Commit f97c59c7 authored by vasilache's avatar vasilache
Browse files

update fix 1074

parent 0012ec50
Loading
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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
+107 −85
Original line number Diff line number Diff line
@@ -151,6 +151,33 @@ 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 && st_ivas->nchan_ism > 0 )
            {
                /* 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
                {
                    /* 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 )++;
                    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;
            }
            else
            {
#endif
                if ( ivas_format != MASA_ISM_FORMAT )
                {
                    /* number of transport channels is always 2 for MASA_ISM format */
@@ -249,15 +276,7 @@ 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
#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
@@ -283,6 +302,9 @@ ivas_error ivas_masa_decode(
                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
        {
+15 −4
Original line number Diff line number Diff line
@@ -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;
        }
#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;