diff --git a/lib_com/options.h b/lib_com/options.h index 33b25d459c924ccaf43ac7661a96d618f855988c..814a323d0f390959f3886f63cfdbad7cd0bf29cb 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -213,6 +213,9 @@ #ifdef HR_METADATA #define FIX_505_MASA_SPHGRID_REUSE /* Nokia: Fix issue #505: MASA spherical grid reuse fix */ #endif + +#define FIX_481_UNUSED_VARIABLES /* Nokia: Fix issue #481: Unused debug variables */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 67aefe90386249495c0756cf1e5d7d2a0731d1f5..cc7335c221aca81c5b8794a15dc22bd0adf6c8f2 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -805,11 +805,23 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( ) { int16_t d, b, m; +#ifdef FIX_481_UNUSED_VARIABLES +#ifdef DEBUG_MODE_QMETADATA + int16_t bits_diff_sum; +#endif +#else int16_t bits_diff_sum; +#endif int16_t nbands, start_band; IVAS_QDIRECTION *q_direction; int16_t start_index_0; +#ifdef FIX_481_UNUSED_VARIABLES +#ifdef DEBUG_MODE_QMETADATA int16_t bits_no_dirs_coh, bits_sur_coherence; +#endif +#else + 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 +904,25 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( #endif /*Coherence flag decoding*/ +#ifdef FIX_481_UNUSED_VARIABLES +#ifdef DEBUG_MODE_QMETADATA + bits_no_dirs_coh = 0; +#endif +#else bits_no_dirs_coh = 0; +#endif all_coherence_zero = 1; if ( hQMetaData->coherence_flag ) { /* read if coherence is zero */ all_coherence_zero = bitstream[( *index )--]; +#ifdef FIX_481_UNUSED_VARIABLES +#ifdef DEBUG_MODE_QMETADATA + bits_no_dirs_coh += 1; +#endif +#else bits_no_dirs_coh += 1; +#endif } hQMetaData->all_coherence_zero = (uint8_t) all_coherence_zero; @@ -934,7 +958,13 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( p[b] = p[b - 1] + dif_p[b] + 1; hQMetaData->twoDirBands[p[b]] = 1; } +#ifdef FIX_481_UNUSED_VARIABLES +#ifdef DEBUG_MODE_QMETADATA + bits_no_dirs_coh += ( d - *index ); +#endif +#else bits_no_dirs_coh += ( d - *index ); +#endif } #ifdef FIX_HBR_MASAMETA @@ -947,11 +977,25 @@ 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] ) ); +#ifdef FIX_481_UNUSED_VARIABLES +#ifdef DEBUG_MODE_QMETADATA + bits_diff_sum = +#endif +#else + 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] ) ); +#ifdef FIX_481_UNUSED_VARIABLES +#ifdef DEBUG_MODE_QMETADATA + bits_diff_sum += +#endif +#else + bits_diff_sum += +#endif + ivas_qmetadata_entropy_decode_diffuseness_hr_512( bitstream, index, &( hQMetaData->q_direction[1] ) ); } @@ -1000,11 +1044,24 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( if ( all_coherence_zero == 0 ) { - bits_sur_coherence = read_surround_coherence_hr( bitstream, index, hQMetaData ); +#ifdef FIX_481_UNUSED_VARIABLES +#ifdef DEBUG_MODE_QMETADATA + bits_sur_coherence = +#endif +#else + bits_sur_coherence = +#endif + read_surround_coherence_hr( bitstream, index, hQMetaData ); } else { +#ifdef FIX_481_UNUSED_VARIABLES +#ifdef DEBUG_MODE_QMETADATA + bits_sur_coherence = 0; +#endif +#else bits_sur_coherence = 0; +#endif /*Surround coherence*/ for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) { @@ -1014,7 +1071,13 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( } } } +#ifdef FIX_481_UNUSED_VARIABLES +#ifdef DEBUG_MODE_QMETADATA + bits_no_dirs_coh += bits_sur_coherence; +#endif +#else bits_no_dirs_coh += bits_sur_coherence; +#endif for ( d = 0; d < hQMetaData->no_directions; d++ ) { @@ -1048,7 +1111,6 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( ivas_qmetadata_raw_decode_dir_512( q_direction, bitstream, index, nbands, start_band, sph_grid16 ); #ifdef DEBUG_MODE_QMETADATA - fprintf( pF, "frame %d: diff %d surcoh %d ", frame, bits_diff_sum, bits_sur_coherence ); fprintf( pF, "dir %d\n", start_index_0 - *index ); fprintf( pF_azi, "frame %d/dir/ec %d: ", frame, d ); diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 3bbf084a7edcb03b488ea466a81f44a9dcbae1d6..17ddbe367687a19741dae585966e9f4a6b806251 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -759,7 +759,13 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( int16_t nbands, nblocks, start_band; int16_t ndirections, d; int16_t all_coherence_zero; +#ifdef FIX_481_UNUSED_VARIABLES +#ifdef DEBUG_MODE_QMETADATA int16_t bits_no_dirs_coh; +#endif +#else + 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 +802,13 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( /* Check if coherence should be encoded */ all_coherence_zero = 1; +#ifdef FIX_481_UNUSED_VARIABLES +#ifdef DEBUG_MODE_QMETADATA bits_no_dirs_coh = 0; +#endif +#else + bits_no_dirs_coh = 0; +#endif #ifdef FIX_HBR_MASAMETA if ( hQMetaData->q_direction->cfg.inactiveBands > 0 ) { @@ -814,13 +826,26 @@ 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 */ +#ifdef FIX_481_UNUSED_VARIABLES +#ifdef DEBUG_MODE_QMETADATA bits_no_dirs_coh += 1; +#endif +#else + 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 ); +#ifdef FIX_481_UNUSED_VARIABLES +#ifdef DEBUG_MODE_QMETADATA + bits_no_dirs_coh += +#endif +#else + 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++ ) {