From f622dfaaedb68e3e54d8d6b59434a35dd3e97baa Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Fri, 3 May 2024 13:56:45 +0300 Subject: [PATCH 1/7] fix 1074 --- lib_com/options.h | 1 + lib_dec/ivas_init_dec.c | 18 ++++++++++++++++++ lib_dec/ivas_masa_dec.c | 10 ++++++++++ lib_enc/ivas_masa_enc.c | 19 +++++++++++++++++++ 4 files changed, 48 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 43cb02520e..1c6a896a55 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,6 +171,7 @@ #define NONBE_FIX_SBA_SIGNALING_BITS_B /* FhG: issue 1061: option B: signal sba order additionally in OSBA */ +#define NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR /* Nok: issue 1074 fixing number of objects signaling in OMASA low rate */ /* ##################### End NON-BE switches ########################### */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 34e876b22a..98f726a911 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -366,12 +366,30 @@ ivas_error ivas_dec_setup( if ( st_ivas->nchan_ism > 0 ) { +#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR + /* the input_ivas_format should be MASA_ISM_FORMAT, but we cannot initialize it now */ + /* info about the number of objects: + '00' - MASA format at the encoder + '01' - MASA_ISM_FORMAT at the encoder, with 4 objects + '10' - MASA_ISM_FORMAT at the encoder, with 3 objects + '11' - MASA_ISM_FORMAT at the encoder, with 1 or 2 objects + reading if 3 or 4 object is performed later + */ + st_ivas->nchan_ism = 5 - st_ivas->nchan_ism; + if ( st_ivas->nchan_transport == 1 && st_ivas->nchan_ism == 2 ) + { + st_ivas->nchan_ism = 1; + } + /* for MASA_ISM_FORMAT at input the number of MASA transport channels is always 2 and the corresponding bit is not used here*/ +#else /* the input_ivas_format should be MASA_ISM_FORMAT, but we cannot initialize it now */ if ( st_ivas->nchan_transport == 2 && st_ivas->nchan_ism == 3 ) { st_ivas->nchan_ism = 4; } + /* for MASA_ISM_FORMAT at input the number of MASA transport channels is always 2 */ +#endif st_ivas->nchan_transport = 2; element_mode_flag = 1; } diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 3d05c01ad4..d8a1261dfd 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -249,6 +249,15 @@ ivas_error ivas_masa_decode( } } +#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR + /* read 2 bits: + '00' - MASA format at the encoder + '01' - MASA_ISM_FORMAT at the encoder, with 4 object + '10' - MASA_ISM_FORMAT at the encoder, with 3 objects + '11' - MASA_ISM_FORMAT at the encoder, with 1 or 2 objects + reading if 3 or 4 object is performed later + */ +#else /* read 2 bits: '00' - MASA format at the encoder '01' - MASA_ISM_FORMAT at the encoder, with 1 object @@ -256,6 +265,7 @@ ivas_error ivas_masa_decode( '11' - MASA_ISM_FORMAT at the encoder, with 3 or 4 objects reading if 3 or 4 object is performed later */ +#endif byteBuffer = st->bit_stream[( st->next_bit_pos )--]; byteBuffer = byteBuffer + 2 * st->bit_stream[( st->next_bit_pos )--]; diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index e4b536dbee..28e6d0b8f1 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -420,6 +420,13 @@ ivas_error ivas_masa_encode( { if ( ivas_format == MASA_ISM_FORMAT && ism_mode == ISM_MODE_NONE ) { +#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR + /* use the MASA number of transport channels bit to signal if there are 1 or 2 objects */ + if ( nchan_ism == 1 || nchan_ism == 2 ) + { + push_next_indice( hMetaData, nchan_ism - 1, MASA_TRANSP_BITS ); + } +#else /* use the MASA number of transport channels bit to signal if there are 3 or 4 objects */ if ( nchan_ism == 4 ) { @@ -429,6 +436,7 @@ ivas_error ivas_masa_encode( { push_next_indice( hMetaData, 0, MASA_TRANSP_BITS ); } +#endif } else { @@ -440,6 +448,16 @@ ivas_error ivas_masa_encode( if ( ivas_format == MASA_ISM_FORMAT && ism_mode == ISM_MODE_NONE ) { +#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR + if ( nchan_ism >= 3 ) /* if 3 or 4 objects */ + { + push_next_indice( hMetaData, 5 - nchan_ism, MASA_HEADER_BITS ); + } + else + { + push_next_indice( hMetaData, 3, MASA_HEADER_BITS ); + } +#else if ( nchan_ism <= 3 ) { push_next_indice( hMetaData, nchan_ism, MASA_HEADER_BITS ); @@ -448,6 +466,7 @@ ivas_error ivas_masa_encode( { push_next_indice( hMetaData, nchan_ism - 1, MASA_HEADER_BITS ); } +#endif hQMetaData->metadata_max_bits -= MASA_HEADER_BITS; } else -- GitLab From f97c59c78052ce02511d576a5fb37324636c5298 Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Tue, 7 May 2024 18:32:12 +0300 Subject: [PATCH 2/7] update fix 1074 --- lib_dec/ivas_init_dec.c | 5 +- lib_dec/ivas_masa_dec.c | 192 ++++++++++++++++++++++------------------ lib_enc/ivas_masa_enc.c | 19 +++- 3 files changed, 126 insertions(+), 90 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 98f726a911..67635ddc8f 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -362,8 +362,11 @@ ivas_error ivas_dec_setup( } /* this should be non-zero if original input format was MASA_ISM_FORMAT */ +#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR + st_ivas->nchan_ism = 2 * st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 3] + st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 2]; +#else st_ivas->nchan_ism = st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 3] + 2 * st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 2]; - +#endif if ( st_ivas->nchan_ism > 0 ) { #ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index d8a1261dfd..2e513f7f74 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -151,73 +151,75 @@ ivas_error ivas_masa_decode( { if ( !( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) { - if ( ivas_format != MASA_ISM_FORMAT ) - { - /* number of transport channels is always 2 for MASA_ISM format */ - /* the number of MASA transport channels was read in ivas_dec_setup() */ - st->next_bit_pos -= MASA_TRANSP_BITS; - *nb_bits_read += MASA_TRANSP_BITS; - } - - if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MODE_NONE ) +#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR + if ( ivas_format == MASA_FORMAT && st_ivas->nchan_ism > 0 ) { - /* the number of objects was read */ - st->next_bit_pos -= NO_BITS_MASA_ISM_NO_OBJ; - *nb_bits_read += NO_BITS_MASA_ISM_NO_OBJ; - - if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + /* there was OMASA in the input */ + hMasa->config.input_ivas_format = MASA_ISM_FORMAT; + if ( st_ivas->nchan_ism < 3 ) + { + /* was read in ivas_init_dec() to distinguish between 1 and 2 objects */ + st->next_bit_pos -= MASA_TRANSP_BITS; + *nb_bits_read += MASA_TRANSP_BITS; + } + else { - /* read index of separated object */ - /* nchan_ism should be > 1*/ + /* if there are 3 or 4 objects the number of transport channels bit is given to MASA format*/ + /* read number of directions */ byteBuffer = st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits_read )++; - st_ivas->hMasaIsmData->idx_separated_ism = 2 * byteBuffer + st->bit_stream[( st->next_bit_pos )--]; - ( *nb_bits_read )++; + hMasa->config.numberOfDirections = (uint8_t) ( byteBuffer + 1 ); } - else + /* the two reserved bits were already read in ivas_init_dec()*/ + byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + *nb_bits_read += MASA_HEADER_BITS; + } + else + { +#endif + if ( ivas_format != MASA_ISM_FORMAT ) { - st_ivas->hMasaIsmData->idx_separated_ism = -1; + /* number of transport channels is always 2 for MASA_ISM format */ + /* the number of MASA transport channels was read in ivas_dec_setup() */ + st->next_bit_pos -= MASA_TRANSP_BITS; + *nb_bits_read += MASA_TRANSP_BITS; } - /* read ISM importance flag (one per object) */ - if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MODE_NONE ) { - ism_imp = 0; - for ( i = 0; i < ISM_METADATA_FLAG_BITS; i++ ) + /* the number of objects was read */ + st->next_bit_pos -= NO_BITS_MASA_ISM_NO_OBJ; + *nb_bits_read += NO_BITS_MASA_ISM_NO_OBJ; + + if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { + /* read index of separated object */ + /* nchan_ism should be > 1*/ byteBuffer = st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits_read )++; - ism_imp = ( ism_imp << 1 ) + byteBuffer; + st_ivas->hMasaIsmData->idx_separated_ism = 2 * byteBuffer + st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits_read )++; } - st_ivas->hIsmMetaData[0]->ism_imp = ism_imp; - } - - if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) - { - ism_imp = 0; - for ( i = 0; i < ISM_METADATA_FLAG_BITS; i++ ) + else { - byteBuffer = st->bit_stream[( st->next_bit_pos )--]; - ( *nb_bits_read )++; - ism_imp = ( ism_imp << 1 ) + byteBuffer; + st_ivas->hMasaIsmData->idx_separated_ism = -1; } - st_ivas->hIsmMetaData[0]->ism_imp = ism_imp; - /* reset */ - st_ivas->hIsmMetaData[0]->ism_md_null_flag = 0; - st_ivas->hIsmMetaData[0]->ism_md_lowrate_flag = 0; - if ( st_ivas->hIsmMetaData[0]->ism_imp == ISM_NO_META ) + /* read ISM importance flag (one per object) */ + if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { - /* read flags */ - st_ivas->hIsmMetaData[0]->ism_md_null_flag = st->bit_stream[( st->next_bit_pos )--]; - ( *nb_bits_read ) += ISM_METADATA_MD_FLAG_BITS; - st_ivas->hIsmMetaData[0]->ism_md_lowrate_flag = st->bit_stream[( st->next_bit_pos )--]; - ( *nb_bits_read ) += ISM_METADATA_INACTIVE_FLAG_BITS; + ism_imp = 0; + for ( i = 0; i < ISM_METADATA_FLAG_BITS; i++ ) + { + byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits_read )++; + ism_imp = ( ism_imp << 1 ) + byteBuffer; + } + st_ivas->hIsmMetaData[0]->ism_imp = ism_imp; } - } - else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) - { - for ( ch = 0; ch < st_ivas->nchan_ism; ch++ ) + + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) { ism_imp = 0; for ( i = 0; i < ISM_METADATA_FLAG_BITS; i++ ) @@ -226,39 +228,56 @@ ivas_error ivas_masa_decode( ( *nb_bits_read )++; ism_imp = ( ism_imp << 1 ) + byteBuffer; } - st_ivas->hIsmMetaData[ch]->ism_imp = ism_imp; + st_ivas->hIsmMetaData[0]->ism_imp = ism_imp; /* reset */ - st_ivas->hIsmMetaData[ch]->ism_md_null_flag = 0; - st_ivas->hIsmMetaData[ch]->ism_md_lowrate_flag = 0; - if ( st_ivas->hIsmMetaData[ch]->ism_imp == ISM_NO_META ) + st_ivas->hIsmMetaData[0]->ism_md_null_flag = 0; + st_ivas->hIsmMetaData[0]->ism_md_lowrate_flag = 0; + if ( st_ivas->hIsmMetaData[0]->ism_imp == ISM_NO_META ) { /* read flags */ - st_ivas->hIsmMetaData[ch]->ism_md_null_flag = st->bit_stream[( st->next_bit_pos )--]; + st_ivas->hIsmMetaData[0]->ism_md_null_flag = st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits_read ) += ISM_METADATA_MD_FLAG_BITS; - st_ivas->hIsmMetaData[ch]->ism_md_lowrate_flag = st->bit_stream[( st->next_bit_pos )--]; + st_ivas->hIsmMetaData[0]->ism_md_lowrate_flag = st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits_read ) += ISM_METADATA_INACTIVE_FLAG_BITS; } } - st_ivas->flag_omasa_brate = 0; - if ( st_ivas->nchan_ism >= 3 && ivas_total_brate == IVAS_128k ) + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { - st_ivas->flag_omasa_brate = st->bit_stream[( st->next_bit_pos )--]; - ( *nb_bits_read ) += 1; + for ( ch = 0; ch < st_ivas->nchan_ism; ch++ ) + { + ism_imp = 0; + for ( i = 0; i < ISM_METADATA_FLAG_BITS; i++ ) + { + byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits_read )++; + ism_imp = ( ism_imp << 1 ) + byteBuffer; + } + st_ivas->hIsmMetaData[ch]->ism_imp = ism_imp; + + /* reset */ + st_ivas->hIsmMetaData[ch]->ism_md_null_flag = 0; + st_ivas->hIsmMetaData[ch]->ism_md_lowrate_flag = 0; + if ( st_ivas->hIsmMetaData[ch]->ism_imp == ISM_NO_META ) + { + /* read flags */ + st_ivas->hIsmMetaData[ch]->ism_md_null_flag = st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits_read ) += ISM_METADATA_MD_FLAG_BITS; + st_ivas->hIsmMetaData[ch]->ism_md_lowrate_flag = st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits_read ) += ISM_METADATA_INACTIVE_FLAG_BITS; + } + } + st_ivas->flag_omasa_brate = 0; + if ( st_ivas->nchan_ism >= 3 && ivas_total_brate == IVAS_128k ) + { + st_ivas->flag_omasa_brate = st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits_read ) += 1; + } } } - } -#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR - /* read 2 bits: - '00' - MASA format at the encoder - '01' - MASA_ISM_FORMAT at the encoder, with 4 object - '10' - MASA_ISM_FORMAT at the encoder, with 3 objects - '11' - MASA_ISM_FORMAT at the encoder, with 1 or 2 objects - reading if 3 or 4 object is performed later - */ -#else - /* read 2 bits: +#ifndef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR + /* read 2 bits: '00' - MASA format at the encoder '01' - MASA_ISM_FORMAT at the encoder, with 1 object '10' - MASA_ISM_FORMAT at the encoder, with 2 objects @@ -266,23 +285,26 @@ ivas_error ivas_masa_decode( reading if 3 or 4 object is performed later */ #endif - byteBuffer = st->bit_stream[( st->next_bit_pos )--]; - byteBuffer = byteBuffer + 2 * st->bit_stream[( st->next_bit_pos )--]; + byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + byteBuffer = byteBuffer + 2 * st->bit_stream[( st->next_bit_pos )--]; - if ( byteBuffer == 0 && ivas_format == MASA_FORMAT ) - { - hMasa->config.input_ivas_format = MASA_FORMAT; - } - else - { - hMasa->config.input_ivas_format = MASA_ISM_FORMAT; - } - *nb_bits_read += MASA_HEADER_BITS; + if ( byteBuffer == 0 && ivas_format == MASA_FORMAT ) + { + hMasa->config.input_ivas_format = MASA_FORMAT; + } + else + { + hMasa->config.input_ivas_format = MASA_ISM_FORMAT; + } + *nb_bits_read += MASA_HEADER_BITS; - /* read number of directions */ - byteBuffer = st->bit_stream[( st->next_bit_pos )--]; - ( *nb_bits_read )++; - hMasa->config.numberOfDirections = (uint8_t) ( byteBuffer + 1 ); + /* read number of directions */ + byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits_read )++; + hMasa->config.numberOfDirections = (uint8_t) ( byteBuffer + 1 ); +#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR + } +#endif } else { diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 28e6d0b8f1..975401d67d 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -426,6 +426,11 @@ ivas_error ivas_masa_encode( { push_next_indice( hMetaData, nchan_ism - 1, MASA_TRANSP_BITS ); } + else + { + /* for 3 or 4 objects write already the number of MASA directions */ + push_next_indice( hMetaData, hQMetaData->no_directions - 1, MASA_TRANSP_BITS ); + } #else /* use the MASA number of transport channels bit to signal if there are 3 or 4 objects */ if ( nchan_ism == 4 ) @@ -476,10 +481,16 @@ ivas_error ivas_masa_encode( push_next_indice( hMetaData, 0, MASA_HEADER_BITS ); hQMetaData->metadata_max_bits -= MASA_HEADER_BITS; } - /* write number of directions */ - push_next_indice( hMetaData, hQMetaData->no_directions - 1, 1 ); - hQMetaData->metadata_max_bits -= 1; - +#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR + if ( !( ivas_format == MASA_ISM_FORMAT && ism_mode == ISM_MODE_NONE && nchan_ism > 2 ) ) + { +#endif + /* write number of directions */ + push_next_indice( hMetaData, hQMetaData->no_directions - 1, 1 ); + hQMetaData->metadata_max_bits -= 1; +#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR + } +#endif /* write subframe mode */ push_next_indice( hMetaData, hQMetaData->q_direction[0].cfg.nblocks == 1 ? 1 : 0, MASA_SUBFRAME_BITS ); hQMetaData->metadata_max_bits -= MASA_SUBFRAME_BITS; -- GitLab From 9c78665824e30aa7349645a1e195f501594040c3 Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Wed, 8 May 2024 11:53:17 +0300 Subject: [PATCH 3/7] fix update 1074 --- lib_dec/ivas_init_dec.c | 5 +---- lib_dec/ivas_masa_dec.c | 5 +++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 10c8418414..fa256b1a88 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -362,11 +362,8 @@ ivas_error ivas_dec_setup( } /* this should be non-zero if original input format was MASA_ISM_FORMAT */ -#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR - st_ivas->nchan_ism = 2 * st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 3] + st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 2]; -#else st_ivas->nchan_ism = st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 3] + 2 * st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 2]; -#endif + if ( st_ivas->nchan_ism > 0 ) { #ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 093f3f645e..4ff5325557 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -152,6 +152,11 @@ ivas_error ivas_masa_decode( if ( !( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) { #ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR + if ( ivas_format == MASA_FORMAT ) + { + /* re-read the number of objects, needed in case of bad frame */ + st_ivas->nchan_ism = 5 - st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 3] + 2 * st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 2]; + } if ( ivas_format == MASA_FORMAT && st_ivas->nchan_ism > 0 ) { /* there was OMASA in the input */ -- GitLab From 98c2f57d143e3be7c3da152bd7498a36e2f370e5 Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Wed, 8 May 2024 13:01:05 +0300 Subject: [PATCH 4/7] correct reserved bits read in 1074fix --- lib_dec/ivas_init_dec.c | 2 +- lib_dec/ivas_masa_dec.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index fa256b1a88..9db46e6953 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -373,7 +373,7 @@ ivas_error ivas_dec_setup( '01' - MASA_ISM_FORMAT at the encoder, with 4 objects '10' - MASA_ISM_FORMAT at the encoder, with 3 objects '11' - MASA_ISM_FORMAT at the encoder, with 1 or 2 objects - reading if 3 or 4 object is performed later + reading if 1 or 2 objects is performed later */ st_ivas->nchan_ism = 5 - st_ivas->nchan_ism; if ( st_ivas->nchan_transport == 1 && st_ivas->nchan_ism == 2 ) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 4ff5325557..4710db2b1c 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -157,7 +157,7 @@ ivas_error ivas_masa_decode( /* re-read the number of objects, needed in case of bad frame */ st_ivas->nchan_ism = 5 - st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 3] + 2 * st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 2]; } - if ( ivas_format == MASA_FORMAT && st_ivas->nchan_ism > 0 ) + if ( ivas_format == MASA_FORMAT && st_ivas->nchan_ism != 5 ) { /* there was OMASA in the input */ hMasa->config.input_ivas_format = MASA_ISM_FORMAT; -- GitLab From 6d898751b48b626e100cdbb75edb0427771bb568 Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Wed, 8 May 2024 16:24:01 +0300 Subject: [PATCH 5/7] fix 1074 nr of directions fix --- lib_dec/ivas_masa_dec.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 4710db2b1c..7aca552043 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -155,7 +155,7 @@ ivas_error ivas_masa_decode( if ( ivas_format == MASA_FORMAT ) { /* re-read the number of objects, needed in case of bad frame */ - st_ivas->nchan_ism = 5 - st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 3] + 2 * st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 2]; + st_ivas->nchan_ism = 5 - ( st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 3] + 2 * st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 2] ); } if ( ivas_format == MASA_FORMAT && st_ivas->nchan_ism != 5 ) { @@ -164,21 +164,35 @@ ivas_error ivas_masa_decode( if ( st_ivas->nchan_ism < 3 ) { /* was read in ivas_init_dec() to distinguish between 1 and 2 objects */ + if ( st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 1] == 0 ) + { + st_ivas->nchan_ism = 1; + } st->next_bit_pos -= MASA_TRANSP_BITS; *nb_bits_read += MASA_TRANSP_BITS; + + /* the two reserved bits were already read in ivas_init_dec()*/ + byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + *nb_bits_read += MASA_HEADER_BITS; + /* read number of directions */ + byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits_read )++; + hMasa->config.numberOfDirections = (uint8_t) ( byteBuffer + 1 ); } else { - /* if there are 3 or 4 objects the number of transport channels bit is given to MASA format*/ - /* read number of directions */ + /* if there are 3 or 4 objects the number of transport channels bit is given to MASA format + and used to read number of directions*/ byteBuffer = st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits_read )++; hMasa->config.numberOfDirections = (uint8_t) ( byteBuffer + 1 ); + + /* the two reserved bits were already read in ivas_init_dec()*/ + byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + *nb_bits_read += MASA_HEADER_BITS; } - /* the two reserved bits were already read in ivas_init_dec()*/ - byteBuffer = st->bit_stream[( st->next_bit_pos )--]; - byteBuffer = st->bit_stream[( st->next_bit_pos )--]; - *nb_bits_read += MASA_HEADER_BITS; } else { -- GitLab From f02907f1bfb844353906dbf9cbe45e7799db6249 Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Wed, 8 May 2024 16:38:23 +0300 Subject: [PATCH 6/7] clang --- lib_dec/ivas_masa_dec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 7aca552043..1be3c80e21 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -300,9 +300,8 @@ ivas_error ivas_masa_decode( '00' - MASA format at the encoder '01' - MASA_ISM_FORMAT at the encoder, with 1 object '10' - MASA_ISM_FORMAT at the encoder, with 2 objects - '11' - MASA_ISM_FORMAT at the encoder, with 3 or 4 objects - reading if 3 or 4 object is performed later - */ + '11' - MASA_ISM_FORMAT at the encoder, with 3 or 4 objects; reading if 3 or 4 object is performed later + */ #endif byteBuffer = st->bit_stream[( st->next_bit_pos )--]; byteBuffer = byteBuffer + 2 * st->bit_stream[( st->next_bit_pos )--]; -- GitLab From d7b06971a1ba4fc084927ecd12f5b2ee7f401928 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Wed, 8 May 2024 16:44:56 +0300 Subject: [PATCH 7/7] More clang format --- lib_dec/ivas_masa_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 1be3c80e21..e64efc4a5e 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -182,7 +182,7 @@ ivas_error ivas_masa_decode( } else { - /* if there are 3 or 4 objects the number of transport channels bit is given to MASA format + /* if there are 3 or 4 objects the number of transport channels bit is given to MASA format and used to read number of directions*/ byteBuffer = st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits_read )++; -- GitLab