diff --git a/apps/renderer.c b/apps/renderer.c index 70e68c757d73716e18d248822b1f7dfc1b1f39d7..0e499863c948bc363a4c976c1ef5eff763a90252 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1646,8 +1646,12 @@ int main( ObjectPositionBuffer mtdBuffer; outBuffer.pq_fact = &outBuffer.q_factor; +#ifdef FIX_2257_INCR_GUARD_BITS + Word16 gd_bits = find_guard_bits( frameSize_smpls ); +#else Word16 subframe_len = (Word16) ( args.sampleRate / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ); Word16 gd_bits = find_guard_bits( subframe_len ); +#endif Word16 prev_q_fact = Q11; while ( 1 ) { diff --git a/lib_com/fft_cldfb_fx.c b/lib_com/fft_cldfb_fx.c index 230dd7ac59f6cff002e6b472a4aab281f04083f8..948854d36daa729a206cce3a49c751099d2fa712 100644 --- a/lib_com/fft_cldfb_fx.c +++ b/lib_com/fft_cldfb_fx.c @@ -19,7 +19,7 @@ contributions. This software is provided "AS IS", without any express or implied warranties. The software is in the - development stage. It is intended exclusively for experts who have experience with such software and + development stage. It is int exclusively for experts who have experience with such software and solely for the purpose of inspection. All implied warranties of non-infringement, merchantability and fitness for a particular purpose are hereby disclaimed and excluded. @@ -257,6 +257,17 @@ static void fft10_with_cmplx_data( cmplx *inp_data /*Qx*/ ) cmplx x0, x1, x2, x3, x4, t; cmplx y[10]; +#ifdef FIX_ISSUE_2257_ADD_HEADROOM_IN_FFT10 + Word16 headroom = L_norm_arr( (Word32 *) inp_data, 2 * 10 ); + Word16 headroom_fix = ( headroom < 5 /* SCALEFACTOR10 */ ) ? ( 5 /* SCALEFACTOR10 */ - headroom ) : 0; + if ( headroom_fix != 0 ) + { + for ( Word16 i = 0; i < 10; i++ ) + { + inp_data[i] = CL_shr( inp_data[i], headroom_fix ); + } + } +#endif /* FOR i=0 */ { x0 = CL_shr( inp_data[0], SCALEFACTOR10 ); @@ -343,6 +354,17 @@ static void fft10_with_cmplx_data( cmplx *inp_data /*Qx*/ ) #ifdef WMOPS multiCounter[currCounter].CL_move += 10; #endif + +#ifdef FIX_ISSUE_2257_ADD_HEADROOM_IN_FFT10 + if ( headroom_fix != 0 ) + { + for ( Word16 i = 0; i < 10; i++ ) + { + /* We want to get assertion in case of overflow, no saturation */ + inp_data[i] = CL_shl( inp_data[i], headroom_fix ); + } + } +#endif } /** diff --git a/lib_com/options.h b/lib_com/options.h index a244037882e84546ecae3ae50084b5843083e95f..1f6f4cdcdde91d5709eee5e2ba223f91ca14ab77 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -131,6 +131,9 @@ #define FIX_2252_LP_CNG_STARTS_SID /* VA: issues 2251 and 2252: fix LP CNG uninitialized value in bitstream that starts with an SID */ #define FIX_1381_BWD /* VA: issue 1381: apply no hysteresis in BWD at higher bitrates also in mono MASA and OMASA */ #define FIX_2285_CODE_DECODER_INIT_BW /* VA: basop issue 2285: fix core-decoder initialization bandwidth */ +#define FIX_2257_INCR_GUARD_BITS /* FhG: take correct rendering frame-size into account for guard-bits calculation */ +#define FIX_ISSUE_2257_INCREASE_GUARD_BITS /* FhG: (tri) adds +1 to result of find_guard_bits of len=320: 9 -> 10 */ +#define FIX_ISSUE_2257_ADD_HEADROOM_IN_FFT10 /* FhG: (tri) optional scale-down at entry and scale-up at end of FFT10, if headroom too small */ #define FIX_2306_MISSING_UPDATE_LOWRATE_PITCH_GAIN /* Dolby: Fix missing update of low-rate pitch gain in the S/M classifier */ #define FIX_2297_SBA_SCALING_32KHZ /* VA: basop issue 2297: Fix scaling factor before the SBA decoder for output_Fs = 32 or 16 */ diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c old mode 100644 new mode 100755 index eaed6ebf5dc4edbc6380504fb6c90b5517bc20a1..c3dc51fa96da8e4dea77e8d44ff7297d84141f46 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -7234,7 +7234,12 @@ static void renderIsmToMasa( q_min = s_min( q_min, L_norm_arr( tmpRendBuffer_fx[i], ismInput->base.inputBuffer.config.numSamplesPerChannel ) ); } +#ifdef FIX_ISSUE_2257_INCREASE_GUARD_BITS + guard_bits = add( 1, find_guarded_bits_fx( ismInput->base.inputBuffer.config.numSamplesPerChannel ) ); +#else guard_bits = find_guarded_bits_fx( ismInput->base.inputBuffer.config.numSamplesPerChannel ); +#endif + q_min = sub( add( q_min, *outAudio.pq_fact ), guard_bits ); q_diff = sub( q_min, *outAudio.pq_fact );