Commit 39777f28 authored by premathasara's avatar premathasara
Browse files

AGC exception bit is no longer used, so clean up all code that calculate/use the exception bit

parent c41f67fd
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -51,6 +51,10 @@ tests/renderer/cut
tests/renderer/ref
tests/dut
tests/ref
scripts/testv/*_cut*.pcm
# default reference binary name
IVAS_cod_ref
IVAS_dec_ref

# Python files that pop up when running scripts
__pycache__/
+2 −2
Original line number Diff line number Diff line
@@ -938,7 +938,7 @@ const ivas_spar_br_table_t ivas_spar_br_table_consts[IVAS_SPAR_BR_TABLE_LEN] =
    { 256000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 76300, 73550, 112000 },{ 59350, 57200, 56000 },{ 42400, 40850, 48000 },{ 25450, 24500, 40000 } },
    { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 31, 1, 1, 1 } }, 1, 2, 0 },

    { 384000, 0, 1, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 100000, 100000, 128000 },{ 79850, 79850, 104000 },{ 66600, 66600, 104000 } },   // not yet optimized
    { 384000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 100000, 100000, 128000 },{ 79850, 79850, 104000 },{ 66600, 66600, 104000 } },   // not yet optimized
    { { 31, 1, 1, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },

    { 384000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 105350, 103300, 112000 },{ 75200, 73750, 96000 },{ 45100, 44250, 48000 } }, // just added as a place holder, not necessarily operational
@@ -947,7 +947,7 @@ const ivas_spar_br_table_t ivas_spar_br_table_consts[IVAS_SPAR_BR_TABLE_LEN] =
    { 384000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 124300, 121550, 128000 },{ 96700, 94550, 112000 },{ 69050, 67500, 96000 },{ 41450, 40500, 48000 } },  // just added as a place holder, not necessarily operational
    { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },

    { 512000, 0, 1, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 128000, 128000, 128000 },{ 128000, 128000, 128000 }, {118450, 118450, 128000 } }, // not yet optimized
    { 512000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 128000, 128000, 128000 },{ 128000, 128000, 128000 }, {118450, 118450, 128000 } }, // not yet optimized
    { { 31, 1, 1, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },

    { 512000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 128000, 128000, 128000 },{ 128000, 128000, 128000 },{ 97700, 93300, 128000 } }, // not yet optimized
+2 −0
Original line number Diff line number Diff line
@@ -315,7 +315,9 @@ typedef struct ivas_huff_coeffs_t
/* AGC structures */
typedef struct ivas_agc_chan_data_t
{
#ifndef CLEANUP_185_NO_AGC_EXCEPTION
    int16_t gainException;
#endif
    int16_t absGainExp;
    int16_t absGainExpCurr;

+4 −0
Original line number Diff line number Diff line
@@ -164,6 +164,10 @@
#define BRATE_SWITCHING_FRAMEWORK                       /* Bitrate switching changes related to the general framework  */
#define BRATE_SWITCHING_RENDERING                       /* Bitrate switching changes related to the renderers */
#define FIX_185_REDUCE_MD_BITS                          /* Issue 185: Crash in SBA encoder for 24.4 kbps HOA3 input with longer testvector */
#ifdef FIX_185_REDUCE_MD_BITS
#define CLEANUP_185_NO_AGC_EXCEPTION                    /* Issue 185: Cleanup AGC EXCEPTION code */
#endif


/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+14 −0
Original line number Diff line number Diff line
@@ -78,7 +78,9 @@ static void ivas_agc_dec_init(
        /* gain_data */
        ptr->absGainExp = hAgcDec->agc_com.absEmin;
        ptr->absGainExpCurr = hAgcDec->agc_com.absEmin;
#ifndef CLEANUP_185_NO_AGC_EXCEPTION
        ptr->gainException = false;
#endif
        ptr++;
    }

@@ -213,8 +215,10 @@ void ivas_agc_dec_process(
        pState->gain_state[i].lastGain = powf( pState->agc_com.winFunc[offset - 1], ( -1.f * (float) ( pState->gain_data[i].absGainExp - pState->agc_com.absEmin ) ) );
        gainLast = 1.f / pState->gain_state[i].lastGain;

#ifndef CLEANUP_185_NO_AGC_EXCEPTION
        if ( !pState->gain_data[i].gainException )
        {
#endif
            if ( pState->gain_state[i].gainExpVal != 0 )
            {
                for ( idx = 0; idx < output_frame; idx++ )
@@ -241,6 +245,7 @@ void ivas_agc_dec_process(
                    pcm_out[i][idx] = pcm_in[i][idx] * gain;
                }
            }
#ifndef CLEANUP_185_NO_AGC_EXCEPTION
        }
        else
        {
@@ -261,6 +266,7 @@ void ivas_agc_dec_process(
            }
            pState->gain_state[i].lastGain /= gainCurr;
        }
#endif
        pState->gain_data[i].absGainExp = pState->gain_data[i].absGainExpCurr;
    }

@@ -309,7 +315,9 @@ void ivas_agc_read_bits(
            {
                pState->gain_data[i].absGainExpCurr = get_next_indice( st0, (int16_t) pState->agc_com.betaE );
#ifdef FIX_185_REDUCE_MD_BITS
#ifndef CLEANUP_185_NO_AGC_EXCEPTION
                pState->gain_data[i].gainException = false;
#endif
#else
                pState->gain_data[i].gainException = get_next_indice( st0, 1 );
#endif
@@ -317,7 +325,9 @@ void ivas_agc_read_bits(
            else
            {
                pState->gain_data[i].absGainExpCurr = (int32_t) pState->agc_com.absEmin;
#ifndef CLEANUP_185_NO_AGC_EXCEPTION
                pState->gain_data[i].gainException = false;
#endif
            }
        }
    }
@@ -326,7 +336,9 @@ void ivas_agc_read_bits(
        for ( i = 0; i < n_channels; i++ )
        {
            pState->gain_data[i].absGainExpCurr = (int32_t) pState->agc_com.absEmin;
#ifndef CLEANUP_185_NO_AGC_EXCEPTION
            pState->gain_data[i].gainException = false;
#endif
        }
    }

@@ -337,8 +349,10 @@ void ivas_agc_read_bits(
    {
        fread( &( pState->gain_data[i].absGainExpCurr ), sizeof( int32_t ), 1, stream ); /* n bits */
        num_bits += pState->agc_com.betaE;
#ifndef CLEANUP_185_NO_AGC_EXCEPTION
        fread( &( pState->gain_data[i].gainException ), sizeof( int16_t ), 1, stream ); /* 1 bit */
        num_bits++;
#endif
        num_dmx_bits[i]++;

        /*fprintf(stdout, "AbsGain[%d]:= %d[%d bits]; ", i, pState->gain_data[i].absGainExp, pState->betaE);*/
Loading