History

avcodec/eac3dec: add detection of Atmos spatial extension profile

Marth64 committed 3 years ago

Commit a4e5b941 parent 814178f8 files · +23 −1Browse files

Unified · Split

8 files
  1. libavcodec/ac3dec.c +1 −0
  2. libavcodec/ac3dec.h +1 −0
  3. libavcodec/ac3dec_float.c +2 −0
  4. libavcodec/avcodec.h +2 −0
  5. libavcodec/codec_desc.c +1 −0
  6. libavcodec/eac3dec.c +10 −1
  7. libavcodec/profiles.c +5 −0
  8. libavcodec/profiles.h +1 −0
libavcodec/ac3dec.c+1−0
@@ -1714,6 +1714,7 @@ skip: · 1713 unmodified lines
1714 if (!err) {1714 if (!err) {
1715 avctx->sample_rate = s->sample_rate;1715 avctx->sample_rate = s->sample_rate;
1716 avctx->bit_rate = s->bit_rate + s->prev_bit_rate;1716 avctx->bit_rate = s->bit_rate + s->prev_bit_rate;
1717 avctx->profile = s->eac3_extension_type_a == 1 ? FF_PROFILE_EAC3_DDP_ATMOS : FF_PROFILE_UNKNOWN;
1717 }1718 }
1718 1719
1719 if (!avctx->sample_rate) {1720 if (!avctx->sample_rate) {
libavcodec/ac3dec.h+1−0
@@ -102,6 +102,7 @@ typedef struct AC3DecodeContext { · 101 unmodified lines
102 int eac3; ///< indicates if current frame is E-AC-3102 int eac3; ///< indicates if current frame is E-AC-3
103 int eac3_frame_dependent_found; ///< bitstream has E-AC-3 dependent frame(s)103 int eac3_frame_dependent_found; ///< bitstream has E-AC-3 dependent frame(s)
104 int eac3_subsbtreamid_found; ///< bitstream has E-AC-3 additional substream(s)104 int eac3_subsbtreamid_found; ///< bitstream has E-AC-3 additional substream(s)
105 int eac3_extension_type_a; ///< bitstream has E-AC-3 extension type A enabled frame(s)
105 int dolby_surround_mode; ///< dolby surround mode (dsurmod)106 int dolby_surround_mode; ///< dolby surround mode (dsurmod)
106 int dolby_surround_ex_mode; ///< dolby surround ex mode (dsurexmod)107 int dolby_surround_ex_mode; ///< dolby surround ex mode (dsurexmod)
107 int dolby_headphone_mode; ///< dolby headphone mode (dheadphonmod)108 int dolby_headphone_mode; ///< dolby headphone mode (dheadphonmod)
libavcodec/ac3dec_float.c+2−0
@@ -33,6 +33,7 @@ · 32 unmodified lines
33 33
34#include "ac3dec.h"34#include "ac3dec.h"
35#include "codec_internal.h"35#include "codec_internal.h"
36#include "profiles.h"
36#include "eac3dec.c"37#include "eac3dec.c"
37#include "ac3dec.c"38#include "ac3dec.c"
38 39
@@ -92,6 +93,7 @@ const FFCodec ff_eac3_decoder = { · 53 unmodified lines
92 .p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,93 .p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
93 AV_SAMPLE_FMT_NONE },94 AV_SAMPLE_FMT_NONE },
94 .p.priv_class = &ac3_eac3_decoder_class,95 .p.priv_class = &ac3_eac3_decoder_class,
96 .p.profiles = NULL_IF_CONFIG_SMALL(ff_eac3_profiles),
95 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,97 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
96};98};
97#endif99#endif
libavcodec/avcodec.h+2−0
@@ -1591,6 +1591,8 @@ typedef struct AVCodecContext { · 1590 unmodified lines
1591#define FF_PROFILE_DTS_HD_MA 601591#define FF_PROFILE_DTS_HD_MA 60
1592#define FF_PROFILE_DTS_EXPRESS 701592#define FF_PROFILE_DTS_EXPRESS 70
1593 1593
1594#define FF_PROFILE_EAC3_DDP_ATMOS 30
1595
1594#define FF_PROFILE_MPEG2_422 01596#define FF_PROFILE_MPEG2_422 0
1595#define FF_PROFILE_MPEG2_HIGH 11597#define FF_PROFILE_MPEG2_HIGH 1
1596#define FF_PROFILE_MPEG2_SS 21598#define FF_PROFILE_MPEG2_SS 2
libavcodec/codec_desc.c+1−0
@@ -2931,6 +2931,7 @@ static const AVCodecDescriptor codec_descriptors[] = { · 2930 unmodified lines
2931 .name = "eac3",2931 .name = "eac3",
2932 .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52B (AC-3, E-AC-3)"),2932 .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52B (AC-3, E-AC-3)"),
2933 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,2933 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
2934 .profiles = NULL_IF_CONFIG_SMALL(ff_eac3_profiles),
2934 },2935 },
2935 {2936 {
2936 .id = AV_CODEC_ID_SIPR,2937 .id = AV_CODEC_ID_SIPR,
libavcodec/eac3dec.c+10−1
@@ -464,7 +464,16 @@ static int ff_eac3_parse_header(AC3DecodeContext *s) · 463 unmodified lines
464 if (get_bits1(gbc)) {464 if (get_bits1(gbc)) {
465 int addbsil = get_bits(gbc, 6);465 int addbsil = get_bits(gbc, 6);
466 for (i = 0; i < addbsil + 1; i++) {466 for (i = 0; i < addbsil + 1; i++) {
467 skip_bits(gbc, 8); // skip additional bit stream info467 if (i == 0) {
468 /* In this 8 bit chunk, the LSB is equal to flag_ec3_extension_type_a
469 which can be used to detect Atmos presence */
470 skip_bits(gbc, 7);
471 if (get_bits1(gbc)) {
472 s->eac3_extension_type_a = 1;
473 }
474 } else {
475 skip_bits(gbc, 8); // skip additional bit stream info
476 }
468 }477 }
469 }478 }
470 479
libavcodec/profiles.c+5−0
@@ -45,6 +45,11 @@ const AVProfile ff_dca_profiles[] = { · 44 unmodified lines
45 { FF_PROFILE_UNKNOWN },45 { FF_PROFILE_UNKNOWN },
46};46};
47 47
48const AVProfile ff_eac3_profiles[] = {
49 { FF_PROFILE_EAC3_DDP_ATMOS, "Dolby Digital Plus + Dolby Atmos"},
50 { FF_PROFILE_UNKNOWN },
51};
52
48const AVProfile ff_dnxhd_profiles[] = {53const AVProfile ff_dnxhd_profiles[] = {
49 { FF_PROFILE_DNXHD, "DNXHD"},54 { FF_PROFILE_DNXHD, "DNXHD"},
50 { FF_PROFILE_DNXHR_LB, "DNXHR LB"},55 { FF_PROFILE_DNXHR_LB, "DNXHR LB"},
libavcodec/profiles.h+1−0
@@ -58,6 +58,7 @@ · 57 unmodified lines
58 58
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_dnxhd_profiles[];62extern const AVProfile ff_dnxhd_profiles[];
62extern const AVProfile ff_h264_profiles[];63extern const AVProfile ff_h264_profiles[];
63extern const AVProfile ff_hevc_profiles[];64extern 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