diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj
index 79e5545f3fee266b8433f1b74a1926d40b570aa5..4ec7948021793313475e6f86c8e5084b7364fed0 100644
--- a/Workspace_msvc/lib_util.vcxproj
+++ b/Workspace_msvc/lib_util.vcxproj
@@ -101,6 +101,7 @@
+
@@ -128,6 +129,7 @@
+
diff --git a/apps/decoder.c b/apps/decoder.c
index 354d611a95b7cec68bed7428394b06d182b04694..8bc31fdea6470d63585ce762dfbba755cd85493f 100644
--- a/apps/decoder.c
+++ b/apps/decoder.c
@@ -128,7 +128,11 @@ typedef struct
bool customLsOutputEnabled;
char *customLsSetupFilename;
int16_t orientation_tracking;
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ bool non_diegetic_pan_enabled;
+#else
int16_t Opt_non_diegetic_pan;
+#endif
float non_diegetic_pan_gain;
bool renderConfigEnabled;
char *renderConfigFilename;
@@ -148,7 +152,11 @@ typedef struct
#endif
#endif
AcousticEnvironmentSequence aeSequence;
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ bool dpidEnabled;
+#else
int16_t Opt_dpid_on;
+#endif
uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS];
} DecArguments;
@@ -407,8 +415,12 @@ int main(
if ( arg.renderConfigEnabled )
{
/* sanity check */
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && arg.non_diegetic_pan_enabled == false )
+#else
if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM &&
arg.Opt_non_diegetic_pan == 0 )
+#endif
{
fprintf( stderr, "\nError: Renderer configuration file cannot be used in this output configuration.\n\n" );
goto cleanup;
@@ -427,8 +439,14 @@ int main(
asked_frame_size = arg.renderFramesize;
uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535;
+
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain,
+ arg.dpidEnabled, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
+#else
if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain,
arg.Opt_dpid_on, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
+#endif
{
fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup;
@@ -594,8 +612,12 @@ int main(
/* sanity check */
if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB &&
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && arg.non_diegetic_pan_enabled == false )
+#else
arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM &&
arg.Opt_non_diegetic_pan == 0 )
+#endif
{
fprintf( stderr, "\nExternal Renderer Config is supported only when binaural output configurations is used as output OR when Split rendering mode is enabled. Exiting. \n" );
goto cleanup;
@@ -1066,12 +1088,20 @@ static bool parseCmdlIVAS_dec(
arg->renderConfigEnabled = false;
arg->renderConfigFilename = NULL;
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ arg->dpidEnabled = false;
+#else
arg->Opt_dpid_on = 0;
+#endif
arg->outputMdFilename = NULL;
arg->inputFormat = IVAS_DEC_INPUT_FORMAT_G192;
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ arg->non_diegetic_pan_enabled = false;
+#else
arg->Opt_non_diegetic_pan = 0;
+#endif
arg->non_diegetic_pan_gain = 0.f;
arg->tsmEnabled = false;
arg->renderFramesize = IVAS_RENDER_FRAMESIZE_20MS;
@@ -1410,7 +1440,11 @@ static bool parseCmdlIVAS_dec(
else if ( strcmp( argv_to_upper, "-NON_DIEGETIC_PAN" ) == 0 )
{
i++;
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ arg->non_diegetic_pan_enabled = true;
+#else
arg->Opt_non_diegetic_pan = 1;
+#endif
strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 );
argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0';
to_upper( argv_to_upper );
@@ -1507,7 +1541,11 @@ static bool parseCmdlIVAS_dec(
{
int16_t id, tmp;
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ arg->dpidEnabled = true;
+#else
arg->Opt_dpid_on = 1;
+#endif
++i;
tmp = 0;
while ( is_number( argv[i + tmp] ) && tmp < IVAS_MAX_NUM_OBJECTS )
@@ -1587,7 +1625,12 @@ static bool parseCmdlIVAS_dec(
arg->customLsSetupFilename = argv[i];
}
i++;
+
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ if ( arg->non_diegetic_pan_enabled && arg->outputConfig != IVAS_AUDIO_CONFIG_STEREO )
+#else
if ( ( arg->Opt_non_diegetic_pan ) && ( arg->outputConfig != IVAS_AUDIO_CONFIG_STEREO ) )
+#endif
{
fprintf( stderr, "Error: non-diegetic panning is supported in stereo only\n\n" );
usage_dec();
@@ -1605,7 +1648,12 @@ static bool parseCmdlIVAS_dec(
{
arg->outputConfig = IVAS_AUDIO_CONFIG_MONO;
arg->decMode = IVAS_DEC_MODE_EVS;
+
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ if ( arg->non_diegetic_pan_enabled )
+#else
if ( ( arg->Opt_non_diegetic_pan ) )
+#endif
{
arg->outputConfig = IVAS_AUDIO_CONFIG_STEREO;
}
diff --git a/ci/basop-pages/create_report_pages.py b/ci/basop-pages/create_report_pages.py
index c849b160be964c75935ffa4e79e858249545e479..25fde10409bba73e20a58dbc7c0e5f7f101a9a2e 100644
--- a/ci/basop-pages/create_report_pages.py
+++ b/ci/basop-pages/create_report_pages.py
@@ -3,6 +3,7 @@ import pathlib
import argparse
from functools import partial
+FORMATS = ["Stereo", "ISM", "Multichannel", "MASA", "SBA", "OSBA", "OMASA", "Renderer"]
CSV_DELIM = ";"
SUBPAGE_TMPL_CSS = """
@@ -25,7 +26,7 @@ SUBPAGE_TMPL_CSS = """
SUBPAGE_TMPL_HTML = """
-Report for job {job_name}
Report for job {job_name}
Comparing:
+{images_mld}
+
+{images_diff}
+
+{images_ssnr}
+
+
How is the table sorted?
@@ -92,9 +100,17 @@ ARROW_DOWN = '⬂'
# expected columns. actual columns are filtered from the incoming data later, this
# is mainly for controlling the order in the output table
-COLUMNS = ["testcase", "Result", "MLD", "MAXIMUM ABS DIFF", "MIN_SSNR"]
+COLUMNS = [
+ "testcase",
+ "Format",
+ "Category",
+ "Result",
+ "MLD",
+ "MAXIMUM ABS DIFF",
+ "MIN_SSNR",
+]
COLUMNS_GLOBAL = COLUMNS[:1]
-COLUMNS_DIFFERENTIAL = COLUMNS[1:]
+COLUMNS_DIFFERENTIAL = COLUMNS[3:]
COLUMNS_DIFFERENTIAL_NOT_MLD = COLUMNS_DIFFERENTIAL[2:]
@@ -106,6 +122,7 @@ def create_subpage(
id_current: int,
id_previous: int,
job_name: str,
+ histogram,
):
merged_reports = merge_and_cleanup_mld_reports(
csv_current, csv_previous, id_current, id_previous
@@ -128,6 +145,33 @@ def create_subpage(
table_body = "\n".join(
tr_from_row(row, id_current, id_previous) for row in merged_reports
)
+ if histogram:
+ images_mld = (
+ f"MLD summary {job_name}
\n"
+ + " ".join(
+ [f"
" for x in FORMATS]
+ )
+ + f'\n
summary_{id_current}_MLD.csv'
+ )
+ images_ssnr = (
+ f"MIN_SSNR summary {job_name}
\n"
+ + " ".join(
+ [f"
" for x in FORMATS]
+ )
+ + f'\n
summary_{id_current}_SSNR.csv'
+ )
+ images_diff = (
+ f"MAX ABS DIFFERENCE summary {job_name}
\n"
+ + " ".join(
+ [f"
" for x in FORMATS]
+ )
+ + f'\n
summary_{id_current}_DIFF.csv'
+ )
+ else:
+ images_mld = ""
+ images_ssnr = ""
+ images_diff = ""
+
new_subpage = SUBPAGE_TMPL_CSS + SUBPAGE_TMPL_HTML.format(
id_current=id_current,
id_previous=id_previous,
@@ -135,6 +179,9 @@ def create_subpage(
job_name=job_name,
table_header_a=table_header_a,
table_header_b=table_header_b,
+ images_mld=images_mld,
+ images_ssnr=images_ssnr,
+ images_diff=images_diff,
)
with open(html_out, "w") as f:
f.write(new_subpage)
@@ -226,8 +273,9 @@ def merge_and_cleanup_mld_reports(
are uninteresting and are put last.
"""
try:
- float(x[mld_col_curr])
- float(x[mld_col_prev])
+ cols = [mld_col_curr, mld_col_prev] + [p[1] for p in other_col_pairs]
+ for c in cols:
+ float(x[c])
except ValueError:
# Value is no valid floating point value
return float("inf")
@@ -293,6 +341,7 @@ if __name__ == "__main__":
parser.add_argument("id_current", type=int)
parser.add_argument("id_previous", type=int)
parser.add_argument("job_name")
+ parser.add_argument("--histogram", action="store_true")
args = parser.parse_args()
create_subpage(
@@ -303,4 +352,5 @@ if __name__ == "__main__":
args.id_current,
args.id_previous,
args.job_name,
+ args.histogram,
)
diff --git a/ci/setup_pages.py b/ci/setup_pages.py
index a28c12675e6d223ce6474265c05f2af932879cef..f131dfb4e45550f5e5503fa9169cf44fb8694e87 100755
--- a/ci/setup_pages.py
+++ b/ci/setup_pages.py
@@ -42,7 +42,7 @@ def main():
project_id = int(os.environ["CI_PROJECT_ID"])
jobs = JOBS_FOR_PROJECT_ID[project_id]
- success_only = project_id == PROJECT_ID_FLOAT_REPO
+ success_only = False
failed_count = get_artifacts_for_jobs_and_return_num_failed(
jobs, project_id, success_only
)
diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h
index d2ae6f9bdde924115aeaa287df21f378a9390e70..c31fa83049eba0dd5e6d233d578db23cf63b914b 100755
--- a/lib_com/ivas_cnst.h
+++ b/lib_com/ivas_cnst.h
@@ -179,9 +179,6 @@ typedef enum
typedef enum
{
-#ifndef FIX_1101_CLEANING_JBM_CALL
- TC_BUFFER_MODE_NONE = 0,
-#endif
TC_BUFFER_MODE_RENDERER,
TC_BUFFER_MODE_BUFFER
} TC_BUFFER_MODE;
@@ -1292,14 +1289,8 @@ typedef enum
#define LFE_CHANNEL 3
#define MIN_LFE_NRG 0.5f
-#ifdef ADJUST_MCT_CHANNELS_MAX
#define MCT_MAX_CHANNELS 11 /* == 7.1.4 LS channels without the LFE channel */
#define MCT_MAX_BLOCKS ( ( MCT_MAX_CHANNELS + 1 ) / CPE_CHANNELS ) /* max. number of channel pairs (MCT_MAX_CHANNELS/2) within MCT*/
-#else
-#define MCT_MAX_CHANNELS 12
-#define MCT_MAX_BLOCKS ( MCT_MAX_CHANNELS / CPE_CHANNELS ) /* max. number of channel pairs (MCT_MAX_CHANNELS/2) within MCT*/
-#define MAX_NUM_DATA max( MCT_MAX_CHANNELS, 4 )
-#endif
#define NBBITS_MCT_RATIO 4
#define BITRATE_MCT_RATIO_RANGE ( 1 << NBBITS_MCT_RATIO ) /* Range of the coded bitrate distribution ratio */
diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h
index 68c08c131202fdbfdceb999756500897550515a9..3e9c15a2a50d7ee476e2f95468a52af7730d5540 100755
--- a/lib_com/ivas_prot.h
+++ b/lib_com/ivas_prot.h
@@ -84,13 +84,9 @@ void ivas_write_format(
void ivas_write_format_sid(
const IVAS_FORMAT ivas_format, /* i : IVAS format */
const int16_t element_mode, /* i : element bitrate */
-#ifdef NONBE_FIX_1052_SBA_EXT_FIX
BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
const int16_t sba_order, /* i : Ambisonic (SBA) order */
const int16_t sba_planar /* i : SBA planar flag */
-#else
- BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */
-#endif
);
ivas_error create_sce_enc(
diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c
index 2c4ab2f661fecabd683ebd5b75f04c91fa0e0160..744fdf25b0dd3104c0e4020b4d516530b43fc045 100644
--- a/lib_com/ivas_rom_com.c
+++ b/lib_com/ivas_rom_com.c
@@ -2471,13 +2471,11 @@ const uint16_t ivas_param_mc_sym_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_
* MASA ROM tables
*----------------------------------------------------------------------------------*/
-#ifdef FIX_1121_MASA_DESCRIPTOR
const uint8_t ivasmasaFormatDescriptor[8] =
{
0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 /* "IVASMASA" */
};
-#endif
const float diffuseness_reconstructions_hr[HR_MASA_ER_LEVELS] =
{
0.00f,
diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h
index 18f2062d7fc0e162d2d16f225efa26f8b4c27462..774aef466aecbcc547d4015c028af5ed1e16e083 100644
--- a/lib_com/ivas_rom_com.h
+++ b/lib_com/ivas_rom_com.h
@@ -264,10 +264,8 @@ extern const uint16_t ivas_param_mc_sym_freq_icc_delta_combined_48_16bits[2 * PA
* MASA ROM tables
*----------------------------------------------------------------------------------*/
-#ifdef FIX_1121_MASA_DESCRIPTOR
extern const uint8_t ivasmasaFormatDescriptor[8]; /* "IVASMASA" */
-#endif
extern const int16_t bits_direction_masa[DIRAC_DIFFUSE_LEVELS];
extern const int16_t no_theta_masa[NO_SPHERICAL_GRIDS - 2];
extern const int16_t no_phi_masa[NO_SPHERICAL_GRIDS][MAX_NO_THETA];
diff --git a/lib_com/options.h b/lib_com/options.h
index 1ff12b05aebaa3bd1afaf67af90ea6ee45a02cb2..6b1a8d303a1d8b298c767eb030478f3b9e5cfaad 100644
--- a/lib_com/options.h
+++ b/lib_com/options.h
@@ -162,11 +162,7 @@
//#define FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT /* Orange issue 1031 : new fix point hrtf binary file format */
//#define FIX_CREND_SIMPLIFY_CODE /* Ora : simplify line code in crend */
#define FLOAT_FIX_POINT_HRTF_FILE_FORMAT /* allows reading floation or fix point hrtf binary file format */
-#define FIX_1101_CLEANING_JBM_CALL /* VA: issue 1101: remove obsolete call of ivas_jbm_dec_tc_buffer_open() */
-#define FIX_1053_AEID_FILE_TEST /* Philips: Tests for the -aeid file and fix for memory error */
-#define FIX_1121_MASA_DESCRIPTOR /* VA: issue 1121: Define 'ivasmasaFormatDescriptor' at one common place */
-#define FIX_1113_CLDFB_REND_IN_ISAR /* issue 1113: fix the use of CLDFB renderer in split-rendering at the external renderer */
-#define ADJUST_MCT_CHANNELS_MAX /* FhG: set correct max mct channels constant*/
+#define FIX_745_FIX_DATA_TYPE_CONVERSION /* VA: issue 745: implicit data type conversion when calling IVAS_DEC_Configure() */
/* #################### End BE switches ################################## */
@@ -174,11 +170,9 @@
/* any switch which is non-be wrt selection floating point code */
/* all switches in this category should start with "NONBE_" */
-#define NONBE_FIX_1110_STEREO_DTX_BRATE_SWITCHING /* VA: issue 1110: fix encoder crash in the stereo DTX bitrate switching condition */
-#define NONBE_1131_ACELP_OOB /* VA: issue 1131: fix division-by-zero in acelp gain decoding caused by wrong length of buffer update when switching from HQ core to ACELP core */
-#define NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER /* FhG: issue 1128: set output ambisonics order to input order for EXT output */
-#define NONBE_FIX_1052_SBA_EXT_FIX /* VA: SBA external output support fix - do not overwrite "output_config" parameter */
-
+#define NONBE_MDCT_ST_DTX_SKIP_DEWHITENING_OF_NOISE_SHAPES_ON_SID_FRAMES /* FhG: issue 1133: skip de-whitening of bg noise shape after frameloss period if the first good frame is an SID */
+#define NONBE_MDCT_ST_PLC_DO_NOT_SCALE_OLD_OUT_IF_FIRST_GOOD_IS_SID /* FhG: issue 1133: in TCX PLC, don't scale hHQ_core->old_out after applying fade to noise in burst frame error */
+#define NONBE_FIX_1130_DIV_ZERO_LEV_DUR /* VA: issue 1130: avoid div by zero in L-D by thresholding R[0] to a min value of 100.0 */
/* ##################### End NON-BE switches ########################### */
diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c
index d444c03ea786cb92055282814f6e424f506f5a33..4ac0e098bebe0dee16617f49b5a868bfdd271ce5 100644
--- a/lib_dec/acelp_core_dec.c
+++ b/lib_dec/acelp_core_dec.c
@@ -231,11 +231,7 @@ ivas_error acelp_core_dec(
st->hGSCDec->Last_frame_ener = (float) MAX_32;
}
-#ifdef NONBE_FIX_1110_STEREO_DTX_BRATE_SWITCHING
if ( st->hFdCngDec != NULL && ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD ) && ( st->last_core_brate == SID_2k40 || st->last_core_brate == FRAME_NO_DATA ) )
-#else
- if ( ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD ) && ( st->last_core_brate == SID_2k40 || st->last_core_brate == FRAME_NO_DATA ) )
-#endif
{
set_zero( st->hFdCngDec->hFdCngCom->olapBufferSynth2, FFTLEN );
set_zero( hStereoCng->olapBufferSynth22, FFTLEN );
@@ -703,11 +699,7 @@ ivas_error acelp_core_dec(
old_exc_s = st->old_exc + L_EXC_MEM_DEC - st->L_frame;
tmpF = *old_exc_s;
st->mem_deemph = old_exc_s[st->L_frame - 1];
-#ifdef NONBE_1131_ACELP_OOB
preemph( old_exc_s, st->preemph_fac, st->L_frame, &tmpF );
-#else
- preemph( old_exc_s, st->preemph_fac, L_FRAME16k, &tmpF );
-#endif
mvr2r( old_exc_s + st->L_frame - M, st->mem_syn2, M );
residu( Aq, M, old_exc_s, old_exc + L_EXC_MEM_DEC - st->L_frame, st->L_frame );
}
diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c
index 1ed443d61841d2105ede0322284a9d5f55e6fa77..f4e3e39fddddbb7128e7fdc1b4c5f7a7e2ba6db1 100644
--- a/lib_dec/ivas_binRenderer_internal.c
+++ b/lib_dec/ivas_binRenderer_internal.c
@@ -1014,11 +1014,7 @@ ivas_error ivas_rend_openCldfbRend(
return error;
}
-#ifdef FIX_1113_CLDFB_REND_IN_ISAR
pCldfbRend->binaural_latency_ns = (int32_t) ( pCldfbRend->hHrtfFastConv->FASTCONV_HOA3_latency_s * 1000000000.f );
-#else
- pCldfbRend->binaural_latency_ns = (int32_t) ( FASTCONV_HOA3_latency_s * 1000000000.f );
-#endif
hBinRenderer->hReverb = NULL;
hBinRenderer->hEFAPdata = NULL;
diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c
index 73c500115395c1390b6b14d6124b1abde0029331..47e6bf25b47d456969239e4457f10c3d9afb6d38 100644
--- a/lib_dec/ivas_core_dec.c
+++ b/lib_dec/ivas_core_dec.c
@@ -189,7 +189,11 @@ ivas_error ivas_core_dec(
st->flagGuidedAcelp = 0;
}
+#ifdef NONBE_MDCT_ST_PLC_DO_NOT_SCALE_OLD_OUT_IF_FIRST_GOOD_IS_SID
+ if ( !st->bfi && st->prev_bfi && st->total_brate > SID_2k40 && ( st->last_core_bfi == TCX_20_CORE || st->last_core_bfi == TCX_10_CORE ) && st->hTcxDec != NULL )
+#else
if ( !st->bfi && st->prev_bfi && ( st->last_core_bfi == TCX_20_CORE || st->last_core_bfi == TCX_10_CORE ) && st->hTcxDec != NULL )
+#endif
{
v_multc( st->hHQ_core->old_out, st->hTcxDec->conceal_eof_gain * st->last_concealed_gain_syn_deemph, st->hHQ_core->old_out, st->hTcxDec->L_frameTCX );
v_multc( st->hHQ_core->old_outLB, st->hTcxDec->conceal_eof_gain * st->last_concealed_gain_syn_deemph, st->hHQ_core->old_outLB, st->L_frame );
@@ -402,10 +406,16 @@ ivas_error ivas_core_dec(
{
updateBuffersForDmxMdctStereo( hCPE, output_frame, output, synth );
}
+#ifdef NONBE_MDCT_ST_DTX_SKIP_DEWHITENING_OF_NOISE_SHAPES_ON_SID_FRAMES
+ /* On first good active frame after frameloss undo the whitening of the bg noise shape */
+ if ( sts[0]->core_brate > SID_2k40 && sts[0]->bfi == 0 && sts[0]->prev_bfi == 1 )
+ {
+#else
if ( sts[0]->bfi == 0 && sts[0]->prev_bfi == 1 )
{
/* On first good frame after frameloss undo the whitening of the bg noise shape */
+#endif
for ( n = 0; n < n_channels; ++n )
{
if ( sts[n]->last_core_bfi != ACELP_CORE )
diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c
index 8548689f64a59b4472a717b8ea52e4c315eda0e4..907f5619ab0235d7f0684355f3221013fdf76e50 100644
--- a/lib_dec/ivas_init_dec.c
+++ b/lib_dec/ivas_init_dec.c
@@ -55,7 +55,6 @@ static ivas_error ivas_read_format( Decoder_Struct *st_ivas, int16_t *num_bits_r
static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas );
-#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
/*-------------------------------------------------------------------*
* ivas_set_audio_config_from_sba_order()
*
@@ -66,12 +65,6 @@ static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas );
static AUDIO_CONFIG ivas_set_audio_config_from_sba_order(
const int16_t sba_order /* i : Ambisonic (SBA) order */
)
-#else
-static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const int16_t sba_order );
-
-
-static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const int16_t sba_order )
-#endif
{
AUDIO_CONFIG output_config;
@@ -89,12 +82,8 @@ static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const int16_t sba_ord
output_config = IVAS_AUDIO_CONFIG_HOA3;
break;
default:
-#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
output_config = IVAS_AUDIO_CONFIG_INVALID;
break;
-#else
- assert( 0 );
-#endif
}
return output_config;
@@ -179,17 +168,6 @@ ivas_error ivas_dec_setup(
/* read Ambisonic (SBA) order */
st_ivas->sba_order = st_ivas->bit_stream[num_bits_read + 1];
st_ivas->sba_order += 2 * st_ivas->bit_stream[num_bits_read];
-#ifndef NONBE_FIX_1052_SBA_EXT_FIX
- if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
- {
-#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
- st_ivas->hDecoderConfig->output_config = ivas_set_audio_config_from_sba_order( st_ivas->sba_order );
-#else
- st_ivas->hDecoderConfig->output_config = ivas_set_output_config_from_sba_order( st_ivas->sba_order );
-#endif
- st_ivas->hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->hDecoderConfig->output_config );
- }
-#endif
num_bits_read += SBA_ORDER_BITS;
if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->last_active_ivas_total_brate && ivas_total_brate > IVAS_SID_5k2 )
@@ -429,18 +407,6 @@ ivas_error ivas_dec_setup(
break;
}
-#ifndef NONBE_FIX_1052_SBA_EXT_FIX
- if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
- {
-#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
- st_ivas->hDecoderConfig->output_config = ivas_set_audio_config_from_sba_order( st_ivas->sba_order );
-#else
- st_ivas->hDecoderConfig->output_config = ivas_set_output_config_from_sba_order( st_ivas->sba_order );
-#endif
- st_ivas->hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->hDecoderConfig->output_config );
- }
-
-#endif
if ( st_ivas->ini_frame > 0 && st_ivas->ivas_format == SBA_FORMAT )
{
int16_t nchan_transport_old, nchan_transport;
@@ -808,9 +774,7 @@ ivas_error ivas_init_decoder_front(
st_ivas->nSCE = 0;
st_ivas->nCPE = 0;
-#ifdef NONBE_FIX_1052_SBA_EXT_FIX
st_ivas->nchan_ism = 0;
-#endif
st_ivas->nchan_transport = -1;
st_ivas->ism_mode = ISM_MODE_NONE;
@@ -976,17 +940,9 @@ ivas_error ivas_init_decoder(
{
hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->transport_config );
}
-#ifdef NONBE_FIX_1052_SBA_EXT_FIX
else if ( st_ivas->ivas_format == SBA_ISM_FORMAT || st_ivas->ivas_format == SBA_FORMAT )
-#else
- else if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
-#endif
{
-#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
hDecoderConfig->nchan_out = audioCfg2channels( ivas_set_audio_config_from_sba_order( st_ivas->sba_order ) );
-#else
- hDecoderConfig->nchan_out = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA3 );
-#endif
hDecoderConfig->nchan_out += st_ivas->nchan_ism;
}
else if ( st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->ivas_format == MASA_FORMAT )
@@ -1012,17 +968,11 @@ ivas_error ivas_init_decoder(
ivas_output_init( &( st_ivas->hOutSetup ), st_ivas->transport_config );
st_ivas->intern_config = st_ivas->transport_config;
}
-#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
-#ifdef NONBE_FIX_1052_SBA_EXT_FIX
else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL && ( st_ivas->ivas_format == SBA_ISM_FORMAT || st_ivas->ivas_format == SBA_FORMAT ) )
-#else
- else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->ivas_format == SBA_ISM_FORMAT )
-#endif
{
st_ivas->intern_config = ivas_set_audio_config_from_sba_order( st_ivas->sba_order );
ivas_output_init( &( st_ivas->hOutSetup ), st_ivas->intern_config );
}
-#endif
else
{
ivas_output_init( &( st_ivas->hOutSetup ), output_config );
@@ -1036,16 +986,6 @@ ivas_error ivas_init_decoder(
st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( st_ivas->intern_config );
}
-#ifndef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
- if ( st_ivas->ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
- {
- st_ivas->hOutSetup.ambisonics_order = SBA_HOA3_ORDER;
- st_ivas->intern_config = IVAS_AUDIO_CONFIG_HOA3;
- st_ivas->hOutSetup.output_config = IVAS_AUDIO_CONFIG_HOA3;
- st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA3 );
- }
-
-#endif
/* Only initialize transport setup if it is used */
if ( st_ivas->transport_config != IVAS_AUDIO_CONFIG_INVALID )
{
@@ -1232,11 +1172,7 @@ ivas_error ivas_init_decoder(
return error;
}
-#ifdef NONBE_FIX_1052_SBA_EXT_FIX
if ( hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_FOA && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_MONO && !( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->intern_config == IVAS_AUDIO_CONFIG_FOA ) )
-#else
- if ( hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_FOA && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_MONO )
-#endif
{
if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK )
{
@@ -2126,17 +2062,6 @@ ivas_error ivas_init_decoder(
}
}
-#ifndef FIX_1101_CLEANING_JBM_CALL
- if ( st_ivas->hTcBuffer == NULL )
- {
- /* we need the handle anyway, but without the buffer*/
- if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_NONE, 0, 0, 0, 1 ) ) != IVAS_ERR_OK )
- {
- return error;
- }
- }
-
-#endif
if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->hDecoderConfig->Opt_tsm )
{
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c
index da386ac0bbf01529c340d10688faec1438635500..b005723168d36b95b028a523256550cca299cdd3 100644
--- a/lib_dec/ivas_jbm_dec.c
+++ b/lib_dec/ivas_jbm_dec.c
@@ -103,15 +103,6 @@ ivas_error ivas_jbm_dec_tc(
}
}
-#ifndef FIX_1101_CLEANING_JBM_CALL
- if ( !st_ivas->hDecoderConfig->Opt_tsm )
- {
- for ( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ )
- {
- st_ivas->hTcBuffer->tc[n] = st_ivas->p_output_f[n];
- }
- }
-#endif
/*----------------------------------------------------------------*
* Decoding + pre-rendering
*----------------------------------------------------------------*/
@@ -801,7 +792,6 @@ void ivas_jbm_dec_feed_tc_to_renderer(
p_data_f[n] = &data_f[n][0];
}
-#ifdef FIX_1101_CLEANING_JBM_CALL
if ( !st_ivas->hDecoderConfig->Opt_tsm )
{
for ( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ )
@@ -810,7 +800,6 @@ void ivas_jbm_dec_feed_tc_to_renderer(
}
}
-#endif
if ( st_ivas->hDecoderConfig->Opt_tsm )
{
ivas_jbm_dec_copy_tc( st_ivas, nSamplesForRendering, nSamplesResidual, data, p_data_f );
@@ -2291,18 +2280,6 @@ ivas_error ivas_jbm_dec_tc_buffer_open(
set_s( hTcBuffer->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS );
set_s( hTcBuffer->subframe_nbslots, nMaxSlotsPerSubframe, MAX_PARAM_SPATIAL_SUBFRAMES );
-#ifndef FIX_1101_CLEANING_JBM_CALL
- if ( hTcBuffer->tc_buffer_mode == TC_BUFFER_MODE_NONE )
- {
- hTcBuffer->tc_buffer = NULL;
-
- for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ )
- {
- hTcBuffer->tc[ch_idx] = NULL;
- }
- }
- else
-#endif
{
int16_t n_samp_full, n_samp_residual;
int32_t offset;
@@ -2729,9 +2706,6 @@ void ivas_jbm_dec_copy_tc_no_tsm(
const int16_t output_frame /* i : output frame size */
)
{
-#ifndef FIX_1101_CLEANING_JBM_CALL
- int16_t n_ch_full_copy;
-#endif
int16_t n_ch_cldfb;
int16_t ch_idx;
DECODER_TC_BUFFER_HANDLE hTcBuffer;
@@ -2739,26 +2713,10 @@ void ivas_jbm_dec_copy_tc_no_tsm(
hTcBuffer = st_ivas->hTcBuffer;
hTcBuffer->n_samples_buffered = output_frame;
hTcBuffer->n_samples_available = hTcBuffer->n_samples_buffered;
-#ifndef FIX_1101_CLEANING_JBM_CALL
- n_ch_full_copy = min( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full );
-#endif
n_ch_cldfb = hTcBuffer->nchan_transport_jbm - hTcBuffer->nchan_buffer_full;
-#ifdef FIX_1101_CLEANING_JBM_CALL
#ifdef DEBUGGING
assert( st_ivas->hDecoderConfig->Opt_tsm == 0 );
-#endif
-#else
- /* copy full tcs*/
- if ( st_ivas->hDecoderConfig->Opt_tsm )
- {
- for ( ch_idx = 0; ch_idx < n_ch_full_copy; ch_idx++ )
- {
- mvr2r( tc[ch_idx], st_ivas->hTcBuffer->tc[ch_idx], hTcBuffer->n_samples_buffered );
- }
- }
- ch_idx = 0;
-
#endif
/* CLDFB ana for ParamMC/ParamISM */
if ( n_ch_cldfb > 0 )
@@ -2792,11 +2750,7 @@ void ivas_jbm_dec_copy_tc_no_tsm(
#endif
/* CLDFB Analysis*/
-#ifdef FIX_1101_CLEANING_JBM_CALL
for ( ch_idx = 0, cldfb_ch = 0; cldfb_ch < n_ch_cldfb; cldfb_ch++, ch_idx++ )
-#else
- for ( cldfb_ch = 0; cldfb_ch < n_ch_cldfb; cldfb_ch++, ch_idx++ )
-#endif
{
for ( slot_idx = 0; slot_idx < DEFAULT_JBM_CLDFB_TIMESLOTS; slot_idx++ )
{
diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c
index 121cb3df43efa88045f2d537a659da633be8db8e..50cd432deaf0630db12f525a909ed395f7637abb 100644
--- a/lib_dec/ivas_masa_dec.c
+++ b/lib_dec/ivas_masa_dec.c
@@ -1835,9 +1835,6 @@ static void create_masa_ext_out_meta(
IVAS_QMETADATA_HANDLE hQMetaData,
const int16_t nchan_transport )
{
-#ifndef FIX_1121_MASA_DESCRIPTOR
- const uint8_t ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 }; /* "IVASMASA" */
-#endif
int16_t i, sf, b_old, b_new, dir;
MASA_DECRIPTIVE_META *descMeta;
int16_t *bandMap;
diff --git a/lib_dec/ivas_mct_core_dec.c b/lib_dec/ivas_mct_core_dec.c
index 909d08058ee4d28be638bfbda7fd60cfb199ce81..6774b473db51aa933b182d4affc055991b984b76 100644
--- a/lib_dec/ivas_mct_core_dec.c
+++ b/lib_dec/ivas_mct_core_dec.c
@@ -77,15 +77,11 @@ void ivas_mct_side_bits(
{
for ( ch = 0; ch < CPE_CHANNELS; ch++ )
{
-#ifdef ADJUST_MCT_CHANNELS_MAX
if ( i < MCT_MAX_CHANNELS )
{
-#endif
sts[i] = hCPE[cpe_id]->hCoreCoder[ch];
i++;
-#ifdef ADJUST_MCT_CHANNELS_MAX
}
-#endif
}
}
@@ -201,30 +197,14 @@ void ivas_mct_core_dec(
{
for ( ch = 0; ch < CPE_CHANNELS; ch++ )
{
-#ifdef ADJUST_MCT_CHANNELS_MAX
if ( i < MCT_MAX_CHANNELS )
{
-#endif
sts[i] = hCPE[cpe_id]->hCoreCoder[ch];
i++;
-#ifdef ADJUST_MCT_CHANNELS_MAX
}
-#endif
- }
- }
-
-#ifndef ADJUST_MCT_CHANNELS_MAX
- /*seems like obsolete code*/
- for ( ch = 0, i = 0; ch < nChannels; ch++ )
- {
- if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE )
- {
- continue;
}
- i++;
}
-#endif
bfi = sts[0]->bfi;
for ( ch = 0; ch < nChannels; ch++ )
diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c
index 5b331378ca2bcc10e95db528ba856eec34cf333e..44a10edbe2eca04a5b29c2a76f0aa2621bf4d0a5 100644
--- a/lib_dec/ivas_output_config.c
+++ b/lib_dec/ivas_output_config.c
@@ -318,15 +318,11 @@ void ivas_renderer_select(
if ( ivas_format == SBA_FORMAT && ( output_config != IVAS_AUDIO_CONFIG_5_1 && output_config != IVAS_AUDIO_CONFIG_5_1_2 && output_config != IVAS_AUDIO_CONFIG_5_1_4 && output_config != IVAS_AUDIO_CONFIG_7_1 && output_config != IVAS_AUDIO_CONFIG_7_1_4 && output_config != IVAS_AUDIO_CONFIG_LS_CUSTOM && output_config != IVAS_AUDIO_CONFIG_MONO && output_config != IVAS_AUDIO_CONFIG_STEREO ) )
{
-#ifdef NONBE_FIX_1052_SBA_EXT_FIX
if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
{
/* 'internal_config' was already set in ivas_set_audio_config_from_sba_order() */
}
else if ( output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_FOA )
-#else
- if ( output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_FOA )
-#endif
{
*internal_config = output_config;
}
@@ -334,11 +330,7 @@ void ivas_renderer_select(
{
*internal_config = IVAS_AUDIO_CONFIG_FOA;
}
-#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
else if ( output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
-#else
- if ( output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
-#endif
{
*internal_config = IVAS_AUDIO_CONFIG_HOA3;
}
diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c
index 82b87bdcd23b29f1bc8107acaaaad56eb8257ccd..ff086adb545df6cfd33ae580a3922e2d94d41539 100644
--- a/lib_dec/ivas_spar_decoder.c
+++ b/lib_dec/ivas_spar_decoder.c
@@ -1556,11 +1556,7 @@ void ivas_spar_dec_upmixer_sf(
}
}
-#ifdef NONBE_FIX_1052_SBA_EXT_FIX
if ( hDecoderConfig->ivas_total_brate < IVAS_24k4 && ( st_ivas->intern_config == IVAS_AUDIO_CONFIG_HOA2 || st_ivas->intern_config == IVAS_AUDIO_CONFIG_HOA3 ) )
-#else
- if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) )
-#endif
{
ivas_spar_calc_smooth_facs( cldfb_in_ts_re[0], cldfb_in_ts_im[0], num_spar_bands, hSpar->subframe_nbslots[hSpar->subframes_rendered], hSpar->subframes_rendered == 0, &hSpar->hFbMixer->pFb->fb_bin_to_band, hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_buf );
}
@@ -1570,11 +1566,7 @@ void ivas_spar_dec_upmixer_sf(
md_idx = hSpar->render_to_md_map[ts + slot_idx_start];
ivas_spar_get_parameters( hSpar, hDecoderConfig, md_idx, numch_out, numch_in, num_spar_bands, mixer_mat );
-#ifdef NONBE_FIX_1052_SBA_EXT_FIX
if ( hDecoderConfig->ivas_total_brate < IVAS_24k4 && ( st_ivas->intern_config == IVAS_AUDIO_CONFIG_HOA2 || st_ivas->intern_config == IVAS_AUDIO_CONFIG_HOA3 ) )
-#else
- if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) )
-#endif
{
for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ )
{
@@ -1663,11 +1655,7 @@ void ivas_spar_dec_upmixer_sf(
}
}
-#ifdef NONBE_FIX_1052_SBA_EXT_FIX
if ( hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_FOA && hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO && hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_MONO && !( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->intern_config == IVAS_AUDIO_CONFIG_FOA ) )
-#else
- if ( hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_FOA && hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO && hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_MONO )
-#endif
{
ivas_dirac_dec_render_sf( st_ivas, output, nchan_internal, cldfb_in_ts_re, cldfb_in_ts_im );
}
diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c
index 0f0ff9d7aaa5efec93963bfa3e96c72064210fcb..a63e7c7cc22acfe5fb3d503af33cb42b11cd5011 100644
--- a/lib_dec/ivas_stereo_cng_dec.c
+++ b/lib_dec/ivas_stereo_cng_dec.c
@@ -923,9 +923,7 @@ void stereo_cna_update_params(
}
else
{
-#ifdef NONBE_FIX_1110_STEREO_DTX_BRATE_SWITCHING
hFdCngDec->first_cna_noise_updated = 0;
-#endif
return;
}
diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c
index 644437828087be2e9f2d806a35188f93aea6a65a..f56a53ba9677bb2a373a7271b408020df1b52208 100644
--- a/lib_dec/ivas_stereo_switching_dec.c
+++ b/lib_dec/ivas_stereo_switching_dec.c
@@ -1552,9 +1552,7 @@ void stereo_switching_dec(
mvr2r( sts[0]->lsf_old, sts[1]->lsf_old, M );
mvr2r( sts[0]->lsp_old, sts[1]->lsp_old, M );
-#ifdef NONBE_FIX_1110_STEREO_DTX_BRATE_SWITCHING
sts[1]->last_core_brate = sts[0]->last_core_brate;
-#endif
if ( hCPE->element_mode == IVAS_CPE_MDCT )
{
diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c
index d60bc2b7a21f986bce82cc3c4de6d61ddaea5f00..7cca9fc39b317b819750db8980a77979f7474ffe 100644
--- a/lib_dec/lib_dec.c
+++ b/lib_dec/lib_dec.c
@@ -401,22 +401,46 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat(
*---------------------------------------------------------------------*/
ivas_error IVAS_DEC_Configure(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- const uint32_t sampleRate, /* i : output sampling frequency */
- const AUDIO_CONFIG outputConfig, /* i : output configuration */
- const int16_t tsmEnabled, /* i : enable time scale modification */
- const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */
- const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */
- const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */
- const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */
- const int16_t enableExternalOrientation, /* i : enable external orientations */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const uint32_t sampleRate, /* i : output sampling frequency */
+ const AUDIO_CONFIG outputConfig, /* i : output configuration */
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ const bool tsmEnabled, /* i : enable TSM */
+#else
+ const int16_t tsmEnabled, /* i : enable time scale modification */
+#endif
+ const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ const bool customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */
+ const bool hrtfReaderEnabled, /* i : enable HRTF binary file input */
+ const bool enableHeadRotation, /* i : enable head rotation for binaural output */
+ const bool enableExternalOrientation, /* i : enable external orientations */
+#else
+ const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */
+ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */
+ const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */
+ const int16_t enableExternalOrientation, /* i : enable external orientations */
+#endif
const IVAS_HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */
- const int16_t renderConfigEnabled, /* i : enable Renderer config. file for binaural output */
- const int16_t Opt_non_diegetic_pan, /* i : diegetic or not */
- const float non_diegetic_pan_gain, /* i : non diegetic panning gain */
- const int16_t Opt_dpid_on, /* i : enable directivity pattern option */
- const uint16_t acousticEnvironmentId, /* i : Acoustic environment ID */
- const int16_t delayCompensationEnabled /* i : enable delay compensation */
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ const bool renderConfigEnabled, /* i : enable Renderer config. file for binaural output */
+ const bool non_diegetic_pan_enabled, /* i : enabled diegetic panning */
+#else
+ const int16_t renderConfigEnabled, /* i : enable Renderer config. file for binaural output */
+ const int16_t Opt_non_diegetic_pan, /* i : diegetic or not */
+#endif
+ const float non_diegetic_pan_gain, /* i : non diegetic panning gain */
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ const bool dpidEnabled, /* i : enable directivity pattern option */
+#else
+ const int16_t Opt_dpid_on, /* i : enable directivity pattern option */
+#endif
+ const uint16_t acousticEnvironmentId, /* i : Acoustic environment ID */
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ const bool delayCompensationEnabled /* i : enable delay compensation */
+#else
+ const int16_t delayCompensationEnabled /* i : enable delay compensation */
+#endif
)
{
Decoder_Struct *st_ivas;
@@ -434,8 +458,13 @@ ivas_error IVAS_DEC_Configure(
return IVAS_ERR_WRONG_PARAMS;
}
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ if ( hIvasDec->mode == IVAS_DEC_MODE_EVS && !( ( outputConfig == IVAS_AUDIO_CONFIG_MONO && !non_diegetic_pan_enabled ) ||
+ ( outputConfig == IVAS_AUDIO_CONFIG_STEREO && non_diegetic_pan_enabled ) ) )
+#else
if ( hIvasDec->mode == IVAS_DEC_MODE_EVS && !( ( outputConfig == IVAS_AUDIO_CONFIG_MONO && Opt_non_diegetic_pan == 0 ) ||
( outputConfig == IVAS_AUDIO_CONFIG_STEREO && Opt_non_diegetic_pan == 1 ) ) )
+#endif
{
return IVAS_ERR_WRONG_MODE;
}
@@ -463,17 +492,37 @@ ivas_error IVAS_DEC_Configure(
hDecoderConfig->nchan_out = audioCfg2channels( hDecoderConfig->output_config );
}
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ hDecoderConfig->Opt_tsm = (int16_t) tsmEnabled;
+ hDecoderConfig->Opt_LsCustom = (int16_t) customLsOutputEnabled;
+ hDecoderConfig->Opt_Headrotation = (int16_t) enableHeadRotation;
+#else
hDecoderConfig->Opt_tsm = tsmEnabled;
hDecoderConfig->Opt_LsCustom = customLsOutputEnabled;
hDecoderConfig->Opt_Headrotation = enableHeadRotation;
+#endif
hDecoderConfig->orientation_tracking = orientation_tracking;
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ hDecoderConfig->Opt_HRTF_binary = (int16_t) hrtfReaderEnabled;
+ hDecoderConfig->Opt_RendConfigCustom = (int16_t) renderConfigEnabled;
+ hDecoderConfig->Opt_non_diegetic_pan = (int16_t) non_diegetic_pan_enabled;
+#else
hDecoderConfig->Opt_HRTF_binary = hrtfReaderEnabled;
hDecoderConfig->Opt_RendConfigCustom = renderConfigEnabled;
hDecoderConfig->Opt_non_diegetic_pan = Opt_non_diegetic_pan;
+#endif
hDecoderConfig->non_diegetic_pan_gain = non_diegetic_pan_gain;
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ hDecoderConfig->Opt_delay_comp = (int16_t) delayCompensationEnabled;
+#else
hDecoderConfig->Opt_delay_comp = delayCompensationEnabled;
+#endif
hDecoderConfig->Opt_ExternalOrientation = enableExternalOrientation;
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ hDecoderConfig->Opt_dpid_on = (int16_t) dpidEnabled;
+#else
hDecoderConfig->Opt_dpid_on = Opt_dpid_on;
+#endif
hDecoderConfig->Opt_aeid_on = acousticEnvironmentId != 65535 ? TRUE : FALSE;
if ( renderFramesize == IVAS_RENDER_FRAMESIZE_UNKNOWN )
@@ -2084,9 +2133,7 @@ static ivas_error copyRendererConfigStruct(
mvr2r( hRCin->roomAcoustics.pAcoustic_rt60, hRCout->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX );
mvr2r( hRCin->roomAcoustics.pAcoustic_dsr, hRCout->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX );
mvr2r( hRCin->directivity, hRCout->directivity, 3 * MAX_NUM_OBJECTS );
-#ifdef FIX_1053_AEID_FILE_TEST
mvr2r( hRCin->distAtt, hRCout->distAtt, 3 );
-#endif
hRCout->split_rend_config = hRCin->split_rend_config;
diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h
index 0be389a61d764eecd2559adcc3ed1864f9e4b973..85f5d60566cf7e502757d19aa73171774fcb2ac4 100644
--- a/lib_dec/lib_dec.h
+++ b/lib_dec/lib_dec.h
@@ -122,19 +122,43 @@ ivas_error IVAS_DEC_Configure(
IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
const uint32_t sampleRate, /* i : output sampling frequency */
const IVAS_AUDIO_CONFIG outputConfig, /* i : audio configuration */
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ const bool tsmEnabled, /* i : enable TSM */
+#else
const int16_t tsmEnabled, /* i : enable TSM */
+#endif
const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ const bool customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */
+ const bool hrtfReaderEnabled, /* i : enable HRTF binary file input */
+ const bool enableHeadRotation, /* i : enable head rotation for binaural output */
+ const bool enableExternalOrientation, /* i : enable external orientations */
+#else
const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */
const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */
const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */
const int16_t enableExternalOrientation, /* i : enable external orientations */
+#endif
const IVAS_HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ const bool renderConfigEnabled, /* i : enable Renderer config. file for binaural output */
+ const bool non_diegetic_pan_enabled, /* i : enabled diegetic panning */
+#else
const int16_t renderConfigEnabled, /* i : enable Renderer config. file for binaural output */
const int16_t Opt_non_diegetic_pan, /* i : diegetic or not */
+#endif
const float non_diegetic_pan_gain, /* i : non diegetic panning gain */
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ const bool dpidEnabled, /* i : enable directivity pattern option */
+#else
const int16_t Opt_dpid_on, /* i : enable directivity pattern option */
+#endif
const uint16_t acousticEnvironmentId, /* i : Acoustic environment ID */
+#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
+ const bool delayCompensationEnabled /* i : enable delay compensation */
+#else
const int16_t delayCompensationEnabled /* i : enable delay compensation */
+#endif
);
void IVAS_DEC_Close(
diff --git a/lib_enc/acelp_core_enc.c b/lib_enc/acelp_core_enc.c
index eca6e6d71c26a67eaca1f9c05c28d0fb8329e743..e305e0ce8067a529f4772209cb4ffc7bce373a89 100644
--- a/lib_enc/acelp_core_enc.c
+++ b/lib_enc/acelp_core_enc.c
@@ -379,11 +379,7 @@ ivas_error acelp_core_enc(
* After inactive period, use the most up-to-date ISPs
*-----------------------------------------------------------------*/
-#ifdef NONBE_FIX_1110_STEREO_DTX_BRATE_SWITCHING
if ( st->hDtxEnc != NULL && ( st->last_core_brate == FRAME_NO_DATA || st->last_core_brate == SID_2k40 ) )
-#else
- if ( st->last_core_brate == FRAME_NO_DATA || st->last_core_brate == SID_2k40 )
-#endif
{
mvr2r( st->hDtxEnc->lspCNG, st->lsp_old, M );
lsp2lsf( st->hDtxEnc->lspCNG, st->lsf_old, M, int_fs );
diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c
index 044fb1c59a85bf6e7803c6cda8424a4bd86c405c..a3a2bec2573d72bcaa9d7b193ecede972e1c3900 100644
--- a/lib_enc/ivas_cpe_enc.c
+++ b/lib_enc/ivas_cpe_enc.c
@@ -599,19 +599,7 @@ ivas_error ivas_cpe_enc(
if ( sts[0]->core_brate == SID_2k40 )
{
-#ifdef NONBE_FIX_1052_SBA_EXT_FIX
ivas_write_format_sid( ivas_format, hCPE->element_mode, sts[0]->hBstr, hEncoderConfig->sba_order, hEncoderConfig->sba_planar );
-#else
- ivas_write_format_sid( ivas_format, hCPE->element_mode, sts[0]->hBstr );
- if ( ivas_format == SBA_FORMAT )
- {
- /* Write SBA planar flag */
- push_indice( sts[0]->hBstr, IND_SMODE, st_ivas->hEncoderConfig->sba_planar, SBA_PLANAR_BITS );
-
- /* Write SBA order */
- push_indice( sts[0]->hBstr, IND_SMODE, st_ivas->hEncoderConfig->sba_order, SBA_ORDER_BITS );
- }
-#endif
}
/*----------------------------------------------------------------*
diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c
index e9b2b5765f6a23ffd4653f5ecd51e352817f5c58..05621dfaaaf765870ec498d27afefef931b71ce9 100644
--- a/lib_enc/ivas_init_enc.c
+++ b/lib_enc/ivas_init_enc.c
@@ -135,13 +135,9 @@ void ivas_write_format(
void ivas_write_format_sid(
const IVAS_FORMAT ivas_format, /* i : IVAS format */
const int16_t element_mode, /* i : element bitrate */
-#ifdef NONBE_FIX_1052_SBA_EXT_FIX
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const int16_t sba_order, /* i : Ambisonic (SBA) order */
- const int16_t sba_planar /* i : SBA planar flag */
-#else
- BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */
-#endif
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const int16_t sba_order, /* i : Ambisonic (SBA) order */
+ const int16_t sba_planar /* i : SBA planar flag */
)
{
int16_t ind = 0; /* to avoid compilation warning */
@@ -199,7 +195,6 @@ void ivas_write_format_sid(
push_indice( hBstr, IND_IVAS_FORMAT, ind, SID_FORMAT_NBITS );
-#ifdef NONBE_FIX_1052_SBA_EXT_FIX
if ( ivas_format == SBA_FORMAT )
{
/* Write SBA planar flag */
@@ -208,7 +203,6 @@ void ivas_write_format_sid(
/* Write SBA order */
push_indice( hBstr, IND_SMODE, sba_order, SBA_ORDER_BITS );
}
-#endif
return;
}
diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c
index 88713e74097ce4e2ef37e8423bd0032b256f4f46..6e2732f44a4e3e5c34d70b033f1023522519658b 100644
--- a/lib_enc/ivas_ism_enc.c
+++ b/lib_enc/ivas_ism_enc.c
@@ -280,11 +280,7 @@ ivas_error ivas_ism_enc(
if ( sid_flag )
{
-#ifdef NONBE_FIX_1052_SBA_EXT_FIX
ivas_write_format_sid( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr, -1, -1 );
-#else
- ivas_write_format_sid( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr );
-#endif
}
/*only metadata encoding is needed for this case*/
diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c
index fa25c6cecec0cc1ed03ee1c04c20eccac77589d7..9df01a94591dc097eb7b5e99a7dd0bd0caa1ae79 100644
--- a/lib_enc/ivas_mct_core_enc.c
+++ b/lib_enc/ivas_mct_core_enc.c
@@ -265,14 +265,10 @@ void ivas_mct_core_enc(
{
for ( ch = 0; ch < CPE_CHANNELS; ch++ )
{
-#ifdef ADJUST_MCT_CHANNELS_MAX
if ( cpe_id * CPE_CHANNELS + ch < nChannels )
{
-#endif
sts[i] = hCPE[cpe_id]->hCoreCoder[ch];
-#ifdef ADJUST_MCT_CHANNELS_MAX
}
-#endif
if ( hCPE[cpe_id]->hCoreCoder[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE )
{
diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c
index b36048ce0b0773e69a2ddc762b92292fb47fbbca..8f5d472ea95f605c7159b8a4001d6260bbc2c12d 100644
--- a/lib_enc/ivas_sce_enc.c
+++ b/lib_enc/ivas_sce_enc.c
@@ -223,19 +223,7 @@ ivas_error ivas_sce_enc(
if ( st->core_brate == SID_2k40 )
{
-#ifdef NONBE_FIX_1052_SBA_EXT_FIX
ivas_write_format_sid( ivas_format, IVAS_SCE, st->hBstr, st_ivas->hEncoderConfig->sba_order, st_ivas->hEncoderConfig->sba_planar );
-#else
- ivas_write_format_sid( ivas_format, IVAS_SCE, st->hBstr );
- if ( ivas_format == SBA_FORMAT )
- {
- /* Write SBA planar flag */
- push_indice( st->hBstr, IND_SMODE, st_ivas->hEncoderConfig->sba_planar, SBA_PLANAR_BITS );
-
- /* Write SBA order */
- push_indice( st->hBstr, IND_SMODE, st_ivas->hEncoderConfig->sba_order, SBA_ORDER_BITS );
- }
-#endif
}
/*----------------------------------------------------------------*
diff --git a/lib_enc/ivas_stereo_switching_enc.c b/lib_enc/ivas_stereo_switching_enc.c
index 0c883721eb1d397ae3cd476e8f257eddabe8542f..8bbfd39321ce36ffef4af936423d146765980f04 100644
--- a/lib_enc/ivas_stereo_switching_enc.c
+++ b/lib_enc/ivas_stereo_switching_enc.c
@@ -801,9 +801,7 @@ void stereo_switching_enc(
mvr2r( sts[0]->lsf_old1, sts[1]->lsf_old1, M );
mvr2r( sts[0]->lsp_old1, sts[1]->lsp_old1, M );
-#ifdef NONBE_FIX_1110_STEREO_DTX_BRATE_SWITCHING
sts[1]->last_core_brate = sts[0]->last_core_brate;
-#endif
sts[1]->GSC_noisy_speech = 0;
if ( hCPE->element_mode == IVAS_CPE_MDCT )
diff --git a/lib_enc/swb_tbe_enc.c b/lib_enc/swb_tbe_enc.c
index 758fa4fe76e2d885dd9d4176edd5e7f698831e86..1cf69fab8a13ddd7bf40a262ed9675a233485526 100644
--- a/lib_enc/swb_tbe_enc.c
+++ b/lib_enc/swb_tbe_enc.c
@@ -280,6 +280,15 @@ void wb_tbe_enc(
}
autocorr( hb_old_speech, R, LPC_SHB_ORDER_WB + 1, ( NS2SA( INT_FS_12k8, 5000000L ) + L_SUBFR + L_FRAME ) * 5 / 16, win_lpc_hb_wb, 0, 1, 1 );
+
+#ifdef NONBE_FIX_1130_DIV_ZERO_LEV_DUR
+ if ( st->element_mode > EVS_MONO )
+ {
+ /* Ensure R[0] isn't zero when entering Levinson-Durbin */
+ R[0] = max( R[0], 1.0e-8f );
+ }
+#endif
+
lev_dur( lpc_wb_temp, R, LPC_SHB_ORDER_WB, ervec_temp );
a2lsp( lsp_wb_temp, lpc_wb_temp, LPC_SHB_ORDER_WB );
lsp_spacing = 0.5f;
diff --git a/lib_rend/ivas_mcmasa_ana.c b/lib_rend/ivas_mcmasa_ana.c
index 49e7d00eec0465c5c8f11598db7294d59460c1e4..0449159a2fd3c6c0f2ead10c91eb3fdccd90d2a6 100644
--- a/lib_rend/ivas_mcmasa_ana.c
+++ b/lib_rend/ivas_mcmasa_ana.c
@@ -1069,9 +1069,6 @@ void ivas_create_masa_out_meta(
float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i : Estimated surround coherence */
)
{
-#ifndef FIX_1121_MASA_DESCRIPTOR
- const uint8_t ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 }; /* "IVASMASA" */
-#endif
int16_t i, sf, band;
uint8_t numFrequencyBands;
uint8_t numDirections;
diff --git a/lib_util/ambi_convert.c b/lib_util/ambi_convert.c
new file mode 100644
index 0000000000000000000000000000000000000000..92711b8e61c5b7c7bd75d93753a365313696de89
--- /dev/null
+++ b/lib_util/ambi_convert.c
@@ -0,0 +1,438 @@
+/******************************************************************************************************
+
+ (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.
+
+*******************************************************************************************************/
+#include
+#include
+#include
+#include "ambi_convert.h"
+
+#define SQRT_2_ 1.4142135f /* sqrtf(2.0f) */
+#define SQRT_3_ 1.7320508f /* sqrtf(3.0f) */
+#define SQRT_5_ 2.2360679f /* sqrtf(5.0f) */
+#define SQRT_7_ 2.6457513f /* sqrtf(7.0f) */
+
+#define INV_SQRT_2_ 0.7071067f /* 1.0f/sqrtf(2.0f) */
+#define INV_SQRT_3_ 0.5773502f /* 1.0f/sqrtf(3.0f) */
+#define INV_SQRT_5_ 0.4472135f /* 1.0f/sqrtf(5.0f) */
+#define INV_SQRT_7_ 0.3779644f /* 1.0f/sqrtf(7.0f) */
+
+#define TWO_OVER_SQRT_3_ 1.1547005f /* 2.0f/sqrtf(3.0f) */
+#define THREE_OVER_SQRT_5_ 1.3416408f /* 3.0f/sqrtf(5.0f) */
+#define SQRT_8_OVER_5_ 1.2649110f /* sqrtf(8.0f/5.0f) */
+#define SQRT_45_OVER_32_ 1.1858541f /* sqrtf(45.0f/32.0f) */
+
+#define INV_TWO_OVER_SQRT_3_ 0.8660254f /* 1.0f/TWO_OVER_SQRT_3_ */
+#define INV_THREE_OVER_SQRT_5_ 0.7453560f /* 1.0f/THREE_OVER_SQRT_5_ */
+#define INV_SQRT_8_OVER_5_ 0.7905694f /* 1.0f/INV_SQRT_8_OVER_5_ */
+#define INV_SQRT_45_OVER_32_ 0.8432740f /* 1.0f/SQRT_45_OVER_32_ */
+
+/* --------------------------------
+ normalization conversion tables
+ -------------------------------- */
+
+static const float SN3D_N3D[AMBI_MAX_CHANNELS] = { 1.0f,
+ SQRT_3_, SQRT_3_, SQRT_3_,
+ SQRT_5_, SQRT_5_, SQRT_5_, SQRT_5_, SQRT_5_,
+ SQRT_7_, SQRT_7_, SQRT_7_, SQRT_7_, SQRT_7_, SQRT_7_, SQRT_7_ };
+
+static const float N3D_SN3D[AMBI_MAX_CHANNELS] = { 1.0f,
+ INV_SQRT_3_, INV_SQRT_3_, INV_SQRT_3_,
+ INV_SQRT_5_, INV_SQRT_5_, INV_SQRT_5_, INV_SQRT_5_, INV_SQRT_5_,
+ INV_SQRT_7_, INV_SQRT_7_, INV_SQRT_7_, INV_SQRT_7_, INV_SQRT_7_, INV_SQRT_7_, INV_SQRT_7_ };
+
+
+static const float SN3D_MAXN[AMBI_MAX_CHANNELS] = { 1.0f,
+ 1.0f, 1.0f, 1.0f,
+ TWO_OVER_SQRT_3_, TWO_OVER_SQRT_3_, 1.0f, TWO_OVER_SQRT_3_, TWO_OVER_SQRT_3_,
+ SQRT_8_OVER_5_, THREE_OVER_SQRT_5_, SQRT_45_OVER_32_, 1.0f, SQRT_45_OVER_32_, THREE_OVER_SQRT_5_, SQRT_8_OVER_5_ };
+
+static const float MAXN_SN3D[AMBI_MAX_CHANNELS] = { 1.0f,
+ 1.0f, 1.0f, 1.0f,
+ INV_TWO_OVER_SQRT_3_, INV_TWO_OVER_SQRT_3_, 1.0f, INV_TWO_OVER_SQRT_3_, INV_TWO_OVER_SQRT_3_,
+ INV_SQRT_8_OVER_5_, INV_THREE_OVER_SQRT_5_, INV_SQRT_45_OVER_32_, 1.0f, INV_SQRT_45_OVER_32_, INV_THREE_OVER_SQRT_5_, INV_SQRT_8_OVER_5_ };
+
+static const float SN3D_FM[AMBI_MAX_CHANNELS] = { INV_SQRT_2_,
+ 1.0f, 1.0f, 1.0f,
+ TWO_OVER_SQRT_3_, TWO_OVER_SQRT_3_, 1.0f, TWO_OVER_SQRT_3_, TWO_OVER_SQRT_3_,
+ SQRT_8_OVER_5_, THREE_OVER_SQRT_5_, SQRT_45_OVER_32_, 1.0f, SQRT_45_OVER_32_, THREE_OVER_SQRT_5_, SQRT_8_OVER_5_ };
+
+static const float FM_SN3D[AMBI_MAX_CHANNELS] = { SQRT_2_,
+ 1.0f, 1.0f, 1.0f,
+ INV_TWO_OVER_SQRT_3_, INV_TWO_OVER_SQRT_3_, 1.0f, INV_TWO_OVER_SQRT_3_, INV_TWO_OVER_SQRT_3_,
+ INV_SQRT_8_OVER_5_, INV_THREE_OVER_SQRT_5_, INV_SQRT_45_OVER_32_, 1.0f, INV_SQRT_45_OVER_32_, INV_THREE_OVER_SQRT_5_, INV_SQRT_8_OVER_5_ };
+
+/* ----------------------------
+ channel re-ordering tables
+ ---------------------------- */
+
+static const int16_t REORDER_FM_ACN[AMBI_MAX_CHANNELS] = { 0,
+ 2, 3, 1,
+ 8, 6, 4, 5, 7,
+ 15, 13, 11, 9, 10, 12, 14 };
+
+static const int16_t REORDER_SID_ACN[AMBI_MAX_CHANNELS] = { 0,
+ 2, 3, 1,
+ 5, 7, 8, 6, 4,
+ 10, 12, 14, 15, 13, 11, 9 };
+
+static const int16_t REORDER_ACN_FM[AMBI_MAX_CHANNELS] = { 0,
+ 3, 1, 2,
+ 6, 7, 5, 8, 4,
+ 12, 13, 11, 14, 10, 15, 9 };
+
+static const int16_t REORDER_ACN_SID[AMBI_MAX_CHANNELS] = { 0,
+ 3, 1, 2,
+ 8, 4, 7, 5, 6,
+ 15, 9, 14, 10, 13, 11, 12 };
+
+/* ----------------------------------
+ API functions for the conversion
+ ---------------------------------- */
+
+/*-------------------------------------------------------------------------*
+* convert_ambi_format()
+*
+* Convert signal between ACN-SN3D and other common ambisonics conventions
+--------------------------------------------------------------------------*/
+
+AMBI_CONVERT_ERROR convert_ambi_format(
+ float *in[], /* i: input ambisonics channels */
+ float *out[], /* o: output ambisonics channels */
+ int16_t order, /* i: ambisonics order */
+ AMBI_FMT in_format, /* i: input ambisonics format */
+ AMBI_FMT out_format /* i: output ambisonics format */
+)
+{
+
+ float tmp[AMBI_MAX_CHANNELS * L_FRAME48k];
+ float *p_tmp[AMBI_MAX_CHANNELS];
+ AMBI_CONVERT_ERROR err = AMBI_CONVERT_OK;
+
+ AMBI_CHANNEL_ORDER ch_ord_in = AMBI_CHANNEL_ORDER_ACN;
+ AMBI_CHANNEL_ORDER ch_ord_out = AMBI_CHANNEL_ORDER_ACN;
+
+ AMBI_CHANNEL_NORM ch_norm_in = AMBI_NORM_SN3D;
+ AMBI_CHANNEL_NORM ch_norm_out = AMBI_NORM_SN3D;
+
+ assert( order <= 3 );
+
+ if ( in_format != AMBI_FMT_ACN_SN3D && out_format != AMBI_FMT_ACN_SN3D )
+ {
+ assert( 0 && "Conversion only supported to and from ACN-SN3D" );
+ }
+
+ for ( int16_t j = 0; j < AMBI_MAX_CHANNELS; j++ )
+ {
+ p_tmp[j] = &tmp[j * L_FRAME48k];
+ }
+
+ switch ( in_format )
+ {
+ case AMBI_FMT_ACN_SN3D:
+ ch_ord_in = AMBI_CHANNEL_ORDER_ACN;
+ ch_norm_in = AMBI_NORM_SN3D;
+ break;
+ case AMBI_FMT_ACN_N3D:
+ ch_ord_in = AMBI_CHANNEL_ORDER_ACN;
+ ch_norm_in = AMBI_NORM_N3D;
+ break;
+ case AMBI_FMT_FM_MAXN:
+ ch_ord_in = AMBI_CHANNEL_ORDER_FM;
+ ch_norm_in = AMBI_NORM_MAXN;
+ break;
+ case AMBI_FMT_FM_FM:
+ ch_ord_in = AMBI_CHANNEL_ORDER_FM;
+ ch_norm_in = AMBI_NORM_FM;
+ break;
+ case AMBI_FMT_SID_SN3D:
+ ch_ord_in = AMBI_CHANNEL_ORDER_SID;
+ ch_norm_in = AMBI_NORM_SN3D;
+ break;
+ case AMBI_FMT_SID_N3D:
+ ch_ord_in = AMBI_CHANNEL_ORDER_SID;
+ ch_norm_in = AMBI_NORM_N3D;
+ break;
+ default:
+ return AMBI_CONVERT_UNSUPPORTED_CONVERSION;
+ }
+
+ switch ( out_format )
+ {
+ case AMBI_FMT_ACN_SN3D:
+ ch_ord_out = AMBI_CHANNEL_ORDER_ACN;
+ ch_norm_out = AMBI_NORM_SN3D;
+ break;
+ case AMBI_FMT_ACN_N3D:
+ ch_ord_out = AMBI_CHANNEL_ORDER_ACN;
+ ch_norm_out = AMBI_NORM_N3D;
+ break;
+ case AMBI_FMT_FM_MAXN:
+ ch_ord_out = AMBI_CHANNEL_ORDER_FM;
+ ch_norm_out = AMBI_NORM_MAXN;
+ break;
+ case AMBI_FMT_FM_FM:
+ ch_ord_out = AMBI_CHANNEL_ORDER_FM;
+ ch_norm_out = AMBI_NORM_FM;
+ break;
+ case AMBI_FMT_SID_SN3D:
+ ch_ord_out = AMBI_CHANNEL_ORDER_SID;
+ ch_norm_out = AMBI_NORM_SN3D;
+ break;
+ case AMBI_FMT_SID_N3D:
+ ch_ord_out = AMBI_CHANNEL_ORDER_SID;
+ ch_norm_out = AMBI_NORM_N3D;
+ break;
+ default:
+ return AMBI_CONVERT_UNSUPPORTED_CONVERSION;
+ }
+
+ if ( in_format == AMBI_FMT_ACN_SN3D && ch_norm_in != ch_norm_out )
+ {
+ if ( ch_ord_in != ch_ord_out )
+ {
+ if ( ( err = renormalize_channels( in, p_tmp, order, ch_norm_in, ch_norm_out ) ) != AMBI_CONVERT_OK )
+ {
+ return err;
+ }
+ if ( ( err = reorder_channels( p_tmp, out, order, ch_ord_in, ch_ord_out ) ) != AMBI_CONVERT_OK )
+ {
+ return err;
+ }
+ }
+ else
+ {
+ if ( ( err = renormalize_channels( in, out, order, ch_norm_in, ch_norm_out ) ) != AMBI_CONVERT_OK )
+ {
+ return err;
+ }
+ }
+ }
+ else if ( in_format == AMBI_FMT_ACN_SN3D && ch_ord_in != ch_ord_out )
+ {
+ if ( ( err = reorder_channels( in, out, order, ch_ord_in, ch_ord_out ) ) != AMBI_CONVERT_OK )
+ {
+ return err;
+ }
+ }
+ else if ( out_format == AMBI_FMT_ACN_SN3D && ch_norm_in != ch_norm_out )
+ {
+ if ( ch_ord_in != ch_ord_out )
+ {
+ if ( ( err = reorder_channels( in, p_tmp, order, ch_ord_in, ch_ord_out ) ) != AMBI_CONVERT_OK )
+ {
+ return err;
+ }
+ if ( ( err = renormalize_channels( p_tmp, out, order, ch_norm_in, ch_norm_out ) ) != AMBI_CONVERT_OK )
+ {
+ return err;
+ }
+ }
+ else
+ {
+ if ( ( err = renormalize_channels( in, out, order, ch_norm_in, ch_norm_out ) ) != AMBI_CONVERT_OK )
+ {
+ return err;
+ }
+ }
+ }
+ else if ( out_format == AMBI_FMT_ACN_SN3D && ch_ord_in != ch_ord_out )
+ {
+ if ( ( err = reorder_channels( in, out, order, ch_ord_in, ch_ord_out ) ) != AMBI_CONVERT_OK )
+ {
+ return err;
+ }
+ }
+ else if ( out_format == AMBI_FMT_ACN_SN3D && in_format == AMBI_FMT_ACN_SN3D )
+ {
+ int16_t i_chan = 0;
+ int16_t n_chan = ( order + 1 ) * ( order + 1 );
+
+ for ( i_chan = 0; i_chan < n_chan; i_chan++ )
+ {
+ int16_t i = 0;
+ for ( i = 0; i < L_FRAME48k; i++ )
+ {
+ out[i_chan][i] = in[i_chan][i];
+ }
+ }
+ }
+ else
+ {
+ assert( 0 && "This should never happen!" );
+ }
+
+ return AMBI_CONVERT_OK;
+}
+
+/*-------------------------------------------------------------------------*
+* renormalize_channels()
+*
+* Rescale audio channels according to the selected ambisonics convention
+--------------------------------------------------------------------------*/
+
+AMBI_CONVERT_ERROR renormalize_channels(
+ float *in[], /* i: input ambisonics channels */
+ float *out[], /* o: output ambisonics channels */
+ int16_t order, /* i: ambisonics order */
+ AMBI_CHANNEL_NORM in_format, /* i: input ambisonics format */
+ AMBI_CHANNEL_NORM out_format /* i: output ambisonics format */
+)
+{
+ int16_t n_chan = ( order + 1 ) * ( order + 1 );
+ int16_t i_chan, i;
+ const float *conversion_table = 0;
+
+ /* conversion factors are applied on the channels assuming that they are still/already in ACN order */
+ if ( in_format == AMBI_NORM_SN3D )
+ {
+ if ( out_format == AMBI_NORM_N3D )
+ {
+ conversion_table = SN3D_N3D;
+ }
+ else if ( out_format == AMBI_NORM_MAXN )
+ {
+ conversion_table = SN3D_MAXN;
+ }
+ else if ( out_format == AMBI_NORM_FM )
+ {
+ conversion_table = SN3D_FM;
+ }
+ else
+ {
+ return AMBI_CONVERT_UNSUPPORTED_CONVERSION;
+ }
+ }
+ else if ( out_format == AMBI_NORM_SN3D )
+ {
+ if ( in_format == AMBI_NORM_N3D )
+ {
+ conversion_table = N3D_SN3D;
+ }
+ else if ( in_format == AMBI_NORM_MAXN )
+ {
+ conversion_table = MAXN_SN3D;
+ }
+ else if ( in_format == AMBI_NORM_FM )
+ {
+ conversion_table = FM_SN3D;
+ }
+ else
+ {
+ return AMBI_CONVERT_UNSUPPORTED_CONVERSION;
+ }
+ }
+ else
+ {
+ return AMBI_CONVERT_UNSUPPORTED_CONVERSION;
+ }
+
+
+ for ( i_chan = 0; i_chan < n_chan; i_chan++ )
+ {
+ float conversion_factor = conversion_table[i_chan];
+ for ( i = 0; i < L_FRAME48k; i++ )
+ {
+ out[i_chan][i] = in[i_chan][i] * conversion_factor;
+ }
+ }
+
+ return AMBI_CONVERT_OK;
+}
+
+/*-------------------------------------------------------------------------*
+* reorder_channels()
+*
+* Reorder channels according to the selected ambisonics convention
+--------------------------------------------------------------------------*/
+
+AMBI_CONVERT_ERROR reorder_channels(
+ float *in[], /* i: input ambisonics channels */
+ float *out[], /* o: output ambisonics channels */
+ int16_t order, /* i: ambisonics order */
+ AMBI_CHANNEL_ORDER in_format, /* i: input ambisonics format */
+ AMBI_CHANNEL_ORDER out_format /* i: output ambisonics format */
+)
+{
+ int16_t n_chan = ( order + 1 ) * ( order + 1 );
+ int16_t i_chan, i;
+ float tmp[AMBI_MAX_CHANNELS];
+ const int16_t *idx_table = 0;
+
+ if ( in_format == AMBI_CHANNEL_ORDER_ACN )
+ {
+ if ( out_format == AMBI_CHANNEL_ORDER_FM )
+ {
+ idx_table = REORDER_ACN_FM;
+ }
+ else if ( out_format == AMBI_CHANNEL_ORDER_SID )
+ {
+ idx_table = REORDER_ACN_SID;
+ }
+ else
+ {
+ return AMBI_CONVERT_UNSUPPORTED_CONVERSION;
+ }
+ }
+ else if ( out_format == AMBI_CHANNEL_ORDER_ACN )
+ {
+ if ( in_format == AMBI_CHANNEL_ORDER_FM )
+ {
+ idx_table = REORDER_FM_ACN;
+ }
+ else if ( in_format == AMBI_CHANNEL_ORDER_SID )
+ {
+ idx_table = REORDER_SID_ACN;
+ }
+ else
+ {
+ return AMBI_CONVERT_UNSUPPORTED_CONVERSION;
+ }
+ }
+ else
+ {
+ return AMBI_CONVERT_UNSUPPORTED_CONVERSION;
+ }
+
+ for ( i = 0; i < L_FRAME48k; i++ )
+ {
+ for ( i_chan = 0; i_chan < n_chan; i_chan++ )
+ {
+ int16_t idx = idx_table[i_chan];
+ tmp[i_chan] = in[idx][i];
+ }
+ for ( i_chan = 0; i_chan < n_chan; i_chan++ )
+ {
+ out[i_chan][i] = tmp[i_chan];
+ }
+ }
+
+ return AMBI_CONVERT_OK;
+}
diff --git a/lib_util/ambi_convert.h b/lib_util/ambi_convert.h
new file mode 100644
index 0000000000000000000000000000000000000000..7b3093c5d369257fcc31e4471fe5b6000f04fa5c
--- /dev/null
+++ b/lib_util/ambi_convert.h
@@ -0,0 +1,95 @@
+/******************************************************************************************************
+
+ (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.
+
+*******************************************************************************************************/
+
+#ifndef AMBI_CONVERT_H
+#define AMBI_CONVERT_H
+
+#include
+
+#define L_FRAME48k 960
+#define AMBI_MAX_CHANNELS 16
+
+typedef enum
+{
+ AMBI_FMT_ACN_SN3D = 0,
+ AMBI_FMT_ACN_N3D,
+ AMBI_FMT_FM_MAXN,
+ AMBI_FMT_FM_FM,
+ AMBI_FMT_SID_SN3D,
+ AMBI_FMT_SID_N3D
+} AMBI_FMT;
+
+typedef enum
+{
+ AMBI_NORM_SN3D = 0,
+ AMBI_NORM_N3D,
+ AMBI_NORM_MAXN,
+ AMBI_NORM_FM
+} AMBI_CHANNEL_NORM;
+
+typedef enum
+{
+ AMBI_CHANNEL_ORDER_ACN = 0,
+ AMBI_CHANNEL_ORDER_FM,
+ AMBI_CHANNEL_ORDER_SID
+} AMBI_CHANNEL_ORDER;
+
+typedef enum
+{
+ AMBI_CONVERT_OK = 0,
+ AMBI_CONVERT_UNSUPPORTED_CONVERSION
+} AMBI_CONVERT_ERROR;
+
+AMBI_CONVERT_ERROR convert_ambi_format(
+ float *in[], /* i: input ambisonics channels */
+ float *out[], /* o: output ambisonics channels */
+ int16_t order, /* i: ambisonics order */
+ AMBI_FMT in_format, /* i: input ambisonics format */
+ AMBI_FMT out_format /* i: output ambisonics format */
+);
+
+AMBI_CONVERT_ERROR renormalize_channels(
+ float *in[], /* i: input ambisonics channels */
+ float *out[], /* o: output ambisonics channels */
+ int16_t order, /* i: ambisonics order */
+ AMBI_CHANNEL_NORM in_format, /* i: input ambisonics format */
+ AMBI_CHANNEL_NORM out_format /* i: output ambisonics format */
+);
+
+AMBI_CONVERT_ERROR reorder_channels(
+ float *in[], /* i: input ambisonics channels */
+ float *out[], /* o: output ambisonics channels */
+ int16_t order, /* i: ambisonics order */
+ AMBI_CHANNEL_ORDER in_format, /* i: input ambisonics format */
+ AMBI_CHANNEL_ORDER out_format /* i: output ambisonics format */
+);
+#endif
diff --git a/lib_util/masa_file_reader.c b/lib_util/masa_file_reader.c
index bc75b0bdbdd780cca8a86c24cccd7716cc8b00ed..56f22d3fed15137ae2db4dd4bc531cd4d438bf65 100644
--- a/lib_util/masa_file_reader.c
+++ b/lib_util/masa_file_reader.c
@@ -33,9 +33,7 @@
#include "masa_file_reader.h"
#include "ivas_prot.h"
#include "ivas_stat_com.h"
-#ifdef FIX_1121_MASA_DESCRIPTOR
#include "ivas_rom_com.h" /* load 'ivasmasaFormatDescriptor[8]' */
-#endif
#include
#include
@@ -114,9 +112,6 @@ ivas_error MasaFileReader_readNextFrame(
return IVAS_ERR_UNEXPECTED_NULL_POINTER;
}
-#ifndef FIX_1121_MASA_DESCRIPTOR
- const uint8_t ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 }; /* "IVASMASA" */
-#endif
uint16_t twoByteBuffer = 0;
int16_t i, j, b;
IVAS_MASA_METADATA_HANDLE hMeta;
diff --git a/scripts/ambi_converter.c b/scripts/ambi_converter.c
new file mode 100644
index 0000000000000000000000000000000000000000..087e90a3fd1800f25a377bfea4f6a7206877bce6
--- /dev/null
+++ b/scripts/ambi_converter.c
@@ -0,0 +1,186 @@
+/******************************************************************************************************
+
+ (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.
+
+*******************************************************************************************************/
+#include
+#include
+#include
+#include
+#include "tinywavein_c.h"
+#include "tinywaveout_c.h"
+#include "ambi_convert.h"
+
+/*-------------------------------------------------------------------------------------*
+ * Ambisonics converter program
+ *
+ * gcc ambi_converter.c ../lib_util/ambi_convert.c -I../lib_util/ -lm -o ambi_converter
+ *--------------------------------------------------------------------------------------*/
+
+int main( int argc, char *argv[] )
+{
+
+ WAVEFILEIN *wavFile_in;
+ WAVEFILEOUT *wavFile_out;
+ char *fileName_in, *fileName_out;
+
+ uint32_t samplingRate;
+ uint32_t samplesInFile;
+ uint32_t numSamples = L_FRAME48k;
+ uint32_t numSamplesRead32 = 0;
+ uint32_t numSamplesClipped = 0;
+
+ int16_t bps;
+ int16_t samples[L_FRAME48k * AMBI_MAX_CHANNELS];
+ int16_t order = 0;
+ int16_t numChannels;
+
+ AMBI_FMT in_format, out_format;
+
+ float samples_f_in[L_FRAME48k * AMBI_MAX_CHANNELS];
+ float samples_f_out[L_FRAME48k * AMBI_MAX_CHANNELS];
+ float *in[AMBI_MAX_CHANNELS], *out[AMBI_MAX_CHANNELS];
+
+ for ( int16_t j = 0; j < AMBI_MAX_CHANNELS; j++ )
+ {
+ in[j] = &samples_f_in[j * L_FRAME48k];
+ out[j] = &samples_f_out[j * L_FRAME48k];
+ }
+
+ if ( argc != 5 )
+ {
+ printf( "Ambisonics converter program\n" );
+ printf( "----------------------------------------------------------------------------------\n" );
+ printf( "Usage:\n" );
+ printf( "./ambi_conveter input_file output_file input_convention output_convention\n" );
+ printf( "\n" );
+ printf( "input_convention and output convention must be an integer number in [0,5]\n" );
+ printf( "the following conventions are supported:\n" );
+ printf( "0 : ACN-SN3D\n" );
+ printf( "1 : ACN-N3D\n" );
+ printf( "2 : FuMa-MaxN\n" );
+ printf( "3 : FuMa-FuMa\n" );
+ printf( "4 : SID-SN3D\n" );
+ printf( "5 : SID-N3D\n" );
+ printf( "\n" );
+ printf( "Either the input or the output convention must always be ACN-SN3D!\n" );
+ return -1;
+ }
+
+ fileName_in = argv[1];
+ fileName_out = argv[2];
+ in_format = atoi( argv[3] );
+ out_format = atoi( argv[4] );
+
+ printf( "In %d, Out: %d\n", in_format, out_format );
+
+ wavFile_in = OpenWav( fileName_in, &samplingRate, &numChannels, &samplesInFile, &bps );
+ if ( !wavFile_in )
+ {
+ fprintf( stderr, "Failed to open input wav file: %s\n", fileName_in );
+ return -1;
+ }
+
+ wavFile_out = CreateWav( fileName_out, samplingRate, numChannels, 16 );
+ if ( !wavFile_out )
+ {
+ fprintf( stderr, "Failed to open output wav file: %s\n", fileName_out );
+ return -1;
+ }
+
+ order = (int16_t) sqrtf( numChannels ) - 1;
+ assert( order > 0 && order <= 3 );
+
+ while ( ReadWavShort( wavFile_in, samples, numSamples, &numSamplesRead32 ) == __TWI_SUCCESS )
+ {
+ int16_t err = 0;
+
+ if ( !numSamplesRead32 )
+ {
+ break;
+ }
+
+ for ( int16_t i = 0; i < numSamplesRead32; i++ )
+ {
+ for ( int16_t j = 0; j < numChannels; j++ )
+ {
+ in[j][i] = (float) samples[i * numChannels + j];
+ }
+ }
+
+ if ( ( err = convert_ambi_format( in, out, order, in_format, out_format ) ) != 0 )
+ {
+ printf( "Error converting the input signal!\n" );
+ return err;
+ }
+
+
+ for ( int16_t i = 0; i < numSamplesRead32; i++ )
+ {
+ for ( int16_t j = 0; j < numChannels; j++ )
+ {
+ int s1_i;
+ float s1 = out[j][i];
+ if ( s1 < INT16_MIN )
+ {
+ s1_i = INT16_MIN;
+ numSamplesClipped++;
+ }
+ else if ( s1 > INT16_MAX )
+ {
+ s1_i = INT16_MAX;
+ numSamplesClipped++;
+ }
+ else
+ {
+ s1_i = (int16_t) s1;
+ }
+ samples[i * numChannels + j] = s1_i;
+ }
+ }
+
+ if ( ( err = WriteWavShort( wavFile_out, samples, numSamplesRead32 ) ) != __TWO_SUCCESS )
+ {
+ printf( "Error writing output wave file!\n" );
+ return err;
+ }
+
+ numSamplesRead32 = 0;
+ }
+
+ CloseWav( wavFile_out );
+ CloseWavIn( wavFile_in );
+
+ if ( numSamplesClipped )
+ {
+ printf( "Warning: %d samples have clipped!\n", numSamplesClipped );
+ }
+
+ return 0;
+}
diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm
index fad98f82689a4b9d87d3bfc487f1177e34762253..acbef956861a9e5f176ec97c1baf312e3fb792af 100644
--- a/scripts/config/self_test.prm
+++ b/scripts/config/self_test.prm
@@ -275,6 +275,11 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error
../IVAS_dec MONO 48 bit_error testv/stvST48n.wav_stereo_48000_48-48_DTX_MONO_FER5.tst
+// stereo at 48 kbps, 48 kHz in, 48 kHz out, DTX on, FER with burst error before SID
+../IVAS_cod -stereo -dtx 48000 48 testv/stvST48n.wav bit
+eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct_burst.g192 bit_error
+../IVAS_dec stereo 48 bit_error testv/stvST48n.wav_stereo_48000_48-48_DTX_stereo_FER5_burst.tst
+
// stereo at 48 kbps, 32 kHz in, 32 kHz out, DTX on, MONO out
../IVAS_cod -stereo -dtx 48000 32 testv/stvST32n.wav bit
../IVAS_dec MONO 32 bit testv/stvST32n.wav_stereo_48000_32-32_DTX_MONO.tst
diff --git a/scripts/config/self_test_ltv.prm b/scripts/config/self_test_ltv.prm
index 9003fec9a1cdfc456ab8efbd601e99ec3931d2e5..45cc65beb1cb7d8242e834db42f579c9d6eadc14 100644
--- a/scripts/config/self_test_ltv.prm
+++ b/scripts/config/self_test_ltv.prm
@@ -274,6 +274,11 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error
../IVAS_dec MONO 48 bit_error testv/ltv48_STEREO.wav_stereo_48000_48-48_DTX_MONO_FER5.tst
+// stereo at 48 kbps, 48 kHz in, 48 kHz out, DTX on, FER with burst error before SID
+../IVAS_cod -stereo -dtx 48000 48 testv/ltv48_STEREO.wav bit
+eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct_burst.g192 bit_error
+../IVAS_dec stereo 48 bit_error testv/ltv48_STEREO.wav_stereo_48000_48-48_DTX_stereo_FER5_burst.tst
+
// stereo at 48 kbps, 32 kHz in, 32 kHz out, DTX on, MONO out
../IVAS_cod -stereo -dtx 48000 32 testv/ltv32_STEREO.wav bit
../IVAS_dec MONO 32 bit testv/ltv32_STEREO.wav_stereo_48000_32-32_DTX_MONO.tst
diff --git a/scripts/create_histogram_summary.py b/scripts/create_histogram_summary.py
new file mode 100644
index 0000000000000000000000000000000000000000..1ab951ac72af1f926a3a0bc7d5ba08bda781a9ef
--- /dev/null
+++ b/scripts/create_histogram_summary.py
@@ -0,0 +1,127 @@
+#!/usr/bin/env python3
+
+import argparse
+import math
+import numpy as np
+# These next three lines are added as a precaution in case the gitlab runner
+# needs DISPLAY to render the plots, even if they are written to file.
+import matplotlib
+matplotlib.use("Agg")
+import matplotlib.pyplot as plt
+import csv
+import os
+from parse_xml_report import FORMATS, CATEGORIES
+
+"""
+Parses a CSV report and creates a summary report.
+"""
+
+
+# Main routine
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(
+ description="Parses a CSV report and creates a summary report."
+ )
+ parser.add_argument(
+ "csv_report",
+ type=str,
+ help="CSV report file of test cases, e.g. report.csv",
+ )
+ parser.add_argument(
+ "csv_summary", type=str, help="Output CSV file, e.g. summary.csv"
+ )
+ parser.add_argument(
+ "csv_image",
+ type=str,
+ nargs="?",
+ help="Summary image file, e.g. summary.png",
+ default=None,
+ )
+ parser.add_argument(
+ "--measure",
+ type=str,
+ nargs=1,
+ help="Measure, any of: MLD, DIFF, SSNR, default: MLD",
+ default=["MLD"],
+ )
+ args = parser.parse_args()
+ csv_report = args.csv_report
+ csv_summary = args.csv_summary
+ csv_image = args.csv_image
+ measure = args.measure[0]
+
+ limits_per_measure = {
+ "MLD": ("MLD", [0, 5, 10, math.inf]),
+ "DIFF": ("MAXIMUM ABS DIFF", [0, 1024, 16384, 32769]),
+ "SSNR": ("MIN_SSNR", [-math.inf, 0, 20, 40, 60, 100]),
+ }
+ (measure_label, limits) = limits_per_measure[measure]
+
+ # Load CSV report
+ results_sorted = {}
+ with open(csv_report, "r") as fp:
+ reader = csv.reader(fp, delimiter=";")
+ header = next(reader)
+ keys = header[1:]
+ for row in reader:
+ testcase = row[0]
+ results_sorted[testcase] = {}
+ for k, val in zip(keys, row[1:]):
+ results_sorted[testcase][k] = val
+
+ # Output CSV file
+ with open(csv_summary, "w") as fp:
+ limits_labels = [
+ f"{str(a)} --\n {str(b)}" for (a, b) in zip(limits[0:-1], limits[1:])
+ ] + ["None"]
+ # Zero difference is treated as a special category for MLD and MAXIMUM ABS DIFF
+ if measure_label == "MLD" or measure_label == "MAXIMUM ABS DIFF":
+ limits_labels = ["0"] + limits_labels
+ headerline = f"Format;Category;" + ";".join(limits_labels) + "\n"
+ fp.write(headerline)
+
+ for fmt in FORMATS:
+ fig, ax = plt.subplots()
+ bottom = np.zeros(len(limits_labels))
+ for cat in CATEGORIES:
+ values = [
+ x
+ for x in [
+ m[measure_label]
+ for m in results_sorted.values()
+ if m["Format"] == fmt and m["Category"] == cat
+ ]
+ ]
+ # Zero difference is treated as a special category for MLD and MAXIMUM ABS DIFF
+ if measure_label == "MLD" or measure_label == "MAXIMUM ABS DIFF":
+ val = [
+ float(x) for x in values if x != "None" and x != "0" and x != ""
+ ]
+ zero = [sum([1 for x in values if x == "0"])]
+ none = [sum([1 for x in values if x == "None" or x == ""])]
+ else:
+ val = [float(x) for x in values if x != "None" and x != ""]
+ zero = []
+ none = [sum([1 for x in values if x == "None" or x == ""])]
+ hist, _ = np.histogram(val, limits)
+ data = np.array(zero + list(hist) + none)
+
+ # CSV output
+ line = f"{fmt};{cat};{'; '.join(map(str,data))}\n"
+ fp.write(line)
+
+ # Matplotlib histogram
+ ax.bar(limits_labels, data, 0.5, label=cat, bottom=bottom)
+ bottom += data
+
+ # Histogram layout
+ ax.set_title(fmt)
+ ax.legend(loc="best")
+ ax.set_xlabel(measure_label)
+ ax.set_ylabel("Number of test cases")
+
+ fig.set_figheight(4)
+ fig.set_figwidth(6)
+ if csv_image:
+ base, ext = os.path.splitext(csv_image)
+ plt.savefig(f"{base}_{fmt}{ext}")
diff --git a/scripts/dly_error_profiles/ep_5pct_burst.g192 b/scripts/dly_error_profiles/ep_5pct_burst.g192
new file mode 100644
index 0000000000000000000000000000000000000000..6c0655b3de98dd2cf45e67bd7d4985955bd2ad15
--- /dev/null
+++ b/scripts/dly_error_profiles/ep_5pct_burst.g192
@@ -0,0 +1 @@
+!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k k!k!k k!k!k
\ No newline at end of file
diff --git a/scripts/parse_xml_report.py b/scripts/parse_xml_report.py
index 4b61dc1a9499aa83fd72eb47b74e2e1ebde65566..3bc0b619ab19b9f9e97be55f0289797035c22ab5 100644
--- a/scripts/parse_xml_report.py
+++ b/scripts/parse_xml_report.py
@@ -12,33 +12,52 @@ Parse a junit report and create a summary report.
PROPERTIES = ["MLD", "MAXIMUM ABS DIFF", "MIN_SSNR"]
+FORMATS = {
+ "Stereo": r"stereo",
+ "ISM": r"ISM",
+ "Multichannel": r"Multi-channel",
+ "MASA": r"(?