Loading lib_com/ivas_ism_com.c +2 −3 Original line number Diff line number Diff line Loading @@ -1260,7 +1260,7 @@ void ivas_ism_metadata_close( * * Store last metadata values *-------------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED void update_last_metadata( const int16_t nchan_ism, /* i : number of objects */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ Loading @@ -1284,8 +1284,7 @@ void update_last_metadata( return; } #ifdef IVAS_FLOAT_FIXED #else void update_last_metadata_fx( const Word16 nchan_ism, /* i : number of objects */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ Loading lib_com/ivas_prot.h +2 −0 Original line number Diff line number Diff line Loading @@ -6691,12 +6691,14 @@ void ivas_ari_done_encoding_14bits( BSTR_ENC_HANDLE hBstr, Tastat *s ); #ifndef IVAS_FLOAT_FIXED void ivas_ari_encode_14bits_ext( BSTR_ENC_HANDLE hBstr, Tastat *s, int32_t symbol, const uint16_t *cum_freq ); #endif // !IVAS_FLOAT_FIXED void ivas_wrap_arround( int16_t *pArr, Loading lib_com/prot.h +6 −0 Original line number Diff line number Diff line Loading @@ -7715,6 +7715,7 @@ int32_t mul_sbc_14bits_ivas( void ari_start_encoding_14bits( Tastat *s ); #ifndef IVAS_FLOAT_FIXED int16_t ari_encode_14bits_ext( int16_t *ptr, int16_t bp, Loading @@ -7726,6 +7727,7 @@ int16_t ari_done_encoding_14bits( int16_t *ptr, int16_t bp, Tastat *s ); #endif // !IVAS_FLOAT_FIXED void ari_start_decoding_14bits_ivas( Decoder_State *st, Loading Loading @@ -7794,12 +7796,14 @@ int16_t ari_encode_14bits_range( uint16_t cum_freq_low, uint16_t cum_freq_high ); #ifndef IVAS_FLOAT_FIXED int16_t ari_encode_14bits_sign( int16_t *ptr, int16_t bp, int32_t bits, Tastat *s, int32_t sign ); #endif // !IVAS_FLOAT_FIXED int16_t ari_done_cbr_encoding_14bits( int16_t *ptr, Loading Loading @@ -10163,6 +10167,7 @@ void IGFSCFEncoderReset( IGFSCFENC_INSTANCE_HANDLE hPublicData /* i : handle to public data or NULL in case there was no instance created */ ); #ifndef IVAS_FLOAT_FIXED int16_t IGFSCFEncoderEncode( IGFSCFENC_INSTANCE_HANDLE hPublicData, /* i : handle to public data or NULL in case there was no instance created */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ Loading @@ -10171,6 +10176,7 @@ int16_t IGFSCFEncoderEncode( const int16_t igfGridIdx, /* i : igf grid index see declaration of IGF_GRID_IDX for details */ const int16_t indepFlag /* i : if 1 frame is independent, 0 = frame is coded with data from previous frame */ ); #endif void IGFSCFEncoderSaveContextState( IGFSCFENC_INSTANCE_HANDLE hPublicData, /* i : handle to public data or NULL in case there was no instance created */ Loading lib_com/prot_fx.h +57 −0 Original line number Diff line number Diff line Loading @@ -5882,6 +5882,27 @@ void RefineTonalComponents( #endif ); void ivas_RefineTonalComponents_fx( Word16 indexOfTonalPeak[], Word16 lowerIndex[], Word16 upperIndex[], Word16 phaseDiff[], Word16 phases[], Word16 *pNumIndexes, const Word32 lastPitchLag, const Word32 currentPitchLag, const Word16 lastMDCTSpectrum[], const Word16 lastMDCTSpectrum_exp, const Word16 scaleFactors[], const Word16 scaleFactors_exp[], const Word16 scaleFactors_max_e, const Word32 secondLastPowerSpectrum[], const Word16 nSamples, const Word16 nSamplesCore, const Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins */ Word16 element_mode, const PsychoacousticParameters *psychParamsCurrent ); ivas_error PsychoacousticParameters_Init( const int32_t sr_core, /* i : sampling rate of core-coder */ const int16_t nBins, /* i : Number of bins (spectral lines) */ Loading Loading @@ -10230,6 +10251,7 @@ void ProcessStereoIGF_fx( const int16_t sp_aud_decision0, /* i : sp_aud_decision0 */ const int32_t element_brate /* i : element bitrate */ ); /*igf_enc.c*/ void IGFEncApplyStereo_fx( STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: MDCT stereo encoder structure */ Word16 ms_mask[2][MAX_SFB], /* i : bandwise MS mask */ Loading @@ -10244,6 +10266,41 @@ void IGFEncApplyStereo_fx( const Word32 element_brate /* i : element bitrate */ ); void IGFSaveSpectrumForITF_ivas_fx( IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i/o: instance handle of IGF Encoder */ const Word16 igfGridIdx, /* i : IGF grid index */ const Word32 *pITFSpectrum /* i : MDCT spectrum */ ); Word16 IGFEncWriteBitstream_ivas_fx( const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ Word16 *pBitOffset, /* i : ptr to bitOffset counter */ const Word16 igfGridIdx, /* i : igf grid index see declaration of IGF_GRID_IDX for details */ const Word16 isIndepFlag /* i : if 1 frame is independent, 0 = frame is coded with data from previous frame */ ); /*igf_scf_enc.c*/ Word16 IGFSCFEncoderEncode( IGFSCFENC_INSTANCE_HANDLE hPublicData, /* i/o: handle to public data or NULL in case there was no instance created */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 bitCount, /* i : offset to the first bit in bitbuffer which should be readed by iisArithDecoderDecode function */ Word16 *sfe, /* i : ptr to an array which contain quantized scalefactor energies */ const Word16 igfGridIdx, /* i : igf grid index see declaration of IGF_GRID_IDX for details */ const Word16 indepFlag /* i : if 1 frame is independent, 0 = frame is coded with data from previous frame */ ); /*ari_enc.c*/ Word16 ari_encode_14bits_ext( Word16 *ptr, Word16 bp, Tastat *s, Word32 symbol, const UWord16 *cum_freq ); Word16 ari_encode_14bits_sign( Word16 *ptr, Word16 bp, Word32 bits, Tastat *s, Word16 sign ); Word16 ari_done_encoding_14bits( Word16 *ptr, Word16 bp, Tastat *s ); #endif // IVAS_FLOAT_FIXED #endif Loading lib_dec/TonalComponentDetection_fx.c +87 −0 Original line number Diff line number Diff line Loading @@ -290,6 +290,93 @@ void RefineTonalComponents( return; } void ivas_RefineTonalComponents_fx( Word16 indexOfTonalPeak[], Word16 lowerIndex[], Word16 upperIndex[], Word16 phaseDiff[], Word16 phases[], Word16 *pNumIndexes, const Word32 lastPitchLag, const Word32 currentPitchLag, const Word16 lastMDCTSpectrum[], const Word16 lastMDCTSpectrum_exp, const Word16 scaleFactors[], const Word16 scaleFactors_exp[], const Word16 scaleFactors_max_e, const Word32 secondLastPowerSpectrum[], const Word16 nSamples, const Word16 nSamplesCore, const Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins */ Word16 element_mode, const PsychoacousticParameters *psychParamsCurrent ) { Word16 newIndexOfTonalPeak[MAX_NUMBER_OF_IDX]; Word16 newLowerIndex[MAX_NUMBER_OF_IDX]; Word16 newUpperIndex[MAX_NUMBER_OF_IDX]; Word16 newNumIndexes, nPreservedPeaks; Word16 iNew, iOld, j; Word16 *pOldPhase, *pNewPhase; ivas_DetectTonalComponents_fx( newIndexOfTonalPeak, newLowerIndex, newUpperIndex, &newNumIndexes, lastPitchLag, currentPitchLag, lastMDCTSpectrum, lastMDCTSpectrum_exp, scaleFactors, scaleFactors_exp, scaleFactors_max_e, secondLastPowerSpectrum, nSamples, nSamplesCore, floorPowerSpectrum, psychParamsCurrent, element_mode ); nPreservedPeaks = 0; move16(); iNew = 0; move16(); pOldPhase = phases; pNewPhase = phases; FOR( iOld = 0; iOld < *pNumIndexes; iOld++ ) { /* We don't want that the old peak index is at the border of the new peak region, that is why >= newUpperIndex and > newLowerIndex */ test(); WHILE( LT_16( iNew, newNumIndexes ) && GE_16( indexOfTonalPeak[iOld], newUpperIndex[iNew] ) ) { iNew = add( iNew, 1 ); } test(); IF( LT_16( iNew, newNumIndexes ) && GT_16( indexOfTonalPeak[iOld], newLowerIndex[iNew] ) ) { newIndexOfTonalPeak[nPreservedPeaks] = indexOfTonalPeak[iOld]; move16(); newLowerIndex[nPreservedPeaks] = lowerIndex[iOld]; move16(); newUpperIndex[nPreservedPeaks] = upperIndex[iOld]; move16(); phaseDiff[nPreservedPeaks] = phaseDiff[iOld]; move16(); FOR( j = lowerIndex[iOld]; j <= upperIndex[iOld]; j++ ) { *pNewPhase++ = *pOldPhase++; move16(); } nPreservedPeaks = add( nPreservedPeaks, 1 ); } ELSE { pOldPhase += sub( upperIndex[iOld], add( lowerIndex[iOld], 1 ) ); } } FOR( iNew = 0; iNew < nPreservedPeaks; iNew++ ) { indexOfTonalPeak[iNew] = newIndexOfTonalPeak[iNew]; move16(); lowerIndex[iNew] = newLowerIndex[iNew]; move16(); upperIndex[iNew] = newUpperIndex[iNew]; move16(); } *pNumIndexes = nPreservedPeaks; move16(); return; } /*-------------------------------------------------------------------* * Local functions *-------------------------------------------------------------------*/ Loading Loading
lib_com/ivas_ism_com.c +2 −3 Original line number Diff line number Diff line Loading @@ -1260,7 +1260,7 @@ void ivas_ism_metadata_close( * * Store last metadata values *-------------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED void update_last_metadata( const int16_t nchan_ism, /* i : number of objects */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ Loading @@ -1284,8 +1284,7 @@ void update_last_metadata( return; } #ifdef IVAS_FLOAT_FIXED #else void update_last_metadata_fx( const Word16 nchan_ism, /* i : number of objects */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ Loading
lib_com/ivas_prot.h +2 −0 Original line number Diff line number Diff line Loading @@ -6691,12 +6691,14 @@ void ivas_ari_done_encoding_14bits( BSTR_ENC_HANDLE hBstr, Tastat *s ); #ifndef IVAS_FLOAT_FIXED void ivas_ari_encode_14bits_ext( BSTR_ENC_HANDLE hBstr, Tastat *s, int32_t symbol, const uint16_t *cum_freq ); #endif // !IVAS_FLOAT_FIXED void ivas_wrap_arround( int16_t *pArr, Loading
lib_com/prot.h +6 −0 Original line number Diff line number Diff line Loading @@ -7715,6 +7715,7 @@ int32_t mul_sbc_14bits_ivas( void ari_start_encoding_14bits( Tastat *s ); #ifndef IVAS_FLOAT_FIXED int16_t ari_encode_14bits_ext( int16_t *ptr, int16_t bp, Loading @@ -7726,6 +7727,7 @@ int16_t ari_done_encoding_14bits( int16_t *ptr, int16_t bp, Tastat *s ); #endif // !IVAS_FLOAT_FIXED void ari_start_decoding_14bits_ivas( Decoder_State *st, Loading Loading @@ -7794,12 +7796,14 @@ int16_t ari_encode_14bits_range( uint16_t cum_freq_low, uint16_t cum_freq_high ); #ifndef IVAS_FLOAT_FIXED int16_t ari_encode_14bits_sign( int16_t *ptr, int16_t bp, int32_t bits, Tastat *s, int32_t sign ); #endif // !IVAS_FLOAT_FIXED int16_t ari_done_cbr_encoding_14bits( int16_t *ptr, Loading Loading @@ -10163,6 +10167,7 @@ void IGFSCFEncoderReset( IGFSCFENC_INSTANCE_HANDLE hPublicData /* i : handle to public data or NULL in case there was no instance created */ ); #ifndef IVAS_FLOAT_FIXED int16_t IGFSCFEncoderEncode( IGFSCFENC_INSTANCE_HANDLE hPublicData, /* i : handle to public data or NULL in case there was no instance created */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ Loading @@ -10171,6 +10176,7 @@ int16_t IGFSCFEncoderEncode( const int16_t igfGridIdx, /* i : igf grid index see declaration of IGF_GRID_IDX for details */ const int16_t indepFlag /* i : if 1 frame is independent, 0 = frame is coded with data from previous frame */ ); #endif void IGFSCFEncoderSaveContextState( IGFSCFENC_INSTANCE_HANDLE hPublicData, /* i : handle to public data or NULL in case there was no instance created */ Loading
lib_com/prot_fx.h +57 −0 Original line number Diff line number Diff line Loading @@ -5882,6 +5882,27 @@ void RefineTonalComponents( #endif ); void ivas_RefineTonalComponents_fx( Word16 indexOfTonalPeak[], Word16 lowerIndex[], Word16 upperIndex[], Word16 phaseDiff[], Word16 phases[], Word16 *pNumIndexes, const Word32 lastPitchLag, const Word32 currentPitchLag, const Word16 lastMDCTSpectrum[], const Word16 lastMDCTSpectrum_exp, const Word16 scaleFactors[], const Word16 scaleFactors_exp[], const Word16 scaleFactors_max_e, const Word32 secondLastPowerSpectrum[], const Word16 nSamples, const Word16 nSamplesCore, const Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins */ Word16 element_mode, const PsychoacousticParameters *psychParamsCurrent ); ivas_error PsychoacousticParameters_Init( const int32_t sr_core, /* i : sampling rate of core-coder */ const int16_t nBins, /* i : Number of bins (spectral lines) */ Loading Loading @@ -10230,6 +10251,7 @@ void ProcessStereoIGF_fx( const int16_t sp_aud_decision0, /* i : sp_aud_decision0 */ const int32_t element_brate /* i : element bitrate */ ); /*igf_enc.c*/ void IGFEncApplyStereo_fx( STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: MDCT stereo encoder structure */ Word16 ms_mask[2][MAX_SFB], /* i : bandwise MS mask */ Loading @@ -10244,6 +10266,41 @@ void IGFEncApplyStereo_fx( const Word32 element_brate /* i : element bitrate */ ); void IGFSaveSpectrumForITF_ivas_fx( IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i/o: instance handle of IGF Encoder */ const Word16 igfGridIdx, /* i : IGF grid index */ const Word32 *pITFSpectrum /* i : MDCT spectrum */ ); Word16 IGFEncWriteBitstream_ivas_fx( const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ Word16 *pBitOffset, /* i : ptr to bitOffset counter */ const Word16 igfGridIdx, /* i : igf grid index see declaration of IGF_GRID_IDX for details */ const Word16 isIndepFlag /* i : if 1 frame is independent, 0 = frame is coded with data from previous frame */ ); /*igf_scf_enc.c*/ Word16 IGFSCFEncoderEncode( IGFSCFENC_INSTANCE_HANDLE hPublicData, /* i/o: handle to public data or NULL in case there was no instance created */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 bitCount, /* i : offset to the first bit in bitbuffer which should be readed by iisArithDecoderDecode function */ Word16 *sfe, /* i : ptr to an array which contain quantized scalefactor energies */ const Word16 igfGridIdx, /* i : igf grid index see declaration of IGF_GRID_IDX for details */ const Word16 indepFlag /* i : if 1 frame is independent, 0 = frame is coded with data from previous frame */ ); /*ari_enc.c*/ Word16 ari_encode_14bits_ext( Word16 *ptr, Word16 bp, Tastat *s, Word32 symbol, const UWord16 *cum_freq ); Word16 ari_encode_14bits_sign( Word16 *ptr, Word16 bp, Word32 bits, Tastat *s, Word16 sign ); Word16 ari_done_encoding_14bits( Word16 *ptr, Word16 bp, Tastat *s ); #endif // IVAS_FLOAT_FIXED #endif Loading
lib_dec/TonalComponentDetection_fx.c +87 −0 Original line number Diff line number Diff line Loading @@ -290,6 +290,93 @@ void RefineTonalComponents( return; } void ivas_RefineTonalComponents_fx( Word16 indexOfTonalPeak[], Word16 lowerIndex[], Word16 upperIndex[], Word16 phaseDiff[], Word16 phases[], Word16 *pNumIndexes, const Word32 lastPitchLag, const Word32 currentPitchLag, const Word16 lastMDCTSpectrum[], const Word16 lastMDCTSpectrum_exp, const Word16 scaleFactors[], const Word16 scaleFactors_exp[], const Word16 scaleFactors_max_e, const Word32 secondLastPowerSpectrum[], const Word16 nSamples, const Word16 nSamplesCore, const Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins */ Word16 element_mode, const PsychoacousticParameters *psychParamsCurrent ) { Word16 newIndexOfTonalPeak[MAX_NUMBER_OF_IDX]; Word16 newLowerIndex[MAX_NUMBER_OF_IDX]; Word16 newUpperIndex[MAX_NUMBER_OF_IDX]; Word16 newNumIndexes, nPreservedPeaks; Word16 iNew, iOld, j; Word16 *pOldPhase, *pNewPhase; ivas_DetectTonalComponents_fx( newIndexOfTonalPeak, newLowerIndex, newUpperIndex, &newNumIndexes, lastPitchLag, currentPitchLag, lastMDCTSpectrum, lastMDCTSpectrum_exp, scaleFactors, scaleFactors_exp, scaleFactors_max_e, secondLastPowerSpectrum, nSamples, nSamplesCore, floorPowerSpectrum, psychParamsCurrent, element_mode ); nPreservedPeaks = 0; move16(); iNew = 0; move16(); pOldPhase = phases; pNewPhase = phases; FOR( iOld = 0; iOld < *pNumIndexes; iOld++ ) { /* We don't want that the old peak index is at the border of the new peak region, that is why >= newUpperIndex and > newLowerIndex */ test(); WHILE( LT_16( iNew, newNumIndexes ) && GE_16( indexOfTonalPeak[iOld], newUpperIndex[iNew] ) ) { iNew = add( iNew, 1 ); } test(); IF( LT_16( iNew, newNumIndexes ) && GT_16( indexOfTonalPeak[iOld], newLowerIndex[iNew] ) ) { newIndexOfTonalPeak[nPreservedPeaks] = indexOfTonalPeak[iOld]; move16(); newLowerIndex[nPreservedPeaks] = lowerIndex[iOld]; move16(); newUpperIndex[nPreservedPeaks] = upperIndex[iOld]; move16(); phaseDiff[nPreservedPeaks] = phaseDiff[iOld]; move16(); FOR( j = lowerIndex[iOld]; j <= upperIndex[iOld]; j++ ) { *pNewPhase++ = *pOldPhase++; move16(); } nPreservedPeaks = add( nPreservedPeaks, 1 ); } ELSE { pOldPhase += sub( upperIndex[iOld], add( lowerIndex[iOld], 1 ) ); } } FOR( iNew = 0; iNew < nPreservedPeaks; iNew++ ) { indexOfTonalPeak[iNew] = newIndexOfTonalPeak[iNew]; move16(); lowerIndex[iNew] = newLowerIndex[iNew]; move16(); upperIndex[iNew] = newUpperIndex[iNew]; move16(); } *pNumIndexes = nPreservedPeaks; move16(); return; } /*-------------------------------------------------------------------* * Local functions *-------------------------------------------------------------------*/ Loading