diff --git a/lib_com/options.h b/lib_com/options.h index ec4b88b340442969d09175465634f45932a8de6d..5839464c5fd17af740cf5f23c8db54edd3dd3dbd 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -212,6 +212,8 @@ #ifdef HR_METADATA #define FIX_505_MASA_SPHGRID_REUSE /* Nokia: Fix issue #505: MASA spherical grid reuse fix */ #endif + +#define FIX_506 /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/LD_music_post_filter.c b/lib_dec/LD_music_post_filter.c index 87984e873a15af6bc744f1e32f4b3af1e409a8ea..0b8bed426c3f836efea94835ecb4190c8402f6bd 100644 --- a/lib_dec/LD_music_post_filter.c +++ b/lib_dec/LD_music_post_filter.c @@ -387,7 +387,10 @@ static void spectrum_mod_dct( float slope; float inv_noise[MBANDS_GN_LD]; float *pt_gbin, alpha, tmpN; - int16_t i, cnt; + int16_t i; +#ifndef FIX_506 + int16_t cnt; +#endif float *pt; float tmp, shift; const float *pt2; @@ -475,7 +478,9 @@ static void spectrum_mod_dct( tmpN = slope * inv_noise[i]; tmp = 0.0f; +#ifndef FIX_506 cnt = 0; +#endif while ( freq <= mfreq_loc_LD[i] ) { gain = 1.0f; @@ -502,7 +507,9 @@ static void spectrum_mod_dct( *pt_gbin = gain + alpha * *pt_gbin; *pt++ *= *pt_gbin; +#ifndef FIX_506 cnt++; +#endif freq += BIN_16kdct; pt_gbin++; } diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 67aefe90386249495c0756cf1e5d7d2a0731d1f5..7fbca350d06fcf759a2a44c3f7367ca92e78220b 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -805,11 +805,15 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( ) { int16_t d, b, m; +#ifndef FIX_506 int16_t bits_diff_sum; +#endif int16_t nbands, start_band; IVAS_QDIRECTION *q_direction; int16_t start_index_0; +#ifndef FIX_506 int16_t bits_no_dirs_coh, bits_sur_coherence; +#endif uint16_t all_coherence_zero; int16_t p[MASA_MAXIMUM_CODING_SUBBANDS], dif_p[MASA_MAXIMUM_CODING_SUBBANDS]; #ifdef FIX_HBR_MASAMETA @@ -892,13 +896,17 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( #endif /*Coherence flag decoding*/ +#ifndef FIX_506 bits_no_dirs_coh = 0; +#endif all_coherence_zero = 1; if ( hQMetaData->coherence_flag ) { /* read if coherence is zero */ all_coherence_zero = bitstream[( *index )--]; +#ifndef FIX_506 bits_no_dirs_coh += 1; +#endif } hQMetaData->all_coherence_zero = (uint8_t) all_coherence_zero; @@ -934,7 +942,9 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( p[b] = p[b - 1] + dif_p[b] + 1; hQMetaData->twoDirBands[p[b]] = 1; } +#ifndef FIX_506 bits_no_dirs_coh += ( d - *index ); +#endif } #ifdef FIX_HBR_MASAMETA @@ -947,11 +957,17 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( } } #endif - bits_diff_sum = ivas_qmetadata_entropy_decode_diffuseness_hr_512( bitstream, index, &( hQMetaData->q_direction[0] ) ); +#ifndef FIX_506 + bits_diff_sum = +#endif + ivas_qmetadata_entropy_decode_diffuseness_hr_512( bitstream, index, &( hQMetaData->q_direction[0] ) ); if ( hQMetaData->no_directions == 2 ) { - bits_diff_sum += ivas_qmetadata_entropy_decode_diffuseness_hr_512( bitstream, index, &( hQMetaData->q_direction[1] ) ); +#ifndef FIX_506 + bits_diff_sum += +#endif + ivas_qmetadata_entropy_decode_diffuseness_hr_512( bitstream, index, &( hQMetaData->q_direction[1] ) ); } @@ -1000,11 +1016,16 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( if ( all_coherence_zero == 0 ) { - bits_sur_coherence = read_surround_coherence_hr( bitstream, index, hQMetaData ); +#ifndef FIX_506 + bits_sur_coherence = +#endif + read_surround_coherence_hr( bitstream, index, hQMetaData ); } else { +#ifndef FIX_506 bits_sur_coherence = 0; +#endif /*Surround coherence*/ for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) { @@ -1014,7 +1035,9 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( } } } +#ifndef FIX_506 bits_no_dirs_coh += bits_sur_coherence; +#endif for ( d = 0; d < hQMetaData->no_directions; d++ ) { diff --git a/lib_dec/swb_bwe_dec_lr.c b/lib_dec/swb_bwe_dec_lr.c index 4f29becf248e298f1aa223816d64366b30f82a88..222316151d395d6fed0bad0565ee6b2897f266a7 100644 --- a/lib_dec/swb_bwe_dec_lr.c +++ b/lib_dec/swb_bwe_dec_lr.c @@ -130,7 +130,10 @@ static void DecodeSWBSubbands( float ss_min = 1.0f, g, be_tonal[SWB_HAR_RAN1], xSynth_har[L_FRAME32k]; GainItem pk_sf[(NB_SWB_SUBBANDS) *8]; int16_t lagIndices_real[NB_SWB_SUBBANDS]; - int16_t pul_res[NB_SWB_SUBBANDS], cnt, imin; +#ifndef FIX_506 + int16_t cnt; +#endif + int16_t pul_res[NB_SWB_SUBBANDS], imin; int16_t har_freq_est1 = 0; int16_t har_freq_est2 = 0; int16_t flag_dis = 1; @@ -202,14 +205,18 @@ static void DecodeSWBSubbands( { lagGains[k] *= 0.9f; } +#ifndef FIX_506 cnt = 0; +#endif for ( k = 0; k < NB_SWB_SUBBANDS; k++ ) { th_g[k] = 0.0f; if ( p2a_flags[BANDS - NB_SWB_SUBBANDS + k] == 0 ) { th_g[k] = lagGains[k] * ss_min; +#ifndef FIX_506 cnt++; +#endif } } /* Construct spectrum */ diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 3bbf084a7edcb03b488ea466a81f44a9dcbae1d6..fc489158839755c95ee2fa72e887eaf91ef5daff 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -759,7 +759,9 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( int16_t nbands, nblocks, start_band; int16_t ndirections, d; int16_t all_coherence_zero; +#ifndef FIX_506 int16_t bits_no_dirs_coh; +#endif int16_t bits_ec; float azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; ivas_error error; @@ -796,7 +798,9 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( /* Check if coherence should be encoded */ all_coherence_zero = 1; +#ifndef FIX_506 bits_no_dirs_coh = 0; +#endif #ifdef FIX_HBR_MASAMETA if ( hQMetaData->q_direction->cfg.inactiveBands > 0 ) { @@ -814,13 +818,18 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( { all_coherence_zero = hQMetaData->all_coherence_zero; push_next_indice( hMetaData, all_coherence_zero, 1 ); /* signal coherence */ +#ifndef FIX_506 bits_no_dirs_coh += 1; +#endif } /* encode 2 direction subbands position */ if ( ndirections == 2 && bits_sph_idx == 11 ) { - bits_no_dirs_coh += write_2dir_info( hMetaData, hQMetaData->twoDirBands, hQMetaData->q_direction[0].cfg.nbands, hQMetaData->numTwoDirBands ); +#ifndef FIX_506 + bits_no_dirs_coh += +#endif + write_2dir_info( hMetaData, hQMetaData->twoDirBands, hQMetaData->q_direction[0].cfg.nbands, hQMetaData->numTwoDirBands ); for ( i = hQMetaData->numTwoDirBands; i < hQMetaData->q_direction[0].cfg.nbands; i++ ) { diff --git a/lib_enc/swb_bwe_enc_lr.c b/lib_enc/swb_bwe_enc_lr.c index afa9e75ac792c6d74bc4b5e1b1ef7dcbdc0a91d6..dd5bf3b4ca65a06911b977547ec9a198b571a2a9 100644 --- a/lib_enc/swb_bwe_enc_lr.c +++ b/lib_enc/swb_bwe_enc_lr.c @@ -66,11 +66,15 @@ static int16_t GetSubbandCorrIndex2_har( int16_t bestIdx, i, j; float corr, energy, corr_sq; float lagCorr_sq, lagEnergy, eOld; +#ifndef FIX_506 int16_t absPos; +#endif int16_t N1, N2; +#ifndef FIX_506 absPos = 0; +#endif bestIdx = 0; lagCorr_sq = 0.0f; lagEnergy = 1e30f; @@ -130,7 +134,9 @@ static int16_t GetSubbandCorrIndex2_har( } predBuf++; +#ifndef FIX_506 absPos++; +#endif } if ( lagCorr_sq == 0.0f && *prev_frame_bstindx < 0 ) @@ -512,7 +518,10 @@ static void EncodeSWBSubbands( float sspectra_ni[L_FRAME32k], sspectra_diff[L_FRAME32k], be_tonal[SWB_HAR_RAN1], xSynth_har[L_FRAME32k]; float ss_min = 1.0f, th_g[NB_SWB_SUBBANDS]; GainItem pk_sf[(NB_SWB_SUBBANDS) *8]; - int16_t pul_res[NB_SWB_SUBBANDS], cnt; +#ifndef FIX_506 + int16_t cnt; +#endif + int16_t pul_res[NB_SWB_SUBBANDS]; int16_t har_freq_est1 = 0, har_freq_est2 = 0; int16_t flag_dis = 1; int16_t pos_max_hfe2 = 0; @@ -599,14 +608,18 @@ static void EncodeSWBSubbands( lagGains[k] *= 0.9f; } +#ifndef FIX_506 cnt = 0; +#endif for ( k = 0; k < NB_SWB_SUBBANDS; k++ ) { th_g[k] = 0.0f; if ( p2a_flags[BANDS - NB_SWB_SUBBANDS + k] == 0 ) { th_g[k] = lagGains[k] * ss_min; +#ifndef FIX_506 cnt++; +#endif } }