avcodec/mlpdec: add detection of Atmos spatial extension profile in TrueHD

Signed-off-by: Marth64 <marth64@proxyid.net>
pull/389/head
Marth64 2 years ago committed by Hendrik Leppkes
parent a4e5b94633
commit 96ed043afa
No known key found for this signature in database
GPG Key ID: 846079A4B0A7C1B5
  1. 2
      libavcodec/avcodec.h
  2. 1
      libavcodec/codec_desc.c
  3. 10
      libavcodec/mlpdec.c
  4. 5
      libavcodec/profiles.c
  5. 1
      libavcodec/profiles.h

@ -1593,6 +1593,8 @@ typedef struct AVCodecContext {
#define FF_PROFILE_EAC3_DDP_ATMOS 30 #define FF_PROFILE_EAC3_DDP_ATMOS 30
#define FF_PROFILE_TRUEHD_ATMOS 30
#define FF_PROFILE_MPEG2_422 0 #define FF_PROFILE_MPEG2_422 0
#define FF_PROFILE_MPEG2_HIGH 1 #define FF_PROFILE_MPEG2_HIGH 1
#define FF_PROFILE_MPEG2_SS 2 #define FF_PROFILE_MPEG2_SS 2

@ -2960,6 +2960,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.name = "truehd", .name = "truehd",
.long_name = NULL_IF_CONFIG_SMALL("TrueHD"), .long_name = NULL_IF_CONFIG_SMALL("TrueHD"),
.props = AV_CODEC_PROP_LOSSLESS, .props = AV_CODEC_PROP_LOSSLESS,
.profiles = NULL_IF_CONFIG_SMALL(ff_truehd_profiles),
}, },
{ {
.id = AV_CODEC_ID_MP4ALS, .id = AV_CODEC_ID_MP4ALS,

@ -42,6 +42,7 @@
#include "mlpdsp.h" #include "mlpdsp.h"
#include "mlp.h" #include "mlp.h"
#include "config.h" #include "config.h"
#include "profiles.h"
/** number of bits used for VLC lookup - longest Huffman code is 9 */ /** number of bits used for VLC lookup - longest Huffman code is 9 */
#if ARCH_ARM #if ARCH_ARM
@ -392,6 +393,14 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
m->num_substreams = mh.num_substreams; m->num_substreams = mh.num_substreams;
m->substream_info = mh.substream_info; m->substream_info = mh.substream_info;
/* If there is a 4th substream and the MSB of substream_info is set,
* there is a 16-channel spatial presentation (Atmos in TrueHD).
*/
if (m->avctx->codec_id == AV_CODEC_ID_TRUEHD
&& m->num_substreams == 4 && m->substream_info >> 7 == 1) {
m->avctx->profile = FF_PROFILE_TRUEHD_ATMOS;
}
/* limit to decoding 3 substreams, as the 4th is used by Dolby Atmos for non-audio data */ /* limit to decoding 3 substreams, as the 4th is used by Dolby Atmos for non-audio data */
m->max_decoded_substream = FFMIN(m->num_substreams - 1, 2); m->max_decoded_substream = FFMIN(m->num_substreams - 1, 2);
@ -1452,5 +1461,6 @@ const FFCodec ff_truehd_decoder = {
FF_CODEC_DECODE_CB(read_access_unit), FF_CODEC_DECODE_CB(read_access_unit),
.flush = mlp_decode_flush, .flush = mlp_decode_flush,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF, .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
.p.profiles = NULL_IF_CONFIG_SMALL(ff_truehd_profiles),
}; };
#endif /* CONFIG_TRUEHD_DECODER */ #endif /* CONFIG_TRUEHD_DECODER */

@ -50,6 +50,11 @@ const AVProfile ff_eac3_profiles[] = {
{ FF_PROFILE_UNKNOWN }, { FF_PROFILE_UNKNOWN },
}; };
const AVProfile ff_truehd_profiles[] = {
{ FF_PROFILE_TRUEHD_ATMOS, "Dolby TrueHD + Dolby Atmos"},
{ FF_PROFILE_UNKNOWN },
};
const AVProfile ff_dnxhd_profiles[] = { const AVProfile ff_dnxhd_profiles[] = {
{ FF_PROFILE_DNXHD, "DNXHD"}, { FF_PROFILE_DNXHD, "DNXHD"},
{ FF_PROFILE_DNXHR_LB, "DNXHR LB"}, { FF_PROFILE_DNXHR_LB, "DNXHR LB"},

@ -59,6 +59,7 @@
extern const AVProfile ff_aac_profiles[]; extern const AVProfile ff_aac_profiles[];
extern const AVProfile ff_dca_profiles[]; extern const AVProfile ff_dca_profiles[];
extern const AVProfile ff_eac3_profiles[]; extern const AVProfile ff_eac3_profiles[];
extern const AVProfile ff_truehd_profiles[];
extern const AVProfile ff_dnxhd_profiles[]; extern const AVProfile ff_dnxhd_profiles[];
extern const AVProfile ff_h264_profiles[]; extern const AVProfile ff_h264_profiles[];
extern const AVProfile ff_hevc_profiles[]; extern const AVProfile ff_hevc_profiles[];

Loading…
Cancel
Save