Skip to content
This diff is collapsed.
#!/usr/bin/env python3
from pathlib import Path
from scipy.io.wavfile import read, write
import numpy as np
MAX_NUM_CH = 20 # number of channel indices in file
MIN_DURATION_MS = 1200 # minimum duration needed for all indices at 16kHz
TESTV_DIR = Path(__file__).parent.joinpath("testv")
def create_vector(fs: int, num_ch: int):
in_file = TESTV_DIR / f"spectral_{fs}.wav"
# requires spectral_{16,32,48}.wav
if not in_file.exists():
raise FileNotFoundError(f"Source file {in_file} not found!")
# validate num_ch
if num_ch > MAX_NUM_CH or num_ch < 1:
raise ValueError(
f"Requested channel count of {num_ch} channels is invalid. Must be between 1 and {MAX_NUM_CH}!"
)
_, data = read(in_file)
# split source file into parts
part_len = data.shape[0] // MAX_NUM_CH
parts = data.reshape(MAX_NUM_CH, part_len).T
duration = fs * MIN_DURATION_MS
out = np.zeros([duration, num_ch], dtype=np.int16)
# populate output vector, loop over the channel indices
# until the duration is reached
for i in range(duration // part_len):
for ch in range(num_ch):
if i % num_ch == ch:
out[i * part_len : (i + 1) * part_len, ch] = parts[:, ch]
write(TESTV_DIR / f"spectral_test_{num_ch}ch_{fs}kHz.wav", fs * 1000, out)
def main():
for fs in [16, 32, 48]:
for ch in range(1, 21):
create_vector(fs, ch)
if __name__ == "__main__":
main()
...@@ -6,13 +6,13 @@ printf "Cleaning old version of LC3plus\n" ...@@ -6,13 +6,13 @@ printf "Cleaning old version of LC3plus\n"
rm -rf lib_lc3plus rm -rf lib_lc3plus
printf "Downloading LC3plus code\n" printf "Downloading LC3plus code\n"
if false; then if true; then
# Waiting for official ETSI release. # Waiting for official ETSI release.
# TODO: add new URL, remove `if false` when package goes public # 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 . unzip lc3plus_sources.zip -d .
rm lc3plus_sources.zip rm lc3plus_sources.zip
cp -r "ETSI_Release/<package name here>/src/floating_point" lib_lc3plus cp -r "ETSI_Release/LC3plus_ETSI_src_v5f640bd48cc_20240516/src/floating_point" lib_lc3plus
rm -r ETSI_Release rm -r ETSI_Release
else else
# Temp solution for downloading WIP ETSI package # Temp solution for downloading WIP ETSI package
...@@ -59,7 +59,7 @@ sed -i 's/^#[[:space:]]\+/#/' {} ...@@ -59,7 +59,7 @@ sed -i 's/^#[[:space:]]\+/#/' {}
# fix for sanitizer issues # 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/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 sed -i 's/~3/(uintptr_t)(~3)/' lib_lc3plus/lc3plus.c
# Add .clang-format file to lib_lc3plus to disable formatting there # Add .clang-format file to lib_lc3plus to disable formatting there
printf "Disabling clang-format in lib_lc3plus directory\n" printf "Disabling clang-format in lib_lc3plus directory\n"
......
...@@ -647,7 +647,7 @@ def runner_setup(runner, args): ...@@ -647,7 +647,7 @@ def runner_setup(runner, args):
"0", "0",
jbm_suffix, jbm_suffix,
] ]
dec_options = ["-Tracefile", "{dec_file_name}.tracefile_dec", "-VOIP"] dec_options = ["-Tracefile", "{dec_file_name}.tracefile_dec", "-no_delay_cmp", "-VOIP"]
add_to_proc_chain(bs_proc_chain, jbm_cmd, dec_options) add_to_proc_chain(bs_proc_chain, jbm_cmd, dec_options)
if args["sidstart"]: if args["sidstart"]:
...@@ -771,7 +771,7 @@ def analyzer_setup(analyzer, args): ...@@ -771,7 +771,7 @@ def analyzer_setup(analyzer, args):
"0", "0",
jbm_suffix, jbm_suffix,
] ]
dec_options = ["-Tracefile", "{dec_file_name}.tracefile_dec", "-VOIP"] dec_options = ["-Tracefile", "{dec_file_name}.tracefile_dec", "-no_delay_cmp", "-VOIP"]
add_to_proc_chain(bs_proc_chain, jbm_cmd, dec_options) add_to_proc_chain(bs_proc_chain, jbm_cmd, dec_options)
if args["sidstart"]: if args["sidstart"]:
......
...@@ -38,16 +38,9 @@ the United Nations Convention on Contracts on the International Sales of Goods. ...@@ -38,16 +38,9 @@ the United Nations Convention on Contracts on the International Sales of Goods.
#include "isar_lc3plus_common.h" #include "isar_lc3plus_common.h"
#include "isar_lc3plus_dec.h" #include "isar_lc3plus_dec.h"
#include "ivas_error_utils.h" #include "ivas_error_utils.h"
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS #include "lc3plus.h"
#include "lc3.h"
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
#define MAX_SAMPLES_PER_CHANNEL 960 / 4 #define MAX_SAMPLES_PER_CHANNEL 960 / 4
#else
#define MAX_SAMPLES_PER_CHANNEL 960
#endif
#define DEFAULT_BPS 256000 #define DEFAULT_BPS 256000
#ifndef PCM_SAMPLE_TYPEDEF_DEFINED #ifndef PCM_SAMPLE_TYPEDEF_DEFINED
...@@ -100,7 +93,6 @@ static int encodeAndDecodeOneStereoFrame( LC3PLUS_CONFIG config, uint32_t bps ) ...@@ -100,7 +93,6 @@ static int encodeAndDecodeOneStereoFrame( LC3PLUS_CONFIG config, uint32_t bps )
uint8_t *bitstream_out = malloc( bitstreamSizePerIvasFrame ); uint8_t *bitstream_out = malloc( bitstreamSizePerIvasFrame );
memset( bitstream_out, 0, bitstreamSizePerIvasFrame ); memset( bitstream_out, 0, bitstreamSizePerIvasFrame );
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
int perChannelBitrate = lc3plus_enc_get_real_bitrate(encHandle->handles[0]); 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 perLc3plusFrameDataBlockOctets = encHandle->num_ftds * perChannelBitrate / 8 / (1000*1000/config.lc3plus_frame_duration_us);
int targetOctets = bps / 8 / (1000*1000/config.isar_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 ) ...@@ -118,9 +110,6 @@ static int encodeAndDecodeOneStereoFrame( LC3PLUS_CONFIG config, uint32_t bps )
Word16 Q_in[16]; 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_in, bitstream_out, bitstreamSizePerIvasFrame, 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 ) if ( IVAS_ERR_OK != err )
{ {
ISAR_LC3PLUS_ENC_Close( &encHandle ); ISAR_LC3PLUS_ENC_Close( &encHandle );
...@@ -200,11 +189,7 @@ static int encodeAndDecodeOneStereoFrame( LC3PLUS_CONFIG config, uint32_t bps ) ...@@ -200,11 +189,7 @@ static int encodeAndDecodeOneStereoFrame( LC3PLUS_CONFIG config, uint32_t bps )
static int openCloseEncoder( void ) static int openCloseEncoder( void )
{ {
ivas_error err; 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 }; 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; uint32_t bps = 128000;
ISAR_LC3PLUS_ENC_HANDLE encHandle; ISAR_LC3PLUS_ENC_HANDLE encHandle;
...@@ -221,36 +206,23 @@ static int openCloseEncoder( void ) ...@@ -221,36 +206,23 @@ static int openCloseEncoder( void )
static int tryOpenEncoderWithInvalidBitrate( void ) static int tryOpenEncoderWithInvalidBitrate( void )
{ {
ivas_error err; 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 }; 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 */ /* lc3plus max bitrate is 320000 per channel */
uint32_t invalid_high_bps = 700000; uint32_t invalid_high_bps = 700000;
uint32_t invalid_low_bps = 8; uint32_t invalid_low_bps = 8;
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
uint32_t limitedBitrate; uint32_t limitedBitrate;
#endif
ISAR_LC3PLUS_ENC_HANDLE encHandle; ISAR_LC3PLUS_ENC_HANDLE encHandle;
err = ISAR_LC3PLUS_ENC_Open( config, invalid_high_bps, &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*/ /* setting an invalid bitrate should result in a limited bitrate*/
if ( IVAS_ERR_OK != err ) 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; return 1;
} }
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
limitedBitrate = lc3plus_enc_get_real_bitrate(encHandle->handles[0]); limitedBitrate = lc3plus_enc_get_real_bitrate(encHandle->handles[0]);
if(limitedBitrate != 320000) if(limitedBitrate != 320000)
{ {
return 1; return 1;
} }
#endif
ISAR_LC3PLUS_ENC_Close(&encHandle); ISAR_LC3PLUS_ENC_Close(&encHandle);
err = ISAR_LC3PLUS_ENC_Open( config, invalid_low_bps, &encHandle ); err = ISAR_LC3PLUS_ENC_Open( config, invalid_low_bps, &encHandle );
/* setting an invalid bitrate should trigger an error - which is what we expect */ /* setting an invalid bitrate should trigger an error - which is what we expect */
...@@ -265,11 +237,7 @@ static int tryOpenEncoderWithInvalidBitrate( void ) ...@@ -265,11 +237,7 @@ static int tryOpenEncoderWithInvalidBitrate( void )
static int tryOpenEncoderWithInvalidFrameDuration( void ) static int tryOpenEncoderWithInvalidFrameDuration( void )
{ {
ivas_error err; 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 }; 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*/ config.lc3plus_frame_duration_us = 1234; /*unsupported frame duration*/
uint32_t bps = 320000; uint32_t bps = 320000;
...@@ -286,11 +254,7 @@ static int tryOpenEncoderWithInvalidFrameDuration( void ) ...@@ -286,11 +254,7 @@ static int tryOpenEncoderWithInvalidFrameDuration( void )
static int tryOpenEncoderWithInvalidSampleRate( void ) static int tryOpenEncoderWithInvalidSampleRate( void )
{ {
ivas_error err; 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 }; 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 */ config.samplerate = 1234; /*unsupported sample rate */
uint32_t bps = 320000; uint32_t bps = 320000;
...@@ -330,22 +294,14 @@ static int tryCallEncoderApiWithInvalidParams( void ) ...@@ -330,22 +294,14 @@ static int tryCallEncoderApiWithInvalidParams( void )
return 1; return 1;
} }
ISAR_LC3PLUS_ENC_Close( &invalidEncHandle ); ISAR_LC3PLUS_ENC_Close( &invalidEncHandle );
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
Word16 Q_in[16]; Word16 Q_in[16];
memset(Q_in, 0, sizeof(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 ) ) 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; return 1;
} }
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
memset(Q_in, 0, sizeof(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 ) ) 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; return 1;
} }
...@@ -391,11 +347,7 @@ static int tryCallDecoderApiWithInvalidParams( void ) ...@@ -391,11 +347,7 @@ static int tryCallDecoderApiWithInvalidParams( void )
static int openCloseDecoderWithCaching( void ) static int openCloseDecoderWithCaching( void )
{ {
ivas_error err; 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 }; 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; ISAR_LC3PLUS_DEC_HANDLE decHandle;
err = ISAR_LC3PLUS_DEC_Open( config, err = ISAR_LC3PLUS_DEC_Open( config,
#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING #ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
...@@ -414,11 +366,7 @@ static int openCloseDecoderWithCaching( void ) ...@@ -414,11 +366,7 @@ static int openCloseDecoderWithCaching( void )
static int openCloseDecoderWithoutCaching( void ) static int openCloseDecoderWithoutCaching( void )
{ {
ivas_error err; 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 }; 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; ISAR_LC3PLUS_DEC_HANDLE decHandle;
err = ISAR_LC3PLUS_DEC_Open( config, err = ISAR_LC3PLUS_DEC_Open( config,
#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING #ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
...@@ -438,11 +386,7 @@ static int openCloseDecoderWithoutCaching( void ) ...@@ -438,11 +386,7 @@ static int openCloseDecoderWithoutCaching( void )
static int tryOpenDecoderWithInvalidFrameDuration( void ) static int tryOpenDecoderWithInvalidFrameDuration( void )
{ {
ivas_error err; 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 }; 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*/ config.lc3plus_frame_duration_us = 1234; /*unsupported frame duration*/
ISAR_LC3PLUS_DEC_HANDLE decHandle; ISAR_LC3PLUS_DEC_HANDLE decHandle;
...@@ -462,11 +406,7 @@ static int tryOpenDecoderWithInvalidFrameDuration( void ) ...@@ -462,11 +406,7 @@ static int tryOpenDecoderWithInvalidFrameDuration( void )
static int tryOpenDecoderWithInvalidSampleRate( void ) static int tryOpenDecoderWithInvalidSampleRate( void )
{ {
ivas_error err; 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 }; 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*/ config.samplerate = 1234; /*unsupported sample rate*/
ISAR_LC3PLUS_DEC_HANDLE decHandle; ISAR_LC3PLUS_DEC_HANDLE decHandle;
...@@ -486,11 +426,7 @@ static int tryOpenDecoderWithInvalidSampleRate( void ) ...@@ -486,11 +426,7 @@ static int tryOpenDecoderWithInvalidSampleRate( void )
static int encodeOneFrame( void ) static int encodeOneFrame( void )
{ {
ivas_error err; 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 }; 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; uint32_t bps = 128000;
ISAR_LC3PLUS_ENC_HANDLE encHandle; ISAR_LC3PLUS_ENC_HANDLE encHandle;
...@@ -511,14 +447,10 @@ static int encodeOneFrame( void ) ...@@ -511,14 +447,10 @@ static int encodeOneFrame( void )
return err; return err;
uint8_t *bitstream_out = malloc( bitstreamSizePerIvasFrame ); uint8_t *bitstream_out = malloc( bitstreamSizePerIvasFrame );
memset( bitstream_out, 0, bitstreamSizePerIvasFrame ); memset( bitstream_out, 0, bitstreamSizePerIvasFrame );
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
Word16 Q_in[16]; 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 ); 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 ) if ( IVAS_ERR_OK != err )
return err; return err;
...@@ -531,11 +463,7 @@ static int encodeOneFrame( void ) ...@@ -531,11 +463,7 @@ static int encodeOneFrame( void )
static int encodeAndDecodeOneMonoFrame( void ) static int encodeAndDecodeOneMonoFrame( void )
{ {
ivas_error err; 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 }; 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; uint32_t bps = 128000;
ISAR_LC3PLUS_ENC_HANDLE encHandle; ISAR_LC3PLUS_ENC_HANDLE encHandle;
...@@ -559,13 +487,9 @@ static int encodeAndDecodeOneMonoFrame( void ) ...@@ -559,13 +487,9 @@ static int encodeAndDecodeOneMonoFrame( void )
uint8_t *bitstream_out = malloc( bitstreamSizePerIvasFrame ); uint8_t *bitstream_out = malloc( bitstreamSizePerIvasFrame );
memset( bitstream_out, 0, bitstreamSizePerIvasFrame ); memset( bitstream_out, 0, bitstreamSizePerIvasFrame );
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
Word16 Q_in[16]; 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_in, bitstream_out, bitstreamSizePerIvasFrame, 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 ) if ( IVAS_ERR_OK != err )
return err; return err;
ISAR_LC3PLUS_ENC_Close( &encHandle ); ISAR_LC3PLUS_ENC_Close( &encHandle );
...@@ -608,11 +532,7 @@ static int encodeAndDecodeOneMonoFrame( void ) ...@@ -608,11 +532,7 @@ static int encodeAndDecodeOneMonoFrame( void )
static int encodeAndDecodeOneStereoFrameIvas20msLc3plus10ms_48kHz( 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 }; 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 ); return encodeAndDecodeOneStereoFrame( config, DEFAULT_BPS );
} }
...@@ -630,140 +550,84 @@ static int encodeAndDecodeOneStereoFrameIvas20msLc3plus10ms_16kHz( void ) ...@@ -630,140 +550,84 @@ static int encodeAndDecodeOneStereoFrameIvas20msLc3plus10ms_16kHz( void )
static int encodeAndDecodeOneStereoFrameIvas5msLc3plus5ms_48kHz( 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 }; 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 ); return encodeAndDecodeOneStereoFrame( config, DEFAULT_BPS );
} }
static int encodeAndDecodeOneStereoFrameIvas10msLc3plus10ms_48kHz( void ) 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 }; 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 ); return encodeAndDecodeOneStereoFrame( config, DEFAULT_BPS );
} }
static int encodeAndDecodeOneMonoFrameIvas20msLc3plus10ms_48kHz( void ) 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 }; 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 ); return encodeAndDecodeOneStereoFrame( config, DEFAULT_BPS );
} }
static int encodeAndDecodeOneMonoFrameIvas5msLc3plus5ms_48kHz( void ) 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 }; 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 ); return encodeAndDecodeOneStereoFrame( config, DEFAULT_BPS );
} }
static int encodeAndDecodeOneStereoFrameIvas20msLc3plus2_5ms_48kHz( void ) 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 }; 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 ); return encodeAndDecodeOneStereoFrame( config, DEFAULT_BPS );
} }
static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_80kbpsPerChannel( void ) 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 }; 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 ); return encodeAndDecodeOneStereoFrame( config, config.channels * 82*1000 );
} }
static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_96kbpsPerChannel( void ) 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 }; 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 ); return encodeAndDecodeOneStereoFrame( config, config.channels * 98*1000 );
} }
static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_124kbpsPerChannel( void ) 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 }; 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 ); return encodeAndDecodeOneStereoFrame( config, config.channels * 126*1000 );
} }
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_800kbpsPerChannel( void ) 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 }; 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 ); return encodeAndDecodeOneStereoFrame( config, config.channels * 800*1000 );
} }
#endif
static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_204800bpsPerChannel( void ) 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 }; 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 ); return encodeAndDecodeOneStereoFrame( config, config.channels * 204800 );
} }
static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_205600bpsPerChannel( void ) 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 }; 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 ); return encodeAndDecodeOneStereoFrame( config, config.channels * 205600 );
} }
static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_206400bpsPerChannel( void ) 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 }; 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 ); return encodeAndDecodeOneStereoFrame( config, config.channels * 206400 );
} }
static int encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_207200bpsPerChannel( void ) 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 }; 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 ); return encodeAndDecodeOneStereoFrame( config, config.channels * 207200 );
} }
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
#include "ivas_lc3plus_unit_test_payload_format.c" #include "ivas_lc3plus_unit_test_payload_format.c"
#endif
int main( int main(
int argc, int argc,
...@@ -841,11 +705,9 @@ int main( ...@@ -841,11 +705,9 @@ int main(
ret = encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_124kbpsPerChannel(); ret = encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_124kbpsPerChannel();
if ( ret != 0 ) if ( ret != 0 )
return 1; return 1;
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
ret = encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_800kbpsPerChannel(); ret = encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_800kbpsPerChannel();
if ( ret != 0 ) if ( ret != 0 )
return 1; return 1;
#endif
/* start configs around the FDL threshold */ /* start configs around the FDL threshold */
ret = encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_204800bpsPerChannel(); ret = encodeAndDecodeOneStereoFrameIvas10msLc3_10ms_48kHz_204800bpsPerChannel();
if ( ret != 0 ) if ( ret != 0 )
...@@ -860,16 +722,8 @@ int main( ...@@ -860,16 +722,8 @@ int main(
if ( ret != 0 ) if ( ret != 0 )
return 1; return 1;
/* end configs around the FDL threshold */ /* end configs around the FDL threshold */
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
ret = run_all_payload_tests(); ret = run_all_payload_tests();
if ( ret != 0 ) if ( ret != 0 )
return 1; return 1;
#endif
return 0; return 0;
} }
#else
int main( void )
{
return EXIT_SUCCESS;
}
#endif /* SPLIT_REND_WITH_HEAD_ROT */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.