From 83876afacab0c4023164dfe04575cb8521e54ac5 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Thu, 25 May 2023 16:02:28 +0200 Subject: [PATCH 1/6] fix clang warnings in ivas_qmetadata_enc.c and ivas_qmetadata_dec.c under FIX_506 --- lib_com/options.h | 2 ++ lib_dec/ivas_qmetadata_dec.c | 29 ++++++++++++++++++++++++++--- lib_enc/ivas_qmetadata_enc.c | 11 ++++++++++- scripts/check-format.sh | 2 +- 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2d1ac97a23..9a2b746b21 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -213,6 +213,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/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 67aefe9038..7fbca350d0 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_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 3bbf084a7e..fc48915883 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/scripts/check-format.sh b/scripts/check-format.sh index 8ec2991cda..6c8891ac51 100755 --- a/scripts/check-format.sh +++ b/scripts/check-format.sh @@ -38,7 +38,7 @@ if [ ! -d "lib_com" ]; then exit 255 fi -CLANG_FORMAT=clang-format +CLANG_FORMAT=../clang-format.exe CLANG_FORMAT_REQUIRED_VERSION="13.0" # list (with space between entries) of substrings that are excluded from the file list, e.g. very large files -- GitLab From 828e10745e6b625acfbc8ee065f8151e4fa55da9 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Thu, 25 May 2023 16:26:15 +0200 Subject: [PATCH 2/6] fix path in formatting script --- scripts/check-format.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check-format.sh b/scripts/check-format.sh index 6c8891ac51..8ec2991cda 100755 --- a/scripts/check-format.sh +++ b/scripts/check-format.sh @@ -38,7 +38,7 @@ if [ ! -d "lib_com" ]; then exit 255 fi -CLANG_FORMAT=../clang-format.exe +CLANG_FORMAT=clang-format CLANG_FORMAT_REQUIRED_VERSION="13.0" # list (with space between entries) of substrings that are excluded from the file list, e.g. very large files -- GitLab From 74ff94d3985536f2cf04b3fcfb238757a82d6625 Mon Sep 17 00:00:00 2001 From: malenov Date: Mon, 29 May 2023 10:07:39 +0200 Subject: [PATCH 3/6] remove unsued variable in swb_bwe_enc_lr.c --- lib_enc/swb_bwe_enc_lr.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib_enc/swb_bwe_enc_lr.c b/lib_enc/swb_bwe_enc_lr.c index afa9e75ac7..dc39e42333 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 ) -- GitLab From 4fce4b096cc1a9559c785597ce93c62aef5e00d1 Mon Sep 17 00:00:00 2001 From: malenov Date: Mon, 29 May 2023 10:11:14 +0200 Subject: [PATCH 4/6] remove unused variable 'cnt' from swb_bwe_enc_lr --- lib_dec/swb_bwe_dec_lr.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib_dec/swb_bwe_dec_lr.c b/lib_dec/swb_bwe_dec_lr.c index 4f29becf24..222316151d 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 */ -- GitLab From 72bc96420a5b4d77a3e1452289c3d432004102f2 Mon Sep 17 00:00:00 2001 From: malenov Date: Mon, 29 May 2023 10:13:46 +0200 Subject: [PATCH 5/6] remove unused variable 'cnt' from swb_bwe_enc_lr.c --- lib_enc/swb_bwe_enc_lr.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib_enc/swb_bwe_enc_lr.c b/lib_enc/swb_bwe_enc_lr.c index dc39e42333..dd5bf3b4ca 100644 --- a/lib_enc/swb_bwe_enc_lr.c +++ b/lib_enc/swb_bwe_enc_lr.c @@ -518,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; @@ -605,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 } } -- GitLab From 8ca4f6ed5e359e3aa55e8dff1a97e47ac6abcc9b Mon Sep 17 00:00:00 2001 From: malenov Date: Mon, 29 May 2023 10:18:22 +0200 Subject: [PATCH 6/6] remove unused variable 'cnt' from LD_music_post_filter.c --- lib_dec/LD_music_post_filter.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib_dec/LD_music_post_filter.c b/lib_dec/LD_music_post_filter.c index 87984e873a..0b8bed426c 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++; } -- GitLab