├── AMRWB ├── Makefile ├── api │ ├── bitpack.c │ ├── decamrwb.c │ ├── dtx_util.c │ ├── encamrwb.c │ ├── ownamrwb.c │ ├── ownamrwb.h │ ├── scratchmem.h │ ├── tab_util.c │ ├── uscamrwb.c │ └── util.c ├── build.sh ├── include │ ├── amrwb_types.h │ ├── amrwbapi.h │ └── usc.h ├── readme.htm ├── samples │ ├── decoder.c │ ├── decoder.h │ ├── encoder.c │ ├── encoder.h │ ├── util_d.c │ ├── util_d.h │ ├── util_e.c │ └── util_e.h └── vm │ ├── include │ ├── sys │ │ └── vm_types_linux32.h │ ├── vm_thread.h │ └── vm_types.h │ └── src │ └── vm_thread_linux32.c ├── G722.1 ├── Makefile ├── api │ ├── decg722.c │ ├── encg722.c │ ├── g722api.c │ ├── owng722.c │ └── owng722.h ├── build.sh ├── include │ ├── g722.h │ └── g722api.h ├── readme.htm ├── samples │ ├── g722decoder.c │ ├── g722decoder.h │ ├── g722encoder.c │ └── g722encoder.h └── vm │ ├── include │ ├── sys │ │ └── vm_types_linux32.h │ ├── vm_thread.h │ └── vm_types.h │ └── src │ └── vm_thread_linux32.c ├── G723.1 ├── Makefile ├── api │ ├── decg723.c │ ├── encg723.c │ ├── g723ipp.h │ ├── owng723.c │ ├── owng723.h │ └── scratchmem.h ├── build.sh ├── include │ └── g723api.h ├── readme.htm ├── samples │ ├── codec_g723.c │ ├── g723_slin_ex.h │ ├── g723decoder.c │ ├── g723decoder.h │ ├── g723encoder.c │ ├── g723encoder.h │ ├── print_bytes.c │ └── slin_g723_ex.h └── vm │ ├── include │ ├── sys │ │ └── vm_types_linux32.h │ ├── vm_thread.h │ └── vm_types.h │ └── src │ └── vm_thread_linux32.c ├── G728 ├── Makefile ├── api │ ├── adapters.c │ ├── consealg728.c │ ├── g728api.c │ ├── g728tables.c │ ├── g728tables.h │ ├── owng728.c │ ├── owng728.h │ ├── pitchg728.c │ ├── pstg728.c │ ├── scratchmem.h │ └── vq.c ├── build.sh ├── include │ ├── g728.h │ └── g728api.h ├── readme.htm ├── samples │ ├── g728decoder.c │ ├── g728decoder.h │ ├── g728encoder.c │ └── g728encoder.h └── vm │ ├── include │ ├── sys │ │ └── vm_types_linux32.h │ ├── vm_thread.h │ └── vm_types.h │ └── src │ └── vm_thread_linux32.c ├── G729-float ├── Makefile ├── api │ ├── decg729fp.c │ ├── encg729fp.c │ ├── owng729fp.c │ ├── owng729fp.h │ ├── scratchmem.h │ └── usc729fp.c ├── build.sh ├── include │ ├── g729api.h │ └── usc.h ├── readme.htm ├── samples │ ├── codec_g729.c │ ├── decoder.c │ ├── decoder.h │ ├── encoder.c │ ├── encoder.h │ ├── g729_slin_ex.h │ ├── gen_test.c │ ├── my_dec.c │ ├── my_enc.c │ ├── slin_g729_ex.h │ ├── util_d.c │ ├── util_d.h │ ├── util_e.c │ └── util_e.h └── vm │ ├── include │ ├── sys │ │ └── vm_types_linux32.h │ ├── vm_thread.h │ └── vm_types.h │ └── src │ └── vm_thread_linux32.c ├── G729 ├── Makefile ├── api │ ├── decg729.c │ ├── encg729.c │ ├── owng729.c │ ├── owng729.h │ ├── scratchmem.h │ └── uscg729i.c ├── build.sh ├── buildem64t.sh ├── include │ ├── g729api.h │ └── usc.h ├── lem64t.ini ├── linux32.ini ├── readme.htm ├── samples │ ├── decoder.c │ ├── decoder.h │ ├── encoder.c │ ├── encoder.h │ ├── util_d.c │ ├── util_d.h │ ├── util_e.c │ └── util_e.h └── vm │ ├── include │ ├── sys │ │ └── vm_types_linux32.h │ ├── vm_thread.h │ └── vm_types.h │ └── src │ └── vm_thread_linux32.c ├── GSMAMR ├── Makefile ├── api │ ├── bitpack.c │ ├── decgsmamr.c │ ├── dtx_util.c │ ├── encgsmamr.c │ ├── gain_util.c │ ├── owngsmamr.h │ ├── scratchmem.h │ ├── tab_util.c │ ├── uscgsmamr.c │ └── util.c ├── build.sh ├── include │ ├── gsmamr.h │ ├── gsmamr_types.h │ ├── gsmamrapi.h │ └── usc.h ├── readme.htm ├── samples │ ├── decoder.c │ ├── decoder.h │ ├── encoder.c │ ├── encoder.h │ ├── util_d.c │ ├── util_d.h │ ├── util_e.c │ └── util_e.h └── vm │ ├── include │ ├── sys │ │ └── vm_types_linux32.h │ ├── vm_thread.h │ └── vm_types.h │ └── src │ └── vm_thread_linux32.c ├── README.Asterisk ├── debian ├── asterisk-ipp-codecs.dirs ├── asterisk-ipp-codecs.install ├── changelog ├── control └── rules ├── ipplic.htm ├── makeopts ├── runme.sh └── support.txt /AMRWB/Makefile: -------------------------------------------------------------------------------- 1 | ############################### 2 | # DO NOT EDIT BELOW THIS LINE # 3 | ############################### 4 | 5 | # System Specific 6 | INCLSFX=.h 7 | CPPSFX=.c 8 | OBJSFX=.o 9 | EXESFX= 10 | 11 | # IPP Dependencies 12 | IPPINCLS=-I$(IPPROOT)/include 13 | IPPLIBS=-L$(IPPROOT)/sharedlib -lippsc -lipps -lippcore -L$(IPPROOT)/sharedlib/linux32 -lguide 14 | 15 | # Compiler Specifics 16 | CCOPTS=-c -O2 17 | CCDEFS=-D__unix__ -DNDEBUG -DLINUX32 18 | CCINCLS=-I./include -I./vm/include $(IPPINCLS) 19 | 20 | LNKOUT=-o 21 | LNKOPTS= 22 | LNKLIBS=$(IPPLIBS) -lpthread -lm 23 | 24 | build: prepare_directory build_encoder build_decoder; @echo "Done" 25 | 26 | ##### api object ##### 27 | CPPSRC_API=$(wildcard ./api/*$(CPPSFX)) 28 | OBJECT_API=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_API)) 29 | 30 | CPPSRC_VM=$(wildcard ./vm/src/*$(CPPSFX)) 31 | OBJECT_VM=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_VM)) 32 | 33 | ##### link encoder example programs ##### 34 | OBJECT_ENCODER=./bin/amrwbencoder$(EXESFX) 35 | CPPSRC_ENCODER=$(wildcard ./samples/encoder$(CPPSFX) ./samples/util_e$(CPPSFX) ) 36 | OBJSRC_ENCODER=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_ENCODER)) 37 | 38 | build_encoder: $(OBJECT_ENCODER) ; @echo "done encoder" 39 | 40 | $(OBJECT_ENCODER): $(OBJSRC_ENCODER) $(OBJECT_API) $(OBJECT_VM) 41 | $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS) 42 | 43 | ##### link decoder example programs ##### 44 | OBJECT_DECODER=./bin/amrwbdecoder$(EXESFX) 45 | CPPSRC_DECODER=$(wildcard ./samples/decoder$(CPPSFX) ./samples/util_d$(CPPSFX)) 46 | OBJSRC_DECODER=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_DECODER)) 47 | 48 | build_decoder: $(OBJECT_DECODER) ; @echo "done decoder" 49 | 50 | $(OBJECT_DECODER): $(OBJSRC_DECODER) $(OBJECT_API) $(OBJECT_VM) 51 | $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS) 52 | 53 | ##### compile encoder & decoder objects all together ##### 54 | OBJECTS=$(OBJECT_API) $(OBJECT_VM)$(OBJSRC_ENCODER) $(OBJSRC_DECODER) 55 | $(OBJECTS): %$(OBJSFX): %$(CPPSFX) 56 | $(CC) $(CCINCLS) $(CCDEFS) $(CCOPTS) -o$@ $< 57 | 58 | prepare_directory: FORCE 59 | @if test ! -d ./bin; then mkdir ./bin; fi 60 | 61 | clean: FORCE 62 | rm -f $(OBJECTS) 63 | 64 | distclean: clean 65 | rm -f $(OBJECT_ENCODER) $(OBJECT_DECODER) 66 | 67 | FORCE: 68 | 69 | -------------------------------------------------------------------------------- /AMRWB/api/bitpack.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/AMRWB/api/bitpack.c -------------------------------------------------------------------------------- /AMRWB/api/decamrwb.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/AMRWB/api/decamrwb.c -------------------------------------------------------------------------------- /AMRWB/api/dtx_util.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/AMRWB/api/dtx_util.c -------------------------------------------------------------------------------- /AMRWB/api/encamrwb.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/AMRWB/api/encamrwb.c -------------------------------------------------------------------------------- /AMRWB/api/scratchmem.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2002-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // 10 | // Purpose: scratch/stack memory managment header file 11 | // 12 | */ 13 | 14 | #ifndef __SCRATCHMEM_H__ 15 | #define __SCRATCHMEM_H__ 16 | 17 | #if (defined( __ICL ) || defined ( __ECL )) && (defined( _WIN32 ) && !defined( _WIN64 )) 18 | __INLINE 19 | Ipp32s IPP_INT_PTR( const void* ptr ) { 20 | union { 21 | void* Ptr; 22 | Ipp32s Int; 23 | } dd; 24 | dd.Ptr = (void*)ptr; 25 | return dd.Int; 26 | } 27 | 28 | __INLINE 29 | Ipp32u IPP_UINT_PTR( const void* ptr ) { 30 | union { 31 | void* Ptr; 32 | Ipp32u Int; 33 | } dd; 34 | dd.Ptr = (void*)ptr; 35 | return dd.Int; 36 | } 37 | 38 | #elif (defined( __ICL ) || defined ( __ECL )) && defined( _WIN64 ) 39 | __INLINE 40 | Ipp64s IPP_INT_PTR( const void* ptr ) { 41 | union { 42 | void* Ptr; 43 | Ipp64s Int; 44 | } dd; 45 | dd.Ptr = (void*)ptr; 46 | return dd.Int; 47 | } 48 | 49 | __INLINE 50 | Ipp64u IPP_UINT_PTR( const void* ptr ) { 51 | union { 52 | void* Ptr; 53 | Ipp64u Int; 54 | } dd; 55 | dd.Ptr = (void*)ptr; 56 | return dd.Int; 57 | } 58 | 59 | #elif defined( __ICC ) && defined( linux32 ) 60 | __INLINE 61 | Ipp32s IPP_INT_PTR( const void* ptr ) { 62 | union { 63 | void* Ptr; 64 | Ipp32s Int; 65 | } dd; 66 | dd.Ptr = (void*)ptr; 67 | return dd.Int; 68 | } 69 | 70 | __INLINE 71 | Ipp32u IPP_UINT_PTR( const void* ptr ) { 72 | union { 73 | void* Ptr; 74 | Ipp32u Int; 75 | } dd; 76 | dd.Ptr = (void*)ptr; 77 | return dd.Int; 78 | } 79 | 80 | #elif defined ( __ECC ) && defined( linux64 ) 81 | __INLINE 82 | Ipp64s IPP_INT_PTR( const void* ptr ) { 83 | union { 84 | void* Ptr; 85 | Ipp64s Int; 86 | } dd; 87 | dd.Ptr = (void*)ptr; 88 | return dd.Int; 89 | } 90 | 91 | __INLINE 92 | Ipp64u IPP_UINT_PTR( const void* ptr ) { 93 | union { 94 | void* Ptr; 95 | Ipp64u Int; 96 | } dd; 97 | dd.Ptr = (void*)ptr; 98 | return dd.Int; 99 | } 100 | 101 | #else 102 | #define IPP_INT_PTR( ptr ) ( (long)(ptr) ) 103 | #define IPP_UINT_PTR( ptr ) ( (unsigned long)(ptr) ) 104 | #endif 105 | 106 | #define IPP_BYTES_TO_ALIGN(ptr, align) ((-(IPP_INT_PTR(ptr)&((align)-1)))&((align)-1)) 107 | 108 | #define IPP_ALIGNED_PTR(ptr, align) (void*)( (char*)(ptr) + (IPP_BYTES_TO_ALIGN( ptr, align )) ) 109 | 110 | #define IPP_MALLOC_ALIGNED_BYTES 32 111 | 112 | #define IPP_MALLOC_ALIGNED_0BYTES 0 113 | #define IPP_MALLOC_ALIGNED_1BYTES 1 114 | #define IPP_MALLOC_ALIGNED_8BYTES 8 115 | #define IPP_MALLOC_ALIGNED_16BYTES 16 116 | #define IPP_MALLOC_ALIGNED_32BYTES 32 117 | 118 | #define IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength)\ 119 | arrtype arrname##AlignedArrBuff[(arrlength)+IPP_MALLOC_ALIGNED_##align##BYTES/sizeof(arrtype)];\ 120 | arrtype *arrname = (arrtype*)IPP_ALIGNED_PTR(arrname##AlignedArrBuff,align) 121 | 122 | __INLINE void* GetMemory(int arrlen, int sizeOfElem, char **CurPtr) 123 | { 124 | void *ret; 125 | 126 | ret = (void*)IPP_ALIGNED_PTR(*CurPtr,sizeOfElem); 127 | *CurPtr += (arrlen+1)*sizeOfElem; 128 | 129 | return ret; 130 | } 131 | 132 | __INLINE void* GetAlignMemory(int align, int arrlen, int sizeOfElem, char **CurPtr) 133 | { 134 | void *ret; 135 | 136 | ret = (void*)IPP_ALIGNED_PTR(*CurPtr,align); 137 | *CurPtr += (arrlen+align/sizeOfElem)*sizeOfElem; 138 | 139 | return ret; 140 | } 141 | 142 | #if !defined (SCRATCH_OLD) 143 | #if !defined (NO_SCRATCH_MEMORY_USED) 144 | 145 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj)\ 146 | arrtype *arrname = (arrtype *)GetAlignMemory(align,arrlength,sizeof(arrtype),&(obj)->Mem.CurPtr) 147 | 148 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj)\ 149 | arrtype *arrname = (arrtype *)GetMemory(arrlength,sizeof(arrtype),&(obj)->Mem.CurPtr) 150 | 151 | #else 152 | 153 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj)\ 154 | IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength) 155 | 156 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj)\ 157 | arrtype arrname[arrlength] 158 | 159 | 160 | #endif 161 | #else 162 | #if !defined (NO_SCRATCH_MEMORY_USED) 163 | #define PRE_ALLOC_ARRAY(align,arrtype,arrname,arrlength)\ 164 | arrtype *arrname 165 | 166 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj)\ 167 | arrname = (arrtype*)IPP_ALIGNED_PTR((obj)->Mem.CurPtr,align);\ 168 | (obj)->Mem.CurPtr += ((arrlength)+IPP_MALLOC_ALIGNED_##align##BYTES/sizeof(arrtype))*sizeof(arrtype) 169 | 170 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj)\ 171 | arrname = (arrtype*)IPP_ALIGNED_PTR((obj)->Mem.CurPtr,sizeof(arrtype));\ 172 | (obj)->Mem.CurPtr += ((arrlength)+1)*sizeof(arrtype) 173 | 174 | #else 175 | #define PRE_ALLOC_ARRAY(align,arrtype,arrname,arrlength)\ 176 | IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength) 177 | 178 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj) 179 | 180 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj) 181 | 182 | 183 | #endif 184 | #endif 185 | 186 | #if !defined (NO_SCRATCH_MEMORY_USED) 187 | #if defined(__ICC) || defined( __ICL ) || defined ( __ECL ) 188 | #pragma message("Scratch memory enabled") 189 | #endif 190 | #define LOCAL_ARRAY_FREE(arrtype,arrname,arrlength,obj)\ 191 | arrname=NULL;\ 192 | (obj)->Mem.CurPtr -= ((arrlength)+1)*sizeof(arrtype) 193 | 194 | #define LOCAL_ALIGN_ARRAY_FREE(align,arrtype,arrname,arrlength,obj)\ 195 | arrname=NULL;\ 196 | (obj)->Mem.CurPtr -= ((arrlength)+IPP_MALLOC_ALIGNED_##align##BYTES/sizeof(arrtype))*sizeof(arrtype) 197 | 198 | #define CLEAR_SCRATCH_MEMORY(obj)\ 199 | (obj)->Mem.CurPtr = (obj)->Mem.base 200 | 201 | #define OPEN_SCRATCH_BLOCK(obj)\ 202 | (obj)->Mem.VecPtr[(obj)->Mem.offset] = IPP_INT_PTR((obj)->Mem.CurPtr);\ 203 | (obj)->Mem.offset++ 204 | 205 | #define CLOSE_SCRATCH_BLOCK(obj)\ 206 | (obj)->Mem.offset--;\ 207 | (obj)->Mem.CurPtr = (char *)(obj)->Mem.VecPtr[(obj)->Mem.offset] 208 | #else 209 | #define LOCAL_ARRAY_FREE(arrtype,arrname,arrlength,obj) 210 | 211 | #define LOCAL_ALIGN_ARRAY_FREE(align,arrtype,arrname,arrlength,obj) 212 | 213 | #define CLEAR_SCRATCH_MEMORY(obj) 214 | 215 | #define OPEN_SCRATCH_BLOCK(obj) 216 | 217 | #define CLOSE_SCRATCH_BLOCK(obj) 218 | #endif 219 | 220 | #endif /*__SCRATCHMEM_H__*/ 221 | -------------------------------------------------------------------------------- /AMRWB/api/tab_util.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/AMRWB/api/tab_util.c -------------------------------------------------------------------------------- /AMRWB/api/util.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/AMRWB/api/util.c -------------------------------------------------------------------------------- /AMRWB/build.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # 4 | # Usage: build.sh {gcc} 5 | # 6 | 7 | IPPENV=${IPPROOT}/tools/env/ippvars32.sh 8 | 9 | if [ ! -x "${IPPENV}" ]; then 10 | IPPENV=/opt/intel/ipp41/ia32_itanium/tools/env/ippvars32.sh 11 | fi 12 | 13 | if [ ! -x "${IPPENV}" ]; then 14 | IPPENV=/opt/intel/ipp41_eval/ia32_itanium/tools/env/ippvars32.sh 15 | fi 16 | 17 | if [ ! -x "${IPPENV}" ]; then 18 | @echo -e "*************************************************************************" 19 | @echo -e "Intel(R) IPP is not found!" 20 | @echo -e "Please install Intel(R) IPP or set IPPROOT environment variable correctly." 21 | @echo -e "*************************************************************************" 22 | exit 23 | fi 24 | 25 | ARG=$1 26 | 27 | CC=gcc 28 | CXX=g++ 29 | 30 | if [ "${ARG}" == "" ]; then 31 | 32 | CCFIND=/opt/intel/compiler60/ia32/bin/iccvars.sh 33 | if [ -x "${CCFIND}" ]; then 34 | CCENV=${CCFIND} 35 | fi 36 | 37 | CCFIND=/opt/intel/compiler70/ia32/bin/iccvars.sh 38 | if [ -x "${CCFIND}" ]; then 39 | CCENV=${CCFIND} 40 | fi 41 | 42 | CCFIND=/opt/intel/compiler80/ia32/bin/iccvars.sh 43 | if [ -x "${CCFIND}" ]; then 44 | CCENV=${CCFIND} 45 | fi 46 | 47 | CCFIND=/opt/intel_cc_80/bin/iccvars.sh 48 | if [ -x "${CCFIND}" ]; then 49 | CCENV=${CCFIND} 50 | fi 51 | 52 | if [ "${CCENV}" ]; then 53 | . ${CCENV} 54 | CC=icc 55 | CXX=icc 56 | fi 57 | 58 | fi 59 | 60 | . ${IPPENV} 61 | 62 | make clean 63 | make CC=${CC} CXX=${CXX} 64 | -------------------------------------------------------------------------------- /AMRWB/include/amrwb_types.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/AMRWB/include/amrwb_types.h -------------------------------------------------------------------------------- /AMRWB/include/amrwbapi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/AMRWB/include/amrwbapi.h -------------------------------------------------------------------------------- /AMRWB/include/usc.h: -------------------------------------------------------------------------------- 1 | /* 2 | // INTEL CORPORATION PROPRIETARY INFORMATION 3 | // This software is supplied under the terms of a license agreement or 4 | // nondisclosure agreement with Intel Corporation and may not be copied 5 | // or disclosed except in accordance with the terms of that agreement. 6 | // Copyright(c) 2004 Intel Corporation. All Rights Reserved. 7 | // 8 | // Unified Speech Codec sample interface main header. 9 | // Structures and functions declarations. 10 | */ 11 | #ifndef __USC_H__ 12 | #define __USC_H__ 13 | 14 | #if defined( USC_W32DLL ) 15 | #if defined( _MSC_VER ) || defined( __ICL ) || defined ( __ECL ) 16 | #define USCFUN __declspec(dllexport) 17 | #else 18 | #define USCFUN extern 19 | #endif 20 | #else 21 | #define USCFUN extern 22 | #endif 23 | 24 | /* USC error code */ 25 | typedef enum { 26 | /* errors: negative response */ 27 | USC_NotInitialized = -8, 28 | USC_InvalidHandler = -7, 29 | USC_NoOperation = -6, 30 | USC_UnsupportedPCMType = -5, 31 | USC_UnsupportedBitRate = -4, 32 | USC_UnsupportedFrameType = -3, 33 | USC_UnsupportedVADType = -2, 34 | USC_BadDataPointer = -1, 35 | USC_NoError = 0, 36 | /* warnings: positive response */ 37 | USC_StateNotChanged = 1 38 | }USC_Status; 39 | 40 | /* USC codec modes, (may be alternated) */ 41 | typedef struct { 42 | int bitrate; /* codec dependent bitrate index */ 43 | int truncate; /* 0 - no truncate */ 44 | int vad; /* 0 - disabled, otherwize vad type (1,2, more if any) */ 45 | int hpf; /* high pass filter: 1- on, 0- off */ 46 | int pf; /* post filter: 1- on, 0- off */ 47 | }USC_Modes; 48 | 49 | 50 | /* USC codec option */ 51 | typedef struct { 52 | int direction; /* 0 - encode only, 1 - decode only, 2 - both */ 53 | int law; /* 0 - pcm, 1 - aLaw, 2 -muLaw */ 54 | USC_Modes modes; 55 | }USC_Option; 56 | 57 | /* USC PCM stream type */ 58 | typedef struct { 59 | int sample_frequency; /* sample rate in Hz */ 60 | int bitPerSample; /* bit per sample */ 61 | }USC_PCMType; 62 | 63 | /* USC codec information */ 64 | typedef struct { 65 | const char *name; /* codec name */ 66 | int framesize; /* PCM frame size in bytes */ 67 | int maxbitsize; /* bitstream max frame size in bytes */ 68 | USC_Option *params; /* what is supported */ 69 | USC_PCMType *pcmType; /* codec audio source */ 70 | }USC_CodecInfo; 71 | 72 | 73 | /* USC memory banks */ 74 | typedef struct { 75 | char *pMem; 76 | int nbytes; 77 | }USC_MemBank; 78 | 79 | /* USC PCM stream */ 80 | typedef struct { 81 | char *pBuffer; 82 | int nbytes; /* pcm data size in byte */ 83 | USC_PCMType pcmType; 84 | int bitrate; /* codec dependent bitrate index */ 85 | }USC_PCMStream; 86 | 87 | /* USC compressed bits */ 88 | typedef struct { 89 | char *pBuffer; 90 | int nbytes; /* bitstream size in byte */ 91 | int frametype; /* codec specific frame type (transmission frame type) */ 92 | int bitrate; /* codec dependent bitrate index */ 93 | }USC_Bitstream; 94 | 95 | typedef void* USC_Handle; 96 | 97 | /* USC functions table. 98 | Each codec should supply a function table structure, which is derived from this base table. 99 | Codec table is to be specified for each codec by name as follows: 100 | USC__Fxns, for example USC_g729_Fxns. 101 | The typical usage model: 102 | - Questing a codec about memory requirement using MemAlloc() function 103 | which returns a memory banks description table with required bank sizes. 104 | - Use Init() function to create codec instance according to modes (vad, rate etc) requested. 105 | Codec handle is returned. Thus different instances of particular codec may be created 106 | and used in parallel. 107 | - Encode(), Decode() - compression/decompression functions. 108 | - GetInfo() - inquire codec state or codec requirement. 109 | */ 110 | 111 | typedef struct { 112 | 113 | /* Get_Info() - quest codec information 114 | General inquiry is possible without initialization when handle==NULL. 115 | */ 116 | USC_Status (*GetInfo)(USC_Handle handle, USC_CodecInfo *pInfo); 117 | 118 | /* NumAlloc() - inquiring number of memory buffers 119 | options - codec control. 120 | nbanks - number of table entries (size of pBanks table). 121 | */ 122 | USC_Status (*NumAlloc)(const USC_Option *options, int *nbanks); 123 | 124 | /* MemAlloc() - inquiring information about memory requirement 125 | (buffers to be allocated) 126 | options - codec control. 127 | pBanks - input table of size nbanks to be filled with memory requirement 128 | (pMem=NULL if to be allocated ) 129 | */ 130 | USC_Status (*MemAlloc)(const USC_Option *options, USC_MemBank *pBanks); 131 | 132 | /* Init() - create codec handle and set it to initial state 133 | options - codec control 134 | pBanks - allocated memory banks of number as after MemAlloc 135 | handle - pointer to the output codec instance pointer 136 | */ 137 | USC_Status (*Init)(const USC_Option *options, const USC_MemBank *pBanks, USC_Handle *handle ); 138 | 139 | /* Reinit() - set codec to initial state 140 | handle - pointer to the input codec instance pointer 141 | */ 142 | USC_Status (*Reinit)(USC_Modes *modes, USC_Handle handle ); 143 | 144 | /* Control() - alternate codec modes 145 | The only modes were set on Init() may be alternated. 146 | modes - what modes to alternate 147 | handle - pointer to the input codec instance pointer 148 | */ 149 | USC_Status (*Control)(USC_Handle handle, USC_Modes *modes); 150 | 151 | /* Encode() 152 | in - input audio stream (pcm) pointer, 153 | out - output bitstream pointer , 154 | */ 155 | USC_Status (*Encode)(USC_Handle handle, const USC_PCMStream *in, USC_Bitstream *out); 156 | 157 | /* Decode() 158 | in - input bitstream pointer, 159 | out - output audio stream (pcm) pointer, 160 | */ 161 | USC_Status (*Decode)(USC_Handle handle, const USC_Bitstream *in, USC_PCMStream *out); 162 | 163 | } USC_stdFxns; 164 | 165 | /* 166 | USC extended function table 167 | */ 168 | 169 | typedef struct { 170 | USC_stdFxns std; 171 | /* function extension, any */ 172 | }USC_Fxns; 173 | 174 | #endif /* __USC_H__ */ 175 | -------------------------------------------------------------------------------- /AMRWB/readme.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/AMRWB/readme.htm -------------------------------------------------------------------------------- /AMRWB/samples/decoder.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/AMRWB/samples/decoder.c -------------------------------------------------------------------------------- /AMRWB/samples/decoder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/AMRWB/samples/decoder.h -------------------------------------------------------------------------------- /AMRWB/samples/encoder.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/AMRWB/samples/encoder.c -------------------------------------------------------------------------------- /AMRWB/samples/encoder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/AMRWB/samples/encoder.h -------------------------------------------------------------------------------- /AMRWB/samples/util_d.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/AMRWB/samples/util_d.c -------------------------------------------------------------------------------- /AMRWB/samples/util_d.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/AMRWB/samples/util_d.h -------------------------------------------------------------------------------- /AMRWB/samples/util_e.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/AMRWB/samples/util_e.c -------------------------------------------------------------------------------- /AMRWB/samples/util_e.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/AMRWB/samples/util_e.h -------------------------------------------------------------------------------- /AMRWB/vm/include/sys/vm_types_linux32.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Linux types header. 11 | */ 12 | #ifdef LINUX32 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | typedef unsigned long vm_var32; 19 | typedef unsigned long long vm_var64; 20 | typedef char vm_char; 21 | 22 | #define VM_ALIGN_DECL(X,Y) Y __attribute__ ((aligned(X))) 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | /* vm_thread.h */ 29 | typedef struct { 30 | pthread_t handle; 31 | int is_valid; 32 | } vm_thread; 33 | 34 | /* vm_event.h */ 35 | typedef struct { 36 | pthread_cond_t cond; 37 | pthread_mutex_t mutex; 38 | int manual; 39 | int state; 40 | } vm_event; 41 | 42 | /* vm_mmap.h */ 43 | typedef struct { 44 | int fd; 45 | void *address; 46 | size_t sizet; 47 | } vm_mmap; 48 | 49 | /* vm_mutex.h */ 50 | typedef struct { 51 | pthread_mutex_t handle; 52 | int is_valid; 53 | } vm_mutex; 54 | 55 | /* vm_semaphore.h */ 56 | typedef struct { 57 | pthread_cond_t cond; 58 | pthread_mutex_t mutex; 59 | int count; 60 | } vm_semaphore; 61 | 62 | #ifdef __cplusplus 63 | }; 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /AMRWB/vm/include/vm_thread.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Threading header. 11 | */ 12 | #ifndef __VM_THREAD_H__ 13 | #define __VM_THREAD_H__ 14 | #include "vm_types.h" 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /* IMPORTANT: 21 | * The thread return value is always saved for the calling thread to 22 | * collect. To avoid memory leak, always vm_thread_wait() for the 23 | * child thread to terminate in the calling thread. 24 | */ 25 | 26 | typedef void *(*vm_thread_callback)(void *); 27 | 28 | typedef enum { 29 | VM_THREAD_PRIORITY_HIGHEST, 30 | VM_THREAD_PRIORITY_HIGH, 31 | VM_THREAD_PRIORITY_NORMAL, 32 | VM_THREAD_PRIORITY_LOW, 33 | VM_THREAD_PRIORITY_LOWEST 34 | } vm_thread_priority; 35 | 36 | /* Set the thread handler to an invalid value */ 37 | void vm_thread_set_invalid(vm_thread *thread); 38 | 39 | /* Verify if the thread handler is valid */ 40 | int vm_thread_is_valid(vm_thread *thread); 41 | 42 | /* Create a thread. The thread is set to run at the call. 43 | Return 1 if successful */ 44 | int vm_thread_create(vm_thread *thread,vm_thread_callback func,void *arg); 45 | 46 | /* Wait until a thread exists. */ 47 | void vm_thread_wait(vm_thread *thread); 48 | 49 | /* Terminate a thread with blocking */ 50 | void vm_thread_terminate(vm_thread *thread); 51 | 52 | /* Terminate the current thread */ 53 | void vm_thread_exit(void); 54 | 55 | /* Set thread priority. Return 1 if successful */ 56 | int vm_thread_set_priority(vm_thread *thread, vm_thread_priority priority); 57 | 58 | #ifdef __cplusplus 59 | }; 60 | #endif 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /AMRWB/vm/include/vm_types.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Common types header. 11 | */ 12 | #ifndef __VM_TYPES_H__ 13 | #define __VM_TYPES_H__ 14 | #ifdef WIN32 15 | #include "sys/vm_types_win32.h" 16 | #elif LINUX32 17 | #include "sys/vm_types_linux32.h" 18 | #endif 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | typedef vm_var64 vm_sizet; 25 | 26 | #define VM_ALIGN16_DECL(X) VM_ALIGN_DECL(16,X) 27 | #define VM_ALIGN32_DECL(X) VM_ALIGN_DECL(32,X) 28 | 29 | #ifdef __cplusplus 30 | }; 31 | #endif 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /AMRWB/vm/src/vm_thread_linux32.c: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Threading primitives for Linux. 11 | */ 12 | #ifdef LINUX32 13 | #include 14 | #include 15 | #include 16 | #include "vm_thread.h" 17 | 18 | /* Set the thread handler an invalid value */ 19 | void vm_thread_set_invalid(vm_thread *thread) 20 | { 21 | thread->is_valid=0; 22 | } 23 | 24 | /* Verify if the thread handler is valid */ 25 | int vm_thread_is_valid(vm_thread *thread) 26 | { 27 | return thread->is_valid; 28 | } 29 | 30 | /* Create a thread. Return 1 if success */ 31 | int vm_thread_create(vm_thread *thread, 32 | void *(*vm_thread_func)(void *),void *arg) 33 | { 34 | pthread_attr_t attr; 35 | pthread_attr_init(&attr); 36 | pthread_attr_setschedpolicy(&attr,geteuid()?SCHED_OTHER:SCHED_RR); 37 | thread->is_valid=!pthread_create(&thread->handle,&attr,vm_thread_func,arg); 38 | pthread_attr_destroy(&attr); 39 | vm_thread_set_priority(thread, VM_THREAD_PRIORITY_LOWEST); 40 | return thread->is_valid; 41 | } 42 | 43 | /* Terminate the current thread */ 44 | void vm_thread_exit(void) 45 | { 46 | pthread_exit(0); 47 | } 48 | 49 | /* Set thread priority, return 1 if successful */ 50 | int vm_thread_set_priority(vm_thread *thread, vm_thread_priority priority) 51 | { 52 | int policy, pmin, pmax, pmean; 53 | struct sched_param param; 54 | 55 | if (!thread->is_valid) return 0; 56 | pthread_getschedparam(thread->handle,&policy,¶m); 57 | 58 | pmin=sched_get_priority_min(policy); 59 | pmax=sched_get_priority_max(policy); 60 | pmean=(pmin+pmax)/2; 61 | 62 | switch (priority) { 63 | case VM_THREAD_PRIORITY_HIGHEST: 64 | param.sched_priority=pmax; break; 65 | case VM_THREAD_PRIORITY_LOWEST: 66 | param.sched_priority=pmin; break; 67 | case VM_THREAD_PRIORITY_NORMAL: 68 | param.sched_priority=pmean; break; 69 | case VM_THREAD_PRIORITY_HIGH: 70 | param.sched_priority=(pmax+pmean)/2; break; 71 | case VM_THREAD_PRIORITY_LOW: 72 | param.sched_priority=(pmin+pmean)/2; break; 73 | } 74 | 75 | return !pthread_setschedparam(thread->handle,policy,¶m); 76 | } 77 | 78 | /* Wait until a thread exists */ 79 | void vm_thread_wait(vm_thread *thread) 80 | { 81 | if (thread->is_valid) { 82 | pthread_join(thread->handle,NULL); 83 | thread->is_valid=0; 84 | } 85 | } 86 | 87 | /* Terminate a thread */ 88 | void vm_thread_terminate(vm_thread *thread) 89 | { 90 | if (thread->is_valid) { 91 | pthread_cancel(thread->handle); 92 | vm_thread_wait(thread); 93 | } 94 | } 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /G722.1/Makefile: -------------------------------------------------------------------------------- 1 | ############################### 2 | # DO NOT EDIT BELOW THIS LINE # 3 | ############################### 4 | 5 | # System Specific 6 | INCLSFX=.h 7 | CPPSFX=.c 8 | OBJSFX=.o 9 | EXESFX= 10 | 11 | # IPP Dependencies 12 | IPPINCLS=-I$(IPPROOT)/include 13 | IPPLIBS=-L$(IPPROOT)/sharedlib -lippsc -lipps -lippcore -L$(IPPROOT)/sharedlib/linux32 -lguide 14 | 15 | # Compiler Specifics 16 | CCOPTS=-c -O2 17 | CCDEFS=-D__unix__ -DNDEBUG -DLINUX32 18 | CCINCLS=-I./include -I./vm/include $(IPPINCLS) 19 | 20 | LNKOUT=-o 21 | LNKOPTS= 22 | LNKLIBS=$(IPPLIBS) -lpthread 23 | 24 | build: prepare_directory build_encoder build_decoder; @echo "Done" 25 | 26 | ##### api object ##### 27 | CPPSRC_API=$(wildcard ./api/*$(CPPSFX)) 28 | OBJECT_API=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_API)) 29 | 30 | CPPSRC_VM=$(wildcard ./vm/src/*$(CPPSFX)) 31 | OBJECT_VM=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_VM)) 32 | 33 | ##### link encoder example programs ##### 34 | OBJECT_ENCODER=./bin/g722encoder$(EXESFX) 35 | CPPSRC_ENCODER=$(wildcard ./samples/g722encoder$(CPPSFX)) 36 | OBJSRC_ENCODER=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_ENCODER)) 37 | 38 | build_encoder: $(OBJECT_ENCODER) ; @echo "done encoder" 39 | 40 | $(OBJECT_ENCODER): $(OBJSRC_ENCODER) $(OBJECT_API) $(OBJECT_VM) 41 | $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS) 42 | 43 | ##### link decoder example programs ##### 44 | OBJECT_DECODER=./bin/g722decoder$(EXESFX) 45 | CPPSRC_DECODER=$(wildcard ./samples/g722decoder$(CPPSFX)) 46 | OBJSRC_DECODER=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_DECODER)) 47 | 48 | build_decoder: $(OBJECT_DECODER) ; @echo "done decoder" 49 | 50 | $(OBJECT_DECODER): $(OBJSRC_DECODER) $(OBJECT_API) $(OBJECT_VM) 51 | $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS) 52 | 53 | ##### compile encoder & decoder objects all together ##### 54 | OBJECTS=$(OBJECT_API) $(OBJECT_VM) $(OBJSRC_ENCODER) $(OBJSRC_DECODER) 55 | $(OBJECTS): %$(OBJSFX): %$(CPPSFX) 56 | $(CC) $(CCINCLS) $(CCDEFS) $(CCOPTS) -o$@ $< 57 | 58 | prepare_directory: FORCE 59 | @if test ! -d ./bin; then mkdir ./bin; fi 60 | 61 | clean: FORCE 62 | rm -f $(OBJECTS) 63 | 64 | distclean: clean 65 | rm -f $(OBJECT_ENCODER) $(OBJECT_DECODER) 66 | 67 | FORCE: 68 | 69 | -------------------------------------------------------------------------------- /G722.1/api/decg722.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G722.1/api/decg722.c -------------------------------------------------------------------------------- /G722.1/api/encg722.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G722.1/api/encg722.c -------------------------------------------------------------------------------- /G722.1/api/g722api.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G722.1/api/g722api.c -------------------------------------------------------------------------------- /G722.1/api/owng722.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G722.1/api/owng722.c -------------------------------------------------------------------------------- /G722.1/api/owng722.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G722.1/api/owng722.h -------------------------------------------------------------------------------- /G722.1/build.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # 4 | # Usage: build.sh {gcc} 5 | # 6 | 7 | IPPENV=${IPPROOT}/tools/env/ippvars32.sh 8 | 9 | if [ ! -x "${IPPENV}" ]; then 10 | IPPENV=/opt/intel/ipp41/ia32_itanium/tools/env/ippvars32.sh 11 | fi 12 | 13 | if [ ! -x "${IPPENV}" ]; then 14 | IPPENV=/opt/intel/ipp41_eval/ia32_itanium/tools/env/ippvars32.sh 15 | fi 16 | 17 | if [ ! -x "${IPPENV}" ]; then 18 | @echo -e "*************************************************************************" 19 | @echo -e "Intel(R) IPP is not found!" 20 | @echo -e "Please install Intel(R) IPP or set IPPROOT environment variable correctly." 21 | @echo -e "*************************************************************************" 22 | exit 23 | fi 24 | 25 | ARG=$1 26 | 27 | CC=gcc 28 | CXX=g++ 29 | 30 | if [ "${ARG}" == "" ]; then 31 | 32 | CCFIND=/opt/intel/compiler60/ia32/bin/iccvars.sh 33 | if [ -x "${CCFIND}" ]; then 34 | CCENV=${CCFIND} 35 | fi 36 | 37 | CCFIND=/opt/intel/compiler70/ia32/bin/iccvars.sh 38 | if [ -x "${CCFIND}" ]; then 39 | CCENV=${CCFIND} 40 | fi 41 | 42 | CCFIND=/opt/intel/compiler80/ia32/bin/iccvars.sh 43 | if [ -x "${CCFIND}" ]; then 44 | CCENV=${CCFIND} 45 | fi 46 | 47 | CCFIND=/opt/intel_cc_80/bin/iccvars.sh 48 | if [ -x "${CCFIND}" ]; then 49 | CCENV=${CCFIND} 50 | fi 51 | 52 | if [ "${CCENV}" ]; then 53 | . ${CCENV} 54 | CC=icc 55 | CXX=icc 56 | fi 57 | 58 | fi 59 | 60 | . ${IPPENV} 61 | 62 | make clean 63 | make CC=${CC} CXX=${CXX} 64 | -------------------------------------------------------------------------------- /G722.1/include/g722.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G722.1/include/g722.h -------------------------------------------------------------------------------- /G722.1/include/g722api.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G722.1/include/g722api.h -------------------------------------------------------------------------------- /G722.1/readme.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G722.1/readme.htm -------------------------------------------------------------------------------- /G722.1/samples/g722decoder.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G722.1/samples/g722decoder.c -------------------------------------------------------------------------------- /G722.1/samples/g722decoder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G722.1/samples/g722decoder.h -------------------------------------------------------------------------------- /G722.1/samples/g722encoder.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G722.1/samples/g722encoder.c -------------------------------------------------------------------------------- /G722.1/samples/g722encoder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G722.1/samples/g722encoder.h -------------------------------------------------------------------------------- /G722.1/vm/include/sys/vm_types_linux32.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Linux types header. 11 | */ 12 | #ifdef LINUX32 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | typedef unsigned long vm_var32; 19 | typedef unsigned long long vm_var64; 20 | typedef char vm_char; 21 | 22 | #define VM_ALIGN_DECL(X,Y) Y __attribute__ ((aligned(X))) 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | /* vm_thread.h */ 29 | typedef struct { 30 | pthread_t handle; 31 | int is_valid; 32 | } vm_thread; 33 | 34 | /* vm_event.h */ 35 | typedef struct { 36 | pthread_cond_t cond; 37 | pthread_mutex_t mutex; 38 | int manual; 39 | int state; 40 | } vm_event; 41 | 42 | /* vm_mmap.h */ 43 | typedef struct { 44 | int fd; 45 | void *address; 46 | size_t sizet; 47 | } vm_mmap; 48 | 49 | /* vm_mutex.h */ 50 | typedef struct { 51 | pthread_mutex_t handle; 52 | int is_valid; 53 | } vm_mutex; 54 | 55 | /* vm_semaphore.h */ 56 | typedef struct { 57 | pthread_cond_t cond; 58 | pthread_mutex_t mutex; 59 | int count; 60 | } vm_semaphore; 61 | 62 | #ifdef __cplusplus 63 | }; 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /G722.1/vm/include/vm_thread.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Threading header. 11 | */ 12 | #ifndef __VM_THREAD_H__ 13 | #define __VM_THREAD_H__ 14 | #include "vm_types.h" 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /* IMPORTANT: 21 | * The thread return value is always saved for the calling thread to 22 | * collect. To avoid memory leak, always vm_thread_wait() for the 23 | * child thread to terminate in the calling thread. 24 | */ 25 | 26 | typedef void *(*vm_thread_callback)(void *); 27 | 28 | typedef enum { 29 | VM_THREAD_PRIORITY_HIGHEST, 30 | VM_THREAD_PRIORITY_HIGH, 31 | VM_THREAD_PRIORITY_NORMAL, 32 | VM_THREAD_PRIORITY_LOW, 33 | VM_THREAD_PRIORITY_LOWEST 34 | } vm_thread_priority; 35 | 36 | /* Set the thread handler to an invalid value */ 37 | void vm_thread_set_invalid(vm_thread *thread); 38 | 39 | /* Verify if the thread handler is valid */ 40 | int vm_thread_is_valid(vm_thread *thread); 41 | 42 | /* Create a thread. The thread is set to run at the call. 43 | Return 1 if successful */ 44 | int vm_thread_create(vm_thread *thread,vm_thread_callback func,void *arg); 45 | 46 | /* Wait until a thread exists. */ 47 | void vm_thread_wait(vm_thread *thread); 48 | 49 | /* Terminate a thread with blocking */ 50 | void vm_thread_terminate(vm_thread *thread); 51 | 52 | /* Terminate the current thread */ 53 | void vm_thread_exit(void); 54 | 55 | /* Set thread priority. Return 1 if successful */ 56 | int vm_thread_set_priority(vm_thread *thread, vm_thread_priority priority); 57 | 58 | #ifdef __cplusplus 59 | }; 60 | #endif 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /G722.1/vm/include/vm_types.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Common types header. 11 | */ 12 | #ifndef __VM_TYPES_H__ 13 | #define __VM_TYPES_H__ 14 | #ifdef WIN32 15 | #include "sys/vm_types_win32.h" 16 | #elif LINUX32 17 | #include "sys/vm_types_linux32.h" 18 | #endif 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | typedef vm_var64 vm_sizet; 25 | 26 | #define VM_ALIGN16_DECL(X) VM_ALIGN_DECL(16,X) 27 | #define VM_ALIGN32_DECL(X) VM_ALIGN_DECL(32,X) 28 | 29 | #ifdef __cplusplus 30 | }; 31 | #endif 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /G722.1/vm/src/vm_thread_linux32.c: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Threading primitives for Linux. 11 | */ 12 | #ifdef LINUX32 13 | #include 14 | #include 15 | #include 16 | #include "vm_thread.h" 17 | 18 | /* Set the thread handler an invalid value */ 19 | void vm_thread_set_invalid(vm_thread *thread) 20 | { 21 | thread->is_valid=0; 22 | } 23 | 24 | /* Verify if the thread handler is valid */ 25 | int vm_thread_is_valid(vm_thread *thread) 26 | { 27 | return thread->is_valid; 28 | } 29 | 30 | /* Create a thread. Return 1 if success */ 31 | int vm_thread_create(vm_thread *thread, 32 | void *(*vm_thread_func)(void *),void *arg) 33 | { 34 | pthread_attr_t attr; 35 | pthread_attr_init(&attr); 36 | pthread_attr_setschedpolicy(&attr,geteuid()?SCHED_OTHER:SCHED_RR); 37 | thread->is_valid=!pthread_create(&thread->handle,&attr,vm_thread_func,arg); 38 | pthread_attr_destroy(&attr); 39 | vm_thread_set_priority(thread, VM_THREAD_PRIORITY_LOWEST); 40 | return thread->is_valid; 41 | } 42 | 43 | /* Terminate the current thread */ 44 | void vm_thread_exit(void) 45 | { 46 | pthread_exit(0); 47 | } 48 | 49 | /* Set thread priority, return 1 if successful */ 50 | int vm_thread_set_priority(vm_thread *thread, vm_thread_priority priority) 51 | { 52 | int policy, pmin, pmax, pmean; 53 | struct sched_param param; 54 | 55 | if (!thread->is_valid) return 0; 56 | pthread_getschedparam(thread->handle,&policy,¶m); 57 | 58 | pmin=sched_get_priority_min(policy); 59 | pmax=sched_get_priority_max(policy); 60 | pmean=(pmin+pmax)/2; 61 | 62 | switch (priority) { 63 | case VM_THREAD_PRIORITY_HIGHEST: 64 | param.sched_priority=pmax; break; 65 | case VM_THREAD_PRIORITY_LOWEST: 66 | param.sched_priority=pmin; break; 67 | case VM_THREAD_PRIORITY_NORMAL: 68 | param.sched_priority=pmean; break; 69 | case VM_THREAD_PRIORITY_HIGH: 70 | param.sched_priority=(pmax+pmean)/2; break; 71 | case VM_THREAD_PRIORITY_LOW: 72 | param.sched_priority=(pmin+pmean)/2; break; 73 | } 74 | 75 | return !pthread_setschedparam(thread->handle,policy,¶m); 76 | } 77 | 78 | /* Wait until a thread exists */ 79 | void vm_thread_wait(vm_thread *thread) 80 | { 81 | if (thread->is_valid) { 82 | pthread_join(thread->handle,NULL); 83 | thread->is_valid=0; 84 | } 85 | } 86 | 87 | /* Terminate a thread */ 88 | void vm_thread_terminate(vm_thread *thread) 89 | { 90 | if (thread->is_valid) { 91 | pthread_cancel(thread->handle); 92 | vm_thread_wait(thread); 93 | } 94 | } 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /G723.1/Makefile: -------------------------------------------------------------------------------- 1 | ############################### 2 | # DO NOT EDIT BELOW THIS LINE # 3 | ############################### 4 | 5 | include ../makeopts 6 | 7 | # Compiler Specifics 8 | CCOPTS=-c $(OPTIMIZE) 9 | CCDEFS=-D__unix__ -DNDEBUG -DNO_SCRATCH_MEMORY_USED -DLINUX32 10 | CCINCLS=-I./include -I./vm/include $(IPPINCLS) 11 | 12 | LNKOUT=-o 13 | LNKOPTS= 14 | LNKLIBS=$(IPPLIBS) -lpthread $(ICCLIBS) 15 | 16 | build: prepare_directory build_codec; @echo "Done" 17 | SOLINKOPTS=-shared $(LDFLAGS) -Xlinker -x 18 | 19 | 20 | ##### api object ##### 21 | CPPSRC_API=$(wildcard ./api/*$(CPPSFX)) 22 | OBJECT_API=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_API)) 23 | 24 | CPPSRC_VM=$(wildcard ./vm/src/*$(CPPSFX)) 25 | OBJECT_VM=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_VM)) 26 | 27 | ############ Asterisk Codec ############ 28 | 29 | OBJECT_CODEC=./bin/codec_g723.so 30 | CPPSRC_CODEC=$(wildcard ./samples/util_e$(CPPSFX) ./samples/util_d$(CPPSFX) ./samples/codec_g723.c ) 31 | OBJSRC_CODEC=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_CODEC)) 32 | 33 | build_codec: $(OBJECT_CODEC) ; @echo "done Asterisk codec" 34 | 35 | $(OBJECT_CODEC): $(OBJSRC_CODEC) $(OBJECT_API) 36 | $(CC) $(SOLINKOPTS) -o $@ $^ $(LNKLIBS) 37 | 38 | ##### link encoder example programs ##### 39 | OBJECT_ENCODER=./bin/g723encoder$(EXESFX) 40 | CPPSRC_ENCODER=$(wildcard ./samples/g723encoder$(CPPSFX)) 41 | OBJSRC_ENCODER=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_ENCODER)) 42 | 43 | build_encoder: $(OBJECT_ENCODER) ; @echo "done encoder" 44 | 45 | $(OBJECT_ENCODER): $(OBJSRC_ENCODER) $(OBJECT_API) $(OBJECT_VM) 46 | $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS) 47 | 48 | ##### link decoder example programs ##### 49 | OBJECT_DECODER=./bin/g723decoder$(EXESFX) 50 | CPPSRC_DECODER=$(wildcard ./samples/g723decoder$(CPPSFX)) 51 | OBJSRC_DECODER=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_DECODER)) 52 | 53 | build_decoder: $(OBJECT_DECODER) ; @echo "done decoder" 54 | 55 | $(OBJECT_DECODER): $(OBJSRC_DECODER) $(OBJECT_API) $(OBJECT_VM) 56 | $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS) 57 | 58 | ##### compile encoder & decoder objects all together ##### 59 | #OBJECTS=$(OBJECT_API) $(OBJECT_VM) $(OBJSRC_ENCODER) $(OBJSRC_DECODER) 60 | OBJECTS=$(OBJECT_API) $(OBJECT_VM) $(OBJSRC_CODEC) 61 | $(OBJECTS): %$(OBJSFX): %$(CPPSFX) 62 | $(CC) $(CCINCLS) $(CCDEFS) $(CCOPTS) -o$@ $< 63 | 64 | prepare_directory: FORCE 65 | @if test ! -d ./bin; then mkdir ./bin; fi 66 | 67 | clean: FORCE 68 | rm -f $(OBJECTS) 69 | 70 | distclean: clean 71 | rm -f $(OBJECT_ENCODER) $(OBJECT_DECODER) 72 | 73 | FORCE: 74 | 75 | -------------------------------------------------------------------------------- /G723.1/api/decg723.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G723.1/api/decg723.c -------------------------------------------------------------------------------- /G723.1/api/encg723.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G723.1/api/encg723.c -------------------------------------------------------------------------------- /G723.1/api/g723ipp.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G723.1/api/g723ipp.h -------------------------------------------------------------------------------- /G723.1/api/owng723.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G723.1/api/owng723.c -------------------------------------------------------------------------------- /G723.1/api/owng723.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G723.1/api/owng723.h -------------------------------------------------------------------------------- /G723.1/api/scratchmem.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2002-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // 10 | // Purpose: scratch/stack memory managment header file 11 | // 12 | */ 13 | 14 | #ifndef __SCRATCHMEM_H__ 15 | #define __SCRATCHMEM_H__ 16 | 17 | #if (defined( __ICL ) || defined ( __ECL )) && (defined( _WIN32 ) && !defined( _WIN64 )) 18 | __INLINE 19 | Ipp32s IPP_INT_PTR( const void* ptr ) { 20 | union { 21 | void* Ptr; 22 | Ipp32s Int; 23 | } dd; 24 | dd.Ptr = (void*)ptr; 25 | return dd.Int; 26 | } 27 | 28 | __INLINE 29 | Ipp32u IPP_UINT_PTR( const void* ptr ) { 30 | union { 31 | void* Ptr; 32 | Ipp32u Int; 33 | } dd; 34 | dd.Ptr = (void*)ptr; 35 | return dd.Int; 36 | } 37 | 38 | #elif (defined( __ICL ) || defined ( __ECL )) && defined( _WIN64 ) 39 | __INLINE 40 | Ipp64s IPP_INT_PTR( const void* ptr ) { 41 | union { 42 | void* Ptr; 43 | Ipp64s Int; 44 | } dd; 45 | dd.Ptr = (void*)ptr; 46 | return dd.Int; 47 | } 48 | 49 | __INLINE 50 | Ipp64u IPP_UINT_PTR( const void* ptr ) { 51 | union { 52 | void* Ptr; 53 | Ipp64u Int; 54 | } dd; 55 | dd.Ptr = (void*)ptr; 56 | return dd.Int; 57 | } 58 | 59 | #elif defined( __ICC ) && defined( linux32 ) 60 | __INLINE 61 | Ipp32s IPP_INT_PTR( const void* ptr ) { 62 | union { 63 | void* Ptr; 64 | Ipp32s Int; 65 | } dd; 66 | dd.Ptr = (void*)ptr; 67 | return dd.Int; 68 | } 69 | 70 | __INLINE 71 | Ipp32u IPP_UINT_PTR( const void* ptr ) { 72 | union { 73 | void* Ptr; 74 | Ipp32u Int; 75 | } dd; 76 | dd.Ptr = (void*)ptr; 77 | return dd.Int; 78 | } 79 | 80 | #elif defined ( __ECC ) && defined( linux64 ) 81 | __INLINE 82 | Ipp64s IPP_INT_PTR( const void* ptr ) { 83 | union { 84 | void* Ptr; 85 | Ipp64s Int; 86 | } dd; 87 | dd.Ptr = (void*)ptr; 88 | return dd.Int; 89 | } 90 | 91 | __INLINE 92 | Ipp64u IPP_UINT_PTR( const void* ptr ) { 93 | union { 94 | void* Ptr; 95 | Ipp64u Int; 96 | } dd; 97 | dd.Ptr = (void*)ptr; 98 | return dd.Int; 99 | } 100 | 101 | #else 102 | #define IPP_INT_PTR( ptr ) ( (long)(ptr) ) 103 | #define IPP_UINT_PTR( ptr ) ( (unsigned long)(ptr) ) 104 | #endif 105 | 106 | #define IPP_BYTES_TO_ALIGN(ptr, align) ((-(IPP_INT_PTR(ptr)&((align)-1)))&((align)-1)) 107 | 108 | #define IPP_ALIGNED_PTR(ptr, align) (void*)( (char*)(ptr) + (IPP_BYTES_TO_ALIGN( ptr, align )) ) 109 | 110 | #define IPP_MALLOC_ALIGNED_BYTES 32 111 | 112 | #define IPP_MALLOC_ALIGNED_0BYTES 0 113 | #define IPP_MALLOC_ALIGNED_1BYTES 1 114 | #define IPP_MALLOC_ALIGNED_8BYTES 8 115 | #define IPP_MALLOC_ALIGNED_16BYTES 16 116 | #define IPP_MALLOC_ALIGNED_32BYTES 32 117 | 118 | #define IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength)\ 119 | arrtype arrname##AlignedArrBuff[(arrlength)+IPP_MALLOC_ALIGNED_##align##BYTES/sizeof(arrtype)];\ 120 | arrtype *arrname = (arrtype*)IPP_ALIGNED_PTR(arrname##AlignedArrBuff,align) 121 | 122 | __INLINE void* GetMemory(int arrlen, int sizeOfElem, char **CurPtr) 123 | { 124 | void *ret; 125 | 126 | ret = (void*)IPP_ALIGNED_PTR(*CurPtr,sizeOfElem); 127 | *CurPtr += (arrlen+1)*sizeOfElem; 128 | 129 | return ret; 130 | } 131 | 132 | __INLINE void* GetAlignMemory(int align, int arrlen, int sizeOfElem, char **CurPtr) 133 | { 134 | void *ret; 135 | 136 | ret = (void*)IPP_ALIGNED_PTR(*CurPtr,align); 137 | *CurPtr += (arrlen+align/sizeOfElem)*sizeOfElem; 138 | 139 | return ret; 140 | } 141 | 142 | #if !defined (SCRATCH_OLD) 143 | #if !defined (NO_SCRATCH_MEMORY_USED) 144 | 145 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj)\ 146 | arrtype *arrname = (arrtype *)GetAlignMemory(align,arrlength,sizeof(arrtype),&(obj)->Mem.CurPtr) 147 | 148 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj)\ 149 | arrtype *arrname = (arrtype *)GetMemory(arrlength,sizeof(arrtype),&(obj)->Mem.CurPtr) 150 | 151 | #else 152 | 153 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj)\ 154 | IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength) 155 | 156 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj)\ 157 | arrtype arrname[arrlength] 158 | 159 | 160 | #endif 161 | #else 162 | #if !defined (NO_SCRATCH_MEMORY_USED) 163 | #define PRE_ALLOC_ARRAY(align,arrtype,arrname,arrlength)\ 164 | arrtype *arrname 165 | 166 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj)\ 167 | arrname = (arrtype*)IPP_ALIGNED_PTR((obj)->Mem.CurPtr,align);\ 168 | (obj)->Mem.CurPtr += ((arrlength)+IPP_MALLOC_ALIGNED_##align##BYTES/sizeof(arrtype))*sizeof(arrtype) 169 | 170 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj)\ 171 | arrname = (arrtype*)IPP_ALIGNED_PTR((obj)->Mem.CurPtr,sizeof(arrtype));\ 172 | (obj)->Mem.CurPtr += ((arrlength)+1)*sizeof(arrtype) 173 | 174 | #else 175 | #define PRE_ALLOC_ARRAY(align,arrtype,arrname,arrlength)\ 176 | IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength) 177 | 178 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj) 179 | 180 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj) 181 | 182 | 183 | #endif 184 | #endif 185 | 186 | #if !defined (NO_SCRATCH_MEMORY_USED) 187 | #if defined(__ICC) || defined( __ICL ) || defined ( __ECL ) 188 | #pragma message("Scratch memory enabled") 189 | #endif 190 | #define LOCAL_ARRAY_FREE(arrtype,arrname,arrlength,obj)\ 191 | arrname=NULL;\ 192 | (obj)->Mem.CurPtr -= ((arrlength)+1)*sizeof(arrtype) 193 | 194 | #define LOCAL_ALIGN_ARRAY_FREE(align,arrtype,arrname,arrlength,obj)\ 195 | arrname=NULL;\ 196 | (obj)->Mem.CurPtr -= ((arrlength)+IPP_MALLOC_ALIGNED_##align##BYTES/sizeof(arrtype))*sizeof(arrtype) 197 | 198 | #define CLEAR_SCRATCH_MEMORY(obj)\ 199 | (obj)->Mem.CurPtr = (obj)->Mem.base 200 | 201 | #define OPEN_SCRATCH_BLOCK(obj)\ 202 | (obj)->Mem.VecPtr[(obj)->Mem.offset] = IPP_INT_PTR((obj)->Mem.CurPtr);\ 203 | (obj)->Mem.offset++ 204 | 205 | #define CLOSE_SCRATCH_BLOCK(obj)\ 206 | (obj)->Mem.offset--;\ 207 | (obj)->Mem.CurPtr = (char *)(obj)->Mem.VecPtr[(obj)->Mem.offset] 208 | #else 209 | #define LOCAL_ARRAY_FREE(arrtype,arrname,arrlength,obj) 210 | 211 | #define LOCAL_ALIGN_ARRAY_FREE(align,arrtype,arrname,arrlength,obj) 212 | 213 | #define CLEAR_SCRATCH_MEMORY(obj) 214 | 215 | #define OPEN_SCRATCH_BLOCK(obj) 216 | 217 | #define CLOSE_SCRATCH_BLOCK(obj) 218 | #endif 219 | 220 | #endif /*__SCRATCHMEM_H__*/ 221 | -------------------------------------------------------------------------------- /G723.1/build.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # 4 | # Usage: build.sh {gcc} 5 | # 6 | 7 | IPPENV=${IPPROOT}/tools/env/ippvars32.sh 8 | 9 | if [ ! -x "${IPPENV}" ]; then 10 | IPPENV=/opt/intel/ipp41/ia32_itanium/tools/env/ippvars32.sh 11 | fi 12 | 13 | if [ ! -x "${IPPENV}" ]; then 14 | IPPENV=/opt/intel/ipp41_eval/ia32_itanium/tools/env/ippvars32.sh 15 | fi 16 | 17 | if [ ! -x "${IPPENV}" ]; then 18 | @echo -e "*************************************************************************" 19 | @echo -e "Intel(R) IPP is not found!" 20 | @echo -e "Please install Intel(R) IPP or set IPPROOT environment variable correctly." 21 | @echo -e "*************************************************************************" 22 | exit 23 | fi 24 | 25 | ARG=$1 26 | 27 | CC=gcc 28 | CXX=g++ 29 | 30 | if [ "${ARG}" == "" ]; then 31 | 32 | CCFIND=/opt/intel/compiler60/ia32/bin/iccvars.sh 33 | if [ -x "${CCFIND}" ]; then 34 | CCENV=${CCFIND} 35 | fi 36 | 37 | CCFIND=/opt/intel/compiler70/ia32/bin/iccvars.sh 38 | if [ -x "${CCFIND}" ]; then 39 | CCENV=${CCFIND} 40 | fi 41 | 42 | CCFIND=/opt/intel/compiler80/ia32/bin/iccvars.sh 43 | if [ -x "${CCFIND}" ]; then 44 | CCENV=${CCFIND} 45 | fi 46 | 47 | CCFIND=/opt/intel_cc_80/bin/iccvars.sh 48 | if [ -x "${CCFIND}" ]; then 49 | CCENV=${CCFIND} 50 | fi 51 | 52 | if [ "${CCENV}" ]; then 53 | . ${CCENV} 54 | CC=icc 55 | CXX=icc 56 | fi 57 | 58 | fi 59 | 60 | . ${IPPENV} 61 | 62 | make clean 63 | make CC=${CC} CXX=${CXX} 64 | -------------------------------------------------------------------------------- /G723.1/include/g723api.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G723.1/include/g723api.h -------------------------------------------------------------------------------- /G723.1/readme.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G723.1/readme.htm -------------------------------------------------------------------------------- /G723.1/samples/g723_slin_ex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * One frame of raw G723.1 data 3 | */ 4 | 5 | static unsigned char g723_slin_ex[] = { 6 | 0xf4, 0xda, 0x1, 0x35, 0x10, 0x7, 0x0, 0x8e, 7 | 0x5a, 0x39, 0xdf, 0x83, 0x6e, 0x79, 0x9c, 0x83, 8 | 0x4e, 0xec, 0xa5, 0x81, 0xe0, 0x3, 0x69, 0xe6 9 | }; 10 | 11 | -------------------------------------------------------------------------------- /G723.1/samples/g723decoder.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G723.1/samples/g723decoder.c -------------------------------------------------------------------------------- /G723.1/samples/g723decoder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G723.1/samples/g723decoder.h -------------------------------------------------------------------------------- /G723.1/samples/g723encoder.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G723.1/samples/g723encoder.c -------------------------------------------------------------------------------- /G723.1/samples/g723encoder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G723.1/samples/g723encoder.h -------------------------------------------------------------------------------- /G723.1/samples/print_bytes.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | int main(int argc, char *argv[]) { 5 | 6 | int c; 7 | 8 | while((c = fgetc(stdin)) != EOF) 9 | printf("0x%x, "); 10 | 11 | printf("\n"); 12 | 13 | } 14 | 15 | -------------------------------------------------------------------------------- /G723.1/samples/slin_g723_ex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Signed 16 bit audio data 3 | * 4 | */ 5 | static signed short slin_g723_ex[] = { 6 | 0x0873, 0x06d9, 0x038c, 0x0588, 0x0409, 0x033d, 0x0311, 0xff6c, 0xfeef, 0xfd3e, 7 | 0xfdff, 0xff7a, 0xff6d, 0xffec, 0xff36, 0xfd62, 0xfda7, 0xfc6c, 0xfe67, 0xffe1, 8 | 0x003d, 0x01cc, 0x0065, 0x002a, 0xff83, 0xfed9, 0xffba, 0xfece, 0xff42, 0xff16, 9 | 0xfe85, 0xff31, 0xff02, 0xfdff, 0xfe32, 0xfe3f, 0xfed5, 0xff65, 0xffd4, 0x005b, 10 | 0xff88, 0xff01, 0xfebd, 0xfe95, 0xff46, 0xffe1, 0x00e2, 0x0165, 0x017e, 0x01c9, 11 | 0x0182, 0x0146, 0x00f9, 0x00ab, 0x006f, 0xffe8, 0xffd8, 0xffc4, 0xffb2, 0xfff9, 12 | 0xfffe, 0x0023, 0x0018, 0x000b, 0x001a, 0xfff7, 0x0014, 0x000b, 0x0004, 0x000b, 13 | 0xfff1, 0xff4f, 0xff3f, 0xff42, 0xff5e, 0xffd4, 0x0014, 0x0067, 0x0051, 0x003b, 14 | 0x0034, 0xfff9, 0x000d, 0xff54, 0xff54, 0xff52, 0xff3f, 0xffcc, 0xffe6, 0x00fc, 15 | 0x00fa, 0x00e4, 0x00f3, 0x0021, 0x0011, 0xffa1, 0xffab, 0xffdb, 0xffa5, 0x0009, 16 | 0xffd2, 0xffe6, 0x0007, 0x0096, 0x00e4, 0x00bf, 0x00ce, 0x0048, 0xffe8, 0xffab, 17 | 0xff8f, 0xffc3, 0xffc1, 0xfffc, 0x0002, 0xfff1, 0x000b, 0x00a7, 0x00c5, 0x00cc, 18 | 0x015e, 0x00e4, 0x0094, 0x0029, 0xffc7, 0xffc3, 0xff86, 0xffe4, 0xffe6, 0xffec, 19 | 0x000f, 0xffe3, 0x0028, 0x004b, 0xffaf, 0xffcb, 0xfedd, 0xfef8, 0xfe83, 0xfeba, 20 | 0xff94, 0xff94, 0xffbe, 0xffa8, 0xff0d, 0xff32, 0xff58, 0x0021, 0x0087, 0x00be, 21 | 0x0115, 0x007e, 0x0052, 0xfff0, 0xffc9, 0xffe8, 0xffc4, 0x0014, 0xfff0, 0xfff5, 22 | 0xfffe, 0xffda, 0x000b, 0x0010, 0x006f, 0x006f, 0x0052, 0x0045, 0xffee, 0xffea, 23 | 0xffcb, 0xffdf, 0xfffc, 0xfff0, 0x0012, 0xfff7, 0xfffe, 0x0018, 0x0050, 0x0066, 24 | 0x0047, 0x0028, 0xfff7, 0xffe8, 0xffec, 0x0007, 0x001d, 0x0016, 0x00c4, 0x0093, 25 | 0x007d, 0x0052, 0x00a5, 0x0091, 0x003c, 0x0041, 0xffd1, 0xffda, 0xffc6, 0xfff0, 26 | 0x001d, 0xfffe, 0x0024, 0xffee, 0xfff3, 0xfff0, 0xffea, 0x0012, 0xfff3, 0xfff7, 27 | 0xffda, 0xffca, 0xffda, 0xffdf, 0xfff3, 0xfff7, 0xff54, 0xff7c, 0xff8c, 0xffb9, 28 | 0x0012, 0x0012, 0x004c, 0x0007, 0xff50, 0xff66, 0xff54, 0xffa9, 0xffdc, 0xfff9, 29 | 0x0038, 0xfff9, 0x00d2, 0x0096, 0x008a, 0x0079, 0xfff5, 0x0019, 0xffad, 0xfffc, 30 | 0x015e, 0x00e4, 0x0094, 0x0029, 0xffc7, 0xffc3, 0xff86, 0xffe4, 0xffe6, 0xffec, 31 | 0x000f, 0xffe3, 0x0028, 0x004b, 0xffaf, 0xffcb, 0xfedd, 0xfef8, 0xfe83, 0xfeba, 32 | 0xff94, 0xff94, 0xffbe, 0xffa8, 0xff0d, 0xff32, 0xff58, 0x0021, 0x0087, 0x00be, 33 | 0x0115, 0x007e, 0x0052, 0xfff0, 0xffc9, 0xffe8, 0xffc4, 0x0014, 0xfff0, 0xfff5, 34 | 0xfffe, 0xffda, 0x000b, 0x0010, 0x006f, 0x006f, 0x0052, 0x0045, 0xffee, 0xffea, 35 | 0xffcb, 0xffdf, 0xfffc, 0xfff0, 0x0012, 0xfff7, 0xfffe, 0x0018, 0x0050, 0x0066, 36 | 0x0047, 0x0028, 0xfff7, 0xffe8, 0xffec, 0x0007, 0x001d, 0x0016, 0x00c4, 0x0093, 37 | 0x007d, 0x0052, 0x00a5, 0x0091, 0x003c, 0x0041, 0xffd1, 0xffda, 0xffc6, 0xfff0, 38 | 0x001d, 0xfffe, 0x0024, 0xffee, 0xfff3, 0xfff0, 0xffea, 0x0012, 0xfff3, 0xfff7, 39 | 0xffda, 0xffca, 0xffda, 0xffdf, 0xfff3, 0xfff7, 0xff54, 0xff7c, 0xff8c, 0xffb9, 40 | 0x0012, 0x0012, 0x004c, 0x0007, 0xff50, 0xff66, 0xff54, 0xffa9, 0xffdc, 0xfff9, 41 | 0x0038, 0xfff9, 0x00d2, 0x0096, 0x008a, 0x0079, 0xfff5, 0x0019, 0xffad, 0xfffc 42 | }; 43 | 44 | -------------------------------------------------------------------------------- /G723.1/vm/include/sys/vm_types_linux32.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Linux types header. 11 | */ 12 | #ifdef LINUX32 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | typedef unsigned long vm_var32; 19 | typedef unsigned long long vm_var64; 20 | typedef char vm_char; 21 | 22 | #define VM_ALIGN_DECL(X,Y) Y __attribute__ ((aligned(X))) 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | /* vm_thread.h */ 31 | typedef struct { 32 | pthread_t handle; 33 | int is_valid; 34 | } vm_thread; 35 | 36 | /* vm_event.h */ 37 | typedef struct { 38 | ast_cond_t cond; 39 | ast_mutex_t mutex; 40 | int manual; 41 | int state; 42 | } vm_event; 43 | 44 | /* vm_mmap.h */ 45 | typedef struct { 46 | int fd; 47 | void *address; 48 | size_t sizet; 49 | } vm_mmap; 50 | 51 | /* vm_mutex.h */ 52 | typedef struct { 53 | ast_mutex_t handle; 54 | int is_valid; 55 | } vm_mutex; 56 | 57 | /* vm_semaphore.h */ 58 | typedef struct { 59 | ast_cond_t cond; 60 | ast_mutex_t mutex; 61 | int count; 62 | } vm_semaphore; 63 | 64 | #ifdef __cplusplus 65 | }; 66 | #endif 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /G723.1/vm/include/vm_thread.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Threading header. 11 | */ 12 | #ifndef __VM_THREAD_H__ 13 | #define __VM_THREAD_H__ 14 | #include "vm_types.h" 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /* IMPORTANT: 21 | * The thread return value is always saved for the calling thread to 22 | * collect. To avoid memory leak, always vm_thread_wait() for the 23 | * child thread to terminate in the calling thread. 24 | */ 25 | 26 | typedef void *(*vm_thread_callback)(void *); 27 | 28 | typedef enum { 29 | VM_THREAD_PRIORITY_HIGHEST, 30 | VM_THREAD_PRIORITY_HIGH, 31 | VM_THREAD_PRIORITY_NORMAL, 32 | VM_THREAD_PRIORITY_LOW, 33 | VM_THREAD_PRIORITY_LOWEST 34 | } vm_thread_priority; 35 | 36 | /* Set the thread handler to an invalid value */ 37 | void vm_thread_set_invalid(vm_thread *thread); 38 | 39 | /* Verify if the thread handler is valid */ 40 | int vm_thread_is_valid(vm_thread *thread); 41 | 42 | /* Create a thread. The thread is set to run at the call. 43 | Return 1 if successful */ 44 | int vm_thread_create(vm_thread *thread,vm_thread_callback func,void *arg); 45 | 46 | /* Wait until a thread exists. */ 47 | void vm_thread_wait(vm_thread *thread); 48 | 49 | /* Terminate a thread with blocking */ 50 | void vm_thread_terminate(vm_thread *thread); 51 | 52 | /* Terminate the current thread */ 53 | void vm_thread_exit(void); 54 | 55 | /* Set thread priority. Return 1 if successful */ 56 | int vm_thread_set_priority(vm_thread *thread, vm_thread_priority priority); 57 | 58 | #ifdef __cplusplus 59 | }; 60 | #endif 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /G723.1/vm/include/vm_types.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Common types header. 11 | */ 12 | #ifndef __VM_TYPES_H__ 13 | #define __VM_TYPES_H__ 14 | #ifdef WIN32 15 | #include "sys/vm_types_win32.h" 16 | #elif LINUX32 17 | #include "sys/vm_types_linux32.h" 18 | #endif 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | typedef vm_var64 vm_sizet; 25 | 26 | #define VM_ALIGN16_DECL(X) VM_ALIGN_DECL(16,X) 27 | #define VM_ALIGN32_DECL(X) VM_ALIGN_DECL(32,X) 28 | 29 | #ifdef __cplusplus 30 | }; 31 | #endif 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /G723.1/vm/src/vm_thread_linux32.c: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Threading primitives for Linux. 11 | */ 12 | #ifdef LINUX32 13 | #include 14 | #include 15 | #include 16 | #include "vm_thread.h" 17 | 18 | /* Set the thread handler an invalid value */ 19 | void vm_thread_set_invalid(vm_thread *thread) 20 | { 21 | thread->is_valid=0; 22 | } 23 | 24 | /* Verify if the thread handler is valid */ 25 | int vm_thread_is_valid(vm_thread *thread) 26 | { 27 | return thread->is_valid; 28 | } 29 | 30 | /* Create a thread. Return 1 if success */ 31 | int vm_thread_create(vm_thread *thread, 32 | void *(*vm_thread_func)(void *),void *arg) 33 | { 34 | pthread_attr_t attr; 35 | pthread_attr_init(&attr); 36 | pthread_attr_setschedpolicy(&attr,geteuid()?SCHED_OTHER:SCHED_RR); 37 | thread->is_valid=!pthread_create(&thread->handle,&attr,vm_thread_func,arg); 38 | pthread_attr_destroy(&attr); 39 | vm_thread_set_priority(thread, VM_THREAD_PRIORITY_LOWEST); 40 | return thread->is_valid; 41 | } 42 | 43 | /* Terminate the current thread */ 44 | void vm_thread_exit(void) 45 | { 46 | pthread_exit(0); 47 | } 48 | 49 | /* Set thread priority, return 1 if successful */ 50 | int vm_thread_set_priority(vm_thread *thread, vm_thread_priority priority) 51 | { 52 | int policy, pmin, pmax, pmean; 53 | struct sched_param param; 54 | 55 | if (!thread->is_valid) return 0; 56 | pthread_getschedparam(thread->handle,&policy,¶m); 57 | 58 | pmin=sched_get_priority_min(policy); 59 | pmax=sched_get_priority_max(policy); 60 | pmean=(pmin+pmax)/2; 61 | 62 | switch (priority) { 63 | case VM_THREAD_PRIORITY_HIGHEST: 64 | param.sched_priority=pmax; break; 65 | case VM_THREAD_PRIORITY_LOWEST: 66 | param.sched_priority=pmin; break; 67 | case VM_THREAD_PRIORITY_NORMAL: 68 | param.sched_priority=pmean; break; 69 | case VM_THREAD_PRIORITY_HIGH: 70 | param.sched_priority=(pmax+pmean)/2; break; 71 | case VM_THREAD_PRIORITY_LOW: 72 | param.sched_priority=(pmin+pmean)/2; break; 73 | } 74 | 75 | return !pthread_setschedparam(thread->handle,policy,¶m); 76 | } 77 | 78 | /* Wait until a thread exists */ 79 | void vm_thread_wait(vm_thread *thread) 80 | { 81 | if (thread->is_valid) { 82 | pthread_join(thread->handle,NULL); 83 | thread->is_valid=0; 84 | } 85 | } 86 | 87 | /* Terminate a thread */ 88 | void vm_thread_terminate(vm_thread *thread) 89 | { 90 | if (thread->is_valid) { 91 | pthread_cancel(thread->handle); 92 | vm_thread_wait(thread); 93 | } 94 | } 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /G728/Makefile: -------------------------------------------------------------------------------- 1 | ############################### 2 | # DO NOT EDIT BELOW THIS LINE # 3 | ############################### 4 | 5 | # System Specific 6 | INCLSFX=.h 7 | CPPSFX=.c 8 | OBJSFX=.o 9 | EXESFX= 10 | 11 | # IPP Dependencies 12 | IPPINCLS=-I$(IPPROOT)/include 13 | IPPLIBS=-L$(IPPROOT)/sharedlib -lippsc -lipps -lippcore -L$(IPPROOT)/sharedlib/linux32 -lguide 14 | 15 | # Compiler Specifics 16 | CCOPTS=-c -O2 17 | CCDEFS=-D__unix__ -DNDEBUG -DNO_SCRATCH_MEMORY_USED -DLINUX32 18 | CCINCLS=-I./include -I./vm/include $(IPPINCLS) 19 | 20 | LNKOUT=-o 21 | LNKOPTS= 22 | LNKLIBS=$(IPPLIBS) -lpthread 23 | 24 | build: prepare_directory build_encoder build_decoder; @echo "Done" 25 | 26 | ##### api object ##### 27 | CPPSRC_API=$(wildcard ./api/*$(CPPSFX)) 28 | OBJECT_API=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_API)) 29 | 30 | CPPSRC_VM=$(wildcard ./vm/src/*$(CPPSFX)) 31 | OBJECT_VM=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_VM)) 32 | 33 | ##### link encoder example programs ##### 34 | OBJECT_ENCODER=./bin/g728encoder$(EXESFX) 35 | CPPSRC_ENCODER=$(wildcard ./samples/g728encoder$(CPPSFX)) 36 | OBJSRC_ENCODER=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_ENCODER)) 37 | 38 | build_encoder: $(OBJECT_ENCODER) ; @echo "done encoder" 39 | 40 | $(OBJECT_ENCODER): $(OBJSRC_ENCODER) $(OBJECT_API) $(OBJECT_VM) 41 | $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS) 42 | 43 | ##### link decoder example programs ##### 44 | OBJECT_DECODER=./bin/g728decoder$(EXESFX) 45 | CPPSRC_DECODER=$(wildcard ./samples/g728decoder$(CPPSFX)) 46 | OBJSRC_DECODER=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_DECODER)) 47 | 48 | build_decoder: $(OBJECT_DECODER) ; @echo "done decoder" 49 | 50 | $(OBJECT_DECODER): $(OBJSRC_DECODER) $(OBJECT_API) $(OBJECT_VM) 51 | $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS) 52 | 53 | ##### compile encoder & decoder objects all together ##### 54 | OBJECTS=$(OBJECT_API) $(OBJECT_VM)$(OBJSRC_ENCODER) $(OBJSRC_DECODER) 55 | $(OBJECTS): %$(OBJSFX): %$(CPPSFX) 56 | $(CC) $(CCINCLS) $(CCDEFS) $(CCOPTS) -o$@ $< 57 | 58 | prepare_directory: FORCE 59 | @if test ! -d ./bin; then mkdir ./bin; fi 60 | 61 | clean: FORCE 62 | rm -f $(OBJECTS) 63 | 64 | distclean: clean 65 | rm -f $(OBJECT_ENCODER) $(OBJECT_DECODER) 66 | 67 | FORCE: 68 | 69 | -------------------------------------------------------------------------------- /G728/api/adapters.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G728/api/adapters.c -------------------------------------------------------------------------------- /G728/api/consealg728.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G728/api/consealg728.c -------------------------------------------------------------------------------- /G728/api/g728api.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G728/api/g728api.c -------------------------------------------------------------------------------- /G728/api/g728tables.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G728/api/g728tables.c -------------------------------------------------------------------------------- /G728/api/g728tables.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G728/api/g728tables.h -------------------------------------------------------------------------------- /G728/api/owng728.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G728/api/owng728.c -------------------------------------------------------------------------------- /G728/api/owng728.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G728/api/owng728.h -------------------------------------------------------------------------------- /G728/api/pitchg728.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G728/api/pitchg728.c -------------------------------------------------------------------------------- /G728/api/pstg728.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G728/api/pstg728.c -------------------------------------------------------------------------------- /G728/api/scratchmem.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2002-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // 10 | // Purpose: scratch/stack memory managment header file 11 | // 12 | */ 13 | 14 | #ifndef __SCRATCHMEM_H__ 15 | #define __SCRATCHMEM_H__ 16 | 17 | #if (defined( __ICL ) || defined ( __ECL )) && (defined( _WIN32 ) && !defined( _WIN64 )) 18 | __INLINE 19 | Ipp32s IPP_INT_PTR( const void* ptr ) { 20 | union { 21 | void* Ptr; 22 | Ipp32s Int; 23 | } dd; 24 | dd.Ptr = (void*)ptr; 25 | return dd.Int; 26 | } 27 | 28 | __INLINE 29 | Ipp32u IPP_UINT_PTR( const void* ptr ) { 30 | union { 31 | void* Ptr; 32 | Ipp32u Int; 33 | } dd; 34 | dd.Ptr = (void*)ptr; 35 | return dd.Int; 36 | } 37 | 38 | #elif (defined( __ICL ) || defined ( __ECL )) && defined( _WIN64 ) 39 | __INLINE 40 | Ipp64s IPP_INT_PTR( const void* ptr ) { 41 | union { 42 | void* Ptr; 43 | Ipp64s Int; 44 | } dd; 45 | dd.Ptr = (void*)ptr; 46 | return dd.Int; 47 | } 48 | 49 | __INLINE 50 | Ipp64u IPP_UINT_PTR( const void* ptr ) { 51 | union { 52 | void* Ptr; 53 | Ipp64u Int; 54 | } dd; 55 | dd.Ptr = (void*)ptr; 56 | return dd.Int; 57 | } 58 | 59 | #elif defined( __ICC ) && defined( linux32 ) 60 | __INLINE 61 | Ipp32s IPP_INT_PTR( const void* ptr ) { 62 | union { 63 | void* Ptr; 64 | Ipp32s Int; 65 | } dd; 66 | dd.Ptr = (void*)ptr; 67 | return dd.Int; 68 | } 69 | 70 | __INLINE 71 | Ipp32u IPP_UINT_PTR( const void* ptr ) { 72 | union { 73 | void* Ptr; 74 | Ipp32u Int; 75 | } dd; 76 | dd.Ptr = (void*)ptr; 77 | return dd.Int; 78 | } 79 | 80 | #elif defined ( __ECC ) && defined( linux64 ) 81 | __INLINE 82 | Ipp64s IPP_INT_PTR( const void* ptr ) { 83 | union { 84 | void* Ptr; 85 | Ipp64s Int; 86 | } dd; 87 | dd.Ptr = (void*)ptr; 88 | return dd.Int; 89 | } 90 | 91 | __INLINE 92 | Ipp64u IPP_UINT_PTR( const void* ptr ) { 93 | union { 94 | void* Ptr; 95 | Ipp64u Int; 96 | } dd; 97 | dd.Ptr = (void*)ptr; 98 | return dd.Int; 99 | } 100 | 101 | #else 102 | #define IPP_INT_PTR( ptr ) ( (long)(ptr) ) 103 | #define IPP_UINT_PTR( ptr ) ( (unsigned long)(ptr) ) 104 | #endif 105 | 106 | #define IPP_BYTES_TO_ALIGN(ptr, align) ((-(IPP_INT_PTR(ptr)&((align)-1)))&((align)-1)) 107 | 108 | #define IPP_ALIGNED_PTR(ptr, align) (void*)( (char*)(ptr) + (IPP_BYTES_TO_ALIGN( ptr, align )) ) 109 | 110 | #define IPP_MALLOC_ALIGNED_BYTES 32 111 | 112 | #define IPP_MALLOC_ALIGNED_0BYTES 0 113 | #define IPP_MALLOC_ALIGNED_1BYTES 1 114 | #define IPP_MALLOC_ALIGNED_8BYTES 8 115 | #define IPP_MALLOC_ALIGNED_16BYTES 16 116 | #define IPP_MALLOC_ALIGNED_32BYTES 32 117 | 118 | #define IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength)\ 119 | arrtype arrname##AlignedArrBuff[(arrlength)+IPP_MALLOC_ALIGNED_##align##BYTES/sizeof(arrtype)];\ 120 | arrtype *arrname = (arrtype*)IPP_ALIGNED_PTR(arrname##AlignedArrBuff,align) 121 | 122 | __INLINE void* GetMemory(int arrlen, int sizeOfElem, char **CurPtr) 123 | { 124 | void *ret; 125 | 126 | ret = (void*)IPP_ALIGNED_PTR(*CurPtr,sizeOfElem); 127 | *CurPtr += (arrlen+1)*sizeOfElem; 128 | 129 | return ret; 130 | } 131 | 132 | __INLINE void* GetAlignMemory(int align, int arrlen, int sizeOfElem, char **CurPtr) 133 | { 134 | void *ret; 135 | 136 | ret = (void*)IPP_ALIGNED_PTR(*CurPtr,align); 137 | *CurPtr += (arrlen+align/sizeOfElem)*sizeOfElem; 138 | 139 | return ret; 140 | } 141 | 142 | #if !defined (SCRATCH_OLD) 143 | #if !defined (NO_SCRATCH_MEMORY_USED) 144 | 145 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj)\ 146 | arrtype *arrname = (arrtype *)GetAlignMemory(align,arrlength,sizeof(arrtype),&(obj)->Mem.CurPtr) 147 | 148 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj)\ 149 | arrtype *arrname = (arrtype *)GetMemory(arrlength,sizeof(arrtype),&(obj)->Mem.CurPtr) 150 | 151 | #else 152 | 153 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj)\ 154 | IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength) 155 | 156 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj)\ 157 | arrtype arrname[arrlength] 158 | 159 | 160 | #endif 161 | #else 162 | #if !defined (NO_SCRATCH_MEMORY_USED) 163 | #define PRE_ALLOC_ARRAY(align,arrtype,arrname,arrlength)\ 164 | arrtype *arrname 165 | 166 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj)\ 167 | arrname = (arrtype*)IPP_ALIGNED_PTR((obj)->Mem.CurPtr,align);\ 168 | (obj)->Mem.CurPtr += ((arrlength)+IPP_MALLOC_ALIGNED_##align##BYTES/sizeof(arrtype))*sizeof(arrtype) 169 | 170 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj)\ 171 | arrname = (arrtype*)IPP_ALIGNED_PTR((obj)->Mem.CurPtr,sizeof(arrtype));\ 172 | (obj)->Mem.CurPtr += ((arrlength)+1)*sizeof(arrtype) 173 | 174 | #else 175 | #define PRE_ALLOC_ARRAY(align,arrtype,arrname,arrlength)\ 176 | IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength) 177 | 178 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj) 179 | 180 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj) 181 | 182 | 183 | #endif 184 | #endif 185 | 186 | #if !defined (NO_SCRATCH_MEMORY_USED) 187 | #if defined(__ICC) || defined( __ICL ) || defined ( __ECL ) 188 | #pragma message("Scratch memory enabled") 189 | #endif 190 | #define LOCAL_ARRAY_FREE(arrtype,arrname,arrlength,obj)\ 191 | arrname=NULL;\ 192 | (obj)->Mem.CurPtr -= ((arrlength)+1)*sizeof(arrtype) 193 | 194 | #define LOCAL_ALIGN_ARRAY_FREE(align,arrtype,arrname,arrlength,obj)\ 195 | arrname=NULL;\ 196 | (obj)->Mem.CurPtr -= ((arrlength)+IPP_MALLOC_ALIGNED_##align##BYTES/sizeof(arrtype))*sizeof(arrtype) 197 | 198 | #define CLEAR_SCRATCH_MEMORY(obj)\ 199 | (obj)->Mem.CurPtr = (obj)->Mem.base 200 | 201 | #define OPEN_SCRATCH_BLOCK(obj)\ 202 | (obj)->Mem.VecPtr[(obj)->Mem.offset] = IPP_INT_PTR((obj)->Mem.CurPtr);\ 203 | (obj)->Mem.offset++ 204 | 205 | #define CLOSE_SCRATCH_BLOCK(obj)\ 206 | (obj)->Mem.offset--;\ 207 | (obj)->Mem.CurPtr = (char *)(obj)->Mem.VecPtr[(obj)->Mem.offset] 208 | #else 209 | #define LOCAL_ARRAY_FREE(arrtype,arrname,arrlength,obj) 210 | 211 | #define LOCAL_ALIGN_ARRAY_FREE(align,arrtype,arrname,arrlength,obj) 212 | 213 | #define CLEAR_SCRATCH_MEMORY(obj) 214 | 215 | #define OPEN_SCRATCH_BLOCK(obj) 216 | 217 | #define CLOSE_SCRATCH_BLOCK(obj) 218 | #endif 219 | 220 | #endif /*__SCRATCHMEM_H__*/ 221 | -------------------------------------------------------------------------------- /G728/api/vq.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G728/api/vq.c -------------------------------------------------------------------------------- /G728/build.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # 4 | # Usage: build.sh {gcc} 5 | # 6 | 7 | IPPENV=${IPPROOT}/tools/env/ippvars32.sh 8 | 9 | if [ ! -x "${IPPENV}" ]; then 10 | IPPENV=/opt/intel/ipp41/ia32_itanium/tools/env/ippvars32.sh 11 | fi 12 | 13 | if [ ! -x "${IPPENV}" ]; then 14 | IPPENV=/opt/intel/ipp41_eval/ia32_itanium/tools/env/ippvars32.sh 15 | fi 16 | 17 | if [ ! -x "${IPPENV}" ]; then 18 | @echo -e "*************************************************************************" 19 | @echo -e "Intel(R) IPP is not found!" 20 | @echo -e "Please install Intel(R) IPP or set IPPROOT environment variable correctly." 21 | @echo -e "*************************************************************************" 22 | exit 23 | fi 24 | 25 | ARG=$1 26 | 27 | CC=gcc 28 | CXX=g++ 29 | 30 | if [ "${ARG}" == "" ]; then 31 | 32 | CCFIND=/opt/intel/compiler60/ia32/bin/iccvars.sh 33 | if [ -x "${CCFIND}" ]; then 34 | CCENV=${CCFIND} 35 | fi 36 | 37 | CCFIND=/opt/intel/compiler70/ia32/bin/iccvars.sh 38 | if [ -x "${CCFIND}" ]; then 39 | CCENV=${CCFIND} 40 | fi 41 | 42 | CCFIND=/opt/intel/compiler80/ia32/bin/iccvars.sh 43 | if [ -x "${CCFIND}" ]; then 44 | CCENV=${CCFIND} 45 | fi 46 | 47 | CCFIND=/opt/intel_cc_80/bin/iccvars.sh 48 | if [ -x "${CCFIND}" ]; then 49 | CCENV=${CCFIND} 50 | fi 51 | 52 | if [ "${CCENV}" ]; then 53 | . ${CCENV} 54 | CC=icc 55 | CXX=icc 56 | fi 57 | 58 | fi 59 | 60 | . ${IPPENV} 61 | 62 | make clean 63 | make CC=${CC} CXX=${CXX} 64 | -------------------------------------------------------------------------------- /G728/include/g728.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G728/include/g728.h -------------------------------------------------------------------------------- /G728/include/g728api.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G728/include/g728api.h -------------------------------------------------------------------------------- /G728/readme.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G728/readme.htm -------------------------------------------------------------------------------- /G728/samples/g728decoder.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G728/samples/g728decoder.c -------------------------------------------------------------------------------- /G728/samples/g728decoder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G728/samples/g728decoder.h -------------------------------------------------------------------------------- /G728/samples/g728encoder.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G728/samples/g728encoder.c -------------------------------------------------------------------------------- /G728/samples/g728encoder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G728/samples/g728encoder.h -------------------------------------------------------------------------------- /G728/vm/include/sys/vm_types_linux32.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Linux types header. 11 | */ 12 | #ifdef LINUX32 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | typedef unsigned long vm_var32; 19 | typedef unsigned long long vm_var64; 20 | typedef char vm_char; 21 | 22 | #define VM_ALIGN_DECL(X,Y) Y __attribute__ ((aligned(X))) 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | /* vm_thread.h */ 29 | typedef struct { 30 | pthread_t handle; 31 | int is_valid; 32 | } vm_thread; 33 | 34 | /* vm_event.h */ 35 | typedef struct { 36 | pthread_cond_t cond; 37 | pthread_mutex_t mutex; 38 | int manual; 39 | int state; 40 | } vm_event; 41 | 42 | /* vm_mmap.h */ 43 | typedef struct { 44 | int fd; 45 | void *address; 46 | size_t sizet; 47 | } vm_mmap; 48 | 49 | /* vm_mutex.h */ 50 | typedef struct { 51 | pthread_mutex_t handle; 52 | int is_valid; 53 | } vm_mutex; 54 | 55 | /* vm_semaphore.h */ 56 | typedef struct { 57 | pthread_cond_t cond; 58 | pthread_mutex_t mutex; 59 | int count; 60 | } vm_semaphore; 61 | 62 | #ifdef __cplusplus 63 | }; 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /G728/vm/include/vm_thread.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Threading header. 11 | */ 12 | #ifndef __VM_THREAD_H__ 13 | #define __VM_THREAD_H__ 14 | #include "vm_types.h" 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /* IMPORTANT: 21 | * The thread return value is always saved for the calling thread to 22 | * collect. To avoid memory leak, always vm_thread_wait() for the 23 | * child thread to terminate in the calling thread. 24 | */ 25 | 26 | typedef void *(*vm_thread_callback)(void *); 27 | 28 | typedef enum { 29 | VM_THREAD_PRIORITY_HIGHEST, 30 | VM_THREAD_PRIORITY_HIGH, 31 | VM_THREAD_PRIORITY_NORMAL, 32 | VM_THREAD_PRIORITY_LOW, 33 | VM_THREAD_PRIORITY_LOWEST 34 | } vm_thread_priority; 35 | 36 | /* Set the thread handler to an invalid value */ 37 | void vm_thread_set_invalid(vm_thread *thread); 38 | 39 | /* Verify if the thread handler is valid */ 40 | int vm_thread_is_valid(vm_thread *thread); 41 | 42 | /* Create a thread. The thread is set to run at the call. 43 | Return 1 if successful */ 44 | int vm_thread_create(vm_thread *thread,vm_thread_callback func,void *arg); 45 | 46 | /* Wait until a thread exists. */ 47 | void vm_thread_wait(vm_thread *thread); 48 | 49 | /* Terminate a thread with blocking */ 50 | void vm_thread_terminate(vm_thread *thread); 51 | 52 | /* Terminate the current thread */ 53 | void vm_thread_exit(void); 54 | 55 | /* Set thread priority. Return 1 if successful */ 56 | int vm_thread_set_priority(vm_thread *thread, vm_thread_priority priority); 57 | 58 | #ifdef __cplusplus 59 | }; 60 | #endif 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /G728/vm/include/vm_types.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Common types header. 11 | */ 12 | #ifndef __VM_TYPES_H__ 13 | #define __VM_TYPES_H__ 14 | #ifdef WIN32 15 | #include "sys/vm_types_win32.h" 16 | #elif LINUX32 17 | #include "sys/vm_types_linux32.h" 18 | #endif 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | typedef vm_var64 vm_sizet; 25 | 26 | #define VM_ALIGN16_DECL(X) VM_ALIGN_DECL(16,X) 27 | #define VM_ALIGN32_DECL(X) VM_ALIGN_DECL(32,X) 28 | 29 | #ifdef __cplusplus 30 | }; 31 | #endif 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /G728/vm/src/vm_thread_linux32.c: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Threading primitives for Linux. 11 | */ 12 | #ifdef LINUX32 13 | #include 14 | #include 15 | #include 16 | #include "vm_thread.h" 17 | 18 | /* Set the thread handler an invalid value */ 19 | void vm_thread_set_invalid(vm_thread *thread) 20 | { 21 | thread->is_valid=0; 22 | } 23 | 24 | /* Verify if the thread handler is valid */ 25 | int vm_thread_is_valid(vm_thread *thread) 26 | { 27 | return thread->is_valid; 28 | } 29 | 30 | /* Create a thread. Return 1 if success */ 31 | int vm_thread_create(vm_thread *thread, 32 | void *(*vm_thread_func)(void *),void *arg) 33 | { 34 | pthread_attr_t attr; 35 | pthread_attr_init(&attr); 36 | pthread_attr_setschedpolicy(&attr,geteuid()?SCHED_OTHER:SCHED_RR); 37 | thread->is_valid=!pthread_create(&thread->handle,&attr,vm_thread_func,arg); 38 | pthread_attr_destroy(&attr); 39 | vm_thread_set_priority(thread, VM_THREAD_PRIORITY_LOWEST); 40 | return thread->is_valid; 41 | } 42 | 43 | /* Terminate the current thread */ 44 | void vm_thread_exit(void) 45 | { 46 | pthread_exit(0); 47 | } 48 | 49 | /* Set thread priority, return 1 if successful */ 50 | int vm_thread_set_priority(vm_thread *thread, vm_thread_priority priority) 51 | { 52 | int policy, pmin, pmax, pmean; 53 | struct sched_param param; 54 | 55 | if (!thread->is_valid) return 0; 56 | pthread_getschedparam(thread->handle,&policy,¶m); 57 | 58 | pmin=sched_get_priority_min(policy); 59 | pmax=sched_get_priority_max(policy); 60 | pmean=(pmin+pmax)/2; 61 | 62 | switch (priority) { 63 | case VM_THREAD_PRIORITY_HIGHEST: 64 | param.sched_priority=pmax; break; 65 | case VM_THREAD_PRIORITY_LOWEST: 66 | param.sched_priority=pmin; break; 67 | case VM_THREAD_PRIORITY_NORMAL: 68 | param.sched_priority=pmean; break; 69 | case VM_THREAD_PRIORITY_HIGH: 70 | param.sched_priority=(pmax+pmean)/2; break; 71 | case VM_THREAD_PRIORITY_LOW: 72 | param.sched_priority=(pmin+pmean)/2; break; 73 | } 74 | 75 | return !pthread_setschedparam(thread->handle,policy,¶m); 76 | } 77 | 78 | /* Wait until a thread exists */ 79 | void vm_thread_wait(vm_thread *thread) 80 | { 81 | if (thread->is_valid) { 82 | pthread_join(thread->handle,NULL); 83 | thread->is_valid=0; 84 | } 85 | } 86 | 87 | /* Terminate a thread */ 88 | void vm_thread_terminate(vm_thread *thread) 89 | { 90 | if (thread->is_valid) { 91 | pthread_cancel(thread->handle); 92 | vm_thread_wait(thread); 93 | } 94 | } 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /G729-float/Makefile: -------------------------------------------------------------------------------- 1 | ############################### 2 | # DO NOT EDIT BELOW THIS LINE # 3 | ############################### 4 | 5 | include ../makeopts 6 | 7 | # Compiler Specifics 8 | CCOPTS=-c $(OPTIMIZE) 9 | CCDEFS=-D__unix__ -Dlinux -Dlinux32 -DNDEBUG -DLINUX32 -DNO_SCRATCH_MEMORY_USED 10 | CCINCLS=-I./include -I./vm/include $(IPPINCLS) 11 | 12 | LNKOUT=-o 13 | LNKOPTS= 14 | LNKLIBS=$(IPPLIBS) -lpthread -lm $(ICCLIBS) 15 | 16 | SOLINKOPTS=-shared $(LDFLAGS) -Xlinker -x 17 | 18 | build: prepare_directory build_codec build_encoder build_decoder ; @echo "Done" 19 | 20 | ##### api object ##### 21 | CPPSRC_API=$(wildcard ./api/*$(CPPSFX)) 22 | OBJECT_API=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_API)) 23 | 24 | CPPSRC_VM=$(wildcard ./vm/src/*$(CPPSFX)) 25 | OBJECT_VM=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_VM)) 26 | 27 | ############ Asterisk Codec ############ 28 | OBJECT_CODEC=./bin/codec_g729.so 29 | CPPSRC_CODEC=$(wildcard ./samples/util_e$(CPPSFX) ./samples/util_d$(CPPSFX) ./samples/codec_g729.c ) 30 | OBJSRC_CODEC=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_CODEC)) 31 | 32 | build_codec: $(OBJECT_CODEC) ; @echo "done Asterisk codec" 33 | 34 | $(OBJECT_CODEC): $(OBJSRC_CODEC) $(OBJECT_API) 35 | $(CC) $(SOLINKOPTS) -o $@ $^ $(LNKLIBS) 36 | 37 | ##### link encoder example programs ##### 38 | OBJECT_ENCODER=./bin/g729fpencoder$(EXESFX) 39 | OBJECT_MY_ENC=./bin/my_enc 40 | CPPSRC_ENCODER=$(wildcard ./samples/encoder$(CPPSFX) ./samples/util_e$(CPPSFX)) 41 | CPPSRC_MY_ENC=$(wildcard ./samples/util_e$(CPPSFX) ./samples/my_enc.c) 42 | OBJSRC_ENCODER=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_ENCODER)) 43 | OBJSRC_MY_ENC=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_MY_ENC)) 44 | 45 | build_encoder: $(OBJECT_ENCODER) $(OBJECT_MY_ENC) ; @echo "done encoder" 46 | 47 | $(OBJECT_MY_ENC): $(OBJSRC_MY_ENC) $(OBJECT_API) $(OBJECT_VM) 48 | $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS) 49 | $(OBJECT_ENCODER): $(OBJSRC_ENCODER) $(OBJECT_API) $(OBJECT_VM) 50 | $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS) 51 | 52 | ##### link decoder example programs ##### 53 | OBJECT_DECODER=./bin/g729fpdecoder$(EXESFX) 54 | OBJECT_MY_DEC=./bin/my_dec 55 | CPPSRC_DECODER=$(wildcard ./samples/decoder$(CPPSFX) ./samples/util_d$(CPPSFX)) 56 | CPPSRC_MY_DEC=$(wildcard ./samples/util_d$(CPPSFX) ./samples/my_dec.c) 57 | OBJSRC_DECODER=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_DECODER)) 58 | OBJSRC_MY_DEC=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_MY_DEC)) 59 | 60 | build_decoder: $(OBJECT_DECODER) $(OBJECT_MY_DEC) ; @echo "done decoder" 61 | 62 | $(OBJECT_MY_DEC): $(OBJSRC_MY_DEC) $(OBJECT_API) $(OBJECT_VM) 63 | $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS) 64 | $(OBJECT_DECODER): $(OBJSRC_DECODER) $(OBJECT_API) $(OBJECT_VM) 65 | $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS) 66 | 67 | ##### compile encoder & decoder objects all together ##### 68 | #OBJECTS=$(OBJECT_API) $(OBJECT_VM) $(OBJSRC_CODEC) 69 | OBJECTS=$(OBJECT_API) $(OBJECT_VM) $(OBJSRC_CODEC) $(OBJSRC_ENCODER) $(OBJSRC_MY_ENC) $(OBJSRC_DECODER) $(OBJSRC_MY_DEC) 70 | $(OBJECTS): %$(OBJSFX): %$(CPPSFX) 71 | $(CC) $(CCINCLS) $(CCDEFS) $(CCOPTS) -o$@ $< 72 | 73 | prepare_directory: FORCE 74 | @if test ! -d ./bin; then mkdir ./bin; fi 75 | 76 | clean: FORCE 77 | rm -f $(OBJECTS) 78 | 79 | distclean: clean 80 | rm -f $(OBJECT_ENCODER) $(OBJECT_DECODER) 81 | 82 | FORCE: 83 | 84 | -------------------------------------------------------------------------------- /G729-float/api/scratchmem.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2002-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // 10 | // Purpose: scratch/stack memory managment header file 11 | // 12 | */ 13 | 14 | #ifndef __SCRATCHMEM_H__ 15 | #define __SCRATCHMEM_H__ 16 | 17 | #if (defined( __ICL ) || defined ( __ECL )) && (defined( _WIN32 ) && !defined( _WIN64 )) 18 | __INLINE 19 | Ipp32s IPP_INT_PTR( const void* ptr ) { 20 | union { 21 | void* Ptr; 22 | Ipp32s Int; 23 | } dd; 24 | dd.Ptr = (void*)ptr; 25 | return dd.Int; 26 | } 27 | 28 | __INLINE 29 | Ipp32u IPP_UINT_PTR( const void* ptr ) { 30 | union { 31 | void* Ptr; 32 | Ipp32u Int; 33 | } dd; 34 | dd.Ptr = (void*)ptr; 35 | return dd.Int; 36 | } 37 | 38 | #elif (defined( __ICL ) || defined ( __ECL )) && defined( _WIN64 ) 39 | __INLINE 40 | Ipp64s IPP_INT_PTR( const void* ptr ) { 41 | union { 42 | void* Ptr; 43 | Ipp64s Int; 44 | } dd; 45 | dd.Ptr = (void*)ptr; 46 | return dd.Int; 47 | } 48 | 49 | __INLINE 50 | Ipp64u IPP_UINT_PTR( const void* ptr ) { 51 | union { 52 | void* Ptr; 53 | Ipp64u Int; 54 | } dd; 55 | dd.Ptr = (void*)ptr; 56 | return dd.Int; 57 | } 58 | 59 | #elif defined( __ICC ) && defined( linux32 ) 60 | __INLINE 61 | Ipp32s IPP_INT_PTR( const void* ptr ) { 62 | union { 63 | void* Ptr; 64 | Ipp32s Int; 65 | } dd; 66 | dd.Ptr = (void*)ptr; 67 | return dd.Int; 68 | } 69 | 70 | __INLINE 71 | Ipp32u IPP_UINT_PTR( const void* ptr ) { 72 | union { 73 | void* Ptr; 74 | Ipp32u Int; 75 | } dd; 76 | dd.Ptr = (void*)ptr; 77 | return dd.Int; 78 | } 79 | 80 | #elif defined ( __ECC ) && defined( linux64 ) 81 | __INLINE 82 | Ipp64s IPP_INT_PTR( const void* ptr ) { 83 | union { 84 | void* Ptr; 85 | Ipp64s Int; 86 | } dd; 87 | dd.Ptr = (void*)ptr; 88 | return dd.Int; 89 | } 90 | 91 | __INLINE 92 | Ipp64u IPP_UINT_PTR( const void* ptr ) { 93 | union { 94 | void* Ptr; 95 | Ipp64u Int; 96 | } dd; 97 | dd.Ptr = (void*)ptr; 98 | return dd.Int; 99 | } 100 | 101 | #else 102 | #define IPP_INT_PTR( ptr ) ( (long)(ptr) ) 103 | #define IPP_UINT_PTR( ptr ) ( (unsigned long)(ptr) ) 104 | #endif 105 | 106 | #define IPP_BYTES_TO_ALIGN(ptr, align) ((-(IPP_INT_PTR(ptr)&((align)-1)))&((align)-1)) 107 | 108 | #define IPP_ALIGNED_PTR(ptr, align) (void*)( (char*)(ptr) + (IPP_BYTES_TO_ALIGN( ptr, align )) ) 109 | 110 | #define IPP_MALLOC_ALIGNED_BYTES 32 111 | 112 | #define IPP_MALLOC_ALIGNED_0BYTES 0 113 | #define IPP_MALLOC_ALIGNED_1BYTES 1 114 | #define IPP_MALLOC_ALIGNED_8BYTES 8 115 | #define IPP_MALLOC_ALIGNED_16BYTES 16 116 | #define IPP_MALLOC_ALIGNED_32BYTES 32 117 | 118 | #define IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength)\ 119 | arrtype arrname##AlignedArrBuff[(arrlength)+IPP_MALLOC_ALIGNED_##align##BYTES/sizeof(arrtype)];\ 120 | arrtype *arrname = (arrtype*)IPP_ALIGNED_PTR(arrname##AlignedArrBuff,align) 121 | 122 | __INLINE void* GetMemory(int arrlen, int sizeOfElem, char **CurPtr) 123 | { 124 | void *ret; 125 | 126 | ret = (void*)IPP_ALIGNED_PTR(*CurPtr,sizeOfElem); 127 | *CurPtr += (arrlen+1)*sizeOfElem; 128 | 129 | return ret; 130 | } 131 | 132 | __INLINE void* GetAlignMemory(int align, int arrlen, int sizeOfElem, char **CurPtr) 133 | { 134 | void *ret; 135 | 136 | ret = (void*)IPP_ALIGNED_PTR(*CurPtr,align); 137 | *CurPtr += (arrlen+align/sizeOfElem)*sizeOfElem; 138 | 139 | return ret; 140 | } 141 | 142 | #if !defined (SCRATCH_OLD) 143 | #if !defined (NO_SCRATCH_MEMORY_USED) 144 | 145 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj)\ 146 | arrtype *arrname = (arrtype *)GetAlignMemory(align,arrlength,sizeof(arrtype),&(obj)->Mem.CurPtr) 147 | 148 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj)\ 149 | arrtype *arrname = (arrtype *)GetMemory(arrlength,sizeof(arrtype),&(obj)->Mem.CurPtr) 150 | 151 | #else 152 | 153 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj)\ 154 | IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength) 155 | 156 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj)\ 157 | arrtype arrname[arrlength] 158 | 159 | 160 | #endif 161 | #else 162 | #if !defined (NO_SCRATCH_MEMORY_USED) 163 | #define PRE_ALLOC_ARRAY(align,arrtype,arrname,arrlength)\ 164 | arrtype *arrname 165 | 166 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj)\ 167 | arrname = (arrtype*)IPP_ALIGNED_PTR((obj)->Mem.CurPtr,align);\ 168 | (obj)->Mem.CurPtr += ((arrlength)+IPP_MALLOC_ALIGNED_##align##BYTES/sizeof(arrtype))*sizeof(arrtype) 169 | 170 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj)\ 171 | arrname = (arrtype*)IPP_ALIGNED_PTR((obj)->Mem.CurPtr,sizeof(arrtype));\ 172 | (obj)->Mem.CurPtr += ((arrlength)+1)*sizeof(arrtype) 173 | 174 | #else 175 | #define PRE_ALLOC_ARRAY(align,arrtype,arrname,arrlength)\ 176 | IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength) 177 | 178 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj) 179 | 180 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj) 181 | 182 | 183 | #endif 184 | #endif 185 | 186 | #if !defined (NO_SCRATCH_MEMORY_USED) 187 | #if defined(__ICC) || defined( __ICL ) || defined ( __ECL ) 188 | #pragma message("Scratch memory enabled") 189 | #endif 190 | #define LOCAL_ARRAY_FREE(arrtype,arrname,arrlength,obj)\ 191 | arrname=NULL;\ 192 | (obj)->Mem.CurPtr -= ((arrlength)+1)*sizeof(arrtype) 193 | 194 | #define LOCAL_ALIGN_ARRAY_FREE(align,arrtype,arrname,arrlength,obj)\ 195 | arrname=NULL;\ 196 | (obj)->Mem.CurPtr -= ((arrlength)+IPP_MALLOC_ALIGNED_##align##BYTES/sizeof(arrtype))*sizeof(arrtype) 197 | 198 | #define CLEAR_SCRATCH_MEMORY(obj)\ 199 | (obj)->Mem.CurPtr = (obj)->Mem.base 200 | 201 | #define OPEN_SCRATCH_BLOCK(obj)\ 202 | (obj)->Mem.VecPtr[(obj)->Mem.offset] = IPP_INT_PTR((obj)->Mem.CurPtr);\ 203 | (obj)->Mem.offset++ 204 | 205 | #define CLOSE_SCRATCH_BLOCK(obj)\ 206 | (obj)->Mem.offset--;\ 207 | (obj)->Mem.CurPtr = (char *)(obj)->Mem.VecPtr[(obj)->Mem.offset] 208 | #else 209 | #define LOCAL_ARRAY_FREE(arrtype,arrname,arrlength,obj) 210 | 211 | #define LOCAL_ALIGN_ARRAY_FREE(align,arrtype,arrname,arrlength,obj) 212 | 213 | #define CLEAR_SCRATCH_MEMORY(obj) 214 | 215 | #define OPEN_SCRATCH_BLOCK(obj) 216 | 217 | #define CLOSE_SCRATCH_BLOCK(obj) 218 | #endif 219 | 220 | #endif /*__SCRATCHMEM_H__*/ 221 | -------------------------------------------------------------------------------- /G729-float/api/usc729fp.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright (c) 2004 Intel Corporation. All Rights Reserved. 8 | // 9 | ***************************************************************************/ 10 | 11 | #include "owng729fp.h" 12 | #include "g729api.h" 13 | #include 14 | #include 15 | 16 | static USC_Status GetInfo(USC_Handle handle, USC_CodecInfo *pInfo); 17 | static USC_Status NumAlloc(const USC_Option *options, int *nbanks); 18 | static USC_Status MemAlloc(const USC_Option *options, USC_MemBank *pBanks); 19 | static USC_Status Init(const USC_Option *options, const USC_MemBank *pBanks, USC_Handle *handle); 20 | static USC_Status Reinit(USC_Modes *modes, USC_Handle handle ); 21 | static USC_Status Control(USC_Handle handle, USC_Modes *modes); 22 | static USC_Status Encode(USC_Handle handle, const USC_PCMStream *in, USC_Bitstream *out); 23 | static USC_Status Decode(USC_Handle handle, const USC_Bitstream *in, USC_PCMStream *out); 24 | 25 | #define BITSTREAM_SIZE 15 26 | 27 | typedef struct { 28 | int direction; 29 | void *Object; 30 | } G729_Handle; 31 | 32 | /* global usc vector table */ 33 | USC_Fxns USC_G729FP_Fxns={ 34 | { 35 | GetInfo, 36 | NumAlloc, 37 | MemAlloc, 38 | Init, 39 | Reinit, 40 | Control, 41 | Encode, 42 | Decode 43 | } 44 | }; 45 | 46 | static USC_Option params; /* what is supported */ 47 | static USC_PCMType pcmType; /* codec audio source */ 48 | 49 | static USC_Status GetInfo(USC_Handle handle, USC_CodecInfo *pInfo) 50 | { 51 | pInfo->name = "G729"; 52 | if (handle == NULL) { 53 | pInfo->params = ¶ms; 54 | pInfo->pcmType = &pcmType; 55 | pInfo->params->modes.bitrate = G729_CODEC; 56 | pInfo->params->modes.truncate = 0; 57 | pInfo->params->direction = 0; 58 | pInfo->params->modes.vad = G729Encode_VAD_Disabled; 59 | } 60 | pInfo->pcmType->sample_frequency = 8000; 61 | pInfo->maxbitsize = BITSTREAM_SIZE; 62 | pInfo->pcmType->bitPerSample = 8; 63 | pInfo->params->modes.hpf = 0; 64 | pInfo->params->modes.pf = 0; 65 | pInfo->params->law = 0; 66 | return USC_NoError; 67 | } 68 | 69 | static USC_Status NumAlloc(const USC_Option *options, int *nbanks) 70 | { 71 | *nbanks = 1; 72 | return USC_NoError; 73 | } 74 | 75 | static USC_Status MemAlloc(const USC_Option *options, USC_MemBank *pBanks) 76 | { 77 | unsigned int nbytes; 78 | pBanks->pMem = NULL; 79 | if (options->direction == 0) /* encode only */ 80 | { 81 | apiG729Encoder_Alloc(options->modes.bitrate, &nbytes); 82 | pBanks->nbytes = nbytes+sizeof(int); /* include direction in handle */ 83 | } 84 | else if (options->direction == 1) /* decode only */ 85 | { 86 | apiG729Decoder_Alloc(options->modes.bitrate, &nbytes); 87 | pBanks->nbytes = nbytes+sizeof(int); /* include direction in handle */ 88 | } else { 89 | return USC_NoOperation; 90 | } 91 | return USC_NoError; 92 | } 93 | 94 | static USC_Status Init(const USC_Option *options, const USC_MemBank *pBanks, USC_Handle *handle) 95 | { 96 | G729_Handle *g729_handle; 97 | *handle = (USC_Handle*)pBanks->pMem; 98 | g729_handle = (G729_Handle*)*handle; 99 | g729_handle->direction = options->direction; 100 | 101 | if (options->direction == 0) /* encode only */ 102 | { 103 | G729Encoder_Obj *EncObj = (G729Encoder_Obj *)&g729_handle->Object; 104 | apiG729Encoder_Init((G729Encoder_Obj*)EncObj, 105 | (G729Codec_Type)options->modes.bitrate,options->modes.vad); 106 | } 107 | else if (options->direction == 1) /* decode only */ 108 | { 109 | G729Decoder_Obj *DecObj = (G729Decoder_Obj *)&g729_handle->Object; 110 | apiG729Decoder_Init((G729Decoder_Obj*)DecObj, (G729Codec_Type)options->modes.bitrate); 111 | } else { 112 | return USC_NoOperation; 113 | } 114 | return USC_NoError; 115 | } 116 | 117 | static USC_Status Reinit(USC_Modes *modes, USC_Handle handle ) 118 | { 119 | G729_Handle *g729_handle; 120 | g729_handle = (G729_Handle*)handle; 121 | 122 | if (g729_handle->direction == 0) /* encode only */ 123 | { 124 | G729Encoder_Obj *EncObj = (G729Encoder_Obj *)&g729_handle->Object; 125 | apiG729Encoder_Init((G729Encoder_Obj*)EncObj, modes->bitrate, modes->vad); 126 | } 127 | else if (g729_handle->direction == 1) /* decode only */ 128 | { 129 | G729Decoder_Obj *DecObj = (G729Decoder_Obj *)&g729_handle->Object; 130 | apiG729Decoder_Init((G729Decoder_Obj*)DecObj, modes->bitrate); 131 | } else { 132 | return USC_NoOperation; 133 | } 134 | return USC_NoError; 135 | } 136 | 137 | static USC_Status Control(USC_Handle handle, USC_Modes *modes) 138 | { 139 | return USC_NoError; 140 | } 141 | 142 | static USC_Status Encode(USC_Handle handle, const USC_PCMStream *in, USC_Bitstream *out) 143 | { 144 | G729_Handle *g729_handle; 145 | G729Encoder_Obj *EncObj; 146 | g729_handle = (G729_Handle*)handle; 147 | EncObj = (G729Encoder_Obj *)&g729_handle->Object; 148 | 149 | if(apiG729Encode(EncObj,(const short*)in->pBuffer,out->pBuffer,in->bitrate,&out->frametype) != APIG729_StsNoErr){ 150 | return USC_NoOperation; 151 | } 152 | return USC_NoError; 153 | } 154 | 155 | static USC_Status Decode(USC_Handle handle, const USC_Bitstream *in, USC_PCMStream *out) 156 | { 157 | G729_Handle *g729_handle; 158 | G729Decoder_Obj *DecObj; 159 | g729_handle = (G729_Handle*)handle; 160 | DecObj = (G729Decoder_Obj *)&g729_handle->Object; 161 | 162 | if(apiG729Decode(DecObj,(const unsigned char*)in->pBuffer,in->frametype,(unsigned short*)out->pBuffer) != APIG729_StsNoErr){ 163 | return USC_NoOperation; 164 | } 165 | return USC_NoError; 166 | } 167 | 168 | 169 | -------------------------------------------------------------------------------- /G729-float/build.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # 4 | # Usage: build.sh {gcc} 5 | # 6 | 7 | IPPENV=${IPPROOT}/tools/env/ippvars32.sh 8 | 9 | if [ ! -x "${IPPENV}" ]; then 10 | IPPENV=/opt/intel/ipp41/ia32_itanium/tools/env/ippvars32.sh 11 | fi 12 | 13 | if [ ! -x "${IPPENV}" ]; then 14 | IPPENV=/opt/intel/ipp41_eval/ia32_itanium/tools/env/ippvars32.sh 15 | fi 16 | 17 | if [ ! -x "${IPPENV}" ]; then 18 | @echo -e "*************************************************************************" 19 | @echo -e "Intel(R) IPP is not found!" 20 | @echo -e "Please install Intel(R) IPP or set IPPROOT environment variable correctly." 21 | @echo -e "*************************************************************************" 22 | exit 23 | fi 24 | 25 | ARG=$1 26 | 27 | CC=gcc 28 | CXX=g++ 29 | 30 | if [ "${ARG}" == "" ]; then 31 | 32 | CCFIND=/opt/intel/compiler60/ia32/bin/iccvars.sh 33 | if [ -x "${CCFIND}" ]; then 34 | CCENV=${CCFIND} 35 | fi 36 | 37 | CCFIND=/opt/intel/compiler70/ia32/bin/iccvars.sh 38 | if [ -x "${CCFIND}" ]; then 39 | CCENV=${CCFIND} 40 | fi 41 | 42 | CCFIND=/opt/intel/compiler80/ia32/bin/iccvars.sh 43 | if [ -x "${CCFIND}" ]; then 44 | CCENV=${CCFIND} 45 | fi 46 | 47 | CCFIND=/opt/intel_cc_80/bin/iccvars.sh 48 | if [ -x "${CCFIND}" ]; then 49 | CCENV=${CCFIND} 50 | fi 51 | 52 | if [ "${CCENV}" ]; then 53 | . ${CCENV} 54 | CC=icc 55 | CXX=icc 56 | fi 57 | 58 | fi 59 | 60 | . ${IPPENV} 61 | 62 | make clean 63 | make CC=${CC} CXX=${CXX} 64 | -------------------------------------------------------------------------------- /G729-float/include/g729api.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729-float/include/g729api.h -------------------------------------------------------------------------------- /G729-float/include/usc.h: -------------------------------------------------------------------------------- 1 | /* 2 | // INTEL CORPORATION PROPRIETARY INFORMATION 3 | // This software is supplied under the terms of a license agreement or 4 | // nondisclosure agreement with Intel Corporation and may not be copied 5 | // or disclosed except in accordance with the terms of that agreement. 6 | // Copyright(c) 2004 Intel Corporation. All Rights Reserved. 7 | // 8 | // Unified Speech Codec sample interface main header. 9 | // Structures and functions declarations. 10 | */ 11 | #ifndef __USC_H__ 12 | #define __USC_H__ 13 | 14 | #if defined( USC_W32DLL ) 15 | #if defined( _MSC_VER ) || defined( __ICL ) || defined ( __ECL ) 16 | #define USCFUN __declspec(dllexport) 17 | #else 18 | #define USCFUN extern 19 | #endif 20 | #else 21 | #define USCFUN extern 22 | #endif 23 | 24 | /* USC error code */ 25 | typedef enum { 26 | /* errors: negative response */ 27 | USC_NotInitialized = -8, 28 | USC_InvalidHandler = -7, 29 | USC_NoOperation = -6, 30 | USC_UnsupportedPCMType = -5, 31 | USC_UnsupportedBitRate = -4, 32 | USC_UnsupportedFrameType = -3, 33 | USC_UnsupportedVADType = -2, 34 | USC_BadDataPointer = -1, 35 | USC_NoError = 0, 36 | /* warnings: positive response */ 37 | USC_StateNotChanged = 1 38 | }USC_Status; 39 | 40 | /* USC codec modes, (may be alternated) */ 41 | typedef struct { 42 | int bitrate; /* codec dependent bitrate index */ 43 | int truncate; /* 0 - no truncate */ 44 | int vad; /* 0 - disabled, otherwize vad type (1,2, more if any) */ 45 | int hpf; /* high pass filter: 1- on, 0- off */ 46 | int pf; /* post filter: 1- on, 0- off */ 47 | }USC_Modes; 48 | 49 | 50 | /* USC codec option */ 51 | typedef struct { 52 | int direction; /* 0 - encode only, 1 - decode only, 2 - both */ 53 | int law; /* 0 - pcm, 1 - aLaw, 2 -muLaw */ 54 | USC_Modes modes; 55 | }USC_Option; 56 | 57 | /* USC PCM stream type */ 58 | typedef struct { 59 | int sample_frequency; /* sample rate in Hz */ 60 | int bitPerSample; /* bit per sample */ 61 | }USC_PCMType; 62 | 63 | /* USC codec information */ 64 | typedef struct { 65 | const char *name; /* codec name */ 66 | int framesize; /* PCM frame size in bytes */ 67 | int maxbitsize; /* bitstream max frame size in bytes */ 68 | USC_Option *params; /* what is supported */ 69 | USC_PCMType *pcmType; /* codec audio source */ 70 | }USC_CodecInfo; 71 | 72 | 73 | /* USC memory banks */ 74 | typedef struct { 75 | char *pMem; 76 | int nbytes; 77 | }USC_MemBank; 78 | 79 | /* USC PCM stream */ 80 | typedef struct { 81 | char *pBuffer; 82 | int nbytes; /* pcm data size in byte */ 83 | USC_PCMType pcmType; 84 | int bitrate; /* codec dependent bitrate index */ 85 | }USC_PCMStream; 86 | 87 | /* USC compressed bits */ 88 | typedef struct { 89 | char *pBuffer; 90 | int nbytes; /* bitstream size in byte */ 91 | int frametype; /* codec specific frame type (transmission frame type) */ 92 | int bitrate; /* codec dependent bitrate index */ 93 | }USC_Bitstream; 94 | 95 | typedef void* USC_Handle; 96 | 97 | /* USC functions table. 98 | Each codec should supply a function table structure, which is derived from this base table. 99 | Codec table is to be specified for each codec by name as follows: 100 | USC__Fxns, for example USC_g729_Fxns. 101 | The typical usage model: 102 | - Questing a codec about memory requirement using MemAlloc() function 103 | which returns a memory banks description table with required bank sizes. 104 | - Use Init() function to create codec instance according to modes (vad, rate etc) requested. 105 | Codec handle is returned. Thus different instances of particular codec may be created 106 | and used in parallel. 107 | - Encode(), Decode() - compression/decompression functions. 108 | - GetInfo() - inquire codec state or codec requirement. 109 | */ 110 | 111 | typedef struct { 112 | 113 | /* Get_Info() - quest codec information 114 | General inquiry is possible without initialization when handle==NULL. 115 | */ 116 | USC_Status (*GetInfo)(USC_Handle handle, USC_CodecInfo *pInfo); 117 | 118 | /* NumAlloc() - inquiring number of memory buffers 119 | options - codec control. 120 | nbanks - number of table entries (size of pBanks table). 121 | */ 122 | USC_Status (*NumAlloc)(const USC_Option *options, int *nbanks); 123 | 124 | /* MemAlloc() - inquiring information about memory requirement 125 | (buffers to be allocated) 126 | options - codec control. 127 | pBanks - input table of size nbanks to be filled with memory requirement 128 | (pMem=NULL if to be allocated ) 129 | */ 130 | USC_Status (*MemAlloc)(const USC_Option *options, USC_MemBank *pBanks); 131 | 132 | /* Init() - create codec handle and set it to initial state 133 | options - codec control 134 | pBanks - allocated memory banks of number as after MemAlloc 135 | handle - pointer to the output codec instance pointer 136 | */ 137 | USC_Status (*Init)(const USC_Option *options, const USC_MemBank *pBanks, USC_Handle *handle ); 138 | 139 | /* Reinit() - set codec to initial state 140 | handle - pointer to the input codec instance pointer 141 | */ 142 | USC_Status (*Reinit)(USC_Modes *modes, USC_Handle handle ); 143 | 144 | /* Control() - alternate codec modes 145 | The only modes were set on Init() may be alternated. 146 | modes - what modes to alternate 147 | handle - pointer to the input codec instance pointer 148 | */ 149 | USC_Status (*Control)(USC_Handle handle, USC_Modes *modes); 150 | 151 | /* Encode() 152 | in - input audio stream (pcm) pointer, 153 | out - output bitstream pointer , 154 | */ 155 | USC_Status (*Encode)(USC_Handle handle, const USC_PCMStream *in, USC_Bitstream *out); 156 | 157 | /* Decode() 158 | in - input bitstream pointer, 159 | out - output audio stream (pcm) pointer, 160 | */ 161 | USC_Status (*Decode)(USC_Handle handle, const USC_Bitstream *in, USC_PCMStream *out); 162 | 163 | } USC_stdFxns; 164 | 165 | /* 166 | USC extended function table 167 | */ 168 | 169 | typedef struct { 170 | USC_stdFxns std; 171 | /* function extension, any */ 172 | }USC_Fxns; 173 | 174 | #endif /* __USC_H__ */ 175 | -------------------------------------------------------------------------------- /G729-float/readme.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729-float/readme.htm -------------------------------------------------------------------------------- /G729-float/samples/decoder.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729-float/samples/decoder.c -------------------------------------------------------------------------------- /G729-float/samples/decoder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729-float/samples/decoder.h -------------------------------------------------------------------------------- /G729-float/samples/encoder.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729-float/samples/encoder.c -------------------------------------------------------------------------------- /G729-float/samples/encoder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729-float/samples/encoder.h -------------------------------------------------------------------------------- /G729-float/samples/g729_slin_ex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * One frame of raw G729 data 3 | */ 4 | 5 | static unsigned char g729_slin_ex[] = { 6 | 0xf9, 0xa3, 0xc9, 0xe0, 0x0, 0xfa, 0xdd, 0xa9, 0x97, 0x7d }; 7 | 8 | -------------------------------------------------------------------------------- /G729-float/samples/gen_test.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | int main(int argc, char *argv[]) { 5 | 6 | int i; 7 | 8 | FILE *f = fopen("test1.g729", "r"); 9 | for(i = 0; i < 10; i++) 10 | printf("0x%x, ", fgetc(f)); 11 | fclose(f); 12 | 13 | return 0; 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /G729-float/samples/my_dec.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "usc.h" 7 | #include 8 | #include 9 | #include 10 | #include "decoder.h" 11 | 12 | 13 | int main(int argc, char *argv[]) { 14 | 15 | char *bitstream_buf; 16 | char *buf_out; 17 | char *p; 18 | char *f; 19 | long file_size; 20 | int i; 21 | 22 | if(argc != 3) { 23 | fprintf(stderr, "Usage: my_dec \n"); 24 | exit(-1); 25 | } 26 | 27 | fprintf(stderr, "Converting %s to %s\n", argv[1], argv[2]); 28 | 29 | 30 | USC_Fxns *USC_CODEC_Fxns; 31 | USC_CodecInfo pInfo; 32 | USC_Handle decoder; 33 | 34 | USC_Bitstream in; 35 | USC_PCMStream out; 36 | USC_MemBank* pBanks; 37 | 38 | int nbanks = 0; 39 | int maxbitsize; 40 | int inFrameSize = 10; 41 | int outFrameSize; 42 | 43 | USC_CODEC_Fxns = USC_GetCodecByName (); 44 | USC_CODEC_Fxns->std.GetInfo((USC_Handle)NULL, &pInfo); /* codec info */ 45 | 46 | ((USC_Option*)pInfo.params)->modes.bitrate = 0; 47 | ((USC_Option*)pInfo.params)->modes.truncate = 1; 48 | ((USC_Option*)pInfo.params)->direction = 1; 49 | 50 | FILE *f_in = fopen(argv[1], "r"); 51 | FILE *f_out = fopen(argv[2], "w"); 52 | 53 | fseek(f_in, 0, SEEK_END); 54 | file_size = ftell(f_in); 55 | fseek(f_in, 0, SEEK_SET); 56 | 57 | bitstream_buf = ippsMalloc_8s(file_size); 58 | fread(bitstream_buf, file_size, 1, f_in); 59 | p = bitstream_buf; 60 | f = bitstream_buf + file_size; 61 | 62 | USC_CODEC_Fxns->std.NumAlloc(pInfo.params, &nbanks); 63 | pBanks = (USC_MemBank*)ippsMalloc_8u(sizeof(USC_MemBank)*nbanks); 64 | USC_CODEC_Fxns->std.MemAlloc(pInfo.params, pBanks); 65 | for(i=0; inbytes))) { 67 | printf("\nLow memory: %d bytes not allocated\n",pBanks->nbytes); 68 | return -1; 69 | } 70 | } 71 | 72 | outFrameSize = getOutFrameSize(); 73 | 74 | buf_out = ippsMalloc_8s(getOutFrameSize()); 75 | 76 | maxbitsize = pInfo.maxbitsize; 77 | USC_CODEC_Fxns->std.Init(pInfo.params, pBanks, &decoder); 78 | 79 | ippCoreSetFlushToZero( 1, NULL ); 80 | 81 | in.nbytes = maxbitsize; 82 | in.bitrate = 0; 83 | in.frametype = 3; 84 | out.pBuffer = buf_out; 85 | out.pcmType.bitPerSample = 0; 86 | out.pcmType.sample_frequency = 0; 87 | 88 | USC_CODEC_Fxns->std.Reinit(&((USC_Option*)pInfo.params)->modes, decoder); 89 | 90 | while(p < f) { 91 | in.pBuffer = p; 92 | USC_CODEC_Fxns->std.Decode (decoder, &in, &out); 93 | fwrite(out.pBuffer, outFrameSize, 1, f_out); 94 | 95 | p += inFrameSize; 96 | } 97 | 98 | fclose(f_out); 99 | fclose(f_in); 100 | 101 | } 102 | 103 | -------------------------------------------------------------------------------- /G729-float/samples/my_enc.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "usc.h" 7 | #include 8 | #include 9 | #include 10 | #include "encoder.h" 11 | 12 | 13 | int main(int argc, char *argv[]) { 14 | 15 | char *buf_in; 16 | char *bitstream_buf; 17 | char *p; 18 | char *f; 19 | long file_size; 20 | int i; 21 | 22 | if(argc != 3) { 23 | fprintf(stderr, "Usage: my_enc audio.raw audio.g729\n"); 24 | exit(-1); 25 | } 26 | 27 | fprintf(stderr, "Converting %s to %s\n", argv[1], argv[2]); 28 | 29 | USC_Fxns *USC_CODEC_Fxns; 30 | USC_CodecInfo pInfo; 31 | USC_Handle encoder; 32 | 33 | USC_PCMStream in; 34 | USC_Bitstream out; 35 | USC_MemBank* pBanks; 36 | 37 | int nbanks = 0; 38 | int maxbitsize; 39 | int inFrameSize; 40 | int outFrameSize = 0; 41 | 42 | USC_CODEC_Fxns = USC_GetCodecByName_xx2 (); 43 | USC_CODEC_Fxns->std.GetInfo((USC_Handle)NULL, &pInfo); /* codec info */ 44 | ((USC_Option*)pInfo.params)->modes.truncate = 1; 45 | ((USC_Option*)pInfo.params)->direction = 0; 46 | ((USC_Option*)pInfo.params)->modes.vad = 0; 47 | 48 | FILE *f_in = fopen(argv[1], "r"); 49 | FILE *f_out = fopen(argv[2], "w"); 50 | 51 | fseek(f_in, 0, SEEK_END); 52 | file_size = ftell(f_in); 53 | fseek(f_in, 0, SEEK_SET); 54 | 55 | buf_in = ippsMalloc_8s(file_size); 56 | fread(buf_in, file_size, 1, f_in); 57 | p = buf_in; 58 | f = buf_in + file_size; 59 | 60 | USC_CODEC_Fxns->std.NumAlloc(pInfo.params, &nbanks); 61 | pBanks = (USC_MemBank*)ippsMalloc_8u(sizeof(USC_MemBank)*nbanks); 62 | USC_CODEC_Fxns->std.MemAlloc(pInfo.params, pBanks); 63 | for(i=0; inbytes))) { 65 | printf("\nLow memory: %d bytes not allocated\n",pBanks->nbytes); 66 | return -1; 67 | } 68 | } 69 | 70 | inFrameSize = getInFrameSize(); 71 | outFrameSize = getOutFrameSize_xx3(); 72 | 73 | bitstream_buf = ippsMalloc_8s(pInfo.maxbitsize); 74 | 75 | in.bitrate = pInfo.params->modes.bitrate; 76 | maxbitsize = pInfo.maxbitsize; 77 | USC_CODEC_Fxns->std.Init(pInfo.params, pBanks, &encoder); 78 | 79 | ippCoreSetFlushToZero( 1, NULL ); 80 | in.pcmType.bitPerSample = pInfo.pcmType->bitPerSample; 81 | in.pcmType.sample_frequency = pInfo.pcmType->sample_frequency; 82 | out.nbytes = maxbitsize; 83 | out.pBuffer = bitstream_buf; 84 | 85 | USC_CODEC_Fxns->std.Reinit(&((USC_Option*)pInfo.params)->modes, encoder); 86 | 87 | while(p < f) { 88 | in.pBuffer = p; 89 | USC_CODEC_Fxns->std.Encode (encoder, &in, &out); 90 | fwrite(out.pBuffer, 10, 1, f_out); 91 | p += inFrameSize; 92 | } 93 | 94 | fclose(f_out); 95 | fclose(f_in); 96 | 97 | return 0; 98 | } 99 | 100 | 101 | -------------------------------------------------------------------------------- /G729-float/samples/slin_g729_ex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Signed 16 bit audio data 3 | * 4 | */ 5 | static signed short slin_g729_ex[] = { 6 | 0x0873, 0x06d9, 0x038c, 0x0588, 0x0409, 0x033d, 0x0311, 0xff6c, 0xfeef, 0xfd3e, 7 | 0xfdff, 0xff7a, 0xff6d, 0xffec, 0xff36, 0xfd62, 0xfda7, 0xfc6c, 0xfe67, 0xffe1, 8 | 0x003d, 0x01cc, 0x0065, 0x002a, 0xff83, 0xfed9, 0xffba, 0xfece, 0xff42, 0xff16, 9 | 0xfe85, 0xff31, 0xff02, 0xfdff, 0xfe32, 0xfe3f, 0xfed5, 0xff65, 0xffd4, 0x005b, 10 | 0xff88, 0xff01, 0xfebd, 0xfe95, 0xff46, 0xffe1, 0x00e2, 0x0165, 0x017e, 0x01c9, 11 | 0x0182, 0x0146, 0x00f9, 0x00ab, 0x006f, 0xffe8, 0xffd8, 0xffc4, 0xffb2, 0xfff9, 12 | 0xfffe, 0x0023, 0x0018, 0x000b, 0x001a, 0xfff7, 0x0014, 0x000b, 0x0004, 0x000b, 13 | 0xfff1, 0xff4f, 0xff3f, 0xff42, 0xff5e, 0xffd4, 0x0014, 0x0067, 0x0051, 0x003b, 14 | 0x0034, 0xfff9, 0x000d, 0xff54, 0xff54, 0xff52, 0xff3f, 0xffcc, 0xffe6, 0x00fc, 15 | 0x00fa, 0x00e4, 0x00f3, 0x0021, 0x0011, 0xffa1, 0xffab, 0xffdb, 0xffa5, 0x0009, 16 | 0xffd2, 0xffe6, 0x0007, 0x0096, 0x00e4, 0x00bf, 0x00ce, 0x0048, 0xffe8, 0xffab, 17 | 0xff8f, 0xffc3, 0xffc1, 0xfffc, 0x0002, 0xfff1, 0x000b, 0x00a7, 0x00c5, 0x00cc, 18 | 0x015e, 0x00e4, 0x0094, 0x0029, 0xffc7, 0xffc3, 0xff86, 0xffe4, 0xffe6, 0xffec, 19 | 0x000f, 0xffe3, 0x0028, 0x004b, 0xffaf, 0xffcb, 0xfedd, 0xfef8, 0xfe83, 0xfeba, 20 | 0xff94, 0xff94, 0xffbe, 0xffa8, 0xff0d, 0xff32, 0xff58, 0x0021, 0x0087, 0x00be, 21 | 0x0115, 0x007e, 0x0052, 0xfff0, 0xffc9, 0xffe8, 0xffc4, 0x0014, 0xfff0, 0xfff5, 22 | 0xfffe, 0xffda, 0x000b, 0x0010, 0x006f, 0x006f, 0x0052, 0x0045, 0xffee, 0xffea, 23 | 0xffcb, 0xffdf, 0xfffc, 0xfff0, 0x0012, 0xfff7, 0xfffe, 0x0018, 0x0050, 0x0066, 24 | 0x0047, 0x0028, 0xfff7, 0xffe8, 0xffec, 0x0007, 0x001d, 0x0016, 0x00c4, 0x0093, 25 | 0x007d, 0x0052, 0x00a5, 0x0091, 0x003c, 0x0041, 0xffd1, 0xffda, 0xffc6, 0xfff0, 26 | 0x001d, 0xfffe, 0x0024, 0xffee, 0xfff3, 0xfff0, 0xffea, 0x0012, 0xfff3, 0xfff7, 27 | 0xffda, 0xffca, 0xffda, 0xffdf, 0xfff3, 0xfff7, 0xff54, 0xff7c, 0xff8c, 0xffb9, 28 | 0x0012, 0x0012, 0x004c, 0x0007, 0xff50, 0xff66, 0xff54, 0xffa9, 0xffdc, 0xfff9, 29 | 0x0038, 0xfff9, 0x00d2, 0x0096, 0x008a, 0x0079, 0xfff5, 0x0019, 0xffad, 0xfffc }; 30 | 31 | -------------------------------------------------------------------------------- /G729-float/samples/util_d.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729-float/samples/util_d.c -------------------------------------------------------------------------------- /G729-float/samples/util_d.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729-float/samples/util_d.h -------------------------------------------------------------------------------- /G729-float/samples/util_e.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729-float/samples/util_e.c -------------------------------------------------------------------------------- /G729-float/samples/util_e.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729-float/samples/util_e.h -------------------------------------------------------------------------------- /G729-float/vm/include/sys/vm_types_linux32.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Linux types header. 11 | */ 12 | #ifdef LINUX32 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | typedef unsigned long vm_var32; 19 | typedef unsigned long long vm_var64; 20 | typedef char vm_char; 21 | 22 | #define VM_ALIGN_DECL(X,Y) Y __attribute__ ((aligned(X))) 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | /* vm_thread.h */ 31 | typedef struct { 32 | pthread_t handle; 33 | int is_valid; 34 | } vm_thread; 35 | 36 | /* vm_event.h */ 37 | typedef struct { 38 | ast_cond_t cond; 39 | ast_mutex_t mutex; 40 | int manual; 41 | int state; 42 | } vm_event; 43 | 44 | /* vm_mmap.h */ 45 | typedef struct { 46 | int fd; 47 | void *address; 48 | size_t sizet; 49 | } vm_mmap; 50 | 51 | /* vm_mutex.h */ 52 | typedef struct { 53 | ast_mutex_t handle; 54 | int is_valid; 55 | } vm_mutex; 56 | 57 | /* vm_semaphore.h */ 58 | typedef struct { 59 | ast_cond_t cond; 60 | ast_mutex_t mutex; 61 | int count; 62 | } vm_semaphore; 63 | 64 | #ifdef __cplusplus 65 | }; 66 | #endif 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /G729-float/vm/include/vm_thread.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Threading header. 11 | */ 12 | #ifndef __VM_THREAD_H__ 13 | #define __VM_THREAD_H__ 14 | #include "vm_types.h" 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /* IMPORTANT: 21 | * The thread return value is always saved for the calling thread to 22 | * collect. To avoid memory leak, always vm_thread_wait() for the 23 | * child thread to terminate in the calling thread. 24 | */ 25 | 26 | typedef void *(*vm_thread_callback)(void *); 27 | 28 | typedef enum { 29 | VM_THREAD_PRIORITY_HIGHEST, 30 | VM_THREAD_PRIORITY_HIGH, 31 | VM_THREAD_PRIORITY_NORMAL, 32 | VM_THREAD_PRIORITY_LOW, 33 | VM_THREAD_PRIORITY_LOWEST 34 | } vm_thread_priority; 35 | 36 | /* Set the thread handler to an invalid value */ 37 | void vm_thread_set_invalid(vm_thread *thread); 38 | 39 | /* Verify if the thread handler is valid */ 40 | int vm_thread_is_valid(vm_thread *thread); 41 | 42 | /* Create a thread. The thread is set to run at the call. 43 | Return 1 if successful */ 44 | int vm_thread_create(vm_thread *thread,vm_thread_callback func,void *arg); 45 | 46 | /* Wait until a thread exists. */ 47 | void vm_thread_wait(vm_thread *thread); 48 | 49 | /* Terminate a thread with blocking */ 50 | void vm_thread_terminate(vm_thread *thread); 51 | 52 | /* Terminate the current thread */ 53 | void vm_thread_exit(void); 54 | 55 | /* Set thread priority. Return 1 if successful */ 56 | int vm_thread_set_priority(vm_thread *thread, vm_thread_priority priority); 57 | 58 | #ifdef __cplusplus 59 | }; 60 | #endif 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /G729-float/vm/include/vm_types.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Common types header. 11 | */ 12 | #ifndef __VM_TYPES_H__ 13 | #define __VM_TYPES_H__ 14 | #ifdef WIN32 15 | #include "sys/vm_types_win32.h" 16 | #elif LINUX32 17 | #include "sys/vm_types_linux32.h" 18 | #endif 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | typedef vm_var64 vm_sizet; 25 | 26 | #define VM_ALIGN16_DECL(X) VM_ALIGN_DECL(16,X) 27 | #define VM_ALIGN32_DECL(X) VM_ALIGN_DECL(32,X) 28 | 29 | #ifdef __cplusplus 30 | }; 31 | #endif 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /G729-float/vm/src/vm_thread_linux32.c: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Threading primitives for Linux. 11 | */ 12 | #ifdef LINUX32 13 | #include 14 | #include 15 | #include 16 | #include "vm_thread.h" 17 | 18 | /* Set the thread handler an invalid value */ 19 | void vm_thread_set_invalid(vm_thread *thread) 20 | { 21 | thread->is_valid=0; 22 | } 23 | 24 | /* Verify if the thread handler is valid */ 25 | int vm_thread_is_valid(vm_thread *thread) 26 | { 27 | return thread->is_valid; 28 | } 29 | 30 | /* Create a thread. Return 1 if success */ 31 | int vm_thread_create(vm_thread *thread, 32 | void *(*vm_thread_func)(void *),void *arg) 33 | { 34 | pthread_attr_t attr; 35 | pthread_attr_init(&attr); 36 | pthread_attr_setschedpolicy(&attr,geteuid()?SCHED_OTHER:SCHED_RR); 37 | thread->is_valid=!pthread_create(&thread->handle,&attr,vm_thread_func,arg); 38 | pthread_attr_destroy(&attr); 39 | vm_thread_set_priority(thread, VM_THREAD_PRIORITY_LOWEST); 40 | return thread->is_valid; 41 | } 42 | 43 | /* Terminate the current thread */ 44 | void vm_thread_exit(void) 45 | { 46 | pthread_exit(0); 47 | } 48 | 49 | /* Set thread priority, return 1 if successful */ 50 | int vm_thread_set_priority(vm_thread *thread, vm_thread_priority priority) 51 | { 52 | int policy, pmin, pmax, pmean; 53 | struct sched_param param; 54 | 55 | if (!thread->is_valid) return 0; 56 | pthread_getschedparam(thread->handle,&policy,¶m); 57 | 58 | pmin=sched_get_priority_min(policy); 59 | pmax=sched_get_priority_max(policy); 60 | pmean=(pmin+pmax)/2; 61 | 62 | switch (priority) { 63 | case VM_THREAD_PRIORITY_HIGHEST: 64 | param.sched_priority=pmax; break; 65 | case VM_THREAD_PRIORITY_LOWEST: 66 | param.sched_priority=pmin; break; 67 | case VM_THREAD_PRIORITY_NORMAL: 68 | param.sched_priority=pmean; break; 69 | case VM_THREAD_PRIORITY_HIGH: 70 | param.sched_priority=(pmax+pmean)/2; break; 71 | case VM_THREAD_PRIORITY_LOW: 72 | param.sched_priority=(pmin+pmean)/2; break; 73 | } 74 | 75 | return !pthread_setschedparam(thread->handle,policy,¶m); 76 | } 77 | 78 | /* Wait until a thread exists */ 79 | void vm_thread_wait(vm_thread *thread) 80 | { 81 | if (thread->is_valid) { 82 | pthread_join(thread->handle,NULL); 83 | thread->is_valid=0; 84 | } 85 | } 86 | 87 | /* Terminate a thread */ 88 | void vm_thread_terminate(vm_thread *thread) 89 | { 90 | if (thread->is_valid) { 91 | pthread_cancel(thread->handle); 92 | vm_thread_wait(thread); 93 | } 94 | } 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /G729/Makefile: -------------------------------------------------------------------------------- 1 | ############################### 2 | # DO NOT EDIT BELOW THIS LINE # 3 | ############################### 4 | 5 | # System Specific 6 | INCLSFX=.h 7 | CPPSFX=.c 8 | OBJSFX=.o 9 | EXESFX= 10 | 11 | # IPP Dependencies 12 | IPPINCLS=-I$(IPPROOT)/include 13 | 14 | # Compiler Specifics 15 | CCOPTS=-c -O2 16 | CCDEFS=-D__unix__ -DNDEBUG -DNO_SCRATCH_MEMORY_USED -DLINUX32 17 | CCINCLS=-I./include -I./vm/include $(IPPINCLS) 18 | 19 | include $(ARCH).ini 20 | 21 | LNKOUT=-o 22 | LNKOPTS= 23 | LNKLIBS=$(IPPLIBS) -lpthread 24 | 25 | build: prepare_directory build_encoder build_decoder; @echo "Done" 26 | 27 | ##### api object ##### 28 | CPPSRC_API=$(wildcard ./api/*$(CPPSFX)) 29 | OBJECT_API=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_API)) 30 | 31 | CPPSRC_VM=$(wildcard ./vm/src/*$(CPPSFX)) 32 | OBJECT_VM=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_VM)) 33 | 34 | ##### link encoder example programs ##### 35 | OBJECT_ENCODER=./bin/g729iencoder$(EXESFX) 36 | CPPSRC_ENCODER=$(wildcard ./samples/encoder$(CPPSFX) ./samples/util_e$(CPPSFX) ) 37 | OBJSRC_ENCODER=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_ENCODER)) 38 | 39 | build_encoder: $(OBJECT_ENCODER) ; @echo "done encoder" 40 | 41 | $(OBJECT_ENCODER): $(OBJSRC_ENCODER) $(OBJECT_API) $(OBJECT_VM) 42 | $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS) 43 | 44 | ##### link decoder example programs ##### 45 | OBJECT_DECODER=./bin/g729idecoder$(EXESFX) 46 | CPPSRC_DECODER=$(wildcard ./samples/decoder$(CPPSFX) ./samples/util_d$(CPPSFX)) 47 | OBJSRC_DECODER=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_DECODER)) 48 | 49 | build_decoder: $(OBJECT_DECODER) ; @echo "done decoder" 50 | 51 | $(OBJECT_DECODER): $(OBJSRC_DECODER) $(OBJECT_API) $(OBJECT_VM) 52 | $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS) 53 | 54 | ##### compile encoder & decoder objects all together ##### 55 | OBJECTS=$(OBJECT_API) $(OBJECT_VM)$(OBJSRC_ENCODER) $(OBJSRC_DECODER) 56 | $(OBJECTS): %$(OBJSFX): %$(CPPSFX) 57 | $(CC) $(CCINCLS) $(CCDEFS) $(CCOPTS) -o$@ $< 58 | 59 | prepare_directory: FORCE 60 | @if test ! -d ./bin; then mkdir ./bin; fi 61 | 62 | clean: FORCE 63 | rm -f $(OBJECTS) 64 | 65 | distclean: clean 66 | rm -f $(OBJECT_ENCODER) $(OBJECT_DECODER) 67 | 68 | FORCE: 69 | 70 | -------------------------------------------------------------------------------- /G729/api/decg729.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729/api/decg729.c -------------------------------------------------------------------------------- /G729/api/encg729.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729/api/encg729.c -------------------------------------------------------------------------------- /G729/api/owng729.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729/api/owng729.c -------------------------------------------------------------------------------- /G729/api/owng729.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729/api/owng729.h -------------------------------------------------------------------------------- /G729/api/scratchmem.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2002-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // 10 | // Purpose: scratch/stack memory managment header file 11 | // 12 | */ 13 | 14 | #ifndef __SCRATCHMEM_H__ 15 | #define __SCRATCHMEM_H__ 16 | 17 | #if (defined( __ICL ) || defined ( __ECL )) && (defined( _WIN32 ) && !defined( _WIN64 )) 18 | __INLINE 19 | Ipp32s IPP_INT_PTR( const void* ptr ) { 20 | union { 21 | void* Ptr; 22 | Ipp32s Int; 23 | } dd; 24 | dd.Ptr = (void*)ptr; 25 | return dd.Int; 26 | } 27 | 28 | __INLINE 29 | Ipp32u IPP_UINT_PTR( const void* ptr ) { 30 | union { 31 | void* Ptr; 32 | Ipp32u Int; 33 | } dd; 34 | dd.Ptr = (void*)ptr; 35 | return dd.Int; 36 | } 37 | 38 | #elif (defined( __ICL ) || defined ( __ECL )) && defined( _WIN64 ) 39 | __INLINE 40 | Ipp64s IPP_INT_PTR( const void* ptr ) { 41 | union { 42 | void* Ptr; 43 | Ipp64s Int; 44 | } dd; 45 | dd.Ptr = (void*)ptr; 46 | return dd.Int; 47 | } 48 | 49 | __INLINE 50 | Ipp64u IPP_UINT_PTR( const void* ptr ) { 51 | union { 52 | void* Ptr; 53 | Ipp64u Int; 54 | } dd; 55 | dd.Ptr = (void*)ptr; 56 | return dd.Int; 57 | } 58 | 59 | #elif defined( __ICC ) && defined( linux32 ) 60 | __INLINE 61 | Ipp32s IPP_INT_PTR( const void* ptr ) { 62 | union { 63 | void* Ptr; 64 | Ipp32s Int; 65 | } dd; 66 | dd.Ptr = (void*)ptr; 67 | return dd.Int; 68 | } 69 | 70 | __INLINE 71 | Ipp32u IPP_UINT_PTR( const void* ptr ) { 72 | union { 73 | void* Ptr; 74 | Ipp32u Int; 75 | } dd; 76 | dd.Ptr = (void*)ptr; 77 | return dd.Int; 78 | } 79 | 80 | #elif defined ( __ECC ) && defined( linux64 ) 81 | __INLINE 82 | Ipp64s IPP_INT_PTR( const void* ptr ) { 83 | union { 84 | void* Ptr; 85 | Ipp64s Int; 86 | } dd; 87 | dd.Ptr = (void*)ptr; 88 | return dd.Int; 89 | } 90 | 91 | __INLINE 92 | Ipp64u IPP_UINT_PTR( const void* ptr ) { 93 | union { 94 | void* Ptr; 95 | Ipp64u Int; 96 | } dd; 97 | dd.Ptr = (void*)ptr; 98 | return dd.Int; 99 | } 100 | 101 | #else 102 | #define IPP_INT_PTR( ptr ) ( (long)(ptr) ) 103 | #define IPP_UINT_PTR( ptr ) ( (unsigned long)(ptr) ) 104 | #endif 105 | 106 | #define IPP_BYTES_TO_ALIGN(ptr, align) ((-(IPP_INT_PTR(ptr)&((align)-1)))&((align)-1)) 107 | 108 | #define IPP_ALIGNED_PTR(ptr, align) (void*)( (char*)(ptr) + (IPP_BYTES_TO_ALIGN( ptr, align )) ) 109 | 110 | #define IPP_MALLOC_ALIGNED_BYTES 32 111 | 112 | #define IPP_MALLOC_ALIGNED_0BYTES 0 113 | #define IPP_MALLOC_ALIGNED_1BYTES 1 114 | #define IPP_MALLOC_ALIGNED_8BYTES 8 115 | #define IPP_MALLOC_ALIGNED_16BYTES 16 116 | #define IPP_MALLOC_ALIGNED_32BYTES 32 117 | 118 | #define IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength)\ 119 | arrtype arrname##AlignedArrBuff[(arrlength)+IPP_MALLOC_ALIGNED_##align##BYTES/sizeof(arrtype)];\ 120 | arrtype *arrname = (arrtype*)IPP_ALIGNED_PTR(arrname##AlignedArrBuff,align) 121 | 122 | __INLINE void* GetMemory(int arrlen, int sizeOfElem, char **CurPtr) 123 | { 124 | void *ret; 125 | 126 | ret = (void*)IPP_ALIGNED_PTR(*CurPtr,sizeOfElem); 127 | *CurPtr += (arrlen+1)*sizeOfElem; 128 | 129 | return ret; 130 | } 131 | 132 | __INLINE void* GetAlignMemory(int align, int arrlen, int sizeOfElem, char **CurPtr) 133 | { 134 | void *ret; 135 | 136 | ret = (void*)IPP_ALIGNED_PTR(*CurPtr,align); 137 | *CurPtr += (arrlen+align/sizeOfElem)*sizeOfElem; 138 | 139 | return ret; 140 | } 141 | 142 | #if !defined (SCRATCH_OLD) 143 | #if !defined (NO_SCRATCH_MEMORY_USED) 144 | 145 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj)\ 146 | arrtype *arrname = (arrtype *)GetAlignMemory(align,arrlength,sizeof(arrtype),&(obj)->Mem.CurPtr) 147 | 148 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj)\ 149 | arrtype *arrname = (arrtype *)GetMemory(arrlength,sizeof(arrtype),&(obj)->Mem.CurPtr) 150 | 151 | #else 152 | 153 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj)\ 154 | IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength) 155 | 156 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj)\ 157 | arrtype arrname[arrlength] 158 | 159 | 160 | #endif 161 | #else 162 | #if !defined (NO_SCRATCH_MEMORY_USED) 163 | #define PRE_ALLOC_ARRAY(align,arrtype,arrname,arrlength)\ 164 | arrtype *arrname 165 | 166 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj)\ 167 | arrname = (arrtype*)IPP_ALIGNED_PTR((obj)->Mem.CurPtr,align);\ 168 | (obj)->Mem.CurPtr += ((arrlength)+IPP_MALLOC_ALIGNED_##align##BYTES/sizeof(arrtype))*sizeof(arrtype) 169 | 170 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj)\ 171 | arrname = (arrtype*)IPP_ALIGNED_PTR((obj)->Mem.CurPtr,sizeof(arrtype));\ 172 | (obj)->Mem.CurPtr += ((arrlength)+1)*sizeof(arrtype) 173 | 174 | #else 175 | #define PRE_ALLOC_ARRAY(align,arrtype,arrname,arrlength)\ 176 | IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength) 177 | 178 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj) 179 | 180 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj) 181 | 182 | 183 | #endif 184 | #endif 185 | 186 | #if !defined (NO_SCRATCH_MEMORY_USED) 187 | #if defined(__ICC) || defined( __ICL ) || defined ( __ECL ) 188 | #pragma message("Scratch memory enabled") 189 | #endif 190 | #define LOCAL_ARRAY_FREE(arrtype,arrname,arrlength,obj)\ 191 | arrname=NULL;\ 192 | (obj)->Mem.CurPtr -= ((arrlength)+1)*sizeof(arrtype) 193 | 194 | #define LOCAL_ALIGN_ARRAY_FREE(align,arrtype,arrname,arrlength,obj)\ 195 | arrname=NULL;\ 196 | (obj)->Mem.CurPtr -= ((arrlength)+IPP_MALLOC_ALIGNED_##align##BYTES/sizeof(arrtype))*sizeof(arrtype) 197 | 198 | #define CLEAR_SCRATCH_MEMORY(obj)\ 199 | (obj)->Mem.CurPtr = (obj)->Mem.base 200 | 201 | #define OPEN_SCRATCH_BLOCK(obj)\ 202 | (obj)->Mem.VecPtr[(obj)->Mem.offset] = IPP_INT_PTR((obj)->Mem.CurPtr);\ 203 | (obj)->Mem.offset++ 204 | 205 | #define CLOSE_SCRATCH_BLOCK(obj)\ 206 | (obj)->Mem.offset--;\ 207 | (obj)->Mem.CurPtr = (char *)(obj)->Mem.VecPtr[(obj)->Mem.offset] 208 | #else 209 | #define LOCAL_ARRAY_FREE(arrtype,arrname,arrlength,obj) 210 | 211 | #define LOCAL_ALIGN_ARRAY_FREE(align,arrtype,arrname,arrlength,obj) 212 | 213 | #define CLEAR_SCRATCH_MEMORY(obj) 214 | 215 | #define OPEN_SCRATCH_BLOCK(obj) 216 | 217 | #define CLOSE_SCRATCH_BLOCK(obj) 218 | #endif 219 | 220 | #endif /*__SCRATCHMEM_H__*/ 221 | -------------------------------------------------------------------------------- /G729/api/uscg729i.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright (c) 2004 Intel Corporation. All Rights Reserved. 8 | // 9 | ***************************************************************************/ 10 | 11 | #include "owng729.h" 12 | #include "g729api.h" 13 | #include 14 | #include 15 | 16 | static USC_Status GetInfo(USC_Handle handle, USC_CodecInfo *pInfo); 17 | static USC_Status NumAlloc(const USC_Option *options, int *nbanks); 18 | static USC_Status MemAlloc(const USC_Option *options, USC_MemBank *pBanks); 19 | static USC_Status Init(const USC_Option *options, const USC_MemBank *pBanks, USC_Handle *handle); 20 | static USC_Status Reinit(USC_Modes *modes, USC_Handle handle ); 21 | static USC_Status Control(USC_Handle handle, USC_Modes *modes); 22 | static USC_Status Encode(USC_Handle handle, const USC_PCMStream *in, USC_Bitstream *out); 23 | static USC_Status Decode(USC_Handle handle, const USC_Bitstream *in, USC_PCMStream *out); 24 | 25 | #define BITSTREAM_SIZE 15 26 | 27 | typedef struct { 28 | int direction; 29 | void *Object; 30 | } G729_Handle; 31 | 32 | /* global usc vector table */ 33 | USC_Fxns USC_G729I_Fxns={ 34 | { 35 | GetInfo, 36 | NumAlloc, 37 | MemAlloc, 38 | Init, 39 | Reinit, 40 | Control, 41 | Encode, 42 | Decode 43 | } 44 | }; 45 | 46 | static USC_Option params; /* what is supported */ 47 | static USC_PCMType pcmType; /* codec audio source */ 48 | 49 | static USC_Status GetInfo(USC_Handle handle, USC_CodecInfo *pInfo) 50 | { 51 | pInfo->name = "G729"; 52 | if (handle == NULL) { 53 | pInfo->params = ¶ms; 54 | pInfo->pcmType = &pcmType; 55 | pInfo->params->modes.bitrate = G729_CODEC; 56 | pInfo->params->modes.truncate = 0; 57 | pInfo->params->direction = 0; 58 | pInfo->params->modes.vad = G729Encode_VAD_Disabled; 59 | } 60 | pInfo->pcmType->sample_frequency = 8000; 61 | pInfo->pcmType->bitPerSample = 8; 62 | pInfo->maxbitsize = BITSTREAM_SIZE; 63 | pInfo->params->modes.hpf = 0; 64 | pInfo->params->modes.pf = 0; 65 | pInfo->params->law = 0; 66 | return USC_NoError; 67 | } 68 | 69 | static USC_Status NumAlloc(const USC_Option *options, int *nbanks) 70 | { 71 | *nbanks = 1; 72 | return USC_NoError; 73 | } 74 | 75 | static USC_Status MemAlloc(const USC_Option *options, USC_MemBank *pBanks) 76 | { 77 | unsigned int nbytes; 78 | pBanks->pMem = NULL; 79 | if (options->direction == 0) /* encode only */ 80 | { 81 | apiG729Encoder_Alloc(options->modes.bitrate, &nbytes); 82 | pBanks->nbytes = nbytes+sizeof(int); /* include direction in handle */ 83 | } 84 | else if (options->direction == 1) /* decode only */ 85 | { 86 | apiG729Decoder_Alloc(options->modes.bitrate, &nbytes); 87 | pBanks->nbytes = nbytes+sizeof(int); /* include direction in handle */ 88 | } else { 89 | return USC_NoOperation; 90 | } 91 | return USC_NoError; 92 | } 93 | 94 | static USC_Status Init(const USC_Option *options, const USC_MemBank *pBanks, USC_Handle *handle) 95 | { 96 | G729_Handle *g729_handle; 97 | *handle = (USC_Handle*)pBanks->pMem; 98 | g729_handle = (G729_Handle*)*handle; 99 | g729_handle->direction = options->direction; 100 | 101 | if (options->direction == 0) /* encode only */ 102 | { 103 | G729Encoder_Obj *EncObj = (G729Encoder_Obj *)&g729_handle->Object; 104 | apiG729Encoder_Init((G729Encoder_Obj*)EncObj, 105 | (G729Codec_Type)options->modes.bitrate,options->modes.vad); 106 | } 107 | else if (options->direction == 1) /* decode only */ 108 | { 109 | G729Decoder_Obj *DecObj = (G729Decoder_Obj *)&g729_handle->Object; 110 | apiG729Decoder_Init((G729Decoder_Obj*)DecObj, (G729Codec_Type)options->modes.bitrate); 111 | } else { 112 | return USC_NoOperation; 113 | } 114 | return USC_NoError; 115 | } 116 | 117 | static USC_Status Reinit(USC_Modes *modes, USC_Handle handle ) 118 | { 119 | G729_Handle *g729_handle; 120 | g729_handle = (G729_Handle*)handle; 121 | 122 | if (g729_handle->direction == 0) /* encode only */ 123 | { 124 | G729Encoder_Obj *EncObj = (G729Encoder_Obj *)&g729_handle->Object; 125 | apiG729Encoder_Init((G729Encoder_Obj*)EncObj, modes->bitrate, modes->vad); 126 | } 127 | else if (g729_handle->direction == 1) /* decode only */ 128 | { 129 | G729Decoder_Obj *DecObj = (G729Decoder_Obj *)&g729_handle->Object; 130 | apiG729Decoder_Init((G729Decoder_Obj*)DecObj, modes->bitrate); 131 | } else { 132 | return USC_NoOperation; 133 | } 134 | return USC_NoError; 135 | } 136 | 137 | static USC_Status Control(USC_Handle handle, USC_Modes *modes) 138 | { 139 | return USC_NoError; 140 | } 141 | 142 | static USC_Status Encode(USC_Handle handle, const USC_PCMStream *in, USC_Bitstream *out) 143 | { 144 | G729_Handle *g729_handle; 145 | G729Encoder_Obj *EncObj; 146 | g729_handle = (G729_Handle*)handle; 147 | EncObj = (G729Encoder_Obj *)&g729_handle->Object; 148 | 149 | if(apiG729Encode(EncObj,(const short*)in->pBuffer,out->pBuffer,in->bitrate,&out->frametype) != APIG729_StsNoErr){ 150 | return USC_NoOperation; 151 | } 152 | return USC_NoError; 153 | } 154 | 155 | static USC_Status Decode(USC_Handle handle, const USC_Bitstream *in, USC_PCMStream *out) 156 | { 157 | G729_Handle *g729_handle; 158 | G729Decoder_Obj *DecObj; 159 | g729_handle = (G729_Handle*)handle; 160 | DecObj = (G729Decoder_Obj *)&g729_handle->Object; 161 | 162 | if(apiG729Decode(DecObj,(const unsigned char*)in->pBuffer,in->frametype,(unsigned short*)out->pBuffer) != APIG729_StsNoErr){ 163 | return USC_NoOperation; 164 | } 165 | return USC_NoError; 166 | } 167 | 168 | 169 | -------------------------------------------------------------------------------- /G729/build.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # 4 | # Usage: build.sh {gcc} 5 | # 6 | 7 | IPPENV=${IPPROOT}/tools/env/ippvars32.sh 8 | 9 | if [ ! -x "${IPPENV}" ]; then 10 | IPPENV=/opt/intel/ipp41/ia32_itanium/tools/env/ippvars32.sh 11 | fi 12 | 13 | if [ ! -x "${IPPENV}" ]; then 14 | IPPENV=/opt/intel/ipp41_eval/ia32_itanium/tools/env/ippvars32.sh 15 | fi 16 | 17 | if [ ! -x "${IPPENV}" ]; then 18 | @echo -e "*************************************************************************" 19 | @echo -e "Intel(R) IPP is not found!" 20 | @echo -e "Please install Intel(R) IPP or set IPPROOT environment variable correctly." 21 | @echo -e "*************************************************************************" 22 | exit 23 | fi 24 | 25 | ARG=$1 26 | 27 | CC=gcc 28 | CXX=g++ 29 | ARCH=linux32 30 | 31 | if [ "${ARG}" == "" ]; then 32 | 33 | CCFIND=/opt/intel/compiler60/ia32/bin/iccvars.sh 34 | if [ -x "${CCFIND}" ]; then 35 | CCENV=${CCFIND} 36 | fi 37 | 38 | CCFIND=/opt/intel/compiler70/ia32/bin/iccvars.sh 39 | if [ -x "${CCFIND}" ]; then 40 | CCENV=${CCFIND} 41 | fi 42 | 43 | CCFIND=/opt/intel/compiler80/ia32/bin/iccvars.sh 44 | if [ -x "${CCFIND}" ]; then 45 | CCENV=${CCFIND} 46 | fi 47 | 48 | CCFIND=/opt/intel_cc_80/bin/iccvars.sh 49 | if [ -x "${CCFIND}" ]; then 50 | CCENV=${CCFIND} 51 | fi 52 | 53 | if [ "${CCENV}" ]; then 54 | . ${CCENV} 55 | CC=icc 56 | CXX=icc 57 | fi 58 | 59 | fi 60 | 61 | . ${IPPENV} 62 | 63 | make clean 64 | make CC=${CC} CXX=${CXX} ARCH=${ARCH} 65 | -------------------------------------------------------------------------------- /G729/buildem64t.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # 4 | # Usage: build.sh {gcc} 5 | # 6 | 7 | IPPENV=${IPPROOT}/tools/env/ippvarsem64t.sh 8 | 9 | if [ ! -x "${IPPENV}" ]; then 10 | IPPENV=/opt/intel/ipp41/em64t/tools/env/ippvarsem64t.sh 11 | fi 12 | 13 | if [ ! -x "${IPPENV}" ]; then 14 | IPPENV=/opt/intel/ipp41_eval/em64t/tools/env/ippvarsem64t.sh 15 | fi 16 | 17 | if [ ! -x "${IPPENV}" ]; then 18 | @echo -e "*************************************************************************" 19 | @echo -e "Intel(R) IPP is not found!" 20 | @echo -e "Please install Intel(R) IPP or set IPPROOT environment variable correctly." 21 | @echo -e "*************************************************************************" 22 | exit 23 | fi 24 | 25 | ARG=$1 26 | 27 | CC=gcc 28 | CXX=g++ 29 | ARCH=lem64t 30 | 31 | if [ "${ARG}" == "" ]; then 32 | 33 | CCFIND=/opt/intel_cce_80/bin/iccvars.sh 34 | if [ -x "${CCFIND}" ]; then 35 | CCENV=${CCFIND} 36 | fi 37 | 38 | if [ "${CCENV}" ]; then 39 | . ${CCENV} 40 | CC=icc 41 | CXX=icc 42 | fi 43 | 44 | fi 45 | 46 | . ${IPPENV} 47 | 48 | make clean 49 | make CC=${CC} CXX=${CXX} ARCH=${ARCH} 50 | -------------------------------------------------------------------------------- /G729/include/g729api.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729/include/g729api.h -------------------------------------------------------------------------------- /G729/include/usc.h: -------------------------------------------------------------------------------- 1 | /* 2 | // INTEL CORPORATION PROPRIETARY INFORMATION 3 | // This software is supplied under the terms of a license agreement or 4 | // nondisclosure agreement with Intel Corporation and may not be copied 5 | // or disclosed except in accordance with the terms of that agreement. 6 | // Copyright(c) 2004 Intel Corporation. All Rights Reserved. 7 | // 8 | // Unified Speech Codec sample interface main header. 9 | // Structures and functions declarations. 10 | */ 11 | #ifndef __USC_H__ 12 | #define __USC_H__ 13 | 14 | #if defined( USC_W32DLL ) 15 | #if defined( _MSC_VER ) || defined( __ICL ) || defined ( __ECL ) 16 | #define USCFUN __declspec(dllexport) 17 | #else 18 | #define USCFUN extern 19 | #endif 20 | #else 21 | #define USCFUN extern 22 | #endif 23 | 24 | /* USC error code */ 25 | typedef enum { 26 | /* errors: negative response */ 27 | USC_NotInitialized = -8, 28 | USC_InvalidHandler = -7, 29 | USC_NoOperation = -6, 30 | USC_UnsupportedPCMType = -5, 31 | USC_UnsupportedBitRate = -4, 32 | USC_UnsupportedFrameType = -3, 33 | USC_UnsupportedVADType = -2, 34 | USC_BadDataPointer = -1, 35 | USC_NoError = 0, 36 | /* warnings: positive response */ 37 | USC_StateNotChanged = 1 38 | }USC_Status; 39 | 40 | /* USC codec modes, (may be alternated) */ 41 | typedef struct { 42 | int bitrate; /* codec dependent bitrate index */ 43 | int truncate; /* 0 - no truncate */ 44 | int vad; /* 0 - disabled, otherwize vad type (1,2, more if any) */ 45 | int hpf; /* high pass filter: 1- on, 0- off */ 46 | int pf; /* post filter: 1- on, 0- off */ 47 | }USC_Modes; 48 | 49 | 50 | /* USC codec option */ 51 | typedef struct { 52 | int direction; /* 0 - encode only, 1 - decode only, 2 - both */ 53 | int law; /* 0 - pcm, 1 - aLaw, 2 -muLaw */ 54 | USC_Modes modes; 55 | }USC_Option; 56 | 57 | /* USC PCM stream type */ 58 | typedef struct { 59 | int sample_frequency; /* sample rate in Hz */ 60 | int bitPerSample; /* bit per sample */ 61 | }USC_PCMType; 62 | 63 | /* USC codec information */ 64 | typedef struct { 65 | const char *name; /* codec name */ 66 | int framesize; /* PCM frame size in bytes */ 67 | int maxbitsize; /* bitstream max frame size in bytes */ 68 | USC_Option *params; /* what is supported */ 69 | USC_PCMType *pcmType; /* codec audio source */ 70 | }USC_CodecInfo; 71 | 72 | 73 | /* USC memory banks */ 74 | typedef struct { 75 | char *pMem; 76 | int nbytes; 77 | }USC_MemBank; 78 | 79 | /* USC PCM stream */ 80 | typedef struct { 81 | char *pBuffer; 82 | int nbytes; /* pcm data size in byte */ 83 | USC_PCMType pcmType; 84 | int bitrate; /* codec dependent bitrate index */ 85 | }USC_PCMStream; 86 | 87 | /* USC compressed bits */ 88 | typedef struct { 89 | char *pBuffer; 90 | int nbytes; /* bitstream size in byte */ 91 | int frametype; /* codec specific frame type (transmission frame type) */ 92 | int bitrate; /* codec dependent bitrate index */ 93 | }USC_Bitstream; 94 | 95 | typedef void* USC_Handle; 96 | 97 | /* USC functions table. 98 | Each codec should supply a function table structure, which is derived from this base table. 99 | Codec table is to be specified for each codec by name as follows: 100 | USC__Fxns, for example USC_g729_Fxns. 101 | The typical usage model: 102 | - Questing a codec about memory requirement using MemAlloc() function 103 | which returns a memory banks description table with required bank sizes. 104 | - Use Init() function to create codec instance according to modes (vad, rate etc) requested. 105 | Codec handle is returned. Thus different instances of particular codec may be created 106 | and used in parallel. 107 | - Encode(), Decode() - compression/decompression functions. 108 | - GetInfo() - inquire codec state or codec requirement. 109 | */ 110 | 111 | typedef struct { 112 | 113 | /* Get_Info() - quest codec information 114 | General inquiry is possible without initialization when handle==NULL. 115 | */ 116 | USC_Status (*GetInfo)(USC_Handle handle, USC_CodecInfo *pInfo); 117 | 118 | /* NumAlloc() - inquiring number of memory buffers 119 | options - codec control. 120 | nbanks - number of table entries (size of pBanks table). 121 | */ 122 | USC_Status (*NumAlloc)(const USC_Option *options, int *nbanks); 123 | 124 | /* MemAlloc() - inquiring information about memory requirement 125 | (buffers to be allocated) 126 | options - codec control. 127 | pBanks - input table of size nbanks to be filled with memory requirement 128 | (pMem=NULL if to be allocated ) 129 | */ 130 | USC_Status (*MemAlloc)(const USC_Option *options, USC_MemBank *pBanks); 131 | 132 | /* Init() - create codec handle and set it to initial state 133 | options - codec control 134 | pBanks - allocated memory banks of number as after MemAlloc 135 | handle - pointer to the output codec instance pointer 136 | */ 137 | USC_Status (*Init)(const USC_Option *options, const USC_MemBank *pBanks, USC_Handle *handle ); 138 | 139 | /* Reinit() - set codec to initial state 140 | handle - pointer to the input codec instance pointer 141 | */ 142 | USC_Status (*Reinit)(USC_Modes *modes, USC_Handle handle ); 143 | 144 | /* Control() - alternate codec modes 145 | The only modes were set on Init() may be alternated. 146 | modes - what modes to alternate 147 | handle - pointer to the input codec instance pointer 148 | */ 149 | USC_Status (*Control)(USC_Handle handle, USC_Modes *modes); 150 | 151 | /* Encode() 152 | in - input audio stream (pcm) pointer, 153 | out - output bitstream pointer , 154 | */ 155 | USC_Status (*Encode)(USC_Handle handle, const USC_PCMStream *in, USC_Bitstream *out); 156 | 157 | /* Decode() 158 | in - input bitstream pointer, 159 | out - output audio stream (pcm) pointer, 160 | */ 161 | USC_Status (*Decode)(USC_Handle handle, const USC_Bitstream *in, USC_PCMStream *out); 162 | 163 | } USC_stdFxns; 164 | 165 | /* 166 | USC extended function table 167 | */ 168 | 169 | typedef struct { 170 | USC_stdFxns std; 171 | /* function extension, any */ 172 | }USC_Fxns; 173 | 174 | #endif /* __USC_H__ */ 175 | -------------------------------------------------------------------------------- /G729/lem64t.ini: -------------------------------------------------------------------------------- 1 | 2 | IPPLIBS=-L$(IPPROOT)/sharedlib -lippscem64t -lippsem64t -lippcoreem64t 3 | 4 | 5 | -------------------------------------------------------------------------------- /G729/linux32.ini: -------------------------------------------------------------------------------- 1 | 2 | 3 | IPPLIBS=-L$(IPPROOT)/sharedlib -lippsc -lipps -lippcore 4 | 5 | -------------------------------------------------------------------------------- /G729/readme.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729/readme.htm -------------------------------------------------------------------------------- /G729/samples/decoder.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729/samples/decoder.c -------------------------------------------------------------------------------- /G729/samples/decoder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729/samples/decoder.h -------------------------------------------------------------------------------- /G729/samples/encoder.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729/samples/encoder.c -------------------------------------------------------------------------------- /G729/samples/encoder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729/samples/encoder.h -------------------------------------------------------------------------------- /G729/samples/util_d.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729/samples/util_d.c -------------------------------------------------------------------------------- /G729/samples/util_d.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729/samples/util_d.h -------------------------------------------------------------------------------- /G729/samples/util_e.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729/samples/util_e.c -------------------------------------------------------------------------------- /G729/samples/util_e.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/G729/samples/util_e.h -------------------------------------------------------------------------------- /G729/vm/include/sys/vm_types_linux32.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Linux types header. 11 | */ 12 | #ifdef LINUX32 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | typedef unsigned long vm_var32; 19 | typedef unsigned long long vm_var64; 20 | typedef char vm_char; 21 | 22 | #define VM_ALIGN_DECL(X,Y) Y __attribute__ ((aligned(X))) 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | /* vm_thread.h */ 29 | typedef struct { 30 | pthread_t handle; 31 | int is_valid; 32 | } vm_thread; 33 | 34 | /* vm_event.h */ 35 | typedef struct { 36 | pthread_cond_t cond; 37 | pthread_mutex_t mutex; 38 | int manual; 39 | int state; 40 | } vm_event; 41 | 42 | /* vm_mmap.h */ 43 | typedef struct { 44 | int fd; 45 | void *address; 46 | size_t sizet; 47 | } vm_mmap; 48 | 49 | /* vm_mutex.h */ 50 | typedef struct { 51 | pthread_mutex_t handle; 52 | int is_valid; 53 | } vm_mutex; 54 | 55 | /* vm_semaphore.h */ 56 | typedef struct { 57 | pthread_cond_t cond; 58 | pthread_mutex_t mutex; 59 | int count; 60 | } vm_semaphore; 61 | 62 | #ifdef __cplusplus 63 | }; 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /G729/vm/include/vm_thread.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Threading header. 11 | */ 12 | #ifndef __VM_THREAD_H__ 13 | #define __VM_THREAD_H__ 14 | #include "vm_types.h" 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /* IMPORTANT: 21 | * The thread return value is always saved for the calling thread to 22 | * collect. To avoid memory leak, always vm_thread_wait() for the 23 | * child thread to terminate in the calling thread. 24 | */ 25 | 26 | typedef void *(*vm_thread_callback)(void *); 27 | 28 | typedef enum { 29 | VM_THREAD_PRIORITY_HIGHEST, 30 | VM_THREAD_PRIORITY_HIGH, 31 | VM_THREAD_PRIORITY_NORMAL, 32 | VM_THREAD_PRIORITY_LOW, 33 | VM_THREAD_PRIORITY_LOWEST 34 | } vm_thread_priority; 35 | 36 | /* Set the thread handler to an invalid value */ 37 | void vm_thread_set_invalid(vm_thread *thread); 38 | 39 | /* Verify if the thread handler is valid */ 40 | int vm_thread_is_valid(vm_thread *thread); 41 | 42 | /* Create a thread. The thread is set to run at the call. 43 | Return 1 if successful */ 44 | int vm_thread_create(vm_thread *thread,vm_thread_callback func,void *arg); 45 | 46 | /* Wait until a thread exists. */ 47 | void vm_thread_wait(vm_thread *thread); 48 | 49 | /* Terminate a thread with blocking */ 50 | void vm_thread_terminate(vm_thread *thread); 51 | 52 | /* Terminate the current thread */ 53 | void vm_thread_exit(void); 54 | 55 | /* Set thread priority. Return 1 if successful */ 56 | int vm_thread_set_priority(vm_thread *thread, vm_thread_priority priority); 57 | 58 | #ifdef __cplusplus 59 | }; 60 | #endif 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /G729/vm/include/vm_types.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Common types header. 11 | */ 12 | #ifndef __VM_TYPES_H__ 13 | #define __VM_TYPES_H__ 14 | #ifdef WIN32 15 | #include "sys/vm_types_win32.h" 16 | #elif LINUX32 17 | #include "sys/vm_types_linux32.h" 18 | #endif 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | typedef vm_var64 vm_sizet; 25 | 26 | #define VM_ALIGN16_DECL(X) VM_ALIGN_DECL(16,X) 27 | #define VM_ALIGN32_DECL(X) VM_ALIGN_DECL(32,X) 28 | 29 | #ifdef __cplusplus 30 | }; 31 | #endif 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /G729/vm/src/vm_thread_linux32.c: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Threading primitives for Linux. 11 | */ 12 | #ifdef LINUX32 13 | #include 14 | #include 15 | #include 16 | #include "vm_thread.h" 17 | 18 | /* Set the thread handler an invalid value */ 19 | void vm_thread_set_invalid(vm_thread *thread) 20 | { 21 | thread->is_valid=0; 22 | } 23 | 24 | /* Verify if the thread handler is valid */ 25 | int vm_thread_is_valid(vm_thread *thread) 26 | { 27 | return thread->is_valid; 28 | } 29 | 30 | /* Create a thread. Return 1 if success */ 31 | int vm_thread_create(vm_thread *thread, 32 | void *(*vm_thread_func)(void *),void *arg) 33 | { 34 | pthread_attr_t attr; 35 | pthread_attr_init(&attr); 36 | pthread_attr_setschedpolicy(&attr,geteuid()?SCHED_OTHER:SCHED_RR); 37 | thread->is_valid=!pthread_create(&thread->handle,&attr,vm_thread_func,arg); 38 | pthread_attr_destroy(&attr); 39 | vm_thread_set_priority(thread, VM_THREAD_PRIORITY_LOWEST); 40 | return thread->is_valid; 41 | } 42 | 43 | /* Terminate the current thread */ 44 | void vm_thread_exit(void) 45 | { 46 | pthread_exit(0); 47 | } 48 | 49 | /* Set thread priority, return 1 if successful */ 50 | int vm_thread_set_priority(vm_thread *thread, vm_thread_priority priority) 51 | { 52 | int policy, pmin, pmax, pmean; 53 | struct sched_param param; 54 | 55 | if (!thread->is_valid) return 0; 56 | pthread_getschedparam(thread->handle,&policy,¶m); 57 | 58 | pmin=sched_get_priority_min(policy); 59 | pmax=sched_get_priority_max(policy); 60 | pmean=(pmin+pmax)/2; 61 | 62 | switch (priority) { 63 | case VM_THREAD_PRIORITY_HIGHEST: 64 | param.sched_priority=pmax; break; 65 | case VM_THREAD_PRIORITY_LOWEST: 66 | param.sched_priority=pmin; break; 67 | case VM_THREAD_PRIORITY_NORMAL: 68 | param.sched_priority=pmean; break; 69 | case VM_THREAD_PRIORITY_HIGH: 70 | param.sched_priority=(pmax+pmean)/2; break; 71 | case VM_THREAD_PRIORITY_LOW: 72 | param.sched_priority=(pmin+pmean)/2; break; 73 | } 74 | 75 | return !pthread_setschedparam(thread->handle,policy,¶m); 76 | } 77 | 78 | /* Wait until a thread exists */ 79 | void vm_thread_wait(vm_thread *thread) 80 | { 81 | if (thread->is_valid) { 82 | pthread_join(thread->handle,NULL); 83 | thread->is_valid=0; 84 | } 85 | } 86 | 87 | /* Terminate a thread */ 88 | void vm_thread_terminate(vm_thread *thread) 89 | { 90 | if (thread->is_valid) { 91 | pthread_cancel(thread->handle); 92 | vm_thread_wait(thread); 93 | } 94 | } 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /GSMAMR/Makefile: -------------------------------------------------------------------------------- 1 | ############################### 2 | # DO NOT EDIT BELOW THIS LINE # 3 | ############################### 4 | 5 | # System Specific 6 | INCLSFX=.h 7 | CPPSFX=.c 8 | OBJSFX=.o 9 | EXESFX= 10 | 11 | # IPP Dependencies 12 | IPPINCLS=-I$(IPPROOT)/include 13 | IPPLIBS=-L$(IPPROOT)/sharedlib -lippsc -lipps -lippcore -L$(IPPROOT)/sharedlib/linux32 -lguide 14 | 15 | # Compiler Specifics 16 | CCOPTS=-c -O2 17 | CCDEFS=-D__unix__ -DNDEBUG -DLINUX32 18 | CCINCLS=-I./include -I./vm/include $(IPPINCLS) 19 | 20 | LNKOUT=-o 21 | LNKOPTS= 22 | LNKLIBS=$(IPPLIBS) -lpthread -lm 23 | 24 | build: prepare_directory build_encoder build_decoder; @echo "Done" 25 | 26 | ##### api object ##### 27 | CPPSRC_API=$(wildcard ./api/*$(CPPSFX)) 28 | OBJECT_API=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_API)) 29 | 30 | CPPSRC_VM=$(wildcard ./vm/src/*$(CPPSFX)) 31 | OBJECT_VM=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_VM)) 32 | 33 | ##### link encoder example programs ##### 34 | OBJECT_ENCODER=./bin/gsmamrencoder$(EXESFX) 35 | CPPSRC_ENCODER=$(wildcard ./samples/encoder$(CPPSFX) ./samples/util_e$(CPPSFX) ) 36 | OBJSRC_ENCODER=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_ENCODER)) 37 | 38 | build_encoder: $(OBJECT_ENCODER) ; @echo "done encoder" 39 | 40 | $(OBJECT_ENCODER): $(OBJSRC_ENCODER) $(OBJECT_API) $(OBJECT_VM) 41 | $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS) 42 | 43 | ##### link decoder example programs ##### 44 | OBJECT_DECODER=./bin/gsmamrdecoder$(EXESFX) 45 | CPPSRC_DECODER=$(wildcard ./samples/decoder$(CPPSFX) ./samples/util_d$(CPPSFX)) 46 | OBJSRC_DECODER=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_DECODER)) 47 | 48 | build_decoder: $(OBJECT_DECODER) ; @echo "done decoder" 49 | 50 | $(OBJECT_DECODER): $(OBJSRC_DECODER) $(OBJECT_API) $(OBJECT_VM) 51 | $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS) 52 | 53 | ##### compile encoder & decoder objects all together ##### 54 | OBJECTS=$(OBJECT_API) $(OBJECT_VM)$(OBJSRC_ENCODER) $(OBJSRC_DECODER) 55 | $(OBJECTS): %$(OBJSFX): %$(CPPSFX) 56 | $(CC) $(CCINCLS) $(CCDEFS) $(CCOPTS) -o$@ $< 57 | 58 | prepare_directory: FORCE 59 | @if test ! -d ./bin; then mkdir ./bin; fi 60 | 61 | clean: FORCE 62 | rm -f $(OBJECTS) 63 | 64 | distclean: clean 65 | rm -f $(OBJECT_ENCODER) $(OBJECT_DECODER) 66 | 67 | FORCE: 68 | 69 | -------------------------------------------------------------------------------- /GSMAMR/api/bitpack.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/api/bitpack.c -------------------------------------------------------------------------------- /GSMAMR/api/decgsmamr.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/api/decgsmamr.c -------------------------------------------------------------------------------- /GSMAMR/api/dtx_util.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/api/dtx_util.c -------------------------------------------------------------------------------- /GSMAMR/api/encgsmamr.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/api/encgsmamr.c -------------------------------------------------------------------------------- /GSMAMR/api/gain_util.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/api/gain_util.c -------------------------------------------------------------------------------- /GSMAMR/api/owngsmamr.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/api/owngsmamr.h -------------------------------------------------------------------------------- /GSMAMR/api/scratchmem.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2002-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // 10 | // Purpose: scratch/stack memory managment header file 11 | // 12 | */ 13 | 14 | #ifndef __SCRATCHMEM_H__ 15 | #define __SCRATCHMEM_H__ 16 | 17 | #if (defined( __ICL ) || defined ( __ECL )) && (defined( _WIN32 ) && !defined( _WIN64 )) 18 | __INLINE 19 | Ipp32s IPP_INT_PTR( const void* ptr ) { 20 | union { 21 | void* Ptr; 22 | Ipp32s Int; 23 | } dd; 24 | dd.Ptr = (void*)ptr; 25 | return dd.Int; 26 | } 27 | 28 | __INLINE 29 | Ipp32u IPP_UINT_PTR( const void* ptr ) { 30 | union { 31 | void* Ptr; 32 | Ipp32u Int; 33 | } dd; 34 | dd.Ptr = (void*)ptr; 35 | return dd.Int; 36 | } 37 | 38 | #elif (defined( __ICL ) || defined ( __ECL )) && defined( _WIN64 ) 39 | __INLINE 40 | Ipp64s IPP_INT_PTR( const void* ptr ) { 41 | union { 42 | void* Ptr; 43 | Ipp64s Int; 44 | } dd; 45 | dd.Ptr = (void*)ptr; 46 | return dd.Int; 47 | } 48 | 49 | __INLINE 50 | Ipp64u IPP_UINT_PTR( const void* ptr ) { 51 | union { 52 | void* Ptr; 53 | Ipp64u Int; 54 | } dd; 55 | dd.Ptr = (void*)ptr; 56 | return dd.Int; 57 | } 58 | 59 | #elif defined( __ICC ) && defined( linux32 ) 60 | __INLINE 61 | Ipp32s IPP_INT_PTR( const void* ptr ) { 62 | union { 63 | void* Ptr; 64 | Ipp32s Int; 65 | } dd; 66 | dd.Ptr = (void*)ptr; 67 | return dd.Int; 68 | } 69 | 70 | __INLINE 71 | Ipp32u IPP_UINT_PTR( const void* ptr ) { 72 | union { 73 | void* Ptr; 74 | Ipp32u Int; 75 | } dd; 76 | dd.Ptr = (void*)ptr; 77 | return dd.Int; 78 | } 79 | 80 | #elif defined ( __ECC ) && defined( linux64 ) 81 | __INLINE 82 | Ipp64s IPP_INT_PTR( const void* ptr ) { 83 | union { 84 | void* Ptr; 85 | Ipp64s Int; 86 | } dd; 87 | dd.Ptr = (void*)ptr; 88 | return dd.Int; 89 | } 90 | 91 | __INLINE 92 | Ipp64u IPP_UINT_PTR( const void* ptr ) { 93 | union { 94 | void* Ptr; 95 | Ipp64u Int; 96 | } dd; 97 | dd.Ptr = (void*)ptr; 98 | return dd.Int; 99 | } 100 | 101 | #else 102 | #define IPP_INT_PTR( ptr ) ( (long)(ptr) ) 103 | #define IPP_UINT_PTR( ptr ) ( (unsigned long)(ptr) ) 104 | #endif 105 | 106 | #define IPP_BYTES_TO_ALIGN(ptr, align) ((-(IPP_INT_PTR(ptr)&((align)-1)))&((align)-1)) 107 | 108 | #define IPP_ALIGNED_PTR(ptr, align) (void*)( (char*)(ptr) + (IPP_BYTES_TO_ALIGN( ptr, align )) ) 109 | 110 | #define IPP_MALLOC_ALIGNED_BYTES 32 111 | 112 | #define IPP_MALLOC_ALIGNED_0BYTES 0 113 | #define IPP_MALLOC_ALIGNED_1BYTES 1 114 | #define IPP_MALLOC_ALIGNED_8BYTES 8 115 | #define IPP_MALLOC_ALIGNED_16BYTES 16 116 | #define IPP_MALLOC_ALIGNED_32BYTES 32 117 | 118 | #define IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength)\ 119 | arrtype arrname##AlignedArrBuff[(arrlength)+IPP_MALLOC_ALIGNED_##align##BYTES/sizeof(arrtype)];\ 120 | arrtype *arrname = (arrtype*)IPP_ALIGNED_PTR(arrname##AlignedArrBuff,align) 121 | 122 | __INLINE void* GetMemory(int arrlen, int sizeOfElem, char **CurPtr) 123 | { 124 | void *ret; 125 | 126 | ret = (void*)IPP_ALIGNED_PTR(*CurPtr,sizeOfElem); 127 | *CurPtr += (arrlen+1)*sizeOfElem; 128 | 129 | return ret; 130 | } 131 | 132 | __INLINE void* GetAlignMemory(int align, int arrlen, int sizeOfElem, char **CurPtr) 133 | { 134 | void *ret; 135 | 136 | ret = (void*)IPP_ALIGNED_PTR(*CurPtr,align); 137 | *CurPtr += (arrlen+align/sizeOfElem)*sizeOfElem; 138 | 139 | return ret; 140 | } 141 | 142 | #if !defined (SCRATCH_OLD) 143 | #if !defined (NO_SCRATCH_MEMORY_USED) 144 | 145 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj)\ 146 | arrtype *arrname = (arrtype *)GetAlignMemory(align,arrlength,sizeof(arrtype),&(obj)->Mem.CurPtr) 147 | 148 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj)\ 149 | arrtype *arrname = (arrtype *)GetMemory(arrlength,sizeof(arrtype),&(obj)->Mem.CurPtr) 150 | 151 | #else 152 | 153 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj)\ 154 | IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength) 155 | 156 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj)\ 157 | arrtype arrname[arrlength] 158 | 159 | 160 | #endif 161 | #else 162 | #if !defined (NO_SCRATCH_MEMORY_USED) 163 | #define PRE_ALLOC_ARRAY(align,arrtype,arrname,arrlength)\ 164 | arrtype *arrname 165 | 166 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj)\ 167 | arrname = (arrtype*)IPP_ALIGNED_PTR((obj)->Mem.CurPtr,align);\ 168 | (obj)->Mem.CurPtr += ((arrlength)+IPP_MALLOC_ALIGNED_##align##BYTES/sizeof(arrtype))*sizeof(arrtype) 169 | 170 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj)\ 171 | arrname = (arrtype*)IPP_ALIGNED_PTR((obj)->Mem.CurPtr,sizeof(arrtype));\ 172 | (obj)->Mem.CurPtr += ((arrlength)+1)*sizeof(arrtype) 173 | 174 | #else 175 | #define PRE_ALLOC_ARRAY(align,arrtype,arrname,arrlength)\ 176 | IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength) 177 | 178 | #define LOCAL_ALIGN_ARRAY(align,arrtype,arrname,arrlength,obj) 179 | 180 | #define LOCAL_ARRAY(arrtype,arrname,arrlength,obj) 181 | 182 | 183 | #endif 184 | #endif 185 | 186 | #if !defined (NO_SCRATCH_MEMORY_USED) 187 | #if defined(__ICC) || defined( __ICL ) || defined ( __ECL ) 188 | #pragma message("Scratch memory enabled") 189 | #endif 190 | #define LOCAL_ARRAY_FREE(arrtype,arrname,arrlength,obj)\ 191 | arrname=NULL;\ 192 | (obj)->Mem.CurPtr -= ((arrlength)+1)*sizeof(arrtype) 193 | 194 | #define LOCAL_ALIGN_ARRAY_FREE(align,arrtype,arrname,arrlength,obj)\ 195 | arrname=NULL;\ 196 | (obj)->Mem.CurPtr -= ((arrlength)+IPP_MALLOC_ALIGNED_##align##BYTES/sizeof(arrtype))*sizeof(arrtype) 197 | 198 | #define CLEAR_SCRATCH_MEMORY(obj)\ 199 | (obj)->Mem.CurPtr = (obj)->Mem.base 200 | 201 | #define OPEN_SCRATCH_BLOCK(obj)\ 202 | (obj)->Mem.VecPtr[(obj)->Mem.offset] = IPP_INT_PTR((obj)->Mem.CurPtr);\ 203 | (obj)->Mem.offset++ 204 | 205 | #define CLOSE_SCRATCH_BLOCK(obj)\ 206 | (obj)->Mem.offset--;\ 207 | (obj)->Mem.CurPtr = (char *)(obj)->Mem.VecPtr[(obj)->Mem.offset] 208 | #else 209 | #define LOCAL_ARRAY_FREE(arrtype,arrname,arrlength,obj) 210 | 211 | #define LOCAL_ALIGN_ARRAY_FREE(align,arrtype,arrname,arrlength,obj) 212 | 213 | #define CLEAR_SCRATCH_MEMORY(obj) 214 | 215 | #define OPEN_SCRATCH_BLOCK(obj) 216 | 217 | #define CLOSE_SCRATCH_BLOCK(obj) 218 | #endif 219 | 220 | #endif /*__SCRATCHMEM_H__*/ 221 | -------------------------------------------------------------------------------- /GSMAMR/api/tab_util.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/api/tab_util.c -------------------------------------------------------------------------------- /GSMAMR/api/util.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/api/util.c -------------------------------------------------------------------------------- /GSMAMR/build.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # 4 | # Usage: build.sh {gcc} 5 | # 6 | 7 | IPPENV=${IPPROOT}/tools/env/ippvars32.sh 8 | 9 | if [ ! -x "${IPPENV}" ]; then 10 | IPPENV=/opt/intel/ipp41/ia32_itanium/tools/env/ippvars32.sh 11 | fi 12 | 13 | if [ ! -x "${IPPENV}" ]; then 14 | IPPENV=/opt/intel/ipp41_eval/ia32_itanium/tools/env/ippvars32.sh 15 | fi 16 | 17 | if [ ! -x "${IPPENV}" ]; then 18 | @echo -e "*************************************************************************" 19 | @echo -e "Intel(R) IPP is not found!" 20 | @echo -e "Please install Intel(R) IPP or set IPPROOT environment variable correctly." 21 | @echo -e "*************************************************************************" 22 | exit 23 | fi 24 | 25 | ARG=$1 26 | 27 | CC=gcc 28 | CXX=g++ 29 | 30 | if [ "${ARG}" == "" ]; then 31 | 32 | CCFIND=/opt/intel/compiler60/ia32/bin/iccvars.sh 33 | if [ -x "${CCFIND}" ]; then 34 | CCENV=${CCFIND} 35 | fi 36 | 37 | CCFIND=/opt/intel/compiler70/ia32/bin/iccvars.sh 38 | if [ -x "${CCFIND}" ]; then 39 | CCENV=${CCFIND} 40 | fi 41 | 42 | CCFIND=/opt/intel/compiler80/ia32/bin/iccvars.sh 43 | if [ -x "${CCFIND}" ]; then 44 | CCENV=${CCFIND} 45 | fi 46 | 47 | CCFIND=/opt/intel_cc_80/bin/iccvars.sh 48 | if [ -x "${CCFIND}" ]; then 49 | CCENV=${CCFIND} 50 | fi 51 | 52 | if [ "${CCENV}" ]; then 53 | . ${CCENV} 54 | CC=icc 55 | CXX=icc 56 | fi 57 | 58 | fi 59 | 60 | . ${IPPENV} 61 | 62 | make clean 63 | make CC=${CC} CXX=${CXX} 64 | -------------------------------------------------------------------------------- /GSMAMR/include/gsmamr.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/include/gsmamr.h -------------------------------------------------------------------------------- /GSMAMR/include/gsmamr_types.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/include/gsmamr_types.h -------------------------------------------------------------------------------- /GSMAMR/include/gsmamrapi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/include/gsmamrapi.h -------------------------------------------------------------------------------- /GSMAMR/include/usc.h: -------------------------------------------------------------------------------- 1 | /* 2 | // INTEL CORPORATION PROPRIETARY INFORMATION 3 | // This software is supplied under the terms of a license agreement or 4 | // nondisclosure agreement with Intel Corporation and may not be copied 5 | // or disclosed except in accordance with the terms of that agreement. 6 | // Copyright(c) 2004 Intel Corporation. All Rights Reserved. 7 | // 8 | // Unified Speech Codec sample interface main header. 9 | // Structures and functions declarations. 10 | */ 11 | #ifndef __USC_H__ 12 | #define __USC_H__ 13 | 14 | #if defined( USC_W32DLL ) 15 | #if defined( _MSC_VER ) || defined( __ICL ) || defined ( __ECL ) 16 | #define USCFUN __declspec(dllexport) 17 | #else 18 | #define USCFUN extern 19 | #endif 20 | #else 21 | #define USCFUN extern 22 | #endif 23 | 24 | /* USC error code */ 25 | typedef enum { 26 | /* errors: negative response */ 27 | USC_NotInitialized = -8, 28 | USC_InvalidHandler = -7, 29 | USC_NoOperation = -6, 30 | USC_UnsupportedPCMType = -5, 31 | USC_UnsupportedBitRate = -4, 32 | USC_UnsupportedFrameType = -3, 33 | USC_UnsupportedVADType = -2, 34 | USC_BadDataPointer = -1, 35 | USC_NoError = 0, 36 | /* warnings: positive response */ 37 | USC_StateNotChanged = 1 38 | }USC_Status; 39 | 40 | /* USC codec modes, (may be alternated) */ 41 | typedef struct { 42 | int bitrate; /* codec dependent bitrate index */ 43 | int truncate; /* 0 - no truncate */ 44 | int vad; /* 0 - disabled, otherwize vad type (1,2, more if any) */ 45 | int hpf; /* high pass filter: 1- on, 0- off */ 46 | int pf; /* post filter: 1- on, 0- off */ 47 | }USC_Modes; 48 | 49 | 50 | /* USC codec option */ 51 | typedef struct { 52 | int direction; /* 0 - encode only, 1 - decode only, 2 - both */ 53 | int law; /* 0 - pcm, 1 - aLaw, 2 -muLaw */ 54 | USC_Modes modes; 55 | }USC_Option; 56 | 57 | /* USC PCM stream type */ 58 | typedef struct { 59 | int sample_frequency; /* sample rate in Hz */ 60 | int bitPerSample; /* bit per sample */ 61 | }USC_PCMType; 62 | 63 | /* USC codec information */ 64 | typedef struct { 65 | const char *name; /* codec name */ 66 | int framesize; /* PCM frame size in bytes */ 67 | int maxbitsize; /* bitstream max frame size in bytes */ 68 | USC_Option *params; /* what is supported */ 69 | USC_PCMType *pcmType; /* codec audio source */ 70 | }USC_CodecInfo; 71 | 72 | 73 | /* USC memory banks */ 74 | typedef struct { 75 | char *pMem; 76 | int nbytes; 77 | }USC_MemBank; 78 | 79 | /* USC PCM stream */ 80 | typedef struct { 81 | char *pBuffer; 82 | int nbytes; /* pcm data size in byte */ 83 | USC_PCMType pcmType; 84 | int bitrate; /* codec dependent bitrate index */ 85 | }USC_PCMStream; 86 | 87 | /* USC compressed bits */ 88 | typedef struct { 89 | char *pBuffer; 90 | int nbytes; /* bitstream size in byte */ 91 | int frametype; /* codec specific frame type (transmission frame type) */ 92 | int bitrate; /* codec dependent bitrate index */ 93 | }USC_Bitstream; 94 | 95 | typedef void* USC_Handle; 96 | 97 | /* USC functions table. 98 | Each codec should supply a function table structure, which is derived from this base table. 99 | Codec table is to be specified for each codec by name as follows: 100 | USC__Fxns, for example USC_g729_Fxns. 101 | The typical usage model: 102 | - Questing a codec about memory requirement using MemAlloc() function 103 | which returns a memory banks description table with required bank sizes. 104 | - Use Init() function to create codec instance according to modes (vad, rate etc) requested. 105 | Codec handle is returned. Thus different instances of particular codec may be created 106 | and used in parallel. 107 | - Encode(), Decode() - compression/decompression functions. 108 | - GetInfo() - inquire codec state or codec requirement. 109 | */ 110 | 111 | typedef struct { 112 | 113 | /* Get_Info() - quest codec information 114 | General inquiry is possible without initialization when handle==NULL. 115 | */ 116 | USC_Status (*GetInfo)(USC_Handle handle, USC_CodecInfo *pInfo); 117 | 118 | /* NumAlloc() - inquiring number of memory buffers 119 | options - codec control. 120 | nbanks - number of table entries (size of pBanks table). 121 | */ 122 | USC_Status (*NumAlloc)(const USC_Option *options, int *nbanks); 123 | 124 | /* MemAlloc() - inquiring information about memory requirement 125 | (buffers to be allocated) 126 | options - codec control. 127 | pBanks - input table of size nbanks to be filled with memory requirement 128 | (pMem=NULL if to be allocated ) 129 | */ 130 | USC_Status (*MemAlloc)(const USC_Option *options, USC_MemBank *pBanks); 131 | 132 | /* Init() - create codec handle and set it to initial state 133 | options - codec control 134 | pBanks - allocated memory banks of number as after MemAlloc 135 | handle - pointer to the output codec instance pointer 136 | */ 137 | USC_Status (*Init)(const USC_Option *options, const USC_MemBank *pBanks, USC_Handle *handle ); 138 | 139 | /* Reinit() - set codec to initial state 140 | handle - pointer to the input codec instance pointer 141 | */ 142 | USC_Status (*Reinit)(USC_Modes *modes, USC_Handle handle ); 143 | 144 | /* Control() - alternate codec modes 145 | The only modes were set on Init() may be alternated. 146 | modes - what modes to alternate 147 | handle - pointer to the input codec instance pointer 148 | */ 149 | USC_Status (*Control)(USC_Handle handle, USC_Modes *modes); 150 | 151 | /* Encode() 152 | in - input audio stream (pcm) pointer, 153 | out - output bitstream pointer , 154 | */ 155 | USC_Status (*Encode)(USC_Handle handle, const USC_PCMStream *in, USC_Bitstream *out); 156 | 157 | /* Decode() 158 | in - input bitstream pointer, 159 | out - output audio stream (pcm) pointer, 160 | */ 161 | USC_Status (*Decode)(USC_Handle handle, const USC_Bitstream *in, USC_PCMStream *out); 162 | 163 | } USC_stdFxns; 164 | 165 | /* 166 | USC extended function table 167 | */ 168 | 169 | typedef struct { 170 | USC_stdFxns std; 171 | /* function extension, any */ 172 | }USC_Fxns; 173 | 174 | #endif /* __USC_H__ */ 175 | -------------------------------------------------------------------------------- /GSMAMR/readme.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/readme.htm -------------------------------------------------------------------------------- /GSMAMR/samples/decoder.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/samples/decoder.c -------------------------------------------------------------------------------- /GSMAMR/samples/decoder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/samples/decoder.h -------------------------------------------------------------------------------- /GSMAMR/samples/encoder.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/samples/encoder.c -------------------------------------------------------------------------------- /GSMAMR/samples/encoder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/samples/encoder.h -------------------------------------------------------------------------------- /GSMAMR/samples/util_d.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/samples/util_d.c -------------------------------------------------------------------------------- /GSMAMR/samples/util_d.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/samples/util_d.h -------------------------------------------------------------------------------- /GSMAMR/samples/util_e.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/samples/util_e.c -------------------------------------------------------------------------------- /GSMAMR/samples/util_e.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/GSMAMR/samples/util_e.h -------------------------------------------------------------------------------- /GSMAMR/vm/include/sys/vm_types_linux32.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Linux types header. 11 | */ 12 | #ifdef LINUX32 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | typedef unsigned long vm_var32; 19 | typedef unsigned long long vm_var64; 20 | typedef char vm_char; 21 | 22 | #define VM_ALIGN_DECL(X,Y) Y __attribute__ ((aligned(X))) 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | /* vm_thread.h */ 29 | typedef struct { 30 | pthread_t handle; 31 | int is_valid; 32 | } vm_thread; 33 | 34 | /* vm_event.h */ 35 | typedef struct { 36 | pthread_cond_t cond; 37 | pthread_mutex_t mutex; 38 | int manual; 39 | int state; 40 | } vm_event; 41 | 42 | /* vm_mmap.h */ 43 | typedef struct { 44 | int fd; 45 | void *address; 46 | size_t sizet; 47 | } vm_mmap; 48 | 49 | /* vm_mutex.h */ 50 | typedef struct { 51 | pthread_mutex_t handle; 52 | int is_valid; 53 | } vm_mutex; 54 | 55 | /* vm_semaphore.h */ 56 | typedef struct { 57 | pthread_cond_t cond; 58 | pthread_mutex_t mutex; 59 | int count; 60 | } vm_semaphore; 61 | 62 | #ifdef __cplusplus 63 | }; 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /GSMAMR/vm/include/vm_thread.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Threading header. 11 | */ 12 | #ifndef __VM_THREAD_H__ 13 | #define __VM_THREAD_H__ 14 | #include "vm_types.h" 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /* IMPORTANT: 21 | * The thread return value is always saved for the calling thread to 22 | * collect. To avoid memory leak, always vm_thread_wait() for the 23 | * child thread to terminate in the calling thread. 24 | */ 25 | 26 | typedef void *(*vm_thread_callback)(void *); 27 | 28 | typedef enum { 29 | VM_THREAD_PRIORITY_HIGHEST, 30 | VM_THREAD_PRIORITY_HIGH, 31 | VM_THREAD_PRIORITY_NORMAL, 32 | VM_THREAD_PRIORITY_LOW, 33 | VM_THREAD_PRIORITY_LOWEST 34 | } vm_thread_priority; 35 | 36 | /* Set the thread handler to an invalid value */ 37 | void vm_thread_set_invalid(vm_thread *thread); 38 | 39 | /* Verify if the thread handler is valid */ 40 | int vm_thread_is_valid(vm_thread *thread); 41 | 42 | /* Create a thread. The thread is set to run at the call. 43 | Return 1 if successful */ 44 | int vm_thread_create(vm_thread *thread,vm_thread_callback func,void *arg); 45 | 46 | /* Wait until a thread exists. */ 47 | void vm_thread_wait(vm_thread *thread); 48 | 49 | /* Terminate a thread with blocking */ 50 | void vm_thread_terminate(vm_thread *thread); 51 | 52 | /* Terminate the current thread */ 53 | void vm_thread_exit(void); 54 | 55 | /* Set thread priority. Return 1 if successful */ 56 | int vm_thread_set_priority(vm_thread *thread, vm_thread_priority priority); 57 | 58 | #ifdef __cplusplus 59 | }; 60 | #endif 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /GSMAMR/vm/include/vm_types.h: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Common types header. 11 | */ 12 | #ifndef __VM_TYPES_H__ 13 | #define __VM_TYPES_H__ 14 | #ifdef WIN32 15 | #include "sys/vm_types_win32.h" 16 | #elif LINUX32 17 | #include "sys/vm_types_linux32.h" 18 | #endif 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | typedef vm_var64 vm_sizet; 25 | 26 | #define VM_ALIGN16_DECL(X) VM_ALIGN_DECL(16,X) 27 | #define VM_ALIGN32_DECL(X) VM_ALIGN_DECL(32,X) 28 | 29 | #ifdef __cplusplus 30 | }; 31 | #endif 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /GSMAMR/vm/src/vm_thread_linux32.c: -------------------------------------------------------------------------------- 1 | /* ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // INTEL CORPORATION PROPRIETARY INFORMATION 4 | // This software is supplied under the terms of a license agreement or 5 | // nondisclosure agreement with Intel Corporation and may not be copied 6 | // or disclosed except in accordance with the terms of that agreement. 7 | // Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved. 8 | // 9 | // Cross-architecture support tool. 10 | // Threading primitives for Linux. 11 | */ 12 | #ifdef LINUX32 13 | #include 14 | #include 15 | #include 16 | #include "vm_thread.h" 17 | 18 | /* Set the thread handler an invalid value */ 19 | void vm_thread_set_invalid(vm_thread *thread) 20 | { 21 | thread->is_valid=0; 22 | } 23 | 24 | /* Verify if the thread handler is valid */ 25 | int vm_thread_is_valid(vm_thread *thread) 26 | { 27 | return thread->is_valid; 28 | } 29 | 30 | /* Create a thread. Return 1 if success */ 31 | int vm_thread_create(vm_thread *thread, 32 | void *(*vm_thread_func)(void *),void *arg) 33 | { 34 | pthread_attr_t attr; 35 | pthread_attr_init(&attr); 36 | pthread_attr_setschedpolicy(&attr,geteuid()?SCHED_OTHER:SCHED_RR); 37 | thread->is_valid=!pthread_create(&thread->handle,&attr,vm_thread_func,arg); 38 | pthread_attr_destroy(&attr); 39 | vm_thread_set_priority(thread, VM_THREAD_PRIORITY_LOWEST); 40 | return thread->is_valid; 41 | } 42 | 43 | /* Terminate the current thread */ 44 | void vm_thread_exit(void) 45 | { 46 | pthread_exit(0); 47 | } 48 | 49 | /* Set thread priority, return 1 if successful */ 50 | int vm_thread_set_priority(vm_thread *thread, vm_thread_priority priority) 51 | { 52 | int policy, pmin, pmax, pmean; 53 | struct sched_param param; 54 | 55 | if (!thread->is_valid) return 0; 56 | pthread_getschedparam(thread->handle,&policy,¶m); 57 | 58 | pmin=sched_get_priority_min(policy); 59 | pmax=sched_get_priority_max(policy); 60 | pmean=(pmin+pmax)/2; 61 | 62 | switch (priority) { 63 | case VM_THREAD_PRIORITY_HIGHEST: 64 | param.sched_priority=pmax; break; 65 | case VM_THREAD_PRIORITY_LOWEST: 66 | param.sched_priority=pmin; break; 67 | case VM_THREAD_PRIORITY_NORMAL: 68 | param.sched_priority=pmean; break; 69 | case VM_THREAD_PRIORITY_HIGH: 70 | param.sched_priority=(pmax+pmean)/2; break; 71 | case VM_THREAD_PRIORITY_LOW: 72 | param.sched_priority=(pmin+pmean)/2; break; 73 | } 74 | 75 | return !pthread_setschedparam(thread->handle,policy,¶m); 76 | } 77 | 78 | /* Wait until a thread exists */ 79 | void vm_thread_wait(vm_thread *thread) 80 | { 81 | if (thread->is_valid) { 82 | pthread_join(thread->handle,NULL); 83 | thread->is_valid=0; 84 | } 85 | } 86 | 87 | /* Terminate a thread */ 88 | void vm_thread_terminate(vm_thread *thread) 89 | { 90 | if (thread->is_valid) { 91 | pthread_cancel(thread->handle); 92 | vm_thread_wait(thread); 93 | } 94 | } 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /README.Asterisk: -------------------------------------------------------------------------------- 1 | 2 | 3 | Revision SVN 8 4 | - fix documentation 5 | - diff at proper level 6 | 7 | Revision SVN 6 8 | - convert to using subversion 9 | - update the documentation 10 | - support for Asterisk 1.2.x 11 | 12 | Revision 1.7 (2006-09-03) 13 | - update Intel filenames in documentation, use IPP 4.1.2 instead of 4.1 14 | 15 | Revision 1.6 (2005-09-03) 16 | - unified G.723.1 and G.729 patches into a single diff, so you can 17 | study both more easily 18 | - fix memory leak - thanks to Rafael for spotting the missing `!' in Intel's 19 | code 20 | - compile the command line encoder and decoder for G.729 such that 21 | they produce raw G.729 rather than ITU demonstration bitstreams. 22 | - add Debian packaging files 23 | - add runme.sh 24 | 25 | Revision 1.5 26 | - libimf.so and libimf.a notes 27 | 28 | Revision 1.4 29 | - static linking 30 | - compiler optimizations 31 | 32 | Revision 1.3 33 | - added Intel links 34 | - fixed patch command 35 | - added notes about build dependencies 36 | 37 | Prerequisites 38 | ------------- 39 | 40 | - This code has been compiled with gcc 4. To use with gcc 3, you may need 41 | to change the `-mtune' to `-mcpu' in makeopts, and some other small 42 | changes. 43 | 44 | 45 | 46 | Step 1a 47 | ------- 48 | Download the code from Intel 49 | 50 | cd /tmp 51 | wget ftp://download.intel.com/software/products/ipp/downloads/samples/l_ipp-sample-speech-coding_p_4.1.008.tgz 52 | wget ftp://download.intel.com/software/products/ipp/downloads/l_ipp_ia32_itanium_p_4_1_2.tar 53 | 54 | Step 1b 55 | ------- 56 | 57 | Install Asterisk header files 58 | 59 | On Debian, just type 60 | 61 | apt-get install asterisk-dev 62 | apt-get build-dep asterisk 63 | 64 | Specifically, you need the *.h files that come with Asterisk 65 | 66 | Step 2a 67 | ------- 68 | 69 | Register with Intel 70 | 71 | See http://www.intel.com/software/products/ipp/ 72 | 73 | a) register on Intel's site under the 'free non-commercial use' section 74 | b) obtain the license number and a license key file 75 | c) put the license key file in the place specified by Intel's documentation 76 | d) run the installer 77 | 78 | Step 2b 79 | ------- 80 | 81 | Install IPP libraries. 82 | 83 | (For more detailed help with this stage, see 84 | http://www.readytechnology.co.uk/open/ipp-codecs/intel-notes/ipp-4.1.2.txt ) 85 | 86 | mkdir /tmp/ipp-tmp 87 | cd /tmp/ipp-tmp 88 | tar xf /tmp/l_ipp_ia32_itanium_p_4_1_2.tar 89 | 90 | Follow Intel's instructions to install IPP. If using Debian, the Intel 91 | installed will stop half way, leaving a .rpm file sitting in a subdirectory 92 | of /tmp. You can install the .rpm file using `alien' and then proceed. 93 | 94 | Intel's instructions and licensing information (including Open Source 95 | version information) are at http://www.intel.com/software/products/ipp/ 96 | 97 | Once you've installed IPP and agreed to the license terms, you may need to 98 | copy the libraries from one PC to another (eg, from your development machine 99 | to a production server). You just need to copy the contents of the following 100 | directory: 101 | 102 | /opt/intel/ipp41/ia32_itanium/sharedlib/ 103 | 104 | without re-running the install process. 105 | 106 | If you use static linking (now the default method), you DON'T need to 107 | copy the libraries onto every computer where you run the codec. You 108 | only need the libraries on the computer where you compile the codec. 109 | 110 | Step 3 111 | ------ 112 | 113 | Install IPP sample code 114 | 115 | cd /usr/local/src 116 | tar xzf /tmp/l_ipp-sample-speech-coding_p_4.1.008.tgz 117 | 118 | Step 4 119 | ------ 120 | 121 | Apply my patch 122 | 123 | cd ipp_sample/ 124 | patch -p0 < /tmp/ipp-svn8.diff 125 | 126 | Step 4a 127 | ------- 128 | 129 | Select compiler optimizations 130 | 131 | vi speech-coding/makeopts 132 | 133 | Note: if you optimize for a more modern processor than the processor 134 | in your machine, the codec will not run and Asterisk will not start. 135 | The default is Pentium 4. If you have a Pentium III, you must change 136 | the optimizations. 137 | 138 | Step 5a 139 | ------- 140 | 141 | If you have icc 8.0 libimf, move intel_cc_80/lib/libimf.so to 142 | somewhere out of the way. This will allow you to link libimf.a 143 | statically with codec_g729.so 144 | 145 | Step 5b 146 | ------- 147 | 148 | ************************************** 149 | * New: * 150 | * If NOT using Debian: * 151 | * chmod a+x runme.sh * 152 | * ./runme.sh * 153 | * or * 154 | * chmod a+x runme.sh * 155 | * ./runme.sh install * 156 | * * 157 | * If you are using Debian: * 158 | * * 159 | * chmod a+x runme.sh debian/rules * 160 | * dpkg-buildpackage -rfakeroot * 161 | ************************************** 162 | 163 | Step 6 164 | ------ 165 | 166 | Deploy 167 | 168 | cp codec_g72*.so /usr/lib/asterisk/modules 169 | (the target location depends on your system) 170 | 171 | or just do ./runme.sh install 172 | 173 | or if using Debian, dpkg -i ../asterisk-ipp-codecs_1.0-1_i386.deb 174 | 175 | If you haven't used static linking (now the default), 176 | modify /etc/init.d/asterisk: 177 | 178 | export LD_LIBRARY_PATH=/opt/intel/ipp41/ia32_itanium/sharedlib:/opt/intel/ipp41/ia32_itanium/sharedlib/linux32:$LD_LIBRARY_PATH 179 | 180 | You may need to insert the following into your 181 | sip.conf, iax.conf, h323.conf, etc: 182 | 183 | allow=g729 184 | 185 | Now restart Asterisk 186 | 187 | /etc/init.d/asterisk restart 188 | 189 | Step 7 190 | ------ 191 | 192 | Verify install 193 | 194 | At the shell prompt: 195 | # asterisk -r 196 | 197 | At the Asterisk prompt: 198 | >show translation 199 | 200 | If the G.723.1 and G.729 columns have -'s instead of numbers, then 201 | the codecs are not working properly. 202 | 203 | ============================ 204 | COMMAND LINE ENCODER/DECODER 205 | ============================ 206 | 207 | G.729 only at present 208 | 209 | Do you want to record greetings and IVR messages in G.729 format so 210 | that your CPU doesn't have to transcode every time a call takes place? 211 | 212 | Most likely, yes, you do want this. 213 | 214 | Now you can. The original Intel command line encoder and decoder utilities 215 | (g729fpencoder and g729fpdecoder) work with bitstream files in a 216 | special format used by the ITU test suite. This is not the same format 217 | that Asterisk expects when reading/writing raw G.729. 218 | 219 | The utilities `my_enc' and `my_dec' have been designed to work 220 | with the raw format. Files generated by `my_enc' can be read by Asterisk 221 | without any transcoding. 222 | 223 | Usage: 224 | 225 | my_enc audio.raw audio.g729 226 | 227 | my_dec audio.g729 audio.raw 228 | 229 | Where: 230 | audio.raw must be 231 | - 16 bit signed linear audio, 232 | - mono, 233 | - 8000Hz sample rate 234 | 235 | To convert a WAV file into the raw uncompressed audio before feeding it 236 | to `my_enc', you would use the `sox' utility (available on all Unix systems): 237 | 238 | sox audio.wav -t raw -r 8000 -s -w -c 1 audio.raw 239 | 240 | To convert a GSM file (such as those distributed with Asterisk), do: 241 | 242 | sox audio.gsm -t raw -r 8000 -s -w -c 1 audio.raw 243 | 244 | -------------------------------------------------------------------------------- /debian/asterisk-ipp-codecs.dirs: -------------------------------------------------------------------------------- 1 | usr/lib/asterisk/modules 2 | -------------------------------------------------------------------------------- /debian/asterisk-ipp-codecs.install: -------------------------------------------------------------------------------- 1 | usr/lib/asterisk/modules 2 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | asterisk-ipp-codecs (1.0-1) stable; urgency=low 2 | 3 | * Initial Debian release. 4 | 5 | -- Daniel Pocock Thu, 05 May 2005 14:00:00 +0100 6 | 7 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: asterisk-ipp-codecs 2 | Section: admin 3 | Priority: extra 4 | Maintainer: Daniel Pocock 5 | Build-Depends: debhelper (>> 4.0.0), asterisk-dev 6 | 7 | Package: asterisk-ipp-codecs 8 | Architecture: i386 9 | Depends: asterisk 10 | Description: G.723.1 and G.729 modules for Asterisk 11 | asterisk-ipp-codecs provides the G.723.1 and G.729 modules for Asterisk 12 | in a binary format. These codecs are patented and in most countries 13 | you will need a license to use them legally. Please see 14 | http://www.readytechnology.co.uk/open/g729 for more details 15 | 16 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | # These are used for cross-compiling and for saving the configure script 4 | # from having to guess our platform (since we know it already) 5 | DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) 6 | DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) 7 | 8 | export DH_COMPAT=4 9 | 10 | CFLAGS = -Wall -g 11 | 12 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) 13 | CFLAGS += -O0 14 | else 15 | CFLAGS += -O2 16 | endif 17 | ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) 18 | INSTALL_PROGRAM += -s 19 | endif 20 | 21 | build: build-stamp 22 | 23 | build-stamp: 24 | dh_testdir 25 | #$(MAKE) 26 | touch build-stamp 27 | 28 | clean: 29 | dh_testdir 30 | dh_testroot 31 | rm -f build-stamp 32 | 33 | # Add here commands to clean up after the build process. 34 | # -$(MAKE) clean 35 | 36 | dh_clean 37 | 38 | install: build 39 | dh_testdir 40 | dh_testroot 41 | dh_clean -k 42 | dh_installdirs 43 | 44 | # Add here commands to install the package into debian/tmp. 45 | #$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp 46 | $(CURDIR)/runme.sh install $(CURDIR)/debian/tmp 47 | 48 | dh_install --sourcedir=debian/tmp 49 | 50 | binary-indep: build install 51 | 52 | binary-arch: build install 53 | dh_testdir 54 | dh_testroot 55 | # dh_installdebconf 56 | dh_installdocs 57 | dh_installexamples 58 | dh_installmenu 59 | # dh_installlogrotate 60 | # dh_installemacsen 61 | # dh_installpam 62 | # dh_installmime 63 | # dh_installinit --no-restart-on-upgrade --init-script=eqld -- start 05 1 2 3 4 5 . stop 95 0 6 . 64 | # dh_installcron 65 | # dh_installman 66 | # dh_installinfo 67 | # dh_undocumented 68 | # dh_installchangelogs ChangeLog 69 | dh_link 70 | dh_strip 71 | dh_compress 72 | dh_fixperms 73 | # dh_makeshlibs 74 | dh_installdeb 75 | # dh_perl 76 | dh_shlibdeps 77 | dh_gencontrol 78 | dh_md5sums 79 | dh_builddeb 80 | 81 | binary: binary-indep binary-arch 82 | .PHONY: build clean binary-indep binary-arch binary install 83 | 84 | -------------------------------------------------------------------------------- /ipplic.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentelecoms-org/ipp_audio_codecs/20d097a32e8c5090d751ce5a9c3956dd42454665/ipplic.htm -------------------------------------------------------------------------------- /makeopts: -------------------------------------------------------------------------------- 1 | 2 | 3 | # System Specific 4 | INCLSFX=.h 5 | CPPSFX=.c 6 | OBJSFX=.o 7 | EXESFX= 8 | 9 | # Optional, for ICC 10 | #ICCLIBS=-lsvml 11 | 12 | # IPP Dependencies 13 | #IPPINCLS=-I$(IPPROOT)/include 14 | #IPPLIBS=-L$(IPPROOT)/sharedlib -lippsc -lipps -lippcore -L$(IPPROOT)/sharedlib/linux32 -lguide 15 | 16 | # Comment the above two and uncomment these 17 | # three lines to build statically linked version 18 | IPPINCLS=-I$(IPPROOT)/include -include $(IPPROOT)/tools/staticlib/ipp_$(IPPCORE).h 19 | IPPLIBS=-L$(IPPROOT)/lib -lippscmerged -lippsrmerged -lippsmerged -lippcore 20 | LDFLAGS=-static 21 | # -libcxa 22 | 23 | # Optimizations, choose one set only depending on CPU type (or debug at bottom) 24 | #OPTIMIZE= -O2 25 | #IPPCORE= 26 | 27 | # For Pentium I 28 | #OPTIMIZE= -O6 -march=pentium -mtune=pentium -ffast-math -fomit-frame-pointer 29 | #IPPCORE=px 30 | 31 | # For PII 32 | #OPTIMIZE=-O6 -march=pentium2 -mtune=pentium2 -ffast-math -fomit-frame-pointer 33 | #IPPCORE=px 34 | 35 | # For PIII 36 | OPTIMIZE= -O6 -mtune=pentium3 -march=pentium3 -ffast-math -fomit-frame-pointer 37 | IPPCORE=a6 38 | 39 | # For PIII no SSE 40 | #OPTIMIZE= -O6 -mtune=pentium3 -march=pentium3 -ffast-math -fomit-frame-pointer -mno-sse 41 | #IPPCORE=a6 42 | 43 | # For P4 44 | #OPTIMIZE= -O6 -march=pentium4 -mtune=pentium4 -ffast-math -fomit-frame-pointer 45 | #IPPCORE=w7 46 | # optional 47 | 48 | # For P4 no SSE 49 | #OPTIMIZE= -O6 -march=pentium4 -mtune=pentium4 -ffast-math -fomit-frame-pointer -no-sse 50 | #IPPCORE=w7 51 | 52 | # For Athlon (untested) 53 | #OPTIMIZE= -O6 -march=athlon -mtune=athlon -ffast-math -fomit-frame-pointer 54 | #IPPCORE=a6 55 | 56 | # For debugging 57 | #OPTIMIZE= -O -g 58 | #IPPCORE=px 59 | 60 | -------------------------------------------------------------------------------- /runme.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script will build each of the Asterisk codecs for you 4 | 5 | # It also builds the modified command line utilities for encoding/decoding 6 | # raw G729 files 7 | 8 | ASTERISK_MODULES_DIR=/usr/lib/asterisk/modules 9 | 10 | SRC_DIR=`pwd`/${SRC_DIR} 11 | 12 | cd "${SRC_DIR}/G729-float" 13 | ./build.sh 14 | 15 | cd "${SRC_DIR}/G723.1" 16 | ./build.sh 17 | 18 | cd "${SRC_DIR}" 19 | 20 | echo "" 21 | echo "Unless you have manually edited the file G729-float/Makefile and" 22 | echo "G723.1/Makefile, the codecs are optimized for Pentium II" 23 | echo "" 24 | echo "This code will not run on Pentium I or lower" 25 | echo "" 26 | echo "If you have a more powerful processor than Pentium II, you are" 27 | echo "strongly encouraged to edit the Makefiles and select the " 28 | echo "optimizations for your processors. This can give a performance" 29 | echo "boost of up to 30%" 30 | echo "" 31 | echo "To use the codecs, just copy codec_g729.so and codec_g723.so to" 32 | echo "your Asterisk modules directory, usually /usr/lib/asterisk/modules" 33 | echo "and restart Asterisk. The Asterisk command \`show translation'" 34 | echo "will show you whether the modules loaded successfully." 35 | echo "" 36 | 37 | mv "${SRC_DIR}/G729-float/bin/codec_g729.so" "${SRC_DIR}" 38 | mv "${SRC_DIR}/G723.1/bin/codec_g723.so" "${SRC_DIR}" 39 | 40 | if [ "X${1}" == "Xinstall" ]; 41 | then 42 | DEST_DIR="${2}" 43 | install -d "${DEST_DIR}${ASTERISK_MODULES_DIR}/" 44 | install "${SRC_DIR}/codec_g729.so" "${DEST_DIR}${ASTERISK_MODULES_DIR}/" 45 | install "${SRC_DIR}/codec_g723.so" "${DEST_DIR}${ASTERISK_MODULES_DIR}/" 46 | 47 | fi 48 | -------------------------------------------------------------------------------- /support.txt: -------------------------------------------------------------------------------- 1 | Please use the following information when submitting customer support requests 2 | 3 | Package ID: l_ipp-sample-speech-coding_p_4.1.008 4 | Package Contents: Intel(R) Integrated Performance Primitives 5 | Speech Coding Samples for Linux* 6 | 7 | --------------------------------------------------------------------------------