Commit d989ed02 authored by emerit's avatar emerit
Browse files

Bug fix in mixerconv tables rom generator

parent 365fc1a4
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -155,9 +155,10 @@
#define FIX_866_MOVE_VBAP                               /* Nokia: Issue 866: Move VBAP to lib_rend */

#define FIX_INV_DIFFUSE_WEIGHT                          /* Orange : Fix error in energy compensation in late binaural reverb*/
#define FIX_638_ENERGIE_IAC_ROM_TABLES                  /* Missing left/right and coherence late reverb tables in binary format*/
#define FIX_CRASH_LONG_BRIR                             /* Fix crash when long BRIR is set */
#define FIX_863_REMOVE_REDUNDANCIES_OMASA               /* Nokia/VA: Issue 863: Remove redundancies in stereo_classifier for OMASA */
#define FIX_638_ENERGIE_IAC_ROM_TABLES                  /* Orange : Missing left/right and coherence late reverb tables in binary format*/
#define FIX_CRASH_LONG_BRIR                             /* Orange : Fix crash when long BRIR is set */
#define FIX_863_REMOVE_REDUNDANCIES_OMASA               /* Nokia/VA & Orange : Issue 863: Remove redundancies in stereo_classifier for OMASA */
#define FIX_20_MS_FRAME_LEN_TABLES_CONVERTER            /* Orange : generate_tables_convereter tools can generate rom for 5 and 20 ms frame length */

/* #################### End BE switches ################################## */

+2 −0
Original line number Diff line number Diff line
@@ -8,3 +8,5 @@ directEnergyThreshold = -25;
diffuseEnergyThreshold = -25; 
beginEnergyThreshold = -50; 
endEnergyThreshold = -120;
maxNumDirectBlocks = 40;
maxNumDiffuseBlocks = 40;
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
@@ -8,3 +8,5 @@ directEnergyThreshold = -15;
diffuseEnergyThreshold = -30; 
beginEnergyThreshold = -50; 
endEnergyThreshold = -120;
maxNumDirectBlocks = 40;
maxNumDiffuseBlocks = 40;
 No newline at end of file
+44 −1
Original line number Diff line number Diff line
@@ -104,6 +104,28 @@ static ivas_error read_txt_float(
    return IVAS_ERR_OK;
}

#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
/*-----------------------------------------------------------------------------------------*
 * Function read_txt_uint32()
 * Reads a float value from a line
 *-----------------------------------------------------------------------------------------*/
static ivas_error read_txt_uint32(
    const char *pLine, /* i  : String to read from  */
    uint32_t *pTarget  /* o  : Output pointer       */
)
{
    uint32_t val = 0;
    if ( sscanf( pLine, "%d", &val ) != 1 )
    {
        return IVAS_ERR_INVALID_RENDER_CONFIG;
    }

    *pTarget = val;

    return IVAS_ERR_OK;
}
#endif

/*-----------------------------------------------------------------------------------------*
 * Function read_txt_vector()
 *
@@ -272,7 +294,10 @@ ivas_error ConfigReader_read(
    hRenderConfig->diffuseEnergyThreshold = DEFAULT_DIFFUSE_ENERGY_THRESHOLD;
    hRenderConfig->diffuseCutOffFreqThreshold = DEFAULT_DIFFUSE_CUT_OFF_FREQ_THRESHOLD;
    hRenderConfig->directCutOffFreqThreshold = DEFAULT_DIRECT_CUT_OFF_FREQ_THRESHOLD;

#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
    hRenderConfig->maxNumDirectBlocks = DEFAULT_MAX_NUM_DIRECT_BLOCKS;
    hRenderConfig->maxNumDiffuseBlocks = DEFAULT_MAX_NUM_DIFFUSE_BLOCKS;
#endif
    /* read file line by line */
    while ( fgets( pConfig_str, file_size, pConfigFile ) != NULL )
    {
@@ -391,6 +416,24 @@ ivas_error ConfigReader_read(
                            return IVAS_ERR_INVALID_RENDER_CONFIG;
                        }
                    }
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
                    else if ( strcmp( item, "MAXNUMDIRECTBLOCKS" ) == 0 )
                    {
                        if ( read_txt_uint32( pValue, &hRenderConfig->maxNumDirectBlocks ) != IVAS_ERR_OK )
                        {
                            errorHandler( item, ERROR_VALUE_INVALID );
                            return IVAS_ERR_INVALID_RENDER_CONFIG;
                        }
                    }
                    else if ( strcmp( item, "MAXNUMDIFFUSEBLOCKS" ) == 0 )
                    {
                        if ( read_txt_uint32( pValue, &hRenderConfig->maxNumDiffuseBlocks ) != IVAS_ERR_OK )
                        {
                            errorHandler( item, ERROR_VALUE_INVALID );
                            return IVAS_ERR_INVALID_RENDER_CONFIG;
                        }
                    }
#endif
                }
                free( pValue );
            }
+10 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
#include "common_api_types.h"
#include "ivas_cnst.h"
#include "ivas_error.h"
#include "options.h"

#define DEFAULT_BEGIN_ENERGY_THRESHOLD         ( -50.f )
#define DEFAULT_END_ENERGY_THRESHOLD           ( -120.f )
@@ -43,6 +44,11 @@
#define DEFAULT_DIFFUSE_ENERGY_THRESHOLD       ( -25.f )
#define DEFAULT_DIFFUSE_CUT_OFF_FREQ_THRESHOLD ( -20.f )
#define DEFAULT_DIRECT_CUT_OFF_FREQ_THRESHOLD  ( -20.f )
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
#define DEFAULT_MAX_NUM_DIRECT_BLOCKS  ( 40 )
#define DEFAULT_MAX_NUM_DIFFUSE_BLOCKS ( 40 )
#endif


typedef struct ConfigReader
{
@@ -55,6 +61,10 @@ typedef struct ConfigReader
    float diffuseEnergyThreshold;                          /* use to find the time end limit of the diffuse part (te).  diffuse part. It is a ratio in dB between diffuse part after te and complete diffuse HRIR/BRIR energies. The more the value is near zero the smallest is te, complexity decrease. */
    float diffuseCutOffFreqThreshold;                      /* threshold in dB to determine the cut off (fcdiff) frequency for each slice of the diffuse IR. ratio in dB between the energy after fcdiff and the total energy. The more the value is near zero the smallest is fcdiff, complexity decrease */
    float directCutOffFreqThreshold;                       /* threshold in dB to determine the cut off (fcdirect) frequency for each slice of the direct IR. Do not applied to first slice. ratio in dB between the energy after fcdirect and the total energy. The more the value is near zero the smallest is fcdirect, complexity decrease */
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
    uint32_t maxNumDirectBlocks;  /* max number of direct blocks */
    uint32_t maxNumDiffuseBlocks; /* max number of diffuse blocks */
#endif
} ConfigReader, *ConfigReaderHandle;

typedef enum
Loading