Skip to content

Commit

Permalink
Support for LC Profile Level 4 - #49
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Sai Vamsi Chunchula authored and SakethSathuvalli committed Jun 12, 2024
1 parent 8310c88 commit ac57c20
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 6 deletions.
3 changes: 3 additions & 0 deletions decoder/ia_core_coder_cnst.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
25 changes: 25 additions & 0 deletions decoder/ia_core_coder_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,23 @@
#include <impeghd_type_def.h>

#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.
#define MAX_NUM_SIGNALGROUPS (16)
/*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 */
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
17 changes: 16 additions & 1 deletion decoder/ia_core_coder_init_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions decoder/impd_drc_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions decoder/impeghd_hoa_dec_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions decoder/impeghd_ver_number.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit ac57c20

Please sign in to comment.