From e98785130fc013e6c08d756f33179421c87467c4 Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Tue, 17 Sep 2024 01:25:07 +0300 Subject: [PATCH 1/4] fix 853 floating point --- lib_com/options.h | 2 +- lib_dec/ivas_masa_dec.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 48d958675..965e18172 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -166,7 +166,7 @@ #define FIX_835_PARAMMC_BUFFER_VALUES /* FhG: issue 835: wide range of buffer values for cx in ParamMC */ #define NONBE_FIX_943_PORT_1208_DFT_STEREO_PLC_BURST /* Ericsson: BASOP Issue 943, Float Issue 1208, fix for overflow of sample offset counter for burst error in DFT Stereo PLC. */ #define FIX_903_ZERO_OUT_IMDCT_BUFFERS_FOR_MCT_IGNORE /* FhG: zero out all relevant imdct buffers in MCT decoding of channels with mct_chan_mode == MCT_CHAN_MODE_IGNORE */ - +#define FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC_FP /* Nokia: Fixes ivas_decode_masaism_metadata decision logic change due to precision difference; this is the fix in floating point */ /* #################### End FIXES switches ############################ */ #define BASOP_NOGLOB /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */ diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index d9369f317..3404b79e2 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -2347,6 +2347,9 @@ static int16_t ivas_decode_masaism_metadata( if ( azimuth * hMasaIsmData->q_azimuth_old[obj] > 0 ) { delta_phi = 180.0f / (float) ( no_phi_masa[bits_ism[obj] - 1][idx_el] ); /* 360/2*/ +#ifdef FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC_FP + delta_phi = floorf( delta_phi ); +#endif if ( azimuth - hMasaIsmData->q_azimuth_old[obj] > delta_phi ) { azimuth -= delta_phi; @@ -2359,7 +2362,7 @@ static int16_t ivas_decode_masaism_metadata( } } } - + hMasaIsmData->q_azimuth_old[obj] = azimuth; hMasaIsmData->q_elevation_old[obj] = elevation; } -- GitLab From 0eb244e62ee2c1bd2ca729cfbcd9e049e03dd483 Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Sat, 28 Sep 2024 16:52:09 +0300 Subject: [PATCH 2/4] fix 853 float --- lib_dec/ivas_masa_dec.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 3404b79e2..fa2c6a5c9 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -2299,7 +2299,12 @@ static int16_t ivas_decode_masaism_metadata( int16_t nb_bits_read; float delta_phi; int16_t meta_write_index; + #if 1 + static FILE *pF = NULL; + if ( pF == NULL ) + pF = fopen( "./direction.txt", "w" ); + #endif nb_bits_read = *next_bit_pos; nbands = hQMetaData->q_direction->cfg.nbands; nblocks = hQMetaData->q_direction->cfg.nblocks; @@ -2347,18 +2352,37 @@ static int16_t ivas_decode_masaism_metadata( if ( azimuth * hMasaIsmData->q_azimuth_old[obj] > 0 ) { delta_phi = 180.0f / (float) ( no_phi_masa[bits_ism[obj] - 1][idx_el] ); /* 360/2*/ +#if 0 #ifdef FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC_FP delta_phi = floorf( delta_phi ); #endif +#endif +#if 1 + fprintf( pF, "azimuth = %4.2f delta_phi = %4.2f obj = %d \n", azimuth, delta_phi, obj ); +#endif +#ifdef FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC_FP + if ( roundf(100*( no_phi_masa[bits_ism[obj] - 1][idx_el] )*( azimuth - hMasaIsmData->q_azimuth_old[obj]))/(float)100.0f > 180.0f ) +#else if ( azimuth - hMasaIsmData->q_azimuth_old[obj] > delta_phi ) +#endif { azimuth -= delta_phi; + #if 1 + fprintf( pF, "azimuth = %3.1f obj = %d 1 \n", azimuth, obj ); + #endif } else { +#ifdef FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC_FP + if ( roundf( 100 * ( no_phi_masa[bits_ism[obj] - 1][idx_el] ) * ( hMasaIsmData->q_azimuth_old[obj] - azimuth ) ) / 100.0f > 180.0f ) +#else if ( hMasaIsmData->q_azimuth_old[obj] - azimuth > delta_phi ) +#endif { azimuth += delta_phi; +#if 1 + fprintf( pF, "azimuth = %3.1f obj = %d -1 \n", azimuth, obj ); +#endif } } } -- GitLab From f5279674addd50febf963f9a9430a66b3ede4703 Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Sat, 28 Sep 2024 17:57:49 +0300 Subject: [PATCH 3/4] fix 853 floating point --- lib_dec/ivas_masa_dec.c | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index fa2c6a5c9..750289f71 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1233,7 +1233,7 @@ static int16_t decode_lfe_to_total_energy_ratio( ivas_error ivas_masa_dec_reconfigure( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ ) { int16_t n, tmp, num_bits; @@ -1250,12 +1250,12 @@ ivas_error ivas_masa_dec_reconfigure( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate; - if ( st_ivas->hSpatParamRendCom != NULL && st_ivas->hSpatParamRendCom->slot_size == st_ivas->hTcBuffer->n_samples_granularity ) - { - mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); - st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; - st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; - } + if ( st_ivas->hSpatParamRendCom != NULL && st_ivas->hSpatParamRendCom->slot_size == st_ivas->hTcBuffer->n_samples_granularity ) + { + mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; + } ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); @@ -1350,7 +1350,7 @@ ivas_error ivas_masa_dec_reconfigure( if ( st_ivas->hDiracDecBin != NULL ) { - /* regularization factor is bitrate-dependent */ + /* regularization factor is bitrate-dependent */ st_ivas->hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); } @@ -2299,12 +2299,12 @@ static int16_t ivas_decode_masaism_metadata( int16_t nb_bits_read; float delta_phi; int16_t meta_write_index; - #if 1 +#if 1 static FILE *pF = NULL; if ( pF == NULL ) pF = fopen( "./direction.txt", "w" ); - #endif +#endif nb_bits_read = *next_bit_pos; nbands = hQMetaData->q_direction->cfg.nbands; nblocks = hQMetaData->q_direction->cfg.nblocks; @@ -2352,24 +2352,13 @@ static int16_t ivas_decode_masaism_metadata( if ( azimuth * hMasaIsmData->q_azimuth_old[obj] > 0 ) { delta_phi = 180.0f / (float) ( no_phi_masa[bits_ism[obj] - 1][idx_el] ); /* 360/2*/ -#if 0 #ifdef FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC_FP - delta_phi = floorf( delta_phi ); -#endif -#endif -#if 1 - fprintf( pF, "azimuth = %4.2f delta_phi = %4.2f obj = %d \n", azimuth, delta_phi, obj ); -#endif -#ifdef FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC_FP - if ( roundf(100*( no_phi_masa[bits_ism[obj] - 1][idx_el] )*( azimuth - hMasaIsmData->q_azimuth_old[obj]))/(float)100.0f > 180.0f ) + if ( roundf( 100 * ( no_phi_masa[bits_ism[obj] - 1][idx_el] ) * ( azimuth - hMasaIsmData->q_azimuth_old[obj] ) ) / (float) 100.0f > 180.0f ) #else if ( azimuth - hMasaIsmData->q_azimuth_old[obj] > delta_phi ) #endif { azimuth -= delta_phi; - #if 1 - fprintf( pF, "azimuth = %3.1f obj = %d 1 \n", azimuth, obj ); - #endif } else { @@ -2380,13 +2369,10 @@ static int16_t ivas_decode_masaism_metadata( #endif { azimuth += delta_phi; -#if 1 - fprintf( pF, "azimuth = %3.1f obj = %d -1 \n", azimuth, obj ); -#endif } } } - + hMasaIsmData->q_azimuth_old[obj] = azimuth; hMasaIsmData->q_elevation_old[obj] = elevation; } -- GitLab From 24842ec95dca279a4e3c509e58a5a31b903810d6 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 22 Oct 2024 09:53:54 +0530 Subject: [PATCH 4/4] Remove debug code --- lib_dec/ivas_masa_dec.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 750289f71..f6b98a37f 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -2299,12 +2299,7 @@ static int16_t ivas_decode_masaism_metadata( int16_t nb_bits_read; float delta_phi; int16_t meta_write_index; -#if 1 - static FILE *pF = NULL; - if ( pF == NULL ) - pF = fopen( "./direction.txt", "w" ); -#endif nb_bits_read = *next_bit_pos; nbands = hQMetaData->q_direction->cfg.nbands; nblocks = hQMetaData->q_direction->cfg.nblocks; -- GitLab