Skip to content
Commits on Source (72)
......@@ -513,7 +513,6 @@ build-codec-windows-msbuild:
script:
- *print-common-info-windows
- *activate-WX-windows
- python .\scripts\strip_split_rendering.py
- MSBuild.exe -maxcpucount .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Debug
# ---------------------------------------------------------------
......@@ -1380,7 +1379,6 @@ ivas-conformance:
- 123
script:
- *print-common-info-windows
- python .\scripts\strip_split_rendering.py
- MSBuild.exe -maxcpucount .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Debug
- cp -force IVAS_cod.exe IVAS_cod_ref.exe
- cp -force IVAS_dec.exe IVAS_dec_ref.exe
......@@ -1389,11 +1387,12 @@ ivas-conformance:
# Reference creation
- python tests/create_short_testvectors.py
- python scripts/prepare_combined_format_inputs.py
- python -m pytest tests/codec_be_on_mr_nonselection tests/renderer/test_renderer.py -v -n auto --update_ref 1 -m create_ref --create_ref --keep_files
- python -m pytest tests/codec_be_on_mr_nonselection tests/renderer/test_renderer.py -v -n auto --update_ref 1 -m create_ref_part2 --keep_files
- $TEST_SET = "tests/codec_be_on_mr_nonselection", "tests/renderer/test_renderer.py", "tests/split_rendering/test_split_rendering.py"
- python -m pytest $TEST_SET -v -n auto --update_ref 1 -m create_ref --create_ref --keep_files
- python -m pytest $TEST_SET -v -n auto --update_ref 1 -m create_ref_part2 --keep_files
# Output creation
- python -m pytest tests/codec_be_on_mr_nonselection tests/renderer/test_renderer.py -v -n auto --keep_files --create_cut --html=report_cmd.html --self-contained-html
- python -m pytest $TEST_SET -v -n auto --keep_files --create_cut --html=report_cmd.html --self-contained-html
- python scripts/parse_commands.py report_cmd.html Readme_IVAS.txt
# Copy input data and output ref data
......@@ -1402,10 +1401,13 @@ ivas-conformance:
- if (Test-Path TMP_ENC) {rm -r -force TMP_ENC}
- if (Test-Path TMP_JBM) {rm -r -force TMP_JBM}
- if (Test-Path TMP_REND) {rm -r -force TMP_REND}
- if (Test-Path TMP_ISAR_POST_REND) {rm -r -force TMP_ISAR_POST_REND}
- if (Test-Path TMP_DEC_ISAR) {rm -r -force TMP_DEC_ISAR}
- mkdir testvec
- mkdir testvec/binauralRenderer_interface
- mkdir testvec/testv
- mkdir testvec/testv/renderer
- mkdir testvec/testv/split_rendering
- mkdir testvec/bin
- cp -force -ErrorAction Ignore scripts/testv/* testvec/testv
- cp -r -force -ErrorAction Ignore scripts/ls_layouts testvec
......@@ -1415,6 +1417,9 @@ ivas-conformance:
- cp -r -force -ErrorAction Ignore tests/ref testvec/testv/ref
- cp -r -force -ErrorAction Ignore tests/dut/* testvec/testv/ref
- cp -r -force -ErrorAction Ignore tests/renderer/cut testvec/testv/renderer/ref
- cp -r -force -ErrorAction Ignore tests/split_rendering/cut testvec/testv/split_rendering/ref
- cp -r -force -ErrorAction Ignore tests/split_rendering/renderer_configs testvec/testv/split_rendering/renderer_configs
- cp -r -force -ErrorAction Ignore tests/split_rendering/error_patterns testvec/testv/split_rendering/error_patterns
# Remove redundant files
- python scripts/cleanup_26252.py
......@@ -1425,9 +1430,12 @@ ivas-conformance:
- cp Readme_IVAS_enc.txt testvec
- cp Readme_IVAS_rend.txt testvec
- cp Readme_IVAS_JBM_dec.txt testvec
- cp Readme_IVAS_ISAR_dec.txt testvec
- cp Readme_IVAS_ISAR_post_rend.txt testvec
- cp IVAS_cod.exe testvec/bin
- cp IVAS_dec.exe testvec/bin
- cp IVAS_rend.exe testvec/bin
- cp ISAR_post_rend.exe testvec/bin
# Test run generated scripts in testvec
......@@ -1447,6 +1455,8 @@ ivas-conformance:
- Readme_IVAS_enc.txt
- Readme_IVAS_rend.txt
- Readme_IVAS_JBM_dec.txt
- Readme_IVAS_ISAR_dec.txt
- Readme_IVAS_ISAR_post_rend.txt
expose_as: "Draft IVAS conformance"
reports:
junit: report-junit.xml
......@@ -1471,7 +1481,7 @@ ivas-conformance-linux:
# Reference creation
- python3 tests/create_short_testvectors.py
- python3 scripts/prepare_combined_format_inputs.py
- TEST_SET="tests/codec_be_on_mr_nonselection tests/renderer/test_renderer.py"
- TEST_SET="tests/codec_be_on_mr_nonselection tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py"
- python3 -m pytest $TEST_SET -v -n auto --update_ref 1 -m create_ref --create_ref --keep_files
- python3 -m pytest $TEST_SET -v -n auto --update_ref 1 -m create_ref_part2 --keep_files
......@@ -1485,6 +1495,7 @@ ivas-conformance-linux:
- mkdir testvec/binauralRenderer_interface
- mkdir testvec/testv
- mkdir testvec/testv/renderer
- mkdir testvec/testv/split_rendering
- mkdir testvec/bin
- cp -r scripts/testv/* testvec/testv
- cp -r scripts/ls_layouts testvec
......@@ -1494,6 +1505,9 @@ ivas-conformance-linux:
- cp -r tests/ref testvec/testv/ref
- cp -r tests/dut/* testvec/testv/ref
- cp -r tests/renderer/cut testvec/testv/renderer/ref
- cp -r tests/split_rendering/cut testvec/testv/split_rendering/ref
- cp -r tests/split_rendering/renderer_configs testvec/testv/split_rendering/renderer_configs
- cp -r tests/split_rendering/error_patterns testvec/testv/split_rendering/error_patterns
# Remove redundant files
- python3 scripts/cleanup_26252.py
......@@ -1504,6 +1518,8 @@ ivas-conformance-linux:
- cp Readme_IVAS_enc.txt testvec
- cp Readme_IVAS_rend.txt testvec
- cp Readme_IVAS_JBM_dec.txt testvec
- cp Readme_IVAS_ISAR_dec.txt testvec
- cp Readme_IVAS_ISAR_post_rend.txt testvec
# Create GCOV execs for coverage analysis
- make clean
......@@ -1512,6 +1528,7 @@ ivas-conformance-linux:
- cp IVAS_cod testvec/bin
- cp IVAS_dec testvec/bin
- cp IVAS_rend testvec/bin
- cp ISAR_post_rend testvec/bin
# Test run generated scripts in testvec
- cd testvec
......@@ -1528,6 +1545,9 @@ ivas-conformance-linux:
- commit_sha=$(git rev-parse HEAD)
- genhtml coverage.info -o coverage -t "Coverage on main @ $commit_sha"
# Check for failures
- if [ $exit_code -eq 1 ]; then echo "Test failures encountered"; exit $EXIT_CODE_FAIL; fi
artifacts:
name: "ivas-conformance-linux-$CI_COMMIT_SHORT_SHA"
expire_in: 1 week
......@@ -1540,6 +1560,8 @@ ivas-conformance-linux:
- Readme_IVAS_enc.txt
- Readme_IVAS_rend.txt
- Readme_IVAS_JBM_dec.txt
- Readme_IVAS_ISAR_dec.txt
- Readme_IVAS_ISAR_post_rend.txt
- coverage.info
- coverage
expose_as: "Draft IVAS conformance -- Linux"
......
......@@ -155,16 +155,23 @@
/*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */
#define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */
#ifdef SPLIT_REND_WITH_HEAD_ROT
#define ISAR_BITSTREAM_UPDATE_LC3PLUS /* FhG: Multiple improvements to the ISAR bitstream when LC3plus is used. See MR 1456 for details. */
#define SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
#define LC3PLUS_LEA_COMPAT_BITRATES_48_6 /* FhG: treat split-rendering 256kbps lc3plus 10ms 0dof bitrate as sentinel value for LEA compatible 48_6 bitrate (124 kbps per channel) */
#endif
#define SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
#define FIX_1081_BINAURAL_SPLIT_PCM_SANITY_CHECK /* VA: issue 1081: correct error print-out when BINAURAL_SPLIT_PCM is requested */
#endif
#define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic switching of acoustic environment */
#define CONF_DISTATT /* Eri: Make distance attenuation configurable */
#define FIX_1082_INSTRUM_FAILED_LC3PLUS /* VoiceAge: issue 1082: fix ambiguous syntax in LC3Plus code leading to fails of instrumented builds */
#define FIX_1052_EXT_OUTPUT /* VA: issue 1052: define EXT decoder output configuration for stereo and MC formats */
#define FIX_989_TD_REND_ROM /* Eri: Clean-up for TD renderer and completion of ROM generation tool */
#define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/
/* #################### End BE switches ################################## */
......@@ -176,7 +183,9 @@
#define NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT /* fix 1070 USAN: nullptr-with-offset and Segfaults in 7_1_4 to BINAURAL and BINAURAL_ROOM_REVERB decoding with bitrate switching and head rotation*/
#define NONBE_FIX_MC_LFE_LPF /* Dlb: Adding the LFE LPF filter back for MC content. */
#define NONBE_FIX_1052_SBA_EXT /* Dlb: SBA external output support */
#define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */
#define NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR /* Nok: issue 1074 fixing number of objects signaling in OMASA low rate */
/* ##################### End NON-BE switches ########################### */
/* ################## End DEVELOPMENT switches ######################### */
......
......@@ -1677,14 +1677,14 @@ void ivas_binaural_cldfb(
idx_in++;
}
if ( st_ivas->hSplitBinRend.hCldfbDataOut != NULL )
if ( st_ivas->hSplitBinRend->hCldfbDataOut != NULL )
{
for ( ch = 0; ch < ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ); ch++ )
{
mvr2r( Cldfb_RealBuffer[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
mvr2r( Cldfb_ImagBuffer[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
mvr2r( Cldfb_RealBuffer[ch][slot_idx], st_ivas->hSplitBinRend->hCldfbDataOut->Cldfb_RealBuffer[ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
mvr2r( Cldfb_ImagBuffer[ch][slot_idx], st_ivas->hSplitBinRend->hCldfbDataOut->Cldfb_ImagBuffer[ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
}
st_ivas->hSplitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
st_ivas->hSplitBinRend->hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
}
}
#endif
......@@ -1694,7 +1694,7 @@ void ivas_binaural_cldfb(
ivas_binRenderer(
st_ivas->hBinRenderer,
#ifdef SPLIT_REND_WITH_HEAD_ROT
&st_ivas->hSplitBinRend.splitrend.multiBinPoseData,
&st_ivas->hSplitBinRend->splitrend.multiBinPoseData,
#endif
st_ivas->hCombinedOrientationData,
JBM_CLDFB_SLOTS_IN_SUBFRAME,
......@@ -1736,8 +1736,8 @@ void ivas_binaural_cldfb(
maxBand );
}
mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
}
}
}
......@@ -1855,14 +1855,14 @@ void ivas_binaural_cldfb_sf(
}
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( st_ivas->hSplitBinRend.hCldfbDataOut != NULL )
if ( st_ivas->hSplitBinRend->hCldfbDataOut != NULL )
{
for ( ch = 0; ch < ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ); ch++ )
{
mvr2r( Cldfb_RealBuffer[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][slot_index_start + slot_idx], maxBand );
mvr2r( Cldfb_ImagBuffer[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_index_start + slot_idx], maxBand );
mvr2r( Cldfb_RealBuffer[ch][slot_idx], st_ivas->hSplitBinRend->hCldfbDataOut->Cldfb_RealBuffer[ch][slot_index_start + slot_idx], maxBand );
mvr2r( Cldfb_ImagBuffer[ch][slot_idx], st_ivas->hSplitBinRend->hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_index_start + slot_idx], maxBand );
}
st_ivas->hSplitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
st_ivas->hSplitBinRend->hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
}
#endif
}
......@@ -1873,7 +1873,7 @@ void ivas_binaural_cldfb_sf(
ivas_binRenderer(
st_ivas->hBinRenderer,
#ifdef SPLIT_REND_WITH_HEAD_ROT
&st_ivas->hSplitBinRend.splitrend.multiBinPoseData,
&st_ivas->hSplitBinRend->splitrend.multiBinPoseData,
#endif
st_ivas->hCombinedOrientationData,
st_ivas->hTcBuffer->subframe_nbslots[subframeIdx],
......@@ -1895,8 +1895,8 @@ void ivas_binaural_cldfb_sf(
{
for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ )
{
mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_index_start + slot_idx], maxBand );
mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_index_start + slot_idx], maxBand );
mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_index_start + slot_idx], maxBand );
mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_index_start + slot_idx], maxBand );
}
}
}
......
......@@ -399,12 +399,30 @@ ivas_error ivas_dec_setup(
if ( st_ivas->nchan_ism > 0 )
{
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
/* the input_ivas_format should be MASA_ISM_FORMAT, but we cannot initialize it now */
/* info about the number of objects:
'00' - MASA format at the encoder
'01' - MASA_ISM_FORMAT at the encoder, with 4 objects
'10' - MASA_ISM_FORMAT at the encoder, with 3 objects
'11' - MASA_ISM_FORMAT at the encoder, with 1 or 2 objects
reading if 1 or 2 objects is performed later
*/
st_ivas->nchan_ism = 5 - st_ivas->nchan_ism;
if ( st_ivas->nchan_transport == 1 && st_ivas->nchan_ism == 2 )
{
st_ivas->nchan_ism = 1;
}
/* for MASA_ISM_FORMAT at input the number of MASA transport channels is always 2 and the corresponding bit is not used here*/
#else
/* the input_ivas_format should be MASA_ISM_FORMAT, but we cannot initialize it now */
if ( st_ivas->nchan_transport == 2 && st_ivas->nchan_ism == 3 )
{
st_ivas->nchan_ism = 4;
}
/* for MASA_ISM_FORMAT at input the number of MASA transport channels is always 2 */
#endif
st_ivas->nchan_transport = 2;
element_mode_flag = 1;
}
......
......@@ -151,6 +151,52 @@ ivas_error ivas_masa_decode(
{
if ( !( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) )
{
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
if ( ivas_format == MASA_FORMAT )
{
/* re-read the number of objects, needed in case of bad frame */
st_ivas->nchan_ism = 5 - ( st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 3] + 2 * st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 2] );
}
if ( ivas_format == MASA_FORMAT && st_ivas->nchan_ism != 5 )
{
/* there was OMASA in the input */
hMasa->config.input_ivas_format = MASA_ISM_FORMAT;
if ( st_ivas->nchan_ism < 3 )
{
/* was read in ivas_init_dec() to distinguish between 1 and 2 objects */
if ( st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 1] == 0 )
{
st_ivas->nchan_ism = 1;
}
st->next_bit_pos -= MASA_TRANSP_BITS;
*nb_bits_read += MASA_TRANSP_BITS;
/* the two reserved bits were already read in ivas_init_dec()*/
byteBuffer = st->bit_stream[( st->next_bit_pos )--];
byteBuffer = st->bit_stream[( st->next_bit_pos )--];
*nb_bits_read += MASA_HEADER_BITS;
/* read number of directions */
byteBuffer = st->bit_stream[( st->next_bit_pos )--];
( *nb_bits_read )++;
hMasa->config.numberOfDirections = (uint8_t) ( byteBuffer + 1 );
}
else
{
/* if there are 3 or 4 objects the number of transport channels bit is given to MASA format
and used to read number of directions*/
byteBuffer = st->bit_stream[( st->next_bit_pos )--];
( *nb_bits_read )++;
hMasa->config.numberOfDirections = (uint8_t) ( byteBuffer + 1 );
/* the two reserved bits were already read in ivas_init_dec()*/
byteBuffer = st->bit_stream[( st->next_bit_pos )--];
byteBuffer = st->bit_stream[( st->next_bit_pos )--];
*nb_bits_read += MASA_HEADER_BITS;
}
}
else
{
#endif
if ( ivas_format != MASA_ISM_FORMAT )
{
/* number of transport channels is always 2 for MASA_ISM format */
......@@ -249,13 +295,14 @@ ivas_error ivas_masa_decode(
}
}
#ifndef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
/* read 2 bits:
'00' - MASA format at the encoder
'01' - MASA_ISM_FORMAT at the encoder, with 1 object
'10' - MASA_ISM_FORMAT at the encoder, with 2 objects
'11' - MASA_ISM_FORMAT at the encoder, with 3 or 4 objects
reading if 3 or 4 object is performed later
'11' - MASA_ISM_FORMAT at the encoder, with 3 or 4 objects; reading if 3 or 4 object is performed later
*/
#endif
byteBuffer = st->bit_stream[( st->next_bit_pos )--];
byteBuffer = byteBuffer + 2 * st->bit_stream[( st->next_bit_pos )--];
......@@ -273,6 +320,9 @@ ivas_error ivas_masa_decode(
byteBuffer = st->bit_stream[( st->next_bit_pos )--];
( *nb_bits_read )++;
hMasa->config.numberOfDirections = (uint8_t) ( byteBuffer + 1 );
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
}
#endif
}
else
{
......
......@@ -87,6 +87,9 @@ ivas_error ivas_mct_dec(
STnsData tnsData[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV];
Decoder_State **sts;
float synth[CPE_CHANNELS][L_FRAME_PLUS];
#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS
float *p_output_orig[2];
#endif
float output_lfe_ch[L_FRAME48k];
int32_t ivas_total_brate;
ivas_error error;
......@@ -148,6 +151,18 @@ ivas_error ivas_mct_dec(
/* MCT side bits decoder */
ivas_mct_side_bits( hMCT, st_ivas->hCPE, nCPE, st_ivas->hCPE[0]->hCoreCoder[0], st_ivas->bfi, st_ivas->hCPE[0]->hCoreCoder[0]->bit_stream, ivas_total_brate, nb_bits_metadata );
#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS
/* in case of switching from an SID frame (with ACELP core) to MCT, buffer of L_FRAME_PLUS samples is needed -> use synth[] as a temporary buffer */
if ( st_ivas->hCPE[0]->hCoreCoder[0]->last_core == ACELP_CORE )
{
for ( n = 0; n < CPE_CHANNELS; n++ )
{
p_output_orig[n] = output[n];
output[n] = synth[n];
}
}
#endif
for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ )
{
st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect |= st_ivas->BER_detect;
......@@ -232,6 +247,17 @@ ivas_error ivas_mct_dec(
ivas_mdct_core_reconstruct( hCPE, x, synth, fUseTns[cpe_id], 1 );
#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS
/* set pointers back */
if ( cpe_id == 0 && st_ivas->hCPE[0]->hCoreCoder[0]->last_core == ACELP_CORE )
{
for ( n = 0; n < CPE_CHANNELS; n++ )
{
output[n] = p_output_orig[n];
}
}
#endif
/*----------------------------------------------------------------*
* CoreCoder Post-processing and updates
*----------------------------------------------------------------*/
......@@ -263,7 +289,6 @@ ivas_error ivas_mct_dec(
#endif
} /* n_channels loop */
/* synthesis synchronization between stereo modes */
if ( !st_ivas->sba_dirac_stereo_flag || ( st_ivas->ivas_format == SBA_ISM_FORMAT && cpe_id < nCPE - 2 ) )
{
......@@ -1230,6 +1255,12 @@ static ivas_error ivas_mc_dec_reconfig(
if ( st_ivas->hBinRenderer != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) )
{
ivas_binRenderer_close( &st_ivas->hBinRenderer );
#ifdef FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR
if ( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) )
{
efap_free_data( &st_ivas->hEFAPdata );
}
#endif
}
#ifdef SPLIT_REND_WITH_HEAD_ROT
......
......@@ -420,6 +420,18 @@ ivas_error ivas_masa_encode(
{
if ( ivas_format == MASA_ISM_FORMAT && ism_mode == ISM_MODE_NONE )
{
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
/* use the MASA number of transport channels bit to signal if there are 1 or 2 objects */
if ( nchan_ism == 1 || nchan_ism == 2 )
{
push_next_indice( hMetaData, nchan_ism - 1, MASA_TRANSP_BITS );
}
else
{
/* for 3 or 4 objects write already the number of MASA directions */
push_next_indice( hMetaData, hQMetaData->no_directions - 1, MASA_TRANSP_BITS );
}
#else
/* use the MASA number of transport channels bit to signal if there are 3 or 4 objects */
if ( nchan_ism == 4 )
{
......@@ -429,6 +441,7 @@ ivas_error ivas_masa_encode(
{
push_next_indice( hMetaData, 0, MASA_TRANSP_BITS );
}
#endif
}
else
{
......@@ -440,6 +453,16 @@ ivas_error ivas_masa_encode(
if ( ivas_format == MASA_ISM_FORMAT && ism_mode == ISM_MODE_NONE )
{
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
if ( nchan_ism >= 3 ) /* if 3 or 4 objects */
{
push_next_indice( hMetaData, 5 - nchan_ism, MASA_HEADER_BITS );
}
else
{
push_next_indice( hMetaData, 3, MASA_HEADER_BITS );
}
#else
if ( nchan_ism <= 3 )
{
push_next_indice( hMetaData, nchan_ism, MASA_HEADER_BITS );
......@@ -448,6 +471,7 @@ ivas_error ivas_masa_encode(
{
push_next_indice( hMetaData, nchan_ism - 1, MASA_HEADER_BITS );
}
#endif
hQMetaData->metadata_max_bits -= MASA_HEADER_BITS;
}
else
......@@ -457,10 +481,16 @@ ivas_error ivas_masa_encode(
push_next_indice( hMetaData, 0, MASA_HEADER_BITS );
hQMetaData->metadata_max_bits -= MASA_HEADER_BITS;
}
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
if ( !( ivas_format == MASA_ISM_FORMAT && ism_mode == ISM_MODE_NONE && nchan_ism > 2 ) )
{
#endif
/* write number of directions */
push_next_indice( hMetaData, hQMetaData->no_directions - 1, 1 );
hQMetaData->metadata_max_bits -= 1;
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
}
#endif
/* write subframe mode */
push_next_indice( hMetaData, hQMetaData->q_direction[0].cfg.nblocks == 1 ? 1 : 0, MASA_SUBFRAME_BITS );
hQMetaData->metadata_max_bits -= MASA_SUBFRAME_BITS;
......
DisableFormat: true
SortIncludes: Never
/******************************************************************************
* ETSI TS 103 634 V1.4.3 *
* ETSI TS 103 634 V1.5.1 *
* Low Complexity Communication Codec Plus (LC3plus) *
* *
* Copyright licence is solely granted through ETSI Intellectual Property *
......@@ -7,7 +7,6 @@
* estoppel or otherwise. *
******************************************************************************/
#include "options.h"
#include "wmc_auto.h"
#include "functions.h"
......@@ -19,11 +18,7 @@ void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_
LC3_FLOAT delta;
LC3_INT delta2;
LC3_INT gg_idx_inc;
#ifdef CR8_G_ADD_75MS
LC3_FLOAT factor;
#else
LC3_INT factor;
#endif
if (frame_dms == 25)
{
......@@ -37,12 +32,10 @@ void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_
{
factor = 2;
}
#ifdef CR8_G_ADD_75MS
else if (frame_dms == 75)
{
factor = 1.2;
}
#endif
else
{
factor = 1;
......
/******************************************************************************
* ETSI TS 103 634 V1.4.3 *
* ETSI TS 103 634 V1.5.1 *
* Low Complexity Communication Codec Plus (LC3plus) *
* *
* Copyright licence is solely granted through ETSI Intellectual Property *
......@@ -7,7 +7,6 @@
* estoppel or otherwise. *
******************************************************************************/
#include "options.h"
#include "wmc_auto.h"
#include "stdint.h"
......@@ -715,7 +714,6 @@ LC3_INT32 fec_decoder(LC3_UINT8 *iobuf, LC3_INT16 slot_bytes, LC3_INT32 *data_by
if (*bfi == 1)
{
return ERROR_REPORT_BEC_MASK;
}
......
/******************************************************************************
* ETSI TS 103 634 V1.4.3 *
* ETSI TS 103 634 V1.5.1 *
* Low Complexity Communication Codec Plus (LC3plus) *
* *
* Copyright licence is solely granted through ETSI Intellectual Property *
......@@ -7,7 +7,6 @@
* estoppel or otherwise. *
******************************************************************************/
#include "options.h"
#include "wmc_auto.h"
#include "functions.h"
......
/******************************************************************************
* ETSI TS 103 634 V1.4.3 *
* ETSI TS 103 634 V1.5.1 *
* Low Complexity Communication Codec Plus (LC3plus) *
* *
* Copyright licence is solely granted through ETSI Intellectual Property *
......@@ -7,7 +7,6 @@
* estoppel or otherwise. *
******************************************************************************/
#include "options.h"
#include "wmc_auto.h"
#include "functions.h"
......@@ -19,105 +18,17 @@ static void write_uint_forward_fl(Encoder_State_fl* st, LC3_INT val, LC3_INT num
static void ari_enc_init(Encoder_State_fl* st, LC3_UINT8* bytes, LC3_INT* bp_side, LC3_INT* mask_side);
static LC3_INT sign(LC3_INT x);
#ifdef CR9_SIMPLIFY_ARI_DECODER
static void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit);
#else
static void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit, LC3_INT *bp, Decoder_State_fl* st_fl, LC3_INT from_left);
#endif
#ifdef CR9_SIMPLIFY_ARI_DECODER
static void ac_dec_init_fl(LC3_UINT8* ptr, LC3_INT* bp, Decoder_State_fl* st_fl, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side);
#else
static void ac_dec_init_fl(LC3_UINT8* ptr, LC3_INT* bp, Decoder_State_fl* st_fl, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side);
#endif
#ifdef CR9_SIMPLIFY_ARI_DECODER
static LC3_INT32 ac_decode_fl(Decoder_State_fl* st, const LC3_INT16* sym_freq, LC3_INT32 num_sym, LC3_UINT8* ptr, LC3_INT32* bp, LC3_INT32 from_left, LC3_INT32 mask_side, LC3_INT32 *bp_side, LC3_INT16 cur_bin);
#else
static LC3_INT ac_decode_fl(Decoder_State_fl* st, LC3_INT* sym_freq, LC3_INT* cum_freq, LC3_INT num_sym, LC3_UINT8* ptr, LC3_INT* bp, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side);
#endif
#ifdef CR9_SIMPLIFY_ARI_DECODER
static LC3_INT16 pc_check_bytes(LC3_INT32* bp, Decoder_State_fl* st_fl, LC3_INT32 from_left, LC3_INT32 mask_side, LC3_INT32 *bp_side, LC3_INT16 cur_bin);
#else
static void pc_check_bytes(LC3_INT32* bp, Decoder_State_fl* st_fl, LC3_INT32 from_left, LC3_INT32 mask_side, LC3_INT32 *bp_side);
#endif
static void calculate_nfseed(LC3_INT *x, LC3_INT L_spec, LC3_INT *nf_seed);
static void findNonZero(LC3_INT* in, LC3_INT len, LC3_INT* outLen);
#ifndef CR9_SIMPLIFY_ARI_DECODER
static void ac_freq(LC3_INT pki, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym);
static void tns_coef_freq(LC3_INT k, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym);
static void tns_order_freq(LC3_INT enable_lpc_weighting, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym);
void ac_freq(LC3_INT pki, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym)
{
LC3_INT i = 0, j = 0;
*numsym = 18 - 1;
j = 0;
for (i = 1; i <= *numsym; i++) {
symfreq[j] = ari_spec_cumfreq_fl[pki][i];
j++;
}
for (i = 0; i < *numsym; i++) {
symfreq[i] -= ari_spec_cumfreq_fl[pki][i];
}
for (i = 0; i < *numsym; i++) {
cumfreq[i] = ari_spec_cumfreq_fl[pki][i];
}
}
void tns_coef_freq(LC3_INT k, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym)
{
LC3_INT i = 0, j = 0;
*numsym = 18 - 1;
j = 0;
for (i = 1; i <= *numsym; i++) {
symfreq[j] = ari_tns_freq_cf[k][i];
j++;
}
for (i = 0; i < *numsym; i++) {
symfreq[i] -= ari_tns_freq_cf[k][i];
}
for (i = 0; i < *numsym; i++) {
cumfreq[i] = ari_tns_freq_cf[k][i];
}
}
void tns_order_freq(LC3_INT enable_lpc_weighting, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym)
{
LC3_INT i = 0, j = 0;
*numsym = 8;
j = 0;
for (i = 1; i < 9; i++) {
symfreq[j] = ari_tns_order_cf[enable_lpc_weighting][i];
j++;
}
for (i = 0; i < *numsym; i++) {
symfreq[i] -= ari_tns_order_cf[enable_lpc_weighting][i];
}
for (i = 0; i < *numsym; i++) {
cumfreq[i] = ari_tns_order_cf[enable_lpc_weighting][i];
}
}
#endif
void findNonZero(LC3_INT* in, LC3_INT len, LC3_INT* outLen)
{
LC3_INT i = 0, j = 0;
......@@ -147,7 +58,6 @@ void calculate_nfseed(LC3_INT *x, LC3_INT L_spec, LC3_INT *nf_seed)
}
}
#ifdef CR9_SIMPLIFY_ARI_DECODER
static LC3_INT16 pc_check_bytes(LC3_INT32* bp, Decoder_State_fl* st_fl, LC3_INT32 from_left, LC3_INT32 mask_side, LC3_INT32 *bp_side, LC3_INT16 cur_bin)
{
LC3_INT32 bp_local, bp_side_local, offset;
......@@ -241,95 +151,6 @@ static LC3_INT16 pc_check_bytes(LC3_INT32* bp, Decoder_State_fl* st_fl, LC3_INT3
return 0;
}
#else
static void pc_check_bytes(LC3_INT32* bp, Decoder_State_fl* st_fl, LC3_INT32 from_left, LC3_INT32 mask_side, LC3_INT32 *bp_side)
{
LC3_INT32 bp_local, bp_side_local, offset;
if (st_fl->pc_bytes > 0)
{
if (!from_left && mask_side != 1)
{
return;
}
if (st_fl->pc_c_bp_side > 0 && *bp_side < 0)
{
assert(mask_side == 1);
assert(st_fl->pc_b_right != -1);
*bp_side = st_fl->pc_b_right;
return;
}
bp_local = *bp;
bp_side_local = *bp_side;
if (from_left)
{
if (mask_side == 1)
{
bp_side_local = bp_side_local + 1;
}
} else {
bp_local = bp_local - 1;
}
if (st_fl->pc_b_right == -1)
{
offset = -1;
if (!st_fl->pc_enc)
{
offset = offset + st_fl->pc_bytes;
}
if ((bp_side_local + offset - bp_local) == st_fl->pc_bytes)
{
st_fl->pc_b_left = bp_local + 1;
st_fl->pc_b_right = bp_side_local - 1;
if (st_fl->pc_enc)
{
st_fl->pc_return = 1;
return;
}
}
}
if (!st_fl->pc_enc && st_fl->pc_b_right > -1)
{
if (from_left && *bp == st_fl->pc_b_left)
{
*bp = 0;
st_fl->pc_c_bp = 1;
}
if (!from_left && bp_side_local == st_fl->pc_b_right)
{
*bp_side = st_fl->pc_bytes - 1;
st_fl->pc_c_bp_side = 1;
}
if (st_fl->pc_bfi == 2)
{
if ((st_fl->pc_c_bp && (*bp + 1) >= st_fl->pc_be_bp_left) || (st_fl->pc_c_bp_side && (*bp_side + 1) <= st_fl->pc_be_bp_right))
{
st_fl->pc_bbi = 2;
} else if ((st_fl->pc_c_bp && *bp >= 0) || (st_fl->pc_c_bp_side && *bp_side <= (st_fl->pc_bytes - 1)))
{
st_fl->pc_bbi = 1;
}
}
}
}
return;
}
#endif
#ifdef CR9_SIMPLIFY_ARI_DECODER
void ac_dec_init_fl(LC3_UINT8* ptr, LC3_INT* bp, Decoder_State_fl* st_fl, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side)
{
LC3_INT i;
......@@ -355,34 +176,7 @@ void ac_dec_init_fl(LC3_UINT8* ptr, LC3_INT* bp, Decoder_State_fl* st_fl, LC3_IN
st_fl->BER_detect = 0;
}
#else
void ac_dec_init_fl(LC3_UINT8* ptr, LC3_INT* bp, Decoder_State_fl* st_fl, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side)
{
LC3_INT i = 0;
if (!st_fl->pc_enc)
{
*bp = *bp + st_fl->pc_bytes;
}
st_fl->ac_low_fl = 0;
st_fl->ac_range_fl = (LC3_UINT32)pow(2, 24) - (LC3_UINT32)1;
for (i = 0; i < 3; i++) {
pc_check_bytes(bp, st_fl, from_left, mask_side, bp_side);
st_fl->ac_low_fl = (st_fl->ac_low_fl << 8) + (LC3_UINT32)ptr[*bp];
*bp = *bp + 1;
}
st_fl->BER_detect = 0;
}
#endif
/* Returns val */
#ifdef CR9_SIMPLIFY_ARI_DECODER
LC3_INT32 ac_decode_fl(Decoder_State_fl* st, const LC3_INT16* freq, LC3_INT32 num_sym, LC3_UINT8* ptr, LC3_INT32* bp, LC3_INT32 from_left, LC3_INT32 mask_side, LC3_INT32 *bp_side, LC3_INT16 cur_bin)
{
LC3_INT val, tmp, symfreq_loc;
......@@ -428,46 +222,6 @@ LC3_INT32 ac_decode_fl(Decoder_State_fl* st, const LC3_INT16* freq, LC3_INT32 nu
return val;
}
#else
LC3_INT ac_decode_fl(Decoder_State_fl* st, LC3_INT* sym_freq, LC3_INT* cum_freq, LC3_INT num_sym, LC3_UINT8* ptr, LC3_INT* bp, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side)
{
LC3_INT val = 0, tmp = 0;
tmp = st->ac_range_fl >> 10;
if (st->ac_low_fl >= (LC3_UINT32)(tmp << 10)) {
st->BER_detect = 1;
}
val = num_sym - 1;
while (st->ac_low_fl < (LC3_UINT32)(tmp * cum_freq[val])) {
val--;
}
st->ac_low_fl = st->ac_low_fl - tmp * cum_freq[val];
st->ac_range_fl = tmp * sym_freq[val];
while (st->ac_range_fl < pow(2, 16)) {
st->ac_low_fl = st->ac_low_fl << 8;
st->ac_low_fl = ((LC3_INT)st->ac_low_fl) & ((LC3_INT)(pow(2, 24) - 1));
pc_check_bytes(bp, st, from_left, mask_side, bp_side);
st->ac_low_fl = st->ac_low_fl + ptr[*bp];
*bp = *bp + 1;
st->ac_range_fl = st->ac_range_fl << 8;
}
return val;
}
#endif
#ifdef CR9_SIMPLIFY_ARI_DECODER
void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit)
{
if (ptr[*bp_side] & *mask_side) {
......@@ -484,33 +238,6 @@ void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT*
}
}
#else
void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit, LC3_INT *bp, Decoder_State_fl* st_fl, LC3_INT from_left)
{
*bit = 0;
UNUSED(bp);
UNUSED(st_fl);
UNUSED(from_left);
if (ptr[*bp_side] & *mask_side) {
*bit = 1;
} else {
*bit = 0;
}
if (*mask_side == 128) {
*mask_side = 1;
*bp_side = *bp_side - 1;
} else {
*mask_side = *mask_side * 2;
}
}
#endif
#ifdef CR9_SIMPLIFY_ARI_DECODER
void processAriDecoder_fl(LC3_UINT8* bytes, LC3_INT bp_side, LC3_INT mask_side, LC3_INT L_spec, LC3_INT fs_idx, LC3_INT enable_lpc_weighting,
LC3_INT tns_numfilters, LC3_INT lsbMode, LC3_INT lastnz, LC3_INT* bfi, LC3_INT* tns_order, LC3_INT fac_ns_idx,
LC3_INT gg_idx, uint8_t * resBits, LC3_INT* x, LC3_INT* nf_seed, LC3_INT* tns_idx, LC3_INT* zero_frame, LC3_INT numbytes,
......@@ -938,550 +665,6 @@ bail:
(void)0;
}
#else
void processAriDecoder_fl(LC3_UINT8* bytes, LC3_INT bp_side, LC3_INT mask_side, LC3_INT L_spec, LC3_INT fs_idx, LC3_INT enable_lpc_weighting,
LC3_INT tns_numfilters, LC3_INT lsbMode, LC3_INT lastnz, LC3_INT* bfi, LC3_INT* tns_order, LC3_INT fac_ns_idx,
LC3_INT gg_idx, uint8_t * resBits, LC3_INT* x, LC3_INT* nf_seed, LC3_INT* tns_idx, LC3_INT* zero_frame, LC3_INT numbytes,
LC3_INT* nbits_residual, LC3_INT* residualPresent, LC3_INT frame_dms,
LC3_INT32 n_pc, LC3_INT32 be_bp_left, LC3_INT32 be_bp_right, LC3_INT32 enc, LC3_INT32 *b_left, LC3_INT32 *spec_inv_idx,
LC3_INT hrmode
)
{
Decoder_State_fl st;
LC3_INT a = 0, b = 0, t = 0, bp = 0;
LC3_INT c = 0;
LC3_INT nbits_side = 0, extra_bits = 0;
LC3_UINT8* ptr = NULL;
LC3_INT n = 0, k = 0, lev = 0;
LC3_INT max_lev = 0, tmp = 0;
LC3_INT sym_freq[MAX_LEN] = {0}, cum_freq[MAX_LEN] = {0}, numsym = 0, bit = 0, lev1 = 0, pki = 0, sym = 0,
save_lev[MAX_LEN] = {0}, idx_len = 0, total_bits = 0, nbits_ari = 0, rateFlag = 0;
total_bits = 8 * numbytes;
memset(&st, 0, sizeof(st));
st.pc_bytes = (n_pc + 1) >> 1;
st.pc_b_left = numbytes + 1;
st.pc_b_right = -1;
st.pc_enc = enc;
st.pc_bfi = *bfi;
st.pc_be_bp_left = floor(be_bp_left / 8);
st.pc_be_bp_right = floor(be_bp_right / 8) - 1;
*spec_inv_idx = L_spec + 1;
assert(st.pc_be_bp_right < st.pc_bytes || st.pc_bytes == 0);
/* Rate flag */
if (fs_idx != 5)
{
if (total_bits > (160 + fs_idx * 160)) {
rateFlag = 512;
}
}
/* Init */
c = 0;
t = 0;
bp = 0;
*b_left = -1;
ptr = bytes;
/* Start Decoding */
ac_dec_init_fl(ptr, &bp, &st, 1, mask_side, &bp_side);
/* Decode TNS data */
tmp = MAXLAG;
if (frame_dms == 25)
{
tmp /= 2;
}
if (frame_dms == 50)
{
tmp /= 2;
}
/* Decode TNS data */
for (n = 0; n < tns_numfilters; n++) {
if (tns_order[n] > 0) {
tns_order_freq(enable_lpc_weighting, sym_freq, cum_freq, &numsym);
tns_order[n] = ac_decode_fl(&st, sym_freq, cum_freq, numsym, ptr, &bp, 1, mask_side, &bp_side);
if (st.pc_return)
{
*b_left = st.pc_b_left;
return;
}
tns_order[n] = tns_order[n] + 1;
if (tns_order[n] > tmp)
{
st.BER_detect = 1;
}
if (st.pc_bbi == 1)
{
spec_inv_idx = 0;
} else if (st.pc_bbi == 2)
{
st.BER_detect = 1;
}
for (k = 0; k < tns_order[n]; k++) {
if (bp_side < bp)
{
*bfi = 1;
return;
}
tns_coef_freq(k, sym_freq, cum_freq, &numsym);
tns_idx[n * 8 + k] = ac_decode_fl(&st, sym_freq, cum_freq, numsym, ptr, &bp, 1, mask_side, &bp_side);
if (st.pc_return)
{
*b_left = st.pc_b_left;
return;
}
if (st.pc_bbi == 1)
{
spec_inv_idx = 0;
} else if (st.pc_bbi == 2)
{
st.BER_detect = 1;
}
}
}
}
if (st.BER_detect > 0) {
*bfi = 1;
return;
}
/* Spectral data */
for (k = 0; k < lastnz; k = k + 2) {
/* Context */
t = c + rateFlag;
if (k > L_spec / 2) {
t = t + 256;
}
/* Decode amplitude */
x[k] = 0;
x[k + 1] = 0;
if (hrmode == 1) {
max_lev = 13 + 8;
} else {
max_lev = 13;
}
for (lev = 0; lev <= max_lev; lev++) {
lev1 = MIN(lev, 3);
pki = ari_spec_lookup_fl[t + lev1 * 1024];
ac_freq(pki, sym_freq, cum_freq, &numsym);
sym = ac_decode_fl(&st, sym_freq, cum_freq, numsym, ptr, &bp, 1, mask_side, &bp_side);
if (st.pc_return)
{
*b_left = st.pc_b_left;
return;
}
if (st.pc_bbi == 1)
{
*spec_inv_idx = MIN(*spec_inv_idx, k);
} else if (st.pc_bbi == 2)
{
*spec_inv_idx = k;
x[k] = 0;
x[k + 1] = 0;
calculate_nfseed(x, k, nf_seed);
return;
}
if (sym < 16) {
break;
}
if (lsbMode == 0 || lev > 0) {
pc_check_bytes(&bp, &st, 0, mask_side, &bp_side);
read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0);
if (st.pc_return)
{
*b_left = st.pc_b_left;
return;
}
if (st.pc_bbi == 2)
{
*spec_inv_idx = k;
x[k] = 0;
x[k + 1] = 0;
calculate_nfseed(x, k, nf_seed);
return;
}
x[k] = x[k] + (bit << lev);
pc_check_bytes(&bp, &st, 0, mask_side, &bp_side);
read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0);
if (st.pc_return)
{
*b_left = st.pc_b_left;
return;
}
if (st.pc_bbi == 2)
{
*spec_inv_idx = k;
x[k] = 0;
x[k + 1] = 0;
calculate_nfseed(x, k, nf_seed);
return;
}
x[k + 1] = x[k + 1] + (bit << lev);
}
}
if ((lev - 1) == 13 && sym == 16)
{
st.BER_detect = 1;
}
if (hrmode == 0) {
lev = MIN(lev, 13);
}
if (lsbMode == 1) {
save_lev[k] = lev;
}
a = sym & 3;
b = sym >> 2;
x[k] = x[k] + (a << lev);
x[k + 1] = x[k + 1] + (b << lev);
/* Decode signs */
if (x[k] > 0) {
pc_check_bytes(&bp, &st, 0, mask_side, &bp_side);
read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0);
if (st.pc_return)
{
*b_left = st.pc_b_left;
return;
}
if (st.pc_bbi == 2)
{
*spec_inv_idx = k;
x[k] = 0;
x[k + 1] = 0;
calculate_nfseed(x, k, nf_seed);
return;
}
if (bit == 1) {
x[k] = -x[k];
}
}
if (x[k + 1] > 0) {
pc_check_bytes(&bp, &st, 0, mask_side, &bp_side);
read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0);
if (st.pc_return)
{
*b_left = st.pc_b_left;
return;
}
if (st.pc_bbi == 2)
{
*spec_inv_idx = k + 1;
x[k + 1] = 0;
calculate_nfseed(x, k, nf_seed);
return;
}
if (bit == 1) {
x[k + 1] = -x[k + 1];
}
}
/* Context */
lev1 = MIN(lev, 3);
if (lev1 <= 1) {
t = 1 + (a + b) * (lev1 + 1);
} else {
t = 12 + lev1;
}
c = (c & 15) * 16 + t;
if (((bp - bp_side) > 3 && (st.pc_c_bp == st.pc_c_bp_side))) {
if ((0 < *spec_inv_idx) && (*spec_inv_idx < (L_spec + 1)))
{
*bfi = 2;
calculate_nfseed(x, k, nf_seed);
return;
}
*bfi = 1;
return;
}
if (st.BER_detect > 0)
{
if ((0 < *spec_inv_idx) && (*spec_inv_idx < (L_spec + 1)))
{
*bfi = 2;
calculate_nfseed(x, k, nf_seed);
return;
}
*bfi = 1;
return;
}
}
/* Residual bits */
nbits_side = total_bits - (8 * bp_side + 8 - (31 - clz_func(mask_side)));
nbits_ari = (bp - 3) * 8;
extra_bits = 25 - (31 - clz_func(st.ac_range_fl));
if (enc == 0)
{
if (st.pc_c_bp == 0)
{
nbits_ari = (bp - st.pc_bytes - 3) * 8;
} else {
nbits_ari = (bp + st.pc_b_left - st.pc_bytes - 3) * 8;
}
if (st.pc_c_bp_side != 0)
{
nbits_side = total_bits - 8 * (st.pc_b_left) + 8 * (st.pc_bytes - bp_side) - (8 - LC3_LOGTWO(mask_side));
}
}
*nbits_residual = total_bits - (nbits_side + nbits_ari + extra_bits);
if (*nbits_residual < 0) {
if ((0 < *spec_inv_idx) && (*spec_inv_idx < (L_spec + 1)))
{
*bfi = 2;
calculate_nfseed(x, k, nf_seed);
return;
}
*bfi = 1;
return;
}
if (lsbMode == 0) {
findNonZero(x, L_spec, &idx_len);
if (hrmode)
{
idx_len *= EXT_RES_ITER_MAX;
}
*nbits_residual = MIN(*nbits_residual, idx_len);
*residualPresent = 1;
memset(resBits, 0, MAX_RESBITS_LEN);
for (k = 0; k < *nbits_residual; k++) {
pc_check_bytes(&bp, &st, 0, mask_side, &bp_side);
read_bit_fl(ptr, &mask_side, &bp_side, &tmp, &bp, &st, 0);
if (st.pc_return)
{
*b_left = st.pc_b_left;
return;
}
if (st.pc_bbi == 2)
{
*bfi = 0;
memset(resBits, 0, sizeof(uint8_t) * (*nbits_residual));
calculate_nfseed(x, k, nf_seed);
return;
}
resBits[k >> 3] |= tmp << (k & 7);
}
} else {
for (k = 0; k < lastnz; k = k + 2) {
if (save_lev[k] > 0) {
if (*nbits_residual == 0) {
break;
}
pc_check_bytes(&bp, &st, 0, mask_side, &bp_side);
read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0);
if (st.pc_return)
{
*b_left = st.pc_b_left;
return;
}
if (st.pc_bbi == 2)
{
*bfi = 0;
memset(resBits, 0, sizeof(LC3_INT32) * (*nbits_residual));
calculate_nfseed(x, k, nf_seed);
return;
}
*nbits_residual = *nbits_residual - 1;
if (bit == 1) {
if (x[k] > 0) {
x[k] = x[k] + 1;
} else if (x[k] < 0) {
x[k] = x[k] - 1;
} else {
if (*nbits_residual == 0) {
break;
}
pc_check_bytes(&bp, &st, 0, mask_side, &bp_side);
read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0);
if (st.pc_return)
{
*b_left = st.pc_b_left;
return;
}
if (st.pc_bbi == 2)
{
*bfi = 0;
memset(resBits, 0, sizeof(LC3_INT32) * (*nbits_residual));
calculate_nfseed(x, k, nf_seed);
return;
}
*nbits_residual = *nbits_residual - 1;
if (bit == 0) {
x[k] = 1;
} else {
x[k] = -1;
}
}
}
if (*nbits_residual == 0) {
break;
}
pc_check_bytes(&bp, &st, 0, mask_side, &bp_side);
read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0);
if (st.pc_return)
{
*b_left = st.pc_b_left;
return;
}
if (st.pc_bbi == 2)
{
*bfi = 0;
memset(resBits, 0, sizeof(LC3_INT32) * (*nbits_residual));
calculate_nfseed(x, k, nf_seed);
return;
}
*nbits_residual = *nbits_residual - 1;
if (bit == 1) {
if (x[k + 1] > 0) {
x[k + 1] = x[k + 1] + 1;
} else if (x[k + 1] < 0) {
x[k + 1] = x[k + 1] - 1;
} else {
if (*nbits_residual == 0) {
break;
}
pc_check_bytes(&bp, &st, 0, mask_side, &bp_side);
read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0);
if (st.pc_return)
{
*b_left = st.pc_b_left;
return;
}
if (st.pc_bbi == 2)
{
*bfi = 0;
memset(resBits, 0, sizeof(LC3_INT32) * (*nbits_residual));
calculate_nfseed(x, k, nf_seed);
return;
}
*nbits_residual = *nbits_residual - 1;
if (bit == 0) {
x[k + 1] = 1;
} else {
x[k + 1] = -1;
}
}
}
}
}
}
/* Noise-filling seed */
calculate_nfseed(x, L_spec, nf_seed);
/* Zero frame flag */
if (lastnz == 2 && x[0] == 0 && x[1] == 0 && gg_idx == 0 && fac_ns_idx == 7) {
*zero_frame = 1;
} else {
*zero_frame = 0;
}
if (enc)
{
if (st.pc_bytes > 0)
{
if (st.pc_b_left > numbytes)
{
*b_left = bp_side - st.pc_bytes;
}
}
}
if ((*bfi == 2) && (*spec_inv_idx == (L_spec + 1)))
{
*bfi = 0;
}
*spec_inv_idx = *spec_inv_idx - 1;
}
#endif
void ac_encode_fl(Encoder_State_fl* st, LC3_INT sym_freq, LC3_INT cum_freq)
{
LC3_INT r;
......
/******************************************************************************
* ETSI TS 103 634 V1.4.3 *
* ETSI TS 103 634 V1.5.1 *
* Low Complexity Communication Codec Plus (LC3plus) *
* *
* Copyright licence is solely granted through ETSI Intellectual Property *
......@@ -7,7 +7,6 @@
* estoppel or otherwise. *
******************************************************************************/
#include "options.h"
#include "wmc_auto.h"
#include "functions.h"
......
/******************************************************************************
* ETSI TS 103 634 V1.4.3 *
* ETSI TS 103 634 V1.5.1 *
* Low Complexity Communication Codec Plus (LC3plus) *
* *
* Copyright licence is solely granted through ETSI Intellectual Property *
......@@ -7,7 +7,6 @@
* estoppel or otherwise. *
******************************************************************************/
#ifndef CLIB_H
#define CLIB_H
......
/******************************************************************************
* ETSI TS 103 634 V1.4.3 *
* ETSI TS 103 634 V1.5.1 *
* Low Complexity Communication Codec Plus (LC3plus) *
* *
* Copyright licence is solely granted through ETSI Intellectual Property *
......@@ -7,7 +7,6 @@
* estoppel or otherwise. *
******************************************************************************/
 
#include "options.h"
#include "wmc_auto.h"
#include "functions.h"
......@@ -1000,7 +999,6 @@ const LC3_INT BW_cutoff_bits_all[MAX_BW_BANDS_NUMBER] = {0, 1, 2, 2, 3, 0};
const LC3_INT BW_cutoff_bin_all_5ms[MAX_BW_BANDS_NUMBER] = {40, 80, 120, 160, 200, 200};
const LC3_INT BW_cutoff_bin_all_2_5ms[MAX_BW_BANDS_NUMBER] = {20, 40, 60, 80, 100, 100};
 
#ifdef CR8_G_ADD_75MS
const LC3_INT BW_cutoff_bin_all_7_5ms[] = {60, 120, 180, 240, 300, 300};
const LC3_INT bands_number_7_5ms_HR [] = {60, 64, 64, 64, 64, 64};
const LC3_INT bands_number_7_5ms [] = {60, 64, 64, 64, 64};
......@@ -1023,7 +1021,6 @@ const LC3_INT* BW_warp_idx_start_all_7_5ms[4] = {BW_warp_idx_start_16k_7_5ms, BW
BW_warp_idx_start_32k_7_5ms, BW_warp_idx_start_48k_7_5ms};
const LC3_INT* BW_warp_idx_stop_all_7_5ms[4] = {BW_warp_idx_stop_16k_7_5ms, BW_warp_idx_stop_24k_7_5ms,
BW_warp_idx_stop_32k_7_5ms, BW_warp_idx_stop_48k_7_5ms};
#endif
 
/* Arithmetic coding */
const LC3_INT tns_cf[8][18] = {{0, 1, 6, 21, 52, 106, 192, 289, 409, 568, 720, 831, 935, 994, 1016, 1022, 1023, 1024},
......@@ -1039,9 +1036,6 @@ const LC3_INT tns_freq_cf[2][9] = {{0, 3, 12, 35, 89, 200, 390, 658, 1024}, {0,
 
/* MDCT Windows */
 
#ifdef CR8_G_ADD_75MS
const LC3_FLOAT MDCT_HRA_WINDOW_480_7_5ms[720] = {
0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
......@@ -3404,7 +3398,6 @@ const LC3_FLOAT MDCT_WINDOW_480_7_5ms[720] = {0.00172152668161197,
0,
0,
0};
#endif /* #ifdef CR8_G_ADD_75MS */
 
const LC3_FLOAT MDCT_WINDOW_80_2_5ms[40] = {
6.737914289329320e-03, 2.732289618100209e-02, 6.163560962361236e-02, 1.119125037883055e-01, 1.787053464784875e-01,
......@@ -5488,12 +5481,10 @@ const LC3_FLOAT* MDCT_WINS_10ms[2][6] = {
{NULL, NULL, NULL, NULL, MDCT_HRA_WINDOW_480_10ms, MDCT_HRA_WINDOW_960_10ms}};
const LC3_INT MDCT_la_zeroes[6] = {30, 60, 90, 120, 180, 360};
 
#ifdef CR8_G_ADD_75MS
const LC3_FLOAT* MDCT_WINS_7_5ms[2][6] = {
{MDCT_WINDOW_80_7_5ms, MDCT_WINDOW_160_7_5ms, MDCT_WINDOW_240_7_5ms, MDCT_WINDOW_320_7_5ms, MDCT_WINDOW_480_7_5ms, NULL},
{NULL , NULL , NULL , NULL , MDCT_HRA_WINDOW_480_7_5ms, MDCT_HRA_WINDOW_960_7_5ms}};
const LC3_INT32 MDCT_la_zeroes_7_5ms[6] = {14, 28, 42, 56, 84, 168};
#endif
 
const LC3_FLOAT* MDCT_WINS_2_5ms[2][6] = {
{MDCT_WINDOW_80_2_5ms, MDCT_WINDOW_160_2_5ms, MDCT_WINDOW_240_2_5ms, MDCT_WINDOW_320_2_5ms, MDCT_WINDOW_480_2_5ms,
......@@ -5624,7 +5615,6 @@ const LC3_INT* ACC_COEFF_PER_BAND_5ms[5] = {ACC_COEFF_PER_BAND_8_5ms, ACC_COEFF_
ACC_COEFF_PER_BAND_24_5ms, ACC_COEFF_PER_BAND_32_5ms,
ACC_COEFF_PER_BAND_48_5ms};
 
#ifdef CR8_G_ADD_75MS
const LC3_INT ACC_COEFF_PER_BAND_8_7_5ms[61] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
......@@ -5704,17 +5694,14 @@ const LC3_INT ACC_COEFF_PER_BAND_PLC_96_7_5ms[81] = {
const LC3_INT* ACC_COEFF_PER_BAND_PLC_7_5ms[] = {
ACC_COEFF_PER_BAND_PLC_8_7_5ms, ACC_COEFF_PER_BAND_PLC_16_7_5ms, ACC_COEFF_PER_BAND_PLC_24_7_5ms,
ACC_COEFF_PER_BAND_PLC_32_7_5ms, ACC_COEFF_PER_BAND_PLC_48_7_5ms, ACC_COEFF_PER_BAND_PLC_96_7_5ms};
#endif
 
/* Near Nyquist detector */
const LC3_INT NN_thresh = 30;
/* Tone detector */
#ifdef CR8_E_TONE_DETECTOR
const LC3_INT32 TD_HR_thresh_10ms = 83402;
const LC3_INT32 TD_HR_thresh_7_5ms = 743496;
const LC3_INT32 TD_HR_thresh_5ms = 382564;
const LC3_INT32 TD_HR_thresh_2_5ms = 301695;
#endif // CR8_E_TONE_DETECTOR
 
 
const LC3_INT32 xavg_N_grp[5] = { 4, 5, 6, 7, 8 };
......@@ -5722,8 +5709,6 @@ const LC3_INT32 xavg_N_grp[5] = { 4, 5, 6, 7, 8 };
 
const LC3_INT32 gwlpr[MAX_LGW+1] = { 1, 3*QUOT_LPR_LTR, 5*QUOT_LPR_LTR, 9*QUOT_LPR_LTR, 17*QUOT_LPR_LTR, 33*QUOT_LPR_LTR, 49*QUOT_LPR_LTR, 65*QUOT_LPR_LTR, 81*QUOT_LPR_LTR, 97*QUOT_LPR_LTR};
 
#ifdef CR8_A_PLC_FADEOUT_TUNING
/* PLC_FADEOUT_TUNING, extended table ranging from 30 ms to 140 ms */
const LC3_INT16 fade_scheme_tab[24 / 2][3] = {
/* tabled {att_per_frame_idx_p3dB , burst_att_thresh, beta_mute_thr } */
......@@ -5742,11 +5727,8 @@ const LC3_INT16 fade_scheme_tab[24 / 2][3] = {
 
};
 
/*compressed ATH Abolute hearing THreshold function weights at band borders */
const LC3_FLOAT scATHFx[MAX_LGW - 2] = { .455444335937500 , 0.930755615234375 , 0.973083496093750 , 0.999969482421875 , 0.908508300781250 , 0.775665283203125 , 0.5 };
#endif
 
const LC3_FLOAT PhECU_whr16ms_NB[128]={
8.000000000000002e-02, 8.393536376804722e-02, 9.567411990702857e-02, 1.150154150448081e-01, 1.416283142591582e-01,
......@@ -6330,7 +6312,7 @@ const LC3_INT* ACC_COEFF_PER_BAND_PLC_5ms[] = {
 
const LC3_INT32 mdct_grp_bins[10] = { 4, 14, 24, 44, 84, 164, 244, 324, 404, 484 };
 
#if defined(CR8_A_PLC_FADEOUT_TUNING)
const LC3_INT16 plc_fadeout_param_maxlen[4] = {800, 400, 266, 200};
const LC3_INT16 plc_fadeout_param_maxbytes[4] = {27, 14, 9, 7};
#endif
const LC3_INT16 PLC_FADEOUT_TYPE_2_SELECTOR = 10; /* can take values from 0 to 10, default is 10 for longer fadeout */
/******************************************************************************
* ETSI TS 103 634 V1.4.3 *
* ETSI TS 103 634 V1.5.1 *
* Low Complexity Communication Codec Plus (LC3plus) *
* *
* Copyright licence is solely granted through ETSI Intellectual Property *
......@@ -7,7 +7,6 @@
* estoppel or otherwise. *
******************************************************************************/
#ifndef CONSTANTS_H
#define CONSTANTS_H
......@@ -114,7 +113,6 @@ extern const LC3_INT bands_number_2_5ms_HR[6];
extern const LC3_INT BW_cutoff_bin_all_2_5ms[MAX_BW_BANDS_NUMBER];
extern const LC3_INT bands_number_2_5ms[5];
extern const LC3_INT BW_warp_idx_start_16k_5ms[4];
extern const LC3_INT BW_warp_idx_stop_16k_5ms[4];
extern const LC3_INT BW_warp_idx_start_24k_5ms[4];
......@@ -132,7 +130,6 @@ extern const LC3_INT BW_cutoff_bin_all_5ms_HR[MAX_BW_BANDS_NUMBER];
extern const LC3_INT BW_cutoff_bin_all[MAX_BW_BANDS_NUMBER];
extern const LC3_INT BW_cutoff_bits_all[MAX_BW_BANDS_NUMBER];
#ifdef CR8_G_ADD_75MS
extern const LC3_INT BW_cutoff_bin_all_7_5ms[MAX_BW_BANDS_NUMBER];
extern const LC3_INT bands_number_7_5ms[6];
extern const LC3_INT bands_number_7_5ms_HR[6];
......@@ -140,7 +137,6 @@ extern const LC3_INT* BW_warp_idx_start_all_7_5ms[4];
extern const LC3_INT* BW_warp_idx_stop_all_7_5ms[4];
extern const LC3_INT brickwall_dist_7_5ms[4];
extern const LC3_INT* ACC_COEFF_PER_BAND_PLC_7_5ms[];
#endif
/* Arithmetic coding */
extern const LC3_INT tns_cf[8][18];
......@@ -172,10 +168,8 @@ extern const LC3_FLOAT MDCT_WINDOW_480_5ms[480];
extern const LC3_FLOAT* MDCT_WINS_5ms[2][6];
extern const LC3_INT MDCT_la_zeroes_5ms[6];
#ifdef CR8_G_ADD_75MS
extern const LC3_FLOAT* MDCT_WINS_7_5ms[2][6];
extern const LC3_INT32 MDCT_la_zeroes_7_5ms[6];
#endif
extern const LC3_INT MDCT_WINDOWS_LENGTHS_10ms[6];
extern const LC3_INT MDCT_WINDOWS_LENGTHS_7_5ms[6];
......@@ -189,10 +183,8 @@ extern const LC3_INT* ACC_COEFF_PER_BAND_HR[6];
extern const LC3_INT* ACC_COEFF_PER_BAND_2_5ms_HR[6];
extern const LC3_INT* ACC_COEFF_PER_BAND_2_5ms[5];
#ifdef CR8_G_ADD_75MS
extern const LC3_INT* ACC_COEFF_PER_BAND_7_5ms_HR[6];
extern const LC3_INT* ACC_COEFF_PER_BAND_7_5ms[5];
#endif
extern const LC3_INT* ACC_COEFF_PER_BAND_5ms_HR[6];
extern const LC3_INT* ACC_COEFF_PER_BAND_5ms[5];
......@@ -200,20 +192,16 @@ extern const LC3_INT* ACC_COEFF_PER_BAND_5ms[5];
/* Near Nyquist detector */
extern const LC3_INT NN_thresh;
/* Tone detector */
#ifdef CR8_E_TONE_DETECTOR
extern const LC3_INT32 TD_HR_thresh_10ms;
extern const LC3_INT32 TD_HR_thresh_7_5ms;
extern const LC3_INT32 TD_HR_thresh_5ms;
extern const LC3_INT32 TD_HR_thresh_2_5ms;
#endif // CR8_E_TONE_DETECTOR
extern const LC3_INT32 xavg_N_grp[5];
extern const LC3_FLOAT *hannOla_wins[5];
extern const LC3_INT32 gwlpr[MAX_LGW+1];
#ifdef CR8_A_PLC_FADEOUT_TUNING
extern const LC3_INT16 fade_scheme_tab[24 / 2][3];
extern const LC3_FLOAT scATHFx[MAX_LGW - 2];
#endif
extern const LC3_INT32 mdct_grp_bins[10];
extern const LC3_FLOAT* PhECU_whr16ms_wins[5];
......@@ -230,9 +218,7 @@ extern const LC3_FLOAT plc_tdc_lpc_48[17];
extern const LC3_FLOAT plc_tdc_lpc_96[17];
extern const LC3_FLOAT plc_tdc_lpc_8_25ms[9];
#if defined(CR8_A_PLC_FADEOUT_TUNING)
extern const LC3_INT16 plc_fadeout_param_maxlen[4];
extern const LC3_INT16 plc_fadeout_param_maxbytes[4];
#endif
extern const LC3_INT16 PLC_FADEOUT_TYPE_2_SELECTOR;
#endif /* CONSTANTS_H */
/******************************************************************************
* ETSI TS 103 634 V1.4.3 *
* ETSI TS 103 634 V1.5.1 *
* Low Complexity Communication Codec Plus (LC3plus) *
* *
* Copyright licence is solely granted through ETSI Intellectual Property *
......@@ -7,7 +7,6 @@
* estoppel or otherwise. *
******************************************************************************/
#include "options.h"
#include "wmc_auto.h"
#include "functions.h"
......
/******************************************************************************
* ETSI TS 103 634 V1.4.3 *
* ETSI TS 103 634 V1.5.1 *
* Low Complexity Communication Codec Plus (LC3plus) *
* *
* Copyright licence is solely granted through ETSI Intellectual Property *
......@@ -7,7 +7,6 @@
* estoppel or otherwise. *
******************************************************************************/
#include "options.h"
#include "wmc_auto.h"
#include "functions.h"
......@@ -56,8 +55,8 @@ void dct4_init(Dct4* dct, int length)
dct->twid1 = calloc(sizeof(*dct->twid1), length / 2);
dct->twid2 = calloc(sizeof(*dct->twid2), length / 2);
for (i = 0; i < length / 2; i++) {
dct->twid1[i] = cexpi(-(LC3_FLOAT)M_PI * (i + (LC3_FLOAT)0.25) / length);
dct->twid2[i] = cexpi(-(LC3_FLOAT)M_PI * i / length);
dct->twid1[i] = cexpi(-(LC3_FLOAT)M_PI_LC3PLUS * (i + (LC3_FLOAT)0.25) / length);
dct->twid2[i] = cexpi(-(LC3_FLOAT)M_PI_LC3PLUS * i / length);
}
fft_init(&dct->fft, length / 2);
}
......
/******************************************************************************
* ETSI TS 103 634 V1.4.3 *
* ETSI TS 103 634 V1.5.1 *
* Low Complexity Communication Codec Plus (LC3plus) *
* *
* Copyright licence is solely granted through ETSI Intellectual Property *
......@@ -7,7 +7,6 @@
* estoppel or otherwise. *
******************************************************************************/
#include "options.h"
#include "wmc_auto.h"
#include "functions.h"
......
/******************************************************************************
* ETSI TS 103 634 V1.4.3 *
* ETSI TS 103 634 V1.5.1 *
* Low Complexity Communication Codec Plus (LC3plus) *
* *
* Copyright licence is solely granted through ETSI Intellectual Property *
......@@ -7,12 +7,10 @@
* estoppel or otherwise. *
******************************************************************************/
#include "options.h"
#include "wmc_auto.h"
#include "functions.h"
static int Dec_LC3PLUS_Channel_fl(LC3PLUS_Dec* decoder, int channel, uint8_t* bs_in, void* s_out, int bps, int bfi_ext)
{
DecSetup* h_DecSetup;
......@@ -65,11 +63,9 @@ static int Dec_LC3PLUS_Channel_fl(LC3PLUS_Dec* decoder, int channel, uint8_t* bs
case 50:
max_bw_stopband = max_bw_stopband >> 1;
break;
#ifdef CR8_G_ADD_75MS
case 75:
max_bw_stopband = 3 * (max_bw_stopband >> 2);
break;
#endif
case 100:
break;
}
......@@ -149,9 +145,7 @@ static int Dec_LC3PLUS_Channel_fl(LC3PLUS_Dec* decoder, int channel, uint8_t* bs
h_DecSetup->PlcSetup.q_d_prev, h_DecSetup->sqQdec_fl, h_DecSetup->spec_inv_idx, decoder->yLen, bfi,
decoder->frame_dms, h_DecSetup->concealMethod, h_DecSetup->ltpf_mem_pitch, h_DecSetup->ltpf_param[0],
&h_DecSetup->PlcAdvSetup->cum_fflcAtten
#ifdef CR8_A_PLC_FADEOUT_TUNING
, h_DecSetup->PlcAdvSetup->plc_fadeout_type
#endif
);
/* IMDCT */
......@@ -172,9 +166,7 @@ static int Dec_LC3PLUS_Channel_fl(LC3PLUS_Dec* decoder, int channel, uint8_t* bs
bfi, h_DecSetup->ltpf_param, h_DecSetup->ltpf_param_mem, h_DecSetup->ltpf_conf_beta_idx,
h_DecSetup->ltpf_conf_beta, h_DecSetup->concealMethod, h_DecSetup->alpha
, &h_DecSetup->ltpf_mem_active
#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH
, &h_DecSetup->rel_pitch_change, decoder->hrmode, decoder->frame_dms
#endif
);
{
......@@ -244,9 +236,12 @@ LC3PLUS_Error Dec_LC3PLUS_fl(LC3PLUS_Dec* decoder, uint8_t* input, LC3_INT32 num
}
bfi = Dec_LC3PLUS_Channel_fl(decoder, ch, input, output[ch], bps, bfi);
if (input != NULL)
{
input += decoder->channel_setup[ch]->targetBytes;
}
}
}
else
{
decoder->epmr = LC3PLUS_EPMR_HIGH_NC;
......@@ -275,7 +270,11 @@ LC3PLUS_Error Dec_LC3PLUS_fl(LC3PLUS_Dec* decoder, uint8_t* input, LC3_INT32 num
channel_bfi = 1;
}
if (input != NULL)
{
input = input + np_zero;
}
decoder->n_pc = MAX(decoder->n_pc - (2 * np_zero), 0);
if (channel_bfi == 2)
......@@ -313,8 +312,11 @@ LC3PLUS_Error Dec_LC3PLUS_fl(LC3PLUS_Dec* decoder, uint8_t* input, LC3_INT32 num
channel_bfi = Dec_LC3PLUS_Channel_fl(decoder, ch, input, output[ch], bps, channel_bfi);
out_bfi |= channel_bfi;
if (input != NULL)
{
input += fec_num_bytes;
}
}
bfi = out_bfi & 1;
}
......@@ -360,14 +362,16 @@ LC3PLUS_Error Dec_LC3PLUS_fl(LC3PLUS_Dec* decoder, uint8_t* input, LC3_INT32 num
}
bfi = Dec_LC3PLUS_Channel_fl(decoder, ch, input, output[ch], bps, bfi);
if (input != NULL)
{
input += decoder->channel_setup[ch]->targetBytes;
}
}
}
if ((decoder->last_error == LC3PLUS_OK) && bfi)
{
decoder->last_error = LC3PLUS_DECODE_ERROR;
}
return bfi == 1 ? LC3PLUS_DECODE_ERROR : LC3PLUS_OK;
}