Commit 1ca051bf authored by vaclav's avatar vaclav
Browse files

- Merge remote-tracking branch 'remotes/origin/main' into...

- Merge remote-tracking branch 'remotes/origin/main' into 1226-ram-optimization-in-fastconv-binaural-renderer-with-external-binary-file
- rename IVAS_DEC_LoadHrtfFromFile() to load_hrtf_from_file()
parents 120067b1 f0fab958
Loading
Loading
Loading
Loading
Loading
+18 −16
Original line number Diff line number Diff line
@@ -150,9 +150,7 @@ typedef struct
    AcousticEnvironmentSequence aeSequence;
    bool dpidEnabled;
    uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS];
#ifdef OBJ_EDITING_COMMANDLINE
    bool objEditEnabled;
#endif

} DecArguments;

@@ -189,7 +187,7 @@ static void usage_dec( void );
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec );
#ifdef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM_SIMPLIFY
static ivas_error IVAS_DEC_LoadHrtfFromFile( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs );
static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs );
#else
static ivas_error IVAS_DEC_LoadHrtfFromFile( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const int32_t output_Fs );
#endif
@@ -442,13 +440,8 @@ int main(
    asked_frame_size = arg.renderFramesize;
    uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535;

#ifdef OBJ_EDITING_COMMANDLINE
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain,
                                       arg.dpidEnabled, aeID, arg.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain,
                                       arg.dpidEnabled, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
@@ -1029,10 +1022,8 @@ static bool parseCmdlIVAS_dec(
        arg->directivityPatternId[i] = 65535;
    }

#ifdef OBJ_EDITING_COMMANDLINE
    arg->objEditEnabled = false;

#endif
    /*-----------------------------------------------------------------*
     * Initialization
     *-----------------------------------------------------------------*/
@@ -1485,13 +1476,11 @@ static bool parseCmdlIVAS_dec(

            i += tmp;
        }
#ifdef OBJ_EDITING_COMMANDLINE
        else if ( strcmp( argv_to_upper, "-OBJ_EDIT" ) == 0 )
        {
            arg->objEditEnabled = true;
            i++;
        }
#endif

        /*-----------------------------------------------------------------*
         * Option not recognized
@@ -1693,9 +1682,7 @@ static void usage_dec( void )
    fprintf( stdout, "-aeid ID | File     : Acoustic environment ID (number > 0)\n" );
    fprintf( stdout, "                      alternatively, it can be a text file where each line contains \"ID duration\"\n" );
    fprintf( stdout, "                      for BINAURAL_ROOM_REVERB output configuration.\n" );
#ifdef OBJ_EDITING_COMMANDLINE
    fprintf( stdout, "-obj_edit           : Enable objects editing\n" );
#endif
    fprintf( stdout, "-level level        : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" );
    fprintf( stdout, "                      Currently, all values default to level 3 (full functionality).\n" );
    fprintf( stdout, "-q                  : Quiet mode, no frame counter\n" );
@@ -2394,7 +2381,7 @@ static ivas_error decodeG192(
                if ( arg.hrtfReaderEnabled )
                {
#ifdef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM_SIMPLIFY
                    if ( ( error = IVAS_DEC_LoadHrtfFromFile( hHrtfBinary, hIvasDec, arg.outputConfig, arg.output_Fs ) ) != IVAS_ERR_OK )
                    if ( ( error = load_hrtf_from_file( hHrtfBinary, hIvasDec, arg.outputConfig, arg.output_Fs ) ) != IVAS_ERR_OK )
#else
                    if ( ( error = IVAS_DEC_LoadHrtfFromFile( hHrtfBinary, hIvasDec, arg.output_Fs ) ) != IVAS_ERR_OK )
#endif
@@ -3309,7 +3296,7 @@ static ivas_error decodeVoIP(
                if ( arg.hrtfReaderEnabled )
                {
#ifdef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM_SIMPLIFY
                    if ( ( error = IVAS_DEC_LoadHrtfFromFile( hHrtf, hIvasDec, arg.outputConfig, arg.output_Fs ) ) != IVAS_ERR_OK )
                    if ( ( error = load_hrtf_from_file( hHrtf, hIvasDec, arg.outputConfig, arg.output_Fs ) ) != IVAS_ERR_OK )
#else
                    if ( ( error = IVAS_DEC_LoadHrtfFromFile( hHrtf, hIvasDec, arg.output_Fs ) ) != IVAS_ERR_OK )
#endif
@@ -3703,6 +3690,20 @@ static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec(
#endif


#ifdef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM_SIMPLIFY
/*---------------------------------------------------------------------*
 * load_hrtf_from_file()
 *
 * Load HRTF coefficients from external binary file
 *---------------------------------------------------------------------*/

static ivas_error load_hrtf_from_file(
    IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, /* i/o: HRTF binary wrapper handle   */
    IVAS_DEC_HANDLE hIvasDec,                  /* i/o: IVAS decoder handle          */
    const IVAS_AUDIO_CONFIG OutputConfig,      /* i  : output audio configuration   */
    const int32_t output_Fs                    /* i  : output sampling rate         */
)
#else
/*---------------------------------------------------------------------*
 * IVAS_DEC_LoadHrtfFromFile()
 *
@@ -3716,6 +3717,7 @@ static ivas_error IVAS_DEC_LoadHrtfFromFile(
    const IVAS_AUDIO_CONFIG OutputConfig,
#endif
    const int32_t output_Fs )
#endif
{
    ivas_error error;
    IVAS_BIN_RENDERER_TYPE binaural_renderer, binaural_renderer_sec;
+0 −8
Original line number Diff line number Diff line
@@ -2624,11 +2624,6 @@ ivas_error preview_indices(
            case SID_ISM:
                st_ivas->ivas_format = ISM_FORMAT;
                break;
#ifndef FIX_1209_SID_SIGNALING
            case SID_MULTICHANNEL:
                st_ivas->ivas_format = MC_FORMAT;
                break;
#endif
            case SID_SBA_1TC:
                st_ivas->ivas_format = SBA_FORMAT;
                st_ivas->element_mode_init = IVAS_SCE;
@@ -2653,9 +2648,6 @@ ivas_error preview_indices(
                }
                break;
            default:
#ifndef FIX_1209_SID_SIGNALING
                /* This should actually be impossible, since only 3 bits are read, so if this happens something is broken */
#endif
                return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Invalid value %c found in SID format field.", st_ivas->sid_format );
        }
    }
+0 −4
Original line number Diff line number Diff line
@@ -233,11 +233,7 @@ typedef enum
#define SID_MDCT_STEREO                         0x1                         /*      1|      0|     0 */
#define SID_ISM                                 0x2                         /*      0|      1|     0 */
#define SID_MASA_1TC                            0x3                         /*      1|      1|     0 */
#ifdef FIX_1209_SID_SIGNALING
/*reserved*/                                  /*0x4*/                       /*      0|      0|     1 */
#else
#define SID_MULTICHANNEL                        0x4                         /*      0|      0|     1 */
#endif
#define SID_SBA_1TC                             0x5                         /*      1|      0|     1 */
#define SID_SBA_2TC                             0x6                         /*      0|      1|     1 */
#define SID_MASA_2TC                            0x7                         /*      1|      1|     1 */
+1 −8
Original line number Diff line number Diff line
@@ -154,15 +154,12 @@

/* ################## Start DEVELOPMENT switches ######################### */

#define OBJ_EDITING_COMMANDLINE                        /* obj editing command-line option */
#define FIX_BRATE_SWITCHING                            /* VA: fix bitrate switching cases in OMASA and OSBA */

/* ################### Start BE switches ################################# */
/* only BE switches wrt selection floating point code */

/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define TMP_FIX_1119_SPLIT_RENDERING_VOIP               /* FhG: Add error check for unsupported config: split rendering with VoIP mode */
#define FIX_1209_SID_SIGNALING                          /* VA: issue 1209: remove dead code in IVAS SID signaling */
#define FIX_1226_FASTCONV_HRTF_LOADING_OPTIM            /* VA: issue 1226: for FastConv binaural renderer in decoder, load only HTRT coefficient set that is needed */
#define FIX_1226_FASTCONV_HRTF_LOADING_OPTIM_2          /* removal of multiplied code */
#define FIX_1226_FASTCONV_HRTF_LOADING_OPTIM_SIMPLIFY
@@ -175,11 +172,7 @@
/* all switches in this category should start with "NONBE_" */

#define NONBE_FIX_1176_OSBA_REVERB_JBM_ASAN_ERROR       /* Ericsson: Issue 1176, fix in TDREND_firfilt for subframes shorter than the filter length */
#define NONBE_FIX_1212_TONAL_MDCT_CONCEALMENT           /* FhG: Fix issue 1212, zero IGF spec also in 1st concealed frame */
#define NONBE_FIX_1204_MDCT_STEREO_NOISE_EST_SCALING    /* FhG: fixes for decoder-side noise level estimation in MDCT-Stereo to prevent noise bursts in stereo switching */
#define NONBE_1200_ISM_JBM_BRATE_SW_FLUSH               /* VA: issue 1200: fix bug in renderer flush in ISM JBM bitrate switching */
#define NONBE_FIX_1205_TD_STEREO_MOD_CT                 /* VA: fix mismatch of coder_type (mod_ct) btw. TD stereo encoder and decoder */
#define NONBE_1203_MDCT2DFT_SWITCHING                   /* VA: issue 1203: fix severe artifacts during MDCT to DFT stereo switching when MDCT ITD is not used */
#define NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH             /* VA: issue 1220: fix bug in renderer flush in OMASA 1ISM JBM bitrate switching */

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

+0 −24
Original line number Diff line number Diff line
@@ -108,9 +108,7 @@ ivas_error ivas_dec_get_format(
    int32_t ivas_total_brate;
    uint16_t *bit_stream_orig;
    AUDIO_CONFIG signaled_config;
#ifdef FIX_1209_SID_SIGNALING
    ivas_error error;
#endif

    num_bits_read = 0;
    element_mode_flag = 0;
@@ -122,14 +120,10 @@ ivas_error ivas_dec_get_format(
     * Read IVAS format
     *-------------------------------------------------------------------*/

#ifdef FIX_1209_SID_SIGNALING
    if ( ( error = ivas_read_format( st_ivas, &num_bits_read ) ) != IVAS_ERR_OK )
    {
        return error;
    }
#else
    ivas_read_format( st_ivas, &num_bits_read );
#endif

    if ( st_ivas->ini_frame > 0 && st_ivas->ivas_format != st_ivas->last_ivas_format &&
         !( st_ivas->ivas_format == MASA_FORMAT && st_ivas->last_ivas_format == MASA_ISM_FORMAT ) &&
@@ -487,14 +481,10 @@ ivas_error ivas_dec_setup(
     * Read IVAS format
     *-------------------------------------------------------------------*/

#ifdef FIX_1209_SID_SIGNALING
    if ( ( error = ivas_read_format( st_ivas, &num_bits_read ) ) != IVAS_ERR_OK )
    {
        return error;
    }
#else
    ivas_read_format( st_ivas, &num_bits_read );
#endif

    /*-------------------------------------------------------------------*
     * Read other signling (ISM/MC mode, number of channels, etc.)
@@ -1016,11 +1006,6 @@ static ivas_error ivas_read_format(
            case SID_ISM:
                st_ivas->ivas_format = ISM_FORMAT;
                break;
#ifndef FIX_1209_SID_SIGNALING
            case SID_MULTICHANNEL:
                st_ivas->ivas_format = MC_FORMAT;
                break;
#endif
            case SID_SBA_1TC:
                st_ivas->ivas_format = SBA_FORMAT;
                st_ivas->element_mode_init = IVAS_SCE;
@@ -1045,9 +1030,6 @@ static ivas_error ivas_read_format(
                }
                break;
            default:
#ifndef FIX_1209_SID_SIGNALING
                /* This should actually be impossible, since only 3 bits are read, so if this happens something is broken */
#endif
                return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Invalid value %c found in SID format field.", st_ivas->sid_format );
        }

@@ -3253,19 +3235,13 @@ static ivas_error doSanityChecks_IVAS(
        }
    }

#ifdef OBJ_EDITING_COMMANDLINE
    if ( st_ivas->hDecoderConfig->Opt_ObjEdit_on )
    {
#ifdef FIX_BRATE_SWITCHING
        if ( !( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT || ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_ism > 0 ) ) )
#else
        if ( !( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) )
#endif
        {
            return IVAS_ERROR( IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED, "Wrong set-up: Obect editing is not supported in this IVAS format." );
        }
    }
#endif
#ifdef DEBUGGING
    if ( ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) && ( ( st_ivas->ivas_format != MC_FORMAT && st_ivas->ivas_format != ISM_FORMAT ) || ( output_config != IVAS_AUDIO_CONFIG_BINAURAL && output_config != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCT ) ) )
    {
Loading