From 4b95483bf1e1564842053da5902feeba02ba07dd Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 7 Aug 2023 09:53:37 +0200 Subject: [PATCH 1/9] add 5ms framing commandline option to renderer --- apps/renderer.c | 24 +++++++++++++++++++++++- lib_com/options.h | 1 + 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/apps/renderer.c b/apps/renderer.c index 817b423383..2d16e4180e 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -175,6 +175,9 @@ typedef struct float lfeConfigElevation; bool lfeCustomRoutingEnabled; char inLfePanningMatrixFile[RENDERER_MAX_CLI_ARG_LENGTH]; +#ifdef API_5MS + bool framing_5ms; +#endif #ifdef FIX_488_SYNC_DELAY float syncMdDelay; #endif @@ -206,6 +209,9 @@ typedef enum #endif CmdLnOptionId_referenceVectorFile, CmdLnOptionId_exteriorOrientationFile, +#ifdef API_5MS + CmdLnOptionId_framing5ms, +#endif #ifdef FIX_488_SYNC_DELAY CmdLnOptionId_syncMdDelay, #endif @@ -348,6 +354,14 @@ static const CmdLnParser_Option cliOptions[] = { .matchShort = "exof", .description = "External orientation trajectory file for simulation of external orientations", }, +#ifdef API_5MS + { + .id = CmdLnOptionId_framing5ms, + .match = "framing_5ms", + .matchShort = "fr5", + .description = "Process audio with 5 ms framing. Time resolution of metadata (e.g. ISM positions) remains unchanged w.r.t. 20 ms framing", + }, +#endif #ifdef FIX_488_SYNC_DELAY { .id = CmdLnOptionId_syncMdDelay, @@ -2509,7 +2523,9 @@ static CmdlnArgs defaultArgs( args.lfeCustomRoutingEnabled = false; clearString( args.inLfePanningMatrixFile ); - +#ifdef API_5MS + args.framing_5ms = false; +#endif #ifdef FIX_488_SYNC_DELAY args.syncMdDelay = 0; #endif @@ -2652,6 +2668,12 @@ static void parseOption( exit( -1 ); } break; +#ifdef API_5MS + case CmdLnOptionId_framing5ms: + assert( numOptionValues == 0 ); + args->framing_5ms = true; + break; +#endif #ifdef FIX_488_SYNC_DELAY case CmdLnOptionId_syncMdDelay: assert( numOptionValues == 1 ); diff --git a/lib_com/options.h b/lib_com/options.h index 07d9d40355..9f66bf920a 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -155,6 +155,7 @@ #define FIX_137_SID_MD_BITS /* Dlb: Fix issue #137 , SID bitrate mismatch correction */ #define FIX_470_MASA_JBM_EXT /* Nokia: Issue 470, fix MASA EXT output with JBM */ #define FIX_564 /* Nokia: Issue 564: Fix gains in JBM path for SBA with parametric binaural renderer */ +#define API_5MS /* FhG: 5ms rendering capability */ #define FIX_559_EXTL_IGF_MISMATCH /* VA: issue 559: fix mismatch between st->extl and st->igf observed as crash in PlanarSBA bitrate switching */ #define FIX_571_REVERB_NOT_ACTIVATED_ISM /* Philips: Issue 571: Reverb not activated for discrete and parametric ISM */ #define FIX_QMETA_SID_5k2 /* Nokia: Issue 137: enable using full 5.2k bitrate in MASA SID */ -- GitLab From ac9f9d171f157c5ae8b0a4e3373f38d681416824 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 10 Aug 2023 15:37:13 +0200 Subject: [PATCH 2/9] [revertme] tmp disable limiter --- lib_com/options.h | 1 + lib_dec/ivas_dec.c | 2 ++ lib_dec/ivas_jbm_dec.c | 6 +++++- lib_rend/lib_rend.c | 4 ++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 486ceb7169..7e96441fb9 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -129,6 +129,7 @@ #define DEBUG_JBM_CMD_OPTION /* ability for telling the decoder the frontend fetch size and to not delay compensate for bad frames at the beginning */ #define VARIABLE_SPEED_DECODING /* variable speed decoding employing the JBM functioniality; move to DEBUGGING after build for disabled is fixed */ #define DEBUG_IND_LIST_MEMORY /* raise assert() when ind_list[] runs out of memory */ +#define DISABLE_LIMITER /* disable limiter to help with debugging BE */ /*Split Rendering Debug switches*/ /*#define DBG_WAV_WRITER*/ /* add debugging function dbgwrite_wav() */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 70136e9592..6d2528dbb6 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -1014,7 +1014,9 @@ ivas_error ivas_dec( * - float to integer conversion *----------------------------------------------------------------*/ +#ifndef DISABLE_LIMITER ivas_limiter_dec( st_ivas->hLimiter, p_output, nchan_out, output_frame, st_ivas->BER_detect ); +#endif #ifdef DEBUGGING st_ivas->noClipping += diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 276fdff4e3..fa3301f0d3 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1054,7 +1054,9 @@ ivas_error ivas_jbm_dec_render( st_ivas->hTcBuffer->n_samples_discard = 0; } +#ifndef DISABLE_LIMITER ivas_limiter_dec( st_ivas->hLimiter, p_output, nchan_out, *nSamplesRendered, st_ivas->BER_detect ); +#endif #ifdef DEBUGGING st_ivas->noClipping += @@ -1204,8 +1206,10 @@ ivas_error ivas_jbm_dec_flush_renderer( } } - /* Only write out the valid data*/ +/* Only write out the valid data*/ +#ifndef DISABLE_LIMITER ivas_limiter_dec( st_ivas->hLimiter, p_output, st_ivas->hDecoderConfig->nchan_out, *nSamplesRendered, st_ivas->BER_detect ); +#endif #ifdef DEBUGGING st_ivas->noClipping += diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 253c1d84b6..9416c285fa 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8693,17 +8693,21 @@ ivas_error IVAS_REND_GetSamples( if ( outAudio.config.is_cldfb == 0 ) { +#ifndef DISABLE_LIMITER #ifdef DEBUGGING hIvasRend->numClipping += #endif limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); +#endif } #else /* SPLIT_REND_WITH_HEAD_ROT */ +#ifndef DISABLE_LIMITER #ifdef DEBUGGING hIvasRend->numClipping += #endif limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); +#endif #endif /* SPLIT_REND_WITH_HEAD_ROT */ #ifdef SPLIT_REND_WITH_HEAD_ROT -- GitLab From 095c1f9c03bee1cdbf30c9c4b5fb097f4bab5593 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Fri, 11 Aug 2023 17:52:51 +0200 Subject: [PATCH 3/9] [fix] zero padding in renderer to align with API_5MS branch --- apps/renderer.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index d0e1a3f7bb..3299659df3 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1967,12 +1967,28 @@ int main( if ( audioWriter != NULL ) { #endif - memset( outInt16Buffer, 0, zeroPad * outBuffer.config.numChannels * sizeof( int16_t ) ); - if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zeroPad * outBuffer.config.numChannels ) ) != IVAS_ERR_OK ) +#ifdef API_5MS + int32_t zerosPadded = 0; + zeroPad *= outBuffer.config.numChannels; + while ( zeroPad > 0 ) { - fprintf( stderr, "\nOutput audio file writer error\n" ); - exit( -1 ); + zerosPadded = min( zeroPad, outBufferSize ); + memset( outInt16Buffer, 0, zerosPadded * sizeof( int16_t ) ); + if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zerosPadded ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nOutput audio file writer error\n" ); + exit( -1 ); + } + zeroPad -= zerosPadded; } +#else + memset( outInt16Buffer, 0, zeroPad * outBuffer.config.numChannels * sizeof( int16_t ) ); + if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zeroPad * outBuffer.config.numChannels ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nOutput audio file writer error\n" ); + exit( -1 ); + } +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT } #endif -- GitLab From ccd5cbfeb8fd83c91d86c9b41c5ce870d3f4a20a Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Fri, 11 Aug 2023 18:37:20 +0200 Subject: [PATCH 4/9] [fix] renderer delay compensation as well to align with API_5MS branch --- apps/renderer.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 3299659df3..5e9bd89d36 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1856,7 +1856,11 @@ int main( if ( audioWriter != NULL ) { #endif - if ( delayNumSamples < outBufferSize ) +#ifdef API_5MS + if ( delayNumSamples < frameSize_smpls ) +#else + if ( delayNumSamples < outBufferSize ) +#endif { if ( AudioFileWriter_write( audioWriter, &outInt16Buffer[delayNumSamples * num_out_channels], outBufferSize - ( delayNumSamples * num_out_channels ) ) != IVAS_ERR_OK ) { @@ -1867,7 +1871,11 @@ int main( } else { - delayNumSamples -= (int16_t) outBufferSize; +#ifdef API_5MS + delayNumSamples -= (int16_t) frameSize_smpls; +#else + delayNumSamples -= (int16_t) outBufferSize; +#endif } #ifdef SPLIT_REND_WITH_HEAD_ROT } -- GitLab From 8c4ae155a894f433642f9b59ba9525d9d3cb7662 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Sun, 13 Aug 2023 13:48:00 +0200 Subject: [PATCH 5/9] [fix] restore removed API_5MS in options.h --- lib_com/options.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_com/options.h b/lib_com/options.h index 710b5a5044..6f9e6ca75b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -150,6 +150,7 @@ /* only BE switches wrt operation points tested in selection */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ +#define API_5MS /* FhG: 5ms rendering capability */ #define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ #ifdef SPLIT_REND_WITH_HEAD_ROT -- GitLab From 7313f8e4e893d9c60feb19e0e07999b47624ba3d Mon Sep 17 00:00:00 2001 From: Stefan Bayer Date: Tue, 15 Aug 2023 16:01:20 +0200 Subject: [PATCH 6/9] add dummy frame size fields to header for better comparison of SR MD bit streams --- lib_util/split_render_file_read_write.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index 9c69b3de1d..98ce1f0960 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -200,6 +200,18 @@ ivas_error split_rend_write_bitstream_to_file( return IVAS_ERR_FAILED_FILE_WRITE; } + /* write dummy header field for framelength*/ +#ifdef API_5MS + /* Write frame size signalling */ + { + int16_t codec_frame_size_ms = 20; + if ( fwrite( &codec_frame_size_ms, sizeof( codec_frame_size_ms ), 1, hSplitRendFileReadWrite->file ) != 1 ) + { + return IVAS_ERR_FAILED_FILE_WRITE; + } + } +#endif + /*write num bytes*/ if ( fwrite( bits_written, sizeof( int32_t ), 1, hSplitRendFileReadWrite->file ) != 1 ) { @@ -278,6 +290,17 @@ ivas_error split_rend_read_bits_from_file( { return IVAS_ERR_FAILED_FILE_READ; } +#ifdef API_5MS + /* read frame size signalling */ + { + int16_t codec_frame_size_ms; + if ( fread( &codec_frame_size_ms, sizeof( codec_frame_size_ms ), 1, hSplitRendFileReadWrite->file ) != 1 ) + { + return IVAS_ERR_FAILED_FILE_WRITE; + } + } +#endif + /*write num bytes*/ if ( fread( &bit_len, sizeof( int32_t ), 1, hSplitRendFileReadWrite->file ) != 1 ) -- GitLab From 0a0027ac6e072e57d07fa2b3154ba1e5dfd9a088 Mon Sep 17 00:00:00 2001 From: Stefan Bayer Date: Wed, 16 Aug 2023 06:26:21 +0200 Subject: [PATCH 7/9] local fix for #712 --- lib_com/options.h | 2 ++ lib_rend/lib_rend.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 6f9e6ca75b..785e923dea 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -152,6 +152,8 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define API_5MS /* FhG: 5ms rendering capability */ +#define FIX_RENDMC_LOCAL_ORIENTATION + #define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ #ifdef SPLIT_REND_WITH_HEAD_ROT #define SPLIT_REND_PRED_QUANT_63_PNTS diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 6a7d565180..6499f40a0a 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -6906,6 +6906,9 @@ static ivas_error renderMcToSplitBinaural( copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); /* Render */ +#ifdef FIX_RENDMC_LOCAL_ORIENTATION + pCombinedOrientationDataLocal = &combinedOrientationDataLocal; +#endif if ( ( error = ivas_td_binaural_renderer_ext( ( pos_idx == 0 ) ? &mcInput->tdRendWrapper : &mcInput->splitTdRendWrappers[pos_idx - 1], mcInput->base.inConfig, &mcInput->customLsInput, -- GitLab From f3281b00a13aa8d2f0211eab5b7cc8635865cb66 Mon Sep 17 00:00:00 2001 From: Stefan Bayer Date: Wed, 16 Aug 2023 10:33:02 +0200 Subject: [PATCH 8/9] local fix for #713, assure to use only the first subframe rotation for the default pose in MASA split pre rendering --- lib_com/options.h | 6 +++-- lib_rend/ivas_dirac_dec_binaural_functions.c | 25 ++++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 785e923dea..af0668034c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -152,13 +152,15 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define API_5MS /* FhG: 5ms rendering capability */ -#define FIX_RENDMC_LOCAL_ORIENTATION + #define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ #ifdef SPLIT_REND_WITH_HEAD_ROT #define SPLIT_REND_PRED_QUANT_63_PNTS #define SPLIT_REND_WITH_HEAD_ROT_PARAMBIN /* Nokia: Issue 623: Split rendering support for parambin renderer */ -#define FIX_658_SPLIT_REND_MASA /*Dlb : Fix for issue 658, uninitialized memory access in MASA in Split rendering 0DOF mode*/ +#define FIX_658_SPLIT_REND_MASA /*Dlb : Fix for issue 658, uninitialized memory access in MASA in Split rendering 0DOF mode*/ +#define FIX_RENDMC_LOCAL_ORIENTATION +#define FIX_SPLITREND_MASA_PRERENDERING #endif #define MASA_AND_OBJECTS /* Nokia: Combination of MASA and objects */ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 249edadc8c..76d2e86f76 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -935,16 +935,33 @@ static void ivas_dirac_dec_binaural_internal( } #endif +#ifdef FIX_SPLITREND_MASA_PRERENDERING + pMultiBinPoseData = &st_ivas->splitBinRend.splitrend.multiBinPoseData; +#endif if ( hCombinedOrientationData ) { - for ( i = 0; i < 3; i++ ) +#ifdef FIX_SPLITREND_MASA_PRERENDERING + if ( pMultiBinPoseData != NULL && pMultiBinPoseData->num_poses > 1 ) { - for ( j = 0; j < 3; j++ ) + for ( i = 0; i < 3; i++ ) { - Rmat[i][j] = hCombinedOrientationData->Rmat[subframe][i][j]; + for ( j = 0; j < 3; j++ ) + { + Rmat[i][j] = hCombinedOrientationData->Rmat[0][i][j]; + } + } + } + else +#endif + { + for ( i = 0; i < 3; i++ ) + { + for ( j = 0; j < 3; j++ ) + { + Rmat[i][j] = hCombinedOrientationData->Rmat[subframe][i][j]; + } } } - if ( nchan_transport == 2 ) { #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN -- GitLab From 4f1def57becec75724b16473dbfc9f790c7e7e64 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 16 Aug 2023 23:49:48 +0200 Subject: [PATCH 9/9] disable split rendering switch --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 7720aadee1..a9861785f2 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -153,7 +153,7 @@ #define API_5MS /* FhG: 5ms rendering capability */ -#define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ +/*#define SPLIT_REND_WITH_HEAD_ROT*/ /* Dlb,FhG: Split Rendering contributions 21 and 35 */ #ifdef SPLIT_REND_WITH_HEAD_ROT #define SPLIT_REND_PRED_QUANT_63_PNTS #define SPLIT_REND_WITH_HEAD_ROT_PARAMBIN /* Nokia: Issue 623: Split rendering support for parambin renderer */ -- GitLab