Loading Workspace_msvc/lib_dec.vcxproj +1 −0 Original line number Diff line number Diff line Loading @@ -337,6 +337,7 @@ <ClCompile Include="..\lib_dec\ivas_stereo_ica_dec.c" /> <ClCompile Include="..\lib_dec\ivas_stereo_icbwe_dec.c" /> <ClCompile Include="..\lib_dec\ivas_stereo_mdct_core_dec.c" /> <ClCompile Include="..\lib_dec\ivas_stereo_mdct_core_dec_fx.c" /> <ClCompile Include="..\lib_dec\ivas_stereo_mdct_stereo_dec.c" /> <ClCompile Include="..\lib_dec\ivas_stereo_switching_dec.c" /> <ClCompile Include="..\lib_dec\ivas_stereo_td_dec.c" /> Loading Workspace_msvc/lib_dec.vcxproj.filters +2 −0 Original line number Diff line number Diff line Loading @@ -832,6 +832,8 @@ </ClCompile> <ClCompile Include="..\lib_dec\ivas_init_dec_fx.c"> <Filter>decoder_ivas_c</Filter> <ClCompile Include="..\lib_dec\ivas_stereo_mdct_core_dec_fx.c"> <Filter>decoder_ivas_c</Filter> </ClCompile> </ItemGroup> <ItemGroup> Loading lib_com/igf_base.c +0 −342 Original line number Diff line number Diff line Loading @@ -357,348 +357,6 @@ int16_t IGF_MapBitRateToIndex_flt( return bitRateIndex; } #ifdef IVAS_FLOAT_FIXED Word16 IGF_MapBitRateToIndex( const Word32 brate, /* i : bitrate */ const Word16 bwidth, /* i : audio bandwidth */ const Word16 element_mode, /* i : element mode */ const Word16 rf_mode /* i : flag to signal the RF mode */ ) { Word16 bitRateIndex = IGF_BITRATE_UNKNOWN; move16(); /* Stereo/CPE modes */ IF ( GT_16( element_mode, IVAS_SCE ) ) { SWITCH ( bwidth ) { case IGF_MODE_WB: IF ( LE_32( brate, IVAS_13k2 ) && EQ_16( rf_mode, 1 ) ) { bitRateIndex = IGF_BITRATE_RF_WB_13200; move16(); } ELSE IF ( LE_32( brate, ACELP_9k60 ) ) { bitRateIndex = IGF_BITRATE_WB_13200_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_13k2 ) ) { bitRateIndex = IGF_BITRATE_WB_16400_CPE; move16(); } BREAK; case IGF_MODE_SWB: /* DFT and TD Stereo bitrates */ IF ( LE_32( brate, ACELP_9k60 ) ) { bitRateIndex = IGF_BITRATE_SWB_13200_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_13k2 ) ) { IF ( EQ_16( rf_mode, 1 ) ) { bitRateIndex = IGF_BITRATE_RF_SWB_13200; move16(); } ELSE { bitRateIndex = IGF_BITRATE_SWB_16400_CPE; move16(); } } ELSE IF ( LE_32( brate, IVAS_16k4 ) ) { bitRateIndex = IGF_BITRATE_SWB_24400_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_24k4 ) ) { bitRateIndex = IGF_BITRATE_SWB_32000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_32k ) ) { bitRateIndex = IGF_BITRATE_SWB_32000; move16(); } /* MDCT Stereo bitrates */ ELSE IF ( LE_32( brate, IVAS_48k ) ) { bitRateIndex = IGF_BITRATE_SWB_48000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_64k ) ) { bitRateIndex = IGF_BITRATE_SWB_64000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_80k ) ) { bitRateIndex = IGF_BITRATE_SWB_80000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_96k ) ) { bitRateIndex = IGF_BITRATE_SWB_96000_CPE; move16(); } BREAK; case IGF_MODE_FB: /* DFT and TD Stereo bitrates */ IF ( LE_32( brate, IVAS_16k4 ) ) { bitRateIndex = IGF_BITRATE_FB_24400_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_24k4 ) ) { bitRateIndex = IGF_BITRATE_FB_32000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_32k ) ) { bitRateIndex = IGF_BITRATE_FB_32000; move16(); } /* MDCT Stereo bitrates */ ELSE IF ( LE_32( brate, IVAS_48k ) ) { bitRateIndex = IGF_BITRATE_FB_48000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_64k ) ) { bitRateIndex = IGF_BITRATE_FB_64000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_80k ) ) { bitRateIndex = IGF_BITRATE_FB_80000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_96k ) ) { bitRateIndex = IGF_BITRATE_FB_96000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_128k ) ) { bitRateIndex = IGF_BITRATE_FB_128000_CPE; move16(); } BREAK; } } /* SCE modes: use tunings done for DFT stereo bitrates also for according SCE bitrates, otherwise same config as mono modes */ ELSE IF ( EQ_16( element_mode, IVAS_SCE ) ) { SWITCH ( bwidth ) { case IGF_MODE_WB: IF ( LE_32( brate, IVAS_13k2 ) && EQ_16( rf_mode, 1 ) ) { bitRateIndex = IGF_BITRATE_RF_WB_13200; move16(); } ELSE IF ( LE_32( brate, ACELP_9k60 ) ) /* bitrates 8000 and 9600 */ { bitRateIndex = IGF_BITRATE_WB_9600; move16(); } BREAK; case IGF_MODE_SWB: IF ( LE_32( brate, ACELP_9k60 ) ) { bitRateIndex = IGF_BITRATE_SWB_13200_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_13k2 ) ) { IF ( EQ_16( rf_mode, 1 ) ) { bitRateIndex = IGF_BITRATE_RF_SWB_13200; move16(); } ELSE { bitRateIndex = IGF_BITRATE_SWB_16400_CPE; move16(); } } ELSE IF ( LE_32( brate, IVAS_16k4 ) ) { bitRateIndex = IGF_BITRATE_SWB_24400_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_24k4 ) ) { bitRateIndex = IGF_BITRATE_SWB_32000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_32k ) ) { bitRateIndex = IGF_BITRATE_SWB_32000; move16(); } ELSE IF ( LE_32( brate, IVAS_48k ) ) { bitRateIndex = IGF_BITRATE_SWB_48000; move16(); } ELSE IF ( LE_32( brate, IVAS_64k ) ) { bitRateIndex = IGF_BITRATE_SWB_64000; move16(); } BREAK; case IGF_MODE_FB: IF ( LE_32( brate, IVAS_16k4 ) ) { bitRateIndex = IGF_BITRATE_FB_24400_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_24k4 ) ) { bitRateIndex = IGF_BITRATE_FB_32000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_32k ) ) { bitRateIndex = IGF_BITRATE_FB_32000; move16(); } ELSE IF ( LE_32( brate, IVAS_48k ) ) { bitRateIndex = IGF_BITRATE_FB_48000; move16(); } ELSE IF ( LE_32( brate, IVAS_64k ) ) { bitRateIndex = IGF_BITRATE_FB_64000; } ELSE IF ( LE_32( brate, IVAS_96k ) ) { bitRateIndex = IGF_BITRATE_FB_96000; move16(); } ELSE IF ( LE_32( brate, IVAS_128k ) ) { bitRateIndex = IGF_BITRATE_FB_128000; move16(); } BREAK; } } /* EVS mono */ ELSE { SWITCH ( bwidth ) { case IGF_MODE_WB: IF ( LE_32( brate, ACELP_13k20 ) && EQ_16( rf_mode, 1 ) ) { bitRateIndex = IGF_BITRATE_RF_WB_13200; move16(); } ELSE IF ( LE_32( brate, ACELP_9k60 ) ) /* bitrates 8000 and 9600 */ { bitRateIndex = IGF_BITRATE_WB_9600; move16(); } BREAK; case IGF_MODE_SWB: IF ( LE_32( brate, ACELP_9k60 ) ) { bitRateIndex = IGF_BITRATE_SWB_9600; move16(); } ELSE IF ( LE_32( brate, ACELP_13k20 ) ) { IF ( EQ_16( rf_mode, 1 ) ) { bitRateIndex = IGF_BITRATE_RF_SWB_13200; move16(); } ELSE { bitRateIndex = IGF_BITRATE_SWB_13200; move16(); } } ELSE IF ( LE_32( brate, ACELP_16k40 ) ) { bitRateIndex = IGF_BITRATE_SWB_16400; move16(); } ELSE IF ( LE_32( brate, ACELP_24k40 ) ) { bitRateIndex = IGF_BITRATE_SWB_24400; move16(); } ELSE IF ( LE_32( brate, ACELP_32k ) ) { bitRateIndex = IGF_BITRATE_SWB_32000; move16(); } ELSE IF ( LE_32( brate, ACELP_48k ) ) { bitRateIndex = IGF_BITRATE_SWB_48000; move16(); } ELSE IF ( LE_32( brate, ACELP_64k ) ) { bitRateIndex = IGF_BITRATE_SWB_64000; move16(); } BREAK; case IGF_MODE_FB: IF ( LE_32( brate, ACELP_16k40 ) ) { bitRateIndex = IGF_BITRATE_FB_16400; move16(); } ELSE IF ( LE_32( brate, ACELP_24k40 ) ) { bitRateIndex = IGF_BITRATE_FB_24400; move16(); } ELSE IF ( LE_32( brate, ACELP_32k ) ) { bitRateIndex = IGF_BITRATE_FB_32000; move16(); } ELSE IF ( LE_32( brate, ACELP_48k ) ) { bitRateIndex = IGF_BITRATE_FB_48000; move16(); } ELSE IF ( LE_32( brate, ACELP_64k ) ) { bitRateIndex = IGF_BITRATE_FB_64000; move16(); } ELSE IF ( LE_32( brate, HQ_96k ) ) { bitRateIndex = IGF_BITRATE_FB_96000; move16(); } ELSE IF ( LE_32( brate, HQ_128k ) ) { bitRateIndex = IGF_BITRATE_FB_128000; move16(); } BREAK; } } return bitRateIndex; } #endif /*---------------------------------------------------------------------* * IGF_gridSetUp_flt() * Loading lib_com/igf_base_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ /**********************************************************************/ /* returns an int val, multiplied with transFac **************************************************************************/ static Word16 IGF_ApplyTransFac( /**< out: Q0 | multiplication factor */ Word16 IGF_ApplyTransFac( /**< out: Q0 | multiplication factor */ const Word16 val, /**< in: Q15 | input value for multiplication, Q15 */ const Word16 transFac /**< in: Q14 | multiplicator for variable val, Q14: 1.25f=0x5000, 1.0f=0x4000, 0.5f=0x2000 */ ) Loading @@ -39,7 +39,7 @@ static Word16 IGF_ApplyTransFac( /**********************************************************************/ /* maps a given bitrate to the IGF_BITRATE index **************************************************************************/ static Word16 IGF_MapBitRateToIndex( Word16 IGF_MapBitRateToIndex( const Word32 brate, /* i : bitrate */ const Word16 bwidth, /* i : audio bandwidth */ const Word16 element_mode, /* i : element mode */ Loading lib_com/ivas_stereo_mdct_bands_com.c +186 −0 Original line number Diff line number Diff line Loading @@ -39,7 +39,11 @@ #include "rom_com.h" #include "prot.h" #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED #include "prot_fx1.h" #include "prot_fx2.h" #include "ivas_prot_fx.h" #endif /*-------------------------------------------------------------------* * Local union Loading @@ -62,6 +66,157 @@ typedef union * initialize stereo band tables for MDCT stereo *-------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED void stereo_mdct_init_bands_fx( const Word16 L_frame, /* i : frame length */ const Word16 tmp_tcx_mode, /* i : tcx mode (TCX10, TCX 20), -1 if transition frame */ const Word32 element_brate, /* i : element bitrate */ const Word16 igf, /* i : flag indicating if IGF is used */ const H_IGF_GRID hIgfGrid, /* i : IGF grid setup */ Word16 *sfbOffset, /* o : sfb offset table */ Word16 *sfbCnt /* o : number of sfbs */ ) { SBPARAMS sfbParam; Word16 i, cnt, specStartOffset, L_frameTCX, tcx_mode; const UWord8 *sfbWidths; IF( tmp_tcx_mode > 0 ) { tcx_mode = tmp_tcx_mode; L_frameTCX = ( tcx_mode == TCX_20_CORE ) ? L_frame : ( L_frame / 2 ); } ELSE { /*transition frame*/ L_frameTCX = L_frame + L_frame / 4; tcx_mode = TCX_20_CORE; } /* select table */ IF( L_frame == L_FRAME48k ) { sfbParam.steBands = mdctStereoBands_32000_640; cnt = ( tcx_mode == TCX_20_CORE ? sfbParam.steBands->bdnCnt_TCX20[0] : sfbParam.steBands->bndCnt_TCX10[0] ); sfbWidths = ( tcx_mode == TCX_20_CORE ? sfbParam.steBands->bandLengthsTCX20 : sfbParam.steBands->bandLengthsTCX10 ); } ELSE { IF( element_brate < IVAS_96k ) { sfbParam.steBands = mdctStereoBands_32000_640; SWITCH( L_frame ) { case L_FRAME32k: cnt = ( tcx_mode == TCX_20_CORE ? sfbParam.steBands->bdnCnt_TCX20[1] : sfbParam.steBands->bndCnt_TCX10[1] ); BREAK; case L_FRAME25_6k: cnt = ( tcx_mode == TCX_20_CORE ? sfbParam.steBands->bdnCnt_TCX20[2] : sfbParam.steBands->bndCnt_TCX10[2] ); BREAK; case L_FRAME16k: cnt = ( tcx_mode == TCX_20_CORE ? sfbParam.steBands->bdnCnt_TCX20[3] : sfbParam.steBands->bndCnt_TCX10[3] ); BREAK; default: assert( !"Subband division not defined for this frame size" ); return; } sfbWidths = ( tcx_mode == TCX_20_CORE ? sfbParam.steBands->bandLengthsTCX20 : sfbParam.steBands->bandLengthsTCX10 ); } ELSE { SWITCH( L_frame ) { case L_FRAME48k: case L_FRAME32k: sfbParam.lpcBndsParam = sw32000Hz; BREAK; case L_FRAME25_6k: sfbParam.lpcBndsParam = sw25600Hz; BREAK; case L_FRAME16k: sfbParam.lpcBndsParam = sw16000Hz; BREAK; default: assert( !"Subband division not defined for this frame size" ); return; } sfbWidths = ( tcx_mode == TCX_20_CORE ? sfbParam.lpcBndsParam->bandLengthsTCX20 : sfbParam.lpcBndsParam->bandLengthsTCX10 ); cnt = 64; } } /* calc sfb offsets */ specStartOffset = 0; FOR( i = 0; i < cnt; i++ ) { sfbOffset[i] = min( specStartOffset, L_frameTCX ); specStartOffset += sfbWidths[i]; IF( sfbOffset[i] >= L_frameTCX ) { BREAK; } } *sfbCnt = i; sfbOffset[*sfbCnt] = min( specStartOffset, L_frameTCX ); IF( igf ) { Word16 sfbOldCnt = *sfbCnt; Word16 igfSfbStep = hIgfGrid->infoIsRefined ? 2 : 1; Word16 k; /* modify sfb bands according to igf grid */ assert( hIgfGrid != NULL ); /* find sfb where IGF starts */ FOR( i = 0; i <= *sfbCnt; i++ ) { IF( sfbOffset[i] >= hIgfGrid->startLine ) { /* set band border to igf start line */ sfbOffset[i] = hIgfGrid->startLine; *sfbCnt = i; BREAK; } } /* change bands above the igf start line to match igf bands */ for( i = 1, k = igfSfbStep; i < hIgfGrid->swb_offset_len; i++, k += igfSfbStep ) { sfbOffset[*sfbCnt + i] = hIgfGrid->swb_offset[k]; } *sfbCnt += ( hIgfGrid->swb_offset_len - 1 ); /* better save than sorry, overwrite anything that is left above */ FOR( i = *sfbCnt + 1; i < sfbOldCnt + 1; i++ ) { sfbOffset[i] = 0; } } ELSE { IF( sfbOffset[*sfbCnt] < L_frameTCX ) { Word16 nMissingBins = L_frameTCX - sfbOffset[*sfbCnt]; IF( sfbWidths[i] / 2 < nMissingBins ) { ( *sfbCnt )++; } sfbOffset[*sfbCnt] = L_frameTCX; } } return; } #endif void stereo_mdct_init_bands( const int16_t L_frame, /* i : frame length */ const int16_t tmp_tcx_mode, /* i : tcx mode (TCX10, TCX 20), -1 if transition frame */ Loading Loading @@ -217,6 +372,37 @@ void stereo_mdct_init_bands( * initialize start band of the IGF in MDCT stereo *-------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED void stereo_mdct_init_igf_start_band_fx( STEREO_MDCT_BAND_PARAMETERS *stbParams, /* i/o: stereo frequency band parameters */ const Word16 transFac, /* i : transform factor */ const Word16 bwidth, /* i : audio bandwidth */ const Word32 element_brate /* i : element bitrate */ ) { Word16 i, bitRateIndex, igfStartLine; const Word16 *swb_offset; bitRateIndex = IGF_MapBitRateToIndex( element_brate, bwidth, IVAS_CPE_MDCT, 0 ); swb_offset = &swb_offset_LB_new[bitRateIndex][1]; igfStartLine = IGF_ApplyTransFac( swb_offset[0], transFac ); FOR( i = 0; i < stbParams->sfbCnt; i++ ) { IF( igfStartLine == stbParams->sfbOffset[i] ) { stbParams->sfbIgfStart = i; BREAK; } } stbParams->nBandsStereoCore = stbParams->sfbIgfStart; return; } #endif void stereo_mdct_init_igf_start_band( STEREO_MDCT_BAND_PARAMETERS *stbParams, /* i/o: stereo frequency band parameters */ const float transFac, /* i : transform factor */ Loading Loading
Workspace_msvc/lib_dec.vcxproj +1 −0 Original line number Diff line number Diff line Loading @@ -337,6 +337,7 @@ <ClCompile Include="..\lib_dec\ivas_stereo_ica_dec.c" /> <ClCompile Include="..\lib_dec\ivas_stereo_icbwe_dec.c" /> <ClCompile Include="..\lib_dec\ivas_stereo_mdct_core_dec.c" /> <ClCompile Include="..\lib_dec\ivas_stereo_mdct_core_dec_fx.c" /> <ClCompile Include="..\lib_dec\ivas_stereo_mdct_stereo_dec.c" /> <ClCompile Include="..\lib_dec\ivas_stereo_switching_dec.c" /> <ClCompile Include="..\lib_dec\ivas_stereo_td_dec.c" /> Loading
Workspace_msvc/lib_dec.vcxproj.filters +2 −0 Original line number Diff line number Diff line Loading @@ -832,6 +832,8 @@ </ClCompile> <ClCompile Include="..\lib_dec\ivas_init_dec_fx.c"> <Filter>decoder_ivas_c</Filter> <ClCompile Include="..\lib_dec\ivas_stereo_mdct_core_dec_fx.c"> <Filter>decoder_ivas_c</Filter> </ClCompile> </ItemGroup> <ItemGroup> Loading
lib_com/igf_base.c +0 −342 Original line number Diff line number Diff line Loading @@ -357,348 +357,6 @@ int16_t IGF_MapBitRateToIndex_flt( return bitRateIndex; } #ifdef IVAS_FLOAT_FIXED Word16 IGF_MapBitRateToIndex( const Word32 brate, /* i : bitrate */ const Word16 bwidth, /* i : audio bandwidth */ const Word16 element_mode, /* i : element mode */ const Word16 rf_mode /* i : flag to signal the RF mode */ ) { Word16 bitRateIndex = IGF_BITRATE_UNKNOWN; move16(); /* Stereo/CPE modes */ IF ( GT_16( element_mode, IVAS_SCE ) ) { SWITCH ( bwidth ) { case IGF_MODE_WB: IF ( LE_32( brate, IVAS_13k2 ) && EQ_16( rf_mode, 1 ) ) { bitRateIndex = IGF_BITRATE_RF_WB_13200; move16(); } ELSE IF ( LE_32( brate, ACELP_9k60 ) ) { bitRateIndex = IGF_BITRATE_WB_13200_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_13k2 ) ) { bitRateIndex = IGF_BITRATE_WB_16400_CPE; move16(); } BREAK; case IGF_MODE_SWB: /* DFT and TD Stereo bitrates */ IF ( LE_32( brate, ACELP_9k60 ) ) { bitRateIndex = IGF_BITRATE_SWB_13200_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_13k2 ) ) { IF ( EQ_16( rf_mode, 1 ) ) { bitRateIndex = IGF_BITRATE_RF_SWB_13200; move16(); } ELSE { bitRateIndex = IGF_BITRATE_SWB_16400_CPE; move16(); } } ELSE IF ( LE_32( brate, IVAS_16k4 ) ) { bitRateIndex = IGF_BITRATE_SWB_24400_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_24k4 ) ) { bitRateIndex = IGF_BITRATE_SWB_32000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_32k ) ) { bitRateIndex = IGF_BITRATE_SWB_32000; move16(); } /* MDCT Stereo bitrates */ ELSE IF ( LE_32( brate, IVAS_48k ) ) { bitRateIndex = IGF_BITRATE_SWB_48000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_64k ) ) { bitRateIndex = IGF_BITRATE_SWB_64000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_80k ) ) { bitRateIndex = IGF_BITRATE_SWB_80000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_96k ) ) { bitRateIndex = IGF_BITRATE_SWB_96000_CPE; move16(); } BREAK; case IGF_MODE_FB: /* DFT and TD Stereo bitrates */ IF ( LE_32( brate, IVAS_16k4 ) ) { bitRateIndex = IGF_BITRATE_FB_24400_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_24k4 ) ) { bitRateIndex = IGF_BITRATE_FB_32000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_32k ) ) { bitRateIndex = IGF_BITRATE_FB_32000; move16(); } /* MDCT Stereo bitrates */ ELSE IF ( LE_32( brate, IVAS_48k ) ) { bitRateIndex = IGF_BITRATE_FB_48000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_64k ) ) { bitRateIndex = IGF_BITRATE_FB_64000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_80k ) ) { bitRateIndex = IGF_BITRATE_FB_80000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_96k ) ) { bitRateIndex = IGF_BITRATE_FB_96000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_128k ) ) { bitRateIndex = IGF_BITRATE_FB_128000_CPE; move16(); } BREAK; } } /* SCE modes: use tunings done for DFT stereo bitrates also for according SCE bitrates, otherwise same config as mono modes */ ELSE IF ( EQ_16( element_mode, IVAS_SCE ) ) { SWITCH ( bwidth ) { case IGF_MODE_WB: IF ( LE_32( brate, IVAS_13k2 ) && EQ_16( rf_mode, 1 ) ) { bitRateIndex = IGF_BITRATE_RF_WB_13200; move16(); } ELSE IF ( LE_32( brate, ACELP_9k60 ) ) /* bitrates 8000 and 9600 */ { bitRateIndex = IGF_BITRATE_WB_9600; move16(); } BREAK; case IGF_MODE_SWB: IF ( LE_32( brate, ACELP_9k60 ) ) { bitRateIndex = IGF_BITRATE_SWB_13200_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_13k2 ) ) { IF ( EQ_16( rf_mode, 1 ) ) { bitRateIndex = IGF_BITRATE_RF_SWB_13200; move16(); } ELSE { bitRateIndex = IGF_BITRATE_SWB_16400_CPE; move16(); } } ELSE IF ( LE_32( brate, IVAS_16k4 ) ) { bitRateIndex = IGF_BITRATE_SWB_24400_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_24k4 ) ) { bitRateIndex = IGF_BITRATE_SWB_32000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_32k ) ) { bitRateIndex = IGF_BITRATE_SWB_32000; move16(); } ELSE IF ( LE_32( brate, IVAS_48k ) ) { bitRateIndex = IGF_BITRATE_SWB_48000; move16(); } ELSE IF ( LE_32( brate, IVAS_64k ) ) { bitRateIndex = IGF_BITRATE_SWB_64000; move16(); } BREAK; case IGF_MODE_FB: IF ( LE_32( brate, IVAS_16k4 ) ) { bitRateIndex = IGF_BITRATE_FB_24400_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_24k4 ) ) { bitRateIndex = IGF_BITRATE_FB_32000_CPE; move16(); } ELSE IF ( LE_32( brate, IVAS_32k ) ) { bitRateIndex = IGF_BITRATE_FB_32000; move16(); } ELSE IF ( LE_32( brate, IVAS_48k ) ) { bitRateIndex = IGF_BITRATE_FB_48000; move16(); } ELSE IF ( LE_32( brate, IVAS_64k ) ) { bitRateIndex = IGF_BITRATE_FB_64000; } ELSE IF ( LE_32( brate, IVAS_96k ) ) { bitRateIndex = IGF_BITRATE_FB_96000; move16(); } ELSE IF ( LE_32( brate, IVAS_128k ) ) { bitRateIndex = IGF_BITRATE_FB_128000; move16(); } BREAK; } } /* EVS mono */ ELSE { SWITCH ( bwidth ) { case IGF_MODE_WB: IF ( LE_32( brate, ACELP_13k20 ) && EQ_16( rf_mode, 1 ) ) { bitRateIndex = IGF_BITRATE_RF_WB_13200; move16(); } ELSE IF ( LE_32( brate, ACELP_9k60 ) ) /* bitrates 8000 and 9600 */ { bitRateIndex = IGF_BITRATE_WB_9600; move16(); } BREAK; case IGF_MODE_SWB: IF ( LE_32( brate, ACELP_9k60 ) ) { bitRateIndex = IGF_BITRATE_SWB_9600; move16(); } ELSE IF ( LE_32( brate, ACELP_13k20 ) ) { IF ( EQ_16( rf_mode, 1 ) ) { bitRateIndex = IGF_BITRATE_RF_SWB_13200; move16(); } ELSE { bitRateIndex = IGF_BITRATE_SWB_13200; move16(); } } ELSE IF ( LE_32( brate, ACELP_16k40 ) ) { bitRateIndex = IGF_BITRATE_SWB_16400; move16(); } ELSE IF ( LE_32( brate, ACELP_24k40 ) ) { bitRateIndex = IGF_BITRATE_SWB_24400; move16(); } ELSE IF ( LE_32( brate, ACELP_32k ) ) { bitRateIndex = IGF_BITRATE_SWB_32000; move16(); } ELSE IF ( LE_32( brate, ACELP_48k ) ) { bitRateIndex = IGF_BITRATE_SWB_48000; move16(); } ELSE IF ( LE_32( brate, ACELP_64k ) ) { bitRateIndex = IGF_BITRATE_SWB_64000; move16(); } BREAK; case IGF_MODE_FB: IF ( LE_32( brate, ACELP_16k40 ) ) { bitRateIndex = IGF_BITRATE_FB_16400; move16(); } ELSE IF ( LE_32( brate, ACELP_24k40 ) ) { bitRateIndex = IGF_BITRATE_FB_24400; move16(); } ELSE IF ( LE_32( brate, ACELP_32k ) ) { bitRateIndex = IGF_BITRATE_FB_32000; move16(); } ELSE IF ( LE_32( brate, ACELP_48k ) ) { bitRateIndex = IGF_BITRATE_FB_48000; move16(); } ELSE IF ( LE_32( brate, ACELP_64k ) ) { bitRateIndex = IGF_BITRATE_FB_64000; move16(); } ELSE IF ( LE_32( brate, HQ_96k ) ) { bitRateIndex = IGF_BITRATE_FB_96000; move16(); } ELSE IF ( LE_32( brate, HQ_128k ) ) { bitRateIndex = IGF_BITRATE_FB_128000; move16(); } BREAK; } } return bitRateIndex; } #endif /*---------------------------------------------------------------------* * IGF_gridSetUp_flt() * Loading
lib_com/igf_base_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ /**********************************************************************/ /* returns an int val, multiplied with transFac **************************************************************************/ static Word16 IGF_ApplyTransFac( /**< out: Q0 | multiplication factor */ Word16 IGF_ApplyTransFac( /**< out: Q0 | multiplication factor */ const Word16 val, /**< in: Q15 | input value for multiplication, Q15 */ const Word16 transFac /**< in: Q14 | multiplicator for variable val, Q14: 1.25f=0x5000, 1.0f=0x4000, 0.5f=0x2000 */ ) Loading @@ -39,7 +39,7 @@ static Word16 IGF_ApplyTransFac( /**********************************************************************/ /* maps a given bitrate to the IGF_BITRATE index **************************************************************************/ static Word16 IGF_MapBitRateToIndex( Word16 IGF_MapBitRateToIndex( const Word32 brate, /* i : bitrate */ const Word16 bwidth, /* i : audio bandwidth */ const Word16 element_mode, /* i : element mode */ Loading
lib_com/ivas_stereo_mdct_bands_com.c +186 −0 Original line number Diff line number Diff line Loading @@ -39,7 +39,11 @@ #include "rom_com.h" #include "prot.h" #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED #include "prot_fx1.h" #include "prot_fx2.h" #include "ivas_prot_fx.h" #endif /*-------------------------------------------------------------------* * Local union Loading @@ -62,6 +66,157 @@ typedef union * initialize stereo band tables for MDCT stereo *-------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED void stereo_mdct_init_bands_fx( const Word16 L_frame, /* i : frame length */ const Word16 tmp_tcx_mode, /* i : tcx mode (TCX10, TCX 20), -1 if transition frame */ const Word32 element_brate, /* i : element bitrate */ const Word16 igf, /* i : flag indicating if IGF is used */ const H_IGF_GRID hIgfGrid, /* i : IGF grid setup */ Word16 *sfbOffset, /* o : sfb offset table */ Word16 *sfbCnt /* o : number of sfbs */ ) { SBPARAMS sfbParam; Word16 i, cnt, specStartOffset, L_frameTCX, tcx_mode; const UWord8 *sfbWidths; IF( tmp_tcx_mode > 0 ) { tcx_mode = tmp_tcx_mode; L_frameTCX = ( tcx_mode == TCX_20_CORE ) ? L_frame : ( L_frame / 2 ); } ELSE { /*transition frame*/ L_frameTCX = L_frame + L_frame / 4; tcx_mode = TCX_20_CORE; } /* select table */ IF( L_frame == L_FRAME48k ) { sfbParam.steBands = mdctStereoBands_32000_640; cnt = ( tcx_mode == TCX_20_CORE ? sfbParam.steBands->bdnCnt_TCX20[0] : sfbParam.steBands->bndCnt_TCX10[0] ); sfbWidths = ( tcx_mode == TCX_20_CORE ? sfbParam.steBands->bandLengthsTCX20 : sfbParam.steBands->bandLengthsTCX10 ); } ELSE { IF( element_brate < IVAS_96k ) { sfbParam.steBands = mdctStereoBands_32000_640; SWITCH( L_frame ) { case L_FRAME32k: cnt = ( tcx_mode == TCX_20_CORE ? sfbParam.steBands->bdnCnt_TCX20[1] : sfbParam.steBands->bndCnt_TCX10[1] ); BREAK; case L_FRAME25_6k: cnt = ( tcx_mode == TCX_20_CORE ? sfbParam.steBands->bdnCnt_TCX20[2] : sfbParam.steBands->bndCnt_TCX10[2] ); BREAK; case L_FRAME16k: cnt = ( tcx_mode == TCX_20_CORE ? sfbParam.steBands->bdnCnt_TCX20[3] : sfbParam.steBands->bndCnt_TCX10[3] ); BREAK; default: assert( !"Subband division not defined for this frame size" ); return; } sfbWidths = ( tcx_mode == TCX_20_CORE ? sfbParam.steBands->bandLengthsTCX20 : sfbParam.steBands->bandLengthsTCX10 ); } ELSE { SWITCH( L_frame ) { case L_FRAME48k: case L_FRAME32k: sfbParam.lpcBndsParam = sw32000Hz; BREAK; case L_FRAME25_6k: sfbParam.lpcBndsParam = sw25600Hz; BREAK; case L_FRAME16k: sfbParam.lpcBndsParam = sw16000Hz; BREAK; default: assert( !"Subband division not defined for this frame size" ); return; } sfbWidths = ( tcx_mode == TCX_20_CORE ? sfbParam.lpcBndsParam->bandLengthsTCX20 : sfbParam.lpcBndsParam->bandLengthsTCX10 ); cnt = 64; } } /* calc sfb offsets */ specStartOffset = 0; FOR( i = 0; i < cnt; i++ ) { sfbOffset[i] = min( specStartOffset, L_frameTCX ); specStartOffset += sfbWidths[i]; IF( sfbOffset[i] >= L_frameTCX ) { BREAK; } } *sfbCnt = i; sfbOffset[*sfbCnt] = min( specStartOffset, L_frameTCX ); IF( igf ) { Word16 sfbOldCnt = *sfbCnt; Word16 igfSfbStep = hIgfGrid->infoIsRefined ? 2 : 1; Word16 k; /* modify sfb bands according to igf grid */ assert( hIgfGrid != NULL ); /* find sfb where IGF starts */ FOR( i = 0; i <= *sfbCnt; i++ ) { IF( sfbOffset[i] >= hIgfGrid->startLine ) { /* set band border to igf start line */ sfbOffset[i] = hIgfGrid->startLine; *sfbCnt = i; BREAK; } } /* change bands above the igf start line to match igf bands */ for( i = 1, k = igfSfbStep; i < hIgfGrid->swb_offset_len; i++, k += igfSfbStep ) { sfbOffset[*sfbCnt + i] = hIgfGrid->swb_offset[k]; } *sfbCnt += ( hIgfGrid->swb_offset_len - 1 ); /* better save than sorry, overwrite anything that is left above */ FOR( i = *sfbCnt + 1; i < sfbOldCnt + 1; i++ ) { sfbOffset[i] = 0; } } ELSE { IF( sfbOffset[*sfbCnt] < L_frameTCX ) { Word16 nMissingBins = L_frameTCX - sfbOffset[*sfbCnt]; IF( sfbWidths[i] / 2 < nMissingBins ) { ( *sfbCnt )++; } sfbOffset[*sfbCnt] = L_frameTCX; } } return; } #endif void stereo_mdct_init_bands( const int16_t L_frame, /* i : frame length */ const int16_t tmp_tcx_mode, /* i : tcx mode (TCX10, TCX 20), -1 if transition frame */ Loading Loading @@ -217,6 +372,37 @@ void stereo_mdct_init_bands( * initialize start band of the IGF in MDCT stereo *-------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED void stereo_mdct_init_igf_start_band_fx( STEREO_MDCT_BAND_PARAMETERS *stbParams, /* i/o: stereo frequency band parameters */ const Word16 transFac, /* i : transform factor */ const Word16 bwidth, /* i : audio bandwidth */ const Word32 element_brate /* i : element bitrate */ ) { Word16 i, bitRateIndex, igfStartLine; const Word16 *swb_offset; bitRateIndex = IGF_MapBitRateToIndex( element_brate, bwidth, IVAS_CPE_MDCT, 0 ); swb_offset = &swb_offset_LB_new[bitRateIndex][1]; igfStartLine = IGF_ApplyTransFac( swb_offset[0], transFac ); FOR( i = 0; i < stbParams->sfbCnt; i++ ) { IF( igfStartLine == stbParams->sfbOffset[i] ) { stbParams->sfbIgfStart = i; BREAK; } } stbParams->nBandsStereoCore = stbParams->sfbIgfStart; return; } #endif void stereo_mdct_init_igf_start_band( STEREO_MDCT_BAND_PARAMETERS *stbParams, /* i/o: stereo frequency band parameters */ const float transFac, /* i : transform factor */ Loading