Commit 01fc7c7d authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch 'ivas-float-update' into 000_ref_mdct-stereo-comfort-noise-fix

parents 1903084a 312fc774
Loading
Loading
Loading
Loading
Loading
+16 −5
Original line number Diff line number Diff line
@@ -1681,6 +1681,18 @@ static bool parseCmdlIVAS_dec(
        return false;
    }

#ifdef SUPPORT_JBM_TRACEFILE
    /* Validate options that depend on other options */
    if ( arg->jbmTraceFilename != NULL && arg->delayCompensationEnabled
         /* This decMode check should be removed once timestamp sync issues between JBM trace and audio are fixed in EVS */
         && arg->decMode != IVAS_DEC_MODE_EVS )
    {
        fprintf( stderr, "Error: Writing to a JBM trace file requires delay compensation to be disabled with -no_delay_cmp\n\n" );
        usage_dec();
        return false;
    }
#endif

    return true;
}

@@ -1717,7 +1729,8 @@ static void usage_dec( void )
    fprintf( stdout, "                      EVS RTP Payload Format. The SDP parameter hf_only is required.\n" );
    fprintf( stdout, "                      Reading RFC4867 AMR/AMR-WB RTP payload format is not supported.\n" );
#ifdef SUPPORT_JBM_TRACEFILE
    fprintf( stdout, "-Tracefile TF       : VoIP mode: Generate trace file named TF\n" );
    fprintf( stdout, "-Tracefile TF       : VoIP mode: Generate trace file named TF. Requires -no_delay_cmp to\n" );
    fprintf( stdout, "                      be enabled so that trace contents remain in sync with audio output.\n" );
#endif
#ifdef DEBUGGING
#ifdef VARIABLE_SPEED_DECODING
@@ -1922,7 +1935,6 @@ static ivas_error initOnFirstGoodFrame(
        }
    }


    int16_t pcmFrameSize;
    if ( ( error = IVAS_DEC_GetOutputBufferSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK )
    {
@@ -1930,13 +1942,13 @@ static ivas_error initOnFirstGoodFrame(
        return error;
    }

    int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) );
    /* Write zeros to the output audio buffer */
    int16_t *zeroBuf = calloc( pcmFrameSize, sizeof( int16_t ) );
    if ( zeroBuf == NULL )
    {
        fprintf( stdout, "Error: Unable to allocate memory for output buffer.\n" );
        return IVAS_ERR_FAILED_ALLOC;
    }
    memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) );

    for ( int16_t i = 0; i < numInitialBadFrames; ++i )
    {
@@ -1960,7 +1972,6 @@ static ivas_error initOnFirstGoodFrame(
        }
        else
        {

            if ( *pRemainingDelayNumSamples < *numOutSamples )
            {
                if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, *numOutSamples * *pNumOutChannels - ( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK )
+5 −0
Original line number Diff line number Diff line
@@ -172,8 +172,13 @@ typedef enum
#define JBM_CLDFB_SLOTS_IN_SUBFRAME             4
#define MAX_JBM_CLDFB_TIMESLOTS                 32
#define DEFAULT_JBM_CLDFB_TIMESLOTS             16
#ifdef JBM_MEMORY_OPT
#define MAX_JBM_L_FRAME48k                      ( IVAS_MAX_FRAME_SIZE * 2 ) /* 1920:  max. time-scaled frame buffer length (per channel) in samples */
#define MAX_JBM_L_FRAME_NS                      40000000L                   /* 40 ms: time-scaled frame size in ns, proportional to MAX_JBM_L_FRAME48k  */
#else
#define MAX_JBM_L_FRAME48k                      1920
#define MAX_JBM_L_FRAME_NS                      40000000L
#endif
#define MAX_SPAR_INTERNAL_CHANNELS              IVAS_SPAR_MAX_CH
#define MAX_CLDFB_DIGEST_CHANNELS               3                           /* == maximum of ParamISM TCs and ParamMC TCs */

+21 −3
Original line number Diff line number Diff line
@@ -262,13 +262,28 @@ uint32_t ivas_syn_output(
    int16_t *synth_out                                          /* o  : integer 16 bits synthesis signal        */
);

#ifdef JBM_MEMORY_OPT
void ivas_buffer_interleaved_to_deinterleaved(
    float *audio,                                               /* i/o: audio buffer                            */
    const int16_t n_channels,                                   /* i  : number of channels                      */
    const int16_t frame_length,                                 /* i  : frame length (one channel)              */
    const int16_t n_samp_full                                   /* i  : full frame length (one channel)         */
);

void ivas_buffer_deinterleaved_to_interleaved(
    float *audio[],                                             /* i  : deinterleaved audio buffer              */
    const int16_t n_channels,                                   /* i  : number of channels                      */
    const int16_t frame_length,                                 /* i  : frame length (one channel)              */
    float *audio_out                                            /* o  : interleaved audio buffer                */
);
#else
void ivas_syn_output_f(
    float *synth[],                                             /* i/o: float synthesis signal                  */
    const int16_t output_frame,                                 /* i  : output frame length (one channel)       */
    const int16_t n_channels,                                   /* i  : number of output channels               */
    float *synth_out                                            /* o  : integer 16 bits synthesis signal        */
);

#endif
void ivas_initialize_handles_enc(
    Encoder_Struct *st_ivas                                     /* i/o: IVAS encoder structure                  */
);
@@ -846,8 +861,11 @@ ivas_error ivas_jbm_dec_flush_renderer(
void ivas_jbm_dec_feed_tc_to_renderer(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                                      */
    const int16_t nSamplesForRendering,                         /* i  : number of TC samples available for rendering                */
    int16_t *nSamplesResidual,                                  /* o  : number of samples not fitting into the renderer grid and buffer for the next call*/
    float *data                                                 /* i/o: transport channels/output synthesis signal                  */
    int16_t *nSamplesResidual                                   /* o  : number of samples not fitting into the renderer grid and buffer for the next call*/
#ifndef JBM_MEMORY_OPT
    ,
    float *data                                                 /* i/o: time-scaled transport channels                              */
#endif
);

void ivas_dec_prepare_renderer(
+65 −1
Original line number Diff line number Diff line
@@ -148,6 +148,70 @@ uint32_t ivas_syn_output(
    return noClipping;
}

#ifdef JBM_MEMORY_OPT

/*-------------------------------------------------------------------*
 * ivas_buffer_interleaved_to_deinterleaved()
 *
 * Convert an interleaved buffer of audio channels to deinterleaved one
 *-------------------------------------------------------------------*/

void ivas_buffer_interleaved_to_deinterleaved(
    float *audio,               /* i/o: audio buffer                    */
    const int16_t n_channels,   /* i  : number of channels              */
    const int16_t frame_length, /* i  : frame length (one channel)      */
    const int16_t n_samp_full   /* i  : full frame length (one channel) */
)
{
    int16_t offset, ch, m;
    float buffer[MAX_TRANSPORT_CHANNELS][MAX_JBM_L_FRAME48k];

    for ( ch = 0; ch < n_channels; ch++ )
    {
        for ( m = 0; m < frame_length; m++ )
        {
            buffer[ch][m] = audio[m * n_channels + ch];
        }
    }

    offset = 0;
    for ( ch = 0; ch < n_channels; ch++ )
    {
        mvr2r( buffer[ch], audio + offset, frame_length );
        offset += n_samp_full;
    }

    return;
}


/*-------------------------------------------------------------------*
 * ivas_buffer_deinterleaved_to_interleaved()
 *
 * Convert a deinterleaved buffer of audio channels to interleaved one
 *-------------------------------------------------------------------*/

void ivas_buffer_deinterleaved_to_interleaved(
    float *audio[],             /* i/o: deinterleaved audio buffer      */
    const int16_t n_channels,   /* i  : number of channels              */
    const int16_t frame_length, /* i  : frame length (one channel)      */
    float *audio_out            /* o  : interleaved audio buffer        */
)
{
    int16_t ch, m;

    for ( ch = 0; ch < n_channels; ch++ )
    {
        for ( m = 0; m < frame_length; m++ )
        {
            audio_out[m * n_channels + ch] = audio[ch][m];
        }
    }

    return;
}

#else

/*-------------------------------------------------------------------*
 * ivas_syn_output_f()
@@ -180,7 +244,7 @@ void ivas_syn_output_f(

    return;
}

#endif

/*-------------------------------------------------------------------*
 * mvr2r_inc()
+3 −0
Original line number Diff line number Diff line
@@ -146,6 +146,7 @@
#endif /* DEBUGGING */

/*#define DISABLE_LIMITER*/                     /* disable the limiter - needed for testing Bitexactness between different renderer framings */
/*#define DEBUG_APA_SILENCE_NON_SCALED*/        /* Switch APA into mode that replaces contents of non-scaled frames with silence. Useful for identifying scaled regions in the audio output of the decoder  */

/* #################### End DEBUGGING switches ############################ */

@@ -183,9 +184,11 @@
#define FIX_1288_SPLIT_REND_XSAN                        /* Dlb: Fix asan, msan and usan issues in split rendering mode*/
#define FIX_NCHAN_BUFFERS                               /* VA: issue 1322: Correct the number of float buffers (channels) at the decoder */
#define FIX_RENDERER_STACK                              /* VA: issue 1322: reduction of renderers' buffers size */
#define JBM_MEMORY_OPT                                  /* VA: issue 916: optimization of RAM in the JBM decoder */
#define FIX_1370_EXTERNAL_ORIENTATION_CHECK             /* Nokia: add sanity check for Euler angles for external orientations */
#define FIX_1413_IGF_INIT_PRINTOUT                      /* FhG: use correct variable for IGF initiliazation */
#define NONBE_MDCT_ST_DTX_FIX_SUBOPT_SPATIAL_CNG       /* FhG: Fix MDCT-Stereo comfort noise for certain noise types */
#define CODE_IMPROVEMENTS

// object-editing feature porting
#define FIX_HRTF_LOAD_API                               // solves API conflicts between HRTF and object-editing features
Loading