Skip to content
......@@ -33,11 +33,12 @@
These files represent the 3GPP EVS Codec Extension for Immersive Voice and
Audio Services (IVAS) floating-point C simulation. All code is writtten
in ISO/IEC C99. The system is implemented as three separate programs:
in ISO/IEC C99. The system is implemented as four separate programs:
IVAS_cod Encoder
IVAS_dec Decoder
IVAS_rend Renderer
IVAS_cod IVAS Encoder
IVAS_dec IVAS Decoder
IVAS_rend IVAS External Renderer
ISAR_post_rend ISAR Post Renderer
For encoding using the coder program, the input is a binary
audio file (*.8k, *.16k, *.32k, *.48k) and the output is a binary
......@@ -128,6 +129,8 @@ should have the following structure:
|-- lib_debug
|-- lib_dec
|-- lib_enc
|-- lib_isar
|-- lib_lc3plus
|-- lib_rend
|-- lib_util
|-- readme.txt
......@@ -135,16 +138,16 @@ should have the following structure:
The package includes a Makefile for gcc, which has been verified on
32-bit Linux systems. The code can be compiled by entering the directory
"c-code" and typing the command: make. The resulting encoder/decoder/renderer
executables are named "IVAS_cod", "IVAS_dec", and "IVAS_rend". All reside
in the c-code directory.
"c-code" and typing the command: make. The resulting encoder/decoder/renderer/
ISAR_post_renderer executables are named "IVAS_cod", "IVAS_dec", "IVAS_rend",
and "ISAR_post_rend". All reside in the c-code directory.
The package also includes a solution-file for Microsoft Visual Studio 2017 (x86).
To compile the code, please open "Workspace_msvc\Workspace_msvc.sln" and build
"encoder" for the encoder, "decoder" for the decoder, and "renderer" for the
renderer executable. The resulting encoder/decoder/renderer executables are
"IVAS_cod.exe", "IVAS_dec.exe", and "IVAS_rend.exe". All reside in the c-code
main directory.
renderer executable. The resulting encoder/decoder/renderer/ISAR_post_renderer
executables are "IVAS_cod.exe", "IVAS_dec.exe", "IVAS_rend.exe", and
"ISAR_post_rend.exe". All reside in the c-code main directory.
RUNNING THE SOFTWARE
......@@ -239,7 +242,8 @@ Usage for IVAS: IVAS_dec.exe [Options] OutputConf Fs bitstream_file output_file
Mandatory parameters:
---------------------
OutputConf : Output configuration: MONO, STEREO, 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4, FOA,
HOA2, HOA3, BINAURAL, BINAURAL_ROOM_IR, BINAURAL_ROOM_REVERB, EXT
HOA2, HOA3, BINAURAL, BINAURAL_ROOM_IR, BINAURAL_ROOM_REVERB,
BINAURAL_SPLIT_CODED, BINAURAL_SPLIT_PCM, EXT
By default, channel order and loudspeaker positions are equal to the
encoder. For loudspeaker outputs, OutputConf can be a custom loudspeaker
layout file. See below for details.
......@@ -284,6 +288,7 @@ Options:
specified) for binaural output configuration
-aeid ID : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output config.
-level level : Complexity level, level = (1, 2, 3), will be defined after characterisation.
-om File : Coded metadata File for BINAURAL_SPLIT_PCM OutputConf
Currently, all values default to level 3 (full functionality).
-q : Quiet mode, limit printouts to terminal, default is deactivated
......@@ -329,11 +334,27 @@ Options:
-g : Input gain (linear, not in dB) to be applied to input audio file
-l : List supported audio formats
-smd : Metadata Synchronization Delay in ms, Default is 0. Quantized by 5ms subframes.
-om File : Coded metadata File for BINAURAL_SPLIT_PCM output format
-level level : Complexity level, level = (1, 2, 3), will be defined after characterisation.
Currently, all values default to level 3 (full functionality).
-q : Quiet mode, limit printouts to terminal, default is deactivated
The usage of the "ISAR_post_rend" program:
------------------------------------------
Usage: ISAR_post_rend [options]
Options:
--------
-i File : Input File (input file is bitstream if format is BINAURAL_SPLIT_CODED, or PCM/WAV file if format is BINAURAL_SPLIT_PCM)
-if Format : Input Format of input (BINAURAL_SPLIT_CODED, BINAURAL_SPLIT_PCM)
-im File : Coded metadata File for BINAURAL_SPLIT_PCM input format
-o File : Output Audio File in BINAURAL format
-fs : Input sampling rate in kHz (48)
-prbfi File : BFI File
MULTICHANNEL LOUDSPEAKER INPUT / OUTPUT CONFIGURATIONS
======================================================
The loudspeaker positions for each MC layouts are assumed to have the following azimuth and elevation
......
/******************************************************************************************************
(C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
contributors to this repository. All Rights Reserved.
This software is protected by copyright law and by international treaties.
The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
contributors to this repository retain full ownership rights in their respective contributions in
the software. This notice grants no license of any kind, including but not limited to patent
license, nor is any license granted by implication, estoppel or otherwise.
Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
contributions.
This software is provided "AS IS", without any express or implied warranties. The software is in the
development stage. It is intended exclusively for experts who have experience with such software and
solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
and fitness for a particular purpose are hereby disclaimed and excluded.
Any dispute, controversy or claim arising under or in relation to providing this software shall be
submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
the United Nations Convention on Contracts on the International Sales of Goods.
*******************************************************************************************************/
For the IVAS Readme.txt, please refer to Readme.txt.
This readme_split_rendering.txt describes a usage of the binaural split
rendering feature in the IVAS codec. This feature is implemented as part of
the following two separate programs:
IVAS_dec Decoder
IVAS_rend Renderer
ISAR_post_rend ISAR_post_renderer
INSTALLING THE SOFTWARE
=======================
Same as described in Readme.txt while the structure looks as follows:
.
`-- c-code
|-- Makefile
|-- Workspace_msvc
|-- apps
|-- lib_com
|-- lib_debug
|-- lib_dec
|-- lib_enc
|-- lib_lc3plus
|-- lib_rend
|-- lib_isar
|-- lib_util
|-- readme.txt
|-- readme_split_rendering.txt
RUNNING THE SOFTWARE
====================
The usage of the "IVAS_cod" program:
------------------------------------
Same as described in Readme.txt.
The usage of the "IVAS_dec" program:
------------------------------------
Same as described in Readme.txt while more command-line options are avilable.
Usage for IVAS: IVAS_dec.exe [Options] OutputConf Fs bitstream_file output_file
Additional options:
-------------------
OutputConf : Output configuration: MONO, STEREO, 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4, FOA,
HOA2, HOA3, BINAURAL, BINAURAL_ROOM_IR, BINAURAL_ROOM_REVERB,
BINAURAL_SPLIT_CODED, BINAURAL_SPLIT_PCM, EXT
-om File : Coded metadata File for BINAURAL_SPLIT_PCM output mode
The usage of the "IVAS_rend" program:
-------------------------------------
Same as described in Readme.txt while more command-line options are avilable.
Usage: IVAS_rend [options]
Additional options:
-------------------
-om File : Coded metadata File for BINAURAL_SPLIT_PCM output mode
The usage of the "ISAR_post_rend" program:
-------------------------------------
Usage: ISAR_post_rend [options]
Options:
--------
-i File : Input File (input file is bitstream if format is BINAURAL_SPLIT_CODED, PCM or WAV file if format is BINAURAL_SPLIT_PCM)
-if Format : Audio Format of input (BINAURAL_SPLIT_CODED, BINAURAL_SPLIT_PCM)
-im File : Coded metadata File for BINAURAL_SPLIT_PCM input mode
-o File : Output audio File (BINAURAL always)
-fs : Input sampling rate in kHz (48)
-prbfi File : Split rendering option: bfi File
RUNNING THE SELF TEST
=====================
Same as described in Readme.txt except of the renderer configuration text file which
can additionally be used to configure the pre-rendering step of the split binaural
renderer. All split renderer parameters are optional.
The detailed syntax of the renderer configuration text can be found in 3GPP TS 26.258.
......@@ -4,7 +4,7 @@ from pathlib import Path
import os
import glob
files = ['Readme_IVAS_JBM_dec.txt','Readme_IVAS_dec.txt','Readme_IVAS_enc.txt','Readme_IVAS_rend.txt'];
files = ['Readme_IVAS_JBM_dec.txt','Readme_IVAS_dec.txt','Readme_IVAS_enc.txt','Readme_IVAS_rend.txt', 'Readme_IVAS_ISAR_dec.txt', 'Readme_IVAS_ISAR_post_rend.txt'];
used_files = []
kept = 0
......
......@@ -1348,6 +1348,10 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
../IVAS_cod -mc 5_1 ../scripts/switchPaths/sw_mctech_5fr.bin 48 testv/stv51MC48c.wav bit
../IVAS_dec BINAURAL_ROOM_REVERB 16 bit testv/stv51MC48c.wav_sw_48-16_Binaural_room.tst
// Multi-channel 5_1 bitrate switching from 13.2 kbps to 512 kbps, 32kHz in, 48kHz out, BINAURAL_ROOM_IR out
../IVAS_cod -mc 5_1 ../scripts/switchPaths/sw_mctech_5fr.bin 32 testv/stv51MC32c.wav bit
../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv51MC32c.wav_sw_32-48_Binaural_room.tst
// Multi-channel 5_1 bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 48kHz out, BINAURAL out, FER at 10%, bandwidth switching
../IVAS_cod -max_band testv/ivas_bws_20fr_start_WB.txt -mc 5_1 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv51MC48c.wav bit
eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_10pct.g192 bit_error
......
#!/usr/bin/env bash
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <CUT_DEC_BIN>"
exit -1
fi
CUT_DEC_BIN=$1
DIFF_BIN="diff"
TESTV_PATH="."
REF_PATH="./testv"
CUT_PATH="./TMP_DEC_ISAR"
LOG_FILE=Readme_IVAS_ISAR_dec_log.txt
rm -rf tmp
rm -rf $CUT_PATH
mkdir -p $CUT_PATH
mkdir -p $CUT_PATH/split_rendering/cut
#!/usr/bin/env bash
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <CUT_ISAR_POST_REND_BIN>"
exit -1
fi
CUT_ISAR_POST_REND_BIN=$1
DIFF_BIN="diff"
TESTV_PATH="."
REF_PATH="./testv"
CUT_PATH="./TMP_ISAR_POST_REND"
LOG_FILE=Readme_IVAS_isar_post_rend_log.txt
rm -rf tmp
rm -rf $CUT_PATH
mkdir -p $CUT_PATH/split_rendering/cut
......@@ -2,39 +2,64 @@
# This script shall only be used by automated continuous integration systems
scriptdir=$(dirname "$0")
pushd "$scriptdir" || exit 1
printf "Cleaning old version of LC3plus\n"
rm -rf lib_lc3plus
# Download and unzip LC3plus code
rm -rf ETSI_Release
curl -o ./lc3plus_sources.zip https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.04.01_60/ts_103634v010401p0.zip
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 .
# Modify LC3plus code to be compatible with IVAS tools (e.g. WMC tool)
git apply --ignore-whitespace lc3plus.patch
sed -i 's/ \({\) \(mdct_apply(.*);\) /\n\1\n \2\n/' ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c
rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c
rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/codec_exe.c
rm lc3plus_sources.zip
cp -r "ETSI_Release/<package name here>/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
# Remove unneeded files
rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/makefile
rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h
rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywaveout_c.h
rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c
rm -r ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc
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/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
# Limit file permissions
find ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point -type f -exec chmod -x {} \;
# Move to output dir
rm -rf ../../lib_lc3plus
mkdir ../../lib_lc3plus
mv ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/* ../../lib_lc3plus
printf "Limiting file permissions\n"
find lib_lc3plus -type f -print0 | \
xargs -0 -I {} \
chmod -x {}
# Create additional files
printf "DisableFormat: true\nSortIncludes: Never\n" > ../../lib_lc3plus/.clang-format
# 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 '
# range: from 1st line to first match
1,/^#include/ {
# insert lines before first match
/^#include/ i\
#include "options.h"\
#include "wmc_auto.h"
}
' {}
# Clean up
rm -rf lc3plus_sources.zip ETSI_Release
# 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:]]\+/#/' {}
popd || exit
# 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 -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_idx_off, LC3_FLOAT* gain, LC3_INT target, LC3_INT nBits, LC3_INT* gainChange, LC3_INT fs_idx
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "stdint.h"
#include <assert.h>
#include <stdlib.h>
@@ -1010,8 +1011,8 @@
LC3_UINT8 blacklist[FEC_N_MODES];
LC3_INT32 rop;
- rop = 0;
void (*syndr_calc[3])(LC3_UINT8 *, LC3_UINT8 *, LC3_INT32);
+ rop = 0;
/* initialization */
blacklist[0] = 0;
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
void processApplyGlobalGain_fl(LC3_FLOAT x[], LC3_INT xLen, LC3_INT global_gain_idx, LC3_INT global_gain_off)
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
static void ac_shift_fl(Encoder_State_fl* st);
@@ -620,7 +621,7 @@
if (st.pc_c_bp_side != 0)
{
- nbits_side = total_bits - 8 * (st.pc_b_left) + 8 * (st.pc_bytes - bp_side) - (8 - LC3_LOG2(mask_side));
+ nbits_side = total_bits - 8 * (st.pc_b_left) + 8 * (st.pc_bytes - bp_side) - (8 - LC3_LOGTWO(mask_side));
}
}
@@ -891,7 +892,7 @@
{
LC3_INT bits = 0, mask = 0, val = 0, over1 = 0, high = 0, over2 = 0, c = 0, b = 0;
- bits = 24 - floor(LC3_LOG2(st->range));
+ bits = 24 - floor(LC3_LOGTWO(st->range));
mask = ((LC3_INT)pow(2, 24) - 1) >> bits;
val = st->low + mask;
over1 = val >> 24;
@@ -1078,8 +1079,8 @@
}
/* Residual bits */
- nbits_side = total_bits - (8 * (*(st.bp_side) + 1) + 8 - LC3_LOG2(*(st.mask_side)));
- nbits_ari = (st.bp + 1) * 8 + 25 - floor(LC3_LOG2(st.range));
+ nbits_side = total_bits - (8 * (*(st.bp_side) + 1) + 8 - LC3_LOGTWO(*(st.mask_side)));
+ nbits_ari = (st.bp + 1) * 8 + 25 - floor(LC3_LOGTWO(st.range));
if (st.cache >= 0) {
nbits_ari = nbits_ari + 8;
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT* lastAttackPosition, LC3_FLOAT* accNrg, LC3_INT* attackFlag,
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
/* DCT */
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
void process_cutoff_bandwidth(LC3_FLOAT *d_fl, LC3_INT len, LC3_INT bw_bin)
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
void dct2_init(Dct2* dct, int length)
@@ -27,11 +28,11 @@
void dct2_apply(Dct2* dct, const LC3_FLOAT* input, LC3_FLOAT* output)
{
- assert(input != output);
Complex tmp1[MAX_LEN];
Complex tmp2[MAX_LEN];
int i = 0;
const int len = dct->length;
+ assert(input != output);
for (i = 0; i < len / 2; i++) {
tmp1[i] = cmplx(input[i * 2], 0);
@@ -49,8 +50,8 @@
void dct4_init(Dct4* dct, int length)
{
- assert(length <= MAX_LEN);
int i = 0;
+ assert(length <= MAX_LEN);
dct->length = length;
dct->twid1 = calloc(sizeof(*dct->twid1), length / 2);
dct->twid2 = calloc(sizeof(*dct->twid2), length / 2);
@@ -73,12 +74,12 @@
void dct4_apply(Dct4* dct, const LC3_FLOAT* input, LC3_FLOAT* output)
{
- assert(input != output);
Complex tmp2[MAX_LEN / 2];
int i = 0;
Complex* tmp1 = (Complex*)output;
const int len = dct->length;
const LC3_FLOAT norm = (LC3_FLOAT)1.0 / LC3_SQRT((LC3_FLOAT)(len >> 1));
+ assert(input != output);
for (i = 0; i < len / 2; i++) {
tmp1[i] = cmul(cmplx(input[i * 2], input[len - i * 2 - 1]), dct->twid1[i]);
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
static void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit);
@@ -53,7 +54,7 @@
LC3_INT nbbytes = nbbits >> 3;
LC3_INT lastnz;
LC3_INT bw_cutoff_idx;
- LC3_INT nbits = ceil(LC3_LOG2(L_spec / 2));
+ LC3_INT nbits = ceil(LC3_LOGTWO(L_spec / 2));
if (nbits > nbbits)
{
@@ -173,7 +174,7 @@
}
/* Last non-zero tuple */
- read_uint_fl(ceil(LC3_LOG2(N / 2)), ptr, &mask_side_local, &bp_side_local, lastnz);
+ read_uint_fl(ceil(LC3_LOGTWO(N / 2)), ptr, &mask_side_local, &bp_side_local, lastnz);
*lastnz = (*lastnz + 1) * 2;
if (*lastnz > N) {
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
@@ -53,8 +54,8 @@
if (decoder->rframe == 1 && zero_frame == 0 && bfi != 1)
{
- bfi = 2;
LC3_INT32 max_bw_stopband = BW_cutoff_bin_all[bw_cutoff_idx];
+ bfi = 2;
switch (decoder->frame_dms)
{
# ifdef ENABLE_025_DMS_MODE
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-06-29 12:58:27
@@ -24,13 +24,13 @@
typedef uint32_t LC3_UINT32;
/* Release defines */
-#define ENABLE_2_5MS_MODE
+// #define ENABLE_2_5MS_MODE
#define ENABLE_5MS_MODE
#define ENABLE_10_MS_MODE
#define ENABLE_ADVANCED_PLC_FL
#define ENABLE_ADVANCED_PLC_FL_DEFAULT
#define ENABLE_BW_CONTROLLER
-#define ENABLE_HR_MODE_FL
+//#define ENABLE_HR_MODE_FL
#define ENABLE_PADDING
#define ENABLE_RFRAME_FL
#define ENABLE_PLC
@@ -49,8 +49,8 @@
/* Precision Defines */
#define LC3_FABS(x) (fabsf(x))
#define LC3_POW(x, y) (powf(x, y))
-#define LC3_LOG10(x) (log10f(x))
-#define LC3_LOG2(x) (log2f(x))
+#define LC3_LOGTEN(x) (log10f(x))
+#define LC3_LOGTWO(x) (log2f(x))
# define LC3_COS(x) (cos(x))
# define LC3_SIN(x) (sin(x))
#define LC3_SQRT(x) (sqrtf(x))
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
void processDetectCutoffWarped_fl(LC3_FLOAT* d2, LC3_INT fs_idx, LC3_INT frame_dms, LC3_INT* bw_idx)
@@ -68,7 +69,7 @@
dist = bw_dist[counter];
for (i = stop; i >= stop - dist; i--) {
- e_diff = 10.0 * LC3_LOG10(d2[i - dist + 1] + FLT_EPSILON) - 10.0 * LC3_LOG10(d2[i + 1] + FLT_EPSILON);
+ e_diff = 10.0 * LC3_LOGTEN(d2[i - dist + 1] + FLT_EPSILON) - 10.0 * LC3_LOGTEN(d2[i + 1] + FLT_EPSILON);
if (e_diff > thr) {
brickwall = 1;
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
void processEncoderEntropy_fl(LC3_UINT8* bytes, LC3_INT* bp_side, LC3_INT* mask_side, LC3_INT numbytes, LC3_INT bw_cutoff_bits,
@@ -33,11 +34,11 @@
/* Last non zero touple */
if (bfi_ext == 1) {
- write_uint_backward_fl(ptr, bp_side, mask_side, lastnzTrigger[fs_idx], ceil(LC3_LOG2(N >> 1)));
+ write_uint_backward_fl(ptr, bp_side, mask_side, lastnzTrigger[fs_idx], ceil(LC3_LOGTWO(N >> 1)));
}
else
{
- write_uint_backward_fl(ptr, bp_side, mask_side, lastnz / 2 - 1, ceil(LC3_LOG2(N / 2)));
+ write_uint_backward_fl(ptr, bp_side, mask_side, lastnz / 2 - 1, ceil(LC3_LOGTWO(N / 2)));
}
/* LSB mode bit */
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
static void Enc_LC3PLUS_Channel_fl(LC3PLUS_Enc* encoder, int channel, int32_t* s_in, uint8_t* bytes, int bps
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
@@ -60,8 +61,8 @@
} else {
g_min = x_max / (32767 - 0.375);
}
- /* Prevent positive rounding errors from LC3_LOG10 function */
- ind_min = 28.0 * LC3_LOG10(g_min);
+ /* Prevent positive rounding errors from LC3_LOGTEN function */
+ ind_min = 28.0 * LC3_LOGTEN(g_min);
ind_min = ceil(ind_min + LC3_FABS(ind_min) * LC3_EPS);
@@ -76,7 +77,7 @@
tmp += x[i + 1] * x[i + 1];
tmp += x[i + 2] * x[i + 2];
tmp += x[i + 3] * x[i + 3];
- en[j] = (28.0 / 20.0) * (7 + 10.0 * LC3_LOG10(tmp + reg_val));
+ en[j] = (28.0 / 20.0) * (7 + 10.0 * LC3_LOGTEN(tmp + reg_val));
j++;
}
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-06-29 12:58:27
@@ -8,7 +8,7 @@
******************************************************************************/
-
+#include "options.h"
#include "cfft.h"
#include "iisfft.h" /* for M_PIl */
#include <stdlib.h> /* for abs() */
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-06-29 12:58:27
@@ -8,14 +8,15 @@
******************************************************************************/
+#include "options.h"
#include <assert.h>
#include <stddef.h>
-#include "iis_fft.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "../structs.h"
+#include <math.h>
+#include "iis_fft.h"
/**************************************************************************************************/
/* AFFT uses two fft implementations
@@ -24,9 +25,6 @@
fast lengths, check the fft_n function.
*/
-#include <math.h>
-#include "cfft.h"
-#include "iisfft.h"
#define FFT_COMPLEX 1
#define FFT_REAL 2
@@ -122,12 +120,13 @@
IIS_FFT_ERROR LC3_IIS_FFT_Apply_CFFT(HANDLE_IIS_FFT handle, const Complex* input, Complex* output)
{
+ LC3_FLOAT* dummy;
if (!handle)
return IIS_FFT_INTERNAL_ERROR;
/* check for inplace operation */
memmove(output, input, sizeof(*input) * handle->len);
- LC3_FLOAT* dummy = (LC3_FLOAT*)output;
+ dummy = (LC3_FLOAT*)output;
if (handle->cfft.len > 0) {
LC3_cfft_apply(&handle->cfft, dummy, dummy + 1, 2);
} else {
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-06-29 12:58:27
@@ -12,6 +12,7 @@
#define IIS_FFT_H
#include "../structs.h"
+#include "../defines.h"
#include "cfft.h"
#ifdef __cplusplus
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include <assert.h>
#include <string.h> /* for mmove */
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-06-29 12:58:27
@@ -11,6 +11,7 @@
#ifndef IISFFT_H
#define IISFFT_H
+#include "../defines.h"
#ifndef M_PIl
#define M_PIl 3.1415926535897932384626433832795029L /* pi */
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
/* Function expects already flipped window */
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "lc3.h"
#include "defines.h"
#include "functions.h"
@@ -48,8 +49,9 @@
case 44100: return 1;
case 48000: return 1;
case 96000: return 1;
- default: return 0;
+ default: break;
}
+ return 0;
}
static int lc3plus_plc_mode_supported(LC3PLUS_PlcMode plc_mode)
@@ -58,8 +60,9 @@
{
case LC3PLUS_PLC_ADVANCED: /* fallthru */
return 1;
- default: return 0;
+ default: break;
}
+ return 0;
}
static int lc3plus_frame_size_supported(float frame_ms)
@@ -69,8 +72,9 @@
case 25: /* fallthru */
case 50: /* fallthru */
case 100: return 1;
- default: return 0;
+ default: break;
}
+ return 0;
}
static int null_in_list(void **list, int n)
@@ -97,13 +101,14 @@
/* encoder functions *********************************************************/
LC3PLUS_Error lc3plus_enc_init(LC3PLUS_Enc *encoder, int samplerate, int channels, int hrmode, int32_t lfe_channel_array[])
{
+ int ch = 0;
+
RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR);
RETURN_IF((uintptr_t)encoder % 4 != 0, LC3PLUS_ALIGN_ERROR);
RETURN_IF(!lc3plus_samplerate_supported(samplerate), LC3PLUS_SAMPLERATE_ERROR);
RETURN_IF(!lc3plus_channels_supported(channels), LC3PLUS_CHANNELS_ERROR);
RETURN_IF(samplerate==96000 && hrmode == 0, LC3PLUS_HRMODE_ERROR);
- int ch = 0;
for (ch = 0; ch < channels; ch++)
{
RETURN_IF(!lc3_enc_supported_lfe() && lfe_channel_array[ch], LC3PLUS_LFE_MODE_NOT_SUPPORTED);
@@ -142,6 +147,7 @@
int lc3plus_enc_get_real_bitrate(const LC3PLUS_Enc *encoder)
{
int ch = 0, totalBytes = 0;
+ int bitrate;
RETURN_IF(encoder == NULL, 0);
RETURN_IF(!encoder->lc3_br_set, LC3PLUS_BITRATE_UNSET_ERROR);
@@ -150,7 +156,7 @@
totalBytes += encoder->channel_setup[ch]->targetBytes;
}
- int bitrate = (totalBytes * 80000.0 + encoder->frame_dms - 1) / encoder->frame_dms;
+ bitrate = (totalBytes * 80000.0 + encoder->frame_dms - 1) / encoder->frame_dms;
if (encoder->fs_in == 44100)
{
@@ -191,11 +197,13 @@
LC3PLUS_Error lc3plus_enc_set_bandwidth(LC3PLUS_Enc *encoder, int bandwidth)
{
+ LC3_INT effective_fs;
+
RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR);
#ifdef ENABLE_HR_MODE_FL_FLAG
RETURN_IF(encoder->hrmode == 1, LC3PLUS_HRMODE_BW_ERROR);
#endif
- LC3_INT effective_fs = encoder->fs_in;
+ effective_fs = encoder->fs_in;
if (encoder->bandwidth != bandwidth) {
if (encoder->fs_in > 40000) {
effective_fs = 40000;
@@ -338,9 +346,9 @@
LC3PLUS_Error lc3plus_free_encoder_structs(LC3PLUS_Enc* encoder)
{
+ int ch = 0;
RETURN_IF(!encoder, LC3PLUS_NULL_ERROR);
- int ch = 0;
for (ch = 0; ch < encoder->channels; ch++) {
mdct_free(&encoder->channel_setup[ch]->mdctStruct);
dct2_free(&encoder->channel_setup[ch]->dct2StructSNS);
@@ -351,9 +359,9 @@
LC3PLUS_Error lc3plus_free_decoder_structs(LC3PLUS_Dec* decoder)
{
+ int ch = 0;
RETURN_IF(!decoder, LC3PLUS_NULL_ERROR);
- int ch = 0;
for (ch = 0; ch < decoder->channels; ch++) {
dct4_free(&decoder->channel_setup[ch]->dct4structImdct);
real_fft_free(&decoder->channel_setup[ch]->PlcAdvSetup->PlcPhEcuSetup.PhEcu_Fft);
@@ -378,11 +386,14 @@
LC3PLUS_Error lc3plus_enc_set_ep_mode(LC3PLUS_Enc *encoder, LC3PLUS_EpMode epmode)
{
+ LC3PLUS_EpMode oldEpmode;
+ LC3PLUS_Error error;
+
RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR);
RETURN_IF((unsigned)epmode > LC3PLUS_EP_HIGH, LC3PLUS_EPMODE_ERROR);
- LC3PLUS_EpMode oldEpmode = encoder->epmode;
+ oldEpmode = encoder->epmode;
encoder->epmode = epmode;
- LC3PLUS_Error error = encoder->lc3_br_set ? update_enc_bitrate(encoder, encoder->bitrate) : LC3PLUS_OK;
+ error = encoder->lc3_br_set ? update_enc_bitrate(encoder, encoder->bitrate) : LC3PLUS_OK;
if (error != LC3PLUS_OK)
{
encoder->epmode = oldEpmode; // preserve old epmode in case of failure
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c 1970-01-01 01:00:00
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c 2023-06-29 12:58:27
@@ -0,0 +1,99 @@
+/******************************************************************************
+* ETSI TS 103 634 V1.4.1 *
+* Low Complexity Communication Codec Plus (LC3plus) *
+* *
+* Copyright licence is solely granted through ETSI Intellectual Property *
+* Rights Policy, 3rd April 2019. No patent licence is granted by implication, *
+* estoppel or otherwise. *
+******************************************************************************/
+
+
+#include "options.h"
+#include "functions.h"
+#include "fft/iis_fft.c"
+#include "fft/iisfft.c"
+#include "fft/cfft.c"
+
+void fft_init(Fft* fft, int length)
+{
+ HANDLE_IIS_FFT handle = NULL;
+ IIS_FFT_ERROR error = 0;
+ assert(length % 2 == 0);
+
+ fft->length = length;
+
+ error = LC3_IIS_CFFT_Create(&handle, length, IIS_FFT_FWD);
+
+ assert(error == IIS_FFT_NO_ERROR);
+ fft->handle = handle;
+}
+
+void fft_free(Fft* fft)
+{
+ IIS_FFT_ERROR error = 0;
+
+ if (fft) {
+ error = LC3_IIS_CFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle);
+
+ assert(error == IIS_FFT_NO_ERROR);
+ memset(fft, 0, sizeof(*fft));
+ }
+}
+
+void real_fft_free(Fft* fft)
+{
+ IIS_FFT_ERROR error = 0;
+
+ if (fft) {
+ error = LC3_IIS_RFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle);
+
+ assert(error == IIS_FFT_NO_ERROR);
+ memset(fft, 0, sizeof(*fft));
+ }
+}
+
+void real_fft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle)
+{
+ IIS_FFT_ERROR error = IIS_FFT_NO_ERROR;
+ assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/
+
+ fft->length = length;
+
+ error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_FWD);
+ assert(error == IIS_FFT_NO_ERROR);
+ fft->handle = *handle;
+}
+
+
+void real_ifft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle)
+{
+ IIS_FFT_ERROR error = IIS_FFT_NO_ERROR;
+ assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/
+
+ fft->length = length;
+
+ error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_BWD);
+
+ assert(error == IIS_FFT_NO_ERROR);
+ fft->handle = *handle;
+}
+
+void fft_apply(Fft* fft, const Complex* input, Complex* output)
+{
+ IIS_FFT_ERROR error = 0;
+ error = LC3_IIS_FFT_Apply_CFFT(fft->handle, input, output);
+
+ assert(error == IIS_FFT_NO_ERROR);
+}
+
+
+void real_fft_apply(Fft* fft, const LC3_FLOAT* input, LC3_FLOAT* output)
+{
+ IIS_FFT_ERROR error = IIS_FFT_NO_ERROR;
+
+ UNUSED(error);
+
+ error = LC3_IIS_FFT_Apply_RFFT(fft->handle, input, output);
+
+ assert(error == IIS_FFT_NO_ERROR);
+}
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
static LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len);
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT fs, LC3_FLOAT* mem_old_x, LC3_FLOAT* mem_old_y,
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
static const LC3_FLOAT* mdct_window(LC3_INT length, LC3_INT frame_dms, LC3_INT hrmode)
@@ -104,6 +105,7 @@
{
LC3_FLOAT tmp[MAX_LEN * 2] = {0};
LC3_INT i = 0;
+ LC3_INT hlen;
move_float(tmp, mdct->mem, mdct->mem_length);
move_float(tmp + mdct->mem_length, input, mdct->length);
@@ -112,7 +114,7 @@
mult_vec(tmp, mdct->window, mdct->length * 2);
- LC3_INT hlen = mdct->length / 2;
+ hlen = mdct->length / 2;
for (i = 0; i < hlen; i++) {
output[i] = -tmp[hlen * 3 - i - 1] - tmp[hlen * 3 + i];
output[hlen + i] = tmp[i] - tmp[hlen * 2 - i - 1];
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
void processMdctShaping_fl(LC3_FLOAT x[], LC3_FLOAT scf[], const LC3_INT bands_offset[], LC3_INT fdns_npts)
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore 1970-01-01 01:00:00
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore 2023-06-29 12:58:27
@@ -0,0 +1 @@
+Win32/
\ No newline at end of file
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-06-29 12:58:35
@@ -8,15 +8,16 @@
******************************************************************************/
#include "functions.h"
+#include "options.h"
void processNearNyquistdetector_fl(LC3_INT16* near_nyquist_flag, const LC3_INT fs_idx, const LC3_INT near_nyquist_index,
const LC3_INT bands_number, const LC3_FLOAT* ener)
{
*near_nyquist_flag = 0;
-
+
if (fs_idx < 4)
- {
+ {
LC3_INT i = 0;
LC3_FLOAT ener_low = FLT_EPSILON, ener_high = 0;
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
void processNoiseFactor_fl(LC3_INT* fac_ns_idx, LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gg, LC3_INT BW_cutoff_idx, LC3_INT frame_dms,
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
void processNoiseFilling_fl(LC3_FLOAT xq[], LC3_INT nfseed, LC3_INT fac_ns_idx, LC3_INT bw_stopband, LC3_INT frame_dms, LC3_FLOAT fac_ns_pc, LC3_INT spec_inv_idx)
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
static void filter_olpa(LC3_FLOAT* in, LC3_FLOAT* out, const LC3_FLOAT* buf, LC3_FLOAT len_buf, LC3_INT len_input);
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
void processPerBandEnergy_fl(LC3_INT bands_number, const LC3_INT* acc_coeff_per_band, LC3_INT16 hrmode, LC3_INT16 frame_dms, LC3_FLOAT* d2, LC3_FLOAT* d)
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
void processPlcMain_fl(LC3_FLOAT *q_d_fl_c, LC3_FLOAT *syntM_fl_c, LC3PLUS_Dec* decoder, DecSetup* h_DecSetup, LC3_INT bfi,
@@ -56,6 +57,8 @@
{
case 2:
{
+ LC3_FLOAT pitch_fl_c;
+
assert(decoder->fs_idx == floor(decoder->fs / 10000));
// phaseECU supports only 10ms framing
assert(PlcSetup->nbLostCmpt != 0 || decoder->frame_dms == 100);
@@ -69,7 +72,7 @@
}
/* call phaseEcu */
- LC3_FLOAT pitch_fl_c = (LC3_FLOAT)ltpf_pitch_int + (LC3_FLOAT)ltpf_pitch_fr / 4.0; /* use non-rounded pitch indeces */
+ pitch_fl_c = (LC3_FLOAT)ltpf_pitch_int + (LC3_FLOAT)ltpf_pitch_fr / 4.0; /* use non-rounded pitch indeces */
if (prev_bfi_plc2 == 0)
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "defines.h"
#include "functions.h"
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "defines.h"
#include "functions.h"
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "defines.h"
#include "functions.h"
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "defines.h"
#include "functions.h"
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "defines.h"
#include "functions.h"
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "defines.h"
#include "functions.h"
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "defines.h"
#include "functions.h"
@@ -135,13 +136,13 @@
if (max_xfp_abs >= 0.5)
{
- PLC2_Q_flt = (LC3_FLOAT)LC3_FLOOR(LC3_LOG2(32768 / 2 / 2 / max_xfp_abs));
+ PLC2_Q_flt = (LC3_FLOAT)LC3_FLOOR(LC3_LOGTWO(32768 / 2 / 2 / max_xfp_abs));
Q_scale_flt = LC3_POW(2.0, PLC2_Q_flt) / fx_fft_scale / fft_fs_scale; /* basop way using xfp scale */
/* C-Float additional safety limit/verification of the integer xfp based scaling using the available C-float Xabs max value inp_high as well */
{
LC3_FLOAT tmp_scale;
- tmp_scale = LC3_POW(2.0, LC3_FLOOR(LC3_LOG2(32768 / 2 / 2 / inp_high)));
+ tmp_scale = LC3_POW(2.0, LC3_FLOOR(LC3_LOGTWO(32768 / 2 / 2 / inp_high)));
if (Q_scale_flt > tmp_scale) {
Q_scale_flt = tmp_scale;
}
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "defines.h"
#include "functions.h"
#include "constants.h"
@@ -30,6 +31,7 @@
LC3_INT32 segmentLen, e;
LC3_FLOAT Xph;
LC3_FLOAT seed_local;
+ LC3_INT32 binCounter, subInd;
UNUSED(corr_phase_dbg);
UNUSED(X_i_new_re_dbg);
@@ -49,8 +51,8 @@
// EVOLVE PHASE -----------------
- LC3_INT32 binCounter = 1;
- LC3_INT32 subInd = 0;
+ binCounter = 1;
+ subInd = 0;
one_peak_flag_mask = -1;
if (n_plocs < 3 && n_plocs > 0) {
@@ -219,9 +221,10 @@
}
static LC3_INT32 own_rand(LC3_INT32 seed) {
- assert(seed <= 32767 && seed >= -32768);
- LC3_INT32 retSeed = (13849 + (seed + 32768) * 31821) & 65535;
- retSeed -= 32768;
+ LC3_INT32 retSeed;
+ assert(seed <= 32767 && seed >= -32768);
+ retSeed = (13849 + (seed + 32768) * 31821) & 65535;
+ retSeed -= 32768;
assert(retSeed <= 32767 && retSeed >= -32768);
return retSeed;
}
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-06-29 12:58:35
@@ -6,13 +6,14 @@
* Rights Policy, 3rd April 2019. No patent licence is granted by implication, *
* estoppel or otherwise. *
******************************************************************************/
-
+
+#include "options.h"
#include "defines.h"
#include "functions.h"
-void plc_phEcu_tba_per_band_gain(LC3_INT32 n_grp, LC3_FLOAT *gr_pow_left, LC3_FLOAT *gr_pow_right, LC3_FLOAT *trans, LC3_FLOAT *grp_pow_change)
+void plc_phEcu_tba_per_band_gain(LC3_INT32 n_grp, LC3_FLOAT *gr_pow_left, LC3_FLOAT *gr_pow_right, LC3_FLOAT *trans, LC3_FLOAT *grp_pow_change)
{
LC3_INT32 i;
@@ -34,10 +35,10 @@
trans[i] = 1.0; /* 0/0 no transient , no power change */
}
}
- grp_pow_change[i] = (LC3_FLOAT) 10.0 * LC3_LOG10(trans[i]);
+ grp_pow_change[i] = (LC3_FLOAT) 10.0 * LC3_LOGTEN(trans[i]);
}
- return;
+ return;
}
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "defines.h"
#include "functions.h"
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "defines.h"
#include "functions.h"
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-06-29 12:58:35
@@ -6,16 +6,17 @@
* Rights Policy, 3rd April 2019. No patent licence is granted by implication, *
* estoppel or otherwise. *
******************************************************************************/
-
+
+#include "options.h"
#include "defines.h"
#include "functions.h"
-void plc_phEcu_trans_burst_ana_sub(LC3_INT32 fs_idx, LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FLOAT *oold_spect_shape,
- LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_spect_shape,
+void plc_phEcu_trans_burst_ana_sub(LC3_INT32 fs_idx, LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FLOAT *oold_spect_shape,
+ LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_spect_shape,
LC3_FLOAT *old_EwPtr, LC3_FLOAT *stPhECU_beta_mute,
- LC3_FLOAT *stPhECU_mag_chg_1st, LC3_FLOAT *stPhECU_Xavg, LC3_FLOAT *alpha, LC3_FLOAT *beta, LC3_FLOAT *mag_chg, LC3_INT32 *tr_dec_dbg, LC3_FLOAT *gpc_dbg)
+ LC3_FLOAT *stPhECU_mag_chg_1st, LC3_FLOAT *stPhECU_Xavg, LC3_FLOAT *alpha, LC3_FLOAT *beta, LC3_FLOAT *mag_chg, LC3_INT32 *tr_dec_dbg, LC3_FLOAT *gpc_dbg)
{
LC3_FLOAT gr_pow_left[MAX_LGW];
LC3_FLOAT gr_pow_right[MAX_LGW];
@@ -27,7 +28,7 @@
LC3_INT32 attDegreeFrames;
LC3_FLOAT thresh_dbg;
-
+
UNUSED(tr_dec_dbg);
UNUSED(gpc_dbg);
@@ -39,7 +40,7 @@
}
-
+
plc_phEcu_tba_trans_dect_gains(burst_len, n_grp, grp_pow_change, stPhECU_beta_mute, stPhECU_mag_chg_1st, alpha, beta, mag_chg, ph_dith, tr_dec, att_val, &attDegreeFrames, &thresh_dbg);
return;
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
/***************************************************************************\
* contents/description: Main function for Time domain concealment
\***************************************************************************/
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
#include "functions.h"
+#include "options.h"
void processPlcUpdate_fl(PlcAdvSetup *PlcAdvSetup, LC3_INT32 frame_length, LC3_FLOAT *syntM, LC3_FLOAT *scf_q,
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
static LC3_INT sign(LC3_FLOAT x);
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
void process_resamp12k8_fl(LC3_FLOAT x[], LC3_INT x_len, LC3_FLOAT mem_in[], LC3_INT mem_in_len, LC3_FLOAT mem_50[], LC3_FLOAT mem_out[],
@@ -17,6 +18,8 @@
LC3_INT len_12k8 = 0, N12k8 = 0, i = 0, k = 0;
LC3_FLOAT mac = 0, buf_out[120 + MAX_LEN] = {0}, bufdown[128] = {0}, buf[120 + MAX_LEN] = {0};
+ LC3_INT32 index_int, index_frac, resamp_upfac, resamp_delay, resamp_off_int, resamp_off_frac;
+ LC3_FLOAT u_11, u_21, u_1, u_2;
const LC3_FLOAT *filter;
const LC3_FLOAT *filt_input, *filt_coeff;
@@ -49,12 +52,12 @@
/* Upsampling & Low-pass Filtering & Downsampling */
- LC3_INT32 index_int = 1;
- LC3_INT32 index_frac = 0;
- LC3_INT32 resamp_upfac = resamp_params[fs_idx][0];
- LC3_INT32 resamp_delay = resamp_params[fs_idx][1];
- LC3_INT32 resamp_off_int = resamp_params[fs_idx][2];
- LC3_INT32 resamp_off_frac = resamp_params[fs_idx][3];
+ index_int = 1;
+ index_frac = 0;
+ resamp_upfac = resamp_params[fs_idx][0];
+ resamp_delay = resamp_params[fs_idx][1];
+ resamp_off_int = resamp_params[fs_idx][2];
+ resamp_off_frac = resamp_params[fs_idx][3];
k = 0;
for (i = 0; i < N12k8; i++) {
@@ -78,9 +81,8 @@
/* 50Hz High-Pass */
- LC3_FLOAT u_11 = mem_50[0];
- LC3_FLOAT u_21 = mem_50[1];
- LC3_FLOAT u_1, u_2;
+ u_11 = mem_50[0];
+ u_21 = mem_50[1];
for (i = 0; i < len_12k8; i++) {
LC3_FLOAT y1 = (highpass50_filt_b[0] * bufdown[i] + u_11);
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
void processResidualCoding_fl(LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gain, LC3_INT L_spec, LC3_INT targetBits, LC3_INT nBits, uint8_t* resBits, LC3_INT* numResBits
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
void processResidualDecoding_fl(LC3_INT* bitsRead, LC3_FLOAT x[], LC3_INT L_spec, uint8_t prm[], LC3_INT resQBits
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
#include "functions.h"
+#include "options.h"
LC3_FLOAT array_max_abs(LC3_FLOAT *in, LC3_INT32 len)
{
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "setup_dec_lc3.h"
#include "functions.h"
#include <stdio.h>
@@ -32,6 +33,7 @@
LC3_FLOAT *sine_table1_phecu, *sine_table2_phecu;
HANDLE_IIS_FFT handle_fft_phaseecu;
HANDLE_IIS_FFT handle_ifft_phaseecu;
+ LC3_FLOAT *q_old_res;
for (ch = 0; ch < channels; ch++) {
DecSetup* setup = balloc(decoder, &size, sizeof(DecSetup));
@@ -56,7 +58,7 @@
sine_table1_phecu = balloc(decoder, &size, sizeof(LC3_FLOAT) * (((CODEC_FS(samplerate) * 16) / 1000) / 2 + 1));
sine_table2_phecu = balloc(decoder, &size, sizeof(LC3_FLOAT) * (((CODEC_FS(samplerate) * 16) / 1000) / 2 + 1));
- LC3_FLOAT *q_old_res = balloc(decoder, &size, sizeof(LC3_FLOAT) * frame_len);
+ q_old_res = balloc(decoder, &size, sizeof(LC3_FLOAT) * frame_len);
if (decoder) {
decoder->channel_setup[ch] = setup;
@@ -346,6 +348,7 @@
LC3PLUS_Error update_dec_bitrate(LC3PLUS_Dec* decoder, int ch, int nBytes)
{
int totalBits = 0, bitsTmp = 0, channel_bytes = 0, maxBytes = 0, minBytes = 0;
+ DecSetup* setup;
if (decoder->hrmode)
{
@@ -375,7 +378,7 @@
channel_bytes = nBytes;
- DecSetup* setup = decoder->channel_setup[ch];
+ setup = decoder->channel_setup[ch];
if (channel_bytes < minBytes || channel_bytes > maxBytes)
{
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "setup_enc_lc3.h"
#include "functions.h"
#include <stdio.h>
@@ -33,6 +34,7 @@
, int32_t lfe_channel_array[]
)
{
+ int ch = 0;
memset(encoder, 0, lc3plus_enc_get_size(samplerate, channels));
alloc_encoder(encoder, channels);
@@ -56,7 +58,6 @@
encoder->r12k8_mem_in_len = 2 * 8 * encoder->fs / 12800;
encoder->r12k8_mem_out_len = 24;
- int ch = 0;
for (ch = 0; ch < encoder->channels; ch++)
{
encoder->channel_setup[ch]->lfe = lfe_channel_array[ch] != 0;
@@ -220,6 +221,7 @@
if (encoder->hrmode)
{
+#ifdef ENABLE_HR_MODE_FL
switch (encoder->frame_dms)
{
case 25:
@@ -243,6 +245,7 @@
default:
return LC3PLUS_HRMODE_ERROR;
}
+#endif
}
else
{
@@ -368,7 +371,7 @@
setup->total_bits = setup->targetBytes << 3;
setup->targetBitsInit = setup->total_bits - encoder->envelope_bits - encoder->global_gain_bits -
encoder->noise_fac_bits - encoder->BW_cutoff_bits -
- ceil(LC3_LOG2(encoder->frame_length / 2)) - 2 - 1;
+ ceil(LC3_LOGTWO(encoder->frame_length / 2)) - 2 - 1;
if (setup->total_bits > 1280) {
setup->targetBitsInit = setup->targetBitsInit - 1;
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
void processSnsComputeScf_fl(LC3_FLOAT* x, LC3_INT tilt, LC3_INT xLen, LC3_FLOAT* gains, LC3_INT smooth, LC3_FLOAT sns_damping, LC3_FLOAT attdec_damping_factor)
@@ -109,7 +110,7 @@
/* Log-domain */
for (i = 0; i < 64; i++) {
- xl[i] = LC3_LOG2(x[i]) / 2.0;
+ xl[i] = LC3_LOGTWO(x[i]) / 2.0;
}
/* Downsampling */
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
void processSnsInterpolateScf_fl(LC3_FLOAT* gains, LC3_INT encoder_side, LC3_INT bands_number, LC3_FLOAT* gains_int)
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
static void pvq_dec(LC3_INT k, LC3_INT m, LC3_INT LS_ind, LC3_INT MPVQ_ind, LC3_INT* pulses);
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h 2023-06-29 12:58:27
@@ -17,6 +17,7 @@
#include <stdlib.h>
#include <string.h>
+
#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) || defined(__arm__) || \
defined(__aarch64__)
#define __TWI_LE /* _T_iny _W_ave _I_n _L_ittle _E_ndian */
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
static void xcorr(LC3_FLOAT* in, LC3_FLOAT* out, LC3_INT lag, LC3_INT inLen);
diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c
--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c 2023-02-28 20:25:37
+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c 2023-06-29 12:58:27
@@ -8,6 +8,7 @@
******************************************************************************/
+#include "options.h"
#include "functions.h"
void processTnsDecoder_fl(LC3_FLOAT* x, LC3_INT* rc_idx, LC3_INT* order, LC3_INT numfilters, LC3_INT bw_fcbin, LC3_INT N, LC3_INT fs)
......@@ -24,6 +24,7 @@ if __name__ == '__main__':
cmds_enc=[]
cmds_dec=[]
cmds_rend=[]
cmds_isar_post_rend=[]
if path.isdir(input):
......@@ -37,15 +38,18 @@ if __name__ == '__main__':
cmds_enc.extend(re.findall(r"DUT encoder command:\\n\\t(.*?)\\n", line))
cmds_dec.extend(re.findall(r"DUT decoder command:\\n\\t(.*?)\\n", line))
cmds_rend.extend(re.findall(r"Running command\\n(.*?)\\n", line))
cmds_isar_post_rend.extend(re.findall(r"Running ISAR post renderer command\\n(.*?)\\n", line))
# If pytest-html < v4 is used, the parsing will fail and render empty lists. This is a work-around in case that happens.
if all(not x for x in [cmds_enc, cmds_dec, cmds_rend]):
if all(not x for x in [cmds_enc, cmds_dec, cmds_rend, cmds_isar_post_rend]):
for html_report in input:
with open(html_report,'r') as infile:
enc_cmd = False
dec_cmd = False
rend_cmd = False
isar_post_rend_cmd = False
for line in infile.readlines():
line = line.split("<br/>")[0] # Remove trailing html tags
if enc_cmd:
cmds_enc.append(line)
enc_cmd = False
......@@ -55,6 +59,9 @@ if __name__ == '__main__':
elif rend_cmd:
cmds_rend.append(line)
rend_cmd = False
elif isar_post_rend_cmd:
cmds_isar_post_rend.append(line)
isar_post_rend_cmd = False
else:
if "DUT encoder command" in line:
enc_cmd = True
......@@ -62,11 +69,14 @@ if __name__ == '__main__':
dec_cmd = True
elif "Running command" in line:
rend_cmd = True
elif "Running ISAR post renderer command" in line:
isar_post_rend_cmd = True
# Sort lists to keep deterministic order between runs
cmds_enc.sort()
cmds_dec.sort()
cmds_rend.sort()
cmds_isar_post_rend.sort()
with open(txt_file.replace('.','_enc.'),'w', newline='\n') as outfile:
with open('scripts/enc_header.txt','r') as header:
......@@ -90,11 +100,13 @@ if __name__ == '__main__':
with open('scripts/script_footer.txt','r') as footer:
outfile.write(footer.read())
with open(txt_file.replace('.','_dec.'),'w', newline='\n') as outfile_dec, open(txt_file.replace('.','_JBM_dec.'),'w', newline='\n') as outfile_jbm:
with open(txt_file.replace('.','_dec.'),'w', newline='\n') as outfile_dec, open(txt_file.replace('.','_JBM_dec.'),'w', newline='\n') as outfile_jbm, open(txt_file.replace('.','_ISAR_dec.'),'w', newline='\n') as outfile_isar:
with open('scripts/dec_header.txt','r') as header:
outfile_dec.write(header.read())
with open('scripts/jbm_header.txt','r') as header:
outfile_jbm.write(header.read())
with open('scripts/dec_isar_header.txt','r') as header:
outfile_isar.write(header.read())
for cmd in cmds_dec:
absolute_out = re.search(r"\s(([\S]+)(.wav))$", cmd)
......@@ -106,20 +118,29 @@ if __name__ == '__main__':
arg = re.sub('IVAS_dec(.exe)?', '$CUT_DEC_BIN', arg)
arg = re.sub('scripts', TESTV_PATH, arg)
arg = re.sub('tests/ref', REF_PATH + r'/ref', arg) # For .fer cases the bitstream is in ref
arg = re.sub('tests/split_rendering/renderer_configs', REF_PATH + r'/split_rendering/renderer_configs', arg)
if re.search("^tests.*192$",arg):
arg = re.sub('tests/split_rendering/cut', REF_PATH + r'/split_rendering/ref', arg)
if re.search("\.wav$",arg):
arg = re.sub('tests', CUT_PATH, arg) # Output argument for decoder ends with .wav
else:
arg = re.sub('tests/dut', REF_PATH + r'/ref', arg) # Input argument
if re.search("^tests.*bit$",arg):
arg = re.sub('tests', CUT_PATH, arg) # Output argument for decoder ends with .wav
args.append(arg)
cmd = ' '.join(args)
if 'VOIP' in cmd:
outfile = outfile_jbm
elif 'BINAURAL_SPLIT' in cmd:
outfile = outfile_isar
else:
outfile = outfile_dec
outfile.write(cmd+'\n')
out = re.search(r"\s(([\S]+)(.wav))$", cmd)
isar_out = re.search(r"\s(([\S]+)(.bit))$", cmd)
isar_md_out = re.search(r"-om\s(([\S]+)(.bit))", cmd)
if out:
diff_cmds=[]
for output in glob.glob(absolute_out.group(1) + '*'):
......@@ -127,11 +148,18 @@ if __name__ == '__main__':
output = re.sub('tests', CUT_PATH, output)
diff_cmds.append('$DIFF_BIN '+output.replace(CUT_PATH + r'/dut',REF_PATH + r'/ref')+' '+output+' >> $LOG_FILE 2>&1')
outfile.write(('; ').join(diff_cmds))
if isar_out and "cut" in isar_out.group(1):
outfile.write('$DIFF_BIN '+isar_out.group(1).replace(CUT_PATH + r'/split_rendering/cut',REF_PATH + r'/split_rendering/ref')+' '+isar_out.group(1)+' >> $LOG_FILE 2>&1\n')
if isar_md_out and "cut" in isar_md_out.group(1):
outfile.write('$DIFF_BIN '+isar_md_out.group(1).replace(CUT_PATH + r'/split_rendering/cut',REF_PATH + r'/split_rendering/ref')+' '+isar_md_out.group(1)+' >> $LOG_FILE 2>&1\n')
outfile.write('\n\n')
with open('scripts/script_footer.txt','r') as footer:
outfile_dec.write(footer.read())
footer.seek(0)
outfile_jbm.write(footer.read())
footer.seek(0)
outfile_isar.write(footer.read())
with open(txt_file.replace('.','_rend.'),'w', newline='\n') as outfile:
with open('scripts/rend_header.txt','r') as header:
......@@ -157,3 +185,29 @@ if __name__ == '__main__':
outfile.write('\n')
with open('scripts/script_footer.txt','r') as footer:
outfile.write(footer.read())
with open(txt_file.replace('.','_ISAR_post_rend.'),'w', newline='\n') as outfile:
with open('scripts/isar_post_rend_header.txt','r') as header:
outfile.write(header.read())
for cmd in cmds_isar_post_rend:
args = []
for arg in cmd.split():
# Adjust file arguments, pass other arguments as they are
if path.exists(arg):
arg = path.relpath(arg).replace('\\','/')
arg = re.sub('ISAR_post_rend(.exe)?', '$CUT_ISAR_POST_REND_BIN', arg)
arg = re.sub('scripts', TESTV_PATH, arg)
if re.search("^tests.*bit$",arg):
arg = re.sub('tests/split_rendering/cut', REF_PATH + r'/split_rendering/ref', arg)
arg = re.sub('tests', CUT_PATH, arg)
args.append(arg)
cmd = ' '.join(args)
if "cut" in cmd:
outfile.write(cmd+'\n')
out = re.search(r"-o\s(([\S]+)(.wav|.raw|.pcm))", cmd)
if out and "cut" in out.group(1):
outfile.write('$DIFF_BIN '+out.group(1).replace(CUT_PATH + r'/split_rendering/cut',REF_PATH + r'/split_rendering/ref')+' '+out.group(1)+' >> $LOG_FILE 2>&1\n')
outfile.write('\n')
with open('scripts/script_footer.txt','r') as footer:
outfile.write(footer.read())
\ No newline at end of file
......@@ -62,7 +62,7 @@ fi
c_header_new=\
'/*====================================================================================
3GPP TS26.258 Aug 24, 2023. IVAS Codec Version IVAS-FL-1.0
3GPP TS26.258 May 14, 2024. IVAS Codec Version IVAS-FL-2.0
====================================================================================*/'
......@@ -139,7 +139,7 @@ rm -f $tmpfile
# Patch Printout
#
sed -i.bak -e "s/IVAS\ Codec\ Baseline/IVAS\ Codec\ Version\ IVAS-FL-1\.0/g" $WORKDIR/lib_com/disclaimer.c
sed -i.bak -e "s/IVAS\ Codec\ Baseline/IVAS\ Codec\ Version\ IVAS-FL-2\.0/g" $WORKDIR/lib_com/disclaimer.c
#
......
......@@ -65,7 +65,7 @@ while getopts "$ALL_OPTS" OPTION; do
;;
esac;;
h)
echo "usage: $0 [--strip_sr] [--no_zip]" >&2
echo "usage: $0 [--no_zip]" >&2
exit -1
;;
*)
......@@ -124,14 +124,10 @@ recode lat1..ibmpc ${OUTDIR}/readme_split_rendering.txt # unix2dos ...
cp ${ROOT}/LICENSE.md ${OUTDIR}
recode lat1..ibmpc ${OUTDIR}/LICENSE.md # unix2dos ...
# include .clang_format, since this is a VS dependency
cp ${ROOT}/.clang-format ${OUTDIR}
# enable split rendering againg by default
# in case we strip it later, it will be explicitly disabled again below
sed -i.bak -e "s/\/\*\ *\(#define\ *SPLIT_REND_WITH_HEAD_ROT\ *\)\*\//\1/g" ${OUTDIR}/lib_com/options.h
##########################
# #
# Stripping #
......
......@@ -96,6 +96,7 @@ if [ $INCLUDE_SPLIT -eq 1 ]; then
sed '/#define DEFINES_H/ d'
)
# Filter defines that come from outside of the header lib_lc3plus/defines.h
lc3plus_defines_filtered=""
while IFS=' \n' read -r line;
do
......
"""
Generate command lines for split rendering with LC3plus
"""
import itertools
import os
# Paths
ENC_PATH = "./IVAS_cod"
DEC_PATH = "./IVAS_dec"
REND_PATH = "./IVAS_rend"
TEMP_DIR = "tmp"
# Config values to iterate over
ISM_CONFIGS_NUM_OBJECTS = [1, 2, 3, 4]
IVAS_BITRATES = [128000]
PRE_HEAD_ROT_FILES = [
"Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20static.csv"
]
POST_HEAD_ROT_FILES = [
"Workspace_msvc/trajectories/post-renderer_pose_files/post_0static.csv"
]
RENDER_CONFIG_FILES = [
#######################################################
# Alternative 2 - LC3plus with CLDFB pose correction
"Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt",
"Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt",
None, # Alternative 2 is the default when no rendering config file is given on command line
#######################################################
# Alternative 3 - LC3plus with multi-stream (TD) pose correction
"Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_tdposecorr.txt",
"Workspace_msvc/renderer_configs/split_renderer_config_1536_2dof_tdposecorr.txt",
]
def audio_for_ism(num_objects):
return f"scripts/testv/stv{num_objects}ISM48s.wav"
def metadata_for_ism(num_objects):
return f"scripts/testv/stvISM{num_objects}.csv"
def basename(file_path):
basename_w_ext = os.path.basename(file_path)
return os.path.splitext(basename_w_ext)[0]
# Full chain: IVAS_cod -> IVAS_dec -> IVAS_rend(post)
def full_chain(
num_objects, ivas_bitrate, pre_head_rot_file, render_config_file, post_head_rot_file
):
bs_name = f"{TEMP_DIR}/ism{num_objects}_b{ivas_bitrate}_full_chain.g192"
cod = [
ENC_PATH,
"-ism",
str(num_objects),
*[metadata_for_ism(i + 1) for i in range(num_objects)],
str(ivas_bitrate),
"48",
audio_for_ism(num_objects),
bs_name,
]
render_config_infix = (
f"##{basename(render_config_file)}" if render_config_file else ""
)
split_bs_name = bs_name.replace(
".g192", f"##{basename(pre_head_rot_file)}{render_config_infix}##split.bs"
)
render_config_args = (
["-render_config", render_config_file] if render_config_file else []
)
dec = [
DEC_PATH,
"-T",
pre_head_rot_file,
*render_config_args,
"SPLIT_BINAURAL",
"48",
bs_name,
split_bs_name,
]
binaural_output_name = split_bs_name.replace(
".bs", f"##{basename(post_head_rot_file)}##binaural.wav"
)
rend = [
REND_PATH,
"-i",
split_bs_name,
"-if",
"BINAURAL_SPLIT_CODED",
"-of",
"BINAURAL",
"-fs",
"48",
"-tf",
post_head_rot_file,
"-o",
binaural_output_name,
]
return [cod, dec, rend]
# Renderer chain: IVAS_rend(pre) -> IVAS_rend(post)
def rend_chain(num_objects, pre_head_rot_file, render_config_file, post_head_rot_file):
render_config_infix = (
f"##{basename(render_config_file)}" if render_config_file else ""
)
split_bs_name = f"{TEMP_DIR}/ism{num_objects}_rend_chain##{basename(pre_head_rot_file)}{render_config_infix}##split.bs"
render_config_args = (
["-render_config", render_config_file] if render_config_file else []
)
pre = [
REND_PATH,
"-i",
audio_for_ism(num_objects),
"-if",
f"ISM{num_objects}",
"-im",
*[metadata_for_ism(i + 1) for i in range(num_objects)],
"-of",
"BINAURAL_SPLIT_CODED",
"-fs",
"48",
*render_config_args,
"-tf",
pre_head_rot_file,
"-o",
split_bs_name,
]
binaural_output_name = split_bs_name.replace(
".bs", f"##{basename(post_head_rot_file)}##binaural.wav"
)
post = [
REND_PATH,
"-i",
split_bs_name,
"-if",
"BINAURAL_SPLIT_CODED",
"-of",
"BINAURAL",
"-fs",
"48",
"-tf",
post_head_rot_file,
"-o",
binaural_output_name,
]
return [pre, post]
def print_command_list(list_of_lists):
for lst in list_of_lists:
print(" ".join(lst))
print("") # newline
def main():
print("\n##########################################")
print("# Full chain: enc -> dec -> rend(post)")
print("##########################################\n")
for args_full_chain in itertools.product(
# Ordering here must match argument order in function call below!
ISM_CONFIGS_NUM_OBJECTS,
IVAS_BITRATES,
PRE_HEAD_ROT_FILES,
RENDER_CONFIG_FILES,
POST_HEAD_ROT_FILES,
):
print_command_list(full_chain(*args_full_chain))
print("\n##########################################")
print("# Renderer chain: rend(pre) -> rend(post)")
print("##########################################\n")
for args_rend_chain in itertools.product(
# Ordering here must match argument order in function call below!
ISM_CONFIGS_NUM_OBJECTS,
PRE_HEAD_ROT_FILES,
RENDER_CONFIG_FILES,
POST_HEAD_ROT_FILES,
):
print_command_list(rend_chain(*args_rend_chain))
if __name__ == "__main__":
main()
......@@ -111,7 +111,7 @@ if dataSpec.genRomFile
' *------------------------------------------------------------------------*/'
'/* TD renderer default HRIR model */'
'extern const float defaultHRIR_rom_latency_s;'
['extern const int16_t defaultHRIR_rom_azimDim2[' int2str(size(mod_hrf_org.elevBf{1}, 3)) '];']
['extern const int16_t defaultHRIR_rom_model_configuration[6];']
['extern const int16_t defaultHRIR_rom_azimDim3[' int2str(size(mod_hrf_org.elevBf{1}, 3)) '];']
['extern const int16_t defaultHRIR_rom_azim_start_idx[' int2str(size(mod_hrf_org.elevBf{1}, 3)) '];']
'extern const int16_t defaultHRIR_rom_azimSegSamples[1];'
......@@ -372,20 +372,14 @@ for fs = [48000 32000 16000]
fwrite(fileID, fs_khz, 'short');
% General - model-specific parts
fwrite(fileID, size(mod_hrf.elevBf{1}, 1), 'short'); % N = 4 i.e. coefficients for cubic including zeroth order
fwrite(fileID, size(mod_hrf.WR{1}, 2), 'short'); % K, filter length
% Elevation model structure
elevDim2 = size(mod_hrf.elevBf{1}, 2);
elevDim3 = size(mod_hrf.elevBf{1}, 3);
fwrite(fileID, elevDim2, 'short'); % elevDim2
fwrite(fileID, elevDim3, 'short'); % elevDim3 = P
fwrite(fileID, mod_hrf.elevKSeq{1}, 'float'); % length = elevDim3-2
% Azimuth model structure
azim_start_idx = 0;
c_file_content_dim2 = {
['const int16_t defaultHRIR_rom_azimDim2[' num2str(elevDim3) '] = {']
};
c_file_content_dim3 = {
['const int16_t defaultHRIR_rom_azimDim3[' num2str(elevDim3) '] = {']
};
......@@ -399,8 +393,6 @@ for fs = [48000 32000 16000]
for i = 1:elevDim3
azimDim2 = size(mod_hrf.azimBf{i}, 2);
azimDim3 = size(mod_hrf.azimBf{i}, 3);
fwrite(fileID, azimDim2, 'short'); % azimDim2
content_dim2 = [content_dim2 int2str(azimDim2) ', '];
fwrite(fileID, azimDim3, 'short'); % azimDim3 = Q
content_dim3 = [content_dim3 int2str(azimDim3) ', '];
fwrite(fileID, azim_start_idx, 'short'); % start azim index per elevation
......@@ -410,9 +402,6 @@ for fs = [48000 32000 16000]
end
if fs == fs_orig && dataSpec.genRomFile
fileID_c = fopen(c_file_name,'at');
c_file_content_dim2{size(c_file_content_dim2,2)+1} = content_dim2;
c_file_content_dim2{size(c_file_content_dim2,2)+1} = '};';
c_file_content_dim2{size(c_file_content_dim2,2)+1} = '';
c_file_content_dim3{size(c_file_content_dim3,2)+1} = content_dim3;
c_file_content_dim3{size(c_file_content_dim3,2)+1} = '};';
c_file_content_dim3{size(c_file_content_dim3,2)+1} = '';
......@@ -420,14 +409,64 @@ for fs = [48000 32000 16000]
c_file_content_start_idx{size(c_file_content_start_idx,2)+1} = '};';
c_file_content_start_idx{size(c_file_content_start_idx,2)+1} = '';
c_file_content = string(join(c_file_content_dim2,newline));
c_file_content = ...
['const int16_t defaultHRIR_rom_model_configuration[6] = {' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(useITD) ', /* UseItdModel */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(elevDim3) ', /* elevDim3 */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(size(mod_hrf_org.WL{1}, 1)) ', /* AlphaN */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(num_unique_splines) ', /* num_unique_azim_splines */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(e_num_points) ', /* elevSegSamples */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(size(mod_hrf_org.WL{1}, 2)) ', /* K_48k */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = ['};' newline ];
fprintf(fileID_c,'%s', c_file_content);
arr_str = join(mat2str((single(len_e))));
arr_str = arr_str(2:end);
arr_str(end) = ';';
arr_str = replace(arr_str, ";",',');
arr_str = replace(arr_str, " ",', ');
c_file_content = ...
['const int16_t defaultHRIR_rom_elevBsLen[' num2str(length(len_e)) '] = {' newline ...
arr_str ...
newline '};' newline ...
];
fprintf(fileID_c,'%s', c_file_content);
arr_str = join(mat2str((single(start_e))));
arr_str = arr_str(2:end);
arr_str(end) = ';';
arr_str = replace(arr_str, ";",',');
arr_str = replace(arr_str, " ",', ');
c_file_content = ...
['const int16_t defaultHRIR_rom_elevBsStart[' num2str(length(start_e)) '] = {' newline ...
arr_str ...
newline '};' newline ...
];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = string(join(c_file_content_dim3,newline));
fprintf(fileID_c,'%s', c_file_content);
c_file_content = string(join(c_file_content_start_idx,newline));
fprintf(fileID_c,'%s', c_file_content);
c_file_content = ['const int16_t defaultHRIR_rom_azimSegSamples[1] = {' newline num2str(mod_hrf_org.azimKmSeq{1,2}(2)) ',' newline '};' newline];
arr_str = join(mat2str((single(a_num_points(1:num_unique_splines)))));
if(num_unique_splines>1)
arr_str = arr_str(2:end);
arr_str(end) = ';';
arr_str = replace(arr_str, ";",',');
arr_str = replace(arr_str, " ",', ');
else
arr_str(end+1) = ',';
end
c_file_content = ['const int16_t defaultHRIR_rom_azimSegSamples[' num2str(num_unique_splines) '] = {' newline arr_str newline '};' newline];
fprintf(fileID_c,'%s', c_file_content);
arr_str = mat2str(azimShapeIdx);
......@@ -662,20 +701,15 @@ for fs = [48000 32000 16000]
% If ITD model is used, parameters are stored in 2nd part of the same file
if useITD
% General
fwrite(fileID, size(mod_itd.elevBf, 1), 'short'); % N = 4 i.e. coefficients for cubic including zeroth order
%fwrite(fileID, size(mod_itd.W, 2), 'short'); % K = 1 always for ITD, so do not need to write.
% Elevation model structure
elevDim2 = size(mod_itd.elevBf, 2);
elevDim3 = size(mod_itd.elevBf, 3);
fwrite(fileID, elevDim2, 'short'); % elevDim2
fwrite(fileID, elevDim3, 'short'); % elevDim3 = P
fwrite(fileID, mod_itd.elevKSeq, 'float'); % length = elevDim3-2
% Azimuth model structure
azimDim2 = size(mod_itd.azimBf{2}, 2);
azimDim3 = size(mod_itd.azimBf{2}, 3);
fwrite(fileID, azimDim2, 'short'); % azimDim2
fwrite(fileID, azimDim3, 'short'); % azimDim3 = Q
fwrite(fileID, mod_itd.azimKSeq{2}, 'float'); % length = azimDim3+1
......@@ -725,6 +759,68 @@ for fs = [48000 32000 16000]
c_file_content = [ arr_str newline '};' newline];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = ...
['const int16_t defaultHRIR_rom_ITD_model_configuration[4] = {' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(elevDim3) ', /* elevDim3 */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(azimDim3) ', /* azimDim3 */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(e_num_points_ITD) ', /* elevSegSamples */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(a_num_points_ITD) ', /* azimSegSamples */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = ['};' newline ];
fprintf(fileID_c,'%s', c_file_content);
arr_str = join(mat2str((single(len_e_ITD))));
arr_str = arr_str(2:end);
arr_str(end) = ';';
arr_str = replace(arr_str, ";",',');
arr_str = replace(arr_str, " ",', ');
c_file_content = ...
['const int16_t defaultHRIR_rom_ITD_elevBsLen[' num2str(length(len_e_ITD)) '] = {' newline ...
arr_str ...
newline '};' newline ...
];
fprintf(fileID_c,'%s', c_file_content);
arr_str = join(mat2str((single(start_e_ITD))));
arr_str = arr_str(2:end);
arr_str(end) = ';';
arr_str = replace(arr_str, ";",',');
arr_str = replace(arr_str, " ",', ');
c_file_content = ...
['const int16_t defaultHRIR_rom_ITD_elevBsStart[' num2str(length(start_e_ITD)) '] = {' newline ...
arr_str ...
newline '};' newline ...
];
fprintf(fileID_c,'%s', c_file_content);
arr_str = join(mat2str((single(len_a_ITD))));
arr_str = arr_str(2:end);
arr_str(end) = ';';
arr_str = replace(arr_str, ";",',');
arr_str = replace(arr_str, " ",', ');
c_file_content = ...
['const int16_t defaultHRIR_rom_ITD_azimBsLen[' num2str(length(len_a_ITD)) '] = {' newline ...
arr_str ...
newline '};' newline ...
];
fprintf(fileID_c,'%s', c_file_content);
arr_str = join(mat2str((single(start_a_ITD))));
arr_str = arr_str(2:end);
arr_str(end) = ';';
arr_str = replace(arr_str, ";",',');
arr_str = replace(arr_str, " ",', ');
c_file_content = ...
['const int16_t defaultHRIR_rom_ITD_azimBsStart[' num2str(length(start_a_ITD)) '] = {' newline ...
arr_str ...
newline '};' newline ...
];
fprintf(fileID_c,'%s', c_file_content);
arr_str_all = num2hex(single(azimSplineShapeITD_all));
numCol = 25;
numIter = floor(length(azimSplineShapeITD_all)/numCol);
......@@ -809,6 +905,8 @@ end % fs loop
if dataSpec.genRomFile
h_file_content = string(join({''
['extern const int16_t defaultHRIR_rom_elevBsLen[' int2str(length(len_e)) '];']
['extern const int16_t defaultHRIR_rom_elevBsStart[' int2str(length(start_e)) '];']
['extern const uint32_t defaultHRIR_rom_elevBsShape[' int2str(length(elevSplineShape_all)) '];']
['extern const uint32_t defaultHRIR_rom_azimBsShape[' int2str(length(azimSplineShape{1})) '];']
['extern const uint32_t defaultHRIR_rom_ITD_W[' int2str(mod_itd.angleBfNum) '];']
......@@ -816,6 +914,11 @@ if dataSpec.genRomFile
['extern const float defaultHRIR_rom_ITD_azimKSeq[19];']
['extern const uint32_t defaultHRIR_rom_ITD_elevBsShape[' int2str(length(elevSplineShapeITD_all)) '];']
['extern const float defaultHRIR_rom_ITD_elevKSeq[16];']
['extern const int16_t defaultHRIR_rom_ITD_model_configuration[4];']
['extern const int16_t defaultHRIR_rom_ITD_elevBsLen[' int2str(length(len_e_ITD)) '];']
['extern const int16_t defaultHRIR_rom_ITD_elevBsStart[' int2str(length(start_e_ITD)) '];']
['extern const int16_t defaultHRIR_rom_ITD_azimBsLen[' int2str(length(len_a_ITD)) '];']
['extern const int16_t defaultHRIR_rom_ITD_azimBsStart[' int2str(length(start_a_ITD)) '];']
'#endif'
''
}, newline));
......