From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 1C5704024E for ; Thu, 16 Feb 2023 23:20:45 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EDC3668BE17; Fri, 17 Feb 2023 01:20:41 +0200 (EET) Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 43DEF68B9FF for ; Fri, 17 Feb 2023 01:20:36 +0200 (EET) Received: by mail-pj1-f44.google.com with SMTP id n20-20020a17090aab9400b00229ca6a4636so7572771pjq.0 for ; Thu, 16 Feb 2023 15:20:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=O8pL/PFhZIu63W8WMYXAHTPqRLefwSwrSK/hdnOEmL0=; b=MppqrPWTR4mMx7fkuwHDfNbHlUl549ZMmGiFFi4j22R07tl83WbjQ9PZZfx10LD45F tgl04l6FiRHEKimATmkYiIEWTmaK8lzRI7p++FVMUnQCBYppArBZzzLq03vstIBH1cdT CG1F94q41v31Qnuiljm8EmdWjCMZFsk1P2N/kLaHaYCqBePJwun0BwKI38aa0XJhK8m+ RAVeVghfRidQQ3vjg0EjU+e8ROTK5lxZMfY7+4Z51c85RjqugQaPBqHatN9xwBb/9skm KHV2i8jkfJ6XCoAD7DCu6Ggaz3zTBP0G0h7gvH9olCEaj1uhuj74MP/YZJ1lX7PjSUPg K2kw== X-Gm-Message-State: AO0yUKVE/z6Rm4YBrqg6XNcurpi9JRnarlT4bW6w9icyQopqUBiFz9Ju kYQ7lzZTJdjjbKVZbZCHt42YWzlkrpzbYXQDjRGK8nMAWNV9kQ== X-Google-Smtp-Source: AK7set9gOFMUFp91owlUglvxsn6zCWeTuVBZuRaE9F1jL2M0V5mJICqzfSvAnujxZkMYygnhvTK3a+GdH6hI5mxknZc= X-Received: by 2002:a17:90b:4c0e:b0:234:3dbf:77a9 with SMTP id na14-20020a17090b4c0e00b002343dbf77a9mr1011595pjb.81.1676589634196; Thu, 16 Feb 2023 15:20:34 -0800 (PST) MIME-Version: 1.0 References: <20230212005240.3167630-1-marth64@proxyid.net> In-Reply-To: From: Marth64 Date: Thu, 16 Feb 2023 17:20:23 -0600 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH] ffprobe/eac3/mlp/dca: add detection of spatial audio extensions X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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 wrote: > On Sun, Feb 12, 2023 at 1:53 AM Marth64 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".