Commit 6d898751 authored by vasilache's avatar vasilache
Browse files

fix 1074 nr of directions fix

parent 98c2f57d
Loading
Loading
Loading
Loading
Loading
+21 −7
Original line number Diff line number Diff line
@@ -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,22 +164,36 @@ 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;
                }
            }
            else
            {
#endif