From aa596442e8c28f5a535465e59483ea7fd22ff87a Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 28 Oct 2025 18:26:10 +0100 Subject: [PATCH 1/3] update LC3plus includes from lc3.h to lc3plus.h --- scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test.c | 2 +- scripts/split_rendering/lc3plus_float/ivas_lc3plus_unit_test.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test.c b/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test.c index 1bba6af9d4..0952d9a661 100644 --- a/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test.c +++ b/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test.c @@ -39,7 +39,7 @@ the United Nations Convention on Contracts on the International Sales of Goods. #include "isar_lc3plus_dec.h" #include "ivas_error_utils.h" #ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS -#include "lc3.h" +#include "lc3plus.h" #endif #ifdef SPLIT_REND_WITH_HEAD_ROT diff --git a/scripts/split_rendering/lc3plus_float/ivas_lc3plus_unit_test.c b/scripts/split_rendering/lc3plus_float/ivas_lc3plus_unit_test.c index d2becedec9..c15f14b4cc 100644 --- a/scripts/split_rendering/lc3plus_float/ivas_lc3plus_unit_test.c +++ b/scripts/split_rendering/lc3plus_float/ivas_lc3plus_unit_test.c @@ -38,7 +38,7 @@ the United Nations Convention on Contracts on the International Sales of Goods. #include "isar_lc3plus_common.h" #include "isar_lc3plus_dec.h" #include "ivas_error_utils.h" -#include "lc3.h" +#include "lc3plus.h" #define MAX_SAMPLES_PER_CHANNEL 960 / 4 #define DEFAULT_BPS 256000 -- GitLab From 686954ce1714c9fe612d2285471d4051b89a2a86 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 28 Oct 2025 18:55:58 +0100 Subject: [PATCH 2/3] strip already accepted defines missed out from LC3plus BASOP unit test files --- .../lc3plus_basop/ivas_lc3plus_unit_test.c | 146 ------------------ .../ivas_lc3plus_unit_test_payload_format.c | 2 - 2 files changed, 148 deletions(-) diff --git a/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test.c b/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test.c index 0952d9a661..7cdda56342 100644 --- a/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test.c +++ b/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test.c @@ -38,16 +38,9 @@ the United Nations Convention on Contracts on the International Sales of Goods. #include "isar_lc3plus_common.h" #include "isar_lc3plus_dec.h" #include "ivas_error_utils.h" -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS #include "lc3plus.h" -#endif -#ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS #define MAX_SAMPLES_PER_CHANNEL 960 / 4 -#else -#define MAX_SAMPLES_PER_CHANNEL 960 -#endif #define DEFAULT_BPS 256000 #ifndef PCM_SAMPLE_TYPEDEF_DEFINED @@ -100,7 +93,6 @@ static int encodeAndDecodeOneStereoFrame( LC3PLUS_CONFIG config, uint32_t bps ) uint8_t *bitstream_out = malloc( bitstreamSizePerIvasFrame ); memset( bitstream_out, 0, bitstreamSizePerIvasFrame ); -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS int perChannelBitrate = lc3plus_enc_get_real_bitrate(encHandle->handles[0]); int perLc3plusFrameDataBlockOctets = encHandle->num_ftds * perChannelBitrate / 8 / (1000*1000/config.lc3plus_frame_duration_us); int targetOctets = bps / 8 / (1000*1000/config.isar_frame_duration_us); @@ -118,9 +110,6 @@ static int encodeAndDecodeOneStereoFrame( LC3PLUS_CONFIG config, uint32_t bps ) Word16 Q_in[16]; memset(Q_in, 0, sizeof(Q_in) ); err = ISAR_LC3PLUS_ENC_Encode( encHandle, pcm_in, bitstream_out, bitstreamSizePerIvasFrame, Q_in ); -#else - err = ISAR_LC3PLUS_ENC_Encode( encHandle, pcm_in, bitstream_out ); -#endif if ( IVAS_ERR_OK != err ) { ISAR_LC3PLUS_ENC_Close( &encHandle ); @@ -200,11 +189,7 @@ static int encodeAndDecodeOneStereoFrame( LC3PLUS_CONFIG config, uint32_t bps ) static int openCloseEncoder( void ) { ivas_error err; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .isar_frame_duration_us = 5000, .channels = 1, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; -#endif uint32_t bps = 128000; ISAR_LC3PLUS_ENC_HANDLE encHandle; @@ -221,36 +206,23 @@ static int openCloseEncoder( void ) static int tryOpenEncoderWithInvalidBitrate( void ) { ivas_error err; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .isar_frame_duration_us = 5000, .channels = 1, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; -#endif /* lc3plus max bitrate is 320000 per channel */ uint32_t invalid_high_bps = 700000; uint32_t invalid_low_bps = 8; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS uint32_t limitedBitrate; -#endif ISAR_LC3PLUS_ENC_HANDLE encHandle; err = ISAR_LC3PLUS_ENC_Open( config, invalid_high_bps, &encHandle ); -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS /* setting an invalid bitrate should result in a limited bitrate*/ if ( IVAS_ERR_OK != err ) -#else - /* setting an invalid bitrate should trigger an error - which is what we expect */ - if ( IVAS_ERR_LC3PLUS_INVALID_BITRATE != err ) -#endif { return 1; } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS limitedBitrate = lc3plus_enc_get_real_bitrate(encHandle->handles[0]); if(limitedBitrate != 320000) { return 1; } -#endif ISAR_LC3PLUS_ENC_Close(&encHandle); err = ISAR_LC3PLUS_ENC_Open( config, invalid_low_bps, &encHandle ); /* setting an invalid bitrate should trigger an error - which is what we expect */ @@ -265,11 +237,7 @@ static int tryOpenEncoderWithInvalidBitrate( void ) static int tryOpenEncoderWithInvalidFrameDuration( void ) { ivas_error err; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .isar_frame_duration_us = 5000, .channels = 1, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; -#endif config.lc3plus_frame_duration_us = 1234; /*unsupported frame duration*/ uint32_t bps = 320000; @@ -286,11 +254,7 @@ static int tryOpenEncoderWithInvalidFrameDuration( void ) static int tryOpenEncoderWithInvalidSampleRate( void ) { ivas_error err; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .isar_frame_duration_us = 5000, .channels = 1, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; -#endif config.samplerate = 1234; /*unsupported sample rate */ uint32_t bps = 320000; @@ -330,22 +294,14 @@ static int tryCallEncoderApiWithInvalidParams( void ) return 1; } ISAR_LC3PLUS_ENC_Close( &invalidEncHandle ); -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS Word16 Q_in[16]; memset(Q_in, 0, sizeof(Q_in) ); if ( IVAS_ERR_UNEXPECTED_NULL_POINTER != ISAR_LC3PLUS_ENC_Encode( invalidEncHandle, invalidPcm_in, invalidBitstream_out, bsSize, Q_in ) ) -#else - if ( IVAS_ERR_UNEXPECTED_NULL_POINTER != ISAR_LC3PLUS_ENC_Encode( invalidEncHandle, invalidPcm_in, invalidBitstream_out ) ) -#endif { return 1; } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS memset(Q_in, 0, sizeof(Q_in) ); if ( IVAS_ERR_UNEXPECTED_NULL_POINTER != ISAR_LC3PLUS_ENC_Encode( invalidEncHandle, pcm_in, invalidBitstream_out, bsSize, Q_in) || IVAS_ERR_UNEXPECTED_NULL_POINTER != ISAR_LC3PLUS_ENC_Encode( invalidEncHandle, invalidPcm_in, bitstream_out, bsSize, Q_in ) || IVAS_ERR_UNEXPECTED_NULL_POINTER != ISAR_LC3PLUS_ENC_Encode( invalidEncHandle, pcm_in, bitstream_out, bsSize, Q_in ) ) -#else - if ( IVAS_ERR_UNEXPECTED_NULL_POINTER != ISAR_LC3PLUS_ENC_Encode( invalidEncHandle, pcm_in, invalidBitstream_out ) || IVAS_ERR_UNEXPECTED_NULL_POINTER != ISAR_LC3PLUS_ENC_Encode( invalidEncHandle, invalidPcm_in, bitstream_out ) || IVAS_ERR_UNEXPECTED_NULL_POINTER != ISAR_LC3PLUS_ENC_Encode( invalidEncHandle, pcm_in, bitstream_out ) ) -#endif { return 1; } @@ -391,11 +347,7 @@ static int tryCallDecoderApiWithInvalidParams( void ) static int openCloseDecoderWithCaching( void ) { ivas_error err; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .isar_frame_duration_us = 5000, .channels = 1, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; -#endif ISAR_LC3PLUS_DEC_HANDLE decHandle; err = ISAR_LC3PLUS_DEC_Open( config, #ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING @@ -414,11 +366,7 @@ static int openCloseDecoderWithCaching( void ) static int openCloseDecoderWithoutCaching( void ) { ivas_error err; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .isar_frame_duration_us = 5000, .channels = 1, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; -#endif ISAR_LC3PLUS_DEC_HANDLE decHandle; err = ISAR_LC3PLUS_DEC_Open( config, #ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING @@ -438,11 +386,7 @@ static int openCloseDecoderWithoutCaching( void ) static int tryOpenDecoderWithInvalidFrameDuration( void ) { ivas_error err; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .isar_frame_duration_us = 5000, .channels = 1, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; -#endif config.lc3plus_frame_duration_us = 1234; /*unsupported frame duration*/ ISAR_LC3PLUS_DEC_HANDLE decHandle; @@ -462,11 +406,7 @@ static int tryOpenDecoderWithInvalidFrameDuration( void ) static int tryOpenDecoderWithInvalidSampleRate( void ) { ivas_error err; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .isar_frame_duration_us = 5000, .channels = 1, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; -#endif config.samplerate = 1234; /*unsupported sample rate*/ ISAR_LC3PLUS_DEC_HANDLE decHandle; @@ -486,11 +426,7 @@ static int tryOpenDecoderWithInvalidSampleRate( void ) static int encodeOneFrame( void ) { ivas_error err; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .isar_frame_duration_us = 5000, .channels = 1, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; -#endif uint32_t bps = 128000; ISAR_LC3PLUS_ENC_HANDLE encHandle; @@ -511,14 +447,10 @@ static int encodeOneFrame( void ) return err; uint8_t *bitstream_out = malloc( bitstreamSizePerIvasFrame ); memset( bitstream_out, 0, bitstreamSizePerIvasFrame ); -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS Word16 Q_in[16]; memset(Q_in, 0, sizeof(Q_in) ); err = ISAR_LC3PLUS_ENC_Encode( encHandle, pcm, bitstream_out, bitstreamSizePerIvasFrame, Q_in ); -#else - err = ISAR_LC3PLUS_ENC_Encode( encHandle, pcm, bitstream_out ); -#endif if ( IVAS_ERR_OK != err ) return err; @@ -531,11 +463,7 @@ static int encodeOneFrame( void ) static int encodeAndDecodeOneMonoFrame( void ) { ivas_error err; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .isar_frame_duration_us = 5000, .channels = 1, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; -#endif uint32_t bps = 128000; ISAR_LC3PLUS_ENC_HANDLE encHandle; @@ -559,13 +487,9 @@ static int encodeAndDecodeOneMonoFrame( void ) uint8_t *bitstream_out = malloc( bitstreamSizePerIvasFrame ); memset( bitstream_out, 0, bitstreamSizePerIvasFrame ); -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS Word16 Q_in[16]; memset(Q_in, 0, sizeof(Q_in) ); err = ISAR_LC3PLUS_ENC_Encode( encHandle, pcm_in, bitstream_out, bitstreamSizePerIvasFrame, Q_in ); -#else - err = ISAR_LC3PLUS_ENC_Encode( encHandle, pcm_in, bitstream_out ); -#endif if ( IVAS_ERR_OK != err ) return err; ISAR_LC3PLUS_ENC_Close( &encHandle ); @@ -608,11 +532,7 @@ static int encodeAndDecodeOneMonoFrame( void ) static int encodeAndDecodeOneStereoFrameIvas20msLc3plus10ms_48kHz( void ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 20 * 1000, .channels = 2, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 20 * 1000, .channels = 2, .samplerate = 48000 }; -#endif return encodeAndDecodeOneStereoFrame( config, DEFAULT_BPS ); } @@ -630,140 +550,84 @@ static int encodeAndDecodeOneStereoFrameIvas20msLc3plus10ms_16kHz( void ) static int encodeAndDecodeOneStereoFrameIvas5msLc3plus5ms_48kHz( void ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .isar_frame_duration_us = 5 * 1000, .channels = 2, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .isar_frame_duration_us = 5 * 1000, .channels = 2, .samplerate = 48000 }; -#endif return encodeAndDecodeOneStereoFrame( config, DEFAULT_BPS ); } static int encodeAndDecodeOneStereoFrameIvas10msLc3plus10ms_48kHz( void ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .isar_frame_duration_us = 5 * 1000, .channels = 2, .samplerate = 48000 }; -#endif return encodeAndDecodeOneStereoFrame( config, DEFAULT_BPS ); } static int encodeAndDecodeOneMonoFrameIvas20msLc3plus10ms_48kHz( void ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 20 * 1000, .channels = 1, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 20 * 1000, .channels = 1, .samplerate = 48000 }; -#endif return encodeAndDecodeOneStereoFrame( config, DEFAULT_BPS ); } static int encodeAndDecodeOneMonoFrameIvas5msLc3plus5ms_48kHz( void ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .isar_frame_duration_us = 5 * 1000, .channels = 1, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .isar_frame_duration_us = 5 * 1000, .channels = 1, .samplerate = 48000 }; -#endif return encodeAndDecodeOneStereoFrame( config, DEFAULT_BPS ); } static int encodeAndDecodeOneStereoFrameIvas20msLc3plus2_5ms_48kHz( void ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 2.5 * 1000, .isar_frame_duration_us = 20 * 1000, .channels = 2, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 2.5 * 1000, .isar_frame_duration_us = 20 * 1000, .channels = 2, .samplerate = 48000 }; -#endif return encodeAndDecodeOneStereoFrame( config, DEFAULT_BPS ); } static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_80kbpsPerChannel( void ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000 }; -#endif return encodeAndDecodeOneStereoFrame( config, config.channels * 82*1000 ); } static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_96kbpsPerChannel( void ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000 }; -#endif return encodeAndDecodeOneStereoFrame( config, config.channels * 98*1000 ); } static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_124kbpsPerChannel( void ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000 }; -#endif return encodeAndDecodeOneStereoFrame( config, config.channels * 126*1000 ); } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_800kbpsPerChannel( void ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000 }; -#endif return encodeAndDecodeOneStereoFrame( config, config.channels * 800*1000 ); } -#endif static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_204800bpsPerChannel( void ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 1, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000 }; -#endif return encodeAndDecodeOneStereoFrame( config, config.channels * 204800 ); } static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_205600bpsPerChannel( void ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 1, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000 }; -#endif return encodeAndDecodeOneStereoFrame( config, config.channels * 205600 ); } static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_206400bpsPerChannel( void ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 1, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000 }; -#endif return encodeAndDecodeOneStereoFrame( config, config.channels * 206400 ); } static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_207200bpsPerChannel( void ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 1, .samplerate = 48000, .high_res_mode_enabled = 0 }; -#else - LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000 }; -#endif return encodeAndDecodeOneStereoFrame( config, config.channels * 207200 ); } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS #include "ivas_lc3plus_unit_test_payload_format.c" -#endif int main( int argc, @@ -841,11 +705,9 @@ int main( ret = encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_124kbpsPerChannel(); if ( ret != 0 ) return 1; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS ret = encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_800kbpsPerChannel(); if ( ret != 0 ) return 1; -#endif /* start configs around the FDL threshold */ ret = encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_204800bpsPerChannel(); if ( ret != 0 ) @@ -860,16 +722,8 @@ int main( if ( ret != 0 ) return 1; /* end configs around the FDL threshold */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS ret = run_all_payload_tests(); if ( ret != 0 ) return 1; -#endif return 0; } -#else -int main( void ) -{ - return EXIT_SUCCESS; -} -#endif /* SPLIT_REND_WITH_HEAD_ROT */ diff --git a/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test_payload_format.c b/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test_payload_format.c index 613441c8ac..5685dd1704 100644 --- a/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test_payload_format.c +++ b/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test_payload_format.c @@ -38,7 +38,6 @@ the United Nations Convention on Contracts on the International Sales of Goods. #include "isar_lc3plus_common.h" #include "options.h" -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS /* included by ivas_lc3plus_unit_test.c */ @@ -448,4 +447,3 @@ static int run_all_payload_tests( void ) } return 0; } -#endif -- GitLab From 39198c63fc3091b7970c064b7cff4449478333bf Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 29 Oct 2025 16:22:21 +0100 Subject: [PATCH 3/3] update scripts from LC3plus v.1.6.1 update MR --- scripts/lc3plus_lib_setup/get_lc3plus.sh | 60 +++--- scripts/lc3plus_lib_setup/get_lc3plus_fx.sh | 174 ++++++++++++++++++ scripts/prepare_instrumentation.sh | 2 +- .../lc3plus_basop/ivas_lc3plus_unit_test.c | 56 +++--- .../lc3plus_float/ivas_lc3plus_unit_test.c | 38 ++-- 5 files changed, 248 insertions(+), 82 deletions(-) create mode 100644 scripts/lc3plus_lib_setup/get_lc3plus_fx.sh diff --git a/scripts/lc3plus_lib_setup/get_lc3plus.sh b/scripts/lc3plus_lib_setup/get_lc3plus.sh index d44aff0699..1aa5dc7b3a 100755 --- a/scripts/lc3plus_lib_setup/get_lc3plus.sh +++ b/scripts/lc3plus_lib_setup/get_lc3plus.sh @@ -3,45 +3,36 @@ # This script shall only be used by automated continuous integration systems printf "Cleaning old version of LC3plus\n" -rm -rf lib_lc3plus +rm -rf lib_lc3plus/* printf "Downloading LC3plus code\n" -if false; then - # Waiting for official ETSI release. - # TODO: add new URL, remove `if false` when package goes public - curl -o ./lc3plus_sources.zip NEW_URL_HERE - unzip lc3plus_sources.zip -d . - rm lc3plus_sources.zip - cp -r "ETSI_Release//src/floating_point" lib_lc3plus - rm -r ETSI_Release -else - # Temp solution for downloading WIP ETSI package - # LC3_ETSI_REPO_URL must be define before running the script - git clone "$LC3_ETSI_REPO_URL" - cp -r lc3_etsi_release/src/floating_point lib_lc3plus - rm -rf lc3_etsi_release -fi + +curl -o ./lc3plus_sources.zip https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.06.01_60/ts_103634v010601p0.zip +unzip -o lc3plus_sources.zip -d . -x "__MACOSX/*" "package.info" +rm lc3plus_sources.zip +cp -r LC3plus_ETSI_src_v527e88bdddb_20251022/src/floating_point/* lib_lc3plus +rm -r LC3plus_ETSI_src_v527e88bdddb_20251022 # Remove unneeded files printf "Removing unneeded files\n" -rm lib_lc3plus/codec_exe.c # Only used for executable -rm lib_lc3plus/makefile # Build handled at IVAS level -rm -r lib_lc3plus/msvc # Build handled at IVAS level +rm lib_lc3plus/codec_exe.c # Only used for executable +rm lib_lc3plus/makefile # Build handled at IVAS level +rm -r lib_lc3plus/msvc # Build handled at IVAS level rm lib_lc3plus/plc_noise_substitution0.c # Empty file -rm lib_lc3plus/tinywavein_c.h # Only used for executable -rm lib_lc3plus/tinywaveout_c.h # Only used for executable +rm lib_lc3plus/tinywavein_c.h # Only used for executable +rm lib_lc3plus/tinywaveout_c.h # Only used for executable # Limit file permissions printf "Limiting file permissions\n" -find lib_lc3plus -type f -print0 | \ -xargs -0 -I {} \ -chmod -x {} +find lib_lc3plus -type f -print0 | + xargs -0 -I {} \ + chmod -x {} # include options.h in all C files printf "Including options.h and wmc_auto.h in C files\n" -find lib_lc3plus -name '*.[ch]' -type f -print0 | \ -xargs -0 -I {} \ -sed -i ' +find lib_lc3plus -name '*.[ch]' -type f -print0 | + xargs -0 -I {} \ + sed -i ' # range: from 1st line to first match 1,/^#include/ { # insert lines before first match @@ -53,17 +44,18 @@ sed -i ' # Remove whitespace from preprocessor commands printf "Removing whitespace from preprocessor commands\n" -find lib_lc3plus -name '*.[ch]' -type f -print0 | \ -xargs -0 -I {} \ -sed -i 's/^#[[:space:]]\+/#/' {} +find lib_lc3plus -name '*.[ch]' -type f -print0 | + xargs -0 -I {} sh -c ' + sed -i "s/^#[[:space:]]\+/#/" "$1" + sed -i "s/^#\(define\|undef\|ifdef\|ifndef\|endif\|if\|else\|elif\|include\)[[:space:]]\+/#\1 /" "$1" + ' _ {} -# fix for sanitizer issues -sed -i 's/st->low << 8/(LC3_INT)((LC3_UINT32)st->low << 8)/' lib_lc3plus/ari_codec.c -sed -i 's/~3/(uintptr_t)(~3)/' lib_lc3plus/lc3.c +# delete define of NPRM_RESQ - not used anywhere in LC3plus but conflicts with IVAS +sed -i '/^\/\* RESIDUAL CODING \*\/$/d; /^#define NPRM_RESQ 5 \* MAX_LEN$/d' lib_lc3plus/defines.h # Add .clang-format file to lib_lc3plus to disable formatting there printf "Disabling clang-format in lib_lc3plus directory\n" printf ' DisableFormat: true SortIncludes: Never -' >> lib_lc3plus/.clang-format +' >lib_lc3plus/.clang-format diff --git a/scripts/lc3plus_lib_setup/get_lc3plus_fx.sh b/scripts/lc3plus_lib_setup/get_lc3plus_fx.sh new file mode 100644 index 0000000000..389fe76cad --- /dev/null +++ b/scripts/lc3plus_lib_setup/get_lc3plus_fx.sh @@ -0,0 +1,174 @@ +#!/usr/bin/env bash + +# This script shall only be used by automated continuous integration systems + +set -ux + +printf "Cleaning old version of LC3plus\n" +rm -rf lib_lc3plus/* + +printf "Downloading LC3plus code\n" + +curl -o ./lc3plus_sources.zip https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.06.01_60/ts_103634v010601p0.zip +unzip -o lc3plus_sources.zip -d . -x "__MACOSX/*" "package.info" +rm lc3plus_sources.zip +cp -r LC3plus_ETSI_src_v527e88bdddb_20251022/src/fixed_point/* lib_lc3plus +rm -r LC3plus_ETSI_src_v527e88bdddb_20251022 + +cd lib_lc3plus + +printf "Updating LC3plus code for IVAS BASOP compatibility\n" + +# rename files +mv basic_op/dynmem.[ch] . +mv basop_mpy.c basop_mpy_lc3plus.c +mv basop_mpy.h basop_mpy_lc3plus.h +mv basop_util.c basop_util_lc3plus.c +mv basop_util.h basop_util_lc3plus.h +mv fft.c fft_lc3plus.c +mv rom_basop_util.c rom_basop_util_lc3plus.c +mv rom_basop_util.h rom_basop_util_lc3plus.h + +# remove unneeded files +rm makefile +rm codec_exe.c +rm ccConvert.c +rm tinywavein_c.h +rm tinywaveout_c.h +rm -r basic_op +rm -r msvc +rm -r msvc_ccc + +# update header include guards to avoid conflict +sed -i 's|__BASOP_UTIL_H__|__BASOP_UTIL_LC3PLUS_H__|g' basop_util_lc3plus.h +sed -i 's|__BASOP_UTIL_ROM_H__|__BASOP_UTIL_ROM_LC3PLUS_H__|g' rom_basop_util_lc3plus.h + +# update includes for renamed files +sed -i 's|#include "basop_mpy.h"|#include "basop_mpy_lc3plus.h"|g' *.[ch] +sed -i 's|#include "basop_util.h"|#include "basop_util_lc3plus.h"|g' *.[ch] +sed -i 's|#include "rom_basop_util.h"|#include "rom_basop_util_lc3plus.h"|g' *.[ch] + +# deactivate DYNMEM_COUNT, conflicts with WMC tool +sed -i 's|#define DYNMEM_COUNT|// #define DYNMEM_COUNT /* conflicts with WMC tool */|g' defines.h + +# change BASOP_sub_start/end to push/pop_wmops wrapped in #ifdef WMOPS +sed -E -i 's|BASOP(_sub){1,2}_start|push_wmops|g' *.[ch] +sed -E -i 's|BASOP(_sub){1,2}_end|pop_wmops|g' *.[ch] +sed -E -i 's|^(.*p[uo][sp]h?_wmops.*)$|#ifdef WMOPS\n\1\n#endif|g' *.[ch] + +# rename conflicting BASOPs +sed -i 's|Isqrt|Isqrt_lc3plus|g' *.[ch] +sed -i 's|\bMpy_32_16(|Mpy_32_16_lc3plus(|g' *.[ch] +sed -i 's|\bMpy_32_32(|Mpy_32_32_lc3plus(|g' *.[ch] + +# suppress #pragma message() +sed -i 's/\#pragma message(/\/\/ \#pragma message(/g' lc3plus.c + +# add ENABLE_HR_MODE to lc3plus.h +sed -i '/\#define LC3PLUS_H/a\#define ENABLE_HR_MODE' lc3plus.h + +# add macros missing from IVAS at the bottom of the file +sed -i '/\#endif \/\* __BASOP_UTIL_LC3PLUS_H__ \*\//i\ +/* Macros missing from IVAS BASOP, used only in LC3plus */\ +#define L_shl_pos(x, y) (L_shl((x), (y)))\ +#define L_shr_pos(x, y) (L_shr((x), (y)))\ +#define L_shr_pos_pos(x, y) (L_shr((x), (y)))\ +\ +#define L_shr_r_pos(x, shift) (L_shr_r(x, shift))\ +\ +#define shl_pos(x, y) (shl((x), (y)))\ +#define shr_pos(x, y) (shr((x), (y)))\ +#define shr_pos_pos(x, y) (shr((x), (y)))\ +\ +#define lshl_pos(x, y) (lshl(x, y))\ +#define UL_lshr_pos(x, y) (UL_lshr(x, y))\ +#define UL_lshl_pos(x, y) (UL_lshl(x, y))' basop_util_lc3plus.h + +# locally redefine duplicate symbols +sed -i '/\#endif \/\* DEFINES_H \*\//i\ +#define FIX_IVAS_LC3PLUS_DUPLICATES\ +#ifdef FIX_IVAS_LC3PLUS_DUPLICATES\ +#define abs_s_sat abs_s\ +#define BASOP_cfft BASOP_cfft_lc3plus\ +#define BASOP_getTables BASOP_getTables_lc3plus\ +#define BASOP_Util_Add_Mant32Exp BASOP_Util_Add_Mant32Exp_lc3plus\ +#define BASOP_Util_Cmp_Mant32Exp BASOP_Util_Cmp_Mant32Exp_lc3plus\ +#define BASOP_Util_Divide1616_Scale BASOP_Util_Divide1616_Scale_lc3plus\ +#define BASOP_Util_Divide3216_Scale BASOP_Util_Divide3216_Scale_lc3plus\ +#define BASOP_Util_InvLog2 BASOP_Util_InvLog2_lc3plus\ +#define BASOP_Util_Log2 BASOP_Util_Log2_lc3plus\ +#define Copy_Scale_sig Copy_Scale_sig_lc3plus\ +#define exp2_tab_long exp2_tab_long_lc3plus\ +#define exp2w_tab_long exp2w_tab_long_lc3plus\ +#define exp2x_tab_long exp2x_tab_long_lc3plus\ +#define get_size_mpvq_calc_offset_fx get_size_mpvq_calc_offset_fx_lc3plus\ +#define getScaleFactor16 getScaleFactor16_lc3plus\ +#define getScaleFactor32 getScaleFactor32_lc3plus\ +#define i_mult DEPR_i_mult\ +#define Inv16 Inv16_lc3plus\ +#define InvDiffTable InvDiffTable_lc3plus\ +#define InvIntTable InvIntTable_lc3plus\ +#define InvTable InvTable_lc3plus\ +#define ISqrt16 ISqrt16_lc3plus\ +#define ISqrtDiffTable ISqrtDiffTable_lc3plus\ +#define ISqrtTable ISqrtTable_lc3plus\ +#define L_abs_sat L_abs\ +#define ldCoeff ldCoeff_lc3plus\ +#define Norm32Norm Norm32Norm_lc3plus\ +#define POW_ATT_TABLE0 POW_ATT_TABLE0_lc3plus\ +#define POW_ATT_TABLE1 POW_ATT_TABLE1_lc3plus\ +#define RotVector_320 RotVector_320_lc3plus\ +#define RotVector_480 RotVector_480_lc3plus\ +#define Scale_sig Scale_sig_lc3plus\ +#define SineTable320 SineTable320_lc3plus\ +#define SineWindow120 SineWindow120_lc3plus\ +#define SineWindow160 SineWindow160_lc3plus\ +#define SineWindow180 SineWindow180_lc3plus\ +#define SineWindow20 SineWindow20_lc3plus\ +#define SineWindow30 SineWindow30_lc3plus\ +#define SineWindow320 SineWindow320_lc3plus\ +#define SineWindow40 SineWindow40_lc3plus\ +#define SineWindow60 SineWindow60_lc3plus\ +#define SineWindow80 SineWindow80_lc3plus\ +#define Sqrt16 Sqrt16_lc3plus\ +#define SqrtDiffTable SqrtDiffTable_lc3plus\ +#define SqrtTable SqrtTable_lc3plus\ +#define Tab_esc_nb Tab_esc_nb_lc3plus\ +#define tnsAcfWindow tnsAcfWindow_lc3plus\ +#endif /* FIX_IVAS_LC3PLUS_DUPLICATES */' defines.h + +cd - + +# Limit file permissions +printf "Limiting file permissions\n" +find lib_lc3plus -type f -print0 | + xargs -0 -I {} \ + chmod -x {} + +# include options.h and wmc_auto.h in all C files +printf "Including options.h and wmc_auto.h in C files\n" +find lib_lc3plus -name '*.[ch]' -type f -print0 | + xargs -0 -I {} \ + sed -i ' +# range: from 1st line to first match +1,/^#include/ { + # insert lines before first match + /^#include/ i\ +#include "options.h"\ +#include "wmc_auto.h" +} +' {} + +# Remove whitespace from preprocessor commands +printf "Removing whitespace from preprocessor commands\n" +find lib_lc3plus -name '*.[ch]' -type f -print0 | + xargs -0 -I {} sh -c ' + sed -i "s/^#[[:space:]]\+/#/" "$1" + sed -i "s/^#\(define\|undef\|ifdef\|ifndef\|endif\|if\|else\|elif\|include\)[[:space:]]\+/#\1 /" "$1" + ' _ {} + +# Add .clang-format file to lib_lc3plus to disable formatting there +printf "Disabling clang-format in lib_lc3plus directory\n" +printf 'DisableFormat: true +SortIncludes: Never +' >lib_lc3plus/.clang-format diff --git a/scripts/prepare_instrumentation.sh b/scripts/prepare_instrumentation.sh index 3698b12b26..906d85e785 100755 --- a/scripts/prepare_instrumentation.sh +++ b/scripts/prepare_instrumentation.sh @@ -156,7 +156,7 @@ if [ $ISAR -eq 1 ]; then echo " #define ENABLE_HR_MODE //#define DYNMEM_COUNT - #define CR10_A_ATTENUATION_CURVE_SELECTOR + //#define USE_LC3_OPERATORS #define SUBSET_NB #define SUBSET_WB #define SUBSET_SSWB diff --git a/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test.c b/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test.c index 7cdda56342..6833a90fea 100644 --- a/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test.c +++ b/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test.c @@ -41,7 +41,7 @@ the United Nations Convention on Contracts on the International Sales of Goods. #include "lc3plus.h" #define MAX_SAMPLES_PER_CHANNEL 960 / 4 -#define DEFAULT_BPS 256000 +#define DEFAULT_BPS 256000 #ifndef PCM_SAMPLE_TYPEDEF_DEFINED #define PCM_SAMPLE_TYPEDEF_DEFINED @@ -93,23 +93,23 @@ static int encodeAndDecodeOneStereoFrame( LC3PLUS_CONFIG config, uint32_t bps ) uint8_t *bitstream_out = malloc( bitstreamSizePerIvasFrame ); memset( bitstream_out, 0, bitstreamSizePerIvasFrame ); - int perChannelBitrate = lc3plus_enc_get_real_bitrate(encHandle->handles[0]); - int perLc3plusFrameDataBlockOctets = encHandle->num_ftds * perChannelBitrate / 8 / (1000*1000/config.lc3plus_frame_duration_us); - int targetOctets = bps / 8 / (1000*1000/config.isar_frame_duration_us); - printf("IVAS-FS=%i LC3plus-FS=%i ch=%i targetBps=%i targetOctets=%i\n", config.isar_frame_duration_us, config.lc3plus_frame_duration_us, config.channels, bps, targetOctets); - printf(" coreBps=%i corePerChBps=%i coreCodecOctets=%i nFtds=%i \n", perChannelBitrate * encHandle->num_encs, perChannelBitrate, perLc3plusFrameDataBlockOctets, encHandle->num_ftds); + int perChannelBitrate = lc3plus_enc_get_real_bitrate( encHandle->handles[0] ); + int perLc3plusFrameDataBlockOctets = encHandle->num_ftds * perChannelBitrate / 8 / ( 1000 * 1000 / config.lc3plus_frame_duration_us ); + int targetOctets = bps / 8 / ( 1000 * 1000 / config.isar_frame_duration_us ); + printf( "IVAS-FS=%i LC3plus-FS=%i ch=%i targetBps=%i targetOctets=%i\n", config.isar_frame_duration_us, config.lc3plus_frame_duration_us, config.channels, bps, targetOctets ); + printf( " coreBps=%i corePerChBps=%i coreCodecOctets=%i nFtds=%i \n", perChannelBitrate * encHandle->num_encs, perChannelBitrate, perLc3plusFrameDataBlockOctets, encHandle->num_ftds ); int pfOctets = bitstreamSizePerIvasFrame - perLc3plusFrameDataBlockOctets; - int pfBps = pfOctets * 8 * (1000*1000 / config.isar_frame_duration_us); - printf(" payloadFormatBps=%i payloadFormatOctets=%i \n\n", pfBps, pfOctets); - if(pfBps <= 0) + int pfBps = pfOctets * 8 * ( 1000 * 1000 / config.isar_frame_duration_us ); + printf( " payloadFormatBps=%i payloadFormatOctets=%i \n\n", pfBps, pfOctets ); + if ( pfBps <= 0 ) { ISAR_LC3PLUS_ENC_Close( &encHandle ); return err; } Word16 Q_in[16]; - memset(Q_in, 0, sizeof(Q_in) ); - err = ISAR_LC3PLUS_ENC_Encode( encHandle, pcm_in, bitstream_out, bitstreamSizePerIvasFrame, Q_in ); + memset( Q_in, 0, sizeof( Q_in ) ); + err = ISAR_LC3PLUS_ENC_Encode( encHandle, pcm_in, bitstream_out, bitstreamSizePerIvasFrame, Q_in ); if ( IVAS_ERR_OK != err ) { ISAR_LC3PLUS_ENC_Close( &encHandle ); @@ -218,19 +218,19 @@ static int tryOpenEncoderWithInvalidBitrate( void ) { return 1; } - limitedBitrate = lc3plus_enc_get_real_bitrate(encHandle->handles[0]); - if(limitedBitrate != 320000) + limitedBitrate = lc3plus_enc_get_real_bitrate( encHandle->handles[0] ); + if ( limitedBitrate != 320000 ) { return 1; } - ISAR_LC3PLUS_ENC_Close(&encHandle); + ISAR_LC3PLUS_ENC_Close( &encHandle ); err = ISAR_LC3PLUS_ENC_Open( config, invalid_low_bps, &encHandle ); /* setting an invalid bitrate should trigger an error - which is what we expect */ if ( IVAS_ERR_LC3PLUS_INVALID_BITRATE != err ) { return 1; } - ISAR_LC3PLUS_ENC_Close(&encHandle); + ISAR_LC3PLUS_ENC_Close( &encHandle ); return 0; } @@ -295,13 +295,13 @@ static int tryCallEncoderApiWithInvalidParams( void ) } ISAR_LC3PLUS_ENC_Close( &invalidEncHandle ); Word16 Q_in[16]; - memset(Q_in, 0, sizeof(Q_in) ); - if ( IVAS_ERR_UNEXPECTED_NULL_POINTER != ISAR_LC3PLUS_ENC_Encode( invalidEncHandle, invalidPcm_in, invalidBitstream_out, bsSize, Q_in ) ) + memset( Q_in, 0, sizeof( Q_in ) ); + if ( IVAS_ERR_UNEXPECTED_NULL_POINTER != ISAR_LC3PLUS_ENC_Encode( invalidEncHandle, invalidPcm_in, invalidBitstream_out, bsSize, Q_in ) ) { return 1; } - memset(Q_in, 0, sizeof(Q_in) ); - if ( IVAS_ERR_UNEXPECTED_NULL_POINTER != ISAR_LC3PLUS_ENC_Encode( invalidEncHandle, pcm_in, invalidBitstream_out, bsSize, Q_in) || IVAS_ERR_UNEXPECTED_NULL_POINTER != ISAR_LC3PLUS_ENC_Encode( invalidEncHandle, invalidPcm_in, bitstream_out, bsSize, Q_in ) || IVAS_ERR_UNEXPECTED_NULL_POINTER != ISAR_LC3PLUS_ENC_Encode( invalidEncHandle, pcm_in, bitstream_out, bsSize, Q_in ) ) + memset( Q_in, 0, sizeof( Q_in ) ); + if ( IVAS_ERR_UNEXPECTED_NULL_POINTER != ISAR_LC3PLUS_ENC_Encode( invalidEncHandle, pcm_in, invalidBitstream_out, bsSize, Q_in ) || IVAS_ERR_UNEXPECTED_NULL_POINTER != ISAR_LC3PLUS_ENC_Encode( invalidEncHandle, invalidPcm_in, bitstream_out, bsSize, Q_in ) || IVAS_ERR_UNEXPECTED_NULL_POINTER != ISAR_LC3PLUS_ENC_Encode( invalidEncHandle, pcm_in, bitstream_out, bsSize, Q_in ) ) { return 1; } @@ -448,7 +448,7 @@ static int encodeOneFrame( void ) uint8_t *bitstream_out = malloc( bitstreamSizePerIvasFrame ); memset( bitstream_out, 0, bitstreamSizePerIvasFrame ); Word16 Q_in[16]; - memset(Q_in, 0, sizeof(Q_in) ); + memset( Q_in, 0, sizeof( Q_in ) ); err = ISAR_LC3PLUS_ENC_Encode( encHandle, pcm, bitstream_out, bitstreamSizePerIvasFrame, Q_in ); if ( IVAS_ERR_OK != err ) @@ -488,8 +488,8 @@ static int encodeAndDecodeOneMonoFrame( void ) uint8_t *bitstream_out = malloc( bitstreamSizePerIvasFrame ); memset( bitstream_out, 0, bitstreamSizePerIvasFrame ); Word16 Q_in[16]; - memset(Q_in, 0, sizeof(Q_in) ); - err = ISAR_LC3PLUS_ENC_Encode( encHandle, pcm_in, bitstream_out, bitstreamSizePerIvasFrame, Q_in ); + memset( Q_in, 0, sizeof( Q_in ) ); + err = ISAR_LC3PLUS_ENC_Encode( encHandle, pcm_in, bitstream_out, bitstreamSizePerIvasFrame, Q_in ); if ( IVAS_ERR_OK != err ) return err; ISAR_LC3PLUS_ENC_Close( &encHandle ); @@ -582,25 +582,25 @@ static int encodeAndDecodeOneStereoFrameIvas20msLc3plus2_5ms_48kHz( void ) static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_80kbpsPerChannel( void ) { LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000, .high_res_mode_enabled = 0 }; - return encodeAndDecodeOneStereoFrame( config, config.channels * 82*1000 ); + return encodeAndDecodeOneStereoFrame( config, config.channels * 82 * 1000 ); } static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_96kbpsPerChannel( void ) { LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000, .high_res_mode_enabled = 0 }; - return encodeAndDecodeOneStereoFrame( config, config.channels * 98*1000 ); + return encodeAndDecodeOneStereoFrame( config, config.channels * 98 * 1000 ); } static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_124kbpsPerChannel( void ) { LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000, .high_res_mode_enabled = 0 }; - return encodeAndDecodeOneStereoFrame( config, config.channels * 126*1000 ); + return encodeAndDecodeOneStereoFrame( config, config.channels * 126 * 1000 ); } static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_800kbpsPerChannel( void ) { LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000, .high_res_mode_enabled = 0 }; - return encodeAndDecodeOneStereoFrame( config, config.channels * 800*1000 ); + return encodeAndDecodeOneStereoFrame( config, config.channels * 800 * 1000 ); } static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_204800bpsPerChannel( void ) @@ -633,8 +633,8 @@ int main( int argc, char *argv[] ) { - (void)argc; - (void)argv; + (void) argc; + (void) argv; int ret = 0; ret = openCloseEncoder(); if ( ret != 0 ) diff --git a/scripts/split_rendering/lc3plus_float/ivas_lc3plus_unit_test.c b/scripts/split_rendering/lc3plus_float/ivas_lc3plus_unit_test.c index c15f14b4cc..8c2f1a1495 100644 --- a/scripts/split_rendering/lc3plus_float/ivas_lc3plus_unit_test.c +++ b/scripts/split_rendering/lc3plus_float/ivas_lc3plus_unit_test.c @@ -41,7 +41,7 @@ the United Nations Convention on Contracts on the International Sales of Goods. #include "lc3plus.h" #define MAX_SAMPLES_PER_CHANNEL 960 / 4 -#define DEFAULT_BPS 256000 +#define DEFAULT_BPS 256000 static int encodeAndDecodeOneStereoFrame( LC3PLUS_CONFIG config, uint32_t bps ) { @@ -88,15 +88,15 @@ static int encodeAndDecodeOneStereoFrame( LC3PLUS_CONFIG config, uint32_t bps ) uint8_t *bitstream_out = malloc( bitstreamSizePerIvasFrame ); memset( bitstream_out, 0, bitstreamSizePerIvasFrame ); - int perChannelBitrate = lc3plus_enc_get_real_bitrate(encHandle->handles[0]); - int perLc3plusFrameDataBlockOctets = encHandle->num_ftds * perChannelBitrate / 8 / (1000*1000/config.lc3plus_frame_duration_us); - int targetOctets = bps / 8 / (1000*1000/config.isar_frame_duration_us); - printf("IVAS-FS=%i LC3plus-FS=%i ch=%i targetBps=%i targetOctets=%i\n", config.isar_frame_duration_us, config.lc3plus_frame_duration_us, config.channels, bps, targetOctets); - printf(" coreBps=%i corePerChBps=%i coreCodecOctets=%i nFtds=%i \n", perChannelBitrate * encHandle->num_encs, perChannelBitrate, perLc3plusFrameDataBlockOctets, encHandle->num_ftds); + int perChannelBitrate = lc3plus_enc_get_real_bitrate( encHandle->handles[0] ); + int perLc3plusFrameDataBlockOctets = encHandle->num_ftds * perChannelBitrate / 8 / ( 1000 * 1000 / config.lc3plus_frame_duration_us ); + int targetOctets = bps / 8 / ( 1000 * 1000 / config.isar_frame_duration_us ); + printf( "IVAS-FS=%i LC3plus-FS=%i ch=%i targetBps=%i targetOctets=%i\n", config.isar_frame_duration_us, config.lc3plus_frame_duration_us, config.channels, bps, targetOctets ); + printf( " coreBps=%i corePerChBps=%i coreCodecOctets=%i nFtds=%i \n", perChannelBitrate * encHandle->num_encs, perChannelBitrate, perLc3plusFrameDataBlockOctets, encHandle->num_ftds ); int pfOctets = bitstreamSizePerIvasFrame - perLc3plusFrameDataBlockOctets; - int pfBps = pfOctets * 8 * (1000*1000 / config.isar_frame_duration_us); - printf(" payloadFormatBps=%i payloadFormatOctets=%i \n\n", pfBps, pfOctets); - if(pfBps <= 0) + int pfBps = pfOctets * 8 * ( 1000 * 1000 / config.isar_frame_duration_us ); + printf( " payloadFormatBps=%i payloadFormatOctets=%i \n\n", pfBps, pfOctets ); + if ( pfBps <= 0 ) { ISAR_LC3PLUS_ENC_Close( &encHandle ); return err; @@ -211,19 +211,19 @@ static int tryOpenEncoderWithInvalidBitrate( void ) { return 1; } - limitedBitrate = lc3plus_enc_get_real_bitrate(encHandle->handles[0]); - if(limitedBitrate != 320000) + limitedBitrate = lc3plus_enc_get_real_bitrate( encHandle->handles[0] ); + if ( limitedBitrate != 320000 ) { return 1; } - ISAR_LC3PLUS_ENC_Close(&encHandle); + ISAR_LC3PLUS_ENC_Close( &encHandle ); err = ISAR_LC3PLUS_ENC_Open( config, invalid_low_bps, &encHandle ); /* setting an invalid bitrate should trigger an error - which is what we expect */ if ( IVAS_ERR_LC3PLUS_INVALID_BITRATE != err ) { return 1; } - ISAR_LC3PLUS_ENC_Close(&encHandle); + ISAR_LC3PLUS_ENC_Close( &encHandle ); return 0; } @@ -567,13 +567,13 @@ static int encodeAndDecodeOneStereoFrameIvas20msLc3plus2_5ms_48kHz( void ) static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_80kbpsPerChannel( void ) { LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000, .high_res_mode_enabled = 0 }; - return encodeAndDecodeOneStereoFrame( config, config.channels * 82*1000 ); + return encodeAndDecodeOneStereoFrame( config, config.channels * 82 * 1000 ); } static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_96kbpsPerChannel( void ) { LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000, .high_res_mode_enabled = 0 }; - return encodeAndDecodeOneStereoFrame( config, config.channels * 98*1000 ); + return encodeAndDecodeOneStereoFrame( config, config.channels * 98 * 1000 ); } #ifdef LC3PLUS_LEA_COMPAT_BITRATES_48_6 @@ -583,13 +583,13 @@ static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_124kbpsPerChannel #endif { LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000, .high_res_mode_enabled = 0 }; - return encodeAndDecodeOneStereoFrame( config, config.channels * 126*1000 ); + return encodeAndDecodeOneStereoFrame( config, config.channels * 126 * 1000 ); } static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_800kbpsPerChannel( void ) { LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .isar_frame_duration_us = 10 * 1000, .channels = 2, .samplerate = 48000, .high_res_mode_enabled = 0 }; - return encodeAndDecodeOneStereoFrame( config, config.channels * 800*1000 ); + return encodeAndDecodeOneStereoFrame( config, config.channels * 800 * 1000 ); } static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_204800bpsPerChannel( void ) @@ -622,8 +622,8 @@ int main( int argc, char *argv[] ) { - (void)argc; - (void)argv; + (void) argc; + (void) argv; int ret = 0; ret = openCloseEncoder(); if ( ret != 0 ) -- GitLab