Commit d366fb34 authored by Stephane Ragot's avatar Stephane Ragot
Browse files

alignment with latest main

parent 83a12be9
Loading
Loading
Loading
Loading
+1 −23
Original line number Diff line number Diff line
@@ -1353,24 +1353,15 @@ static ivas_error initOnFirstGoodFrame(
        /* If outputting MASA, open output file and write metadata for initial bad frames */
        else if ( *pBsFormat == IVAS_DEC_BS_MASA )
        {
#ifdef FIX_350_MASA_DELAY_COMP
            if ( ( error = MasaFileWriter_open( arg.outputWavFilename, arg.delayCompensationEnabled, ppMasaWriter ) ) != IVAS_ERR_OK )
#else
            if ( ( error = MasaFileWriter_open( arg.outputWavFilename, ppMasaWriter ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nError: Error opening MASA decoded metadata file %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) );
                return error;
            }

            /* Duplicate good first frame metadata to fill the beginning of stream. */
#ifdef FIX_350_MASA_DELAY_COMP
            MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL;
            if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#else
            IVAS_MASA_QMETADATA_HANDLE qMetadata = NULL;
            if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &qMetadata ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                return error;
@@ -1378,11 +1369,7 @@ static ivas_error initOnFirstGoodFrame(

            for ( int16_t j = 0; j < numInitialBadFrames; ++j )
            {
#ifdef FIX_350_MASA_DELAY_COMP
                if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#else
                if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, qMetadata ) ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) );
                    return error;
@@ -1429,7 +1416,7 @@ static ivas_error decodeG192(
    ivas_error error = IVAS_ERR_UNKNOWN;
    uint16_t numObj = 0;
    IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN;
    IVAS_POSITION Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
    IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];

    IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS];
    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
@@ -1642,23 +1629,14 @@ static ivas_error decodeG192(
            }
            else if ( bsFormat == IVAS_DEC_BS_MASA )
            {
#ifdef FIX_350_MASA_DELAY_COMP
                MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#else
                IVAS_MASA_QMETADATA_HANDLE qMetadata;
                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &qMetadata ) ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
                }

#ifdef FIX_350_MASA_DELAY_COMP
                if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#else
                if ( ( error = MasaFileWriter_writeFrame( masaWriter, qMetadata ) ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) );
                    goto cleanup;
+1 −12
Original line number Diff line number Diff line
@@ -536,7 +536,7 @@ int main(
    int32_t delayTimeScale = 0;
    int16_t i, numChannels;
    ivas_error error = IVAS_ERR_OK;
    IVAS_POSITION Pos[RENDERER_HEAD_POSITIONS_PER_FRAME];
    IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME];

#ifdef WMOPS
    reset_wmops();
@@ -645,9 +645,6 @@ int main(
                fprintf( stderr, "Sampling rate must be specified on command line when using raw PCM input\n" );
                exit( -1 );
            }
#ifndef FIX_389_EXT_REND_PCM_SR
            args.sampleRate = inFileSampleRate;
#endif
            break;
        default:
            fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
@@ -675,11 +672,7 @@ int main(
    }

    /* === Configure === */
#ifdef FIX_392_LATE_REVERB
    if ( ( error = IVAS_REND_InitConfig( hIvasRend, args.outConfig.audioConfig ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_REND_InitConfig( hIvasRend, ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) || ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL ) ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "Error in Renderer Config Init\n" );
        exit( -1 );
@@ -971,12 +964,8 @@ int main(
        }
        else
        {
#ifdef FIX_379_EXT_METADATA
            error = IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL );
            if ( ( error != IVAS_ERR_OK ) && ( error != IVAS_ERR_INVALID_OUTPUT_FORMAT ) ) // VE: TBC
#else
            if ( ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ) ) != IVAS_ERR_OK ) && ( IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ) != IVAS_ERR_INVALID_OUTPUT_FORMAT ) ) // VE: TBC
#endif
            {
                fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) );
                exit( -1 );
+26 −21
Original line number Diff line number Diff line
@@ -536,6 +536,9 @@ ivas_error config_acelp1(
    const int16_t tdm_lp_reuse_flag, /* i  : LPC reuse flag (can be 1 only with secondary channel */
    const int16_t tdm_low_rate_mode, /* i  : secondary channel low rate mode flag */
    const int16_t idchan,            /* i  : stereo channel ID               */
#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE
    const int16_t active_cnt, /* i  : Active frame counter            */
#endif
    const int16_t tdm_Pitch_reuse_flag, /* i  : primary channel pitch reuse flag*/
    const int16_t tdm_LRTD_flag,        /* i  : LRTD stereo mode flag           */
    const int16_t GSC_IVAS_mode         /* i  : GSC IVAS mode                   */
@@ -754,11 +757,12 @@ ivas_error config_acelp1(
            bits -= acelp_cfg->mid_lsf_bits;
        }
#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE
        else if ( tdm_lp_reuse_flag == 1 && idchan == 1 )
        else if ( tdm_lp_reuse_flag == 1 && idchan == 1 && active_cnt != 1 )
        {
            bits -= TDM_IC_LSF_PRED_BITS;
        }
#endif

        /* gain Q bit-budget - part 1 */
        if ( ( coder_type != UNVOICED && coder_type != AUDIO && coder_type != INACTIVE && !( core_brate <= ACELP_8k00 && coder_type != TRANSITION ) ) || ( coder_type == INACTIVE && total_brate > MAX_GSC_INACTIVE_BRATE ) )
        {
@@ -1323,6 +1327,7 @@ ivas_error config_acelp1(
                else
                {
                    int16_t nb_prm = 4;

                    if ( tdm_low_rate_mode == 1 )
                    {
                        nb_prm = 2;
+4 −7
Original line number Diff line number Diff line
@@ -833,13 +833,6 @@ static ivas_error write_indices_element(
            /* restore previous pointer position */
            pt_stream_loc = pt_stream_backup;
        }
#ifndef ISSUE_24_CLEANUP_MCT_LFE
        /* TODO implemented only for MCT for now */
        if ( ( st_ivas->hEncoderConfig->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_MCT ) && ( element_id * CPE_CHANNELS + n == LFE_CHANNEL ) )
        {
            continue;
        }
#endif
#ifdef ENABLE_BITRATE_VERIFICATION
        total_nb_bits =
#endif
@@ -1808,7 +1801,11 @@ ivas_error preview_indices(
                if ( bit_stream[2] == 0 )
                {
                    st_ivas->ivas_format = SBA_FORMAT;
#ifndef LBR_SBA
                    st_ivas->sba_mode = ivas_sba_mode_select( total_brate );
#else
                    st_ivas->sba_mode = ivas_sba_mode_select();
#endif
                }
                else
                {
+29 −2
Original line number Diff line number Diff line
@@ -1391,6 +1391,25 @@ enum
#define NPARTCLDFB                          10
#define NPART_SHAPING                       62

#ifdef ERI_FDCNGVQ_LOW_ROM
#define FDCNG_VQ_MAX_LEN        FD_CNG_maxN_37bits   
#define FDCNG_VQ_DCT_NSEGM      4   
#define FDCNG_VQ_DCT_MINTRUNC   8   
#define FDCNG_VQ_DCT_MAXTRUNC   18  
#define FDCNG_VQ_MAX_LEN_WB     21 

#define FDCNG_VQ_DCT_NPOST   8   

typedef enum _DCTTYPE
{
    DCT_T2_24_XX = 0, /* truncated DCT_T2_24 */
    IDCT_T2_XX_24 = 1,
    DCT_T2_21_XX = 2, /* truncated DCT_T2_21 */
    IDCT_T2_XX_21 = 3
} DCTTYPE;

#endif 

#define MSSUBFRLEN                          12
#define MSNUMSUBFR                          6
#define MSBUFLEN                            5
@@ -1415,7 +1434,12 @@ enum
#define CHEAP_NORM_SIZE                     161

#define CNA_MAX_BRATE                       ACELP_13k20

#ifdef FIX_I414_OOA_CNA
#define CNA_INIT_NBANDS                     6
#else
#define MAX_CNA_NBANDS                      12
#endif

#define GAIN_Q_OFFSET_EVS 60.f
#define GAIN_Q_OFFSET_IVAS 45.f
@@ -1513,7 +1537,10 @@ enum
#define TOD_NSPEC                           80                      /* number of spectral bins of the tonal detector */
#define TOD_THR_MASS                        0.86f                   /* initial value for the adaptive threshold of the tonal detector */
#define P2A_FACT                            0.9f                    /* long-term averaging factor for peak-to-average ratio */
#define THR_P2A                             80.0f                   /* threshold to detect strongly peaky signals */
#ifdef FIX_SP2A
#define THR_P2A_HIGH                        95.0f                   /* higher threshold to detect strongly peaky signals at low bitrates*/
#endif
#define THR_P2A                             80.0f                   /* lower threshold to detect strongly peaky signals at higher bitrates */

/*----------------------------------------------------------------------------------*
 * LD music post-filter constants
Loading