From e7c844234cd0d5bd6aca5cf7979d52225d6bea23 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 30 Sep 2025 15:22:10 +0200 Subject: [PATCH 1/4] fix reading of ISM SID signaling --- lib_dec/ivas_init_dec_fx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index e69d6994e..d71293d1c 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -486,7 +486,13 @@ ivas_error ivas_dec_get_format_fx( /* read the number of objects */ nchan_ism = 1; move16(); +#ifdef FIX_HRTF_LOAD + k = sub( sub( k, 1 ), SID_FORMAT_NBITS ); + move16(); + WHILE( st_ivas->bit_stream[k] && ( nchan_ism < MAX_NUM_OBJECTS ) ) +#else WHILE( st_ivas->bit_stream[k - 1 - SID_FORMAT_NBITS] && nchan_ism < MAX_NUM_OBJECTS ) +#endif { nchan_ism = add( nchan_ism, 1 ); k = sub( k, 1 ); -- GitLab From 1edf97b8bb478d675f0496a2550ccf9452e12f39 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 30 Sep 2025 15:30:50 +0200 Subject: [PATCH 2/4] fix reading of ISM SID signaling --- lib_dec/ivas_init_dec_fx.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index d71293d1c..45f6e0a42 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -174,7 +174,12 @@ ivas_error ivas_dec_get_format_fx( /* read the number of objects */ nchan_ism = 1; move16(); +#ifdef FIX_HRTF_LOAD + k = sub( k, 1 ); + WHILE( st_ivas->bit_stream[k] && ( nchan_ism < MAX_NUM_OBJECTS ) ) +#else WHILE( st_ivas->bit_stream[k - 1] && nchan_ism < MAX_NUM_OBJECTS ) +#endif { nchan_ism = add( nchan_ism, 1 ); k = sub( k, 1 ); @@ -481,14 +486,13 @@ ivas_error ivas_dec_get_format_fx( BREAK; } - if ( st_ivas->ivas_format == ISM_FORMAT ) + IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) ) { /* read the number of objects */ nchan_ism = 1; move16(); #ifdef FIX_HRTF_LOAD k = sub( sub( k, 1 ), SID_FORMAT_NBITS ); - move16(); WHILE( st_ivas->bit_stream[k] && ( nchan_ism < MAX_NUM_OBJECTS ) ) #else WHILE( st_ivas->bit_stream[k - 1 - SID_FORMAT_NBITS] && nchan_ism < MAX_NUM_OBJECTS ) @@ -610,7 +614,6 @@ ivas_error ivas_dec_setup( move16(); k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); k = sub( k, 1 ); - WHILE( st_ivas->bit_stream[k] && ( nchan_ism < MAX_NUM_OBJECTS ) ) { nchan_ism = add( nchan_ism, 1 ); @@ -1009,8 +1012,6 @@ ivas_error ivas_dec_setup( move16(); k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); k = sub( sub( k, 1 ), SID_FORMAT_NBITS ); - move16(); - WHILE( st_ivas->bit_stream[k] && ( nchan_ism < MAX_NUM_OBJECTS ) ) { nchan_ism = add( nchan_ism, 1 ); -- GitLab From 6ff25aafd327126a7790f9af01f0708027032c3d Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 1 Oct 2025 16:27:44 +0200 Subject: [PATCH 3/4] k = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC ); --- lib_dec/ivas_init_dec_fx.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 45f6e0a42..544048143 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -152,8 +152,6 @@ ivas_error ivas_dec_get_format_fx( * Read other signaling (ISM/MC mode, number of channels, etc.) *-------------------------------------------------------------------*/ - k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); - IF( is_DTXrate( ivas_total_brate ) == 0 ) { /*-------------------------------------------------------------------* @@ -175,6 +173,7 @@ ivas_error ivas_dec_get_format_fx( nchan_ism = 1; move16(); #ifdef FIX_HRTF_LOAD + k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); k = sub( k, 1 ); WHILE( st_ivas->bit_stream[k] && ( nchan_ism < MAX_NUM_OBJECTS ) ) #else @@ -241,6 +240,7 @@ ivas_error ivas_dec_get_format_fx( ELSE IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) ) { /* read number of MASA transport channels */ + k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); IF( st_ivas->bit_stream[k - 1] ) { st_ivas->nchan_transport = 2; @@ -310,6 +310,7 @@ ivas_error ivas_dec_get_format_fx( move16(); /* the number of objects are written at the end of the bitstream */ + k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); nchan_ism = add( add( shl( st_ivas->bit_stream[k - 1], 1 ), st_ivas->bit_stream[k - 2] ), 1 ); st_ivas->ism_mode = ivas_omasa_ism_mode_select_fx( ivas_total_brate, nchan_ism ); @@ -328,6 +329,7 @@ ivas_error ivas_dec_get_format_fx( ELSE IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) { /* the number of objects is written at the end of the bitstream, in the SBA metadata */ + k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); nchan_ism = add( add( shl( st_ivas->bit_stream[k - 1], 1 ), st_ivas->bit_stream[k - 2] ), 1 ); test(); @@ -463,6 +465,7 @@ ivas_error ivas_dec_get_format_fx( move16(); BREAK; case SID_MASA_2TC: + k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); IF( st_ivas->bit_stream[k - 1 - SID_FORMAT_NBITS] == 1 ) { st_ivas->element_mode_init = IVAS_CPE_MDCT; @@ -492,6 +495,7 @@ ivas_error ivas_dec_get_format_fx( nchan_ism = 1; move16(); #ifdef FIX_HRTF_LOAD + k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); k = sub( sub( k, 1 ), SID_FORMAT_NBITS ); WHILE( st_ivas->bit_stream[k] && ( nchan_ism < MAX_NUM_OBJECTS ) ) #else @@ -930,7 +934,7 @@ ivas_error ivas_dec_setup( st_ivas->nchan_transport = 1; move16(); BREAK; - case SID_MASA_2TC:; // empyt statement for declaration + case SID_MASA_2TC: k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); IF( EQ_16( st_ivas->bit_stream[( k - 1 ) - SID_FORMAT_NBITS], 1 ) ) { -- GitLab From 9a8eb0ab5b9ad3e7d22f782db1398ad23ba36296 Mon Sep 17 00:00:00 2001 From: marc emerit Date: Wed, 1 Oct 2025 16:29:55 +0200 Subject: [PATCH 4/4] align with float code --- lib_dec/ivas_init_dec_fx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 45f6e0a42..bb0e0c57c 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -151,8 +151,9 @@ ivas_error ivas_dec_get_format_fx( /*-------------------------------------------------------------------* * Read other signaling (ISM/MC mode, number of channels, etc.) *-------------------------------------------------------------------*/ - +#ifndef FIX_HRTF_LOAD k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); +#endif IF( is_DTXrate( ivas_total_brate ) == 0 ) { @@ -175,6 +176,7 @@ ivas_error ivas_dec_get_format_fx( nchan_ism = 1; move16(); #ifdef FIX_HRTF_LOAD + k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); k = sub( k, 1 ); WHILE( st_ivas->bit_stream[k] && ( nchan_ism < MAX_NUM_OBJECTS ) ) #else @@ -492,6 +494,7 @@ ivas_error ivas_dec_get_format_fx( nchan_ism = 1; move16(); #ifdef FIX_HRTF_LOAD + k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); k = sub( sub( k, 1 ), SID_FORMAT_NBITS ); WHILE( st_ivas->bit_stream[k] && ( nchan_ism < MAX_NUM_OBJECTS ) ) #else -- GitLab