Commit 007440d6 authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_155_HP20_ISSUE

parent 1ae73658
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -144,7 +144,6 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
/*#define FIX_I1_113*/                                  /* under review : MCT bit distribution optimization for SBA high bitrates*/

#define FIX_155_HP20_ISSUE                              /* Issue 155: apply hp20 on all input channels instead of just 2 channels */
#define EFAP_FIX_POLY                                   /* Issue 167: fix bug in EFAP polygon selection */
#define SBA_HOA_HBR_IMPROV                              /* issue 91: Improvements to SBA high bitrate HOA3 coding */
#define ALLRAD_OPTIM                                    /* Issue 159: Optimize memory allocation for ALLRAD */
+0 −2
Original line number Diff line number Diff line
@@ -190,12 +190,10 @@ int16_t getNumChanAnalysis(
    {
        n = st_ivas->hEncoderConfig->nchan_inp;
    }
#ifdef FIX_155_HP20_ISSUE
    else if ( st_ivas->hEncoderConfig->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM )
    {
        n = st_ivas->hEncoderConfig->nchan_inp;
    }
#endif

    return n;
}
+0 −91
Original line number Diff line number Diff line
@@ -41,9 +41,6 @@
#include "ivas_rom_com.h"
#include "wmops.h"

#ifndef FIX_155_HP20_ISSUE
static ivas_error ivas_hp20_reconfig( Encoder_Struct *st_ivas, const int16_t nchan_hp20_old );
#endif
/*-------------------------------------------------------------------------
 * Local function definitions
 *------------------------------------------------------------------------*/
@@ -465,96 +462,8 @@ ivas_error ivas_ism_enc_config(
            st_ivas->hDirAC = NULL;
        }

#ifndef FIX_155_HP20_ISSUE
        ivas_hp20_reconfig( st_ivas, nchan_transport_old );
#endif
    }

    return error;
}
#ifndef FIX_155_HP20_ISSUE
// VE: this is the same function as at the decoder -> harmonize them to a new file ivas_corecoder_reconfig.c
/*-------------------------------------------------------------------*
 * ivas_hp20_dec_reconfig()
 *
 * Allocate, initialize, and configure HP20 memory handles in case of bitrate switching
 *-------------------------------------------------------------------*/

static ivas_error ivas_hp20_reconfig(
    Encoder_Struct *st_ivas,     /* i/o: IVAS encoder structure                     */
    const int16_t nchan_hp20_old /* i  : number of HP20 filters in previous frame   */
)
{
    int16_t i, nchan_hp20;
    float **old_mem_hp20_out;
    ivas_error error;

    error = IVAS_ERR_OK;

    /*-----------------------------------------------------------------*
     * HP20 memories
     *-----------------------------------------------------------------*/

    nchan_hp20 = getNumChanAnalysis( st_ivas );

    if ( nchan_hp20 > nchan_hp20_old )
    {
        /* save old mem_hp_20 pointer */
        old_mem_hp20_out = st_ivas->mem_hp20_in;
        st_ivas->mem_hp20_in = NULL;

        if ( ( st_ivas->mem_hp20_in = (float **) count_malloc( nchan_hp20 * sizeof( float * ) ) ) == NULL )
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) );
        }

        for ( i = 0; i < nchan_hp20_old; i++ )
        {
            st_ivas->mem_hp20_in[i] = old_mem_hp20_out[i];
            old_mem_hp20_out[i] = NULL;
        }
        /* create additional hp20 memories */
        for ( ; i < nchan_hp20; i++ )
        {
            if ( ( st_ivas->mem_hp20_in[i] = (float *) count_malloc( L_HP20_MEM * sizeof( float ) ) ) == NULL )
            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) );
            }

            set_f( st_ivas->mem_hp20_in[i], 0.0f, L_HP20_MEM );
        }

        count_free( old_mem_hp20_out );
        old_mem_hp20_out = NULL;
    }
    else if ( nchan_hp20 < nchan_hp20_old )
    {
        /* save old mem_hp_20 pointer */
        old_mem_hp20_out = st_ivas->mem_hp20_in;
        st_ivas->mem_hp20_in = NULL;

        if ( ( st_ivas->mem_hp20_in = (float **) count_malloc( nchan_hp20 * sizeof( float * ) ) ) == NULL )
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) );
        }

        for ( i = 0; i < nchan_hp20; i++ )
        {
            st_ivas->mem_hp20_in[i] = old_mem_hp20_out[i];
            old_mem_hp20_out[i] = NULL;
        }
        /* remove superfluous hp20 memories */
        for ( ; i < nchan_hp20_old; i++ )
        {
            count_free( old_mem_hp20_out[i] );
            old_mem_hp20_out[i] = NULL;
        }

        count_free( old_mem_hp20_out );
        old_mem_hp20_out = NULL;
    }

    return error;
}
#endif