Re: [FFmpeg-devel] [PATCH 2/2] lavc/vc1dsp: R-V V mspel_pixels

2024-04-06 Thread flow gg
ping

flow gg  于2024年3月8日周五 17:46写道:

> Alright, using m8, but for now don't add code to address dependencies in
> loops that have a minor impact. Updated in the reply
>
> Rémi Denis-Courmont  于2024年3月8日周五 17:08写道:
>
>>
>>
>> Le 8 mars 2024 02:45:46 GMT+02:00, flow gg  a
>> écrit :
>> >> Isn't it also faster to max LMUL for the adds here?
>> >
>> >It requires the use of one more vset, making the time slightly longer:
>> >147.7 (m1), 148.7 (m8 + vset).
>>
>> A variation of 0.6% on a single set of kernels will end up below
>> measurement noise in real overall codec usage. And then reducing the
>> I-cache contention can improve performance in other ways. Larger LMUL
>> should also improve performance on bigger cores with more ALUs. So it's not
>> all black and white.
>>
>> My personal preference is to keep the code small if it makes almost no
>> difference but I'm not BDFL.
>>
>> >Also this might not be much noticeable on C908, but avoiding sequential
>> >dependencies on the address registers may help. I mean, avoid using as
>> >address
>> >operand a value that was calculated by the immediate previous
>> instruction.
>> >
>> >> Okay, but the test results haven't changed..
>> >It would add more than ten lines of code, perhaps shorter code will
>> better?
>>
>> I don't know. There are definitely in-order vector cores coming, and data
>> dependencies will hurt them. But I don't know if anyone will care about
>> FFmpeg on those.
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/4] lavc/vp9dsp: R-V V ipred dc

2024-04-06 Thread flow gg
Okay, updated it in the reply and github(
https://github.com/hleft/FFmpeg/tree/vp8vp9)

Rémi Denis-Courmont  于2024年4月4日周四 04:22写道:

> Le torstaina 28. maaliskuuta 2024, 4.44.33 EEST flow gg a écrit :
> > I don't quite understand, I think here 8x8 because zve64x is not suitable
> > for sharing, it shares between dc16x16 and dc32x32, there isn't much
> common
> > code, it would require adding 3 if-else statements and function
> parameters,
> > it feels okay not to extract too.
>
> I agree that we can't realistically share code between the different block
> sizes. My point was that the code after getdc is lengthy (after expansion)
> and
> fixed for a given block size, so *that* code could be shared and jumped as
> common function tail.
>
> --
> Rémi Denis-Courmont
> http://www.remlab.net/
>
>
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
From f4e49d6f26c1ed85907a4ef7596dcc7b77cd9b8c Mon Sep 17 00:00:00 2001
From: sunyuechi 
Date: Mon, 26 Feb 2024 14:42:17 +0800
Subject: [PATCH 08/18] lavc/vp9dsp: R-V V ipred dc

C908:
vp9_dc_8x8_8bpp_c: 46.0
vp9_dc_8x8_8bpp_rvv_i64: 41.0
vp9_dc_16x16_8bpp_c: 109.2
vp9_dc_16x16_8bpp_rvv_i32: 72.7
vp9_dc_32x32_8bpp_c: 365.2
vp9_dc_32x32_8bpp_rvv_i32: 165.5
vp9_dc_127_8x8_8bpp_c: 23.0
vp9_dc_127_8x8_8bpp_rvv_i64: 22.0
vp9_dc_127_16x16_8bpp_c: 70.2
vp9_dc_127_16x16_8bpp_rvv_i32: 50.2
vp9_dc_127_32x32_8bpp_c: 295.2
vp9_dc_127_32x32_8bpp_rvv_i32: 136.7
vp9_dc_128_8x8_8bpp_c: 23.0
vp9_dc_128_8x8_8bpp_rvv_i64: 22.0
vp9_dc_128_16x16_8bpp_c: 70.2
vp9_dc_128_16x16_8bpp_rvv_i32: 50.2
vp9_dc_128_32x32_8bpp_c: 295.2
vp9_dc_128_32x32_8bpp_rvv_i32: 136.7
vp9_dc_129_8x8_8bpp_c: 23.0
vp9_dc_129_8x8_8bpp_rvv_i64: 22.0
vp9_dc_129_16x16_8bpp_c: 70.2
vp9_dc_129_16x16_8bpp_rvv_i32: 50.2
vp9_dc_129_32x32_8bpp_c: 295.2
vp9_dc_129_32x32_8bpp_rvv_i32: 136.7
vp9_dc_left_8x8_8bpp_c: 38.0
vp9_dc_left_8x8_8bpp_rvv_i64: 36.0
vp9_dc_left_16x16_8bpp_c: 93.2
vp9_dc_left_16x16_8bpp_rvv_i32: 67.7
vp9_dc_left_32x32_8bpp_c: 333.2
vp9_dc_left_32x32_8bpp_rvv_i32: 158.5
vp9_dc_top_8x8_8bpp_c: 38.7
vp9_dc_top_8x8_8bpp_rvv_i64: 36.0
vp9_dc_top_16x16_8bpp_c: 93.2
vp9_dc_top_16x16_8bpp_rvv_i32: 67.7
vp9_dc_top_32x32_8bpp_c: 333.2
vp9_dc_top_32x32_8bpp_rvv_i32: 156.2
---
 libavcodec/riscv/Makefile|   2 +
 libavcodec/riscv/vp9_intra_rvv.S | 115 +
 libavcodec/riscv/vp9dsp.h| 171 +++
 libavcodec/riscv/vp9dsp_init.c   |  61 +++
 libavcodec/vp9dsp.c  |   2 +
 libavcodec/vp9dsp.h  |   1 +
 6 files changed, 352 insertions(+)
 create mode 100644 libavcodec/riscv/vp9_intra_rvv.S
 create mode 100644 libavcodec/riscv/vp9dsp.h
 create mode 100644 libavcodec/riscv/vp9dsp_init.c

diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile
index 6c2ce3001a..69ccd0896d 100644
--- a/libavcodec/riscv/Makefile
+++ b/libavcodec/riscv/Makefile
@@ -58,5 +58,7 @@ OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_init.o
 RVV-OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_rvv.o
 OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_init.o
 RVV-OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_rvv.o
+OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9dsp_init.o
+RVV-OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9_intra_rvv.o
 OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o
 RVV-OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_rvv.o
diff --git a/libavcodec/riscv/vp9_intra_rvv.S b/libavcodec/riscv/vp9_intra_rvv.S
new file mode 100644
index 00..db9774c263
--- /dev/null
+++ b/libavcodec/riscv/vp9_intra_rvv.S
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS).
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/riscv/asm.S"
+
+.macro avgdc size
+vwredsumu.vs v16, v8, v16
+vsetivli zero, 1, e16, m1, ta, ma
+vmv.x.s  t1, v16
+addi t1, t1, 1 << (\size - 1)
+srai t1, t1, \size
+.endm
+
+.macro getdc type size
+.ifc \type,top
+vmv.v.x  v16, zero
+vle8.v   v8, (a3)
+avgdc\size
+.elseif \type == left
+  

Re: [FFmpeg-devel] [PATCH 1/3] lavu/hwcontext_vaapi: Add a new quirk

2024-04-06 Thread Xiang, Haihao
On Wo, 2024-04-03 at 20:21 +0100, Mark Thompson wrote:
> On 28/03/2024 02:17, Xiang, Haihao wrote:
> > From: Haihao Xiang 
> > 
> > libva2 doesn't require a fixed surface-array any more, but some
> > driver/hardware combinations which rely on this are still used. To
> > reduce the impact to users, add a quirk for the driver/hardware
> > combination which supports dynamic surface pool.
> > 
> > Signed-off-by: Haihao Xiang 
> > ---
> >   libavutil/hwcontext_vaapi.c | 7 +++
> >   libavutil/hwcontext_vaapi.h | 6 ++
> >   2 files changed, 13 insertions(+)
> > 
> > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
> > index 56d03aa4cd..dae5dd4a11 100644
> > --- a/libavutil/hwcontext_vaapi.c
> > +++ b/libavutil/hwcontext_vaapi.c
> > @@ -390,6 +390,13 @@ static const struct {
> >   "Splitted-Desktop Systems VDPAU backend for VA-API",
> >   AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES,
> >   },
> > +#if CONFIG_VAAPI_1
> > +    {
> > +    "New Intel iHD",
> > +    "Intel iHD driver for Intel(R) Gen Graphics",
> > +    AV_VAAPI_DRIVER_QUIRK_DYNAMIC_SURFACE_POOL,
> > +    },
> > +#endif
> >   };
> >   
> >   static int vaapi_device_init(AVHWDeviceContext *hwdev)
> > diff --git a/libavutil/hwcontext_vaapi.h b/libavutil/hwcontext_vaapi.h
> > index 0b2e071cb3..07014fd526 100644
> > --- a/libavutil/hwcontext_vaapi.h
> > +++ b/libavutil/hwcontext_vaapi.h
> > @@ -58,6 +58,12 @@ enum {
> >    * and the results of the vaQuerySurfaceAttributes() call will be
> > faked.
> >    */
> >   AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES = (1 << 3),
> > +
> > +    /**
> > + * The driver (and the underlying HW) supports dynamic surface pool.
> > + * The vaCreateContext() call doesn't require a fixed surface-array.
> > + */
> > +    AV_VAAPI_DRIVER_QUIRK_DYNAMIC_SURFACE_POOL = (1 << 4),
> >   };
> >   
> >   /**
> 
> I do not think a vendor-specific quirk like this is a reasonable answer, but I
> can see that your company is invested in making sure that your current driver
> doesn't hit this problem.
> 
> Given that, I give up on arguing for trying to preserve compatibility here. 
> Let's just use dynamic pools unconditionally and see if anything breaks.

Thanks, I'll update the patchset to use dynamic pools for all drivers when libva
>= 2.0. 

> 
> Is there any reason not to drop support for libva < 2.0 at the same time? 
> (Making CONFIG_VAAPI_1 always true.)  It is of similar age to C17, which we
> are intending to require soon as well.

We are considering to drop the support for libva < 2.0, but we can't be sure
whether user is still using libva < 2.0.

If there isn't any objection about dropping the support for libva < 2.0, We will
use a separate patch to drop the support.

BRs
Haihao

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avcodec/vvc/ps: reset sps_id_used on PS uninit

2024-04-06 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/vvc/ps.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/vvc/ps.c b/libavcodec/vvc/ps.c
index 3c71c34bae..83ee75fb62 100644
--- a/libavcodec/vvc/ps.c
+++ b/libavcodec/vvc/ps.c
@@ -912,6 +912,7 @@ void ff_vvc_ps_uninit(VVCParamSets *ps)
 ff_refstruct_unref(>sps_list[i]);
 for (int i = 0; i < FF_ARRAY_ELEMS(ps->pps_list); i++)
 ff_refstruct_unref(>pps_list[i]);
+ps->sps_id_used = 0;
 }
 
 static void alf_coeff(int16_t *coeff,
-- 
2.44.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2] lavc/vvc: Error if SPS ID is duplicated within CVS

2024-04-06 Thread Nuo Mi
On Sat, Apr 6, 2024 at 9:46 PM Frank Plowman  wrote:

> Key line from the spec is:
>
> "All SPS NAL units with a particular value of sps_seq_parameter_set_id
> in a CVS shall have the same content."
>
> Prior to this patch, the VVC decoder's behaviour on encountering a
> duplicated SPS ID (within the entire bitstream, not restricted to
> a CVS) was simply to replace the entry in the SPS lookup table with the
> new data.  Illegal bitstreams with multiple SPSs in the same CVS sharing
> an ID but differing elsewhere could cause all manner of issues.
>
> The patch tracks which SPS IDs have been used in the given CVS using the
> new sps_id_used field of VVCParamSets.  If it encounters an SPS with an
> ID already in use and whose content differs from the previous SPS, it
> throws an AVERROR_INVALIDDATA.
>
> Signed-off-by: Frank Plowman 
> ---
> Changes since v1:
> * Track which SPS IDs are in use using a bit field rather than a bool
>   array.
> * Move sps_id_used to the end of VVCParamSets.
> * Style: remove blank line & add braces for clarity.
>
Pushed.
Thank you, Frank

>
>  libavcodec/vvc/vvc_ps.c | 28 
>  libavcodec/vvc/vvc_ps.h |  2 ++
>  2 files changed, 22 insertions(+), 8 deletions(-)
>
> diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c
> index 301fa16400..7e967180d2 100644
> --- a/libavcodec/vvc/vvc_ps.c
> +++ b/libavcodec/vvc/vvc_ps.c
> @@ -219,14 +219,22 @@ fail:
>  return NULL;
>  }
>
> -static int decode_sps(VVCParamSets *ps, const H266RawSPS *rsps, void
> *log_ctx)
> +static int decode_sps(VVCParamSets *ps, const H266RawSPS *rsps, void
> *log_ctx, int is_clvss)
>  {
>  const int sps_id= rsps->sps_seq_parameter_set_id;
>  const VVCSPS *old_sps   = ps->sps_list[sps_id];
>  const VVCSPS *sps;
>
> -if (old_sps && old_sps->r == rsps)
> -return 0;
> +if (is_clvss) {
> +ps->sps_id_used = 0;
> +}
> +
> +if (old_sps) {
> +if (old_sps->r == rsps || !memcmp(old_sps->r, rsps,
> sizeof(*old_sps->r)))
> +return 0;
> +else if (ps->sps_id_used & (1 << sps_id))
> +return AVERROR_INVALIDDATA;
> +}
>
>  sps = sps_alloc(rsps, log_ctx);
>  if (!sps)
> @@ -234,6 +242,7 @@ static int decode_sps(VVCParamSets *ps, const
> H266RawSPS *rsps, void *log_ctx)
>
>  ff_refstruct_unref(>sps_list[sps_id]);
>  ps->sps_list[sps_id] = sps;
> +ps->sps_id_used |= (1 << sps_id);
>
>  return 0;
>  }
> @@ -610,7 +619,7 @@ static int decode_pps(VVCParamSets *ps, const
> H266RawPPS *rpps)
>  return ret;
>  }
>
> -static int decode_ps(VVCParamSets *ps, const CodedBitstreamH266Context
> *h266, void *log_ctx)
> +static int decode_ps(VVCParamSets *ps, const CodedBitstreamH266Context
> *h266, void *log_ctx, int is_clvss)
>  {
>  const H266RawPictureHeader *ph = h266->ph;
>  const H266RawPPS *rpps;
> @@ -628,7 +637,7 @@ static int decode_ps(VVCParamSets *ps, const
> CodedBitstreamH266Context *h266, vo
>  if (!rsps)
>  return AVERROR_INVALIDDATA;
>
> -ret = decode_sps(ps, rsps, log_ctx);
> +ret = decode_sps(ps, rsps, log_ctx, is_clvss);
>  if (ret < 0)
>  return ret;
>
> @@ -867,13 +876,16 @@ int ff_vvc_decode_frame_ps(VVCFrameParamSets *fps,
> struct VVCContext *s)
>  int ret = 0;
>  VVCParamSets *ps= >ps;
>  const CodedBitstreamH266Context *h266   = s->cbc->priv_data;
> +int is_clvss;
> +
> +decode_recovery_flag(s);
> +is_clvss = IS_CLVSS(s);
>
> -ret = decode_ps(ps, h266, s->avctx);
> +ret = decode_ps(ps, h266, s->avctx, is_clvss);
>  if (ret < 0)
>  return ret;
>
> -decode_recovery_flag(s);
> -ret = decode_frame_ps(fps, ps, h266, s->poc_tid0, IS_CLVSS(s));
> +ret = decode_frame_ps(fps, ps, h266, s->poc_tid0, is_clvss);
>  decode_recovery_poc(s, >ph);
>  return ret;
>  }
> diff --git a/libavcodec/vvc/vvc_ps.h b/libavcodec/vvc/vvc_ps.h
> index f60d8b81c6..710673ebed 100644
> --- a/libavcodec/vvc/vvc_ps.h
> +++ b/libavcodec/vvc/vvc_ps.h
> @@ -214,6 +214,8 @@ typedef struct VVCParamSets {
>  const VVCALF*alf_list[VVC_MAX_ALF_COUNT];   ///<
> RefStruct reference
>  const H266RawAPS*lmcs_list[VVC_MAX_LMCS_COUNT]; ///<
> RefStruct reference
>  const VVCScalingList*scaling_list[VVC_MAX_SL_COUNT];///<
> RefStruct reference
> +// Bit field of SPS IDs used in the current CVS
> +  uint16_t   sps_id_used;
>  } VVCParamSets;
>
>  typedef struct VVCFrameParamSets {
> --
> 2.44.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To 

[FFmpeg-devel] [PATCH] lavf/vsrc_ddagrab: WinAPI functions must be called as stdcall in x86_32

2024-04-06 Thread Vadim Guchenko
Now I get Access Violation when using ddagrab filter in ffmpeg compiled for 
x86_32 architecture.

More information here: https://trac.ffmpeg.org/ticket/10914

diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c
--- a/libavfilter/vsrc_ddagrab.c
+++ b/libavfilter/vsrc_ddagrab.c
@@ -178,7 +178,7 @@ static av_cold int init_dxgi_dda(AVFilterContext *avctx)
 #if HAVE_IDXGIOUTPUT5 && HAVE_DPI_AWARENESS_CONTEXT
 IDXGIOutput5 *dxgi_output5 = NULL;
 
-typedef DPI_AWARENESS_CONTEXT (*set_thread_dpi_t)(DPI_AWARENESS_CONTEXT);
+typedef DPI_AWARENESS_CONTEXT (__stdcall 
*set_thread_dpi_t)(DPI_AWARENESS_CONTEXT);
 set_thread_dpi_t set_thread_dpi;
 HMODULE user32_module;
 #endif

-- 
Best regards,
 Vadim

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 01/11] avcodec: add avcodec_get_supported_config()

2024-04-06 Thread Michael Niedermayer
On Fri, Apr 05, 2024 at 08:57:11PM +0200, Niklas Haas wrote:
> From: Niklas Haas 
> 
> This replaces the myriad of existing lists in AVCodec by a unified API
> call, allowing us to (ultimately) trim down the sizeof(AVCodec) quite
> substantially, while also making this more trivially extensible.
> 
> In addition to the already covered lists, add two new entries for color
> space and color range, mirroring the newly added negotiable fields in
> libavfilter.
> 
> I decided to drop the explicit length field from the API proposed by
> Andreas Rheinhardt, because having it in place ended up complicating
> both the codec side and the client side implementations, while also
> being strictly less flexible (it's trivial to recover a length given
> a terminator, but requires allocation to add a terminator given
> a length). Using a terminator also presents less of a porting challenge
> for existing users of the current API.
> 
> Once the deprecation period passes for the existing public fields, the
> rough plan is to move the commonly used fields (such as
> pix_fmt/sample_fmt) into FFCodec, possibly as a union of audio and video
> configuration types, and then implement the rarely used fields with
> custom callbacks.
> ---
>  doc/APIchanges  |  5 
>  libavcodec/avcodec.c| 51 +
>  libavcodec/avcodec.h| 27 
>  libavcodec/codec.h  | 19 +++---
>  libavcodec/codec_internal.h | 21 +++
>  libavcodec/version.h|  4 +--
>  6 files changed, 121 insertions(+), 6 deletions(-)

If the API is changed, it should be to an API that allows externally
maintained codecs.
(it would result in more developers working on codecs)

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec/options_table: map IPT-C2, YCgCo-R variants in colorspace

2024-04-06 Thread Michael Niedermayer
On Wed, Apr 03, 2024 at 07:04:20PM +, Jan Ekström wrote:
> ffmpeg | branch: master | Jan Ekström  | Fri Mar 29 
> 00:52:53 2024 +0200| [06c53efd233340762535957ad765ed4d9aafcddd] | committer: 
> Jan Ekström
> 
> avcodec/options_table: map IPT-C2, YCgCo-R variants in colorspace
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=06c53efd233340762535957ad765ed4d9aafcddd
> ---
> 
>  libavcodec/options_table.h | 3 +++
>  libavcodec/version.h   | 2 +-
>  2 files changed, 4 insertions(+), 1 deletion(-)

> 
> diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
> index 7a2ef3474e..7a70fa7b6c 100644
> --- a/libavcodec/options_table.h
> +++ b/libavcodec/options_table.h
> @@ -331,8 +331,11 @@ static const AVOption avcodec_options[] = {
>  {"chroma-derived-nc", "Chroma-derived NCL", 0, AV_OPT_TYPE_CONST, {.i64 = 
> AVCOL_SPC_CHROMA_DERIVED_NCL }, INT_MIN, INT_MAX, V|E|D, .unit = 
> "colorspace_type"},
>  {"chroma-derived-c",  "Chroma-derived CL",  0, AV_OPT_TYPE_CONST, {.i64 = 
> AVCOL_SPC_CHROMA_DERIVED_CL },  INT_MIN, INT_MAX, V|E|D, .unit = 
> "colorspace_type"},
>  {"ictcp", "ICtCp",  0, AV_OPT_TYPE_CONST, {.i64 = 
> AVCOL_SPC_ICTCP },  INT_MIN, INT_MAX, V|E|D, .unit = 
> "colorspace_type"},
> +{"ipt-c2","IPT-C2", 0, AV_OPT_TYPE_CONST, {.i64 = 
> AVCOL_SPC_IPT_C2 }, INT_MIN, INT_MAX, V|E|D, .unit = 
> "colorspace_type"},
>  {"unspecified",   "Unspecified",0, AV_OPT_TYPE_CONST, {.i64 = 
> AVCOL_SPC_UNSPECIFIED },INT_MIN, INT_MAX, V|E|D, .unit = 
> "colorspace_type"},
>  {"ycocg", "YCGCO",  0, AV_OPT_TYPE_CONST, {.i64 = 
> AVCOL_SPC_YCGCO },  INT_MIN, INT_MAX, V|E|D, .unit = 
> "colorspace_type"},
> +{"ycgco-re",  "YCgCo-R, even add.", 0, AV_OPT_TYPE_CONST, {.i64 = 
> AVCOL_SPC_YCGCO_RE },   INT_MIN, INT_MAX, V|E|D, .unit = 
> "colorspace_type"},
> +{"ycgco-ro",  "YCgCo-R, odd add.",  0, AV_OPT_TYPE_CONST, {.i64 = 
> AVCOL_SPC_YCGCO_RO },   INT_MIN, INT_MAX, V|E|D, .unit = 
> "colorspace_type"},

missing addition to doc/

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The day soldiers stop bringing you their problems is the day you have stopped 
leading them. They have either lost confidence that you can help or concluded 
you do not care. Either case is a failure of leadership. - Colin Powell


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avformat/lc3: Add file format for LC3/LC3plus transport

2024-04-06 Thread Antoine Soulier via ffmpeg-devel
From: Antoine SOULIER 

A file format is described in Bluetooth SIG LC3 and ETSI TS 103 634, for
test purpose. This is the format implemented here.
---
 Changelog|   1 +
 doc/muxers.texi  |   6 ++
 libavformat/Makefile |   2 +
 libavformat/allformats.c |   2 +
 libavformat/lc3dec.c | 173 +++
 libavformat/lc3enc.c | 114 ++
 6 files changed, 298 insertions(+)
 create mode 100644 libavformat/lc3dec.c
 create mode 100644 libavformat/lc3enc.c

diff --git a/Changelog b/Changelog
index 18e83b99a1..02ed7831ec 100644
--- a/Changelog
+++ b/Changelog
@@ -4,6 +4,7 @@ releases are sorted from youngest to oldest.
 version :
 - Raw Captions with Time (RCWT) closed caption demuxer
 - LC3/LC3plus decoding/encoding using external library liblc3
+- LC3/LC3plus demuxer and muxer
 
 
 version 7.0:
diff --git a/doc/muxers.texi b/doc/muxers.texi
index d8a1f83309..ed4144f6d1 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -2700,6 +2700,12 @@ computer-generated compositions.
 
 This muxer accepts a single audio stream containing PCM data.
 
+@section lc3
+Bluetooth SIG Low Complexity Communication Codec audio (LC3), or
+ETSI TS 103 634 Low Complexity Communication Codec plus (LC3plus).
+
+This muxer accepts a single @code{lc3} audio stream.
+
 @section matroska
 
 Matroska container muxer.
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 9981799cc9..027d0cdae5 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -332,6 +332,8 @@ OBJS-$(CONFIG_KVAG_DEMUXER)  += kvag.o
 OBJS-$(CONFIG_KVAG_MUXER)+= kvag.o rawenc.o
 OBJS-$(CONFIG_LAF_DEMUXER)   += lafdec.o
 OBJS-$(CONFIG_LATM_MUXER)+= latmenc.o rawenc.o
+OBJS-$(CONFIG_LC3_DEMUXER)   += lc3dec.o
+OBJS-$(CONFIG_LC3_MUXER) += lc3enc.o
 OBJS-$(CONFIG_LMLM4_DEMUXER) += lmlm4.o
 OBJS-$(CONFIG_LOAS_DEMUXER)  += loasdec.o rawdec.o
 OBJS-$(CONFIG_LUODAT_DEMUXER)+= luodatdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index ae925dcf60..305fa46532 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -252,6 +252,8 @@ extern const FFInputFormat  ff_kvag_demuxer;
 extern const FFOutputFormat ff_kvag_muxer;
 extern const FFInputFormat  ff_laf_demuxer;
 extern const FFOutputFormat ff_latm_muxer;
+extern const FFInputFormat  ff_lc3_demuxer;
+extern const FFOutputFormat ff_lc3_muxer;
 extern const FFInputFormat  ff_lmlm4_demuxer;
 extern const FFInputFormat  ff_loas_demuxer;
 extern const FFInputFormat  ff_luodat_demuxer;
diff --git a/libavformat/lc3dec.c b/libavformat/lc3dec.c
new file mode 100644
index 00..371e9242d5
--- /dev/null
+++ b/libavformat/lc3dec.c
@@ -0,0 +1,173 @@
+/*
+ * LC3 demuxer
+ * Copyright (C) 2024  Antoine Soulier 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * Based on the file format specified by :
+ *
+ * - Bluetooth SIG - Low Complexity Communication Codec Test Suite
+ *   https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=502301
+ *   3.2.8.2 Reference LC3 Codec Bitstream Format
+ *
+ * - ETSI TI 103 634 V1.4.1 - Low Complexity Communication Codec plus
+ *   
https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.04.01_60/ts_103634v010401p.pdf
+ *   LC3plus conformance script package
+ */
+
+#include "libavcodec/packet.h"
+#include "libavutil/intreadwrite.h"
+
+#include "avformat.h"
+#include "avio.h"
+#include "demux.h"
+#include "internal.h"
+
+typedef struct LC3DemuxContext {
+int frame_samples;
+int64_t end_dts;
+} LC3DemuxContext;
+
+static int lc3_read_probe(const AVProbeData *p)
+{
+int frame_us, srate_hz;
+
+if (p->buf_size < 12)
+return 0;
+
+if (AV_RB16(p->buf + 0) != 0x1ccc ||
+AV_RL16(p->buf + 2) <  9 * sizeof(uint16_t))
+return 0;
+
+srate_hz = AV_RL16(p->buf + 4) * 100;
+if (srate_hz !=  8000 && srate_hz != 16000 && srate_hz != 24000 &&
+srate_hz != 32000 && srate_hz != 48000 && srate_hz != 96000)
+return 0;
+
+frame_us = AV_RL16(p->buf + 10) * 10;
+if (frame_us != 2500 && frame_us !=  5000 &&
+frame_us != 7500 && frame_us != 

Re: [FFmpeg-devel] [PATCH] avcodec/libx264: bump minimum required version to 160

2024-04-06 Thread Michael Niedermayer
On Fri, Apr 05, 2024 at 07:44:52PM +0200, Niklas Haas wrote:
> From: Niklas Haas 
> 
> This version is four years old, and present in Debian oldstable, Ubuntu
> 22.04 and Leap 15.1.

Ubuntu 20.04 has general support till 2025-05-29
Ubuntu 18.04 has security support (ESM) till 2028-04

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Nations do behave wisely once they have exhausted all other alternatives. 
-- Abba Eban


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/2] libavformat/hls.c: support in-stream ID3 metadata update.

2024-04-06 Thread Romain Beauxis
On Sun, Mar 31, 2024, 12:46 Romain Beauxis  wrote:

>
>
> On Sun, Mar 31, 2024, 05:52 Liu Steven  wrote:
>
>>
>>
>> > On Mar 29, 2024, at 06:51, Romain Beauxis  wrote:
>> >
>> > On Mon, Mar 25, 2024, 19:58 Romain Beauxis 
>> wrote:
>> >
>> >> This patch adds support for updating HLS metadata passed as ID3 frames.
>> >>
>> >> This seems like a pretty straight-forward improvement. Updating the
>> >> metadaata of the first stream seems to be the mechanism is other places
>> >> in the code and works as expected.
>> >>
>> >
>> >
>> > Hello!
>> >
>> > Any interest in reviewing this?
>>
>> Patchset looks good to me, looks better than before patch.
>>
>
> Great! Happy to provide the fate samples too.
>
>
Hi!

Any update on this?

Let me know if I can do anything to help!




> > ---
>> >> libavformat/hls.c | 54 ---
>> >> 1 file changed, 32 insertions(+), 22 deletions(-)
>> >>
>> >> diff --git a/libavformat/hls.c b/libavformat/hls.c
>> >> index f6b44c2e35..ba6634d57a 100644
>> >> --- a/libavformat/hls.c
>> >> +++ b/libavformat/hls.c
>> >> @@ -93,6 +93,12 @@ enum PlaylistType {
>> >> PLS_TYPE_VOD
>> >> };
>> >>
>> >> +#define ID3_PRIV_OWNER_TS
>> "com.apple.streaming.transportStreamTimestamp"
>> >> +#define ID3_PRIV_OWNER_AUDIO_SETUP
>> "com.apple.streaming.audioDescription"
>> >> +
>> >> +#define ID3v2_PRIV_OWNER_TS ID3v2_PRIV_METADATA_PREFIX
>> ID3_PRIV_OWNER_TS
>> >> +#define ID3v2_PRIV_OWNER_AUDIO_SETUP ID3v2_PRIV_METADATA_PREFIX
>> >> ID3_PRIV_OWNER_AUDIO_SETUP
>> >> +
>> >> /*
>> >>  * Each playlist has its own demuxer. If it currently is active,
>> >>  * it has an open AVIOContext too, and potentially an AVPacket
>> >> @@ -150,9 +156,7 @@ struct playlist {
>> >> int64_t id3_offset; /* in stream original tb */
>> >> uint8_t* id3_buf; /* temp buffer for id3 parsing */
>> >> unsigned int id3_buf_size;
>> >> -AVDictionary *id3_initial; /* data from first id3 tag */
>> >> -int id3_found; /* ID3 tag found at some point */
>> >> -int id3_changed; /* ID3 tag data has changed at some point */
>> >> +AVDictionary *last_id3; /* data from the last id3 tag */
>> >> ID3v2ExtraMeta *id3_deferred_extra; /* stored here until subdemuxer
>> >> is opened */
>> >>
>> >> HLSAudioSetupInfo audio_setup_info;
>> >> @@ -270,7 +274,7 @@ static void free_playlist_list(HLSContext *c)
>> >> av_freep(>main_streams);
>> >> av_freep(>renditions);
>> >> av_freep(>id3_buf);
>> >> -av_dict_free(>id3_initial);
>> >> +av_dict_free(>last_id3);
>> >> ff_id3v2_free_extra_meta(>id3_deferred_extra);
>> >> av_freep(>init_sec_buf);
>> >> av_packet_free(>pkt);
>> >> @@ -1083,15 +1087,13 @@ static void parse_id3(AVFormatContext *s,
>> >> AVIOContext *pb,
>> >>   AVDictionary **metadata, int64_t *dts,
>> >> HLSAudioSetupInfo *audio_setup_info,
>> >>   ID3v2ExtraMetaAPIC **apic, ID3v2ExtraMeta
>> >> **extra_meta)
>> >> {
>> >> -static const char id3_priv_owner_ts[] =
>> >> "com.apple.streaming.transportStreamTimestamp";
>> >> -static const char id3_priv_owner_audio_setup[] =
>> >> "com.apple.streaming.audioDescription";
>> >> ID3v2ExtraMeta *meta;
>> >>
>> >> ff_id3v2_read_dict(pb, metadata, ID3v2_DEFAULT_MAGIC, extra_meta);
>> >> for (meta = *extra_meta; meta; meta = meta->next) {
>> >> if (!strcmp(meta->tag, "PRIV")) {
>> >> ID3v2ExtraMetaPRIV *priv = >data.priv;
>> >> -if (priv->datasize == 8 && !av_strncasecmp(priv->owner,
>> >> id3_priv_owner_ts, 44)) {
>> >> +if (priv->datasize == 8 && !av_strncasecmp(priv->owner,
>> >> ID3_PRIV_OWNER_TS, strlen(ID3_PRIV_OWNER_TS))) {
>> >> /* 33-bit MPEG timestamp */
>> >> int64_t ts = AV_RB64(priv->data);
>> >> av_log(s, AV_LOG_DEBUG, "HLS ID3 audio timestamp
>> >> %"PRId64"\n", ts);
>> >> @@ -1099,7 +1101,9 @@ static void parse_id3(AVFormatContext *s,
>> >> AVIOContext *pb,
>> >> *dts = ts;
>> >> else
>> >> av_log(s, AV_LOG_ERROR, "Invalid HLS ID3 audio
>> >> timestamp %"PRId64"\n", ts);
>> >> -} else if (priv->datasize >= 8 &&
>> >> !av_strncasecmp(priv->owner, id3_priv_owner_audio_setup, 36)) {
>> >> +} else if (priv->datasize >= 8 &&
>> >> +   !av_strncasecmp(priv->owner,
>> >> ID3_PRIV_OWNER_AUDIO_SETUP, 36) &&
>> >> +   audio_setup_info) {
>> >> ff_hls_senc_read_audio_setup_info(audio_setup_info,
>> >> priv->data, priv->datasize);
>> >> }
>> >> } else if (!strcmp(meta->tag, "APIC") && apic)
>> >> @@ -1113,9 +1117,10 @@ static int id3_has_changed_values(struct
>> playlist
>> >> *pls, AVDictionary *metadata,
>> >> {
>> >> const AVDictionaryEntry *entry = NULL;
>> >> const AVDictionaryEntry *oldentry;
>> >> +
>> >> /* check that no keys have changed 

[FFmpeg-devel] [PATCH v4 5/5] avcodec/ac3: Implement sum_square_butterfly_float for aarch64 NEON

2024-04-06 Thread Geoff Hill
Signed-off-by: Geoff Hill 
---
 libavcodec/aarch64/ac3dsp_init_aarch64.c |  5 
 libavcodec/aarch64/ac3dsp_neon.S | 30 
 tests/checkasm/ac3dsp.c  | 26 
 3 files changed, 61 insertions(+)

diff --git a/libavcodec/aarch64/ac3dsp_init_aarch64.c 
b/libavcodec/aarch64/ac3dsp_init_aarch64.c
index e95436c651..e367353e11 100644
--- a/libavcodec/aarch64/ac3dsp_init_aarch64.c
+++ b/libavcodec/aarch64/ac3dsp_init_aarch64.c
@@ -32,6 +32,10 @@ void ff_ac3_sum_square_butterfly_int32_neon(int64_t sum[4],
 const int32_t *coef0,
 const int32_t *coef1,
 int len);
+void ff_ac3_sum_square_butterfly_float_neon(float sum[4],
+const float *coef0,
+const float *coef1,
+int len);
 
 av_cold void ff_ac3dsp_init_aarch64(AC3DSPContext *c)
 {
@@ -42,4 +46,5 @@ av_cold void ff_ac3dsp_init_aarch64(AC3DSPContext *c)
 c->extract_exponents = ff_ac3_extract_exponents_neon;
 c->float_to_fixed24 = ff_float_to_fixed24_neon;
 c->sum_square_butterfly_int32 = ff_ac3_sum_square_butterfly_int32_neon;
+c->sum_square_butterfly_float = ff_ac3_sum_square_butterfly_float_neon;
 }
diff --git a/libavcodec/aarch64/ac3dsp_neon.S b/libavcodec/aarch64/ac3dsp_neon.S
index 77f9d20275..20beb6cc50 100644
--- a/libavcodec/aarch64/ac3dsp_neon.S
+++ b/libavcodec/aarch64/ac3dsp_neon.S
@@ -87,3 +87,33 @@ function ff_ac3_sum_square_butterfly_int32_neon, export=1
 st1 {v0.1d-v3.1d}, [x0]
 ret
 endfunc
+
+function ff_ac3_sum_square_butterfly_float_neon, export=1
+moviv0.4s, #0
+moviv1.4s, #0
+moviv2.4s, #0
+moviv3.4s, #0
+1:  ld1 {v30.4s}, [x1], #16
+ld1 {v31.4s}, [x2], #16
+faddv16.4s, v30.4s, v31.4s
+fsubv17.4s, v30.4s, v31.4s
+fmlav0.4s, v30.4s, v30.4s
+fmlav1.4s, v31.4s, v31.4s
+fmlav2.4s, v16.4s, v16.4s
+fmlav3.4s, v17.4s, v17.4s
+subsw3, w3, #4
+b.gt1b
+faddp   v0.4s, v0.4s, v0.4s
+faddp   v0.2s, v0.2s, v0.2s
+st1 {v0.s}[0], [x0], #4
+faddp   v1.4s, v1.4s, v1.4s
+faddp   v1.2s, v1.2s, v1.2s
+st1 {v1.s}[0], [x0], #4
+faddp   v2.4s, v2.4s, v2.4s
+faddp   v2.2s, v2.2s, v2.2s
+st1 {v2.s}[0], [x0], #4
+faddp   v3.4s, v3.4s, v3.4s
+faddp   v3.2s, v3.2s, v3.2s
+st1 {v3.s}[0], [x0]
+ret
+endfunc
diff --git a/tests/checkasm/ac3dsp.c b/tests/checkasm/ac3dsp.c
index 573a76c764..442e965f3b 100644
--- a/tests/checkasm/ac3dsp.c
+++ b/tests/checkasm/ac3dsp.c
@@ -165,6 +165,31 @@ static void 
check_ac3_sum_square_butterfly_int32(AC3DSPContext *c) {
 report("ac3_sum_square_butterfly_int32");
 }
 
+static void check_ac3_sum_square_butterfly_float(AC3DSPContext *c) {
+LOCAL_ALIGNED_32(float, lt, [ELEMS]);
+LOCAL_ALIGNED_32(float, rt, [ELEMS]);
+LOCAL_ALIGNED_16(float, v1, [4]);
+LOCAL_ALIGNED_16(float, v2, [4]);
+
+declare_func(void, float[4], const float *, const float *, int);
+
+randomize_float(lt, ELEMS);
+randomize_float(rt, ELEMS);
+
+if (check_func(c->sum_square_butterfly_float,
+   "ac3_sum_square_bufferfly_float")) {
+call_ref(v1, lt, rt, ELEMS);
+call_new(v2, lt, rt, ELEMS);
+
+if (!float_near_ulp_array(v1, v2, 10, 4))
+fail();
+
+bench_new(v2, lt, rt, ELEMS);
+}
+
+report("ac3_sum_square_butterfly_float");
+}
+
 void checkasm_check_ac3dsp(void)
 {
 AC3DSPContext c;
@@ -174,4 +199,5 @@ void checkasm_check_ac3dsp(void)
 check_ac3_extract_exponents();
 check_float_to_fixed24();
 check_ac3_sum_square_butterfly_int32();
+check_ac3_sum_square_butterfly_float();
 }
-- 
2.42.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v4 4/5] avcodec/ac3: Implement sum_square_butterfly_int32 for aarch64 NEON

2024-04-06 Thread Geoff Hill
Signed-off-by: Geoff Hill 
---
 libavcodec/aarch64/ac3dsp_init_aarch64.c |  5 +
 libavcodec/aarch64/ac3dsp_neon.S | 23 
 tests/checkasm/ac3dsp.c  | 27 
 3 files changed, 55 insertions(+)

diff --git a/libavcodec/aarch64/ac3dsp_init_aarch64.c 
b/libavcodec/aarch64/ac3dsp_init_aarch64.c
index 1bdc215b51..e95436c651 100644
--- a/libavcodec/aarch64/ac3dsp_init_aarch64.c
+++ b/libavcodec/aarch64/ac3dsp_init_aarch64.c
@@ -28,6 +28,10 @@
 void ff_ac3_exponent_min_neon(uint8_t *exp, int num_reuse_blocks, int 
nb_coefs);
 void ff_ac3_extract_exponents_neon(uint8_t *exp, int32_t *coef, int nb_coefs);
 void ff_float_to_fixed24_neon(int32_t *dst, const float *src, size_t len);
+void ff_ac3_sum_square_butterfly_int32_neon(int64_t sum[4],
+const int32_t *coef0,
+const int32_t *coef1,
+int len);
 
 av_cold void ff_ac3dsp_init_aarch64(AC3DSPContext *c)
 {
@@ -37,4 +41,5 @@ av_cold void ff_ac3dsp_init_aarch64(AC3DSPContext *c)
 c->ac3_exponent_min = ff_ac3_exponent_min_neon;
 c->extract_exponents = ff_ac3_extract_exponents_neon;
 c->float_to_fixed24 = ff_float_to_fixed24_neon;
+c->sum_square_butterfly_int32 = ff_ac3_sum_square_butterfly_int32_neon;
 }
diff --git a/libavcodec/aarch64/ac3dsp_neon.S b/libavcodec/aarch64/ac3dsp_neon.S
index c350c1f173..77f9d20275 100644
--- a/libavcodec/aarch64/ac3dsp_neon.S
+++ b/libavcodec/aarch64/ac3dsp_neon.S
@@ -64,3 +64,26 @@ function ff_float_to_fixed24_neon, export=1
 b.ne1b
 ret
 endfunc
+
+function ff_ac3_sum_square_butterfly_int32_neon, export=1
+moviv0.2d, #0
+moviv1.2d, #0
+moviv2.2d, #0
+moviv3.2d, #0
+1:  ld1 {v4.2s}, [x1], #8
+ld1 {v5.2s}, [x2], #8
+add v6.2s, v4.2s, v5.2s
+sub v7.2s, v4.2s, v5.2s
+smlal   v0.2d, v4.2s, v4.2s
+smlal   v1.2d, v5.2s, v5.2s
+smlal   v2.2d, v6.2s, v6.2s
+smlal   v3.2d, v7.2s, v7.2s
+subsw3, w3, #2
+b.gt1b
+addpd0, v0.2d
+addpd1, v1.2d
+addpd2, v2.2d
+addpd3, v3.2d
+st1 {v0.1d-v3.1d}, [x0]
+ret
+endfunc
diff --git a/tests/checkasm/ac3dsp.c b/tests/checkasm/ac3dsp.c
index dc1b169e68..573a76c764 100644
--- a/tests/checkasm/ac3dsp.c
+++ b/tests/checkasm/ac3dsp.c
@@ -139,6 +139,32 @@ static void check_float_to_fixed24(AC3DSPContext *c) {
 report("float_to_fixed24");
 }
 
+static void check_ac3_sum_square_butterfly_int32(AC3DSPContext *c) {
+#define ELEMS 240
+LOCAL_ALIGNED_16(int32_t, lt, [ELEMS]);
+LOCAL_ALIGNED_16(int32_t, rt, [ELEMS]);
+LOCAL_ALIGNED_16(uint64_t, v1, [4]);
+LOCAL_ALIGNED_16(uint64_t, v2, [4]);
+
+declare_func(void, int64_t[4], const int32_t *, const int32_t *, int);
+
+randomize_i24(lt, ELEMS);
+randomize_i24(rt, ELEMS);
+
+if (check_func(c->sum_square_butterfly_int32,
+   "ac3_sum_square_bufferfly_int32")) {
+call_ref(v1, lt, rt, ELEMS);
+call_new(v2, lt, rt, ELEMS);
+
+if (memcmp(v1, v2, sizeof(int64_t[4])) != 0)
+fail();
+
+bench_new(v2, lt, rt, ELEMS);
+}
+
+report("ac3_sum_square_butterfly_int32");
+}
+
 void checkasm_check_ac3dsp(void)
 {
 AC3DSPContext c;
@@ -147,4 +173,5 @@ void checkasm_check_ac3dsp(void)
 check_ac3_exponent_min();
 check_ac3_extract_exponents();
 check_float_to_fixed24();
+check_ac3_sum_square_butterfly_int32();
 }
-- 
2.42.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v4 3/5] avcodec/ac3: Implement ac3_extract_exponents for aarch64 NEON

2024-04-06 Thread Geoff Hill
Signed-off-by: Geoff Hill 
---
 libavcodec/aarch64/ac3dsp_init_aarch64.c |  2 ++
 libavcodec/aarch64/ac3dsp_neon.S | 14 +
 tests/checkasm/ac3dsp.c  | 38 
 3 files changed, 54 insertions(+)

diff --git a/libavcodec/aarch64/ac3dsp_init_aarch64.c 
b/libavcodec/aarch64/ac3dsp_init_aarch64.c
index 8874b41393..1bdc215b51 100644
--- a/libavcodec/aarch64/ac3dsp_init_aarch64.c
+++ b/libavcodec/aarch64/ac3dsp_init_aarch64.c
@@ -26,6 +26,7 @@
 #include "config.h"
 
 void ff_ac3_exponent_min_neon(uint8_t *exp, int num_reuse_blocks, int 
nb_coefs);
+void ff_ac3_extract_exponents_neon(uint8_t *exp, int32_t *coef, int nb_coefs);
 void ff_float_to_fixed24_neon(int32_t *dst, const float *src, size_t len);
 
 av_cold void ff_ac3dsp_init_aarch64(AC3DSPContext *c)
@@ -34,5 +35,6 @@ av_cold void ff_ac3dsp_init_aarch64(AC3DSPContext *c)
 if (!have_neon(cpu_flags)) return;
 
 c->ac3_exponent_min = ff_ac3_exponent_min_neon;
+c->extract_exponents = ff_ac3_extract_exponents_neon;
 c->float_to_fixed24 = ff_float_to_fixed24_neon;
 }
diff --git a/libavcodec/aarch64/ac3dsp_neon.S b/libavcodec/aarch64/ac3dsp_neon.S
index f916c32538..c350c1f173 100644
--- a/libavcodec/aarch64/ac3dsp_neon.S
+++ b/libavcodec/aarch64/ac3dsp_neon.S
@@ -37,6 +37,20 @@ function ff_ac3_exponent_min_neon, export=1
 3:  ret
 endfunc
 
+function ff_ac3_extract_exponents_neon, export=1
+moviv1.4s, #8
+1:  ld1 {v0.4s}, [x1], #16
+abs v0.4s, v0.4s
+clz v0.4s, v0.4s
+sub v0.4s, v0.4s, v1.4s
+xtn v0.4h, v0.4s
+xtn v0.8b, v0.8h
+st1 {v0.s}[0], [x0], #4
+subsw2, w2, #4
+b.gt1b
+ret
+endfunc
+
 function ff_float_to_fixed24_neon, export=1
 1:  ld1 {v0.4s, v1.4s}, [x1], #32
 fcvtzs  v0.4s, v0.4s, #24
diff --git a/tests/checkasm/ac3dsp.c b/tests/checkasm/ac3dsp.c
index 06f31339f9..dc1b169e68 100644
--- a/tests/checkasm/ac3dsp.c
+++ b/tests/checkasm/ac3dsp.c
@@ -19,6 +19,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#include 
 #include 
 
 #include "libavutil/mem.h"
@@ -36,6 +37,16 @@
 }  \
 } while (0)
 
+#define randomize_i24(buf, len)  \
+do { \
+int i;   \
+for (i = 0; i < len; i++) {  \
+int32_t v = (int32_t)rnd();  \
+int32_t u = (v & 0xFF);  \
+buf[i] = (v < 0) ? -u : u;   \
+}\
+} while (0)
+
 #define randomize_float(buf, len)   \
 do {\
 int i;  \
@@ -77,6 +88,32 @@ static void check_ac3_exponent_min(AC3DSPContext *c) {
 report("ac3_exponent_min");
 }
 
+static void check_ac3_extract_exponents(AC3DSPContext *c) {
+#define MAX_EXPS 3072
+LOCAL_ALIGNED_16(int32_t, src, [MAX_EXPS]);
+LOCAL_ALIGNED_16(uint8_t, v1, [MAX_EXPS]);
+LOCAL_ALIGNED_16(uint8_t, v2, [MAX_EXPS]);
+int n;
+
+declare_func(void, uint8_t *, int32_t *, int);
+
+for (n = 512; n <= MAX_EXPS; n += 256) {
+if (check_func(c->extract_exponents, "ac3_extract_exponents_n%d", n)) {
+randomize_i24(src, n);
+
+call_ref(v1, src, n);
+call_new(v2, src, n);
+
+if (memcmp(v1, v2, n) != 0)
+fail();
+
+bench_new(v1, src, n);
+}
+}
+
+report("ac3_extract_exponents");
+}
+
 static void check_float_to_fixed24(AC3DSPContext *c) {
 #define BUF_SIZE 1024
 LOCAL_ALIGNED_32(float, src, [BUF_SIZE]);
@@ -108,5 +145,6 @@ void checkasm_check_ac3dsp(void)
 ff_ac3dsp_init();
 
 check_ac3_exponent_min();
+check_ac3_extract_exponents();
 check_float_to_fixed24();
 }
-- 
2.42.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v4 2/5] avcodec/ac3: Implement ac3_exponent_min for aarch64 NEON

2024-04-06 Thread Geoff Hill
Signed-off-by: Geoff Hill 
---
 libavcodec/aarch64/ac3dsp_init_aarch64.c |  2 ++
 libavcodec/aarch64/ac3dsp_neon.S | 16 +
 tests/checkasm/ac3dsp.c  | 41 
 3 files changed, 59 insertions(+)

diff --git a/libavcodec/aarch64/ac3dsp_init_aarch64.c 
b/libavcodec/aarch64/ac3dsp_init_aarch64.c
index e3320de0f5..8874b41393 100644
--- a/libavcodec/aarch64/ac3dsp_init_aarch64.c
+++ b/libavcodec/aarch64/ac3dsp_init_aarch64.c
@@ -25,6 +25,7 @@
 #include "libavcodec/ac3dsp.h"
 #include "config.h"
 
+void ff_ac3_exponent_min_neon(uint8_t *exp, int num_reuse_blocks, int 
nb_coefs);
 void ff_float_to_fixed24_neon(int32_t *dst, const float *src, size_t len);
 
 av_cold void ff_ac3dsp_init_aarch64(AC3DSPContext *c)
@@ -32,5 +33,6 @@ av_cold void ff_ac3dsp_init_aarch64(AC3DSPContext *c)
 int cpu_flags = av_get_cpu_flags();
 if (!have_neon(cpu_flags)) return;
 
+c->ac3_exponent_min = ff_ac3_exponent_min_neon;
 c->float_to_fixed24 = ff_float_to_fixed24_neon;
 }
diff --git a/libavcodec/aarch64/ac3dsp_neon.S b/libavcodec/aarch64/ac3dsp_neon.S
index c4d204b51a..f916c32538 100644
--- a/libavcodec/aarch64/ac3dsp_neon.S
+++ b/libavcodec/aarch64/ac3dsp_neon.S
@@ -21,6 +21,22 @@
 
 #include "libavutil/aarch64/asm.S"
 
+function ff_ac3_exponent_min_neon, export=1
+cbz w1, 3f
+1:  ld1 {v0.16b}, [x0]
+mov w3, w1
+add x4, x0, #256
+2:  ld1 {v1.16b}, [x4]
+uminv0.16b, v0.16b, v1.16b
+add x4, x4, #256
+subsw3, w3, #1
+b.gt2b
+st1 {v0.16b}, [x0], #16
+subsw2, w2, #16
+b.gt1b
+3:  ret
+endfunc
+
 function ff_float_to_fixed24_neon, export=1
 1:  ld1 {v0.4s, v1.4s}, [x1], #32
 fcvtzs  v0.4s, v0.4s, #24
diff --git a/tests/checkasm/ac3dsp.c b/tests/checkasm/ac3dsp.c
index b1064fccb4..06f31339f9 100644
--- a/tests/checkasm/ac3dsp.c
+++ b/tests/checkasm/ac3dsp.c
@@ -28,6 +28,14 @@
 
 #include "checkasm.h"
 
+#define randomize_exp(buf, len)\
+do {   \
+int i; \
+for (i = 0; i < len; i++) {\
+buf[i] = (uint8_t)rnd();   \
+}  \
+} while (0)
+
 #define randomize_float(buf, len)   \
 do {\
 int i;  \
@@ -37,6 +45,38 @@
 }   \
 } while (0)
 
+static void check_ac3_exponent_min(AC3DSPContext *c) {
+#define MAX_COEFS 256
+#define MAX_CTXT 6
+#define EXP_SIZE (MAX_CTXT * MAX_COEFS)
+
+LOCAL_ALIGNED_16(uint8_t, src, [EXP_SIZE]);
+LOCAL_ALIGNED_16(uint8_t, v1, [EXP_SIZE]);
+LOCAL_ALIGNED_16(uint8_t, v2, [EXP_SIZE]);
+int n;
+
+declare_func(void, uint8_t *, int, int);
+
+for (n = 0; n < MAX_CTXT; ++n) {
+if (check_func(c->ac3_exponent_min, "ac3_exponent_min_reuse%d", n)) {
+randomize_exp(src, EXP_SIZE);
+
+memcpy(v1, src, EXP_SIZE);
+memcpy(v2, src, EXP_SIZE);
+
+call_ref(v1, n, MAX_COEFS);
+call_new(v2, n, MAX_COEFS);
+
+if (memcmp(v1, v2, EXP_SIZE) != 0)
+fail();
+
+bench_new(v2, n, MAX_COEFS);
+}
+}
+
+report("ac3_exponent_min");
+}
+
 static void check_float_to_fixed24(AC3DSPContext *c) {
 #define BUF_SIZE 1024
 LOCAL_ALIGNED_32(float, src, [BUF_SIZE]);
@@ -67,5 +107,6 @@ void checkasm_check_ac3dsp(void)
 AC3DSPContext c;
 ff_ac3dsp_init();
 
+check_ac3_exponent_min();
 check_float_to_fixed24();
 }
-- 
2.42.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v4 1/5] avcodec/ac3: Implement float_to_fixed24 for aarch64 NEON

2024-04-06 Thread Geoff Hill
Signed-off-by: Geoff Hill 
---
 libavcodec/aarch64/Makefile  |  2 ++
 libavcodec/aarch64/ac3dsp_init_aarch64.c | 36 
 libavcodec/aarch64/ac3dsp_neon.S | 36 
 libavcodec/ac3dsp.c  |  4 ++-
 libavcodec/ac3dsp.h  |  3 +-
 tests/checkasm/ac3dsp.c  |  1 +
 6 files changed, 80 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/aarch64/ac3dsp_init_aarch64.c
 create mode 100644 libavcodec/aarch64/ac3dsp_neon.S

diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile
index beb6a02f5f..95ad4dd202 100644
--- a/libavcodec/aarch64/Makefile
+++ b/libavcodec/aarch64/Makefile
@@ -1,4 +1,5 @@
 # subsystems
+OBJS-$(CONFIG_AC3DSP)   += aarch64/ac3dsp_init_aarch64.o
 OBJS-$(CONFIG_FMTCONVERT)   += aarch64/fmtconvert_init.o
 OBJS-$(CONFIG_H264CHROMA)   += aarch64/h264chroma_init_aarch64.o
 OBJS-$(CONFIG_H264DSP)  += aarch64/h264dsp_init_aarch64.o
@@ -35,6 +36,7 @@ ARMV8-OBJS-$(CONFIG_VIDEODSP)   += aarch64/videodsp.o
 
 # subsystems
 NEON-OBJS-$(CONFIG_AAC_DECODER) += aarch64/sbrdsp_neon.o
+NEON-OBJS-$(CONFIG_AC3DSP)  += aarch64/ac3dsp_neon.o
 NEON-OBJS-$(CONFIG_FMTCONVERT)  += aarch64/fmtconvert_neon.o
 NEON-OBJS-$(CONFIG_H264CHROMA)  += aarch64/h264cmc_neon.o
 NEON-OBJS-$(CONFIG_H264DSP) += aarch64/h264dsp_neon.o  
\
diff --git a/libavcodec/aarch64/ac3dsp_init_aarch64.c 
b/libavcodec/aarch64/ac3dsp_init_aarch64.c
new file mode 100644
index 00..e3320de0f5
--- /dev/null
+++ b/libavcodec/aarch64/ac3dsp_init_aarch64.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2024 Geoff Hill 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include 
+
+#include "libavutil/arm/cpu.h"
+#include "libavutil/attributes.h"
+#include "libavcodec/ac3dsp.h"
+#include "config.h"
+
+void ff_float_to_fixed24_neon(int32_t *dst, const float *src, size_t len);
+
+av_cold void ff_ac3dsp_init_aarch64(AC3DSPContext *c)
+{
+int cpu_flags = av_get_cpu_flags();
+if (!have_neon(cpu_flags)) return;
+
+c->float_to_fixed24 = ff_float_to_fixed24_neon;
+}
diff --git a/libavcodec/aarch64/ac3dsp_neon.S b/libavcodec/aarch64/ac3dsp_neon.S
new file mode 100644
index 00..c4d204b51a
--- /dev/null
+++ b/libavcodec/aarch64/ac3dsp_neon.S
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2011 Mans Rullgard 
+ * Copyright (c) 2024 Geoff Hill 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "libavutil/aarch64/asm.S"
+
+function ff_float_to_fixed24_neon, export=1
+1:  ld1 {v0.4s, v1.4s}, [x1], #32
+fcvtzs  v0.4s, v0.4s, #24
+ld1 {v2.4s, v3.4s}, [x1], #32
+fcvtzs  v1.4s, v1.4s, #24
+fcvtzs  v2.4s, v2.4s, #24
+st1 {v0.4s, v1.4s}, [x0], #32
+fcvtzs  v3.4s, v3.4s, #24
+st1 {v2.4s, v3.4s}, [x0], #32
+subsw2, w2, #16
+b.ne1b
+ret
+endfunc
diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c
index 8397e03d32..730fa70fff 100644
--- a/libavcodec/ac3dsp.c
+++ b/libavcodec/ac3dsp.c
@@ -389,7 +389,9 @@ av_cold void ff_ac3dsp_init(AC3DSPContext *c)
 c->downmix   = NULL;
 c->downmix_fixed = NULL;
 
-#if ARCH_ARM
+#if ARCH_AARCH64
+ff_ac3dsp_init_aarch64(c);
+#elif ARCH_ARM
 ff_ac3dsp_init_arm(c);
 #elif ARCH_X86
 ff_ac3dsp_init_x86(c);
diff --git a/libavcodec/ac3dsp.h 

[FFmpeg-devel] [PATCH v4 0/5] avcodec/ac3: Add aarch64 NEON DSP

2024-04-06 Thread Geoff Hill
Thanks Martin for your review and testing.

Here's v4 with the following changes:

  * Use fmal in sum_square_butterfly_float loop. Faster.

  * Removed redundant loop bound zero checks in extract_exponents,
sum_square_bufferfly_int32 and sum_square_bufferfly_float.

  * Fixed randomize_int24() to also use negative values.

  * Carry copyright from arm implementation over to aarch64. I
did use this version as reference.

  * Fix indentation to match existing aarch64 assembly style.

Tested once again on aarch64 and x86.

On AWS Graviton2 (t4g.medium), GCC 12.3:

$ tests/checkasm/checkasm --bench --test=ac3dsp
...
NEON:
 - ac3dsp.ac3_exponent_min   [OK]
 - ac3dsp.ac3_extract_exponents  [OK]
 - ac3dsp.float_to_fixed24   [OK]
 - ac3dsp.ac3_sum_square_butterfly_int32 [OK]
 - ac3dsp.ac3_sum_square_butterfly_float [OK]
checkasm: all 20 tests passed
ac3_exponent_min_reuse0_c: 7.5
ac3_exponent_min_reuse0_neon: 7.5
ac3_exponent_min_reuse1_c: 1044.0
ac3_exponent_min_reuse1_neon: 57.0
ac3_exponent_min_reuse2_c: 2073.0
ac3_exponent_min_reuse2_neon: 73.7
ac3_exponent_min_reuse3_c: 2596.2
ac3_exponent_min_reuse3_neon: 154.0
ac3_exponent_min_reuse4_c: 3107.2
ac3_exponent_min_reuse4_neon: 169.2
ac3_exponent_min_reuse5_c: 3615.2
ac3_exponent_min_reuse5_neon: 185.2
ac3_extract_exponents_n512_c: 1672.0
ac3_extract_exponents_n512_neon: 517.5
ac3_extract_exponents_n768_c: 2505.0
ac3_extract_exponents_n768_neon: 770.5
ac3_extract_exponents_n1024_c: 3304.0
ac3_extract_exponents_n1024_neon: 1022.0
ac3_extract_exponents_n1280_c: 4163.5
ac3_extract_exponents_n1280_neon: 1279.5
ac3_extract_exponents_n1536_c: 5001.2
ac3_extract_exponents_n1536_neon: 1553.2
ac3_extract_exponents_n1792_c: 5823.5
ac3_extract_exponents_n1792_neon: 1851.7
ac3_extract_exponents_n2048_c: 6601.5
ac3_extract_exponents_n2048_neon: 2116.2
ac3_extract_exponents_n2304_c: 7425.2
ac3_extract_exponents_n2304_neon: 2382.7
ac3_extract_exponents_n2560_c: 8278.5
ac3_extract_exponents_n2560_neon: 2620.5
ac3_extract_exponents_n2816_c: 9079.5
ac3_extract_exponents_n2816_neon: 2893.2
ac3_extract_exponents_n3072_c: 10026.5
ac3_extract_exponents_n3072_neon: 3127.0
ac3_sum_square_bufferfly_float_c: 1647.5
ac3_sum_square_bufferfly_float_neon: 229.5
ac3_sum_square_bufferfly_int32_c: 963.5
ac3_sum_square_bufferfly_int32_neon: 546.5
float_to_fixed24_c: 2460.5
float_to_fixed24_neon: 561.5


Geoff Hill (5):
  avcodec/ac3: Implement float_to_fixed24 for aarch64 NEON
  avcodec/ac3: Implement ac3_exponent_min for aarch64 NEON
  avcodec/ac3: Implement ac3_extract_exponents for aarch64 NEON
  avcodec/ac3: Implement sum_square_butterfly_int32 for aarch64 NEON
  avcodec/ac3: Implement sum_square_butterfly_float for aarch64 NEON

 libavcodec/aarch64/Makefile  |   2 +
 libavcodec/aarch64/ac3dsp_init_aarch64.c |  50 +
 libavcodec/aarch64/ac3dsp_neon.S | 119 
 libavcodec/ac3dsp.c  |   4 +-
 libavcodec/ac3dsp.h  |   3 +-
 tests/checkasm/ac3dsp.c  | 133 +++
 6 files changed, 309 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/aarch64/ac3dsp_init_aarch64.c
 create mode 100644 libavcodec/aarch64/ac3dsp_neon.S

-- 
2.42.0
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2] lavc/vvc: Error if SPS ID is duplicated within CVS

2024-04-06 Thread Frank Plowman
Key line from the spec is:

"All SPS NAL units with a particular value of sps_seq_parameter_set_id
in a CVS shall have the same content."

Prior to this patch, the VVC decoder's behaviour on encountering a
duplicated SPS ID (within the entire bitstream, not restricted to
a CVS) was simply to replace the entry in the SPS lookup table with the
new data.  Illegal bitstreams with multiple SPSs in the same CVS sharing
an ID but differing elsewhere could cause all manner of issues.

The patch tracks which SPS IDs have been used in the given CVS using the
new sps_id_used field of VVCParamSets.  If it encounters an SPS with an
ID already in use and whose content differs from the previous SPS, it
throws an AVERROR_INVALIDDATA.

Signed-off-by: Frank Plowman 
---
Changes since v1:
* Track which SPS IDs are in use using a bit field rather than a bool
  array.
* Move sps_id_used to the end of VVCParamSets.
* Style: remove blank line & add braces for clarity.

 libavcodec/vvc/vvc_ps.c | 28 
 libavcodec/vvc/vvc_ps.h |  2 ++
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c
index 301fa16400..7e967180d2 100644
--- a/libavcodec/vvc/vvc_ps.c
+++ b/libavcodec/vvc/vvc_ps.c
@@ -219,14 +219,22 @@ fail:
 return NULL;
 }
 
-static int decode_sps(VVCParamSets *ps, const H266RawSPS *rsps, void *log_ctx)
+static int decode_sps(VVCParamSets *ps, const H266RawSPS *rsps, void *log_ctx, 
int is_clvss)
 {
 const int sps_id= rsps->sps_seq_parameter_set_id;
 const VVCSPS *old_sps   = ps->sps_list[sps_id];
 const VVCSPS *sps;
 
-if (old_sps && old_sps->r == rsps)
-return 0;
+if (is_clvss) {
+ps->sps_id_used = 0;
+}
+
+if (old_sps) {
+if (old_sps->r == rsps || !memcmp(old_sps->r, rsps, 
sizeof(*old_sps->r)))
+return 0;
+else if (ps->sps_id_used & (1 << sps_id))
+return AVERROR_INVALIDDATA;
+}
 
 sps = sps_alloc(rsps, log_ctx);
 if (!sps)
@@ -234,6 +242,7 @@ static int decode_sps(VVCParamSets *ps, const H266RawSPS 
*rsps, void *log_ctx)
 
 ff_refstruct_unref(>sps_list[sps_id]);
 ps->sps_list[sps_id] = sps;
+ps->sps_id_used |= (1 << sps_id);
 
 return 0;
 }
@@ -610,7 +619,7 @@ static int decode_pps(VVCParamSets *ps, const H266RawPPS 
*rpps)
 return ret;
 }
 
-static int decode_ps(VVCParamSets *ps, const CodedBitstreamH266Context *h266, 
void *log_ctx)
+static int decode_ps(VVCParamSets *ps, const CodedBitstreamH266Context *h266, 
void *log_ctx, int is_clvss)
 {
 const H266RawPictureHeader *ph = h266->ph;
 const H266RawPPS *rpps;
@@ -628,7 +637,7 @@ static int decode_ps(VVCParamSets *ps, const 
CodedBitstreamH266Context *h266, vo
 if (!rsps)
 return AVERROR_INVALIDDATA;
 
-ret = decode_sps(ps, rsps, log_ctx);
+ret = decode_sps(ps, rsps, log_ctx, is_clvss);
 if (ret < 0)
 return ret;
 
@@ -867,13 +876,16 @@ int ff_vvc_decode_frame_ps(VVCFrameParamSets *fps, struct 
VVCContext *s)
 int ret = 0;
 VVCParamSets *ps= >ps;
 const CodedBitstreamH266Context *h266   = s->cbc->priv_data;
+int is_clvss;
+
+decode_recovery_flag(s);
+is_clvss = IS_CLVSS(s);
 
-ret = decode_ps(ps, h266, s->avctx);
+ret = decode_ps(ps, h266, s->avctx, is_clvss);
 if (ret < 0)
 return ret;
 
-decode_recovery_flag(s);
-ret = decode_frame_ps(fps, ps, h266, s->poc_tid0, IS_CLVSS(s));
+ret = decode_frame_ps(fps, ps, h266, s->poc_tid0, is_clvss);
 decode_recovery_poc(s, >ph);
 return ret;
 }
diff --git a/libavcodec/vvc/vvc_ps.h b/libavcodec/vvc/vvc_ps.h
index f60d8b81c6..710673ebed 100644
--- a/libavcodec/vvc/vvc_ps.h
+++ b/libavcodec/vvc/vvc_ps.h
@@ -214,6 +214,8 @@ typedef struct VVCParamSets {
 const VVCALF*alf_list[VVC_MAX_ALF_COUNT];   ///< RefStruct 
reference
 const H266RawAPS*lmcs_list[VVC_MAX_LMCS_COUNT]; ///< RefStruct 
reference
 const VVCScalingList*scaling_list[VVC_MAX_SL_COUNT];///< RefStruct 
reference
+// Bit field of SPS IDs used in the current CVS
+  uint16_t   sps_id_used;
 } VVCParamSets;
 
 typedef struct VVCFrameParamSets {
-- 
2.44.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] lavc/vvc: Error if SPS ID is duplicated within CVS

2024-04-06 Thread Nuo Mi
Hi Frank,
Thank you for the patch.

On Thu, Apr 4, 2024 at 3:01 AM Frank Plowman  wrote:

> Key line from the spec is:
>
> "All SPS NAL units with a particular value of sps_seq_parameter_set_id
> in a CVS shall have the same content."
>
> Prior to this patch, the VVC decoder's behaviour on encountering a
> duplicated SPS ID (within the entire bitstream, not restricted to
> a CVS) was simply to replace the entry in the SPS lookup table with the
> new data.  Illegal bitstreams with multiple SPSs in the same CVS sharing
> an ID but differing elsewhere could cause all manner of issues.
>
> The patch tracks which SPS IDs have been used in the given CVS using the
> new sps_id_used field of VVCParamSets.  If it encounters an SPS with an
> ID already in use and whose content differs from the previous SPS, it
> throws an AVERROR_INVALIDDATA.
> ---
>  libavcodec/vvc/vvc_ps.c | 29 +
>  libavcodec/vvc/vvc_ps.h |  1 +
>  2 files changed, 22 insertions(+), 8 deletions(-)
>
> diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c
> index 301fa16400..7a8daaa6ad 100644
> --- a/libavcodec/vvc/vvc_ps.c
> +++ b/libavcodec/vvc/vvc_ps.c
> @@ -219,14 +219,23 @@ fail:
>  return NULL;
>  }
>
> -static int decode_sps(VVCParamSets *ps, const H266RawSPS *rsps, void
> *log_ctx)
> +static int decode_sps(VVCParamSets *ps, const H266RawSPS *rsps, void
> *log_ctx, int is_clvss)
>  {
>  const int sps_id= rsps->sps_seq_parameter_set_id;
>  const VVCSPS *old_sps   = ps->sps_list[sps_id];
>  const VVCSPS *sps;
>
> -if (old_sps && old_sps->r == rsps)
> -return 0;
> +if (is_clvss) {
> +for (int sps_id = 0; sps_id < VVC_MAX_SPS_COUNT; ++sps_id)
> +ps->sps_id_used[sps_id] = 0;
> +}
> +
> +if (old_sps)
>
 better use a bracket here.

> +if (old_sps->r == rsps || !memcmp(old_sps->r, rsps,
> sizeof(*old_sps->r)))
> +return 0;
> +else if (ps->sps_id_used[sps_id])
> +return AVERROR_INVALIDDATA;
> +

trailing space.

>
>
>  sps = sps_alloc(rsps, log_ctx);
>  if (!sps)
> @@ -234,6 +243,7 @@ static int decode_sps(VVCParamSets *ps, const
> H266RawSPS *rsps, void *log_ctx)
>
>  ff_refstruct_unref(>sps_list[sps_id]);
>  ps->sps_list[sps_id] = sps;
> +ps->sps_id_used[sps_id] = 1;
>
>  return 0;
>  }
> @@ -610,7 +620,7 @@ static int decode_pps(VVCParamSets *ps, const
> H266RawPPS *rpps)
>  return ret;
>  }
>
> -static int decode_ps(VVCParamSets *ps, const CodedBitstreamH266Context
> *h266, void *log_ctx)
> +static int decode_ps(VVCParamSets *ps, const CodedBitstreamH266Context
> *h266, void *log_ctx, int is_clvss)
>  {
>  const H266RawPictureHeader *ph = h266->ph;
>  const H266RawPPS *rpps;
> @@ -628,7 +638,7 @@ static int decode_ps(VVCParamSets *ps, const
> CodedBitstreamH266Context *h266, vo
>  if (!rsps)
>  return AVERROR_INVALIDDATA;
>
> -ret = decode_sps(ps, rsps, log_ctx);
> +ret = decode_sps(ps, rsps, log_ctx, is_clvss);
>  if (ret < 0)
>  return ret;
>
> @@ -867,13 +877,16 @@ int ff_vvc_decode_frame_ps(VVCFrameParamSets *fps,
> struct VVCContext *s)
>  int ret = 0;
>  VVCParamSets *ps= >ps;
>  const CodedBitstreamH266Context *h266   = s->cbc->priv_data;
> +int is_clvss;
>
> -ret = decode_ps(ps, h266, s->avctx);
> +decode_recovery_flag(s);
> +is_clvss = IS_CLVSS(s);
> +
> +ret = decode_ps(ps, h266, s->avctx, is_clvss);
>  if (ret < 0)
>  return ret;
>
> -decode_recovery_flag(s);
> -ret = decode_frame_ps(fps, ps, h266, s->poc_tid0, IS_CLVSS(s));
> +ret = decode_frame_ps(fps, ps, h266, s->poc_tid0, is_clvss);
>  decode_recovery_poc(s, >ph);
>  return ret;
>  }
> diff --git a/libavcodec/vvc/vvc_ps.h b/libavcodec/vvc/vvc_ps.h
> index f60d8b81c6..b293043de8 100644
> --- a/libavcodec/vvc/vvc_ps.h
> +++ b/libavcodec/vvc/vvc_ps.h
> @@ -210,6 +210,7 @@ typedef struct VVCLMCS {
>
>  typedef struct VVCParamSets {
>  const VVCSPS*sps_list[VVC_MAX_SPS_COUNT];   ///<
> RefStruct reference
> +  intsps_id_used[VVC_MAX_SPS_COUNT];
>
The int array seems excessive for just a flag. Let's replace it with a
uint16_t.
Also, please relocate sps_id_used to the end of the structure."

>  const VVCPPS*pps_list[VVC_MAX_PPS_COUNT];   ///<
> RefStruct reference
>  const VVCALF*alf_list[VVC_MAX_ALF_COUNT];   ///<
> RefStruct reference
>  const H266RawAPS*lmcs_list[VVC_MAX_LMCS_COUNT]; ///<
> RefStruct reference
> --
> 2.44.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org

[FFmpeg-devel] [PATCH] avcodec/h264dec: Remove unused coded_picture_number

2024-04-06 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/h264_slice.c | 1 -
 libavcodec/h264dec.h| 1 -
 2 files changed, 2 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 4b01c54147..f61af0d6d7 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -388,7 +388,6 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
 
 h->width_from_caller= h1->width_from_caller;
 h->height_from_caller   = h1->height_from_caller;
-h->coded_picture_number = h1->coded_picture_number;
 h->first_field  = h1->first_field;
 h->picture_structure= h1->picture_structure;
 h->mb_aff_frame = h1->mb_aff_frame;
diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h
index 447c2499d9..fc50df90f2 100644
--- a/libavcodec/h264dec.h
+++ b/libavcodec/h264dec.h
@@ -356,7 +356,6 @@ typedef struct H264Context {
 int chroma_x_shift, chroma_y_shift;
 
 int droppable;
-int coded_picture_number;
 
 int context_initialized;
 int flags;
-- 
2.40.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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 08/11] fftools/opt_common: switch to avcodec_get_supported_config()

2024-04-06 Thread Niklas Haas
On Fri, 05 Apr 2024 16:36:50 -0300 James Almer  wrote:
> On 4/5/2024 3:57 PM, Niklas Haas wrote:
> > From: Niklas Haas 
> > 
> > While rewriting this macro, I decided to make it a bit more flexible so
> > it can work for all of the fields (including future fields) in a more
> > generic way.
> > ---
> >   fftools/opt_common.c | 86 ++--
> >   1 file changed, 43 insertions(+), 43 deletions(-)
> > 
> > diff --git a/fftools/opt_common.c b/fftools/opt_common.c
> > index 947a226d8d1..1bf66580192 100644
> > --- a/fftools/opt_common.c
> > +++ b/fftools/opt_common.c
> > @@ -262,22 +262,32 @@ int show_buildconf(void *optctx, const char *opt, 
> > const char *arg)
> >   return 0;
> >   }
> >   
> > -#define PRINT_CODEC_SUPPORTED(codec, field, type, list_name, term, 
> > get_name) \
> > -if (codec->field) {
> >   \
> > -const type *p = codec->field;  
> >   \
> > -   
> >   \
> > -printf("Supported " list_name ":");
> >   \
> > -while (*p != term) {   
> >   \
> > -get_name(*p);  
> >   \
> > -printf(" %s", name);   
> >   \
> > -p++;   
> >   \
> > -}  
> >   \
> > -printf("\n");  
> >   \
> > -}  
> >   \
> > +#define PRINT_CODEC_SUPPORTED(codec, config, type, name, elem, cond, fmt, 
> > ...)  \
> > +do {   
> >  \
> > +const type *elem = NULL;   
> >  \
> > +avcodec_get_supported_config(NULL, codec, config, 0,   
> >  \
> > + (const void **) );   
> >  \
> > +if (elem) {
> >  \
> > +printf("Supported " name ":"); 
> >  \
> > +while (cond) { 
> >  \
> > +printf(" " fmt, __VA_ARGS__);  
> >  \
> > +elem++;
> >  \
> > +}  
> >  \
> > +printf("\n");  
> >  \
> > +}  
> >  \
> > +} while (0)
> > +
> > +static char *get_channel_layout_desc(const AVChannelLayout *layout,
> > + char desc[], int desc_size)
> > +{
> > +av_channel_layout_describe(layout, desc, desc_size);
> > +return desc;
> > +}
> >   
> >   static void print_codec(const AVCodec *c)
> >   {
> >   int encoder = av_codec_is_encoder(c);
> > +char desc[128];
> >   
> >   printf("%s %s [%s]:\n", encoder ? "Encoder" : "Decoder", c->name,
> >  c->long_name ? c->long_name : "");
> > @@ -343,35 +353,19 @@ static void print_codec(const AVCodec *c)
> >   printf("\n");
> >   }
> >   
> > -if (c->supported_framerates) {
> > -const AVRational *fps = c->supported_framerates;
> > -
> > -printf("Supported framerates:");
> > -while (fps->num) {
> > -printf(" %d/%d", fps->num, fps->den);
> > -fps++;
> > -}
> > -printf("\n");
> > -}
> > -PRINT_CODEC_SUPPORTED(c, pix_fmts, enum AVPixelFormat, "pixel formats",
> > -  AV_PIX_FMT_NONE, GET_PIX_FMT_NAME);
> > -PRINT_CODEC_SUPPORTED(c, supported_samplerates, int, "sample rates", 0,
> > -  GET_SAMPLE_RATE_NAME);
> > -PRINT_CODEC_SUPPORTED(c, sample_fmts, enum AVSampleFormat, "sample 
> > formats",
> > -  AV_SAMPLE_FMT_NONE, GET_SAMPLE_FMT_NAME);
> > -
> > -if (c->ch_layouts) {
> > -const AVChannelLayout *p = c->ch_layouts;
> > -
> > -printf("Supported channel layouts:");
> > -while (p->nb_channels) {
> > -char name[128];
> > -av_channel_layout_describe(p, name, sizeof(name));
> > -printf(" %s", name);
> > -p++;
> > -}
> > -printf("\n");
> > -}
> > +PRINT_CODEC_SUPPORTED(c, AV_CODEC_CONFIG_FRAME_RATE, AVRational, 
> > "framerates",
> > +  fps, fps->num, "%d/%d", fps->num, fps->den);
> > +   

Re: [FFmpeg-devel] [PATCH] lavf/matroskaenc: sort options by name

2024-04-06 Thread Stefano Sabatini
On date Saturday 2024-04-06 13:25:49 +0200, Andreas Rheinhardt wrote:
> Stefano Sabatini:
> > ---
> >  libavformat/matroskaenc.c | 12 ++--
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> > 
[...]
> See https://ffmpeg.org/pipermail/ffmpeg-devel/2024-February/320849.html

> Additionally I do not agree that sorting options by name is the best
> way;

> it should be sorted by what are (believed to be) the most commonly
> used options.

This is highly arbitrary and subjective, the best way is sort-by-name
as already done in other places (and I still find the git blame
argument rather weak for the reasons I already explained).

The alternative - which I observe all the time - is that when a new
option is added an arbitrary place is assigned and more confusion is
added.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] lavf/matroskaenc: sort options by name

2024-04-06 Thread Andreas Rheinhardt
Stefano Sabatini:
> ---
>  libavformat/matroskaenc.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 566e9f4981..8ebe6e4334 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -3500,20 +3500,20 @@ static const AVCodecTag additional_subtitle_tags[] = {
>  #define OFFSET(x) offsetof(MatroskaMuxContext, x)
>  #define FLAGS AV_OPT_FLAG_ENCODING_PARAM
>  static const AVOption options[] = {
> -{ "reserve_index_space", "Reserve a given amount of space (in bytes) at 
> the beginning of the file for the index (cues).", OFFSET(reserve_cues_space), 
> AV_OPT_TYPE_INT,   { .i64 = 0 },   0, INT_MAX,   FLAGS },
> -{ "cues_to_front", "Move Cues (the index) to the front by shifting data 
> if necessary", OFFSET(move_cues_to_front), AV_OPT_TYPE_BOOL, { .i64 = 0}, 0, 
> 1, FLAGS },
> +{ "allow_raw_vfw", "allow RAW VFW mode", OFFSET(allow_raw_vfw), 
> AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
>  { "cluster_size_limit",  "Store at most the provided amount of bytes in 
> a cluster. ", OFFSET(cluster_size_limit), 
> AV_OPT_TYPE_INT  , { .i64 = -1 }, -1, INT_MAX,   FLAGS },
>  { "cluster_time_limit",  "Store at most the provided number of 
> milliseconds in a cluster.",   
> OFFSET(cluster_time_limit), AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, INT64_MAX, 
> FLAGS },
> +{ "cues_to_front", "Move Cues (the index) to the front by shifting data 
> if necessary", OFFSET(move_cues_to_front), AV_OPT_TYPE_BOOL, { .i64 = 0}, 0, 
> 1, FLAGS },
>  { "dash", "Create a WebM file conforming to WebM DASH specification", 
> OFFSET(is_dash), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
>  { "dash_track_number", "Track number for the DASH stream", 
> OFFSET(dash_track_number), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, INT_MAX, FLAGS },
> -{ "live", "Write files assuming it is a live stream.", OFFSET(is_live), 
> AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
> -{ "allow_raw_vfw", "allow RAW VFW mode", OFFSET(allow_raw_vfw), 
> AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
> -{ "flipped_raw_rgb", "Raw RGB bitmaps in VFW mode are stored bottom-up", 
> OFFSET(flipped_raw_rgb), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
> -{ "write_crc32", "write a CRC32 element inside every Level 1 element", 
> OFFSET(write_crc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS },
>  { "default_mode", "Controls how a track's FlagDefault is inferred", 
> OFFSET(default_mode), AV_OPT_TYPE_INT, { .i64 = DEFAULT_MODE_PASSTHROUGH }, 
> DEFAULT_MODE_INFER, DEFAULT_MODE_PASSTHROUGH, FLAGS, .unit = "default_mode" },
> +{ "flipped_raw_rgb", "Raw RGB bitmaps in VFW mode are stored bottom-up", 
> OFFSET(flipped_raw_rgb), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
>  { "infer", "For each track type, mark each track of disposition default 
> as default; if none exists, mark the first track as default.", 0, 
> AV_OPT_TYPE_CONST, { .i64 = DEFAULT_MODE_INFER }, 0, 0, FLAGS, .unit = 
> "default_mode" },
>  { "infer_no_subs", "For each track type, mark each track of disposition 
> default as default; for audio and video: if none exists, mark the first track 
> as default.", 0, AV_OPT_TYPE_CONST, { .i64 = DEFAULT_MODE_INFER_NO_SUBS }, 0, 
> 0, FLAGS, .unit = "default_mode" },
> +{ "live", "Write files assuming it is a live stream.", OFFSET(is_live), 
> AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
>  { "passthrough", "Use the disposition flag as-is", 0, AV_OPT_TYPE_CONST, 
> { .i64 = DEFAULT_MODE_PASSTHROUGH }, 0, 0, FLAGS, .unit = "default_mode" },
> +{ "reserve_index_space", "Reserve a given amount of space (in bytes) at 
> the beginning of the file for the index (cues).", OFFSET(reserve_cues_space), 
> AV_OPT_TYPE_INT,   { .i64 = 0 },   0, INT_MAX,   FLAGS },
> +{ "write_crc32", "write a CRC32 element inside every Level 1 element", 
> OFFSET(write_crc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS },
>  { NULL },
>  };
>  

See https://ffmpeg.org/pipermail/ffmpeg-devel/2024-February/320849.html
Additionally I do not agree that sorting options by name is the best
way; it should be sorted by what are (believed to be) the most commonly
used options.

- Andreas

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avcodec/hevcdec: fix segfault on invalid film grain metadata

2024-04-06 Thread Niklas Haas
From: Niklas Haas 

Invalid input files may contain film grain metadata which survives
ff_h274_film_grain_params_supported() but does not pass
av_film_grain_params_select(), leading to a SIGSEGV on hevc_frame_end().

Fix this by duplicating the av_film_grain_params_select() check at frame
init time.

An alternative solution here would be to defer the incompatibility check
to hevc_frame_end(), but this has the downside of allocating a film
grain buffer even when we already know we can't apply film grain.

Fixes: https://trac.ffmpeg.org/ticket/10951
---
 libavcodec/hevcdec.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 727b02f0f40..d3b668af00e 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2893,10 +2893,15 @@ static int hevc_frame_start(HEVCContext *s)
 !(s->avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN) &&
 !s->avctx->hwaccel;
 
+ret = set_side_data(s);
+if (ret < 0)
+goto fail;
+
 if (s->ref->needs_fg &&
-s->sei.common.film_grain_characteristics.present &&
-
!ff_h274_film_grain_params_supported(s->sei.common.film_grain_characteristics.model_id,
- s->ref->frame->format)) {
+( s->sei.common.film_grain_characteristics.present &&
+  
!ff_h274_film_grain_params_supported(s->sei.common.film_grain_characteristics.model_id,
+ s->ref->frame->format))
+  || !av_film_grain_params_select(s->ref->frame)) {
 av_log_once(s->avctx, AV_LOG_WARNING, AV_LOG_DEBUG, 
>film_grain_warning_shown,
 "Unsupported film grain parameters. Ignoring film 
grain.\n");
 s->ref->needs_fg = 0;
@@ -2910,10 +2915,6 @@ static int hevc_frame_start(HEVCContext *s)
 goto fail;
 }
 
-ret = set_side_data(s);
-if (ret < 0)
-goto fail;
-
 s->frame->pict_type = 3 - s->sh.slice_type;
 
 if (!IS_IRAP(s))
-- 
2.44.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] lavf/matroskaenc: sort options by name

2024-04-06 Thread Stefano Sabatini
---
 libavformat/matroskaenc.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 566e9f4981..8ebe6e4334 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -3500,20 +3500,20 @@ static const AVCodecTag additional_subtitle_tags[] = {
 #define OFFSET(x) offsetof(MatroskaMuxContext, x)
 #define FLAGS AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
-{ "reserve_index_space", "Reserve a given amount of space (in bytes) at 
the beginning of the file for the index (cues).", OFFSET(reserve_cues_space), 
AV_OPT_TYPE_INT,   { .i64 = 0 },   0, INT_MAX,   FLAGS },
-{ "cues_to_front", "Move Cues (the index) to the front by shifting data if 
necessary", OFFSET(move_cues_to_front), AV_OPT_TYPE_BOOL, { .i64 = 0}, 0, 1, 
FLAGS },
+{ "allow_raw_vfw", "allow RAW VFW mode", OFFSET(allow_raw_vfw), 
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
 { "cluster_size_limit",  "Store at most the provided amount of bytes in a 
cluster. ", OFFSET(cluster_size_limit), 
AV_OPT_TYPE_INT  , { .i64 = -1 }, -1, INT_MAX,   FLAGS },
 { "cluster_time_limit",  "Store at most the provided number of 
milliseconds in a cluster.",   
OFFSET(cluster_time_limit), AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, INT64_MAX, 
FLAGS },
+{ "cues_to_front", "Move Cues (the index) to the front by shifting data if 
necessary", OFFSET(move_cues_to_front), AV_OPT_TYPE_BOOL, { .i64 = 0}, 0, 1, 
FLAGS },
 { "dash", "Create a WebM file conforming to WebM DASH specification", 
OFFSET(is_dash), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
 { "dash_track_number", "Track number for the DASH stream", 
OFFSET(dash_track_number), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, INT_MAX, FLAGS },
-{ "live", "Write files assuming it is a live stream.", OFFSET(is_live), 
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
-{ "allow_raw_vfw", "allow RAW VFW mode", OFFSET(allow_raw_vfw), 
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
-{ "flipped_raw_rgb", "Raw RGB bitmaps in VFW mode are stored bottom-up", 
OFFSET(flipped_raw_rgb), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
-{ "write_crc32", "write a CRC32 element inside every Level 1 element", 
OFFSET(write_crc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS },
 { "default_mode", "Controls how a track's FlagDefault is inferred", 
OFFSET(default_mode), AV_OPT_TYPE_INT, { .i64 = DEFAULT_MODE_PASSTHROUGH }, 
DEFAULT_MODE_INFER, DEFAULT_MODE_PASSTHROUGH, FLAGS, .unit = "default_mode" },
+{ "flipped_raw_rgb", "Raw RGB bitmaps in VFW mode are stored bottom-up", 
OFFSET(flipped_raw_rgb), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
 { "infer", "For each track type, mark each track of disposition default as 
default; if none exists, mark the first track as default.", 0, 
AV_OPT_TYPE_CONST, { .i64 = DEFAULT_MODE_INFER }, 0, 0, FLAGS, .unit = 
"default_mode" },
 { "infer_no_subs", "For each track type, mark each track of disposition 
default as default; for audio and video: if none exists, mark the first track 
as default.", 0, AV_OPT_TYPE_CONST, { .i64 = DEFAULT_MODE_INFER_NO_SUBS }, 0, 
0, FLAGS, .unit = "default_mode" },
+{ "live", "Write files assuming it is a live stream.", OFFSET(is_live), 
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
 { "passthrough", "Use the disposition flag as-is", 0, AV_OPT_TYPE_CONST, { 
.i64 = DEFAULT_MODE_PASSTHROUGH }, 0, 0, FLAGS, .unit = "default_mode" },
+{ "reserve_index_space", "Reserve a given amount of space (in bytes) at 
the beginning of the file for the index (cues).", OFFSET(reserve_cues_space), 
AV_OPT_TYPE_INT,   { .i64 = 0 },   0, INT_MAX,   FLAGS },
+{ "write_crc32", "write a CRC32 element inside every Level 1 element", 
OFFSET(write_crc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS },
 { NULL },
 };
 
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 5/7] doc/muxers: add kvag

2024-04-06 Thread Stefano Sabatini
---
 doc/muxers.texi | 8 
 1 file changed, 8 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 6b85befb43..6eea856a40 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -2717,6 +2717,14 @@ This muxer accepts a single @samp{jacosub} subtitles 
stream.
 For more information about the format, see
 @url{http://unicorn.us.com/jacosub/jscripts.html}.
 
+@section kvag
+Simon & Schuster Interactive VAG muxer.
+
+This custom VAG container is used by some Simon & Schuster Interactive
+games such as "Real War", and "Real War: Rogue States".
+
+This muxer accepts a single @samp{adpcm_ima_ssi} audio stream.
+
 @section matroska
 
 Matroska container muxer.
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 7/7] doc/muxers: add lrc

2024-04-06 Thread Stefano Sabatini
---
 doc/muxers.texi | 25 +
 1 file changed, 25 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 6eea856a40..3928ebc549 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -2725,6 +2725,31 @@ games such as "Real War", and "Real War: Rogue States".
 
 This muxer accepts a single @samp{adpcm_ima_ssi} audio stream.
 
+@section lrc
+LRC lyrics file format muxer.
+
+LRC (short for LyRiCs) is a computer file format that synchronizes
+song lyrics with an audio file, such as MP3, Vorbis, or MIDI.
+
+This muxer accepts a single @samp{subrip} or @samp{text} subtitles stream.
+
+@subsection Metadata
+The following metadata tags are converted to the format corresponding
+metadata:
+
+@table @option
+@item title
+@item album
+@item artist
+@item author
+@item creator
+@item encoder
+@item encoder_version
+@end table
+
+If @samp{encoder_version} is not explicitly set, it is automatically
+set to the libavformat version.
+
 @section matroska
 
 Matroska container muxer.
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 4/7] doc/muxers: add jacosub

2024-04-06 Thread Stefano Sabatini
---
 doc/muxers.texi | 8 
 1 file changed, 8 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 29b6fa1427..6b85befb43 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -2709,6 +2709,14 @@ Corporation), to store internally developed codecs.
 This muxer accepts a single @samp{vp8}, @samp{vp9}, or @samp{av1}
 video stream.
 
+@section jacosub
+JACOsub subtitle format muxer.
+
+This muxer accepts a single @samp{jacosub} subtitles stream.
+
+For more information about the format, see
+@url{http://unicorn.us.com/jacosub/jscripts.html}.
+
 @section matroska
 
 Matroska container muxer.
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 4/7] doc/muxers: add jacosub

2024-04-06 Thread Stefano Sabatini
---
 doc/muxers.texi | 8 
 1 file changed, 8 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 29b6fa1427..6b85befb43 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -2709,6 +2709,14 @@ Corporation), to store internally developed codecs.
 This muxer accepts a single @samp{vp8}, @samp{vp9}, or @samp{av1}
 video stream.
 
+@section jacosub
+JACOsub subtitle format muxer.
+
+This muxer accepts a single @samp{jacosub} subtitles stream.
+
+For more information about the format, see
+@url{http://unicorn.us.com/jacosub/jscripts.html}.
+
 @section matroska
 
 Matroska container muxer.
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 3/7] doc/muxers: add ivf

2024-04-06 Thread Stefano Sabatini
---
 doc/muxers.texi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index d8a1f83309..29b6fa1427 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -2700,6 +2700,15 @@ computer-generated compositions.
 
 This muxer accepts a single audio stream containing PCM data.
 
+@section ivf
+On2 IVF muxer.
+
+IVF was developed by On2 Technologies (formerly known as Duck
+Corporation), to store internally developed codecs.
+
+This muxer accepts a single @samp{vp8}, @samp{vp9}, or @samp{av1}
+video stream.
+
 @section matroska
 
 Matroska container muxer.
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/2] avcodec/mpegvideo_enc: Remove custom plane copying code

2024-04-06 Thread Andreas Rheinhardt
It caused errors (see e.g. a066b8a809fa6d8b31398d41787822803f8762f2)
and would not support negative linesizes (this is currently
impossible to trigger as avcodec_default_get_buffer2() (used
internally by ff_encode_alloc_frame()) does not use negative
linesizes at all).

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpegvideo_enc.c | 19 ---
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index a65ecc6839..f3e45c18d2 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -36,6 +36,7 @@
 #include 
 
 #include "libavutil/emms.h"
+#include "libavutil/imgutils.h"
 #include "libavutil/internal.h"
 #include "libavutil/intmath.h"
 #include "libavutil/mathematics.h"
@@ -1214,28 +1215,16 @@ static int load_input_picture(MpegEncContext *s, const 
AVFrame *pic_arg)
 int w = s->width  >> h_shift;
 int h = s->height >> v_shift;
 const uint8_t *src = pic_arg->data[i];
-uint8_t *dst = pic->f->data[i];
+uint8_t *dst = pic->f->data[i] + !s->avctx->rc_buffer_size * 
INPLACE_OFFSET;
 int vpad = 16;
 
+av_image_copy_plane(dst, dst_stride, src, src_stride, w, h);
+
 if (   s->codec_id == AV_CODEC_ID_MPEG2VIDEO
 && !s->progressive_sequence
 && FFALIGN(s->height, 32) - s->height > 16)
 vpad = 32;
 
-if (!s->avctx->rc_buffer_size)
-dst += INPLACE_OFFSET;
-
-if (src_stride == dst_stride)
-memcpy(dst, src, src_stride * h - src_stride + w);
-else {
-int h2 = h;
-uint8_t *dst2 = dst;
-while (h2--) {
-memcpy(dst2, src, w);
-dst2 += dst_stride;
-src += src_stride;
-}
-}
 if ((s->width & 15) || (s->height & (vpad-1))) {
 s->mpvencdsp.draw_edges(dst, dst_stride,
 w, h,
-- 
2.40.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/2] avcodec/mpegvideo_enc: Reject input incompatible with chroma subsampling

2024-04-06 Thread Andreas Rheinhardt
Fixes ticket #10952.

Discovered by: Zeng Yunxiang
Signed-off-by: Andreas Rheinhardt 
---
I am pretty sure that a lot of other encoders don't handle this well
either. Maybe we should handle this more generically in
ff_encode_preinit?

 libavcodec/mpegvideo_enc.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index d1b1917824..a65ecc6839 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -314,6 +314,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
 AVCPBProperties *cpb_props;
 int i, ret;
 int mb_array_size, mv_table_size;
+int chroma_h_subsampling = 1, chroma_v_subsampling = 1;
 
 mpv_encode_defaults(s);
 
@@ -325,14 +326,25 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
 case AV_PIX_FMT_YUVJ422P:
 case AV_PIX_FMT_YUV422P:
 s->chroma_format = CHROMA_422;
+chroma_h_subsampling = 2;
 break;
 case AV_PIX_FMT_YUVJ420P:
 case AV_PIX_FMT_YUV420P:
 default:
 s->chroma_format = CHROMA_420;
+chroma_h_subsampling = 2;
+chroma_v_subsampling = 2;
 break;
 }
 
+if (avctx->width &  (chroma_h_subsampling - 1) ||
+avctx->height & (chroma_v_subsampling - 1)) {
+av_log(avctx, AV_LOG_ERROR,
+   "Dimensions %dx%d incompatible with chroma subsampling.\n",
+   avctx->width, avctx->height);
+return AVERROR(EINVAL);
+}
+
 avctx->bits_per_raw_sample = av_clip(avctx->bits_per_raw_sample, 0, 8);
 
 s->bit_rate = avctx->bit_rate;
-- 
2.40.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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: use a slash separator even in win32

2024-04-06 Thread Marton Balint




On Sun, 31 Mar 2024, Marton Balint wrote:


We don't know if the protocol used is referring to a local file or a remote
resource, so it is better to simply use slash as separator which works all the
time. (well, except in very special cases when the user specified a \\?\ path)

Fixes ticket #9780.


Will apply soon.

Regards,
Marton



Signed-off-by: Marton Balint 
---
libavformat/hlsenc.c | 11 ++-
1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index ac8bb189f0..bde7230036 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -570,12 +570,6 @@ static void reflush_dynbuf(VariantStream *vs, int 
*range_length)
avio_write(vs->out, vs->temp_buffer, *range_length);
}

-#if HAVE_DOS_PATHS
-#define SEPARATOR '\\'
-#else
-#define SEPARATOR '/'
-#endif
-
static int hls_delete_file(HLSContext *hls, AVFormatContext *avf,
   char *path, const char *proto)
{
@@ -668,7 +662,7 @@ static int hls_delete_old_segments(AVFormatContext *s, 
HLSContext *hls,
av_log(hls, AV_LOG_DEBUG, "deleting old segment %s\n",
   segment->filename);
if (!hls->use_localtime_mkdir) // segment->filename contains basename 
only
-av_bprintf(, "%s%c", dirname, SEPARATOR);
+av_bprintf(, "%s/", dirname);
av_bprintf(, "%s", segment->filename);

if (!av_bprint_is_complete()) {
@@ -685,8 +679,7 @@ static int hls_delete_old_segments(AVFormatContext *s, 
HLSContext *hls,
vtt_dirname = av_dirname(vtt_dirname_r);

av_bprint_clear();
-av_bprintf(, "%s%c%s", vtt_dirname, SEPARATOR,
- segment->sub_filename);
+av_bprintf(, "%s/%s", vtt_dirname, segment->sub_filename);
av_freep(_dirname_r);

if (!av_bprint_is_complete()) {
--
2.35.3

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avfilter/buffersrc: never override channel count in av_buffersrc_add_frame_flags

2024-04-06 Thread Marton Balint




On Sun, 31 Mar 2024, Marton Balint wrote:


Overriding unknown layouts with the negotiated layout is OK, but the number of
channels should match with what was negotiated.


Will apply.

Regards,
Marton



Signed-off-by: Marton Balint 
---
libavfilter/buffersrc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index 130751775a..3ea3ca92c9 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -215,7 +215,7 @@ int attribute_align_arg 
av_buffersrc_add_frame_flags(AVFilterContext *ctx, AVFra
break;
case AVMEDIA_TYPE_AUDIO:
/* For layouts unknown on input but known on link after 
negotiation. */
-if (frame->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) {
+if (frame->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC && 
frame->ch_layout.nb_channels == s->ch_layout.nb_channels) {
ret = av_channel_layout_copy(>ch_layout, >ch_layout);
if (ret < 0)
return ret;
--
2.35.3

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avfilter/buffersrc: fix overriding unknown channel layouts with negotiated one

2024-04-06 Thread Marton Balint



On Sat, 30 Mar 2024, James Almer wrote:


On 3/29/2024 7:01 PM, Marton Balint wrote:



 On Sat, 23 Mar 2024, Marton Balint wrote:


 Fixes ffplay playback of unknown layouts, when SDL directly supports the
 audio
 format, such as:

 ffplay -f lavfi anullsrc=cl=2C,aformat=s16

 Without the patch, "Channel layout change is not supported" errors are
 generated because buffersrc (unknown 2 channel) and buffersink (stereo)
 negotiated a stereo layout, but the stereo layout was never stored in the
 BufferSourceContext.

 This fixes a regression of 7251f909721a570726775acf61b2b9c28a950c76, but
 this
 is more of a regression of the avfilter channel layout conversion
 (1f96db959c1235bb7079d354e09914a0a2608f62).

 Signed-off-by: Marton Balint 
 ---
 libavfilter/buffersrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
 index ddcd403785..fcae4f8e69 100644
 --- a/libavfilter/buffersrc.c
 +++ b/libavfilter/buffersrc.c
 @@ -507,7 +507,7 @@ static int config_props(AVFilterLink *link)
     }
     break;
     case AVMEDIA_TYPE_AUDIO:
 -    if (!c->ch_layout.nb_channels) {
 +    if (!c->ch_layout.nb_channels || c->ch_layout.order ==
 AV_CHANNEL_ORDER_UNSPEC) {
     int ret = av_channel_layout_copy(>ch_layout,
 >ch_layout);


Why is this the only field in the function where BufferSourceContext is the 
destination and the link is the source?


I guess the reason for that is that those link parameters are not 
negotiated, so they has to be set. Storing the negotiated layout on the 
context has a different purpose and is originated from 01649c79c87.


Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 2/2] avformat/lc3: Add file format for LC3/LC3plus transport

2024-04-06 Thread Stefano Sabatini
On date Thursday 2024-04-04 22:57:34 +, ffmpeg-devel Mailing List wrote:
> From: Antoine SOULIER 
> 
> A file format is described in Bluetooth SIG LC3 and ETSI TS 103 634, for
> test purpose. This is the format implemented here.
> ---
>  Changelog|   1 +
>  doc/muxers.texi  |   6 ++
>  libavformat/Makefile |   2 +
>  libavformat/allformats.c |   2 +
>  libavformat/lc3dec.c | 160 +++
>  libavformat/lc3enc.c | 100 
>  6 files changed, 271 insertions(+)
>  create mode 100644 libavformat/lc3dec.c
>  create mode 100644 libavformat/lc3enc.c
> 
> diff --git a/Changelog b/Changelog
> index 18e83b99a1..92670f6a05 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest 
> within each release,
>  releases are sorted from youngest to oldest.
>  
>  version :
> +- LC3/LC3plus demuxer and muxer
>  - Raw Captions with Time (RCWT) closed caption demuxer
>  - LC3/LC3plus decoding/encoding using external library liblc3

nit: add new entry to the bottom

>  
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index d8a1f83309..ed4144f6d1 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -2700,6 +2700,12 @@ computer-generated compositions.
>  
>  This muxer accepts a single audio stream containing PCM data.
>  
> +@section lc3
> +Bluetooth SIG Low Complexity Communication Codec audio (LC3), or
> +ETSI TS 103 634 Low Complexity Communication Codec plus (LC3plus).
> +
> +This muxer accepts a single @code{lc3} audio stream.
> +
>  @section matroska
>  
>  Matroska container muxer.
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index 9981799cc9..027d0cdae5 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -332,6 +332,8 @@ OBJS-$(CONFIG_KVAG_DEMUXER)  += kvag.o
>  OBJS-$(CONFIG_KVAG_MUXER)+= kvag.o rawenc.o
>  OBJS-$(CONFIG_LAF_DEMUXER)   += lafdec.o
>  OBJS-$(CONFIG_LATM_MUXER)+= latmenc.o rawenc.o
> +OBJS-$(CONFIG_LC3_DEMUXER)   += lc3dec.o
> +OBJS-$(CONFIG_LC3_MUXER) += lc3enc.o
>  OBJS-$(CONFIG_LMLM4_DEMUXER) += lmlm4.o
>  OBJS-$(CONFIG_LOAS_DEMUXER)  += loasdec.o rawdec.o
>  OBJS-$(CONFIG_LUODAT_DEMUXER)+= luodatdec.o
> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> index ae925dcf60..305fa46532 100644
> --- a/libavformat/allformats.c
> +++ b/libavformat/allformats.c
> @@ -252,6 +252,8 @@ extern const FFInputFormat  ff_kvag_demuxer;
>  extern const FFOutputFormat ff_kvag_muxer;
>  extern const FFInputFormat  ff_laf_demuxer;
>  extern const FFOutputFormat ff_latm_muxer;
> +extern const FFInputFormat  ff_lc3_demuxer;
> +extern const FFOutputFormat ff_lc3_muxer;
>  extern const FFInputFormat  ff_lmlm4_demuxer;
>  extern const FFInputFormat  ff_loas_demuxer;
>  extern const FFInputFormat  ff_luodat_demuxer;
> diff --git a/libavformat/lc3dec.c b/libavformat/lc3dec.c
> new file mode 100644
> index 00..1fcde8ca4e
> --- /dev/null
> +++ b/libavformat/lc3dec.c
> @@ -0,0 +1,160 @@
> +/*
> + * LC3 demuxer
> + * Copyright (C) 2024  Antoine Soulier 
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +/**
> + * @file
> + * Based on the file format specified by :
> + *
> + * - Bluetooth SIG - Low Complexity Communication Codec Test Suite
> + *   https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=502301
> + *   3.2.8.2 Reference LC3 Codec Bitstream Format
> + *
> + * - ETSI TI 103 634 V1.4.1 - Low Complexity Communication Codec plus
> + *   
> https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.04.01_60/ts_103634v010401p.pdf
> + *   LC3plus conformance script package
> + */
> +
> +#include "libavcodec/packet.h"
> +#include "libavutil/intreadwrite.h"
> +
> +#include "avformat.h"
> +#include "avio.h"
> +#include "demux.h"
> +#include "internal.h"
> +
> +typedef struct LC3DemuxContext {
> +int frame_samples;
> +int64_t end_dts;
> +} LC3DemuxContext;
> +
> +static int lc3_read_probe(const AVProbeData *p)
> +{
> +uint16_t frame_10us, srate_100hz;
> +
> +if (p->buf_size < 12)
> +return 0;
> +
> + 

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/liblc3dec: Retrieve duration of the last packet from the demux

2024-04-06 Thread Stefano Sabatini
On date Thursday 2024-04-04 22:57:33 +, ffmpeg-devel Mailing List wrote:
> From: Antoine SOULIER 
> 
> Use the packet duration field to invalid last samples of the last frame.
> ---
>  libavcodec/liblc3dec.c | 12 +++-
>  1 file changed, 3 insertions(+), 9 deletions(-)

Will apply this soon, thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v4 0/4] Fix some active sequences in subtitles

2024-04-06 Thread Stefano Sabatini
On date Wednesday 2024-04-03 21:50:29 +0200, Oneric wrote:
> On Mon, 19 Feb 2024 Oneric wrote:
> >   avcodec/webvttdec: honour bidi marks
> >   avcodec/{ass,webvttdec}: fix handling of backslashes
> >   avcodec/{ass,webvttdec}: more portable curly brace escapes
> >   avocdec/ass: simplify linebreaks
> >
> >  libavcodec/ass.c   | 47 +++---
> >  libavcodec/webvttdec.c |  4 ++--
> >  tests/ref/fate/sub-webvtt  |  2 +-
> >  tests/ref/fate/sub-webvtt2 |  2 +-
> >  4 files changed, 33 insertions(+), 22 deletions(-)
> 
> On Tue, Mar 26, 2024 at 11:01:40 -0500, Marth64 wrote:
> > Ping on this set authored by Oneric as well.
> 
> ping again

will apply this soon, thanks
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".