Commit 1ba56e6a authored by Dominik Weckbecker's avatar Dominik Weckbecker 💬
Browse files

improve format signaling for ISM and OSBA

parent 8e82ef62
Loading
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@
/* ################### Start DEBUGGING switches ########################### */

#ifndef RELEASE
/*#define DEBUGGING*/                           /* Activate debugging part of the code */
#define DEBUGGING                           /* Activate debugging part of the code */
#endif
/*#define WMOPS*/                               /* Activate complexity and memory counters */
/*#define WMOPS_PER_FRAME*/                     /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */
@@ -177,6 +177,8 @@
#define NONBE_FIX_1054_NEGATIVE_LVQ_INDEX               /* Nokia: issue 1054: Input to decode_comb in deindex_lvq_SHB should be positive */
#define NONBE_FIX_1063_DIV_BY_ZERO_SUMNRG               /* VoiceAge: issue 1063: division by zero for angle_rot feature in the UNCLR classifier */

#define NONBE_FIX_SBA_SIGNALING_BITS

/* ##################### End NON-BE switches ########################### */

/* ################## End DEVELOPMENT switches ######################### */
+14 −3
Original line number Diff line number Diff line
@@ -467,8 +467,9 @@ ivas_error ivas_dec_setup(
        {
            /* the number of objects is written at the end of the bitstream, in the SBA metadata */
            st_ivas->nchan_ism = 2 * st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 1] + st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 2] + 1;

#ifndef NONBE_FIX_SBA_SIGNALING_BITS
            if ( ivas_total_brate < IVAS_24k4 || ivas_total_brate >= IVAS_256k )
#endif
            {
                /* read Ambisonic (SBA) planar flag */
                st_ivas->sba_planar = st_ivas->bit_stream[num_bits_read];
@@ -480,10 +481,12 @@ ivas_error ivas_dec_setup(
            num_bits_read += SBA_ORDER_BITS;

            /* read Ambisonic (SBA) order */
#ifndef NONBE_FIX_SBA_SIGNALING_BITS
            if ( ivas_total_brate < IVAS_256k )
            {
                st_ivas->sba_order = 3;
            }
#endif

            if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->last_active_ivas_total_brate )
            {
@@ -786,8 +789,9 @@ static ivas_error ivas_read_format(
                break;
            case 2:
                st_ivas->ivas_format = ISM_FORMAT;

#ifndef NONBE_FIX_SBA_SIGNALING_BITS
                if ( ivas_total_brate >= IVAS_24k4 )
#endif
                {
                    if ( st_ivas->bit_stream[*num_bits_read] )
                    {
@@ -801,7 +805,12 @@ static ivas_error ivas_read_format(
                            st_ivas->ivas_format = MASA_ISM_FORMAT;
                        }
                    }

#ifdef NONBE_FIX_SBA_SIGNALING_BITS
                    else
                    {
                        ( *num_bits_read )++;
                    }
#endif
                    ( *num_bits_read )++;
                }
                break;
@@ -819,10 +828,12 @@ static ivas_error ivas_read_format(
                    /* read Ambisonic (SBA) order */
                    st_ivas->sba_order = st_ivas->bit_stream[( *num_bits_read ) + 2 + SBA_PLANAR_BITS];
                    st_ivas->sba_order += 2 * st_ivas->bit_stream[( *num_bits_read ) + 1 + SBA_PLANAR_BITS];
#ifndef NONBE_FIX_SBA_SIGNALING_BITS
                    if ( st_ivas->sba_order == 0 )
                    {
                        st_ivas->ivas_format = SBA_ISM_FORMAT;
                    }
#endif
                }
                ( *num_bits_read )++;

+16 −0
Original line number Diff line number Diff line
@@ -67,10 +67,18 @@ void ivas_write_format(
            break;
        case ISM_FORMAT:
            ind = 2;
#ifndef NONBE_FIX_SBA_SIGNALING_BITS
            if ( st_ivas->hEncoderConfig->ivas_total_brate >= IVAS_24k4 )
#endif
            {
#ifndef NONBE_FIX_SBA_SIGNALING_BITS
                ind = 4;
                nBits += extra_bits;
#else
                ind = 8;
                nBits += extra_bits;
                nBits += IVAS_COMBINED_FORMAT_SIGNALLING_BITS;
#endif
            }
            break;
        case MC_FORMAT:
@@ -83,12 +91,18 @@ void ivas_write_format(
        case MASA_FORMAT:
            ind = 7;
            nBits += extra_bits;
#if 0
            nBits += IVAS_COMBINED_FORMAT_SIGNALLING_BITS;
#endif
            break;
        case MASA_ISM_FORMAT:
            if ( st_ivas->ism_mode == ISM_MODE_NONE )
            {
                ind = 7; /* send MASA format */
                nBits += extra_bits;
#if 0
                nBits += IVAS_COMBINED_FORMAT_SIGNALLING_BITS;
#endif
            }
            else
            {
@@ -97,12 +111,14 @@ void ivas_write_format(
            }
            break;
        case SBA_ISM_FORMAT:
#ifndef NONBE_FIX_SBA_SIGNALING_BITS
            if ( st_ivas->hEncoderConfig->ivas_total_brate < IVAS_24k4 )
            {
                ind = 6; /* send SBA format */
                nBits += extra_bits;
            }
            else
#endif
            {
                ind = 11; /* 1011 */
                nBits += extra_bits + IVAS_COMBINED_FORMAT_SIGNALLING_BITS;
+5 −0
Original line number Diff line number Diff line
@@ -253,11 +253,16 @@ int16_t ivas_ism_dtx_enc(
            /* replicate ivas_write_format() */
            int16_t ind = 2;
            nBits = IVAS_FORMAT_SIGNALING_NBITS;
#ifdef NONBE_FIX_SBA_SIGNALING_BITS
            ind = 8;
            nBits = IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + IVAS_COMBINED_FORMAT_SIGNALLING_BITS;
#else
            if ( ivas_total_brate >= IVAS_24k4 )
            {
                ind = 4;
                nBits = IVAS_FORMAT_SIGNALING_NBITS_EXTENDED;
            }
#endif

            push_indice( hSCE[0]->hCoreCoder[0]->hBstr, IND_IVAS_FORMAT, ind, nBits );
        }
+9 −0
Original line number Diff line number Diff line
@@ -497,7 +497,11 @@ void ivas_mct_core_enc(
    {
        nAvailBits -= IVAS_FORMAT_SIGNALING_NBITS_EXTENDED;
        nAvailBits -= SBA_ORDER_BITS + SBA_PLANAR_BITS;
#ifdef NONBE_FIX_SBA_SIGNALING_BITS
        if ( ivas_format == SBA_ISM_FORMAT )
#else
        if ( ivas_format == SBA_ISM_FORMAT && nChannels > 4 )
#endif
        {
            nAvailBits -= IVAS_COMBINED_FORMAT_SIGNALLING_BITS;
        }
@@ -574,7 +578,12 @@ void ivas_mct_core_enc(

#ifdef DEBUGGING
    format_bits = ( ivas_format == MC_FORMAT ? IVAS_FORMAT_SIGNALING_NBITS + MC_LS_SETUP_BITS : IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + SBA_ORDER_BITS + SBA_PLANAR_BITS );

#ifdef NONBE_FIX_SBA_SIGNALING_BITS
    format_bits += ( ivas_format == SBA_ISM_FORMAT );
#else
    format_bits += ( ivas_format == SBA_ISM_FORMAT && nChannels > FOA_CHANNELS );
#endif
    mct_bits += hMCT->nBitsMCT + hMCT->nchan_out_woLFE;
    assert( ( total_brate + ( NBITS_BWIDTH + format_bits + mct_bits + sba_meta + lfe_bits ) * FRAMES_PER_SEC ) == ivas_total_brate );
#endif
Loading