ittiam-systems / libmpegh

MPEG-H 3D Audio Low Complexity Profile Decoder. Encoder: https://github.com/ittiam-systems/libmpeghe Contact: mob-audio@ittiam.com
http://www.ittiam.com/
BSD 3-Clause Clear License
88 stars 18 forks source link

Full support for MPEGH_PROFILE_LC_LVL_4 #49

Closed amiartus closed 5 months ago

amiartus commented 1 year ago

Hello,

Amazonmusic has "ultra" quality providing mpegh streams with MPEGH_PROFILE_LC_LVL_4 which is not fully supported (limited by channel count) with libmpegh at the moment.

Since this service is quite popular I would like to ask whether support for this profile and level is planned for future.

An example of such stream is Piano Man by Billy Joe on Amazon music

thanks!

Adam

christof-fersch commented 1 year ago

Hi Adam,

There is a minor difference in the MPEG-H LC Profile if you are comparing 23008-3:2019 with the latest version 23008-3:2022 (3rd Edition). With the introduction of the Baseline profile, it has been specified that LC Profile Level 3 also includes support for Baseline Profile Level 3, which also supports a "Max. number of decoder processed core channels" of 24 (under additional complexity restrictions):

The baseline profile is a subset of the low-complexity profile. If a decoder implementation supports decoding of low complexity profile level 3 bitstreams and supports the configuration extension CompatibleProfileLevelSet(), then the decoder shall support decoding of bitstreams encoded according to the baseline profile level 3. Bitstreams complying to the baseline profile may be signalled using: — the mpegh3daProfileLevelIndication field set to indicate baseline profile as specified in Table 67, or alternatively, — the mpegh3daProfileLevelIndication field set to indicate low complexity profile as specified in Table 67 and the CompatibleProfileLevelSet configuration extension for indicating compatibility to baseline profile, as described in Annex P;

Please also see Table P.1 — Value of mpegh3daProfileLevelIndication and CompatibleSetIndication. This indicates the following:

Level mpegh3daProfileLevelIndication CompatibleSetIndication

... Baseline level 3a | 0x0D (LC level 3) | 0x12 (Baseline level 3) Baseline level 3b | 0x0E (LC level 4) | 0x12 (Baseline level 3)

Therefore, it might very well be that Amazon Music is using MPEG-H LC Level 4 for their streams as primary level, but that they are using the "CompatibleProfileLevelSet()" syntax to signal compatibility to Baseline Profile Level 3. Can you check for that? Are you aware of streams using more than 24 "decoder processed core channels"?

The decoder published in this GitHub supports both, MPEG-H LC Level 3 and MPEG-H Baseline Level 3.

Thanks! //Christof

amiartus commented 1 year ago

Hi Christof,

thank you for your insightful comment.

Based on my understanding if LC4 is used by stream, this check in decoder/ia_core_coder_init_config.c will fail:

   if (dec_proc_core_chans > MAX_NUM_CHANNELS_LVL3 || ref_layout_chans > MAX_NUM_CHANNELS_LVL3)
    {
      return IA_MPEGH_DEC_INIT_FATAL_STREAM_CHAN_GT_MAX;
    }

because

decoder/ia_core_coder_cnst.h:#define MAX_NUM_CHANNELS_LVL3 16

Hence why we were not able to decode the stream.

If I understand your comment correctly libmpegh may in case of LC4 and CompatibleProfileLevelSet() flag revert to BP3 and in that case in code check vs MAX_NUM_CHANNELS(24) will be used instead and the stream may potentially play.

  case MPEGH_PROFILE_LC_LVL_3:
    if (dec_proc_core_chans > MAX_NUM_CHANNELS || ref_layout_chans > MAX_NUM_CHANNELS ||

However since this is decoder internals I assume the patch would have to be done to the libmpegh as AFAIK there is no way to produce this behavior just by using the decoder API.

Adam

christof-fersch commented 1 year ago

Hi Adam,

You are right. I didn't check what the code does, but from the description it should be supporting that scenario:

State-of-the-art MPEG-H 3D Audio Low Complexity Profile decoders according to ISO/IEC 23008-3:2019/AMD 2:2020 also support the MPEG-H 3D Audio Baseline Profile, which is a subset of the MPEG-H 3D Audio Low Complexity Profile.

Have you been able to check the streams you are using and if they are in fact using the signalling as described?

Independent from that, I think the check should be changed according to what's standardised in AMD 2:2020 or the 23008-3:2022 version accordingly.

Thanks, //Christof

amiartus commented 1 year ago

Hi @christof-fersch, @SakethSathuvalli,

we tested decoding mpegh stream file from Amazon with "ultra" quality.

libmpegh currently does not implement CompatibleProfileLevelSet parsing and support in mp4 ext box or in decoder config as described in 2022 version of the standard.

The Amazon ultra streams that I tested do not use MHAProfileAndLevelCompatibilitySetBox or CompatibleProfileLevelSet in the mpegh3daConfigExtension. This leads me to believe even if the compatibility flag could be used, some ultra streams may not be able to be played, unless full LC LVL 4 support is implemented.

We were able to play and listen to at least one "ultra" stream when patching libmpegh to force decoding in LC LVL 3 mode.

Amazon streaming is a major use case, @SakethSathuvalli, are there any plans for implementing full LC LVL 4 decoding and the CompatibleProfileLevelSet as described by the 2022 standard?

Best Regards, Adam

SakethSathuvalli commented 1 year ago

Hi @miartad,

We will be adding this support in decoder config in a week's time. Thanks for your patience!

Best Regards, Saketh

SakethSathuvalli commented 1 year ago

Hi @adminitis,

Support for CompatibleProfileLevelSet landed on main branch today. Regarding Low complexity profile level 4, work is currently under progress. Support will be added in a few weeks.

Thanks, Saketh

bluewidy commented 1 year ago

It looks like it is still not decoding profile level 4.

bluewidy commented 1 year ago

https://github.com/Fraunhofer-IIS/mpeghdec This program supports decoding for profile level 4 and is open source. So you can refer to this.

SonMaxime commented 1 year ago

https://github.com/Fraunhofer-IIS/mpeghdec This program supports decoding for profile level 4 and is open source. So you can refer to this.

Only with LC@L4/BL@L3 files unfortunately.

benjamin-weiss commented 6 months ago

@SakethSathuvalli I've seen you have been working on this recently. What are your plans on merging this to main?

SakethSathuvalli commented 6 months ago

@SakethSathuvalli I've seen you have been working on this recently. What are your plans on merging this to main?

The changes are expected to be available on main branch - in the same form (enhancements maintained under build time switch) - by early June.

Thanks!

SakethSathuvalli commented 5 months ago

Initial version available on main branch. Note: The default build has support only till profile level 3, in order to enable support for profile level 4 the build switch LC_LEVEL_4 has to be enabled.

Thanks!