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
1593 1593
1594#define FF_PROFILE_EAC3_DDP_ATMOS 301594#define FF_PROFILE_EAC3_DDP_ATMOS 30
1595 1595
1596#define FF_PROFILE_TRUEHD_ATMOS 30
1597
1596#define FF_PROFILE_MPEG2_422 01598#define FF_PROFILE_MPEG2_422 0
1597#define FF_PROFILE_MPEG2_HIGH 11599#define FF_PROFILE_MPEG2_HIGH 1
1598#define FF_PROFILE_MPEG2_SS 21600#define FF_PROFILE_MPEG2_SS 2
libavcodec/codec_desc.c+1−0
@@ -2960,6 +2960,7 @@ static const AVCodecDescriptor codec_descriptors[] = { · 2959 unmodified lines
2960 .name = "truehd",2960 .name = "truehd",
2961 .long_name = NULL_IF_CONFIG_SMALL("TrueHD"),2961 .long_name = NULL_IF_CONFIG_SMALL("TrueHD"),
2962 .props = AV_CODEC_PROP_LOSSLESS,2962 .props = AV_CODEC_PROP_LOSSLESS,
2963 .profiles = NULL_IF_CONFIG_SMALL(ff_truehd_profiles),
2963 },2964 },
2964 {2965 {
2965 .id = AV_CODEC_ID_MP4ALS,2966 .id = AV_CODEC_ID_MP4ALS,
libavcodec/mlpdec.c+10−0
@@ -42,6 +42,7 @@ · 41 unmodified lines
42#include "mlpdsp.h"42#include "mlpdsp.h"
43#include "mlp.h"43#include "mlp.h"
44#include "config.h"44#include "config.h"
45#include "profiles.h"
45 46
46/** number of bits used for VLC lookup - longest Huffman code is 9 */47/** number of bits used for VLC lookup - longest Huffman code is 9 */
47#if ARCH_ARM48#if ARCH_ARM
@@ -392,6 +393,14 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb) · 344 unmodified lines
392 m->num_substreams = mh.num_substreams;393 m->num_substreams = mh.num_substreams;
393 m->substream_info = mh.substream_info;394 m->substream_info = mh.substream_info;
394 395
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
395 /* limit to decoding 3 substreams, as the 4th is used by Dolby Atmos for non-audio data */404 /* limit to decoding 3 substreams, as the 4th is used by Dolby Atmos for non-audio data */
396 m->max_decoded_substream = FFMIN(m->num_substreams - 1, 2);405 m->max_decoded_substream = FFMIN(m->num_substreams - 1, 2);
397 406
@@ -1452,5 +1461,6 @@ const FFCodec ff_truehd_decoder = { · 1054 unmodified lines
1452 FF_CODEC_DECODE_CB(read_access_unit),1461 FF_CODEC_DECODE_CB(read_access_unit),
1453 .flush = mlp_decode_flush,1462 .flush = mlp_decode_flush,
1454 .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,1463 .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
1464 .p.profiles = NULL_IF_CONFIG_SMALL(ff_truehd_profiles),
1455};1465};
1456#endif /* CONFIG_TRUEHD_DECODER */1466#endif /* CONFIG_TRUEHD_DECODER */
libavcodec/profiles.c+5−0
@@ -50,6 +50,11 @@ const AVProfile ff_eac3_profiles[] = { · 49 unmodified lines
50 { FF_PROFILE_UNKNOWN },50 { FF_PROFILE_UNKNOWN },
51};51};
52 52
53const AVProfile ff_truehd_profiles[] = {
54 { FF_PROFILE_TRUEHD_ATMOS, "Dolby TrueHD + Dolby Atmos"},
55 { FF_PROFILE_UNKNOWN },
56};
57
53const AVProfile ff_dnxhd_profiles[] = {58const AVProfile ff_dnxhd_profiles[] = {
54 { FF_PROFILE_DNXHD, "DNXHD"},59 { FF_PROFILE_DNXHD, "DNXHD"},
55 { FF_PROFILE_DNXHR_LB, "DNXHR LB"},60 { FF_PROFILE_DNXHR_LB, "DNXHR LB"},
libavcodec/profiles.h+1−0
@@ -59,6 +59,7 @@ · 58 unmodified lines
59extern const AVProfile ff_aac_profiles[];59extern const AVProfile ff_aac_profiles[];
60extern const AVProfile ff_dca_profiles[];60extern const AVProfile ff_dca_profiles[];
61extern const AVProfile ff_eac3_profiles[];61extern const AVProfile ff_eac3_profiles[];
62extern const AVProfile ff_truehd_profiles[];
62extern const AVProfile ff_dnxhd_profiles[];63extern const AVProfile ff_dnxhd_profiles[];
63extern const AVProfile ff_h264_profiles[];64extern const AVProfile ff_h264_profiles[];
64extern const AVProfile ff_hevc_profiles[];65extern 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