From: Marth64 <marth64@proxyid.net>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] ffprobe/eac3/mlp/dca: add detection of spatial audio extensions
Date: Thu, 16 Feb 2023 17:20:23 -0600
Message-ID: <CA+28BfD6ABM6tPt-72H__urBzYzSXaCL32LCN6_mLZb0GHq_Vg@mail.gmail.com> (raw)
In-Reply-To: <CA+anqdxVf5dtphNdMHGjFAr8+hJCbcDrTMPPkuZ3peQ0GvRMqg@mail.gmail.com>
Hi Hendrik,
Thank you for taking the time to help me test this. I will verify this as
well on my corpus of 15 or so titles and commit/sign if it passes there
too. Will update within 24.
Respectfully,
Marth64
On Thu, Feb 16, 2023 at 06:37 Hendrik Leppkes <h.leppkes@gmail.com> wrote:
> On Sun, Feb 12, 2023 at 1:53 AM Marth64 <marth64@proxyid.net> wrote:
> > diff --git a/libavcodec/dca_syncwords.h b/libavcodec/dca_syncwords.h
> > index 4d2cd5f56d..200702f89e 100644
> > --- a/libavcodec/dca_syncwords.h
> > +++ b/libavcodec/dca_syncwords.h
> > @@ -33,4 +33,7 @@
> > #define DCA_SYNCWORD_SUBSTREAM_CORE 0x02B09261U
> > #define DCA_SYNCWORD_REV1AUX 0x9A1105A0U
> >
> > +#define DCA_SYNCWORD_XLL_X 0x00020008U
> > +#define DCA_SYNCWORD_XLL_X_IMAX 0x00F14000U
> > +
> > #endif /* AVCODEC_DCA_SYNCWORDS_H */
> > diff --git a/libavcodec/dca_xll.c b/libavcodec/dca_xll.c
> > index fe2c766d98..efbbae67f8 100644
> > --- a/libavcodec/dca_xll.c
> > +++ b/libavcodec/dca_xll.c
> > @@ -19,6 +19,7 @@
> > */
> >
> > #include "libavutil/channel_layout.h"
> > +#include "avcodec.h"
> > #include "dcadec.h"
> > #include "dcadata.h"
> > #include "dcamath.h"
> > @@ -1043,6 +1044,7 @@ static int parse_band_data(DCAXllDecoder *s)
> > static int parse_frame(DCAXllDecoder *s, const uint8_t *data, int size,
> DCAExssAsset *asset)
> > {
> > int ret;
> > + int extradata_peek_pos;
> >
> > if ((ret = init_get_bits8(&s->gb, data, size)) < 0)
> > return ret;
> > @@ -1054,10 +1056,23 @@ static int parse_frame(DCAXllDecoder *s, const
> uint8_t *data, int size, DCAExssA
> > return ret;
> > if ((ret = parse_band_data(s)) < 0)
> > return ret;
> > +
> > + extradata_peek_pos = (get_bits_count(&s->gb) + 31) & ~31;
> > + if (s->frame_size * 8 > extradata_peek_pos) {
> > + unsigned int extradata_syncword = show_bits_long(&s->gb, 32);
> > +
> > + if (extradata_syncword == DCA_SYNCWORD_XLL_X) {
> > + s->x_syncword_present = 1;
> > + } else if (extradata_syncword == DCA_SYNCWORD_XLL_X_IMAX) {
> > + s->x_imax_syncword_present = 1;
> > + }
> > + }
> > +
>
>
> I was testing this, and the DTS detections were not very reliable for
> me. This is what I came up with instead:
>
> #define DCA_SYNCWORD_XLL_X 0x02000850U
> #define DCA_SYNCWORD_XLL_X_IMAX 0xF14000D0U
>
>
> if (s->frame_size * 8 > FFALIGN(get_bits_count(&s->gb), 32)) {
> unsigned int extradata_syncword;
>
> // align to dword
> skip_bits_long(&s->gb, -get_bits_count(&s->gb) & 31);
>
> // get sync code
> extradata_syncword = show_bits_long(&s->gb, 32);
>
> if (extradata_syncword == DCA_SYNCWORD_XLL_X) {
> s->x_syncword_present = 1;
> } else if ((extradata_syncword >> 1) ==
> (DCA_SYNCWORD_XLL_X_IMAX >> 1)) {
> s->x_imax_syncword_present = 1;
> }
> }
>
> I don't have many DTS:X discs, but this worked on them, the old code did
> not.
> Aligning to DWORD for a new section is a typical DTS thing to do,
> which then also resulted in the syncwords to shift a bit, and actually
> include more digits.
>
> The IMAX case is a bit weird, there seems to be an extra bit in there
> thats not stable, so shifting it out improves the detection (or it
> could be masked out, but same difference).
>
> - Hendrik
> _______________________________________________
> 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".
next prev parent reply other threads:[~2023-02-16 23:20 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <306450>
2023-02-12 0:31 ` Marth64
2023-02-17 10:59 ` Anton Khirnov
2023-02-17 14:51 ` Marth64
2023-02-20 16:41 ` Anton Khirnov
2023-02-20 16:57 ` Marth64
2023-03-10 2:17 ` Marth64
2023-03-10 11:53 ` Hendrik Leppkes
2023-03-10 22:00 ` Marth64
2023-02-12 0:52 ` Marth64
2023-02-16 12:36 ` Hendrik Leppkes
2023-02-16 23:20 ` Marth64 [this message]
2023-02-17 4:46 ` Marth64
2023-02-17 19:46 ` Marth64
2023-02-17 22:43 ` James Almer
2023-02-17 23:09 ` Marth64
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
2023-02-18 1:14 ` [FFmpeg-devel] [PATCH v2 3/4] avcodec/dca_xll: add detection of DTS:X and DTS:X IMAX Marth64
2023-02-18 16:46 ` Hendrik Leppkes
2023-02-18 1:14 ` [FFmpeg-devel] [PATCH v2 4/4] avcodec/version: bump minor version to accommodate spatial audio detection Marth64
2023-02-18 16:45 ` [FFmpeg-devel] [PATCH v2 1/4] avcodec/eac3dec: add detection of Atmos spatial extension profile Hendrik Leppkes
2023-02-18 16:46 ` Hendrik Leppkes
2023-02-09 4:41 [FFmpeg-devel] [PATCH] ffprobe/eac3/mlp/dca: add detection of spatial audio extensions Marth64
2023-02-09 20:12 ` Hendrik Leppkes
2023-02-10 0:03 ` Marth64
2023-02-09 22:34 ` Michael Niedermayer
2023-02-10 0:07 ` Marth64
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+28BfD6ABM6tPt-72H__urBzYzSXaCL32LCN6_mLZb0GHq_Vg@mail.gmail.com \
--to=marth64@proxyid.net \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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