From ac57c201f6588b0e8a20592af5b23031bf6b6e1a Mon Sep 17 00:00:00 2001 From: Sai Vamsi Chunchula <100858@ittiam.com> Date: Tue, 5 Sep 2023 16:58:22 +0530 Subject: [PATCH] Support for LC Profile Level 4 - #49 Significance: ------------- - Initial version supporting LC profile level 4 decoding. - Build time switch `LC_LEVEL_4` has to be enabled to enable support for decoding profile level 4 MPEG-H streams - Default build has support till level 3 Testing: -------- - Conformance tested for both level 3 and level 4 builds --- decoder/ia_core_coder_cnst.h | 3 +++ decoder/ia_core_coder_config.h | 25 +++++++++++++++++++++++++ decoder/ia_core_coder_init_config.c | 17 ++++++++++++++++- decoder/impd_drc_common.h | 8 ++++++++ decoder/impeghd_hoa_dec_init.c | 13 +++++++++++-- decoder/impeghd_ver_number.h | 6 +++--- 6 files changed, 66 insertions(+), 6 deletions(-) diff --git a/decoder/ia_core_coder_cnst.h b/decoder/ia_core_coder_cnst.h index 7920879..5a9af68 100644 --- a/decoder/ia_core_coder_cnst.h +++ b/decoder/ia_core_coder_cnst.h @@ -171,6 +171,9 @@ #define MAX_NUM_CHANNELS_LVL1 5 #define MAX_NUM_CHANNELS_LVL2 9 #define MAX_NUM_CHANNELS_LVL3 16 +#ifdef LC_LEVEL_4 +#define MAX_NUM_CHANNELS_LVL4 (28) +#endif #define MAX_NUM_CHANNELS_USAC_LVL2 24 #define SFB_NUM_MAX ((NSFB_SHORT + 1) * MAX_SHORT_IN_LONG_BLOCK) diff --git a/decoder/ia_core_coder_config.h b/decoder/ia_core_coder_config.h index c2a78bc..20492bd 100644 --- a/decoder/ia_core_coder_config.h +++ b/decoder/ia_core_coder_config.h @@ -38,6 +38,15 @@ #include #define MAX_ELEMENTS_USAC (50) +#ifdef LC_LEVEL_4 +// The bit stream extracted value can be 32. +// Currently this is limited to 3 considering: +// Audio Channels, Objects and HOA Transport channels. +#define MAX_NUM_SIGNALGROUPS (28) +/* The multi‐channel coding tool (MCT) shall not employ + * more stereo boxes than 28 for LC profile lvl 4*/ +#define MAX_NUM_MC_BOXES (28) +#else // The bit stream extracted value can be 32. // Currently this is limited to 3 considering: // Audio Channels, Objects and HOA Transport channels. @@ -45,6 +54,7 @@ /*The multi‐channel coding tool (MCT) shall not employ * more stereo boxes than 16 for LC profile lvl 3*/ #define MAX_NUM_MC_BOXES (16) +#endif #define MAX_NUM_MC_BANDS (64) #define MAX_TIME_CHANNELS (MAX_NUM_CHANNELS) #define DEFAULT_BETA (48) /*equals 45 degrees */ @@ -114,9 +124,17 @@ #define MPEGH_PROFILE_BP_LVL_5 (0x14) #define MINIMUM_SUPPORTED_LC_PROFILE (MPEGH_PROFILE_LC_LVL_1) +#ifdef LC_LEVEL_4 +#define MAXIMUM_SUPPORTED_LC_PROFILE (MPEGH_PROFILE_LC_LVL_4) +#else #define MAXIMUM_SUPPORTED_LC_PROFILE (MPEGH_PROFILE_LC_LVL_3) +#endif #define MINIMUM_SUPPORTED_BP_PROFILE (MPEGH_PROFILE_BP_LVL_1) +#ifdef LC_LEVLE_4 +#define MAXIMUM_SUPPORTED_BP_PROFILE (MPEGH_PROFILE_BP_LVL_4) +#else #define MAXIMUM_SUPPORTED_BP_PROFILE (MPEGH_PROFILE_BP_LVL_3) +#endif typedef UWORD8 UINT8; typedef UWORD32 UINT32; @@ -217,8 +235,15 @@ typedef struct #define BS_MAX_NUM_OUT_CHANNELS (255) +#ifdef LC_LEVEL_4 +#define MAX_CHANNEL_COUNT (28) + +#define SEQUENCE_COUNT_MAX (48) +#else #define MAX_CHANNEL_COUNT (16) + #define SEQUENCE_COUNT_MAX (24) +#endif #define PARAM_DRC_TYPE_FF_NODE_COUNT_MAX (9) #define PARAM_DRC_INSTRUCTIONS_COUNT_MAX (8) #define DOWNMIX_ID_COUNT_MAX (8) diff --git a/decoder/ia_core_coder_init_config.c b/decoder/ia_core_coder_init_config.c index d3c320e..c32dbc1 100644 --- a/decoder/ia_core_coder_init_config.c +++ b/decoder/ia_core_coder_init_config.c @@ -1633,12 +1633,14 @@ IA_ERRORCODE ia_core_coder_mpegh_3da_config(ia_bit_buf_struct *it_bit_buff, mpeghd_state_struct->is_base_line_profile_3b = 1; } } - else if (compat_lc_lvl <= MPEGH_PROFILE_LC_LVL_3 && compat_lc_lvl >= MPEGH_PROFILE_LC_LVL_1) + else if ((compat_lc_lvl <= MAXIMUM_SUPPORTED_LC_PROFILE) && + (compat_lc_lvl >= MINIMUM_SUPPORTED_LC_PROFILE)) { mpeghd_state_struct->is_base_line_profile_3b = 0; mpegh_profile_lvl = compat_lc_lvl; } } + switch (mpegh_profile_lvl) { case MPEGH_PROFILE_LC_LVL_1: @@ -1666,6 +1668,19 @@ IA_ERRORCODE ia_core_coder_mpegh_3da_config(ia_bit_buf_struct *it_bit_buff, return IA_MPEGH_DEC_INIT_FATAL_STREAM_CHAN_GT_MAX; } break; +#ifdef LC_LEVEL_4 + case MPEGH_PROFILE_BP_LVL_4: + case MPEGH_PROFILE_LC_LVL_4: + if (dec_proc_core_chans > MAX_NUM_CHANNELS || ref_layout_chans > MAX_NUM_CHANNELS || + (dec_proc_core_chans > MAX_NUM_CHANNELS_LVL4 && + (num_hoa_based_grps != 0 || num_ch_based_grps != 0)) || + (ref_layout_chans > MAX_NUM_CHANNELS_LVL4 && + (num_hoa_based_grps != 0 || num_ch_based_grps != 0))) + { + return IA_MPEGH_DEC_INIT_FATAL_STREAM_CHAN_GT_MAX; + } + break; +#endif default: return IA_MPEGH_DEC_INIT_FATAL_UNSUPPORTED_MPEGH_PROFILE; break; diff --git a/decoder/impd_drc_common.h b/decoder/impd_drc_common.h index f0b2e8a..7ddda87 100644 --- a/decoder/impd_drc_common.h +++ b/decoder/impd_drc_common.h @@ -73,7 +73,11 @@ extern "C" { #define LOUDNESS_INFO_COUNT_MAX (DOWNMIX_INSTRUCTION_COUNT_MAX + 20) #define MAX_BS_BUF_SIZE 768 +#ifdef LC_LEVEL_4 +#define MAX_CHANNEL_COUNT (28) +#else #define MAX_CHANNEL_COUNT (16) +#endif #define MAX_GAIN_ELE_COUNT 15 #define MAX_LOUDNESS_INFO_COUNT (16) #define MAX_NUM_COMPRESSION_EQ (16) @@ -103,7 +107,11 @@ extern "C" { #define SELECTION_CANDIDATE_COUNT_MAX 32 #define SEL_DRC_COUNT (3) +#ifdef LC_LEVEL_4 +#define SEQUENCE_COUNT_MAX (48) +#else #define SEQUENCE_COUNT_MAX (24) +#endif #define SLOPE_FACTOR_DB_TO_LINEAR 0.1151f #define SPEAKER_POS_COUNT_MAX (8) #define SUB_DRC_COUNT 4 diff --git a/decoder/impeghd_hoa_dec_init.c b/decoder/impeghd_hoa_dec_init.c index 2298aec..3a291b1 100644 --- a/decoder/impeghd_hoa_dec_init.c +++ b/decoder/impeghd_hoa_dec_init.c @@ -496,14 +496,23 @@ IA_ERRORCODE impeghd_hoa_ren_input_init(pVOID handle, ia_speaker_config_3d *ref_ } else { - /*The near field compensation (NFC) processing may be applied to - HOA content of an order which is smaller or equal to 2 for LC +#ifdef LC_LEVEL_4 + /*The near field compensation (NFC) processing may be applied to + HOA content of an order which is smaller or equal to 3 for LC lvl 4, 2 for LC + lvl 3, 1 for LC lvl 2, not allowed for LC lvl 1*/ + if (((mpegh_profile_lvl == MPEGH_PROFILE_LC_LVL_4) && (order <= 3)) || + ((mpegh_profile_lvl == MPEGH_PROFILE_LC_LVL_3) && (order <= 2)) || + ((mpegh_profile_lvl == MPEGH_PROFILE_LC_LVL_2) && (order <= 1))) +#else + /*The near field compensation (NFC) processing may be applied to + HOA content of an order which is smaller or equal to 2 for LC lvl 3, 1 for LC lvl 2, not allowed for LC lvl 1*/ if (((mpegh_profile_lvl == MPEGH_PROFILE_LC_LVL_3) && (order <= 2)) || ((mpegh_profile_lvl == MPEGH_PROFILE_LC_LVL_2) && (order <= 1)) || ((mpegh_profile_lvl == MPEGH_PROFILE_BP_LVL_3) || (mpegh_profile_lvl == MPEGH_PROFILE_BP_LVL_2) || (mpegh_profile_lvl == MPEGH_PROFILE_BP_LVL_1))) +#endif { rh_handle->use_nfc = 1; err_code = impeghd_hoa_ren_nfc_init(rh_handle, order, f_nfc_radius, sampling_rate); diff --git a/decoder/impeghd_ver_number.h b/decoder/impeghd_ver_number.h index e4e086a..d451416 100644 --- a/decoder/impeghd_ver_number.h +++ b/decoder/impeghd_ver_number.h @@ -36,11 +36,11 @@ #define IMPEGHD_VER_NUMBER_H #ifdef _ARM_ -#define MPEG_H_3D_AUD_DEC_ITTIAM_VER "_ARM $Rev: 1.5 $" +#define MPEG_H_3D_AUD_DEC_ITTIAM_VER "_ARM $Rev: 1.6 $" #elif _X86_ -#define MPEG_H_3D_AUD_DEC_ITTIAM_VER "_X86 $Rev: 1.5 $" +#define MPEG_H_3D_AUD_DEC_ITTIAM_VER "_X86 $Rev: 1.6 $" #else -#define MPEG_H_3D_AUD_DEC_ITTIAM_VER "_MSVC $Rev: 1.5 $" +#define MPEG_H_3D_AUD_DEC_ITTIAM_VER "_MSVC $Rev: 1.6 $" #endif #endif /* IMPEGHD_VER_NUMBER_H */