History

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

Marth64 committed 3 years ago

Commit 96ed0431 parent a4e5b945 files · +19 −0Browse files

Unified · Split

5 files
  1. libavcodec/avcodec.h +2 −0
  2. libavcodec/codec_desc.c +1 −0
  3. libavcodec/mlpdec.c +10 −0
  4. libavcodec/profiles.c +5 −0
  5. libavcodec/profiles.h +1 −0
libavcodec/avcodec.h+2−0
@@ -1593,6 +1593,8 @@ typedef struct AVCodecContext { · 1592 unmodified lines
15931593
15941594 #define FF_PROFILE_EAC3_DDP_ATMOS 30
15951595
1596+#define FF_PROFILE_TRUEHD_ATMOS 30
1597+
15961598 #define FF_PROFILE_MPEG2_422 0
15971599 #define FF_PROFILE_MPEG2_HIGH 1
15981600 #define FF_PROFILE_MPEG2_SS 2
libavcodec/codec_desc.c+1−0
@@ -2960,6 +2960,7 @@ static const AVCodecDescriptor codec_descriptors[] = { · 2959 unmodified lines
29602960 .name = "truehd",
29612961 .long_name = NULL_IF_CONFIG_SMALL("TrueHD"),
29622962 .props = AV_CODEC_PROP_LOSSLESS,
2963+ .profiles = NULL_IF_CONFIG_SMALL(ff_truehd_profiles),
29632964 },
29642965 {
29652966 .id = AV_CODEC_ID_MP4ALS,
libavcodec/mlpdec.c+10−0
@@ -42,6 +42,7 @@ · 41 unmodified lines
4242 #include "mlpdsp.h"
4343 #include "mlp.h"
4444 #include "config.h"
45+#include "profiles.h"
4546
4647 /** number of bits used for VLC lookup - longest Huffman code is 9 */
4748 #if ARCH_ARM
@@ -392,6 +393,14 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb) · 344 unmodified lines
392393 m->num_substreams = mh.num_substreams;
393394 m->substream_info = mh.substream_info;
394395
396+ /* If there is a 4th substream and the MSB of substream_info is set,
397+ * there is a 16-channel spatial presentation (Atmos in TrueHD).
398+ */
399+ if (m->avctx->codec_id == AV_CODEC_ID_TRUEHD
400+ && m->num_substreams == 4 && m->substream_info >> 7 == 1) {
401+ m->avctx->profile = FF_PROFILE_TRUEHD_ATMOS;
402+ }
403+
395404 /* limit to decoding 3 substreams, as the 4th is used by Dolby Atmos for non-audio data */
396405 m->max_decoded_substream = FFMIN(m->num_substreams - 1, 2);
397406
@@ -1452,5 +1461,6 @@ const FFCodec ff_truehd_decoder = { · 1054 unmodified lines
14521461 FF_CODEC_DECODE_CB(read_access_unit),
14531462 .flush = mlp_decode_flush,
14541463 .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
1464+ .p.profiles = NULL_IF_CONFIG_SMALL(ff_truehd_profiles),
14551465 };
14561466 #endif /* CONFIG_TRUEHD_DECODER */
libavcodec/profiles.c+5−0
@@ -50,6 +50,11 @@ const AVProfile ff_eac3_profiles[] = { · 49 unmodified lines
5050 { FF_PROFILE_UNKNOWN },
5151 };
5252
53+const AVProfile ff_truehd_profiles[] = {
54+ { FF_PROFILE_TRUEHD_ATMOS, "Dolby TrueHD + Dolby Atmos"},
55+ { FF_PROFILE_UNKNOWN },
56+};
57+
5358 const AVProfile ff_dnxhd_profiles[] = {
5459 { FF_PROFILE_DNXHD, "DNXHD"},
5560 { FF_PROFILE_DNXHR_LB, "DNXHR LB"},
libavcodec/profiles.h+1−0
@@ -59,6 +59,7 @@ · 58 unmodified lines
5959 extern const AVProfile ff_aac_profiles[];
6060 extern const AVProfile ff_dca_profiles[];
6161 extern const AVProfile ff_eac3_profiles[];
62+extern const AVProfile ff_truehd_profiles[];
6263 extern const AVProfile ff_dnxhd_profiles[];
6364 extern const AVProfile ff_h264_profiles[];
6465 extern const AVProfile ff_hevc_profiles[];

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t