Commit 7f549400 authored by sagnowski's avatar sagnowski
Browse files

Fix problems with too small decoder output buffer

parent a9162a8d
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ ivas_error ivas_dec(
    Decoder_State *st;                                                                                                     /* used for bitstream handling */
#ifdef FLOAT_INTERFACE_DEC_REND
    float* output[MAX_OUTPUT_CHANNELS];
    float outputMemory[MAX_OUTPUT_CHANNELS * L_FRAME48k]; /* TODO(sgi): find a nicer solution */
#else
    float output[MAX_OUTPUT_CHANNELS][L_FRAME48k]; /* 'float' buffer for output synthesis, MAX_OUTPUT_CHANNELS channels */ /* IVAS_fmToDo: buffer can be allocated dynamically based on the actual number of output channels */
#endif
@@ -118,8 +119,11 @@ ivas_error ivas_dec(
     *
     * Lib user only provides the mono buffer, so additional space needs to be allocated within the library
     * for the first step when `num_channels(bitstream_format) > num_channels(output_format)`.
     * 
     * Currently this is solved by allocating `outputMemory` as the underlying buffer of `output` and
     * copying from `outputMemory` to `data` at the end of this function.
     */
    save_channel_pointers( data, nchan_out, output_frame, output );
    save_channel_pointers( outputMemory, MAX_OUTPUT_CHANNELS, output_frame, output );
#endif

    /*----------------------------------------------------------------*
@@ -617,7 +621,9 @@ ivas_error ivas_dec(

    ivas_limiter_dec( st_ivas->hLimiter, output, nchan_out, output_frame, st_ivas->BER_detect );

#ifndef FLOAT_INTERFACE_DEC_REND
#ifdef FLOAT_INTERFACE_DEC_REND
    mvr2r( outputMemory, data, output_frame * nchan_out );
#else
    /* float to integer conversion moved to IVAS_DEC_GetSamples() */
#ifdef DEBUGGING
    st_ivas->noClipping +=