diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5035bd7088422d906060e8e347dc72c1271fa012..a34c6a76d85481fe18739440a351374c4135f629 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -172,15 +172,16 @@ if(NOT INCLUDE_SPLIT)
list(FILTER libRendSrcs EXCLUDE REGEX ".*lib_rend\/.*lc3plus.*\.c$")
list(FILTER libRendSrcs EXCLUDE REGEX ".*lib_rend\/.*ivas_cldfb_codec.*\.c$")
list(FILTER libRendSrcs EXCLUDE REGEX ".*lib_rend\/.*splitRend.*\.c$")
- list(FILTER libRendSrcs EXCLUDE REGEX ".*lib_rend\/.*ivas_CQMF.*\.c$")
+ list(FILTER libRendSrcs EXCLUDE REGEX ".*lib_rend\/.*splitrenderer.*\.c$")
+ list(FILTER libRendSrcs EXCLUDE REGEX ".*lib_rend\/.*ivas_lcld.*\.c$")
list(FILTER libRendSrcs EXCLUDE REGEX ".*lib_rend\/.*ivas_Pred.*\.c$")
list(FILTER libRendSrcs EXCLUDE REGEX ".*lib_rend\/.*ivas_RMSEnv.*\.c$")
list(FILTER libRendSrcs EXCLUDE REGEX ".*lib_rend\/.*ivas_PerceptualModel.*\.c$")
- list(FILTER libRendSrcs EXCLUDE REGEX ".*lib_rend\/.*ivas_lcld_tables.*\.c$")
+ list(FILTER libRendSrcs EXCLUDE REGEX ".*lib_rend\/.*ivas_lcld_rom_tables.*\.c$")
list(FILTER libRendHeaders EXCLUDE REGEX ".*lib_rend\/.*lc3plus.*\.h$")
list(FILTER libRendHeaders EXCLUDE REGEX ".*lib_rend\/.*splitRend.*\.h$")
list(FILTER libRendHeaders EXCLUDE REGEX ".*lib_rend\/.*ivas_cldfb_codec.*\.h$")
- list(FILTER libRendHeaders EXCLUDE REGEX ".*lib_rend\/.*ivas_lcld_tables.*\.h$")
+ list(FILTER libRendHeaders EXCLUDE REGEX ".*lib_rend\/.*ivas_lcld_rom_tables.*\.h$")
endif()
if(INCLUDE_SPLIT)
diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj
index 9cd48bcd8a2edc9ac9e13dcd97d0bfd1b835104e..7415fb432c45bd04a67f7c26af6ee5c83c915f01 100644
--- a/Workspace_msvc/lib_rend.vcxproj
+++ b/Workspace_msvc/lib_rend.vcxproj
@@ -145,12 +145,12 @@
-
+
+
+
-
-
@@ -178,7 +178,7 @@
-
+
@@ -191,20 +191,14 @@
-
+
-
-
-
-
-
-
-
-
+
+
+
-
diff --git a/Workspace_msvc/lib_rend.vcxproj.filters b/Workspace_msvc/lib_rend.vcxproj.filters
index 7bcbdd91e415fca1c6c4b279b32767c47eda9660..fd7b1620cec3d9166aaaabcc0ec924dcf5fe528c 100644
--- a/Workspace_msvc/lib_rend.vcxproj.filters
+++ b/Workspace_msvc/lib_rend.vcxproj.filters
@@ -155,15 +155,21 @@
rend_c
-
-
-
rend_c
rend_c
+
+ rend_c
+
+
+ rend_c
+
+
+ rend_c
+
@@ -194,15 +200,15 @@
rend_h
-
-
-
-
-
-
-
-
-
+
+ rend_h
+
+
+ rend_h
+
+
+ rend_h
+
diff --git a/apps/decoder.c b/apps/decoder.c
index d6cf41a4877b3639df5b271b82e3144b2352947e..3d59643ca8d9e25a29b6c0bf29b3c97be5e2a5a9 100644
--- a/apps/decoder.c
+++ b/apps/decoder.c
@@ -74,10 +74,7 @@ static
#else
#define MAX_OUTPUT_PCM_BUFFER_SIZE ( IVAS_MAX_OUTPUT_CHANNELS * IVAS_MAX_FRAME_SIZE )
#endif
-#ifdef SPLIT_REND_WITH_HEAD_ROT
-#define MAX_SPLIT_REND_BITRATE ( 768000 ) /* TODO tmu: unify with SPLIT_REND_MAX_BRATE ? */
-#define MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) MAX_SPLIT_REND_BITRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 )
-#endif
+
#define IVAS_PUBLIC_ORIENT_TRK_NONE ( 0 )
#define IVAS_PUBLIC_ORIENT_TRK_REF ( 1 )
@@ -207,7 +204,7 @@ int main(
ivas_error error = IVAS_ERR_UNKNOWN;
int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE];
#ifdef SPLIT_REND_WITH_HEAD_ROT
- uint8_t splitRendBitsBuf[MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES];
+ uint8_t splitRendBitsBuf[IVAS_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES];
#endif
RenderConfigReader *renderConfigReader = NULL;
#ifdef DEBUGGING
@@ -272,7 +269,21 @@ int main(
}
}
- fprintf( stdout, "Output synthesis file: %s\n", arg.outputWavFilename );
+#ifdef SPLIT_REND_WITH_HEAD_ROT
+ if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED )
+ {
+ fprintf( stdout, "Output metadata file: %s\n", arg.outputWavFilename );
+ }
+ else if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
+ {
+ fprintf( stdout, "Output synthesis file: %s\n", arg.outputWavFilename );
+ fprintf( stdout, "Output metadata file: %s\n", arg.outputMdFilename );
+ }
+ else
+#endif
+ {
+ fprintf( stdout, "Output synthesis file: %s\n", arg.outputWavFilename );
+ }
/*------------------------------------------------------------------------------------------*
* Open HRTF file
@@ -424,17 +435,28 @@ int main(
}
}
+#ifdef SPLIT_REND_WITH_HEAD_ROT
/*------------------------------------------------------------------------------------------*
- * Configure the decoder
+ * Binaural split rendering sanity checks
*------------------------------------------------------------------------------------------*/
-#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
arg.enableHeadRotation = true;
+
+ if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM && arg.outputMdFilename == NULL )
+ {
+ fprintf( stderr, "\nError: split rendering metadata output file not specified.\n\n" );
+ usage_dec();
+ goto cleanup;
+ }
}
#endif
+ /*------------------------------------------------------------------------------------------*
+ * Configure the decoder
+ *------------------------------------------------------------------------------------------*/
+
if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -1560,13 +1582,13 @@ static void usage_dec( void )
fprintf( stdout, "-T File : Head rotation specified by external trajectory File\n" );
fprintf( stdout, "-otr tracking_type : Head orientation tracking type: 'none', 'ref', 'avg', 'ref_vec' \n" );
fprintf( stdout, " or 'ref_vec_lev' (only for binaural rendering)\n" );
- fprintf( stdout, "-rf File : Reference rotation specified by external trajectory file\n" );
+ fprintf( stdout, "-rf File : Reference rotation specified by external trajectory File\n" );
fprintf( stdout, " works only in combination with '-otr ref' mode \n" );
- fprintf( stdout, "-rvf File : Reference vector specified by external trajectory file\n" );
+ fprintf( stdout, "-rvf File : Reference vector specified by external trajectory File\n" );
fprintf( stdout, " works only in combination with '-otr ref_vec' and 'ref_vec_lev' modes\n" );
fprintf( stdout, "-render_config File : Renderer configuration File\n" );
#ifdef SPLIT_REND_WITH_HEAD_ROT
- fprintf( stdout, "-om File : MD output file for BINAURAL_SPLIT_PCM output format\n" );
+ fprintf( stdout, "-om File : Metadata output File for BINAURAL_SPLIT_PCM OutputConf (only for Fs = 48 kHz)\n" );
#endif
fprintf( stdout, "-non_diegetic_pan P : panning mono non-diegetic sound to stereo with paning P, -90<= P <=90,\n" );
fprintf( stdout, " left or l or 90->left, right or r or -90->right, center or c or 0->middle\n" );
@@ -1578,7 +1600,7 @@ static void usage_dec( void )
fprintf( stdout, " default is OFF, if this option is not used\n" );
fprintf( stdout, "-force R : Force specific binaural rendering mode, R = (TDREND, CLDFBREND),\n" );
#endif
- fprintf( stdout, "-exof File : External orientation file for external orientation trajectory\n" );
+ fprintf( stdout, "-exof File : External orientation File for external orientation trajectory\n" );
fprintf( stdout, "-dpid ID : Directivity pattern ID(s) (space-separated list of up to 4 numbers can be specified) for binaural output configuration\n" );
fprintf( stdout, "-aeid ID : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration\n" );
fprintf( stdout, "-level level : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" );
@@ -1610,6 +1632,13 @@ static int16_t app_own_random( int16_t *seed )
}
#endif
+
+/*---------------------------------------------------------------------*
+ * initOnFirstGoodFrame()
+ *
+ *
+ *---------------------------------------------------------------------*/
+
static ivas_error initOnFirstGoodFrame(
IVAS_DEC_HANDLE hIvasDec, /* i/o: */
const DecArguments arg, /* i : */
@@ -1638,9 +1667,9 @@ static ivas_error initOnFirstGoodFrame(
fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) );
return error;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ||
- ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) )
+ if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
pFullDelayNumSamples[0] = 0;
}
@@ -1667,8 +1696,9 @@ static ivas_error initOnFirstGoodFrame(
}
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED )
+ if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
+ /* Open split rendering metadata writer */
int16_t delayNumSamples_temp[3];
int32_t delayTimeScale_temp;
@@ -1678,35 +1708,27 @@ static ivas_error initOnFirstGoodFrame(
return error;
}
- if ( ( error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputWavFilename, delayNumSamples_temp[0], delayTimeScale_temp ) ) != IVAS_ERR_OK )
+ if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED )
{
- fprintf( stderr, "Could not open split rend metadata file %s\n", arg.outputWavFilename );
- return error;
- }
-
- *ppAfWriter = NULL;
- }
- else
- {
- if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
- {
- int16_t delayNumSamples_temp[3];
- int32_t delayTimeScale_temp;
-
- if ( ( error = IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ) ) != IVAS_ERR_OK )
+ if ( ( error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputWavFilename, delayNumSamples_temp[0], delayTimeScale_temp ) ) != IVAS_ERR_OK )
{
- fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) );
+ fprintf( stderr, "\nUnable to open output split rendering metadata file %s\n", arg.outputWavFilename );
return error;
}
-
+ }
+ else
+ {
if ( ( error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputMdFilename, delayNumSamples_temp[0], delayTimeScale_temp ) ) != IVAS_ERR_OK )
{
- fprintf( stderr, "Could not open split rend metadata file %s\n", arg.outputWavFilename );
+ fprintf( stderr, "\nUnable to open output split rendering metadata file %s\n", arg.outputWavFilename );
return error;
}
}
-#endif
+ }
+ if ( arg.outputConfig != AUDIO_CONFIG_BINAURAL_SPLIT_CODED )
+ {
+#endif
/* Open audio writer and write all previously skipped bad frames now that frame size is known */
if ( ( error = AudioFileWriter_open( ppAfWriter, arg.outputWavFilename, arg.output_Fs, *pNumOutChannels ) ) != IVAS_ERR_OK )
{
@@ -1717,7 +1739,6 @@ static ivas_error initOnFirstGoodFrame(
}
#endif
-
int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) );
memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) );
@@ -1726,11 +1747,11 @@ static ivas_error initOnFirstGoodFrame(
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( *hSplitRendFileReadWrite != NULL )
{
- IVAS_SPLIT_REND_BITS splitRendBitsZero;
+ IVAS_SPLIT_REND_BITS_DATA splitRendBitsZero;
splitRendBitsZero.bits_written = 0;
splitRendBitsZero.bits_read = 0;
- if ( split_rend_write_bitstream_to_file( *hSplitRendFileReadWrite, splitRendBitsZero.bits_buf, &splitRendBitsZero.bits_read, &splitRendBitsZero.bits_written,
- -1, IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) != IVAS_ERR_OK )
+
+ if ( split_rend_write_bitstream_to_file( *hSplitRendFileReadWrite, splitRendBitsZero.bits_buf, &splitRendBitsZero.bits_read, &splitRendBitsZero.bits_written, -1, IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nUnable to write to bitstream file!\n" );
exit( -1 );
@@ -1898,12 +1919,9 @@ static ivas_error decodeG192(
uint16_t numObj = 0;
IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN;
IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
-
#ifdef SPLIT_REND_WITH_HEAD_ROT
- IVAS_SPLIT_REND_BITS splitRendBits;
- SplitFileReadWrite *hSplitRendFileReadWrite;
+ SplitFileReadWrite *splitRendWriter = NULL;
#endif
-
IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS];
for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
{
@@ -1927,14 +1945,6 @@ static ivas_error decodeG192(
reset_wmops();
#endif
-#ifdef SPLIT_REND_WITH_HEAD_ROT
- splitRendBits.bits_buf = splitRendBitsBuf;
- splitRendBits.bits_read = 0;
- splitRendBits.bits_written = 0;
- splitRendBits.buf_len = MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES;
- hSplitRendFileReadWrite = NULL;
-#endif
-
/*------------------------------------------------------------------------------------------*
* Loop for every packet (frame) of bitstream data
* - Read the bitstream packet
@@ -2089,7 +2099,7 @@ static ivas_error decodeG192(
if ( ( error = IVAS_DEC_GetSamples( hIvasDec, pcmBuf, &nOutSamples
#ifdef SPLIT_REND_WITH_HEAD_ROT
,
- &splitRendBits
+ splitRendBitsBuf
#endif
) ) != IVAS_ERR_OK )
{
@@ -2113,7 +2123,7 @@ static ivas_error decodeG192(
&delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj
#ifdef SPLIT_REND_WITH_HEAD_ROT
,
- &hSplitRendFileReadWrite
+ &splitRendWriter
#endif
) ) != IVAS_ERR_OK )
{
@@ -2130,26 +2140,25 @@ static ivas_error decodeG192(
if ( decodedGoodFrame )
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) )
+ if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
- if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written,
- splitRendBits.codec, splitRendBits.pose_correction ) != IVAS_ERR_OK )
+ IVAS_SPLIT_REND_BITS_DATA splitRendBits;
+
+ if ( ( error = IVAS_DEC_GetSplitRendBits( hIvasDec, &splitRendBits ) ) != IVAS_ERR_OK )
{
- fprintf( stderr, "\nUnable to write to bitstream file!\n" );
- exit( -1 );
+ fprintf( stderr, "\nError in IVAS_DEC_SplitRendBits: %s\n", IVAS_DEC_GetErrorMessage( error ) );
+ goto cleanup;
}
- }
- else
- {
- if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+
+ if ( split_rend_write_bitstream_to_file( splitRendWriter, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written, splitRendBits.codec, splitRendBits.pose_correction ) != IVAS_ERR_OK )
{
- if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written,
- splitRendBits.codec, splitRendBits.pose_correction ) != IVAS_ERR_OK )
- {
- fprintf( stderr, "\nUnable to write to bitstream file!\n" );
- exit( -1 );
- }
+ fprintf( stderr, "\nError writing split rendering bitstream to file!\n" );
+ goto cleanup;
}
+ }
+
+ if ( arg.outputConfig != AUDIO_CONFIG_BINAURAL_SPLIT_CODED )
+ {
#endif
if ( delayNumSamples < nOutSamples )
{
@@ -2313,10 +2322,11 @@ static ivas_error decodeG192(
cleanup:
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( hSplitRendFileReadWrite != NULL )
+ if ( splitRendWriter != NULL )
{
- split_rend_reader_writer_close( &hSplitRendFileReadWrite );
+ split_rend_reader_writer_close( &splitRendWriter );
}
+
if ( afWriter != NULL )
{
#endif
@@ -2324,6 +2334,7 @@ cleanup:
#ifdef SPLIT_REND_WITH_HEAD_ROT
}
#endif
+
MasaFileWriter_close( &masaWriter );
for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; i++ )
{
@@ -3154,7 +3165,6 @@ static ivas_error decodeVariableSpeed(
if ( decodedGoodFrame )
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
-
SplitFileReadWrite *hSplitRendFileReadWrite = NULL;
#endif
error = initOnFirstGoodFrame(
diff --git a/apps/renderer.c b/apps/renderer.c
index ed7a596c562c113f32f5b5ad675a19533d03d75f..85dca6fb1d1c48813d692a31edee89c310606eb1 100644
--- a/apps/renderer.c
+++ b/apps/renderer.c
@@ -665,6 +665,8 @@ static void setupWithSingleFormatInput(
}
}
#endif
+
+ return;
}
@@ -674,10 +676,14 @@ static float dBToLin(
return powf( 10.0f, gain_dB / 20.0f );
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
-static int16_t get_cldfb_in_flag( AUDIO_CONFIG audioConfig, IVAS_RENDER_CONFIG_DATA *renderConfig )
+static int16_t get_cldfb_in_flag(
+ const AUDIO_CONFIG audioConfig,
+ IVAS_RENDER_CONFIG_DATA *renderConfig )
{
int16_t cldfb_in;
+
cldfb_in = 0;
if ( renderConfig->split_rend_config.rendererSelection == IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV )
{
@@ -693,12 +699,14 @@ static int16_t get_cldfb_in_flag( AUDIO_CONFIG audioConfig, IVAS_RENDER_CONFIG_D
return cldfb_in;
}
-static int16_t is_split_post_rend_mode( CmdlnArgs *args )
+
+static int16_t is_split_post_rend_mode(
+ CmdlnArgs *args )
{
int16_t flag;
+
flag = 0;
- if ( ( args->inConfig.numBinBuses > 0 ) &&
- ( ( args->inConfig.binBuses[0].audioConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( args->inConfig.binBuses[0].audioConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) )
+ if ( args->inConfig.numBinBuses > 0 && ( args->inConfig.binBuses[0].audioConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || args->inConfig.binBuses[0].audioConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
{
flag = 1;
}
@@ -706,12 +714,13 @@ static int16_t is_split_post_rend_mode( CmdlnArgs *args )
return flag;
}
-static int16_t is_split_pre_rend_mode( CmdlnArgs *args )
+static int16_t is_split_pre_rend_mode(
+ CmdlnArgs *args )
{
int16_t flag;
+
flag = 0;
- if ( ( args->outConfig.audioConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( args->outConfig.audioConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( args->outConfig.audioConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || args->outConfig.audioConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
flag = 1;
}
@@ -720,6 +729,7 @@ static int16_t is_split_pre_rend_mode( CmdlnArgs *args )
}
#endif
+
/*------------------------------------------------------------------------------------------*
* main()
*
@@ -1091,6 +1101,7 @@ int main(
#endif
exit( -1 );
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( !is_split_post_rend_mode( &args ) )
{
@@ -1357,9 +1368,11 @@ int main(
#ifdef SPLIT_REND_WITH_HEAD_ROT
}
#endif
+
inBufferSize = frameSize_smpls * totalNumInChannels;
outBufferSize = frameSize_smpls * numOutChannels;
inpInt16Buffer = malloc( inBufferSize * sizeof( int16_t ) );
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( cldfb_in == 0 )
{
@@ -1464,6 +1477,7 @@ int main(
}
}
}
+
if ( audioReader != NULL )
{
#endif
@@ -1538,6 +1552,7 @@ int main(
exit( -1 );
}
}
+
if ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer, Pos
#ifdef SPLIT_REND_WITH_HEAD_ROT
,
@@ -1573,6 +1588,7 @@ int main(
IVAS_REND_SetSplitRendBFI( hIvasRend, bfi );
}
#endif
+
/* Read from external orientation file if specified */
if ( externalOrientationFileReader != NULL )
{
@@ -1818,11 +1834,11 @@ int main(
}
#ifdef SPLIT_REND_WITH_HEAD_ROT
}
+
bitsBuffer.config.bitsRead = 0;
bitsBuffer.config.bitsWritten = 0;
#endif
-
/* Write MASA metadata for MASA outputs */
if ( args.outConfig.audioConfig == AUDIO_CONFIG_MASA1 || args.outConfig.audioConfig == AUDIO_CONFIG_MASA2 )
{
@@ -2442,6 +2458,7 @@ static bool checkRequiredArgs(
fprintf( stderr, "Missing required argument: %s (%s)\n", tmpOption->match, tmpOption->matchShort );
missingRequiredArg = true;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
const bool singleInputSpecified = args.inConfig.numAudioObjects != 0 ||
args.inConfig.numAmbisonicsBuses != 0 ||
@@ -2454,6 +2471,7 @@ static bool checkRequiredArgs(
args.inConfig.numMultiChannelBuses != 0 ||
args.inConfig.numMasaBuses != 0;
#endif
+
if ( !args.sceneDescriptionInput && !singleInputSpecified )
{
/* Neither scene description input nor single-type input was specified on command line */
diff --git a/lib_com/cnst.h b/lib_com/cnst.h
index 9b9278d5683f8503e055fc4db0e0fe875a702750..75529a916fa04bfbad13e99611a771270f7dd492 100644
--- a/lib_com/cnst.h
+++ b/lib_com/cnst.h
@@ -629,9 +629,6 @@ enum
#define CLDFB_NO_COL_MAX_SWITCH_BFI 10 /* CLDFB resampling - max number of CLDFB col. for switching, BFI */
#define CLDFB_OVRLP_MIN_SLOTS 3 /* CLDFB resampling - minimize processing to minimum required for transition frame ACELP->TCX/HQ */
#define INV_CLDFB_BANDWIDTH ( 1.f / 800.f )
-#ifdef SPLIT_REND_WITH_HEAD_ROT
-#define CLDFB_PLC_XF 2 /* Length of cross-fade into first good frame after frame loss in CLDFB cols. */
-#endif
#define L_FILT_2OVER3 12
#define L_FILT_2OVER3_LP 3
diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h
index 634fc8f5503321a725fac4fafc99b1c8e6501e65..da51606209ff631d7adf3b46e8f9b1139b816e4b 100644
--- a/lib_com/common_api_types.h
+++ b/lib_com/common_api_types.h
@@ -59,6 +59,12 @@
#define RENDERER_HEAD_POSITIONS_PER_FRAME 4 // ToDo: should it be harmonized with IVAS_MAX_PARAM_SPATIAL_SUBFRAMES?
#define QC_ABS_COEFF 6
+#ifdef SPLIT_REND_WITH_HEAD_ROT
+#define IVAS_NUM_FRAMES_PER_SEC 50
+
+#define MAX_SPLIT_REND_BITRATE 768000
+#define IVAS_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) MAX_SPLIT_REND_BITRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 )
+#endif
/*----------------------------------------------------------------------------------*
* Common API enum for output audio configurations
@@ -174,7 +180,7 @@ typedef struct ivas_split_rend_bits_t
int32_t bits_read;
IVAS_SPLIT_REND_CODEC codec;
IVAS_SPLIT_REND_POSE_CORRECTION_MODE pose_correction;
-} ivas_split_rend_bits_t, IVAS_SPLIT_REND_BITS, *IVAS_SPLIT_REND_BITS_HANDLE;
+} ivas_split_rend_bits_t, IVAS_SPLIT_REND_BITS_DATA, *IVAS_SPLIT_REND_BITS_HANDLE;
#endif
typedef struct
@@ -218,6 +224,7 @@ typedef struct
float yaw;
float pitch;
int16_t non_diegetic_flag;
+
} IVAS_REND_AudioObjectPosition;
typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG
@@ -236,6 +243,7 @@ typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG
IVAS_VECTOR3 dimensions; /* Room dimensions [m] */
float AbsCoeff[QC_ABS_COEFF]; /* Absorption coeffs */
IVAS_VECTOR3 ListenerOrigin; /* Listener origin */
+
} IVAS_ROOM_ACOUSTICS_CONFIG_DATA;
#ifdef SPLIT_REND_WITH_HEAD_ROT
diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c
index 0d08f64fd1296c562cc4a4bda6ca7c65a42ec9aa..afccf2d68ec0b402c952049fb04b1581c16c523c 100644
--- a/lib_com/delay_comp.c
+++ b/lib_com/delay_comp.c
@@ -57,7 +57,7 @@ int32_t get_delay(
HANDLE_CLDFB_FILTER_BANK hCldfb /* i : Handle of Cldfb analysis */
#ifdef SPLIT_REND_WITH_HEAD_ROT
,
- AUDIO_CONFIG output_config /* i : decoder output config */
+ const AUDIO_CONFIG output_config /* i : decoder output config */
#endif
)
{
diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h
index 02a342dfe0c9a178c8d50c4e8cd22221f5321add..387aec683b119b6ae07dba0581f928810686230d 100755
--- a/lib_com/ivas_cnst.h
+++ b/lib_com/ivas_cnst.h
@@ -1265,9 +1265,7 @@ typedef enum
MASA_FRAME_4SF
} MASA_FRAME_MODE;
-#ifdef SBA_AND_OBJECTS
-#define NO_BITS_MASA_ISM_NO_OBJ 2
-#endif
+
/*----------------------------------------------------------------------------------*
* Multichannel format
*----------------------------------------------------------------------------------*/
@@ -1341,9 +1339,11 @@ typedef enum
MCT_CHAN_MODE_IGNORE
} MCT_CHAN_MODE;
+
/*----------------------------------------------------------------------------------*
* MC Param-Upmix Mode Constants
*----------------------------------------------------------------------------------*/
+
#define MC_PARAMUPMIX_MAX_TRANSPORT_CHANS 8
#define MC_PARAMUPMIX_MAX_INPUT_CHANS 12
#define MC_PARAMUPMIX_MAX_BITS 1024 /* Maximum number of bits for the MC Param-Upmix metadata */
@@ -1530,6 +1530,7 @@ typedef enum
#define VBAP_NUM_SEARCH_SECTORS 4
+
/*----------------------------------------------------------------------------------*
* Binaural Rendering Constants
*----------------------------------------------------------------------------------*/
@@ -1542,69 +1543,6 @@ typedef enum
#define BINAURAL_NTAPS_MAX 96
-#ifdef SPLIT_REND_WITH_HEAD_ROT
-#define SPLIT_REND_DECOR_ALPHA (0.25f)
-
-#define SPLIT_REND_MAX_YAW_ONLY_POSES (2)
-#define SPLIT_REND_MAX_PITCH_ONLY_POSES (2)
-#define SPLIT_REND_MAX_ROLL_ONLY_POSES (2)
-#define SPLIT_REND_MAX_ONE_AXIS_MD_POSES (2)
-#define MAX_EXTRAPOLATION_ANGLE (15.0f) /* this means additional 15 degrees can be extrapolated on top of MD probing poses*/
-
-#define SPLIT_REND_MAX_DOF (3)
-
-#define MAX_HEAD_ROT_POSES (2 + SPLIT_REND_MAX_YAW_ONLY_POSES + SPLIT_REND_MAX_PITCH_ONLY_POSES + SPLIT_REND_MAX_ROLL_ONLY_POSES)
-#define MAX_SPLIT_REND_MD_BANDS (20)
-#define MAX_SPLIT_MD_SUBFRAMES (1)
-#define COMPLEX_MD_BAND_THRESH (MAX_SPLIT_REND_MD_BANDS)
-#define COMPLEX_MD_BAND_THRESH_LOW (5)
-
-#ifndef SPLIT_REND_PRED_QUANT_63_PNTS
-#define IVAS_SPLIT_REND_NUM_QUANT_STRATS (3)
-#else
-#define IVAS_SPLIT_REND_NUM_QUANT_STRATS (4)
-#endif
-#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
-#define IVAS_SPLIT_REND_PRED_63QUANT_PNTS ( 63 )
-#define IVAS_SPLIT_REND_PRED_31QUANT_PNTS ( 31 )
-#define IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS ( 31 )
-#else
-#define IVAS_SPLIT_REND_PRED_QUANT_PNTS ( 31 )
-#endif
-#define IVAS_SPLIT_REND_D_QUANT_PNTS ( 15 )
-#define IVAS_SPLIT_REND_PRED_MIN_VAL ( -1.4f )
-#define IVAS_SPLIT_REND_PRED_MAX_VAL ( 1.4f )
-
-#define IVAS_SPLIT_REND_PITCH_G_MIN_VAL (0.5f)
-#define IVAS_SPLIT_REND_PITCH_G_MAX_VAL (1.5f)
-#define IVAS_SPLIT_REND_PITCH_G_QUANT_PNTS ( IVAS_SPLIT_REND_D_QUANT_PNTS )
-#define IVAS_SPLIT_REND_D_MIN_VAL ( 0.0f )
-#define IVAS_SPLIT_REND_D_MAX_VAL ( 1.0f )
-
-#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
-#define IVAS_SPLIT_REND_PRED_ROLL_Q_STEP (( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ) / ( IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS - 1 ))
-#define IVAS_SPLIT_REND_PRED_ROLL_1BYQ_STEP (( IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ))
-#define IVAS_SPLIT_REND_PRED31_Q_STEP (( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ) / ( IVAS_SPLIT_REND_PRED_31QUANT_PNTS - 1 ))
-#define IVAS_SPLIT_REND_PRED31_1BYQ_STEP (( IVAS_SPLIT_REND_PRED_31QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ))
-#define IVAS_SPLIT_REND_PRED63_Q_STEP (( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ) / ( IVAS_SPLIT_REND_PRED_63QUANT_PNTS - 1 ))
-#define IVAS_SPLIT_REND_PRED63_1BYQ_STEP (( IVAS_SPLIT_REND_PRED_63QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ))
-#else
-#define IVAS_SPLIT_REND_PRED_Q_STEP (( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ) / ( IVAS_SPLIT_REND_PRED_QUANT_PNTS - 1 ))
-#define IVAS_SPLIT_REND_PRED_1BYQ_STEP (( IVAS_SPLIT_REND_PRED_QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ))
-#endif
-
-#define IVAS_SPLIT_REND_D_Q_STEP (( IVAS_SPLIT_REND_D_MAX_VAL - IVAS_SPLIT_REND_D_MIN_VAL ) / ( IVAS_SPLIT_REND_D_QUANT_PNTS - 1 ))
-#define IVAS_SPLIT_REND_D_1BYQ_STEP (( IVAS_SPLIT_REND_D_QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_D_MAX_VAL - IVAS_SPLIT_REND_D_MIN_VAL ))
-#define IVAS_SPLIT_REND_PITCH_G_Q_STEP (( IVAS_SPLIT_REND_PITCH_G_MAX_VAL - IVAS_SPLIT_REND_PITCH_G_MIN_VAL ) / ( IVAS_SPLIT_REND_PITCH_G_QUANT_PNTS - 1 ))
-#define IVAS_SPLIT_REND_PITCH_G_1BYQ_STEP (( IVAS_SPLIT_REND_PITCH_G_QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_PITCH_G_MAX_VAL - IVAS_SPLIT_REND_PITCH_G_MIN_VAL ))
-
-#define IVAS_SPLIT_REND_MAX_NUM_BYTES (4000)
-#define IVAS_SPLIT_REND_HEAD_POSE_BITS (9)
-#define IVAS_SPLIT_REND_DOF_BITS (2)
-#define IVAS_SPLIT_REND_HQ_MODE_BITS (1)
-#define IVAS_SPLIT_REND_ROT_AXIS_BITS (3)
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
-
#define HRTF_SH_ORDER 3
#define HRTF_SH_CHANNELS HOA3_CHANNELS
#define HRTF_LS_CHANNELS 15
@@ -1620,8 +1558,8 @@ typedef enum
{
BINAURAL_INPUT_AUDIO_CONFIG_INVALID,
BINAURAL_INPUT_AUDIO_CONFIG_COMBINED, /* 5_1, 5_1_2, 5_1_4, 7_1, 7_1_4 */
- BINAURAL_INPUT_AUDIO_CONFIG_HOA3, /* HOA3 */
- BINAURAL_INPUT_AUDIO_CONFIG_HOA2, /* HOA2 */
+ BINAURAL_INPUT_AUDIO_CONFIG_HOA3, /* HOA3 */
+ BINAURAL_INPUT_AUDIO_CONFIG_HOA2, /* HOA2 */
BINAURAL_INPUT_AUDIO_CONFIG_FOA, /* FOA */
BINAURAL_INPUT_AUDIO_CONFIG_UNDEFINED /* Not used */
@@ -1631,6 +1569,79 @@ typedef enum
#define HEADROT_SHMAT_DIM ( ( HEADROT_ORDER + 1 ) * ( HEADROT_ORDER + 1 ) )
#define HEADROT_SHMAT_DIM2 ( HEADROT_SHMAT_DIM * HEADROT_SHMAT_DIM )
+
+#ifdef SPLIT_REND_WITH_HEAD_ROT
+/*----------------------------------------------------------------------------------*
+ * Split Binaural Rendering Constants
+ *----------------------------------------------------------------------------------*/
+
+#ifdef SPLIT_REND_WITH_HEAD_ROT
+#define CLDFB_PLC_XF 2 /* Length of cross-fade into first good frame after frame loss in CLDFB cols. */
+#endif
+
+#define SPLIT_REND_DECOR_ALPHA 0.25f
+
+#define SPLIT_REND_MAX_YAW_ONLY_POSES 2
+#define SPLIT_REND_MAX_PITCH_ONLY_POSES 2
+#define SPLIT_REND_MAX_ROLL_ONLY_POSES 2
+#define SPLIT_REND_MAX_ONE_AXIS_MD_POSES 2
+#define MAX_EXTRAPOLATION_ANGLE 15.0f /* this means additional 15 degrees can be extrapolated on top of MD probing poses*/
+
+#define SPLIT_REND_MAX_DOF 3
+
+#define MAX_HEAD_ROT_POSES (2 + SPLIT_REND_MAX_YAW_ONLY_POSES + SPLIT_REND_MAX_PITCH_ONLY_POSES + SPLIT_REND_MAX_ROLL_ONLY_POSES)
+#define MAX_SPLIT_REND_MD_BANDS 20
+#define MAX_SPLIT_MD_SUBFRAMES 1
+#define COMPLEX_MD_BAND_THRESH MAX_SPLIT_REND_MD_BANDS
+#define COMPLEX_MD_BAND_THRESH_LOW 5
+
+#ifndef SPLIT_REND_PRED_QUANT_63_PNTS
+#define IVAS_SPLIT_REND_NUM_QUANT_STRATS 3
+#else
+#define IVAS_SPLIT_REND_NUM_QUANT_STRATS 4
+#endif
+#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
+#define IVAS_SPLIT_REND_PRED_63QUANT_PNTS 63
+#define IVAS_SPLIT_REND_PRED_31QUANT_PNTS 31
+#define IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS 31
+#else
+#define IVAS_SPLIT_REND_PRED_QUANT_PNTS 31
+#endif
+#define IVAS_SPLIT_REND_D_QUANT_PNTS 15
+#define IVAS_SPLIT_REND_PRED_MIN_VAL -1.4f
+#define IVAS_SPLIT_REND_PRED_MAX_VAL 1.4f
+
+#define IVAS_SPLIT_REND_PITCH_G_MIN_VAL 0.5f
+#define IVAS_SPLIT_REND_PITCH_G_MAX_VAL 1.5f
+#define IVAS_SPLIT_REND_PITCH_G_QUANT_PNTS IVAS_SPLIT_REND_D_QUANT_PNTS
+#define IVAS_SPLIT_REND_D_MIN_VAL 0.0f
+#define IVAS_SPLIT_REND_D_MAX_VAL 1.0f
+
+#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
+#define IVAS_SPLIT_REND_PRED_ROLL_Q_STEP (( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ) / ( IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS - 1 ))
+#define IVAS_SPLIT_REND_PRED_ROLL_1BYQ_STEP (( IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ))
+#define IVAS_SPLIT_REND_PRED31_Q_STEP (( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ) / ( IVAS_SPLIT_REND_PRED_31QUANT_PNTS - 1 ))
+#define IVAS_SPLIT_REND_PRED31_1BYQ_STEP (( IVAS_SPLIT_REND_PRED_31QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ))
+#define IVAS_SPLIT_REND_PRED63_Q_STEP (( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ) / ( IVAS_SPLIT_REND_PRED_63QUANT_PNTS - 1 ))
+#define IVAS_SPLIT_REND_PRED63_1BYQ_STEP (( IVAS_SPLIT_REND_PRED_63QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ))
+#else
+#define IVAS_SPLIT_REND_PRED_Q_STEP (( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ) / ( IVAS_SPLIT_REND_PRED_QUANT_PNTS - 1 ))
+#define IVAS_SPLIT_REND_PRED_1BYQ_STEP (( IVAS_SPLIT_REND_PRED_QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ))
+#endif
+
+#define IVAS_SPLIT_REND_D_Q_STEP (( IVAS_SPLIT_REND_D_MAX_VAL - IVAS_SPLIT_REND_D_MIN_VAL ) / ( IVAS_SPLIT_REND_D_QUANT_PNTS - 1 ))
+#define IVAS_SPLIT_REND_D_1BYQ_STEP (( IVAS_SPLIT_REND_D_QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_D_MAX_VAL - IVAS_SPLIT_REND_D_MIN_VAL ))
+#define IVAS_SPLIT_REND_PITCH_G_Q_STEP (( IVAS_SPLIT_REND_PITCH_G_MAX_VAL - IVAS_SPLIT_REND_PITCH_G_MIN_VAL ) / ( IVAS_SPLIT_REND_PITCH_G_QUANT_PNTS - 1 ))
+#define IVAS_SPLIT_REND_PITCH_G_1BYQ_STEP (( IVAS_SPLIT_REND_PITCH_G_QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_PITCH_G_MAX_VAL - IVAS_SPLIT_REND_PITCH_G_MIN_VAL ))
+
+#define IVAS_SPLIT_REND_MAX_NUM_BYTES 4000
+#define IVAS_SPLIT_REND_HEAD_POSE_BITS 9
+#define IVAS_SPLIT_REND_DOF_BITS 2
+#define IVAS_SPLIT_REND_HQ_MODE_BITS 1
+#define IVAS_SPLIT_REND_ROT_AXIS_BITS 3
+#endif
+
+
/*----------------------------------------------------------------------------------*
* TD Binaural Object renderer
*----------------------------------------------------------------------------------*/
@@ -1833,6 +1844,19 @@ typedef enum
#define QUANT_STRAT_0 0
#define QUANT_STRAT_2 2
+#ifdef SPLIT_REND_WITH_HEAD_ROT
+/*----------------------------------------------------------------------------------*
+ * Split rendering bitrate constants
+ *----------------------------------------------------------------------------------*/
+
+#define SPLIT_REND_256k 256000
+#define SPLIT_REND_320k 320000
+#define SPLIT_REND_384k 384000
+#define SPLIT_REND_512k 512000
+#define SPLIT_REND_768k 768000
+#define SPLIT_REND_MAX_BRATE SPLIT_REND_768k
+#define SPLIT_REND_ADDITIONAL_BYTES_TO_READ 1
+#endif
/*----------------------------------------------------------------------------------*
* Limiter constants
@@ -1874,20 +1898,20 @@ typedef enum
* Stereo downmix EVS constants
*----------------------------------------------------------------------------------*/
-#define STEREO_DMX_EVS_PHA_LEN_16 48
-#define STEREO_DMX_EVS_FAD_LEN_16 160
-#define STEREO_DMX_EVS_PHA_LEN_32 96
-#define STEREO_DMX_EVS_FAD_LEN_32 320
-#define STEREO_DMX_EVS_PHA_LEN_48 96
-#define STEREO_DMX_EVS_FAD_LEN_48 480
+#define STEREO_DMX_EVS_PHA_LEN_16 48
+#define STEREO_DMX_EVS_FAD_LEN_16 160
+#define STEREO_DMX_EVS_PHA_LEN_32 96
+#define STEREO_DMX_EVS_FAD_LEN_32 320
+#define STEREO_DMX_EVS_PHA_LEN_48 96
+#define STEREO_DMX_EVS_FAD_LEN_48 480
-#define STEREO_DMX_EVS_SUBBAND_SIZE 2
-#define STEREO_DMX_EVS_NB_SUBBAND_MAX (L_FRAME48k / (2 * STEREO_DMX_EVS_SUBBAND_SIZE))
+#define STEREO_DMX_EVS_SUBBAND_SIZE 2
+#define STEREO_DMX_EVS_NB_SUBBAND_MAX (L_FRAME48k / (2 * STEREO_DMX_EVS_SUBBAND_SIZE))
-#define STEREO_DMX_EVS_PHA_LEN_MAX 96 /* Max of PHA_LEN */
-#define STEREO_DMX_EVS_FAD_LEN_MAX 480 /* Max of FAD_LEN */
+#define STEREO_DMX_EVS_PHA_LEN_MAX 96 /* Max of PHA_LEN */
+#define STEREO_DMX_EVS_FAD_LEN_MAX 480 /* Max of FAD_LEN */
-#define STEREO_DMX_EVS_DATA_LEN_MAX (STEREO_DMX_EVS_PHA_LEN_MAX + L_FRAME48k)
+#define STEREO_DMX_EVS_DATA_LEN_MAX (STEREO_DMX_EVS_PHA_LEN_MAX + L_FRAME48k)
typedef enum
{
diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h
index 997798f60113bd35734e1bd2ede5cd23db76a7ed..dd003e6ad701864125a9456c24f7dfd23068c22d 100755
--- a/lib_com/ivas_prot.h
+++ b/lib_com/ivas_prot.h
@@ -308,7 +308,7 @@ ivas_error ivas_dec(
int16_t *data /* o : output synthesis signal */
#ifdef SPLIT_REND_WITH_HEAD_ROT
,
- IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits
+ uint8_t *splitRendBitsBuf /* o : output split rendering bits */
#endif
);
@@ -850,11 +850,11 @@ int16_t ivas_jbm_dec_get_num_tc_channels(
);
void ivas_jbm_dec_get_md_map_even_spacing(
- const int16_t len, /* i : length of the modfied frames in metadata slots */
- const int16_t subframe_len, /* i : default length of a subframe */
- const int16_t offset, /* i : current read offset into the md buffer */
- const int16_t buf_len, /* i : length of the metadata buffer */
- int16_t *map /* o : metadata index map */
+ const int16_t len, /* i : length of the modfied frames in metadata slots */
+ const int16_t subframe_len, /* i : default length of a subframe */
+ const int16_t offset, /* i : current read offset into the md buffer */
+ const int16_t buf_len, /* i : length of the metadata buffer */
+ int16_t *map /* o : metadata index map */
);
TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode(
@@ -1036,7 +1036,7 @@ ivas_error ivas_ism_metadata_dec(
ISM_DTX_DATA_DEC hISMDTX, /* i/o: ISM DTX structure */
const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Config Handle */
int16_t *ism_extended_metadata_flag, /* i/o: Extended metadata active in renderer */
- int16_t *ism_extmeta_cnt /* i/o: Number of change frames observed */
+ int16_t *ism_extmeta_cnt /* i/o: Number of change frames observed */
#ifdef SBA_AND_OBJECTS
, DEC_CORE_HANDLE st0 /* i : core-coder handle */
#endif
@@ -2525,7 +2525,7 @@ void IGFDecApplyStereo(
const int16_t *coreMsMask,
const int16_t restrict_hopsize,
const int16_t bfi, /* i : frame loss == 1, frame good == 0 */
- const int16_t bfi_apply_damping /* i : decoder element mode */
+ const int16_t bfi_apply_damping /* i : decoder element mode */
);
void IGFEncStereoEncoder(
@@ -3507,7 +3507,7 @@ void ivas_dirac_param_est_enc(
float **pp_fr_imag,
const int16_t input_frame,
const IVAS_FORMAT ivas_format ,
- const int16_t hodirac_flag,
+ const int16_t hodirac_flag,
const int16_t nchan_fb_in,
int16_t *mono_frame_count,
int16_t *dirac_mono_flag
@@ -3897,18 +3897,18 @@ void ivas_mc_paramupmix_dec_read_BS(
);
void ivas_mc_paramupmix_dec_digest_tc(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
- const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */
- const int16_t nSamplesForRendering /* i : number of samples provided */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
+ const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */
+ const int16_t nSamplesForRendering /* i : number of samples provided */
);
void ivas_mc_paramupmix_dec_render(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
- const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */
- uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */
- uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
+ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */
+ uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */
+ uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */
float *input_f[], /* i : core-coder transport channels */
- float *output_f[] /* i/o: synthesized core-coder transport channels */
+ float *output_f[] /* i/o: synthesized core-coder transport channels */
);
void ivas_param_mc_metadata_open(
@@ -4525,17 +4525,17 @@ void ivas_spar_md_enc_close(
);
ivas_error ivas_spar_md_enc_process(
- ivas_spar_md_enc_state_t *hMdEnc, /* i/o: SPAR MD encoder handle */
- const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */
+ ivas_spar_md_enc_state_t *hMdEnc, /* i/o: SPAR MD encoder handle */
+ const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */
float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
- BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */
+ BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */
const int16_t dtx_vad,
const int16_t nchan_inp,
- const int16_t sba_order, /* i : Ambisonic (SBA) order */
+ const int16_t sba_order, /* i : Ambisonic (SBA) order */
float *prior_mixer[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH], /* i : prior mixer_matrix */
- const int16_t dyn_active_w_flag, /* i : flag to indicate dynamic active W */
- const int16_t dirac_mono_flag /* i : flag to indicate mono only mode in SBA */
+ const int16_t dyn_active_w_flag, /* i : flag to indicate dynamic active W */
+ const int16_t dirac_mono_flag /* i : flag to indicate mono only mode in SBA */
);
void ivas_compute_spar_params(
@@ -4607,13 +4607,13 @@ int16_t ivas_get_spar_dec_md_num_subframes(
);
ivas_error ivas_spar_md_dec_matrix_open(
- ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */
- const int16_t num_channels, /* i : number of internal channels */
+ ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */
+ const int16_t num_channels, /* i : number of internal channels */
const int16_t num_md_sub_frames
);
void ivas_spar_md_dec_matrix_close(
- ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle */
+ ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle */
const int16_t num_channels /* i : number of internal channels */
);
@@ -4621,7 +4621,7 @@ ivas_error ivas_spar_md_dec_open(
ivas_spar_md_dec_state_t **hMdDec_out, /* i/o: SPAR MD decoder handle */
const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */
const int16_t num_channels, /* i : number of internal channels */
- const int16_t sba_order, /* i : SBA order */
+ const int16_t sba_order, /* i : SBA order */
const int16_t sid_format, /* i : SID format */
const int32_t last_active_ivas_total_brate /* i : IVAS last active bitrate */
);
@@ -4723,8 +4723,8 @@ void ivas_enc_cov_handler_process(
int16_t *res_ind,
const int16_t *remix_order,
int16_t *dyn_active_w_flag,
- const int16_t nchan_transport,
- const int16_t is_sba
+ const int16_t nchan_transport,
+ const int16_t is_sba
);
ivas_error ivas_spar_covar_smooth_enc_open(
@@ -4733,7 +4733,7 @@ ivas_error ivas_spar_covar_smooth_enc_open(
ivas_filterbank_t *pFb, /* i/o: FB handle */
const int16_t nchan_inp, /* i : number of input channels */
const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */
- const int32_t ivas_total_brate /* i : IVAS total bitrate */
+ const int32_t ivas_total_brate /* i : IVAS total bitrate */
);
void ivas_spar_covar_smooth_enc_close(
@@ -5366,15 +5366,15 @@ void ivas_binRenderer_close(
);
void ivas_binaural_hrtf_close(
- HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i/o: decoder binaural hrtf handle */
+ HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i/o: decoder binaural hrtf handle */
);
void ivas_init_binaural_hrtf(
- HRTFS_FASTCONV *HrtfFastConv /* i/o: FASTCONV HRTF structure */
+ HRTFS_FASTCONV *HrtfFastConv /* i/o: FASTCONV HRTF structure */
);
ivas_error ivas_allocate_binaural_hrtf(
- HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */
+ HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */
const AUDIO_CONFIG input_config, /* i : input audio configuration */
const BINAURAL_INPUT_AUDIO_CONFIG bin_input_config, /* i : binaural input audio config */
const RENDERER_TYPE renderer_type, /* i : renderer type */
@@ -5396,7 +5396,7 @@ void ivas_binaural_cldfb_sf(
#endif
void ivas_binRenderer(
- BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */
+ BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */
#ifdef SPLIT_REND_WITH_HEAD_ROT
const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
#endif
@@ -5856,42 +5856,42 @@ void ivas_osba_enc(
);
ivas_error ivas_masa_ism_data_open(
- Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */
);
ivas_error ivas_sba_ism_separate_object_renderer_open(
- Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
);
ivas_error ivas_osba_dirac_td_binaural(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP
- float *output[], /* o : output synthesis signal */
+ float *output[], /* o : output synthesis signal */
#else
- float output[][L_FRAME48k], /* o : output synthesis signal */
+ float output[][L_FRAME48k], /* o : output synthesis signal */
#endif
- const int16_t output_frame /* i : output frame length per channel */
+ const int16_t output_frame /* i : output frame length per channel */
);
ivas_error ivas_osba_ism_metadata_dec(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
- const int32_t ism_total_brate, /* i : ISM total bitrate */
- int16_t *nchan_ism, /* o : number of ISM separated channels */
- int16_t nb_bits_metadata[] /* o : number of ISM metadata bits */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ const int32_t ism_total_brate, /* i : ISM total bitrate */
+ int16_t *nchan_ism, /* o : number of ISM separated channels */
+ int16_t nb_bits_metadata[] /* o : number of ISM metadata bits */
);
ivas_error ivas_osba_render(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP
- float *output_f[], /* i/o: core-coder transport channels/object output */
+ float *output_f[], /* i/o: core-coder transport channels/object output */
#else
- float output_f[][L_FRAME48k], /* i/o: core-coder transport channels/object output */
+ float output_f[][L_FRAME48k], /* i/o: core-coder transport channels/object output */
#endif
- const int16_t output_frame /* i : output frame length per channel */
+ const int16_t output_frame /* i : output frame length per channel */
);
void ivas_masa_ism_data_close(
- MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */
+ MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */
);
#endif
@@ -6242,13 +6242,13 @@ void ivas_fb_mixer_get_in_out_mapping(
);
void ivas_fb_mixer_cross_fading(
- IVAS_FB_MIXER_HANDLE hFbMixer,
- float **ppOut_pcm,
- float *pMdft_out_old,
- float *pMdft_out_new,
- const int16_t ch,
- const int16_t frame_len,
- const int16_t cf_offset
+ IVAS_FB_MIXER_HANDLE hFbMixer,
+ float **ppOut_pcm,
+ float *pMdft_out_old,
+ float *pMdft_out_new,
+ const int16_t ch,
+ const int16_t frame_len,
+ const int16_t cf_offset
);
/*! r: number of spectral bands */
diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c
index c1e524d8af426139b3783a98c688b906f9e714f9..27f66ba373c0cf1b1ead62222acfc02e8eb5cd8d 100644
--- a/lib_com/ivas_rom_com.c
+++ b/lib_com/ivas_rom_com.c
@@ -887,13 +887,12 @@ const ivas_spar_br_table_t ivas_spar_br_table_consts[IVAS_SPAR_BR_TABLE_LEN] =
{
/* When AGC is ON additional (AGC_BITS_PER_CH+1) bits may be taken from each core-coder channel
so minimum core-coder bitrate per channel can be min core-coder bitrates as per the table - AGC_BITS_PER_CH */
- { 13200, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0,
- { { 10000, 8150, 13150 } },
+ { 13200, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 10000, 8150, 13150 } },
{ { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 },
- { 16400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0,
- { { 13200, 11350, 16350 } },
+ { 16400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 13200, 11350, 16350 } },
{ { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 },
+
{ 24400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0,{ { 16400, 14850, 24350 } },
{ { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 },
@@ -927,9 +926,7 @@ const ivas_spar_br_table_t ivas_spar_br_table_consts[IVAS_SPAR_BR_TABLE_LEN] =
{ { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
{ 256000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 76300, 73550, 112000 },{ 59350, 57200, 56000 },{ 42400, 40850, 48000 },{ 25450, 24500, 40000 } },
- { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },
- { 1, 1, 1, 1 }
- }, 1, 2, 0 },
+ { { 31, 11, 11, 1 },{ 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, 1, 2, 0 },
{ 384000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 100000, 100000, 128000 },{ 79850, 79850, 104000 },{ 66600, 66600, 104000 } }, // not yet optimized
{ { 31, 1, 1, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
@@ -6442,13 +6439,14 @@ const int16_t sns_1st_means_32k[2][16] =
};
-/*------------------------------------------------------------------------------------------*
- * MC ParamUpMix tables
- *------------------------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------*
+ * MC ParamUpmix ROM tables
+ *-----------------------------------------------------------------------*/
-const ACPL_QUANT_TABLE ivas_param_upmx_alpha_quant_table[] =
+const ACPL_QUANT_TABLE ivas_mc_paramupmix_alpha_quant_table[] =
{
- { /* Alfa Fine */
+ /* Alfa Fine */
+ {
33, /* nquant */
16, /* offset */
{ -2.000000e+000f, -1.809375e+000f, -1.637500e+000f, -1.484375e+000f, -1.350000e+000f, -1.234375e+000f, -1.137500e+000f, -1.059375e+000f, -1.000000e+000f, -9.406250e-001f,
@@ -6464,10 +6462,11 @@ const ACPL_QUANT_TABLE ivas_param_upmx_alpha_quant_table[] =
}
};
-const ACPL_QUANT_TABLE ivas_param_upmx_beta_quant_table[2][9] =
+const ACPL_QUANT_TABLE ivas_mc_paramupmix_beta_quant_table[2][9] =
{
{
- { /* Beta Fine #1 */
+ /* Beta Fine #1 */
+ {
9, /* nquant */
0, /* offset */
{ +0.000000e+000f, +2.375000e-001f, +5.500000e-001f, +9.375000e-001f, +1.400000e+000f, +1.937500e+000f, +2.550000e+000f, +3.237500e+000f, +4.000000e+000f } /* data */
@@ -6514,7 +6513,8 @@ const ACPL_QUANT_TABLE ivas_param_upmx_beta_quant_table[2][9] =
}
},
{
- { /* Beta Coarse #1 */
+ /* Beta Coarse #1 */
+ {
5, /* nquant */
0, /* offset */
{ +0.000000e+000f, +5.500000e-001f, +1.400000e+000f, +2.550000e+000f, +4.000000e+000f } /* data */
diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h
index ce43aa3c5c7c1b1e29b1d22f69318126b1d5a2ff..159ee1129220aaa2835a6dee4159b1e959e2da4c 100644
--- a/lib_com/ivas_rom_com.h
+++ b/lib_com/ivas_rom_com.h
@@ -454,12 +454,13 @@ extern const int16_t sns_1st_means_16k[2][16];
extern const int16_t sns_1st_means_25k6[2][16];
extern const int16_t sns_1st_means_32k[2][16];
-/*------------------------------------------------------------------------------------------*
- * SNS MSVQ codebooks and means
- *------------------------------------------------------------------------------------------*/
-extern const ACPL_QUANT_TABLE ivas_param_upmx_alpha_quant_table[];
-extern const ACPL_QUANT_TABLE ivas_param_upmx_beta_quant_table[2][9];
+/*----------------------------------------------------------------------*
+ * MC ParamUpmix ROM tables
+ *-----------------------------------------------------------------------*/
+
+extern const ACPL_QUANT_TABLE ivas_mc_paramupmix_alpha_quant_table[];
+extern const ACPL_QUANT_TABLE ivas_mc_paramupmix_beta_quant_table[2][9];
/* IVAS_ROM_COM_H */
#endif
diff --git a/lib_com/prot.h b/lib_com/prot.h
index 454100d590b1cd18c377c2acf6bf0b396cdf9a6d..47469062253eeb20a07cbf44418886540b91302a 100644
--- a/lib_com/prot.h
+++ b/lib_com/prot.h
@@ -723,7 +723,7 @@ int32_t get_delay(
HANDLE_CLDFB_FILTER_BANK hCldfb /* i : Handle of Cldfb analysis */
#ifdef SPLIT_REND_WITH_HEAD_ROT
,
- AUDIO_CONFIG output_config /* i : decoder output config */
+ const AUDIO_CONFIG output_config /* i : decoder output config */
#endif
);
diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c
index 902afa22dfa518db1f9b2ab6301fb3d12ad79e84..d884f8f8e500a0537c14facec395a99efe658346 100644
--- a/lib_dec/ivas_binRenderer_internal.c
+++ b/lib_dec/ivas_binRenderer_internal.c
@@ -67,7 +67,7 @@ static void ivas_binRenderer_filterModule(
BINAURAL_RENDERER_HANDLE hBinRenderer /* i/o: fastconv binaural renderer handle */
#ifdef SPLIT_REND_WITH_HEAD_ROT
,
- int16_t pos_idx
+ const int16_t pos_idx
#endif
)
{
@@ -153,7 +153,6 @@ static ivas_error ivas_binRenderer_convModuleOpen(
int16_t pos_idx;
#endif
-
/*-----------------------------------------------------------------*
* prepare library opening
*-----------------------------------------------------------------*/
@@ -587,7 +586,7 @@ static ivas_error ivas_alloc_pppMem(
*-------------------------------------------------------------------------*/
ivas_error ivas_allocate_binaural_hrtf(
- HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */
+ HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */
const AUDIO_CONFIG input_config, /* i : input audio configuration */
const BINAURAL_INPUT_AUDIO_CONFIG bin_input_config, /* i : binaural input audio config */
const RENDERER_TYPE renderer_type, /* i : renderer type */
@@ -741,7 +740,7 @@ ivas_error ivas_allocate_binaural_hrtf(
*-------------------------------------------------------------------------*/
static ivas_error ivas_binaural_hrtf_open(
- HRTFS_FASTCONV_HANDLE *hHrtfFastConv, /* i : fastconv HRTF handle */
+ HRTFS_FASTCONV_HANDLE *hHrtfFastConv, /* i : fastconv HRTF handle */
const AUDIO_CONFIG input_config, /* i : output configuration */
const RENDERER_TYPE renderer_type /* i : renderer type */
)
@@ -975,6 +974,7 @@ static void ivas_binaural_obtain_DMX(
return;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
/*-------------------------------------------------------------------------
* ivas_rend_openCldfbRend()
@@ -1025,6 +1025,7 @@ ivas_error ivas_rend_openCldfbRend(
{
hBinRenderer->conv_band = convBand;
}
+
hBinRenderer->hInputSetup->is_loudspeaker_setup = 0;
hBinRenderer->hInputSetup->output_config = inConfig;
getAudioConfigNumChannels( inConfig, &hBinRenderer->hInputSetup->nchan_out_woLFE );
@@ -1041,16 +1042,19 @@ ivas_error ivas_rend_openCldfbRend(
{
hBinRenderer->numPoses = 1;
}
- /* Load HRTF tables */
- ivas_binaural_hrtf_open( &pCldfbRend->hHrtfFastConv, hBinRenderer->hInputSetup->output_config, RENDERER_BINAURAL_FASTCONV );
+ /* Load HRTF tables */
+ if ( ( error = ivas_binaural_hrtf_open( &pCldfbRend->hHrtfFastConv, hBinRenderer->hInputSetup->output_config, RENDERER_BINAURAL_FASTCONV ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
/* Allocate memories and buffers needed for convolutional module */
- if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, RENDERER_BINAURAL_FASTCONV, hBinRenderer->hInputSetup->is_loudspeaker_setup, inConfig,
- pCldfbRend->hHrtfFastConv, hBinRenderer->numPoses ) ) != IVAS_ERR_OK )
+ if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, RENDERER_BINAURAL_FASTCONV, hBinRenderer->hInputSetup->is_loudspeaker_setup, inConfig, pCldfbRend->hHrtfFastConv, hBinRenderer->numPoses ) ) != IVAS_ERR_OK )
{
return error;
}
+
pCldfbRend->binaural_latency_ns = (int32_t) ( FASTCONV_HOA3_latency_s * 1000000000.f );
hBinRenderer->hReverb = NULL;
hBinRenderer->hEFAPdata = NULL;
@@ -1059,7 +1063,8 @@ ivas_error ivas_rend_openCldfbRend(
return error;
}
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
+#endif
+
/*-------------------------------------------------------------------------
* ivas_binRenderer_open()
@@ -1096,13 +1101,12 @@ ivas_error ivas_binRenderer_open(
}
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
- hBinRenderer->numPoses = st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses + 1;
+ hBinRenderer->numPoses = st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses + 1;
#else
- hBinRenderer->numPoses = st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses;
+ hBinRenderer->numPoses = st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses;
#endif
}
else
@@ -1153,7 +1157,7 @@ ivas_error ivas_binRenderer_open(
{
IVAS_OUTPUT_SETUP out_setup;
- /* Allocate memories and buffers needed for convolutional module in CCP19 */
+ /* Allocate memories and buffers needed for convolutional module in CICP19 */
if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, 1, AUDIO_CONFIG_7_1_4, st_ivas->hHrtfFastConv
#ifdef SPLIT_REND_WITH_HEAD_ROT
,
@@ -1228,8 +1232,7 @@ ivas_error ivas_binRenderer_open(
{
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 )
+ st_ivas->hHrtfFastConv, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -1365,8 +1368,7 @@ static void ivas_binRenderer_convModuleClose(
free( hBinRenConvModule->filterStatesLeftImag );
hBinRenConvModule->filterStatesLeftImag = NULL;
-#else /* SPLIT_REND_WITH_HEAD_ROT */
-
+#else
for ( bandIdx = 0; bandIdx < ( *hBinRenderer )->conv_band; bandIdx++ )
{
for ( chIdx = 0; chIdx < ( *hBinRenderer )->nInChannels; chIdx++ )
@@ -1390,8 +1392,7 @@ static void ivas_binRenderer_convModuleClose(
free( hBinRenConvModule->filterStatesLeftImag );
hBinRenConvModule->filterStatesLeftImag = NULL;
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
-
+#endif
free( ( *hBinRenderer )->hBinRenConvModule );
( *hBinRenderer )->hBinRenConvModule = NULL;
@@ -1555,6 +1556,7 @@ void ivas_binaural_add_LFE(
{
gain = ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hHrtfCrend != NULL ) ) ? st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe : GAIN_LFE;
}
+
for ( idx_lfe = 0; idx_lfe < st_ivas->hIntSetup.num_lfe; idx_lfe++ )
{
v_multc( input_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], gain, input_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_frame );
@@ -1624,29 +1626,24 @@ void ivas_binaural_cldfb(
}
#ifdef SPLIT_REND_WITH_HEAD_ROT
/*LFE handling for split rendering cases*/
- if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
for ( idx_lfe = 0; idx_lfe < st_ivas->hIntSetup.num_lfe; idx_lfe++ )
{
ch = st_ivas->hIntSetup.index_lfe[idx_lfe];
- cldfbAnalysis_ts( &( output_f[ch][maxBand * index_slot] ),
- Cldfb_RealBuffer[idx_in][slot_idx],
- Cldfb_ImagBuffer[idx_in][slot_idx],
- maxBand, st_ivas->cldfbAnaDec[idx_in] );
+ cldfbAnalysis_ts( &( output_f[ch][maxBand * index_slot] ), Cldfb_RealBuffer[idx_in][slot_idx], Cldfb_ImagBuffer[idx_in][slot_idx], maxBand, st_ivas->cldfbAnaDec[idx_in] );
idx_in++;
}
-#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( st_ivas->splitBinRend.hCldfbDataOut != NULL )
+
+ if ( st_ivas->hSplitBinRend.hCldfbDataOut != NULL )
{
for ( ch = 0; ch < ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ); ch++ )
{
- mvr2r( Cldfb_RealBuffer[ch][slot_idx], st_ivas->splitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
- mvr2r( Cldfb_ImagBuffer[ch][slot_idx], st_ivas->splitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
+ mvr2r( Cldfb_RealBuffer[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
+ mvr2r( Cldfb_ImagBuffer[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
}
- st_ivas->splitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
+ st_ivas->hSplitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
}
-#endif
}
#endif
}
@@ -1654,7 +1651,7 @@ void ivas_binaural_cldfb(
/* Implement binaural rendering */
ivas_binRenderer( st_ivas->hBinRenderer,
#ifdef SPLIT_REND_WITH_HEAD_ROT
- &st_ivas->splitBinRend.splitrend.multiBinPoseData,
+ &st_ivas->hSplitBinRend.splitrend.multiBinPoseData,
#endif
st_ivas->hCombinedOrientationData,
subframeIdx, JBM_CLDFB_SLOTS_IN_SUBFRAME,
@@ -1662,12 +1659,10 @@ void ivas_binaural_cldfb(
NULL,
#endif
Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural,
- Cldfb_RealBuffer,
- Cldfb_ImagBuffer );
+ Cldfb_RealBuffer, Cldfb_ImagBuffer );
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
int16_t pos_idx;
for ( slot_idx = 0; slot_idx < JBM_CLDFB_SLOTS_IN_SUBFRAME; slot_idx++ )
@@ -1678,6 +1673,7 @@ void ivas_binaural_cldfb(
v_multc( Cldfb_ImagBuffer[st_ivas->hIntSetup.nchan_out_woLFE][slot_idx], GAIN_LFE, Cldfb_ImagBuffer[st_ivas->hIntSetup.nchan_out_woLFE][slot_idx], maxBand );
}
}
+
for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ )
{
for ( slot_idx = 0; slot_idx < JBM_CLDFB_SLOTS_IN_SUBFRAME; slot_idx++ )
@@ -1690,13 +1686,15 @@ void ivas_binaural_cldfb(
Cldfb_RealBuffer[st_ivas->hIntSetup.nchan_out_woLFE][slot_idx],
Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx],
maxBand );
+
v_add( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx],
Cldfb_ImagBuffer[st_ivas->hIntSetup.nchan_out_woLFE][slot_idx],
Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx],
maxBand );
}
- mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
- mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
+
+ mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
+ mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
}
}
}
@@ -1793,13 +1791,11 @@ void ivas_binaural_cldfb_sf(
}
else
{
- cldfbAnalysis_ts( &( st_ivas->hTcBuffer->tc[ch][maxBand * index_slot] ),
- Cldfb_RealBuffer[idx_in][slot_idx],
- Cldfb_ImagBuffer[idx_in][slot_idx],
- maxBand, st_ivas->cldfbAnaDec[idx_in] );
+ cldfbAnalysis_ts( &( st_ivas->hTcBuffer->tc[ch][maxBand * index_slot] ), Cldfb_RealBuffer[idx_in][slot_idx], Cldfb_ImagBuffer[idx_in][slot_idx], maxBand, st_ivas->cldfbAnaDec[idx_in] );
idx_in++;
}
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
/*LFE handling for split rendering cases*/
if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
@@ -1808,21 +1804,19 @@ void ivas_binaural_cldfb_sf(
for ( idx_lfe = 0; idx_lfe < st_ivas->hIntSetup.num_lfe; idx_lfe++ )
{
ch = st_ivas->hIntSetup.index_lfe[idx_lfe];
- cldfbAnalysis_ts( &( output_f[ch][maxBand * index_slot] ),
- Cldfb_RealBuffer[idx_in][slot_idx],
- Cldfb_ImagBuffer[idx_in][slot_idx],
- maxBand, st_ivas->cldfbAnaDec[idx_in] );
+ cldfbAnalysis_ts( &( output_f[ch][maxBand * index_slot] ), Cldfb_RealBuffer[idx_in][slot_idx], Cldfb_ImagBuffer[idx_in][slot_idx], maxBand, st_ivas->cldfbAnaDec[idx_in] );
idx_in++;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( st_ivas->splitBinRend.hCldfbDataOut != NULL )
+ if ( st_ivas->hSplitBinRend.hCldfbDataOut != NULL )
{
for ( ch = 0; ch < ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ); ch++ )
{
- mvr2r( Cldfb_RealBuffer[ch][slot_idx], st_ivas->splitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][slot_index_start + slot_idx], maxBand );
- mvr2r( Cldfb_ImagBuffer[ch][slot_idx], st_ivas->splitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_index_start + slot_idx], maxBand );
+ mvr2r( Cldfb_RealBuffer[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][slot_index_start + slot_idx], maxBand );
+ mvr2r( Cldfb_ImagBuffer[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_index_start + slot_idx], maxBand );
}
- st_ivas->splitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
+ st_ivas->hSplitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
}
#endif
}
@@ -1832,13 +1826,12 @@ void ivas_binaural_cldfb_sf(
/* Implement binaural rendering */
ivas_binRenderer( st_ivas->hBinRenderer,
#ifdef SPLIT_REND_WITH_HEAD_ROT
- &st_ivas->splitBinRend.splitrend.multiBinPoseData,
+ &st_ivas->hSplitBinRend.splitrend.multiBinPoseData,
#endif
st_ivas->hCombinedOrientationData, subframeIdx, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer );
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
int16_t pos_idx;
for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ )
@@ -1847,8 +1840,8 @@ void ivas_binaural_cldfb_sf(
{
for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ )
{
- mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_index_start + slot_idx], maxBand );
- mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_index_start + slot_idx], maxBand );
+ mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_index_start + slot_idx], maxBand );
+ mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_index_start + slot_idx], maxBand );
}
}
}
@@ -1946,7 +1939,7 @@ void ivas_binRenderer(
set_zero( Cldfb_ImagBuffer_Binaural[chIdx][k], CLDFB_NO_CHANNELS_MAX );
}
}
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
+#endif
/* Head rotation in HOA3 or CICPx */
if (
@@ -2045,7 +2038,7 @@ void ivas_binRenderer(
}
}
}
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
+#endif
/* Obtain the binaural dmx and compute the reverb */
if ( hBinRenderer->hReverb != NULL )
@@ -2093,7 +2086,14 @@ void ivas_binRenderer(
return;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
+/*-------------------------------------------------------------------------
+ * ivas_rend_CldfbMultiBinRendProcess()
+ *
+ *
+ *-------------------------------------------------------------------------*/
+
void ivas_rend_CldfbMultiBinRendProcess(
const BINAURAL_RENDERER_HANDLE hCldfbRend,
const COMBINED_ORIENTATION_HANDLE *pCombinedOrientationData,
@@ -2116,7 +2116,6 @@ void ivas_rend_CldfbMultiBinRendProcess(
float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
#endif
-
for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ )
{
for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ )
@@ -2144,15 +2143,14 @@ void ivas_rend_CldfbMultiBinRendProcess(
}
( *pCombinedOrientationData )->shd_rot_max_order = -1;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
head_track_post.num_quaternions = 0;
head_track_post.shd_rot_max_order = -1;
head_track_post.Quaternions[0] = ivas_split_rend_get_sf_rot_data( pHeadRotData->headPositionsPostRend, sf_idx );
#endif
- ivas_binRenderer( hCldfbRend,
- pMultiBinPoseData,
- *pCombinedOrientationData, sf_idx, MAX_PARAM_SPATIAL_SUBFRAMES,
+ ivas_binRenderer( hCldfbRend, pMultiBinPoseData, *pCombinedOrientationData, sf_idx, MAX_PARAM_SPATIAL_SUBFRAMES,
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
&head_track_post,
#endif
@@ -2174,4 +2172,4 @@ void ivas_rend_CldfbMultiBinRendProcess(
return;
}
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
+#endif
diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c
index 899778316a29164f28771188eab411ac9ae56549..b7a0297bf6690ab6f635e95d6dfffd051abcf74e 100644
--- a/lib_dec/ivas_dec.c
+++ b/lib_dec/ivas_dec.c
@@ -56,7 +56,7 @@ ivas_error ivas_dec(
int16_t *data /* o : output synthesis signal */
#ifdef SPLIT_REND_WITH_HEAD_ROT
,
- IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits
+ uint8_t *splitRendBitsBuf /* o : output split rendering bits */
#endif
)
{
@@ -154,8 +154,11 @@ ivas_error ivas_dec(
}
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ /*----------------------------------------------------------------*
+ * Split rendering setup
+ *----------------------------------------------------------------*/
+
+ if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
assert( ( st_ivas->ivas_format != UNDEFINED_FORMAT &&
@@ -170,9 +173,13 @@ ivas_error ivas_dec(
( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCMASA ) ) &&
( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA, discrete ISM, or MCT-MC formats and 48 kHz sampling rate only" );
#endif
- ivas_set_split_rend_setup( &st_ivas->splitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hCombinedOrientationData, hSplitRendBits );
+ if ( ( error = ivas_set_split_rend_setup( &st_ivas->hSplitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hCombinedOrientationData, splitRendBitsBuf ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
}
#endif
+
/*----------------------------------------------------------------*
* Decoding + Rendering
*----------------------------------------------------------------*/
@@ -360,10 +367,12 @@ ivas_error ivas_dec(
if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD )
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
- ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame );
+ if ( ( error = ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
}
else
{
@@ -452,7 +461,7 @@ ivas_error ivas_dec(
/* SCE Decoder Output */
for ( int16_t t = 0; t < 960; t++ )
{
- for ( int c = 0; c < st_ivas->nchan_transport; c++ )
+ for ( int16_t c = 0; c < st_ivas->nchan_transport; c++ )
{
float val = output[c][t] / MAX16B_FLT;
dbgwrite( &val, sizeof( float ), 1, 1, "int_dec_core_out.raw" );
@@ -914,20 +923,13 @@ ivas_error ivas_dec(
if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM )
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
- ivas_rend_crendProcessSplitBin(
- st_ivas->hCrendWrapper,
- st_ivas->intern_config,
- st_ivas->hOutSetup.output_config,
- &st_ivas->splitBinRend.splitrend.multiBinPoseData,
- st_ivas->hDecoderConfig,
- st_ivas->hCombinedOrientationData,
- &st_ivas->hIntSetup,
- st_ivas->hEFAPdata,
- p_output,
- output_Fs );
+ if ( ( error = ivas_rend_crendProcessSplitBin( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, &st_ivas->hSplitBinRend.splitrend.multiBinPoseData, st_ivas->hDecoderConfig,
+ st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
}
else
{
@@ -960,10 +962,12 @@ ivas_error ivas_dec(
else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD )
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
- ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame );
+ if ( ( error = ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
}
else
{
@@ -1020,8 +1024,7 @@ ivas_error ivas_dec(
if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) &&
- ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
#endif
{
ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output );
@@ -1045,15 +1048,17 @@ ivas_error ivas_dec(
else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD )
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
- ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame );
+ if ( ( error = ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
}
else
{
#endif
- if ( ( ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK )
+ if ( ( error = ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -1202,9 +1207,11 @@ ivas_error ivas_dec(
#ifdef SPLIT_REND_WITH_HEAD_ROT
- /*split rendering process calls*/
- if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ /*----------------------------------------------------------------*
+ * Split rendering process calls
+ *----------------------------------------------------------------*/
+
+ if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend;
int16_t max_band;
@@ -1214,17 +1221,12 @@ ivas_error ivas_dec(
td_input = st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC;
#endif
- hSplitBinRend = &st_ivas->splitBinRend;
+ hSplitBinRend = &st_ivas->hSplitBinRend;
max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 );
pcm_out = ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
- if ( ( error = ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend,
- st_ivas->hHeadTrackData->Quaternions,
- st_ivas->hRenderConfig->split_rend_config.splitRendBitRate,
- st_ivas->hRenderConfig->split_rend_config.codec,
- hSplitBinRend->hSplitRendBits,
- hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural,
- hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural,
+ if ( ( error = ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend, st_ivas->hHeadTrackData->Quaternions, st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, st_ivas->hRenderConfig->split_rend_config.codec, hSplitBinRend->hSplitRendBits,
+ hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural, hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural,
max_band, output, 1,
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
td_input,
@@ -1236,10 +1238,11 @@ ivas_error ivas_dec(
return error;
}
- free( st_ivas->splitBinRend.hMultiBinCldfbData );
+ free( st_ivas->hSplitBinRend.hMultiBinCldfbData );
+ st_ivas->hSplitBinRend.hMultiBinCldfbData = NULL;
}
-
#endif
+
/*----------------------------------------------------------------*
* Write IVAS output channels
* - compensation for saturation
diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c
index d33f06765e5abf0158494747b2afaeb1adc84ca1..abd09846a74fba26043418c814b8a53ee2dcea56 100644
--- a/lib_dec/ivas_dirac_dec.c
+++ b/lib_dec/ivas_dirac_dec.c
@@ -953,7 +953,7 @@ ivas_error ivas_dirac_dec_config(
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
/* copy td-decorr flag to split renderer side rendereres */
- for ( int16_t pos_idx = 1; pos_idx < st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses; pos_idx++ )
+ for ( int16_t pos_idx = 1; pos_idx < st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses; pos_idx++ )
{
st_ivas->hDiracDecBin[pos_idx]->useTdDecorr = st_ivas->hDiracDecBin[0]->useTdDecorr;
}
@@ -971,7 +971,9 @@ ivas_error ivas_dirac_dec_config(
#endif
{
float frequency_axis[CLDFB_NO_CHANNELS_MAX];
+
ivas_dirac_dec_get_frequency_axis( frequency_axis, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSpatParamRendCom->num_freq_bands );
+
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
if ( ( error = ivas_dirac_dec_decorr_open( &( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_params ),
&( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_state ),
@@ -993,7 +995,7 @@ ivas_error ivas_dirac_dec_config(
}
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
- for ( int16_t pos_idx = 0; pos_idx < st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses; pos_idx++ )
+ for ( int16_t pos_idx = 0; pos_idx < st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses; pos_idx++ )
{
st_ivas->hDiracDecBin[pos_idx]->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate );
}
@@ -2441,7 +2443,6 @@ void ivas_dirac_dec_render_sf(
qualityBasedSmFactor *= qualityBasedSmFactor;
}
-
ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( Cldfb_RealBuffer,
Cldfb_ImagBuffer,
hSpatParamRendCom,
@@ -2462,20 +2463,19 @@ void ivas_dirac_dec_render_sf(
if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
- if ( st_ivas->splitBinRend.hCldfbDataOut != NULL )
+ if ( st_ivas->hSplitBinRend.hCldfbDataOut != NULL )
{
for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ )
{
for ( ch = 0; ch < st_ivas->hBinRenderer->nInChannels; ch++ )
{
- mvr2r( Cldfb_RealBuffer[ch][slot_idx], st_ivas->splitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][slot_idx_start + slot_idx], hSpatParamRendCom->num_freq_bands );
- mvr2r( Cldfb_ImagBuffer[ch][slot_idx], st_ivas->splitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_idx_start + slot_idx], hSpatParamRendCom->num_freq_bands );
+ mvr2r( Cldfb_RealBuffer[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][slot_idx_start + slot_idx], hSpatParamRendCom->num_freq_bands );
+ mvr2r( Cldfb_ImagBuffer[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_idx_start + slot_idx], hSpatParamRendCom->num_freq_bands );
}
}
- st_ivas->splitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
+ st_ivas->hSplitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
}
}
#endif
@@ -2483,19 +2483,12 @@ void ivas_dirac_dec_render_sf(
/* Perform binaural rendering */
ivas_binRenderer( st_ivas->hBinRenderer,
#ifdef SPLIT_REND_WITH_HEAD_ROT
- &st_ivas->splitBinRend.splitrend.multiBinPoseData,
+ &st_ivas->hSplitBinRend.splitrend.multiBinPoseData,
#endif
- st_ivas->hCombinedOrientationData,
- subframe_idx,
- hSpatParamRendCom->subframe_nbslots[subframe_idx],
- Cldfb_RealBuffer_Binaural,
- Cldfb_ImagBuffer_Binaural,
- Cldfb_RealBuffer,
- Cldfb_ImagBuffer );
+ st_ivas->hCombinedOrientationData, subframe_idx, hSpatParamRendCom->subframe_nbslots[subframe_idx], Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer );
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
int16_t pos_idx;
for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ )
@@ -2504,13 +2497,14 @@ void ivas_dirac_dec_render_sf(
{
for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ )
{
- mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hSpatParamRendCom->num_freq_bands );
- mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hSpatParamRendCom->num_freq_bands );
+ mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hSpatParamRendCom->num_freq_bands );
+ mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hSpatParamRendCom->num_freq_bands );
}
}
}
}
#endif
+
/* Inverse CLDFB*/
for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ )
{
@@ -2529,11 +2523,7 @@ void ivas_dirac_dec_render_sf(
#endif
}
- cldfbSynthesis( RealBuffer,
- ImagBuffer,
- &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ),
- hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx],
- st_ivas->cldfbSynDec[ch] );
+ cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] );
}
}
#ifdef SBA_AND_OBJECTS
diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c
index b936fd20f99071daf421802c1de97f2e3d428f44..e900c153137edb0d9697c891109a0a248188db72 100644
--- a/lib_dec/ivas_init_dec.c
+++ b/lib_dec/ivas_init_dec.c
@@ -37,6 +37,9 @@
#include "ivas_rom_com.h"
#include "ivas_stat_enc.h"
#include "prot.h"
+#ifdef SPLIT_REND_WITH_HEAD_ROT
+#include "common_api_types.h"
+#endif
#include
#include
#include
@@ -53,16 +56,17 @@
static ivas_error ivas_read_format( Decoder_Struct *st_ivas, int16_t *num_bits_read );
static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas );
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
static ivas_error ivas_dec_reconfig_split_rend( Decoder_Struct *st_ivas );
-#endif
-#ifdef SPLIT_REND_WITH_HEAD_ROT
+
/*-------------------------------------------------------------------*
* ivas_dec_reconfig_split_rend()
*
* IVAS decoder split rend reconfig
*-------------------------------------------------------------------*/
+
static ivas_error ivas_dec_reconfig_split_rend(
Decoder_Struct *st_ivas /* i : IVAS decoder structure */
)
@@ -74,9 +78,10 @@ static ivas_error ivas_dec_reconfig_split_rend(
CLDFB_TYPE cldfbMode;
#endif
- hSplitRendWrapper = &st_ivas->splitBinRend.splitrend;
+ hSplitRendWrapper = &st_ivas->hSplitBinRend.splitrend;
pcm_out = ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
cldfb_in = 0;
+
if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ||
st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ||
st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ||
@@ -84,10 +89,8 @@ static ivas_error ivas_dec_reconfig_split_rend(
{
cldfb_in = 1;
}
- ivas_renderSplitGetMultiBinPoseData(
- &st_ivas->hRenderConfig->split_rend_config,
- &hSplitRendWrapper->multiBinPoseData,
- st_ivas->hHeadTrackData->sr_pose_pred_axis );
+
+ ivas_renderSplitGetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &hSplitRendWrapper->multiBinPoseData, st_ivas->hHeadTrackData->sr_pose_pred_axis );
isCldfbNeeded = 0;
#ifndef OSBA_SPLIT_RENDERING
@@ -209,6 +212,7 @@ static ivas_error ivas_dec_reconfig_split_rend(
return IVAS_ERR_OK;
}
+
/*-------------------------------------------------------------------*
* ivas_dec_init_split_rend()
*
@@ -224,6 +228,7 @@ static ivas_error ivas_dec_init_split_rend(
pcm_out = ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
cldfb_in = 0;
+
if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ||
st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ||
st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ||
@@ -231,13 +236,12 @@ static ivas_error ivas_dec_init_split_rend(
{
cldfb_in = 1;
}
- ivas_renderSplitGetMultiBinPoseData(
- &st_ivas->hRenderConfig->split_rend_config,
- &st_ivas->splitBinRend.splitrend.multiBinPoseData,
- st_ivas->hHeadTrackData->sr_pose_pred_axis );
- if ( cldfb_in == 1 && ( st_ivas->splitBinRend.splitrend.multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) )
+
+ ivas_renderSplitGetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &st_ivas->hSplitBinRend.splitrend.multiBinPoseData, st_ivas->hHeadTrackData->sr_pose_pred_axis );
+
+ if ( cldfb_in == 1 && ( st_ivas->hSplitBinRend.splitrend.multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) )
{
- if ( ( st_ivas->splitBinRend.hCldfbDataOut = (IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE) malloc( sizeof( IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA ) ) ) == NULL )
+ if ( ( st_ivas->hSplitBinRend.hCldfbDataOut = (IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE) malloc( sizeof( IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for cldfb data out buffer\n" ) );
}
@@ -250,15 +254,29 @@ static ivas_error ivas_dec_init_split_rend(
cldfb_in = 0;
}
#endif
- error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend,
- &st_ivas->hRenderConfig->split_rend_config,
- st_ivas->hDecoderConfig->output_Fs,
- cldfb_in, pcm_out );
+ if ( ( error = ivas_split_renderer_open( &st_ivas->hSplitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in, pcm_out ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+
+ IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits;
+ if ( ( hSplitRendBits = (IVAS_SPLIT_REND_BITS_HANDLE) malloc( sizeof( IVAS_SPLIT_REND_BITS_DATA ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for split renderer Bits buffer\n" ) );
+ }
+
+ hSplitRendBits->bits_buf = NULL;
+ hSplitRendBits->bits_read = 0;
+ hSplitRendBits->bits_written = 0;
+ hSplitRendBits->buf_len = IVAS_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES;
+
+ st_ivas->hSplitBinRend.hSplitRendBits = hSplitRendBits;
return error;
}
#endif
+
/*-------------------------------------------------------------------*
* ivas_dec_setup()
*
@@ -266,7 +284,7 @@ static ivas_error ivas_dec_init_split_rend(
*-------------------------------------------------------------------*/
ivas_error ivas_dec_setup(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */
int16_t *data /* o : flushed PCM samples */
)
@@ -620,17 +638,6 @@ ivas_error ivas_dec_setup(
}
}
-#ifdef SPLIT_REND_WITH_HEAD_ROT
- /*-----------------------------------------------------------------*
- * reconfig split rendering as renderer might change after bitrate switching
- *-----------------------------------------------------------------*/
- if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
- {
- ivas_dec_reconfig_split_rend( st_ivas );
- }
-#endif
-
/*-------------------------------------------------------------------*
* Initialize decoder in the first good frame based on IVAS format
* and number of transport channels
@@ -649,6 +656,20 @@ ivas_error ivas_dec_setup(
}
}
+#ifdef SPLIT_REND_WITH_HEAD_ROT
+ /*-----------------------------------------------------------------*
+ * reconfig split rendering as renderer might change after bitrate switching
+ *-----------------------------------------------------------------*/
+
+ if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
+ {
+ if ( ( error = ivas_dec_reconfig_split_rend( st_ivas ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+ }
+#endif
+
/*----------------------------------------------------------------*
* Reset bitstream pointers
*----------------------------------------------------------------*/
@@ -1202,16 +1223,19 @@ ivas_error ivas_init_decoder(
#ifdef SPLIT_REND_WITH_HEAD_ROT
/*-----------------------------------------------------------------*
- * Initialize split rendering
+ * Initialize binuaral split rendering
*-----------------------------------------------------------------*/
- if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+
+ if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
- ivas_dec_init_split_rend( st_ivas );
+ if ( ( error = ivas_dec_init_split_rend( st_ivas ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
}
else
{
- st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses = 1;
+ st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses = 1;
}
#endif
@@ -1930,13 +1954,16 @@ ivas_error ivas_init_decoder(
/*-------------------------------------------------------------------*
* Allocate and initialize rendering handles
*--------------------------------------------------------------------*/
+
if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
{
+
if ( ( error = ivas_binRenderer_open( st_ivas ) ) != IVAS_ERR_OK )
{
return error;
}
}
+
/* ParamISM is handled separately from other common config */
else if ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) )
{
@@ -1969,6 +1996,7 @@ ivas_error ivas_init_decoder(
}
}
+
if ( st_ivas->hDecoderConfig->voip_active )
{
granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES );
@@ -2008,7 +2036,7 @@ ivas_error ivas_init_decoder(
st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs
#ifdef SPLIT_REND_WITH_HEAD_ROT
,
- st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses
+ st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses
#endif
) ) != IVAS_ERR_OK )
{
@@ -2132,8 +2160,7 @@ ivas_error ivas_init_decoder(
if ( st_ivas->hBinRenderer->render_lfe )
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) &&
- ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
#endif
{
/* Account for filterbank delay */
@@ -2468,12 +2495,6 @@ void ivas_initialize_handles_dec(
/* rendering handles */
st_ivas->hBinRenderer = NULL;
-#ifdef SPLIT_REND_WITH_HEAD_ROT
- st_ivas->splitBinRend.hMultiBinCldfbData = NULL;
- st_ivas->splitBinRend.hSplitRendBits = NULL;
- st_ivas->splitBinRend.hCldfbDataOut = NULL;
- ivas_init_split_rend_handles( &st_ivas->splitBinRend.splitrend );
-#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
for ( i = 0; i < MAX_HEAD_ROT_POSES; i++ )
{
@@ -2507,6 +2528,15 @@ void ivas_initialize_handles_dec(
st_ivas->hExtOrientationData = NULL;
st_ivas->hCombinedOrientationData = NULL;
+#ifdef SPLIT_REND_WITH_HEAD_ROT
+ /* Binuaral split rendering handles */
+ st_ivas->hSplitBinRend.hMultiBinCldfbData = NULL;
+ st_ivas->hSplitBinRend.hSplitRendBits = NULL;
+ st_ivas->hSplitBinRend.hCldfbDataOut = NULL;
+ ivas_init_split_rend_handles( &st_ivas->hSplitBinRend.splitrend );
+#endif
+
+ /* JBM handles */
st_ivas->hTcBuffer = NULL;
st_ivas->hJbmMetadata = NULL;
@@ -2652,12 +2682,21 @@ void ivas_destroy_dec(
/* Fastconv binaural renderer handle */
ivas_binRenderer_close( &st_ivas->hBinRenderer );
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
/* Split binaural renderer handle */
- ivas_split_renderer_close( &st_ivas->splitBinRend.splitrend );
- if ( st_ivas->splitBinRend.hCldfbDataOut != NULL )
+ ivas_split_renderer_close( &st_ivas->hSplitBinRend.splitrend );
+
+ if ( st_ivas->hSplitBinRend.hCldfbDataOut != NULL )
{
- free( st_ivas->splitBinRend.hCldfbDataOut );
+ free( st_ivas->hSplitBinRend.hCldfbDataOut );
+ st_ivas->hSplitBinRend.hCldfbDataOut = NULL;
+ }
+
+ if ( st_ivas->hSplitBinRend.hSplitRendBits != NULL )
+ {
+ free( st_ivas->hSplitBinRend.hSplitRendBits );
+ st_ivas->hSplitBinRend.hSplitRendBits = NULL;
}
#endif
@@ -2672,7 +2711,7 @@ void ivas_destroy_dec(
ivas_rend_closeCrend( &( st_ivas->hCrendWrapper )
#ifdef SPLIT_REND_WITH_HEAD_ROT
,
- st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses
+ st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses
#endif
);
@@ -3122,6 +3161,13 @@ static ivas_error doSanityChecks_IVAS(
}
}
+#ifdef SPLIT_REND_WITH_HEAD_ROT
+ if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) && output_Fs != 48000 )
+ {
+ return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Error: Only 48kHz output sampling rate is supported for split rendering." );
+ }
+#endif
+
if ( st_ivas->hDecoderConfig->Opt_Headrotation )
{
if ( !( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB
diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c
index 4ad262493fbd165def82c6f3d63aaa9b90c1a2f8..740c6581671458e87dd96406a3465bddb78bbd58 100644
--- a/lib_dec/ivas_ism_dec.c
+++ b/lib_dec/ivas_ism_dec.c
@@ -235,7 +235,7 @@ static ivas_error ivas_ism_bitrate_switching_dec(
if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs
#ifdef SPLIT_REND_WITH_HEAD_ROT
,
- st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses
+ st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses
#endif
) ) != IVAS_ERR_OK )
{
@@ -254,6 +254,7 @@ static ivas_error ivas_ism_bitrate_switching_dec(
{
return error;
}
+
if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB
#ifdef SPLIT_REND_WITH_HEAD_ROT
|| st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM
@@ -318,7 +319,7 @@ static ivas_error ivas_ism_bitrate_switching_dec(
ivas_rend_closeCrend( &( st_ivas->hCrendWrapper )
#ifdef SPLIT_REND_WITH_HEAD_ROT
,
- st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses
+ st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses
#endif
);
}
diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c
index 96815604f55deda190eb798114d398412a73a352..f7f339855002c76e05fdf8e1289b51c5dbd1431f 100644
--- a/lib_dec/ivas_jbm_dec.c
+++ b/lib_dec/ivas_jbm_dec.c
@@ -1120,8 +1120,7 @@ ivas_error ivas_jbm_dec_render(
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
/*handled in CLDFB domain already*/
- if ( ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) &&
- ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
#endif
{
ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_output, p_output );
diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c
index 0ba001d415aee165d188879bcfa20bf787f76ae0..25663a1241907f01ce074e24534eb35ee2324ab2 100644
--- a/lib_dec/ivas_mc_param_dec.c
+++ b/lib_dec/ivas_mc_param_dec.c
@@ -1756,7 +1756,7 @@ void ivas_param_mc_dec_render(
{
ivas_binRenderer( st_ivas->hBinRenderer,
#ifdef SPLIT_REND_WITH_HEAD_ROT
- &st_ivas->splitBinRend.splitrend.multiBinPoseData,
+ &st_ivas->hSplitBinRend.splitrend.multiBinPoseData,
#endif
st_ivas->hCombinedOrientationData, subframe_idx,
hParamMC->subframe_nbslots[subframe_idx],
@@ -1765,10 +1765,9 @@ void ivas_param_mc_dec_render(
NULL,
#endif
Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer );
-#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+#ifdef SPLIT_REND_WITH_HEAD_ROT
+ if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
int16_t pos_idx;
for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ )
@@ -1777,8 +1776,8 @@ void ivas_param_mc_dec_render(
{
for ( ch = 0; ch < nchan_out_cldfb; ch++ )
{
- mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands );
- mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands );
+ mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands );
+ mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands );
}
}
}
@@ -1818,6 +1817,7 @@ void ivas_param_mc_dec_render(
ImagBuffer[i] = Cldfb_ImagBuffer[ch][i];
}
}
+
cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands] ),
hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] );
}
diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c
index 06751a67c521ed19b10c6caad7fa57aac93e2be3..3c7b6113c6daed983470a14bfad72c6ee83114b5 100644
--- a/lib_dec/ivas_mc_paramupmix_dec.c
+++ b/lib_dec/ivas_mc_paramupmix_dec.c
@@ -308,6 +308,7 @@ void ivas_mc_paramupmix_dec(
idx_in++;
}
}
+
/* copy and reorder cldfb analysis of coupled channels */
for ( ch = 0; ch < MAX_PARAM_SPATIAL_SUBFRAMES; ch++ )
{
@@ -320,10 +321,10 @@ void ivas_mc_paramupmix_dec(
}
idx_in += 2;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
/*LFE handling for split rendering cases*/
- if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
for ( idx_lfe = 0; idx_lfe < st_ivas->hIntSetup.num_lfe; idx_lfe++ )
{
@@ -338,26 +339,28 @@ void ivas_mc_paramupmix_dec(
}
idx_in++;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( st_ivas->splitBinRend.hCldfbDataOut != NULL )
+ if ( st_ivas->hSplitBinRend.hCldfbDataOut != NULL )
{
for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ )
{
for ( ch = 0; ch < ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ); ch++ )
{
- mvr2r( Cldfb_RealBuffer_subfr[ch][slot_idx], st_ivas->splitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
- mvr2r( Cldfb_ImagBuffer_subfr[ch][slot_idx], st_ivas->splitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
+ mvr2r( Cldfb_RealBuffer_subfr[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
+ mvr2r( Cldfb_ImagBuffer_subfr[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
}
}
- st_ivas->splitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
+ st_ivas->hSplitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
}
#endif
}
#endif
+
/* Implement binaural rendering */
ivas_binRenderer( st_ivas->hBinRenderer,
#ifdef SPLIT_REND_WITH_HEAD_ROT
- &st_ivas->splitBinRend.splitrend.multiBinPoseData,
+ &st_ivas->hSplitBinRend.splitrend.multiBinPoseData,
#endif
st_ivas->hCombinedOrientationData,
subframeIdx, JBM_CLDFB_SLOTS_IN_SUBFRAME,
@@ -370,8 +373,7 @@ void ivas_mc_paramupmix_dec(
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
int16_t pos_idx;
for ( slot_idx = 0; slot_idx < JBM_CLDFB_SLOTS_IN_SUBFRAME; slot_idx++ )
@@ -394,13 +396,14 @@ void ivas_mc_paramupmix_dec(
Cldfb_RealBuffer_subfr[st_ivas->hIntSetup.nchan_out_woLFE][slot_idx],
Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx],
maxBand );
+
v_add( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx],
Cldfb_ImagBuffer_subfr[st_ivas->hIntSetup.nchan_out_woLFE][slot_idx],
Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx],
maxBand );
}
- mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
- mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
+ mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
+ mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
}
}
}
@@ -491,9 +494,9 @@ void ivas_mc_paramupmix_dec(
*------------------------------------------------------------------------*/
void ivas_mc_paramupmix_dec_digest_tc(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
- const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */
- const int16_t nSamplesForRendering /* i : number of samples provided */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
+ const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */
+ const int16_t nSamplesForRendering /* i : number of samples provided */
)
{
MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix;
@@ -1101,6 +1104,7 @@ static void ivas_mc_paramupmix_dec_sf(
idx_in++;
}
}
+
/* copy and reorder cldfb analysis of coupled channels */
for ( ch = 0; ch < MAX_PARAM_SPATIAL_SUBFRAMES; ch++ )
{
@@ -1113,10 +1117,10 @@ static void ivas_mc_paramupmix_dec_sf(
}
idx_in += 2;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
/*LFE handling for split rendering cases*/
- if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
for ( idx_lfe = 0; idx_lfe < st_ivas->hIntSetup.num_lfe; idx_lfe++ )
{
@@ -1130,26 +1134,29 @@ static void ivas_mc_paramupmix_dec_sf(
}
idx_in++;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( st_ivas->splitBinRend.hCldfbDataOut != NULL )
+ if ( st_ivas->hSplitBinRend.hCldfbDataOut != NULL )
{
for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ )
{
for ( ch = 0; ch < ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ); ch++ )
{
- mvr2r( Cldfb_RealBuffer_subfr[ch][slot_idx], st_ivas->splitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][slot_index_start + slot_idx], maxBand );
- mvr2r( Cldfb_ImagBuffer_subfr[ch][slot_idx], st_ivas->splitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_index_start + slot_idx], maxBand );
+ mvr2r( Cldfb_RealBuffer_subfr[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][slot_index_start + slot_idx], maxBand );
+ mvr2r( Cldfb_ImagBuffer_subfr[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_index_start + slot_idx], maxBand );
}
}
- st_ivas->splitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
+
+ st_ivas->hSplitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
}
#endif
}
#endif
+
/* Implement binaural rendering */
ivas_binRenderer( st_ivas->hBinRenderer,
#ifdef SPLIT_REND_WITH_HEAD_ROT
- &st_ivas->splitBinRend.splitrend.multiBinPoseData,
+ &st_ivas->hSplitBinRend.splitrend.multiBinPoseData,
#endif
st_ivas->hCombinedOrientationData,
subframeIdx, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx],
@@ -1158,8 +1165,7 @@ static void ivas_mc_paramupmix_dec_sf(
Cldfb_ImagBuffer_subfr );
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
int16_t pos_idx;
for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ )
@@ -1168,8 +1174,8 @@ static void ivas_mc_paramupmix_dec_sf(
{
for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ )
{
- mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_index_start + slot_idx], maxBand );
- mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_index_start + slot_idx], maxBand );
+ mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_index_start + slot_idx], maxBand );
+ mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_index_start + slot_idx], maxBand );
}
}
}
@@ -1341,10 +1347,10 @@ static void huffman_decode(
switch ( parType )
{
case ALPHA:
- nquant = ivas_param_upmx_alpha_quant_table[quant_type].nquant;
+ nquant = ivas_mc_paramupmix_alpha_quant_table[quant_type].nquant;
break;
case BETA:
- nquant = ivas_param_upmx_beta_quant_table[quant_type][0].nquant;
+ nquant = ivas_mc_paramupmix_beta_quant_table[quant_type][0].nquant;
break;
default:
assert( 0 );
@@ -1367,10 +1373,10 @@ static void huffman_decode(
switch ( parType )
{
case ALPHA:
- huff_node_table = huff_nodes_dt.alpha[quant_type];
+ huff_node_table = ivas_mc_paramupmix_huff_nodes_dt.alpha[quant_type];
break;
case BETA:
- huff_node_table = huff_nodes_dt.beta[quant_type];
+ huff_node_table = ivas_mc_paramupmix_huff_nodes_dt.beta[quant_type];
break;
default:
huff_node_table = NULL;
@@ -1386,10 +1392,10 @@ static void huffman_decode(
switch ( parType )
{
case ALPHA:
- huff_node_table = huff_nodes_df0.alpha[quant_type];
+ huff_node_table = ivas_mc_paramupmix_huff_nodes_df0.alpha[quant_type];
break;
case BETA:
- huff_node_table = huff_nodes_df0.beta[quant_type];
+ huff_node_table = ivas_mc_paramupmix_huff_nodes_df0.beta[quant_type];
break;
default:
huff_node_table = NULL;
@@ -1400,10 +1406,10 @@ static void huffman_decode(
switch ( parType )
{
case ALPHA:
- huff_node_table = huff_nodes_df.alpha[quant_type];
+ huff_node_table = ivas_mc_paramupmix_huff_nodes_df.alpha[quant_type];
break;
case BETA:
- huff_node_table = huff_nodes_df.beta[quant_type];
+ huff_node_table = ivas_mc_paramupmix_huff_nodes_df.beta[quant_type];
break;
default:
assert( 0 );
@@ -1427,7 +1433,7 @@ static void dequant_alpha(
float *v )
{
int16_t iv;
- const ACPL_QUANT_TABLE *quant_table = &ivas_param_upmx_alpha_quant_table[quant_type];
+ const ACPL_QUANT_TABLE *quant_table = &ivas_mc_paramupmix_alpha_quant_table[quant_type];
for ( iv = 0; iv < ivStart; iv++ )
{
@@ -1461,7 +1467,7 @@ static void dequant_beta(
for ( iv = ivStart; iv < nv; iv++ )
{
- quant_table = &ivas_param_upmx_beta_quant_table[quant_type][ivas_param_upmx_mx_qmap[quant_type][aq[iv]]];
+ quant_table = &ivas_mc_paramupmix_beta_quant_table[quant_type][ivas_param_upmx_mx_qmap[quant_type][aq[iv]]];
beta[iv] = quant_table->data[bq[iv]];
}
diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c
index 66ec3f9c6b10b2c2fc0b5e7cd947842df9d11c70..3d8a3ab62138b35dd6e9730a1a08e58c8ed3c852 100755
--- a/lib_dec/ivas_mct_dec.c
+++ b/lib_dec/ivas_mct_dec.c
@@ -1225,7 +1225,7 @@ static ivas_error ivas_mc_dec_reconfig(
ivas_rend_closeCrend( &( st_ivas->hCrendWrapper )
#ifdef SPLIT_REND_WITH_HEAD_ROT
,
- st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses
+ st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses
#endif
);
}
@@ -1277,6 +1277,7 @@ static ivas_error ivas_mc_dec_reconfig(
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" );
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
st_ivas->hCrendWrapper->hCrend[0] = NULL;
st_ivas->hCrendWrapper->hHrtfCrend = NULL;
@@ -1299,7 +1300,7 @@ static ivas_error ivas_mc_dec_reconfig(
if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs
#ifdef SPLIT_REND_WITH_HEAD_ROT
,
- st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses
+ st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses
#endif
) ) != IVAS_ERR_OK )
{
diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c
index eeb756ded535bdca7146c5e2866c148dde30611b..21c38a879dd1a1dcb4159c7712d48f03b9e8bcd9 100755
--- a/lib_dec/ivas_osba_dec.c
+++ b/lib_dec/ivas_osba_dec.c
@@ -211,27 +211,27 @@ ivas_error ivas_osba_dirac_td_binaural(
int16_t slot_idx, num_cldfb_bands, b, nchan_transport_orig;
float Cldfb_RealBuffer[CLDFB_NO_CHANNELS_MAX];
float Cldfb_ImagBuffer[CLDFB_NO_CHANNELS_MAX];
- num_cldfb_bands = st_ivas->splitBinRend.splitrend.hCldfbHandles->cldfbAna[0]->no_channels;
+
+ num_cldfb_bands = st_ivas->hSplitBinRend.splitrend.hCldfbHandles->cldfbAna[0]->no_channels;
nchan_transport_orig = st_ivas->nchan_transport;
st_ivas->nchan_transport = st_ivas->nchan_ism;
ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame );
st_ivas->nchan_transport = nchan_transport_orig;
- for ( n = 0; n < st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses * BINAURAL_CHANNELS; ++n )
+
+ for ( n = 0; n < st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses * BINAURAL_CHANNELS; ++n )
{
for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ )
{
- cldfbAnalysis_ts( &( output[n][num_cldfb_bands * slot_idx] ),
- Cldfb_RealBuffer,
- Cldfb_ImagBuffer,
- num_cldfb_bands,
- st_ivas->splitBinRend.splitrend.hCldfbHandles->cldfbAna[n] );
+ cldfbAnalysis_ts( &( output[n][num_cldfb_bands * slot_idx] ), Cldfb_RealBuffer, Cldfb_ImagBuffer, num_cldfb_bands, st_ivas->hSplitBinRend.splitrend.hCldfbHandles->cldfbAna[n] );
+
for ( b = 0; b < num_cldfb_bands; b++ )
{
- st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx][b] =
- ( 0.5f * st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx][b] ) +
+ st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx][b] =
+ ( 0.5f * st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx][b] ) +
( 0.5f * Cldfb_RealBuffer[b] );
- st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx][b] =
- ( 0.5f * st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx][b] ) +
+
+ st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx][b] =
+ ( 0.5f * st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx][b] ) +
( 0.5f * Cldfb_ImagBuffer[b] );
}
}
diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c
index 97f6fd134901c0b889742dab8ffc2d1edeaec537..76625c2a640c5bf2548a67399525cc55ed654abc 100644
--- a/lib_dec/ivas_output_config.c
+++ b/lib_dec/ivas_output_config.c
@@ -211,6 +211,7 @@ void ivas_renderer_select(
if ( st_ivas->mc_mode == MC_MODE_MCMASA )
{
*internal_config = output_config;
+
if ( output_config == AUDIO_CONFIG_BINAURAL
#ifdef SPLIT_REND_WITH_HEAD_ROT
|| output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM
@@ -227,11 +228,12 @@ void ivas_renderer_select(
else
{
*internal_config = transport_config;
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED )
#else
if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
+#endif
{
#ifdef DEBUGGING
if ( ( ( ( st_ivas->transport_config == AUDIO_CONFIG_5_1 || st_ivas->transport_config == AUDIO_CONFIG_7_1 ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) || ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) ) && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && !( st_ivas->hDecoderConfig->force_rend == FORCE_CLDFB_RENDERER ) )
@@ -566,37 +568,3 @@ void ivas_renderer_select(
return;
}
-
-#ifdef SPLIT_REND_WITH_HEAD_ROT
-void ivas_set_split_rend_setup( IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, IVAS_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits )
-{
- hSplitRendBits->bits_written = 0;
- hSplitRendBits->bits_read = 0;
- hSplitBinRend->hSplitRendBits = hSplitRendBits;
-
- hSplitBinRend->hMultiBinCldfbData = (IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) );
-
- ivas_renderSplitGetMultiBinPoseData(
- hSplitBinConfig,
- &hSplitBinRend->splitrend.multiBinPoseData,
- hCombinedOrientationData->sr_pose_pred_axis );
-
- if ( ( hCombinedOrientationData != NULL ) && ( hSplitBinRend->splitrend.multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) )
- {
- int16_t sf, i, j;
- for ( sf = 1; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ )
- {
- hCombinedOrientationData->Quaternions[sf] = hCombinedOrientationData->Quaternions[0];
- for ( i = 0; i < 3; i++ )
- {
- for ( j = 0; j < 3; j++ )
- {
- hCombinedOrientationData->Rmat[sf][i][j] = hCombinedOrientationData->Rmat[0][i][j];
- }
- }
- }
- }
-
- return;
-}
-#endif
diff --git a/lib_dec/ivas_rom_dec.c b/lib_dec/ivas_rom_dec.c
index f89b22022cbcc3540730ff5e420be183d9127da2..fc191e0deb938034ac1997daa6042ab7c776f4ab 100644
--- a/lib_dec/ivas_rom_dec.c
+++ b/lib_dec/ivas_rom_dec.c
@@ -543,42 +543,42 @@ const float dmxmtx_table[BINAURAL_CHANNELS][11] =
#ifdef SPLIT_REND_WITH_HEAD_ROT
/*----------------------------------------------------------------------*
- * split rendering ROM tables
+ * Binuaral split rendering ROM tables
*-----------------------------------------------------------------------*/
-/*rotations in this array are relative to ref rotation */
-const float split_rend_relative_yaw_pos_angles[SPLIT_REND_MAX_YAW_ONLY_POSES] = {-15.0f, 15.0f};
-const float split_rend_relative_pitch_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {10.0f, 10.0f};
-const float split_rend_relative_roll_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {10.0f, 10.0f};
-const float split_rend_relative_one_axis_pos_angles[SPLIT_REND_MAX_ONE_AXIS_MD_POSES] = {-15.0f, 15.0f};
+/* rotations in this array are relative to ref rotation */
+const float ivas_split_rend_relative_yaw_pos_angles[SPLIT_REND_MAX_YAW_ONLY_POSES] = {-15.0f, 15.0f};
+const float ivas_split_rend_relative_pitch_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {10.0f, 10.0f};
+const float ivas_split_rend_relative_roll_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {10.0f, 10.0f};
+const float ivas_split_rend_relative_one_axis_pos_angles[SPLIT_REND_MAX_ONE_AXIS_MD_POSES] = {-15.0f, 15.0f};
-const float split_rend_relative_yaw_pos_angles_hq[SPLIT_REND_MAX_YAW_ONLY_POSES] = {-15.0f, 15.0f};
-const float split_rend_relative_pitch_pos_angles_hq[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {-15.0f, 15.0f};
-const float split_rend_relative_roll_pos_angles_hq[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {-15.0f, 15.0f};
-const float split_rend_relative_one_axis_pos_angles_hq[SPLIT_REND_MAX_ONE_AXIS_MD_POSES] = {-15.0f, 15.0f};
+const float ivas_split_rend_relative_yaw_pos_angles_hq[SPLIT_REND_MAX_YAW_ONLY_POSES] = {-15.0f, 15.0f};
+const float ivas_split_rend_relative_pitch_pos_angles_hq[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {-15.0f, 15.0f};
+const float ivas_split_rend_relative_roll_pos_angles_hq[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {-15.0f, 15.0f};
+const float ivas_split_rend_relative_one_axis_pos_angles_hq[SPLIT_REND_MAX_ONE_AXIS_MD_POSES] = {-15.0f, 15.0f};
-const int16_t SplitRend_band_grouping[MAX_SPLIT_REND_MD_BANDS + 1] =
+const int16_t ivas_split_rend_band_grouping[MAX_SPLIT_REND_MD_BANDS + 1] =
{
- //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 32, 34, 36, 38, 40, 50, 60
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 20, 25, 30, 35, 40, 50, 60
- //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 21, 23, 25, 27, 30, 35, 40, 50, 60
- //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 25, 40, 60
};
-const int32_t ivas_split_rend_huff_p_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3] = {
-{0,8,252},{1,8,253},{2,7,124},{3,6,60},{4,5,28},{5,4,12},
-{6,3,4},{7,1,0},{8,3,5},{9,4,13},{10,5,29},{11,6,61},
-{12,7,125},{13,8,254},{14,8,255}
+const int32_t ivas_split_rend_huff_p_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3] =
+{
+ {0,8,252},{1,8,253},{2,7,124},{3,6,60},{4,5,28},{5,4,12},
+ {6,3,4},{7,1,0},{8,3,5},{9,4,13},{10,5,29},{11,6,61},
+ {12,7,125},{13,8,254},{14,8,255}
};
-const int32_t ivas_split_rend_huff_p_d_diff_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3] = {
+const int32_t ivas_split_rend_huff_p_d_diff_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3] =
+{
{ 0, 1, 0 },{ 1, 2, 2 },{ 2, 3, 6 },{ 3, 4, 14 },
{ 4, 5, 30 },{ 5, 6, 62 },{ 6, 7, 126 },{ 7, 8, 254 },
{ 8, 9, 510 },{ 9, 10, 1022 },{ 10, 11, 2046 },{ 11, 12, 4094 },
{ 12, 13, 8190 },{ 13, 14, 16382 },{ 14, 14, 16383 }
};
-const int32_t ivas_split_rend_huff_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3] = {
+const int32_t ivas_split_rend_huff_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3] =
+{
{ 0, 1, 0 },{ 1, 2, 2 },{ 2, 3, 6 },{ 3, 4, 14 },
{ 4, 5, 30 },{ 5, 6, 62 },{ 6, 7, 126 },{ 7, 8, 254 },
{ 8, 9, 510 },{ 9, 10, 1022 },{ 10, 11, 2046 },{ 11, 12, 4094 },
@@ -586,91 +586,97 @@ const int32_t ivas_split_rend_huff_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3] = {
};
#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
-const int32_t ivas_split_rend_huff_pred63_consts[IVAS_SPLIT_REND_PRED_63QUANT_PNTS][3] = {
-{-31,11,2040},
-{-30,11,2041},
-{-29,11,2042},
-{-28,11,2043},
-{-27,10,1012},
-{-26,10,1013},
-{-25,10,1014},
-{-24,10,1015},
-{-23,9,498},
-{-22,9,499},
-{-21,9,500},
-{-20,9,501},
-{-19,8,242},
-{-18,8,243},
-{-17,8,244},
-{-16,8,245},
-{-15,7,112},
-{-14,7,113},
-{-13,7,114},
-{-12,7,115},
-{-11,6,48},
-{-10,6,49},
-{-9,6,50},
-{-8,6,51},
-{-7,5,16},
-{-6,5,17},
-{-5,5,18},
-{-4,5,19},
-{-3,4,2},
-{-2,4,3},
-{-1,4,4},
-{0,3,0},
-{1,4,5},
-{2,4,6},
-{3,4,7},
-{4,5,20},
-{5,5,21},
-{6,5,22},
-{7,5,23},
-{8,6,52},
-{9,6,53},
-{10,6,54},
-{11,6,55},
-{12,7,116},
-{13,7,117},
-{14,7,118},
-{15,7,119},
-{16,7,120},
-{17,8,246},
-{18,8,247},
-{19,8,248},
-{20,9,502},
-{21,9,503},
-{22,9,504},
-{23,9,505},
-{24,10,1016},
-{25,10,1017},
-{26,10,1018},
-{27,10,1019},
-{28,11,2044},
-{29,11,2045},
-{30,11,2046},
-{31,11,2047},
-};
-const int32_t ivas_split_rend_huff_pred31_consts[IVAS_SPLIT_REND_PRED_31QUANT_PNTS][3] = {
-{-15,10,1020},{-14,10,1021},{-13,9,506},{-12,9,507},
-{-11,8,250},{-10,8,251},{-9,7,120},{-8,7,121},
-{-7,6,56},{-6,6,57},{-5,5,24},{-4,5,25},{-3,4,8},
-{-2,4,9},{-1,3,2},{0,2,0},{1,3,3},
-{2,4,10},{3,4,11},{4,5,26},{5,5,27},
-{6,6,58},{7,6,59},{8,7,122},{9,7,123},
-{10,7,124},{11,8,252},{12,9,508},{13,9,509},
-{14,10,1022},{15,10,1023},
-};
-const int32_t ivas_split_rend_huff_roll_pred_consts[IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS][3] = {
-{-15,10,1020},{-14,10,1021},{-13,9,506},{-12,9,507},
-{-11,8,250},{-10,8,251},{-9,7,120},{-8,7,121},
-{-7,6,56},{-6,6,57},{-5,5,24},{-4,5,25},{-3,4,8},
-{-2,4,9},{-1,3,2},{0,2,0},{1,3,3},
-{2,4,10},{3,4,11},{4,5,26},{5,5,27},
-{6,6,58},{7,6,59},{8,7,122},{9,7,123},
-{10,7,124},{11,8,252},{12,9,508},{13,9,509},
+const int32_t ivas_split_rend_huff_pred63_consts[IVAS_SPLIT_REND_PRED_63QUANT_PNTS][3] =
+{
+ {-31,11,2040},
+ {-30,11,2041},
+ {-29,11,2042},
+ {-28,11,2043},
+ {-27,10,1012},
+ {-26,10,1013},
+ {-25,10,1014},
+ {-24,10,1015},
+ {-23,9,498},
+ {-22,9,499},
+ {-21,9,500},
+ {-20,9,501},
+ {-19,8,242},
+ {-18,8,243},
+ {-17,8,244},
+ {-16,8,245},
+ {-15,7,112},
+ {-14,7,113},
+ {-13,7,114},
+ {-12,7,115},
+ {-11,6,48},
+ {-10,6,49},
+ {-9,6,50},
+ {-8,6,51},
+ {-7,5,16},
+ {-6,5,17},
+ {-5,5,18},
+ {-4,5,19},
+ {-3,4,2},
+ {-2,4,3},
+ {-1,4,4},
+ {0,3,0},
+ {1,4,5},
+ {2,4,6},
+ {3,4,7},
+ {4,5,20},
+ {5,5,21},
+ {6,5,22},
+ {7,5,23},
+ {8,6,52},
+ {9,6,53},
+ {10,6,54},
+ {11,6,55},
+ {12,7,116},
+ {13,7,117},
+ {14,7,118},
+ {15,7,119},
+ {16,7,120},
+ {17,8,246},
+ {18,8,247},
+ {19,8,248},
+ {20,9,502},
+ {21,9,503},
+ {22,9,504},
+ {23,9,505},
+ {24,10,1016},
+ {25,10,1017},
+ {26,10,1018},
+ {27,10,1019},
+ {28,11,2044},
+ {29,11,2045},
+ {30,11,2046},
+ {31,11,2047},
+};
+
+const int32_t ivas_split_rend_huff_pred31_consts[IVAS_SPLIT_REND_PRED_31QUANT_PNTS][3] =
+{
+ {-15,10,1020},{-14,10,1021},{-13,9,506},{-12,9,507},
+ {-11,8,250},{-10,8,251},{-9,7,120},{-8,7,121},
+ {-7,6,56},{-6,6,57},{-5,5,24},{-4,5,25},{-3,4,8},
+ {-2,4,9},{-1,3,2},{0,2,0},{1,3,3},
+ {2,4,10},{3,4,11},{4,5,26},{5,5,27},
+ {6,6,58},{7,6,59},{8,7,122},{9,7,123},
+ {10,7,124},{11,8,252},{12,9,508},{13,9,509},
+ {14,10,1022},{15,10,1023},
+};
+
+const int32_t ivas_split_rend_huff_roll_pred_consts[IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS][3] =
+{
+ {-15,10,1020},{-14,10,1021},{-13,9,506},{-12,9,507},
+ {-11,8,250},{-10,8,251},{-9,7,120},{-8,7,121},
+ {-7,6,56},{-6,6,57},{-5,5,24},{-4,5,25},{-3,4,8},
+ {-2,4,9},{-1,3,2},{0,2,0},{1,3,3},
+ {2,4,10},{3,4,11},{4,5,26},{5,5,27},
+ {6,6,58},{7,6,59},{8,7,122},{9,7,123},
+ {10,7,124},{11,8,252},{12,9,508},{13,9,509},
{14,10,1022},{15,10,1023},
};
+
#else
const int32_t ivas_split_rend_huff_pred_consts[IVAS_SPLIT_REND_PRED_QUANT_PNTS][3] = {
{-15,10,1020},{-14,10,1021},{-13,9,506},{-12,9,507},
@@ -683,290 +689,333 @@ const int32_t ivas_split_rend_huff_pred_consts[IVAS_SPLIT_REND_PRED_QUANT_PNTS][
{14,10,1022},{15,10,1023},
};
#endif
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
-
-const int16_t huff_nodes_first_band_alpha[32][2] = { /* Alpha Fine Huffman table df0 */
- { -17, 1 },
- { 3, 2 },
- { -16, -18 },
- { 5, 4 },
- { -15, 6 },
- { -19, 7 },
- { 9, 8 },
- { 11, 10 },
- { -14, -20 },
- { 13, 12 },
- { -21, 14 },
- { -13, 15 },
- { 17, 16 },
- { -22, 18 },
- { -12, 19 },
- { -9, -10 },
- { -11, 20 },
- { -23, 21 },
- { -8, 22 },
- { -24, 23 },
- { -25, 24 },
- { -7, 25 },
- { -26, 26 },
- { 28, 27 },
- { -6, -27 },
- { -33, 29 },
- { -1, -28 },
- { -5, 30 },
- { -29, -30 },
- { -4, 31 },
- { -3, -31 },
- { -2, -32 }
-};
-const int16_t huff_nodes_first_band_alpha_coarse[16][2] = { /* Alpha Coarse Huffman table df0 */
- { -9, 1 },
- { -8, 2 },
- { -10, 3 },
- { 5, 4 },
- { -7, 6 },
- { -11, 7 },
- { -5, 8 },
- { -6, 9 },
- { -12, 10 },
- { -13, 11 },
- { -4, 12 },
- { -14, 13 },
- { -3, 14 },
- { -15, 15 },
- { -2, -16 },
- { -1, -17 }
-};
-
-
-const int16_t huff_nodes_alpha_1D_DF[64][2] = { /* Alpha Fine Huffman table df */
- { -33, 1 },
- { 3, 2 },
- { -32, -34 },
- { 5, 4 },
- { -31, -35 },
- { 7, 6 },
- { -30, 8 },
- { -36, 9 },
- { 11, 10 },
- { -37, 12 },
- { -29, 13 },
- { -28, 14 },
- { -38, 15 },
- { 17, 16 },
- { -27, -39 },
- { 19, 18 },
- { -26, 20 },
- { -40, 21 },
- { 23, 22 },
- { -41, 24 },
- { -25, 25 },
- { -24, 26 },
- { -42, 27 },
- { -43, 28 },
- { -23, 29 },
- { -44, 30 },
- { -22, 31 },
- { -45, 32 },
- { -21, 33 },
- { -20, 34 },
- { -46, 35 },
- { -19, 36 },
- { -47, 37 },
- { -18, -48 },
- { 39, 38 },
- { -17, -49 },
- { 41, 40 },
- { -16, 42 },
- { -1, -50 },
- { -65, 43 },
- { 45, 44 },
- { -51, 46 },
- { -15, 47 },
- { 49, 48 },
- { -52, 50 },
- { -14, 51 },
- { 53, 52 },
- { -13, 54 },
- { -53, 55 },
- { 57, 56 },
- { -12, 58 },
- { -54, 59 },
- { 61, 60 },
- { -55, 62 },
- { -11, 63 },
- { -10, -61 },
- { -5, -57 },
- { -58, -60 },
- { -56, -59 },
- { -4, -6 },
- { -7, -64 },
- { -9, -63 },
- { -3, -8 },
- { -2, -62 }
-};
-const int16_t huff_nodes_alpha_1D_DF_coarse[32][2] = { /* Alpha Coarse Huffman table df */
- { -17, 1 },
- { -18, 2 },
- { -16, 3 },
- { -15, 4 },
- { -19, 5 },
- { 7, 6 },
- { -14, -20 },
- { 9, 8 },
- { -13, -21 },
- { 11, 10 },
- { -22, 12 },
- { -12, 13 },
- { -23, 14 },
- { -11, 15 },
- { -10, 16 },
- { -24, 17 },
- { -9, -25 },
- { 19, 18 },
- { -26, 20 },
- { -8, 21 },
- { 23, 22 },
- { 25, 24 },
- { -27, 26 },
- { -7, 27 },
- { -1, -33 },
- { -6, 28 },
- { -28, 29 },
- { -29, 30 },
- { -5, -31 },
- { -30, 31 },
- { -3, -4 },
- { -2, -32 }
-};
-
-const int16_t huff_nodes_alpha_1D_DT[64][2] = { /* Alpha Fine Huffman table dt */
- { -33, 1 },
- { -34, 2 },
- { -32, 3 },
- { 5, 4 },
- { -31, -35 },
- { 7, 6 },
- { -36, 8 },
- { -30, 9 },
- { 11, 10 },
- { -29, -37 },
- { 13, 12 },
- { 15, 14 },
- { -28, -38 },
- { 17, 16 },
- { -27, -39 },
- { 19, 18 },
- { -40, 20 },
- { -26, 21 },
- { 23, 22 },
- { -25, -41 },
- { 25, 24 },
- { -24, -42 },
- { 27, 26 },
- { -23, -43 },
- { 29, 28 },
- { -22, -44 },
- { 31, 30 },
- { -45, 32 },
- { -21, 33 },
- { -20, 34 },
- { -46, 35 },
- { -47, 36 },
- { -19, 37 },
- { -48, 38 },
- { -18, 39 },
- { 41, 40 },
- { -17, -49 },
- { 43, 42 },
- { -50, 44 },
- { -16, 45 },
- { 47, 46 },
- { -51, 48 },
- { -15, 49 },
- { 51, 50 },
- { -52, -65 },
- { -1, -14 },
- { 53, 52 },
- { -53, 54 },
- { -13, 55 },
- { 57, 56 },
- { -12, 58 },
- { -54, 59 },
- { 61, 60 },
- { -11, -55 },
- { -56, 62 },
- { -10, 63 },
- { -9, -57 },
- { -5, -6 },
- { -58, -61 },
- { -7, -59 },
- { -8, -62 },
- { -4, -60 },
- { -3, -64 },
- { -2, -63 }
-};
-const int16_t huff_nodes_alpha_1D_DT_coarse[32][2] = { /* Alpha Coarse Huffman table dt */
- { -17, 1 },
- { -18, 2 },
- { -16, 3 },
- { -19, 4 },
- { -15, 5 },
- { 7, 6 },
- { -14, -20 },
- { 9, 8 },
- { -21, 10 },
- { -13, 11 },
- { 13, 12 },
- { -12, -22 },
- { 15, 14 },
- { -11, -23 },
- { 17, 16 },
- { -24, 18 },
- { -10, 19 },
- { -25, 20 },
- { -9, 21 },
- { 23, 22 },
- { -26, 24 },
- { -8, 25 },
- { 27, 26 },
- { -1, -33 },
- { -7, -27 },
- { 29, 28 },
- { -28, 30 },
- { -6, 31 },
- { -5, -29 },
- { -3, -31 },
- { -4, -30 },
- { -2, -32 }
-};
-
-const int16_t huff_nodes_first_band_beta[8][2] = /* Beta Fine Huffman table df0 */
- { { -1, 1 }, { -2, 2 }, { -3, 3 }, { -4, 4 }, { -5, 5 }, { -6, 6 }, { -7, 7 }, { -8, -9 } };
-const int16_t huff_nodes_first_band_beta_coarse[4][2] = /* Beta Coarse Huffman table df0 */
- { { -1, 1 }, { -2, 2 }, { -3, 3 }, { -4, -5 } };
-
-const int16_t huff_nodes_beta_1D_DF[16][2] = /* Beta Fine Huffman table df */
- { { -9, 1 }, { -10, 2 }, { -8, 3 }, { -11, 4 }, { -7, 5 }, { 7, 6 }, { -6, -12 }, { 9, 8 }, { -5, -13 }, { 11, 10 }, { -4, -14 }, { -15, 12 }, { -3, 13 }, { -16, 14 }, { -2, 15 }, { -1, -17 } };
-const int16_t huff_nodes_beta_1D_DF_coarse[8][2] = /* Beta Coarse Huffman table df */
- { { -5, 1 }, { -6, 2 }, { -4, 3 }, { -3, 4 }, { -7, 5 }, { -2, 6 }, { -8, 7 }, { -1, -9 } };
-
-const int16_t huff_nodes_beta_1D_DT[16][2] = /* Beta Fine Huffman table dt */
- { { -9, 1 }, { -10, 2 }, { -8, 3 }, { -11, 4 }, { -7, 5 }, { 7, 6 }, { -6, -12 }, { -13, 8 }, { -5, 9 }, { -14, 10 }, { -4, 11 }, { -15, 12 }, { -3, 13 }, { -16, 14 }, { -2, 15 }, { -1, -17 } };
-const int16_t huff_nodes_beta_1D_DT_coarse[8][2] = /* Beta Coarse Huffman table dt */
- { { -5, 1 }, { -6, 2 }, { -4, 3 }, { -7, 4 }, { -3, 5 }, { -8, 6 }, { -2, 7 }, { -1, -9 } };
-
-HUFF_NODE_TABLE huff_nodes_df0 = {
+#endif
+
+
+/*----------------------------------------------------------------------*
+ * MC ParamUpmix ROM tables
+ *-----------------------------------------------------------------------*/
+
+/* Alpha Fine Huffman table df0 */
+static const int16_t huff_nodes_first_band_alpha[32][2] =
+{
+ { -17, 1 },
+ { 3, 2 },
+ { -16, -18 },
+ { 5, 4 },
+ { -15, 6 },
+ { -19, 7 },
+ { 9, 8 },
+ { 11, 10 },
+ { -14, -20 },
+ { 13, 12 },
+ { -21, 14 },
+ { -13, 15 },
+ { 17, 16 },
+ { -22, 18 },
+ { -12, 19 },
+ { -9, -10 },
+ { -11, 20 },
+ { -23, 21 },
+ { -8, 22 },
+ { -24, 23 },
+ { -25, 24 },
+ { -7, 25 },
+ { -26, 26 },
+ { 28, 27 },
+ { -6, -27 },
+ { -33, 29 },
+ { -1, -28 },
+ { -5, 30 },
+ { -29, -30 },
+ { -4, 31 },
+ { -3, -31 },
+ { -2, -32 }
+};
+
+/* Alpha Coarse Huffman table df0 */
+static const int16_t huff_nodes_first_band_alpha_coarse[16][2] =
+{
+ { -9, 1 },
+ { -8, 2 },
+ { -10, 3 },
+ { 5, 4 },
+ { -7, 6 },
+ { -11, 7 },
+ { -5, 8 },
+ { -6, 9 },
+ { -12, 10 },
+ { -13, 11 },
+ { -4, 12 },
+ { -14, 13 },
+ { -3, 14 },
+ { -15, 15 },
+ { -2, -16 },
+ { -1, -17 }
+};
+
+/* Alpha Fine Huffman table df */
+static const int16_t huff_nodes_alpha_1D_DF[64][2] =
+{
+ { -33, 1 },
+ { 3, 2 },
+ { -32, -34 },
+ { 5, 4 },
+ { -31, -35 },
+ { 7, 6 },
+ { -30, 8 },
+ { -36, 9 },
+ { 11, 10 },
+ { -37, 12 },
+ { -29, 13 },
+ { -28, 14 },
+ { -38, 15 },
+ { 17, 16 },
+ { -27, -39 },
+ { 19, 18 },
+ { -26, 20 },
+ { -40, 21 },
+ { 23, 22 },
+ { -41, 24 },
+ { -25, 25 },
+ { -24, 26 },
+ { -42, 27 },
+ { -43, 28 },
+ { -23, 29 },
+ { -44, 30 },
+ { -22, 31 },
+ { -45, 32 },
+ { -21, 33 },
+ { -20, 34 },
+ { -46, 35 },
+ { -19, 36 },
+ { -47, 37 },
+ { -18, -48 },
+ { 39, 38 },
+ { -17, -49 },
+ { 41, 40 },
+ { -16, 42 },
+ { -1, -50 },
+ { -65, 43 },
+ { 45, 44 },
+ { -51, 46 },
+ { -15, 47 },
+ { 49, 48 },
+ { -52, 50 },
+ { -14, 51 },
+ { 53, 52 },
+ { -13, 54 },
+ { -53, 55 },
+ { 57, 56 },
+ { -12, 58 },
+ { -54, 59 },
+ { 61, 60 },
+ { -55, 62 },
+ { -11, 63 },
+ { -10, -61 },
+ { -5, -57 },
+ { -58, -60 },
+ { -56, -59 },
+ { -4, -6 },
+ { -7, -64 },
+ { -9, -63 },
+ { -3, -8 },
+ { -2, -62 }
+};
+
+/* Alpha Coarse Huffman table df */
+static const int16_t huff_nodes_alpha_1D_DF_coarse[32][2] =
+{
+ { -17, 1 },
+ { -18, 2 },
+ { -16, 3 },
+ { -15, 4 },
+ { -19, 5 },
+ { 7, 6 },
+ { -14, -20 },
+ { 9, 8 },
+ { -13, -21 },
+ { 11, 10 },
+ { -22, 12 },
+ { -12, 13 },
+ { -23, 14 },
+ { -11, 15 },
+ { -10, 16 },
+ { -24, 17 },
+ { -9, -25 },
+ { 19, 18 },
+ { -26, 20 },
+ { -8, 21 },
+ { 23, 22 },
+ { 25, 24 },
+ { -27, 26 },
+ { -7, 27 },
+ { -1, -33 },
+ { -6, 28 },
+ { -28, 29 },
+ { -29, 30 },
+ { -5, -31 },
+ { -30, 31 },
+ { -3, -4 },
+ { -2, -32 }
+};
+
+/* Alpha Fine Huffman table dt */
+static const int16_t huff_nodes_alpha_1D_DT[64][2] =
+{
+ { -33, 1 },
+ { -34, 2 },
+ { -32, 3 },
+ { 5, 4 },
+ { -31, -35 },
+ { 7, 6 },
+ { -36, 8 },
+ { -30, 9 },
+ { 11, 10 },
+ { -29, -37 },
+ { 13, 12 },
+ { 15, 14 },
+ { -28, -38 },
+ { 17, 16 },
+ { -27, -39 },
+ { 19, 18 },
+ { -40, 20 },
+ { -26, 21 },
+ { 23, 22 },
+ { -25, -41 },
+ { 25, 24 },
+ { -24, -42 },
+ { 27, 26 },
+ { -23, -43 },
+ { 29, 28 },
+ { -22, -44 },
+ { 31, 30 },
+ { -45, 32 },
+ { -21, 33 },
+ { -20, 34 },
+ { -46, 35 },
+ { -47, 36 },
+ { -19, 37 },
+ { -48, 38 },
+ { -18, 39 },
+ { 41, 40 },
+ { -17, -49 },
+ { 43, 42 },
+ { -50, 44 },
+ { -16, 45 },
+ { 47, 46 },
+ { -51, 48 },
+ { -15, 49 },
+ { 51, 50 },
+ { -52, -65 },
+ { -1, -14 },
+ { 53, 52 },
+ { -53, 54 },
+ { -13, 55 },
+ { 57, 56 },
+ { -12, 58 },
+ { -54, 59 },
+ { 61, 60 },
+ { -11, -55 },
+ { -56, 62 },
+ { -10, 63 },
+ { -9, -57 },
+ { -5, -6 },
+ { -58, -61 },
+ { -7, -59 },
+ { -8, -62 },
+ { -4, -60 },
+ { -3, -64 },
+ { -2, -63 }
+};
+
+/* Alpha Coarse Huffman table dt */
+static const int16_t huff_nodes_alpha_1D_DT_coarse[32][2] =
+{
+ { -17, 1 },
+ { -18, 2 },
+ { -16, 3 },
+ { -19, 4 },
+ { -15, 5 },
+ { 7, 6 },
+ { -14, -20 },
+ { 9, 8 },
+ { -21, 10 },
+ { -13, 11 },
+ { 13, 12 },
+ { -12, -22 },
+ { 15, 14 },
+ { -11, -23 },
+ { 17, 16 },
+ { -24, 18 },
+ { -10, 19 },
+ { -25, 20 },
+ { -9, 21 },
+ { 23, 22 },
+ { -26, 24 },
+ { -8, 25 },
+ { 27, 26 },
+ { -1, -33 },
+ { -7, -27 },
+ { 29, 28 },
+ { -28, 30 },
+ { -6, 31 },
+ { -5, -29 },
+ { -3, -31 },
+ { -4, -30 },
+ { -2, -32 }
+};
+
+/* Beta Fine Huffman table df0 */
+static const int16_t huff_nodes_first_band_beta[8][2] =
+{
+ { -1, 1 }, { -2, 2 }, { -3, 3 }, { -4, 4 }, { -5, 5 }, { -6, 6 }, { -7, 7 }, { -8, -9 }
+};
+
+/* Beta Coarse Huffman table df0 */
+static const int16_t huff_nodes_first_band_beta_coarse[4][2] =
+{
+ { -1, 1 }, { -2, 2 }, { -3, 3 }, { -4, -5 }
+};
+
+/* Beta Fine Huffman table df */
+static const int16_t huff_nodes_beta_1D_DF[16][2] =
+{
+ { -9, 1 }, { -10, 2 }, { -8, 3 }, { -11, 4 }, { -7, 5 }, { 7, 6 }, { -6, -12 }, { 9, 8 }, { -5, -13 }, { 11, 10 }, { -4, -14 }, { -15, 12 }, { -3, 13 }, { -16, 14 }, { -2, 15 }, { -1, -17 }
+};
+
+/* Beta Coarse Huffman table df */
+static const int16_t huff_nodes_beta_1D_DF_coarse[8][2] =
+{
+ { -5, 1 }, { -6, 2 }, { -4, 3 }, { -3, 4 }, { -7, 5 }, { -2, 6 }, { -8, 7 }, { -1, -9 }
+};
+
+/* Beta Fine Huffman table dt */
+static const int16_t huff_nodes_beta_1D_DT[16][2] =
+{
+ { -9, 1 }, { -10, 2 }, { -8, 3 }, { -11, 4 }, { -7, 5 }, { 7, 6 }, { -6, -12 }, { -13, 8 }, { -5, 9 }, { -14, 10 }, { -4, 11 }, { -15, 12 }, { -3, 13 }, { -16, 14 }, { -2, 15 }, { -1, -17 }
+};
+
+/* Beta Coarse Huffman table dt */
+static const int16_t huff_nodes_beta_1D_DT_coarse[8][2] =
+{
+ { -5, 1 }, { -6, 2 }, { -4, 3 }, { -7, 4 }, { -3, 5 }, { -8, 6 }, { -2, 7 }, { -1, -9 }
+};
+
+const HUFF_NODE_TABLE ivas_mc_paramupmix_huff_nodes_df0 =
+{
{ huff_nodes_first_band_alpha, huff_nodes_first_band_alpha_coarse },
{ huff_nodes_first_band_beta, huff_nodes_first_band_beta_coarse }
};
-HUFF_NODE_TABLE huff_nodes_df = {
+const HUFF_NODE_TABLE ivas_mc_paramupmix_huff_nodes_df =
+{
{ huff_nodes_alpha_1D_DF, huff_nodes_alpha_1D_DF_coarse },
{ huff_nodes_beta_1D_DF, huff_nodes_beta_1D_DF_coarse }
};
-HUFF_NODE_TABLE huff_nodes_dt = {
+const HUFF_NODE_TABLE ivas_mc_paramupmix_huff_nodes_dt =
+{
{ huff_nodes_alpha_1D_DT, huff_nodes_alpha_1D_DT_coarse },
{ huff_nodes_beta_1D_DT, huff_nodes_beta_1D_DT_coarse }
};
diff --git a/lib_dec/ivas_rom_dec.h b/lib_dec/ivas_rom_dec.h
index e47f66807f3a98fc721b64f519ef4f2f3f3222d1..b4c3c89fd611b190f95551b1a18f0c9c2b105309 100644
--- a/lib_dec/ivas_rom_dec.h
+++ b/lib_dec/ivas_rom_dec.h
@@ -123,21 +123,21 @@ extern const float dmxmtx_table[BINAURAL_CHANNELS][11];
#ifdef SPLIT_REND_WITH_HEAD_ROT
/*----------------------------------------------------------------------*
- * split rendering ROM tables
+ * Binuaral split rendering ROM tables
*-----------------------------------------------------------------------*/
-extern const float split_rend_relative_yaw_pos_angles[SPLIT_REND_MAX_YAW_ONLY_POSES];
-extern const float split_rend_relative_pitch_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES];
-extern const float split_rend_relative_roll_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES];
-extern const float split_rend_relative_one_axis_pos_angles[SPLIT_REND_MAX_ONE_AXIS_MD_POSES];
-extern const float split_rend_relative_one_axis_pos_angles_hq[SPLIT_REND_MAX_ONE_AXIS_MD_POSES];
-extern const float split_rend_relative_yaw_pos_angles_hq[SPLIT_REND_MAX_YAW_ONLY_POSES];
-extern const float split_rend_relative_pitch_pos_angles_hq[SPLIT_REND_MAX_PITCH_ONLY_POSES];
-extern const float split_rend_relative_roll_pos_angles_hq[SPLIT_REND_MAX_PITCH_ONLY_POSES];
+extern const float ivas_split_rend_relative_yaw_pos_angles[SPLIT_REND_MAX_YAW_ONLY_POSES];
+extern const float ivas_split_rend_relative_pitch_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES];
+extern const float ivas_split_rend_relative_roll_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES];
+extern const float ivas_split_rend_relative_one_axis_pos_angles[SPLIT_REND_MAX_ONE_AXIS_MD_POSES];
+extern const float ivas_split_rend_relative_one_axis_pos_angles_hq[SPLIT_REND_MAX_ONE_AXIS_MD_POSES];
+extern const float ivas_split_rend_relative_yaw_pos_angles_hq[SPLIT_REND_MAX_YAW_ONLY_POSES];
+extern const float ivas_split_rend_relative_pitch_pos_angles_hq[SPLIT_REND_MAX_PITCH_ONLY_POSES];
+extern const float ivas_split_rend_relative_roll_pos_angles_hq[SPLIT_REND_MAX_PITCH_ONLY_POSES];
-extern const float split_rend_relative_pos_angles[MAX_HEAD_ROT_POSES][3];
-extern const int16_t SplitRend_band_grouping[MAX_SPLIT_REND_MD_BANDS + 1];
+extern const float ivas_split_rend_relative_pos_angles[MAX_HEAD_ROT_POSES][3];
+extern const int16_t ivas_split_rend_band_grouping[MAX_SPLIT_REND_MD_BANDS + 1];
extern const int32_t ivas_split_rend_huff_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3];
#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
extern const int32_t ivas_split_rend_huff_pred63_consts[IVAS_SPLIT_REND_PRED_31QUANT_PNTS][3];
@@ -151,27 +151,15 @@ extern const int32_t ivas_split_rend_huff_roll_pred_consts[IVAS_SPLIT_REND_ROLL_
extern const int32_t ivas_split_rend_huff_p_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3];
extern const int32_t ivas_split_rend_huff_p_d_diff_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3];
extern const int32_t split_rend_brate_tbl[];
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
-extern const int16_t huff_nodes_first_band_alpha[32][2];
-extern const int16_t huff_nodes_first_band_alpha_coarse[16][2];
-
-
-extern const int16_t huff_nodes_alpha_1D_DF[64][2];
-extern const int16_t huff_nodes_alpha_1D_DF_coarse[32][2];
-
-extern const int16_t huff_nodes_alpha_1D_DT[64][2];
-extern const int16_t huff_nodes_alpha_1D_DT_coarse[32][2];
+#endif
-extern const int16_t huff_nodes_first_band_beta[8][2];
-extern const int16_t huff_nodes_first_band_beta_coarse[4][2];
-extern const int16_t huff_nodes_beta_1D_DF[16][2];
-extern const int16_t huff_nodes_beta_1D_DF_coarse[8][2];
+/*----------------------------------------------------------------------*
+ * MC ParamUpmix ROM tables
+ *-----------------------------------------------------------------------*/
-extern const int16_t huff_nodes_beta_1D_DT[16][2];
-extern const int16_t huff_nodes_beta_1D_DT_coarse[8][2];
-extern const HUFF_NODE_TABLE huff_nodes_df0;
-extern const HUFF_NODE_TABLE huff_nodes_df;
-extern const HUFF_NODE_TABLE huff_nodes_dt;
+extern const HUFF_NODE_TABLE ivas_mc_paramupmix_huff_nodes_df0;
+extern const HUFF_NODE_TABLE ivas_mc_paramupmix_huff_nodes_df;
+extern const HUFF_NODE_TABLE ivas_mc_paramupmix_huff_nodes_dt;
#endif
diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c
index 5ff22b54baaab194082061af0d2afe165e2f1962..572960178b648176e6699a052492199cb3513f66 100755
--- a/lib_dec/ivas_sba_dec.c
+++ b/lib_dec/ivas_sba_dec.c
@@ -564,7 +564,6 @@ ivas_error ivas_sba_dec_digest_tc(
const int16_t nSamplesForRendering /* i : number of samples provided */
)
{
-
int16_t ch_idx;
ivas_error error;
@@ -582,7 +581,7 @@ ivas_error ivas_sba_dec_digest_tc(
}
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
- if ( st_ivas->hDiracDecBin[0] != NULL && ( st_ivas->hDiracDecBin[0]->useTdDecorr ) )
+ if ( st_ivas->hDiracDecBin[0] != NULL && st_ivas->hDiracDecBin[0]->useTdDecorr )
#else
if ( st_ivas->hDiracDecBin != NULL && ( st_ivas->hDiracDecBin->useTdDecorr ) )
#endif
@@ -603,6 +602,7 @@ ivas_error ivas_sba_dec_digest_tc(
while ( nSamplesLeftForTD )
{
int16_t nSamplesToDecorr = min( nSamplesLeftForTD, default_frame );
+
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
if ( st_ivas->hDiracDecBin[0]->hTdDecorr )
#else
@@ -615,6 +615,7 @@ ivas_error ivas_sba_dec_digest_tc(
ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, p_tc, decorr_signal, nSamplesToDecorr );
#endif
}
+
for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ )
{
decorr_signal[ch_idx] += nSamplesToDecorr;
diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h
index d19fa843f190d9defd3a0c4447fc1dccfe5f119a..8c920b781f30b752aff1b5ecfcb02271d97c6799 100755
--- a/lib_dec/ivas_stat_dec.h
+++ b/lib_dec/ivas_stat_dec.h
@@ -916,6 +916,7 @@ typedef struct decoder_config_structure
#endif
int16_t voip_active;
int16_t Opt_delay_comp; /* flag indicating delay compensation active */
+
} DECODER_CONFIG, *DECODER_CONFIG_HANDLE;
#ifdef SPLIT_REND_WITH_HEAD_ROT
@@ -923,6 +924,7 @@ typedef struct
{
float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
+
} IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA, *IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE;
typedef struct
@@ -930,6 +932,7 @@ typedef struct
float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
AUDIO_CONFIG config;
+
} IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA, *IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE;
typedef struct
@@ -938,6 +941,7 @@ typedef struct
IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits; /*scratch buffer for frame by frame processing*/
SPLIT_REND_WRAPPER splitrend;
IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE hCldfbDataOut; /*buffer to store cldfb data before binauralization*/
+
} IVAS_DEC_SPLIT_REND_WRAPPER;
#endif
@@ -1072,7 +1076,7 @@ typedef struct Decoder_Struct
MONO_DOWNMIX_RENDERER_HANDLE hMonoDmxRenderer; /* Mono downmix structure */
CREND_WRAPPER_HANDLE hCrendWrapper; /* Crend handle */
REVERB_HANDLE hReverb; /* Reverb handle */
- HRTFS_CREND_HANDLE hSetOfHRTF; /* Set of HRTFs handle (CRend) */
+ HRTFS_CREND_HANDLE hSetOfHRTF; /* Set of HRTFs handle (CRend) */
HRTFS_FASTCONV_HANDLE hHrtfFastConv; /* FASTCONV HRTF tables for binaural rendering */
HRTFS_PARAMBIN_HANDLE hHrtfParambin; /* HRTF tables for parametric binauralizer */
LSSETUP_CUSTOM_HANDLE hLsSetupCustom; /* Custom LS configuration handle */
@@ -1092,6 +1096,10 @@ typedef struct Decoder_Struct
int16_t flag_omasa_brate;
#endif
+#ifdef SPLIT_REND_WITH_HEAD_ROT
+ IVAS_DEC_SPLIT_REND_WRAPPER hSplitBinRend; /* split binuaral rendering handle */
+#endif
+
/* JBM module */
DECODER_TC_BUFFER_HANDLE hTcBuffer; /* JBM structure */
JBM_METADATA_HANDLE hJbmMetadata; /* Structure for metadata buffering in JBM */
@@ -1103,10 +1111,6 @@ typedef struct Decoder_Struct
int16_t ism_extmeta_active; /* Extended metadata active in decoder */
int16_t ism_extmeta_cnt; /* Change frame counter for extended metadata */
-#ifdef SPLIT_REND_WITH_HEAD_ROT
- IVAS_DEC_SPLIT_REND_WRAPPER splitBinRend;
-#endif
-
} Decoder_Struct;
/* clang-format on */
diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c
index 8f4efe998928e7af3d0922c3a81faa3c56c81ff5..78c8aecf942d0ceb6b904f7ae813d1dab16f4663 100644
--- a/lib_dec/lib_dec.c
+++ b/lib_dec/lib_dec.c
@@ -37,9 +37,6 @@
#include "jbm_jb4sb.h"
#include "jbm_pcmdsp_apa.h"
#include "jbm_pcmdsp_fifo.h"
-#ifdef SPLIT_REND_WITH_HEAD_ROT
-#include "ivas_rom_dec.h"
-#endif
#include
#include
#include
@@ -635,7 +632,7 @@ ivas_error IVAS_DEC_GetSamples(
int16_t *nOutSamples /* o : number of samples per channel written to output buffer */
#ifdef SPLIT_REND_WITH_HEAD_ROT
,
- IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits
+ uint8_t *splitRendBitsBuf /* o : output split rendering bits */
#endif
)
{
@@ -666,7 +663,7 @@ ivas_error IVAS_DEC_GetSamples(
if ( ( error = ivas_dec( st_ivas, pcmBuf
#ifdef SPLIT_REND_WITH_HEAD_ROT
,
- hSplitRendBits
+ splitRendBitsBuf
#endif
) ) != IVAS_ERR_OK )
{
@@ -692,12 +689,12 @@ ivas_error IVAS_DEC_GetSamples(
*---------------------------------------------------------------------*/
static ivas_error IVAS_DEC_Setup(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- uint16_t *nTcBufferGranularity, /* o : granularity of the TC Buffer */
- uint8_t *nTransportChannels, /* o : number of decoded transport PCM channels */
- uint8_t *nOutChannels, /* o : number of decoded out channels (PCM or CLDFB) */
- uint16_t *nSamplesRendered, /* o : number of samples flushed from the last frame */
- int16_t *data /* o : flushed samples */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ uint16_t *nTcBufferGranularity, /* o : granularity of the TC Buffer */
+ uint8_t *nTransportChannels, /* o : number of decoded transport PCM channels */
+ uint8_t *nOutChannels, /* o : number of decoded out channels (PCM or CLDFB) */
+ uint16_t *nSamplesRendered, /* o : number of samples flushed from the last frame */
+ int16_t *data /* o : flushed samples */
)
{
ivas_error error;
@@ -882,7 +879,7 @@ static ivas_error IVAS_DEC_GetRenderedSamples(
static ivas_error IVAS_DEC_GetBufferedNumberOfSamples(
IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- int16_t *nSamplesBuffered /* o : number of samples still buffered */
+ int16_t *nSamplesBuffered /* o : number of samples still buffered */
)
{
ivas_error error;
@@ -1135,15 +1132,13 @@ ivas_error IVAS_DEC_FeedHeadTrackData(
for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
{
/* check for Euler angle signaling */
-#ifdef SPLIT_REND_WITH_HEAD_ROT
-#endif
+ if ( orientation[i].w == -3.0f )
{
- if ( orientation[i].w == -3.0f )
- {
- Euler2Quat( deg2rad( orientation[i].x ), deg2rad( orientation[i].y ), deg2rad( orientation[i].z ), &orientation[i] );
- }
+ Euler2Quat( deg2rad( orientation[i].x ), deg2rad( orientation[i].y ), deg2rad( orientation[i].z ), &orientation[i] );
}
+
ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, orientation[i], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hHeadTrackData->Quaternions[i] );
+
hHeadTrackData->Pos[i].x = Pos[i].x;
hHeadTrackData->Pos[i].y = Pos[i].y;
hHeadTrackData->Pos[i].z = Pos[i].z;
@@ -3222,12 +3217,43 @@ static ivas_error IVAS_DEC_VoIP_reconfigure(
return error;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
/*---------------------------------------------------------------------*
* IVAS_DEC_GetCldfbSamples()
*
*
*---------------------------------------------------------------------*/
+
+/*! r: decoder error code */
+ivas_error IVAS_DEC_GetSplitRendBits(
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_SPLIT_REND_BITS_HANDLE splitRendBits /* o : split rendering Bits structue */
+)
+{
+ if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL /*|| hIvasDec->st_ivas->hSplitBinRend == NULL */ )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+
+ splitRendBits->bits_buf = hIvasDec->st_ivas->hSplitBinRend.hSplitRendBits->bits_buf;
+ splitRendBits->bits_read = hIvasDec->st_ivas->hSplitBinRend.hSplitRendBits->bits_read;
+ splitRendBits->bits_written = hIvasDec->st_ivas->hSplitBinRend.hSplitRendBits->bits_written;
+ splitRendBits->buf_len = hIvasDec->st_ivas->hSplitBinRend.hSplitRendBits->buf_len;
+ splitRendBits->codec = hIvasDec->st_ivas->hSplitBinRend.hSplitRendBits->codec;
+ splitRendBits->pose_correction = hIvasDec->st_ivas->hSplitBinRend.hSplitRendBits->pose_correction;
+
+ return IVAS_ERR_OK;
+}
+
+
+/*---------------------------------------------------------------------*
+ * IVAS_DEC_GetCldfbSamples()
+ *
+ *
+ *---------------------------------------------------------------------*/
+
+// ToDo: currently unused
ivas_error IVAS_DEC_GetCldfbSamples(
IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
float *out_real, /* o : buffer for decoded PCM real output in CLDFB domain */
@@ -3249,12 +3275,13 @@ ivas_error IVAS_DEC_GetCldfbSamples(
st_ivas = hIvasDec->st_ivas;
num_samples = 0;
- if ( st_ivas->splitBinRend.hCldfbDataOut != NULL )
+
+ if ( st_ivas->hSplitBinRend.hCldfbDataOut != NULL )
{
- *audio_config = st_ivas->splitBinRend.hCldfbDataOut->config;
- if ( st_ivas->splitBinRend.hCldfbDataOut->config != AUDIO_CONFIG_INVALID )
+ *audio_config = st_ivas->hSplitBinRend.hCldfbDataOut->config;
+ if ( st_ivas->hSplitBinRend.hCldfbDataOut->config != AUDIO_CONFIG_INVALID )
{
- num_chs = audioCfg2channels( st_ivas->splitBinRend.hCldfbDataOut->config );
+ num_chs = audioCfg2channels( st_ivas->hSplitBinRend.hCldfbDataOut->config );
maxBand = (int16_t) ( ( CLDFB_NO_CHANNELS_MAX * st_ivas->hDecoderConfig->output_Fs ) / 48000 );
for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ )
@@ -3263,8 +3290,8 @@ ivas_error IVAS_DEC_GetCldfbSamples(
{
for ( ch = 0; ch < num_chs; ch++ )
{
- *out_real++ = st_ivas->splitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][slot_idx][b];
- *out_imag++ = st_ivas->splitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_idx][b];
+ *out_real++ = st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][slot_idx][b];
+ *out_imag++ = st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_idx][b];
}
}
}
@@ -3275,7 +3302,9 @@ ivas_error IVAS_DEC_GetCldfbSamples(
{
*audio_config = AUDIO_CONFIG_INVALID;
}
+
*nOutSamples = num_samples;
+
return error;
}
#endif
diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h
index 3d61e99e81894688dd9242a85303927eed168833..535379201d3f285ff8e8958c23c07e5da828dc80 100644
--- a/lib_dec/lib_dec.h
+++ b/lib_dec/lib_dec.h
@@ -159,11 +159,17 @@ ivas_error IVAS_DEC_GetSamples(
int16_t *nOutSamples /* o : number of samples per channel written to output buffer */
#ifdef SPLIT_REND_WITH_HEAD_ROT
,
- IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits /* o : bitstream output for split rendering mode */
+ uint8_t *splitRendBitsBuf /* o : output split rendering bits */
#endif
);
#ifdef SPLIT_REND_WITH_HEAD_ROT
+/*! r: decoder error code */
+ivas_error IVAS_DEC_GetSplitRendBits(
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_SPLIT_REND_BITS_HANDLE splitRendBits /* o : split rendering Bits structure */
+);
+
/*! r: decoder error code */
ivas_error IVAS_DEC_GetCldfbSamples(
IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
diff --git a/lib_enc/ivas_mc_paramupmix_enc.c b/lib_enc/ivas_mc_paramupmix_enc.c
index 24e7d119b17d0f522aa1de04f379f772ed5a0cff..4e71f104a869b1c2cd0bb0ee6866e910f15ed2c6 100644
--- a/lib_enc/ivas_mc_paramupmix_enc.c
+++ b/lib_enc/ivas_mc_paramupmix_enc.c
@@ -556,8 +556,8 @@ static void quantize_alpha(
int16_t nq;
const float *data;
- nq = ivas_param_upmx_alpha_quant_table[quant_type].nquant;
- data = ivas_param_upmx_alpha_quant_table[quant_type].data;
+ nq = ivas_mc_paramupmix_alpha_quant_table[quant_type].nquant;
+ data = ivas_mc_paramupmix_alpha_quant_table[quant_type].data;
quantize_pars( nv, alpha, nq, data, aq, adeq );
@@ -577,7 +577,7 @@ static void quantize_beta(
float *bdeq )
{
int16_t iv, iq, iq0, iq1;
- const ACPL_QUANT_TABLE *tables = ivas_param_upmx_beta_quant_table[quant_type];
+ const ACPL_QUANT_TABLE *tables = ivas_mc_paramupmix_beta_quant_table[quant_type];
ACPL_QUANT_TABLE quant_table;
for ( iv = 0; iv < nv; iv++ )
@@ -612,7 +612,7 @@ static void quantize_beta(
}
}
- *pnq = ivas_param_upmx_beta_quant_table[quant_type][0].nquant;
+ *pnq = ivas_mc_paramupmix_beta_quant_table[quant_type][0].nquant;
return;
}
diff --git a/lib_rend/ivas_CQMFDecoder.h b/lib_rend/ivas_CQMFDecoder.h
deleted file mode 100644
index 753bc579da5e40b4ce7831ba8d64633cb0ef8516..0000000000000000000000000000000000000000
--- a/lib_rend/ivas_CQMFDecoder.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-
-#ifndef _IVAS_CQMF_DECODER_H_
-#define _IVAS_CQMF_DECODER_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include "options.h"
-#ifdef SPLIT_REND_WITH_HEAD_ROT
-#include "lib_rend.h"
-#define DECODER_ERROR_NONE ( 0 )
-#define DECODER_ERROR_FS_NOT_SUPPORTED ( -1 )
-#define DECODER_ERROR_CHAN_NOT_SUPPORTED ( -2 )
-#define DECODER_ERROR_UNKNOWN ( -100 )
-
- typedef struct CQMF_DECODER CQMFDecoder;
-
- CQMFDecoder *CreateCQMFDecoder( const int32_t iSampleRate,
- const int32_t iChannels );
-
- void DeleteCQMFDecoder( CQMFDecoder *psCQMFDecoder );
-
- int32_t CQMFDecoderGetError( CQMFDecoder *psCQMFDecoder );
-
- int32_t DecodeFrame( CQMFDecoder *psCQMFDecoder,
- ivas_split_rend_bits_t *pBits,
- float ***pppfCQMFReal,
- float ***pppfCQMFImag );
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif /* _CQMF_DECODER_H_ */
diff --git a/lib_rend/ivas_CQMFEncoder.h b/lib_rend/ivas_CQMFEncoder.h
deleted file mode 100644
index c4ac51ed8e7ab9c29c2168528d67c43380738206..0000000000000000000000000000000000000000
--- a/lib_rend/ivas_CQMFEncoder.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-
-#ifndef _IVAS_CQMF_ENCODER_H_
-#define _IVAS_CQMF_ENCODER_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include "options.h"
-#ifdef SPLIT_REND_WITH_HEAD_ROT
-#include "lib_rend.h"
-#define ENCODER_ERROR_NONE ( 0 )
-#define ENCODER_ERROR_FS_NOT_SUPPORTED ( -1 )
-#define ENCODER_ERROR_CHAN_NOT_SUPPORTED ( -2 )
-#define ENCODER_ERROR_UNKNOWN ( -100 )
-
- typedef struct CQMF_ENCODER CQMFEncoder;
-
- CQMFEncoder *CreateCQMFEncoder( const int32_t iSampleRate,
- const int32_t iChannels,
- const int32_t iTargetBitRate,
- const int32_t iAllowSidePred );
-
- void DeleteCQMFEncoder( CQMFEncoder *psCQMFEncoder );
-
- int32_t CQMFEncoderGetError( CQMFEncoder *psCQMFEncoder );
- int32_t EncodeFrame(
- CQMFEncoder *psCQMFEncoder,
- float ***pppfCQMFReal,
- float ***pppfCQMFImag,
- int32_t *piNumiBites,
- const int32_t available_bits,
- ivas_split_rend_bits_t *pBits );
- int32_t GetNumGroups( CQMFEncoder *psCQMFEncoder );
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif /* _CQMF_ENCODER_H_ */
diff --git a/lib_rend/ivas_MSPred.c b/lib_rend/ivas_MSPred.c
index cec626c3aa4a86debc0d018a4a255ddfe37dbfcb..33581631d45ff1cc91509ebdf72bfefbcf2121b6 100644
--- a/lib_rend/ivas_MSPred.c
+++ b/lib_rend/ivas_MSPred.c
@@ -1,6 +1,6 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -30,22 +30,36 @@
*******************************************************************************************************/
-#include "ivas_MSPred.h"
#include "options.h"
+#include
#ifdef SPLIT_REND_WITH_HEAD_ROT
-#include "ivas_lcld_tables.h"
-#include
-#include
-#include "prot.h"
+#include "ivas_lcld_rom_tables.h"
+#include "ivas_lcld_prot.h"
#include "ivas_prot_rend.h"
#include "wmc_auto.h"
-int32_t _round( float val )
+
+/*-------------------------------------------------------------------*
+ * Function _round()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static int32_t _round(
+ float val )
{
return ( val > 0.0f ? (int32_t) ( val + 0.5f ) : (int32_t) ( val - 0.5f ) );
}
-int32_t quantPhase( float phase )
+
+/*-------------------------------------------------------------------*
+ * Function quantPhase()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+int32_t quantPhase(
+ float phase )
{
#ifdef SIMPLE_PHASE
int32_t phaseQ;
@@ -67,37 +81,94 @@ int32_t quantPhase( float phase )
return phaseQ;
}
-void rot_pm_pi( float *pr, float *pi )
+
+/*-------------------------------------------------------------------*
+ * Function rot_pm_pi()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void rot_pm_pi(
+ float *pr,
+ float *pi )
{
/* (-1 + j0) */
*pr = -( *pr );
*pi = -( *pi );
+
+ return;
}
-void rot_p_pi_2( float *pr, float *pi )
+
+/*-------------------------------------------------------------------*
+ * Function ApplyInversePredictros()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void rot_p_pi_2(
+ float *pr,
+ float *pi )
{
/* (0 + j) */
float r = *pr;
+
*pr = -( *pi );
*pi = r;
+
+ return;
}
-void rot_m_pi_2( float *pr, float *pi )
+
+/*-------------------------------------------------------------------*
+ * Function rot_m_pi_2()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void rot_m_pi_2(
+ float *pr,
+ float *pi )
{
/* (0 - j) */
float r = *pr;
+
*pr = *pi;
*pi = -r;
+
+ return;
}
-void cplxmult( float *pr1, float *pi1, float r2, float i2 )
+
+/*-------------------------------------------------------------------*
+ * Function cplxmult()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void cplxmult(
+ float *pr1,
+ float *pi1,
+ float r2,
+ float i2 )
{
float r1 = *pr1, i1 = *pi1;
+
*pr1 = r1 * r2 - i1 * i2;
*pi1 = r1 * i2 + i1 * r2;
+
+ return;
}
-int32_t requantPhase( int32_t phaseQ )
+
+/*-------------------------------------------------------------------*
+ * Function requantPhase()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+int32_t requantPhase(
+ int32_t phaseQ )
{
if ( phaseQ >= PHASE_MAX_VAL )
@@ -120,7 +191,15 @@ int32_t requantPhase( int32_t phaseQ )
return phaseQ;
}
-int32_t quantPred( float pred )
+
+/*-------------------------------------------------------------------*
+ * Function quantPred()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+int32_t quantPred(
+ const float pred )
{
int32_t predQ = _round( pred * PRED_QUANT_FACTOR );
predQ = predQ > PRED_MAX_VAL ? PRED_MAX_VAL : predQ;
@@ -129,7 +208,15 @@ int32_t quantPred( float pred )
return predQ;
}
-float dequantPhase( int32_t phaseQ )
+
+/*-------------------------------------------------------------------*
+ * Function dequantPhase()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+float dequantPhase(
+ const int32_t phaseQ )
{
#ifdef SIMPLE_PHASE
return (float) phaseQ / SIMPLE_PHASE_QUANT_FACTOR;
@@ -138,14 +225,32 @@ float dequantPhase( int32_t phaseQ )
#endif
}
+
+/*-------------------------------------------------------------------*
+ * Function dequantPred()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
float dequantPred( int32_t predQ )
{
return (float) predQ / PRED_QUANT_FACTOR;
}
-int32_t PrepEncode( int32_t *piQuant, const int32_t *piMSFlags, const int32_t numBands )
+
+/*-------------------------------------------------------------------*
+ * Function PrepEncode()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+int32_t PrepEncode(
+ int32_t *piQuant,
+ const int32_t *piMSFlags,
+ const int32_t numBands )
{
int32_t b, numMSBands = 0;
+
for ( b = 0; b < numBands; b++ )
{
if ( piMSFlags[b] )
@@ -153,16 +258,29 @@ int32_t PrepEncode( int32_t *piQuant, const int32_t *piMSFlags, const int32_t nu
piQuant[numMSBands++] = piQuant[b];
}
}
+
for ( b = numMSBands; b < numBands; b++ )
{
piQuant[b] = 0;
}
+
return numMSBands;
}
-void EncodePhase( int32_t *phaseQuant, int32_t numMSBands, int32_t diffDim )
+
+/*-------------------------------------------------------------------*
+ * Function EncodePhase()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void EncodePhase(
+ int32_t *phaseQuant,
+ const int32_t numMSBands,
+ const int32_t diffDim )
{
int32_t b;
+
if ( diffDim > 0 )
{
int32_t tmp1, tmp2;
@@ -174,6 +292,7 @@ void EncodePhase( int32_t *phaseQuant, int32_t numMSBands, int32_t diffDim )
tmp1 = tmp2;
}
}
+
if ( diffDim > 1 )
{
int32_t tmp1, tmp2;
@@ -189,11 +308,24 @@ void EncodePhase( int32_t *phaseQuant, int32_t numMSBands, int32_t diffDim )
{
phaseQuant[b] = requantPhase( phaseQuant[b] );
}
+
+ return;
}
-void DecodePhase( int32_t *phaseQuant, int32_t numMSBands, int32_t diffDim )
+
+/*-------------------------------------------------------------------*
+ * Function DecodePhase()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void DecodePhase(
+ int32_t *phaseQuant,
+ const int32_t numMSBands,
+ const int32_t diffDim )
{
int32_t b;
+
if ( diffDim > 1 )
{
for ( b = 2; b < numMSBands; b++ )
@@ -201,6 +333,7 @@ void DecodePhase( int32_t *phaseQuant, int32_t numMSBands, int32_t diffDim )
phaseQuant[b] += phaseQuant[b - 1];
}
}
+
if ( diffDim > 0 )
{
for ( b = 1; b < numMSBands; b++ )
@@ -208,15 +341,28 @@ void DecodePhase( int32_t *phaseQuant, int32_t numMSBands, int32_t diffDim )
phaseQuant[b] += phaseQuant[b - 1];
}
}
+
for ( b = 1; b < numMSBands; b++ )
{
phaseQuant[b] = requantPhase( phaseQuant[b] );
}
+
+ return;
}
-int32_t EncodePredCoef( int32_t *predQuant, int32_t numMSBands )
+
+/*-------------------------------------------------------------------*
+ * Function EncodePredCoef()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+int32_t EncodePredCoef(
+ int32_t *predQuant,
+ const int32_t numMSBands )
{
int32_t b, tmp1, tmp2;
+
tmp1 = predQuant[0];
for ( b = 1; b < numMSBands; b++ )
{
@@ -224,19 +370,44 @@ int32_t EncodePredCoef( int32_t *predQuant, int32_t numMSBands )
predQuant[b] -= tmp1;
tmp1 = tmp2;
}
+
return numMSBands;
}
-void DecodePredCoef( int32_t *phaseQuant, int32_t numMSBands )
+
+/*-------------------------------------------------------------------*
+ * Function DecodePredCoef()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void DecodePredCoef(
+ int32_t *phaseQuant,
+ const int32_t numMSBands )
{
int32_t b;
+
for ( b = 1; b < numMSBands; b++ )
{
phaseQuant[b] += phaseQuant[b - 1];
}
+
+ return;
}
-int32_t CountMSBits( int32_t iNumBands, const int32_t iMSMode, const int32_t *piMSFlags, const int32_t *piLRPhaseDiff, const int32_t *piMSPredCoef )
+
+/*-------------------------------------------------------------------*
+ * Function CountMSBits()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+int32_t CountMSBits(
+ int32_t iNumBands,
+ const int32_t iMSMode,
+ const int32_t *piMSFlags,
+ const int32_t *piLRPhaseDiff,
+ const int32_t *piMSPredCoef )
{
int32_t iBitsWritten = 0;
int32_t b;
@@ -329,9 +500,19 @@ int32_t CountMSBits( int32_t iNumBands, const int32_t iMSMode, const int32_t *pi
return iBitsWritten;
}
-void writeMSPred( int32_t *phaseQuant, int32_t *predQuant, int32_t MSMode, int32_t numMSBands, int32_t numBands, void *fid, int32_t *piMsFlags )
+
+#ifdef DEBUG_WRITE_MS_PRED
+void writeMSPred(
+ int32_t *phaseQuant,
+ int32_t *predQuant,
+ int32_t MSMode,
+ int32_t numMSBands,
+ int32_t numBands,
+ void *fid,
+ int32_t *piMsFlags )
{
int32_t b;
+
fid = (FILE *) fid;
fprintf( fid, "%d %d", MSMode, numMSBands );
for ( b = 0; b < numMSBands; b++ )
@@ -355,5 +536,8 @@ void writeMSPred( int32_t *phaseQuant, int32_t *predQuant, int32_t MSMode, int32
fprintf( fid, " %d", piMsFlags[b] );
}
fprintf( fid, "\n" );
+
+ return;
}
#endif
+#endif
diff --git a/lib_rend/ivas_MSPred.h b/lib_rend/ivas_MSPred.h
deleted file mode 100644
index a2e94b7ba72a5995e572503bc8b619bbec952a9b..0000000000000000000000000000000000000000
--- a/lib_rend/ivas_MSPred.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-
-#ifndef _IVAS_MS_PRED_H_
-#define _IVAS_MS_PRED_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-#include
- int32_t _round( float val );
- int32_t quantPhase( float phase );
- void cplxmult( float *pr1, float *pi1, float r2, float i2 );
- void rot_pm_pi( float *pr, float *pi );
- void rot_p_pi_2( float *pr, float *pi );
- void rot_m_pi_2( float *pr, float *pi );
- int32_t requantPhase( int32_t phaseQ );
- int32_t quantPred( float pred );
- float dequantPhase( int32_t phaseQ );
- float dequantPred( int32_t predQ );
- int32_t PrepEncode( int32_t *piQuant, const int32_t *piMSFlags, const int32_t numBands );
- void EncodePhase( int32_t *phaseQuant, int32_t numMSBands, int32_t diffDim );
- void DecodePhase( int32_t *phaseQuant, int32_t numMSBands, int32_t diffDim );
- int32_t EncodePredCoef( int32_t *predQuant, int32_t numMSBands );
- void DecodePredCoef( int32_t *phaseQuant, int32_t numMSBands );
- void writeMSPred( int32_t *phaseQuant, int32_t *predQuant, int32_t MSMode, int32_t numMSBands, int32_t numBands, void *fid, int32_t *piMsFlags );
- int32_t CountMSBits( int32_t iNumBands, const int32_t iMSMode, const int32_t *piMSFlags, const int32_t *piLRPhaseDiff, const int32_t *piMSPredCoef );
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _MS_PRED_H_ */
diff --git a/lib_rend/ivas_NoiseGen.c b/lib_rend/ivas_NoiseGen.c
index 44a794b69abf9d7252d906327017c37073fa8a35..e4a24fabd8d653cb5fa3b1043d7b36952a2cc783 100644
--- a/lib_rend/ivas_NoiseGen.c
+++ b/lib_rend/ivas_NoiseGen.c
@@ -1,6 +1,6 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -30,16 +30,22 @@
*******************************************************************************************************/
-#include "ivas_NoiseGen.h"
+#include
#include "options.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
-#include
-#include
#include
#include "prot.h"
+#include "ivas_lcld_prot.h"
#include "ivas_prot_rend.h"
#include "wmc_auto.h"
+
+/*------------------------------------------------------------------------------------------*
+ * Function CreateNoiseGen()
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
+// todo: not used!!
NoiseGen *CreateNoiseGen( void )
{
int32_t n;
@@ -75,10 +81,19 @@ NoiseGen *CreateNoiseGen( void )
return psNoiseGen;
}
+
+/*------------------------------------------------------------------------------------------*
+ * Function DeleteNoiseGen()
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
+
void DeleteNoiseGen( NoiseGen *psNoiseGen )
{
free( psNoiseGen->pfNoiseBuffer );
free( psNoiseGen );
+
+ return;
}
extern float GetNoise( NoiseGen *psNoiseGen );
diff --git a/lib_rend/ivas_NoiseGen.h b/lib_rend/ivas_NoiseGen.h
deleted file mode 100644
index b56b1f9f84a7488b15b78c0d5eecebea9f07ef01..0000000000000000000000000000000000000000
--- a/lib_rend/ivas_NoiseGen.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-
-#ifndef _IVAS_NOISE_GEN_H_
-#define _IVAS_NOISE_GEN_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-#include
- typedef struct NOISE_GEN
- {
- int32_t iNoiseBufferLength;
- int32_t iNoiseBufferMask;
- int32_t iNoiseBufferIndex;
- float *pfNoiseBuffer;
- } NoiseGen;
-
- NoiseGen *CreateNoiseGen( void );
-
- void DeleteNoiseGen( NoiseGen *psNoiseGen );
-
- inline float GetNoise( NoiseGen *psNoiseGen )
- {
- float fNoiseSample;
-
- fNoiseSample = psNoiseGen->pfNoiseBuffer[psNoiseGen->iNoiseBufferIndex];
- psNoiseGen->iNoiseBufferIndex++;
- psNoiseGen->iNoiseBufferIndex &= psNoiseGen->iNoiseBufferMask;
-
- return fNoiseSample;
- }
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _NOISE_GEN_H_ */
diff --git a/lib_rend/ivas_PerceptualModel.c b/lib_rend/ivas_PerceptualModel.c
index 8a86a0098d6fd52f32e251952fad655fd1a6d40f..4250a4fe8911c1a52404fa7b6aab700011347fe4 100644
--- a/lib_rend/ivas_PerceptualModel.c
+++ b/lib_rend/ivas_PerceptualModel.c
@@ -1,6 +1,6 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -30,39 +30,68 @@
*******************************************************************************************************/
+#include
#include "options.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
-#include "ivas_PerceptualModel.h"
+#include "ivas_lcld_prot.h"
#include "prot.h"
#include "ivas_prot_rend.h"
+#include "ivas_lcld_rom_tables.h"
#include
#include "wmc_auto.h"
-/* clang-format off */
+/*------------------------------------------------------------------------------------------*
+ * Local constants
+ *------------------------------------------------------------------------------------------*/
-static inline int32_t LogAdd(int32_t iVal1,int32_t iVal2)
+#define PERCEPTUAL_MODEL_SCALE ( 64 )
+#define PERCEPTUAL_MODEL_SCALE_SHIFT ( 6 )
+#define PERCEPTUAL_MODEL_ALPHA_SCALE ( 614 )
+#define PERCEPTUAL_MODEL_ALPHA_INV_SCALE ( 6827 )
+#define PERCEPTUAL_MODEL_ALPHA_SHIFT ( 11 )
+
+
+/*------------------------------------------------------------------------------------------*
+ * Function LogAdd()
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
+
+static inline int32_t LogAdd(
+ const int32_t iVal1,
+ const int32_t iVal2 )
{
int32_t iRetVal;
-
- if(iVal1 > iVal2){
+
+ if ( iVal1 > iVal2 )
+ {
iRetVal = iVal1 - iVal2;
- iRetVal = (iRetVal < (LOG_ADD_TABLE_LENGTH - 1)) ? iRetVal : (LOG_ADD_TABLE_LENGTH - 1);
+ iRetVal = ( iRetVal < ( LOG_ADD_TABLE_LENGTH - 1 ) ) ? iRetVal : ( LOG_ADD_TABLE_LENGTH - 1 );
iRetVal = iVal1 + c_aiLogAddTable[iRetVal];
}
- else{
+ else
+ {
iRetVal = iVal2 - iVal1;
- iRetVal = (iRetVal < (LOG_ADD_TABLE_LENGTH - 1)) ? iRetVal : (LOG_ADD_TABLE_LENGTH - 1);
+ iRetVal = ( iRetVal < ( LOG_ADD_TABLE_LENGTH - 1 ) ) ? iRetVal : ( LOG_ADD_TABLE_LENGTH - 1 );
iRetVal = iVal2 + c_aiLogAddTable[iRetVal];
}
-
+
return iRetVal;
}
-void PerceptualModel( const int32_t iMaxQuantBands,
- const int32_t *piRMSEnvelope,
- int32_t *piExcitation,
- int32_t *piSMR )
+
+/*------------------------------------------------------------------------------------------*
+ * Function PerceptualModel()
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
+
+void PerceptualModel(
+ const int32_t iMaxQuantBands,
+ const int32_t *piRMSEnvelope,
+ int32_t *piExcitation,
+ int32_t *piSMR )
{
int32_t n;
@@ -71,16 +100,19 @@ void PerceptualModel( const int32_t iMaxQuantBands,
int32_t iSLOffset;
piExcitation[n] = PERCEPTUAL_MODEL_SCALE * piRMSEnvelope[n] + c_aiBandwidthAdjust48[n];
- // Calculate sensation level offset
+
+ /* Calculate sensation level offset */
iSLOffset = c_aiDefaultTheta48[n] * ( piExcitation[n] - c_aiAbsoluteThresh48[n] ) >> PERCEPTUAL_MODEL_SLGAIN_SHIFT;
// iSLOffset = (iSLOffset > 0) ? iSLOffset : 0;
- // Offset envelope by sensation level offset
+
+ /* Offset envelope by sensation level offset */
piExcitation[n] -= iSLOffset;
- // Convert to loudness domain (x^0.3)
+
+ /* Convert to loudness domain (x^0.3) */
piExcitation[n] = PERCEPTUAL_MODEL_ALPHA_SCALE * piExcitation[n] >> PERCEPTUAL_MODEL_ALPHA_SHIFT;
}
- // Spread excitation function
+ /* Spread excitation function */
for ( n = 0; n < iMaxQuantBands; n++ )
{
int32_t k;
@@ -102,16 +134,26 @@ void PerceptualModel( const int32_t iMaxQuantBands,
piSMR[n] = PERCEPTUAL_MODEL_ALPHA_INV_SCALE * piSMR[n] >> PERCEPTUAL_MODEL_ALPHA_SHIFT;
piSMR[n] = PERCEPTUAL_MODEL_SCALE * piRMSEnvelope[n] + c_aiBandwidthAdjust48[n] - piSMR[n];
}
+
+ return;
}
-void PerceptualModelStereo( const int32_t iMaxQuantBands,
- const int32_t *piMSFlags,
- const int32_t *piRMSEnvelope0,
- const int32_t *piRMSEnvelope1,
- int32_t *piExcitation0,
- int32_t *piExcitation1,
- int32_t *piSMR0,
- int32_t *piSMR1 )
+
+/*------------------------------------------------------------------------------------------*
+ * Function PerceptualModelStereo()
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
+
+void PerceptualModelStereo(
+ const int32_t iMaxQuantBands,
+ const int32_t *piMSFlags,
+ const int32_t *piRMSEnvelope0,
+ const int32_t *piRMSEnvelope1,
+ int32_t *piExcitation0,
+ int32_t *piExcitation1,
+ int32_t *piSMR0,
+ int32_t *piSMR1 )
{
int32_t n;
@@ -122,17 +164,20 @@ void PerceptualModelStereo( const int32_t iMaxQuantBands,
iMaxRMSEnv = piRMSEnvelope0[n];
- piExcitation0[n] = PERCEPTUAL_MODEL_SCALE * iMaxRMSEnv + c_aiBandwidthAdjust48[n]; // piRMSEnvelope0[n]
- // Calculate sensation level offset
+ piExcitation0[n] = PERCEPTUAL_MODEL_SCALE * iMaxRMSEnv + c_aiBandwidthAdjust48[n]; /* piRMSEnvelope0[n] */
+
+ /* Calculate sensation level offset */
iSLOffset = c_aiDefaultTheta48[n] * ( piExcitation0[n] - c_aiAbsoluteThresh48[n] ) >> PERCEPTUAL_MODEL_SLGAIN_SHIFT;
// iSLOffset = (iSLOffset > 0) ? iSLOffset : 0;
- // Offset envelope by sensation level offset
+
+ /* Offset envelope by sensation level offset */
piExcitation0[n] -= iSLOffset;
- // Convert to loudness domain (x^0.3)
+
+ /* Convert to loudness domain (x^0.3) */
piExcitation0[n] = PERCEPTUAL_MODEL_ALPHA_SCALE * piExcitation0[n] >> PERCEPTUAL_MODEL_ALPHA_SHIFT;
}
- // Spread excitation function
+ /* Spread excitation function */
for ( n = 0; n < iMaxQuantBands; n++ )
{
int32_t k;
@@ -156,17 +201,20 @@ void PerceptualModelStereo( const int32_t iMaxQuantBands,
iMaxRMSEnv = piRMSEnvelope1[n];
- piExcitation1[n] = PERCEPTUAL_MODEL_SCALE * iMaxRMSEnv + c_aiBandwidthAdjust48[n]; // piRMSEnvelope1[n]
- // Calculate sensation level offset
+ piExcitation1[n] = PERCEPTUAL_MODEL_SCALE * iMaxRMSEnv + c_aiBandwidthAdjust48[n]; /* piRMSEnvelope1[n] */
+
+ /* Calculate sensation level offset */
iSLOffset = c_aiDefaultTheta48[n] * ( piExcitation1[n] - c_aiAbsoluteThresh48[n] ) >> PERCEPTUAL_MODEL_SLGAIN_SHIFT;
// iSLOffset = (iSLOffset > 0) ? iSLOffset : 0;
- // Offset envelope by sensation level offset
+
+ /* Offset envelope by sensation level offset */
piExcitation1[n] -= iSLOffset;
- // Convert to loudness domain (x^0.3)
+
+ /* Convert to loudness domain (x^0.3) */
piExcitation1[n] = PERCEPTUAL_MODEL_ALPHA_SCALE * piExcitation1[n] >> PERCEPTUAL_MODEL_ALPHA_SHIFT;
}
- // Spread excitation function
+ /* Spread excitation function */
for ( n = 0; n < iMaxQuantBands; n++ )
{
int32_t k;
@@ -203,5 +251,7 @@ void PerceptualModelStereo( const int32_t iMaxQuantBands,
piSMR1[n] = PERCEPTUAL_MODEL_ALPHA_INV_SCALE * piSMR1[n] >> PERCEPTUAL_MODEL_ALPHA_SHIFT;
piSMR1[n] = PERCEPTUAL_MODEL_SCALE * piRMSEnvelope1[n] + c_aiBandwidthAdjust48[n] - piSMR1[n];
}
+
+ return;
}
#endif
diff --git a/lib_rend/ivas_PerceptualModel.h b/lib_rend/ivas_PerceptualModel.h
deleted file mode 100644
index b7d75d16dafece3aa954fd33e7c2c8f689745db4..0000000000000000000000000000000000000000
--- a/lib_rend/ivas_PerceptualModel.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-
-#ifndef _IVAS_PERCEPTUAL_MODEL_H_
-#define _IVAS_PERCEPTUAL_MODEL_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-#include "options.h"
-#ifdef SPLIT_REND_WITH_HEAD_ROT
-
-#include
-
-#define LOG_ADD_TABLE_LENGTH ( 512 )
-#define PERCEPTUAL_MODEL_SCALE ( 64 )
-#define PERCEPTUAL_MODEL_SCALE_SHIFT ( 6 )
-#define PERCEPTUAL_MODEL_ALPHA_SCALE ( 614 )
-#define PERCEPTUAL_MODEL_ALPHA_INV_SCALE ( 6827 )
-#define PERCEPTUAL_MODEL_ALPHA_SHIFT ( 11 )
-#define PERCEPTUAL_MODEL_SLGAIN_SHIFT ( 8 ) //(4)
-#define MAX_BANDS_48 ( 23 )
-
- extern const int32_t c_aiLogAddTable[LOG_ADD_TABLE_LENGTH];
- extern const int32_t c_aiBandwidthAdjust48[MAX_BANDS_48];
- extern const int32_t c_aiAbsoluteThresh48[MAX_BANDS_48];
- extern const int32_t c_aiDefaultTheta48[MAX_BANDS_48];
- extern const int32_t c_aaiSpreadFunction48[MAX_BANDS_48 * MAX_BANDS_48];
-
- extern void PerceptualModel( const int32_t iMaxQuantBands,
- const int32_t *piRMSEnvelope,
- int32_t *piExcitation,
- int32_t *piSMR );
-
- extern void PerceptualModelStereo( const int32_t iMaxQuantBands,
- const int32_t *piMSFlags,
- const int32_t *piRMSEnvelope0,
- const int32_t *piRMSEnvelope1,
- int32_t *piExcitation0,
- int32_t *piExcitation1,
- int32_t *piSMR0,
- int32_t *piSMR1 );
-
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PERCEPTUAL_MODEL_H_ */
diff --git a/lib_rend/ivas_PredDecoder.c b/lib_rend/ivas_PredDecoder.c
index 1e8adf2aed421352f23ff54abc14d266e011fd36..abc78e894014d4f2e931fd5df7561235f39afa8a 100644
--- a/lib_rend/ivas_PredDecoder.c
+++ b/lib_rend/ivas_PredDecoder.c
@@ -1,6 +1,6 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -30,56 +30,104 @@
*******************************************************************************************************/
+#include
#include "options.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
-#include "ivas_PredDecoder.h"
-#include
#include
-#include
#include "prot.h"
#include "ivas_prot_rend.h"
-#include "ivas_lcld_tables.h"
-#include "ivas_PredTables.h"
+#include "ivas_lcld_prot.h"
+#include "ivas_lcld_rom_tables.h"
#include "ivas_cldfb_codec_bitstream.h"
#include "wmc_auto.h"
-PredictionDecoder *CreatePredictionDecoder( const int32_t iChannels,
- const int32_t iNumBlocks )
+/*-------------------------------------------------------------------*
+ * Function CreatePredictionDecoder()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+ivas_error CreatePredictionDecoder(
+ PredictionDecoder **psPredictionDecoder_out,
+ const int32_t iChannels,
+ const int32_t iNumBlocks )
{
- int32_t n;
+ int16_t n;
PredictionDecoder *psPredictionDecoder = NULL;
- psPredictionDecoder = (PredictionDecoder *) malloc( sizeof( PredictionDecoder ) );
+ if ( ( psPredictionDecoder = (PredictionDecoder *) malloc( sizeof( PredictionDecoder ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
psPredictionDecoder->iChannels = iChannels;
psPredictionDecoder->iNumBlocks = iNumBlocks;
- psPredictionDecoder->piPredChanEnable = (int32_t *) malloc( sizeof( int32_t ) * iChannels );
- psPredictionDecoder->piNumPredBands = (int32_t *) malloc( sizeof( int32_t ) * iChannels );
+ if ( ( psPredictionDecoder->piPredChanEnable = (int32_t *) malloc( sizeof( int32_t ) * iChannels ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psPredictionDecoder->piNumPredBands = (int32_t *) malloc( sizeof( int32_t ) * iChannels ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psPredictionDecoder->ppfEstPredGain = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psPredictionDecoder->ppiPredBandEnable = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psPredictionDecoder->ppfA1Real = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psPredictionDecoder->ppfA1Imag = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psPredictionDecoder->ppiA1Mag = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psPredictionDecoder->ppiA1Phase = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
- psPredictionDecoder->ppfEstPredGain = (float **) malloc( sizeof( float * ) * iChannels );
- psPredictionDecoder->ppiPredBandEnable = (int32_t **) malloc( sizeof( int32_t * ) * iChannels );
- psPredictionDecoder->ppfA1Real = (float **) malloc( sizeof( float * ) * iChannels );
- psPredictionDecoder->ppfA1Imag = (float **) malloc( sizeof( float * ) * iChannels );
- psPredictionDecoder->ppiA1Mag = (int32_t **) malloc( sizeof( int32_t * ) * iChannels );
- psPredictionDecoder->ppiA1Phase = (int32_t **) malloc( sizeof( int32_t * ) * iChannels );
for ( n = 0; n < psPredictionDecoder->iChannels; n++ )
{
- psPredictionDecoder->ppfEstPredGain[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS );
- psPredictionDecoder->ppiPredBandEnable[n] = (int32_t *) malloc( sizeof( int32_t ) * CQMF_BANDS );
- psPredictionDecoder->ppfA1Real[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS );
- psPredictionDecoder->ppfA1Imag[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS );
- psPredictionDecoder->ppiA1Mag[n] = (int32_t *) malloc( sizeof( int32_t ) * CQMF_BANDS );
- psPredictionDecoder->ppiA1Phase[n] = (int32_t *) malloc( sizeof( int32_t ) * CQMF_BANDS );
+ if ( ( psPredictionDecoder->ppfEstPredGain[n] = (float *) malloc( sizeof( float ) * LCLD_BANDS ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psPredictionDecoder->ppiPredBandEnable[n] = (int32_t *) malloc( sizeof( int32_t ) * LCLD_BANDS ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psPredictionDecoder->ppfA1Real[n] = (float *) malloc( sizeof( float ) * LCLD_BANDS ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psPredictionDecoder->ppfA1Imag[n] = (float *) malloc( sizeof( float ) * LCLD_BANDS ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psPredictionDecoder->ppiA1Mag[n] = (int32_t *) malloc( sizeof( int32_t ) * LCLD_BANDS ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psPredictionDecoder->ppiA1Phase[n] = (int32_t *) malloc( sizeof( int32_t ) * LCLD_BANDS ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
}
/* pre-define these tables? */
- psPredictionDecoder->pfMagLUT = (float *) malloc( sizeof( float ) * ( 1 << PRED_QUNAT_FILTER_MAG_BITS ) );
- psPredictionDecoder->pfP2RRealLUT = (float *) malloc( sizeof( float ) * ( 1 << PRED_QUANT_FILTER_PHASE_BITS ) );
- psPredictionDecoder->pfP2RImagLUT = (float *) malloc( sizeof( float ) * ( 1 << PRED_QUANT_FILTER_PHASE_BITS ) );
-
for ( n = 0; n < ( 1 << PRED_QUNAT_FILTER_MAG_BITS ); n++ )
{
const float fInvMagScale = M_PI / ( 2.0f * (float) ( 1 << ( PRED_QUNAT_FILTER_MAG_BITS ) ) + 1.0f );
@@ -89,18 +137,27 @@ PredictionDecoder *CreatePredictionDecoder( const int32_t iChannels,
for ( n = 0; n < ( 1 << PRED_QUANT_FILTER_PHASE_BITS ); n++ )
{
const float fInvPhaseScale = M_PI / (float) ( 1 << ( PRED_QUANT_FILTER_PHASE_BITS - 1 ) );
- int32_t iVal;
+ int16_t iVal;
iVal = n + PRED_QUANT_FILTER_PHASE_MIN;
psPredictionDecoder->pfP2RRealLUT[n] = cosf( fInvPhaseScale * (float) iVal );
psPredictionDecoder->pfP2RImagLUT[n] = sinf( fInvPhaseScale * (float) iVal );
}
+ *psPredictionDecoder_out = psPredictionDecoder;
- return psPredictionDecoder;
+ return IVAS_ERR_OK;
}
-void DeletePredictionDecoder( PredictionDecoder *psPredictionDecoder )
+
+/*-------------------------------------------------------------------*
+ * Function DeletePredictionDecoder()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void DeletePredictionDecoder(
+ PredictionDecoder *psPredictionDecoder )
{
int32_t n;
@@ -122,17 +179,25 @@ void DeletePredictionDecoder( PredictionDecoder *psPredictionDecoder )
free( psPredictionDecoder->ppiA1Mag );
free( psPredictionDecoder->ppiA1Phase );
- free( psPredictionDecoder->pfMagLUT );
- free( psPredictionDecoder->pfP2RRealLUT );
- free( psPredictionDecoder->pfP2RImagLUT );
-
free( psPredictionDecoder );
+ psPredictionDecoder = NULL;
+
+ return;
}
+
+
#define USE_TABLE_LOOKUP
-int32_t ReadPredictors( PredictionDecoder *psPredictionDecoder,
- ivas_split_rend_bits_t *pBits )
+/*-------------------------------------------------------------------*
+ * Function ReadPredictors()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+int32_t ReadPredictors(
+ PredictionDecoder *psPredictionDecoder,
+ ivas_split_rend_bits_t *pBits )
{
- int32_t iBitsRead = 0;
+ int16_t iBitsRead = 0;
int32_t c;
for ( c = 0; c < psPredictionDecoder->iChannels; c++ )
@@ -144,7 +209,7 @@ int32_t ReadPredictors( PredictionDecoder *psPredictionDecoder,
{
int32_t b;
- for ( b = 0; b < CQMF_BANDS; b++ )
+ for ( b = 0; b < LCLD_BANDS; b++ )
{
psPredictionDecoder->ppiPredBandEnable[c][b] = 0;
}
@@ -205,15 +270,15 @@ int32_t ReadPredictors( PredictionDecoder *psPredictionDecoder,
psPredictionDecoder->ppfA1Real[c][b] = fA1Real;
psPredictionDecoder->ppfA1Imag[c][b] = fA1Imag;
- // printf("Dec %f\t%f\t%f\n",fA1Real,fA1Imag,fA1Real * fA1Real + fA1Imag * fA1Imag);
+ /* printf("Dec %f\t%f\t%f\n",fA1Real,fA1Imag,fA1Real * fA1Real + fA1Imag * fA1Imag); */
#endif
}
}
}
else
{
- int32_t b;
- for ( b = 0; b < CQMF_BANDS; b++ )
+ int16_t b;
+ for ( b = 0; b < LCLD_BANDS; b++ )
{
psPredictionDecoder->ppiPredBandEnable[c][b] = 0;
}
@@ -223,9 +288,17 @@ int32_t ReadPredictors( PredictionDecoder *psPredictionDecoder,
return iBitsRead;
}
-void ApplyInversePredictros( PredictionDecoder *psPredictionDecoder,
- float ***pppfReal,
- float ***pppfImag )
+
+/*-------------------------------------------------------------------*
+ * Function ApplyInversePredictros()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void ApplyInversePredictros(
+ PredictionDecoder *psPredictionDecoder,
+ float ***pppfReal,
+ float ***pppfImag )
{
int32_t c;
for ( c = 0; c < psPredictionDecoder->iChannels; c++ )
@@ -258,5 +331,7 @@ void ApplyInversePredictros( PredictionDecoder *psPredictionDecoder,
}
}
}
+
+ return;
}
#endif
diff --git a/lib_rend/ivas_PredDecoder.h b/lib_rend/ivas_PredDecoder.h
deleted file mode 100644
index 47f986bc7dd643e59f5a866c7737fbc3dda584ee..0000000000000000000000000000000000000000
--- a/lib_rend/ivas_PredDecoder.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-
-#ifndef _IVAS_PRED_DECODER_H_
-#define _IVAS_PRED_DECODER_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include "options.h"
-#ifdef SPLIT_REND_WITH_HEAD_ROT
-
-#include "ivas_cldfb_codec_bitstream.h"
-
- // typedef struct PREDICTION_DECODER PredictionDecoder;
-
- typedef struct PREDICTION_DECODER
- {
- int32_t iChannels;
- int32_t iNumBlocks;
-
- int32_t *piPredChanEnable;
- int32_t *piNumPredBands;
-
- float **ppfEstPredGain;
- int32_t **ppiPredBandEnable;
-
- float **ppfA1Real;
- float **ppfA1Imag;
-
- int32_t **ppiA1Mag;
- int32_t **ppiA1Phase;
-
- float *pfMagLUT;
- float *pfP2RRealLUT;
- float *pfP2RImagLUT;
- } PredictionDecoder;
-
- PredictionDecoder *CreatePredictionDecoder( const int32_t iChannels,
- const int32_t iNumBlocks );
-
- void DeletePredictionDecoder( PredictionDecoder *psPredictionDecoder );
-
- int32_t ReadPredictors( PredictionDecoder *psPredictionDecoder,
- ivas_split_rend_bits_t *pBits );
-
- void ApplyInversePredictros( PredictionDecoder *psPredictionDecoder,
- float ***pppfReal,
- float ***pppfImag );
-
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PRED_DECODER_H_ */
diff --git a/lib_rend/ivas_PredEncoder.c b/lib_rend/ivas_PredEncoder.c
index f8b26426fe730a8e6d5cda70d26dd50fadbef885..59aa58129e944234024384f022280ca34d6caa9e 100644
--- a/lib_rend/ivas_PredEncoder.c
+++ b/lib_rend/ivas_PredEncoder.c
@@ -1,6 +1,6 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -30,69 +30,124 @@
*******************************************************************************************************/
+#include
#include "options.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
-#include "ivas_PredEncoder.h"
-#include
-#include
#include
-#include "ivas_lcld_tables.h"
-#include "ivas_PredTables.h"
+#include "ivas_lcld_prot.h"
+#include "ivas_lcld_rom_tables.h"
#include "prot.h"
#include "ivas_prot_rend.h"
#include "ivas_cldfb_codec_bitstream.h"
#include "wmc_auto.h"
-PredictionEncoder *CreatePredictionEncoder( const int32_t iChannels,
- const int32_t iNumBlocks )
-{
- int32_t n;
+/*-------------------------------------------------------------------*
+ * Function CreatePredictionEncoder()
+ *
+ *
+ *-------------------------------------------------------------------*/
+ivas_error CreatePredictionEncoder(
+ PredictionEncoder **psPredictionEncoder_out,
+ const int32_t iChannels,
+ const int32_t iNumBlocks )
+{
+ int32_t k, n;
PredictionEncoder *psPredictionEncoder = NULL;
- psPredictionEncoder = (PredictionEncoder *) malloc( sizeof( PredictionEncoder ) );
+ if ( ( psPredictionEncoder = (PredictionEncoder *) malloc( sizeof( PredictionEncoder ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) );
+ }
psPredictionEncoder->iChannels = iChannels;
psPredictionEncoder->iNumBlocks = iNumBlocks;
- psPredictionEncoder->pfWindow = (float *) malloc( sizeof( float ) * iNumBlocks );
+ if ( ( psPredictionEncoder->pfWindow = (float *) malloc( sizeof( float ) * iNumBlocks ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) );
+ }
for ( n = 0; n < iNumBlocks; n++ )
{
psPredictionEncoder->pfWindow[n] = 0.54f - 0.46f * cosf( 2.0f * M_PI * ( (float) n + 0.5f ) / (float) iNumBlocks );
}
+ if ( ( psPredictionEncoder->piPredChanEnable = (int32_t *) malloc( sizeof( int32_t ) * iChannels ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) );
+ }
- psPredictionEncoder->pfRxxReal = (float *) malloc( sizeof( float ) * 2 );
- psPredictionEncoder->pfRxxImag = (float *) malloc( sizeof( float ) * 2 );
-
- psPredictionEncoder->piPredChanEnable = (int32_t *) malloc( sizeof( int32_t ) * iChannels );
- psPredictionEncoder->piNumPredBands = (int32_t *) malloc( sizeof( int32_t ) * iChannels );
+ if ( ( psPredictionEncoder->piNumPredBands = (int32_t *) malloc( sizeof( int32_t ) * iChannels ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) );
+ }
for ( n = 0; n < psPredictionEncoder->iChannels; n++ )
{
psPredictionEncoder->piPredChanEnable[n] = 0;
psPredictionEncoder->piNumPredBands[n] = 40; // Will need to be set correctly
}
- psPredictionEncoder->ppfEstPredGain = (float **) malloc( sizeof( float * ) * iChannels );
- psPredictionEncoder->ppfEstPredBitGain = (float **) malloc( sizeof( float * ) * iChannels );
- psPredictionEncoder->ppiPredBandEnable = (int32_t **) malloc( sizeof( int32_t * ) * iChannels );
- psPredictionEncoder->ppfA1Real = (float **) malloc( sizeof( float * ) * iChannels );
- psPredictionEncoder->ppfA1Imag = (float **) malloc( sizeof( float * ) * iChannels );
- psPredictionEncoder->ppiA1Mag = (int32_t **) malloc( sizeof( int32_t * ) * iChannels );
- psPredictionEncoder->ppiA1Phase = (int32_t **) malloc( sizeof( int32_t * ) * iChannels );
+ if ( ( psPredictionEncoder->ppfEstPredGain = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) );
+ }
+ if ( ( psPredictionEncoder->ppfEstPredBitGain = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) );
+ }
+ if ( ( psPredictionEncoder->ppiPredBandEnable = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) );
+ }
+ if ( ( psPredictionEncoder->ppfA1Real = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) );
+ }
+ if ( ( psPredictionEncoder->ppfA1Imag = (float **) malloc( sizeof( float * ) * iChannels ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) );
+ }
+ if ( ( psPredictionEncoder->ppiA1Mag = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) );
+ }
+ if ( ( psPredictionEncoder->ppiA1Phase = (int32_t **) malloc( sizeof( int32_t * ) * iChannels ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) );
+ }
+
for ( n = 0; n < psPredictionEncoder->iChannels; n++ )
{
- int32_t k;
-
- psPredictionEncoder->ppfEstPredGain[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS );
- psPredictionEncoder->ppfEstPredBitGain[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS );
- psPredictionEncoder->ppiPredBandEnable[n] = (int32_t *) malloc( sizeof( int32_t ) * CQMF_BANDS );
- psPredictionEncoder->ppfA1Real[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS );
- psPredictionEncoder->ppfA1Imag[n] = (float *) malloc( sizeof( float ) * CQMF_BANDS );
- psPredictionEncoder->ppiA1Mag[n] = (int32_t *) malloc( sizeof( int32_t ) * CQMF_BANDS );
- psPredictionEncoder->ppiA1Phase[n] = (int32_t *) malloc( sizeof( int32_t ) * CQMF_BANDS );
- for ( k = 0; k < CQMF_BANDS; k++ )
+ if ( ( psPredictionEncoder->ppfEstPredGain[n] = (float *) malloc( sizeof( float ) * LCLD_BANDS ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) );
+ }
+ if ( ( psPredictionEncoder->ppfEstPredBitGain[n] = (float *) malloc( sizeof( float ) * LCLD_BANDS ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) );
+ }
+ if ( ( psPredictionEncoder->ppiPredBandEnable[n] = (int32_t *) malloc( sizeof( int32_t ) * LCLD_BANDS ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) );
+ }
+ if ( ( psPredictionEncoder->ppfA1Real[n] = (float *) malloc( sizeof( float ) * LCLD_BANDS ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) );
+ }
+ if ( ( psPredictionEncoder->ppfA1Imag[n] = (float *) malloc( sizeof( float ) * LCLD_BANDS ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) );
+ }
+ if ( ( psPredictionEncoder->ppiA1Mag[n] = (int32_t *) malloc( sizeof( int32_t ) * LCLD_BANDS ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) );
+ }
+ if ( ( psPredictionEncoder->ppiA1Phase[n] = (int32_t *) malloc( sizeof( int32_t ) * LCLD_BANDS ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) );
+ }
+ for ( k = 0; k < LCLD_BANDS; k++ )
{
psPredictionEncoder->ppiPredBandEnable[n][k] = 0;
psPredictionEncoder->ppfA1Real[n][k] = 0.0;
@@ -100,16 +155,24 @@ PredictionEncoder *CreatePredictionEncoder( const int32_t iChannels,
}
}
- return psPredictionEncoder;
+ *psPredictionEncoder_out = psPredictionEncoder;
+
+ return IVAS_ERR_OK;
}
-void DeletePredictionEncoder( PredictionEncoder *psPredictionEncoder )
+
+/*-------------------------------------------------------------------*
+ * Function DeletePredictionEncoder()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void DeletePredictionEncoder(
+ PredictionEncoder *psPredictionEncoder )
{
int32_t n;
free( psPredictionEncoder->pfWindow );
- free( psPredictionEncoder->pfRxxReal );
- free( psPredictionEncoder->pfRxxImag );
for ( n = 0; n < psPredictionEncoder->iChannels; n++ )
{
@@ -132,11 +195,23 @@ void DeletePredictionEncoder( PredictionEncoder *psPredictionEncoder )
free( psPredictionEncoder->ppiA1Phase );
free( psPredictionEncoder );
+
+ return;
}
+
+
//#define USE_RXX_WINDOW
-int32_t ComputePredictors( PredictionEncoder *psPredictionEncoder,
- float ***pppfReal,
- float ***pppfImag )
+
+/*-------------------------------------------------------------------*
+ * Function ComputePredictors()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+int32_t ComputePredictors(
+ PredictionEncoder *psPredictionEncoder,
+ float ***pppfReal,
+ float ***pppfImag )
{
int32_t c;
int32_t iPredictionBits = 0;
@@ -155,8 +230,6 @@ int32_t ComputePredictors( PredictionEncoder *psPredictionEncoder,
float *pfRxxImag;
float fA1Real;
float fA1Imag;
- // int32_t iA1Real;
- // int32_t iA1Imag;
int32_t iA1Mag;
int32_t iA1Phase;
@@ -213,12 +286,12 @@ int32_t ComputePredictors( PredictionEncoder *psPredictionEncoder,
const float fPhaseScale = (float) ( 1 << ( PRED_QUANT_FILTER_PHASE_BITS - 1 ) ) / M_PI;
const float fInvPhaseScale = M_PI / (float) ( 1 << ( PRED_QUANT_FILTER_PHASE_BITS - 1 ) );
- // Compute filter coefficeints
+ /* Compute filter coefficeints */
fA1Real = -pfRxxReal[1] / pfRxxReal[0];
fA1Imag = -pfRxxImag[1] / pfRxxReal[0];
- // compute these before quant
- // Compute est coding gain based on quantized filter coefficients
+ /* compute these before quant */
+ /* Compute est coding gain based on quantized filter coefficients */
fGain = 1.0f / ( 1.0f - fA1Real * fA1Real - fA1Imag * fA1Imag );
fBitGain = 0.6f * log2f( fGain ) * (float) ( iNumBlocks ) - (float) ( PRED_QUNAT_FILTER_MAG_BITS + PRED_QUANT_FILTER_PHASE_BITS ); // Wrong fix (iNumBlocks-1)
@@ -354,7 +427,7 @@ int32_t ComputePredictors( PredictionEncoder *psPredictionEncoder,
iPredictionBits += ( PRED_QUNAT_FILTER_MAG_BITS + PRED_QUANT_FILTER_PHASE_BITS );
}
}
- for ( b = iPredBands; b < CQMF_BANDS; b++ )
+ for ( b = iPredBands; b < LCLD_BANDS; b++ )
{
psPredictionEncoder->ppiPredBandEnable[c][b] = 0;
}
@@ -365,7 +438,7 @@ int32_t ComputePredictors( PredictionEncoder *psPredictionEncoder,
{
// int32_t b;
iPredictionBits += 1;
- for ( b = 0; b < CQMF_BANDS; b++ )
+ for ( b = 0; b < LCLD_BANDS; b++ )
{
psPredictionEncoder->ppiPredBandEnable[c][b] = 0;
}
@@ -379,9 +452,17 @@ int32_t ComputePredictors( PredictionEncoder *psPredictionEncoder,
return iPredictionBits;
}
-void ApplyForwardPredictors( PredictionEncoder *psPredictionEncoder,
- float ***pppfReal,
- float ***pppfImag )
+
+/*-------------------------------------------------------------------*
+ * Function ApplyForwardPredictors()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void ApplyForwardPredictors(
+ PredictionEncoder *psPredictionEncoder,
+ float ***pppfReal,
+ float ***pppfImag )
{
int32_t c;
for ( c = 0; c < psPredictionEncoder->iChannels; c++ )
@@ -421,10 +502,20 @@ void ApplyForwardPredictors( PredictionEncoder *psPredictionEncoder,
}
}
}
+
+ return;
}
-int32_t WritePredictors( PredictionEncoder *psPredictionEncoder,
- ivas_split_rend_bits_t *pBits )
+
+/*-------------------------------------------------------------------*
+ * Function WritePredictors()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+int32_t WritePredictors(
+ PredictionEncoder *psPredictionEncoder,
+ ivas_split_rend_bits_t *pBits )
{
int32_t iBitsWritten = 0;
int32_t c;
@@ -432,21 +523,17 @@ int32_t WritePredictors( PredictionEncoder *psPredictionEncoder,
for ( c = 0; c < psPredictionEncoder->iChannels; c++ )
{
int32_t b;
- ivas_split_rend_bitstream_write_int32(
- pBits, psPredictionEncoder->piPredChanEnable[c],
- 1 );
+ ivas_split_rend_bitstream_write_int32( pBits, psPredictionEncoder->piPredChanEnable[c], 1 );
iBitsWritten += 1;
if ( psPredictionEncoder->piPredChanEnable[c] == 1 )
{
- ivas_split_rend_bitstream_write_int32(
- pBits, psPredictionEncoder->piNumPredBands[c], 6 );
+ ivas_split_rend_bitstream_write_int32( pBits, psPredictionEncoder->piNumPredBands[c], 6 );
iBitsWritten += 6;
for ( b = 0; b < psPredictionEncoder->piNumPredBands[c]; b++ )
{
- ivas_split_rend_bitstream_write_int32(
- pBits, psPredictionEncoder->ppiPredBandEnable[c][b], 1 );
+ ivas_split_rend_bitstream_write_int32( pBits, psPredictionEncoder->ppiPredBandEnable[c][b], 1 );
iBitsWritten += 1;
if ( psPredictionEncoder->ppiPredBandEnable[c][b] == 1 )
@@ -456,11 +543,9 @@ int32_t WritePredictors( PredictionEncoder *psPredictionEncoder,
iA1Mag = psPredictionEncoder->ppiA1Mag[c][b];
iA1Phase = psPredictionEncoder->ppiA1Phase[c][b] - PRED_QUANT_FILTER_PHASE_MIN;
- ivas_split_rend_bitstream_write_int32(
- pBits, iA1Mag, PRED_QUNAT_FILTER_MAG_BITS );
+ ivas_split_rend_bitstream_write_int32( pBits, iA1Mag, PRED_QUNAT_FILTER_MAG_BITS );
iBitsWritten += PRED_QUNAT_FILTER_MAG_BITS;
- ivas_split_rend_bitstream_write_int32(
- pBits, iA1Phase, PRED_QUANT_FILTER_PHASE_BITS );
+ ivas_split_rend_bitstream_write_int32( pBits, iA1Phase, PRED_QUANT_FILTER_PHASE_BITS );
iBitsWritten += PRED_QUANT_FILTER_PHASE_BITS;
}
}
diff --git a/lib_rend/ivas_PredEncoder.h b/lib_rend/ivas_PredEncoder.h
deleted file mode 100644
index e74c61d76b71c61a665cae3a8f743ba73aa47b48..0000000000000000000000000000000000000000
--- a/lib_rend/ivas_PredEncoder.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-
-#ifndef _IVAS_PRED_ENCODER_H_
-#define _IVAS_PRED_ENCODER_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include "options.h"
-#ifdef SPLIT_REND_WITH_HEAD_ROT
-
-#include "ivas_cldfb_codec_bitstream.h"
-
- typedef struct PREDICTION_ENCODER
- {
- int32_t iChannels;
- int32_t iNumBlocks;
-
- float *pfWindow;
- float *pfRxxReal;
- float *pfRxxImag;
-
- int32_t *piPredChanEnable;
- int32_t *piNumPredBands;
-
- float **ppfEstPredGain;
- float **ppfEstPredBitGain;
- int32_t **ppiPredBandEnable;
-
- float **ppfA1Real;
- float **ppfA1Imag;
-
- int32_t **ppiA1Mag;
- int32_t **ppiA1Phase;
- } PredictionEncoder;
-
- PredictionEncoder *CreatePredictionEncoder( const int32_t iChannels,
- const int32_t iNumBlocks );
-
- void DeletePredictionEncoder( PredictionEncoder *psPredictionEncoder );
-
- int32_t ComputePredictors( PredictionEncoder *psPredictionEncoder,
- float ***pppfReal,
- float ***pppfImag );
-
- void ApplyForwardPredictors( PredictionEncoder *psPredictionEncoder,
- float ***pppfReal,
- float ***pppfImag );
-
-
- int32_t WritePredictors( PredictionEncoder *psPredictionEncoder,
- ivas_split_rend_bits_t *pBits );
-
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PRED_ENCODER_H_ */
diff --git a/lib_rend/ivas_PredTables.h b/lib_rend/ivas_PredTables.h
deleted file mode 100644
index dbecc24c40fb6727a2ee33726907fae8946915dd..0000000000000000000000000000000000000000
--- a/lib_rend/ivas_PredTables.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-
-#ifndef _IVAS_PRED_TABLE_H_
-#define _IVAS_PRED_TABLE_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include "options.h"
-#ifdef SPLIT_REND_WITH_HEAD_ROT
-
-#define PRED_QUNAT_FILTER_MAG_BITS ( 3 )
-#define PRED_QUANT_FILTER_PHASE_BITS ( 5 )
-#define PRED_QUANT_FILTER_MAG_MIN ( 0 )
-#define PRED_QUANT_FILTER_MAG_MAX ( 7 )
-#define PRED_QUANT_FILTER_PHASE_MIN ( -16 )
-#define PRED_QUANT_FILTER_PHASE_MAX ( 15 )
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PRED_TABLE_H_ */
diff --git a/lib_rend/ivas_RMSEnvGrouping.c b/lib_rend/ivas_RMSEnvGrouping.c
index 11b4a71accfed49e7e12e5225f22c4d888ae76d6..770165ba6fb07d13cbba26733e9874f15d39bcff 100644
--- a/lib_rend/ivas_RMSEnvGrouping.c
+++ b/lib_rend/ivas_RMSEnvGrouping.c
@@ -1,6 +1,6 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -30,22 +30,77 @@
*******************************************************************************************************/
-#include "options.h"
-#ifdef SPLIT_REND_WITH_HEAD_ROT
-#include "ivas_RMSEnvGrouping.h"
-
/* Double check cost function calculation */
-#include
-#include
#include
-#include
+#include "options.h"
+#ifdef SPLIT_REND_WITH_HEAD_ROT
+#include
#include "prot.h"
#include "ivas_prot_rend.h"
-#include "ivas_lcld_tables.h"
+#include "ivas_lcld_prot.h"
+#include "ivas_lcld_rom_tables.h"
#include "wmc_auto.h"
+/*-------------------------------------------------------------------*
+ * Local ROM tables
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static const float c_afThreshQuiet48[23] = {
+ -8.40653699e+01f,
+ -8.40653699e+01f,
+ -8.40653699e+01f,
+ -8.40653699e+01f,
+ -8.40653699e+01f,
+ -8.40653699e+01f,
+ -8.40653699e+01f,
+ -8.40653699e+01f,
+ -8.38067304e+01f,
+ -8.28409495e+01f,
+ -8.17031225e+01f,
+ -7.89799501e+01f,
+ -7.70607916e+01f,
+ -7.58484320e+01f,
+ -7.47976303e+01f,
+ -7.37491303e+01f,
+ -7.13163746e+01f,
+ -6.86144293e+01f,
+ -6.56295695e+01f,
+ -6.06521800e+01f,
+ -3.15408065e+01f,
+ -1.92542188e+01f,
+ -1.88401753e+01f,
+};
+
+static const float c_fiDefaultTheta48[MAX_BANDS_48] = {
+ 0.4375,
+ 0.4375,
+ 0.375,
+ 0.3125,
+ 0.3125,
+ 0.25,
+ 0.25,
+ 0.25,
+ 0.25,
+ 0.25,
+ 0.25,
+ 0.25,
+ 0.25,
+ 0.25,
+ 0.25,
+ 0.25,
+ 0.25,
+ 0.25,
+ 0.25,
+ 0.25,
+ 0.25,
+ 0.25,
+ 0.25,
+};
+
typedef struct GMNODE
{
int32_t iGroupStart;
@@ -69,10 +124,17 @@ struct RMS_ENVELOPE_GROUPING
GMNode *psGMNodes;
};
-RMSEnvelopeGrouping *CreateRMSEnvelopeGrouping( int32_t iNumBlocks )
+
+/*-------------------------------------------------------------------*
+ * Function CreateRMSEnvelopeGrouping()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+RMSEnvelopeGrouping *CreateRMSEnvelopeGrouping(
+ const int32_t iNumBlocks )
{
int32_t n;
- // assert( ( iNumBlocks & 0x1 ) == 0 ); // remove this
RMSEnvelopeGrouping *psRMSEnvelopeGrouping;
@@ -103,7 +165,15 @@ RMSEnvelopeGrouping *CreateRMSEnvelopeGrouping( int32_t iNumBlocks )
return psRMSEnvelopeGrouping;
}
-void DeleteRMSEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping )
+
+/*-------------------------------------------------------------------*
+ * Function DeleteRMSEnvelopeGrouping()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void DeleteRMSEnvelopeGrouping(
+ RMSEnvelopeGrouping *psRMSEnvelopeGrouping )
{
int32_t n;
@@ -125,43 +195,27 @@ void DeleteRMSEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping )
free( psRMSEnvelopeGrouping->psGMNodes );
free( psRMSEnvelopeGrouping );
+
+ return;
}
-const float c_afThreshQuiet48[23] = {
- -8.40653699e+01f,
- -8.40653699e+01f,
- -8.40653699e+01f,
- -8.40653699e+01f,
- -8.40653699e+01f,
- -8.40653699e+01f,
- -8.40653699e+01f,
- -8.40653699e+01f,
- -8.38067304e+01f,
- -8.28409495e+01f,
- -8.17031225e+01f,
- -7.89799501e+01f,
- -7.70607916e+01f,
- -7.58484320e+01f,
- -7.47976303e+01f,
- -7.37491303e+01f,
- -7.13163746e+01f,
- -6.86144293e+01f,
- -6.56295695e+01f,
- -6.06521800e+01f,
- -3.15408065e+01f,
- -1.92542188e+01f,
- -1.88401753e+01f,
-};
-static void ComputeBandEnergy( const int32_t iChannels,
- const int32_t iNumBlocks,
- const int32_t iNumBands,
- const int32_t *piBandwidths,
- float ***pppfReal,
- float ***pppfImag,
- float **ppfBandEnergy,
- float **ppfBandEnergydB,
- float **ppfWeight )
+/*-------------------------------------------------------------------*
+ * Function ComputeBandEnergy()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static void ComputeBandEnergy(
+ const int32_t iChannels,
+ const int32_t iNumBlocks,
+ const int32_t iNumBands,
+ const int32_t *piBandwidths,
+ float ***pppfReal,
+ float ***pppfImag,
+ float **ppfBandEnergy,
+ float **ppfBandEnergydB,
+ float **ppfWeight )
{
int32_t n;
@@ -177,7 +231,6 @@ static void ComputeBandEnergy( const int32_t iChannels,
int32_t iFBOffset;
float fMaxWeight;
-
iFBOffset = 0;
fMaxWeight = 0.0f;
for ( b = 0; b < iNumBands; b++ )
@@ -218,19 +271,29 @@ static void ComputeBandEnergy( const int32_t iChannels,
}
}
}
+
+ return;
}
+
+/*-------------------------------------------------------------------*
+ * Function TryMerge()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
/* THis is temporary cost function */
-static float TryMerge( const int32_t iNumBands,
- const int32_t iStartBlock,
- const int32_t iGroupLength,
- const float fMaxAllowedDiffdB,
- float **ppfBandEnergy,
- float **ppfBandEnergydB,
+static float TryMerge(
+ const int32_t iNumBands,
+ const int32_t iStartBlock,
+ const int32_t iGroupLength,
+ const float fMaxAllowedDiffdB,
+ float **ppfBandEnergy,
+ float **ppfBandEnergydB,
#ifdef APPLY_WEIGHT
- float **ppfWeight,
+ float **ppfWeight,
#endif
- float *pfMegredEnergydB )
+ float *pfMegredEnergydB )
{
int32_t b;
int32_t n;
@@ -313,12 +376,20 @@ static float TryMerge( const int32_t iNumBands,
return fMeanCost;
}
-static void ComputeMergeRMS( const int32_t iNumBands,
- const int32_t iStartBlock,
- const int32_t iGroupLength,
- float **ppfBandEnergy,
- float *pfMergedEnergydB,
- int32_t *piQRMSEnvelope )
+
+/*-------------------------------------------------------------------*
+ * Function ComputeMergeRMS()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static void ComputeMergeRMS(
+ const int32_t iNumBands,
+ const int32_t iStartBlock,
+ const int32_t iGroupLength,
+ float **ppfBandEnergy,
+ float *pfMergedEnergydB,
+ int32_t *piQRMSEnvelope )
{
int32_t b;
float fInvGroupSize = 1.0f / (float) iGroupLength;
@@ -345,12 +416,21 @@ static void ComputeMergeRMS( const int32_t iNumBands,
pfMergedEnergydB[b] = fGroupEnergy;
piQRMSEnvelope[b] = iQRMSEnvelope;
}
+
+ return;
}
-static int32_t ComputeRMSEnvelopeBits( const int32_t iChannels,
- const int32_t iNumBands,
- const int32_t *piQRMSEnevelope )
+/*-------------------------------------------------------------------*
+ * Function ComputeRMSEnvelopeBits()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static int32_t ComputeRMSEnvelopeBits(
+ const int32_t iChannels,
+ const int32_t iNumBands,
+ const int32_t *piQRMSEnevelope )
{
int32_t n;
int32_t iRMSEnvelopeBits = 0;
@@ -375,45 +455,28 @@ static int32_t ComputeRMSEnvelopeBits( const int32_t iChannels,
iLastRMSVal = piQRMSEnevelope[iChanOffset + b];
}
+
iChanOffset += iNumBands;
}
return iRMSEnvelopeBits;
}
-static const float c_fiDefaultTheta48[MAX_BANDS_48] = {
- 0.4375,
- 0.4375,
- 0.375,
- 0.3125,
- 0.3125,
- 0.25,
- 0.25,
- 0.25,
- 0.25,
- 0.25,
- 0.25,
- 0.25,
- 0.25,
- 0.25,
- 0.25,
- 0.25,
- 0.25,
- 0.25,
- 0.25,
- 0.25,
- 0.25,
- 0.25,
- 0.25,
-};
-static float ComputeSNRPenalty( const int32_t iChannels,
- const int32_t iNumBands,
- const int32_t *piBandwidths,
- const int32_t iStartBlock,
- const int32_t iGroupLength,
- float **ppfBandEnergydB,
- const int32_t *piRMSEnvelope )
+/*-------------------------------------------------------------------*
+ * Function ComputeSNRPenalty()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static float ComputeSNRPenalty(
+ const int32_t iChannels,
+ const int32_t iNumBands,
+ const int32_t *piBandwidths,
+ const int32_t iStartBlock,
+ const int32_t iGroupLength,
+ float **ppfBandEnergydB,
+ const int32_t *piRMSEnvelope )
{
int32_t n;
int32_t iChanOffset;
@@ -445,20 +508,28 @@ static float ComputeSNRPenalty( const int32_t iChannels,
}
}
}
+
iChanOffset += iNumBands;
}
-
return fSNRPenalty;
}
-static float TryMegre2( const int32_t iChannels,
- const int32_t iNumBands,
- const int32_t *piBandwidths,
- float **ppfBandEnergy,
- float **ppfBandEnergydB,
- GMNode *psGMNode1,
- GMNode *psGMNode2 )
+
+/*-------------------------------------------------------------------*
+ * Function TryMerge2()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static float TryMerge2(
+ const int32_t iChannels,
+ const int32_t iNumBands,
+ const int32_t *piBandwidths,
+ float **ppfBandEnergy,
+ float **ppfBandEnergydB,
+ GMNode *psGMNode1,
+ GMNode *psGMNode2 )
{
int32_t iRMSEnvBits1;
int32_t iRMSEnvBits2;
@@ -471,24 +542,11 @@ static float TryMegre2( const int32_t iChannels,
/* First compute current RMS Envelope for each group */
if ( psGMNode1->iGroupRMSEnvelopeCost == -1 || psGMNode1->fGroupSNRPenalty == -1.0 )
{
- ComputeMergeRMS( iNumBands * iChannels,
- psGMNode1->iGroupStart,
- psGMNode1->iGroupLength,
- ppfBandEnergy,
- psGMNode1->pfMergedEnergydB,
- psGMNode1->piQRMSEnvelope );
-
- iRMSEnvBits1 = ComputeRMSEnvelopeBits( iChannels,
- iNumBands,
- psGMNode1->piQRMSEnvelope );
-
- fSNRPenalty1 = ComputeSNRPenalty( iChannels,
- iNumBands,
- piBandwidths,
- psGMNode1->iGroupStart,
- psGMNode1->iGroupLength,
- ppfBandEnergydB,
- psGMNode1->piQRMSEnvelope );
+ ComputeMergeRMS( iNumBands * iChannels, psGMNode1->iGroupStart, psGMNode1->iGroupLength, ppfBandEnergy, psGMNode1->pfMergedEnergydB, psGMNode1->piQRMSEnvelope );
+
+ iRMSEnvBits1 = ComputeRMSEnvelopeBits( iChannels, iNumBands, psGMNode1->piQRMSEnvelope );
+
+ fSNRPenalty1 = ComputeSNRPenalty( iChannels, iNumBands, piBandwidths, psGMNode1->iGroupStart, psGMNode1->iGroupLength, ppfBandEnergydB, psGMNode1->piQRMSEnvelope );
psGMNode1->iGroupRMSEnvelopeCost = iRMSEnvBits1;
psGMNode1->fGroupSNRPenalty = fSNRPenalty1;
@@ -501,24 +559,11 @@ static float TryMegre2( const int32_t iChannels,
if ( psGMNode2->iGroupRMSEnvelopeCost == -1 || psGMNode2->fGroupSNRPenalty == -1.0 )
{
- ComputeMergeRMS( iNumBands * iChannels,
- psGMNode2->iGroupStart,
- psGMNode2->iGroupLength,
- ppfBandEnergy,
- psGMNode2->pfMergedEnergydB,
- psGMNode2->piQRMSEnvelope );
-
- iRMSEnvBits2 = ComputeRMSEnvelopeBits( iChannels,
- iNumBands,
- psGMNode2->piQRMSEnvelope );
-
- fSNRPenalty2 = ComputeSNRPenalty( iChannels,
- iNumBands,
- piBandwidths,
- psGMNode2->iGroupStart,
- psGMNode2->iGroupLength,
- ppfBandEnergydB,
- psGMNode2->piQRMSEnvelope );
+ ComputeMergeRMS( iNumBands * iChannels, psGMNode2->iGroupStart, psGMNode2->iGroupLength, ppfBandEnergy, psGMNode2->pfMergedEnergydB, psGMNode2->piQRMSEnvelope );
+
+ iRMSEnvBits2 = ComputeRMSEnvelopeBits( iChannels, iNumBands, psGMNode2->piQRMSEnvelope );
+
+ fSNRPenalty2 = ComputeSNRPenalty( iChannels, iNumBands, piBandwidths, psGMNode2->iGroupStart, psGMNode2->iGroupLength, ppfBandEnergydB, psGMNode2->piQRMSEnvelope );
psGMNode2->iGroupRMSEnvelopeCost = iRMSEnvBits2;
psGMNode2->fGroupSNRPenalty = fSNRPenalty2;
@@ -530,38 +575,32 @@ static float TryMegre2( const int32_t iChannels,
}
/* Compute the merged group */
- ComputeMergeRMS( iNumBands * iChannels,
- psGMNode1->iGroupStart,
- psGMNode1->iGroupLength + psGMNode2->iGroupLength,
- ppfBandEnergy,
- psGMNode1->pfMergedEnergydB,
- psGMNode1->piQRMSEnvelope );
+ ComputeMergeRMS( iNumBands * iChannels, psGMNode1->iGroupStart, psGMNode1->iGroupLength + psGMNode2->iGroupLength, ppfBandEnergy, psGMNode1->pfMergedEnergydB, psGMNode1->piQRMSEnvelope );
/* Compute the RMS Envelope cost for merged group */
- iRMSEnvBitsMerged = ComputeRMSEnvelopeBits( iChannels,
- iNumBands,
- psGMNode1->piQRMSEnvelope );
+ iRMSEnvBitsMerged = ComputeRMSEnvelopeBits( iChannels, iNumBands, psGMNode1->piQRMSEnvelope );
/* Compute an approximation of the bit cost based on SNR increase/decrease due to merging */
- fSNRPenaltyMerged = ComputeSNRPenalty( iChannels,
- iNumBands,
- piBandwidths,
- psGMNode1->iGroupStart,
- psGMNode1->iGroupLength + psGMNode2->iGroupLength,
- ppfBandEnergydB,
- psGMNode1->piQRMSEnvelope );
-
+ fSNRPenaltyMerged = ComputeSNRPenalty( iChannels, iNumBands, piBandwidths, psGMNode1->iGroupStart, psGMNode1->iGroupLength + psGMNode2->iGroupLength, ppfBandEnergydB, psGMNode1->piQRMSEnvelope );
fMergedCost = fSNRPenaltyMerged - fSNRPenalty1 - fSNRPenalty2 + (float) iRMSEnvBitsMerged - (float) iRMSEnvBits1 - (float) iRMSEnvBits2;
return fMergedCost;
}
-static void ComputeGreedyGroups( RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
- const int32_t iChannels,
- const int32_t iNumBands,
- const float fMeanAllowedDiffdB,
- const float fMaxAllowedDiffdB )
+
+/*-------------------------------------------------------------------*
+ * Function ComputeGreedyGroups()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static void ComputeGreedyGroups(
+ RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
+ const int32_t iChannels,
+ const int32_t iNumBands,
+ const float fMeanAllowedDiffdB,
+ const float fMaxAllowedDiffdB )
{
float fBestMeanCost;
@@ -608,12 +647,22 @@ static void ComputeGreedyGroups( RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
psBestGMNode->psNext = psBestGMNode->psNext->psNext;
}
}
+
+ return;
}
-static void ComputeGreedyGroups2( RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
- const int32_t iChannels,
- const int32_t iNumBands,
- const int32_t *piBandwidths )
+
+/*-------------------------------------------------------------------*
+ * Function ComputeGreedyGroups2()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static void ComputeGreedyGroups2(
+ RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
+ const int32_t iChannels,
+ const int32_t iNumBands,
+ const int32_t *piBandwidths )
{
float fBestMergeCost;
// int32_t iDone = 0;
@@ -631,13 +680,7 @@ static void ComputeGreedyGroups2( RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
{
float fMergeCost;
- fMergeCost = TryMegre2( iChannels,
- iNumBands,
- piBandwidths,
- psRMSEnvelopeGrouping->ppfBandEnergy,
- psRMSEnvelopeGrouping->ppfBandEnergydB,
- psGMNode,
- psGMNode->psNext );
+ fMergeCost = TryMerge2( iChannels, iNumBands, piBandwidths, psRMSEnvelopeGrouping->ppfBandEnergy, psRMSEnvelopeGrouping->ppfBandEnergydB, psGMNode, psGMNode->psNext );
if ( fMergeCost < fBestMergeCost )
{
@@ -647,6 +690,7 @@ static void ComputeGreedyGroups2( RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
psGMNode = psGMNode->psNext;
}
+
if ( fBestMergeCost < 0.0 && psBestGMNode != NULL && psBestGMNode->psNext != NULL )
{
psBestGMNode->iGroupLength += psBestGMNode->psNext->iGroupLength;
@@ -655,17 +699,28 @@ static void ComputeGreedyGroups2( RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
psBestGMNode->psNext = psBestGMNode->psNext->psNext;
}
}
+
+ return;
}
-static void ComputeGreedyGroups3( RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
- const int32_t iChannels,
- const int32_t iNumBands,
- const int32_t *piBandwidths,
- const int32_t iMaxGroups )
+
+/*-------------------------------------------------------------------*
+ * Function ComputeGreedyGroups3()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static void ComputeGreedyGroups3(
+ RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
+ const int32_t iChannels,
+ const int32_t iNumBands,
+ const int32_t *piBandwidths,
+ const int32_t iMaxGroups )
{
int32_t iDone = 0;
int32_t iNumGroups = psRMSEnvelopeGrouping->iMaxGroups;
+
while ( iDone == 0 )
{
GMNode *psGMNode;
@@ -679,13 +734,7 @@ static void ComputeGreedyGroups3( RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
{
float fMergeCost;
- fMergeCost = TryMegre2( iChannels,
- iNumBands,
- piBandwidths,
- psRMSEnvelopeGrouping->ppfBandEnergy,
- psRMSEnvelopeGrouping->ppfBandEnergydB,
- psGMNode,
- psGMNode->psNext );
+ fMergeCost = TryMerge2( iChannels, iNumBands, piBandwidths, psRMSEnvelopeGrouping->ppfBandEnergy, psRMSEnvelopeGrouping->ppfBandEnergydB, psGMNode, psGMNode->psNext );
if ( fMergeCost < fBestMergeCost )
{
@@ -695,6 +744,7 @@ static void ComputeGreedyGroups3( RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
psGMNode = psGMNode->psNext;
}
+
if ( fBestMergeCost > 0.0 && iNumGroups <= iMaxGroups )
{
iDone++;
@@ -712,14 +762,24 @@ static void ComputeGreedyGroups3( RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
iDone++; // This only catches a problem
}
}
+
+ return;
}
-static void ComputeRMSEnvelope( const int32_t iChannels,
- const int32_t iNumBands,
- const int32_t iNumGroups,
- const int32_t *piGroupLengths,
- float **ppfBandEnergy,
- int32_t ***pppiRMSEnvelope )
+
+/*-------------------------------------------------------------------*
+ * Function ComputeRMSEnvelope()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static void ComputeRMSEnvelope(
+ const int32_t iChannels,
+ const int32_t iNumBands,
+ const int32_t iNumGroups,
+ const int32_t *piGroupLengths,
+ float **ppfBandEnergy,
+ int32_t ***pppiRMSEnvelope )
{
int32_t n;
@@ -754,12 +814,22 @@ static void ComputeRMSEnvelope( const int32_t iChannels,
}
}
}
+
+ return;
}
-static void LimitRMSEnvelope( const int32_t iBandCount,
- const int32_t iRMSDeltaMax,
- const int32_t iRMSDeltaMin,
- int32_t *piRMSEnvelope )
+
+/*-------------------------------------------------------------------*
+ * Function LimitRMSEnvelope()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static void LimitRMSEnvelope(
+ const int32_t iBandCount,
+ const int32_t iRMSDeltaMax,
+ const int32_t iRMSDeltaMin,
+ int32_t *piRMSEnvelope )
{
int32_t iBand;
int32_t iLastSCF;
@@ -801,31 +871,33 @@ static void LimitRMSEnvelope( const int32_t iBandCount,
iLastSCF = piRMSEnvelope[iBand];
}
+
+ return;
}
-void ComputeEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
- const int32_t iChannels,
- const int32_t iNumBands,
- const int32_t *piBandwidths, // pass in absolute thresh
- float ***pppfReal,
- float ***pppfImag,
- int32_t *piNumGroups,
- int32_t *piGroupLengths,
- int32_t ***pppiRMSEnvelope )
+
+/*-------------------------------------------------------------------*
+ * Function ComputeEnvelopeGrouping()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void ComputeEnvelopeGrouping(
+ RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
+ const int32_t iChannels,
+ const int32_t iNumBands,
+ const int32_t *piBandwidths, // pass in absolute thresh
+ float ***pppfReal,
+ float ***pppfImag,
+ int32_t *piNumGroups,
+ int32_t *piGroupLengths,
+ int32_t ***pppiRMSEnvelope )
{
int32_t n;
GMNode *psGMNode;
/* Compute Band Energies */
- ComputeBandEnergy( iChannels,
- psRMSEnvelopeGrouping->iNumBlocks,
- iNumBands,
- piBandwidths,
- pppfReal,
- pppfImag,
- psRMSEnvelopeGrouping->ppfBandEnergy,
- psRMSEnvelopeGrouping->ppfBandEnergydB,
- psRMSEnvelopeGrouping->ppfWeight );
+ ComputeBandEnergy( iChannels, psRMSEnvelopeGrouping->iNumBlocks, iNumBands, piBandwidths, pppfReal, pppfImag, psRMSEnvelopeGrouping->ppfBandEnergy, psRMSEnvelopeGrouping->ppfBandEnergydB, psRMSEnvelopeGrouping->ppfWeight );
/* Init GMNodes */
psRMSEnvelopeGrouping->psGMNodes[0].iGroupStart = 0;
@@ -846,17 +918,10 @@ void ComputeEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
/* Perform grouping via Greedy Merge */
- /*ComputeGreedyGroups2(psRMSEnvelopeGrouping,
- iChannels,
- iNumBands,
- piBandwidths);*/
- // Allows control over max groups can call using 16 if want same as previous call
- ComputeGreedyGroups3( psRMSEnvelopeGrouping,
- iChannels,
- iNumBands,
- piBandwidths,
- CQMF_BLOCKS_PER_FRAME );
+ /* ComputeGreedyGroups2( psRMSEnvelopeGrouping, iChannels, iNumBands, piBandwidths );*/
+ /* Allows control over max groups can call using 16 if want same as previous call */
+ ComputeGreedyGroups3( psRMSEnvelopeGrouping, iChannels, iNumBands, piBandwidths, LCLD_BLOCKS_PER_FRAME );
/* Calc Groups from Merge Results */
*piNumGroups = 0;
@@ -869,12 +934,7 @@ void ComputeEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
}
/* Compute RMS Envelope given group lengths */
- ComputeRMSEnvelope( iChannels,
- iNumBands,
- *piNumGroups,
- piGroupLengths,
- psRMSEnvelopeGrouping->ppfBandEnergy,
- pppiRMSEnvelope );
+ ComputeRMSEnvelope( iChannels, iNumBands, *piNumGroups, piGroupLengths, psRMSEnvelopeGrouping->ppfBandEnergy, pppiRMSEnvelope );
/* Envelope Tenting */
for ( n = 0; n < iChannels; n++ )
@@ -882,11 +942,10 @@ void ComputeEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
int32_t k;
for ( k = 0; k < *piNumGroups; k++ )
{
- LimitRMSEnvelope( iNumBands,
- ENV_DELTA_MAX,
- ENV_DELTA_MIN,
- pppiRMSEnvelope[n][k] );
+ LimitRMSEnvelope( iNumBands, ENV_DELTA_MAX, ENV_DELTA_MIN, pppiRMSEnvelope[n][k] );
}
}
+
+ return;
}
#endif
diff --git a/lib_rend/ivas_RMSEnvGrouping.h b/lib_rend/ivas_RMSEnvGrouping.h
deleted file mode 100644
index 41b3eb19215072c520d864e78d77b6dc54f82d84..0000000000000000000000000000000000000000
--- a/lib_rend/ivas_RMSEnvGrouping.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-
-#ifndef _IVAS_RMS_ENV_GROUPING_H_
-#define _IVAS_RMS_ENV_GROUPING_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include "options.h"
-
-#ifdef SPLIT_REND_WITH_HEAD_ROT
-#include
- typedef struct RMS_ENVELOPE_GROUPING RMSEnvelopeGrouping;
-
- RMSEnvelopeGrouping *CreateRMSEnvelopeGrouping( int32_t iNumBlocks );
-
- void DeleteRMSEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping );
-
- void ComputeEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
- const int32_t iChannels,
- const int32_t iNumBands,
- const int32_t *piBandwidths,
- float ***pppfReal,
- float ***pppfImag,
- int32_t *piNumGroups,
- int32_t *piGroupLengths,
- int32_t ***pppiRMSEnvelope );
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _RMS_ENV_GROUPING_H_ */
diff --git a/lib_rend/ivas_cldfb_codec_bitstream.c b/lib_rend/ivas_cldfb_codec_bitstream.c
index 7e8950ab2884896b66ec75cae88350550fc086aa..0b8126c7c545c4237f10c173bfee0ad9d8d19b7c 100644
--- a/lib_rend/ivas_cldfb_codec_bitstream.c
+++ b/lib_rend/ivas_cldfb_codec_bitstream.c
@@ -1,6 +1,6 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -29,7 +29,9 @@
the United Nations Convention on Contracts on the International Sales of Goods.
*******************************************************************************************************/
+
#include "ivas_cldfb_codec_bitstream.h"
+#include
#include "options.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
#include
@@ -37,7 +39,10 @@
#include "prot.h"
#include "wmc_auto.h"
-#define MAX_BUFFER 1024
+
+/*------------------------------------------------------------------------------------------*
+ * Local ROM tables
+ *------------------------------------------------------------------------------------------*/
static const uint32_t MASKS[] = {
0x00000000,
@@ -74,124 +79,17 @@ static const uint32_t MASKS[] = {
0x7fffffff,
};
-Bitstream *CreateBitstream( const int32_t iDirection,
- const int32_t iMaxBuffer )
-
-{
-
- int32_t n;
- Bitstream *psBitstream;
-
- psBitstream = (Bitstream *) malloc( sizeof( Bitstream ) );
-
- psBitstream->iDirection = iDirection;
- psBitstream->iMaxBuffer = iMaxBuffer;
- psBitstream->iIndex = 0;
- psBitstream->iBufferEnd = 0;
- psBitstream->iBufferStart = 0;
- psBitstream->iError = BS_ERROR_NONE;
-
- if ( psBitstream->iMaxBuffer == -1 )
- {
- psBitstream->iMaxBuffer = 4096;
- }
-
- psBitstream->puchBuffer = (uint8_t *) malloc( sizeof( uint8_t ) * psBitstream->iMaxBuffer );
-
- for ( n = 0; n < psBitstream->iMaxBuffer; n++ )
- {
- psBitstream->puchBuffer[n] = 0;
- }
-
- return psBitstream;
-}
-
-void DeleteBitstream( Bitstream *psBitstream )
-{
- free( psBitstream->puchBuffer );
- free( psBitstream );
-}
-
-void BSFlushBuffer( Bitstream *psBitstream )
-{
- memset( psBitstream->puchBuffer, 0, psBitstream->iMaxBuffer );
- psBitstream->iIndex = 0;
- psBitstream->iBufferEnd = 0;
- psBitstream->iBufferStart = 0;
- psBitstream->iError = BS_ERROR_NONE;
-}
-
-int32_t BSPutBytes( Bitstream *psBitstream,
- const uint8_t *puchBytes,
- const int32_t iByteCount )
-{
- int32_t n;
- for ( n = 0; n < iByteCount; n++ )
- {
- psBitstream->puchBuffer[psBitstream->iBufferEnd] = puchBytes[n];
- psBitstream->iBufferEnd++;
- }
- if ( psBitstream->iDirection != BS_READ )
- {
- psBitstream->iError = BS_ERROR_FAIL;
- }
-
- return psBitstream->iError;
-}
-
-int32_t BSGetBytes( Bitstream *psBitstream,
- uint8_t *puchBytes,
- int32_t iByteCount )
-{
- int32_t n;
- for ( n = 0; n < iByteCount; n++ )
- {
- puchBytes[n] = psBitstream->puchBuffer[psBitstream->iBufferStart];
- psBitstream->puchBuffer[psBitstream->iBufferStart] = 0;
- psBitstream->iBufferStart++;
- }
- if ( psBitstream->iDirection != BS_WRITE )
- {
- psBitstream->iError = BS_ERROR_FAIL;
- }
-
- return psBitstream->iError;
-}
-
-int32_t BSByteAlign( Bitstream *psBitstream )
-{
- if ( psBitstream->iDirection == BS_WRITE )
- {
- if ( psBitstream->iIndex & 0x7 )
- {
- int32_t iByte;
- int32_t iRem;
- iByte = psBitstream->iIndex >> 3;
- iRem = 8 - ( psBitstream->iIndex - ( iByte << 3 ) );
- psBitstream->puchBuffer[iByte] &= ( 0xff ^ MASKS[iRem] );
- psBitstream->iIndex += iRem;
- }
- }
- else
- {
- if ( psBitstream->iIndex & 0x7 )
- {
- int32_t iByte;
- int32_t iRem;
+/*------------------------------------------------------------------------------------------*
+ * Function BSPutBits()
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
- iByte = psBitstream->iIndex >> 3;
- iRem = 8 - ( psBitstream->iIndex - ( iByte << 3 ) );
- psBitstream->iIndex += iRem;
- }
- }
-
- return psBitstream->iError;
-}
-
-int32_t BSPutBits( Bitstream *psBitstream,
- int32_t iValue,
- int32_t iBitCount )
+int32_t BSPutBits(
+ Bitstream *psBitstream,
+ int32_t iValue,
+ int32_t iBitCount )
{
iValue &= MASKS[iBitCount];
while ( iBitCount )
@@ -201,7 +99,7 @@ int32_t BSPutBits( Bitstream *psBitstream,
int32_t iShift;
iByte = psBitstream->iIndex >> 3;
- iRem = 8 - ( psBitstream->iIndex - ( iByte << 3 ) ); // 8 - psBitstream->iIndex & 0x7;
+ iRem = 8 - ( psBitstream->iIndex - ( iByte << 3 ) ); /* 8 - psBitstream->iIndex & 0x7; */
iShift = iBitCount - iRem;
if ( iShift <= 0 )
@@ -228,8 +126,16 @@ int32_t BSPutBits( Bitstream *psBitstream,
return psBitstream->iError;
}
-int32_t BSGetBits( Bitstream *psBitstream,
- int32_t iBitCount )
+
+/*------------------------------------------------------------------------------------------*
+ * Function BSGetBits()
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
+
+int32_t BSGetBits(
+ Bitstream *psBitstream,
+ int32_t iBitCount )
{
int32_t iValue = 0;
@@ -241,7 +147,7 @@ int32_t BSGetBits( Bitstream *psBitstream,
int32_t iShift;
iByte = psBitstream->iIndex >> 3;
- iRem = 8 - ( psBitstream->iIndex - ( iByte << 3 ) ); // 8 - psBitstream->iIndex & 0x7;
+ iRem = 8 - ( psBitstream->iIndex - ( iByte << 3 ) ); /* 8 - psBitstream->iIndex & 0x7; */
uchByte = psBitstream->puchBuffer[iByte];
iShift = iBitCount - iRem;
@@ -269,39 +175,20 @@ int32_t BSGetBits( Bitstream *psBitstream,
return iValue;
}
+
+/*------------------------------------------------------------------------------------------*
+ * Function BSForceBack()
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
+
int32_t BSForceBack(
ivas_split_rend_bits_t *pBits,
int32_t iValue,
int32_t iBitCount )
{
pBits->bits_read -= iBitCount;
- return ( iValue >> iBitCount );
-}
-int32_t BSGetByteCount( Bitstream *psBitstream )
-{
- int32_t iBytes;
- iBytes = psBitstream->iIndex >> 3;
- if ( ( iBytes << 3 ) != psBitstream->iIndex )
- {
- iBytes++;
- }
-
- return iBytes;
-}
-
-uint8_t *BSGetBuffer( Bitstream *psBitstream )
-{
- return psBitstream->puchBuffer;
-}
-
-int32_t BSGetAvailableBytes( Bitstream *psBitstream )
-{
- return psBitstream->iBufferEnd;
-}
-
-int32_t BSGetError( Bitstream *psBitstream )
-{
- return psBitstream->iError;
+ return ( iValue >> iBitCount );
}
#endif
diff --git a/lib_rend/ivas_cldfb_codec_bitstream.h b/lib_rend/ivas_cldfb_codec_bitstream.h
index a058b901eea432642e843de811317093fbfd77bf..1ca49b1edab7baf37a8c15e6ad7b9eb123d3deff 100644
--- a/lib_rend/ivas_cldfb_codec_bitstream.h
+++ b/lib_rend/ivas_cldfb_codec_bitstream.h
@@ -1,106 +1,82 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby
-International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der
-angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips
-N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge
-Corporation, and other contributors to this repository. All Rights Reserved.
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
+ Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
+ Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+ contributors to this repository. All Rights Reserved.
This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB,
-Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung
-e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph
-and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings
-Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their
-respective contributions in the software. This notice grants no license of any
-kind, including but not limited to patent license, nor is any license granted by
-implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration
-agreement before making contributions.
-
- This software is provided "AS IS", without any express or implied warranties.
-The software is in the development stage. It is intended exclusively for experts
-who have experience with such software and solely for the purpose of inspection.
-All implied warranties of non-infringement, merchantability and fitness for a
-particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing
-this software shall be submitted to and settled by the final, binding
-jurisdiction of the courts of Munich, Germany in accordance with the laws of the
-Federal Republic of Germany excluding its conflict of law rules and the United
-Nations Convention on Contracts on the International Sales of Goods.
+ The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
+ Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
+ Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
+ Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+ contributors to this repository retain full ownership rights in their respective contributions in
+ the software. This notice grants no license of any kind, including but not limited to patent
+ license, nor is any license granted by implication, estoppel or otherwise.
+
+ Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
+ contributions.
+
+ This software is provided "AS IS", without any express or implied warranties. The software is in the
+ development stage. It is intended exclusively for experts who have experience with such software and
+ solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
+ and fitness for a particular purpose are hereby disclaimed and excluded.
+
+ Any dispute, controversy or claim arising under or in relation to providing this software shall be
+ submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
+ accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
+ the United Nations Convention on Contracts on the International Sales of Goods.
*******************************************************************************************************/
#ifndef _IVAS_CLDFB_CODEC_BITSTREAM_H_
#define _IVAS_CLDFB_CODEC_BITSTREAM_H_
-#ifdef __cplusplus
-extern "C"
-{
-#endif
#include "lib_rend.h"
#include "ivas_prot_rend.h"
#include "options.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
- enum
- {
- BS_READ,
- BS_WRITE
- };
- enum
- {
- BS_ERROR_NONE,
- BS_ERROR_FAIL
- };
-
- typedef struct BITSTREAM
- {
- int32_t iMaxBuffer;
- int32_t iDirection;
- int32_t iBufferEnd;
- int32_t iBufferStart;
- int32_t iIndex;
- int32_t iError;
- uint8_t *puchBuffer;
- } Bitstream;
-
- Bitstream *CreateBitstream( const int32_t iDirection, const int32_t iMaxBuffer );
-
- void DeleteBitstream( Bitstream *psBitstream );
-
- void BSFlushBuffer( Bitstream *psBitstream );
-
- int32_t BSPutBytes( Bitstream *psBitstream, const uint8_t *puchBytes, const int32_t iByteCount );
-
- int32_t BSGetBytes( Bitstream *psBitstream, uint8_t *puchBytes, int32_t iByteCount );
-
- int32_t BSByteAlign( Bitstream *psBitstream );
+// ToDo: file can be removed if SIMPLE_PHASE is removed
- int32_t BSPutBits( Bitstream *psBitstream, int32_t iValue, int32_t iBitCount );
-
- int32_t BSGetBits( Bitstream *psBitstream, int32_t iBitCount );
-
- int32_t BSForceBack(
- ivas_split_rend_bits_t *pBits,
- int32_t iValue,
- int32_t iBitCount );
-
- uint8_t *BSGetBuffer( Bitstream *psBitstream );
+enum
+{
+ BS_READ,
+ BS_WRITE
+};
- int32_t BSGetByteCount( Bitstream *psBitstream );
+enum
+{
+ BS_ERROR_NONE,
+ BS_ERROR_FAIL
+};
- int32_t BSGetAvailableBytes( Bitstream *psBitstream );
- int32_t BSGetError( Bitstream *psBitstream );
-#endif
+typedef struct BITSTREAM
+{
+ int32_t iMaxBuffer;
+ int32_t iDirection;
+ int32_t iBufferEnd;
+ int32_t iBufferStart;
+ int32_t iIndex;
+ int32_t iError;
+ uint8_t *puchBuffer;
+} Bitstream;
+
+int32_t BSPutBits(
+ Bitstream *psBitstream,
+ int32_t iValue,
+ int32_t iBitCount );
+
+int32_t BSGetBits(
+ Bitstream *psBitstream,
+ int32_t iBitCount );
+
+int32_t BSForceBack(
+ ivas_split_rend_bits_t *pBits,
+ int32_t iValue,
+ int32_t iBitCount );
-#ifdef __cplusplus
-}
#endif
-
#endif /* _BITSTREAM_H_ */
diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c
index 64b2c9931db2f469cefc04a062e5d06ba6f9fa09..1427ce69e84bcda8d22499f7ef3c938d342d8ff9 100644
--- a/lib_rend/ivas_crend.c
+++ b/lib_rend/ivas_crend.c
@@ -1158,9 +1158,11 @@ ivas_error ivas_rend_initCrendWrapper(
( *pCrend )->hCrend = hCrend;
#endif
}
+
return IVAS_ERR_OK;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
/*-------------------------------------------------------------------------
* ivas_rend_openMultiBinCrend()
@@ -1177,18 +1179,21 @@ ivas_error ivas_rend_openMultiBinCrend(
{
ivas_error error;
-
- error = ivas_rend_openCrend( pCrend, inConfig, outConfig, NULL /*hRendCfg*/, NULL, output_Fs
+ if ( ( error = ivas_rend_openCrend( pCrend, inConfig, outConfig, NULL /*hRendCfg*/, NULL, output_Fs
#ifdef SPLIT_REND_WITH_HEAD_ROT
- ,
- pMultiBinPoseData->num_poses
+ ,
+ pMultiBinPoseData->num_poses
#endif
- );
+ ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
return error;
}
#endif
+
/*-------------------------------------------------------------------------
* ivas_rend_openCrend()
*
@@ -1358,6 +1363,7 @@ ivas_error ivas_rend_openCrend(
( *pCrend )->binaural_latency_ns = (int32_t) ( ( *pCrend )->hHrtfCrend->latency_s * 1000000000.f );
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
( *pCrend )->hCrend[pos_idx] = hCrend;
#else
@@ -1388,6 +1394,7 @@ void ivas_rend_closeCrend(
int16_t pos_idx;
#endif
CREND_HANDLE hCrend;
+
if ( pCrend == NULL || *pCrend == NULL )
{
return;
@@ -1485,6 +1492,7 @@ void ivas_rend_closeCrend(
#endif
}
}
+
free( *pCrend );
*pCrend = NULL;
@@ -1492,6 +1500,30 @@ void ivas_rend_closeCrend(
}
+#ifdef SPLIT_REND_WITH_HEAD_ROT
+/*-------------------------------------------------------------------------
+ * ivas_rend_openCldfbRend()
+ *
+ * Close CLDFB based fastconv binaural renderer memories
+ *------------------------------------------------------------------------*/
+
+void ivas_rend_closeCldfbRend(
+ CLDFB_REND_WRAPPER *pCldfbRend )
+{
+ if ( pCldfbRend->hCldfbRend->hInputSetup != NULL )
+ {
+ free( pCldfbRend->hCldfbRend->hInputSetup );
+ pCldfbRend->hCldfbRend->hInputSetup = NULL;
+ }
+
+ ivas_binRenderer_close( &pCldfbRend->hCldfbRend );
+
+ ivas_HRTF_fastconv_binary_close( &pCldfbRend->hHrtfFastConv );
+
+ return;
+}
+#endif
+
/*-----------------------------------------------------------------------------------------*
* Function ivas_rend_crendConvolver()
*
@@ -1943,6 +1975,7 @@ ivas_error ivas_rend_crendProcessSubframe(
{
return error;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( pCrend->hCrend[0]->hReverb != NULL )
{
@@ -1960,6 +1993,7 @@ ivas_error ivas_rend_crendProcessSubframe(
}
}
#endif
+
for ( ch = 0; ch < nchan_in; ch++ )
{
tc_local[ch] += subframe_len;
@@ -2054,9 +2088,7 @@ ivas_error ivas_rend_crendProcessSplitBin(
if ( hIntSetup->num_lfe > 0 && hIntSetup->index_lfe[0] != -1 )
{
mvr2r( output[hIntSetup->index_lfe[0]], tmpLfeBuffer, output_frame );
- gain_lfe = ( ( pCrend != NULL ) && ( pCrend->hHrtfCrend != NULL ) )
- ? pCrend->hHrtfCrend->gain_lfe
- : GAIN_LFE;
+ gain_lfe = ( ( pCrend != NULL ) && ( pCrend->hHrtfCrend != NULL ) ) ? pCrend->hHrtfCrend->gain_lfe : GAIN_LFE;
v_multc( tmpLfeBuffer, gain_lfe, tmpLfeBuffer, output_frame );
}
else
@@ -2088,19 +2120,11 @@ ivas_error ivas_rend_crendProcessSplitBin(
{
mvr2r( hCombinedOrientationData->Rmat_prev[pos_idx][i], pCombinedOrientationDataLocal->Rmat_prev[0][i], 3 );
}
- if ( ( error = ivas_rend_crendProcess( pCrend,
- inConfig,
- outConfig,
- hDecoderConfig,
- pCombinedOrientationDataLocal,
- hIntSetup,
- hEFAPdata,
- p_tmpInputBuffer,
- output_Fs,
- pos_idx ) ) != IVAS_ERR_OK )
+ if ( ( error = ivas_rend_crendProcess( pCrend, inConfig, outConfig, hDecoderConfig, pCombinedOrientationDataLocal, hIntSetup, hEFAPdata, p_tmpInputBuffer, output_Fs, pos_idx ) ) != IVAS_ERR_OK )
{
return error;
}
+
for ( i = 0; i < 3; i++ )
{
mvr2r( pCombinedOrientationDataLocal->Rmat_prev[0][i], hCombinedOrientationData->Rmat_prev[pos_idx][i], 3 );
@@ -2128,7 +2152,6 @@ ivas_error ivas_rend_crendProcessSplitBin(
}
}
-
/* copy split binaural rendered signals to final output */
for ( i = 0; i < BINAURAL_CHANNELS * pMultiBinPoseData->num_poses; ++i )
{
diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c
index 5b2001e64bc8ef7017f345d2983cc48cf1873fcb..cf1cde9860489a8b4f048d3065463261396de9ba 100644
--- a/lib_rend/ivas_dirac_dec_binaural_functions.c
+++ b/lib_rend/ivas_dirac_dec_binaural_functions.c
@@ -170,7 +170,7 @@ ivas_error ivas_dirac_dec_init_binaural_data(
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
int16_t pos_idx;
- for ( pos_idx = 0; pos_idx < st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses; pos_idx++ )
+ for ( pos_idx = 0; pos_idx < st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses; pos_idx++ )
{
hDiracDecBin = st_ivas->hDiracDecBin[pos_idx];
#else
@@ -1005,6 +1005,7 @@ static void ivas_dirac_dec_binaural_internal(
{
nchanSeparateChannels = (uint8_t) st_ivas->nchan_ism;
}
+
ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat, subframe,
hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0,
nchanSeparateChannels, st_ivas->hMasaIsmData );
@@ -1014,10 +1015,10 @@ static void ivas_dirac_dec_binaural_internal(
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
- pMultiBinPoseData = &st_ivas->splitBinRend.splitrend.multiBinPoseData;
+ pMultiBinPoseData = &st_ivas->hSplitBinRend.splitrend.multiBinPoseData;
+
#ifdef FIX_658_SPLIT_REND_MASA
- if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ||
- st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
#else
if ( pMultiBinPoseData != NULL && pMultiBinPoseData->num_poses > 1 )
#endif
@@ -1025,12 +1026,13 @@ static void ivas_dirac_dec_binaural_internal(
ivas_dirac_dec_binaural_process_output( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in,
max_band_decorr, numInChannels, config_data.processReverb, subframe, tmp_Cldfb_out_re, tmp_Cldfb_out_im,
reverbRe, reverbIm, decorrRe, decorrIm, 1 );
+
for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
{
for ( i = 0; i < CLDFB_SLOTS_PER_SUBFRAME; i++ )
{
- mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX );
- mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX );
+ mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX );
+ mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX );
}
}
}
@@ -1043,6 +1045,7 @@ static void ivas_dirac_dec_binaural_internal(
#else
ivas_dirac_dec_binaural_process_output( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, config_data.processReverb, subframe );
#endif
+
hDiracDecBin->hDiffuseDist = NULL;
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
@@ -1091,7 +1094,6 @@ static void ivas_dirac_dec_binaural_internal(
hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0,
subFrameTotalEne, IIReneLimiter, st_ivas->hMasaIsmData );
-
ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat_local, subframe,
hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0, nchanSeparateChannels, st_ivas->hMasaIsmData );
@@ -1109,16 +1111,15 @@ static void ivas_dirac_dec_binaural_internal(
/* re-use reverb and decorr from main direction for the sides */
ivas_dirac_dec_binaural_process_output( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in,
max_band_decorr, numInChannels, config_data.processReverb, subframe, tmp_Cldfb_out_re, tmp_Cldfb_out_im,
- reverbRe, reverbIm,
- decorrRe, decorrIm, 0 );
+ reverbRe, reverbIm, decorrRe, decorrIm, 0 );
/* copy from temporary buffer to the main split rendering buffer */
for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
{
for ( i = 0; i < CLDFB_SLOTS_PER_SUBFRAME; i++ )
{
- mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX );
- mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX );
+ mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX );
+ mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX );
}
}
@@ -1129,7 +1130,6 @@ static void ivas_dirac_dec_binaural_internal(
/* update this counter only after the last rendering of split directions */
#endif
-
hSpatParamRendCom->slots_rendered += hSpatParamRendCom->subframe_nbslots[subframe];
hSpatParamRendCom->subframes_rendered++;
@@ -1191,6 +1191,7 @@ static void ivas_dirac_dec_decorrelate_slot(
return;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
static void ivas_dirac_dec_binaural_formulate_input_covariance_matrices(
DIRAC_DEC_BIN_HANDLE hDiracDecBin,
diff --git a/lib_rend/ivas_lc3plus_common.c b/lib_rend/ivas_lc3plus_common.c
index 9f175feaf31872bf1e8d326572ec5156c163f62b..db33f9861fec97e629bf2e8453cb0aefb97f6426 100644
--- a/lib_rend/ivas_lc3plus_common.c
+++ b/lib_rend/ivas_lc3plus_common.c
@@ -36,7 +36,14 @@
#include "lc3.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
-ivas_error IVAS_LC3PLUS_LC3plusErrToIvasErr( const LC3PLUS_Error lc3PlusError )
+/*-----------------------------------------------------------------------------------------*
+ * Function IVAS_LC3PLUS_LC3plusErrToIvasErr()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
+ivas_error IVAS_LC3PLUS_LC3plusErrToIvasErr(
+ const LC3PLUS_Error lc3PlusError )
{
switch ( lc3PlusError )
{
@@ -47,6 +54,7 @@ ivas_error IVAS_LC3PLUS_LC3plusErrToIvasErr( const LC3PLUS_Error lc3PlusError )
default:
break;
}
+
return IVAS_ERR_INTERNAL;
}
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
+#endif
diff --git a/lib_rend/ivas_lc3plus_dec.c b/lib_rend/ivas_lc3plus_dec.c
index 628e8767110ae55f8b04fdcd2cfef1ec276f9787..78372c4fbbe1ffd69ba76dc820c3dddb6cb07762 100644
--- a/lib_rend/ivas_lc3plus_dec.c
+++ b/lib_rend/ivas_lc3plus_dec.c
@@ -30,6 +30,8 @@
*******************************************************************************************************/
+#include
+#include "options.h"
#include "prot.h"
#include "ivas_prot.h"
#include "ivas_lc3plus_dec.h"
@@ -38,12 +40,19 @@
#include "ivas_error_utils.h"
#include "wmc_auto.h"
+
+/*-------------------------------------------------------------------------
+ * IVAS_LC3PLUS_DEC_Open()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
ivas_error IVAS_LC3PLUS_DEC_Open(
- const LC3PLUS_CONFIG config, /* i: decoder configuration */
+ const LC3PLUS_CONFIG config, /* i : LC3plus decoder configuration */
#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
- const int16_t enableCaching, /* i: if set to 0, the decoder will NOT use cached frame to flush algorithmic delay after skipped frames */
+ const int16_t enableCaching, /* i : if set to 0, the decoder will NOT use cached frame to flush algorithmic delay after skipped frames */
#endif
- IVAS_LC3PLUS_DEC_HANDLE *handle /* o: decoder handle */
+ IVAS_LC3PLUS_DEC_HANDLE *handle /* o : decoder handle */
)
{
LC3PLUS_Error err;
@@ -52,11 +61,11 @@ ivas_error IVAS_LC3PLUS_DEC_Open(
int16_t numLC3plusFramesPerIvasFrame;
int16_t i;
- *handle = malloc( sizeof( struct IVAS_LC3PLUS_DEC_HANDLE ) );
- if ( NULL == handle )
+ if ( ( *handle = malloc( sizeof( struct IVAS_LC3PLUS_DEC_HANDLE ) ) ) == NULL )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus wrapper handle\n" );
}
+
if ( 0 == config.lc3plus_frame_duration_us )
{
return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Invalid lc3plus_frame_duration_us (0)\n" );
@@ -79,13 +88,19 @@ ivas_error IVAS_LC3PLUS_DEC_Open(
( *handle )->handles = NULL;
( *handle )->selective_decoding_states = NULL;
( *handle )->bitstream_caches = NULL;
- ( *handle )->handles = malloc( config.channels * sizeof( IVAS_LC3PLUS_DEC_HANDLE ) );
- ( *handle )->selective_decoding_states = malloc( config.channels * sizeof( IVAS_LC3PLUS_DEC_SELECTIVE_DECODING_STATE * ) );
- if ( NULL == ( *handle )->handles || NULL == ( *handle )->selective_decoding_states )
+
+ if ( ( ( *handle )->handles = malloc( config.channels * sizeof( IVAS_LC3PLUS_DEC_HANDLE ) ) ) == NULL )
+ {
+ IVAS_LC3PLUS_DEC_Close( handle );
+ return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus wrapper handle\n" );
+ }
+
+ if ( ( ( *handle )->selective_decoding_states = malloc( config.channels * sizeof( IVAS_LC3PLUS_DEC_SELECTIVE_DECODING_STATE * ) ) ) == NULL )
{
IVAS_LC3PLUS_DEC_Close( handle );
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus wrapper handle\n" );
}
+
for ( i = 0; i < config.channels; ++i )
{
( *handle )->handles[i] = NULL;
@@ -96,8 +111,7 @@ ivas_error IVAS_LC3PLUS_DEC_Open(
if ( enableCaching )
{
#endif
- ( *handle )->bitstream_caches = malloc( config.channels * sizeof( IVAS_LC3PLUS_DEC_BITSTREAM_CACHE * ) );
- if ( NULL == ( *handle )->bitstream_caches )
+ if ( ( ( *handle )->bitstream_caches = malloc( config.channels * sizeof( IVAS_LC3PLUS_DEC_BITSTREAM_CACHE * ) ) ) == NULL )
{
IVAS_LC3PLUS_DEC_Close( handle );
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus wrapper handle\n" );
@@ -109,6 +123,7 @@ ivas_error IVAS_LC3PLUS_DEC_Open(
#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
}
#endif
+
( *handle )->num_decs = config.channels;
for ( int32_t iCh = 0; iCh < config.channels; iCh++ )
{
@@ -125,8 +140,7 @@ ivas_error IVAS_LC3PLUS_DEC_Open(
return IVAS_ERROR( IVAS_ERR_INTERNAL, "lc3plus_dec_get_size failed\n" );
}
- ( *handle )->handles[iCh] = malloc( decoder_size );
- if ( NULL == ( *handle )->handles[iCh] )
+ if ( ( ( *handle )->handles[iCh] = malloc( decoder_size ) ) == NULL )
{
IVAS_LC3PLUS_DEC_Close( handle );
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder\n" );
@@ -147,38 +161,37 @@ ivas_error IVAS_LC3PLUS_DEC_Open(
}
/* allocate and configure per LC3plus decoder skip state */
- ( *handle )->selective_decoding_states[iCh] = malloc( sizeof( IVAS_LC3PLUS_DEC_SELECTIVE_DECODING_STATE ) );
- if ( NULL == ( *handle )->selective_decoding_states[iCh] )
+ if ( ( ( *handle )->selective_decoding_states[iCh] = malloc( sizeof( IVAS_LC3PLUS_DEC_SELECTIVE_DECODING_STATE ) ) ) == NULL )
{
IVAS_LC3PLUS_DEC_Close( handle );
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder\n" );
}
- ( *handle )->selective_decoding_states[iCh]->frame_actions = malloc( numLC3plusFramesPerIvasFrame * sizeof( SelectiveDecAction ) );
- if ( NULL == ( *handle )->selective_decoding_states[iCh]->frame_actions )
+
+ if ( ( ( *handle )->selective_decoding_states[iCh]->frame_actions = malloc( numLC3plusFramesPerIvasFrame * sizeof( SelectiveDecAction ) ) ) == NULL )
{
IVAS_LC3PLUS_DEC_Close( handle );
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder\n" );
}
+
( *handle )->selective_decoding_states[iCh]->has_skipped_a_frame = 0;
( *handle )->selective_decoding_states[iCh]->shall_decode_cached_frame = 0;
for ( lc3plusFrameIdx = 0; lc3plusFrameIdx < numLC3plusFramesPerIvasFrame; lc3plusFrameIdx++ )
{
( *handle )->selective_decoding_states[iCh]->frame_actions[lc3plusFrameIdx] = DEC_ACTION_DECODE_AND_USE;
}
+
#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
if ( enableCaching )
{
#endif
/* allocate and configure per LC3plus decoder bitstream cache */
- ( *handle )->bitstream_caches[iCh] = malloc( sizeof( IVAS_LC3PLUS_DEC_BITSTREAM_CACHE ) );
- if ( NULL == ( *handle )->bitstream_caches[iCh] )
+ if ( ( ( *handle )->bitstream_caches[iCh] = malloc( sizeof( IVAS_LC3PLUS_DEC_BITSTREAM_CACHE ) ) ) == NULL )
{
IVAS_LC3PLUS_DEC_Close( handle );
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder\n" );
}
( *handle )->bitstream_caches[iCh]->bitstream_cache_capacity = 400 /*LC3plus max non-HR octet count*/ * numLC3plusFramesPerIvasFrame;
- ( *handle )->bitstream_caches[iCh]->bitstream_cache = malloc( ( *handle )->bitstream_caches[iCh]->bitstream_cache_capacity );
- if ( NULL == ( *handle )->bitstream_caches[iCh]->bitstream_cache )
+ if ( ( ( *handle )->bitstream_caches[iCh]->bitstream_cache = malloc( ( *handle )->bitstream_caches[iCh]->bitstream_cache_capacity ) ) == NULL )
{
IVAS_LC3PLUS_DEC_Close( handle );
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder\n" );
@@ -188,55 +201,87 @@ ivas_error IVAS_LC3PLUS_DEC_Open(
}
#endif
}
+
( *handle )->config = config;
if ( config.ivas_frame_duration_us < config.lc3plus_frame_duration_us || config.ivas_frame_duration_us % config.lc3plus_frame_duration_us != 0 )
{
IVAS_LC3PLUS_DEC_Close( handle );
return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "Current pcm_conversion_buffer sizing requires that lc3plus uses a shorter or equal frame duration than ivas\n" );
}
- ( *handle )->pcm_conversion_buffer = malloc( sizeof( int16_t ) * config.samplerate * config.lc3plus_frame_duration_us / 1000000 );
- if ( NULL == ( *handle )->pcm_conversion_buffer )
+
+ if ( ( ( *handle )->pcm_conversion_buffer = malloc( sizeof( int16_t ) * config.samplerate * config.lc3plus_frame_duration_us / 1000000 ) ) == NULL )
{
IVAS_LC3PLUS_DEC_Close( handle );
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder wrapper pcm_conversion_buffer\n" );
}
+
return IVAS_ERR_OK;
}
-ivas_error IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( int16_t ***subframeChannelMatrix, const uint32_t num_decs )
+
+/*-------------------------------------------------------------------------
+ * IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+ivas_error IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix(
+ int16_t ***subframeChannelMatrix,
+ const uint32_t num_decs )
{
- *subframeChannelMatrix = malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( int16_t * ) );
- if ( NULL == *subframeChannelMatrix )
+ int16_t i;
+
+ if ( ( *subframeChannelMatrix = malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( int16_t * ) ) ) == NULL )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "subframeChannelMatrix allocation failed\n" );
}
- for ( int i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
+
+ for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
{
( *subframeChannelMatrix )[i] = NULL;
}
- for ( int i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
+
+ for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
{
- ( *subframeChannelMatrix )[i] = malloc( num_decs * sizeof( int16_t ) );
- if ( NULL == ( *subframeChannelMatrix )[i] )
+ if ( ( ( *subframeChannelMatrix )[i] = malloc( num_decs * sizeof( int16_t ) ) ) == NULL )
{
IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix( *subframeChannelMatrix );
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "subframeChannelMatrix allocation failed\n" );
}
}
+
return IVAS_ERR_OK;
}
-void IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix( int16_t **subframeChannelMatrix )
+
+/*-------------------------------------------------------------------------
+ * IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+void IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix(
+ int16_t **subframeChannelMatrix )
{
- for ( int i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
+ for ( int16_t i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
{
free( subframeChannelMatrix[i] );
}
+
free( subframeChannelMatrix );
+
+ return;
}
+
+/*-------------------------------------------------------------------------
+ * IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
ivas_error IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix(
- IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder handle */
+ IVAS_LC3PLUS_DEC_HANDLE handle, /* i : LC3plus decoder handle */
int16_t *subframeChannelMatrix[MAX_PARAM_SPATIAL_SUBFRAMES] )
{
int16_t numIvasSubFramesPerLC3frame;
@@ -244,14 +289,17 @@ ivas_error IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix(
int16_t ivasSubframeIdx;
int16_t effectiveIvasSubframeDuration;
int16_t actual_num_spatial_subframes;
+
if ( NULL == handle )
{
return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "IVAS_LC3PLUS_DEC_HANDLE is NULL\n" );
}
+
if ( NULL == subframeChannelMatrix )
{
return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "subframeChannelMatrix is NULL\n" );
}
+
if ( handle->config.lc3plus_frame_duration_us == 0 || handle->config.ivas_frame_duration_us % handle->config.lc3plus_frame_duration_us != 0 )
{
return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "invalid ivas_frame_duration_us/lc3plus_frame_duration_us values\n" );
@@ -260,13 +308,12 @@ ivas_error IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix(
effectiveIvasSubframeDuration = (int16_t) ( handle->config.ivas_frame_duration_us == 20000 ? handle->config.ivas_frame_duration_us / MAX_PARAM_SPATIAL_SUBFRAMES : handle->config.ivas_frame_duration_us );
numIvasSubFramesPerLC3frame = (int16_t) handle->config.lc3plus_frame_duration_us / effectiveIvasSubframeDuration;
actual_num_spatial_subframes = (int16_t) handle->config.ivas_frame_duration_us / effectiveIvasSubframeDuration;
- // 0.5(0) = 10ms lc3plus, 5ms subframe
+ /* 0.5(0) = 10ms lc3plus, 5ms subframe */
if ( numIvasSubFramesPerLC3frame != 1 )
{
return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "Selective decoding is only implemented for aligned IVAS-Subframes & LC3plus \n" );
}
-
/* map subframeChannelMatrix to lc3plus skip states */
/* 1st pass: Flag the required frames */
for ( decIdx = 0; decIdx < handle->num_decs; decIdx++ )
@@ -298,6 +345,7 @@ ivas_error IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix(
}
}
}
+
#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
if ( handle->cachingEnabled )
{
@@ -345,12 +393,20 @@ ivas_error IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix(
#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
}
#endif
+
return IVAS_ERR_OK;
}
+
+/*-------------------------------------------------------------------------
+ * IVAS_LC3PLUS_DEC_GetDelay()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
ivas_error IVAS_LC3PLUS_DEC_GetDelay(
- IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder handle */
- int32_t *delayInSamples /* o: decoder delay in number of samples per channel */
+ IVAS_LC3PLUS_DEC_HANDLE handle, /* i : LC3plus decoder handle */
+ int32_t *delayInSamples /* o : decoder delay in number of samples per channel */
)
{
int32_t tmpDelayInSamples;
@@ -378,13 +434,22 @@ ivas_error IVAS_LC3PLUS_DEC_GetDelay(
{
return IVAS_ERROR( IVAS_ERR_INTERNAL, "Not all mono LC3plus decoders are configured identically\n" );
}
+
*delayInSamples = tmpDelayInSamples;
}
+
return IVAS_ERR_OK;
}
+
+/*-------------------------------------------------------------------------
+ * IVAS_LC3PLUS_DEC_Close()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
void IVAS_LC3PLUS_DEC_Close(
- IVAS_LC3PLUS_DEC_HANDLE *handle /* i/o: Pointer to decoder handle */
+ IVAS_LC3PLUS_DEC_HANDLE *handle /* i/o: Pointer to LC3plus decoder handle */
)
{
if ( NULL == handle || NULL == *handle )
@@ -414,20 +479,32 @@ void IVAS_LC3PLUS_DEC_Close(
free( ( *handle )->bitstream_caches[iDec] );
}
}
+
if ( NULL != ( *handle )->pcm_conversion_buffer )
{
free( ( *handle )->pcm_conversion_buffer );
}
free( ( *handle )->handles );
+
if ( NULL != ( *handle )->bitstream_caches )
{
free( ( *handle )->bitstream_caches );
}
free( ( *handle )->selective_decoding_states );
+
free( *handle );
*handle = NULL;
+
+ return;
}
+
+/*-------------------------------------------------------------------------
+ * decode_or_conceal_one_lc3plus_frame()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
static ivas_error decode_or_conceal_one_lc3plus_frame(
LC3PLUS_Dec *dec,
uint8_t *bitstream_in,
@@ -436,27 +513,38 @@ static ivas_error decode_or_conceal_one_lc3plus_frame(
const int32_t badFrameIndicator )
{
LC3PLUS_Error err;
+
push_wmops( "lc3plus_dec16" );
err = lc3plus_dec16( dec, bitstream_in, bitstream_in_length, pcm_out_buffer, NULL, badFrameIndicator );
pop_wmops();
+
if ( err == LC3PLUS_DECODE_ERROR && 1 == badFrameIndicator )
{
/* LC3PLUS_DECODE_ERROR && badFrameIndicator means that the decoder has successfully concealed, which is actually OK. */
err = LC3PLUS_OK;
}
+
if ( err != LC3PLUS_OK )
{
return IVAS_ERROR( IVAS_LC3PLUS_LC3plusErrToIvasErr( err ), "lc3plus_dec16 failed\n" );
}
+
return IVAS_ERR_OK;
}
+
+/*-------------------------------------------------------------------------
+ * IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
static ivas_error IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal(
- IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder configuration */
- uint8_t *bitstream_in, /* i: pointer to input bitstream */
- int32_t bitstream_in_size, /* i: size of bitstream_in */
- const int32_t badFrameIndicator, /* i: bad frame indicator. If set to 1, triggers concealment */
- float **pcm_out /* o: decoded samples */
+ IVAS_LC3PLUS_DEC_HANDLE handle, /* i : LC3plus decoder configuration */
+ uint8_t *bitstream_in, /* i : pointer to input bitstream */
+ int32_t bitstream_in_size, /* i : size of bitstream_in */
+ const int16_t badFrameIndicator, /* i : bad frame indicator. If set to 1, triggers concealment */
+ float **pcm_out /* o : decoded samples */
)
{
uint32_t iDec;
@@ -493,6 +581,7 @@ static ivas_error IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal(
{
return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "ivas_frame_duration_us must be equal or multiple of lc3plus_frame_duration_us \n" );
}
+
lc3framesPerIvasFrame = handle->config.ivas_frame_duration_us / handle->config.lc3plus_frame_duration_us;
numSamplesPerLC3plusChannel = (int16_t) ( handle->config.samplerate / ( 1000000 / handle->config.ivas_frame_duration_us ) / lc3framesPerIvasFrame );
@@ -507,12 +596,8 @@ static ivas_error IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal(
{
return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "LC3plus cache is empty\n" );
}
- err = decode_or_conceal_one_lc3plus_frame(
- handle->handles[iDec],
- handle->bitstream_caches[iDec]->bitstream_cache,
- handle->bitstream_caches[iDec]->bitstream_cache_size,
- &handle->pcm_conversion_buffer,
- badFrameIndicator );
+
+ err = decode_or_conceal_one_lc3plus_frame( handle->handles[iDec], handle->bitstream_caches[iDec]->bitstream_cache, handle->bitstream_caches[iDec]->bitstream_cache_size, &handle->pcm_conversion_buffer, badFrameIndicator );
if ( err != IVAS_ERR_OK )
{
return IVAS_ERROR( err, "lc3plus decoding failed\n" );
@@ -523,6 +608,7 @@ static ivas_error IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal(
handle->stats.num_cached_frames_decoded_and_dropped++;
#endif
}
+
/* reset cache if caching is enabled - it has either been decoded or is not needed */
if ( NULL != handle->bitstream_caches )
{
@@ -582,25 +668,35 @@ static ivas_error IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal(
default:
return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "invalid LC3plus decoder state\n" );
}
+
bitstream_in_iter += bitstreamOffsetPerCoder;
}
+
/* reset skipping state, must be set by the user before each decode call*/
for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ )
{
handle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] = DEC_ACTION_DECODE_AND_USE;
}
}
+
return IVAS_ERR_OK;
}
+
+/*-------------------------------------------------------------------------
+ * IVAS_LC3PLUS_DEC_Decode()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
ivas_error IVAS_LC3PLUS_DEC_Decode(
- IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder configuration */
- uint8_t *bitstream_in, /* i: pointer to input bitstream */
- int32_t bitstream_in_size, /* i: size of bitstream_in */
- float **pcm_out /* o: decoded samples */
+ IVAS_LC3PLUS_DEC_HANDLE handle, /* i : LC3plus decoder configuration */
+ uint8_t *bitstream_in, /* i : pointer to input bitstream */
+ const int32_t bitstream_in_size, /* i : size of bitstream_in */
+ float **pcm_out /* o : decoded samples */
)
{
- int32_t badFrameIndicator;
+ int16_t badFrameIndicator;
if ( NULL == handle )
{
@@ -615,27 +711,38 @@ ivas_error IVAS_LC3PLUS_DEC_Decode(
return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "pcm_out is NULL\n" );
}
badFrameIndicator = 0;
+
return IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal( handle, bitstream_in, bitstream_in_size, badFrameIndicator, pcm_out );
}
+
+/*-------------------------------------------------------------------------
+ * IVAS_LC3PLUS_DEC_Conceal()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
ivas_error IVAS_LC3PLUS_DEC_Conceal(
- IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder handle */
- float **pcm_out /* o: concealed samples */
+ IVAS_LC3PLUS_DEC_HANDLE handle, /* i : LC3plus decoder handle */
+ float **pcm_out /* o : concealed samples */
)
{
uint8_t bitstream_in[LC3PLUS_MAX_BYTES];
- int32_t badFrameIndicator;
+ int16_t badFrameIndicator;
if ( NULL == handle )
{
return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "LC3PLUS_Dec_Wrap_Handle is NULL\n" );
}
+
if ( NULL == pcm_out )
{
return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "pcm_out is NULL\n" );
}
+
/* LC3plus API requires a non-NULL bitstream pointer, even when triggering concealment */
badFrameIndicator = 1;
+
return IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal( handle, bitstream_in, 0, badFrameIndicator, pcm_out );
}
@@ -669,5 +776,7 @@ void printLC3plusDecStats( const IVAS_LC3PLUS_DEC_COLLECT_STATS *stats )
printf( " perc of req : %f\n", 100.f * (float) sum_decoded_and_dropped_frames / sum_pushed_frames );
printf( "Workload saved: \n" );
printf( " Skipped perc. of req %f\n", 100.f * (float) sum_skipped_frames / sum_pushed_frames );
+
+ return;
}
#endif
diff --git a/lib_rend/ivas_lc3plus_dec.h b/lib_rend/ivas_lc3plus_dec.h
index b7592fd7404e20327268d2c1ab992453e299491f..0bd14280e639f7e10f4df4fa11748528daf69900 100644
--- a/lib_rend/ivas_lc3plus_dec.h
+++ b/lib_rend/ivas_lc3plus_dec.h
@@ -34,6 +34,7 @@
#define IVAS_LC3PLUS_DEC_H
#include
+#include "options.h"
#include "lc3.h"
#include "ivas_error.h"
#include "ivas_lc3plus_common.h"
@@ -100,41 +101,43 @@ typedef struct IVAS_LC3PLUS_DEC_HANDLE
} * IVAS_LC3PLUS_DEC_HANDLE;
ivas_error IVAS_LC3PLUS_DEC_Open(
- const LC3PLUS_CONFIG config, /* i: decoder configuration */
+ const LC3PLUS_CONFIG config, /* i : decoder configuration */
#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
- const int16_t enableCaching, /* i: if set to 0, the decoder will NOT use cached frame to flush algorithmic delay after skipped frames */
+ const int16_t enableCaching, /* i : if set to 0, the decoder will NOT use cached frame to flush algorithmic delay after skipped frames */
#endif
- IVAS_LC3PLUS_DEC_HANDLE *handle /* o: decoder handle */
+ IVAS_LC3PLUS_DEC_HANDLE *handle /* o : decoder handle */
);
ivas_error IVAS_LC3PLUS_DEC_GetDelay(
- IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder handle */
- int32_t *delayInSamples /* o: algorithmic delay of encoding and decoding in number of samples per channel */
+ IVAS_LC3PLUS_DEC_HANDLE handle, /* i : decoder handle */
+ int32_t *delayInSamples /* o : algorithmic delay of encoding and decoding in number of samples per channel */
);
void IVAS_LC3PLUS_DEC_Close(
- IVAS_LC3PLUS_DEC_HANDLE *handle /* i/o: pointer to decoder handle */
+ IVAS_LC3PLUS_DEC_HANDLE *handle /* i/o: pointer to decoder handle */
);
/*! Sets a matrix[MAX_PARAM_SPATIAL_SUBFRAMES][numLC3plusDecoders] where all require subframes must be flagged with 1, frames that are not required with 0 */
ivas_error IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix(
- IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder handle */
- int16_t *subframeChannelMatrix[MAX_PARAM_SPATIAL_SUBFRAMES] /* i: */
+ IVAS_LC3PLUS_DEC_HANDLE handle, /* i : decoder handle */
+ int16_t *subframeChannelMatrix[MAX_PARAM_SPATIAL_SUBFRAMES] /* i : */
);
ivas_error IVAS_LC3PLUS_DEC_Decode(
- IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder handle */
- uint8_t *bitstream_in, /* i: pointer to input bitstream */
- int32_t bitstream_in_size, /* i: size of bitstream_in */
- float **pcm_out /* o: decoded samples */
+ IVAS_LC3PLUS_DEC_HANDLE handle, /* i : decoder handle */
+ uint8_t *bitstream_in, /* i : pointer to input bitstream */
+ const int32_t bitstream_in_size, /* i : size of bitstream_in */
+ float **pcm_out /* o : decoded samples */
);
ivas_error IVAS_LC3PLUS_DEC_Conceal(
- IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder handle */
- float **pcm_out /* o: concealed samples */
+ IVAS_LC3PLUS_DEC_HANDLE handle, /* i : decoder handle */
+ float **pcm_out /* o : concealed samples */
);
-ivas_error IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( int16_t ***subframeChannelMatrix, const uint32_t num_decs );
+ivas_error IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix(
+ int16_t ***subframeChannelMatrix,
+ const uint32_t num_decs );
void IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix( int16_t **subframeChannelMatrix );
diff --git a/lib_rend/ivas_lc3plus_enc.c b/lib_rend/ivas_lc3plus_enc.c
index 36e9015b5de39362a7bfbbeab0f90885de957b6b..dd4268a1f16720aee4d3b853d207f3db6cfe4a47 100644
--- a/lib_rend/ivas_lc3plus_enc.c
+++ b/lib_rend/ivas_lc3plus_enc.c
@@ -37,10 +37,17 @@
#include "prot.h"
#include "wmc_auto.h"
+
+/*-------------------------------------------------------------------*
+ * Function IVAS_LC3PLUS_ENC_Open()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
ivas_error IVAS_LC3PLUS_ENC_Open(
- const LC3PLUS_CONFIG config, /* i: encoder configuration */
- const uint32_t bitsPerSecond, /* i: bit rate */
- IVAS_LC3PLUS_ENC_HANDLE *handle /* o: encoder handle */
+ const LC3PLUS_CONFIG config, /* i : LC3plus encoder configuration */
+ const uint32_t bitsPerSecond, /* i : bit rate */
+ IVAS_LC3PLUS_ENC_HANDLE *handle /* o : encoder handle */
)
{
int32_t bitsPerSecondPerChannel;
@@ -61,20 +68,19 @@ ivas_error IVAS_LC3PLUS_ENC_Open(
return IVAS_ERROR( IVAS_ERR_INTERNAL, "lc3plus_enc_get_size failed\n" );
}
- *handle = malloc( sizeof( struct IVAS_LC3PLUS_ENC_HANDLE ) );
- if ( NULL == handle )
+ if ( ( *handle = malloc( sizeof( struct IVAS_LC3PLUS_ENC_HANDLE ) ) ) == NULL )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus wrapper handle\n" );
}
( *handle )->pcm_conversion_buffer = NULL;
( *handle )->num_encs = 0;
- ( *handle )->handles = malloc( config.channels * sizeof( IVAS_LC3PLUS_ENC_HANDLE ) );
- if ( NULL == ( *handle )->handles )
+ if ( ( ( *handle )->handles = malloc( config.channels * sizeof( IVAS_LC3PLUS_ENC_HANDLE ) ) ) == NULL )
{
IVAS_LC3PLUS_ENC_Close( handle );
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus wrapper handle\n" );
}
+
for ( i = 0; i < config.channels; ++i )
{
( *handle )->handles[i] = NULL;
@@ -83,8 +89,7 @@ ivas_error IVAS_LC3PLUS_ENC_Open(
for ( int32_t iCh = 0; iCh < config.channels; iCh++ )
{
- ( *handle )->handles[iCh] = malloc( encoder_size );
- if ( NULL == ( *handle )->handles[iCh] )
+ if ( ( ( *handle )->handles[iCh] = malloc( encoder_size ) ) == NULL )
{
IVAS_LC3PLUS_ENC_Close( handle );
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus encoder\n" );
@@ -117,6 +122,7 @@ ivas_error IVAS_LC3PLUS_ENC_Open(
IVAS_LC3PLUS_ENC_Close( handle );
return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "Current pcm_conversion_buffer sizing requires that lc3plus uses a shorter or equal frame duration than ivas\n" );
}
+
( *handle )->config = config;
( *handle )->pcm_conversion_buffer = malloc( sizeof( int16_t ) * config.samplerate * config.lc3plus_frame_duration_us / 1000000 );
if ( NULL == ( *handle )->pcm_conversion_buffer )
@@ -124,12 +130,20 @@ ivas_error IVAS_LC3PLUS_ENC_Open(
IVAS_LC3PLUS_ENC_Close( handle );
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus encoder wrapper pcm_conversion_buffer\n" );
}
+
return IVAS_ERR_OK;
}
+
+/*-------------------------------------------------------------------*
+ * Function IVAS_LC3PLUS_ENC_GetDelay()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
ivas_error IVAS_LC3PLUS_ENC_GetDelay(
- IVAS_LC3PLUS_ENC_HANDLE handle, /* i: encoder handle */
- int32_t *delayInSamples /* o: encoder delay in number of samples per channel */
+ IVAS_LC3PLUS_ENC_HANDLE handle, /* i : LC3plus encoder handle */
+ int32_t *delayInSamples /* o : encoder delay in number of samples per channel */
)
{
int32_t tmpDelayInSamples;
@@ -159,12 +173,20 @@ ivas_error IVAS_LC3PLUS_ENC_GetDelay(
}
*delayInSamples = tmpDelayInSamples;
}
+
return IVAS_ERR_OK;
}
+
+/*-------------------------------------------------------------------*
+ * Function IVAS_LC3PLUS_ENC_GetOutputBitstreamSize()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
ivas_error IVAS_LC3PLUS_ENC_GetOutputBitstreamSize(
- IVAS_LC3PLUS_ENC_HANDLE handle, /* i: encoder handle */
- int32_t *bsSize /* o: size of each bitstream frame in bytes */
+ IVAS_LC3PLUS_ENC_HANDLE handle, /* i : LC3plus encoder handle */
+ int32_t *bsSize /* o : size of each bitstream frame in bytes */
)
{
int32_t bitstreamSizeMultiplier;
@@ -194,11 +216,19 @@ ivas_error IVAS_LC3PLUS_ENC_GetOutputBitstreamSize(
bitstreamSizeMultiplier = handle->config.ivas_frame_duration_us / handle->config.lc3plus_frame_duration_us;
*bsSize *= bitstreamSizeMultiplier;
+
return IVAS_ERR_OK;
}
+
+/*-------------------------------------------------------------------*
+ * Function IVAS_LC3PLUS_ENC_Close()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
void IVAS_LC3PLUS_ENC_Close(
- IVAS_LC3PLUS_ENC_HANDLE *handle /* i/o: pointer to encoder handle */
+ IVAS_LC3PLUS_ENC_HANDLE *handle /* i/o: pointer to LC3plus encoder handle */
)
{
if ( NULL == handle || NULL == *handle )
@@ -217,15 +247,26 @@ void IVAS_LC3PLUS_ENC_Close(
{
free( ( *handle )->pcm_conversion_buffer );
}
+
free( ( *handle )->handles );
free( *handle );
+
*handle = NULL;
+
+ return;
}
+
+/*-------------------------------------------------------------------*
+ * Function IVAS_LC3PLUS_ENC_Encode()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
ivas_error IVAS_LC3PLUS_ENC_Encode(
- IVAS_LC3PLUS_ENC_HANDLE handle, /* i: encoder handle */
- float **pcm_in, /* i: pointer input samples */
- void *bitstream_out /* o: pointer to bitstream frame */
+ IVAS_LC3PLUS_ENC_HANDLE handle, /* i : LC3plus encoder handle */
+ float **pcm_in, /* i : pointer input samples */
+ void *bitstream_out /* o : pointer to bitstream frame */
)
{
uint32_t numSamplesPerLC3plusChannel;
diff --git a/lib_rend/ivas_lc3plus_enc.h b/lib_rend/ivas_lc3plus_enc.h
index b54f16996bfd4f6e43e52a3df5d8afaa95ec7ae7..d58ecf1b653deec0295e99e6dcd6550c9cd24970 100644
--- a/lib_rend/ivas_lc3plus_enc.h
+++ b/lib_rend/ivas_lc3plus_enc.h
@@ -48,29 +48,29 @@ typedef struct IVAS_LC3PLUS_ENC_HANDLE
} * IVAS_LC3PLUS_ENC_HANDLE;
ivas_error IVAS_LC3PLUS_ENC_Open(
- const LC3PLUS_CONFIG config, /* i: encoder configuration */
- const uint32_t bitsPerSecond, /* i: bit rate */
- IVAS_LC3PLUS_ENC_HANDLE *handle /* o: encoder handle */
+ const LC3PLUS_CONFIG config, /* i : encoder configuration */
+ const uint32_t bitsPerSecond, /* i : bit rate */
+ IVAS_LC3PLUS_ENC_HANDLE *handle /* o : LC3plus encoder handle */
);
ivas_error IVAS_LC3PLUS_ENC_GetDelay(
- IVAS_LC3PLUS_ENC_HANDLE handle, /* i: encoder handle */
- int32_t *delayInSamples /* o: algorithmic delay of encoding and decoding in number of samples per channel */
+ IVAS_LC3PLUS_ENC_HANDLE handle, /* i : LC3plus encoder handle */
+ int32_t *delayInSamples /* o : algorithmic delay of encoding and decoding in number of samples per channel */
);
ivas_error IVAS_LC3PLUS_ENC_GetOutputBitstreamSize(
- IVAS_LC3PLUS_ENC_HANDLE handle, /* i: encoder handle */
- int32_t *bsSize /* o: size of each bitstream frame in bytes */
+ IVAS_LC3PLUS_ENC_HANDLE handle, /* i : LC3plus encoder handle */
+ int32_t *bsSize /* o : size of each bitstream frame in bytes */
);
void IVAS_LC3PLUS_ENC_Close(
- IVAS_LC3PLUS_ENC_HANDLE *handle /* i/o: pointer to encoder handle */
+ IVAS_LC3PLUS_ENC_HANDLE *handle /* i/o: pointer to LC3plus encoder handle */
);
ivas_error IVAS_LC3PLUS_ENC_Encode(
- IVAS_LC3PLUS_ENC_HANDLE handle, /* i: encoder handle */
- float **pcm_in, /* i: pointer input samples */
- void *bitstream_out /* o: pointer to bitstream frame */
+ IVAS_LC3PLUS_ENC_HANDLE handle, /* i : LC3plus encoder handle */
+ float **pcm_in, /* i : pointer input samples */
+ void *bitstream_out /* o : pointer to bitstream frame */
);
#endif /* IVAS_LC3PLUS_ENC_H */
diff --git a/lib_rend/ivas_CQMFDecoder.c b/lib_rend/ivas_lcld_decoder.c
similarity index 54%
rename from lib_rend/ivas_CQMFDecoder.c
rename to lib_rend/ivas_lcld_decoder.c
index bf6c7fa5181b1a5e041330b0f0bb3d78521ac814..7e9734e763b20eacbea18a892cebc18476aad943 100644
--- a/lib_rend/ivas_CQMFDecoder.c
+++ b/lib_rend/ivas_lcld_decoder.c
@@ -1,57 +1,60 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby
-International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der
-angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips
-N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge
-Corporation, and other contributors to this repository. All Rights Reserved.
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
+ Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
+ Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+ contributors to this repository. All Rights Reserved.
This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB,
-Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung
-e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph
-and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings
-Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their
-respective contributions in the software. This notice grants no license of any
-kind, including but not limited to patent license, nor is any license granted by
-implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration
-agreement before making contributions.
-
- This software is provided "AS IS", without any express or implied warranties.
-The software is in the development stage. It is intended exclusively for experts
-who have experience with such software and solely for the purpose of inspection.
-All implied warranties of non-infringement, merchantability and fitness for a
-particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing
-this software shall be submitted to and settled by the final, binding
-jurisdiction of the courts of Munich, Germany in accordance with the laws of the
-Federal Republic of Germany excluding its conflict of law rules and the United
-Nations Convention on Contracts on the International Sales of Goods.
+ The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
+ Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
+ Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
+ Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+ contributors to this repository retain full ownership rights in their respective contributions in
+ the software. This notice grants no license of any kind, including but not limited to patent
+ license, nor is any license granted by implication, estoppel or otherwise.
+
+ Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
+ contributions.
+
+ This software is provided "AS IS", without any express or implied warranties. The software is in the
+ development stage. It is intended exclusively for experts who have experience with such software and
+ solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
+ and fitness for a particular purpose are hereby disclaimed and excluded.
+
+ Any dispute, controversy or claim arising under or in relation to providing this software shall be
+ submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
+ accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
+ the United Nations Convention on Contracts on the International Sales of Goods.
*******************************************************************************************************/
-#include "ivas_CQMFDecoder.h"
+#include
#include "options.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
-#include "ivas_NoiseGen.h"
-#include "ivas_PerceptualModel.h"
-#include "ivas_lcld_tables.h"
+#include "ivas_lcld_prot.h"
+#include "ivas_lcld_rom_tables.h"
#include "ivas_cldfb_codec_bitstream.h"
#include "prot.h"
#include
-#include
-#include
-#include
-#include "ivas_MSPred.h"
-#include "ivas_PredDecoder.h"
#include "ivas_prot_rend.h"
#include "wmc_auto.h"
+
+/*------------------------------------------------------------------------------------------*
+ * Local constants
+ *------------------------------------------------------------------------------------------*/
+
+#define DECODER_ERROR_NONE ( 0 ) // todo: not really used
+
+#define HUFF_READ_SIZE ( 4 )
+
+
+/*------------------------------------------------------------------------------------------*
+ * Local structures
+ *------------------------------------------------------------------------------------------*/
+
#ifdef ROM_TO_RAM
typedef struct TableNode
{
@@ -69,7 +72,8 @@ typedef struct TableList
} TableList;
#endif
-struct CQMF_DECODER
+
+struct LCLD_DECODER
{
int32_t iSampleRate;
int32_t iChannels;
@@ -90,7 +94,6 @@ struct CQMF_DECODER
#ifdef ENABLE_PMOD_ADJUST
int32_t **ppiHiSMRFlags;
#endif
- // uint8_t *pReadBuff;
int32_t iCommonGrouping;
int32_t *piNumGroups;
int32_t **ppiGroupLengths;
@@ -102,10 +105,10 @@ struct CQMF_DECODER
int32_t iAllocOffset;
- int32_t ***pppiCQMFSignReal;
- int32_t ***pppiCQMFSignImag;
- int32_t ***pppiQCQMFReal;
- int32_t ***pppiQCQMFImag;
+ int32_t ***pppiLCLDSignReal;
+ int32_t ***pppiLCLDSignImag;
+ int32_t ***pppiQLCLDReal;
+ int32_t ***pppiQLCLDImag;
PredictionDecoder *psPredictionDecoder;
@@ -114,13 +117,14 @@ struct CQMF_DECODER
int32_t iLastError;
};
+
#ifdef ROM_TO_RAM
-static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const uint16_t ( *ppuiEncTable )[2], int32_t iSize, int32_t iReadLength, uint32_t *iTables );
+static void CreateDecodeTable( LCLDDecoder *psLCLDDecoder, int32_t num, const uint16_t ( *ppuiEncTable )[2], int32_t iSize, int32_t iReadLength, uint32_t *iTables );
static TableNode *CreateTableList( int32_t iReadLength );
static void DeleteTableList( TableList *ptable_list, int32_t iTables );
static TableNode *GetNextTable( int32_t iIndex, TableList *table_list, TableNode *poParent, int32_t iReadLength, uint32_t *iTablesCreated );
static void AddcodeTableList( TableList *ptable_list, int32_t iLength, int32_t iCode, int32_t iCodeIndex, int32_t iReadLength, uint32_t *iTables );
-static void CompleteTables( CQMFDecoder *psCQMFDecoder, int32_t n, TableList *ptable_list, int32_t iReadLength, int32_t iTablesCreated );
+static void CompleteTables( LCLDDecoder *psLCLDDecoder, int32_t n, TableList *ptable_list, int32_t iReadLength, int32_t iTablesCreated );
static TableNode *CreateTableList( int32_t iReadLength )
{
@@ -190,9 +194,7 @@ static TableNode *GetNextTable( int32_t iIndex, TableList *table_list, TableNode
{
poNextNode = CreateTableList( iReadLength );
poParent->ppoNextTable[iIndex] = poNextNode;
- poParent->piDifference[iIndex] =
- *iTablesCreated; // this is a link to the next table rather than the
- // difference
+ poParent->piDifference[iIndex] = *iTablesCreated; /* this is a link to the next table rather than the difference */
table_list->poOrderedBottom->poOrderedNext = poNextNode;
table_list->poOrderedBottom = poNextNode;
@@ -205,7 +207,7 @@ static TableNode *GetNextTable( int32_t iIndex, TableList *table_list, TableNode
return poNextNode;
}
-static void CompleteTables( CQMFDecoder *psCQMFDecoder, int32_t n, TableList *ptable_list, int32_t iReadLength, int32_t iTablesCreated )
+static void CompleteTables( LCLDDecoder *psLCLDDecoder, int32_t n, TableList *ptable_list, int32_t iReadLength, int32_t iTablesCreated )
{
int32_t iMaxTables;
@@ -213,7 +215,7 @@ static void CompleteTables( CQMFDecoder *psCQMFDecoder, int32_t n, TableList *pt
TableNode *poNode;
iMaxTables = 1 << iReadLength;
- psCQMFDecoder->c_apauiHuffDecTable_RAM[n] =
+ psLCLDDecoder->c_apauiHuffDecTable_RAM[n] =
malloc( iTablesCreated * iMaxTables * sizeof( uint32_t * ) );
poNode = ptable_list->poOrderedTop;
@@ -228,7 +230,7 @@ static void CompleteTables( CQMFDecoder *psCQMFDecoder, int32_t n, TableList *pt
uiCode = poNode->piDifference[k];
uiCode <<= 16;
uiCode |= poNode->piCodeIndex[k];
- psCQMFDecoder->c_apauiHuffDecTable_RAM[n][j][k] = uiCode;
+ psLCLDDecoder->c_apauiHuffDecTable_RAM[n][j][k] = uiCode;
}
}
poNode = poNode->poOrderedNext;
@@ -269,7 +271,7 @@ static void AddcodeTableList( TableList *ptable_list, int32_t iLength, int32_t i
}
}
-static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const uint16_t ( *ppuiEncTable )[2], int32_t iSize, int32_t iReadLength, uint32_t *iTables )
+static void CreateDecodeTable( LCLDDecoder *psLCLDDecoder, int32_t num, const uint16_t ( *ppuiEncTable )[2], int32_t iSize, int32_t iReadLength, uint32_t *iTables )
{
int32_t n;
uint32_t **ppsort_enc_table;
@@ -337,7 +339,7 @@ static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const ui
iTables );
}
- CompleteTables( psCQMFDecoder, num, ptable_list, iReadLength, *iTables );
+ CompleteTables( psLCLDDecoder, num, ptable_list, iReadLength, *iTables );
DeleteTableList( ptable_list, *iTables );
for ( n = 0; n < iSize; n++ )
{
@@ -346,540 +348,576 @@ static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const ui
free( ppsort_enc_table );
}
#endif
-CQMFDecoder *CreateCQMFDecoder( const int32_t iSampleRate,
- const int32_t iChannels )
+
+
+/*------------------------------------------------------------------------------------------*
+ * Function CreateLCLDDecoder()
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
+
+ivas_error CreateLCLDDecoder(
+ LCLDDecoder **psLCLDDecoder_out,
+ const int32_t iSampleRate,
+ const int32_t iChannels )
{
int32_t n;
#ifdef ROM_TO_RAM
int32_t read_length;
#endif
- CQMFDecoder *psCQMFDecoder = NULL;
+ ivas_error error;
+ LCLDDecoder *psLCLDDecoder = NULL;
assert( iSampleRate == 48000 ); // Fix
- psCQMFDecoder = (CQMFDecoder *) malloc( sizeof( CQMFDecoder ) );
- psCQMFDecoder->iSampleRate = iSampleRate;
- psCQMFDecoder->iChannels = iChannels;
- psCQMFDecoder->iNumBlocks = CQMF_BLOCKS_PER_FRAME;
- psCQMFDecoder->iAllocOffset = 0;
+ if ( ( psLCLDDecoder = (LCLDDecoder *) malloc( sizeof( LCLDDecoder ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ psLCLDDecoder->iSampleRate = iSampleRate;
+ psLCLDDecoder->iChannels = iChannels;
+ psLCLDDecoder->iNumBlocks = LCLD_BLOCKS_PER_FRAME;
+ psLCLDDecoder->iAllocOffset = 0;
- psCQMFDecoder->iNumBands = MAX_BANDS_48; // Fix
- psCQMFDecoder->piBandwidths = c_aiBandwidths48; // Fix
+ psLCLDDecoder->iNumBands = MAX_BANDS_48; // Fix
+ psLCLDDecoder->piBandwidths = c_aiBandwidths48; // Fix
- psCQMFDecoder->iMSMode = 0;
- psCQMFDecoder->piMSFlags =
- (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) );
+ psLCLDDecoder->iMSMode = 0;
+ if ( ( psLCLDDecoder->piMSFlags = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
for ( n = 0; n < MAX_BANDS; n++ )
{
- psCQMFDecoder->piLRPhaseDiffs[n] = 0;
- psCQMFDecoder->piMSPredCoefs[n] = 0;
+ psLCLDDecoder->piLRPhaseDiffs[n] = 0;
+ psLCLDDecoder->piMSPredCoefs[n] = 0;
}
#ifdef ENABLE_PMOD_ADJUST
- psCQMFDecoder->ppiHiSMRFlags =
- (int32_t **) malloc( psCQMFDecoder->iChannels * sizeof( int32_t * ) );
+ psLCLDDecoder->ppiHiSMRFlags =
+ (int32_t **) malloc( psLCLDDecoder->iChannels * sizeof( int32_t * ) );
#endif
- psCQMFDecoder->iCommonGrouping =
- 1; // Common grouping always on only impacts stereo
- psCQMFDecoder->piNumGroups =
- (int32_t *) malloc( psCQMFDecoder->iChannels * sizeof( int32_t ) );
- psCQMFDecoder->ppiGroupLengths =
- (int32_t **) malloc( psCQMFDecoder->iChannels * sizeof( int32_t * ) );
- psCQMFDecoder->pppiRMSEnvelope =
- (int32_t ***) malloc( psCQMFDecoder->iChannels * sizeof( int32_t ** ) );
- psCQMFDecoder->pppiSMR =
- (int32_t ***) malloc( psCQMFDecoder->iChannels * sizeof( int32_t ** ) );
- psCQMFDecoder->pppiExcitation =
- (int32_t ***) malloc( psCQMFDecoder->iChannels * sizeof( int32_t ** ) );
- psCQMFDecoder->pppiAlloc =
- (int32_t ***) malloc( psCQMFDecoder->iChannels * sizeof( int32_t ** ) );
-
- psCQMFDecoder->pppiCQMFSignReal =
- (int32_t ***) malloc( psCQMFDecoder->iChannels * sizeof( int32_t ** ) );
- psCQMFDecoder->pppiCQMFSignImag =
- (int32_t ***) malloc( psCQMFDecoder->iChannels * sizeof( int32_t ** ) );
- psCQMFDecoder->pppiQCQMFReal =
- (int32_t ***) malloc( psCQMFDecoder->iChannels * sizeof( int32_t ** ) );
- psCQMFDecoder->pppiQCQMFImag =
- (int32_t ***) malloc( psCQMFDecoder->iChannels * sizeof( int32_t ** ) );
+ psLCLDDecoder->iCommonGrouping = 1; /* Common grouping always on only impacts stereo */
+ if ( ( psLCLDDecoder->piNumGroups = (int32_t *) malloc( psLCLDDecoder->iChannels * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->ppiGroupLengths = (int32_t **) malloc( psLCLDDecoder->iChannels * sizeof( int32_t * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiRMSEnvelope = (int32_t ***) malloc( psLCLDDecoder->iChannels * sizeof( int32_t ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiSMR = (int32_t ***) malloc( psLCLDDecoder->iChannels * sizeof( int32_t ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiExcitation = (int32_t ***) malloc( psLCLDDecoder->iChannels * sizeof( int32_t ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiAlloc = (int32_t ***) malloc( psLCLDDecoder->iChannels * sizeof( int32_t ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDDecoder->pppiLCLDSignReal = (int32_t ***) malloc( psLCLDDecoder->iChannels * sizeof( int32_t ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiLCLDSignImag = (int32_t ***) malloc( psLCLDDecoder->iChannels * sizeof( int32_t ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiQLCLDReal = (int32_t ***) malloc( psLCLDDecoder->iChannels * sizeof( int32_t ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiQLCLDImag = (int32_t ***) malloc( psLCLDDecoder->iChannels * sizeof( int32_t ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
for ( n = 0; n < iChannels; n++ )
{
- int32_t k;
+ int16_t k;
#ifdef ENABLE_PMOD_ADJUST
- psCQMFDecoder->ppiHiSMRFlags[n] =
+ psLCLDDecoder->ppiHiSMRFlags[n] =
(int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) );
;
#endif
- psCQMFDecoder->ppiGroupLengths[n] =
- (int32_t *) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t ) );
- psCQMFDecoder->pppiRMSEnvelope[n] =
- (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) );
- psCQMFDecoder->pppiSMR[n] =
- (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) );
- psCQMFDecoder->pppiExcitation[n] =
- (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) );
- psCQMFDecoder->pppiAlloc[n] =
- (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) );
-
- psCQMFDecoder->pppiCQMFSignReal[n] =
- (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) );
- psCQMFDecoder->pppiCQMFSignImag[n] =
- (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) );
- psCQMFDecoder->pppiQCQMFReal[n] =
- (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) );
- psCQMFDecoder->pppiQCQMFImag[n] =
- (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) );
- for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ )
+ if ( ( psLCLDDecoder->ppiGroupLengths[n] = (int32_t *) malloc( LCLD_BLOCKS_PER_FRAME * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiRMSEnvelope[n] = (int32_t **) malloc( LCLD_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiSMR[n] = (int32_t **) malloc( LCLD_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiExcitation[n] = (int32_t **) malloc( LCLD_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiAlloc[n] = (int32_t **) malloc( LCLD_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDDecoder->pppiLCLDSignReal[n] = (int32_t **) malloc( LCLD_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiLCLDSignImag[n] = (int32_t **) malloc( LCLD_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL )
{
- psCQMFDecoder->pppiRMSEnvelope[n][k] =
- (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) );
- psCQMFDecoder->pppiSMR[n][k] =
- (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) );
- psCQMFDecoder->pppiExcitation[n][k] =
- (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) );
- psCQMFDecoder->pppiAlloc[n][k] =
- (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) );
-
- psCQMFDecoder->pppiCQMFSignReal[n][k] =
- (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) );
- psCQMFDecoder->pppiCQMFSignImag[n][k] =
- (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) );
- psCQMFDecoder->pppiQCQMFReal[n][k] =
- (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) );
- psCQMFDecoder->pppiQCQMFImag[n][k] =
- (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) );
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiQLCLDReal[n] = (int32_t **) malloc( LCLD_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiQLCLDImag[n] = (int32_t **) malloc( LCLD_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ for ( k = 0; k < LCLD_BLOCKS_PER_FRAME; k++ )
+ {
+ if ( ( psLCLDDecoder->pppiRMSEnvelope[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiSMR[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiExcitation[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiAlloc[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDDecoder->pppiLCLDSignReal[n][k] = (int32_t *) malloc( LCLD_BANDS * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiLCLDSignImag[n][k] = (int32_t *) malloc( LCLD_BANDS * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiQLCLDReal[n][k] = (int32_t *) malloc( LCLD_BANDS * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( psLCLDDecoder->pppiQLCLDImag[n][k] = (int32_t *) malloc( LCLD_BANDS * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
}
}
+
#ifdef ROM_TO_RAM
read_length = READ_LENGTH;
for ( n = 0; n < ALLOC_TABLE_SIZE * 2; n++ )
{
- psCQMFDecoder->num_decode_table[n] = 1; // initialising the value to 1
+ psLCLDDecoder->num_decode_table[n] = 1;
if ( c_apauiHuffEncTabels[n] != NULL )
{
- CreateDecodeTable( psCQMFDecoder, n, c_apauiHuffEncTabels[n], num_row_aauiCQMFHuff[n], read_length, &psCQMFDecoder->num_decode_table[n] );
+ CreateDecodeTable( psLCLDDecoder, n, c_apauiHuffEncTabels[n], num_row_aauiLCLDHuff[n], read_length, &psLCLDDecoder->num_decode_table[n] );
}
else
{
- psCQMFDecoder->c_apauiHuffDecTable_RAM[n] = NULL;
+ psLCLDDecoder->c_apauiHuffDecTable_RAM[n] = NULL;
}
}
#endif
- psCQMFDecoder->psPredictionDecoder =
- CreatePredictionDecoder( iChannels, psCQMFDecoder->iNumBlocks );
- // psCQMFDecoder->pReadBuff =
- // (uint8_t *) malloc( 4096 * sizeof( uint8_t ) );
- psCQMFDecoder->psNoiseGen =
- NULL; // CreateNoiseGen(); // No noise fill for now
+ if ( ( error = CreatePredictionDecoder( &psLCLDDecoder->psPredictionDecoder, iChannels, psLCLDDecoder->iNumBlocks ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+ psLCLDDecoder->psNoiseGen = NULL; // CreateNoiseGen(); // No noise fill for now
+
+ psLCLDDecoder->iLastError = DECODER_ERROR_NONE;
- psCQMFDecoder->iLastError = DECODER_ERROR_NONE;
+ *psLCLDDecoder_out = psLCLDDecoder;
- return psCQMFDecoder;
+ return IVAS_ERR_OK;
}
-void DeleteCQMFDecoder( CQMFDecoder *psCQMFDecoder )
+
+/*------------------------------------------------------------------------------------------*
+ * Function CreateLCLDDecoder()
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
+
+void DeleteLCLDDecoder( LCLDDecoder *psLCLDDecoder )
{
- if ( psCQMFDecoder != NULL )
- {
+ int32_t k, n;
- if ( psCQMFDecoder->piMSFlags != NULL )
+ if ( psLCLDDecoder != NULL )
+ {
+ if ( psLCLDDecoder->piMSFlags != NULL )
{
- free( psCQMFDecoder->piMSFlags );
+ free( psLCLDDecoder->piMSFlags );
}
- if ( psCQMFDecoder->piNumGroups != NULL )
+ if ( psLCLDDecoder->piNumGroups != NULL )
{
- free( psCQMFDecoder->piNumGroups );
+ free( psLCLDDecoder->piNumGroups );
}
- if ( psCQMFDecoder->ppiGroupLengths != NULL )
+ if ( psLCLDDecoder->ppiGroupLengths != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFDecoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDDecoder->iChannels; n++ )
{
- free( psCQMFDecoder->ppiGroupLengths[n] );
+ free( psLCLDDecoder->ppiGroupLengths[n] );
}
- free( psCQMFDecoder->ppiGroupLengths );
+ free( psLCLDDecoder->ppiGroupLengths );
}
- if ( psCQMFDecoder->pppiRMSEnvelope != NULL )
+ if ( psLCLDDecoder->pppiRMSEnvelope != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFDecoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDDecoder->iChannels; n++ )
{
- int32_t k;
- for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ )
+ for ( k = 0; k < LCLD_BLOCKS_PER_FRAME; k++ )
{
- free( psCQMFDecoder->pppiRMSEnvelope[n][k] );
+ free( psLCLDDecoder->pppiRMSEnvelope[n][k] );
}
- free( psCQMFDecoder->pppiRMSEnvelope[n] );
+ free( psLCLDDecoder->pppiRMSEnvelope[n] );
}
- free( psCQMFDecoder->pppiRMSEnvelope );
+ free( psLCLDDecoder->pppiRMSEnvelope );
}
- if ( psCQMFDecoder->pppiSMR != NULL )
+ if ( psLCLDDecoder->pppiSMR != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFDecoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDDecoder->iChannels; n++ )
{
- int32_t k;
- for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ )
+ for ( k = 0; k < LCLD_BLOCKS_PER_FRAME; k++ )
{
- free( psCQMFDecoder->pppiSMR[n][k] );
+ free( psLCLDDecoder->pppiSMR[n][k] );
}
- free( psCQMFDecoder->pppiSMR[n] );
+ free( psLCLDDecoder->pppiSMR[n] );
}
- free( psCQMFDecoder->pppiSMR );
+ free( psLCLDDecoder->pppiSMR );
}
- if ( psCQMFDecoder->pppiExcitation != NULL )
+ if ( psLCLDDecoder->pppiExcitation != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFDecoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDDecoder->iChannels; n++ )
{
- int32_t k;
- for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ )
+ for ( k = 0; k < LCLD_BLOCKS_PER_FRAME; k++ )
{
- free( psCQMFDecoder->pppiExcitation[n][k] );
+ free( psLCLDDecoder->pppiExcitation[n][k] );
}
- free( psCQMFDecoder->pppiExcitation[n] );
+ free( psLCLDDecoder->pppiExcitation[n] );
}
- free( psCQMFDecoder->pppiExcitation );
+ free( psLCLDDecoder->pppiExcitation );
}
#ifdef ENABLE_PMOD_ADJUST
- if ( psCQMFDecoder->ppiHiSMRFlags != NULL )
+ if ( psLCLDDecoder->ppiHiSMRFlags != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFDecoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDDecoder->iChannels; n++ )
{
- free( psCQMFDecoder->ppiHiSMRFlags[n] );
+ free( psLCLDDecoder->ppiHiSMRFlags[n] );
}
- free( psCQMFDecoder->ppiHiSMRFlags );
+ free( psLCLDDecoder->ppiHiSMRFlags );
}
#endif
- if ( psCQMFDecoder->pppiAlloc != NULL )
+ if ( psLCLDDecoder->pppiAlloc != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFDecoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDDecoder->iChannels; n++ )
{
- int32_t k;
- for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ )
+ for ( k = 0; k < LCLD_BLOCKS_PER_FRAME; k++ )
{
- free( psCQMFDecoder->pppiAlloc[n][k] );
+ free( psLCLDDecoder->pppiAlloc[n][k] );
}
- free( psCQMFDecoder->pppiAlloc[n] );
+ free( psLCLDDecoder->pppiAlloc[n] );
}
- free( psCQMFDecoder->pppiAlloc );
+ free( psLCLDDecoder->pppiAlloc );
}
- if ( psCQMFDecoder->pppiCQMFSignReal != NULL )
+ if ( psLCLDDecoder->pppiLCLDSignReal != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFDecoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDDecoder->iChannels; n++ )
{
- int32_t k;
- for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ )
+ for ( k = 0; k < LCLD_BLOCKS_PER_FRAME; k++ )
{
- free( psCQMFDecoder->pppiCQMFSignReal[n][k] );
+ free( psLCLDDecoder->pppiLCLDSignReal[n][k] );
}
- free( psCQMFDecoder->pppiCQMFSignReal[n] );
+ free( psLCLDDecoder->pppiLCLDSignReal[n] );
}
- free( psCQMFDecoder->pppiCQMFSignReal );
+ free( psLCLDDecoder->pppiLCLDSignReal );
}
- if ( psCQMFDecoder->pppiCQMFSignImag != NULL )
+ if ( psLCLDDecoder->pppiLCLDSignImag != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFDecoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDDecoder->iChannels; n++ )
{
- int32_t k;
- for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ )
+ for ( k = 0; k < LCLD_BLOCKS_PER_FRAME; k++ )
{
- free( psCQMFDecoder->pppiCQMFSignImag[n][k] );
+ free( psLCLDDecoder->pppiLCLDSignImag[n][k] );
}
- free( psCQMFDecoder->pppiCQMFSignImag[n] );
+ free( psLCLDDecoder->pppiLCLDSignImag[n] );
}
- free( psCQMFDecoder->pppiCQMFSignImag );
+ free( psLCLDDecoder->pppiLCLDSignImag );
}
- if ( psCQMFDecoder->pppiQCQMFReal != NULL )
+ if ( psLCLDDecoder->pppiQLCLDReal != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFDecoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDDecoder->iChannels; n++ )
{
- int32_t k;
- for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ )
+ for ( k = 0; k < LCLD_BLOCKS_PER_FRAME; k++ )
{
- free( psCQMFDecoder->pppiQCQMFReal[n][k] );
+ free( psLCLDDecoder->pppiQLCLDReal[n][k] );
}
- free( psCQMFDecoder->pppiQCQMFReal[n] );
+ free( psLCLDDecoder->pppiQLCLDReal[n] );
}
- free( psCQMFDecoder->pppiQCQMFReal );
+ free( psLCLDDecoder->pppiQLCLDReal );
}
- if ( psCQMFDecoder->pppiQCQMFImag != NULL )
+ if ( psLCLDDecoder->pppiQLCLDImag != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFDecoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDDecoder->iChannels; n++ )
{
- int32_t k;
- for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ )
+ for ( k = 0; k < LCLD_BLOCKS_PER_FRAME; k++ )
{
- free( psCQMFDecoder->pppiQCQMFImag[n][k] );
+ free( psLCLDDecoder->pppiQLCLDImag[n][k] );
}
- free( psCQMFDecoder->pppiQCQMFImag[n] );
+ free( psLCLDDecoder->pppiQLCLDImag[n] );
}
- free( psCQMFDecoder->pppiQCQMFImag );
+ free( psLCLDDecoder->pppiQLCLDImag );
}
- // if ( psCQMFDecoder->pReadBuff != NULL )
- //{
- // free( psCQMFDecoder->pReadBuff );
- // }
#ifdef ROM_TO_RAM
for ( uint32_t n = 0; n < ALLOC_TABLE_SIZE * 2; n++ )
{
- if ( psCQMFDecoder->num_decode_table[n] > 1 )
+ if ( psLCLDDecoder->num_decode_table[n] > 1 )
{
- if ( psCQMFDecoder->c_apauiHuffDecTable_RAM[n] != NULL )
+ if ( psLCLDDecoder->c_apauiHuffDecTable_RAM[n] != NULL )
{
- free( psCQMFDecoder->c_apauiHuffDecTable_RAM[n] );
+ free( psLCLDDecoder->c_apauiHuffDecTable_RAM[n] );
}
}
}
#endif
- DeletePredictionDecoder( psCQMFDecoder->psPredictionDecoder );
+ DeletePredictionDecoder( psLCLDDecoder->psPredictionDecoder );
- if ( psCQMFDecoder->psNoiseGen != NULL )
+ if ( psLCLDDecoder->psNoiseGen != NULL )
{
- DeleteNoiseGen( psCQMFDecoder->psNoiseGen );
+ DeleteNoiseGen( psLCLDDecoder->psNoiseGen );
}
- free( psCQMFDecoder );
+ free( psLCLDDecoder );
}
}
-int32_t CQMFDecoderGetError( CQMFDecoder *psCQMFDecoder )
+
+/*------------------------------------------------------------------------------------------*
+ * Function LCLDDecoderGetError()
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
+
+int32_t LCLDDecoderGetError( LCLDDecoder *psLCLDDecoder )
{
- return psCQMFDecoder->iLastError;
+ return psLCLDDecoder->iLastError;
}
-static void ApplyRMSEnvelope( const int32_t iNumBands,
- const int32_t *piBandwidths,
- const int32_t iNumGroups,
- const int32_t *piGroupLengths,
- int32_t **ppiRMSEnvelope,
- float **ppfReal,
- float **ppfImag );
-static void ReplaceSign( const int32_t iNumBlocks, const int32_t iNumCQMFBands, int32_t **ppiSignReal, int32_t **ppiSignImag, float **ppfReal, float **ppfImag );
+/*------------------------------------------------------------------------------------------*
+ * Local function declarations
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
-static void
-InvQuantizeSpectrum( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, int32_t **ppiAlloc, int32_t **ppiQReal, int32_t **ppiQImag, float **ppfReal, float **ppfImag,
- NoiseGen *psNoiseGen ); // Nullable
+static void ApplyRMSEnvelope( const int32_t iNumBands, const int32_t *piBandwidths, const int32_t iNumGroups, const int32_t *piGroupLengths, int32_t **ppiRMSEnvelope, float **ppfReal, float **ppfImag );
+
+static void ReplaceSign( const int32_t iNumBlocks, const int32_t iNumLCLDBands, int32_t **ppiSignReal, int32_t **ppiSignImag, float **ppfReal, float **ppfImag );
+
+static void InvQuantizeSpectrum( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, int32_t **ppiAlloc, int32_t **ppiQReal, int32_t **ppiQImag, float **ppfReal, float **ppfImag, NoiseGen *psNoiseGen );
static void InvMSCoding( const int32_t iNumBlocks, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t iMSMode, const int32_t *piMSFlags, const int32_t *piLRPhaseDiffs, const int32_t *piMSPredCoefs, float ***pppfReal, float ***pppfImag );
-/* Currently only the number of bands in frame */
-static int32_t ReadHeaderInformation( int32_t *piNumBands,
- ivas_split_rend_bits_t *pBits );
+static int32_t ReadHeaderInformation( int32_t *piNumBands, ivas_split_rend_bits_t *pBits );
static int32_t ReadMSInformation( const int32_t iNumBands, int32_t *piMSMode, int32_t *piMSFlags, int32_t *piLRPhaseDiffs, int32_t *piMSPredCoefs, ivas_split_rend_bits_t *pBits );
-static int32_t ReadGroupInformation( const int32_t iChannels,
- const int32_t iNumBlocks,
- int32_t *piCommonGrouping,
- int32_t *piNumGroups,
- int32_t **ppiGroupLengths,
- ivas_split_rend_bits_t *pBits );
-
-static int32_t ReadHuff( const uint32_t ( *pauiHuffDecTable )[HUFF_DEC_TABLE_SIZE],
- int32_t *piSymbol,
- ivas_split_rend_bits_t *pBits );
-
-static int32_t ReadRMSEnvelope( const int32_t iChannels,
- const int32_t *piNumGroups,
- const int32_t iNumBands,
- int32_t ***pppiRMSEnvelope,
- ivas_split_rend_bits_t *pBits );
-static int32_t ReadAllocInformation( int32_t *piAllocOffset,
- ivas_split_rend_bits_t *pBits );
+static int32_t ReadGroupInformation( const int32_t iChannels, const int32_t iNumBlocks, int32_t *piCommonGrouping, int32_t *piNumGroups, int32_t **ppiGroupLengths, ivas_split_rend_bits_t *pBits );
+
+static int32_t ReadHuff( const uint32_t ( *pauiHuffDecTable )[HUFF_DEC_TABLE_SIZE], int32_t *piSymbol, ivas_split_rend_bits_t *pBits );
+
+static int32_t ReadRMSEnvelope( const int32_t iChannels, const int32_t *piNumGroups, const int32_t iNumBands, int32_t ***pppiRMSEnvelope, ivas_split_rend_bits_t *pBits );
+
+static int32_t ReadAllocInformation( int32_t *piAllocOffset, ivas_split_rend_bits_t *pBits );
+
#ifdef ROM_TO_RAM
static int32_t
-ReadCQMFData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t *piPredEnable, int32_t **ppiAlloc, int32_t **ppiSignReal, int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, ivas_split_rend_bits_t *pBits, uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE] );
+ReadLCLDData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t *piPredEnable, int32_t **ppiAlloc, int32_t **ppiSignReal, int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, ivas_split_rend_bits_t *pBits, uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE] );
#else
static int32_t
-ReadCQMFData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t *piPredEnable, int32_t **ppiAlloc, int32_t **ppiSignReal, int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, ivas_split_rend_bits_t *pBits );
+ReadLCLDData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t *piPredEnable, int32_t **ppiAlloc, int32_t **ppiSignReal, int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, ivas_split_rend_bits_t *pBits );
#endif
-static void ComputeAllocation( const int32_t iChannels,
- const int32_t *piNumGroups,
- const int32_t iNumBands,
- int32_t ***pppiSMR,
- const int32_t iAllocOffset,
- int32_t ***pppiAlloc );
-
-int32_t DecodeFrame( CQMFDecoder *psCQMFDecoder,
- ivas_split_rend_bits_t *pBits,
- float ***pppfCQMFReal,
- float ***pppfCQMFImag )
+static void ComputeAllocation( const int32_t iChannels, const int32_t *piNumGroups, const int32_t iNumBands, int32_t ***pppiSMR, const int32_t iAllocOffset, int32_t ***pppiAlloc );
+
+
+/*------------------------------------------------------------------------------------------*
+ * Function DecodeLCLDFrame()
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
+
+int32_t DecodeLCLDFrame(
+ LCLDDecoder *psLCLDDecoder,
+ ivas_split_rend_bits_t *pBits,
+ float ***pppfLCLDReal,
+ float ***pppfLCLDImag )
{
- int32_t n;
+ int32_t k, n;
- ReadHeaderInformation( &psCQMFDecoder->iNumBands, pBits );
+ ReadHeaderInformation( &psLCLDDecoder->iNumBands, pBits );
- if ( psCQMFDecoder->iChannels == 2 )
+ if ( psLCLDDecoder->iChannels == 2 )
{
- ReadMSInformation(
- psCQMFDecoder->iNumBands, &psCQMFDecoder->iMSMode,
- psCQMFDecoder->piMSFlags,
- psCQMFDecoder->piLRPhaseDiffs, psCQMFDecoder->piMSPredCoefs,
- pBits );
+ ReadMSInformation( psLCLDDecoder->iNumBands, &psLCLDDecoder->iMSMode, psLCLDDecoder->piMSFlags, psLCLDDecoder->piLRPhaseDiffs, psLCLDDecoder->piMSPredCoefs, pBits );
}
- ReadPredictors( psCQMFDecoder->psPredictionDecoder,
- pBits );
+ ReadPredictors( psLCLDDecoder->psPredictionDecoder, pBits );
- ReadGroupInformation(
- psCQMFDecoder->iChannels, psCQMFDecoder->iNumBlocks,
- &psCQMFDecoder->iCommonGrouping, psCQMFDecoder->piNumGroups,
- psCQMFDecoder->ppiGroupLengths,
- pBits );
+ ReadGroupInformation( psLCLDDecoder->iChannels, psLCLDDecoder->iNumBlocks, &psLCLDDecoder->iCommonGrouping, psLCLDDecoder->piNumGroups, psLCLDDecoder->ppiGroupLengths, pBits );
- ReadRMSEnvelope(
- psCQMFDecoder->iChannels, (const int32_t *) psCQMFDecoder->piNumGroups,
- psCQMFDecoder->iNumBands, psCQMFDecoder->pppiRMSEnvelope,
- pBits );
+ ReadRMSEnvelope( psLCLDDecoder->iChannels, (const int32_t *) psLCLDDecoder->piNumGroups, psLCLDDecoder->iNumBands, psLCLDDecoder->pppiRMSEnvelope, pBits );
#ifdef ENABLE_PMOD_ADJUST
- ReadPmodInformation( psCQMFDecoder->ppiHiSMRFlags, psCQMFDecoder->psBSRead,
- psCQMFDecoder->iChannels, psCQMFDecoder->iNumBands );
+ ReadPmodInformation( psLCLDDecoder->ppiHiSMRFlags, psLCLDDecoder->psBSRead, psLCLDDecoder->iChannels, psLCLDDecoder->iNumBands );
#endif
- ReadAllocInformation( &psCQMFDecoder->iAllocOffset,
- pBits );
+ ReadAllocInformation( &psLCLDDecoder->iAllocOffset, pBits );
- if ( psCQMFDecoder->iChannels == 2 &&
- psCQMFDecoder->iCommonGrouping == 1 )
- { // MS Mode?
- int32_t k;
- for ( k = 0; k < psCQMFDecoder->piNumGroups[0]; k++ )
+ if ( psLCLDDecoder->iChannels == 2 && psLCLDDecoder->iCommonGrouping == 1 )
+ { /* MS Mode? */
+ for ( k = 0; k < psLCLDDecoder->piNumGroups[0]; k++ )
{
- PerceptualModelStereo( psCQMFDecoder->iNumBands, psCQMFDecoder->piMSFlags,
- psCQMFDecoder->pppiRMSEnvelope[0][k],
- psCQMFDecoder->pppiRMSEnvelope[1][k],
- psCQMFDecoder->pppiExcitation[0][k],
- psCQMFDecoder->pppiExcitation[1][k],
- psCQMFDecoder->pppiSMR[0][k],
- psCQMFDecoder->pppiSMR[1][k] );
+ PerceptualModelStereo( psLCLDDecoder->iNumBands, psLCLDDecoder->piMSFlags,
+ psLCLDDecoder->pppiRMSEnvelope[0][k],
+ psLCLDDecoder->pppiRMSEnvelope[1][k],
+ psLCLDDecoder->pppiExcitation[0][k],
+ psLCLDDecoder->pppiExcitation[1][k],
+ psLCLDDecoder->pppiSMR[0][k],
+ psLCLDDecoder->pppiSMR[1][k] );
}
}
else
{
- for ( n = 0; n < psCQMFDecoder->iChannels;
- n++ )
+ for ( n = 0; n < psLCLDDecoder->iChannels; n++ )
{ // This will be updated to support multiple sample rates
- int32_t k;
- for ( k = 0; k < psCQMFDecoder->piNumGroups[n]; k++ )
+ for ( k = 0; k < psLCLDDecoder->piNumGroups[n]; k++ )
{
- PerceptualModel(
- psCQMFDecoder->iNumBands, psCQMFDecoder->pppiRMSEnvelope[n][k],
- psCQMFDecoder->pppiExcitation[n][k], psCQMFDecoder->pppiSMR[n][k] );
+ PerceptualModel( psLCLDDecoder->iNumBands, psLCLDDecoder->pppiRMSEnvelope[n][k], psLCLDDecoder->pppiExcitation[n][k], psLCLDDecoder->pppiSMR[n][k] );
}
}
}
- ComputeAllocation(
- psCQMFDecoder->iChannels, (const int32_t *) psCQMFDecoder->piNumGroups,
- psCQMFDecoder->iNumBands, psCQMFDecoder->pppiSMR,
- psCQMFDecoder->iAllocOffset, psCQMFDecoder->pppiAlloc );
+ ComputeAllocation( psLCLDDecoder->iChannels, (const int32_t *) psLCLDDecoder->piNumGroups, psLCLDDecoder->iNumBands, psLCLDDecoder->pppiSMR, psLCLDDecoder->iAllocOffset, psLCLDDecoder->pppiAlloc );
- for ( n = 0; n < psCQMFDecoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDDecoder->iChannels; n++ )
{
- ReadCQMFData(
- psCQMFDecoder->piNumGroups[n],
- (const int32_t *) psCQMFDecoder->ppiGroupLengths[n],
- psCQMFDecoder->iNumBands, psCQMFDecoder->piBandwidths,
+ ReadLCLDData(
+ psLCLDDecoder->piNumGroups[n],
+ (const int32_t *) psLCLDDecoder->ppiGroupLengths[n],
+ psLCLDDecoder->iNumBands, psLCLDDecoder->piBandwidths,
(const int32_t *)
- psCQMFDecoder->psPredictionDecoder->ppiPredBandEnable[n],
- psCQMFDecoder->pppiAlloc[n],
- psCQMFDecoder->pppiCQMFSignReal[n], psCQMFDecoder->pppiCQMFSignImag[n],
- psCQMFDecoder->pppiQCQMFReal[n], psCQMFDecoder->pppiQCQMFImag[n],
+ psLCLDDecoder->psPredictionDecoder->ppiPredBandEnable[n],
+ psLCLDDecoder->pppiAlloc[n],
+ psLCLDDecoder->pppiLCLDSignReal[n], psLCLDDecoder->pppiLCLDSignImag[n],
+ psLCLDDecoder->pppiQLCLDReal[n], psLCLDDecoder->pppiQLCLDImag[n],
pBits
#ifdef ROM_TO_RAM
,
- psCQMFDecoder->c_apauiHuffDecTable_RAM
+ psLCLDDecoder->c_apauiHuffDecTable_RAM
#endif
);
}
- for ( n = 0; n < psCQMFDecoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDDecoder->iChannels; n++ )
{
- InvQuantizeSpectrum( psCQMFDecoder->piNumGroups[n],
- (const int32_t *) psCQMFDecoder->ppiGroupLengths[n],
- psCQMFDecoder->iNumBands, psCQMFDecoder->piBandwidths,
- psCQMFDecoder->pppiAlloc[n],
- psCQMFDecoder->pppiQCQMFReal[n],
- psCQMFDecoder->pppiQCQMFImag[n],
- pppfCQMFReal[n], pppfCQMFImag[n],
- psCQMFDecoder->psNoiseGen );
-
- ReplaceSign( psCQMFDecoder->iNumBlocks, CQMF_BANDS,
- psCQMFDecoder->pppiCQMFSignReal[n],
- psCQMFDecoder->pppiCQMFSignImag[n],
- pppfCQMFReal[n], pppfCQMFImag[n] );
+ InvQuantizeSpectrum( psLCLDDecoder->piNumGroups[n],
+ (const int32_t *) psLCLDDecoder->ppiGroupLengths[n],
+ psLCLDDecoder->iNumBands, psLCLDDecoder->piBandwidths,
+ psLCLDDecoder->pppiAlloc[n],
+ psLCLDDecoder->pppiQLCLDReal[n],
+ psLCLDDecoder->pppiQLCLDImag[n],
+ pppfLCLDReal[n], pppfLCLDImag[n],
+ psLCLDDecoder->psNoiseGen );
+
+ ReplaceSign( psLCLDDecoder->iNumBlocks, LCLD_BANDS,
+ psLCLDDecoder->pppiLCLDSignReal[n],
+ psLCLDDecoder->pppiLCLDSignImag[n],
+ pppfLCLDReal[n], pppfLCLDImag[n] );
}
- ApplyInversePredictros( psCQMFDecoder->psPredictionDecoder, pppfCQMFReal,
- pppfCQMFImag );
+ ApplyInversePredictros( psLCLDDecoder->psPredictionDecoder, pppfLCLDReal, pppfLCLDImag );
- for ( n = 0; n < psCQMFDecoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDDecoder->iChannels; n++ )
{
- ApplyRMSEnvelope( psCQMFDecoder->iNumBands, psCQMFDecoder->piBandwidths,
- psCQMFDecoder->piNumGroups[n],
- (const int32_t *) psCQMFDecoder->ppiGroupLengths[n],
- psCQMFDecoder->pppiRMSEnvelope[n],
- pppfCQMFReal[n], pppfCQMFImag[n] );
+ ApplyRMSEnvelope( psLCLDDecoder->iNumBands, psLCLDDecoder->piBandwidths,
+ psLCLDDecoder->piNumGroups[n],
+ (const int32_t *) psLCLDDecoder->ppiGroupLengths[n],
+ psLCLDDecoder->pppiRMSEnvelope[n],
+ pppfLCLDReal[n], pppfLCLDImag[n] );
}
- if ( psCQMFDecoder->iChannels == 2 && psCQMFDecoder->iMSMode > 0 )
+ if ( psLCLDDecoder->iChannels == 2 && psLCLDDecoder->iMSMode > 0 )
{
- InvMSCoding( psCQMFDecoder->iNumBlocks, psCQMFDecoder->iNumBands,
- psCQMFDecoder->piBandwidths, psCQMFDecoder->iMSMode,
- (const int32_t *) psCQMFDecoder->piMSFlags,
- (const int32_t *) psCQMFDecoder->piLRPhaseDiffs,
- (const int32_t *) psCQMFDecoder->piMSPredCoefs,
- pppfCQMFReal, pppfCQMFImag );
+ InvMSCoding( psLCLDDecoder->iNumBlocks, psLCLDDecoder->iNumBands,
+ psLCLDDecoder->piBandwidths, psLCLDDecoder->iMSMode,
+ (const int32_t *) psLCLDDecoder->piMSFlags,
+ (const int32_t *) psLCLDDecoder->piLRPhaseDiffs,
+ (const int32_t *) psLCLDDecoder->piMSPredCoefs,
+ pppfLCLDReal, pppfLCLDImag );
}
return 0;
}
-static void ApplyRMSEnvelope( const int32_t iNumBands,
- const int32_t *piBandwidths,
- const int32_t iNumGroups,
- const int32_t *piGroupLengths,
- int32_t **ppiRMSEnvelope,
- float **ppfReal,
- float **ppfImag )
+
+/*------------------------------------------------------------------------------------------*
+ * Local functions
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
+
+static void ApplyRMSEnvelope(
+ const int32_t iNumBands,
+ const int32_t *piBandwidths,
+ const int32_t iNumGroups,
+ const int32_t *piGroupLengths,
+ int32_t **ppiRMSEnvelope,
+ float **ppfReal,
+ float **ppfImag )
{
- int32_t n;
- int32_t iBlockOffset;
+ int32_t b, k, n;
+ int32_t iBlockOffset, iFBOffset;
iBlockOffset = 0;
for ( n = 0; n < iNumGroups; n++ )
{
- int32_t k;
-
for ( k = 0; k < piGroupLengths[n]; k++ )
{
- int32_t b;
- int32_t iFBOffset;
iFBOffset = 0;
for ( b = 0; b < iNumBands; b++ )
{
@@ -900,28 +938,41 @@ static void ApplyRMSEnvelope( const int32_t iNumBands,
iBlockOffset++;
}
}
+
+ return;
}
-static void ReplaceSign( const int32_t iNumBlocks, const int32_t iNumCQMFBands, int32_t **ppiSignReal, int32_t **ppiSignImag, float **ppfReal, float **ppfImag )
+
+static void ReplaceSign(
+ const int32_t iNumBlocks,
+ const int32_t iNumLCLDBands,
+ int32_t **ppiSignReal,
+ int32_t **ppiSignImag,
+ float **ppfReal,
+ float **ppfImag )
{
- int32_t n;
+ int32_t b, n;
+
for ( n = 0; n < iNumBlocks; n++ )
{
- int32_t b;
- for ( b = 0; b < iNumCQMFBands; b++ )
+ for ( b = 0; b < iNumLCLDBands; b++ )
{
if ( ppiSignReal[n][b] == 1 )
{
ppfReal[n][b] = -ppfReal[n][b];
}
+
if ( ppiSignImag[n][b] == 1 )
{
ppfImag[n][b] = -ppfImag[n][b];
}
}
}
+
+ return;
}
+
static void InvQuantizeSpectrum(
const int32_t iNumGroups,
const int32_t *piGroupLengths,
@@ -932,20 +983,17 @@ static void InvQuantizeSpectrum(
int32_t **ppiQImag,
float **ppfReal,
float **ppfImag,
- NoiseGen *psNoiseGen ) // Pass in NULL to swicth off noise gen
+ NoiseGen *psNoiseGen /* Pass in NULL to switch off noise gen */
+)
{
- int32_t n;
- int32_t iBlockOffest;
+ int32_t b, k, n;
+ int32_t iBlockOffest, iFBOffset;
iBlockOffest = 0;
for ( n = 0; n < iNumGroups; n++ )
{
- int32_t k;
for ( k = 0; k < piGroupLengths[n]; k++ )
{
- int32_t b;
- int32_t iFBOffset;
-
iFBOffset = 0;
for ( b = 0; b < iNumBands; b++ )
{
@@ -990,9 +1038,21 @@ static void InvQuantizeSpectrum(
iBlockOffest++;
}
}
+
+ return;
}
-static void InvMSCoding( const int32_t iNumBlocks, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t iMSMode, const int32_t *piMSFlags, const int32_t *piLRPhaseDiffs, const int32_t *piMSPredCoefs, float ***pppfReal, float ***pppfImag )
+
+static void InvMSCoding(
+ const int32_t iNumBlocks,
+ const int32_t iNumBands,
+ const int32_t *piBandwidths,
+ const int32_t iMSMode,
+ const int32_t *piMSFlags,
+ const int32_t *piLRPhaseDiffs,
+ const int32_t *piMSPredCoefs,
+ float ***pppfReal,
+ float ***pppfImag )
{
if ( iMSMode > 0 )
{
@@ -1000,8 +1060,7 @@ static void InvMSCoding( const int32_t iNumBlocks, const int32_t iNumBands, cons
int32_t iFBOffset;
int32_t bms = 0;
#if defined SIMPLE_PHASE
- void( *pFuncPhaseRotateOptions[4] ) = { &rot_zero, &rot_m_pi_2, &rot_pm_pi,
- &rot_p_pi_2 };
+ void( *pFuncPhaseRotateOptions[4] ) = { &rot_zero, &rot_m_pi_2, &rot_pm_pi, &rot_p_pi_2 };
#endif
iFBOffset = 0;
@@ -1034,10 +1093,8 @@ static void InvMSCoding( const int32_t iNumBlocks, const int32_t iNumBands, cons
fLeftReal = ( pppfReal[0][k][iFBOffset] + pppfReal[1][k][iFBOffset] );
fLeftImag = ( pppfImag[0][k][iFBOffset] + pppfImag[1][k][iFBOffset] );
- fRightReal =
- ( pppfReal[0][k][iFBOffset] - pppfReal[1][k][iFBOffset] );
- fRightImag =
- ( pppfImag[0][k][iFBOffset] - pppfImag[1][k][iFBOffset] );
+ fRightReal = ( pppfReal[0][k][iFBOffset] - pppfReal[1][k][iFBOffset] );
+ fRightImag = ( pppfImag[0][k][iFBOffset] - pppfImag[1][k][iFBOffset] );
if ( iMSMode == 3 )
{
@@ -1046,8 +1103,7 @@ static void InvMSCoding( const int32_t iNumBlocks, const int32_t iNumBands, cons
#else
int32_t phaseIdx;
phaseIdx = piLRPhaseDiffs[bms] - PHASE_MIN_VAL;
- cplxmult( &fRightReal, &fRightImag, c_afRotRealImag[phaseIdx][0],
- -c_afRotRealImag[phaseIdx][1] );
+ cplxmult( &fRightReal, &fRightImag, c_afRotRealImag[phaseIdx][0], -c_afRotRealImag[phaseIdx][1] );
#endif
}
@@ -1067,11 +1123,15 @@ static void InvMSCoding( const int32_t iNumBlocks, const int32_t iNumBands, cons
}
}
}
+
+ return;
}
+
/* Currently only the number of bands in frame */
-static int32_t ReadHeaderInformation( int32_t *piNumBands,
- ivas_split_rend_bits_t *pBits )
+static int32_t ReadHeaderInformation(
+ int32_t *piNumBands,
+ ivas_split_rend_bits_t *pBits )
{
int32_t iBitsRead;
@@ -1082,7 +1142,14 @@ static int32_t ReadHeaderInformation( int32_t *piNumBands,
return iBitsRead;
}
-static int32_t ReadMSInformation( const int32_t iNumBands, int32_t *piMSMode, int32_t *piMSFlags, int32_t *piLRPhaseDiffs, int32_t *piMSPredCoefs, ivas_split_rend_bits_t *pBits )
+
+static int32_t ReadMSInformation(
+ const int32_t iNumBands,
+ int32_t *piMSMode,
+ int32_t *piMSFlags,
+ int32_t *piLRPhaseDiffs,
+ int32_t *piMSPredCoefs,
+ ivas_split_rend_bits_t *pBits )
{
int32_t iBitsRead;
@@ -1115,7 +1182,6 @@ static int32_t ReadMSInformation( const int32_t iNumBands, int32_t *piMSMode, in
iBitsRead += 1;
}
}
-
else if ( *piMSMode == 3 )
{
int32_t n;
@@ -1201,8 +1267,7 @@ static int32_t ReadMSInformation( const int32_t iNumBands, int32_t *piMSMode, in
{
fid = fopen( "ms_mode_dec.txt", "wt" );
}
- writeMSPred( piLRPhaseDiffs, piMSPredCoefs, *piMSMode, iNumMSPredBands,
- iNumBands, fid, piMSFlags );
+ writeMSPred( piLRPhaseDiffs, piMSPredCoefs, *piMSMode, iNumMSPredBands, iNumBands, fid, piMSFlags );
}
#endif
}
@@ -1214,10 +1279,16 @@ static int32_t ReadMSInformation( const int32_t iNumBands, int32_t *piMSMode, in
return iBitsRead;
}
-static int32_t
-ReadGroupInformation( const int32_t iChannels, const int32_t iNumBlocks, int32_t *piCommonGrouping, int32_t *piNumGroups, int32_t **ppiGroupLengths, ivas_split_rend_bits_t *pBits )
+
+static int32_t ReadGroupInformation(
+ const int32_t iChannels,
+ const int32_t iNumBlocks,
+ int32_t *piCommonGrouping,
+ int32_t *piNumGroups,
+ int32_t **ppiGroupLengths,
+ ivas_split_rend_bits_t *pBits )
{
- int32_t iBitsRead;
+ int32_t c, k, iBitsRead;
iBitsRead = 0;
if ( iChannels == 2 )
@@ -1227,8 +1298,6 @@ ReadGroupInformation( const int32_t iChannels, const int32_t iNumBlocks, int32_t
if ( *piCommonGrouping == 1 )
{
- int32_t k;
-
piNumGroups[0] = 0;
ppiGroupLengths[0][piNumGroups[0]] = 1;
for ( k = 0; k < ( iNumBlocks - 1 ); k++ )
@@ -1258,12 +1327,8 @@ ReadGroupInformation( const int32_t iChannels, const int32_t iNumBlocks, int32_t
}
else
{
- int32_t c;
-
for ( c = 0; c < iChannels; c++ )
{
- int32_t k;
-
piNumGroups[c] = 0;
ppiGroupLengths[c][piNumGroups[c]] = 1;
for ( k = 0; k < ( iNumBlocks - 1 ); k++ )
@@ -1289,12 +1354,8 @@ ReadGroupInformation( const int32_t iChannels, const int32_t iNumBlocks, int32_t
}
else
{
- int32_t c;
-
for ( c = 0; c < iChannels; c++ )
{
- int32_t k;
-
piNumGroups[c] = 0;
ppiGroupLengths[c][piNumGroups[c]] = 1;
for ( k = 0; k < ( iNumBlocks - 1 ); k++ )
@@ -1321,9 +1382,11 @@ ReadGroupInformation( const int32_t iChannels, const int32_t iNumBlocks, int32_t
return iBitsRead;
}
-static int32_t ReadHuff( const uint32_t ( *pauiHuffDecTable )[HUFF_DEC_TABLE_SIZE],
- int32_t *piSymbol,
- ivas_split_rend_bits_t *pBits )
+
+static int32_t ReadHuff(
+ const uint32_t ( *pauiHuffDecTable )[HUFF_DEC_TABLE_SIZE],
+ int32_t *piSymbol,
+ ivas_split_rend_bits_t *pBits )
{
int32_t iBitsRead;
int32_t iSymbol;
@@ -1347,9 +1410,7 @@ static int32_t ReadHuff( const uint32_t ( *pauiHuffDecTable )[HUFF_DEC_TABLE_SIZ
if ( iVal )
{
- BSForceBack(
- pBits,
- iIndex, iVal );
+ BSForceBack( pBits, iIndex, iVal );
iBitsRead -= iVal;
}
@@ -1358,24 +1419,22 @@ static int32_t ReadHuff( const uint32_t ( *pauiHuffDecTable )[HUFF_DEC_TABLE_SIZ
return iBitsRead;
}
-static int32_t ReadRMSEnvelope( const int32_t iChannels,
- const int32_t *piNumGroups,
- const int32_t iNumBands,
- int32_t ***pppiRMSEnvelope,
- ivas_split_rend_bits_t *pBits )
+
+static int32_t ReadRMSEnvelope(
+ const int32_t iChannels,
+ const int32_t *piNumGroups,
+ const int32_t iNumBands,
+ int32_t ***pppiRMSEnvelope,
+ ivas_split_rend_bits_t *pBits )
{
- int32_t n;
- int32_t iBitsRead;
+ int32_t b, k, n;
+ int32_t iBitsRead, iLastRMSVal;
iBitsRead = 0;
for ( n = 0; n < iChannels; n++ )
{
- int32_t k;
for ( k = 0; k < piNumGroups[n]; k++ )
{
- int32_t b;
- int32_t iLastRMSVal;
-
iLastRMSVal = ivas_split_rend_bitstream_read_int32( pBits, ENV0_BITS );
iBitsRead += ENV0_BITS;
@@ -1397,6 +1456,7 @@ static int32_t ReadRMSEnvelope( const int32_t iChannels,
return iBitsRead;
}
+
#ifdef ENABLE_PMOD_ADJUST
static int32_t ReadPmodInformation( int32_t **ppiHiSMRFlags, Bitstream *psBSRead, int32_t iChannels, int32_t iNumBands )
{
@@ -1413,7 +1473,6 @@ static int32_t ReadPmodInformation( int32_t **ppiHiSMRFlags, Bitstream *psBSRead
for ( b = 0; b < iNumBands; b++ )
{
ppiHiSMRFlags[c][b] = BSGetBits( psBSRead, 1 );
- ;
iBitsRead += 1;
}
}
@@ -1453,8 +1512,10 @@ static int32_t ReadPmodInformation( int32_t **ppiHiSMRFlags, Bitstream *psBSRead
}
#endif
-static int32_t ReadAllocInformation( int32_t *piAllocOffset,
- ivas_split_rend_bits_t *pBits )
+
+static int32_t ReadAllocInformation(
+ int32_t *piAllocOffset,
+ ivas_split_rend_bits_t *pBits )
{
int32_t iBitsRead;
@@ -1466,35 +1527,47 @@ static int32_t ReadAllocInformation( int32_t *piAllocOffset,
return iBitsRead;
}
#ifdef ROM_TO_RAM
-static int32_t
-ReadCQMFData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t *piPredEnable, int32_t **ppiAlloc, int32_t **ppiSignReal, int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, ivas_split_rend_bits_t *pBits, uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE] )
+static int32_t ReadLCLDData(
+ const int32_t iNumGroups,
+ const int32_t *piGroupLengths,
+ const int32_t iNumBands,
+ const int32_t *piBandwidths,
+ const int32_t *piPredEnable,
+ int32_t **ppiAlloc,
+ int32_t **ppiSignReal,
+ int32_t **ppiSignImag,
+ int32_t **ppiQReal,
+ int32_t **ppiQImag,
+ ivas_split_rend_bits_t *pBits,
+ uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE] )
#else
-static int32_t
-ReadCQMFData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t *piPredEnable, int32_t **ppiAlloc, int32_t **ppiSignReal, int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, ivas_split_rend_bits_t *pBits )
+static int32_t ReadLCLDData(
+ const int32_t iNumGroups,
+ const int32_t *piGroupLengths,
+ const int32_t iNumBands,
+ const int32_t *piBandwidths,
+ const int32_t *piPredEnable,
+ int32_t **ppiAlloc,
+ int32_t **ppiSignReal,
+ int32_t **ppiSignImag,
+ int32_t **ppiQReal,
+ int32_t **ppiQImag,
+ ivas_split_rend_bits_t *pBits )
#endif
{
- int32_t n;
- int32_t iBitsRead;
- int32_t iBlockOffest;
+ int32_t b, k, m, n;
+ int32_t iBitsRead, iBlockOffest, iFBOffset;
+ int32_t iAlloc, iHuffDim, iHuffMod;
iBitsRead = 0;
iBlockOffest = 0;
for ( n = 0; n < iNumGroups; n++ )
{
- int32_t k;
for ( k = 0; k < piGroupLengths[n]; k++ )
{
- int32_t b;
- int32_t iFBOffset;
-
iFBOffset = 0;
for ( b = 0; b < iNumBands; b++ )
{
- int32_t m;
- int32_t iAlloc;
- int32_t iHuffDim;
- int32_t iHuffMod;
-
iAlloc = ppiAlloc[n][b];
iHuffDim = c_aiHuffmanDim[iAlloc];
@@ -1538,12 +1611,8 @@ ReadCQMFData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int
}
else
{
- iBitsRead +=
- ReadHuff( pauiHuffmanTableDPCM, &iQuantValue1,
- pBits );
- iBitsRead +=
- ReadHuff( pauiHuffmanTableDPCM, &iQuantValue2,
- pBits );
+ iBitsRead += ReadHuff( pauiHuffmanTableDPCM, &iQuantValue1, pBits );
+ iBitsRead += ReadHuff( pauiHuffmanTableDPCM, &iQuantValue2, pBits );
}
}
else
@@ -1552,8 +1621,7 @@ ReadCQMFData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int
{
int32_t iSymbol;
- iBitsRead += ReadHuff( pauiHuffmanTable, &iSymbol,
- pBits );
+ iBitsRead += ReadHuff( pauiHuffmanTable, &iSymbol, pBits );
#ifdef USE_DEMOD_TABLES
iQuantValue1 = paiDemodTable[iSymbol][0];
iQuantValue2 = paiDemodTable[iSymbol][1];
@@ -1564,12 +1632,8 @@ ReadCQMFData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int
}
else
{
- iBitsRead +=
- ReadHuff( pauiHuffmanTable, &iQuantValue1,
- pBits );
- iBitsRead +=
- ReadHuff( pauiHuffmanTable, &iQuantValue2,
- pBits );
+ iBitsRead += ReadHuff( pauiHuffmanTable, &iQuantValue1, pBits );
+ iBitsRead += ReadHuff( pauiHuffmanTable, &iQuantValue2, pBits );
}
}
@@ -1616,24 +1680,23 @@ ReadCQMFData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int
return iBitsRead;
}
-static void ComputeAllocation( const int32_t iChannels,
- const int32_t *piNumGroups,
- const int32_t iNumBands,
- int32_t ***pppiSMR,
- const int32_t iAllocOffset,
- int32_t ***pppiAlloc )
+
+static void ComputeAllocation(
+ const int32_t iChannels,
+ const int32_t *piNumGroups,
+ const int32_t iNumBands,
+ int32_t ***pppiSMR,
+ const int32_t iAllocOffset,
+ int32_t ***pppiAlloc )
{
- int32_t n;
+ int32_t b, k, n, iAlloc;
for ( n = 0; n < iChannels; n++ )
{
- int32_t k;
for ( k = 0; k < piNumGroups[n]; k++ )
{
- int32_t b;
for ( b = 0; b < iNumBands; b++ )
{
- int32_t iAlloc;
iAlloc = ( ( pppiSMR[n][k][b] + iAllocOffset * ALLOC_OFFSET_SCALE ) >> 5 );
iAlloc = ( iAlloc > MIN_ALLOC ) ? iAlloc : MIN_ALLOC;
iAlloc = ( iAlloc < MAX_ALLOC ) ? iAlloc : MAX_ALLOC;
@@ -1641,5 +1704,7 @@ static void ComputeAllocation( const int32_t iChannels,
}
}
}
+
+ return;
}
#endif
diff --git a/lib_rend/ivas_CQMFEncoder.c b/lib_rend/ivas_lcld_encoder.c
similarity index 58%
rename from lib_rend/ivas_CQMFEncoder.c
rename to lib_rend/ivas_lcld_encoder.c
index 0a7205e4734cfc965b15ff848f497af4a59006fe..c7ae7a291fef9a5d919b423b2a59f04243ea483a 100644
--- a/lib_rend/ivas_CQMFEncoder.c
+++ b/lib_rend/ivas_lcld_encoder.c
@@ -1,6 +1,6 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -30,27 +30,28 @@
*******************************************************************************************************/
-#include "ivas_CQMFEncoder.h"
+#include
#include "options.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
-#include
#include
-#include
#include
-#include "ivas_lcld_tables.h"
+#include "ivas_lcld_prot.h"
+#include "ivas_lcld_rom_tables.h"
#include "prot.h"
-#include "ivas_RMSEnvGrouping.h"
-#include "ivas_PerceptualModel.h"
#include "ivas_cldfb_codec_bitstream.h"
#include "ivas_prot_rend.h"
-#include "ivas_MSPred.h"
#ifdef ENABLE_PMOD_ADJUST
#include "ton_corr.h"
#endif
-#include "ivas_PredEncoder.h"
#include "wmc_auto.h"
-struct CQMF_ENCODER
+#define ENCODER_ERROR_NONE ( 0 ) // todo: not really used
+
+/*------------------------------------------------------------------------------------------*
+ * Local structures
+ *------------------------------------------------------------------------------------------*/
+
+struct LCLD_ENCODER
{
int32_t iSampleRate;
int32_t iChannels;
@@ -85,572 +86,659 @@ struct CQMF_ENCODER
int32_t iAllocOffset;
- int32_t ***pppiCQMFSignReal;
- int32_t ***pppiCQMFSignImag;
- int32_t ***pppiQCQMFReal;
- int32_t ***pppiQCQMFImag;
+ int32_t ***pppiLCLDSignReal;
+ int32_t ***pppiLCLDSignImag;
+ int32_t ***pppiQLCLDReal;
+ int32_t ***pppiQLCLDImag;
PredictionEncoder *psPredictionEncoder;
int32_t iLastError;
};
-CQMFEncoder *CreateCQMFEncoder( const int32_t iSampleRate,
- const int32_t iChannels,
- const int32_t iTargetBitRate,
- const int32_t iAllowSidePred )
+
+/*------------------------------------------------------------------------------------------*
+ * Function CreateLCLDEncoder()
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
+
+ivas_error CreateLCLDEncoder(
+ LCLDEncoder **psLCLDEncoder_out,
+ const int32_t iSampleRate,
+ const int32_t iChannels,
+ const int32_t iTargetBitRate,
+ const int32_t iAllowSidePred )
{
int32_t n;
- CQMFEncoder *psCQMFEncoder = NULL;
+ LCLDEncoder *psLCLDEncoder;
+ ivas_error error;
assert( iSampleRate == 48000 ); // Fix
- psCQMFEncoder = (CQMFEncoder *) malloc( sizeof( CQMFEncoder ) );
- psCQMFEncoder->iSampleRate = iSampleRate;
- psCQMFEncoder->iChannels = iChannels;
- psCQMFEncoder->iNumBlocks = CQMF_BLOCKS_PER_FRAME;
- psCQMFEncoder->iAllocOffset = 0;
+ if ( ( psLCLDEncoder = (LCLDEncoder *) malloc( sizeof( LCLDEncoder ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
- psCQMFEncoder->iTargetBitRate = iTargetBitRate;
- psCQMFEncoder->iTargetBitsPerFrame = iTargetBitRate * CQMF_BLOCKS_PER_FRAME * CQMF_BANDS / iSampleRate;
+ psLCLDEncoder->iSampleRate = iSampleRate;
+ psLCLDEncoder->iChannels = iChannels;
+ psLCLDEncoder->iNumBlocks = LCLD_BLOCKS_PER_FRAME;
+ psLCLDEncoder->iAllocOffset = 0;
- psCQMFEncoder->iNumBands = MAX_BANDS_48; // Fix
- psCQMFEncoder->piBandwidths = c_aiBandwidths48; // Fix
+ psLCLDEncoder->iTargetBitRate = iTargetBitRate;
+ psLCLDEncoder->iTargetBitsPerFrame = iTargetBitRate * LCLD_BLOCKS_PER_FRAME * LCLD_BANDS / iSampleRate;
- psCQMFEncoder->iMSMode = 0;
- psCQMFEncoder->piMSFlags = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) );
+ psLCLDEncoder->iNumBands = MAX_BANDS_48; // Fix
+ psLCLDEncoder->piBandwidths = c_aiBandwidths48; // Fix
+
+ psLCLDEncoder->iMSMode = 0;
+ if ( ( psLCLDEncoder->piMSFlags = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
for ( n = 0; n < MAX_BANDS; n++ )
{
- psCQMFEncoder->piLRPhaseDiffs[n] = 0;
- psCQMFEncoder->piMSPredCoefs[n] = 0;
+ psLCLDEncoder->piLRPhaseDiffs[n] = 0;
+ psLCLDEncoder->piMSPredCoefs[n] = 0;
+ }
+ psLCLDEncoder->iAllowSidePred = iAllowSidePred;
+
+ psLCLDEncoder->psRMSEnvelopeGrouping = CreateRMSEnvelopeGrouping( psLCLDEncoder->iNumBlocks );
+
+ psLCLDEncoder->iCommonGrouping = 1; //*Common grouping always on only impacts stereo */
+ if ( ( psLCLDEncoder->piNumGroups = (int32_t *) malloc( psLCLDEncoder->iChannels * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->ppiGroupLengths = (int32_t **) malloc( psLCLDEncoder->iChannels * sizeof( int32_t * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiRMSEnvelope = (int32_t ***) malloc( psLCLDEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiSMR = (int32_t ***) malloc( psLCLDEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiExcitation = (int32_t ***) malloc( psLCLDEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiAlloc = (int32_t ***) malloc( psLCLDEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+
+ if ( ( psLCLDEncoder->pppiLCLDSignReal = (int32_t ***) malloc( psLCLDEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiLCLDSignImag = (int32_t ***) malloc( psLCLDEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiQLCLDReal = (int32_t ***) malloc( psLCLDEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiQLCLDImag = (int32_t ***) malloc( psLCLDEncoder->iChannels * sizeof( int32_t ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
}
- psCQMFEncoder->iAllowSidePred = iAllowSidePred;
-
- psCQMFEncoder->psRMSEnvelopeGrouping = CreateRMSEnvelopeGrouping( psCQMFEncoder->iNumBlocks );
-
- psCQMFEncoder->iCommonGrouping = 1; // Common grouping always on only impacts stereo
- psCQMFEncoder->piNumGroups = (int32_t *) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ) );
- psCQMFEncoder->ppiGroupLengths = (int32_t **) malloc( psCQMFEncoder->iChannels * sizeof( int32_t * ) );
- psCQMFEncoder->pppiRMSEnvelope = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) );
- psCQMFEncoder->pppiSMR = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) );
- psCQMFEncoder->pppiExcitation = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) );
- psCQMFEncoder->pppiAlloc = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) );
-
- psCQMFEncoder->pppiCQMFSignReal = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) );
- psCQMFEncoder->pppiCQMFSignImag = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) );
- psCQMFEncoder->pppiQCQMFReal = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) );
- psCQMFEncoder->pppiQCQMFImag = (int32_t ***) malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) );
#ifdef ENABLE_PMOD_ADJUST
- psCQMFEncoder->ppiHiSMRFlags = (int32_t **) malloc( psCQMFEncoder->iChannels * sizeof( int32_t * ) );
+ if ( ( psLCLDEncoder->ppiHiSMRFlags = (int32_t **) malloc( psLCLDEncoder->iChannels * sizeof( int32_t * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
#endif
+
for ( n = 0; n < iChannels; n++ )
{
int32_t k;
#ifdef ENABLE_PMOD_ADJUST
- psCQMFEncoder->ppiHiSMRFlags[n] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) );
- ;
+ if ( ( psLCLDEncoder->ppiHiSMRFlags[n] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
#endif
- psCQMFEncoder->ppiGroupLengths[n] = (int32_t *) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t ) );
- psCQMFEncoder->pppiRMSEnvelope[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) );
- psCQMFEncoder->pppiSMR[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) );
- psCQMFEncoder->pppiExcitation[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) );
- psCQMFEncoder->pppiAlloc[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) );
-
- psCQMFEncoder->pppiCQMFSignReal[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) );
- psCQMFEncoder->pppiCQMFSignImag[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) );
- psCQMFEncoder->pppiQCQMFReal[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) );
- psCQMFEncoder->pppiQCQMFImag[n] = (int32_t **) malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) );
- for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ )
- {
- psCQMFEncoder->pppiRMSEnvelope[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) );
- psCQMFEncoder->pppiSMR[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) );
- psCQMFEncoder->pppiExcitation[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) );
- psCQMFEncoder->pppiAlloc[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) );
-
- psCQMFEncoder->pppiCQMFSignReal[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) );
- psCQMFEncoder->pppiCQMFSignImag[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) );
- psCQMFEncoder->pppiQCQMFReal[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) );
- psCQMFEncoder->pppiQCQMFImag[n][k] = (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) );
+ if ( ( psLCLDEncoder->ppiGroupLengths[n] = (int32_t *) malloc( LCLD_BLOCKS_PER_FRAME * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiRMSEnvelope[n] = (int32_t **) malloc( LCLD_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiSMR[n] = (int32_t **) malloc( LCLD_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiExcitation[n] = (int32_t **) malloc( LCLD_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiAlloc[n] = (int32_t **) malloc( LCLD_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+
+ if ( ( psLCLDEncoder->pppiLCLDSignReal[n] = (int32_t **) malloc( LCLD_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiLCLDSignImag[n] = (int32_t **) malloc( LCLD_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiQLCLDReal[n] = (int32_t **) malloc( LCLD_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiQLCLDImag[n] = (int32_t **) malloc( LCLD_BLOCKS_PER_FRAME * sizeof( int32_t * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ for ( k = 0; k < LCLD_BLOCKS_PER_FRAME; k++ )
+ {
+ if ( ( psLCLDEncoder->pppiRMSEnvelope[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiSMR[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiExcitation[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiAlloc[n][k] = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+
+ if ( ( psLCLDEncoder->pppiLCLDSignReal[n][k] = (int32_t *) malloc( LCLD_BANDS * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiLCLDSignImag[n][k] = (int32_t *) malloc( LCLD_BANDS * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiQLCLDReal[n][k] = (int32_t *) malloc( LCLD_BANDS * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ if ( ( psLCLDEncoder->pppiQLCLDImag[n][k] = (int32_t *) malloc( LCLD_BANDS * sizeof( int32_t ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
}
}
- psCQMFEncoder->psPredictionEncoder = CreatePredictionEncoder( iChannels, psCQMFEncoder->iNumBlocks );
- psCQMFEncoder->iLastError = ENCODER_ERROR_NONE;
+ if ( ( error = CreatePredictionEncoder( &( psLCLDEncoder->psPredictionEncoder ), iChannels, psLCLDEncoder->iNumBlocks ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+
+ psLCLDEncoder->iLastError = ENCODER_ERROR_NONE;
+
+ *psLCLDEncoder_out = psLCLDEncoder;
- return psCQMFEncoder;
+ return IVAS_ERR_OK;
}
-void DeleteCQMFEncoder( CQMFEncoder *psCQMFEncoder )
+
+/*------------------------------------------------------------------------------------------*
+ * Function DeleteLCLDEncoder()
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
+
+void DeleteLCLDEncoder(
+ LCLDEncoder *psLCLDEncoder )
{
- if ( psCQMFEncoder != NULL )
+ int32_t k, n;
+
+ if ( psLCLDEncoder != NULL )
{
- if ( psCQMFEncoder->piMSFlags != NULL )
+ if ( psLCLDEncoder->piMSFlags != NULL )
{
- free( psCQMFEncoder->piMSFlags );
+ free( psLCLDEncoder->piMSFlags );
}
- if ( psCQMFEncoder->piNumGroups != NULL )
+ if ( psLCLDEncoder->piNumGroups != NULL )
{
- free( psCQMFEncoder->piNumGroups );
+ free( psLCLDEncoder->piNumGroups );
}
- if ( psCQMFEncoder->psRMSEnvelopeGrouping != NULL )
+ if ( psLCLDEncoder->psRMSEnvelopeGrouping != NULL )
{
- DeleteRMSEnvelopeGrouping( psCQMFEncoder->psRMSEnvelopeGrouping );
+ DeleteRMSEnvelopeGrouping( psLCLDEncoder->psRMSEnvelopeGrouping );
}
- if ( psCQMFEncoder->ppiGroupLengths != NULL )
+ if ( psLCLDEncoder->ppiGroupLengths != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFEncoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDEncoder->iChannels; n++ )
{
- free( psCQMFEncoder->ppiGroupLengths[n] );
+ free( psLCLDEncoder->ppiGroupLengths[n] );
}
- free( psCQMFEncoder->ppiGroupLengths );
+ free( psLCLDEncoder->ppiGroupLengths );
}
#ifdef ENABLE_PMOD_ADJUST
- if ( psCQMFEncoder->ppiHiSMRFlags != NULL )
+ if ( psLCLDEncoder->ppiHiSMRFlags != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFEncoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDEncoder->iChannels; n++ )
{
- free( psCQMFEncoder->ppiHiSMRFlags[n] );
+ free( psLCLDEncoder->ppiHiSMRFlags[n] );
}
- free( psCQMFEncoder->ppiHiSMRFlags );
+ free( psLCLDEncoder->ppiHiSMRFlags );
}
#endif
- if ( psCQMFEncoder->pppiRMSEnvelope != NULL )
+ if ( psLCLDEncoder->pppiRMSEnvelope != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFEncoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDEncoder->iChannels; n++ )
{
- int32_t k;
- for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ )
+ for ( k = 0; k < LCLD_BLOCKS_PER_FRAME; k++ )
{
- free( psCQMFEncoder->pppiRMSEnvelope[n][k] );
+ free( psLCLDEncoder->pppiRMSEnvelope[n][k] );
}
- free( psCQMFEncoder->pppiRMSEnvelope[n] );
+ free( psLCLDEncoder->pppiRMSEnvelope[n] );
}
- free( psCQMFEncoder->pppiRMSEnvelope );
+ free( psLCLDEncoder->pppiRMSEnvelope );
}
- if ( psCQMFEncoder->pppiSMR != NULL )
+ if ( psLCLDEncoder->pppiSMR != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFEncoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDEncoder->iChannels; n++ )
{
- int32_t k;
- for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ )
+ for ( k = 0; k < LCLD_BLOCKS_PER_FRAME; k++ )
{
- free( psCQMFEncoder->pppiSMR[n][k] );
+ free( psLCLDEncoder->pppiSMR[n][k] );
}
- free( psCQMFEncoder->pppiSMR[n] );
+ free( psLCLDEncoder->pppiSMR[n] );
}
- free( psCQMFEncoder->pppiSMR );
+ free( psLCLDEncoder->pppiSMR );
}
- if ( psCQMFEncoder->pppiExcitation != NULL )
+ if ( psLCLDEncoder->pppiExcitation != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFEncoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDEncoder->iChannels; n++ )
{
- int32_t k;
- for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ )
+ for ( k = 0; k < LCLD_BLOCKS_PER_FRAME; k++ )
{
- free( psCQMFEncoder->pppiExcitation[n][k] );
+ free( psLCLDEncoder->pppiExcitation[n][k] );
}
- free( psCQMFEncoder->pppiExcitation[n] );
+ free( psLCLDEncoder->pppiExcitation[n] );
}
- free( psCQMFEncoder->pppiExcitation );
+ free( psLCLDEncoder->pppiExcitation );
}
- if ( psCQMFEncoder->pppiAlloc != NULL )
+ if ( psLCLDEncoder->pppiAlloc != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFEncoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDEncoder->iChannels; n++ )
{
- int32_t k;
- for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ )
+ for ( k = 0; k < LCLD_BLOCKS_PER_FRAME; k++ )
{
- free( psCQMFEncoder->pppiAlloc[n][k] );
+ free( psLCLDEncoder->pppiAlloc[n][k] );
}
- free( psCQMFEncoder->pppiAlloc[n] );
+ free( psLCLDEncoder->pppiAlloc[n] );
}
- free( psCQMFEncoder->pppiAlloc );
+ free( psLCLDEncoder->pppiAlloc );
}
- if ( psCQMFEncoder->pppiCQMFSignReal != NULL )
+ if ( psLCLDEncoder->pppiLCLDSignReal != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFEncoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDEncoder->iChannels; n++ )
{
- int32_t k;
- for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ )
+ for ( k = 0; k < LCLD_BLOCKS_PER_FRAME; k++ )
{
- free( psCQMFEncoder->pppiCQMFSignReal[n][k] );
+ free( psLCLDEncoder->pppiLCLDSignReal[n][k] );
}
- free( psCQMFEncoder->pppiCQMFSignReal[n] );
+ free( psLCLDEncoder->pppiLCLDSignReal[n] );
}
- free( psCQMFEncoder->pppiCQMFSignReal );
+ free( psLCLDEncoder->pppiLCLDSignReal );
}
- if ( psCQMFEncoder->pppiCQMFSignImag != NULL )
+ if ( psLCLDEncoder->pppiLCLDSignImag != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFEncoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDEncoder->iChannels; n++ )
{
- int32_t k;
- for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ )
+ for ( k = 0; k < LCLD_BLOCKS_PER_FRAME; k++ )
{
- free( psCQMFEncoder->pppiCQMFSignImag[n][k] );
+ free( psLCLDEncoder->pppiLCLDSignImag[n][k] );
}
- free( psCQMFEncoder->pppiCQMFSignImag[n] );
+ free( psLCLDEncoder->pppiLCLDSignImag[n] );
}
- free( psCQMFEncoder->pppiCQMFSignImag );
+ free( psLCLDEncoder->pppiLCLDSignImag );
}
- if ( psCQMFEncoder->pppiQCQMFReal != NULL )
+ if ( psLCLDEncoder->pppiQLCLDReal != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFEncoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDEncoder->iChannels; n++ )
{
- int32_t k;
- for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ )
+ for ( k = 0; k < LCLD_BLOCKS_PER_FRAME; k++ )
{
- free( psCQMFEncoder->pppiQCQMFReal[n][k] );
+ free( psLCLDEncoder->pppiQLCLDReal[n][k] );
}
- free( psCQMFEncoder->pppiQCQMFReal[n] );
+ free( psLCLDEncoder->pppiQLCLDReal[n] );
}
- free( psCQMFEncoder->pppiQCQMFReal );
+ free( psLCLDEncoder->pppiQLCLDReal );
}
- if ( psCQMFEncoder->pppiQCQMFImag != NULL )
+ if ( psLCLDEncoder->pppiQLCLDImag != NULL )
{
- int32_t n;
- for ( n = 0; n < psCQMFEncoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDEncoder->iChannels; n++ )
{
- int32_t k;
- for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ )
+ for ( k = 0; k < LCLD_BLOCKS_PER_FRAME; k++ )
{
- free( psCQMFEncoder->pppiQCQMFImag[n][k] );
+ free( psLCLDEncoder->pppiQLCLDImag[n][k] );
}
- free( psCQMFEncoder->pppiQCQMFImag[n] );
+ free( psLCLDEncoder->pppiQLCLDImag[n] );
}
- free( psCQMFEncoder->pppiQCQMFImag );
+ free( psLCLDEncoder->pppiQLCLDImag );
}
-
- DeletePredictionEncoder( psCQMFEncoder->psPredictionEncoder );
- free( psCQMFEncoder );
+ DeletePredictionEncoder( psLCLDEncoder->psPredictionEncoder );
+ free( psLCLDEncoder );
}
+
+ return;
}
-int32_t CQMFEncoderGetError( CQMFEncoder *psCQMFEncoder )
+
+/*------------------------------------------------------------------------------------------*
+ * Function LCLDEncoderGetError()
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
+
+int32_t LCLDEncoderGetError( LCLDEncoder *psLCLDEncoder )
{
- return psCQMFEncoder->iLastError;
+ return psLCLDEncoder->iLastError;
}
-static int32_t MSModeCalculation( const int32_t iNumBlocks,
- const int32_t iNumBands,
- const int32_t *piBandwidths,
- float ***pppfReal,
- float ***pppfImag,
- int32_t *piMSMode,
- int32_t *piLRPhaseDiff,
- int32_t *piMSPredCoef,
- const int32_t iAllowSidePred,
- int32_t *piMSFlags );
-
-static void RemoveRMSEnvelope( const int32_t iNumBands,
- const int32_t *piBandwidths,
- const int32_t iNumGroups,
- const int32_t *piGroupLengths,
- int32_t **ppiRMSEnvelope,
- float **ppfReal,
- float **ppfImag );
-
-
-static int32_t CountCQMFBits( const int32_t iNumGroups,
- const int32_t *piGroupLengths,
- const int32_t iNumBands,
- const int32_t *piBandwidths,
- const int32_t *piPredEnable,
- int32_t **ppiAlloc,
- int32_t **ppiQReal,
- int32_t **ppiQImag );
-/* Currently only the number of bands in frame */
-static int32_t WriteHeaderInformation( const int32_t iNumBands,
- ivas_split_rend_bits_t *pBits );
-
-static int32_t WritePmodInformation( const int32_t **ppiHiSMRFlags,
- Bitstream *psBSWrite,
- int32_t iChannels,
- int32_t iNumBands );
-
-static int32_t WriteMSInformation( const int32_t iNumBands,
- const int32_t iMSMode,
- const int32_t *piMSFlags,
- const int32_t *piLRPhaseDiffs,
- const int32_t *piMSPredCoefs,
- int32_t iNumMSPredBands,
- ivas_split_rend_bits_t *pBits );
-
-static int32_t WriteGroupInformation( const int32_t iChannels,
- const int32_t iCommonGrouping,
- const int32_t *piNumGroups,
- int32_t **ppiGroupLengths,
- ivas_split_rend_bits_t *pBits );
+/*------------------------------------------------------------------------------------------*
+ * Local function declarations
+ *------------------------------------------------------------------------------------------*/
+
+static int32_t MSModeCalculation( const int32_t iNumBlocks, const int32_t iNumBands, const int32_t *piBandwidths, float ***pppfReal, float ***pppfImag, int32_t *piMSMode, int32_t *piLRPhaseDiff, int32_t *piMSPredCoef, const int32_t iAllowSidePred, int32_t *piMSFlags );
+
+static void RemoveRMSEnvelope( const int32_t iNumBands, const int32_t *piBandwidths, const int32_t iNumGroups, const int32_t *piGroupLengths, int32_t **ppiRMSEnvelope, float **ppfReal, float **ppfImag );
+
+static int32_t CountLCLDBits( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t *piPredEnable, int32_t **ppiAlloc, int32_t **ppiQReal, int32_t **ppiQImag );
+
+static int32_t WriteHeaderInformation( const int32_t iNumBands, ivas_split_rend_bits_t *pBits );
+
+static int32_t WritePmodInformation( const int32_t **ppiHiSMRFlags, Bitstream *psBSWrite, int32_t iChannels, int32_t iNumBands );
-static int32_t WriteRMSEnvelope( const int32_t iChannels,
- const int32_t *piNumGroups,
- const int32_t iNumBands,
- int32_t ***pppiRMSEnvelope,
- ivas_split_rend_bits_t *pBits );
+static int32_t WriteMSInformation( const int32_t iNumBands, const int32_t iMSMode, const int32_t *piMSFlags, const int32_t *piLRPhaseDiffs, const int32_t *piMSPredCoefs, int32_t iNumMSPredBands, ivas_split_rend_bits_t *pBits );
+
+static int32_t WriteGroupInformation( const int32_t iChannels, const int32_t iCommonGrouping, const int32_t *piNumGroups, int32_t **ppiGroupLengths, ivas_split_rend_bits_t *pBits );
+
+static int32_t WriteRMSEnvelope( const int32_t iChannels, const int32_t *piNumGroups, const int32_t iNumBands, int32_t ***pppiRMSEnvelope, ivas_split_rend_bits_t *pBits );
static int32_t WriteAllocInformation( const int32_t iAllocOffset,
ivas_split_rend_bits_t *pBits );
-static int32_t WriteCQMFData( const int32_t iNumGroups,
- const int32_t *piGroupLengths,
- const int32_t iNumBands,
- const int32_t *piBandwidths,
- const int32_t *piPredEnable,
- int32_t **ppiAlloc,
- int32_t **ppiSignReal,
- int32_t **ppiSignImag,
- int32_t **ppiQReal,
- int32_t **ppiQImag,
- ivas_split_rend_bits_t *pBits );
-
-static int32_t ComputeAllocation( const int32_t iChannels,
- const int32_t *piNumGroups,
- int32_t **ppiGroupLengths,
- const int32_t iNumBands,
- const int32_t *piBandwidths,
- float ***pppfReal,
- float ***pppfImag,
- int32_t ***pppiSMR,
- const int32_t iAvailableBits,
- int32_t *piAllocOffset,
- int32_t ***pppiAlloc,
- int32_t ***pppiQReal,
- int32_t ***pppiQImag,
- int32_t ***pppiSignReal,
- int32_t ***pppiSignImag,
- int32_t **ppiPredEnable,
- float **ppfA1Real,
- float **ppfA1Imag );
-
-int32_t EncodeFrame( CQMFEncoder *psCQMFEncoder, float ***pppfCQMFReal, float ***pppfCQMFImag, int32_t *piBitsWritten, const int32_t available_bits, ivas_split_rend_bits_t *pBits )
+static int32_t WriteLCLDData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t *piPredEnable, int32_t **ppiAlloc, int32_t **ppiSignReal, int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, ivas_split_rend_bits_t *pBits );
+
+static int32_t ComputeAllocation( const int32_t iChannels, const int32_t *piNumGroups, int32_t **ppiGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, float ***pppfReal, float ***pppfImag, int32_t ***pppiSMR, const int32_t iAvailableBits, int32_t *piAllocOffset, int32_t ***pppiAlloc, int32_t ***pppiQReal, int32_t ***pppiQImag, int32_t ***pppiSignReal, int32_t ***pppiSignImag, int32_t **ppiPredEnable, float **ppfA1Real, float **ppfA1Imag );
+
+
+/*------------------------------------------------------------------------------------------*
+ * Function EncodeLCLDFrame()
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
+
+int32_t EncodeLCLDFrame(
+ LCLDEncoder *psLCLDEncoder,
+ float ***pppfLCLDReal,
+ float ***pppfLCLDImag,
+ int32_t *piBitsWritten,
+ const int32_t available_bits,
+ ivas_split_rend_bits_t *pBits )
{
int32_t n;
int32_t iAvailableBits, iBitsWritten;
- // int32_t iCQMFBits;
int32_t iNumMSBands = 0;
iAvailableBits = available_bits; // HCBR for now
iBitsWritten = 0;
/* Do MS calc here */
- if ( psCQMFEncoder->iChannels == 2 )
+ if ( psLCLDEncoder->iChannels == 2 )
{
- iNumMSBands = MSModeCalculation( psCQMFEncoder->iNumBlocks,
- psCQMFEncoder->iNumBands,
- psCQMFEncoder->piBandwidths,
- pppfCQMFReal,
- pppfCQMFImag,
- &psCQMFEncoder->iMSMode,
- psCQMFEncoder->piLRPhaseDiffs,
- psCQMFEncoder->piMSPredCoefs,
- psCQMFEncoder->iAllowSidePred,
- psCQMFEncoder->piMSFlags );
-
- if ( psCQMFEncoder->iMSMode > 0 )
+ iNumMSBands = MSModeCalculation( psLCLDEncoder->iNumBlocks,
+ psLCLDEncoder->iNumBands,
+ psLCLDEncoder->piBandwidths,
+ pppfLCLDReal,
+ pppfLCLDImag,
+ &psLCLDEncoder->iMSMode,
+ psLCLDEncoder->piLRPhaseDiffs,
+ psLCLDEncoder->piMSPredCoefs,
+ psLCLDEncoder->iAllowSidePred,
+ psLCLDEncoder->piMSFlags );
+
+ if ( psLCLDEncoder->iMSMode > 0 )
{
- psCQMFEncoder->iCommonGrouping = 1; // Make sure common grouping is enabled when MS is in use
+ psLCLDEncoder->iCommonGrouping = 1; // Make sure common grouping is enabled when MS is in use
}
}
#ifdef ENABLE_PMOD_ADJUST
- CalcTonQuotas( psCQMFEncoder->iChannels, psCQMFEncoder->iNumBands, psCQMFEncoder->piBandwidths, pppfCQMFReal, pppfCQMFImag, psCQMFEncoder->ppiHiSMRFlags );
+ CalcTonQuotas( psLCLDEncoder->iChannels, psLCLDEncoder->iNumBands, psLCLDEncoder->piBandwidths, pppfLCLDReal, pppfLCLDImag, psLCLDEncoder->ppiHiSMRFlags );
#endif
/* Compute Grouping and RMS Envelopes */
- if ( psCQMFEncoder->iChannels == 2 && psCQMFEncoder->iCommonGrouping == 1 )
+ if ( psLCLDEncoder->iChannels == 2 && psLCLDEncoder->iCommonGrouping == 1 )
{
- ComputeEnvelopeGrouping( psCQMFEncoder->psRMSEnvelopeGrouping,
- psCQMFEncoder->iChannels,
- psCQMFEncoder->iNumBands,
- psCQMFEncoder->piBandwidths,
- pppfCQMFReal,
- pppfCQMFImag,
- &psCQMFEncoder->piNumGroups[0],
- psCQMFEncoder->ppiGroupLengths[0],
- psCQMFEncoder->pppiRMSEnvelope );
-
- psCQMFEncoder->piNumGroups[1] = psCQMFEncoder->piNumGroups[0];
- for ( n = 0; n < psCQMFEncoder->piNumGroups[0]; n++ )
+ ComputeEnvelopeGrouping( psLCLDEncoder->psRMSEnvelopeGrouping,
+ psLCLDEncoder->iChannels,
+ psLCLDEncoder->iNumBands,
+ psLCLDEncoder->piBandwidths,
+ pppfLCLDReal,
+ pppfLCLDImag,
+ &psLCLDEncoder->piNumGroups[0],
+ psLCLDEncoder->ppiGroupLengths[0],
+ psLCLDEncoder->pppiRMSEnvelope );
+
+ psLCLDEncoder->piNumGroups[1] = psLCLDEncoder->piNumGroups[0];
+ for ( n = 0; n < psLCLDEncoder->piNumGroups[0]; n++ )
{
- psCQMFEncoder->ppiGroupLengths[1][n] = psCQMFEncoder->ppiGroupLengths[0][n];
+ psLCLDEncoder->ppiGroupLengths[1][n] = psLCLDEncoder->ppiGroupLengths[0][n];
}
}
else
{
- for ( n = 0; n < psCQMFEncoder->iChannels; n++ )
- {
- ComputeEnvelopeGrouping( psCQMFEncoder->psRMSEnvelopeGrouping,
- psCQMFEncoder->iChannels,
- psCQMFEncoder->iNumBands,
- psCQMFEncoder->piBandwidths,
- &pppfCQMFReal[n],
- &pppfCQMFImag[n],
- &psCQMFEncoder->piNumGroups[n],
- psCQMFEncoder->ppiGroupLengths[n],
- &psCQMFEncoder->pppiRMSEnvelope[n] );
+ for ( n = 0; n < psLCLDEncoder->iChannels; n++ )
+ {
+ ComputeEnvelopeGrouping( psLCLDEncoder->psRMSEnvelopeGrouping,
+ psLCLDEncoder->iChannels,
+ psLCLDEncoder->iNumBands,
+ psLCLDEncoder->piBandwidths,
+ &pppfLCLDReal[n],
+ &pppfLCLDImag[n],
+ &psLCLDEncoder->piNumGroups[n],
+ psLCLDEncoder->ppiGroupLengths[n],
+ &psLCLDEncoder->pppiRMSEnvelope[n] );
}
}
- for ( n = 0; n < psCQMFEncoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDEncoder->iChannels; n++ )
{
- RemoveRMSEnvelope( psCQMFEncoder->iNumBands,
- psCQMFEncoder->piBandwidths,
- psCQMFEncoder->piNumGroups[n],
- (const int32_t *) psCQMFEncoder->ppiGroupLengths[n],
- psCQMFEncoder->pppiRMSEnvelope[n],
- pppfCQMFReal[n],
- pppfCQMFImag[n] );
+ RemoveRMSEnvelope( psLCLDEncoder->iNumBands,
+ psLCLDEncoder->piBandwidths,
+ psLCLDEncoder->piNumGroups[n],
+ (const int32_t *) psLCLDEncoder->ppiGroupLengths[n],
+ psLCLDEncoder->pppiRMSEnvelope[n],
+ pppfLCLDReal[n],
+ pppfLCLDImag[n] );
}
- ComputePredictors( psCQMFEncoder->psPredictionEncoder,
- pppfCQMFReal,
- pppfCQMFImag );
+ ComputePredictors( psLCLDEncoder->psPredictionEncoder, pppfLCLDReal, pppfLCLDImag );
- iBitsWritten += WriteHeaderInformation( psCQMFEncoder->iNumBands,
- pBits );
+ iBitsWritten += WriteHeaderInformation( psLCLDEncoder->iNumBands, pBits );
- if ( psCQMFEncoder->iChannels == 2 )
+ if ( psLCLDEncoder->iChannels == 2 )
{
- iBitsWritten += WriteMSInformation( psCQMFEncoder->iNumBands,
- psCQMFEncoder->iMSMode,
- (const int32_t *) psCQMFEncoder->piMSFlags,
- (const int32_t *) psCQMFEncoder->piLRPhaseDiffs,
- (const int32_t *) psCQMFEncoder->piMSPredCoefs,
+ iBitsWritten += WriteMSInformation( psLCLDEncoder->iNumBands,
+ psLCLDEncoder->iMSMode,
+ (const int32_t *) psLCLDEncoder->piMSFlags,
+ (const int32_t *) psLCLDEncoder->piLRPhaseDiffs,
+ (const int32_t *) psLCLDEncoder->piMSPredCoefs,
iNumMSBands,
pBits );
}
- iBitsWritten += WritePredictors( psCQMFEncoder->psPredictionEncoder,
- pBits );
+ iBitsWritten += WritePredictors( psLCLDEncoder->psPredictionEncoder, pBits );
- iBitsWritten += WriteGroupInformation( psCQMFEncoder->iChannels,
- psCQMFEncoder->iCommonGrouping,
- (const int32_t *) psCQMFEncoder->piNumGroups,
- psCQMFEncoder->ppiGroupLengths,
- pBits );
+ iBitsWritten += WriteGroupInformation( psLCLDEncoder->iChannels, psLCLDEncoder->iCommonGrouping, (const int32_t *) psLCLDEncoder->piNumGroups, psLCLDEncoder->ppiGroupLengths, pBits );
- iBitsWritten += WriteRMSEnvelope( psCQMFEncoder->iChannels,
- (const int32_t *) psCQMFEncoder->piNumGroups,
- psCQMFEncoder->iNumBands,
- psCQMFEncoder->pppiRMSEnvelope,
- pBits );
+ iBitsWritten += WriteRMSEnvelope( psLCLDEncoder->iChannels, (const int32_t *) psLCLDEncoder->piNumGroups, psLCLDEncoder->iNumBands, psLCLDEncoder->pppiRMSEnvelope, pBits );
#ifdef ENABLE_PMOD_ADJUST
- iBitsWritten += WritePmodInformation( psCQMFEncoder->ppiHiSMRFlags,
- psCQMFEncoder->psBSWrite,
- psCQMFEncoder->iChannels,
- psCQMFEncoder->iNumBands );
+ iBitsWritten += WritePmodInformation( psLCLDEncoder->ppiHiSMRFlags,
+ psLCLDEncoder->psBSWrite,
+ psLCLDEncoder->iChannels,
+ psLCLDEncoder->iNumBands );
#endif
- if ( psCQMFEncoder->iChannels == 2 && psCQMFEncoder->iCommonGrouping == 1 )
+ if ( psLCLDEncoder->iChannels == 2 && psLCLDEncoder->iCommonGrouping == 1 )
{
int32_t k;
- for ( k = 0; k < psCQMFEncoder->piNumGroups[0]; k++ )
+ for ( k = 0; k < psLCLDEncoder->piNumGroups[0]; k++ )
{
- PerceptualModelStereo( psCQMFEncoder->iNumBands,
- psCQMFEncoder->piMSFlags,
- psCQMFEncoder->pppiRMSEnvelope[0][k],
- psCQMFEncoder->pppiRMSEnvelope[1][k],
- psCQMFEncoder->pppiExcitation[0][k],
- psCQMFEncoder->pppiExcitation[1][k],
- psCQMFEncoder->pppiSMR[0][k],
- psCQMFEncoder->pppiSMR[1][k] );
+ PerceptualModelStereo( psLCLDEncoder->iNumBands,
+ psLCLDEncoder->piMSFlags,
+ psLCLDEncoder->pppiRMSEnvelope[0][k],
+ psLCLDEncoder->pppiRMSEnvelope[1][k],
+ psLCLDEncoder->pppiExcitation[0][k],
+ psLCLDEncoder->pppiExcitation[1][k],
+ psLCLDEncoder->pppiSMR[0][k],
+ psLCLDEncoder->pppiSMR[1][k] );
}
}
else
{
- for ( n = 0; n < psCQMFEncoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDEncoder->iChannels; n++ )
{
int32_t k;
- for ( k = 0; k < psCQMFEncoder->piNumGroups[n]; k++ )
+ for ( k = 0; k < psLCLDEncoder->piNumGroups[n]; k++ )
{
- PerceptualModel( psCQMFEncoder->iNumBands,
- psCQMFEncoder->pppiRMSEnvelope[n][k],
- psCQMFEncoder->pppiExcitation[n][k],
- psCQMFEncoder->pppiSMR[n][k] );
+ PerceptualModel( psLCLDEncoder->iNumBands,
+ psLCLDEncoder->pppiRMSEnvelope[n][k],
+ psLCLDEncoder->pppiExcitation[n][k],
+ psLCLDEncoder->pppiSMR[n][k] );
}
}
}
iAvailableBits -= iBitsWritten;
- ComputeAllocation( psCQMFEncoder->iChannels,
- (const int32_t *) psCQMFEncoder->piNumGroups,
- psCQMFEncoder->ppiGroupLengths,
- psCQMFEncoder->iNumBands,
- psCQMFEncoder->piBandwidths,
- pppfCQMFReal,
- pppfCQMFImag,
- psCQMFEncoder->pppiSMR,
+ ComputeAllocation( psLCLDEncoder->iChannels,
+ (const int32_t *) psLCLDEncoder->piNumGroups,
+ psLCLDEncoder->ppiGroupLengths,
+ psLCLDEncoder->iNumBands,
+ psLCLDEncoder->piBandwidths,
+ pppfLCLDReal,
+ pppfLCLDImag,
+ psLCLDEncoder->pppiSMR,
iAvailableBits,
- &psCQMFEncoder->iAllocOffset,
- psCQMFEncoder->pppiAlloc,
- psCQMFEncoder->pppiQCQMFReal,
- psCQMFEncoder->pppiQCQMFImag,
- psCQMFEncoder->pppiCQMFSignReal,
- psCQMFEncoder->pppiCQMFSignImag,
- psCQMFEncoder->psPredictionEncoder->ppiPredBandEnable,
- psCQMFEncoder->psPredictionEncoder->ppfA1Real,
- psCQMFEncoder->psPredictionEncoder->ppfA1Imag );
-
- iBitsWritten += WriteAllocInformation( psCQMFEncoder->iAllocOffset,
+ &psLCLDEncoder->iAllocOffset,
+ psLCLDEncoder->pppiAlloc,
+ psLCLDEncoder->pppiQLCLDReal,
+ psLCLDEncoder->pppiQLCLDImag,
+ psLCLDEncoder->pppiLCLDSignReal,
+ psLCLDEncoder->pppiLCLDSignImag,
+ psLCLDEncoder->psPredictionEncoder->ppiPredBandEnable,
+ psLCLDEncoder->psPredictionEncoder->ppfA1Real,
+ psLCLDEncoder->psPredictionEncoder->ppfA1Imag );
+
+ iBitsWritten += WriteAllocInformation( psLCLDEncoder->iAllocOffset,
pBits );
- for ( n = 0; n < psCQMFEncoder->iChannels; n++ )
+ for ( n = 0; n < psLCLDEncoder->iChannels; n++ )
{
- iBitsWritten += WriteCQMFData( psCQMFEncoder->piNumGroups[n],
- (const int32_t *) psCQMFEncoder->ppiGroupLengths[n],
- psCQMFEncoder->iNumBands,
- psCQMFEncoder->piBandwidths,
- (const int32_t *) psCQMFEncoder->psPredictionEncoder->ppiPredBandEnable[n],
- psCQMFEncoder->pppiAlloc[n],
- psCQMFEncoder->pppiCQMFSignReal[n],
- psCQMFEncoder->pppiCQMFSignImag[n],
- psCQMFEncoder->pppiQCQMFReal[n],
- psCQMFEncoder->pppiQCQMFImag[n],
+ iBitsWritten += WriteLCLDData( psLCLDEncoder->piNumGroups[n],
+ (const int32_t *) psLCLDEncoder->ppiGroupLengths[n],
+ psLCLDEncoder->iNumBands,
+ psLCLDEncoder->piBandwidths,
+ (const int32_t *) psLCLDEncoder->psPredictionEncoder->ppiPredBandEnable[n],
+ psLCLDEncoder->pppiAlloc[n],
+ psLCLDEncoder->pppiLCLDSignReal[n],
+ psLCLDEncoder->pppiLCLDSignImag[n],
+ psLCLDEncoder->pppiQLCLDReal[n],
+ psLCLDEncoder->pppiQLCLDImag[n],
pBits );
}
*piBitsWritten = iBitsWritten;
+
return 0;
}
-int32_t GetNumGroups( CQMFEncoder *psCQMFEncoder )
+
+/*------------------------------------------------------------------------------------------*
+ * Function GetNumGroups()
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
+
+int32_t GetNumGroups( LCLDEncoder *psLCLDEncoder )
{
- return psCQMFEncoder->piNumGroups[0];
+ return psLCLDEncoder->piNumGroups[0];
}
-static int32_t MSModeCalculation( const int32_t iNumBlocks,
- const int32_t iNumBands,
- const int32_t *piBandwidths,
- float ***pppfReal,
- float ***pppfImag,
- int32_t *piMSMode,
- int32_t *piLRPhaseDiffs,
- int32_t *piMSPredCoefs,
- const int32_t iAllowSidePred,
- int32_t *piMSFlags )
+
+/*------------------------------------------------------------------------------------------*
+ * Local functions
+ *
+ *
+ *------------------------------------------------------------------------------------------*/
+
+static int32_t MSModeCalculation(
+ const int32_t iNumBlocks,
+ const int32_t iNumBands,
+ const int32_t *piBandwidths,
+ float ***pppfReal,
+ float ***pppfImag,
+ int32_t *piMSMode,
+ int32_t *piLRPhaseDiffs,
+ int32_t *piMSPredCoefs,
+ const int32_t iAllowSidePred,
+ int32_t *piMSFlags )
{
int32_t b;
int32_t iFBOffset;
@@ -666,6 +754,7 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks,
void( *pFuncPhaseRotateOptions[4] ) = { &rot_zero, &rot_p_pi_2, &rot_pm_pi, &rot_m_pi_2 };
#endif
const float one_by_log10_2 = 3.32192809488736f;
+
*piMSMode = 0;
iFBOffset = 0;
iNumMSBands = 0;
@@ -722,7 +811,7 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks,
/* compute L/R phase difference if high coherence */
if ( fLRCovReal * fLRCovReal + fLRCovImag * fLRCovImag > 0.5f * fLeftEnergy * fRightEnergy )
{
- float fPhase = (float) atan2( fLRCovImag, fLRCovReal );
+ float fPhase = (float) atan2( fLRCovImag, fLRCovReal ); // ToDo: replace by atan2f()
iPhase = quantPhase( fPhase );
}
else
@@ -751,7 +840,7 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks,
/* evaluation */
fSideEnergyPred += ( fPred * fPred * fMidEnergyPred - 2.0f * fPred * 0.25f * ( fLeftEnergy - fRightEnergy ) );
/* -= fPred * fPred * fMidEnergyPred doesn't work because fPred is quantized and does not match MS/MM exactly */
- fMSPredRatio = (float) log10f( ( fMidEnergyPred + 1e-12f ) / ( fSideEnergyPred + 1e-12f ) );
+ fMSPredRatio = log10f( ( fMidEnergyPred + 1e-12f ) / ( fSideEnergyPred + 1e-12f ) );
fLeftEnergy = log10f( fLeftEnergy + 1e-12f );
fRightEnergy = log10f( fRightEnergy + 1e-12f );
@@ -791,6 +880,7 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks,
float maskThresShift_dB_by_10 = ( fMSRatio - fLRRatio ) * (float) c_aiDefaultTheta48[b] / 16.0f;
msBitsReduction += (float) ( piBandwidths[b] * iNumBlocks * 2 ) * one_by_log10_2 * maskThresShift_dB_by_10; /* * 2 for real/imag */
}
+
if ( fMSPredRatio > fLRRatio )
{
float maskThresShift_dB_by_10 = ( fMSPredRatio - fLRRatio ) * (float) c_aiDefaultTheta48[b] / 16.0f;
@@ -818,6 +908,7 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks,
fprintf( fid, "%.1f %.1f %d %d\n", msBitsReduction, msPredBitsReduction, msBits, msPredBits );
}
#endif
+
if ( iAllowSidePred && msPredBitsReduction > 1.1f * msBitsReduction )
{
*piMSMode = 3;
@@ -827,9 +918,7 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks,
}
iNumMSBands = iNumMSPredBands;
}
- else
-
- if ( iNumMSBands == iNumBands )
+ else if ( iNumMSBands == iNumBands )
{
*piMSMode = 1;
}
@@ -947,32 +1036,28 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks,
return iNumMSBands;
}
-static void RemoveRMSEnvelope( const int32_t iNumBands,
- const int32_t *piBandwidths,
- const int32_t iNumGroups,
- const int32_t *piGroupLengths,
- int32_t **ppiRMSEnvelope,
- float **ppfReal,
- float **ppfImag )
+
+static void RemoveRMSEnvelope(
+ const int32_t iNumBands,
+ const int32_t *piBandwidths,
+ const int32_t iNumGroups,
+ const int32_t *piGroupLengths,
+ int32_t **ppiRMSEnvelope,
+ float **ppfReal,
+ float **ppfImag )
{
- int32_t n;
+ int32_t k, n, b, iFBOffset, m, iRMSEnv;
int32_t iBlockOffset;
+ float fGain;
iBlockOffset = 0;
for ( n = 0; n < iNumGroups; n++ )
{
- int32_t k;
for ( k = 0; k < piGroupLengths[n]; k++ )
{
- int32_t b;
- int32_t iFBOffset;
iFBOffset = 0;
for ( b = 0; b < iNumBands; b++ )
{
- int32_t m;
- int32_t iRMSEnv;
- float fGain;
-
iRMSEnv = ppiRMSEnvelope[n][b];
fGain = c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_CENTER - iRMSEnv];
for ( m = 0; m < piBandwidths[b]; m++ )
@@ -985,50 +1070,43 @@ static void RemoveRMSEnvelope( const int32_t iNumBands,
iBlockOffset++;
}
}
+
+ return;
}
-static void QuantizeSpectrumDPCM_Opt( const int32_t iNumGroups,
- const int32_t *piGroupLengths,
- const int32_t iNumBands,
- const int32_t *piBandwidths,
- int32_t **ppiAlloc,
- float **ppfReal,
- float **ppfImag,
- int32_t **ppiQReal,
- int32_t **ppiQImag,
- int32_t **ppiSignReal,
- int32_t **ppiSignImag,
- int32_t *piPredEnable,
- float *pfA1Real,
- float *pfA1Imag ) // Pass in 2 previous value buffers NULLABLE
-{
- int32_t b;
+static void QuantizeSpectrumDPCM_Opt(
+ const int32_t iNumGroups,
+ const int32_t *piGroupLengths,
+ const int32_t iNumBands,
+ const int32_t *piBandwidths,
+ int32_t **ppiAlloc,
+ float **ppfReal,
+ float **ppfImag,
+ int32_t **ppiQReal,
+ int32_t **ppiQImag,
+ int32_t **ppiSignReal,
+ int32_t **ppiSignImag,
+ int32_t *piPredEnable,
+ float *pfA1Real,
+ float *pfA1Imag ) /* Pass in 2 previous value buffers NULLABLE */
+{
+ int32_t b, m, n, iBlockOffset;
+ float fVal, fPrevReal, fPrevImag, fPredReal, fPredImag;
int32_t iFBOffset;
+ int32_t k, iAlloc, iQuantValue, iMaxQuantVal;
+ float fSCFGain, fInvSCFGain;
iFBOffset = 0;
for ( b = 0; b < iNumBands; b++ )
{
- int32_t m;
for ( m = 0; m < piBandwidths[b]; m++ )
{
- int32_t n;
- int32_t iBlockOffset;
- float fPrevReal;
- float fPrevImag;
-
iBlockOffset = 0;
fPrevReal = 0.0;
fPrevImag = 0.0;
for ( n = 0; n < iNumGroups; n++ )
{
- int32_t k;
- int32_t iAlloc;
- int32_t iMaxQuantVal;
- float fSCFGain;
- float fInvSCFGain;
-
-
iAlloc = ppiAlloc[n][b];
iMaxQuantVal = c_aiQuantMaxValues[iAlloc];
fSCFGain = c_afScaleFactor[iAlloc];
@@ -1038,10 +1116,8 @@ static void QuantizeSpectrumDPCM_Opt( const int32_t iNumGroups,
{
for ( k = 0; k < piGroupLengths[n]; k++ )
{
- int32_t iQuantValue;
- float fPredReal = 0.0;
- float fPredImag = 0.0;
- float fVal;
+ fPredReal = 0.0;
+ fPredImag = 0.0;
fPredReal = pfA1Real[iFBOffset] * fPrevReal - pfA1Imag[iFBOffset] * fPrevImag;
fPredImag = pfA1Real[iFBOffset] * fPrevImag + pfA1Imag[iFBOffset] * fPrevReal;
@@ -1101,9 +1177,6 @@ static void QuantizeSpectrumDPCM_Opt( const int32_t iNumGroups,
{
for ( k = 0; k < piGroupLengths[n]; k++ )
{
- int32_t iQuantValue;
- float fVal;
-
fVal = ppfReal[iBlockOffset][iFBOffset];
if ( fVal > 0.0 )
{
@@ -1140,48 +1213,43 @@ static void QuantizeSpectrumDPCM_Opt( const int32_t iNumGroups,
iFBOffset++;
}
}
+
+ return;
}
-static void QuantizeSpectrumDPCM( const int32_t iNumGroups,
- const int32_t *piGroupLengths,
- const int32_t iNumBands,
- const int32_t *piBandwidths,
- int32_t **ppiAlloc,
- float **ppfReal,
- float **ppfImag,
- int32_t **ppiQReal,
- int32_t **ppiQImag,
- int32_t **ppiSignReal,
- int32_t **ppiSignImag,
- int32_t *piPredEnable,
- float *pfA1Real,
- float *pfA1Imag ) // Pass in 2 previous value buffers NULLABLE
+
+static void QuantizeSpectrumDPCM(
+ const int32_t iNumGroups,
+ const int32_t *piGroupLengths,
+ const int32_t iNumBands,
+ const int32_t *piBandwidths,
+ int32_t **ppiAlloc,
+ float **ppfReal,
+ float **ppfImag,
+ int32_t **ppiQReal,
+ int32_t **ppiQImag,
+ int32_t **ppiSignReal,
+ int32_t **ppiSignImag,
+ int32_t *piPredEnable,
+ float *pfA1Real,
+ float *pfA1Imag ) /* Pass in 2 previous value buffers NULLABLE */
{
- int32_t b;
+ int32_t b, m, n, iBlockOffset;
+ float fVal, fPrevReal, fPrevImag, fPredReal, fPredImag;
int32_t iFBOffset;
+ int32_t k, iAlloc, iQuantValue, iMaxQuantVal;
+ float fSCFGain, fInvSCFGain;
iFBOffset = 0;
for ( b = 0; b < iNumBands; b++ )
{
- int32_t m;
for ( m = 0; m < piBandwidths[b]; m++ )
{
- int32_t n;
- int32_t iBlockOffset;
- float fPrevReal;
- float fPrevImag;
-
iBlockOffset = 0;
fPrevReal = 0.0;
fPrevImag = 0.0;
for ( n = 0; n < iNumGroups; n++ )
{
- int32_t k;
- int32_t iAlloc;
- int32_t iMaxQuantVal;
- float fSCFGain;
- float fInvSCFGain;
-
iAlloc = ppiAlloc[n][b];
iMaxQuantVal = c_aiQuantMaxValues[iAlloc];
@@ -1190,10 +1258,8 @@ static void QuantizeSpectrumDPCM( const int32_t iNumGroups,
for ( k = 0; k < piGroupLengths[n]; k++ )
{
- int32_t iQuantValue;
- float fPredReal = 0.0;
- float fPredImag = 0.0;
- float fVal;
+ fPredReal = 0.0;
+ fPredImag = 0.0;
if ( piPredEnable[iFBOffset] == 1 )
{
@@ -1272,7 +1338,7 @@ static void QuantizeSpectrumDPCM( const int32_t iNumGroups,
}
}
else
- { // don't need
+ { // don't need // ToDo ?
fPrevReal = 0.0;
fPrevImag = 0.0;
}
@@ -1284,45 +1350,39 @@ static void QuantizeSpectrumDPCM( const int32_t iNumGroups,
iFBOffset++;
}
}
+
+ return;
}
-static int32_t CountCQMFBits( const int32_t iNumGroups,
- const int32_t *piGroupLengths,
- const int32_t iNumBands,
- const int32_t *piBandwidths,
- const int32_t *piPredEnable,
- int32_t **ppiAlloc,
- int32_t **ppiQReal,
- int32_t **ppiQImag )
+
+static int32_t CountLCLDBits(
+ const int32_t iNumGroups,
+ const int32_t *piGroupLengths,
+ const int32_t iNumBands,
+ const int32_t *piBandwidths,
+ const int32_t *piPredEnable,
+ int32_t **ppiAlloc,
+ int32_t **ppiQReal,
+ int32_t **ppiQImag )
{
- int32_t n;
- int32_t iBits;
- int32_t iBlockOffest;
+ int32_t k, n, b, iFBOffset;
+ int32_t iBits, iBlockOffest;
+ int32_t m, iAlloc, iHuffDim, iHuffMod;
iBits = 0;
iBlockOffest = 0;
for ( n = 0; n < iNumGroups; n++ )
{
- int32_t k;
for ( k = 0; k < piGroupLengths[n]; k++ )
{
- int32_t b;
- int32_t iFBOffset;
-
iFBOffset = 0;
for ( b = 0; b < iNumBands; b++ )
{
- int32_t m;
- int32_t iAlloc;
- int32_t iHuffDim;
- int32_t iHuffMod;
-
iAlloc = ppiAlloc[n][b];
iHuffDim = c_aiHuffmanDim[iAlloc];
iHuffMod = c_aiHuffmanMod[iAlloc];
-
if ( iAlloc > 0 )
{
#ifndef ROM_TO_RAM
@@ -1332,7 +1392,6 @@ static int32_t CountCQMFBits( const int32_t iNumGroups,
const uint16_t( *pauiHuffmanTable )[2] = NULL;
const uint16_t( *pauiHuffmanTableDPCM )[2] = NULL;
#endif
- // pauiHuffmanTable = GetHuffEncTable(iAlloc);
pauiHuffmanTable = c_apauiHuffEncTabels[iAlloc];
pauiHuffmanTableDPCM = c_apauiHuffEncTabels[ALLOC_TABLE_SIZE + iAlloc];
for ( m = 0; m < piBandwidths[b]; m++ )
@@ -1343,8 +1402,8 @@ static int32_t CountCQMFBits( const int32_t iNumGroups,
iQuantValue1 = ppiQReal[iBlockOffest][iFBOffset];
iQuantValue2 = ppiQImag[iBlockOffest][iFBOffset];
- iBits += ( iQuantValue1 > 0 ) ? 1 : 0; // Sign bit for vals > 0
- iBits += ( iQuantValue2 > 0 ) ? 1 : 0; // Sign bit for vals > 0
+ iBits += ( iQuantValue1 > 0 ) ? 1 : 0; /* Sign bit for vals > 0 */
+ iBits += ( iQuantValue2 > 0 ) ? 1 : 0; /* Sign bit for vals > 0 */
if ( piPredEnable[iFBOffset] == 1 )
{
@@ -1391,9 +1450,11 @@ static int32_t CountCQMFBits( const int32_t iNumGroups,
return iBits;
}
+
/* Currently only the number of bands in frame */
-static int32_t WriteHeaderInformation( const int32_t iNumBands,
- ivas_split_rend_bits_t *pBits )
+static int32_t WriteHeaderInformation(
+ const int32_t iNumBands,
+ ivas_split_rend_bits_t *pBits )
{
int32_t iBitsWritten;
@@ -1404,13 +1465,15 @@ static int32_t WriteHeaderInformation( const int32_t iNumBands,
return iBitsWritten;
}
-static int32_t WriteMSInformation( const int32_t iNumBands,
- const int32_t iMSMode,
- const int32_t *piMSFlags,
- const int32_t *piLRPhaseDiff,
- const int32_t *piMSPredCoef,
- int32_t iNumMSPredBands,
- ivas_split_rend_bits_t *pBits )
+
+static int32_t WriteMSInformation(
+ const int32_t iNumBands,
+ const int32_t iMSMode,
+ const int32_t *piMSFlags,
+ const int32_t *piLRPhaseDiff,
+ const int32_t *piMSPredCoef,
+ int32_t iNumMSPredBands,
+ ivas_split_rend_bits_t *pBits )
{
int32_t iBitsWritten;
int32_t iMSPredAll = ( iNumMSPredBands == iNumBands );
@@ -1426,6 +1489,7 @@ static int32_t WriteMSInformation( const int32_t iNumBands,
ivas_split_rend_bitstream_write_int32( pBits, iMSPredAll, 1 );
iBitsWritten += 1;
}
+
if ( iMSMode == 2 || ( iMSMode == 3 && !iMSPredAll ) )
{
int32_t n;
@@ -1454,6 +1518,7 @@ static int32_t WriteMSInformation( const int32_t iNumBands,
}
ivas_split_rend_bitstream_write_int32( pBits, anyNonZero, 1 );
iBitsWritten++;
+
if ( anyNonZero )
{
#ifdef SIMPLE_PHASE
@@ -1463,19 +1528,17 @@ static int32_t WriteMSInformation( const int32_t iNumBands,
iBitsWritten += SIMPLE_PHASE_BITS;
}
#else
- ivas_split_rend_bitstream_write_int32(
- pBits, piLRPhaseDiff[0] - PHASE_MIN_VAL, PHASE_BAND0_BITS );
+ ivas_split_rend_bitstream_write_int32( pBits, piLRPhaseDiff[0] - PHASE_MIN_VAL, PHASE_BAND0_BITS );
iBitsWritten += PHASE_BAND0_BITS;
for ( b = 1; b < iNumMSPredBands; b++ )
{
int32_t tabIdx = piLRPhaseDiff[b] - ENV_DELTA_MIN;
- ivas_split_rend_bitstream_write_int32(
- pBits, c_aaiRMSEnvHuffEnc[tabIdx][1],
- c_aaiRMSEnvHuffEnc[tabIdx][0] );
+ ivas_split_rend_bitstream_write_int32( pBits, c_aaiRMSEnvHuffEnc[tabIdx][1], c_aaiRMSEnvHuffEnc[tabIdx][0] );
iBitsWritten += c_aaiRMSEnvHuffEnc[tabIdx][0];
}
#endif
}
+
anyNonZero = 0;
for ( b = 0; b < iNumMSPredBands; b++ )
{
@@ -1485,20 +1548,18 @@ static int32_t WriteMSInformation( const int32_t iNumBands,
break;
}
}
- ivas_split_rend_bitstream_write_int32( pBits, anyNonZero,
- 1 );
+
+ ivas_split_rend_bitstream_write_int32( pBits, anyNonZero, 1 );
iBitsWritten++;
+
if ( anyNonZero )
{
- ivas_split_rend_bitstream_write_int32(
- pBits, piMSPredCoef[0] - PRED_MIN_VAL, PRED_BAND0_BITS );
+ ivas_split_rend_bitstream_write_int32( pBits, piMSPredCoef[0] - PRED_MIN_VAL, PRED_BAND0_BITS );
iBitsWritten += PRED_BAND0_BITS;
for ( b = 1; b < iNumMSPredBands; b++ )
{
int32_t tabIdx = piMSPredCoef[b] - ENV_DELTA_MIN;
- ivas_split_rend_bitstream_write_int32(
- pBits, c_aaiRMSEnvHuffEnc[tabIdx][1],
- c_aaiRMSEnvHuffEnc[tabIdx][0] );
+ ivas_split_rend_bitstream_write_int32( pBits, c_aaiRMSEnvHuffEnc[tabIdx][1], c_aaiRMSEnvHuffEnc[tabIdx][0] );
iBitsWritten += c_aaiRMSEnvHuffEnc[tabIdx][0];
}
}
@@ -1517,25 +1578,24 @@ static int32_t WriteMSInformation( const int32_t iNumBands,
return iBitsWritten;
}
-static int32_t WriteGroupInformation( const int32_t iChannels,
- const int32_t iCommonGrouping,
- const int32_t *piNumGroups,
- int32_t **ppiGroupLengths,
- ivas_split_rend_bits_t *pBits )
+
+static int32_t WriteGroupInformation(
+ const int32_t iChannels,
+ const int32_t iCommonGrouping,
+ const int32_t *piNumGroups,
+ int32_t **ppiGroupLengths,
+ ivas_split_rend_bits_t *pBits )
{
- int32_t iBitsWritten;
+ int32_t c, k, n, iBitsWritten;
iBitsWritten = 0;
if ( iChannels == 2 && iCommonGrouping == 1 )
{
- int32_t n;
- ivas_split_rend_bitstream_write_int32( pBits, iCommonGrouping,
- 1 );
+ ivas_split_rend_bitstream_write_int32( pBits, iCommonGrouping, 1 );
iBitsWritten += 1;
for ( n = 0; n < piNumGroups[0]; n++ )
{
- int32_t k;
for ( k = 1; k < ppiGroupLengths[0][n]; k++ )
{
ivas_split_rend_bitstream_write_int32( pBits, 0, 1 );
@@ -1550,21 +1610,16 @@ static int32_t WriteGroupInformation( const int32_t iChannels,
}
else if ( iChannels == 2 )
{
- int32_t c;
ivas_split_rend_bitstream_write_int32( pBits, iCommonGrouping, 1 );
iBitsWritten += 1;
for ( c = 0; c < iChannels; c++ )
{
- int32_t n;
-
for ( n = 0; n < piNumGroups[c]; n++ )
{
- int32_t k;
for ( k = 1; k < ppiGroupLengths[c][n]; k++ )
{
- ivas_split_rend_bitstream_write_int32( pBits, 0,
- 1 );
+ ivas_split_rend_bitstream_write_int32( pBits, 0, 1 );
iBitsWritten += 1;
}
if ( n < ( piNumGroups[c] - 1 ) )
@@ -1577,20 +1632,16 @@ static int32_t WriteGroupInformation( const int32_t iChannels,
}
else
{
- int32_t c;
-
for ( c = 0; c < iChannels; c++ )
{
- int32_t n;
-
for ( n = 0; n < piNumGroups[c]; n++ )
{
- int32_t k;
for ( k = 1; k < ppiGroupLengths[c][n]; k++ )
{
ivas_split_rend_bitstream_write_int32( pBits, 0, 1 );
iBitsWritten += 1;
}
+
if ( n < ( piNumGroups[c] - 1 ) )
{
ivas_split_rend_bitstream_write_int32( pBits, 1, 1 );
@@ -1603,19 +1654,20 @@ static int32_t WriteGroupInformation( const int32_t iChannels,
return iBitsWritten;
}
-static int32_t WriteRMSEnvelope( const int32_t iChannels,
- const int32_t *piNumGroups,
- const int32_t iNumBands,
- int32_t ***pppiRMSEnvelope,
- ivas_split_rend_bits_t *pBits )
+
+static int32_t WriteRMSEnvelope(
+ const int32_t iChannels,
+ const int32_t *piNumGroups,
+ const int32_t iNumBands,
+ int32_t ***pppiRMSEnvelope,
+ ivas_split_rend_bits_t *pBits )
{
- int32_t n;
+ int32_t k, n;
int32_t iBitsWritten;
iBitsWritten = 0;
for ( n = 0; n < iChannels; n++ )
{
- int32_t k;
for ( k = 0; k < piNumGroups[n]; k++ )
{
int32_t b;
@@ -1635,9 +1687,7 @@ static int32_t WriteRMSEnvelope( const int32_t iChannels,
iDelta = ( iDelta > ENV_DELTA_MIN ) ? iDelta : ENV_DELTA_MIN;
iDelta = ( iDelta < ENV_DELTA_MAX ) ? iDelta : ENV_DELTA_MAX;
iDelta -= ENV_DELTA_MIN;
- ivas_split_rend_bitstream_write_int32(
- pBits, c_aaiRMSEnvHuffEnc[iDelta][1],
- c_aaiRMSEnvHuffEnc[iDelta][0] );
+ ivas_split_rend_bitstream_write_int32( pBits, c_aaiRMSEnvHuffEnc[iDelta][1], c_aaiRMSEnvHuffEnc[iDelta][0] );
iBitsWritten += c_aaiRMSEnvHuffEnc[iDelta][0];
iLastRMSVal = pppiRMSEnvelope[n][k][b];
@@ -1648,8 +1698,13 @@ static int32_t WriteRMSEnvelope( const int32_t iChannels,
return iBitsWritten;
}
+
#ifdef ENABLE_PMOD_ADJUST
-static int32_t WritePmodInformation( const int32_t **ppiHiSMRFlags, Bitstream *psBSWrite, int32_t iChannels, int32_t iNumBands )
+static int32_t WritePmodInformation(
+ const int32_t **ppiHiSMRFlags,
+ Bitstream *psBSWrite,
+ int32_t iChannels,
+ int32_t iNumBands )
{
int32_t iBitsWritten, c, b;
@@ -1707,8 +1762,10 @@ static int32_t WritePmodInformation( const int32_t **ppiHiSMRFlags, Bitstream *p
}
#endif
-static int32_t WriteAllocInformation( const int32_t iAllocOffset,
- ivas_split_rend_bits_t *pBits )
+
+static int32_t WriteAllocInformation(
+ const int32_t iAllocOffset,
+ ivas_split_rend_bits_t *pBits )
{
int32_t iBitsWritten;
@@ -1718,24 +1775,26 @@ static int32_t WriteAllocInformation( const int32_t iAllocOffset,
{
printf( "Serious error\n" );
}
- ivas_split_rend_bitstream_write_int32( pBits,
- ( iAllocOffset - MIN_ALLOC_OFFSET ), ALLOC_OFFSET_BITS );
+
+ ivas_split_rend_bitstream_write_int32( pBits, ( iAllocOffset - MIN_ALLOC_OFFSET ), ALLOC_OFFSET_BITS );
iBitsWritten += ALLOC_OFFSET_BITS;
return iBitsWritten;
}
-static int32_t WriteCQMFData( const int32_t iNumGroups,
- const int32_t *piGroupLengths,
- const int32_t iNumBands,
- const int32_t *piBandwidths,
- const int32_t *piPredEnable,
- int32_t **ppiAlloc,
- int32_t **ppiSignReal,
- int32_t **ppiSignImag,
- int32_t **ppiQReal,
- int32_t **ppiQImag,
- ivas_split_rend_bits_t *pBits )
+
+static int32_t WriteLCLDData(
+ const int32_t iNumGroups,
+ const int32_t *piGroupLengths,
+ const int32_t iNumBands,
+ const int32_t *piBandwidths,
+ const int32_t *piPredEnable,
+ int32_t **ppiAlloc,
+ int32_t **ppiSignReal,
+ int32_t **ppiSignImag,
+ int32_t **ppiQReal,
+ int32_t **ppiQImag,
+ ivas_split_rend_bits_t *pBits )
{
int32_t n;
int32_t iBitsWritten;
@@ -1744,7 +1803,6 @@ static int32_t WriteCQMFData( const int32_t iNumGroups,
iBitsWritten = 0;
iBlockOffest = 0;
-
for ( n = 0; n < iNumGroups; n++ )
{
int32_t k;
@@ -1766,7 +1824,6 @@ static int32_t WriteCQMFData( const int32_t iNumGroups,
iHuffDim = c_aiHuffmanDim[iAlloc];
iHuffMod = c_aiHuffmanMod[iAlloc];
-
if ( iAlloc > 0 )
{
#ifndef ROM_TO_RAM
@@ -1776,7 +1833,6 @@ static int32_t WriteCQMFData( const int32_t iNumGroups,
const uint16_t( *pauiHuffmanTable )[2] = NULL;
const uint16_t( *pauiHuffmanTableDPCM )[2] = NULL;
#endif
- // pauiHuffmanTable = GetHuffEncTable(iAlloc);
pauiHuffmanTable = c_apauiHuffEncTabels[iAlloc];
pauiHuffmanTableDPCM = c_apauiHuffEncTabels[ALLOC_TABLE_SIZE + iAlloc];
for ( m = 0; m < piBandwidths[b]; m++ )
@@ -1795,22 +1851,15 @@ static int32_t WriteCQMFData( const int32_t iNumGroups,
iSymbol = iQuantValue1;
iSymbol *= iHuffMod;
iSymbol += iQuantValue2;
- ivas_split_rend_bitstream_write_int32(
- pBits, pauiHuffmanTableDPCM[iSymbol][1],
- pauiHuffmanTableDPCM[iSymbol][0] );
+ ivas_split_rend_bitstream_write_int32( pBits, pauiHuffmanTableDPCM[iSymbol][1], pauiHuffmanTableDPCM[iSymbol][0] );
iBitsWritten += pauiHuffmanTableDPCM[iSymbol][0];
}
else
{
- ivas_split_rend_bitstream_write_int32(
- pBits, pauiHuffmanTableDPCM[iQuantValue1][1],
- pauiHuffmanTableDPCM[iQuantValue1][0] );
+ ivas_split_rend_bitstream_write_int32( pBits, pauiHuffmanTableDPCM[iQuantValue1][1], pauiHuffmanTableDPCM[iQuantValue1][0] );
iBitsWritten += pauiHuffmanTableDPCM[iQuantValue1][0];
- ivas_split_rend_bitstream_write_int32(
- pBits,
- pauiHuffmanTableDPCM[iQuantValue2][1],
- pauiHuffmanTableDPCM[iQuantValue2][0] );
+ ivas_split_rend_bitstream_write_int32( pBits, pauiHuffmanTableDPCM[iQuantValue2][1], pauiHuffmanTableDPCM[iQuantValue2][0] );
iBitsWritten += pauiHuffmanTableDPCM[iQuantValue2][0];
}
}
@@ -1822,36 +1871,27 @@ static int32_t WriteCQMFData( const int32_t iNumGroups,
iSymbol = iQuantValue1;
iSymbol *= iHuffMod;
iSymbol += iQuantValue2;
- ivas_split_rend_bitstream_write_int32(
- pBits, pauiHuffmanTable[iSymbol][1],
- pauiHuffmanTable[iSymbol][0] );
+ ivas_split_rend_bitstream_write_int32( pBits, pauiHuffmanTable[iSymbol][1], pauiHuffmanTable[iSymbol][0] );
iBitsWritten += pauiHuffmanTable[iSymbol][0];
}
else
{
- ivas_split_rend_bitstream_write_int32(
- pBits, pauiHuffmanTable[iQuantValue1][1],
- pauiHuffmanTable[iQuantValue1][0] );
+ ivas_split_rend_bitstream_write_int32( pBits, pauiHuffmanTable[iQuantValue1][1], pauiHuffmanTable[iQuantValue1][0] );
iBitsWritten += pauiHuffmanTable[iQuantValue1][0];
- ivas_split_rend_bitstream_write_int32(
- pBits, pauiHuffmanTable[iQuantValue2][1],
- pauiHuffmanTable[iQuantValue2][0] );
+ ivas_split_rend_bitstream_write_int32( pBits, pauiHuffmanTable[iQuantValue2][1], pauiHuffmanTable[iQuantValue2][0] );
iBitsWritten += pauiHuffmanTable[iQuantValue2][0];
}
}
if ( iQuantValue1 > 0 )
{
- ivas_split_rend_bitstream_write_int32(
- pBits, ppiSignReal[iBlockOffest][iFBOffset],
- 1 );
+ ivas_split_rend_bitstream_write_int32( pBits, ppiSignReal[iBlockOffest][iFBOffset], 1 );
iBitsWritten += 1;
}
if ( iQuantValue2 > 0 )
{
- ivas_split_rend_bitstream_write_int32(
- pBits, ppiSignImag[iBlockOffest][iFBOffset], 1 );
+ ivas_split_rend_bitstream_write_int32( pBits, ppiSignImag[iBlockOffest][iFBOffset], 1 );
iBitsWritten += 1;
}
@@ -1871,30 +1911,32 @@ static int32_t WriteCQMFData( const int32_t iNumGroups,
return iBitsWritten;
}
-static int32_t ComputeAllocation( const int32_t iChannels,
- const int32_t *piNumGroups,
- int32_t **ppiGroupLengths,
- const int32_t iNumBands,
- const int32_t *piBandwidths,
- float ***pppfReal,
- float ***pppfImag,
- int32_t ***pppiSMR,
- const int32_t iAvailableBits,
- int32_t *piAllocOffset,
- int32_t ***pppiAlloc,
- int32_t ***pppiQReal,
- int32_t ***pppiQImag,
- int32_t ***pppiSignReal,
- int32_t ***pppiSignImag,
- int32_t **ppiPredEnable,
- float **ppfA1Real,
- float **ppfA1Imag )
+
+static int32_t ComputeAllocation(
+ const int32_t iChannels,
+ const int32_t *piNumGroups,
+ int32_t **ppiGroupLengths,
+ const int32_t iNumBands,
+ const int32_t *piBandwidths,
+ float ***pppfReal,
+ float ***pppfImag,
+ int32_t ***pppiSMR,
+ const int32_t iAvailableBits,
+ int32_t *piAllocOffset,
+ int32_t ***pppiAlloc,
+ int32_t ***pppiQReal,
+ int32_t ***pppiQImag,
+ int32_t ***pppiSignReal,
+ int32_t ***pppiSignImag,
+ int32_t **ppiPredEnable,
+ float **ppfA1Real,
+ float **ppfA1Imag )
{
- int32_t iBitsUsed;
- int32_t iDone;
- int32_t iDelta;
+ int32_t iBitsUsed, iDone, iDelta;
+ int32_t b, k, n;
+ int32_t iLimitAllocOffset;
- iBitsUsed = ALLOC_OFFSET_BITS; // Bits used for Alloc Offset
+ iBitsUsed = ALLOC_OFFSET_BITS; /* Bits used for Alloc Offset */
iDone = 0;
iDelta = -MIN_ALLOC_OFFSET;
@@ -1902,8 +1944,6 @@ static int32_t ComputeAllocation( const int32_t iChannels,
while ( iDone == 0 )
{
- int32_t n;
- int32_t iLimitAllocOffset;
iBitsUsed = ALLOC_OFFSET_BITS;
iLimitAllocOffset = *piAllocOffset;
@@ -1912,10 +1952,8 @@ static int32_t ComputeAllocation( const int32_t iChannels,
for ( n = 0; n < iChannels; n++ )
{
- int32_t k;
for ( k = 0; k < piNumGroups[n]; k++ )
{
- int32_t b;
for ( b = 0; b < iNumBands; b++ )
{
int32_t iAlloc;
@@ -1941,7 +1979,7 @@ static int32_t ComputeAllocation( const int32_t iChannels,
ppfA1Real[n],
ppfA1Imag[n] );
- iBitsUsed += CountCQMFBits( piNumGroups[n],
+ iBitsUsed += CountLCLDBits( piNumGroups[n],
(const int32_t *) ppiGroupLengths[n],
iNumBands,
piBandwidths,
diff --git a/lib_rend/ivas_lcld_prot.h b/lib_rend/ivas_lcld_prot.h
new file mode 100644
index 0000000000000000000000000000000000000000..2d60f127dc6222353c1801a17f098eacabf3137d
--- /dev/null
+++ b/lib_rend/ivas_lcld_prot.h
@@ -0,0 +1,332 @@
+/******************************************************************************************************
+
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
+ Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
+ Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+ contributors to this repository. All Rights Reserved.
+
+ This software is protected by copyright law and by international treaties.
+ The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
+ Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
+ Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
+ Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+ contributors to this repository retain full ownership rights in their respective contributions in
+ the software. This notice grants no license of any kind, including but not limited to patent
+ license, nor is any license granted by implication, estoppel or otherwise.
+
+ Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
+ contributions.
+
+ This software is provided "AS IS", without any express or implied warranties. The software is in the
+ development stage. It is intended exclusively for experts who have experience with such software and
+ solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
+ and fitness for a particular purpose are hereby disclaimed and excluded.
+
+ Any dispute, controversy or claim arising under or in relation to providing this software shall be
+ submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
+ accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
+ the United Nations Convention on Contracts on the International Sales of Goods.
+
+*******************************************************************************************************/
+
+#ifndef _IVAS_LCLD_ENCODER_H_
+#define _IVAS_LCLD_ENCODER_H_
+
+#include "options.h"
+#ifdef SPLIT_REND_WITH_HEAD_ROT
+#include "lib_rend.h"
+#include "ivas_lcld_rom_tables.h"
+
+
+typedef struct LCLD_ENCODER LCLDEncoder;
+
+ivas_error CreateLCLDEncoder(
+ LCLDEncoder **psLCLDEncoder,
+ const int32_t iSampleRate,
+ const int32_t iChannels,
+ const int32_t iTargetBitRate,
+ const int32_t iAllowSidePred );
+
+void DeleteLCLDEncoder(
+ LCLDEncoder *psLCLDEncoder );
+
+int32_t LCLDEncoderGetError(
+ LCLDEncoder *psLCLDEncoder );
+
+int32_t EncodeLCLDFrame(
+ LCLDEncoder *psLCLDEncoder,
+ float ***pppfLCLDReal,
+ float ***pppfLCLDImag,
+ int32_t *piNumiBites,
+ const int32_t available_bits,
+ ivas_split_rend_bits_t *pBits );
+
+int32_t GetNumGroups(
+ LCLDEncoder *psLCLDEncoder );
+
+
+typedef struct LCLD_DECODER LCLDDecoder;
+
+ivas_error CreateLCLDDecoder(
+ LCLDDecoder **psLCLDDecoder_out,
+ const int32_t iSampleRate,
+ const int32_t iChannels );
+
+void DeleteLCLDDecoder(
+ LCLDDecoder *psLCLDDecoder );
+
+int32_t LCLDDecoderGetError(
+ LCLDDecoder *psLCLDDecoder );
+
+int32_t DecodeLCLDFrame(
+ LCLDDecoder *psLCLDDecoder,
+ ivas_split_rend_bits_t *pBits,
+ float ***pppfLCLDReal,
+ float ***pppfLCLDImag );
+
+
+/*----------------------------------------------------------------------------------*
+ * MSPred prototypes
+ *----------------------------------------------------------------------------------*/
+
+int32_t quantPhase(
+ float phase );
+
+void cplxmult(
+ float *pr1,
+ float *pi1,
+ float r2,
+ float i2 );
+
+void rot_pm_pi(
+ float *pr,
+ float *pi );
+
+void rot_p_pi_2(
+ float *pr,
+ float *pi );
+
+void rot_m_pi_2(
+ float *pr,
+ float *pi );
+
+int32_t requantPhase(
+ int32_t phaseQ );
+
+int32_t quantPred(
+ const float pred );
+
+float dequantPhase(
+ const int32_t phaseQ );
+
+float dequantPred(
+ int32_t predQ );
+
+int32_t PrepEncode(
+ int32_t *piQuant,
+ const int32_t *piMSFlags,
+ const int32_t numBands );
+
+void EncodePhase(
+ int32_t *phaseQuant,
+ const int32_t numMSBands,
+ const int32_t diffDim );
+
+void DecodePhase(
+ int32_t *phaseQuant,
+ const int32_t numMSBands,
+ const int32_t diffDim );
+
+int32_t EncodePredCoef(
+ int32_t *predQuant,
+ const int32_t numMSBands );
+
+void DecodePredCoef(
+ int32_t *phaseQuant,
+ const int32_t numMSBands );
+
+void writeMSPred(
+ int32_t *phaseQuant,
+ int32_t *predQuant,
+ const int32_t MSMode,
+ const int32_t numMSBands,
+ int32_t numBands,
+ void *fid,
+ int32_t *piMsFlags );
+
+int32_t CountMSBits(
+ int32_t iNumBands,
+ const int32_t iMSMode,
+ const int32_t *piMSFlags,
+ const int32_t *piLRPhaseDiff,
+ const int32_t *piMSPredCoef );
+
+
+/*----------------------------------------------------------------------------------*
+ * NoiseGen prototypes
+ *----------------------------------------------------------------------------------*/
+
+typedef struct NOISE_GEN
+{
+ int32_t iNoiseBufferLength;
+ int32_t iNoiseBufferMask;
+ int32_t iNoiseBufferIndex;
+ float *pfNoiseBuffer;
+} NoiseGen;
+
+NoiseGen *CreateNoiseGen( void );
+
+void DeleteNoiseGen( NoiseGen *psNoiseGen );
+
+inline float GetNoise( NoiseGen *psNoiseGen )
+{
+ float fNoiseSample;
+
+ fNoiseSample = psNoiseGen->pfNoiseBuffer[psNoiseGen->iNoiseBufferIndex];
+ psNoiseGen->iNoiseBufferIndex++;
+ psNoiseGen->iNoiseBufferIndex &= psNoiseGen->iNoiseBufferMask;
+
+ return fNoiseSample;
+}
+
+
+/*----------------------------------------------------------------------------------*
+ * PereptualModel prototypes
+ *----------------------------------------------------------------------------------*/
+
+extern void PerceptualModel(
+ const int32_t iMaxQuantBands,
+ const int32_t *piRMSEnvelope,
+ int32_t *piExcitation,
+ int32_t *piSMR );
+
+extern void PerceptualModelStereo(
+ const int32_t iMaxQuantBands,
+ const int32_t *piMSFlags,
+ const int32_t *piRMSEnvelope0,
+ const int32_t *piRMSEnvelope1,
+ int32_t *piExcitation0,
+ int32_t *piExcitation1,
+ int32_t *piSMR0,
+ int32_t *piSMR1 );
+
+/*----------------------------------------------------------------------------------*
+ * PredEncoder/PredDecoder prototypes
+ *----------------------------------------------------------------------------------*/
+
+
+typedef struct PREDICTION_ENCODER
+{
+ int32_t iChannels;
+ int32_t iNumBlocks;
+
+ float *pfWindow;
+ float pfRxxReal[2];
+ float pfRxxImag[2];
+
+ int32_t *piPredChanEnable;
+ int32_t *piNumPredBands;
+
+ float **ppfEstPredGain;
+ float **ppfEstPredBitGain;
+ int32_t **ppiPredBandEnable;
+
+ float **ppfA1Real;
+ float **ppfA1Imag;
+
+ int32_t **ppiA1Mag;
+ int32_t **ppiA1Phase;
+} PredictionEncoder;
+
+ivas_error CreatePredictionEncoder(
+ PredictionEncoder **psPredictionEncoder_out,
+ const int32_t iChannels,
+ const int32_t iNumBlocks );
+
+void DeletePredictionEncoder(
+ PredictionEncoder *psPredictionEncoder );
+
+int32_t ComputePredictors(
+ PredictionEncoder *psPredictionEncoder,
+ float ***pppfReal,
+ float ***pppfImag );
+
+void ApplyForwardPredictors(
+ PredictionEncoder *psPredictionEncoder,
+ float ***pppfReal,
+ float ***pppfImag );
+
+
+int32_t WritePredictors(
+ PredictionEncoder *psPredictionEncoder,
+ ivas_split_rend_bits_t *pBits );
+
+typedef struct PREDICTION_DECODER
+{
+ int32_t iChannels;
+ int32_t iNumBlocks;
+
+ int32_t *piPredChanEnable;
+ int32_t *piNumPredBands;
+
+ float **ppfEstPredGain;
+ int32_t **ppiPredBandEnable;
+
+ float **ppfA1Real;
+ float **ppfA1Imag;
+
+ int32_t **ppiA1Mag;
+ int32_t **ppiA1Phase;
+
+ float pfMagLUT[1 << PRED_QUNAT_FILTER_MAG_BITS];
+ float pfP2RRealLUT[1 << PRED_QUANT_FILTER_PHASE_BITS];
+ float pfP2RImagLUT[1 << PRED_QUANT_FILTER_PHASE_BITS];
+
+} PredictionDecoder;
+
+ivas_error CreatePredictionDecoder(
+ PredictionDecoder **psPredictionDecoder_out,
+ const int32_t iChannels,
+ const int32_t iNumBlocks );
+
+void DeletePredictionDecoder(
+ PredictionDecoder *psPredictionDecoder );
+
+int32_t ReadPredictors(
+ PredictionDecoder *psPredictionDecoder,
+ ivas_split_rend_bits_t *pBits );
+
+void ApplyInversePredictros(
+ PredictionDecoder *psPredictionDecoder,
+ float ***pppfReal,
+ float ***pppfImag );
+
+
+/*----------------------------------------------------------------------------------*
+ * RMSEnvGrouping prototypes
+ *----------------------------------------------------------------------------------*/
+
+typedef struct RMS_ENVELOPE_GROUPING RMSEnvelopeGrouping;
+
+RMSEnvelopeGrouping *CreateRMSEnvelopeGrouping(
+ const int32_t iNumBlocks );
+
+void DeleteRMSEnvelopeGrouping(
+ RMSEnvelopeGrouping *psRMSEnvelopeGrouping );
+
+void ComputeEnvelopeGrouping(
+ RMSEnvelopeGrouping *psRMSEnvelopeGrouping,
+ const int32_t iChannels,
+ const int32_t iNumBands,
+ const int32_t *piBandwidths,
+ float ***pppfReal,
+ float ***pppfImag,
+ int32_t *piNumGroups,
+ int32_t *piGroupLengths,
+ int32_t ***pppiRMSEnvelope );
+
+
+#endif
+
+#endif /* _LCLD_ENCODER_H_ */
diff --git a/lib_rend/ivas_lcld_tables.c b/lib_rend/ivas_lcld_rom_tables.c
similarity index 98%
rename from lib_rend/ivas_lcld_tables.c
rename to lib_rend/ivas_lcld_rom_tables.c
index ae882a5e1b87cf240d6295beb270184c5da0860b..6f3c529836799097039613d20d55a11f9b41953a 100644
--- a/lib_rend/ivas_lcld_tables.c
+++ b/lib_rend/ivas_lcld_rom_tables.c
@@ -1,6 +1,6 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -30,15 +30,12 @@
*******************************************************************************************************/
-
+#include "ivas_lcld_rom_tables.h"
#include "options.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
-#include "ivas_lcld_tables.h"
-#include "ivas_prot_rend.h"
#include "wmc_auto.h"
-#include
#include "prot.h"
-#include "ivas_PerceptualModel.h"
+#include "ivas_lcld_prot.h"
/* clang-format off */
@@ -50,7 +47,8 @@ const float c_afRotRealImagSimple[SIMPLE_PHASE_MAX_VAL + 1][2] = {
};
/* phi = (-12:12)'/12 *pi; tmp = [cos(phi),sin(phi)]; tmp = tmp';sprintf('{%.8ff, %.8ff},\n',tmp(:)) */
-const float c_afRotRealImag[PHASE_MAX_VAL - PHASE_MIN_VAL + 1][2] = {
+const float c_afRotRealImag[PHASE_MAX_VAL - PHASE_MIN_VAL + 1][2] =
+{
{ -1.00000000f, -0.00000000f },
{ -0.96592583f, -0.25881905f },
{ -0.86602540f, -0.50000000f },
@@ -79,7 +77,8 @@ const float c_afRotRealImag[PHASE_MAX_VAL - PHASE_MIN_VAL + 1][2] = {
};
/* Move this to perceptual model ? */
-const int32_t c_aiBandwidths48[MAX_BANDS_48] = {
+const int32_t c_aiBandwidths48[MAX_BANDS_48] =
+{
1,
1,
1,
@@ -753,9 +752,9 @@ const uint32_t c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE] = {
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc1[16][2] =
+const uint32_t c_aauiLCLDHuffEnc1[16][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc1[16][2] =
+const uint16_t c_aauiLCLDHuffEnc1[16][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -777,7 +776,7 @@ const uint16_t c_aauiCQMFHuffEnc1[16][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec1[3][16] = {
+const uint32_t c_aauiLCLDHuffDec1[3][16] = {
{
0x0001ffff,
0x00000005,
@@ -836,9 +835,9 @@ const uint32_t c_aauiCQMFHuffDec1[3][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc2[16][2] =
+const uint32_t c_aauiLCLDHuffEnc2[16][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc2[16][2] =
+const uint16_t c_aauiLCLDHuffEnc2[16][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -860,7 +859,7 @@ const uint16_t c_aauiCQMFHuffEnc2[16][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec2[3][16] = {
+const uint32_t c_aauiLCLDHuffDec2[3][16] = {
{
0x0001ffff,
0x00000005,
@@ -918,9 +917,9 @@ const uint32_t c_aauiCQMFHuffDec2[3][16] = {
};
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc3[25][2] =
+const uint32_t c_aauiLCLDHuffEnc3[25][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc3[25][2] =
+const uint16_t c_aauiLCLDHuffEnc3[25][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -952,7 +951,7 @@ const uint16_t c_aauiCQMFHuffEnc3[25][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec3[10][16] = {
+const uint32_t c_aauiLCLDHuffDec3[10][16] = {
{
0x0001ffff,
0x00000006,
@@ -1137,9 +1136,9 @@ const uint32_t c_aauiCQMFHuffDec3[10][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc4[36][2] =
+const uint32_t c_aauiLCLDHuffEnc4[36][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc4[36][2] =
+const uint16_t c_aauiLCLDHuffEnc4[36][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -1182,7 +1181,7 @@ const uint16_t c_aauiCQMFHuffEnc4[36][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec4[5][16] = {
+const uint32_t c_aauiLCLDHuffDec4[5][16] = {
{
0x0001ffff,
0x00000007,
@@ -1277,9 +1276,9 @@ const uint32_t c_aauiCQMFHuffDec4[5][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc5[36][2] =
+const uint32_t c_aauiLCLDHuffEnc5[36][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc5[36][2] =
+const uint16_t c_aauiLCLDHuffEnc5[36][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -1322,7 +1321,7 @@ const uint16_t c_aauiCQMFHuffEnc5[36][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec5[10][16] = {
+const uint32_t c_aauiLCLDHuffDec5[10][16] = {
{
0x0001ffff,
0x00000007,
@@ -1507,9 +1506,9 @@ const uint32_t c_aauiCQMFHuffDec5[10][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc6[49][2] =
+const uint32_t c_aauiLCLDHuffEnc6[49][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc6[49][2] =
+const uint16_t c_aauiLCLDHuffEnc6[49][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -1565,7 +1564,7 @@ const uint16_t c_aauiCQMFHuffEnc6[49][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec6[7][16] = {
+const uint32_t c_aauiLCLDHuffDec6[7][16] = {
{
0x0001ffff,
0x00000008,
@@ -1696,9 +1695,9 @@ const uint32_t c_aauiCQMFHuffDec6[7][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc7[64][2] =
+const uint32_t c_aauiLCLDHuffEnc7[64][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc7[64][2] =
+const uint16_t c_aauiLCLDHuffEnc7[64][2] =
#endif
{
{ 0x0002, 0x0001 },
@@ -1768,7 +1767,7 @@ const uint16_t c_aauiCQMFHuffEnc7[64][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec7[25][16] = {
+const uint32_t c_aauiLCLDHuffDec7[25][16] = {
{
0x0001ffff,
0x0002ffff,
@@ -2223,9 +2222,9 @@ const uint32_t c_aauiCQMFHuffDec7[25][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc8[81][2] =
+const uint32_t c_aauiLCLDHuffEnc8[81][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc8[81][2] =
+const uint16_t c_aauiLCLDHuffEnc8[81][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -2313,7 +2312,7 @@ const uint16_t c_aauiCQMFHuffEnc8[81][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec8[16][16] = {
+const uint32_t c_aauiLCLDHuffDec8[16][16] = {
{
0x0001ffff,
0x0002ffff,
@@ -2606,9 +2605,9 @@ const uint32_t c_aauiCQMFHuffDec8[16][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc9[100][2] =
+const uint32_t c_aauiLCLDHuffEnc9[100][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc9[100][2] =
+const uint16_t c_aauiLCLDHuffEnc9[100][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -2715,7 +2714,7 @@ const uint16_t c_aauiCQMFHuffEnc9[100][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec9[22][16] = {
+const uint32_t c_aauiLCLDHuffDec9[22][16] = {
{
0x0001ffff,
0x0002ffff,
@@ -3116,9 +3115,9 @@ const uint32_t c_aauiCQMFHuffDec9[22][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc10[169][2] =
+const uint32_t c_aauiLCLDHuffEnc10[169][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc10[169][2] =
+const uint16_t c_aauiLCLDHuffEnc10[169][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -3294,7 +3293,7 @@ const uint16_t c_aauiCQMFHuffEnc10[169][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec10[45][16] = {
+const uint32_t c_aauiLCLDHuffDec10[45][16] = {
{
0x0002ffff,
0x0001ffff,
@@ -4109,9 +4108,9 @@ const uint32_t c_aauiCQMFHuffDec10[45][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc11[196][2] =
+const uint32_t c_aauiLCLDHuffEnc11[196][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc11[196][2] =
+const uint16_t c_aauiLCLDHuffEnc11[196][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -4314,7 +4313,7 @@ const uint16_t c_aauiCQMFHuffEnc11[196][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec11[50][16] = {
+const uint32_t c_aauiLCLDHuffDec11[50][16] = {
{
0x0003ffff,
0x0001ffff,
@@ -5219,9 +5218,9 @@ const uint32_t c_aauiCQMFHuffDec11[50][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc12[289][2] =
+const uint32_t c_aauiLCLDHuffEnc12[289][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc12[289][2] =
+const uint16_t c_aauiLCLDHuffEnc12[289][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -5517,7 +5516,7 @@ const uint16_t c_aauiCQMFHuffEnc12[289][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec12[76][16] = {
+const uint32_t c_aauiLCLDHuffDec12[76][16] = {
{
0x0003ffff,
0x0004ffff,
@@ -6890,9 +6889,9 @@ const uint32_t c_aauiCQMFHuffDec12[76][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc13[324][2] =
+const uint32_t c_aauiLCLDHuffEnc13[324][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc13[324][2] =
+const uint16_t c_aauiLCLDHuffEnc13[324][2] =
#endif
{
{ 0x0004, 0x0006 },
@@ -7223,7 +7222,7 @@ const uint16_t c_aauiCQMFHuffEnc13[324][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec13[89][16] = {
+const uint32_t c_aauiLCLDHuffDec13[89][16] = {
{
0x0006ffff,
0x0005ffff,
@@ -8830,9 +8829,9 @@ const uint32_t c_aauiCQMFHuffDec13[89][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc14[400][2] =
+const uint32_t c_aauiLCLDHuffEnc14[400][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc14[400][2] =
+const uint16_t c_aauiLCLDHuffEnc14[400][2] =
#endif
{
{ 0x0005, 0x0007 },
@@ -9238,7 +9237,7 @@ const uint16_t c_aauiCQMFHuffEnc14[400][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec14[53][16] = {
+const uint32_t c_aauiLCLDHuffDec14[53][16] = {
{
0x0009ffff,
0x0007ffff,
@@ -10197,9 +10196,9 @@ const uint32_t c_aauiCQMFHuffDec14[53][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc15[576][2] =
+const uint32_t c_aauiLCLDHuffEnc15[576][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc15[576][2] =
+const uint16_t c_aauiLCLDHuffEnc15[576][2] =
#endif
{
{ 0x0005, 0x000a },
@@ -10781,7 +10780,7 @@ const uint16_t c_aauiCQMFHuffEnc15[576][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec15[73][16] = {
+const uint32_t c_aauiLCLDHuffDec15[73][16] = {
{
0x000cffff,
0x000bffff,
@@ -12100,9 +12099,9 @@ const uint32_t c_aauiCQMFHuffDec15[73][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc16[729][2] =
+const uint32_t c_aauiLCLDHuffEnc16[729][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc16[729][2] =
+const uint16_t c_aauiLCLDHuffEnc16[729][2] =
#endif
{
{ 0x0006, 0x000d },
@@ -12838,7 +12837,7 @@ const uint16_t c_aauiCQMFHuffEnc16[729][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec16[85][16] = {
+const uint32_t c_aauiLCLDHuffDec16[85][16] = {
{
0x000fffff,
0x000dffff,
@@ -14373,9 +14372,9 @@ const uint32_t c_aauiCQMFHuffDec16[85][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc17[729][2] =
+const uint32_t c_aauiLCLDHuffEnc17[729][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc17[729][2] =
+const uint16_t c_aauiLCLDHuffEnc17[729][2] =
#endif
{
{ 0x0006, 0x0012 },
@@ -15111,7 +15110,7 @@ const uint16_t c_aauiCQMFHuffEnc17[729][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec17[93][16] = {
+const uint32_t c_aauiLCLDHuffDec17[93][16] = {
{
0x0010ffff,
0x000dffff,
@@ -16790,9 +16789,9 @@ const uint32_t c_aauiCQMFHuffDec17[93][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc18[28][2] =
+const uint32_t c_aauiLCLDHuffEnc18[28][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc18[28][2] =
+const uint16_t c_aauiLCLDHuffEnc18[28][2] =
#endif
{
{ 0x0004, 0x0001 },
@@ -16827,7 +16826,7 @@ const uint16_t c_aauiCQMFHuffEnc18[28][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec18[6][16] = {
+const uint32_t c_aauiLCLDHuffDec18[6][16] = {
{
0x0001ffff,
0x00000000,
@@ -16940,9 +16939,9 @@ const uint32_t c_aauiCQMFHuffDec18[6][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc19[29][2] =
+const uint32_t c_aauiLCLDHuffEnc19[29][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc19[29][2] =
+const uint16_t c_aauiLCLDHuffEnc19[29][2] =
#endif
{
{ 0x0004, 0x0002 },
@@ -16978,7 +16977,7 @@ const uint16_t c_aauiCQMFHuffEnc19[29][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec19[6][16] = {
+const uint32_t c_aauiLCLDHuffDec19[6][16] = {
{
0x0001ffff,
0x0002ffff,
@@ -17091,9 +17090,9 @@ const uint32_t c_aauiCQMFHuffDec19[6][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc20[32][2] =
+const uint32_t c_aauiLCLDHuffEnc20[32][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc20[32][2] =
+const uint16_t c_aauiLCLDHuffEnc20[32][2] =
#endif
{
{ 0x0004, 0x0002 },
@@ -17131,7 +17130,7 @@ const uint16_t c_aauiCQMFHuffEnc20[32][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec20[6][16] = {
+const uint32_t c_aauiLCLDHuffDec20[6][16] = {
{
0x0002ffff,
0x0001ffff,
@@ -17244,9 +17243,9 @@ const uint32_t c_aauiCQMFHuffDec20[6][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc21[37][2] =
+const uint32_t c_aauiLCLDHuffEnc21[37][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc21[37][2] =
+const uint16_t c_aauiLCLDHuffEnc21[37][2] =
#endif
{
{ 0x0005, 0x0002 },
@@ -17290,7 +17289,7 @@ const uint16_t c_aauiCQMFHuffEnc21[37][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec21[7][16] = {
+const uint32_t c_aauiLCLDHuffDec21[7][16] = {
{
0x0003ffff,
0x0001ffff,
@@ -17421,9 +17420,9 @@ const uint32_t c_aauiCQMFHuffDec21[7][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc22[39][2] =
+const uint32_t c_aauiLCLDHuffEnc22[39][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc22[39][2] =
+const uint16_t c_aauiLCLDHuffEnc22[39][2] =
#endif
{
{ 0x0005, 0x0002 },
@@ -17469,7 +17468,7 @@ const uint16_t c_aauiCQMFHuffEnc22[39][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec22[9][16] = {
+const uint32_t c_aauiLCLDHuffDec22[9][16] = {
{
0x0004ffff,
0x0001ffff,
@@ -17636,9 +17635,9 @@ const uint32_t c_aauiCQMFHuffDec22[9][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc23[46][2] =
+const uint32_t c_aauiLCLDHuffEnc23[46][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc23[46][2] =
+const uint16_t c_aauiLCLDHuffEnc23[46][2] =
#endif
{
{ 0x0005, 0x0003 },
@@ -17691,7 +17690,7 @@ const uint16_t c_aauiCQMFHuffEnc23[46][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec23[12][16] = {
+const uint32_t c_aauiLCLDHuffDec23[12][16] = {
{
0x0006ffff,
0x0001ffff,
@@ -17912,9 +17911,9 @@ const uint32_t c_aauiCQMFHuffDec23[12][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc24[55][2] =
+const uint32_t c_aauiLCLDHuffEnc24[55][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc24[55][2] =
+const uint16_t c_aauiLCLDHuffEnc24[55][2] =
#endif
{
{ 0x0005, 0x0004 },
@@ -17976,7 +17975,7 @@ const uint16_t c_aauiCQMFHuffEnc24[55][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec24[17][16] = {
+const uint32_t c_aauiLCLDHuffDec24[17][16] = {
{
0x0008ffff,
0x0009ffff,
@@ -18287,9 +18286,9 @@ const uint32_t c_aauiCQMFHuffDec24[17][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc25[65][2] =
+const uint32_t c_aauiLCLDHuffEnc25[65][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc25[65][2] =
+const uint16_t c_aauiLCLDHuffEnc25[65][2] =
#endif
{
{ 0x0005, 0x0005 },
@@ -18361,7 +18360,7 @@ const uint16_t c_aauiCQMFHuffEnc25[65][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec25[19][16] = {
+const uint32_t c_aauiLCLDHuffDec25[19][16] = {
{
0x000cffff,
0x000bffff,
@@ -18708,9 +18707,9 @@ const uint32_t c_aauiCQMFHuffDec25[19][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc26[77][2] =
+const uint32_t c_aauiLCLDHuffEnc26[77][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc26[77][2] =
+const uint16_t c_aauiLCLDHuffEnc26[77][2] =
#endif
{
{ 0x0006, 0x0004 },
@@ -18794,7 +18793,7 @@ const uint16_t c_aauiCQMFHuffEnc26[77][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec26[26][16] = {
+const uint32_t c_aauiLCLDHuffDec26[26][16] = {
{
0x0010ffff,
0x000effff,
@@ -19267,9 +19266,9 @@ const uint32_t c_aauiCQMFHuffDec26[26][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc27[91][2] =
+const uint32_t c_aauiLCLDHuffEnc27[91][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc27[91][2] =
+const uint16_t c_aauiLCLDHuffEnc27[91][2] =
#endif
{
{ 0x0006, 0x0006 },
@@ -19367,7 +19366,7 @@ const uint16_t c_aauiCQMFHuffEnc27[91][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec27[28][16] = {
+const uint32_t c_aauiLCLDHuffDec27[28][16] = {
{
0x0010ffff,
0x000cffff,
@@ -19876,9 +19875,9 @@ const uint32_t c_aauiCQMFHuffDec27[28][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc28[109][2] =
+const uint32_t c_aauiLCLDHuffEnc28[109][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc28[109][2] =
+const uint16_t c_aauiLCLDHuffEnc28[109][2] =
#endif
{
{ 0x0006, 0x0008 },
@@ -19994,7 +19993,7 @@ const uint16_t c_aauiCQMFHuffEnc28[109][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec28[30][16] = {
+const uint32_t c_aauiLCLDHuffDec28[30][16] = {
{
0x000fffff,
0x0010ffff,
@@ -20539,9 +20538,9 @@ const uint32_t c_aauiCQMFHuffDec28[30][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc29[129][2] =
+const uint32_t c_aauiLCLDHuffEnc29[129][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc29[129][2] =
+const uint16_t c_aauiLCLDHuffEnc29[129][2] =
#endif
{
{ 0x0006, 0x0009 },
@@ -20677,7 +20676,7 @@ const uint16_t c_aauiCQMFHuffEnc29[129][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec29[34][16] = {
+const uint32_t c_aauiLCLDHuffDec29[34][16] = {
{
0x000fffff,
0x0010ffff,
@@ -21294,9 +21293,9 @@ const uint32_t c_aauiCQMFHuffDec29[34][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc30[153][2] =
+const uint32_t c_aauiLCLDHuffEnc30[153][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc30[153][2] =
+const uint16_t c_aauiLCLDHuffEnc30[153][2] =
#endif
{
{ 0x0007, 0x0009 },
@@ -21456,7 +21455,7 @@ const uint16_t c_aauiCQMFHuffEnc30[153][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec30[39][16] = {
+const uint32_t c_aauiLCLDHuffDec30[39][16] = {
{
0x0010ffff,
0x000effff,
@@ -22163,9 +22162,9 @@ const uint32_t c_aauiCQMFHuffDec30[39][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc31[181][2] =
+const uint32_t c_aauiLCLDHuffEnc31[181][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc31[181][2] =
+const uint16_t c_aauiLCLDHuffEnc31[181][2] =
#endif
{
{ 0x0007, 0x000b },
@@ -22353,7 +22352,7 @@ const uint16_t c_aauiCQMFHuffEnc31[181][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec31[43][16] = {
+const uint32_t c_aauiLCLDHuffDec31[43][16] = {
{
0x0010ffff,
0x000cffff,
@@ -23132,9 +23131,9 @@ const uint32_t c_aauiCQMFHuffDec31[43][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc33[16][2] =
+const uint32_t c_aauiLCLDHuffEnc33[16][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc33[16][2] =
+const uint16_t c_aauiLCLDHuffEnc33[16][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -23156,7 +23155,7 @@ const uint16_t c_aauiCQMFHuffEnc33[16][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec33[2][16] = {
+const uint32_t c_aauiLCLDHuffDec33[2][16] = {
{
0x0001ffff,
0x00000005,
@@ -23197,9 +23196,9 @@ const uint32_t c_aauiCQMFHuffDec33[2][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc34[16][2] =
+const uint32_t c_aauiLCLDHuffEnc34[16][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc34[16][2] =
+const uint16_t c_aauiLCLDHuffEnc34[16][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -23221,7 +23220,7 @@ const uint16_t c_aauiCQMFHuffEnc34[16][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec34[2][16] = {
+const uint32_t c_aauiLCLDHuffDec34[2][16] = {
{
0x0001ffff,
0x00000005,
@@ -23262,9 +23261,9 @@ const uint32_t c_aauiCQMFHuffDec34[2][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc35[25][2] =
+const uint32_t c_aauiLCLDHuffEnc35[25][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc35[25][2] =
+const uint16_t c_aauiLCLDHuffEnc35[25][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -23296,7 +23295,7 @@ const uint16_t c_aauiCQMFHuffEnc35[25][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec35[9][16] = {
+const uint32_t c_aauiLCLDHuffDec35[9][16] = {
{
0x0001ffff,
0x00000006,
@@ -23463,9 +23462,9 @@ const uint32_t c_aauiCQMFHuffDec35[9][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc36[36][2] =
+const uint32_t c_aauiLCLDHuffEnc36[36][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc36[36][2] =
+const uint16_t c_aauiLCLDHuffEnc36[36][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -23508,7 +23507,7 @@ const uint16_t c_aauiCQMFHuffEnc36[36][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec36[7][16] = {
+const uint32_t c_aauiLCLDHuffDec36[7][16] = {
{
0x0001ffff,
0x00000007,
@@ -23639,9 +23638,9 @@ const uint32_t c_aauiCQMFHuffDec36[7][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc37[36][2] =
+const uint32_t c_aauiLCLDHuffEnc37[36][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc37[36][2] =
+const uint16_t c_aauiLCLDHuffEnc37[36][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -23684,7 +23683,7 @@ const uint16_t c_aauiCQMFHuffEnc37[36][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec37[4][16] = {
+const uint32_t c_aauiLCLDHuffDec37[4][16] = {
{
0x0001ffff,
0x00000007,
@@ -23761,9 +23760,9 @@ const uint32_t c_aauiCQMFHuffDec37[4][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc38[49][2] =
+const uint32_t c_aauiLCLDHuffEnc38[49][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc38[49][2] =
+const uint16_t c_aauiLCLDHuffEnc38[49][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -23819,7 +23818,7 @@ const uint16_t c_aauiCQMFHuffEnc38[49][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec38[22][16] = {
+const uint32_t c_aauiLCLDHuffDec38[22][16] = {
{
0x0001ffff,
0x00000008,
@@ -24220,9 +24219,9 @@ const uint32_t c_aauiCQMFHuffDec38[22][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc39[64][2] =
+const uint32_t c_aauiLCLDHuffEnc39[64][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc39[64][2] =
+const uint16_t c_aauiLCLDHuffEnc39[64][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -24292,7 +24291,7 @@ const uint16_t c_aauiCQMFHuffEnc39[64][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec39[12][16] = {
+const uint32_t c_aauiLCLDHuffDec39[12][16] = {
{
0x0001ffff,
0x00000009,
@@ -24513,9 +24512,9 @@ const uint32_t c_aauiCQMFHuffDec39[12][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc40[81][2] =
+const uint32_t c_aauiLCLDHuffEnc40[81][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc40[81][2] =
+const uint16_t c_aauiLCLDHuffEnc40[81][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -24603,7 +24602,7 @@ const uint16_t c_aauiCQMFHuffEnc40[81][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec40[36][16] = {
+const uint32_t c_aauiLCLDHuffDec40[36][16] = {
{
0x0001ffff,
0x0000000a,
@@ -25256,9 +25255,9 @@ const uint32_t c_aauiCQMFHuffDec40[36][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc41[100][2] =
+const uint32_t c_aauiLCLDHuffEnc41[100][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc41[100][2] =
+const uint16_t c_aauiLCLDHuffEnc41[100][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -25365,7 +25364,7 @@ const uint16_t c_aauiCQMFHuffEnc41[100][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec41[16][16] = {
+const uint32_t c_aauiLCLDHuffDec41[16][16] = {
{
0x0001ffff,
0x0000000b,
@@ -25658,9 +25657,9 @@ const uint32_t c_aauiCQMFHuffDec41[16][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc42[169][2] =
+const uint32_t c_aauiLCLDHuffEnc42[169][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc42[169][2] =
+const uint16_t c_aauiLCLDHuffEnc42[169][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -25836,7 +25835,7 @@ const uint16_t c_aauiCQMFHuffEnc42[169][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec42[28][16] = {
+const uint32_t c_aauiLCLDHuffDec42[28][16] = {
{
0x0001ffff,
0x0002ffff,
@@ -26345,9 +26344,9 @@ const uint32_t c_aauiCQMFHuffDec42[28][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc43[196][2] =
+const uint32_t c_aauiLCLDHuffEnc43[196][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc43[196][2] =
+const uint16_t c_aauiLCLDHuffEnc43[196][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -26550,7 +26549,7 @@ const uint16_t c_aauiCQMFHuffEnc43[196][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec43[32][16] = {
+const uint32_t c_aauiLCLDHuffDec43[32][16] = {
{
0x0001ffff,
0x0002ffff,
@@ -27131,9 +27130,9 @@ const uint32_t c_aauiCQMFHuffDec43[32][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc44[289][2] =
+const uint32_t c_aauiLCLDHuffEnc44[289][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc44[289][2] =
+const uint16_t c_aauiLCLDHuffEnc44[289][2] =
#endif
{
{ 0x0001, 0x0001 },
@@ -27429,7 +27428,7 @@ const uint16_t c_aauiCQMFHuffEnc44[289][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec44[27][16] = {
+const uint32_t c_aauiLCLDHuffDec44[27][16] = {
{
0x0002ffff,
0x0001ffff,
@@ -27920,9 +27919,9 @@ const uint32_t c_aauiCQMFHuffDec44[27][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc45[324][2] =
+const uint32_t c_aauiLCLDHuffEnc45[324][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc45[324][2] =
+const uint16_t c_aauiLCLDHuffEnc45[324][2] =
#endif
{
{ 0x0002, 0x0002 },
@@ -28253,7 +28252,7 @@ const uint16_t c_aauiCQMFHuffEnc45[324][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec45[50][16] = {
+const uint32_t c_aauiLCLDHuffDec45[50][16] = {
{
0x0003ffff,
0x0001ffff,
@@ -29158,9 +29157,9 @@ const uint32_t c_aauiCQMFHuffDec45[50][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc46[400][2] =
+const uint32_t c_aauiLCLDHuffEnc46[400][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc46[400][2] =
+const uint16_t c_aauiLCLDHuffEnc46[400][2] =
#endif
{
{ 0x0002, 0x0002 },
@@ -29566,7 +29565,7 @@ const uint16_t c_aauiCQMFHuffEnc46[400][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec46[61][16] = {
+const uint32_t c_aauiLCLDHuffDec46[61][16] = {
{
0x0004ffff,
0x0001ffff,
@@ -30669,9 +30668,9 @@ const uint32_t c_aauiCQMFHuffDec46[61][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc47[576][2] =
+const uint32_t c_aauiLCLDHuffEnc47[576][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc47[576][2] =
+const uint16_t c_aauiLCLDHuffEnc47[576][2] =
#endif
{
{ 0x0002, 0x0003 },
@@ -31253,7 +31252,7 @@ const uint16_t c_aauiCQMFHuffEnc47[576][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec47[87][16] = {
+const uint32_t c_aauiLCLDHuffDec47[87][16] = {
{
0x0004ffff,
0x0003ffff,
@@ -32824,9 +32823,9 @@ const uint32_t c_aauiCQMFHuffDec47[87][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc48[729][2] =
+const uint32_t c_aauiLCLDHuffEnc48[729][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc48[729][2] =
+const uint16_t c_aauiLCLDHuffEnc48[729][2] =
#endif
{
{ 0x0002, 0x0003 },
@@ -33562,7 +33561,7 @@ const uint16_t c_aauiCQMFHuffEnc48[729][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec48[110][16] = {
+const uint32_t c_aauiLCLDHuffDec48[110][16] = {
{
0x0005ffff,
0x0003ffff,
@@ -35547,9 +35546,9 @@ const uint32_t c_aauiCQMFHuffDec48[110][16] = {
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc49[729][2] =
+const uint32_t c_aauiLCLDHuffEnc49[729][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc49[729][2] =
+const uint16_t c_aauiLCLDHuffEnc49[729][2] =
#endif
{
{ 0x0002, 0x0003 },
@@ -36284,7 +36283,7 @@ const uint16_t c_aauiCQMFHuffEnc49[729][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec49[113][16] = {
+const uint32_t c_aauiLCLDHuffDec49[113][16] = {
{
0x0006ffff,
0x0005ffff,
@@ -38322,9 +38321,9 @@ const uint32_t c_aauiCQMFHuffDec49[113][16] = {
};
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc50[28][2] =
+const uint32_t c_aauiLCLDHuffEnc50[28][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc50[28][2] =
+const uint16_t c_aauiLCLDHuffEnc50[28][2] =
#endif
{
{ 0x0002, 0x0001 },
@@ -38358,7 +38357,7 @@ const uint16_t c_aauiCQMFHuffEnc50[28][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec50[6][16] = {
+const uint32_t c_aauiLCLDHuffDec50[6][16] = {
{
0x0001ffff,
0x00000004,
@@ -38470,9 +38469,9 @@ const uint32_t c_aauiCQMFHuffDec50[6][16] = {
};
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc51[29][2] =
+const uint32_t c_aauiLCLDHuffEnc51[29][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc51[29][2] =
+const uint16_t c_aauiLCLDHuffEnc51[29][2] =
#endif
{
{ 0x0002, 0x0002 },
@@ -38507,7 +38506,7 @@ const uint16_t c_aauiCQMFHuffEnc51[29][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec51[6][16] = {
+const uint32_t c_aauiLCLDHuffDec51[6][16] = {
{
0x0001ffff,
0x00000004,
@@ -38619,9 +38618,9 @@ const uint32_t c_aauiCQMFHuffDec51[6][16] = {
};
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc52[32][2] =
+const uint32_t c_aauiLCLDHuffEnc52[32][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc52[32][2] =
+const uint16_t c_aauiLCLDHuffEnc52[32][2] =
#endif
{
{ 0x0002, 0x0002 },
@@ -38658,7 +38657,7 @@ const uint16_t c_aauiCQMFHuffEnc52[32][2] =
{ 0x0013, 0x0005 },
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec52[7][16] = {
+const uint32_t c_aauiLCLDHuffDec52[7][16] = {
{
0x0001ffff,
0x0002ffff,
@@ -38788,9 +38787,9 @@ const uint32_t c_aauiCQMFHuffDec52[7][16] = {
};
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc53[37][2] =
+const uint32_t c_aauiLCLDHuffEnc53[37][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc53[37][2] =
+const uint16_t c_aauiLCLDHuffEnc53[37][2] =
#endif
{
{ 0x0002, 0x0002 },
@@ -38833,7 +38832,7 @@ const uint16_t c_aauiCQMFHuffEnc53[37][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec53[9][16] = {
+const uint32_t c_aauiLCLDHuffDec53[9][16] = {
{
0x0002ffff,
0x0001ffff,
@@ -38999,9 +38998,9 @@ const uint32_t c_aauiCQMFHuffDec53[9][16] = {
};
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc54[39][2] =
+const uint32_t c_aauiLCLDHuffEnc54[39][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc54[39][2] =
+const uint16_t c_aauiLCLDHuffEnc54[39][2] =
#endif
{
{ 0x0002, 0x0002 },
@@ -39046,7 +39045,7 @@ const uint16_t c_aauiCQMFHuffEnc54[39][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec54[9][16] = {
+const uint32_t c_aauiLCLDHuffDec54[9][16] = {
{
0x0003ffff,
0x0001ffff,
@@ -39212,9 +39211,9 @@ const uint32_t c_aauiCQMFHuffDec54[9][16] = {
};
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc55[46][2] =
+const uint32_t c_aauiLCLDHuffEnc55[46][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc55[46][2] =
+const uint16_t c_aauiLCLDHuffEnc55[46][2] =
#endif
{
{ 0x0003, 0x0003 },
@@ -39266,7 +39265,7 @@ const uint16_t c_aauiCQMFHuffEnc55[46][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec55[10][16] = {
+const uint32_t c_aauiLCLDHuffDec55[10][16] = {
{
0x0003ffff,
0x0001ffff,
@@ -39450,9 +39449,9 @@ const uint32_t c_aauiCQMFHuffDec55[10][16] = {
};
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc56[55][2] =
+const uint32_t c_aauiLCLDHuffEnc56[55][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc56[55][2] =
+const uint16_t c_aauiLCLDHuffEnc56[55][2] =
#endif
{
{ 0x0003, 0x0003 },
@@ -39513,7 +39512,7 @@ const uint16_t c_aauiCQMFHuffEnc56[55][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec56[12][16] = {
+const uint32_t c_aauiLCLDHuffDec56[12][16] = {
{
0x0004ffff,
0x0001ffff,
@@ -39733,9 +39732,9 @@ const uint32_t c_aauiCQMFHuffDec56[12][16] = {
};
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc57[65][2] =
+const uint32_t c_aauiLCLDHuffEnc57[65][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc57[65][2] =
+const uint16_t c_aauiLCLDHuffEnc57[65][2] =
#endif
{
{ 0x0003, 0x0004 },
@@ -39806,7 +39805,7 @@ const uint16_t c_aauiCQMFHuffEnc57[65][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec57[14][16] = {
+const uint32_t c_aauiLCLDHuffDec57[14][16] = {
{
0x0004ffff,
0x0003ffff,
@@ -40062,9 +40061,9 @@ const uint32_t c_aauiCQMFHuffDec57[14][16] = {
};
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc58[77][2] =
+const uint32_t c_aauiLCLDHuffEnc58[77][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc58[77][2] =
+const uint16_t c_aauiLCLDHuffEnc58[77][2] =
#endif
{
{ 0x0004, 0x0005 },
@@ -40147,7 +40146,7 @@ const uint16_t c_aauiCQMFHuffEnc58[77][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec58[17][16] = {
+const uint32_t c_aauiLCLDHuffDec58[17][16] = {
{
0x0005ffff,
0x0004ffff,
@@ -40457,9 +40456,9 @@ const uint32_t c_aauiCQMFHuffDec58[17][16] = {
};
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc59[91][2] =
+const uint32_t c_aauiLCLDHuffEnc59[91][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc59[91][2] =
+const uint16_t c_aauiLCLDHuffEnc59[91][2] =
#endif
{
{ 0x0003, 0x0005 },
@@ -40556,7 +40555,7 @@ const uint16_t c_aauiCQMFHuffEnc59[91][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec59[20][16] = {
+const uint32_t c_aauiLCLDHuffDec59[20][16] = {
{
0x0006ffff,
0x0004ffff,
@@ -40920,9 +40919,9 @@ const uint32_t c_aauiCQMFHuffDec59[20][16] = {
};
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc60[109][2] =
+const uint32_t c_aauiLCLDHuffEnc60[109][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc60[109][2] =
+const uint16_t c_aauiLCLDHuffEnc60[109][2] =
#endif
{
{ 0x0004, 0x0007 },
@@ -41037,7 +41036,7 @@ const uint16_t c_aauiCQMFHuffEnc60[109][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec60[24][16] = {
+const uint32_t c_aauiLCLDHuffDec60[24][16] = {
{
0x0007ffff,
0x0005ffff,
@@ -41473,9 +41472,9 @@ const uint32_t c_aauiCQMFHuffDec60[24][16] = {
};
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc61[129][2] =
+const uint32_t c_aauiLCLDHuffEnc61[129][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc61[129][2] =
+const uint16_t c_aauiLCLDHuffEnc61[129][2] =
#endif
{
{ 0x0004, 0x0008 },
@@ -41610,7 +41609,7 @@ const uint16_t c_aauiCQMFHuffEnc61[129][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec61[33][16] = {
+const uint32_t c_aauiLCLDHuffDec61[33][16] = {
{
0x0008ffff,
0x0007ffff,
@@ -42208,9 +42207,9 @@ const uint32_t c_aauiCQMFHuffDec61[33][16] = {
};
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc62[153][2] =
+const uint32_t c_aauiLCLDHuffEnc62[153][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc62[153][2] =
+const uint16_t c_aauiLCLDHuffEnc62[153][2] =
#endif
{
{ 0x0004, 0x0009 },
@@ -42369,7 +42368,7 @@ const uint16_t c_aauiCQMFHuffEnc62[153][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec62[41][16] = {
+const uint32_t c_aauiLCLDHuffDec62[41][16] = {
{
0x0009ffff,
0x0008ffff,
@@ -43111,9 +43110,9 @@ const uint32_t c_aauiCQMFHuffDec62[41][16] = {
};
#endif
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffEnc63[181][2] =
+const uint32_t c_aauiLCLDHuffEnc63[181][2] =
#else
-const uint16_t c_aauiCQMFHuffEnc63[181][2] =
+const uint16_t c_aauiLCLDHuffEnc63[181][2] =
#endif
{
{ 0x0004, 0x0008 },
@@ -43300,7 +43299,7 @@ const uint16_t c_aauiCQMFHuffEnc63[181][2] =
};
#ifndef ROM_TO_RAM
-const uint32_t c_aauiCQMFHuffDec63[39][16] = {
+const uint32_t c_aauiLCLDHuffDec63[39][16] = {
{
0x0008ffff,
0x0006ffff,
@@ -44013,139 +44012,139 @@ const uint16_t ( *c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE] )[2] =
#endif
{
NULL,
- c_aauiCQMFHuffEnc1,
- c_aauiCQMFHuffEnc2,
- c_aauiCQMFHuffEnc3,
- c_aauiCQMFHuffEnc4,
- c_aauiCQMFHuffEnc5,
- c_aauiCQMFHuffEnc6,
- c_aauiCQMFHuffEnc7,
- c_aauiCQMFHuffEnc8,
- c_aauiCQMFHuffEnc9,
- c_aauiCQMFHuffEnc10,
- c_aauiCQMFHuffEnc11,
- c_aauiCQMFHuffEnc12,
- c_aauiCQMFHuffEnc13,
- c_aauiCQMFHuffEnc14,
- c_aauiCQMFHuffEnc15,
- c_aauiCQMFHuffEnc16,
- c_aauiCQMFHuffEnc17,
- c_aauiCQMFHuffEnc18,
- c_aauiCQMFHuffEnc19,
- c_aauiCQMFHuffEnc20,
- c_aauiCQMFHuffEnc21,
- c_aauiCQMFHuffEnc22,
- c_aauiCQMFHuffEnc23,
- c_aauiCQMFHuffEnc24,
- c_aauiCQMFHuffEnc25,
- c_aauiCQMFHuffEnc26,
- c_aauiCQMFHuffEnc27,
- c_aauiCQMFHuffEnc28,
- c_aauiCQMFHuffEnc29,
- c_aauiCQMFHuffEnc30,
- c_aauiCQMFHuffEnc31,
+ c_aauiLCLDHuffEnc1,
+ c_aauiLCLDHuffEnc2,
+ c_aauiLCLDHuffEnc3,
+ c_aauiLCLDHuffEnc4,
+ c_aauiLCLDHuffEnc5,
+ c_aauiLCLDHuffEnc6,
+ c_aauiLCLDHuffEnc7,
+ c_aauiLCLDHuffEnc8,
+ c_aauiLCLDHuffEnc9,
+ c_aauiLCLDHuffEnc10,
+ c_aauiLCLDHuffEnc11,
+ c_aauiLCLDHuffEnc12,
+ c_aauiLCLDHuffEnc13,
+ c_aauiLCLDHuffEnc14,
+ c_aauiLCLDHuffEnc15,
+ c_aauiLCLDHuffEnc16,
+ c_aauiLCLDHuffEnc17,
+ c_aauiLCLDHuffEnc18,
+ c_aauiLCLDHuffEnc19,
+ c_aauiLCLDHuffEnc20,
+ c_aauiLCLDHuffEnc21,
+ c_aauiLCLDHuffEnc22,
+ c_aauiLCLDHuffEnc23,
+ c_aauiLCLDHuffEnc24,
+ c_aauiLCLDHuffEnc25,
+ c_aauiLCLDHuffEnc26,
+ c_aauiLCLDHuffEnc27,
+ c_aauiLCLDHuffEnc28,
+ c_aauiLCLDHuffEnc29,
+ c_aauiLCLDHuffEnc30,
+ c_aauiLCLDHuffEnc31,
NULL,
- c_aauiCQMFHuffEnc33,
- c_aauiCQMFHuffEnc34,
- c_aauiCQMFHuffEnc35,
- c_aauiCQMFHuffEnc36,
- c_aauiCQMFHuffEnc37,
- c_aauiCQMFHuffEnc38,
- c_aauiCQMFHuffEnc39,
- c_aauiCQMFHuffEnc40,
- c_aauiCQMFHuffEnc41,
- c_aauiCQMFHuffEnc42,
- c_aauiCQMFHuffEnc43,
- c_aauiCQMFHuffEnc44,
- c_aauiCQMFHuffEnc45,
- c_aauiCQMFHuffEnc46,
- c_aauiCQMFHuffEnc47,
- c_aauiCQMFHuffEnc48,
- c_aauiCQMFHuffEnc49,
- c_aauiCQMFHuffEnc50,
- c_aauiCQMFHuffEnc51,
- c_aauiCQMFHuffEnc52,
- c_aauiCQMFHuffEnc53,
- c_aauiCQMFHuffEnc54,
- c_aauiCQMFHuffEnc55,
- c_aauiCQMFHuffEnc56,
- c_aauiCQMFHuffEnc57,
- c_aauiCQMFHuffEnc58,
- c_aauiCQMFHuffEnc59,
- c_aauiCQMFHuffEnc60,
- c_aauiCQMFHuffEnc61,
- c_aauiCQMFHuffEnc62,
- c_aauiCQMFHuffEnc63,
+ c_aauiLCLDHuffEnc33,
+ c_aauiLCLDHuffEnc34,
+ c_aauiLCLDHuffEnc35,
+ c_aauiLCLDHuffEnc36,
+ c_aauiLCLDHuffEnc37,
+ c_aauiLCLDHuffEnc38,
+ c_aauiLCLDHuffEnc39,
+ c_aauiLCLDHuffEnc40,
+ c_aauiLCLDHuffEnc41,
+ c_aauiLCLDHuffEnc42,
+ c_aauiLCLDHuffEnc43,
+ c_aauiLCLDHuffEnc44,
+ c_aauiLCLDHuffEnc45,
+ c_aauiLCLDHuffEnc46,
+ c_aauiLCLDHuffEnc47,
+ c_aauiLCLDHuffEnc48,
+ c_aauiLCLDHuffEnc49,
+ c_aauiLCLDHuffEnc50,
+ c_aauiLCLDHuffEnc51,
+ c_aauiLCLDHuffEnc52,
+ c_aauiLCLDHuffEnc53,
+ c_aauiLCLDHuffEnc54,
+ c_aauiLCLDHuffEnc55,
+ c_aauiLCLDHuffEnc56,
+ c_aauiLCLDHuffEnc57,
+ c_aauiLCLDHuffEnc58,
+ c_aauiLCLDHuffEnc59,
+ c_aauiLCLDHuffEnc60,
+ c_aauiLCLDHuffEnc61,
+ c_aauiLCLDHuffEnc62,
+ c_aauiLCLDHuffEnc63,
};
#ifndef ROM_TO_RAM
const uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE] = {
NULL,
- c_aauiCQMFHuffDec1,
- c_aauiCQMFHuffDec2,
- c_aauiCQMFHuffDec3,
- c_aauiCQMFHuffDec4,
- c_aauiCQMFHuffDec5,
- c_aauiCQMFHuffDec6,
- c_aauiCQMFHuffDec7,
- c_aauiCQMFHuffDec8,
- c_aauiCQMFHuffDec9,
- c_aauiCQMFHuffDec10,
- c_aauiCQMFHuffDec11,
- c_aauiCQMFHuffDec12,
- c_aauiCQMFHuffDec13,
- c_aauiCQMFHuffDec14,
- c_aauiCQMFHuffDec15,
- c_aauiCQMFHuffDec16,
- c_aauiCQMFHuffDec17,
- c_aauiCQMFHuffDec18,
- c_aauiCQMFHuffDec19,
- c_aauiCQMFHuffDec20,
- c_aauiCQMFHuffDec21,
- c_aauiCQMFHuffDec22,
- c_aauiCQMFHuffDec23,
- c_aauiCQMFHuffDec24,
- c_aauiCQMFHuffDec25,
- c_aauiCQMFHuffDec26,
- c_aauiCQMFHuffDec27,
- c_aauiCQMFHuffDec28,
- c_aauiCQMFHuffDec29,
- c_aauiCQMFHuffDec30,
- c_aauiCQMFHuffDec31,
+ c_aauiLCLDHuffDec1,
+ c_aauiLCLDHuffDec2,
+ c_aauiLCLDHuffDec3,
+ c_aauiLCLDHuffDec4,
+ c_aauiLCLDHuffDec5,
+ c_aauiLCLDHuffDec6,
+ c_aauiLCLDHuffDec7,
+ c_aauiLCLDHuffDec8,
+ c_aauiLCLDHuffDec9,
+ c_aauiLCLDHuffDec10,
+ c_aauiLCLDHuffDec11,
+ c_aauiLCLDHuffDec12,
+ c_aauiLCLDHuffDec13,
+ c_aauiLCLDHuffDec14,
+ c_aauiLCLDHuffDec15,
+ c_aauiLCLDHuffDec16,
+ c_aauiLCLDHuffDec17,
+ c_aauiLCLDHuffDec18,
+ c_aauiLCLDHuffDec19,
+ c_aauiLCLDHuffDec20,
+ c_aauiLCLDHuffDec21,
+ c_aauiLCLDHuffDec22,
+ c_aauiLCLDHuffDec23,
+ c_aauiLCLDHuffDec24,
+ c_aauiLCLDHuffDec25,
+ c_aauiLCLDHuffDec26,
+ c_aauiLCLDHuffDec27,
+ c_aauiLCLDHuffDec28,
+ c_aauiLCLDHuffDec29,
+ c_aauiLCLDHuffDec30,
+ c_aauiLCLDHuffDec31,
NULL,
- c_aauiCQMFHuffDec33,
- c_aauiCQMFHuffDec34,
- c_aauiCQMFHuffDec35,
- c_aauiCQMFHuffDec36,
- c_aauiCQMFHuffDec37,
- c_aauiCQMFHuffDec38,
- c_aauiCQMFHuffDec39,
- c_aauiCQMFHuffDec40,
- c_aauiCQMFHuffDec41,
- c_aauiCQMFHuffDec42,
- c_aauiCQMFHuffDec43,
- c_aauiCQMFHuffDec44,
- c_aauiCQMFHuffDec45,
- c_aauiCQMFHuffDec46,
- c_aauiCQMFHuffDec47,
- c_aauiCQMFHuffDec48,
- c_aauiCQMFHuffDec49,
- c_aauiCQMFHuffDec50,
- c_aauiCQMFHuffDec51,
- c_aauiCQMFHuffDec52,
- c_aauiCQMFHuffDec53,
- c_aauiCQMFHuffDec54,
- c_aauiCQMFHuffDec55,
- c_aauiCQMFHuffDec56,
- c_aauiCQMFHuffDec57,
- c_aauiCQMFHuffDec58,
- c_aauiCQMFHuffDec59,
- c_aauiCQMFHuffDec60,
- c_aauiCQMFHuffDec61,
- c_aauiCQMFHuffDec62,
- c_aauiCQMFHuffDec63,
+ c_aauiLCLDHuffDec33,
+ c_aauiLCLDHuffDec34,
+ c_aauiLCLDHuffDec35,
+ c_aauiLCLDHuffDec36,
+ c_aauiLCLDHuffDec37,
+ c_aauiLCLDHuffDec38,
+ c_aauiLCLDHuffDec39,
+ c_aauiLCLDHuffDec40,
+ c_aauiLCLDHuffDec41,
+ c_aauiLCLDHuffDec42,
+ c_aauiLCLDHuffDec43,
+ c_aauiLCLDHuffDec44,
+ c_aauiLCLDHuffDec45,
+ c_aauiLCLDHuffDec46,
+ c_aauiLCLDHuffDec47,
+ c_aauiLCLDHuffDec48,
+ c_aauiLCLDHuffDec49,
+ c_aauiLCLDHuffDec50,
+ c_aauiLCLDHuffDec51,
+ c_aauiLCLDHuffDec52,
+ c_aauiLCLDHuffDec53,
+ c_aauiLCLDHuffDec54,
+ c_aauiLCLDHuffDec55,
+ c_aauiLCLDHuffDec56,
+ c_aauiLCLDHuffDec57,
+ c_aauiLCLDHuffDec58,
+ c_aauiLCLDHuffDec59,
+ c_aauiLCLDHuffDec60,
+ c_aauiLCLDHuffDec61,
+ c_aauiLCLDHuffDec62,
+ c_aauiLCLDHuffDec63,
};
#else
-const uint32_t num_row_aauiCQMFHuff[2 * ALLOC_TABLE_SIZE] = { 0, 16, 16, 25, 36, 36, 49, 64, 81, 100,
+const uint32_t num_row_aauiLCLDHuff[2 * ALLOC_TABLE_SIZE] = { 0, 16, 16, 25, 36, 36, 49, 64, 81, 100,
169, 196, 289, 324, 400, 576, 729, 729, 28, 29,
32, 37, 39, 46, 55, 65, 77, 91, 109, 129,
153, 181, 0, 16, 16, 25, 36, 36, 49, 64, 81,
diff --git a/lib_rend/ivas_lcld_rom_tables.h b/lib_rend/ivas_lcld_rom_tables.h
new file mode 100644
index 0000000000000000000000000000000000000000..e4321fa003b41b3b085e532de67c7e621c8186de
--- /dev/null
+++ b/lib_rend/ivas_lcld_rom_tables.h
@@ -0,0 +1,423 @@
+/******************************************************************************************************
+
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
+ Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
+ Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+ contributors to this repository. All Rights Reserved.
+
+ This software is protected by copyright law and by international treaties.
+ The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
+ Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
+ Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
+ Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+ contributors to this repository retain full ownership rights in their respective contributions in
+ the software. This notice grants no license of any kind, including but not limited to patent
+ license, nor is any license granted by implication, estoppel or otherwise.
+
+ Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
+ contributions.
+
+ This software is provided "AS IS", without any express or implied warranties. The software is in the
+ development stage. It is intended exclusively for experts who have experience with such software and
+ solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
+ and fitness for a particular purpose are hereby disclaimed and excluded.
+
+ Any dispute, controversy or claim arising under or in relation to providing this software shall be
+ submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
+ accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
+ the United Nations Convention on Contracts on the International Sales of Goods.
+
+*******************************************************************************************************/
+
+#ifndef _IVAS_TABLES_H_
+#define _IVAS_TABLES_H_
+
+#include
+#include "options.h"
+
+#ifndef M_PI
+
+#define M_PI 3.14159265358979323846264338327950288f // todo: replace by EVS_PI
+
+#endif
+
+#define LCLD_BLOCKS_PER_FRAME ( 16 )
+#define LCLD_MAX_BLOCKS_PER_FRAME ( 16 )
+#define LCLD_BANDS ( 60 )
+
+#define MAX_BANDS ( 23 )
+#define MAX_BANDS_48 ( 23 )
+
+#define ENV_MIN ( -64 )
+#define ENV_MAX ( 64 )
+
+#define ENV0_BITS ( 7 )
+
+#define ENV_DELTA_MIN ( -32 )
+#define ENV_DELTA_MAX ( 31 )
+
+#define ENV_RECONSTRUCT_TABLE_SIZE ( 129 )
+
+#define ENV_RECONSTRUCT_TABLE_CENTER ( 64 )
+
+#define MIN_ALLOC ( 0 )
+#define MAX_ALLOC ( 31 )
+
+#define ALLOC_OFFSET_SCALE ( 8 )
+
+#define ALLOC_OFFSET_BITS ( 8 )
+
+#define MIN_ALLOC_OFFSET ( -128 )
+#define MAX_ALLOC_OFFSET ( 127 )
+#ifdef ROM_TO_RAM
+#define READ_LENGTH ( 4 )
+#endif
+
+#define ALLOC_TABLE_SIZE ( 32 )
+
+#ifndef _PI_
+#define _PI_ ( 3.14159265358979f )
+#endif
+#define PRED_MAX_VAL ( 12 )
+#define PRED_MIN_VAL ( -PRED_MAX_VAL )
+#define PRED_QUANT_FACTOR ( (float) PRED_MAX_VAL )
+#define PRED_BAND0_BITS ( 5 )
+
+#define PHASE_MAX_VAL ( 12 )
+#define PHASE_MIN_VAL ( -PHASE_MAX_VAL )
+#define PHASE_QUANT_FACTOR ( (float) PHASE_MAX_VAL / _PI_ )
+#define PHASE_DIFF_DIM ( 2 )
+#define PHASE_BAND0_BITS ( 5 )
+
+#define SIMPLE_PHASE_MAX_VAL ( 3 )
+#define SIMPLE_PHASE_MIN_VAL ( 0 )
+#define SIMPLE_PHASE_BITS ( 2 )
+#define SIMPLE_PHASE_QUANT_FACTOR ( 2.0f / _PI_ )
+
+#define TON_QUOTA_ABS_THRESHOLD ( 8.0f )
+#define TON_QUOTA_INC_THRESHOLD ( 4.0f )
+
+#define PERCEPTUAL_MODEL_SLGAIN_SHIFT ( 8 )
+
+//#define USE_DEMOD_TABLES
+
+#define HUFF_DEC_TABLE_SIZE ( 16 )
+
+extern const float c_afRotRealImag[PRED_MAX_VAL - PRED_MIN_VAL + 1][2];
+extern const float c_afRotRealImagSimple[SIMPLE_PHASE_MAX_VAL + 1][2];
+extern const int32_t c_aiDefaultTheta48[MAX_BANDS_48];
+
+extern const float c_afScaleFactor[ALLOC_TABLE_SIZE];
+extern const float c_afInvScaleFactor[ALLOC_TABLE_SIZE];
+extern const float c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_SIZE];
+extern const int32_t c_aiQuantMaxValues[ALLOC_TABLE_SIZE];
+extern const int32_t c_aiHuffmanDim[ALLOC_TABLE_SIZE];
+extern const int32_t c_aiHuffmanMod[ALLOC_TABLE_SIZE];
+extern const int32_t c_aiHuffmanSize[ALLOC_TABLE_SIZE];
+
+
+#define LOG_ADD_TABLE_LENGTH ( 512 )
+
+extern const int32_t c_aiBandwidths48[MAX_BANDS_48];
+extern const int32_t c_aiLogAddTable[LOG_ADD_TABLE_LENGTH];
+extern const int32_t c_aiBandwidthAdjust48[MAX_BANDS_48];
+extern const int32_t c_aiAbsoluteThresh48[MAX_BANDS_48];
+extern const int32_t c_aiDefaultTheta48[MAX_BANDS_48];
+extern const int32_t c_aaiSpreadFunction48[MAX_BANDS_48 * MAX_BANDS_48];
+
+
+#define PRED_QUNAT_FILTER_MAG_BITS ( 3 )
+#define PRED_QUANT_FILTER_PHASE_BITS ( 5 )
+#define PRED_QUANT_FILTER_MAG_MIN ( 0 )
+#define PRED_QUANT_FILTER_MAG_MAX ( 7 )
+#define PRED_QUANT_FILTER_PHASE_MIN ( -16 )
+#define PRED_QUANT_FILTER_PHASE_MAX ( 15 )
+
+
+#ifndef ROM_TO_RAM
+extern const uint32_t c_aauiLCLDHuffEnc1[16][2];
+
+extern const uint32_t c_aauiLCLDHuffDec1[3][16];
+
+extern const uint32_t c_aauiLCLDHuffEnc2[16][2];
+
+extern const uint32_t c_aauiLCLDHuffDec2[3][16];
+extern const uint32_t c_aauiLCLDHuffEnc3[25][2];
+
+extern const uint32_t c_aauiLCLDHuffDec3[10][16];
+extern const uint32_t c_aauiLCLDHuffEnc4[36][2];
+
+extern const uint32_t c_aauiLCLDHuffDec4[5][16];
+extern const uint32_t c_aauiLCLDHuffEnc5[36][2];
+
+extern const uint32_t c_aauiLCLDHuffDec5[10][16];
+extern const uint32_t c_aauiLCLDHuffEnc6[49][2];
+
+extern const uint32_t c_aauiLCLDHuffDec6[7][16];
+extern const uint32_t c_aauiLCLDHuffEnc7[64][2];
+
+extern const uint32_t c_aauiLCLDHuffDec7[25][16];
+extern const uint32_t c_aauiLCLDHuffEnc8[81][2];
+
+extern const uint32_t c_aauiLCLDHuffDec8[16][16];
+extern const uint32_t c_aauiLCLDHuffEnc9[100][2];
+
+extern const uint32_t c_aauiLCLDHuffDec9[22][16];
+extern const uint32_t c_aauiLCLDHuffEnc10[169][2];
+
+extern const uint32_t c_aauiLCLDHuffDec10[45][16];
+extern const uint32_t c_aauiLCLDHuffEnc11[196][2];
+
+extern const uint32_t c_aauiLCLDHuffDec11[50][16];
+extern const uint32_t c_aauiLCLDHuffEnc12[289][2];
+
+extern const uint32_t c_aauiLCLDHuffDec12[76][16];
+extern const uint32_t c_aauiLCLDHuffEnc13[324][2];
+
+extern const uint32_t c_aauiLCLDHuffDec13[89][16];
+extern const uint32_t c_aauiLCLDHuffEnc14[400][2];
+
+extern const uint32_t c_aauiLCLDHuffDec14[53][16];
+extern const uint32_t c_aauiLCLDHuffEnc15[576][2];
+
+extern const uint32_t c_aauiLCLDHuffDec15[73][16];
+extern const uint32_t c_aauiLCLDHuffEnc16[729][2];
+
+extern const uint32_t c_aauiLCLDHuffDec16[85][16];
+extern const uint32_t c_aauiLCLDHuffEnc17[729][2];
+
+extern const uint32_t c_aauiLCLDHuffDec17[93][16];
+extern const uint32_t c_aauiLCLDHuffEnc18[28][2];
+
+extern const uint32_t c_aauiLCLDHuffDec18[6][16];
+extern const uint32_t c_aauiLCLDHuffEnc19[29][2];
+
+extern const uint32_t c_aauiLCLDHuffDec19[6][16];
+extern const uint32_t c_aauiLCLDHuffEnc20[32][2];
+
+extern const uint32_t c_aauiLCLDHuffDec20[6][16];
+extern const uint32_t c_aauiLCLDHuffEnc21[37][2];
+
+extern const uint32_t c_aauiLCLDHuffDec21[7][16];
+extern const uint32_t c_aauiLCLDHuffEnc22[39][2];
+
+extern const uint32_t c_aauiLCLDHuffDec22[9][16];
+extern const uint32_t c_aauiLCLDHuffEnc23[46][2];
+
+extern const uint32_t c_aauiLCLDHuffDec23[12][16];
+extern const uint32_t c_aauiLCLDHuffEnc24[55][2];
+
+extern const uint32_t c_aauiLCLDHuffDec24[17][16];
+extern const uint32_t c_aauiLCLDHuffEnc25[65][2];
+
+extern const uint32_t c_aauiLCLDHuffDec25[19][16];
+extern const uint32_t c_aauiLCLDHuffEnc26[77][2];
+
+extern const uint32_t c_aauiLCLDHuffDec26[26][16];
+extern const uint32_t c_aauiLCLDHuffEnc27[91][2];
+
+extern const uint32_t c_aauiLCLDHuffDec27[28][16];
+extern const uint32_t c_aauiLCLDHuffEnc28[109][2];
+
+extern const uint32_t c_aauiLCLDHuffDec28[30][16];
+extern const uint32_t c_aauiLCLDHuffEnc29[129][2];
+
+extern const uint32_t c_aauiLCLDHuffDec29[34][16];
+extern const uint32_t c_aauiLCLDHuffEnc30[153][2];
+
+extern const uint32_t c_aauiLCLDHuffDec30[39][16];
+extern const uint32_t c_aauiLCLDHuffEnc31[181][2];
+
+extern const uint32_t c_aauiLCLDHuffDec31[43][16];
+extern const uint32_t c_aauiLCLDHuffEnc33[16][2];
+
+extern const uint32_t c_aauiLCLDHuffDec33[2][16];
+extern const uint32_t c_aauiLCLDHuffEnc34[16][2];
+
+extern const uint32_t c_aauiLCLDHuffDec34[2][16];
+extern const uint32_t c_aauiLCLDHuffEnc35[25][2];
+
+extern const uint32_t c_aauiLCLDHuffDec35[9][16];
+extern const uint32_t c_aauiLCLDHuffEnc36[36][2];
+
+extern const uint32_t c_aauiLCLDHuffDec36[7][16];
+extern const uint32_t c_aauiLCLDHuffEnc37[36][2];
+
+extern const uint32_t c_aauiLCLDHuffDec37[4][16];
+extern const uint32_t c_aauiLCLDHuffEnc38[49][2];
+
+extern const uint32_t c_aauiLCLDHuffDec38[22][16];
+extern const uint32_t c_aauiLCLDHuffEnc39[64][2];
+
+extern const uint32_t c_aauiLCLDHuffDec39[12][16];
+extern const uint32_t c_aauiLCLDHuffEnc40[81][2];
+
+extern const uint32_t c_aauiLCLDHuffDec40[36][16];
+extern const uint32_t c_aauiLCLDHuffEnc41[100][2];
+
+extern const uint32_t c_aauiLCLDHuffDec41[16][16];
+extern const uint32_t c_aauiLCLDHuffEnc42[169][2];
+
+extern const uint32_t c_aauiLCLDHuffDec42[28][16];
+extern const uint32_t c_aauiLCLDHuffEnc43[196][2];
+
+extern const uint32_t c_aauiLCLDHuffDec43[32][16];
+extern const uint32_t c_aauiLCLDHuffEnc44[289][2];
+
+extern const uint32_t c_aauiLCLDHuffDec44[27][16];
+extern const uint32_t c_aauiLCLDHuffEnc45[324][2];
+
+extern const uint32_t c_aauiLCLDHuffDec45[50][16];
+extern const uint32_t c_aauiLCLDHuffEnc46[400][2];
+
+extern const uint32_t c_aauiLCLDHuffDec46[61][16];
+extern const uint32_t c_aauiLCLDHuffEnc47[576][2];
+
+extern const uint32_t c_aauiLCLDHuffDec47[87][16];
+extern const uint32_t c_aauiLCLDHuffEnc48[729][2];
+
+extern const uint32_t c_aauiLCLDHuffDec48[110][16];
+extern const uint32_t c_aauiLCLDHuffEnc49[729][2];
+
+extern const uint32_t c_aauiLCLDHuffDec49[113][16];
+extern const uint32_t c_aauiLCLDHuffEnc50[28][2];
+
+extern const uint32_t c_aauiLCLDHuffDec50[6][16];
+extern const uint32_t c_aauiLCLDHuffEnc51[29][2];
+
+extern const uint32_t c_aauiLCLDHuffDec51[6][16];
+extern const uint32_t c_aauiLCLDHuffEnc52[32][2];
+
+extern const uint32_t c_aauiLCLDHuffDec52[7][16];
+extern const uint32_t c_aauiLCLDHuffEnc53[37][2];
+
+extern const uint32_t c_aauiLCLDHuffDec53[9][16];
+extern const uint32_t c_aauiLCLDHuffEnc54[39][2];
+
+extern const uint32_t c_aauiLCLDHuffDec54[9][16];
+extern const uint32_t c_aauiLCLDHuffEnc55[46][2];
+
+extern const uint32_t c_aauiLCLDHuffDec55[10][16];
+extern const uint32_t c_aauiLCLDHuffEnc56[55][2];
+
+extern const uint32_t c_aauiLCLDHuffDec56[12][16];
+extern const uint32_t c_aauiLCLDHuffEnc57[65][2];
+
+extern const uint32_t c_aauiLCLDHuffDec57[14][16];
+extern const uint32_t c_aauiLCLDHuffEnc58[77][2];
+
+extern const uint32_t c_aauiLCLDHuffDec58[17][16];
+extern const uint32_t c_aauiLCLDHuffEnc59[91][2];
+
+extern const uint32_t c_aauiLCLDHuffDec59[20][16];
+extern const uint32_t c_aauiLCLDHuffEnc60[109][2];
+
+extern const uint32_t c_aauiLCLDHuffDec60[24][16];
+extern const uint32_t c_aauiLCLDHuffEnc61[129][2];
+
+extern const uint32_t c_aauiLCLDHuffDec61[33][16];
+
+extern const uint32_t c_aauiLCLDHuffEnc62[153][2];
+
+
+extern const uint32_t c_aauiLCLDHuffDec62[41][16];
+extern const uint32_t c_aauiLCLDHuffEnc63[181][2];
+
+extern const uint32_t c_aauiLCLDHuffDec63[39][16];
+
+extern const uint32_t ( *c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE] )[2];
+extern const uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE];
+#else
+extern const uint16_t c_aauiLCLDHuffEnc1[16][2];
+extern const uint16_t c_aauiLCLDHuffEnc2[16][2];
+extern const uint16_t c_aauiLCLDHuffEnc3[25][2];
+extern const uint16_t c_aauiLCLDHuffEnc4[36][2];
+extern const uint16_t c_aauiLCLDHuffEnc5[36][2];
+extern const uint16_t c_aauiLCLDHuffEnc6[49][2];
+extern const uint16_t c_aauiLCLDHuffEnc7[64][2];
+extern const uint16_t c_aauiLCLDHuffEnc8[81][2];
+extern const uint16_t c_aauiLCLDHuffEnc9[100][2];
+extern const uint16_t c_aauiLCLDHuffEnc10[169][2];
+extern const uint16_t c_aauiLCLDHuffEnc11[196][2];
+extern const uint16_t c_aauiLCLDHuffEnc12[289][2];
+extern const uint16_t c_aauiLCLDHuffEnc13[324][2];
+extern const uint16_t c_aauiLCLDHuffEnc14[400][2];
+extern const uint16_t c_aauiLCLDHuffEnc15[576][2];
+extern const uint16_t c_aauiLCLDHuffEnc16[729][2];
+extern const uint16_t c_aauiLCLDHuffEnc17[729][2];
+extern const uint16_t c_aauiLCLDHuffEnc18[28][2];
+extern const uint16_t c_aauiLCLDHuffEnc19[29][2];
+extern const uint16_t c_aauiLCLDHuffEnc20[32][2];
+extern const uint16_t c_aauiLCLDHuffEnc21[37][2];
+extern const uint16_t c_aauiLCLDHuffEnc22[39][2];
+extern const uint16_t c_aauiLCLDHuffEnc23[46][2];
+extern const uint16_t c_aauiLCLDHuffEnc24[55][2];
+extern const uint16_t c_aauiLCLDHuffEnc25[65][2];
+extern const uint16_t c_aauiLCLDHuffEnc26[77][2];
+extern const uint16_t c_aauiLCLDHuffEnc27[91][2];
+extern const uint16_t c_aauiLCLDHuffEnc28[109][2];
+extern const uint16_t c_aauiLCLDHuffEnc29[129][2];
+extern const uint16_t c_aauiLCLDHuffEnc30[153][2];
+extern const uint16_t c_aauiLCLDHuffEnc31[181][2];
+extern const uint16_t c_aauiLCLDHuffEnc33[16][2];
+extern const uint16_t c_aauiLCLDHuffEnc34[16][2];
+extern const uint16_t c_aauiLCLDHuffEnc35[25][2];
+extern const uint16_t c_aauiLCLDHuffEnc36[36][2];
+extern const uint16_t c_aauiLCLDHuffEnc37[36][2];
+extern const uint16_t c_aauiLCLDHuffEnc38[49][2];
+extern const uint16_t c_aauiLCLDHuffEnc39[64][2];
+extern const uint16_t c_aauiLCLDHuffEnc40[81][2];
+extern const uint16_t c_aauiLCLDHuffEnc41[100][2];
+extern const uint16_t c_aauiLCLDHuffEnc42[169][2];
+extern const uint16_t c_aauiLCLDHuffEnc43[196][2];
+extern const uint16_t c_aauiLCLDHuffEnc44[289][2];
+extern const uint16_t c_aauiLCLDHuffEnc45[324][2];
+extern const uint16_t c_aauiLCLDHuffEnc46[400][2];
+extern const uint16_t c_aauiLCLDHuffEnc47[576][2];
+extern const uint16_t c_aauiLCLDHuffEnc48[729][2];
+extern const uint16_t c_aauiLCLDHuffEnc49[729][2];
+extern const uint16_t c_aauiLCLDHuffEnc50[28][2];
+extern const uint16_t c_aauiLCLDHuffEnc51[29][2];
+extern const uint16_t c_aauiLCLDHuffEnc52[32][2];
+extern const uint16_t c_aauiLCLDHuffEnc53[37][2];
+extern const uint16_t c_aauiLCLDHuffEnc54[39][2];
+extern const uint16_t c_aauiLCLDHuffEnc55[46][2];
+extern const uint16_t c_aauiLCLDHuffEnc56[55][2];
+extern const uint16_t c_aauiLCLDHuffEnc57[65][2];
+extern const uint16_t c_aauiLCLDHuffEnc58[77][2];
+extern const uint16_t c_aauiLCLDHuffEnc59[91][2];
+extern const uint16_t c_aauiLCLDHuffEnc60[109][2];
+extern const uint16_t c_aauiLCLDHuffEnc61[129][2];
+extern const uint16_t c_aauiLCLDHuffEnc62[153][2];
+extern const uint16_t c_aauiLCLDHuffEnc63[181][2];
+extern const uint16_t ( *c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE] )[2];
+extern const uint32_t num_row_aauiLCLDHuff[2 * ALLOC_TABLE_SIZE];
+#endif
+
+#ifdef USE_DEMOD_TABLES
+extern const int32_t c_aaiHuffDemod1[16][2];
+extern const int32_t c_aaiHuffDemod2[16][2];
+extern const int32_t c_aaiHuffDemod3[25][2];
+extern const int32_t c_aaiHuffDemod4[36][2];
+extern const int32_t c_aaiHuffDemod5[36][2];
+extern const int32_t c_aaiHuffDemod6[49][2];
+extern const int32_t c_aaiHuffDemod7[64][2];
+extern const int32_t c_aaiHuffDemod8[81][2];
+extern const int32_t c_aaiHuffDemod9[100][2];
+extern const int32_t c_aaiHuffDemod10[169][2];
+extern const int32_t c_aaiHuffDemod11[196][2];
+extern const int32_t c_aaiHuffDemod12[289][2];
+extern const int32_t c_aaiHuffDemod13[324][2];
+extern const int32_t c_aaiHuffDemod14[400][2];
+extern const int32_t c_aaiHuffDemod15[576][2];
+extern const int32_t c_aaiHuffDemod16[729][2];
+extern const int32_t c_aaiHuffDemod17[729][2];
+extern const int32_t ( *c_apaiDemodTables[ALLOC_TABLE_SIZE] )[2];
+#endif
+
+extern const uint32_t c_aaiRMSEnvHuffEnc[64][2];
+extern const uint32_t c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE];
+
+
+#endif /* _TABLES_H_ */
diff --git a/lib_rend/ivas_lcld_tables.h b/lib_rend/ivas_lcld_tables.h
deleted file mode 100644
index 4fec652e0214e0b442df135790164469ed5b7935..0000000000000000000000000000000000000000
--- a/lib_rend/ivas_lcld_tables.h
+++ /dev/null
@@ -1,563 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-#ifndef _IVAS_TABLES_H_
-#define _IVAS_TABLES_H_
-
-#include "options.h"
-#ifdef SPLIT_REND_WITH_HEAD_ROT
-#include
-#include // For NULL
-
-
-#ifndef M_PI
-
-#define M_PI 3.14159265358979323846264338327950288f
-
-#endif
-
-#define CQMF_BLOCKS_PER_FRAME ( 16 )
-#define CQMF_MAX_BLOCKS_PER_FRAME ( 16 )
-#define CQMF_BANDS ( 60 )
-
-#define MAX_BANDS ( 23 )
-#define MAX_BANDS_48 ( 23 )
-
-extern const int32_t c_aiBandwidths48[MAX_BANDS_48]; // move this
-
-
-#define ENV_MIN ( -64 )
-#define ENV_MAX ( 64 )
-
-#define ENV0_BITS ( 7 )
-
-#define ENV_DELTA_MIN ( -32 )
-#define ENV_DELTA_MAX ( 31 )
-
-#define ENV_RECONSTRUCT_TABLE_SIZE ( 129 )
-
-#define ENV_RECONSTRUCT_TABLE_CENTER ( 64 )
-
-#define MIN_ALLOC ( 0 )
-#define MAX_ALLOC ( 31 )
-
-#define ALLOC_OFFSET_SCALE ( 8 )
-
-#define ALLOC_OFFSET_BITS ( 8 )
-
-#define MIN_ALLOC_OFFSET ( -128 )
-#define MAX_ALLOC_OFFSET ( 127 )
-#ifdef ROM_TO_RAM
-#define READ_LENGTH ( 4 )
-#endif
-
-#define ALLOC_TABLE_SIZE ( 32 )
-
-#ifndef _PI_
-#define _PI_ ( 3.14159265358979f )
-#endif
-#define PRED_MAX_VAL ( 12 )
-#define PRED_MIN_VAL ( -PRED_MAX_VAL )
-#define PRED_QUANT_FACTOR ( (float) PRED_MAX_VAL )
-#define PRED_BAND0_BITS ( 5 )
-
-#define PHASE_MAX_VAL ( 12 )
-#define PHASE_MIN_VAL ( -PHASE_MAX_VAL )
-#define PHASE_QUANT_FACTOR ( (float) PHASE_MAX_VAL / _PI_ )
-#define PHASE_DIFF_DIM ( 2 )
-#define PHASE_BAND0_BITS ( 5 )
-
-#define SIMPLE_PHASE_MAX_VAL ( 3 )
-#define SIMPLE_PHASE_MIN_VAL ( 0 )
-#define SIMPLE_PHASE_BITS ( 2 )
-#define SIMPLE_PHASE_QUANT_FACTOR ( 2.0f / _PI_ )
-
-#define TON_QUOTA_ABS_THRESHOLD ( 8.0f )
-#define TON_QUOTA_INC_THRESHOLD ( 4.0f )
-
-#define MAX_BANDS_48 ( 23 )
-
-//#define USE_DEMOD_TABLES
-
-#ifndef HUFF_READ_SIZE
-#define HUFF_READ_SIZE ( 4 )
-#endif
-
-#ifndef HUFF_DEC_TABLE_SIZE
-#define HUFF_DEC_TABLE_SIZE ( 16 )
-#endif
-
-extern const float c_afRotRealImag[PRED_MAX_VAL - PRED_MIN_VAL + 1][2];
-extern const float c_afRotRealImagSimple[SIMPLE_PHASE_MAX_VAL + 1][2];
-extern const int32_t c_aiDefaultTheta48[MAX_BANDS_48];
-
-extern const float c_afScaleFactor[ALLOC_TABLE_SIZE];
-
-extern const float c_afInvScaleFactor[ALLOC_TABLE_SIZE];
-
-extern const float c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_SIZE];
-
-extern const int32_t c_aiQuantMaxValues[ALLOC_TABLE_SIZE];
-
-extern const int32_t c_aiHuffmanDim[ALLOC_TABLE_SIZE];
-
-extern const int32_t c_aiHuffmanMod[ALLOC_TABLE_SIZE];
-
-extern const int32_t c_aiHuffmanSize[ALLOC_TABLE_SIZE];
-
-#ifndef ROM_TO_RAM
-extern const uint32_t c_aauiCQMFHuffEnc1[16][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec1[3][16];
-
-
-extern const uint32_t c_aauiCQMFHuffEnc2[16][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec2[3][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc3[25][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec3[10][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc4[36][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec4[5][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc5[36][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec5[10][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc6[49][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec6[7][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc7[64][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec7[25][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc8[81][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec8[16][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc9[100][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec9[22][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc10[169][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec10[45][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc11[196][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec11[50][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc12[289][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec12[76][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc13[324][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec13[89][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc14[400][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec14[53][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc15[576][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec15[73][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc16[729][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec16[85][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc17[729][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec17[93][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc18[28][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec18[6][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc19[29][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec19[6][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc20[32][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec20[6][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc21[37][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec21[7][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc22[39][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec22[9][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc23[46][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec23[12][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc24[55][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec24[17][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc25[65][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec25[19][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc26[77][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec26[26][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc27[91][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec27[28][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc28[109][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec28[30][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc29[129][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec29[34][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc30[153][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec30[39][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc31[181][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec31[43][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc33[16][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec33[2][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc34[16][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec34[2][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc35[25][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec35[9][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc36[36][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec36[7][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc37[36][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec37[4][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc38[49][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec38[22][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc39[64][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec39[12][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc40[81][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec40[36][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc41[100][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec41[16][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc42[169][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec42[28][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc43[196][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec43[32][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc44[289][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec44[27][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc45[324][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec45[50][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc46[400][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec46[61][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc47[576][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec47[87][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc48[729][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec48[110][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc49[729][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec49[113][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc50[28][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec50[6][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc51[29][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec51[6][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc52[32][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec52[7][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc53[37][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec53[9][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc54[39][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec54[9][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc55[46][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec55[10][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc56[55][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec56[12][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc57[65][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec57[14][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc58[77][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec58[17][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc59[91][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec59[20][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc60[109][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec60[24][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc61[129][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec61[33][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc62[153][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec62[41][16];
-
-extern const uint32_t c_aauiCQMFHuffEnc63[181][2];
-
-
-extern const uint32_t c_aauiCQMFHuffDec63[39][16];
-
-
-extern const uint32_t ( *c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE] )[2];
-
-extern const uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE];
-#else
-extern const uint16_t c_aauiCQMFHuffEnc1[16][2];
-extern const uint16_t c_aauiCQMFHuffEnc2[16][2];
-extern const uint16_t c_aauiCQMFHuffEnc3[25][2];
-extern const uint16_t c_aauiCQMFHuffEnc4[36][2];
-extern const uint16_t c_aauiCQMFHuffEnc5[36][2];
-extern const uint16_t c_aauiCQMFHuffEnc6[49][2];
-extern const uint16_t c_aauiCQMFHuffEnc7[64][2];
-extern const uint16_t c_aauiCQMFHuffEnc8[81][2];
-extern const uint16_t c_aauiCQMFHuffEnc9[100][2];
-extern const uint16_t c_aauiCQMFHuffEnc10[169][2];
-extern const uint16_t c_aauiCQMFHuffEnc11[196][2];
-extern const uint16_t c_aauiCQMFHuffEnc12[289][2];
-extern const uint16_t c_aauiCQMFHuffEnc13[324][2];
-extern const uint16_t c_aauiCQMFHuffEnc14[400][2];
-extern const uint16_t c_aauiCQMFHuffEnc15[576][2];
-extern const uint16_t c_aauiCQMFHuffEnc16[729][2];
-extern const uint16_t c_aauiCQMFHuffEnc17[729][2];
-extern const uint16_t c_aauiCQMFHuffEnc18[28][2];
-extern const uint16_t c_aauiCQMFHuffEnc19[29][2];
-extern const uint16_t c_aauiCQMFHuffEnc20[32][2];
-extern const uint16_t c_aauiCQMFHuffEnc21[37][2];
-extern const uint16_t c_aauiCQMFHuffEnc22[39][2];
-extern const uint16_t c_aauiCQMFHuffEnc23[46][2];
-extern const uint16_t c_aauiCQMFHuffEnc24[55][2];
-extern const uint16_t c_aauiCQMFHuffEnc25[65][2];
-extern const uint16_t c_aauiCQMFHuffEnc26[77][2];
-extern const uint16_t c_aauiCQMFHuffEnc27[91][2];
-extern const uint16_t c_aauiCQMFHuffEnc28[109][2];
-extern const uint16_t c_aauiCQMFHuffEnc29[129][2];
-extern const uint16_t c_aauiCQMFHuffEnc30[153][2];
-extern const uint16_t c_aauiCQMFHuffEnc31[181][2];
-extern const uint16_t c_aauiCQMFHuffEnc33[16][2];
-extern const uint16_t c_aauiCQMFHuffEnc34[16][2];
-extern const uint16_t c_aauiCQMFHuffEnc35[25][2];
-extern const uint16_t c_aauiCQMFHuffEnc36[36][2];
-extern const uint16_t c_aauiCQMFHuffEnc37[36][2];
-extern const uint16_t c_aauiCQMFHuffEnc38[49][2];
-extern const uint16_t c_aauiCQMFHuffEnc39[64][2];
-extern const uint16_t c_aauiCQMFHuffEnc40[81][2];
-extern const uint16_t c_aauiCQMFHuffEnc41[100][2];
-extern const uint16_t c_aauiCQMFHuffEnc42[169][2];
-extern const uint16_t c_aauiCQMFHuffEnc43[196][2];
-extern const uint16_t c_aauiCQMFHuffEnc44[289][2];
-extern const uint16_t c_aauiCQMFHuffEnc45[324][2];
-extern const uint16_t c_aauiCQMFHuffEnc46[400][2];
-extern const uint16_t c_aauiCQMFHuffEnc47[576][2];
-extern const uint16_t c_aauiCQMFHuffEnc48[729][2];
-extern const uint16_t c_aauiCQMFHuffEnc49[729][2];
-extern const uint16_t c_aauiCQMFHuffEnc50[28][2];
-extern const uint16_t c_aauiCQMFHuffEnc51[29][2];
-extern const uint16_t c_aauiCQMFHuffEnc52[32][2];
-extern const uint16_t c_aauiCQMFHuffEnc53[37][2];
-extern const uint16_t c_aauiCQMFHuffEnc54[39][2];
-extern const uint16_t c_aauiCQMFHuffEnc55[46][2];
-extern const uint16_t c_aauiCQMFHuffEnc56[55][2];
-extern const uint16_t c_aauiCQMFHuffEnc57[65][2];
-extern const uint16_t c_aauiCQMFHuffEnc58[77][2];
-extern const uint16_t c_aauiCQMFHuffEnc59[91][2];
-extern const uint16_t c_aauiCQMFHuffEnc60[109][2];
-extern const uint16_t c_aauiCQMFHuffEnc61[129][2];
-extern const uint16_t c_aauiCQMFHuffEnc62[153][2];
-extern const uint16_t c_aauiCQMFHuffEnc63[181][2];
-extern const uint16_t ( *c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE] )[2];
-extern const uint32_t num_row_aauiCQMFHuff[2 * ALLOC_TABLE_SIZE];
-#endif
-
-#ifdef USE_DEMOD_TABLES
-extern const int32_t c_aaiHuffDemod1[16][2];
-
-extern const int32_t c_aaiHuffDemod2[16][2];
-
-extern const int32_t c_aaiHuffDemod3[25][2];
-
-extern const int32_t c_aaiHuffDemod4[36][2];
-
-extern const int32_t c_aaiHuffDemod5[36][2];
-
-extern const int32_t c_aaiHuffDemod6[49][2];
-
-extern const int32_t c_aaiHuffDemod7[64][2];
-
-extern const int32_t c_aaiHuffDemod8[81][2];
-
-extern const int32_t c_aaiHuffDemod9[100][2];
-
-extern const int32_t c_aaiHuffDemod10[169][2];
-
-extern const int32_t c_aaiHuffDemod11[196][2];
-
-extern const int32_t c_aaiHuffDemod12[289][2];
-
-extern const int32_t c_aaiHuffDemod13[324][2];
-
-extern const int32_t c_aaiHuffDemod14[400][2];
-
-extern const int32_t c_aaiHuffDemod15[576][2];
-
-extern const int32_t c_aaiHuffDemod16[729][2];
-
-extern const int32_t c_aaiHuffDemod17[729][2];
-
-extern const int32_t ( *c_apaiDemodTables[ALLOC_TABLE_SIZE] )[2];
-#endif
-
-extern const uint32_t c_aaiRMSEnvHuffEnc[64][2];
-
-extern const uint32_t c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE];
-
-#endif
-
-#endif /* _TABLES_H_ */
diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c
index abb9d568de05f5af74f3720e8b655b5ee7366afa..6e2d843ee851b23bb2de7ab415493225eb9c6b01 100644
--- a/lib_rend/ivas_objectRenderer.c
+++ b/lib_rend/ivas_objectRenderer.c
@@ -635,7 +635,6 @@ ivas_error ivas_td_binaural_open_ext(
hTransSetup.ls_elevation = customLsInput->ls_elevation;
}
-
if ( NULL != hRendCfg )
{
directivity = hRendCfg->directivity;
@@ -732,13 +731,15 @@ ivas_error ivas_td_binaural_renderer_ext(
return IVAS_ERR_OK;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
/*---------------------------------------------------------------------*
* ObjRenderIvasFrame_splitBinaural()
*
* Render to multiple binaural pairs based on relative head positions for split rendering.
*---------------------------------------------------------------------*/
-void ObjRenderIvasFrame_splitBinaural(
+
+ivas_error ObjRenderIvasFrame_splitBinaural(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP
float *output[], /* i/o: SCE channels / Binaural synthesis */
@@ -748,37 +749,40 @@ void ObjRenderIvasFrame_splitBinaural(
const int16_t output_frame /* i : output frame length */
)
{
- int32_t i;
+ int16_t i;
float tmpProcessing[MAX_OUTPUT_CHANNELS][L_FRAME48k];
float tmpBinaural[MAX_HEAD_ROT_POSES * 2][L_FRAME48k];
float *p_tmpProcessing[MAX_OUTPUT_CHANNELS];
-
int16_t pos_idx;
IVAS_QUATERNION originalHeadRot[MAX_PARAM_SPATIAL_SUBFRAMES];
MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData;
BINAURAL_TD_OBJECT_RENDERER_HANDLE tmpTdRendHandle;
+ ivas_error error;
push_wmops( "ObjRenderIvasFrame_splitBinaural" );
- pMultiBinPoseData = &st_ivas->splitBinRend.splitrend.multiBinPoseData;
+ pMultiBinPoseData = &st_ivas->hSplitBinRend.splitrend.multiBinPoseData;
/* If not yet allocated, open additional instances of TD renderer */
for ( i = 0; i < pMultiBinPoseData->num_poses - 1; ++i )
{
- if ( st_ivas->splitBinRend.splitrend.hTdRendHandles[i] != NULL )
+ if ( st_ivas->hSplitBinRend.splitrend.hTdRendHandles[i] != NULL )
{
continue;
}
- ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD,
- st_ivas->hDecoderConfig->output_Fs,
- st_ivas->nchan_transport,
- st_ivas->ivas_format,
- st_ivas->transport_config,
- st_ivas->hRenderConfig->directivity,
- st_ivas->hTransSetup,
- &st_ivas->splitBinRend.splitrend.hTdRendHandles[i],
- &st_ivas->binaural_latency_ns );
+ if ( ( error = ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD,
+ st_ivas->hDecoderConfig->output_Fs,
+ st_ivas->nchan_transport,
+ st_ivas->ivas_format,
+ st_ivas->transport_config,
+ st_ivas->hRenderConfig->directivity,
+ st_ivas->hTransSetup,
+ &st_ivas->hSplitBinRend.splitrend.hTdRendHandles[i],
+ &st_ivas->binaural_latency_ns ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
}
/* Save current head positions */
@@ -811,36 +815,44 @@ void ObjRenderIvasFrame_splitBinaural(
else
{
st_ivas->hCombinedOrientationData->Quaternions[i].w = -3.0f;
+
Quat2EulerDegree( originalHeadRot[i], /* TODO tmu : fix bug with ordering*/
&st_ivas->hCombinedOrientationData->Quaternions[i].z,
&st_ivas->hCombinedOrientationData->Quaternions[i].y,
&st_ivas->hCombinedOrientationData->Quaternions[i].x );
+
st_ivas->hCombinedOrientationData->Quaternions[i].x += pMultiBinPoseData->relative_head_poses[pos_idx][0];
st_ivas->hCombinedOrientationData->Quaternions[i].y += pMultiBinPoseData->relative_head_poses[pos_idx][1];
st_ivas->hCombinedOrientationData->Quaternions[i].z += pMultiBinPoseData->relative_head_poses[pos_idx][2];
}
}
}
+
/* Handle the 1 ISM case where there is only one channel in the input buffer */
for ( i = 0; i < max( st_ivas->nchan_transport, BINAURAL_CHANNELS ); ++i )
{
p_tmpProcessing[i] = tmpProcessing[i];
}
+
/* Render */
if ( pos_idx == 0 )
{
- ivas_td_binaural_renderer( st_ivas,
- p_tmpProcessing,
- output_frame );
+ if ( ( error = ivas_td_binaural_renderer( st_ivas, p_tmpProcessing, output_frame ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
}
else
{
/* Tmp swap renderer handles for rendering call */
tmpTdRendHandle = st_ivas->hBinRendererTd;
- st_ivas->hBinRendererTd = st_ivas->splitBinRend.splitrend.hTdRendHandles[pos_idx - 1];
- ivas_td_binaural_renderer( st_ivas,
- p_tmpProcessing,
- output_frame );
+ st_ivas->hBinRendererTd = st_ivas->hSplitBinRend.splitrend.hTdRendHandles[pos_idx - 1];
+
+ if ( ( error = ivas_td_binaural_renderer( st_ivas, p_tmpProcessing, output_frame ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+
st_ivas->hBinRendererTd = tmpTdRendHandle;
}
@@ -867,8 +879,10 @@ void ObjRenderIvasFrame_splitBinaural(
}
pop_wmops();
+
+ return IVAS_ERR_OK;
}
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
+#endif
/*---------------------------------------------------------------------*
diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c
index e08d0a12eefdcf99066f5f6b7544c16043216afa..9590e73a2aaccd01a8d1720cf64ece4dcdeb597f 100644
--- a/lib_rend/ivas_output_init.c
+++ b/lib_rend/ivas_output_init.c
@@ -390,7 +390,7 @@ int16_t ivas_get_nchan_buffers_dec(
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
- nchan_out_buff = max( nchan_out_buff, st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses * BINAURAL_CHANNELS );
+ nchan_out_buff = max( nchan_out_buff, st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses * BINAURAL_CHANNELS );
}
#endif
diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h
index c519476b1352b739361261ec7653b3ce07d06e1b..69723f9cbebc10128ba3038c608363119df039e2 100644
--- a/lib_rend/ivas_prot_rend.h
+++ b/lib_rend/ivas_prot_rend.h
@@ -558,19 +558,6 @@ void ivas_HRTF_CRend_binary_close(
* TD object renderer
*----------------------------------------------------------------------------------*/
-#ifdef SPLIT_REND_WITH_HEAD_ROT
-/* TODO(sgi): Rework interface */
-void ObjRenderIvasFrame_splitBinaural(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
-#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP
- float *output[], /* i/o: SCE channels / Binaural synthesis */
-#else
- float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */
-#endif
- const int16_t output_frame /* i : output frame length */
-);
-#endif
-
ivas_error ivas_td_binaural_renderer_unwrap(
const REVERB_HANDLE hReverb, /* i : Reverberator handle */
const AUDIO_CONFIG transport_config, /* i : Transport configuration */
@@ -865,84 +852,6 @@ ivas_error ivas_rend_initCrendWrapper(
#endif
);
-#ifdef SPLIT_REND_WITH_HEAD_ROT
-ivas_error ivas_rend_openMultiBinCrend(
- CREND_WRAPPER_HANDLE *pCrend,
- const AUDIO_CONFIG inConfig,
- const AUDIO_CONFIG outConfig,
- const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
- const int32_t output_Fs );
-
-void ivas_rend_CldfbMultiBinRendProcess(
- const BINAURAL_RENDERER_HANDLE hCldfbRend,
- const COMBINED_ORIENTATION_HANDLE *pCombinedOrientationData,
- const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
- float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
- float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
- float Cldfb_Out_Real[MAX_HEAD_ROT_POSES*BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */
- float Cldfb_Out_Imag[MAX_HEAD_ROT_POSES*BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
- const int16_t low_res_pre_rend_rot );
-
-ivas_error ivas_rend_openCldfb(
- HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS],
- const AUDIO_CONFIG inConfig,
- const int32_t output_Fs );
-
-ivas_error ivas_rend_openCldfbRend(
- CLDFB_REND_WRAPPER *pCldfbRend,
- const AUDIO_CONFIG inConfig,
- const AUDIO_CONFIG outConfig,
- const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
- const int32_t output_Fs );
-
-void ivas_mat_mult_2by2_complex( float in_re1[2][2],
- float in_im1[2][2],
- float in_re2[2][2],
- float in_im2[2][2],
- float out_re2[2][2],
- float out_im2[2][2] );
-void ivas_split_rend_bitstream_init( ivas_split_rend_bits_t *pBits, const int32_t buf_len_bytes, uint8_t *pbuf );
-void ivas_split_rend_huffman_dec_init_min_max_len( ivas_split_rend_huffman_cfg_t *p_huff_cfg );
-void ivas_split_rend_init_huff_cfg( BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg );
-void set_fix_rotation_mat( float fix_pos_rot_mat[][BINAURAL_CHANNELS][BINAURAL_CHANNELS],
- MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData );
-void set_pose_types( IVAS_SPLIT_REND_POSE_TYPE pose_type[MAX_HEAD_ROT_POSES - 1], MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData );
-int16_t wrap_a( int16_t val, int16_t min_val, int16_t max_val );
-void ivas_SplitRenderer_getdiagdiff(
- int16_t in_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS],
- int16_t out_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS],
- const int16_t sign,
- const int16_t min_val,
- const int16_t max_val );
-void ivas_split_rend_bitstream_write_int32( ivas_split_rend_bits_t *pBits, int32_t val, int32_t bits );
-int32_t ivas_split_rend_bitstream_read_int32( ivas_split_rend_bits_t *pBits, int32_t bits );
-IVAS_QUATERNION ivas_split_rend_get_sf_rot_data(
- const IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME],
- int16_t subframe_idx );
-
-int32_t ivas_get_lcld_bitrate( const int32_t SplitRendBitRate, const IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode );
-int32_t ivas_get_split_rend_md_target_brate( const int32_t SplitRendBitRate, const int16_t pcm_out );
-int32_t ivas_get_lc3plus_bitrate( const int32_t SplitRendBitRate, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode );
-int8_t ivas_get_lc3plus_bitrate_id( const int32_t SplitRendBitRate );
-int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode );
-ivas_error ivas_split_rend_validate_config( const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const int16_t is_pcm_out );
-void ivas_split_rend_get_quant_params(
- const int16_t num_md_bands,
- int16_t pred_real_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS],
- int16_t pred_imag_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS],
-#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
- int16_t pred_quant_pnts_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS],
- float pred_quantstep_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS],
- float pred_1byquantstep_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS],
-#endif
- int16_t d_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS],
- int16_t bands_pitch[IVAS_SPLIT_REND_NUM_QUANT_STRATS],
- int16_t pred_real_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS],
- int16_t pred_imag_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS],
- int16_t *num_quant_strats,
- int16_t *num_complex_bands );
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
-
ivas_error ivas_rend_crendProcess(
const CREND_WRAPPER *pCrend,
const AUDIO_CONFIG inConfig,
@@ -974,20 +883,6 @@ ivas_error ivas_rend_crendProcessSubframe(
const int32_t output_Fs /* i : output sampling rate */
);
-#ifdef SPLIT_REND_WITH_HEAD_ROT
-ivas_error ivas_rend_crendProcessSplitBin(
- const CREND_WRAPPER *pCrend,
- const AUDIO_CONFIG inConfig,
- const AUDIO_CONFIG outConfig,
- const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
- DECODER_CONFIG_HANDLE hDecoderConfig,
- COMBINED_ORIENTATION_HANDLE hCombinedOrientationData,
- const IVAS_OUTPUT_SETUP_HANDLE hIntSetup,
- EFAP_HANDLE hEFAPdata,
- float *output[],
- const int32_t output_Fs
-);
-#endif
/*----------------------------------------------------------------------------------*
* Reverberator
@@ -1473,52 +1368,62 @@ ivas_error ivas_orient_trk_Process(
#ifdef SPLIT_REND_WITH_HEAD_ROT
/*----------------------------------------------------------------------------------*
- * Split renderer prototypes
+ * Split binaural renderer prototypes
*----------------------------------------------------------------------------------*/
-void ivas_set_split_rend_setup(
- IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend,
- IVAS_SPLIT_REND_CONFIG_DATA *hSplitBinConfig,
+ivas_error ivas_set_split_rend_setup(
+ IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend,
+ IVAS_SPLIT_REND_CONFIG_DATA *hSplitBinConfig,
COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i/o: combined orientation handle */
- IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits );
+ uint8_t *splitRendBitsBuf
+);
void ivas_init_split_rend_handles(
- SPLIT_REND_WRAPPER *hSplitRendWrapper );
+ SPLIT_REND_WRAPPER *hSplitRendWrapper
+);
+
void ivas_init_split_post_rend_handles(
- SPLIT_POST_REND_WRAPPER *hSplitRendWrapper );
+ SPLIT_POST_REND_WRAPPER *hSplitRendWrapper
+);
ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitBinRend,
- const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig,
- const int32_t output_Fs,
- const int16_t is_cldfb_in,
- const int16_t is_pcm_out);
+ const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig,
+ const int32_t output_Fs,
+ const int16_t is_cldfb_in,
+ const int16_t is_pcm_out
+);
void ivas_split_renderer_close(
- SPLIT_REND_WRAPPER *hSplitBinRend);
+ SPLIT_REND_WRAPPER *hSplitBinRend
+);
ivas_error ivas_splitBinLCLDEncOpen(
BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc,
- int32_t iSampleRate,
- int32_t iChannels,
- int32_t iDataRate );
+ const int32_t iSampleRate,
+ const int16_t iChannels,
+ const int32_t iDataRate );
void ivas_splitBinLCLDEncClose(
- BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc );
+ BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc
+);
void ivas_splitBinLCLDEncProcess(
BIN_HR_SPLIT_LCLD_ENC_HANDLE hSplitBinLCLDEnc,
float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
const int32_t available_bits,
- ivas_split_rend_bits_t *pBits );
+ ivas_split_rend_bits_t *pBits
+);
ivas_error ivas_splitBinLCLDDecOpen(
BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec,
- int32_t iSampleRate,
- int32_t iChannels );
+ const int32_t iSampleRate,
+ const int16_t iChannels
+);
void ivas_splitBinLCLDDecClose(
- BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec );
+ BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec
+);
void ivas_splitBinLCLDDecProcess(
BIN_HR_SPLIT_LCLD_DEC_HANDLE hSplitBinLCLDDec,
@@ -1543,17 +1448,20 @@ ivas_error ivas_splitBinPostRendOpen(
const int32_t output_Fs
);
-
void ivas_init_multi_bin_pose_data(
- MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData );
+ MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData
+);
+
void ivas_renderSplitGetMultiBinPoseData(
const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config,
MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
- const IVAS_SPLIT_REND_ROT_AXIS rot_axis);
+ const IVAS_SPLIT_REND_ROT_AXIS rot_axis
+);
void ivas_renderSplitUpdateNoCorrectionPoseData(
const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config,
- MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData );
+ MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData
+);
ivas_error ivas_renderMultiBinToSplitBinaural(
SPLIT_REND_WRAPPER *hSplitBin,
@@ -1582,7 +1490,8 @@ void ivas_rend_CldfbSplitPreRendProcess(
float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
ivas_split_rend_bits_t *pBits,
const int32_t target_md_bits,
- const int16_t low_res_pre_rend_rot);
+ const int16_t low_res_pre_rend_rot
+);
void ivas_rend_CldfbSplitPostRendProcess(
BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend,
@@ -1591,10 +1500,12 @@ void ivas_rend_CldfbSplitPostRendProcess(
float Cldfb_RealBuffer_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
float Cldfb_ImagBuffer_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
float output[][L_FRAME48k],
- const int16_t is_cldfb_in );
+ const int16_t is_cldfb_in
+);
void ivas_splitBinPreRendClose(
- BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend );
+ BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend
+);
void ivas_splitBinPostRendClose(
BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostRend );
@@ -1612,25 +1523,29 @@ ivas_error ivas_splitBinRendPLCOpen(
SPLIT_REND_PLC_HANDLE* phSplitRendPLC
);
-void ivas_splitBinRendPLCClose(SPLIT_REND_PLC_HANDLE* phSplitRendPLC);
+void ivas_splitBinRendPLCClose(SPLIT_REND_PLC_HANDLE* phSplitRendPLC
+);
void ivas_splitBinRendPLCsaveState(
SPLIT_REND_PLC_HANDLE hSplitRendPLC,
float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
- const int16_t num_chs );
+ const int16_t num_chs
+);
void ivas_splitBinRendPLC_xf(
SPLIT_REND_PLC_HANDLE hSplitRendPLC,
float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
- const int16_t num_chs );
+ const int16_t num_chs
+);
void ivas_splitBinRendPLC(
SPLIT_REND_PLC_HANDLE hSplitRendPLC,
float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
- const int16_t num_chs );
+ const int16_t num_chs
+);
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
void ivas_log_cldfb2wav_data(
@@ -1642,24 +1557,28 @@ void ivas_log_cldfb2wav_data(
const int32_t output_Fs,
const int16_t start_slot_idx,
const int16_t md_band_idx,
- const char *filename );
+ const char *filename
+);
#endif
void ivas_SplitRenderer_GetRotMd(
- BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, /* i/o: binaural renderer handle */
+ BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, /* i/o: binaural renderer handle */
MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
- float Cldfb_RealBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */
- float Cldfb_ImagBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */
- int16_t low_res);
+ float Cldfb_RealBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */
+ float Cldfb_ImagBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */
+ const int16_t low_res
+);
void ivas_SplitRenderer_PostRenderer(
- BIN_HR_SPLIT_POST_REND_HANDLE hBinPostRenderer, /* i/o: binaural renderer handle */
+ BIN_HR_SPLIT_POST_REND_HANDLE hBinPostRenderer, /* i/o: binaural renderer handle */
MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
- float Cldfb_RealBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */
- float Cldfb_ImagBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */
- const IVAS_QUATERNION Quaternions_act[MAX_PARAM_SPATIAL_SUBFRAMES]);
+ float Cldfb_RealBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: Reference/out Binaural signals */
+ float Cldfb_ImagBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: Reference/out Binaural signals */
+ const IVAS_QUATERNION Quaternions_act[MAX_PARAM_SPATIAL_SUBFRAMES]
+);
+
+#endif
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
/*----------------------------------------------------------------------------------*
* Rendering & merging to MASA format
*----------------------------------------------------------------------------------*/
@@ -1765,14 +1684,187 @@ ivas_error masaPrerendOpen(
);
void masaPrerendClose(
- MASA_PREREND_HANDLE *hMasaPrerendPtr /* i/o: prerenderer handle to be closed */
+ MASA_PREREND_HANDLE *hMasaPrerendPtr /* i/o: prerenderer handle to be closed */
);
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
+/*----------------------------------------------------------------------------------*
+ * Split rendering
+ *----------------------------------------------------------------------------------*/
+
+/* TODO(sgi): Rework interface */
+ivas_error ObjRenderIvasFrame_splitBinaural(
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP
+ float *output[], /* i/o: SCE channels / Binaural synthesis */
+#else
+ float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */
+#endif
+ const int16_t output_frame /* i : output frame length */
+);
+
+ivas_error ivas_rend_crendProcessSplitBin(
+ const CREND_WRAPPER *pCrend,
+ const AUDIO_CONFIG inConfig,
+ const AUDIO_CONFIG outConfig,
+ const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
+ DECODER_CONFIG_HANDLE hDecoderConfig,
+ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData,
+ const IVAS_OUTPUT_SETUP_HANDLE hIntSetup,
+ EFAP_HANDLE hEFAPdata,
+ float *output[],
+ const int32_t output_Fs
+);
+
+ivas_error ivas_rend_openMultiBinCrend(
+ CREND_WRAPPER_HANDLE *pCrend,
+ const AUDIO_CONFIG inConfig,
+ const AUDIO_CONFIG outConfig,
+ const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
+ const int32_t output_Fs
+);
+
+void ivas_rend_CldfbMultiBinRendProcess(
+ const BINAURAL_RENDERER_HANDLE hCldfbRend,
+ const COMBINED_ORIENTATION_HANDLE *pCombinedOrientationData,
+ const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
+ float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
+ float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
+ float Cldfb_Out_Real[MAX_HEAD_ROT_POSES*BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */
+ float Cldfb_Out_Imag[MAX_HEAD_ROT_POSES*BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
+ const int16_t low_res_pre_rend_rot
+);
+
+ivas_error ivas_rend_openCldfb(
+ HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS],
+ const AUDIO_CONFIG inConfig,
+ const int32_t output_Fs
+);
+
+ivas_error ivas_rend_openCldfbRend(
+ CLDFB_REND_WRAPPER *pCldfbRend,
+ const AUDIO_CONFIG inConfig,
+ const AUDIO_CONFIG outConfig,
+ const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
+ const int32_t output_Fs
+);
+
+void ivas_mat_mult_2by2_complex(
+ float in_re1[2][2],
+ float in_im1[2][2],
+ float in_re2[2][2],
+ float in_im2[2][2],
+ float out_re2[2][2],
+ float out_im2[2][2]
+);
+
+void ivas_split_rend_bitstream_init(
+ ivas_split_rend_bits_t *pBits,
+ const int32_t buf_len_bytes, uint8_t *pbuf
+);
+
+void ivas_split_rend_huffman_dec_init_min_max_len(
+ ivas_split_rend_huffman_cfg_t *p_huff_cfg
+);
+
+void ivas_split_rend_init_huff_cfg(
+ BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg );
+
+void set_fix_rotation_mat(
+ float fix_pos_rot_mat[][BINAURAL_CHANNELS][BINAURAL_CHANNELS],
+ MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData
+);
+
+void set_pose_types(
+ IVAS_SPLIT_REND_POSE_TYPE pose_type[MAX_HEAD_ROT_POSES - 1],
+ MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData
+);
+
+int16_t wrap_a(
+ int16_t val,
+ const int16_t min_val,
+ const int16_t max_val
+);
+
+void ivas_SplitRenderer_getdiagdiff(
+ int16_t in_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS],
+ int16_t out_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS],
+ const int16_t sign,
+ const int16_t min_val,
+ const int16_t max_val
+);
+
+void ivas_split_rend_bitstream_write_int32(
+ ivas_split_rend_bits_t *pBits,
+ const int32_t val,
+ const int32_t bits
+);
+
+int32_t ivas_split_rend_bitstream_read_int32(
+ ivas_split_rend_bits_t *pBits,
+ const int32_t bits
+);
+
+IVAS_QUATERNION ivas_split_rend_get_sf_rot_data(
+ const IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME],
+ int16_t subframe_idx
+);
+
+void ivas_rend_closeCldfbRend(
+ CLDFB_REND_WRAPPER *pCldfbRend
+);
+
+int32_t ivas_get_lcld_bitrate(
+ const int32_t SplitRendBitRate,
+ const IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode
+);
+
+int32_t ivas_get_split_rend_md_target_brate(
+ const int32_t SplitRendBitRate,
+ const int16_t pcm_out
+);
+
+int32_t ivas_get_lc3plus_bitrate(
+ const int32_t SplitRendBitRate,
+ const IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode
+);
+
+int8_t ivas_get_lc3plus_bitrate_id(
+ const int32_t SplitRendBitRate
+);
+
+int32_t ivas_get_lc3plus_size_from_id(
+ const int8_t SplitRendBitRateId,
+ const IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode
+);
+
+ivas_error ivas_split_rend_validate_config(
+ const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig,
+ const int16_t is_pcm_out
+);
+
+void ivas_split_rend_get_quant_params(
+ const int16_t num_md_bands,
+ int16_t pred_real_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS],
+ int16_t pred_imag_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS],
+#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
+ int16_t pred_quant_pnts_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS],
+ float pred_quantstep_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS],
+ float pred_1byquantstep_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS],
+#endif
+ int16_t d_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS],
+ int16_t bands_pitch[IVAS_SPLIT_REND_NUM_QUANT_STRATS],
+ int16_t pred_real_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS],
+ int16_t pred_imag_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS],
+ int16_t *num_quant_strats,
+ int16_t *num_complex_bands
+);
+
void ivas_split_rend_choose_default_codec(
IVAS_SPLIT_REND_CODEC *pCodec, /* i/o: pointer to codec setting */
- int16_t isRenderingInTd, /* i : flag: is rendering done in TD? */
- int16_t pcm_out /*i : flag to indicate PCM output*/
+ const int16_t isRenderingInTd, /* i : flag: is rendering done in TD? */
+ const int16_t pcm_out /* i : flag to indicate PCM output */
);
#endif
diff --git a/lib_rend/ivas_rom_rend.h b/lib_rend/ivas_rom_rend.h
index 00bf4e3a29d93c4db480c752af4258b429f5e7a3..0e42c33286b69ef62a64f3c5f29b92cf060dac0f 100644
--- a/lib_rend/ivas_rom_rend.h
+++ b/lib_rend/ivas_rom_rend.h
@@ -125,7 +125,12 @@ extern const float ls_conversion_cicpX_stereo[12][2];
/* Mapping table of input config : output config with corresponding matrix */
extern const LS_CONVERSION_MAPPING ls_conversion_mapping[];
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
+/*----------------------------------------------------------------------------------*
+ * Split binaural rendering ROM tables
+ *----------------------------------------------------------------------------------*/
+
extern const int32_t split_rend_brate_tbl[];
#endif
diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c
index 7a9ad1156fcabab6e1b814746f06f394a7d35773..388617a53224cf579934e17b916221d60b5318d2 100644
--- a/lib_rend/ivas_rotation.c
+++ b/lib_rend/ivas_rotation.c
@@ -101,6 +101,7 @@ ivas_error ivas_headTrack_open(
set_zero( ( *hHeadTrackData )->Rmat_prev[i], 3 );
( *hHeadTrackData )->Rmat_prev[i][i] = 1.0f;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
( *hHeadTrackData )->sr_pose_pred_axis = DEFAULT_AXIS;
#endif
@@ -216,6 +217,7 @@ void Euler2Quat(
*
* Quaternion handling: calculate corresponding Euler angles in degrees
*------------------------------------------------------------------------*/
+
void Quat2EulerDegree(
const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */
float *yaw, /* o : yaw */
@@ -292,6 +294,7 @@ float rad2deg(
{
radians = radians + EVS_PI;
}
+
return _180_OVER_PI * radians;
}
@@ -906,6 +909,7 @@ ivas_error ivas_combined_orientation_open(
( *hCombinedOrientationData )->Rmat[i][j][j] = 1.0f;
}
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ )
{
@@ -1319,6 +1323,7 @@ static ivas_error combine_external_and_head_orientations(
hCombinedOrientationData->enableCombinedOrientation[i] = 0;
}
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
hCombinedOrientationData->sr_pose_pred_axis = sr_pose_pred_axis;
#endif
diff --git a/lib_rend/ivas_splitRend_lcld_dec.c b/lib_rend/ivas_splitRend_lcld_dec.c
index 93489d19b889a28c11ce33441f0bbc0b76a03cac..9868a8d0b54c4aeaa00c502d9e04ab31ff69a1bf 100644
--- a/lib_rend/ivas_splitRend_lcld_dec.c
+++ b/lib_rend/ivas_splitRend_lcld_dec.c
@@ -1,90 +1,94 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby
-International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der
-angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips
-N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge
-Corporation, and other contributors to this repository. All Rights Reserved.
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
+ Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
+ Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+ contributors to this repository. All Rights Reserved.
This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB,
-Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung
-e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph
-and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings
-Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their
-respective contributions in the software. This notice grants no license of any
-kind, including but not limited to patent license, nor is any license granted by
-implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration
-agreement before making contributions.
-
- This software is provided "AS IS", without any express or implied warranties.
-The software is in the development stage. It is intended exclusively for experts
-who have experience with such software and solely for the purpose of inspection.
-All implied warranties of non-infringement, merchantability and fitness for a
-particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing
-this software shall be submitted to and settled by the final, binding
-jurisdiction of the courts of Munich, Germany in accordance with the laws of the
-Federal Republic of Germany excluding its conflict of law rules and the United
-Nations Convention on Contracts on the International Sales of Goods.
+ The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
+ Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
+ Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
+ Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+ contributors to this repository retain full ownership rights in their respective contributions in
+ the software. This notice grants no license of any kind, including but not limited to patent
+ license, nor is any license granted by implication, estoppel or otherwise.
+
+ Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
+ contributions.
+
+ This software is provided "AS IS", without any express or implied warranties. The software is in the
+ development stage. It is intended exclusively for experts who have experience with such software and
+ solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
+ and fitness for a particular purpose are hereby disclaimed and excluded.
+
+ Any dispute, controversy or claim arising under or in relation to providing this software shall be
+ submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
+ accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
+ the United Nations Convention on Contracts on the International Sales of Goods.
*******************************************************************************************************/
+#include
#include "options.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
-#include "cnst.h"
-#include "ivas_cnst.h"
#include "ivas_prot_rend.h"
#include "ivas_prot.h"
-#include "ivas_rom_binauralRenderer.h"
-#include "ivas_rom_com.h"
-#include "ivas_rom_dec.h"
-#include "ivas_rom_rend.h"
-#include "lib_rend.h"
#include "prot.h"
-#include
-#include
-#include
#ifdef DEBUGGING
#include "debug.h"
#endif
#include "wmc_auto.h"
-ivas_error
-ivas_splitBinLCLDDecOpen( BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec,
- int32_t iSampleRate,
- int32_t iChannels )
+
+/*-------------------------------------------------------------------------
+ * Function ivas_splitBinLCLDDecOpen()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+ivas_error ivas_splitBinLCLDDecOpen(
+ BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec,
+ const int32_t iSampleRate,
+ const int16_t iChannels )
{
- ivas_error error;
+ int16_t n;
BIN_HR_SPLIT_LCLD_DEC_HANDLE splitBinLCLDDec;
- error = IVAS_ERR_OK;
- if ( ( splitBinLCLDDec = (BIN_HR_SPLIT_LCLD_DEC_HANDLE) malloc(
- sizeof( BIN_HR_SPLIT_LCLD_DEC ) ) ) == NULL )
+ ivas_error error;
+
+ if ( ( splitBinLCLDDec = (BIN_HR_SPLIT_LCLD_DEC_HANDLE) malloc( sizeof( BIN_HR_SPLIT_LCLD_DEC ) ) ) == NULL )
{
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC,
- "Can not allocate memory for LCLD decoder Module \n" ) );
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
}
- splitBinLCLDDec->pLcld_dec = NULL; // place holder for CLDFB decoder handle
+ splitBinLCLDDec->pLcld_dec = NULL; /* place holder for CLDFB decoder handle */
splitBinLCLDDec->iChannels = iChannels;
- splitBinLCLDDec->psCQMFDecoder = CreateCQMFDecoder( iSampleRate, iChannels );
+ if ( ( error = CreateLCLDDecoder( &splitBinLCLDDec->psLCLDDecoder, iSampleRate, iChannels ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
- splitBinLCLDDec->pppfDecCQMFReal =
- (float ***) malloc( iChannels * sizeof( float ** ) );
- splitBinLCLDDec->pppfDecCQMFImag =
- (float ***) malloc( iChannels * sizeof( float ** ) );
- for ( int32_t n = 0; n < splitBinLCLDDec->iChannels; n++ )
+ if ( ( splitBinLCLDDec->pppfDecLCLDReal = (float ***) malloc( iChannels * sizeof( float ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
+ }
+ if ( ( splitBinLCLDDec->pppfDecLCLDImag = (float ***) malloc( iChannels * sizeof( float ** ) ) ) == NULL )
{
- splitBinLCLDDec->pppfDecCQMFReal[n] =
- (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) );
- splitBinLCLDDec->pppfDecCQMFImag[n] =
- (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) );
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
+ }
+
+ for ( n = 0; n < splitBinLCLDDec->iChannels; n++ )
+ {
+ if ( ( splitBinLCLDDec->pppfDecLCLDReal[n] = (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
+ }
+ if ( ( splitBinLCLDDec->pppfDecLCLDImag[n] = (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) );
+ }
}
#ifdef CLDFB_DEBUG
@@ -92,36 +96,50 @@ ivas_splitBinLCLDDecOpen( BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec,
char cldfbFilename[50] = "cldfb_out.bin";
if ( ( splitBinLCLDDec->cldfbOut = fopen( cldfbFilename, "wb" ) ) == NULL )
{
- fprintf( stderr, "Error: CLDFB bitstream file %s could not be opened\n\n",
- cldfbFilename );
+ fprintf( stderr, "Error: CLDFB bitstream file %s could not be opened\n\n", cldfbFilename );
exit( -1 );
}
- int num_bands = CLDFB_NO_CHANNELS_MAX;
- fwrite( &iChannels, sizeof( int ), 1, splitBinLCLDDec->cldfbOut );
- fwrite( &num_bands, sizeof( int ), 1, splitBinLCLDDec->cldfbOut );
+ int16_t num_bands = CLDFB_NO_CHANNELS_MAX;
+ fwrite( &iChannels, sizeof( int16_t ), 1, splitBinLCLDDec->cldfbOut );
+ fwrite( &num_bands, sizeof( int16_t ), 1, splitBinLCLDDec->cldfbOut );
#endif
- ivas_splitBinRendPLCOpen( &splitBinLCLDDec->hSplitRendPLC );
+
+ if ( ( error = ivas_splitBinRendPLCOpen( &splitBinLCLDDec->hSplitRendPLC ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
*hSplitBinLCLDDec = splitBinLCLDDec;
- return error;
+
+ return IVAS_ERR_OK;
}
-void ivas_splitBinLCLDDecClose( BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec )
+
+/*-------------------------------------------------------------------------
+ * Function ivas_splitBinLCLDDecClose()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+void ivas_splitBinLCLDDecClose(
+ BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec )
{
+ int16_t n;
+
if ( ( *hSplitBinLCLDDec ) != NULL )
{
- if ( ( *hSplitBinLCLDDec )->psCQMFDecoder != NULL )
+ if ( ( *hSplitBinLCLDDec )->psLCLDDecoder != NULL )
{
- DeleteCQMFDecoder( ( *hSplitBinLCLDDec )->psCQMFDecoder );
+ DeleteLCLDDecoder( ( *hSplitBinLCLDDec )->psLCLDDecoder );
}
- for ( int32_t n = 0; n < ( *hSplitBinLCLDDec )->iChannels; n++ )
+ for ( n = 0; n < ( *hSplitBinLCLDDec )->iChannels; n++ )
{
- free( ( *hSplitBinLCLDDec )->pppfDecCQMFReal[n] );
- free( ( *hSplitBinLCLDDec )->pppfDecCQMFImag[n] );
+ free( ( *hSplitBinLCLDDec )->pppfDecLCLDReal[n] );
+ free( ( *hSplitBinLCLDDec )->pppfDecLCLDImag[n] );
}
- free( ( *hSplitBinLCLDDec )->pppfDecCQMFReal );
- free( ( *hSplitBinLCLDDec )->pppfDecCQMFImag );
+ free( ( *hSplitBinLCLDDec )->pppfDecLCLDReal );
+ free( ( *hSplitBinLCLDDec )->pppfDecLCLDImag );
#ifdef CLDFB_DEBUG
if ( ( *hSplitBinLCLDDec )->cldfbOut != NULL )
@@ -134,9 +152,17 @@ void ivas_splitBinLCLDDecClose( BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec )
free( *hSplitBinLCLDDec );
*hSplitBinLCLDDec = NULL;
}
+
return;
}
+
+/*-------------------------------------------------------------------------
+ * Function ivas_splitBinLCLDDecProcess()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
void ivas_splitBinLCLDDecProcess(
BIN_HR_SPLIT_LCLD_DEC_HANDLE hSplitBinLCLDDec,
ivas_split_rend_bits_t *pBits,
@@ -144,6 +170,8 @@ void ivas_splitBinLCLDDecProcess(
float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
const int16_t bfi )
{
+ int16_t k, n;
+
push_wmops( "ivas_splitBinLCLDDecProcess" );
assert( hSplitBinLCLDDec != NULL );
@@ -156,38 +184,33 @@ void ivas_splitBinLCLDDecProcess(
#endif
if ( !bfi )
{
- // Initialized with zeros....... :(
- for ( int32_t n = 0; n < hSplitBinLCLDDec->iChannels; n++ )
+ /* Initialized with zeros....... */
+ for ( n = 0; n < hSplitBinLCLDDec->iChannels; n++ )
{
- for ( int32_t k = 0; k < CLDFB_NO_COL_MAX; k++ )
+ for ( k = 0; k < CLDFB_NO_COL_MAX; k++ )
{
- hSplitBinLCLDDec->pppfDecCQMFReal[n][k] = Cldfb_Out_Real[n][k];
- hSplitBinLCLDDec->pppfDecCQMFImag[n][k] = Cldfb_Out_Imag[n][k];
- set_f( hSplitBinLCLDDec->pppfDecCQMFReal[n][k], 0, CLDFB_NO_CHANNELS_MAX );
- set_f( hSplitBinLCLDDec->pppfDecCQMFImag[n][k], 0, CLDFB_NO_CHANNELS_MAX );
+ hSplitBinLCLDDec->pppfDecLCLDReal[n][k] = Cldfb_Out_Real[n][k];
+ hSplitBinLCLDDec->pppfDecLCLDImag[n][k] = Cldfb_Out_Imag[n][k];
+ set_f( hSplitBinLCLDDec->pppfDecLCLDReal[n][k], 0, CLDFB_NO_CHANNELS_MAX );
+ set_f( hSplitBinLCLDDec->pppfDecLCLDImag[n][k], 0, CLDFB_NO_CHANNELS_MAX );
}
}
- DecodeFrame( hSplitBinLCLDDec->psCQMFDecoder,
- pBits,
- hSplitBinLCLDDec->pppfDecCQMFReal,
- hSplitBinLCLDDec->pppfDecCQMFImag );
+ DecodeLCLDFrame( hSplitBinLCLDDec->psLCLDDecoder, pBits, hSplitBinLCLDDec->pppfDecLCLDReal, hSplitBinLCLDDec->pppfDecLCLDImag );
#ifdef CLDFB_DEBUG
printf( "Frame Decoded = %d\n", ++hSplitBinLCLDDec->numFrame );
- int writeByte = 0;
- for ( int k = 0; k < CLDFB_NO_COL_MAX; k++ )
+ int16_t writeByte = 0;
+ for ( k = 0; k < CLDFB_NO_COL_MAX; k++ )
{
- for ( int b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ )
+ for ( int16_t b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ )
{
- for ( int n = 0; n < hSplitBinLCLDDec->iChannels; n++ )
+ for ( n = 0; n < hSplitBinLCLDDec->iChannels; n++ )
{
- writeByte = fwrite( &hSplitBinLCLDDec->pppfDecCQMFReal[n][k][b],
- sizeof( float ), 1, hSplitBinLCLDDec->cldfbOut );
+ writeByte = fwrite( &hSplitBinLCLDDec->pppfDecLCLDReal[n][k][b], sizeof( float ), 1, hSplitBinLCLDDec->cldfbOut );
if ( writeByte != 1 )
exit( -1 );
- writeByte = fwrite( &hSplitBinLCLDDec->pppfDecCQMFImag[n][k][b],
- sizeof( float ), 1, hSplitBinLCLDDec->cldfbOut );
+ writeByte = fwrite( &hSplitBinLCLDDec->pppfDecLCLDImag[n][k][b], sizeof( float ), 1, hSplitBinLCLDDec->cldfbOut );
if ( writeByte != 1 )
exit( -1 );
}
@@ -205,6 +228,7 @@ void ivas_splitBinLCLDDecProcess(
/* do PLC for lost split renderer frame */
ivas_splitBinRendPLC( hSplitBinLCLDDec->hSplitRendPLC, Cldfb_Out_Real, Cldfb_Out_Imag, (int16_t) hSplitBinLCLDDec->iChannels );
}
+
/* save PLC state */
ivas_splitBinRendPLCsaveState( hSplitBinLCLDDec->hSplitRendPLC, Cldfb_Out_Real, Cldfb_Out_Imag, (int16_t) hSplitBinLCLDDec->iChannels );
diff --git a/lib_rend/ivas_splitRend_lcld_enc.c b/lib_rend/ivas_splitRend_lcld_enc.c
index a0b3e86d9829c26df1938d115c3b3d6d85ef1401..c243a2af9cd56a9bcabc1ee123261d8348bf77d3 100644
--- a/lib_rend/ivas_splitRend_lcld_enc.c
+++ b/lib_rend/ivas_splitRend_lcld_enc.c
@@ -1,92 +1,93 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby
-International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der
-angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips
-N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge
-Corporation, and other contributors to this repository. All Rights Reserved.
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
+ Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
+ Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+ contributors to this repository. All Rights Reserved.
This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB,
-Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung
-e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph
-and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings
-Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their
-respective contributions in the software. This notice grants no license of any
-kind, including but not limited to patent license, nor is any license granted by
-implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration
-agreement before making contributions.
-
- This software is provided "AS IS", without any express or implied warranties.
-The software is in the development stage. It is intended exclusively for experts
-who have experience with such software and solely for the purpose of inspection.
-All implied warranties of non-infringement, merchantability and fitness for a
-particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing
-this software shall be submitted to and settled by the final, binding
-jurisdiction of the courts of Munich, Germany in accordance with the laws of the
-Federal Republic of Germany excluding its conflict of law rules and the United
-Nations Convention on Contracts on the International Sales of Goods.
+ The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
+ Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
+ Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
+ Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+ contributors to this repository retain full ownership rights in their respective contributions in
+ the software. This notice grants no license of any kind, including but not limited to patent
+ license, nor is any license granted by implication, estoppel or otherwise.
+
+ Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
+ contributions.
+
+ This software is provided "AS IS", without any express or implied warranties. The software is in the
+ development stage. It is intended exclusively for experts who have experience with such software and
+ solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
+ and fitness for a particular purpose are hereby disclaimed and excluded.
+
+ Any dispute, controversy or claim arising under or in relation to providing this software shall be
+ submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
+ accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
+ the United Nations Convention on Contracts on the International Sales of Goods.
*******************************************************************************************************/
+#include
#include "options.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
-#include "cnst.h"
-#include "ivas_cnst.h"
#include "ivas_prot_rend.h"
#include "ivas_prot.h"
-#include "ivas_rom_binauralRenderer.h"
-#include "ivas_rom_com.h"
-#include "ivas_rom_dec.h"
-#include "ivas_rom_rend.h"
-#include "lib_rend.h"
-#include "prot.h"
-#include
-#include
-#include
#ifdef DEBUGGING
#include "debug.h"
#endif
#include "wmc_auto.h"
-ivas_error
-ivas_splitBinLCLDEncOpen( BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc,
- int32_t iSampleRate,
- int32_t iChannels,
- int32_t iDataRate )
+
+/*-------------------------------------------------------------------------
+ * Function ivas_splitBinLCLDEncOpen()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+ivas_error ivas_splitBinLCLDEncOpen(
+ BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc,
+ const int32_t iSampleRate,
+ const int16_t iChannels,
+ const int32_t iDataRate )
{
- ivas_error error;
BIN_HR_SPLIT_LCLD_ENC_HANDLE splitBinLCLDEnc;
- error = IVAS_ERR_OK;
- if ( ( splitBinLCLDEnc = (BIN_HR_SPLIT_LCLD_ENC_HANDLE) malloc(
- sizeof( BIN_HR_SPLIT_LCLD_ENC ) ) ) == NULL )
+ ivas_error error;
+
+ if ( ( splitBinLCLDEnc = (BIN_HR_SPLIT_LCLD_ENC_HANDLE) malloc( sizeof( BIN_HR_SPLIT_LCLD_ENC ) ) ) == NULL )
{
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC,
- "Can not allocate memory for LCLD encoder Module \n" ) );
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
}
splitBinLCLDEnc->pLcld_enc = NULL; // place holder for CLDFB encoder handle
splitBinLCLDEnc->iChannels = iChannels;
- splitBinLCLDEnc->psCQMFEncoder =
- CreateCQMFEncoder( iSampleRate, iChannels, iDataRate, 1 );
-
- splitBinLCLDEnc->pppfCQMFReal =
- (float ***) malloc( iChannels * sizeof( float ** ) );
- splitBinLCLDEnc->pppfCQMFImag =
- (float ***) malloc( iChannels * sizeof( float ** ) );
- for ( int32_t n = 0; n < splitBinLCLDEnc->iChannels; n++ )
+ if ( ( error = CreateLCLDEncoder( &( splitBinLCLDEnc->psLCLDEncoder ), iSampleRate, iChannels, iDataRate, 1 ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+
+ if ( ( splitBinLCLDEnc->pppfLCLDReal = (float ***) malloc( iChannels * sizeof( float ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( splitBinLCLDEnc->pppfLCLDImag = (float ***) malloc( iChannels * sizeof( float ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+
+ for ( int16_t n = 0; n < splitBinLCLDEnc->iChannels; n++ )
{
- splitBinLCLDEnc->pppfCQMFReal[n] =
- (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) );
- splitBinLCLDEnc->pppfCQMFImag[n] =
- (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) );
+ if ( ( splitBinLCLDEnc->pppfLCLDReal[n] = (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
+ if ( ( splitBinLCLDEnc->pppfLCLDImag[n] = (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) );
+ }
}
#ifdef CLDFB_DEBUG
@@ -94,32 +95,40 @@ ivas_splitBinLCLDEncOpen( BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc,
char cldfbFilename[50] = "cldfb_in_ref.qmf";
if ( ( splitBinLCLDEnc->cldfbIn = fopen( cldfbFilename, "rb" ) ) == NULL )
{
- fprintf( stderr, "Error: CLDFB bitstream file %s could not be opened\n\n",
- cldfbFilename );
+ fprintf( stderr, "Error: CLDFB bitstream file %s could not be opened\n\n", cldfbFilename );
exit( -1 );
}
- int chan, band;
- fread( &chan, sizeof( int ), 1, splitBinLCLDEnc->cldfbIn );
- fread( &band, sizeof( int ), 1, splitBinLCLDEnc->cldfbIn );
+ int16_t chan, band;
+ fread( &chan, sizeof( int16_t ), 1, splitBinLCLDEnc->cldfbIn );
+ fread( &band, sizeof( int16_t ), 1, splitBinLCLDEnc->cldfbIn );
#endif
*hSplitBinLCLDEnc = splitBinLCLDEnc;
- return error;
+
+ return IVAS_ERR_OK;
}
-void ivas_splitBinLCLDEncClose( BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc )
+
+/*-------------------------------------------------------------------------
+ * Function ivas_splitBinLCLDEncClose()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+void ivas_splitBinLCLDEncClose(
+ BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc )
{
if ( ( *hSplitBinLCLDEnc ) != NULL )
{
- DeleteCQMFEncoder( ( *hSplitBinLCLDEnc )->psCQMFEncoder );
+ DeleteLCLDEncoder( ( *hSplitBinLCLDEnc )->psLCLDEncoder );
- for ( int32_t n = 0; n < ( *hSplitBinLCLDEnc )->iChannels; n++ )
+ for ( int16_t n = 0; n < ( *hSplitBinLCLDEnc )->iChannels; n++ )
{
- free( ( *hSplitBinLCLDEnc )->pppfCQMFReal[n] );
- free( ( *hSplitBinLCLDEnc )->pppfCQMFImag[n] );
+ free( ( *hSplitBinLCLDEnc )->pppfLCLDReal[n] );
+ free( ( *hSplitBinLCLDEnc )->pppfLCLDImag[n] );
}
- free( ( *hSplitBinLCLDEnc )->pppfCQMFReal );
- free( ( *hSplitBinLCLDEnc )->pppfCQMFImag );
+ free( ( *hSplitBinLCLDEnc )->pppfLCLDReal );
+ free( ( *hSplitBinLCLDEnc )->pppfLCLDImag );
#ifdef CLDFB_DEBUG
if ( ( *hSplitBinLCLDEnc )->cldfbIn != NULL )
@@ -131,9 +140,17 @@ void ivas_splitBinLCLDEncClose( BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc )
free( *hSplitBinLCLDEnc );
*hSplitBinLCLDEnc = NULL;
}
+
return;
}
+
+/*-------------------------------------------------------------------------
+ * Function ivas_splitBinLCLDEncProcess()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
void ivas_splitBinLCLDEncProcess(
BIN_HR_SPLIT_LCLD_ENC_HANDLE hSplitBinLCLDEnc,
float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
@@ -150,36 +167,34 @@ void ivas_splitBinLCLDEncProcess(
assert( Cldfb_In_Imag != NULL );
assert( pBits != NULL );
- // A conversion is needed for the 3d pointer interface here ........ :(
+ /* A conversion is needed for the 3d pointer interface here ........ */
for ( int32_t n = 0; n < hSplitBinLCLDEnc->iChannels; n++ )
{
for ( int32_t k = 0; k < CLDFB_NO_COL_MAX; k++ )
{
- hSplitBinLCLDEnc->pppfCQMFReal[n][k] = Cldfb_In_Real[n][k];
- hSplitBinLCLDEnc->pppfCQMFImag[n][k] = Cldfb_In_Imag[n][k];
+ hSplitBinLCLDEnc->pppfLCLDReal[n][k] = Cldfb_In_Real[n][k];
+ hSplitBinLCLDEnc->pppfLCLDImag[n][k] = Cldfb_In_Imag[n][k];
}
}
#ifdef CLDFB_DEBUG
- int readByte = 0;
- for ( int k = 0; k < CLDFB_NO_COL_MAX; k++ )
+ int16_t readByte = 0;
+ for ( int16_t k = 0; k < CLDFB_NO_COL_MAX; k++ )
{
- for ( int b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ )
+ for ( int16_t b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ )
{
- for ( int n = 0; n < hSplitBinLCLDEnc->iChannels; n++ )
+ for ( int16_t n = 0; n < hSplitBinLCLDEnc->iChannels; n++ )
{
#if 0
- readByte = fread(&hSplitBinLCLDEnc->pppfCQMFReal[n][k][b], sizeof(float), 1, hSplitBinLCLDEnc->cldfbIn);
+ readByte = fread(&hSplitBinLCLDEnc->pppfLCLDReal[n][k][b], sizeof(float), 1, hSplitBinLCLDEnc->cldfbIn);
if ( readByte != 1 )
break;
- readByte = fread(&hSplitBinLCLDEnc->pppfCQMFImag[n][k][b], sizeof(float), 1, hSplitBinLCLDEnc->cldfbIn);
+ readByte = fread(&hSplitBinLCLDEnc->pppfLCLDImag[n][k][b], sizeof(float), 1, hSplitBinLCLDEnc->cldfbIn);
#else
- readByte = fread( &Cldfb_In_Real[n][k][b], sizeof( float ), 1,
- hSplitBinLCLDEnc->cldfbIn );
+ readByte = fread( &Cldfb_In_Real[n][k][b], sizeof( float ), 1, hSplitBinLCLDEnc->cldfbIn );
if ( readByte != 1 )
break;
- readByte = fread( &Cldfb_In_Imag[n][k][b], sizeof( float ), 1,
- hSplitBinLCLDEnc->cldfbIn );
+ readByte = fread( &Cldfb_In_Imag[n][k][b], sizeof( float ), 1, hSplitBinLCLDEnc->cldfbIn );
#endif
}
}
@@ -192,25 +207,26 @@ void ivas_splitBinLCLDEncProcess(
else
{
printf( "Writing zeroes...\n" );
- for ( int k = 0; k < CLDFB_NO_COL_MAX; k++ )
+ for ( int16_T k = 0; k < CLDFB_NO_COL_MAX; k++ )
{
- for ( int b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ )
+ for ( int16_t b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ )
{
- for ( int n = 0; n < hSplitBinLCLDEnc->iChannels; n++ )
+ for ( int16_t n = 0; n < hSplitBinLCLDEnc->iChannels; n++ )
{
- hSplitBinLCLDEnc->pppfCQMFReal[n][k][b] = 0.f;
- hSplitBinLCLDEnc->pppfCQMFImag[n][k][b] = 0.f;
+ hSplitBinLCLDEnc->pppfLCLDReal[n][k][b] = 0.f;
+ hSplitBinLCLDEnc->pppfLCLDImag[n][k][b] = 0.f;
}
}
}
}
#endif
- EncodeFrame( hSplitBinLCLDEnc->psCQMFEncoder, hSplitBinLCLDEnc->pppfCQMFReal,
- hSplitBinLCLDEnc->pppfCQMFImag, &iBitsWritten, available_bits,
- pBits );
+ EncodeLCLDFrame( hSplitBinLCLDEnc->psLCLDEncoder, hSplitBinLCLDEnc->pppfLCLDReal, hSplitBinLCLDEnc->pppfLCLDImag, &iBitsWritten, available_bits, pBits );
+
+#ifdef DEBUGGING
if ( iBitsWritten > available_bits )
assert( iBitsWritten <= available_bits );
+#endif
#ifdef CLDFB_DEBUG
printf( "Bits written = %d\n", iBitsWritten );
diff --git a/lib_rend/ivas_splitRendererPLC.c b/lib_rend/ivas_splitRendererPLC.c
index 3d5ad64824a7f2a84b1f200040524f02024f2ad7..dcdd515b6f790aca719bf229f1ce1d28cd8d6469 100644
--- a/lib_rend/ivas_splitRendererPLC.c
+++ b/lib_rend/ivas_splitRendererPLC.c
@@ -1,6 +1,6 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -34,30 +34,35 @@
#ifdef SPLIT_REND_WITH_HEAD_ROT
#include
#include
-#include
#include "ivas_prot.h"
#include "prot.h"
-#include "cnst.h"
#include "ivas_cnst.h"
-#include "ivas_rom_rend.h"
-#include "ivas_rom_com.h"
-#include "ivas_rom_dec.h"
-#include "ivas_rom_binauralRenderer.h"
-#include "lib_rend.h"
#include "ivas_prot_rend.h"
#ifdef DEBUGGING
#include "debug.h"
#endif
#include "wmc_auto.h"
+
+/*-------------------------------------------------------------------------
+ * Local constants
+ *------------------------------------------------------------------------*/
+
#define DO_PERTURB 1
#define PH_PERT_ONLY 1
#define START_VAL_AVG_LEN 2
-#define SR_PLC_FADE_START 10 // start fading at this number of bad frames in row
-#define SR_PLC_MUTE 30 // Total mute at this number of bad frames in row
-#define SR_PLC_FADE_DEGREE -3 // fading degree per frame in dB
-#define SRHO_THRESH 2.f / 3.f * 0.1f
-#define STH_THRESH 2.f / 3.f * PI2 / 12
+#define SR_PLC_FADE_START 10 /* start fading at this number of bad frames in row */
+#define SR_PLC_MUTE 30 /* Total mute at this number of bad frames in row */
+#define SR_PLC_FADE_DEGREE -3 /* fading degree per frame in dB */
+#define SRHO_THRESH ( 2.f / 3.f * 0.1f )
+#define STH_THRESH ( 2.f / 3.f * PI2 / 12 )
+
+
+/*-------------------------------------------------------------------------
+ * Function adaptive_polar_ext_plc()
+ *
+ *
+ *------------------------------------------------------------------------*/
static void adaptive_polar_ext_plc(
const float *prev_real,
@@ -78,32 +83,32 @@ static void adaptive_polar_ext_plc(
float fac_ph_real, fac_ph_imag, rat_real, rat_imag, abs_temp;
int32_t k, j;
- // reset of accumulators
+ /* reset of accumulators */
ph_adj = 0.0f;
drho = 0.0f;
srho = 0.0f;
dth = 0.0f;
sth = 0.0f;
- // calculate per-sample phase and magnitude evolution in preceding frame
+ /* calculate per-sample phase and magnitude evolution in preceding frame */
for ( k = 0; k < CLDFB_NO_COL_MAX; k++ )
{
urh[k] = sqrtf( prev_imag[k] * prev_imag[k] + prev_real[k] * prev_real[k] );
if ( urh[k] < EPSILON )
{
- // zero encountered
+ /* zero encountered */
break;
}
uth[k] = atan2f( prev_imag[k], prev_real[k] );
- // phase unwrap
+ /* phase unwrap */
if ( k == 0 )
{
uthu[0] = uth[0];
}
else
{
- // phase unwrap
+ /* phase unwrap */
ph_diff = uth[k] - uth[k - 1];
uthu[k] = uth[k];
if ( fabsf( ph_diff ) >= PI2 / 2 )
@@ -116,21 +121,22 @@ static void adaptive_polar_ext_plc(
ph_adj = -PI2 * roundf( ph_adj_t ) + ph_adj;
}
uthu[k] += ph_adj;
- // unwrapped phase in uthu
+ /* unwrapped phase in uthu */
- // mean and stdev of per-sample magnitude ratios
+ /* mean and stdev of per-sample magnitude ratios */
quot = urh[k] / urh[k - 1];
drho += quot;
srho += SQR( quot );
- // mean and stdev of per-sample phase differences
- diff = uthu[k] - uthu[k - 1]; // the mean value calculation could be optimized
+ /* mean and stdev of per-sample phase differences */
+ diff = uthu[k] - uthu[k - 1]; /* the mean value calculation could be optimized */
dth += diff;
sth += SQR( diff );
}
}
+
if ( k == CLDFB_NO_COL_MAX )
{
- // mean and stdev of per-sample magnitude ratios
+ /* mean and stdev of per-sample magnitude ratios */
drho *= 1.0f / ( CLDFB_NO_COL_MAX - 1 );
temp = srho - ( CLDFB_NO_COL_MAX - 1 ) * SQR( drho );
if ( temp > 0 )
@@ -141,7 +147,8 @@ static void adaptive_polar_ext_plc(
{
srho = 0.0f;
}
- // mean and stdev of per-sample phase differences
+
+ /* mean and stdev of per-sample phase differences */
dth *= 1.0f / ( CLDFB_NO_COL_MAX - 1 );
temp = sth - ( CLDFB_NO_COL_MAX - 1 ) * SQR( dth );
if ( temp > 0 )
@@ -152,16 +159,18 @@ static void adaptive_polar_ext_plc(
{
sth = 0.0f;
}
- // do phase extension only if the std deviations are small
+
+ /* do phase extension only if the std deviations are small */
if ( ( srho < SRHO_THRESH ) || ( sth < STH_THRESH ) )
{
- // calculate complex evolution factor
+ /* calculate complex evolution factor */
fac_ph_real = cosf( dth );
fac_ph_imag = sinf( dth );
fac_real = min( 1, drho ) * fac_ph_real;
fac_imag = min( 1, drho ) * fac_ph_imag;
+
#if START_VAL_AVG_LEN > 1
- // Calculate start value for evolution from last samples of previous frame
+ /* Calculate start value for evolution from last samples of previous frame */
fac_powj_real = fac_real;
fac_powj_imag = fac_imag;
start_real = prev_real[CLDFB_NO_COL_MAX - 1];
@@ -177,49 +186,52 @@ static void adaptive_polar_ext_plc(
start_real *= 1.0f / START_VAL_AVG_LEN;
start_imag *= 1.0f / START_VAL_AVG_LEN;
#else
- // take last sample of previous frame as start value
+ /* take last sample of previous frame as start value */
start_real = prev_real[CLDFB_NO_COL_MAX - 1];
start_imag = prev_imag[CLDFB_NO_COL_MAX - 1];
#endif
+
#if DO_PERTURB != 0
- // make evolution less static: apply per samples differences as in preceding frame
+ /* make evolution less static: apply per samples differences as in preceding frame */
rat_real = ( prev_real[1] * prev_real[0] + prev_imag[1] * prev_imag[0] );
rat_imag = ( -prev_real[1] * prev_imag[0] + prev_imag[1] * prev_real[0] );
#if PH_PERT_ONLY != 0
- // only phase perturbation
+ /* only phase perturbation */
abs_temp = sqrtf( SQR( rat_real ) + SQR( rat_imag ) );
abs2inv = min( 1, drho ) / max( EPSILON, abs_temp );
rat_real *= abs2inv;
rat_imag *= abs2inv;
#else
- // phase and magnitude perturbation
+ /* phase and magnitude perturbation */
abs2inv = 1 / ( max( 1, drho ) * ( SQR( prev_real[0] ) + SQR( prev_imag[0] ) ) );
rat_real *= abs2inv;
rat_imag *= abs2inv;
#endif
- // apply complex evolution for first substitution sample
+
+ /* apply complex evolution for first substitution sample */
rec_real[0] = rat_real * start_real - rat_imag * start_imag;
rec_imag[0] = rat_imag * start_real + rat_real * start_imag;
for ( j = 2; j < CLDFB_NO_COL_MAX; j++ )
{
- // make evolution less static: apply per samples differences as in preceding frame
+ /* make evolution less static: apply per samples differences as in preceding frame */
rat_real = ( prev_real[j] * prev_real[j - 1] + prev_imag[j] * prev_imag[j - 1] );
rat_imag = ( -prev_real[j] * prev_imag[j - 1] + prev_imag[j] * prev_real[j - 1] );
#if PH_PERT_ONLY != 0
- // only phase perturbation
+ /* only phase perturbation */
abs_temp = sqrtf( SQR( rat_real ) + SQR( rat_imag ) );
abs2inv = min( 1, drho ) / max( EPSILON, abs_temp );
#else
- // phase and magnitude perturbation
+ /* phase and magnitude perturbation */
abs2inv = 1 / ( max( 1, drho ) * ( SQR( prev_real[j - 1] ) + SQR( prev_imag[j - 1] ) ) );
#endif
rat_real *= abs2inv;
rat_imag *= abs2inv;
- // apply complex evolution for further substitution samples
+ /* apply complex evolution for further substitution samples */
rec_real[j - 1] = rat_real * rec_real[j - 2] - rat_imag * rec_imag[j - 2];
rec_imag[j - 1] = rat_imag * rec_real[j - 2] + rat_real * rec_imag[j - 2];
}
- // do the same for samples of crossfade region
+
+ /* do the same for samples of crossfade region */
for ( j = 1; j < CLDFB_PLC_XF + 2; j++ )
{
rat_real = ( prev_real[j] * prev_real[j - 1] + prev_imag[j] * prev_imag[j - 1] );
@@ -244,8 +256,9 @@ static void adaptive_polar_ext_plc(
rec_imag[j] = fac_imag * rec_real[j - 1] + fac_real * rec_imag[j - 1];
}
#endif
+
#if CLDFB_PLC_XF > 0
- // apply crossfade
+ /* apply crossfade */
for ( j = 0; j < CLDFB_PLC_XF; j++ )
{
rec_real[CLDFB_NO_COL_MAX + j] *= xf_alp[j];
@@ -256,7 +269,7 @@ static void adaptive_polar_ext_plc(
}
else
{
- // do complex lpc combined with frame repetition
+ /* do complex lpc combined with frame repetition */
Ruu_real[0] = SQR( prev_real[0] ) + SQR( prev_imag[0] );
Ruu_real[1] = 0;
Ruu_imag[1] = 0;
@@ -268,7 +281,7 @@ static void adaptive_polar_ext_plc(
}
if ( Ruu_real[0] > EPSILON )
{
- // prediction coefficient
+ /* prediction coefficient */
fac_real = Ruu_real[1] / Ruu_real[0];
fac_imag = Ruu_imag[1] / Ruu_real[0];
}
@@ -277,7 +290,8 @@ static void adaptive_polar_ext_plc(
fac_real = 0;
fac_imag = 0;
}
- // apply prediction using last sample of preceding frame as start value and combine with previous frame samples
+
+ /* apply prediction using last sample of preceding frame as start value and combine with previous frame samples */
fac_powj_real = fac_real;
fac_powj_imag = fac_imag;
abs_fac = sqrtf( SQR( fac_real ) + SQR( fac_imag ) );
@@ -294,7 +308,8 @@ static void adaptive_polar_ext_plc(
fac_powj_imag = fac_powj_real * fac_imag + fac_powj_imag * fac_real;
fac_powj_real = temp;
}
- // prepare XF to next frame using prediction
+
+ /* prepare XF to next frame using prediction */
fac_powj_real = fac_real;
fac_powj_imag = fac_imag;
abs_fac_powj = abs_fac;
@@ -328,8 +343,17 @@ static void adaptive_polar_ext_plc(
}
#endif
}
+
+ return;
}
+
+/*-------------------------------------------------------------------------
+ * Function ivas_splitBinRendPLCOpen()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
ivas_error ivas_splitBinRendPLCOpen(
SPLIT_REND_PLC_HANDLE *phSplitRendPLC )
{
@@ -341,6 +365,7 @@ ivas_error ivas_splitBinRendPLCOpen(
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for bin split renderer PLC Module \n" ) );
}
+
hSplitRendPLC->prev_bfi = 0;
hSplitRendPLC->bf_count = 0;
set_zero( &hSplitRendPLC->CldfbPLC_state.Cldfb_Prev_BinReal[0][0][0], 2 * ( CLDFB_NO_COL_MAX + CLDFB_PLC_XF ) * CLDFB_NO_CHANNELS_MAX );
@@ -350,23 +375,40 @@ ivas_error ivas_splitBinRendPLCOpen(
return error;
}
-void ivas_splitBinRendPLCClose( SPLIT_REND_PLC_HANDLE *phSplitRendPLC )
+
+/*-------------------------------------------------------------------------
+ * Function ivas_splitBinRendPLCClose()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+void ivas_splitBinRendPLCClose(
+ SPLIT_REND_PLC_HANDLE *phSplitRendPLC )
{
if ( ( *phSplitRendPLC ) != NULL )
{
free( ( *phSplitRendPLC ) );
( *phSplitRendPLC ) = NULL;
}
+
return;
}
+
+/*-------------------------------------------------------------------------
+ * Function ivas_splitBinRendPLCsaveState()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
void ivas_splitBinRendPLCsaveState(
SPLIT_REND_PLC_HANDLE hSplitRendPLC,
float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
const int16_t num_chs )
{
- int32_t k, n;
+ int16_t k, n;
+
/* Save Cldfb frame */
for ( k = 0; k < CLDFB_NO_COL_MAX; k++ )
{
@@ -376,40 +418,58 @@ void ivas_splitBinRendPLCsaveState(
mvr2r( &Cldfb_ImagBuffer_Binaural[n][k][0], &hSplitRendPLC->CldfbPLC_state.Cldfb_Prev_BinImag[n][k][0], CLDFB_NO_CHANNELS_MAX );
}
}
+
+ return;
}
-/* Cross-fade of preceding bad frame into good frame */
+
+/*-------------------------------------------------------------------------
+ * Function ivas_splitBinRendPLC_xf()
+ *
+ * Cross-fade of preceding bad frame into good frame
+ *------------------------------------------------------------------------*/
+
void ivas_splitBinRendPLC_xf(
SPLIT_REND_PLC_HANDLE hSplitRendPLC,
float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
const int16_t num_chs )
{
- int32_t n, i, k;
- // Indicate that next transition will be from a good frame
+ int16_t n, i, k;
+
+ /* Indicate that next transition will be from a good frame */
hSplitRendPLC->prev_bfi = 0;
- // Reset bf conter
+
+ /* Reset bf conter */
hSplitRendPLC->bf_count = 0;
+
+ /* Do the cross fade */
+ for ( n = 0; n < num_chs; n++ )
{
- // Do the cross fade
- for ( n = 0; n < num_chs; n++ )
+ for ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ )
{
- for ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ )
- {
#if CLDFB_PLC_XF > 0
- for ( k = 0; k < CLDFB_PLC_XF; k++ )
- {
- Cldfb_RealBuffer_Binaural[n][k][i] = hSplitRendPLC->CldfbPLC_state.xf_bet[n][i][k] * Cldfb_RealBuffer_Binaural[n][k][i] + hSplitRendPLC->CldfbPLC_state.Cldfb_Prev_BinReal[n][k + CLDFB_NO_COL_MAX][i];
- Cldfb_ImagBuffer_Binaural[n][k][i] = hSplitRendPLC->CldfbPLC_state.xf_bet[n][i][k] * Cldfb_ImagBuffer_Binaural[n][k][i] + hSplitRendPLC->CldfbPLC_state.Cldfb_Prev_BinImag[n][k + CLDFB_NO_COL_MAX][i];
- }
-#endif
+ for ( k = 0; k < CLDFB_PLC_XF; k++ )
+ {
+ Cldfb_RealBuffer_Binaural[n][k][i] = hSplitRendPLC->CldfbPLC_state.xf_bet[n][i][k] * Cldfb_RealBuffer_Binaural[n][k][i] + hSplitRendPLC->CldfbPLC_state.Cldfb_Prev_BinReal[n][k + CLDFB_NO_COL_MAX][i];
+ Cldfb_ImagBuffer_Binaural[n][k][i] = hSplitRendPLC->CldfbPLC_state.xf_bet[n][i][k] * Cldfb_ImagBuffer_Binaural[n][k][i] + hSplitRendPLC->CldfbPLC_state.Cldfb_Prev_BinImag[n][k + CLDFB_NO_COL_MAX][i];
}
+#endif
}
}
+
+
+ return;
}
-/* Conceal bad frame */
+
+/*-------------------------------------------------------------------------
+ * Function ivas_splitBinRendPLC()
+ *
+ * Conceal bad frame
+ *------------------------------------------------------------------------*/
+
void ivas_splitBinRendPLC(
SPLIT_REND_PLC_HANDLE hSplitRendPLC,
float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
@@ -423,7 +483,7 @@ void ivas_splitBinRendPLC(
float xf_alp[CLDFB_PLC_XF];
#endif
- // Indicate that next transition will be from a bad frame
+ /* Indicate that next transition will be from a bad frame */
hSplitRendPLC->prev_bfi = 1;
{
@@ -433,9 +493,7 @@ void ivas_splitBinRendPLC(
xf_alp[i] = 1.0f - ( i + 1.0f ) / ( CLDFB_PLC_XF + 1.0f );
}
#endif
- // for k = 1 : size(x, 1)
- // y(k, :) = adaptive_polar_ext_plc_vec(x(k, :), false);
- // end
+
for ( n = 0; n < num_chs; n++ )
{
for ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ )
@@ -469,7 +527,7 @@ void ivas_splitBinRendPLC(
}
}
- // Check bf counter
+ /* Check bf counter */
if ( hSplitRendPLC->bf_count++ >= SR_PLC_FADE_START )
{
if ( hSplitRendPLC->bf_count < SR_PLC_MUTE )
@@ -485,6 +543,7 @@ void ivas_splitBinRendPLC(
hSplitRendPLC->bf_count = SR_PLC_MUTE;
}
}
+
return;
}
diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c
index 48d957993f49a600a51842aef5e54f640b9682f1..7566007834e099d0d521072e8ae4ce14e245a732 100644
--- a/lib_rend/ivas_splitRendererPost.c
+++ b/lib_rend/ivas_splitRendererPost.c
@@ -1,6 +1,6 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -30,28 +30,29 @@
*******************************************************************************************************/
+#include
#include "options.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
-#include
#include
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
#include
#endif
#include "ivas_prot.h"
#include "prot.h"
-#include "cnst.h"
-#include "ivas_cnst.h"
-#include "ivas_rom_rend.h"
-#include "ivas_rom_com.h"
#include "ivas_rom_dec.h"
-#include "ivas_rom_binauralRenderer.h"
-#include "lib_rend.h"
#include "ivas_prot_rend.h"
#ifdef DEBUGGING
#include "debug.h"
#endif
#include "wmc_auto.h"
+
+/*-------------------------------------------------------------------------
+ * ivas_splitBinPostRendOpen()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
ivas_error ivas_splitBinPostRendOpen(
BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostRend,
MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
@@ -82,7 +83,6 @@ ivas_error ivas_splitBinPostRendOpen(
}
#endif
-
for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
{
if ( ( error = openCldfb( &( hBinRend->cldfbSyn[ch] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK )
@@ -116,9 +116,18 @@ ivas_error ivas_splitBinPostRendOpen(
return error;
}
-void ivas_splitBinPostRendClose( BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostRend )
+
+/*-------------------------------------------------------------------------
+ * ivas_splitBinPostRendClose()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+void ivas_splitBinPostRendClose(
+ BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostRend )
{
int16_t ch;
+
if ( ( *hBinHrSplitPostRend ) != NULL )
{
for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
@@ -151,9 +160,11 @@ void ivas_splitBinPostRendClose( BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostR
free( ( *hBinHrSplitPostRend ) );
( *hBinHrSplitPostRend ) = NULL;
}
+
return;
}
+
/*-----------------------------------------------------------------------------------------*
* Function ivas_huffman_code_bits_present()
*
@@ -164,10 +175,10 @@ static int32_t ivas_split_rend_huffman_code_bits_present(
const int32_t *codebook,
const int32_t code,
const int32_t bits,
- const int32_t len )
+ const int16_t len )
{
- int32_t index = len + 1;
- int32_t i = 0;
+ int16_t index = len + 1;
+ int16_t i = 0;
int32_t code_t, ind_t, bits_t;
while ( i < len )
@@ -186,6 +197,13 @@ static int32_t ivas_split_rend_huffman_code_bits_present(
return index;
}
+
+/*-----------------------------------------------------------------------------------------*
+ * Function ivas_split_rend_huffman_decode_opt()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
static int16_t ivas_split_rend_huffman_decode_opt(
ivas_split_rend_huffman_cfg_t *huff_cfg,
ivas_split_rend_bits_t *pBits,
@@ -193,6 +211,7 @@ static int16_t ivas_split_rend_huffman_decode_opt(
{
int32_t i, ind, code, num_bits, code_b, num_bits_read;
const int32_t *codebook;
+
codebook = huff_cfg->codebook;
num_bits_read = 0;
ind = huff_cfg->codebook[0] - 1;
@@ -218,12 +237,20 @@ static int16_t ivas_split_rend_huffman_decode_opt(
num_bits_read = num_bits;
codebook = huff_cfg->codebook;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
assert( ind >= huff_cfg->codebook[0] );
#endif
return (int16_t) ind;
}
+
+/*-----------------------------------------------------------------------------------------*
+ * Function ivas_split_rend_huffman_decode()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+// ToDo: unused function
static int16_t ivas_split_rend_huffman_decode(
ivas_split_rend_huffman_cfg_t *huff_cfg,
ivas_split_rend_bits_t *pBits )
@@ -241,6 +268,7 @@ static int16_t ivas_split_rend_huffman_decode(
num_bits_read += 1;
code = code << 1 | bit;
ind = ivas_split_rend_huffman_code_bits_present( huff_cfg->codebook, code, num_bits_read, huff_cfg->sym_len );
+
if ( num_bits_read > huff_cfg->max_len )
{
assert( 0 );
@@ -250,6 +278,7 @@ static int16_t ivas_split_rend_huffman_decode(
return (int16_t) ind;
}
+
static void ivas_split_rend_unquant_md(
BIN_HR_SPLIT_REND_MD_HANDLE hMd,
IVAS_SPLIT_REND_POSE_TYPE pose_type,
@@ -257,7 +286,7 @@ static void ivas_split_rend_unquant_md(
float fix_pos_rot_mat[][BINAURAL_CHANNELS]
#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
,
- float pred_quant_step
+ const float pred_quant_step
#endif
)
{
@@ -272,9 +301,7 @@ static void ivas_split_rend_unquant_md(
{
#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
float quantstep;
-#endif
-#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
quantstep = pred_quant_step;
#endif
@@ -338,6 +365,13 @@ static void ivas_split_rend_unquant_md(
return;
}
+
+/*-----------------------------------------------------------------------------------------*
+ * Function ivas_splitBinPostRendMdBase2Dec()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
static void ivas_splitBinPostRendMdBase2Dec(
ivas_split_rend_bits_t *pBits,
BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend,
@@ -472,6 +506,13 @@ static void ivas_splitBinPostRendMdBase2Dec(
return;
}
+
+/*-----------------------------------------------------------------------------------------*
+ * Function ivas_splitBinPostRendMdHuffDec()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
static void ivas_splitBinPostRendMdHuffDec(
ivas_split_rend_bits_t *pBits,
BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend,
@@ -642,6 +683,13 @@ static void ivas_splitBinPostRendMdHuffDec(
return;
}
+
+/*-----------------------------------------------------------------------------------------*
+ * Function ivas_splitBinPostRendMdDec()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
void ivas_splitBinPostRendMdDec(
ivas_split_rend_bits_t *pBits,
BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend,
@@ -671,15 +719,12 @@ void ivas_splitBinPostRendMdDec(
IVAS_SPLIT_REND_ROT_AXIS rot_axis;
hBinHrSplitPostRend->low_Res = 1;
- //( int16_t ) ivas_split_rend_bitstream_read_int32( pBits, 1 );
split_rend_config.dof = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, IVAS_SPLIT_REND_DOF_BITS );
split_rend_config.hq_mode = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, IVAS_SPLIT_REND_HQ_MODE_BITS );
rot_axis = (IVAS_SPLIT_REND_ROT_AXIS) ivas_split_rend_bitstream_read_int32( pBits, IVAS_SPLIT_REND_ROT_AXIS_BITS );
- ivas_renderSplitGetMultiBinPoseData(
- &split_rend_config,
- pMultiBinPoseData, rot_axis );
+ ivas_renderSplitGetMultiBinPoseData( &split_rend_config, pMultiBinPoseData, rot_axis );
set_fix_rotation_mat( hBinHrSplitPostRend->fix_pos_rot_mat, pMultiBinPoseData );
set_pose_types( hBinHrSplitPostRend->pose_type, pMultiBinPoseData );
@@ -859,6 +904,7 @@ void ivas_splitBinPostRendMdDec(
}
}
#endif
+
for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ )
{
for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ )
@@ -868,9 +914,7 @@ void ivas_splitBinPostRendMdDec(
for ( b = 0; b < pred_imag_bands_yaw[quant_strat]; b++ )
{
hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
- ivas_split_rend_unquant_md( hMd,
- PRED_ONLY,
- 0, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx]
+ ivas_split_rend_unquant_md( hMd, PRED_ONLY, 0, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx]
#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
,
pred_quantstep_yaw[quant_strat]
@@ -880,9 +924,7 @@ void ivas_splitBinPostRendMdDec(
for ( ; b < pred_real_bands_yaw[quant_strat]; b++ )
{
hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
- ivas_split_rend_unquant_md( hMd,
- PRED_ONLY,
- 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx]
+ ivas_split_rend_unquant_md( hMd, PRED_ONLY, 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx]
#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
,
pred_quantstep_yaw[quant_strat]
@@ -902,9 +944,7 @@ void ivas_splitBinPostRendMdDec(
for ( b = 0; b < d_bands_yaw[quant_strat]; b++ )
{
hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
- ivas_split_rend_unquant_md( hMd,
- COM_GAIN_ONLY,
- 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx]
+ ivas_split_rend_unquant_md( hMd, COM_GAIN_ONLY, 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx]
#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
,
0
@@ -922,9 +962,7 @@ void ivas_splitBinPostRendMdDec(
for ( b = 0; b < bands_pitch[quant_strat]; b++ )
{
hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
- ivas_split_rend_unquant_md( hMd,
- LR_GAIN_ONLY,
- 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx]
+ ivas_split_rend_unquant_md( hMd, LR_GAIN_ONLY, 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx]
#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
,
0
@@ -1085,6 +1123,13 @@ void ivas_splitBinPostRendMdDec(
return;
}
+
+/*-----------------------------------------------------------------------------------------*
+ * Function wrap_around_angle()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
static void wrap_around_angle( float *a )
{
if ( ( *a ) > 180.0f )
@@ -1097,6 +1142,13 @@ static void wrap_around_angle( float *a )
}
return;
}
+
+/*-----------------------------------------------------------------------------------------*
+ * Function wrap_around_angle()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
static void wrap_around_ypr( IVAS_QUATERNION *Quaternions )
{
/*only if quat is actually yaw, pitch , roll angles*/
@@ -1109,6 +1161,13 @@ static void wrap_around_ypr( IVAS_QUATERNION *Quaternions )
return;
}
+
+/*-----------------------------------------------------------------------------------------*
+ * Function wrap_around_angle()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
static float get_interp_fact( float p[MAX_HEAD_ROT_POSES], float p_t, int16_t ind[2] )
{
float n, d, interp_fact;
@@ -1133,7 +1192,18 @@ static float get_interp_fact( float p[MAX_HEAD_ROT_POSES], float p_t, int16_t in
return interp_fact;
}
-static void get_nearest_pose_ind( float p[MAX_HEAD_ROT_POSES], float p_t, int16_t ind[2], int16_t num_poses )
+
+/*-----------------------------------------------------------------------------------------*
+ * Function get_nearest_pose_ind()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
+static void get_nearest_pose_ind(
+ float p[MAX_HEAD_ROT_POSES],
+ const float p_t,
+ int16_t ind[2],
+ const int16_t num_poses )
{
float min_diff, diff;
int16_t pos_idx;
@@ -1167,6 +1237,13 @@ static void get_nearest_pose_ind( float p[MAX_HEAD_ROT_POSES], float p_t, int16_
return;
}
+
+/*-----------------------------------------------------------------------------------------*
+ * Function get_interpolation_vars()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
static void get_interpolation_vars(
MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
const IVAS_QUATERNION *Quaternions_ref,
@@ -1234,12 +1311,19 @@ static void get_interpolation_vars(
return;
}
+
+/*-----------------------------------------------------------------------------------------*
+ * Function interpolate_gain_matrix()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
static void interpolate_gain_matrix(
BIN_HR_SPLIT_REND_MD rot_md[][MAX_SPLIT_MD_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS],
- int16_t sf_idx,
- int16_t band_idx,
- int16_t ind[2],
- float interp_fact,
+ const int16_t sf_idx,
+ const int16_t band_idx,
+ const int16_t ind[2],
+ const float interp_fact,
float gain[BINAURAL_CHANNELS] )
{
float gd1, gd2, gd3, gd4, diff;
@@ -1275,14 +1359,23 @@ static void interpolate_gain_matrix(
gain[1] = gd3 - ( diff * interp_fact );
gain[1] = max( 0.0f, gain[1] );
#endif
+
+ return;
}
+
+/*-----------------------------------------------------------------------------------------*
+ * Function interpolate_pred_matrix()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
static void interpolate_pred_matrix(
BIN_HR_SPLIT_REND_MD rot_md[][MAX_SPLIT_MD_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS],
- int16_t sf_idx,
- int16_t band_idx,
- int16_t ind[2],
- float interp_fact,
+ const int16_t sf_idx,
+ const int16_t band_idx,
+ const int16_t ind[2],
+ const float interp_fact,
float mat_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS],
float mat_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS] )
{
@@ -1348,19 +1441,26 @@ static void interpolate_pred_matrix(
return;
}
+
+/*-----------------------------------------------------------------------------------------*
+ * Function interpolate_rend_md()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
static void interpolate_rend_md(
BIN_HR_SPLIT_REND_MD rot_md[][MAX_SPLIT_MD_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS],
float mix_mat_re[][BINAURAL_CHANNELS],
float mix_mat_im[][BINAURAL_CHANNELS],
float *gd_int,
- int16_t sf_idx,
- int16_t band_idx,
- int16_t interp_yaw_pose_idx[2],
- int16_t interp_pitch_pose_idx[2],
- int16_t interp_roll_pose_idx[2],
- float interp_yaw_fact,
- float interp_pitch_fact,
- float interp_roll_fact )
+ const int16_t sf_idx,
+ const int16_t band_idx,
+ const int16_t interp_yaw_pose_idx[2],
+ const int16_t interp_pitch_pose_idx[2],
+ const int16_t interp_roll_pose_idx[2],
+ const float interp_yaw_fact,
+ const float interp_pitch_fact,
+ const float interp_roll_fact )
{
int16_t ch_idx1, idx1, idx2;
float mix_mat_re1[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
@@ -1464,8 +1564,8 @@ static void interpolate_rend_md(
interpolate_pred_matrix( rot_md, sf_idx, band_idx, interp_roll_pose_idx, interp_roll_fact, mix_mat_re3, mix_mat_im3 );
- ivas_mat_mult_2by2_complex( mix_mat_re, mix_mat_im, mix_mat_re3, mix_mat_im3,
- mix_mat_re1, mix_mat_im1 );
+ ivas_mat_mult_2by2_complex( mix_mat_re, mix_mat_im, mix_mat_re3, mix_mat_im3, mix_mat_re1, mix_mat_im1 );
+
for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
{
for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ )
@@ -1479,6 +1579,13 @@ static void interpolate_rend_md(
return;
}
+
+/*-----------------------------------------------------------------------------------------*
+ * Function ivas_SplitRenderer_PostRenderer()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
void ivas_SplitRenderer_PostRenderer(
BIN_HR_SPLIT_POST_REND_HANDLE hBinPostRenderer, /* i/o: binaural renderer handle */
MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
@@ -1505,12 +1612,12 @@ void ivas_SplitRenderer_PostRenderer(
float fade;
float *pMix_mat_re_prev[BINAURAL_CHANNELS];
float *pMix_mat_im_prev[BINAURAL_CHANNELS];
- const int16_t *pBand_grouping = SplitRend_band_grouping;
+ const int16_t *pBand_grouping = ivas_split_rend_band_grouping;
+
num_md_bands = MAX_SPLIT_REND_MD_BANDS;
push_wmops( "ivas_SplitRenderer_PostRenderer" );
-
num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES;
num_slots = MAX_PARAM_SPATIAL_SUBFRAMES;
for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ )
@@ -1522,15 +1629,8 @@ void ivas_SplitRenderer_PostRenderer(
#endif
sf_idx_md = ( hBinPostRenderer->low_Res == 0 ) ? sf_idx : 0;
- get_interpolation_vars( pMultiBinPoseData,
- &hBinPostRenderer->QuaternionsPre[sf_idx_md],
- &Quaternions_act[sf_idx],
- interp_yaw_pose_idx,
- interp_pitch_pose_idx,
- interp_roll_pose_idx,
- &interp_yaw_fact,
- &interp_pitch_fact,
- &interp_roll_fact );
+ get_interpolation_vars( pMultiBinPoseData, &hBinPostRenderer->QuaternionsPre[sf_idx_md], &Quaternions_act[sf_idx], interp_yaw_pose_idx, interp_pitch_pose_idx, interp_roll_pose_idx, &interp_yaw_fact, &interp_pitch_fact, &interp_roll_fact );
+
for ( b = 0; b < num_md_bands; b++ )
{
for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
@@ -1636,7 +1736,7 @@ void ivas_SplitRenderer_PostRenderer(
{
for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
{
- // Apply prediction matrix
+ /* Apply prediction matrix */
IVAS_CMULT_FLOAT( Cldfb_RealBuffer_Ref_Binaural[0][index_slot][b2],
Cldfb_ImagBuffer_Ref_Binaural[0][index_slot][b2],
mix_mat_re[0][ch_idx1],
@@ -1733,6 +1833,13 @@ void ivas_SplitRenderer_PostRenderer(
return;
}
+
+/*-----------------------------------------------------------------------------------------*
+ * Function ivas_rend_CldfbSplitPostRendProcessTdIn()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
static void ivas_rend_CldfbSplitPostRendProcessTdIn(
BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend,
MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
@@ -1757,12 +1864,7 @@ static void ivas_rend_CldfbSplitPostRendProcessTdIn(
}
}
- ivas_SplitRenderer_PostRenderer(
- hBinHrSplitPostRend,
- pMultiBinPoseData,
- Cldfb_RealBuffer_Binaural,
- Cldfb_ImagBuffer_Binaural,
- QuaternionsPost );
+ ivas_SplitRenderer_PostRenderer( hBinHrSplitPostRend, pMultiBinPoseData, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, QuaternionsPost );
/* Implement CLDFB synthesis */
for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ )
@@ -1778,9 +1880,17 @@ static void ivas_rend_CldfbSplitPostRendProcessTdIn(
cldfbSynthesis( RealBuffer, ImagBuffer, &( output[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX, hBinHrSplitPostRend->cldfbSyn[ch_idx] );
}
+
return;
}
+
+/*-----------------------------------------------------------------------------------------*
+ * Function ivas_rend_CldfbSplitPostRendProcess()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
void ivas_rend_CldfbSplitPostRendProcess(
BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend,
MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
@@ -1803,12 +1913,7 @@ void ivas_rend_CldfbSplitPostRendProcess(
return;
}
- ivas_SplitRenderer_PostRenderer(
- hBinHrSplitPostRend,
- pMultiBinPoseData,
- Cldfb_RealBuffer_Binaural,
- Cldfb_ImagBuffer_Binaural,
- QuaternionsPost );
+ ivas_SplitRenderer_PostRenderer( hBinHrSplitPostRend, pMultiBinPoseData, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, QuaternionsPost );
/* Implement CLDFB synthesis */
for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ )
@@ -1830,13 +1935,22 @@ void ivas_rend_CldfbSplitPostRendProcess(
return;
}
-void ivas_init_split_post_rend_handles( SPLIT_POST_REND_WRAPPER *hSplitRendWrapper )
+
+/*-----------------------------------------------------------------------------------------*
+ * Function ivas_init_split_post_rend_handles()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
+void ivas_init_split_post_rend_handles(
+ SPLIT_POST_REND_WRAPPER *hSplitRendWrapper )
{
hSplitRendWrapper->hBinHrSplitPostRend = NULL;
hSplitRendWrapper->hSplitBinLCLDDec = NULL;
hSplitRendWrapper->hLc3plusDec = NULL;
ivas_init_multi_bin_pose_data( &hSplitRendWrapper->multiBinPoseData );
hSplitRendWrapper->first_good_frame_received = 0;
+
return;
}
#endif
diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c
index ef5b29f0b9414f60da8f916b165376e9396b47c4..40dbba3d0078c88dc37c5555b670a595d442ce42 100644
--- a/lib_rend/ivas_splitRendererPre.c
+++ b/lib_rend/ivas_splitRendererPre.c
@@ -1,6 +1,6 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -30,64 +30,70 @@
*******************************************************************************************************/
+#include
#include "options.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
-#include
#include
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
#include
#endif
#include "ivas_prot.h"
#include "prot.h"
-#include "cnst.h"
#include "ivas_cnst.h"
-#include "ivas_rom_rend.h"
-#include "ivas_rom_com.h"
#include "ivas_rom_dec.h"
-#include "ivas_rom_binauralRenderer.h"
-#include "lib_rend.h"
#include "ivas_prot_rend.h"
-#include "ivas_lc3plus_enc.h"
#ifdef DEBUGGING
#include "debug.h"
#endif
#include "wmc_auto.h"
-
#ifdef DBG_WAV_WRITER
#include "string.h"
#endif
-#define MAX_BAND_SMOOTH ( 1 )
-#define SMOOTH_DIRAC_MONO_NORM_FACTOR ( 5.0f )
+/*-------------------------------------------------------------------------
+ * Local functions
+ *
+ *
+ *------------------------------------------------------------------------*/
-static void ivas_calc_mat_det_2by2_complex( float in_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS],
- float in_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS],
- float *det_re,
- float *det_im )
+static void ivas_calc_mat_det_2by2_complex(
+ float in_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS],
+ float in_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS],
+ float *det_re,
+ float *det_im )
{
float re1, im1, re2, im2;
+
IVAS_CMULT_FLOAT( in_re[0][0], in_im[0][0], in_re[1][1], in_im[1][1], re1, im1 );
IVAS_CMULT_FLOAT( in_re[0][1], in_im[0][1], in_re[1][0], in_im[1][0], re2, im2 );
*det_re = re1 - re2;
*det_im = im1 - im2;
+
return;
}
-static int16_t ivas_is_mat_inv_2by2_complex( float in_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS],
- float in_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS] )
+
+static int16_t ivas_is_mat_inv_2by2_complex(
+ float in_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS],
+ float in_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS] )
{
int16_t is_det_zero = 1;
float det, det_re, det_im;
+
ivas_calc_mat_det_2by2_complex( in_re, in_im, &det_re, &det_im );
+
det = ( ( det_re * det_re ) + ( det_im * det_im ) );
+
if ( det < EPSILON )
{
is_det_zero = 0;
}
+
return is_det_zero;
}
+
static void ivas_calc_mat_inv_2by2_complex(
float in_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS],
float in_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS],
@@ -96,10 +102,15 @@ static void ivas_calc_mat_inv_2by2_complex(
{
float det_re, det_im;
float re, im, det;
+
ivas_calc_mat_det_2by2_complex( in_re, in_im, &det_re, &det_im );
+
det = ( det_re * det_re ) + ( det_im * det_im );
- // assert to catch cases when input is singular matrix
+
+#ifdef DEBUGGING
+ /* assert to catch cases when input is singular matrix */
assert( det > 0 );
+#endif
det = 1 / det;
IVAS_CMULT_FLOAT( det_re, -det_im, in_re[1][1], in_im[1][1], re, im );
@@ -109,15 +120,19 @@ static void ivas_calc_mat_inv_2by2_complex(
IVAS_CMULT_FLOAT( det_re, -det_im, in_re[0][1], in_im[0][1], re, im );
out_re[0][1] = -re * det;
out_im[0][1] = -im * det;
+
IVAS_CMULT_FLOAT( det_re, -det_im, in_re[1][0], in_im[1][0], re, im );
out_re[1][0] = -re * det;
out_im[1][0] = -im * det;
+
IVAS_CMULT_FLOAT( det_re, -det_im, in_re[0][0], in_im[0][0], re, im );
out_re[1][1] = re * det;
out_im[1][1] = im * det;
+
return;
}
+
static void ComputePredMat(
float cov_ii_re[][BINAURAL_CHANNELS],
float cov_ii_im[][BINAURAL_CHANNELS],
@@ -129,7 +144,6 @@ static void ComputePredMat(
int16_t real_only )
{
float cov_ii_local_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
- // float cov_ii_local_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
float cov_ii_inv_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
float cov_ii_inv_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
float trace_cov;
@@ -140,7 +154,9 @@ static void ComputePredMat(
{
trace_cov += cov_ii_re[i][i];
}
+
trace_cov = max( 0.0f, trace_cov );
+
if ( trace_cov < EPSILON )
{
for ( i = 0; i < num_chs; i++ )
@@ -155,29 +171,20 @@ static void ComputePredMat(
for ( i = 0; i < num_chs; i++ )
{
mvr2r( cov_ii_re[i], cov_ii_local_re[i], num_chs );
- // mvr2r( cov_ii_im[i], cov_ii_local_im[i], num_chs );
}
+
for ( i = 0; i < num_chs; i++ )
{
cov_ii_local_re[i][i] = cov_ii_re[i][i] + ( trace_cov * 0.0001f );
- // cov_ii_local_im[i][i] = cov_ii_im[i][i] + ( trace_cov * 0.0005f );
}
- // float det_re, det_im, det;
- // ivas_calc_mat_det_2by2_complex( cov_ii_local_re, cov_ii_im, &det_re, &det_im );
- // det = ( ( det_re * det_re ) + ( det_im * det_im ) );
- // det = sqrtf( det );
- // if ( ivas_is_mat_inv_2by2_complex( cov_ii_local_re, cov_ii_im ) )
- // if ( det > 0.0001f )
if ( ivas_is_mat_inv_2by2_complex( cov_ii_local_re, cov_ii_im ) )
{
ivas_calc_mat_inv_2by2_complex( cov_ii_local_re, cov_ii_im, cov_ii_inv_re, cov_ii_inv_im );
- ivas_mat_mult_2by2_complex( cov_ii_inv_re, cov_ii_inv_im, cov_io_re, cov_io_im,
- pred_mat_re, pred_mat_im );
+ ivas_mat_mult_2by2_complex( cov_ii_inv_re, cov_ii_inv_im, cov_io_re, cov_io_im, pred_mat_re, pred_mat_im );
}
else
{
- // float max_var;
int16_t max_var_idx;
for ( i = 0; i < num_chs; i++ )
{
@@ -186,11 +193,9 @@ static void ComputePredMat(
}
max_var_idx = 0;
- // max_var = cov_ii_local_re[0][0];
if ( cov_ii_local_re[1][1] > cov_ii_local_re[0][0] )
{
max_var_idx = 1;
- // max_var = cov_ii_local_re[1][1];
}
if ( cov_ii_local_re[max_var_idx][max_var_idx] > EPSILON )
@@ -214,6 +219,7 @@ static void ComputePredMat(
return;
}
+
static void ComputePostPredCov(
float cov_ii_re[][BINAURAL_CHANNELS],
float cov_ii_im[][BINAURAL_CHANNELS],
@@ -245,10 +251,8 @@ static void ComputePostPredCov(
}
/* 2x2 mult */
- ivas_mat_mult_2by2_complex( dmx_mat_conj_re, dmx_mat_conj_im, cov_ii_re, cov_ii_im,
- temp_mat_re, temp_mat_im );
- ivas_mat_mult_2by2_complex( temp_mat_re, temp_mat_im, pred_mat_re, pred_mat_im,
- postpred_cov_re, postpred_cov_im );
+ ivas_mat_mult_2by2_complex( dmx_mat_conj_re, dmx_mat_conj_im, cov_ii_re, cov_ii_im, temp_mat_re, temp_mat_im );
+ ivas_mat_mult_2by2_complex( temp_mat_re, temp_mat_im, pred_mat_re, pred_mat_im, postpred_cov_re, postpred_cov_im );
for ( i = 0; i < BINAURAL_CHANNELS; i++ )
{
@@ -263,6 +267,7 @@ static void ComputePostPredCov(
return;
}
+
static void ComputeBandedCrossCov(
float Cldfb_RealBuffer1[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
float Cldfb_ImagBuffer1[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
@@ -287,8 +292,10 @@ static void ComputeBandedCrossCov(
set_f( out_cov_re[ch_idx1], 0.0f, num_chs );
set_f( out_cov_im[ch_idx1], 0.0f, num_chs );
}
+
brange[0] = pBand_grouping[md_band_idx];
brange[1] = pBand_grouping[md_band_idx + 1];
+
for ( ch_idx1 = 0; ch_idx1 < num_chs; ch_idx1++ )
{
for ( ch_idx2 = 0; ch_idx2 < num_chs; ch_idx2++ )
@@ -326,10 +333,10 @@ static void ComputeBandedCrossCov(
}
}
-
return;
}
+
static void ComputeBandedCov(
float Cldfb_RealBuffer[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
float Cldfb_ImagBuffer[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
@@ -351,8 +358,10 @@ static void ComputeBandedCov(
set_f( out_cov_re[ch_idx1], 0.0f, num_chs );
set_f( out_cov_im[ch_idx1], 0.0f, num_chs );
}
+
brange[0] = pBand_grouping[md_band_idx];
brange[1] = pBand_grouping[md_band_idx + 1];
+
for ( ch_idx1 = 0; ch_idx1 < num_chs; ch_idx1++ )
{
for ( ch_idx2 = 0; ch_idx2 <= ch_idx1; ch_idx2++ )
@@ -399,10 +408,10 @@ static void ComputeBandedCov(
}
}
-
return;
}
+
static float GetNormFact(
float cov_ii_re[][BINAURAL_CHANNELS],
float cov_ii_im[][BINAURAL_CHANNELS],
@@ -436,6 +445,7 @@ static float GetNormFact(
return norm_fact;
}
+
static void ivas_split_rend_huffman_encode(
ivas_split_rend_huffman_cfg_t *huff_cfg,
int16_t in,
@@ -454,6 +464,7 @@ static void ivas_split_rend_huffman_encode(
return;
}
+
static void ivas_split_rend_quant_md(
BIN_HR_SPLIT_REND_MD_HANDLE hMd,
IVAS_SPLIT_REND_POSE_TYPE pose_type,
@@ -495,6 +506,7 @@ static void ivas_split_rend_quant_md(
}
}
}
+
for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
{
for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
@@ -506,9 +518,9 @@ static void ivas_split_rend_quant_md(
#else
hMd->pred_mat_re_idx[ch1][ch2] = (int16_t) roundf( IVAS_SPLIT_REND_PRED_1BYQ_STEP * quant_val );
#endif
- // hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re_idx[ch1][ch2] * IVAS_SPLIT_REND_PRED_Q_STEP;
}
}
+
if ( real_only == 0 )
{
for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
@@ -557,8 +569,8 @@ static void ComputeCoeffs(
float cov_io_im[][BINAURAL_CHANNELS],
float cov_oo_re[][BINAURAL_CHANNELS],
BIN_HR_SPLIT_REND_MD_HANDLE hMd,
- IVAS_SPLIT_REND_POSE_TYPE pose_type,
- int16_t real_only )
+ const IVAS_SPLIT_REND_POSE_TYPE pose_type,
+ const int16_t real_only )
{
float postpred_cov_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
float postpred_cov_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
@@ -568,7 +580,6 @@ static void ComputeCoeffs(
float cov_io_norm_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
float cov_oo_norm_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
float sigma_d, gd, gd2, gl2, gr2, cov_norm_fact;
- // float aa, bb, cc, dd, sign, rho, rho_hat;
int16_t i, j;
if ( pose_type == PITCH_ONLY )
@@ -593,14 +604,9 @@ static void ComputeCoeffs(
}
else
{
- cov_norm_fact = GetNormFact(
- cov_ii_re,
- cov_ii_im,
- cov_io_re,
- cov_io_im,
- cov_oo_re );
+ cov_norm_fact = GetNormFact( cov_ii_re, cov_ii_im, cov_io_re, cov_io_im, cov_oo_re );
- // normalize the covariance
+ /* normalize the covariance */
for ( i = 0; i < BINAURAL_CHANNELS; i++ )
{
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
@@ -613,26 +619,12 @@ static void ComputeCoeffs(
}
}
- ComputePredMat( cov_ii_norm_re,
- cov_ii_norm_im,
- cov_io_norm_re,
- cov_io_norm_im,
- hMd->pred_mat_re,
- hMd->pred_mat_im,
- BINAURAL_CHANNELS,
- real_only );
-
+ ComputePredMat( cov_ii_norm_re, cov_ii_norm_im, cov_io_norm_re, cov_io_norm_im, hMd->pred_mat_re, hMd->pred_mat_im, BINAURAL_CHANNELS, real_only );
/*TODO : change this function to real only as thats what is needed*/
- ComputePostPredCov( cov_ii_norm_re,
- cov_ii_norm_im,
- hMd->pred_mat_re,
- hMd->pred_mat_im,
- postpred_cov_re,
- postpred_cov_im,
- BINAURAL_CHANNELS );
-
- // normalize everything to +-1 range
+ ComputePostPredCov( cov_ii_norm_re, cov_ii_norm_im, hMd->pred_mat_re, hMd->pred_mat_im, postpred_cov_re, postpred_cov_im, BINAURAL_CHANNELS );
+
+ /* normalize everything to +-1 range */
gd = 1.0f / ( PCM16_TO_FLT_FAC );
for ( i = 0; i < BINAURAL_CHANNELS; i++ )
{
@@ -718,6 +710,7 @@ static void ComputeCoeffs(
{
gl2 = 1.0f;
}
+
if ( postpred_cov_re[1][1] > EPSILON )
{
gr2 = ( cov_oo_norm_re[1][1] - ( gd2 * sigma_d ) ) / max( EPSILON, postpred_cov_re[1][1] );
@@ -734,6 +727,7 @@ static void ComputeCoeffs(
hMd->pred_mat_re[i][0] *= gl2;
hMd->pred_mat_re[i][1] *= gr2;
}
+
if ( real_only == 0 )
{
for ( i = 0; i < BINAURAL_CHANNELS; i++ )
@@ -743,9 +737,11 @@ static void ComputeCoeffs(
}
}
}
+
return;
}
+
static void get_base2_bits(
const BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend,
MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
@@ -825,6 +821,7 @@ static void get_base2_bits(
return;
}
+
static void ivas_SplitRenderer_code_md_base2(
const BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend,
MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
@@ -849,6 +846,7 @@ static void ivas_SplitRenderer_code_md_base2(
int32_t code;
BIN_HR_SPLIT_REND_MD_HANDLE hMd;
BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg;
+
pHuff_cfg = &hBinHrSplitPreRend->huff_cfg;
#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
if ( pred_quant_pnts_yaw == IVAS_SPLIT_REND_PRED_63QUANT_PNTS )
@@ -962,14 +960,14 @@ static void ivas_SplitRenderer_code_md_base2(
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
{
- static int num_bits = 0;
- static int cntr = 0;
+ static int16_t num_bits = 0;
+ static int16_t cntr = 0;
float fnum_bits;
cntr++;
num_bits += pBits->bits_written;
- // collect bits for every second
+ /* collect bits for every second */
if ( cntr == 50 )
{
cntr = 0;
@@ -982,6 +980,7 @@ static void ivas_SplitRenderer_code_md_base2(
return;
}
+
static void ivas_SplitRenderer_code_md_huff(
const BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend,
MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
@@ -1006,6 +1005,7 @@ static void ivas_SplitRenderer_code_md_huff(
int32_t code, len;
BIN_HR_SPLIT_REND_MD_HANDLE hMd;
BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg;
+
pHuff_cfg = &hBinHrSplitPreRend->huff_cfg;
#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
@@ -1017,6 +1017,7 @@ static void ivas_SplitRenderer_code_md_huff(
{
pred_cb_idx = 0;
}
+
min_pred_idx = (int16_t) pHuff_cfg->pred[pred_cb_idx].codebook[0];
max_pred_idx = (int16_t) pHuff_cfg->pred[pred_cb_idx].codebook[( pred_quant_pnts_yaw - 1 ) * 3];
min_pred_roll_idx = (int16_t) pHuff_cfg->pred_roll.codebook[0];
@@ -1150,13 +1151,13 @@ static void ivas_SplitRenderer_code_md_huff(
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
{
- static int num_bits = 0;
- static int cntr = 0;
+ static int16_t num_bits = 0;
+ static int16_t cntr = 0;
float fnum_bits;
cntr++;
num_bits += pBits->bits_written;
- // collect bits for every second
+ /* collect bits for every second */
if ( cntr == 50 )
{
cntr = 0;
@@ -1169,6 +1170,7 @@ static void ivas_SplitRenderer_code_md_huff(
return;
}
+
static void ivas_SplitRenderer_quant_code(
const BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend,
const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES],
@@ -1201,7 +1203,6 @@ static void ivas_SplitRenderer_quant_code(
overhead_bits = pBits->bits_written;
- // ivas_split_rend_bitstream_write_int32( pBits, low_res_pre_rend_rot, 1 );
ivas_split_rend_bitstream_write_int32( pBits, pMultiBinPoseData->dof, IVAS_SPLIT_REND_DOF_BITS );
ivas_split_rend_bitstream_write_int32( pBits, pMultiBinPoseData->hq_mode, IVAS_SPLIT_REND_HQ_MODE_BITS );
ivas_split_rend_bitstream_write_int32( pBits, (int32_t) pMultiBinPoseData->rot_axis, IVAS_SPLIT_REND_ROT_AXIS_BITS );
@@ -1211,6 +1212,7 @@ static void ivas_SplitRenderer_quant_code(
{
int16_t angle;
IVAS_QUATERNION head_pos_euler;
+
Quat2EulerDegree( headPositions[sf_idx], &head_pos_euler.z, &head_pos_euler.y, &head_pos_euler.x );
angle = (int16_t) roundf( head_pos_euler.x );
angle += 180;
@@ -1222,42 +1224,26 @@ static void ivas_SplitRenderer_quant_code(
angle = (int16_t) roundf( head_pos_euler.z );
angle += 180;
+
ivas_split_rend_bitstream_write_int32( pBits, angle, IVAS_SPLIT_REND_HEAD_POSE_BITS );
}
- ivas_split_rend_get_quant_params(
- MAX_SPLIT_REND_MD_BANDS,
- pred_real_bands_yaw,
- pred_imag_bands_yaw,
+ ivas_split_rend_get_quant_params( MAX_SPLIT_REND_MD_BANDS, pred_real_bands_yaw, pred_imag_bands_yaw,
#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
- pred_quant_pnts_yaw,
- pred_quantstep_yaw,
- pred_1byquantstep_yaw,
-#endif
- d_bands_yaw,
- bands_pitch,
- pred_real_bands_roll,
- pred_imag_bands_roll,
- &num_quant_strats,
- &num_complex_bands );
+ pred_quant_pnts_yaw, pred_quantstep_yaw, pred_1byquantstep_yaw,
+#endif
+ d_bands_yaw, bands_pitch, pred_real_bands_roll, pred_imag_bands_roll, &num_quant_strats, &num_complex_bands );
+
quant_strat_bits = (int32_t) ceilf( log2f( num_quant_strats ) );
- overhead_bits = pBits->bits_written - overhead_bits + quant_strat_bits + 1; // 1 for base2 vs huff
+ overhead_bits = pBits->bits_written - overhead_bits + quant_strat_bits + 1; /* 1 for base2 vs huff */
+
get_base2_bits(
- hBinHrSplitPreRend,
- pMultiBinPoseData,
- num_subframes,
- num_quant_strats,
- pred_real_bands_yaw,
- pred_imag_bands_yaw,
+ hBinHrSplitPreRend, pMultiBinPoseData, num_subframes, num_quant_strats, pred_real_bands_yaw, pred_imag_bands_yaw,
#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
pred_quant_pnts_yaw,
#endif
- d_bands_yaw,
- bands_pitch,
- pred_real_bands_roll,
- pred_imag_bands_roll,
- base2bits );
+ d_bands_yaw, bands_pitch, pred_real_bands_roll, pred_imag_bands_roll, base2bits );
for ( q = 0; q < num_quant_strats; q++ )
{
@@ -1270,9 +1256,8 @@ static void ivas_SplitRenderer_quant_code(
for ( b = 0; b < pred_imag_bands_yaw[q]; b++ )
{
hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b];
- ivas_split_rend_quant_md( hMd,
- PRED_ONLY,
- 0, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx]
+
+ ivas_split_rend_quant_md( hMd, PRED_ONLY, 0, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx]
#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
,
pred_1byquantstep_yaw[q]
@@ -1282,21 +1267,20 @@ static void ivas_SplitRenderer_quant_code(
for ( ; b < pred_real_bands_yaw[q]; b++ )
{
hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b];
- ivas_split_rend_quant_md( hMd,
- PRED_ONLY,
- 1, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx]
+
+ ivas_split_rend_quant_md( hMd, PRED_ONLY, 1, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx]
#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
,
pred_1byquantstep_yaw[q]
#endif
);
}
+
for ( b = 0; b < d_bands_yaw[q]; b++ )
{
hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b];
- ivas_split_rend_quant_md( hMd,
- COM_GAIN_ONLY,
- 1, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx]
+
+ ivas_split_rend_quant_md( hMd, COM_GAIN_ONLY, 1, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx]
#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
,
0
@@ -1309,9 +1293,7 @@ static void ivas_SplitRenderer_quant_code(
for ( b = 0; b < bands_pitch[q]; b++ )
{
hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b];
- ivas_split_rend_quant_md( hMd,
- LR_GAIN_ONLY,
- 1, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx]
+ ivas_split_rend_quant_md( hMd, LR_GAIN_ONLY, 1, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx]
#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
,
0
@@ -1358,52 +1340,47 @@ static void ivas_SplitRenderer_quant_code(
}
/*get base2 bits and check if its within target. if yes then code with base2 to save complexity on post renderer*/
- {
- start_bit = pBits->bits_written;
- ivas_split_rend_bitstream_write_int32( pBits, 1, 1 );
- ivas_split_rend_bitstream_write_int32( pBits, q, quant_strat_bits );
- huff_bits = pBits->bits_written;
- ivas_SplitRenderer_code_md_huff(
- hBinHrSplitPreRend,
- pMultiBinPoseData,
- num_subframes,
- pred_real_bands_yaw[q],
- pred_imag_bands_yaw[q],
+ start_bit = pBits->bits_written;
+
+ ivas_split_rend_bitstream_write_int32( pBits, 1, 1 );
+ ivas_split_rend_bitstream_write_int32( pBits, q, quant_strat_bits );
+
+ huff_bits = pBits->bits_written;
+ ivas_SplitRenderer_code_md_huff(
+ hBinHrSplitPreRend,
+ pMultiBinPoseData,
+ num_subframes,
+ pred_real_bands_yaw[q],
+ pred_imag_bands_yaw[q],
#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
- pred_quant_pnts_yaw[q],
-#endif
- d_bands_yaw[q],
- bands_pitch[q],
- pred_real_bands_roll[q],
- pred_imag_bands_roll[q],
- pBits );
- huff_bits = pBits->bits_written - huff_bits;
- if ( ( target_md_bits >= ( base2bits[q] + overhead_bits ) ) || ( target_md_bits >= ( huff_bits + overhead_bits ) ) || ( q == ( num_quant_strats - 1 ) ) )
+ pred_quant_pnts_yaw[q],
+#endif
+ d_bands_yaw[q],
+ bands_pitch[q],
+ pred_real_bands_roll[q],
+ pred_imag_bands_roll[q],
+ pBits );
+ huff_bits = pBits->bits_written - huff_bits;
+
+ if ( ( target_md_bits >= ( base2bits[q] + overhead_bits ) ) || ( target_md_bits >= ( huff_bits + overhead_bits ) ) || ( q == ( num_quant_strats - 1 ) ) )
+ {
+ if ( huff_bits > base2bits[q] )
{
- if ( huff_bits > base2bits[q] )
- {
- pBits->bits_written = start_bit;
- ivas_split_rend_bitstream_write_int32( pBits, 0, 1 );
- ivas_split_rend_bitstream_write_int32( pBits, q, quant_strat_bits );
- ivas_SplitRenderer_code_md_base2(
- hBinHrSplitPreRend,
- pMultiBinPoseData,
- num_subframes,
- pred_real_bands_yaw[q],
- pred_imag_bands_yaw[q],
+ pBits->bits_written = start_bit;
+
+ ivas_split_rend_bitstream_write_int32( pBits, 0, 1 );
+ ivas_split_rend_bitstream_write_int32( pBits, q, quant_strat_bits );
+
+ ivas_SplitRenderer_code_md_base2( hBinHrSplitPreRend, pMultiBinPoseData, num_subframes, pred_real_bands_yaw[q], pred_imag_bands_yaw[q],
#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
- pred_quant_pnts_yaw[q],
+ pred_quant_pnts_yaw[q],
#endif
- d_bands_yaw[q],
- bands_pitch[q],
- pred_real_bands_roll[q],
- pred_imag_bands_roll[q],
- pBits );
- }
- break;
+ d_bands_yaw[q], bands_pitch[q], pred_real_bands_roll[q], pred_imag_bands_roll[q], pBits );
}
- pBits->bits_written = start_bit;
+ break;
}
+
+ pBits->bits_written = start_bit;
}
#ifdef SPLIT_MD_CODING_DEBUG
@@ -1487,12 +1464,18 @@ static void ivas_SplitRenderer_quant_code(
}
+/*-------------------------------------------------------------------------
+ * Function ivas_SplitRenderer_GetRotMd()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
void ivas_SplitRenderer_GetRotMd(
BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, /* i/o: binaural renderer handle */
MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
float Cldfb_RealBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */
float Cldfb_ImagBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */
- int16_t low_res )
+ const int16_t low_res )
{
float cov_ii_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
float cov_oo_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
@@ -1504,11 +1487,11 @@ void ivas_SplitRenderer_GetRotMd(
int16_t pos_idx, b, sf_idx, start_slot_idx, num_slots, num_subframes, ch_s_idx1, ch_s_idx2;
int16_t num_md_bands, num_poses;
- const int16_t *pBand_grouping = SplitRend_band_grouping;
- num_md_bands = MAX_SPLIT_REND_MD_BANDS;
+ const int16_t *pBand_grouping = ivas_split_rend_band_grouping;
push_wmops( "ivas_SplitRenderer_GetRotMd" );
+ num_md_bands = MAX_SPLIT_REND_MD_BANDS;
num_poses = pMultiBinPoseData->num_poses;
if ( low_res )
@@ -1521,7 +1504,8 @@ void ivas_SplitRenderer_GetRotMd(
num_slots = MAX_PARAM_SPATIAL_SUBFRAMES;
num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES;
}
- /*compute reference signal covariance*/
+
+ /* compute reference signal covariance */
for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ )
{
start_slot_idx = sf_idx * num_slots;
@@ -1535,46 +1519,19 @@ void ivas_SplitRenderer_GetRotMd(
{
real_only = 1;
}
+
ch_s_idx1 = 0;
- ComputeBandedCov( Cldfb_RealBuffer_Ref_Binaural,
- Cldfb_ImagBuffer_Ref_Binaural,
- ch_s_idx1,
- cov_ii_re, cov_ii_im,
- BINAURAL_CHANNELS,
- pBand_grouping,
- num_slots, start_slot_idx, b, real_only );
-
- /*compute rotated signal covariance*/
+ ComputeBandedCov( Cldfb_RealBuffer_Ref_Binaural, Cldfb_ImagBuffer_Ref_Binaural, ch_s_idx1, cov_ii_re, cov_ii_im, BINAURAL_CHANNELS, pBand_grouping, num_slots, start_slot_idx, b, real_only );
+
+ /* compute rotated signal covariance */
for ( pos_idx = 0; pos_idx < num_poses - 1; pos_idx++ )
{
ch_s_idx2 = ( pos_idx + 1 ) * BINAURAL_CHANNELS;
- ComputeBandedCrossCov( Cldfb_RealBuffer_Ref_Binaural,
- Cldfb_ImagBuffer_Ref_Binaural,
- ch_s_idx1,
- Cldfb_RealBuffer_Ref_Binaural,
- Cldfb_ImagBuffer_Ref_Binaural,
- ch_s_idx2,
- cov_io_re, cov_io_im,
- BINAURAL_CHANNELS,
- pBand_grouping,
- num_slots, start_slot_idx, b, real_only );
-
- ComputeBandedCov( Cldfb_RealBuffer_Ref_Binaural,
- Cldfb_ImagBuffer_Ref_Binaural,
- ch_s_idx2,
- cov_oo_re, cov_oo_im,
- BINAURAL_CHANNELS,
- pBand_grouping,
- num_slots, start_slot_idx, b, real_only );
-
- ComputeCoeffs( cov_ii_re,
- cov_ii_im,
- cov_io_re,
- cov_io_im,
- cov_oo_re,
- &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b],
- hBinHrSplitPreRend->pose_type[pos_idx],
- real_only );
+ ComputeBandedCrossCov( Cldfb_RealBuffer_Ref_Binaural, Cldfb_ImagBuffer_Ref_Binaural, ch_s_idx1, Cldfb_RealBuffer_Ref_Binaural, Cldfb_ImagBuffer_Ref_Binaural, ch_s_idx2, cov_io_re, cov_io_im, BINAURAL_CHANNELS, pBand_grouping, num_slots, start_slot_idx, b, real_only );
+
+ ComputeBandedCov( Cldfb_RealBuffer_Ref_Binaural, Cldfb_ImagBuffer_Ref_Binaural, ch_s_idx2, cov_oo_re, cov_oo_im, BINAURAL_CHANNELS, pBand_grouping, num_slots, start_slot_idx, b, real_only );
+
+ ComputeCoeffs( cov_ii_re, cov_ii_im, cov_io_re, cov_io_im, cov_oo_re, &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b], hBinHrSplitPreRend->pose_type[pos_idx], real_only );
}
}
}
@@ -1584,6 +1541,13 @@ void ivas_SplitRenderer_GetRotMd(
return;
}
+
+/*-------------------------------------------------------------------------
+ * Function ivas_rend_CldfbSplitPreRendProcess()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
void ivas_rend_CldfbSplitPreRendProcess(
const BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend,
const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES],
@@ -1596,20 +1560,9 @@ void ivas_rend_CldfbSplitPreRendProcess(
{
push_wmops( "ivas_rend_CldfbSplitPreRendProcess" );
- ivas_SplitRenderer_GetRotMd(
- hBinHrSplitPreRend,
- pMultiBinPoseData,
- Cldfb_In_BinReal,
- Cldfb_In_BinImag,
- low_res_pre_rend_rot );
-
- ivas_SplitRenderer_quant_code(
- hBinHrSplitPreRend,
- headPositions,
- pMultiBinPoseData,
- pBits,
- low_res_pre_rend_rot,
- target_md_bits );
+ ivas_SplitRenderer_GetRotMd( hBinHrSplitPreRend, pMultiBinPoseData, Cldfb_In_BinReal, Cldfb_In_BinImag, low_res_pre_rend_rot );
+
+ ivas_SplitRenderer_quant_code( hBinHrSplitPreRend, headPositions, pMultiBinPoseData, pBits, low_res_pre_rend_rot, target_md_bits );
#ifdef SPLIT_POSE_CORRECTION_DEBUG
float tmpCrendBuffer[2][L_FRAME48k], quant_val, step, minv, maxv;
@@ -1648,8 +1601,7 @@ void ivas_rend_CldfbSplitPreRendProcess(
{
for ( b = 0; b < MAX_SPLIT_REND_MD_BANDS; b++ )
{
- hBinHrSplitPreRend->hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b] =
- hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b];
+ hBinHrSplitPreRend->hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b] = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b];
#if 0
BIN_HR_SPLIT_REND_MD_HANDLE hMd;
hMd = &hBinHrSplitPreRend->hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
@@ -1693,22 +1645,14 @@ void ivas_rend_CldfbSplitPreRendProcess(
}
#endif
- ivas_rend_CldfbSplitPostRendProcess(
- hBinHrSplitPreRend->hBinHrSplitPostRend,
- pMultiBinPoseData,
- QuaternionsPost,
- Cldfb_In_BinReal[0],
- Cldfb_In_BinImag[0],
- tmpCrendBuffer,
- 1 );
+ ivas_rend_CldfbSplitPostRendProcess( hBinHrSplitPreRend->hBinHrSplitPostRend, pMultiBinPoseData, QuaternionsPost, Cldfb_In_BinReal[0], Cldfb_In_BinImag[0], tmpCrendBuffer, 1 );
{
float *pOut[2];
char fname[200] = "ref_act_pos.wav";
pOut[0] = tmpCrendBuffer[0];
pOut[1] = tmpCrendBuffer[1];
- dbgwrite_wav( pOut, CLDFB_NO_COL_MAX * hBinHrSplitPreRend->hBinHrSplitPostRend->cldfbSyn[0]->no_channels,
- fname, 48000, 2 );
+ dbgwrite_wav( pOut, CLDFB_NO_COL_MAX * hBinHrSplitPreRend->hBinHrSplitPostRend->cldfbSyn[0]->no_channels, fname, 48000, 2 );
}
#endif
@@ -1717,6 +1661,13 @@ void ivas_rend_CldfbSplitPreRendProcess(
return;
}
+
+/*-------------------------------------------------------------------------
+ * Function ivas_splitBinPreRendOpen()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
ivas_error ivas_splitBinPreRendOpen(
BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend,
MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData
@@ -1770,22 +1721,31 @@ ivas_error ivas_splitBinPreRendOpen(
}
}
}
+
set_fix_rotation_mat( hBinRend->fix_pos_rot_mat, pMultiBinPoseData );
+
set_pose_types( hBinRend->pose_type, pMultiBinPoseData );
+
ivas_split_rend_init_huff_cfg( &hBinRend->huff_cfg );
#ifdef SPLIT_POSE_CORRECTION_DEBUG
- ivas_splitBinPostRendOpen(
- &hBinRend->hBinHrSplitPostRend,
- pMultiBinPoseData,
- 48000 );
+ ivas_splitBinPostRendOpen( &hBinRend->hBinHrSplitPostRend, pMultiBinPoseData, 48000 );
#endif
*hBinHrSplitPreRend = hBinRend;
+
return error;
}
-void ivas_splitBinPreRendClose( BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend )
+
+/*-------------------------------------------------------------------------
+ * Function ivas_splitBinPreRendClose()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+void ivas_splitBinPreRendClose(
+ BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend )
{
if ( ( *hBinHrSplitPreRend ) != NULL )
{
@@ -1812,21 +1772,77 @@ void ivas_splitBinPreRendClose( BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend
free( ( *hBinHrSplitPreRend ) );
( *hBinHrSplitPreRend ) = NULL;
}
+
return;
}
-void ivas_init_split_rend_handles( SPLIT_REND_WRAPPER *hSplitRendWrapper )
+
+/*-------------------------------------------------------------------------*
+ * ivas_set_split_rend_setup()
+ *
+ * Setup IVAS split rendering
+ *-------------------------------------------------------------------------*/
+
+ivas_error ivas_set_split_rend_setup(
+ IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend,
+ IVAS_SPLIT_REND_CONFIG_DATA *hSplitBinConfig,
+ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData,
+ uint8_t *splitRendBitsBuf )
+{
+ int16_t sf, i, j;
+
+ hSplitBinRend->hSplitRendBits->bits_buf = splitRendBitsBuf;
+ hSplitBinRend->hSplitRendBits->bits_written = 0;
+ hSplitBinRend->hSplitRendBits->bits_read = 0;
+
+ if ( ( hSplitBinRend->hMultiBinCldfbData = (IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL )
+ {
+ return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for split rendering structure" );
+ }
+
+ ivas_renderSplitGetMultiBinPoseData( hSplitBinConfig, &hSplitBinRend->splitrend.multiBinPoseData, hCombinedOrientationData->sr_pose_pred_axis );
+
+ if ( hCombinedOrientationData != NULL && hSplitBinRend->splitrend.multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
+ {
+ for ( sf = 1; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ )
+ {
+ hCombinedOrientationData->Quaternions[sf] = hCombinedOrientationData->Quaternions[0];
+
+ for ( i = 0; i < 3; i++ )
+ {
+ for ( j = 0; j < 3; j++ )
+ {
+ hCombinedOrientationData->Rmat[sf][i][j] = hCombinedOrientationData->Rmat[0][i][j];
+ }
+ }
+ }
+ }
+
+ return IVAS_ERR_OK;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function ivas_init_split_rend_handles()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+void ivas_init_split_rend_handles(
+ SPLIT_REND_WRAPPER *hSplitRendWrapper )
{
- int32_t i;
+ int16_t i;
hSplitRendWrapper->hBinHrSplitPreRend = NULL;
hSplitRendWrapper->hCldfbHandles = NULL;
hSplitRendWrapper->hSplitBinLCLDEnc = NULL;
hSplitRendWrapper->hLc3plusEnc = NULL;
+
for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i )
{
hSplitRendWrapper->hTdRendHandles[i] = NULL;
}
+
for ( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; ++i )
{
hSplitRendWrapper->lc3plusDelayBuffers[i] = NULL;
@@ -1834,15 +1850,24 @@ void ivas_init_split_rend_handles( SPLIT_REND_WRAPPER *hSplitRendWrapper )
hSplitRendWrapper->lc3plusDelaySamples = 0;
ivas_init_multi_bin_pose_data( &hSplitRendWrapper->multiBinPoseData );
+
return;
}
-static ivas_error split_renderer_open_lc3plus( SPLIT_REND_WRAPPER *hSplitRendWrapper,
- const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig,
- const int32_t OutSampleRate )
+
+/*-------------------------------------------------------------------------
+ * Function split_renderer_open_lc3plus()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+static ivas_error split_renderer_open_lc3plus(
+ SPLIT_REND_WRAPPER *hSplitRendWrapper,
+ const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig,
+ const int32_t OutSampleRate )
{
ivas_error error;
- int32_t i, delayBufferLength;
+ int16_t i, delayBufferLength;
LC3PLUS_CONFIG config;
config.lc3plus_frame_duration_us = 5000;
@@ -1867,11 +1892,15 @@ static ivas_error split_renderer_open_lc3plus( SPLIT_REND_WRAPPER *hSplitRendWra
/* Alocate buffers for delay compensation */
if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS )
{
- delayBufferLength = OutSampleRate / (int32_t) FRAMES_PER_SECOND + hSplitRendWrapper->lc3plusDelaySamples;
+ delayBufferLength = (int16_t) ( OutSampleRate / (int32_t) FRAMES_PER_SECOND + hSplitRendWrapper->lc3plusDelaySamples );
for ( i = 0; i < hSplitRendWrapper->multiBinPoseData.num_poses * BINAURAL_CHANNELS; ++i )
{
- hSplitRendWrapper->lc3plusDelayBuffers[i] = malloc( delayBufferLength * sizeof( float ) );
- set_zero( hSplitRendWrapper->lc3plusDelayBuffers[i], (int16_t) delayBufferLength );
+ if ( ( hSplitRendWrapper->lc3plusDelayBuffers[i] = malloc( delayBufferLength * sizeof( float ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for multiBinPoseData handle\n" ) );
+ }
+
+ set_zero( hSplitRendWrapper->lc3plusDelayBuffers[i], delayBufferLength );
}
}
else
@@ -1883,19 +1912,31 @@ static ivas_error split_renderer_open_lc3plus( SPLIT_REND_WRAPPER *hSplitRendWra
delayBufferLength = 2 /* Columns */ * 2 /* real and imag */ * CLDFB_NO_CHANNELS_MAX;
for ( i = 0; i < hSplitRendWrapper->multiBinPoseData.num_poses * BINAURAL_CHANNELS; ++i )
{
- hSplitRendWrapper->lc3plusDelayBuffers[i] = malloc( delayBufferLength * sizeof( float ) );
- set_zero( hSplitRendWrapper->lc3plusDelayBuffers[i], (int16_t) delayBufferLength );
+ if ( ( hSplitRendWrapper->lc3plusDelayBuffers[i] = malloc( delayBufferLength * sizeof( float ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for multiBinPoseData handle\n" ) );
+ }
+
+ set_zero( hSplitRendWrapper->lc3plusDelayBuffers[i], delayBufferLength );
}
}
return IVAS_ERR_OK;
}
-ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper,
- const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig,
- const int32_t OutSampleRate,
- const int16_t is_cldfb_in,
- const int16_t is_pcm_out )
+
+/*-------------------------------------------------------------------------
+ * Function ivas_split_renderer_open()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+ivas_error ivas_split_renderer_open(
+ SPLIT_REND_WRAPPER *hSplitRendWrapper,
+ const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig,
+ const int32_t OutSampleRate,
+ const int16_t is_cldfb_in,
+ const int16_t is_pcm_out )
{
ivas_error error, ch, num_ch;
#ifndef OSBA_SPLIT_RENDERING
@@ -1952,6 +1993,7 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper,
{
hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] = NULL;
}
+
#ifdef OSBA_SPLIT_RENDERING
for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
{
@@ -1991,14 +2033,12 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper,
if ( pSplitRendConfig->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
{
- error = ivas_splitBinPreRendOpen( &hSplitRendWrapper->hBinHrSplitPreRend,
- &hSplitRendWrapper->multiBinPoseData
+ if ( ( error = ivas_splitBinPreRendOpen( &hSplitRendWrapper->hBinHrSplitPreRend, &hSplitRendWrapper->multiBinPoseData
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
- ,
- OutSampleRate
+ ,
+ OutSampleRate
#endif
- );
- if ( error != IVAS_ERR_OK )
+ ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -2008,32 +2048,40 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper,
{
if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS )
{
- error = split_renderer_open_lc3plus( hSplitRendWrapper, pSplitRendConfig, OutSampleRate );
- if ( error != IVAS_ERR_OK )
+ if ( ( error = split_renderer_open_lc3plus( hSplitRendWrapper, pSplitRendConfig, OutSampleRate ) ) != IVAS_ERR_OK )
{
return error;
}
}
else
{
- error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, BINAURAL_CHANNELS, ivas_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate, hSplitRendWrapper->multiBinPoseData.poseCorrectionMode ) );
- if ( error != IVAS_ERR_OK )
+ if ( ( error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, BINAURAL_CHANNELS, ivas_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate, hSplitRendWrapper->multiBinPoseData.poseCorrectionMode ) ) ) != IVAS_ERR_OK )
{
return error;
}
}
}
+
return error;
}
-void ivas_split_renderer_close( SPLIT_REND_WRAPPER *hSplitBinRend )
+
+/*-------------------------------------------------------------------------
+ * Function ivas_split_renderer_close()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+void ivas_split_renderer_close(
+ SPLIT_REND_WRAPPER *hSplitBinRend )
{
- int32_t i;
+ int16_t i;
if ( hSplitBinRend->hBinHrSplitPreRend != NULL )
{
ivas_splitBinPreRendClose( &hSplitBinRend->hBinHrSplitPreRend );
}
+
if ( hSplitBinRend->hSplitBinLCLDEnc != NULL )
{
ivas_splitBinLCLDEncClose( &hSplitBinRend->hSplitBinLCLDEnc );
@@ -2093,6 +2141,13 @@ void ivas_split_renderer_close( SPLIT_REND_WRAPPER *hSplitBinRend )
return;
}
+
+/*-------------------------------------------------------------------------
+ * Function splitRendLc3plusEncodeAndWrite()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
static ivas_error splitRendLc3plusEncodeAndWrite(
SPLIT_REND_WRAPPER *hSplitBin,
ivas_split_rend_bits_t *pBits,
@@ -2105,7 +2160,6 @@ static ivas_error splitRendLc3plusEncodeAndWrite(
{
ivas_error error;
int16_t i;
-
int32_t lc3plusBitstreamSize;
float *channel_ptrs[MAX_HEAD_ROT_POSES * 2];
assert( hSplitBin->hLc3plusEnc != NULL );
@@ -2113,18 +2167,19 @@ static ivas_error splitRendLc3plusEncodeAndWrite(
/* Find next byte boundary and zero-pad to it */
while ( pBits->bits_written % 8 != 0 )
{
- ivas_split_rend_bitstream_write_int32( pBits, (int32_t) 0, 1 );
+ ivas_split_rend_bitstream_write_int32( pBits, 0L, 1 );
}
for ( i = 0; i < BINAURAL_CHANNELS * hSplitBin->multiBinPoseData.num_poses; ++i )
{
channel_ptrs[i] = in[i];
}
+
if ( ( error = IVAS_LC3PLUS_ENC_GetOutputBitstreamSize( hSplitBin->hLc3plusEnc, &lc3plusBitstreamSize ) ) != IVAS_ERR_OK )
{
return error;
}
- /* Write bitstream size info */
+
ivas_split_rend_bitstream_write_int32( pBits, ivas_get_lc3plus_bitrate_id( SplitRendBitRate ), 8 );
/* Write bitstream */
@@ -2132,12 +2187,21 @@ static ivas_error splitRendLc3plusEncodeAndWrite(
{
return error;
}
+
pBits->bits_written += 8 * lc3plusBitstreamSize;
pBits->codec = IVAS_SPLIT_REND_CODEC_LC3PLUS;
pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode;
+
return IVAS_ERR_OK;
}
+
+/*-------------------------------------------------------------------------
+ * Function ivas_renderMultiTDBinToSplitBinaural()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
static ivas_error ivas_renderMultiTDBinToSplitBinaural(
SPLIT_REND_WRAPPER *hSplitBin,
const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES],
@@ -2159,7 +2223,7 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural(
float Cldfb_In_BinImag[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
uint8_t useLc3plus;
float *in_delayed[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS];
- int32_t i;
+ int16_t i;
push_wmops( "ivas_renderMultiTDBinToSplitBinaural" );
@@ -2170,14 +2234,14 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural(
if ( useLc3plus )
{
- int32_t frame_size = hSplitBin->hLc3plusEnc->config.samplerate / (int32_t) FRAMES_PER_SECOND;
+ int16_t frame_size = (int16_t) ( hSplitBin->hLc3plusEnc->config.samplerate / (int32_t) FRAMES_PER_SECOND );
for ( i = 0; i < num_poses * BINAURAL_CHANNELS; ++i )
{
/* Artificially delay input to head pose correction analysis by LC3plus coding delay, so that audio and metadata are in sync after decoding */
mvr2r( hSplitBin->lc3plusDelayBuffers[i] + frame_size, hSplitBin->lc3plusDelayBuffers[i], (int16_t) hSplitBin->lc3plusDelaySamples );
in_delayed[i] = hSplitBin->lc3plusDelayBuffers[i];
- mvr2r( in[i], hSplitBin->lc3plusDelayBuffers[i] + hSplitBin->lc3plusDelaySamples, (int16_t) frame_size );
+ mvr2r( in[i], hSplitBin->lc3plusDelayBuffers[i] + hSplitBin->lc3plusDelaySamples, frame_size );
}
}
else
@@ -2189,15 +2253,13 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural(
}
actual_md_bits = pBits->bits_written;
- if ( ( hSplitBin->multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) ||
- ( !useLc3plus && !pcm_out ) )
+ if ( ( hSplitBin->multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) || ( !useLc3plus && !pcm_out ) )
{
num_cldfb_bands = hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels;
/* CLDFB Analysis*/
for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ )
{
-
#ifdef SPLIT_POSE_CORRECTION_DEBUG
{
float *pOut[2];
@@ -2210,8 +2272,7 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural(
pOut[0] = in_delayed[2 * pos_idx];
pOut[1] = in_delayed[2 * pos_idx + 1];
- dbgwrite_wav( pOut, CLDFB_NO_COL_MAX * max_bands,
- fname, 48000, 2 );
+ dbgwrite_wav( pOut, CLDFB_NO_COL_MAX * max_bands, fname, 48000, 2 );
}
#endif
@@ -2220,10 +2281,8 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural(
for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ )
{
cldfbAnalysis_ts( &( in_delayed[pos_idx * BINAURAL_CHANNELS + ch][num_cldfb_bands * slot_idx] ),
- Cldfb_In_BinReal[pos_idx * BINAURAL_CHANNELS + ch][slot_idx],
- Cldfb_In_BinImag[pos_idx * BINAURAL_CHANNELS + ch][slot_idx],
- max_bands,
- hSplitBin->hCldfbHandles->cldfbAna[pos_idx * BINAURAL_CHANNELS + ch] );
+ Cldfb_In_BinReal[pos_idx * BINAURAL_CHANNELS + ch][slot_idx], Cldfb_In_BinImag[pos_idx * BINAURAL_CHANNELS + ch][slot_idx],
+ max_bands, hSplitBin->hCldfbHandles->cldfbAna[pos_idx * BINAURAL_CHANNELS + ch] );
}
}
}
@@ -2232,34 +2291,24 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural(
if ( hSplitBin->multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
{
target_md_bits = ivas_get_split_rend_md_target_brate( SplitRendBitRate, pcm_out ) * L_FRAME48k / 48000;
+
actual_md_bits = pBits->bits_written;
- ivas_rend_CldfbSplitPreRendProcess(
- hSplitBin->hBinHrSplitPreRend,
- headPositions,
- &hSplitBin->multiBinPoseData,
- Cldfb_In_BinReal,
- Cldfb_In_BinImag,
- pBits,
- target_md_bits,
- low_res_pre_rend_rot );
+
+ ivas_rend_CldfbSplitPreRendProcess( hSplitBin->hBinHrSplitPreRend, headPositions, &hSplitBin->multiBinPoseData, Cldfb_In_BinReal, Cldfb_In_BinImag, pBits, target_md_bits, low_res_pre_rend_rot );
}
if ( pcm_out == 0 )
{
pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode;
pBits->codec = useLc3plus ? IVAS_SPLIT_REND_CODEC_LC3PLUS : IVAS_SPLIT_REND_CODEC_LCLD;
+
if ( !useLc3plus )
{
- // available_bits = ivas_get_lcld_bitrate( SplitRendBitRate ) * L_FRAME48k / 48000;
available_bits = SplitRendBitRate * L_FRAME48k / 48000;
actual_md_bits = pBits->bits_written - actual_md_bits;
available_bits -= actual_md_bits;
- ivas_splitBinLCLDEncProcess(
- hSplitBin->hSplitBinLCLDEnc,
- Cldfb_In_BinReal,
- Cldfb_In_BinImag,
- available_bits,
- pBits );
+
+ ivas_splitBinLCLDEncProcess( hSplitBin->hSplitBinLCLDEnc, Cldfb_In_BinReal, Cldfb_In_BinImag, available_bits, pBits );
}
else
{
@@ -2279,7 +2328,7 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural(
bit_len = SplitRendBitRate / FRAMES_PER_SEC;
while ( pBits->bits_written < bit_len )
{
- ivas_split_rend_bitstream_write_int32( pBits, (int32_t) 0, 1 );
+ ivas_split_rend_bitstream_write_int32( pBits, 0L, 1 );
}
pop_wmops();
@@ -2287,6 +2336,13 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural(
return error;
}
+
+/*-------------------------------------------------------------------------
+ * Function lc3plusTimeAlignCldfbPoseCorr()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
static void lc3plusTimeAlignCldfbPoseCorr(
SPLIT_REND_WRAPPER *hSplitBin,
float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
@@ -2338,8 +2394,17 @@ static void lc3plusTimeAlignCldfbPoseCorr(
}
}
}
+
+ return;
}
+
+/*-------------------------------------------------------------------------
+ * Function ivas_renderMultiBinToSplitBinaural()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
ivas_error ivas_renderMultiBinToSplitBinaural(
SPLIT_REND_WRAPPER *hSplitBin,
const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES],
@@ -2378,9 +2443,9 @@ ivas_error ivas_renderMultiBinToSplitBinaural(
if ( td_input )
{
/*TD input*/
- /*if CLDFB handles have been allocated then assume valid multi binaural input in output[][] buffer and perform CLDFB analysis*/
- error = ivas_renderMultiTDBinToSplitBinaural( hSplitBin, headPositions, SplitRendBitRate, pBits, max_bands, output,
- low_res_pre_rend_rot, pcm_out );
+ /*if CLDFB handles have been allocated then assume valid multi binaural input in out[][] buffer and perform CLDFB analysis*/
+ error = ivas_renderMultiTDBinToSplitBinaural( hSplitBin, headPositions, SplitRendBitRate, pBits, max_bands, output, low_res_pre_rend_rot, pcm_out );
+
pop_wmops();
return error;
}
@@ -2395,16 +2460,10 @@ ivas_error ivas_renderMultiBinToSplitBinaural(
if ( hSplitBin->multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
{
target_md_bits = ivas_get_split_rend_md_target_brate( SplitRendBitRate, pcm_out ) * L_FRAME48k / 48000;
+
actual_md_bits = pBits->bits_written;
- ivas_rend_CldfbSplitPreRendProcess(
- hSplitBin->hBinHrSplitPreRend,
- headPositions,
- &hSplitBin->multiBinPoseData,
- Cldfb_In_BinReal,
- Cldfb_In_BinImag,
- pBits,
- target_md_bits,
- low_res_pre_rend_rot );
+
+ ivas_rend_CldfbSplitPreRendProcess( hSplitBin->hBinHrSplitPreRend, headPositions, &hSplitBin->multiBinPoseData, Cldfb_In_BinReal, Cldfb_In_BinImag, pBits, target_md_bits, low_res_pre_rend_rot );
}
if ( pcm_out == 0 )
@@ -2414,20 +2473,16 @@ ivas_error ivas_renderMultiBinToSplitBinaural(
if ( splitCodec == IVAS_SPLIT_REND_CODEC_LCLD )
{
- // available_bits = ivas_get_lcld_bitrate( SplitRendBitRate ) * L_FRAME48k / 48000;
available_bits = SplitRendBitRate * L_FRAME48k / 48000;
actual_md_bits = pBits->bits_written - actual_md_bits;
available_bits -= actual_md_bits;
- ivas_splitBinLCLDEncProcess(
- hSplitBin->hSplitBinLCLDEnc,
- Cldfb_In_BinReal,
- Cldfb_In_BinImag,
- available_bits,
- pBits );
+
+ ivas_splitBinLCLDEncProcess( hSplitBin->hSplitBinLCLDEnc, Cldfb_In_BinReal, Cldfb_In_BinImag, available_bits, pBits );
}
else
{
int16_t ch, slot_idx;
+
/* CLDFB synthesis of main pose */
for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
{
@@ -2483,11 +2538,11 @@ ivas_error ivas_renderMultiBinToSplitBinaural(
while ( pBits->bits_written < bit_len )
{
- ivas_split_rend_bitstream_write_int32( pBits, (int32_t) 0, 1 );
+ ivas_split_rend_bitstream_write_int32( pBits, 0L, 1 );
}
pop_wmops();
return error;
}
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
+#endif
diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c
index a6e5720e30ab6f4b8de112ea3f1c11242e44a9cd..22d2b2183452f1a2e6cb0a0c16026d6f65e54623 100644
--- a/lib_rend/ivas_splitRenderer_utils.c
+++ b/lib_rend/ivas_splitRenderer_utils.c
@@ -1,6 +1,6 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -50,12 +50,19 @@
#include "wmc_auto.h"
-void ivas_mat_mult_2by2_complex( float in_re1[2][2],
- float in_im1[2][2],
- float in_re2[2][2],
- float in_im2[2][2],
- float out_re2[2][2],
- float out_im2[2][2] )
+/*-------------------------------------------------------------------------
+ * Function ivas_mat_mult_2by2_complex()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+void ivas_mat_mult_2by2_complex(
+ float in_re1[2][2],
+ float in_im1[2][2],
+ float in_re2[2][2],
+ float in_im2[2][2],
+ float out_re2[2][2],
+ float out_im2[2][2] )
{
int16_t i, j;
float tmp_re, tmp_im;
@@ -64,28 +71,46 @@ void ivas_mat_mult_2by2_complex( float in_re1[2][2],
{
for ( j = 0; j < 2; j++ )
{
-
- IVAS_CMULT_FLOAT( in_re1[i][0], in_im1[i][0],
- in_re2[0][j], in_im2[0][j], tmp_re, tmp_im );
+ IVAS_CMULT_FLOAT( in_re1[i][0], in_im1[i][0], in_re2[0][j], in_im2[0][j], tmp_re, tmp_im );
out_re2[i][j] = tmp_re;
out_im2[i][j] = tmp_im;
- IVAS_CMULT_FLOAT( in_re1[i][1], in_im1[i][1],
- in_re2[1][j], in_im2[1][j], tmp_re, tmp_im );
+
+ IVAS_CMULT_FLOAT( in_re1[i][1], in_im1[i][1], in_re2[1][j], in_im2[1][j], tmp_re, tmp_im );
out_re2[i][j] += tmp_re;
out_im2[i][j] += tmp_im;
}
}
+
return;
}
-void ivas_split_rend_bitstream_init( ivas_split_rend_bits_t *pBits, const int32_t buf_len_bytes, uint8_t *pbuf )
+
+
+/*-------------------------------------------------------------------------
+ * Function ivas_split_rend_bitstream_init()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+void ivas_split_rend_bitstream_init(
+ ivas_split_rend_bits_t *pBits,
+ const int32_t buf_len_bytes,
+ uint8_t *pbuf )
{
pBits->bits_buf = pbuf;
pBits->buf_len = buf_len_bytes;
pBits->bits_read = 0;
pBits->bits_written = 0;
+
return;
}
+
+/*-------------------------------------------------------------------------
+ * Function ivas_split_rend_huffman_dec_init_min_max_len()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
void ivas_split_rend_huffman_dec_init_min_max_len(
ivas_split_rend_huffman_cfg_t *p_huff_cfg )
{
@@ -114,9 +139,20 @@ void ivas_split_rend_huffman_dec_init_min_max_len(
return;
}
-static int16_t is_idx_present( int16_t *idx_list, const int16_t idx, const int16_t len )
+
+/*-------------------------------------------------------------------------
+ * Function is_idx_present()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+static int16_t is_idx_present(
+ int16_t *idx_list,
+ const int16_t idx,
+ const int16_t len )
{
int16_t i;
+
for ( i = 0; i < len; i++ )
{
if ( idx_list[i] == idx )
@@ -124,9 +160,20 @@ static int16_t is_idx_present( int16_t *idx_list, const int16_t idx, const int16
return 1;
}
}
+
return 0;
}
-static void ivas_split_huff_get_idx_trav_list( int16_t *idx_list, ivas_split_rend_huffman_cfg_t *p_huff_cfg )
+
+
+/*-------------------------------------------------------------------------
+ * Function ivas_split_huff_get_idx_trav_list()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+static void ivas_split_huff_get_idx_trav_list(
+ int16_t *idx_list,
+ ivas_split_rend_huffman_cfg_t *p_huff_cfg )
{
int16_t i, j, min_idx;
int32_t min_bits;
@@ -157,7 +204,15 @@ static void ivas_split_huff_get_idx_trav_list( int16_t *idx_list, ivas_split_ren
return;
}
-void ivas_split_rend_init_huff_cfg( BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg )
+
+/*-------------------------------------------------------------------------
+ * Function ivas_split_rend_init_huff_cfg()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+void ivas_split_rend_init_huff_cfg(
+ BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg )
{
#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
pHuff_cfg->pred[0].codebook = &ivas_split_rend_huff_pred31_consts[0][0];
@@ -211,7 +266,16 @@ void ivas_split_rend_init_huff_cfg( BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg )
return;
}
-void set_fix_rotation_mat( float fix_pos_rot_mat[][BINAURAL_CHANNELS][BINAURAL_CHANNELS], MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData )
+
+/*-------------------------------------------------------------------------
+ * Function set_fix_rotation_mat()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+void set_fix_rotation_mat(
+ float fix_pos_rot_mat[][BINAURAL_CHANNELS][BINAURAL_CHANNELS],
+ MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData )
{
float yaw_a, cos_yaw, sin_yaw;
int16_t pos_idx;
@@ -228,12 +292,23 @@ void set_fix_rotation_mat( float fix_pos_rot_mat[][BINAURAL_CHANNELS][BINAURAL_C
fix_pos_rot_mat[pos_idx][0][1] = sin_yaw;
fix_pos_rot_mat[pos_idx][1][0] = -1.0f * sin_yaw;
}
+
return;
}
-void set_pose_types( IVAS_SPLIT_REND_POSE_TYPE pose_type[MAX_HEAD_ROT_POSES - 1], MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData )
+
+/*-------------------------------------------------------------------------
+ * Function set_pose_types()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+void set_pose_types(
+ IVAS_SPLIT_REND_POSE_TYPE pose_type[MAX_HEAD_ROT_POSES - 1],
+ MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData )
{
int16_t pos_idx;
+
for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ )
{
if ( fabs( pMultiBinPoseData->relative_head_poses[pos_idx + 1][0] ) > EPSILON )
@@ -249,22 +324,42 @@ void set_pose_types( IVAS_SPLIT_REND_POSE_TYPE pose_type[MAX_HEAD_ROT_POSES - 1]
pose_type[pos_idx] = PITCH_ONLY;
}
}
+
return;
}
-int16_t wrap_a( int16_t val, int16_t min_val, int16_t max_val )
+
+/*-------------------------------------------------------------------------
+ * Function wrap_a()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+int16_t wrap_a(
+ int16_t val,
+ const int16_t min_val,
+ const int16_t max_val )
{
if ( val < min_val )
{
val = max_val - min_val + val + 1;
}
+
if ( val > max_val )
{
val = min_val + val - max_val - 1;
}
+
return val;
}
+
+/*-------------------------------------------------------------------------
+ * Function ivas_SplitRenderer_getdiagdiff()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
void ivas_SplitRenderer_getdiagdiff(
int16_t in_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS],
int16_t out_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS],
@@ -282,7 +377,16 @@ void ivas_SplitRenderer_getdiagdiff(
return;
}
-int32_t ivas_split_rend_bitstream_read_int32( ivas_split_rend_bits_t *pBits, int32_t bits )
+
+/*-------------------------------------------------------------------------
+ * Function ivas_split_rend_bitstream_read_int32()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+int32_t ivas_split_rend_bitstream_read_int32(
+ ivas_split_rend_bits_t *pBits,
+ const int32_t bits )
{
int32_t val, k, bit_val;
@@ -306,9 +410,21 @@ int32_t ivas_split_rend_bitstream_read_int32( ivas_split_rend_bits_t *pBits, int
#endif
pBits->bits_read++;
}
+
return val;
}
-void ivas_split_rend_bitstream_write_int32( ivas_split_rend_bits_t *pBits, int32_t val, int32_t bits )
+
+
+/*-------------------------------------------------------------------------
+ * Function ivas_split_rend_bitstream_write_int32()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+void ivas_split_rend_bitstream_write_int32(
+ ivas_split_rend_bits_t *pBits,
+ const int32_t val,
+ const int32_t bits )
{
int32_t mask, k;
@@ -335,9 +451,17 @@ void ivas_split_rend_bitstream_write_int32( ivas_split_rend_bits_t *pBits, int32
pBits->bits_written++;
mask >>= 1;
}
+
return;
}
+
+/*-------------------------------------------------------------------------
+ * Function ivas_split_rend_get_sf_rot_data()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
IVAS_QUATERNION ivas_split_rend_get_sf_rot_data(
const IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME],
int16_t subframe_idx )
@@ -345,11 +469,18 @@ IVAS_QUATERNION ivas_split_rend_get_sf_rot_data(
int16_t idx;
idx = ( subframe_idx * RENDERER_HEAD_POSITIONS_PER_FRAME ) / MAX_PARAM_SPATIAL_SUBFRAMES;
+
return headPositions[idx];
}
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
+/*-------------------------------------------------------------------------
+ * ivas_mat_mult_2by2_complex()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
void ivas_log_cldfb2wav_data(
float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
@@ -379,21 +510,28 @@ void ivas_log_cldfb2wav_data(
RealBuffer[sf - start_slot_idx] = Cldfb_local_Real[ch][sf];
ImagBuffer[sf - start_slot_idx] = Cldfb_local_Imag[ch][sf];
}
- cldfbSynthesis( RealBuffer,
- ImagBuffer,
- &( pcm_out[ch][0] ),
- num_freq_bands * num_slots,
- cldfbSyn[ch] );
+ cldfbSynthesis( RealBuffer, ImagBuffer, &( pcm_out[ch][0] ), num_freq_bands * num_slots, cldfbSyn[ch] );
pPcm[ch] = pcm_out[ch];
}
- dbgwrite_wav( pPcm, num_freq_bands * num_slots,
- filename, output_Fs, num_chs );
+ dbgwrite_wav( pPcm, num_freq_bands * num_slots, filename, output_Fs, num_chs );
+
+ return;
}
#endif
-int32_t ivas_get_split_rend_md_target_brate( const int32_t SplitRendBitRate, const int16_t pcm_out )
+
+/*-------------------------------------------------------------------------
+ * Function ivas_get_split_rend_md_target_brate()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+int32_t ivas_get_split_rend_md_target_brate(
+ const int32_t SplitRendBitRate,
+ const int16_t pcm_out )
{
int32_t md_bitrate;
+
if ( pcm_out == 1 )
{
md_bitrate = SplitRendBitRate;
@@ -423,10 +561,20 @@ int32_t ivas_get_split_rend_md_target_brate( const int32_t SplitRendBitRate, con
}
}
}
+
return md_bitrate;
}
-int32_t ivas_get_lcld_bitrate( const int32_t SplitRendBitRate, const IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode )
+
+/*-------------------------------------------------------------------------
+ * Function ivas_get_lcld_bitrate()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+int32_t ivas_get_lcld_bitrate(
+ const int32_t SplitRendBitRate,
+ const IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode )
{
if ( poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
{
@@ -457,7 +605,16 @@ int32_t ivas_get_lcld_bitrate( const int32_t SplitRendBitRate, const IVAS_SPLIT_
return -1;
}
-int32_t ivas_get_lc3plus_bitrate( const int32_t SplitRendBitRate, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode )
+
+/*-------------------------------------------------------------------------
+ * Function ivas_get_lc3plus_bitrate()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+int32_t ivas_get_lc3plus_bitrate(
+ const int32_t SplitRendBitRate,
+ IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode )
{
if ( poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
{
@@ -474,7 +631,15 @@ int32_t ivas_get_lc3plus_bitrate( const int32_t SplitRendBitRate, IVAS_SPLIT_REN
return -1;
}
-int8_t ivas_get_lc3plus_bitrate_id( const int32_t SplitRendBitRate )
+
+/*-------------------------------------------------------------------------
+ * Function ivas_get_lc3plus_bitrate_id()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+int8_t ivas_get_lc3plus_bitrate_id(
+ const int32_t SplitRendBitRate )
{
switch ( SplitRendBitRate )
{
@@ -505,7 +670,17 @@ int8_t ivas_get_lc3plus_bitrate_id( const int32_t SplitRendBitRate )
}
return -1;
}
-int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode )
+
+
+/*-------------------------------------------------------------------------
+ * Function ivas_mat_mult_2by2_complex()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+int32_t ivas_get_lc3plus_size_from_id(
+ const int8_t SplitRendBitRateId,
+ const IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode )
{
int32_t bitrate;
@@ -549,7 +724,16 @@ int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPL
return (int32_t) ( bitrate / FRAMES_PER_SECOND / 8 );
}
-ivas_error ivas_split_rend_validate_config( const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const int16_t is_pcm_out )
+
+/*-------------------------------------------------------------------------
+ * Function ivas_split_rend_validate_config()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+ivas_error ivas_split_rend_validate_config(
+ const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig,
+ const int16_t is_pcm_out )
{
/* Valid DOF range is 0-3 */
if ( pSplitRendConfig->dof < 0 || pSplitRendConfig->dof > 3 )
@@ -630,6 +814,13 @@ ivas_error ivas_split_rend_validate_config( const IVAS_SPLIT_REND_CONFIG_DATA *p
return IVAS_ERR_OK;
}
+
+/*-------------------------------------------------------------------------
+ * Function ivas_split_rend_get_quant_params()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
void ivas_split_rend_get_quant_params(
const int16_t num_md_bands,
int16_t pred_real_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS],
@@ -704,6 +895,13 @@ void ivas_split_rend_get_quant_params(
return;
}
+
+/*-------------------------------------------------------------------------
+ * Function ivas_renderSplitGetMultiBinPoseData()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
void ivas_renderSplitGetMultiBinPoseData(
const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config,
MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
@@ -727,9 +925,9 @@ void ivas_renderSplitGetMultiBinPoseData(
num_roll_poses = 0;
/* defaults for all DOF except 3DOF HQ */
- relative_yaw_angles = split_rend_relative_yaw_pos_angles_hq;
- relative_pitch_angles = split_rend_relative_pitch_pos_angles_hq;
- relative_roll_angles = split_rend_relative_roll_pos_angles_hq;
+ relative_yaw_angles = ivas_split_rend_relative_yaw_pos_angles_hq;
+ relative_pitch_angles = ivas_split_rend_relative_pitch_pos_angles_hq;
+ relative_roll_angles = ivas_split_rend_relative_roll_pos_angles_hq;
if ( pSplit_rend_config->dof == 1 )
{
@@ -793,35 +991,37 @@ void ivas_renderSplitGetMultiBinPoseData(
{
if ( pSplit_rend_config->hq_mode == 1 )
{
- relative_yaw_angles = split_rend_relative_yaw_pos_angles_hq;
- relative_pitch_angles = split_rend_relative_pitch_pos_angles_hq;
- relative_roll_angles = split_rend_relative_roll_pos_angles_hq;
+ relative_yaw_angles = ivas_split_rend_relative_yaw_pos_angles_hq;
+ relative_pitch_angles = ivas_split_rend_relative_pitch_pos_angles_hq;
+ relative_roll_angles = ivas_split_rend_relative_roll_pos_angles_hq;
num_yaw_poses = SPLIT_REND_MAX_YAW_ONLY_POSES;
num_pitch_poses = SPLIT_REND_MAX_PITCH_ONLY_POSES;
num_roll_poses = SPLIT_REND_MAX_ROLL_ONLY_POSES;
}
else
{
- relative_yaw_angles = split_rend_relative_yaw_pos_angles;
- relative_pitch_angles = split_rend_relative_pitch_pos_angles;
- relative_roll_angles = split_rend_relative_roll_pos_angles;
+ relative_yaw_angles = ivas_split_rend_relative_yaw_pos_angles;
+ relative_pitch_angles = ivas_split_rend_relative_pitch_pos_angles;
+ relative_roll_angles = ivas_split_rend_relative_roll_pos_angles;
num_yaw_poses = SPLIT_REND_MAX_YAW_ONLY_POSES;
num_pitch_poses = 1;
num_roll_poses = 1;
}
}
+
pMultiBinPoseData->num_poses = num_yaw_poses + num_pitch_poses + num_roll_poses + 1;
assert( pMultiBinPoseData->num_poses <= MAX_HEAD_ROT_POSES );
-
for ( pos_idx = 0; pos_idx < num_yaw_poses; pos_idx++ )
{
pMultiBinPoseData->relative_head_poses[pos_idx + 1][0] = relative_yaw_angles[pos_idx];
}
+
for ( pos_idx = 0; pos_idx < num_pitch_poses; pos_idx++ )
{
pMultiBinPoseData->relative_head_poses[pos_idx + num_yaw_poses + 1][1] = relative_pitch_angles[pos_idx];
}
+
for ( pos_idx = 0; pos_idx < num_roll_poses; pos_idx++ )
{
pMultiBinPoseData->relative_head_poses[pos_idx + num_yaw_poses + num_pitch_poses + 1][2] = relative_roll_angles[pos_idx];
@@ -834,6 +1034,13 @@ void ivas_renderSplitGetMultiBinPoseData(
return;
}
+
+/*-------------------------------------------------------------------------
+ * Function ivas_renderSplitUpdateNoCorrectionPoseData()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
void ivas_renderSplitUpdateNoCorrectionPoseData(
const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config,
MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData )
@@ -843,9 +1050,19 @@ void ivas_renderSplitUpdateNoCorrectionPoseData(
pMultiBinPoseData->dof = pSplit_rend_config->dof;
assert( pSplit_rend_config->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE );
pMultiBinPoseData->poseCorrectionMode = pSplit_rend_config->poseCorrectionMode;
+
+ return;
}
-void ivas_init_multi_bin_pose_data( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData )
+
+/*-------------------------------------------------------------------------
+ * Function ivas_init_multi_bin_pose_data()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+void ivas_init_multi_bin_pose_data(
+ MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData )
{
int16_t pos_idx;
@@ -864,7 +1081,16 @@ void ivas_init_multi_bin_pose_data( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData
}
-void ivas_split_rend_choose_default_codec( IVAS_SPLIT_REND_CODEC *pCodec, int16_t isRenderingInTd, int16_t pcm_out )
+/*-------------------------------------------------------------------------
+ * Function ivas_split_rend_choose_default_codec()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+void ivas_split_rend_choose_default_codec(
+ IVAS_SPLIT_REND_CODEC *pCodec,
+ const int16_t isRenderingInTd,
+ const int16_t pcm_out )
{
if ( pcm_out == 0 )
{
@@ -877,6 +1103,7 @@ void ivas_split_rend_choose_default_codec( IVAS_SPLIT_REND_CODEC *pCodec, int16_
{
*pCodec = IVAS_SPLIT_REND_CODEC_NONE;
}
+
return;
}
#endif
diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h
index f7899271fde7fe42d8f7982c4a021c2396b16c3d..35812f74faaf62e3f6b49f51a20e64fc4d74b708 100644
--- a/lib_rend/ivas_stat_rend.h
+++ b/lib_rend/ivas_stat_rend.h
@@ -41,8 +41,7 @@
#include "common_api_types.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
#include "stat_com.h"
-#include "ivas_CQMFEncoder.h"
-#include "ivas_CQMFDecoder.h"
+#include "ivas_lcld_prot.h"
#include "ivas_lc3plus_enc.h"
#include "ivas_lc3plus_dec.h"
#endif
@@ -550,189 +549,6 @@ typedef struct ivas_binaural_rendering_conv_module_struct
} BINRENDERER_CONV_MODULE, *BINRENDERER_CONV_MODULE_HANDLE;
-#ifdef SPLIT_REND_WITH_HEAD_ROT
-/* binaural split rendering head rotation data structure */
-typedef struct ivas_binaural_head_rot_split_rendering_md_struct
-{
- float pred_mat_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
- float pred_mat_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
- float gd;
- float gd2;
- int16_t pred_mat_re_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
- int16_t pred_mat_im_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
- int16_t gd_idx;
- int16_t gd2_idx;
-} BIN_HR_SPLIT_REND_MD, *BIN_HR_SPLIT_REND_MD_HANDLE;
-
-typedef struct ivas_split_rend_huffman_cfg_t
-{
- const int32_t *codebook;
- int16_t min_len;
- int16_t max_len;
- int16_t sym_len;
-} ivas_split_rend_huffman_cfg_t;
-
-typedef struct ivas_binaural_head_rot_split_rendering_huff_struct
-{
-#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
- ivas_split_rend_huffman_cfg_t pred[2];
- int16_t pred_idx_trav[2][IVAS_SPLIT_REND_PRED_63QUANT_PNTS];
- int16_t pred_base2_code_len[2];
-#else
- ivas_split_rend_huffman_cfg_t pred;
- int16_t pred_idx_trav[IVAS_SPLIT_REND_PRED_QUANT_PNTS];
- int16_t pred_base2_code_len;
-#endif
-
-#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
- ivas_split_rend_huffman_cfg_t pred_roll;
- int16_t pred_roll_idx_trav[IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS];
- int16_t pred_roll_base2_code_len;
-#endif
- ivas_split_rend_huffman_cfg_t gd;
- int16_t gd_base2_code_len;
- int16_t gd_idx_trav[IVAS_SPLIT_REND_D_QUANT_PNTS];
- ivas_split_rend_huffman_cfg_t p_gd;
- int16_t p_gd_base2_code_len;
- int16_t p_gd_idx_trav[IVAS_SPLIT_REND_D_QUANT_PNTS];
- ivas_split_rend_huffman_cfg_t p_gd_diff;
- int16_t p_gd_diff_base2_code_len;
- int16_t p_gd_diff_idx_trav[IVAS_SPLIT_REND_D_QUANT_PNTS];
-} BIN_HR_SPLIT_REND_HUFF, *BIN_HR_SPLIT_REND_HUFF_HANDLE;
-typedef struct ivas_binaural_head_rot_split_post_rendering_struct
-{
- BIN_HR_SPLIT_REND_MD rot_md[MAX_HEAD_ROT_POSES][MAX_SPLIT_MD_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS];
- IVAS_QUATERNION QuaternionsPre[MAX_PARAM_SPATIAL_SUBFRAMES];
- int16_t low_Res;
-
- float fix_pos_rot_mat[MAX_HEAD_ROT_POSES - 1][BINAURAL_CHANNELS][BINAURAL_CHANNELS];
- IVAS_SPLIT_REND_POSE_TYPE pose_type[MAX_HEAD_ROT_POSES - 1];
- BIN_HR_SPLIT_REND_HUFF huff_cfg;
-#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
- float mixer_mat_re[MAX_HEAD_ROT_POSES][MAX_SPLIT_REND_MD_BANDS][BINAURAL_CHANNELS][BINAURAL_CHANNELS];
- float mixer_mat_im[MAX_HEAD_ROT_POSES][MAX_SPLIT_REND_MD_BANDS][BINAURAL_CHANNELS][BINAURAL_CHANNELS];
- float gd_mem[MAX_HEAD_ROT_POSES][MAX_SPLIT_REND_MD_BANDS];
-#else
- float mixer_mat_re[1][MAX_SPLIT_REND_MD_BANDS][BINAURAL_CHANNELS][BINAURAL_CHANNELS];
- float mixer_mat_im[1][MAX_SPLIT_REND_MD_BANDS][BINAURAL_CHANNELS][BINAURAL_CHANNELS];
- float gd_mem[1][MAX_SPLIT_REND_MD_BANDS];
-#endif
- int16_t cf_flag;
- HANDLE_CLDFB_FILTER_BANK cldfbAna[BINAURAL_CHANNELS];
- HANDLE_CLDFB_FILTER_BANK cldfbSyn[BINAURAL_CHANNELS];
-#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
- HANDLE_CLDFB_FILTER_BANK cldfbSynReconsBinDec[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS];
-#endif
-} BIN_HR_SPLIT_POST_REND, *BIN_HR_SPLIT_POST_REND_HANDLE;
-
-typedef struct ivas_binaural_head_rot_split_pre_rendering_struct
-{
- BIN_HR_SPLIT_REND_MD rot_md[MAX_HEAD_ROT_POSES - 1][MAX_SPLIT_MD_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS];
- float fix_pos_rot_mat[MAX_HEAD_ROT_POSES - 1][BINAURAL_CHANNELS][BINAURAL_CHANNELS];
- IVAS_SPLIT_REND_POSE_TYPE pose_type[MAX_HEAD_ROT_POSES - 1];
- BIN_HR_SPLIT_REND_HUFF huff_cfg;
-#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
- HANDLE_CLDFB_FILTER_BANK cldfbSynRotBinDec[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS];
-#endif
-
-#ifdef SPLIT_POSE_CORRECTION_DEBUG
- BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend;
-#endif
-} BIN_HR_SPLIT_PRE_REND, *BIN_HR_SPLIT_PRE_REND_HANDLE;
-
-
-typedef struct ivas_binaural_head_rot_split_rendering_lcld_enc_struct
-{
- void *pLcld_enc;
- int32_t iChannels;
- CQMFEncoder *psCQMFEncoder;
- float ***pppfCQMFReal;
- float ***pppfCQMFImag;
-#ifdef CLDFB_DEBUG
- FILE *cldfbIn;
- int numFrame;
-#endif
-} BIN_HR_SPLIT_LCLD_ENC, *BIN_HR_SPLIT_LCLD_ENC_HANDLE;
-
-typedef struct
-{
- float Cldfb_Prev_BinReal[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX + CLDFB_PLC_XF][CLDFB_NO_CHANNELS_MAX];
- float Cldfb_Prev_BinImag[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX + CLDFB_PLC_XF][CLDFB_NO_CHANNELS_MAX];
-#if CLDFB_PLC_XF > 0
- float xf_bet[2][CLDFB_NO_CHANNELS_MAX][CLDFB_PLC_XF];
-#endif
-} CLDFB_PLC, *CLDFB_PLC_HANDLE;
-
-typedef struct
-{
- CLDFB_PLC CldfbPLC_state;
- int16_t prev_bfi;
- int16_t bf_count;
-} SPLIT_REND_PLC_STRUCT, *SPLIT_REND_PLC_HANDLE;
-
-typedef struct ivas_binaural_head_rot_split_rendering_lcld_dec_struct
-{
- void *pLcld_dec;
- int32_t iChannels;
- CQMFDecoder *psCQMFDecoder;
- float ***pppfDecCQMFReal;
- float ***pppfDecCQMFImag;
-#ifdef CLDFB_DEBUG
- FILE *cldfbOut;
- int numFrame;
-#endif
- SPLIT_REND_PLC_HANDLE hSplitRendPLC;
-} BIN_HR_SPLIT_LCLD_DEC, *BIN_HR_SPLIT_LCLD_DEC_HANDLE;
-
-typedef struct
-{
-#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
- HANDLE_CLDFB_FILTER_BANK cldfbAna[( 1 + MAX_HEAD_ROT_POSES ) * BINAURAL_CHANNELS];
-#else
- HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS];
-#endif
-#ifdef OSBA_SPLIT_RENDERING
- HANDLE_CLDFB_FILTER_BANK cldfbSyn[BINAURAL_CHANNELS];
-#endif
-} CLDFB_HANDLES_WRAPPER, *CLDFB_HANDLES_WRAPPER_HANDLE;
-
-typedef struct
-{
- int16_t num_poses;
- float relative_head_poses[MAX_HEAD_ROT_POSES][3];
- int16_t dof;
- int16_t hq_mode;
- IVAS_SPLIT_REND_ROT_AXIS rot_axis;
- IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode;
-} MULTI_BIN_REND_POSE_DATA;
-
-/* Forward declaration of TD_OBJECT_RENDERER_HANDLE.
- This avoids shifting the entire definition of TD Renderer structs above
- this line, which could cause merge conflicts.
- Can be cleaned up later. */
-typedef struct ivas_binaural_td_rendering_struct *TD_OBJECT_RENDERER_HANDLE;
-
-typedef struct
-{
- MULTI_BIN_REND_POSE_DATA multiBinPoseData;
- BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend;
- BIN_HR_SPLIT_LCLD_ENC_HANDLE hSplitBinLCLDEnc;
- CLDFB_HANDLES_WRAPPER_HANDLE hCldfbHandles;
- IVAS_LC3PLUS_ENC_HANDLE hLc3plusEnc;
- TD_OBJECT_RENDERER_HANDLE hTdRendHandles[MAX_HEAD_ROT_POSES - 1];
- float *lc3plusDelayBuffers[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS]; /* Used to time-align head pose correction metadata with LC3plus-coded reference audio */
- int32_t lc3plusDelaySamples;
-} SPLIT_REND_WRAPPER;
-
-typedef struct
-{
- MULTI_BIN_REND_POSE_DATA multiBinPoseData;
- BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend;
- BIN_HR_SPLIT_LCLD_DEC_HANDLE hSplitBinLCLDDec;
- int16_t first_good_frame_received;
- IVAS_LC3PLUS_DEC_HANDLE hLc3plusDec;
-} SPLIT_POST_REND_WRAPPER;
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
/*----------------------------------------------------------------------------------*
* EFAP structures
@@ -852,6 +668,7 @@ typedef struct ivas_binaural_head_track_struct
#ifdef SPLIT_REND_WITH_HEAD_ROT
IVAS_SPLIT_REND_ROT_AXIS sr_pose_pred_axis;
#endif
+
} HEAD_TRACK_DATA, *HEAD_TRACK_DATA_HANDLE;
/*----------------------------------------------------------------------------------*
@@ -906,11 +723,10 @@ typedef struct ivas_combined_orientation_struct
} COMBINED_ORIENTATION_DATA, *COMBINED_ORIENTATION_HANDLE;
+
/*----------------------------------------------------------------------------------*
* Reverberator structure
*----------------------------------------------------------------------------------*/
-/* Reverberator structures */
-
typedef struct ivas_roomAcoustics_t
{
@@ -1420,6 +1236,7 @@ typedef struct ivas_binaural_crend_wrapper_struct
} CREND_WRAPPER, *CREND_WRAPPER_HANDLE;
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
/* Fastconv binaural data structure */
typedef struct ivas_binaural_rendering_struct
@@ -1443,9 +1260,8 @@ typedef struct ivas_binaural_rendering_struct
float earlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX];
REVERB_STRUCT_HANDLE hReverb;
-#ifdef SPLIT_REND_WITH_HEAD_ROT
int16_t numPoses;
-#endif
+
} BINAURAL_RENDERER, *BINAURAL_RENDERER_HANDLE;
#endif
@@ -1518,6 +1334,202 @@ typedef struct ivas_hrtfs_parambin_struct
} HRTFS_PARAMBIN, *HRTFS_PARAMBIN_HANDLE;
+#ifdef SPLIT_REND_WITH_HEAD_ROT
+/*----------------------------------------------------------------------------------*
+ * Binaural split rendering structures
+ *----------------------------------------------------------------------------------*/
+
+/* binaural split rendering head rotation data structure */
+typedef struct ivas_binaural_head_rot_split_rendering_md_struct
+{
+ float pred_mat_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
+ float pred_mat_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
+ float gd;
+ float gd2;
+ int16_t pred_mat_re_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
+ int16_t pred_mat_im_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
+ int16_t gd_idx;
+ int16_t gd2_idx;
+
+} BIN_HR_SPLIT_REND_MD, *BIN_HR_SPLIT_REND_MD_HANDLE;
+
+typedef struct ivas_split_rend_huffman_cfg_t
+{
+ const int32_t *codebook;
+ int16_t min_len;
+ int16_t max_len;
+ int16_t sym_len;
+
+} ivas_split_rend_huffman_cfg_t;
+
+typedef struct ivas_binaural_head_rot_split_rendering_huff_struct
+{
+#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
+ ivas_split_rend_huffman_cfg_t pred[2];
+ int16_t pred_idx_trav[2][IVAS_SPLIT_REND_PRED_63QUANT_PNTS];
+ int16_t pred_base2_code_len[2];
+#else
+ ivas_split_rend_huffman_cfg_t pred;
+ int16_t pred_idx_trav[IVAS_SPLIT_REND_PRED_QUANT_PNTS];
+ int16_t pred_base2_code_len;
+#endif
+
+#ifdef SPLIT_REND_PRED_QUANT_63_PNTS
+ ivas_split_rend_huffman_cfg_t pred_roll;
+ int16_t pred_roll_idx_trav[IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS];
+ int16_t pred_roll_base2_code_len;
+#endif
+ ivas_split_rend_huffman_cfg_t gd;
+ int16_t gd_base2_code_len;
+ int16_t gd_idx_trav[IVAS_SPLIT_REND_D_QUANT_PNTS];
+ ivas_split_rend_huffman_cfg_t p_gd;
+ int16_t p_gd_base2_code_len;
+ int16_t p_gd_idx_trav[IVAS_SPLIT_REND_D_QUANT_PNTS];
+ ivas_split_rend_huffman_cfg_t p_gd_diff;
+ int16_t p_gd_diff_base2_code_len;
+ int16_t p_gd_diff_idx_trav[IVAS_SPLIT_REND_D_QUANT_PNTS];
+
+} BIN_HR_SPLIT_REND_HUFF, *BIN_HR_SPLIT_REND_HUFF_HANDLE;
+
+typedef struct ivas_binaural_head_rot_split_pre_rendering_struct
+{
+ BIN_HR_SPLIT_REND_MD rot_md[MAX_HEAD_ROT_POSES - 1][MAX_SPLIT_MD_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS];
+ float fix_pos_rot_mat[MAX_HEAD_ROT_POSES - 1][BINAURAL_CHANNELS][BINAURAL_CHANNELS];
+ IVAS_SPLIT_REND_POSE_TYPE pose_type[MAX_HEAD_ROT_POSES - 1];
+ BIN_HR_SPLIT_REND_HUFF huff_cfg;
+#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
+ HANDLE_CLDFB_FILTER_BANK cldfbSynRotBinDec[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS];
+#endif
+
+#ifdef SPLIT_POSE_CORRECTION_DEBUG
+ BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend;
+#endif
+
+} BIN_HR_SPLIT_PRE_REND, *BIN_HR_SPLIT_PRE_REND_HANDLE;
+
+typedef struct ivas_binaural_head_rot_split_post_rendering_struct
+{
+ BIN_HR_SPLIT_REND_MD rot_md[MAX_HEAD_ROT_POSES][MAX_SPLIT_MD_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS];
+ IVAS_QUATERNION QuaternionsPre[MAX_PARAM_SPATIAL_SUBFRAMES];
+ int16_t low_Res;
+
+ float fix_pos_rot_mat[MAX_HEAD_ROT_POSES - 1][BINAURAL_CHANNELS][BINAURAL_CHANNELS];
+ IVAS_SPLIT_REND_POSE_TYPE pose_type[MAX_HEAD_ROT_POSES - 1];
+ BIN_HR_SPLIT_REND_HUFF huff_cfg;
+#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
+ float mixer_mat_re[MAX_HEAD_ROT_POSES][MAX_SPLIT_REND_MD_BANDS][BINAURAL_CHANNELS][BINAURAL_CHANNELS];
+ float mixer_mat_im[MAX_HEAD_ROT_POSES][MAX_SPLIT_REND_MD_BANDS][BINAURAL_CHANNELS][BINAURAL_CHANNELS];
+ float gd_mem[MAX_HEAD_ROT_POSES][MAX_SPLIT_REND_MD_BANDS];
+#else
+ float mixer_mat_re[1][MAX_SPLIT_REND_MD_BANDS][BINAURAL_CHANNELS][BINAURAL_CHANNELS];
+ float mixer_mat_im[1][MAX_SPLIT_REND_MD_BANDS][BINAURAL_CHANNELS][BINAURAL_CHANNELS];
+ float gd_mem[1][MAX_SPLIT_REND_MD_BANDS];
+#endif
+ int16_t cf_flag;
+ HANDLE_CLDFB_FILTER_BANK cldfbAna[BINAURAL_CHANNELS];
+ HANDLE_CLDFB_FILTER_BANK cldfbSyn[BINAURAL_CHANNELS];
+#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
+ HANDLE_CLDFB_FILTER_BANK cldfbSynReconsBinDec[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS];
+#endif
+
+} BIN_HR_SPLIT_POST_REND, *BIN_HR_SPLIT_POST_REND_HANDLE;
+
+typedef struct ivas_binaural_head_rot_split_rendering_lcld_enc_struct
+{
+ void *pLcld_enc;
+ int16_t iChannels;
+ LCLDEncoder *psLCLDEncoder;
+ float ***pppfLCLDReal;
+ float ***pppfLCLDImag;
+#ifdef CLDFB_DEBUG
+ FILE *cldfbIn;
+ int16_t numFrame;
+#endif
+
+} BIN_HR_SPLIT_LCLD_ENC, *BIN_HR_SPLIT_LCLD_ENC_HANDLE;
+
+typedef struct
+{
+ float Cldfb_Prev_BinReal[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX + CLDFB_PLC_XF][CLDFB_NO_CHANNELS_MAX];
+ float Cldfb_Prev_BinImag[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX + CLDFB_PLC_XF][CLDFB_NO_CHANNELS_MAX];
+#if CLDFB_PLC_XF > 0
+ float xf_bet[2][CLDFB_NO_CHANNELS_MAX][CLDFB_PLC_XF];
+#endif
+
+} CLDFB_PLC, *CLDFB_PLC_HANDLE;
+
+typedef struct
+{
+ CLDFB_PLC CldfbPLC_state;
+ int16_t prev_bfi;
+ int16_t bf_count;
+
+} SPLIT_REND_PLC_STRUCT, *SPLIT_REND_PLC_HANDLE;
+
+typedef struct ivas_binaural_head_rot_split_rendering_lcld_dec_struct
+{
+ void *pLcld_dec;
+ int32_t iChannels;
+ LCLDDecoder *psLCLDDecoder;
+ float ***pppfDecLCLDReal;
+ float ***pppfDecLCLDImag;
+#ifdef CLDFB_DEBUG
+ FILE *cldfbOut;
+ int16_t numFrame;
+#endif
+ SPLIT_REND_PLC_HANDLE hSplitRendPLC;
+
+} BIN_HR_SPLIT_LCLD_DEC, *BIN_HR_SPLIT_LCLD_DEC_HANDLE;
+
+typedef struct
+{
+#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
+ HANDLE_CLDFB_FILTER_BANK cldfbAna[( 1 + MAX_HEAD_ROT_POSES ) * BINAURAL_CHANNELS];
+#else
+ HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS];
+#endif
+#ifdef OSBA_SPLIT_RENDERING
+ HANDLE_CLDFB_FILTER_BANK cldfbSyn[BINAURAL_CHANNELS];
+#endif
+
+} CLDFB_HANDLES_WRAPPER, *CLDFB_HANDLES_WRAPPER_HANDLE;
+
+typedef struct
+{
+ int16_t num_poses;
+ float relative_head_poses[MAX_HEAD_ROT_POSES][3];
+ int16_t dof;
+ int16_t hq_mode;
+ IVAS_SPLIT_REND_ROT_AXIS rot_axis;
+ IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode;
+
+} MULTI_BIN_REND_POSE_DATA;
+
+typedef struct
+{
+ MULTI_BIN_REND_POSE_DATA multiBinPoseData;
+ BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend;
+ BIN_HR_SPLIT_LCLD_ENC_HANDLE hSplitBinLCLDEnc;
+ CLDFB_HANDLES_WRAPPER_HANDLE hCldfbHandles;
+ IVAS_LC3PLUS_ENC_HANDLE hLc3plusEnc;
+ BINAURAL_TD_OBJECT_RENDERER_HANDLE hTdRendHandles[MAX_HEAD_ROT_POSES - 1];
+ float *lc3plusDelayBuffers[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS]; /* Used to time-align head pose correction metadata with LC3plus-coded reference audio */
+ int32_t lc3plusDelaySamples;
+
+} SPLIT_REND_WRAPPER;
+
+typedef struct
+{
+ MULTI_BIN_REND_POSE_DATA multiBinPoseData;
+ BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend;
+ BIN_HR_SPLIT_LCLD_DEC_HANDLE hSplitBinLCLDDec;
+ int16_t first_good_frame_received;
+ IVAS_LC3PLUS_DEC_HANDLE hLc3plusDec;
+
+} SPLIT_POST_REND_WRAPPER;
+#endif
+
+
/*----------------------------------------------------------------------------------*
* Limiter structure
*----------------------------------------------------------------------------------*/
@@ -1606,12 +1618,14 @@ typedef struct
} CLDFB_REND_WRAPPER;
#endif
+
/* Channel types in a channel-based config */
typedef enum
{
CHANNEL_TYPE_UNUSED = 0,
CHANNEL_TYPE_SPEAKER,
CHANNEL_TYPE_LFE
+
} ChannelType;
/*----------------------------------------------------------------------------------*
diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c
index abe380e8c319a92cd10c6c3b47be2bde3018207f..8d0582865725f1c7976692625eaeb3ce53482c76 100644
--- a/lib_rend/lib_rend.c
+++ b/lib_rend/lib_rend.c
@@ -259,7 +259,6 @@ struct IVAS_REND
int16_t splitRendBFI;
#endif
-
EXTERNAL_ORIENTATION_HANDLE hExternalOrientationData;
COMBINED_ORIENTATION_HANDLE hCombinedOrientationData;
@@ -1414,7 +1413,7 @@ static ivas_error setRendInputActiveIsm(
return error;
}
}
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
+#endif
}
return IVAS_ERR_OK;
@@ -1450,6 +1449,7 @@ static void clearInputIsm(
ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd );
inputIsm->tdRendWrapper.hHrtfTD = NULL;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
for ( i = 0; i < (int16_t) ( sizeof( inputIsm->splitTdRendWrappers ) / sizeof( *inputIsm->splitTdRendWrappers ) ); ++i )
{
@@ -1793,7 +1793,7 @@ static bool configsAreEqual(
for ( i = 0; i < customLsA.num_spk; ++i )
{
- /* Compare to nearest degree (hence the int cast) */
+ /* Compare to nearest degree (hence the int16_t cast) */
if ( (int16_t) customLsA.ls_azimuth[i] != (int16_t) customLsB.ls_azimuth[i] ||
(int16_t) customLsA.ls_elevation[i] != (int16_t) customLsB.ls_elevation[i] )
{
@@ -2381,6 +2381,7 @@ static ivas_error setRendInputActiveMc(
inputMc->crendWrapper = NULL;
inputMc->hReverb = NULL;
inputMc->hMcMasa = NULL;
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ )
{
@@ -2569,8 +2570,7 @@ static ivas_error initSbaPanGainsForSbaOut(
#ifdef SPLIT_REND_WITH_HEAD_ROT
-static ivas_error
-updateSplitPostRendPanGains(
+static ivas_error updateSplitPostRendPanGains(
input_split_post_rend *inputSplitPostRend,
const AUDIO_CONFIG outConfig,
RENDER_CONFIG_DATA *hRendCfg )
@@ -2581,15 +2581,9 @@ updateSplitPostRendPanGains(
getAudioConfigNumChannels( outConfig, &numOutChannels );
rendCtx = inputSplitPostRend->base.ctx;
- ivas_renderSplitGetMultiBinPoseData(
- &hRendCfg->split_rend_config,
- &inputSplitPostRend->splitPostRendWrapper.multiBinPoseData,
- rendCtx.pHeadRotData->sr_pose_pred_axis );
-
- error = ivas_splitBinPostRendOpen( &inputSplitPostRend->splitPostRendWrapper.hBinHrSplitPostRend,
- &inputSplitPostRend->splitPostRendWrapper.multiBinPoseData,
- *rendCtx.pOutSampleRate );
- if ( error != IVAS_ERR_OK )
+ ivas_renderSplitGetMultiBinPoseData( &hRendCfg->split_rend_config, &inputSplitPostRend->splitPostRendWrapper.multiBinPoseData, rendCtx.pHeadRotData->sr_pose_pred_axis );
+
+ if ( ( error = ivas_splitBinPostRendOpen( &inputSplitPostRend->splitPostRendWrapper.hBinHrSplitPostRend, &inputSplitPostRend->splitPostRendWrapper.multiBinPoseData, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -2633,22 +2627,15 @@ static ivas_error updateSbaPanGains(
{
assert( inConfig == AUDIO_CONFIG_HOA3 && ( *rendCtx.pOutSampleRate == 48000 ) && "split binaural fast conv mode is currently supported with HOA3 input and 48k sampling rate only" );
- error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig,
- &rendCtx.pSplitRendWrapper->multiBinPoseData,
- *rendCtx.pOutSampleRate );
- if ( error != IVAS_ERR_OK )
+ if ( ( error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )
{
return error;
}
}
-
else
{
assert( ( *rendCtx.pOutSampleRate == 48000 ) && "split binaural crend mode is currently supported with 48k sampling rate only" );
- error = ivas_rend_openMultiBinCrend( &inputSba->crendWrapper, inConfig, outConfig,
- &rendCtx.pSplitRendWrapper->multiBinPoseData,
- *rendCtx.pOutSampleRate );
- if ( error != IVAS_ERR_OK )
+ if ( ( error = ivas_rend_openMultiBinCrend( &inputSba->crendWrapper, inConfig, outConfig, &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -2660,8 +2647,7 @@ static ivas_error updateSbaPanGains(
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( hRendCfg->split_rend_config.rendererSelection == IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV )
{
- error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate );
- if ( error != IVAS_ERR_OK )
+ if ( ( error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -2669,12 +2655,15 @@ static ivas_error updateSbaPanGains(
else
#endif
{
- error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate
+ if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate
#ifdef SPLIT_REND_WITH_HEAD_ROT
- ,
- rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses
+ ,
+ rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses
#endif
- );
+ ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
}
break;
case AUDIO_CONFIG_BINAURAL_ROOM_IR:
@@ -2684,12 +2673,15 @@ static ivas_error updateSbaPanGains(
return error;
}
- error = ivas_rend_openCrend( &inputSba->crendWrapper, AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate
+ if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate
#ifdef SPLIT_REND_WITH_HEAD_ROT
- ,
- rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses
+ ,
+ rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses
#endif
- );
+ ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
break;
default:
return IVAS_ERR_INVALID_OUTPUT_FORMAT;
@@ -2701,6 +2693,7 @@ static ivas_error updateSbaPanGains(
default:
return IVAS_ERR_INVALID_OUTPUT_FORMAT;
}
+
/* Check error here to keep switch statement more compact */
if ( error != IVAS_ERR_OK )
{
@@ -2738,6 +2731,7 @@ static ivas_error setRendInputActiveSplitPostRend(
{
return error;
}
+
return IVAS_ERR_OK;
}
#endif
@@ -2792,7 +2786,7 @@ static ivas_error setRendInputActiveSba(
if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH ) ) != IVAS_ERR_OK )
#else
if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK )
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
+#endif
{
return error;
}
@@ -2800,8 +2794,10 @@ static ivas_error setRendInputActiveSba(
initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH );
#else
initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH );
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
+#endif
+
setZeroPanMatrix( inputSba->hoaDecMtx );
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
inputSba->crendWrapper = NULL;
for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ )
@@ -2812,7 +2808,7 @@ static ivas_error setRendInputActiveSba(
inputSba->crendWrapper = NULL;
inputSba->hDirAC = NULL;
initRotGains( inputSba->rot_gains_prev );
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
+#endif
if ( outConfig == AUDIO_CONFIG_MASA1 || outConfig == AUDIO_CONFIG_MASA2 )
{
@@ -2860,30 +2856,6 @@ static void clearInputSplitRend(
return;
}
-
-
-/*-------------------------------------------------------------------------
- * ivas_rend_openCldfbRend()
- *
- * Close CLDFB based fastconv binaural renderer memories
- *------------------------------------------------------------------------*/
-
-static void ivas_rend_closeCldfbRend(
- CLDFB_REND_WRAPPER *pCldfbRend )
-{
- if ( pCldfbRend->hCldfbRend->hInputSetup != NULL )
- {
- free( pCldfbRend->hCldfbRend->hInputSetup );
- pCldfbRend->hCldfbRend->hInputSetup = NULL;
- }
-
- ivas_binRenderer_close( &pCldfbRend->hCldfbRend );
-
- ivas_HRTF_fastconv_binary_close( &pCldfbRend->hHrtfFastConv );
-
- return;
-}
-
#endif /* SPLIT_REND_WITH_HEAD_ROT */
@@ -2901,6 +2873,7 @@ static void clearInputSba(
/* Free input's internal handles */
#ifdef SPLIT_REND_WITH_HEAD_ROT
ivas_rend_closeCrend( &inputSba->crendWrapper, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses );
+
if ( inputSba->cldfbRendWrapper.hCldfbRend != NULL )
{
ivas_rend_closeCldfbRend( &inputSba->cldfbRendWrapper );
@@ -3190,18 +3163,18 @@ static DecoderDummy *initDecoderDummy(
decDummy->hBinRenderer = NULL;
#ifdef SPLIT_REND_WITH_HEAD_ROT
- decDummy->splitBinRend.hSplitRendBits = NULL;
- decDummy->splitBinRend.hMultiBinCldfbData = NULL;
- ivas_init_split_rend_handles( &decDummy->splitBinRend.splitrend );
- decDummy->splitBinRend.splitrend = *pSplitRendWrapper;
+ decDummy->hSplitBinRend.hSplitRendBits = NULL;
+ decDummy->hSplitBinRend.hMultiBinCldfbData = NULL;
+ ivas_init_split_rend_handles( &decDummy->hSplitBinRend.splitrend );
+ decDummy->hSplitBinRend.splitrend = *pSplitRendWrapper;
+
#ifdef FIX_658_SPLIT_REND_MASA
- if ( outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ||
- outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
+ if ( outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
#else
if ( decDummy->splitBinRend.splitrend.multiBinPoseData.num_poses > 1 )
#endif
{
- if ( ( decDummy->splitBinRend.hMultiBinCldfbData = (IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL )
+ if ( ( decDummy->hSplitBinRend.hMultiBinCldfbData = (IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL )
{
assert( error == IVAS_ERR_OK );
}
@@ -3433,10 +3406,11 @@ static void freeDecoderDummy(
free( pDecDummy->hHrtfParambin );
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( pDecDummy->splitBinRend.hMultiBinCldfbData != NULL )
+ /* Split binaural renderr handle */
+ if ( pDecDummy->hSplitBinRend.hMultiBinCldfbData != NULL )
{
- free( pDecDummy->splitBinRend.hMultiBinCldfbData );
- pDecDummy->splitBinRend.hMultiBinCldfbData = NULL;
+ free( pDecDummy->hSplitBinRend.hMultiBinCldfbData );
+ pDecDummy->hSplitBinRend.hMultiBinCldfbData = NULL;
}
#endif
@@ -3483,7 +3457,6 @@ static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REN
if ( outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
-
if ( pSplit_rend_config->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
{
ivas_renderSplitGetMultiBinPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData, headRotData.sr_pose_pred_axis );
@@ -3493,12 +3466,7 @@ static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REN
ivas_renderSplitUpdateNoCorrectionPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData );
}
- error = ivas_split_renderer_open( pSplitRendWrapper,
- pSplit_rend_config,
- outputSampleRate,
- cldfb_in,
- outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM );
- if ( error != IVAS_ERR_OK )
+ if ( ( error = ivas_split_renderer_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, cldfb_in, outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -3527,7 +3495,7 @@ static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REN
return IVAS_ERR_OK;
}
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
+#endif
ivas_error IVAS_REND_Open(
@@ -4075,6 +4043,7 @@ static ivas_error findFreeInputSlot(
return IVAS_ERR_OK;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
static int16_t getCldfbRendFlag(
IVAS_REND_HANDLE hIvasRend, /* i : Renderer handle */
@@ -4129,6 +4098,7 @@ static void closeSplitRend(
free( pSplitRendEncBuffer->data );
pSplitRendEncBuffer->data = NULL;
}
+
pSplitRendEncBuffer->config.numChannels = 0;
pSplitRendEncBuffer->config.numSamplesPerChannel = 0;
@@ -4168,18 +4138,12 @@ ivas_error IVAS_REND_AddInput(
int16_t cldfb_in;
cldfb_in = getCldfbRendFlag( hIvasRend, getAudioConfigType( inConfig ) );
+
#ifdef FIX_658_SPLIT_REND_MASA
- ivas_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec,
- ( cldfb_in == 0 ),
- hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM );
+ ivas_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec, ( cldfb_in == 0 ), hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM );
#endif
- if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper,
- &hIvasRend->splitRendEncBuffer,
- &hIvasRend->hRendererConfig->split_rend_config,
- hIvasRend->headRotData,
- hIvasRend->sampleRateOut,
- hIvasRend->outputConfig,
- cldfb_in ) ) != IVAS_ERR_OK )
+
+ if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -4503,7 +4467,7 @@ ivas_error IVAS_REND_RemoveInput(
*-------------------------------------------------------------------*/
ivas_error IVAS_REND_GetInputNumChannels(
- IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */
+ IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */
const IVAS_REND_InputId inputId, /* i : ID of the input */
int16_t *numChannels /* o : number of channels of the input */
)
@@ -4538,7 +4502,7 @@ ivas_error IVAS_REND_GetInputNumChannels(
*-------------------------------------------------------------------*/
ivas_error IVAS_REND_GetNumAllObjects(
- IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */
+ IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */
int16_t *numChannels /* o : number of all objects */
)
{
@@ -4637,6 +4601,7 @@ ivas_error IVAS_REND_GetDelay(
}
}
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
for ( i = 0; i < RENDERER_MAX_BIN_INPUTS; i++ )
{
@@ -4700,6 +4665,7 @@ ivas_error IVAS_REND_FeedInputAudio(
#ifdef SPLIT_REND_WITH_HEAD_ROT
cldfb2tdSampleFact = ( inputAudio.config.is_cldfb ) ? 2 : 1;
+
if ( inputAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 0 ) ||
( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 1 ) )
#else
@@ -4874,7 +4840,7 @@ ivas_error IVAS_REND_FeedInputMasaMetadata(
*-------------------------------------------------------------------*/
ivas_error IVAS_REND_InitConfig(
- IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */
+ IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */
const AUDIO_CONFIG outAudioConfig /* i : output audioConfig */
)
{
@@ -5104,8 +5070,7 @@ ivas_error IVAS_REND_SetHeadRotation(
if ( headRot == NULL )
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
- if ( ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
- ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
hIvasRend->headRotData.headRotEnabled = 1;
for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i )
@@ -5166,16 +5131,25 @@ ivas_error IVAS_REND_SetHeadRotation(
return IVAS_ERR_OK;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
+/*-------------------------------------------------------------------*
+ * IVAS_REND_SetSplitRendBFI()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
ivas_error IVAS_REND_SetSplitRendBFI(
IVAS_REND_HANDLE hIvasRend,
const int16_t bfi )
{
hIvasRend->splitRendBFI = bfi;
+
return IVAS_ERR_OK;
}
#endif
+
/*-------------------------------------------------------------------*
* IVAS_REND_SetOrientationTrackingMode()
*
@@ -5183,7 +5157,7 @@ ivas_error IVAS_REND_SetSplitRendBFI(
*-------------------------------------------------------------------*/
ivas_error IVAS_REND_SetOrientationTrackingMode(
- IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */
+ IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */
const HEAD_ORIENT_TRK_T orientation_tracking /* i : Head orientation tracking type */
)
{
@@ -6077,6 +6051,7 @@ static ivas_error renderIsmToSplitBinaural(
pSplitRendWrapper = ismInput->base.ctx.pSplitRendWrapper;
pMultiBinPoseData = &pSplitRendWrapper->multiBinPoseData;
+
/* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */
ism_md_subframe_update_ext = (int16_t) round( ismInput->ism_metadata_delay_ms / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );
@@ -6151,32 +6126,16 @@ static ivas_error renderIsmToSplitBinaural(
/* Render */
if ( pos_idx == 0 )
{
- error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper,
- ismInput->base.inConfig,
- NULL,
- ismInput->base.ctx.pCombinedOrientationData,
- &ismInput->currentPos,
- NULL,
- ism_md_subframe_update_ext,
- output_frame,
- tmpProcessing );
- if ( error != IVAS_ERR_OK )
+ if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, NULL,
+ ism_md_subframe_update_ext, output_frame, tmpProcessing ) ) != IVAS_ERR_OK )
{
return error;
}
}
else
{
- error = ivas_td_binaural_renderer_ext( &ismInput->splitTdRendWrappers[pos_idx - 1],
- ismInput->base.inConfig,
- NULL,
- ismInput->base.ctx.pCombinedOrientationData,
- &ismInput->currentPos,
- NULL,
- ism_md_subframe_update_ext,
- output_frame,
- tmpProcessing );
- if ( error != IVAS_ERR_OK )
+ if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->splitTdRendWrappers[pos_idx - 1], ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, NULL,
+ ism_md_subframe_update_ext, output_frame, tmpProcessing ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -6190,6 +6149,7 @@ static ivas_error renderIsmToSplitBinaural(
/* Overwrite processing buffer with original input audio again */
copyBufferTo2dArray( ismInput->base.inputBuffer, tmpProcessing );
}
+
/* Restore original head rotation */
for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i )
{
@@ -6202,7 +6162,7 @@ static ivas_error renderIsmToSplitBinaural(
/* Encoding to split rendering bitstream done at a higher level */
return IVAS_ERR_OK;
}
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
+#endif
static void renderIsmToMasa(
@@ -6924,8 +6884,7 @@ static ivas_error renderMcToSplitBinaural(
/* copy input for in-place rotation */
- mvr2r( mcInput->base.inputBuffer.data, tmpRotBuffer.data,
- tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel );
+ mvr2r( mcInput->base.inputBuffer.data, tmpRotBuffer.data, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel );
/* perform rotation in source format to tmpRotBuffer */
pCombinedOrientationDataLocal = &combinedOrientationDataLocal;
@@ -6983,7 +6942,7 @@ static ivas_error renderMcToSplitBinaural(
return IVAS_ERR_OK;
}
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
+#endif
static ivas_error renderInputMc(
@@ -7154,10 +7113,8 @@ static ivas_error splitBinLc3plusDecode(
{
channel_ptrs[i] = outputBuffer[i];
}
- if ( ( error = IVAS_LC3PLUS_DEC_Decode( hSplitBin->hLc3plusDec,
- &bits->bits_buf[bits->bits_read / 8],
- lc3plusBitstreamSize,
- channel_ptrs ) ) != IVAS_ERR_OK )
+
+ if ( ( error = IVAS_LC3PLUS_DEC_Decode( hSplitBin->hLc3plusDec, &bits->bits_buf[bits->bits_read / 8], lc3plusBitstreamSize, channel_ptrs ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -7167,6 +7124,7 @@ static ivas_error splitBinLc3plusDecode(
return IVAS_ERR_OK;
}
+
static ivas_error renderSplitBinauralWithPostRot(
input_split_post_rend *splitBinInput,
IVAS_REND_AudioBuffer outAudio,
@@ -7196,8 +7154,7 @@ static ivas_error renderSplitBinauralWithPostRot(
if ( bits.codec == IVAS_SPLIT_REND_CODEC_LCLD && splitBinInput->splitPostRendWrapper.hSplitBinLCLDDec == NULL )
{
- error = ivas_splitBinLCLDDecOpen( &splitBinInput->splitPostRendWrapper.hSplitBinLCLDDec, *splitBinInput->base.ctx.pOutSampleRate, BINAURAL_CHANNELS );
- if ( error != IVAS_ERR_OK )
+ if ( ( error = ivas_splitBinLCLDDecOpen( &splitBinInput->splitPostRendWrapper.hSplitBinLCLDDec, *splitBinInput->base.ctx.pOutSampleRate, BINAURAL_CHANNELS ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -7210,12 +7167,11 @@ static ivas_error renderSplitBinauralWithPostRot(
config.channels = BINAURAL_CHANNELS;
config.samplerate = *splitBinInput->base.ctx.pOutSampleRate;
- error = IVAS_LC3PLUS_DEC_Open( config,
+ if ( ( error = IVAS_LC3PLUS_DEC_Open( config,
#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
- 0 /* caching disabled */,
+ 0 /* caching disabled */,
#endif
- &splitBinInput->splitPostRendWrapper.hLc3plusDec );
- if ( error != IVAS_ERR_OK )
+ &splitBinInput->splitPostRendWrapper.hLc3plusDec ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -7241,7 +7197,7 @@ static ivas_error renderSplitBinauralWithPostRot(
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
,
hSplitBin->hBinHrSplitPreRend
-#endif /* SPLIT_REND_WITH_HEAD_ROT_DEBUG */
+#endif
);
}
}
@@ -7258,8 +7214,7 @@ static ivas_error renderSplitBinauralWithPostRot(
}
else
{
- error = splitBinLc3plusDecode( hSplitBin, &bits, tmpCrendBuffer, bits.pose_correction );
- if ( error != IVAS_ERR_OK )
+ if ( ( error = splitBinLc3plusDecode( hSplitBin, &bits, tmpCrendBuffer, bits.pose_correction ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -7369,6 +7324,7 @@ static ivas_error renderSbaToMultiBinaural(
for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ )
{
IVAS_QUATERNION Quaternions_orig[RENDERER_HEAD_POSITIONS_PER_FRAME], Quaternions_abs;
+
for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ )
{
Quaternions_orig[i] = combinedOrientationDataLocal.Quaternions[i];
@@ -7384,20 +7340,19 @@ static ivas_error renderSbaToMultiBinaural(
/* copy input for in-place rotation */
- mvr2r( sbaInput->base.inputBuffer.data, tmpRotBuffer.data,
- tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel );
+ mvr2r( sbaInput->base.inputBuffer.data, tmpRotBuffer.data, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel );
pCombinedOrientationDataLocal = &combinedOrientationDataLocal;
- rotateFrameSba( sbaInput->base.inputBuffer,
- sbaInput->base.inConfig,
- sbaInput->base.ctx.pHeadRotData,
- &pCombinedOrientationDataLocal,
- sbaInput->rot_gains_prev[pos_idx],
- tmpRotBuffer );
+
+ if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, &pCombinedOrientationDataLocal, sbaInput->rot_gains_prev[pos_idx], tmpRotBuffer ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
copyBufferTo2dArray( tmpRotBuffer, tmpCrendBuffer );
assert( sbaInput->crendWrapper->hCrend[0]->hReverb == NULL );
+
/* call CREND */
if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, pos_idx ) ) != IVAS_ERR_OK )
{
@@ -7423,7 +7378,8 @@ static ivas_error renderSbaToMultiBinaural(
return IVAS_ERR_OK;
}
-static ivas_error renderSbaToMultiBinauralCldfb(
+
+static void renderSbaToMultiBinauralCldfb(
input_sba *sbaInput,
float Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
@@ -7434,16 +7390,9 @@ static ivas_error renderSbaToMultiBinauralCldfb(
copyBufferToCLDFBarray( sbaInput->base.inputBuffer, Cldfb_RealBuffer, Cldfb_ImagBuffer );
- ivas_rend_CldfbMultiBinRendProcess(
- sbaInput->cldfbRendWrapper.hCldfbRend,
- sbaInput->base.ctx.pCombinedOrientationData,
- &sbaInput->base.ctx.pSplitRendWrapper->multiBinPoseData,
- Cldfb_RealBuffer,
- Cldfb_ImagBuffer,
- Cldfb_Out_Real,
- Cldfb_Out_Imag,
- low_res_pre_rend_rot );
- return IVAS_ERR_OK;
+ ivas_rend_CldfbMultiBinRendProcess( sbaInput->cldfbRendWrapper.hCldfbRend, sbaInput->base.ctx.pCombinedOrientationData, &sbaInput->base.ctx.pSplitRendWrapper->multiBinPoseData, Cldfb_RealBuffer, Cldfb_ImagBuffer, Cldfb_Out_Real, Cldfb_Out_Imag, low_res_pre_rend_rot );
+
+ return;
}
static ivas_error renderSbaToSplitBinaural(
@@ -7464,19 +7413,17 @@ static ivas_error renderSbaToSplitBinaural(
if ( sbaInput->base.ctx.hhRendererConfig[0]->split_rend_config.rendererSelection == IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV )
{
+ renderSbaToMultiBinauralCldfb( sbaInput, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, low_res_pre_rend_rot );
- renderSbaToMultiBinauralCldfb( sbaInput,
- Cldfb_RealBuffer_Binaural,
- Cldfb_ImagBuffer_Binaural,
- low_res_pre_rend_rot );
accumulateCLDFBArrayToBuffer( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, &outAudio );
}
else
{
- renderSbaToMultiBinaural(
- sbaInput,
- outConfig,
- tmpCrendBuffer );
+ if ( ( renderSbaToMultiBinaural( sbaInput, outConfig, tmpCrendBuffer ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+
accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio );
}
@@ -7484,7 +7431,7 @@ static ivas_error renderSbaToSplitBinaural(
return error;
}
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
+#endif
static ivas_error renderSbaToBinaural(
@@ -7509,10 +7456,8 @@ static ivas_error renderSbaToBinaural(
float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
- renderSbaToMultiBinauralCldfb( sbaInput,
- Cldfb_RealBuffer_Binaural,
- Cldfb_ImagBuffer_Binaural,
- 0 );
+ renderSbaToMultiBinauralCldfb( sbaInput, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, 0 );
+
accumulateCLDFBArrayToBuffer( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, &outAudio );
}
else
@@ -7548,8 +7493,6 @@ static ivas_error renderSbaToBinaural(
if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData,
sbaInput->base.ctx.pCombinedOrientationData,
-
-
#ifdef SPLIT_REND_WITH_HEAD_ROT
sbaInput->rot_gains_prev[0],
#else
@@ -7823,6 +7766,7 @@ static ivas_error renderInputSba(
return error;
}
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
static ivas_error renderActiveInputsSplitBin(
IVAS_REND_HANDLE hIvasRend,
@@ -7850,7 +7794,8 @@ static ivas_error renderActiveInputsSplitBin(
return IVAS_ERR_OK;
}
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
+#endif
+
static ivas_error renderActiveInputsSba(
IVAS_REND_HANDLE hIvasRend,
@@ -8019,13 +7964,11 @@ static void renderMasaToBinaural(
copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hSpatParamRendCom );
ivas_dirac_dec_binaural( masaInput->decDummy, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, masaInput->base.inputBuffer.config.numChannels );
+
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( is_split_rend_mode )
{
- accumulateCLDFBArrayToBuffer(
- masaInput->decDummy->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural,
- masaInput->decDummy->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural,
- &outAudio );
+ accumulateCLDFBArrayToBuffer( masaInput->decDummy->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural, masaInput->decDummy->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural, &outAudio );
}
else
{
@@ -8225,10 +8168,10 @@ static ivas_error renderInputMasa(
// case AUDIO_CONFIG_BINAURAL_ROOM_IR:
// case AUDIO_CONFIG_BINAURAL_ROOM_REVERB:
// #else
- // case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM:
+ // case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM:
// #endif
- // renderMasaToBinauralRoom( masaInput, outConfig, outAudio );
- // break;
+ // renderMasaToBinauralRoom( masaInput, outConfig, outAudio );
+ // break;
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
case AUDIO_CONFIG_BINAURAL_SPLIT_CODED:
case AUDIO_CONFIG_BINAURAL_SPLIT_PCM:
@@ -8442,7 +8385,7 @@ ivas_error IVAS_REND_SetTotalNumberOfObjects(
*---------------------------------------------------------------------*/
ivas_error IVAS_REND_SetIsmMetadataDelay(
- IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */
+ IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */
const float sync_md_delay /* i : Ism Metadata Delay in ms to sync with audio delay */
)
{
@@ -8627,7 +8570,7 @@ ivas_error IVAS_REND_GetSamples(
hIvasRend->numClipping +=
#endif
limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD );
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
+#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
@@ -8665,24 +8608,25 @@ ivas_error IVAS_REND_GetSamples(
/* Encode split rendering bitstream */
convertBitsBufferToInternalBitsBuff( *hBits, &bits );
- error = ivas_renderMultiBinToSplitBinaural( &hIvasRend->splitRendWrapper,
- hIvasRend->headRotData.headPositions,
- hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate,
- hIvasRend->hRendererConfig->split_rend_config.codec,
- &bits,
- Cldfb_RealBuffer_Binaural,
- Cldfb_ImagBuffer_Binaural,
- ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ),
- tmpBinaural,
- 1,
- td_input,
- ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 );
- if ( error != IVAS_ERR_OK )
+
+ if ( ( error = ivas_renderMultiBinToSplitBinaural( &hIvasRend->splitRendWrapper,
+ hIvasRend->headRotData.headPositions,
+ hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate,
+ hIvasRend->hRendererConfig->split_rend_config.codec,
+ &bits,
+ Cldfb_RealBuffer_Binaural,
+ Cldfb_ImagBuffer_Binaural,
+ ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ),
+ tmpBinaural,
+ 1,
+ td_input,
+ ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK )
{
return error;
}
convertInternalBitsBuffToBitsBuffer( hBits, bits );
+
outAudio = outAudioOrig;
if ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
@@ -8694,7 +8638,7 @@ ivas_error IVAS_REND_GetSamples(
#endif
}
}
-#endif /* SPLIT_REND_WITH_HEAD_ROT */
+#endif
return IVAS_ERR_OK;
}
@@ -8755,6 +8699,7 @@ void IVAS_REND_Close(
ivas_limiter_close( &hIvasRend->hLimiter );
#ifdef SPLIT_REND_WITH_HEAD_ROT
+ /* Split binaural rendering */
closeSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer );
#endif
diff --git a/lib_util/split_rend_bfi_file_reader.c b/lib_util/split_rend_bfi_file_reader.c
index 1eab6652674ef9a38c4d4f8a93df494f626cd2a6..64ec04738e36a3d8d0049f428e2a79376cf9240f 100644
--- a/lib_util/split_rend_bfi_file_reader.c
+++ b/lib_util/split_rend_bfi_file_reader.c
@@ -1,6 +1,6 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -56,8 +56,8 @@ struct SplitRendBFIFileReader
*-----------------------------------------------------------------------*/
ivas_error SplitRendBFIFileReader_open(
- char *bfiFilePath, /* i : frame loss file name */
- SplitRendBFIFileReader **SplitRendBFIReader /* o : SplitRendBFIFileReader handle */
+ char *bfiFilePath, /* i : frame loss file name */
+ SplitRendBFIFileReader **SplitRendBFIReader /* o : SplitRendBFIFileReader handle */
)
{
SplitRendBFIFileReader *self;
diff --git a/lib_util/split_rend_bfi_file_reader.h b/lib_util/split_rend_bfi_file_reader.h
index fc0a530ddcb5cdc78f3d5eb4b3a63bb49aeb7e35..341ef3ed657bab7c6a1f7fd9a9836c36d60106bb 100644
--- a/lib_util/split_rend_bfi_file_reader.h
+++ b/lib_util/split_rend_bfi_file_reader.h
@@ -1,6 +1,6 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -33,27 +33,26 @@
#ifndef IVAS_SR_BFI_FILE_READER_H
#define IVAS_SR_BFI_FILE_READER_H
-#ifdef SPLIT_REND_WITH_HEAD_ROT
#include "common_api_types.h"
-
+#ifdef SPLIT_REND_WITH_HEAD_ROT
typedef struct SplitRendBFIFileReader SplitRendBFIFileReader;
ivas_error SplitRendBFIFileReader_open(
- char *trajFilePath, /* i : head rotation trajectory file name */
- SplitRendBFIFileReader **SplitRendBFIReader /* o : SplitRendBFIFileReader handle */
+ char *trajFilePath, /* i : head rotation trajectory file name */
+ SplitRendBFIFileReader **SplitRendBFIReader /* o : SplitRendBFIFileReader handle */
);
ivas_error SplitRendBFIFileReading(
- SplitRendBFIFileReader *SplitRendBFIReader, /* i/o: SplitRendBFIFileReader handle */
+ SplitRendBFIFileReader *SplitRendBFIReader, /* i/o: SplitRendBFIFileReader handle */
int16_t *bfi );
void SplitRendBFIFileReader_close(
- SplitRendBFIFileReader **SplitRendBFIReader /* i/o: SplitRendBFIFileReader handle */
+ SplitRendBFIFileReader **SplitRendBFIReader /* i/o: SplitRendBFIFileReader handle */
);
const char *SplitRendBFIFileReader_getFilePath(
- SplitRendBFIFileReader *SplitRendBFIReader /* i/o: SplitRendBFIFileReader handle */
+ SplitRendBFIFileReader *SplitRendBFIReader /* i/o: SplitRendBFIFileReader handle */
);
diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c
index 36902b91ec2163adee2a247c873a5f506b8e71b3..215d3d32c6bcc1cfd0c52f8bbc079a5c7c244f60 100644
--- a/lib_util/split_render_file_read_write.c
+++ b/lib_util/split_render_file_read_write.c
@@ -1,6 +1,6 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -42,9 +42,11 @@
#include "prot.h"
#include "ivas_cnst.h"
+
/*------------------------------------------------------------------------------------------*
* PreProc Macros
*------------------------------------------------------------------------------------------*/
+
#define SPLIT_RENDERER_FRAME_HEADER_LEN ( 12 )
/*------------------------------------------------------------------------------------------*
@@ -60,21 +62,28 @@ struct SplitFileReadWrite
/*-----------------------------------------------------------------------------------------*
* Function split_rend_reader_open()
+ *
* open in read mode
*-----------------------------------------------------------------------------------------*/
-ivas_error split_rend_reader_open( SplitFileReadWrite **hhSplitRendFileReadWrite, char *filename )
+
+ivas_error split_rend_reader_open(
+ SplitFileReadWrite **hhSplitRendFileReadWrite,
+ char *filename )
{
SplitFileReadWrite *hSplitRendFileReadWrite;
size_t header_len, h;
char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "MAIN_SPLITH";
char header_read[SPLIT_RENDERER_FRAME_HEADER_LEN];
- hSplitRendFileReadWrite = (SplitFileReadWrite *) malloc( sizeof( SplitFileReadWrite ) );
+ if ( ( hSplitRendFileReadWrite = (SplitFileReadWrite *) malloc( sizeof( SplitFileReadWrite ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for split rendering writer\n" ) );
+ }
+
hSplitRendFileReadWrite->file = fopen( filename, "rb" );
if ( hSplitRendFileReadWrite->file == NULL )
{
- fprintf( stderr, "Could not open split rend metadata file %s\n", filename );
- exit( -1 );
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "\nCould not open split rend metadata file %s\n", filename ) );
}
header_len = strlen( header );
@@ -87,23 +96,31 @@ ivas_error split_rend_reader_open( SplitFileReadWrite **hhSplitRendFileReadWrite
return IVAS_ERR_FAILED_FILE_READ;
}
}
+
if ( strncmp( header_read, header, header_len ) )
{
- fprintf( stderr, "Error split rend bitstream main header mismatch\n" );
- return IVAS_ERR_FAILED_FILE_READ;
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "\nError split rend bitstream main header mismatch\n" ) );
}
fread( &hSplitRendFileReadWrite->delay_ns, sizeof( uint32_t ), 1, hSplitRendFileReadWrite->file );
*hhSplitRendFileReadWrite = hSplitRendFileReadWrite;
+
return IVAS_ERR_OK;
}
+
/*-----------------------------------------------------------------------------------------*
* Function split_rend_writer_open()
+ *
* open in write mode
*-----------------------------------------------------------------------------------------*/
-ivas_error split_rend_writer_open( SplitFileReadWrite **hhSplitRendFileReadWrite, char *filename, int16_t delayNumSamples, int32_t delayTimeScale )
+
+ivas_error split_rend_writer_open(
+ SplitFileReadWrite **hhSplitRendFileReadWrite,
+ char *filename,
+ const int16_t delayNumSamples,
+ const int32_t delayTimeScale )
{
SplitFileReadWrite *hSplitRendFileReadWrite;
size_t header_len, h;
@@ -114,17 +131,20 @@ ivas_error split_rend_writer_open( SplitFileReadWrite **hhSplitRendFileReadWrite
return IVAS_ERR_UNEXPECTED_NULL_POINTER;
}
- hSplitRendFileReadWrite = (SplitFileReadWrite *) malloc( sizeof( SplitFileReadWrite ) );
+ if ( ( hSplitRendFileReadWrite = (SplitFileReadWrite *) malloc( sizeof( SplitFileReadWrite ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for split rendering writer\n" ) );
+ }
+
hSplitRendFileReadWrite->file = fopen( filename, "wb" );
if ( hSplitRendFileReadWrite->file == NULL )
{
- fprintf( stderr, "Could not open split rend metadata file %s\n", filename );
- exit( -1 );
+ return IVAS_ERR_FAILED_FILE_OPEN;
}
header_len = strlen( header );
- /*read frame header*/
+ /* write frame header */
for ( h = 0; h < header_len; h++ )
{
if ( fwrite( &header[h], sizeof( char ), 1, hSplitRendFileReadWrite->file ) != 1 )
@@ -136,10 +156,19 @@ ivas_error split_rend_writer_open( SplitFileReadWrite **hhSplitRendFileReadWrite
fwrite( &hSplitRendFileReadWrite->delay_ns, sizeof( int32_t ), 1, hSplitRendFileReadWrite->file );
*hhSplitRendFileReadWrite = hSplitRendFileReadWrite;
+
return IVAS_ERR_OK;
}
-ivas_error split_rend_reader_writer_close( SplitFileReadWrite **hhSplitRendFileReadWrite )
+
+/*-----------------------------------------------------------------------------------------*
+ * Function split_rend_reader_writer_close()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
+ivas_error split_rend_reader_writer_close(
+ SplitFileReadWrite **hhSplitRendFileReadWrite )
{
if ( ( *hhSplitRendFileReadWrite ) != NULL )
{
@@ -148,12 +177,21 @@ ivas_error split_rend_reader_writer_close( SplitFileReadWrite **hhSplitRendFileR
fclose( ( *hhSplitRendFileReadWrite )->file );
( *hhSplitRendFileReadWrite )->file = NULL;
}
+
free( *hhSplitRendFileReadWrite );
*hhSplitRendFileReadWrite = NULL;
}
+
return IVAS_ERR_OK;
}
+
+/*-----------------------------------------------------------------------------------------*
+ * Function split_rend_write_bitstream_to_file()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
ivas_error split_rend_write_bitstream_to_file(
SplitFileReadWrite *hSplitRendFileReadWrite,
uint8_t *bits,
@@ -178,7 +216,7 @@ ivas_error split_rend_write_bitstream_to_file(
header_len = strlen( header );
- /*write frame header*/
+ /* write frame header */
for ( i = 0; i < header_len; i++ )
{
if ( fwrite( &header[i], sizeof( char ), 1, hSplitRendFileReadWrite->file ) != 1 )
@@ -198,13 +236,14 @@ ivas_error split_rend_write_bitstream_to_file(
{
return IVAS_ERR_FAILED_FILE_WRITE;
}
+
/* Write pose correction signalling */
if ( fwrite( &poseCorrection, sizeof( poseCorrection ), 1, hSplitRendFileReadWrite->file ) != 1 )
{
return IVAS_ERR_FAILED_FILE_WRITE;
}
- /*write num bytes*/
+ /* write num bytes */
if ( fwrite( bits_written, sizeof( int32_t ), 1, hSplitRendFileReadWrite->file ) != 1 )
{
return IVAS_ERR_FAILED_FILE_WRITE;
@@ -222,6 +261,13 @@ ivas_error split_rend_write_bitstream_to_file(
return IVAS_ERR_OK;
}
+
+/*-----------------------------------------------------------------------------------------*
+ * Function split_rend_read_bits_from_file()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
ivas_error split_rend_read_bits_from_file(
SplitFileReadWrite *hSplitRendFileReadWrite,
uint8_t *bits,
@@ -247,7 +293,7 @@ ivas_error split_rend_read_bits_from_file(
header_len = strlen( header );
- /*read frame header*/
+ /* read frame header */
for ( i = 0; i < header_len; i++ )
{
if ( fread( &header_read[i], sizeof( char ), 1, hSplitRendFileReadWrite->file ) != 1 )
@@ -255,6 +301,7 @@ ivas_error split_rend_read_bits_from_file(
return IVAS_ERR_END_OF_FILE;
}
}
+
if ( strncmp( header_read, header, header_len ) )
{
fprintf( stderr, "Error bitstream frame header mismatch\n" );
@@ -277,13 +324,14 @@ ivas_error split_rend_read_bits_from_file(
{
return IVAS_ERR_FAILED_FILE_READ;
}
+
/* read pose correction signalling */
if ( fread( poseCorrection, sizeof( *poseCorrection ), 1, hSplitRendFileReadWrite->file ) != 1 )
{
return IVAS_ERR_FAILED_FILE_READ;
}
- /*write num bytes*/
+ /* write num bytes */
if ( fread( &bit_len, sizeof( int32_t ), 1, hSplitRendFileReadWrite->file ) != 1 )
{
return IVAS_ERR_FAILED_FILE_READ;
@@ -305,13 +353,24 @@ ivas_error split_rend_read_bits_from_file(
return IVAS_ERR_OK;
}
-ivas_error split_rend_read_pre_rend_delay_ns( SplitFileReadWrite *hSplitRendFileReadWrite, uint32_t *delay_ns )
+
+/*-----------------------------------------------------------------------------------------*
+ * Function split_rend_read_pre_rend_delay_ns()
+ *
+ *
+ *-----------------------------------------------------------------------------------------*/
+
+ivas_error split_rend_read_pre_rend_delay_ns(
+ SplitFileReadWrite *hSplitRendFileReadWrite,
+ uint32_t *delay_ns )
{
if ( hSplitRendFileReadWrite == NULL )
{
return IVAS_ERR_FAILED_FILE_READ;
}
+
*delay_ns = hSplitRendFileReadWrite->delay_ns;
+
return IVAS_ERR_OK;
}
#endif /* SPLIT_REND_WITH_HEAD_ROT */
diff --git a/lib_util/split_render_file_read_write.h b/lib_util/split_render_file_read_write.h
index 29ca49aad7273d785182683e47c0d72485d13149..3f523eb87d44181cfde087cf49b7f8869b9179ec 100644
--- a/lib_util/split_render_file_read_write.h
+++ b/lib_util/split_render_file_read_write.h
@@ -1,6 +1,6 @@
/******************************************************************************************************
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -33,24 +33,25 @@
#ifndef SPLIT_RENDER_FILE_READ_WRITE_H
#define SPLIT_RENDER_FILE_READ_WRITE_H
-#ifdef SPLIT_REND_WITH_HEAD_ROT
#include "common_api_types.h"
-
+#ifdef SPLIT_REND_WITH_HEAD_ROT
typedef struct SplitFileReadWrite SplitFileReadWrite;
-/* Allocates and initializes a a split renderer reader instance */
-ivas_error split_rend_reader_open( SplitFileReadWrite **hhSplitRendFileReadWrite, char *filename );
+/* Allocates and initializes a a split renderer reader instance */
+ivas_error split_rend_reader_open(
+ SplitFileReadWrite **hhSplitRendFileReadWrite,
+ char *filename );
-/* Allocates and initializes a a split renderer writer instance */
+/* Allocates and initializes a a split renderer writer instance */
ivas_error split_rend_writer_open(
SplitFileReadWrite **hhSplitRendFileReadWrite,
char *filename,
- int16_t delayNumSamples,
- int32_t delayTimeScale );
+ const int16_t delayNumSamples,
+ const int32_t delayTimeScale );
-/* Closes the split renderer reader/writer and deallocates memory */
+/* Closes the split renderer reader/writer and deallocates memory */
ivas_error split_rend_reader_writer_close( SplitFileReadWrite **hhSplitRendFileReadWrite );
/*write split rend coded bitstream to file */
diff --git a/readme.txt b/readme.txt
index 020f4929f79ffab290f3b850875aad456d21e197..aaa04389a78f93280c23c04a535f0358558b1f88 100644
--- a/readme.txt
+++ b/readme.txt
@@ -237,15 +237,15 @@ Usage for IVAS: IVAS_dec.exe [Options] OutputConf Fs bitstream_file output_file
Mandatory parameters:
---------------------
-OutputConf : Output configuration: MONO, STEREO, 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4, FOA,
+OutputConf : Output configuration: MONO, STEREO, 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4, FOA,
HOA2, HOA3, BINAURAL, BINAURAL_ROOM_IR, BINAURAL_ROOM_REVERB, EXT
- By default, channel order and loudspeaker positions are equal to the
- encoder. For loudspeaker outputs, OutputConf can be a custom loudspeaker
- layout file. See below for details.
- Parameter is only used when decoding IVAS bitstream.
-Fs : Output sampling rate in kHz (8, 16, 32 or 48)
-bitstream_file : Input bitstream filename or RTP packet filename (in VOIP mode)
-output_file : Output audio filename
+ By default, channel order and loudspeaker positions are equal to the
+ encoder. For loudspeaker outputs, OutputConf can be a custom loudspeaker
+ layout file. See below for details.
+ Parameter is only used when decoding IVAS bitstream.
+Fs : Output sampling rate in kHz (8, 16, 32 or 48)
+bitstream_file : Input bitstream filename or RTP packet filename (in VOIP mode)
+output_file : Output audio filename
Options:
--------
@@ -276,6 +276,7 @@ Options:
-rvf File : Reference vector specified by external trajectory File
works only in combination with '-otr ref_vec' and 'ref_vec_lev' modes
-render_config File : Renderer configuration option with parameters specified in File
+-om File : Metadata output File for BINAURAL_SPLIT_PCM OutputConf
-non_diegetic_pan P : panning mono non-diegetic sound to stereo -90<= P <=90,
left or l or 90->left, right or r or -90->right, center or c or 0->middle
-exof File : External orientation trajectory File for simulation of external orientations
@@ -307,14 +308,14 @@ Options:
-hrtf File : Custom HRTF File for binaural rendering (only for binaural outputs)
-rc File : Binaural renderer configuration File (only for binaural outputs)
-ndp P : Panning mono non-diegetic sound to stereo -90<= P <= 90
- left or l or 90->left, right or r or -90->right, center or c or 0 ->middle
+ left or l or 90->left, right or r or -90->right, center or c or 0 ->middle
-otr tracking_type : Head orientation tracking type: 'none', 'ref', 'avg' or `ref_vec` or `ref_vec_lev` (only for binaural outputs)
-lp Position : Output LFE position. Comma-delimited triplet of [gain, azimuth, elevation] where gain is linear
(like --gain, -g) and azimuth, elevation are in degrees.
- If specified, overrides the default behavior which attempts to map input to output LFE channel(s)
+ If specified, overrides the default behavior which attempts to map input to output LFE channel(s)
-lm File : LFE panning matrix File (CSV table) containing a matrix of dimensions
[ num_input_lfe x num_output_channels ] with elements specifying linear routing gain (like --gain, -g).
- If specified, overrides the output LFE position option and the default behavior which attempts to map input to output LFE channel(s)
+ If specified, overrides the output LFE position option and the default behavior which attempts to map input to output LFE channel(s)
-ndc : Turn off delay compensation
-g : Input gain (linear, not in dB) to be applied to input audio file
-l : List supported audio formats
diff --git a/scripts/prepare_delivery.sh b/scripts/prepare_delivery.sh
index 4128abd3de4af5259d110471f7730654713ab30c..17bae7e4475b355c97bb85fe1746ac2447ff9daf 100755
--- a/scripts/prepare_delivery.sh
+++ b/scripts/prepare_delivery.sh
@@ -145,23 +145,14 @@ if [ $STRIP_SPLITREND -ne 0 ]; then
# remove other split rendering files
declare -a sr_files_rend=(
- "lib_rend/ivas_CQMFDecoder.c"
- "lib_rend/ivas_CQMFDecoder.h"
- "lib_rend/ivas_CQMFEncoder.c"
- "lib_rend/ivas_CQMFEncoder.h"
+ "lib_rend/ivas_lcld_decoder.c"
+ "lib_rend/ivas_lcld_encoder.c"
"lib_rend/ivas_MSPred.c"
- "lib_rend/ivas_MSPred.h"
"lib_rend/ivas_NoiseGen.c"
- "lib_rend/ivas_NoiseGen.h"
"lib_rend/ivas_PerceptualModel.c"
- "lib_rend/ivas_PerceptualModel.h"
"lib_rend/ivas_PredDecoder.c"
- "lib_rend/ivas_PredDecoder.h"
"lib_rend/ivas_PredEncoder.c"
- "lib_rend/ivas_PredEncoder.h"
- "lib_rend/ivas_PredTables.h"
"lib_rend/ivas_RMSEnvGrouping.c"
- "lib_rend/ivas_RMSEnvGrouping.h"
"lib_rend/ivas_cldfb_codec_bitstream.c"
"lib_rend/ivas_cldfb_codec_bitstream.h"
"lib_rend/ivas_lc3plus_common.c"
@@ -170,8 +161,8 @@ if [ $STRIP_SPLITREND -ne 0 ]; then
"lib_rend/ivas_lc3plus_dec.h"
"lib_rend/ivas_lc3plus_enc.c"
"lib_rend/ivas_lc3plus_enc.h"
- "lib_rend/ivas_lcld_tables.c"
- "lib_rend/ivas_lcld_tables.h"
+ "lib_rend/ivas_lcld_rom_tables.c"
+ "lib_rend/ivas_lcld_rom_tables.h"
"lib_rend/ivas_splitRend_lcld_dec.c"
"lib_rend/ivas_splitRend_lcld_enc.c"
"lib_rend/ivas_splitRendererPLC.c"
@@ -452,7 +443,6 @@ find $OUTDIR/lib_com $OUTDIR/lib_dec $OUTDIR/lib_enc -name "*.[ch]" -exec perl -
find $OUTDIR/lib_com $OUTDIR/lib_dec $OUTDIR/lib_enc -name "*.[ch]" -exec perl -i.bak -pe 's#/\*\s*Variable not present in the floating point.*/?\*/##sg' \{\} \;
find $OUTDIR/lib_com $OUTDIR/lib_dec $OUTDIR/lib_enc -name "*.[ch]" -exec perl -i.bak -pe 's#/\*.* ERI.*/?\*/$##isg' \{\} \;
find $OUTDIR/lib_com $OUTDIR/lib_dec $OUTDIR/lib_enc -name "*.[ch]" -exec perl -i.bak -pe 's#/\*.* FHG.*/?\*/$##isg' \{\} \;
-find $OUTDIR/lib_com $OUTDIR/lib_dec $OUTDIR/lib_enc -name "*.[ch]" -exec perl -i.bak -pe 's#/\*.* VE2FHG.*/?\*/$##isg' \{\} \;
find $OUTDIR/lib_com $OUTDIR/lib_dec $OUTDIR/lib_enc -name "*.[ch]" -exec perl -i.bak -pe 's#/\*.* HUA.*/?\*/$##isg' \{\} \;
find $OUTDIR/lib_com $OUTDIR/lib_dec $OUTDIR/lib_enc -name "*.[ch]" -exec perl -i.bak -pe 's#/\*.* HW.*/?\*/$##isg' \{\} \;
find $OUTDIR/lib_com $OUTDIR/lib_dec $OUTDIR/lib_enc -name "*.[ch]" -exec perl -i.bak -pe 's#/\*.* NOK.*/?\*/$##isg' \{\} \;
diff --git a/scripts/strip_split_rendering.py b/scripts/strip_split_rendering.py
index fd286ced901aa820d7b8964ab36ac7147ed3b680..3f98db24198c7ae2ad228c20719e8c97f09df841 100644
--- a/scripts/strip_split_rendering.py
+++ b/scripts/strip_split_rendering.py
@@ -32,25 +32,14 @@
# remove other split rendering files
sr_files_rend=[
- "lib_rend\\ivas_CQMFDecoder.c"
- "lib_rend\\ivas_CQMFDecoder.h",
- "lib_rend\\ivas_CQMFDecoder.c",
- "lib_rend\\ivas_CQMFDecoder.h",
- "lib_rend\\ivas_CQMFEncoder.c",
- "lib_rend\\ivas_CQMFEncoder.h",
+ "lib_rend\\ivas_lcld_decoder.c",
+ "lib_rend\\ivas_lcld_encoder.c",
"lib_rend\\ivas_MSPred.c",
- "lib_rend\\ivas_MSPred.h",
"lib_rend\\ivas_NoiseGen.c",
- "lib_rend\\ivas_NoiseGen.h",
"lib_rend\\ivas_PerceptualModel.c",
- "lib_rend\\ivas_PerceptualModel.h",
"lib_rend\\ivas_PredDecoder.c",
- "lib_rend\\ivas_PredDecoder.h",
"lib_rend\\ivas_PredEncoder.c",
- "lib_rend\\ivas_PredEncoder.h",
- "lib_rend\\ivas_PredTables.h",
"lib_rend\\ivas_RMSEnvGrouping.c",
- "lib_rend\\ivas_RMSEnvGrouping.h",
"lib_rend\\ivas_cldfb_codec_bitstream.c",
"lib_rend\\ivas_cldfb_codec_bitstream.h",
"lib_rend\\ivas_lc3plus_common.c",
@@ -59,8 +48,8 @@ sr_files_rend=[
"lib_rend\\ivas_lc3plus_dec.h",
"lib_rend\\ivas_lc3plus_enc.c",
"lib_rend\\ivas_lc3plus_enc.h",
- "lib_rend\\ivas_lcld_tables.c",
- "lib_rend\\ivas_lcld_tables.h",
+ "lib_rend/ivas_lcld_rom_tables.c"
+ "lib_rend/ivas_lcld_rom_tables.h"
"lib_rend\\ivas_splitRend_lcld_dec.c",
"lib_rend\\ivas_splitRend_lcld_enc.c",
"lib_rend\\ivas_splitRendererPLC.c",
diff --git a/scripts/strip_split_rendering.sh b/scripts/strip_split_rendering.sh
index f202d837e3d55bcca4cf6bf3ee867eb0993c02b0..12d1d6b3a1b5f4f5e65857ac592e5b64f03a0d11 100644
--- a/scripts/strip_split_rendering.sh
+++ b/scripts/strip_split_rendering.sh
@@ -38,23 +38,14 @@ rm -R $OUTDIR/lc3plus
# remove other split rendering files
declare -a sr_files_rend=(
- "lib_rend/ivas_CQMFDecoder.c"
- "lib_rend/ivas_CQMFDecoder.h"
- "lib_rend/ivas_CQMFEncoder.c"
- "lib_rend/ivas_CQMFEncoder.h"
+ "lib_rend/ivas_lcld_decoder.c"
+ "lib_rend/ivas_lcld_encoder.c"
"lib_rend/ivas_MSPred.c"
- "lib_rend/ivas_MSPred.h"
"lib_rend/ivas_NoiseGen.c"
- "lib_rend/ivas_NoiseGen.h"
"lib_rend/ivas_PerceptualModel.c"
- "lib_rend/ivas_PerceptualModel.h"
"lib_rend/ivas_PredDecoder.c"
- "lib_rend/ivas_PredDecoder.h"
"lib_rend/ivas_PredEncoder.c"
- "lib_rend/ivas_PredEncoder.h"
- "lib_rend/ivas_PredTables.h"
"lib_rend/ivas_RMSEnvGrouping.c"
- "lib_rend/ivas_RMSEnvGrouping.h"
"lib_rend/ivas_cldfb_codec_bitstream.c"
"lib_rend/ivas_cldfb_codec_bitstream.h"
"lib_rend/ivas_lc3plus_common.c"
@@ -63,8 +54,8 @@ declare -a sr_files_rend=(
"lib_rend/ivas_lc3plus_dec.h"
"lib_rend/ivas_lc3plus_enc.c"
"lib_rend/ivas_lc3plus_enc.h"
- "lib_rend/ivas_lcld_tables.c"
- "lib_rend/ivas_lcld_tables.h"
+ "lib_rend/ivas_lcld_rom_tables.c"
+ "lib_rend/ivas_lcld_rom_tables.h"
"lib_rend/ivas_splitRend_lcld_dec.c"
"lib_rend/ivas_splitRend_lcld_enc.c"
"lib_rend/ivas_splitRendererPLC.c"