Commit 823e34a4 authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Merge branch '1847_basop_port_float_mr_1542_omasa_lbr_signaling_fix' into 'main'

[non-BE] [non-IO] [split-non-BE][allow regression] Port float MR 1542 to BASOP

See merge request !1968
parents 0de863f5 98ebaa00
Loading
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -120,6 +120,7 @@
#define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR          /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/
#define NONBE_FIX_1052_SBA_EXT                          /* Dlb: SBA external output support */
#define NONBE_FIX_MC_LFE_LPF                                  /* Dlb: Adding the LFE LPF filter back for MC content. */
#define NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR            /* Nok: issue 1074 fixing number of objects signaling in OMASA low rate */

/* #################### End BASOP porting switches ############################ */

+20 −0
Original line number Diff line number Diff line
@@ -427,6 +427,25 @@ ivas_error ivas_dec_setup(

            IF( GT_16( 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 1 or 2 objects is performed later
                */
                st_ivas->nchan_ism = sub( 5, st_ivas->nchan_ism );

                test();
                IF( EQ_16( st_ivas->nchan_transport, 1 ) && EQ_16( st_ivas->nchan_ism, 2 ) )
                {
                    st_ivas->nchan_ism = 1;
                    move16();
                }
                /* 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 */
                test();
                IF( EQ_16( st_ivas->nchan_transport, 2 ) && EQ_16( st_ivas->nchan_ism, 3 ) )
@@ -435,6 +454,7 @@ ivas_error ivas_dec_setup(
                    move16();
                }
                /* 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;
                move16();
+164 −103
Original line number Diff line number Diff line
@@ -184,6 +184,62 @@ ivas_error ivas_masa_decode_fx(
        test();
        IF( NE_32( ivas_format, MC_FORMAT ) || NE_16( st_ivas->mc_mode, MC_MODE_MCMASA ) )
        {
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
            Word16 bits_per_frame = extract_l( Mpy_32_32( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
            IF( EQ_32( ivas_format, MASA_FORMAT ) )
            {
                /* re-read the number of objects, needed in case of bad frame  */
                st_ivas->nchan_ism = sub( 5, add( st_ivas->bit_stream[bits_per_frame - 3], shl( st_ivas->bit_stream[bits_per_frame - 2], 1 ) ) );
            }
            test();
            IF( EQ_32( ivas_format, MASA_FORMAT ) && NE_16( st_ivas->nchan_ism, 5 ) )
            {
                /* there was OMASA in the input */
                hMasa->config.input_ivas_format = MASA_ISM_FORMAT;
                move32();
                IF( LT_16( st_ivas->nchan_ism, 3 ) )
                {
                    /* was read in ivas_init_dec() to distinguish between 1 and 2 objects */
                    IF( EQ_16( st_ivas->bit_stream[bits_per_frame - 1], 0 ) )
                    {
                        st_ivas->nchan_ism = 1;
                        move16();
                    }
                    st->next_bit_pos = sub( st->next_bit_pos, MASA_TRANSP_BITS );
                    *nb_bits_read = add( *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 )--];
                    move16();
                    move16();
                    *nb_bits_read = add( *nb_bits_read, MASA_HEADER_BITS );
                    /* read number of directions */
                    byteBuffer = st->bit_stream[( st->next_bit_pos )--];
                    move16();
                    *nb_bits_read = add( *nb_bits_read, 1 );
                    hMasa->config.numberOfDirections = (UWord8) L_add( byteBuffer, 1 );
                }
                ELSE
                {
                    /* 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 )--];
                    move16();
                    *nb_bits_read = add( *nb_bits_read, 1 );
                    hMasa->config.numberOfDirections = (UWord8) L_add( 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 )--];
                    move16();
                    move16();
                    *nb_bits_read = add( *nb_bits_read, MASA_HEADER_BITS );
                }
            }
            ELSE
            {
#endif
                IF( NE_32( ivas_format, MASA_ISM_FORMAT ) )
                {
                    /* number of transport channels is always 2 for MASA_ISM format */
@@ -322,6 +378,7 @@ ivas_error ivas_masa_decode_fx(
                }
#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT

#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
@@ -329,6 +386,7 @@ ivas_error ivas_masa_decode_fx(
                              '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];
                move16();
                st->next_bit_pos = sub( st->next_bit_pos, 1 );
@@ -373,6 +431,9 @@ ivas_error ivas_masa_decode_fx(
                move16();
                hMasa->config.numberOfDirections = (UWord8) L_add( byteBuffer, 1 );
                move16();
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
            }
#endif
        }
        ELSE
        {
+39 −4
Original line number Diff line number Diff line
@@ -537,6 +537,19 @@ ivas_error ivas_masa_encode_fx(
            test();
            IF( EQ_32( ivas_format, MASA_ISM_FORMAT ) && EQ_32( 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 */
                test();
                IF( EQ_16( nchan_ism, 1 ) || EQ_16( nchan_ism, 2 ) )
                {
                    push_next_indice( hMetaData, sub( nchan_ism, 1 ), MASA_TRANSP_BITS );
                }
                ELSE
                {
                    /* for 3 or 4 objects write already the number of MASA directions */
                    push_next_indice( hMetaData, sub( 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( EQ_16( nchan_ism, 4 ) )
                {
@@ -546,6 +559,7 @@ ivas_error ivas_masa_encode_fx(
                {
                    push_next_indice( hMetaData, 0, MASA_TRANSP_BITS );
                }
#endif
            }
            ELSE
            {
@@ -563,6 +577,16 @@ ivas_error ivas_masa_encode_fx(
        IF( EQ_32( ivas_format, MASA_ISM_FORMAT ) && EQ_32( ism_mode, ISM_MODE_NONE ) )
        {
#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
            IF( GE_16( nchan_ism, 3 ) ) /* if 3 or 4 objects */
            {
                push_next_indice( hMetaData, sub( 5, nchan_ism ), MASA_HEADER_BITS );
            }
            ELSE
            {
                push_next_indice( hMetaData, 3, MASA_HEADER_BITS );
            }
#else
            IF( LE_16( nchan_ism, 3 ) )
            {
                push_next_indice( hMetaData, nchan_ism, MASA_HEADER_BITS );
@@ -571,6 +595,7 @@ ivas_error ivas_masa_encode_fx(
            {
                push_next_indice( hMetaData, sub( nchan_ism, 1 ), MASA_HEADER_BITS );
            }
#endif
            hQMetaData->metadata_max_bits = sub( hQMetaData->metadata_max_bits, MASA_HEADER_BITS );
            move16();
#else
@@ -590,10 +615,20 @@ ivas_error ivas_masa_encode_fx(
            hQMetaData->metadata_max_bits = sub( hQMetaData->metadata_max_bits, MASA_HEADER_BITS );
            move16();
        }
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
        test();
        test();
        test();
        IF( !( EQ_32( ivas_format, MASA_ISM_FORMAT ) && EQ_32( ism_mode, ISM_MODE_NONE ) && GT_16( nchan_ism, 2 ) ) )
        {
#endif
            /* write number of directions */
            push_next_indice( hMetaData, sub( hQMetaData->no_directions, 1 ), 1 );
            hQMetaData->metadata_max_bits = sub( hQMetaData->metadata_max_bits, 1 );
            move16();
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
        }
#endif

        /* write subframe mode */
        IF( EQ_16( hQMetaData->q_direction[0].cfg.nblocks, 1 ) )
+5 −0
Original line number Diff line number Diff line
@@ -388,7 +388,12 @@ Word16 ivas_get_nchan_buffers_dec_fx(
        }
#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
        test();
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
        test();
        IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && GT_16( st_ivas->nchan_ism, 0 ) && LT_16( st_ivas->nchan_ism, 5 ) ) /* Last condition needed only in BASOP */
#else
        IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && GT_16( st_ivas->nchan_ism, 0 ) )
#endif
        {
            nchan_out_buff = add( st_ivas->nchan_ism, CPE_CHANNELS );
        }