Skip to content

Commit

Permalink
Add initial version of embARC Audio
Browse files Browse the repository at this point in the history
  • Loading branch information
kiyaev committed Nov 6, 2019
0 parents commit 6ea35c9
Show file tree
Hide file tree
Showing 311 changed files with 42,207 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*/obj/
*/lib/
*.elf
*.log
*.map
.vscode/*
*rpd.txt
.sc.project*
11 changes: 11 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Copyright (c) 2019 Synopsys, Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3) Neither the name of the Synopsys, Inc., nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
embARC Audio
=====
![](https://embarc.org/images/icons/icon_baremetal.jpg)
###### This repository contains sorce code of voice and audio codecs, test library and documantation.
## Release notes
The following codecs were tuned for using MWDT compiler on processors families ARC EM/HS4xD voice audio:
- BT-CVSD
- G.711
- G.722 Appendix IV
- G.726
- GSM-FR codec
- Sony LDAC encoder

## Package structure
[doc](/doc) - contains the API documentation of the embARC MLI library
[BT-CVSD](/cvsd) - Bluetooth CVSD codec
[G.711](/g711) - G.711 codec
[G.722](/g722) - G.722 codec
[G.726](/g726) - G.726 codec
[GSM-FR](/gsm_fr) - GSM-FR codec
[LDAC encoder](/ldac_encoder) - Sony LDAC encoder
[rules](/rules) - Common parts of makefiles for build and run codecs
[Testlib](/testlib) - test library for benchmarking codecs

## Prerequisites
1. Installed MetaWare Development Toolkit P-2019.09 or newer
2. Valid license for MetaWare Development compiler and debugger
3. HW platform shall support accumulator preshift option (-Xdsp_itu) for codecs based on ITU-T basop, with REMAPITU_T=on.

## Supported platforms
For codecs where conformance (bit exactness tests) test suite is required to pass following ARCv2 DSP platforms are tested:
* em5d voice audio;
* em7d voice audio;
* em9d voice audio;
* em11d voice audio;
* hs45d voice audio;

## Getting started
All codecs fllow general approach to build and run an codec application. For more information see in the README.md of a specific codec.
##### Build and run procedure for default platform:
1. Open command line in folder of specific codec
2. `gmake cleanall`
3. `gmake all`
4. `gmake run`

##### Build and run procedure for specific HW platform
EM9D voice audio HW template is used for example.
1. Open command line in folder of specific codec
2. `gmake cleanall`
3. `gmake all TCF=em9d_voice_audio`
4. `gmake run TCF=em9d_voice_audio`

At the end of successful execution of codec application the output log is expected to contain a string:
`FC: no differences encountered`
## Known Issues
None
2 changes: 2 additions & 0 deletions cvsd/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
testvectors/test_vector_8000_64000.cod
testvectors/test_vector_8000_64000.out
37 changes: 37 additions & 0 deletions cvsd/include/cvsd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright 2019, Synopsys, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-3-Clause license found in
* the LICENSE file in the root directory of this source tree.
*
*/

#ifndef __CVSD_H__
#define __CVSD_H__

#ifdef __cplusplus
extern "C"
{
#endif

#pragma push_align_members(4)
typedef struct cvsd_s
{
int accumulator;
int step_size;
unsigned int output_byte;
} cvsd_t;
#pragma pop_align_members()

short cvsdInit(cvsd_t *cvsd);

void cvsdEncode(cvsd_t *restrict cvsd, const short *restrict in, unsigned int input_len, unsigned int * restrict out);

void cvsdDecode(cvsd_t *restrict cvsd, const unsigned char *restrict in, unsigned int input_len, short *restrict out);

#ifdef __cplusplus
}
#endif

#endif // __CVSD_H__
81 changes: 81 additions & 0 deletions cvsd/make/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#
# Copyright 2019, Synopsys, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-3-Clause license found in
# the LICENSE file in the root directory of this source tree.
#

#################################################
# Global Settings

CODEC_ID_PREFIX = arc_cvsd_codec

#################################################
# Include external configuration files
include ../../rules/init.mk

#################################################
# Targets list

.PHONY: all lib clean cleanall app run run_decoder run_encoder

all: lib app

#################################################
# Library parameters section

LIB_NAME = $(CODEC_ID_PREFIX)
SYMBOLS_FILE = $(CODEC_ID_PREFIX)_symbols.txt

# Setting target
lib: $(BUILD_DIR) $(BINARY_DIR) $(BINARY_DIR)$(PS)$(LIB_NAME).lib $(BINARY_DIR)$(PS)$(LIB_NAME).a
CLEAN_BINS += $(BINARY_DIR)$(PS)$(LIB_NAME).lib $(BINARY_DIR)$(PS)$(LIB_NAME).a

LIB_C_FILES_OPT_SIZE_COMMON =
LIB_C_FILES_OPT_SPEED_COMMON += cvsd.c

include ..$(PS)..$(PS)rules$(PS)common.mk
#################################################
# Application section
app: lib
$(MAKE) -f Makefile.app CODEC_LIB=$(BINARY_DIR)$(PS)$(LIB_NAME).lib

#################################################
# Run application
run_decoder: app
$(MAKE) -f Makefile.app run_decoder CODEC_LIB=$(BINARY_DIR)$(PS)$(LIB_NAME).lib

run_codec: app
$(MAKE) -f Makefile.app run_codec CODEC_LIB=$(BINARY_DIR)$(PS)$(LIB_NAME).lib

run_encoder:app
$(MAKE) -f Makefile.app run_encoder CODEC_LIB=$(BINARY_DIR)$(PS)$(LIB_NAME).lib
run: run_decoder run_encoder run_codec

#################################################
# Size evaluation

size: lib
@echo [Dynamic library size]:
@$(SZ) $(BINARY_DIR)$(PS)$(LIB_NAME).lib
@echo [Static library size]:
@$(SZ) -t $(BINARY_DIR)$(PS)$(LIB_NAME).a

##################################################
# Global VPATH settings

vpath %.c $(LIB_C_FILES_DIRS)
vpath %.h $(LIB_INCLUDE_DIRS)

clean: $(BUILD_DIR)
@echo [Deleting OBJ files]
@$(RM) $(call fix_platform_path, $(CLEAN_OBJS))
@echo [Deleting dependency files]
@$(RM) $(call fix_platform_path, $(CLEAN_DEPENDS))
@$(MAKE) -f Makefile.app clean

cleanall: clean $(BINARY_DIR)
@echo [Deleting binary files]
@$(RM) $(call fix_platform_path, $(CLEAN_BINS))
@$(MAKE) -f Makefile.app cleanall
80 changes: 80 additions & 0 deletions cvsd/make/Makefile.app
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#
# Copyright 2019, Synopsys, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-3-Clause license found in
# the LICENSE file in the root directory of this source tree.
#

#################################################
# Global parameters section
#
# CODEC_ID_PREFIX - target codec <ID> prefix

COMPONENT ?= CVSD_codec

CODEC_ID_PREFIX = arc_cvsd_codec
CODEC_ID_PREFIX_UPPER = ARC_CVSD_CODEC

#################################################
# Include external configuration files
include ../../rules/init.mk

#################################################
# Targets list

.PHONY: all run clean cleanall run run_decoder run_codec

#################################################
# Test app parameters section

APP_NAME = $(CODEC_ID_PREFIX_UPPER)_app.elf

# Setting target
all: $(APP_BUILD_DIR) $(APP_NAME)

CLEAN_BINS += $(APP_NAME)
MAP_NAME += $(EXECUTOR_NAME).map

APP_C_FILES = cvsd_example.c filter.c

include ..$(PS)..$(PS)rules$(PS)common_app.mk

#################################################
# Run application

ifneq (,$(TCF_FLAG))

run_decoder:
@echo [Running decoder of application]
mdb $(DBG_HWFLAGS) $(APP_NAME) -dec -F 256 -i "..$(PS)testvectors$(PS)inp$(PS)test_vector_64000.cod" -o "..$(PS)testvectors$(PS)test_vector_8000.out"
@$(BIN_CMP) $(call fix_platform_path, ..$(PS)testvectors$(PS)test_vector_8000.out ..$(PS)testvectors$(PS)ref$(PS)test_vector_8000.out)

run_encoder:
@echo [Running encoder of application]
mdb $(DBG_HWFLAGS) $(APP_NAME) -enc -F 128 -i "..$(PS)testvectors$(PS)inp$(PS)test_vector_8000.raw" -o "..$(PS)testvectors$(PS)test_vector_64000.cod"
@$(BIN_CMP) $(call fix_platform_path, ..$(PS)testvectors$(PS)test_vector_64000.cod ..$(PS)testvectors$(PS)ref$(PS)test_vector_64000.cod)

run_codec:
@echo [Running transcoder of application]
mdb $(DBG_HWFLAGS) $(APP_NAME) -encdec -F 128 -i "..$(PS)testvectors$(PS)inp$(PS)test_vector_8000.raw" -o "..$(PS)testvectors$(PS)test_vector_8000.out"
@$(BIN_CMP) $(call fix_platform_path, ..$(PS)testvectors$(PS)test_vector_8000.out ..$(PS)testvectors$(PS)ref$(PS)test_vector_8000.out)

run: run_codec run_decoder run_encoder

endif

##################################################
# Global VPATH settings

vpath %.c $(APP_C_FILES_DIRS)
vpath %.h $(APP_INCLUDE_DIRS)

clean: $(APP_BUILD_DIR)
@echo [Deleting OBJ files]
@$(RM) $(call fix_platform_path, $(CLEAN_OBJS))

cleanall: clean
@echo [Deleting binary files]
@$(RM) $(call fix_platform_path, $(CLEAN_BINS))
@$(RM) $(call fix_platform_path, $(call get_file_name, $(APP_NAME)).map)
14 changes: 14 additions & 0 deletions cvsd/make/arc_cvsd_codec_sw_config.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# Copyright 2019, Synopsys, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-3-Clause license found in
# the LICENSE file in the root directory of this source tree.
#

include ..$(PS)..$(PS)rules$(PS)common_build_config.mk

override CFLAGS += -Hfxapi -fvectorize -Hloop_sms -Hinline_threshold=555 -Hunswitch=30 -Hunroll=150 -Hpipeline
override ASMFLAGS +=
override LRFLAGS +=
override LDFLAGS +=
5 changes: 5 additions & 0 deletions cvsd/make/arc_cvsd_codec_symbols.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cvsdInit
cvsdEncode
cvsdDecode
interpolation_x8
decimation_x8
Loading

0 comments on commit 6ea35c9

Please sign in to comment.