* [FFmpeg-devel] [PATCH v2 2/4] avcodec/mlpdec: add detection of Atmos spatial extension profile in TrueHD
[not found] <306724>
@ 2023-02-18 17:24 ` Marth64
0 siblings, 0 replies; 4+ messages in thread
From: Marth64 @ 2023-02-18 17:24 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marth64
Signed-off-by: Marth64 <marth64@proxyid.net>
---
Tidied up formatting in mlpdec.c
libavcodec/avcodec.h | 2 ++
libavcodec/codec_desc.c | 1 +
libavcodec/mlpdec.c | 10 ++++++++++
libavcodec/profiles.c | 5 +++++
libavcodec/profiles.h | 1 +
5 files changed, 19 insertions(+)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 0e85dd50a4..3feab75741 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1593,6 +1593,8 @@ typedef struct AVCodecContext {
#define FF_PROFILE_EAC3_DDP_ATMOS 30
+#define FF_PROFILE_TRUEHD_ATMOS 30
+
#define FF_PROFILE_MPEG2_422 0
#define FF_PROFILE_MPEG2_HIGH 1
#define FF_PROFILE_MPEG2_SS 2
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 4098d4f5a5..e80ac07700 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -2960,6 +2960,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.name = "truehd",
.long_name = NULL_IF_CONFIG_SMALL("TrueHD"),
.props = AV_CODEC_PROP_LOSSLESS,
+ .profiles = NULL_IF_CONFIG_SMALL(ff_truehd_profiles),
},
{
.id = AV_CODEC_ID_MP4ALS,
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index 0ee1f0982c..966ee0f0a2 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -42,6 +42,7 @@
#include "mlpdsp.h"
#include "mlp.h"
#include "config.h"
+#include "profiles.h"
/** number of bits used for VLC lookup - longest Huffman code is 9 */
#if ARCH_ARM
@@ -392,6 +393,14 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
m->num_substreams = mh.num_substreams;
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 */
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),
.flush = mlp_decode_flush,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
+ .p.profiles = NULL_IF_CONFIG_SMALL(ff_truehd_profiles),
};
#endif /* CONFIG_TRUEHD_DECODER */
diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c
index 343b08f363..5bd91d9c5c 100644
--- a/libavcodec/profiles.c
+++ b/libavcodec/profiles.c
@@ -50,6 +50,11 @@ const AVProfile ff_eac3_profiles[] = {
{ FF_PROFILE_UNKNOWN },
};
+const AVProfile ff_truehd_profiles[] = {
+ { FF_PROFILE_TRUEHD_ATMOS, "Dolby TrueHD + Dolby Atmos"},
+ { FF_PROFILE_UNKNOWN },
+};
+
const AVProfile ff_dnxhd_profiles[] = {
{ FF_PROFILE_DNXHD, "DNXHD"},
{ FF_PROFILE_DNXHR_LB, "DNXHR LB"},
diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
index 6ebedbd03f..1d523992fc 100644
--- a/libavcodec/profiles.h
+++ b/libavcodec/profiles.h
@@ -59,6 +59,7 @@
extern const AVProfile ff_aac_profiles[];
extern const AVProfile ff_dca_profiles[];
extern const AVProfile ff_eac3_profiles[];
+extern const AVProfile ff_truehd_profiles[];
extern const AVProfile ff_dnxhd_profiles[];
extern const AVProfile ff_h264_profiles[];
extern const AVProfile ff_hevc_profiles[];
--
2.25.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 2/4] avcodec/mlpdec: add detection of Atmos spatial extension profile in TrueHD
2023-02-18 16:50 ` Hendrik Leppkes
@ 2023-02-18 17:22 ` Marth64
0 siblings, 0 replies; 4+ messages in thread
From: Marth64 @ 2023-02-18 17:22 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Good nit. Fix on the way,
On Sat, Feb 18, 2023 at 10:50 AM Hendrik Leppkes <h.leppkes@gmail.com>
wrote:
> On Sat, Feb 18, 2023 at 2:15 AM Marth64 <marth64@proxyid.net> wrote:
> >
> > Signed-off-by: Marth64 <marth64@proxyid.net>
> > ---
> > libavcodec/avcodec.h | 2 ++
> > libavcodec/codec_desc.c | 1 +
> > libavcodec/mlpdec.c | 11 +++++++++++
> > libavcodec/profiles.c | 5 +++++
> > libavcodec/profiles.h | 1 +
> > 5 files changed, 20 insertions(+)
> >
> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > index 0e85dd50a4..3feab75741 100644
> > --- a/libavcodec/avcodec.h
> > +++ b/libavcodec/avcodec.h
> > @@ -1593,6 +1593,8 @@ typedef struct AVCodecContext {
> >
> > #define FF_PROFILE_EAC3_DDP_ATMOS 30
> >
> > +#define FF_PROFILE_TRUEHD_ATMOS 30
> > +
> > #define FF_PROFILE_MPEG2_422 0
> > #define FF_PROFILE_MPEG2_HIGH 1
> > #define FF_PROFILE_MPEG2_SS 2
> > diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
> > index 4098d4f5a5..e80ac07700 100644
> > --- a/libavcodec/codec_desc.c
> > +++ b/libavcodec/codec_desc.c
> > @@ -2960,6 +2960,7 @@ static const AVCodecDescriptor codec_descriptors[]
> = {
> > .name = "truehd",
> > .long_name = NULL_IF_CONFIG_SMALL("TrueHD"),
> > .props = AV_CODEC_PROP_LOSSLESS,
> > + .profiles = NULL_IF_CONFIG_SMALL(ff_truehd_profiles),
> > },
> > {
> > .id = AV_CODEC_ID_MP4ALS,
> > diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
> > index 0ee1f0982c..85d6207b9c 100644
> > --- a/libavcodec/mlpdec.c
> > +++ b/libavcodec/mlpdec.c
> > @@ -42,6 +42,7 @@
> > #include "mlpdsp.h"
> > #include "mlp.h"
> > #include "config.h"
> > +#include "profiles.h"
> >
> > /** number of bits used for VLC lookup - longest Huffman code is 9 */
> > #if ARCH_ARM
> > @@ -392,6 +393,15 @@ static int read_major_sync(MLPDecodeContext *m,
> GetBitContext *gb)
> > m->num_substreams = mh.num_substreams;
> > 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;
> > + }
> > +
>
> Nit: maybe put the if into two lines instead of three? The two
> substream checks look like they should fit in one line quite well. But
> this is just a style question, so feel free to ignore.
>
> Otherwise LGTM
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 2/4] avcodec/mlpdec: add detection of Atmos spatial extension profile in TrueHD
2023-02-18 1:14 ` [FFmpeg-devel] [PATCH v2 2/4] avcodec/mlpdec: add detection of Atmos spatial extension profile in TrueHD Marth64
@ 2023-02-18 16:50 ` Hendrik Leppkes
2023-02-18 17:22 ` Marth64
0 siblings, 1 reply; 4+ messages in thread
From: Hendrik Leppkes @ 2023-02-18 16:50 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Sat, Feb 18, 2023 at 2:15 AM Marth64 <marth64@proxyid.net> wrote:
>
> Signed-off-by: Marth64 <marth64@proxyid.net>
> ---
> libavcodec/avcodec.h | 2 ++
> libavcodec/codec_desc.c | 1 +
> libavcodec/mlpdec.c | 11 +++++++++++
> libavcodec/profiles.c | 5 +++++
> libavcodec/profiles.h | 1 +
> 5 files changed, 20 insertions(+)
>
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 0e85dd50a4..3feab75741 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -1593,6 +1593,8 @@ typedef struct AVCodecContext {
>
> #define FF_PROFILE_EAC3_DDP_ATMOS 30
>
> +#define FF_PROFILE_TRUEHD_ATMOS 30
> +
> #define FF_PROFILE_MPEG2_422 0
> #define FF_PROFILE_MPEG2_HIGH 1
> #define FF_PROFILE_MPEG2_SS 2
> diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
> index 4098d4f5a5..e80ac07700 100644
> --- a/libavcodec/codec_desc.c
> +++ b/libavcodec/codec_desc.c
> @@ -2960,6 +2960,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
> .name = "truehd",
> .long_name = NULL_IF_CONFIG_SMALL("TrueHD"),
> .props = AV_CODEC_PROP_LOSSLESS,
> + .profiles = NULL_IF_CONFIG_SMALL(ff_truehd_profiles),
> },
> {
> .id = AV_CODEC_ID_MP4ALS,
> diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
> index 0ee1f0982c..85d6207b9c 100644
> --- a/libavcodec/mlpdec.c
> +++ b/libavcodec/mlpdec.c
> @@ -42,6 +42,7 @@
> #include "mlpdsp.h"
> #include "mlp.h"
> #include "config.h"
> +#include "profiles.h"
>
> /** number of bits used for VLC lookup - longest Huffman code is 9 */
> #if ARCH_ARM
> @@ -392,6 +393,15 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
> m->num_substreams = mh.num_substreams;
> 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;
> + }
> +
Nit: maybe put the if into two lines instead of three? The two
substream checks look like they should fit in one line quite well. But
this is just a style question, so feel free to ignore.
Otherwise LGTM
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* [FFmpeg-devel] [PATCH v2 2/4] avcodec/mlpdec: add detection of Atmos spatial extension profile in TrueHD
2023-02-18 1:14 ` [FFmpeg-devel] [PATCH v2 1/4] avcodec/eac3dec: add detection of Atmos spatial extension profile Marth64
@ 2023-02-18 1:14 ` Marth64
2023-02-18 16:50 ` Hendrik Leppkes
0 siblings, 1 reply; 4+ messages in thread
From: Marth64 @ 2023-02-18 1:14 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marth64
Signed-off-by: Marth64 <marth64@proxyid.net>
---
libavcodec/avcodec.h | 2 ++
libavcodec/codec_desc.c | 1 +
libavcodec/mlpdec.c | 11 +++++++++++
libavcodec/profiles.c | 5 +++++
libavcodec/profiles.h | 1 +
5 files changed, 20 insertions(+)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 0e85dd50a4..3feab75741 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1593,6 +1593,8 @@ typedef struct AVCodecContext {
#define FF_PROFILE_EAC3_DDP_ATMOS 30
+#define FF_PROFILE_TRUEHD_ATMOS 30
+
#define FF_PROFILE_MPEG2_422 0
#define FF_PROFILE_MPEG2_HIGH 1
#define FF_PROFILE_MPEG2_SS 2
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 4098d4f5a5..e80ac07700 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -2960,6 +2960,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.name = "truehd",
.long_name = NULL_IF_CONFIG_SMALL("TrueHD"),
.props = AV_CODEC_PROP_LOSSLESS,
+ .profiles = NULL_IF_CONFIG_SMALL(ff_truehd_profiles),
},
{
.id = AV_CODEC_ID_MP4ALS,
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index 0ee1f0982c..85d6207b9c 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -42,6 +42,7 @@
#include "mlpdsp.h"
#include "mlp.h"
#include "config.h"
+#include "profiles.h"
/** number of bits used for VLC lookup - longest Huffman code is 9 */
#if ARCH_ARM
@@ -392,6 +393,15 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
m->num_substreams = mh.num_substreams;
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 */
m->max_decoded_substream = FFMIN(m->num_substreams - 1, 2);
@@ -1452,5 +1462,6 @@ const FFCodec ff_truehd_decoder = {
FF_CODEC_DECODE_CB(read_access_unit),
.flush = mlp_decode_flush,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
+ .p.profiles = NULL_IF_CONFIG_SMALL(ff_truehd_profiles),
};
#endif /* CONFIG_TRUEHD_DECODER */
diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c
index 343b08f363..5bd91d9c5c 100644
--- a/libavcodec/profiles.c
+++ b/libavcodec/profiles.c
@@ -50,6 +50,11 @@ const AVProfile ff_eac3_profiles[] = {
{ FF_PROFILE_UNKNOWN },
};
+const AVProfile ff_truehd_profiles[] = {
+ { FF_PROFILE_TRUEHD_ATMOS, "Dolby TrueHD + Dolby Atmos"},
+ { FF_PROFILE_UNKNOWN },
+};
+
const AVProfile ff_dnxhd_profiles[] = {
{ FF_PROFILE_DNXHD, "DNXHD"},
{ FF_PROFILE_DNXHR_LB, "DNXHR LB"},
diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
index 6ebedbd03f..1d523992fc 100644
--- a/libavcodec/profiles.h
+++ b/libavcodec/profiles.h
@@ -59,6 +59,7 @@
extern const AVProfile ff_aac_profiles[];
extern const AVProfile ff_dca_profiles[];
extern const AVProfile ff_eac3_profiles[];
+extern const AVProfile ff_truehd_profiles[];
extern const AVProfile ff_dnxhd_profiles[];
extern const AVProfile ff_h264_profiles[];
extern const AVProfile ff_hevc_profiles[];
--
2.25.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-18 17:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <306724>
2023-02-18 17:24 ` [FFmpeg-devel] [PATCH v2 2/4] avcodec/mlpdec: add detection of Atmos spatial extension profile in TrueHD Marth64
[not found] <306450>
2023-02-18 1:14 ` [FFmpeg-devel] [PATCH v2 1/4] avcodec/eac3dec: add detection of Atmos spatial extension profile Marth64
2023-02-18 1:14 ` [FFmpeg-devel] [PATCH v2 2/4] avcodec/mlpdec: add detection of Atmos spatial extension profile in TrueHD Marth64
2023-02-18 16:50 ` Hendrik Leppkes
2023-02-18 17:22 ` Marth64
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git