Loading apps/decoder.c +24 −1 Original line number Diff line number Diff line Loading @@ -196,7 +196,11 @@ int main( RotFileReader *refRotReader = NULL; Vector3PairFileReader *referenceVectorReader = NULL; ivas_error error = IVAS_ERR_UNKNOWN; #ifdef FIX_847_OUTPUT_PCM_BUFFER int16_t *pcmBuf = NULL; #else int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE]; #endif #ifdef SPLIT_REND_WITH_HEAD_ROT uint8_t splitRendBitsBuf[IVAS_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES]; #endif Loading Loading @@ -743,6 +747,21 @@ int main( } } #ifdef FIX_847_OUTPUT_PCM_BUFFER /*------------------------------------------------------------------------------------------* * Allocate output data buffer *------------------------------------------------------------------------------------------*/ int16_t pcmBufSize; if ( ( error = IVAS_DEC_GetOutputBufferSize( hIvasDec, &pcmBufSize ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nGetOutputBufferSize failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } pcmBuf = malloc( pcmBufSize * sizeof( int16_t ) ); #endif /*-----------------------------------------------------------------* * Decoding Loading Loading @@ -797,10 +816,14 @@ int main( cleanup: #ifdef FIX_847_OUTPUT_PCM_BUFFER free( pcmBuf ); #endif #ifdef DEBUG_SBA_AUDIO_DUMP IVAS_DEC_GetSbaDebugParams( hIvasDec, &numOutChannels, &numTransportChannels, &pca_ingest_channels ); #endif #endif if ( arg.hrtfReaderEnabled ) { IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL; Loading lib_com/ivas_error.h +7 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,9 @@ typedef enum IVAS_ERR_INVALID_FEC_CONFIG, IVAS_ERR_INVALID_FEC_OFFSET, IVAS_ERR_INVALID_INPUT_BUFFER_SIZE, #ifdef FIX_847_OUTPUT_PCM_BUFFER IVAS_ERR_INVALID_OUTPUT_BUFFER_SIZE, #endif IVAS_ERR_DTX_NOT_SUPPORTED, IVAS_ERR_UNEXPECTED_NULL_POINTER, IVAS_ERR_METADATA_NOT_EXPECTED, Loading Loading @@ -217,6 +220,10 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) return "Invalid FEC offset"; case IVAS_ERR_INVALID_INPUT_BUFFER_SIZE: return "Invalid input buffer size"; #ifdef FIX_847_OUTPUT_PCM_BUFFER case IVAS_ERR_INVALID_OUTPUT_BUFFER_SIZE: return "Invalid output buffer size"; #endif case IVAS_ERR_DTX_NOT_SUPPORTED: return "DTX is not supported in this IVAS format and element mode"; case IVAS_ERR_UNEXPECTED_NULL_POINTER: Loading lib_com/options.h +3 −1 Original line number Diff line number Diff line Loading @@ -159,7 +159,9 @@ #define FIX_712_713_SPLIT_REND_MASA_MC /*Dlb : Fix for issue 712 and 713*/ #endif #define FIX_818_DOUBLE_PREC_KERNEN_SW /* FhG: Issue 818: Avoid double precision in kernel switching */ #define FIX_818_DOUBLE_PREC_KERNEL_SW /* FhG: Issue 818: Avoid double precision in kernel switching */ #define FIX_822_REFACTOR_BIN_REVERB_OPEN /* Nokia: Addresses first step of issue 822 by refactoring ivas_binaural_reverb_open */ #define FIX_847_OUTPUT_PCM_BUFFER /* VA: issue 847: Allocate decoder output PCM buffer dynamically */ /* #################### End BE switches ################################## */ Loading lib_dec/ivas_binRenderer_internal.c +4 −0 Original line number Diff line number Diff line Loading @@ -1230,7 +1230,11 @@ ivas_error ivas_binRenderer_open( /* Allocate memories needed for reverb module */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { #ifdef FIX_822_REFACTOR_BIN_REVERB_OPEN if ( ( error = ivas_binaural_reverb_open_fastconv( &( hBinRenderer->hReverb ), hBinRenderer->conv_band, hBinRenderer->timeSlots, &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hIntSetup.output_config, st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_binaural_reverb_open( &( hBinRenderer->hReverb ), hBinRenderer->conv_band, hBinRenderer->timeSlots, &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hIntSetup.output_config, st_ivas->hDecoderConfig->output_Fs, RENDERER_BINAURAL_FASTCONV, st_ivas->hHrtfFastConv, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) #endif { return error; } Loading lib_dec/lib_dec.c +66 −0 Original line number Diff line number Diff line Loading @@ -1417,6 +1417,72 @@ ivas_error IVAS_DEC_GetFormat( } #ifdef FIX_847_OUTPUT_PCM_BUFFER /*---------------------------------------------------------------------* * getInputBufferSize() * * *---------------------------------------------------------------------*/ static int16_t getOutputBufferSize( const Decoder_Struct *st_ivas /* i : IVAS decoder handle */ ) { if ( st_ivas->hDecoderConfig == NULL ) { return -1; } if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) { return (int16_t) ( st_ivas->hDecoderConfig->output_Fs * ( IVAS_MAX_OUTPUT_CHANNELS + IVAS_MAX_NUM_OBJECTS ) / FRAMES_PER_SEC ); } else if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { if ( st_ivas->hLsSetupCustom == NULL ) { return -1; } return (int16_t) ( st_ivas->hDecoderConfig->output_Fs * ( st_ivas->hLsSetupCustom->num_spk + st_ivas->hLsSetupCustom->num_lfe ) / FRAMES_PER_SEC ); } else { return (int16_t) ( st_ivas->hDecoderConfig->output_Fs * st_ivas->hDecoderConfig->nchan_out / FRAMES_PER_SEC ); } } /*---------------------------------------------------------------------* * IVAS_DEC_GetOutputBufferSize() * * *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetOutputBufferSize( const IVAS_DEC_HANDLE hIvasDec, /* i : IVAS decoder handle */ int16_t *outputBufferSize /* o : total number of samples expected in the output buffer for current decoder configuration */ ) { if ( outputBufferSize == NULL || hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } *outputBufferSize = getOutputBufferSize( hIvasDec->st_ivas ); if ( *outputBufferSize == -1 ) { return IVAS_ERR_INVALID_OUTPUT_BUFFER_SIZE; } else { return IVAS_ERR_OK; } } #endif /*---------------------------------------------------------------------* * IVAS_DEC_GetNumOutputChannels( ) * Loading Loading
apps/decoder.c +24 −1 Original line number Diff line number Diff line Loading @@ -196,7 +196,11 @@ int main( RotFileReader *refRotReader = NULL; Vector3PairFileReader *referenceVectorReader = NULL; ivas_error error = IVAS_ERR_UNKNOWN; #ifdef FIX_847_OUTPUT_PCM_BUFFER int16_t *pcmBuf = NULL; #else int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE]; #endif #ifdef SPLIT_REND_WITH_HEAD_ROT uint8_t splitRendBitsBuf[IVAS_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES]; #endif Loading Loading @@ -743,6 +747,21 @@ int main( } } #ifdef FIX_847_OUTPUT_PCM_BUFFER /*------------------------------------------------------------------------------------------* * Allocate output data buffer *------------------------------------------------------------------------------------------*/ int16_t pcmBufSize; if ( ( error = IVAS_DEC_GetOutputBufferSize( hIvasDec, &pcmBufSize ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nGetOutputBufferSize failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } pcmBuf = malloc( pcmBufSize * sizeof( int16_t ) ); #endif /*-----------------------------------------------------------------* * Decoding Loading Loading @@ -797,10 +816,14 @@ int main( cleanup: #ifdef FIX_847_OUTPUT_PCM_BUFFER free( pcmBuf ); #endif #ifdef DEBUG_SBA_AUDIO_DUMP IVAS_DEC_GetSbaDebugParams( hIvasDec, &numOutChannels, &numTransportChannels, &pca_ingest_channels ); #endif #endif if ( arg.hrtfReaderEnabled ) { IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL; Loading
lib_com/ivas_error.h +7 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,9 @@ typedef enum IVAS_ERR_INVALID_FEC_CONFIG, IVAS_ERR_INVALID_FEC_OFFSET, IVAS_ERR_INVALID_INPUT_BUFFER_SIZE, #ifdef FIX_847_OUTPUT_PCM_BUFFER IVAS_ERR_INVALID_OUTPUT_BUFFER_SIZE, #endif IVAS_ERR_DTX_NOT_SUPPORTED, IVAS_ERR_UNEXPECTED_NULL_POINTER, IVAS_ERR_METADATA_NOT_EXPECTED, Loading Loading @@ -217,6 +220,10 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) return "Invalid FEC offset"; case IVAS_ERR_INVALID_INPUT_BUFFER_SIZE: return "Invalid input buffer size"; #ifdef FIX_847_OUTPUT_PCM_BUFFER case IVAS_ERR_INVALID_OUTPUT_BUFFER_SIZE: return "Invalid output buffer size"; #endif case IVAS_ERR_DTX_NOT_SUPPORTED: return "DTX is not supported in this IVAS format and element mode"; case IVAS_ERR_UNEXPECTED_NULL_POINTER: Loading
lib_com/options.h +3 −1 Original line number Diff line number Diff line Loading @@ -159,7 +159,9 @@ #define FIX_712_713_SPLIT_REND_MASA_MC /*Dlb : Fix for issue 712 and 713*/ #endif #define FIX_818_DOUBLE_PREC_KERNEN_SW /* FhG: Issue 818: Avoid double precision in kernel switching */ #define FIX_818_DOUBLE_PREC_KERNEL_SW /* FhG: Issue 818: Avoid double precision in kernel switching */ #define FIX_822_REFACTOR_BIN_REVERB_OPEN /* Nokia: Addresses first step of issue 822 by refactoring ivas_binaural_reverb_open */ #define FIX_847_OUTPUT_PCM_BUFFER /* VA: issue 847: Allocate decoder output PCM buffer dynamically */ /* #################### End BE switches ################################## */ Loading
lib_dec/ivas_binRenderer_internal.c +4 −0 Original line number Diff line number Diff line Loading @@ -1230,7 +1230,11 @@ ivas_error ivas_binRenderer_open( /* Allocate memories needed for reverb module */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { #ifdef FIX_822_REFACTOR_BIN_REVERB_OPEN if ( ( error = ivas_binaural_reverb_open_fastconv( &( hBinRenderer->hReverb ), hBinRenderer->conv_band, hBinRenderer->timeSlots, &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hIntSetup.output_config, st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_binaural_reverb_open( &( hBinRenderer->hReverb ), hBinRenderer->conv_band, hBinRenderer->timeSlots, &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hIntSetup.output_config, st_ivas->hDecoderConfig->output_Fs, RENDERER_BINAURAL_FASTCONV, st_ivas->hHrtfFastConv, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) #endif { return error; } Loading
lib_dec/lib_dec.c +66 −0 Original line number Diff line number Diff line Loading @@ -1417,6 +1417,72 @@ ivas_error IVAS_DEC_GetFormat( } #ifdef FIX_847_OUTPUT_PCM_BUFFER /*---------------------------------------------------------------------* * getInputBufferSize() * * *---------------------------------------------------------------------*/ static int16_t getOutputBufferSize( const Decoder_Struct *st_ivas /* i : IVAS decoder handle */ ) { if ( st_ivas->hDecoderConfig == NULL ) { return -1; } if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) { return (int16_t) ( st_ivas->hDecoderConfig->output_Fs * ( IVAS_MAX_OUTPUT_CHANNELS + IVAS_MAX_NUM_OBJECTS ) / FRAMES_PER_SEC ); } else if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { if ( st_ivas->hLsSetupCustom == NULL ) { return -1; } return (int16_t) ( st_ivas->hDecoderConfig->output_Fs * ( st_ivas->hLsSetupCustom->num_spk + st_ivas->hLsSetupCustom->num_lfe ) / FRAMES_PER_SEC ); } else { return (int16_t) ( st_ivas->hDecoderConfig->output_Fs * st_ivas->hDecoderConfig->nchan_out / FRAMES_PER_SEC ); } } /*---------------------------------------------------------------------* * IVAS_DEC_GetOutputBufferSize() * * *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetOutputBufferSize( const IVAS_DEC_HANDLE hIvasDec, /* i : IVAS decoder handle */ int16_t *outputBufferSize /* o : total number of samples expected in the output buffer for current decoder configuration */ ) { if ( outputBufferSize == NULL || hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } *outputBufferSize = getOutputBufferSize( hIvasDec->st_ivas ); if ( *outputBufferSize == -1 ) { return IVAS_ERR_INVALID_OUTPUT_BUFFER_SIZE; } else { return IVAS_ERR_OK; } } #endif /*---------------------------------------------------------------------* * IVAS_DEC_GetNumOutputChannels( ) * Loading