From 18ac1a86698b68c6fab6bc88e98dbbe4ddb53a2e Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 9 Jul 2025 12:28:50 +0200 Subject: [PATCH 1/3] Update LC3plus integration to latest ETSI release package for v.1.5.1 --- .gitlab-ci.yml | 2 +- Workspace_msvc/lib_lc3plus.vcxproj | 32 +++++++++---------- lib_isar/isar_lc3plus_common.c | 2 +- lib_isar/isar_lc3plus_common.h | 2 +- lib_isar/isar_lc3plus_dec.c | 2 +- lib_isar/isar_lc3plus_dec.h | 2 +- lib_isar/isar_lc3plus_enc.c | 2 +- lib_isar/isar_lc3plus_enc.h | 2 +- lib_isar/isar_lc3plus_payload.h | 2 +- lib_lc3plus/ari_codec.c | 2 +- lib_lc3plus/functions.h | 6 ++-- lib_lc3plus/{lc3.c => lc3plus.c} | 10 +++--- lib_lc3plus/{lc3.h => lc3plus.h} | 2 +- .../{setup_com_lc3.c => setup_com_lc3plus.c} | 0 .../{setup_dec_lc3.c => setup_dec_lc3plus.c} | 2 +- .../{setup_dec_lc3.h => setup_dec_lc3plus.h} | 0 .../{setup_enc_lc3.c => setup_enc_lc3plus.c} | 2 +- .../{setup_enc_lc3.h => setup_enc_lc3plus.h} | 0 scripts/lc3plus_lib_setup/get_lc3plus.sh | 10 ++++-- .../lc3plus_basop/ivas_lc3plus_unit_test.c | 4 +++ .../lc3plus_float/ivas_lc3plus_unit_test.c | 2 +- 21 files changed, 47 insertions(+), 41 deletions(-) rename lib_lc3plus/{lc3.c => lc3plus.c} (98%) rename lib_lc3plus/{lc3.h => lc3plus.h} (99%) rename lib_lc3plus/{setup_com_lc3.c => setup_com_lc3plus.c} (100%) rename lib_lc3plus/{setup_dec_lc3.c => setup_dec_lc3plus.c} (99%) rename lib_lc3plus/{setup_dec_lc3.h => setup_dec_lc3plus.h} (100%) rename lib_lc3plus/{setup_enc_lc3.c => setup_enc_lc3plus.c} (99%) rename lib_lc3plus/{setup_enc_lc3.h => setup_enc_lc3plus.h} (100%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9003f5042b..dd396504fb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1017,7 +1017,7 @@ check-first-frame-is-sid: expose_as: "logs-sidstart" expire_in: "5 days" -.lc3plus-ensure-no-code-changes: +lc3plus-ensure-no-code-changes: extends: - .test-job-linux - .rules-merge-request-to-main diff --git a/Workspace_msvc/lib_lc3plus.vcxproj b/Workspace_msvc/lib_lc3plus.vcxproj index 55a291fa9c..3f1527357a 100644 --- a/Workspace_msvc/lib_lc3plus.vcxproj +++ b/Workspace_msvc/lib_lc3plus.vcxproj @@ -106,7 +106,6 @@ - @@ -116,13 +115,13 @@ - - + + - + @@ -133,35 +132,36 @@ + - - - + + + + - - - + + + - @@ -169,14 +169,12 @@ - - - - + + + + - - diff --git a/lib_isar/isar_lc3plus_common.c b/lib_isar/isar_lc3plus_common.c index 4236c9ced7..a186908990 100644 --- a/lib_isar/isar_lc3plus_common.c +++ b/lib_isar/isar_lc3plus_common.c @@ -33,7 +33,7 @@ #include "options.h" #include "isar_lc3plus_common.h" #include "ivas_error.h" -#include "lc3.h" +#include "lc3plus.h" /*-----------------------------------------------------------------------------------------* * Function ISAR_LC3PLUS_LC3plusErrToIvasErr() diff --git a/lib_isar/isar_lc3plus_common.h b/lib_isar/isar_lc3plus_common.h index b99348e0ed..eb3e7b0ad2 100644 --- a/lib_isar/isar_lc3plus_common.h +++ b/lib_isar/isar_lc3plus_common.h @@ -37,7 +37,7 @@ #include #include "options.h" #include "ivas_error.h" -#include "lc3.h" +#include "lc3plus.h" #include "isar_lc3plus_payload.h" /*! common configuration parameters between encoder and decoder */ diff --git a/lib_isar/isar_lc3plus_dec.c b/lib_isar/isar_lc3plus_dec.c index 560f34f1c4..c5d78f4446 100644 --- a/lib_isar/isar_lc3plus_dec.c +++ b/lib_isar/isar_lc3plus_dec.c @@ -36,7 +36,7 @@ #include "ivas_prot.h" #include "isar_lc3plus_dec.h" #include "isar_lc3plus_common.h" -#include "lc3.h" +#include "lc3plus.h" #include "ivas_error_utils.h" #include "wmc_auto.h" diff --git a/lib_isar/isar_lc3plus_dec.h b/lib_isar/isar_lc3plus_dec.h index 82b9e51e19..d5cb37aaa9 100644 --- a/lib_isar/isar_lc3plus_dec.h +++ b/lib_isar/isar_lc3plus_dec.h @@ -35,7 +35,7 @@ #include #include "options.h" -#include "lc3.h" +#include "lc3plus.h" #include "ivas_error.h" #include "ivas_cnst.h" #include "isar_lc3plus_common.h" diff --git a/lib_isar/isar_lc3plus_enc.c b/lib_isar/isar_lc3plus_enc.c index 62a803f38f..c6e2d31334 100644 --- a/lib_isar/isar_lc3plus_enc.c +++ b/lib_isar/isar_lc3plus_enc.c @@ -32,7 +32,7 @@ #include "isar_lc3plus_enc.h" #include "isar_lc3plus_common.h" -#include "lc3.h" +#include "lc3plus.h" #include "ivas_error_utils.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_isar/isar_lc3plus_enc.h b/lib_isar/isar_lc3plus_enc.h index 9c80033fd3..ed6c526011 100644 --- a/lib_isar/isar_lc3plus_enc.h +++ b/lib_isar/isar_lc3plus_enc.h @@ -35,7 +35,7 @@ #include #include "ivas_error.h" -#include "lc3.h" +#include "lc3plus.h" #include "isar_lc3plus_common.h" #include "isar_lc3plus_payload.h" diff --git a/lib_isar/isar_lc3plus_payload.h b/lib_isar/isar_lc3plus_payload.h index e951285784..580a58ca65 100644 --- a/lib_isar/isar_lc3plus_payload.h +++ b/lib_isar/isar_lc3plus_payload.h @@ -35,7 +35,7 @@ #include #include -#include "lc3.h" +#include "lc3plus.h" #include "options.h" diff --git a/lib_lc3plus/ari_codec.c b/lib_lc3plus/ari_codec.c index 5ba87a32bc..2a76ecac83 100644 --- a/lib_lc3plus/ari_codec.c +++ b/lib_lc3plus/ari_codec.c @@ -705,7 +705,7 @@ void ac_shift_fl(Encoder_State_fl* st) st->carry_count = st->carry_count + 1; } - st->low = st->low << 8; + st->low = (LC3_INT)((LC3_UINT32)st->low << 8); st->low = (st->low) & (16777215); /* 2^24 - 1 */ } diff --git a/lib_lc3plus/functions.h b/lib_lc3plus/functions.h index 46daa64bf3..a2f4857b2a 100644 --- a/lib_lc3plus/functions.h +++ b/lib_lc3plus/functions.h @@ -15,9 +15,9 @@ #include "clib.h" #include "defines.h" #include "float.h" -#include "lc3.h" -#include "setup_dec_lc3.h" -#include "setup_enc_lc3.h" +#include "lc3plus.h" +#include "setup_dec_lc3plus.h" +#include "setup_enc_lc3plus.h" #include "structs.h" #include "util.h" diff --git a/lib_lc3plus/lc3.c b/lib_lc3plus/lc3plus.c similarity index 98% rename from lib_lc3plus/lc3.c rename to lib_lc3plus/lc3plus.c index 56a39286f8..d208cfb151 100644 --- a/lib_lc3plus/lc3.c +++ b/lib_lc3plus/lc3plus.c @@ -9,13 +9,13 @@ #include "options.h" #include "wmc_auto.h" -#include "lc3.h" +#include "lc3plus.h" #include "defines.h" #include "functions.h" #include -#include "setup_dec_lc3.h" -#include "setup_enc_lc3.h" +#include "setup_dec_lc3plus.h" +#include "setup_enc_lc3plus.h" #define RETURN_IF(cond, error) \ if (cond) \ @@ -88,9 +88,9 @@ static int null_in_list(void **list, int n) /* return pointer to aligned base + base_size, *base_size += size + 4 bytes align */ void *balloc(void *base, size_t *base_size, size_t size) { - uintptr_t ptr = ((uintptr_t)base + *base_size + 3) & ~3; + uintptr_t ptr = ((uintptr_t)base + *base_size + 3) & (uintptr_t)(~3); assert((uintptr_t)base % 4 == 0); /* base must be 4-byte aligned */ - *base_size = (*base_size + size + 3) & ~3; + *base_size = (*base_size + size + 3) & (uintptr_t)(~3); return (void *)ptr; } diff --git a/lib_lc3plus/lc3.h b/lib_lc3plus/lc3plus.h similarity index 99% rename from lib_lc3plus/lc3.h rename to lib_lc3plus/lc3plus.h index b5f8809e7e..063714467d 100644 --- a/lib_lc3plus/lc3.h +++ b/lib_lc3plus/lc3plus.h @@ -7,7 +7,7 @@ * estoppel or otherwise. * ******************************************************************************/ -/*! \file lc3.h +/*! \file lc3plus.h * This header provides the API for LC3plus. * * This library is targeting devices with extreme memory limitations, so memory management diff --git a/lib_lc3plus/setup_com_lc3.c b/lib_lc3plus/setup_com_lc3plus.c similarity index 100% rename from lib_lc3plus/setup_com_lc3.c rename to lib_lc3plus/setup_com_lc3plus.c diff --git a/lib_lc3plus/setup_dec_lc3.c b/lib_lc3plus/setup_dec_lc3plus.c similarity index 99% rename from lib_lc3plus/setup_dec_lc3.c rename to lib_lc3plus/setup_dec_lc3plus.c index 7bdbf0523d..9e9a5ea64e 100644 --- a/lib_lc3plus/setup_dec_lc3.c +++ b/lib_lc3plus/setup_dec_lc3plus.c @@ -9,7 +9,7 @@ #include "options.h" #include "wmc_auto.h" -#include "setup_dec_lc3.h" +#include "setup_dec_lc3plus.h" #include "functions.h" #include #include diff --git a/lib_lc3plus/setup_dec_lc3.h b/lib_lc3plus/setup_dec_lc3plus.h similarity index 100% rename from lib_lc3plus/setup_dec_lc3.h rename to lib_lc3plus/setup_dec_lc3plus.h diff --git a/lib_lc3plus/setup_enc_lc3.c b/lib_lc3plus/setup_enc_lc3plus.c similarity index 99% rename from lib_lc3plus/setup_enc_lc3.c rename to lib_lc3plus/setup_enc_lc3plus.c index 750a97bb04..80bd909ab3 100644 --- a/lib_lc3plus/setup_enc_lc3.c +++ b/lib_lc3plus/setup_enc_lc3plus.c @@ -9,7 +9,7 @@ #include "options.h" #include "wmc_auto.h" -#include "setup_enc_lc3.h" +#include "setup_enc_lc3plus.h" #include "functions.h" #include diff --git a/lib_lc3plus/setup_enc_lc3.h b/lib_lc3plus/setup_enc_lc3plus.h similarity index 100% rename from lib_lc3plus/setup_enc_lc3.h rename to lib_lc3plus/setup_enc_lc3plus.h diff --git a/scripts/lc3plus_lib_setup/get_lc3plus.sh b/scripts/lc3plus_lib_setup/get_lc3plus.sh index ea2a893d19..f654768707 100755 --- a/scripts/lc3plus_lib_setup/get_lc3plus.sh +++ b/scripts/lc3plus_lib_setup/get_lc3plus.sh @@ -6,13 +6,13 @@ printf "Cleaning old version of LC3plus\n" rm -rf lib_lc3plus printf "Downloading LC3plus code\n" -if false; then +if true; 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 + curl -o ./lc3plus_sources.zip https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.05.01_60/ts_103634v010501p0.zip unzip lc3plus_sources.zip -d . rm lc3plus_sources.zip - cp -r "ETSI_Release//src/floating_point" lib_lc3plus + cp -r "ETSI_Release/LC3plus_ETSI_src_v5f640bd48cc_20240516/src/floating_point" lib_lc3plus rm -r ETSI_Release else # Temp solution for downloading WIP ETSI package @@ -57,6 +57,10 @@ find lib_lc3plus -name '*.[ch]' -type f -print0 | \ xargs -0 -I {} \ sed -i 's/^#[[:space:]]\+/#/' {} +# 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/lc3plus.c + # Add .clang-format file to lib_lc3plus to disable formatting there printf "Disabling clang-format in lib_lc3plus directory\n" printf ' 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..0c7e1375cc 100644 --- a/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test.c +++ b/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test.c @@ -39,8 +39,12 @@ 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 +#if 0 // TODO remove with upgrade to LC3plus v.1.5.1 / Porting MR 157 +#include "lc3plus.h" +#else #include "lc3.h" #endif +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS 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 7ed17630754f338bf991632a7cde31fdd7436d35 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 11 Aug 2025 11:18:10 +0200 Subject: [PATCH 2/3] disable lc3plus code changes job - will be reenabled later --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 722c09a51e..a3a9e4706a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1006,7 +1006,7 @@ check-first-frame-is-sid: expose_as: "logs-sidstart" expire_in: "5 days" -lc3plus-ensure-no-code-changes: +.lc3plus-ensure-no-code-changes: extends: - .test-job-linux - .rules-merge-request-to-main -- GitLab From e471741a458b204fae5d1002482e81c23a9bebde Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 11 Aug 2025 11:38:10 +0200 Subject: [PATCH 3/3] accept SPLIT_REND_WITH_HEAD_ROT and ISAR_BITSTREAM_UPDATE_LC3PLUS in unit test file --- .../lc3plus_basop/ivas_lc3plus_unit_test.c | 150 ------------------ 1 file changed, 150 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 0c7e1375cc..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,20 +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 -#if 0 // TODO remove with upgrade to LC3plus v.1.5.1 / Porting MR 157 #include "lc3plus.h" -#else -#include "lc3.h" -#endif -#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 @@ -104,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); @@ -122,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 ); @@ -204,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; @@ -225,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 */ @@ -269,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; @@ -290,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; @@ -334,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; } @@ -395,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 @@ -418,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 @@ -442,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; @@ -466,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; @@ -490,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; @@ -515,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; @@ -535,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; @@ -563,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 ); @@ -612,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 ); } @@ -634,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, @@ -845,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 ) @@ -864,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 */ -- GitLab