Re: [FFmpeg-devel] [PATCH v3 2/2] lavc/vulkan_av1: port to the new stable API

2024-03-18 Thread Dave Airlie
  >
>  > -/* Workaround for a spec issue.
>  > - *Can be removed once no longer needed, and threading can be enabled. 
> */
>  > +/* TODO: investigate if this can be removed to make decoding 
> completely
>  > + * independent. */
>  >  FFVulkanDecodeContext  *dec;
>
> Can you explain what the id_alloc_mask thing is doing which needs this?  (The 
> 32 size in particular seems suspicious.)

This is for DPB slot management, 32 is the wrong limit, I think I just
picked uint32_t and bitshifting as a quick option. We should limit
this to maxDpbSlots I suspect, probably still use a uint32_t bitmask
to track it.

Dave.
___
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] lavu/hwcontext_vulkan: check both vendor and PCI IDs

2024-03-18 Thread Lynne
Mar 18, 2024, 06:57 by haihao.xiang-at-intel@ffmpeg.org:

> On Vr, 2024-03-08 at 15:13 +0800, Xiang, Haihao wrote:
>
>> From: Haihao Xiang 
>>
>> Otherwise the derived device and the source device might have different
>> PCI ID or vendor ID in a multiple-device system.
>>
>> Signed-off-by: Haihao Xiang 
>> ---
>>  libavutil/hwcontext_vulkan.c | 31 +--
>>  1 file changed, 29 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
>> index 855f099e26..9d94f74d78 100644
>> --- a/libavutil/hwcontext_vulkan.c
>> +++ b/libavutil/hwcontext_vulkan.c
>> @@ -975,6 +975,20 @@ static int find_device(AVHWDeviceContext *ctx,
>> VulkanDeviceSelection *select)
>>     select->name);
>>  err = AVERROR(ENODEV);
>>  goto end;
>> +    } else if (select->vendor_id && select->pci_device) {
>> +    av_log(ctx, AV_LOG_VERBOSE, "Requested vendor:device %04x:%04x\n",
>> +   select->vendor_id, select->pci_device);
>> +    for (int i = 0; i < num; i++) {
>> +    if (select->vendor_id == prop[i].properties.vendorID &&
>> +    select->pci_device == prop[i].properties.deviceID) {
>> +    choice = i;
>> +    goto end;
>> +    }
>> +    }
>> +    av_log(ctx, AV_LOG_ERROR, "Unable to find device with vendor ID 0x%x
>> "
>> +   "and PCI ID 0x%x!\n", select->vendor_id, select->pci_device);
>> +    err = AVERROR(EINVAL);
>> +    goto end;
>>  } else if (select->pci_device) {
>>  av_log(ctx, AV_LOG_VERBOSE, "Requested device: 0x%x\n", select-
>> >pci_device);
>>  for (int i = 0; i < num; i++) {
>> @@ -1597,8 +1611,14 @@ static int vulkan_device_derive(AVHWDeviceContext 
>> *ctx,
>>  #if CONFIG_VAAPI
>>  case AV_HWDEVICE_TYPE_VAAPI: {
>>  AVVAAPIDeviceContext *src_hwctx = src_ctx->hwctx;
>> -
>> -    const char *vendor = vaQueryVendorString(src_hwctx->display);
>> +    VADisplay dpy = src_hwctx->display;
>> +#if VA_CHECK_VERSION(1, 15, 0)
>> +    VAStatus vas;
>> +    VADisplayAttribute attr = {
>> +    .type = VADisplayPCIID,
>> +    };
>> +#endif
>> +    const char *vendor = vaQueryVendorString(dpy);
>>  if (!vendor) {
>>  av_log(ctx, AV_LOG_ERROR, "Unable to get device info from
>> VAAPI!\n");
>>  return AVERROR_EXTERNAL;
>> @@ -1607,6 +1627,13 @@ static int vulkan_device_derive(AVHWDeviceContext 
>> *ctx,
>>  if (strstr(vendor, "AMD"))
>>  dev_select.vendor_id = 0x1002;
>>  
>> +#if VA_CHECK_VERSION(1, 15, 0)
>> +    vas = vaGetDisplayAttributes(dpy, , 1);
>> +    if (vas == VA_STATUS_SUCCESS && attr.flags !=
>> VA_DISPLAY_ATTRIB_NOT_SUPPORTED) {
>> +    dev_select.vendor_id = ((attr.value >> 16) & 0x);
>> +    dev_select.pci_device = (attr.value & 0x);
>> +    }
>> +#endif
>>  return vulkan_device_create_internal(ctx, _select, 0, opts,
>> flags);
>>  }
>>  #endif
>>
>
> Hi,
>
> Any comment for this patch ? 
>

Is this possible? For two devices from different vendors to have the same PCI 
ID?
___
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] lavu/hwcontext_vulkan: check both vendor and PCI IDs

2024-03-18 Thread Xiang, Haihao
On Ma, 2024-03-18 at 07:18 +0100, Lynne wrote:
> Mar 18, 2024, 06:57 by haihao.xiang-at-intel@ffmpeg.org:
> 
> > On Vr, 2024-03-08 at 15:13 +0800, Xiang, Haihao wrote:
> > 
> > > From: Haihao Xiang 
> > > 
> > > Otherwise the derived device and the source device might have different
> > > PCI ID or vendor ID in a multiple-device system.
> > > 
> > > Signed-off-by: Haihao Xiang 
> > > ---
> > >  libavutil/hwcontext_vulkan.c | 31 +--
> > >  1 file changed, 29 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
> > > index 855f099e26..9d94f74d78 100644
> > > --- a/libavutil/hwcontext_vulkan.c
> > > +++ b/libavutil/hwcontext_vulkan.c
> > > @@ -975,6 +975,20 @@ static int find_device(AVHWDeviceContext *ctx,
> > > VulkanDeviceSelection *select)
> > >     select->name);
> > >  err = AVERROR(ENODEV);
> > >  goto end;
> > > +    } else if (select->vendor_id && select->pci_device) {
> > > +    av_log(ctx, AV_LOG_VERBOSE, "Requested vendor:device
> > > %04x:%04x\n",
> > > +   select->vendor_id, select->pci_device);
> > > +    for (int i = 0; i < num; i++) {
> > > +    if (select->vendor_id == prop[i].properties.vendorID &&
> > > +    select->pci_device == prop[i].properties.deviceID) {
> > > +    choice = i;
> > > +    goto end;
> > > +    }
> > > +    }
> > > +    av_log(ctx, AV_LOG_ERROR, "Unable to find device with vendor ID
> > > 0x%x
> > > "
> > > +   "and PCI ID 0x%x!\n", select->vendor_id, select-
> > > >pci_device);
> > > +    err = AVERROR(EINVAL);
> > > +    goto end;
> > >  } else if (select->pci_device) {
> > >  av_log(ctx, AV_LOG_VERBOSE, "Requested device: 0x%x\n", select-
> > > > pci_device);
> > >  for (int i = 0; i < num; i++) {
> > > @@ -1597,8 +1611,14 @@ static int vulkan_device_derive(AVHWDeviceContext
> > > *ctx,
> > >  #if CONFIG_VAAPI
> > >  case AV_HWDEVICE_TYPE_VAAPI: {
> > >  AVVAAPIDeviceContext *src_hwctx = src_ctx->hwctx;
> > > -
> > > -    const char *vendor = vaQueryVendorString(src_hwctx->display);
> > > +    VADisplay dpy = src_hwctx->display;
> > > +#if VA_CHECK_VERSION(1, 15, 0)
> > > +    VAStatus vas;
> > > +    VADisplayAttribute attr = {
> > > +    .type = VADisplayPCIID,
> > > +    };
> > > +#endif
> > > +    const char *vendor = vaQueryVendorString(dpy);
> > >  if (!vendor) {
> > >  av_log(ctx, AV_LOG_ERROR, "Unable to get device info from
> > > VAAPI!\n");
> > >  return AVERROR_EXTERNAL;
> > > @@ -1607,6 +1627,13 @@ static int vulkan_device_derive(AVHWDeviceContext
> > > *ctx,
> > >  if (strstr(vendor, "AMD"))
> > >  dev_select.vendor_id = 0x1002;
> > >  
> > > +#if VA_CHECK_VERSION(1, 15, 0)
> > > +    vas = vaGetDisplayAttributes(dpy, , 1);
> > > +    if (vas == VA_STATUS_SUCCESS && attr.flags !=
> > > VA_DISPLAY_ATTRIB_NOT_SUPPORTED) {
> > > +    dev_select.vendor_id = ((attr.value >> 16) & 0x);
> > > +    dev_select.pci_device = (attr.value & 0x);
> > > +    }
> > > +#endif
> > >  return vulkan_device_create_internal(ctx, _select, 0, opts,
> > > flags);
> > >  }
> > >  #endif
> > > 
> > 
> > Hi,
> > 
> > Any comment for this patch ? 
> > 
> 
> Is this possible? For two devices from different vendors to have the same PCI
> ID?

I'm not sure for different vendors. But when two devices come from the same
vendor (e.g. 8086:56a0 and 8086:4682), vulkan always picks up 8086:56a0 no
matter the source device is 8086:4682 if we don't set the device id here.

Thanks
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 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 v3] lavc/vaapi_encode: Enable block level bitrate control

2024-03-18 Thread Xiang, Haihao
On Vr, 2024-03-15 at 02:46 +, Xiang, Haihao wrote:
> On Vr, 2024-03-08 at 16:45 +0800, fei.w.wang-at-intel@ffmpeg.org wrote:
> > From: Fei Wang 
> > 
> > Signed-off-by: Fei Wang 
> > ---
> >  doc/encoders.texi |  4 
> >  libavcodec/vaapi_encode.c | 13 -
> >  libavcodec/vaapi_encode.h |  9 -
> >  3 files changed, 24 insertions(+), 2 deletions(-)
> > 
> > diff --git a/doc/encoders.texi b/doc/encoders.texi
> > index 5f7864770e..7c223ed74c 100644
> > --- a/doc/encoders.texi
> > +++ b/doc/encoders.texi
> > @@ -4089,6 +4089,10 @@ Quality-defined variable-bitrate.
> >  Average variable bitrate.
> >  @end table
> >  
> > +@item blbrc
> > +Enable block level rate control, which assigns different bitrate block by
> > block.
> > +Invalid for CQP mode.
> > +
> >  @end table
> >  
> >  Each encoder also has its own specific options:
> > diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
> > index 808b79c0c7..940f0678a5 100644
> > --- a/libavcodec/vaapi_encode.c
> > +++ b/libavcodec/vaapi_encode.c
> > @@ -1805,6 +1805,11 @@ static av_cold int
> > vaapi_encode_init_rate_control(AVCodecContext *avctx)
> >  int i, first = 1, res;
> >  
> >  supported_va_rc_modes = rc_attr.value;
> > +    if (ctx->blbrc && !(supported_va_rc_modes & VA_RC_MB)) {
> > +    ctx->blbrc = 0;
> > +    av_log(avctx, AV_LOG_WARNING, "Driver does not support
> > BLBRC.\n");
> > +    }
> > +
> >  for (i = 0; i < FF_ARRAY_ELEMS(vaapi_encode_rc_modes); i++) {
> >  rc_mode = _encode_rc_modes[i];
> >  if (supported_va_rc_modes & rc_mode->va_mode) {
> > @@ -2016,13 +2021,18 @@ rc_mode_found:
> >  ctx->va_bit_rate = rc_bits_per_second;
> >  
> >  av_log(avctx, AV_LOG_VERBOSE, "RC mode: %s.\n", rc_mode->name);
> > +
> > +    if (ctx->blbrc && ctx->va_rc_mode == VA_RC_CQP)
> > +    ctx->blbrc = 0;
> > +    av_log(avctx, AV_LOG_VERBOSE, "Block Level bitrate control: %s.\n",
> > ctx-
> > > blbrc ? "ON" : "OFF");
> > +
> >  if (rc_attr.value == VA_ATTRIB_NOT_SUPPORTED) {
> >  // This driver does not want the RC mode attribute to be set.
> >  } else {
> >  ctx->config_attributes[ctx->nb_config_attributes++] =
> >  (VAConfigAttrib) {
> >  .type  = VAConfigAttribRateControl,
> > -    .value = ctx->va_rc_mode,
> > +    .value = ctx->blbrc ? ctx->va_rc_mode | VA_RC_MB : ctx-
> > > va_rc_mode,
> >  };
> >  }
> >  
> > @@ -2051,6 +2061,7 @@ rc_mode_found:
> >  #if VA_CHECK_VERSION(1, 1, 0)
> >  .ICQ_quality_factor = av_clip(rc_quality, 1, 51),
> >  .max_qp = (avctx->qmax > 0 ? avctx->qmax : 0),
> > +    .rc_flags.bits.mb_rate_control = ctx->blbrc ? 1 : 2,
> >  #endif
> >  #if VA_CHECK_VERSION(1, 3, 0)
> >  .quality_factor = rc_quality,
> > diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
> > index 6964055b93..0eed9691ca 100644
> > --- a/libavcodec/vaapi_encode.h
> > +++ b/libavcodec/vaapi_encode.h
> > @@ -216,6 +216,9 @@ typedef struct VAAPIEncodeContext {
> >  // available modes).
> >  int explicit_rc_mode;
> >  
> > +    // Block Level based bitrate control.
> > +    int blbrc;
> > +
> >  // Explicitly-set QP, for use with the "qp" options.
> >  // (Forces CQP mode when set, overriding everything else.)
> >  int explicit_qp;
> > @@ -538,7 +541,11 @@ int ff_vaapi_encode_close(AVCodecContext *avctx);
> >  VAAPI_ENCODE_RC_MODE(VBR,  "Variable-bitrate"), \
> >  VAAPI_ENCODE_RC_MODE(ICQ,  "Intelligent constant-quality"), \
> >  VAAPI_ENCODE_RC_MODE(QVBR, "Quality-defined variable-bitrate"), \
> > -    VAAPI_ENCODE_RC_MODE(AVBR, "Average variable-bitrate")
> > +    VAAPI_ENCODE_RC_MODE(AVBR, "Average variable-bitrate"), \
> > +    { "blbrc", \
> > +  "Block level based bitrate control",\
> > +  OFFSET(common.blbrc), AV_OPT_TYPE_BOOL, \
> > +  { .i64 = 0 }, 0, 1, FLAGS }
> >  
> >  
> >  #endif /* AVCODEC_VAAPI_ENCODE_H */
> 
> LGTM, I will push this patch if there is no objection.

Pushed.

- 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 2/3] lavfi: Add drawbox_vaapi filter

2024-03-18 Thread Xiang, Haihao
From: Haihao Xiang 

Signed-off-by: Haihao Xiang 
---
 configure  |   1 +
 doc/filters.texi   |  85 
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/vf_drawbox_vaapi.c | 369 +
 5 files changed, 457 insertions(+)
 create mode 100644 libavfilter/vf_drawbox_vaapi.c

diff --git a/configure b/configure
index 4f64f48b38..3102689392 100755
--- a/configure
+++ b/configure
@@ -3891,6 +3891,7 @@ vstack_qsv_filter_select="qsvvpp"
 xstack_qsv_filter_deps="libmfx"
 xstack_qsv_filter_select="qsvvpp"
 pad_vaapi_filter_deps="vaapi_1"
+drawbox_vaapi_filter_deps="vaapi_1"
 
 # examples
 avio_http_serve_files_deps="avformat avutil fork"
diff --git a/doc/filters.texi b/doc/filters.texi
index 2bd1a5b9e7..82bea77107 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -28018,6 +28018,91 @@ input sample aspect ratio
 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
 @end table
 
+@section drawbox_vaapi
+
+Draw a colored box on the input image.
+
+It accepts the following parameters:
+
+@table @option
+@item x
+@item y
+The expressions which specify the top left corner coordinates of the box. It 
defaults to 0.
+
+@item width, w
+@item height, h
+The expressions which specify the width and height of the box; if 0 they are 
interpreted as
+the input width and height. It defaults to 0.
+
+@item color, c
+Specify the color of the box to write. For the general syntax of this option,
+check the @ref{color syntax,,"Color" section in the ffmpeg-utils 
manual,ffmpeg-utils}.
+
+@item thickness, t
+The expression which sets the thickness of the box edge.
+A value of @code{fill} will create a filled box. Default value is @code{3}.
+
+See below for the list of accepted constants.
+
+@item replace
+With value @code{1}, the pixels of the painted box will overwrite the video's 
color and alpha pixels.
+Default is @code{0}, which composites the box onto the input video.
+@end table
+
+The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are 
expressions containing the
+following constants:
+
+@table @option
+@item in_h, ih
+@item in_w, iw
+The input width and height.
+
+@item x
+@item y
+The x and y offset coordinates where the box is drawn.
+
+@item w
+@item h
+The width and height of the drawn box.
+
+@item t
+The thickness of the drawn box.
+
+@end table
+
+@subsection Examples
+
+@itemize
+@item
+Draw a black box around the edge of the input image:
+@example
+drawbox
+@end example
+
+@item
+Draw a box with color red and an opacity of 50%:
+@example
+drawbox=10:20:200:60:red@@0.5
+@end example
+
+The previous example can be specified as:
+@example
+drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
+@end example
+
+@item
+Fill the box with pink color:
+@example
+drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
+@end example
+
+@item
+Draw a 2-pixel red 2.40:1 mask:
+@example
+drawbox=x=-t:y=0.5*(ih-iw/2.4)-t:w=iw+t*2:h=iw/2.4+t*2:t=2:c=red
+@end example
+@end itemize
+
 @c man end VAAPI VIDEO FILTERS
 
 @chapter Vulkan Video Filters
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index babcc7b676..8571e9e2af 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -582,6 +582,7 @@ OBJS-$(CONFIG_HSTACK_QSV_FILTER) += 
vf_stack_qsv.o framesync.o
 OBJS-$(CONFIG_VSTACK_QSV_FILTER) += vf_stack_qsv.o framesync.o
 OBJS-$(CONFIG_XSTACK_QSV_FILTER) += vf_stack_qsv.o framesync.o
 OBJS-$(CONFIG_PAD_VAAPI_FILTER)  += vf_pad_vaapi.o vaapi_vpp.o
+OBJS-$(CONFIG_DRAWBOX_VAAPI_FILTER)  += vf_drawbox_vaapi.o vaapi_vpp.o
 
 OBJS-$(CONFIG_ALLRGB_FILTER) += vsrc_testsrc.o
 OBJS-$(CONFIG_ALLYUV_FILTER) += vsrc_testsrc.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 1e024b3376..c532682fc2 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -547,6 +547,7 @@ extern const AVFilter ff_vf_hstack_qsv;
 extern const AVFilter ff_vf_vstack_qsv;
 extern const AVFilter ff_vf_xstack_qsv;
 extern const AVFilter ff_vf_pad_vaapi;
+extern const AVFilter ff_vf_drawbox_vaapi;
 
 extern const AVFilter ff_vsrc_allrgb;
 extern const AVFilter ff_vsrc_allyuv;
diff --git a/libavfilter/vf_drawbox_vaapi.c b/libavfilter/vf_drawbox_vaapi.c
new file mode 100644
index 00..1081d463e9
--- /dev/null
+++ b/libavfilter/vf_drawbox_vaapi.c
@@ -0,0 +1,369 @@
+/*
+ * 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 

[FFmpeg-devel] [PATCH 3/3] Changelog: Add pad_vaapi, drawbox_vaapi entry

2024-03-18 Thread Xiang, Haihao
From: Haihao Xiang 

Signed-off-by: Haihao Xiang 
---
 Changelog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Changelog b/Changelog
index b7d7535a9e..27da4b77f0 100644
--- a/Changelog
+++ b/Changelog
@@ -34,6 +34,7 @@ version :
 - ffprobe (with -export_side_data film_grain) now prints film grain metadata
 - AEA muxer
 - ffmpeg CLI loopback decoders
+- pad_vaapi, drawbox_vaapi filters
 
 
 version 6.1:
-- 
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 1/3] lavfi: Add pad_vaapi filter

2024-03-18 Thread Xiang, Haihao
From: Haihao Xiang 

Signed-off-by: Haihao Xiang 
---
 configure  |   1 +
 doc/filters.texi   |  77 ++
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/vf_pad_vaapi.c | 283 +
 5 files changed, 363 insertions(+)
 create mode 100644 libavfilter/vf_pad_vaapi.c

diff --git a/configure b/configure
index 2b4c4ec9a2..4f64f48b38 100755
--- a/configure
+++ b/configure
@@ -3890,6 +3890,7 @@ vstack_qsv_filter_deps="libmfx"
 vstack_qsv_filter_select="qsvvpp"
 xstack_qsv_filter_deps="libmfx"
 xstack_qsv_filter_select="qsvvpp"
+pad_vaapi_filter_deps="vaapi_1"
 
 # examples
 avio_http_serve_files_deps="avformat avutil fork"
diff --git a/doc/filters.texi b/doc/filters.texi
index 913365671d..2bd1a5b9e7 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -27941,6 +27941,83 @@ first input stream. For the syntax of this option, 
check the
 See @ref{xstack}.
 @end table
 
+@section pad_vaapi
+
+Add paddings to the input image, and place the original input at the
+provided @var{x}, @var{y} coordinates.
+
+It accepts the following options:
+
+@table @option
+@item width, w
+@item height, h
+Specify an expression for the size of the output image with the
+paddings added. If the value for @var{width} or @var{height} is 0, the
+corresponding input size is used for the output.
+
+The @var{width} expression can reference the value set by the
+@var{height} expression, and vice versa.
+
+The default value of @var{width} and @var{height} is 0.
+
+@item x
+@item y
+Specify the offsets to place the input image at within the padded area,
+with respect to the top/left border of the output image.
+
+The @var{x} expression can reference the value set by the @var{y}
+expression, and vice versa.
+
+The default value of @var{x} and @var{y} is 0.
+
+If @var{x} or @var{y} evaluate to a negative number, they'll be changed
+so the input image is centered on the padded area.
+
+@item color
+Specify the color of the padded area. For the syntax of this option,
+check the @ref{color syntax,,"Color" section in the ffmpeg-utils
+manual,ffmpeg-utils}.
+
+@item aspect
+Pad to an aspect instead to a resolution.
+@end table
+
+The value for the @var{width}, @var{height}, @var{x}, and @var{y}
+options are expressions containing the following constants:
+
+@table @option
+@item in_w
+@item in_h
+The input video width and height.
+
+@item iw
+@item ih
+These are the same as @var{in_w} and @var{in_h}.
+
+@item out_w
+@item out_h
+The output width and height (the size of the padded area), as
+specified by the @var{width} and @var{height} expressions.
+
+@item ow
+@item oh
+These are the same as @var{out_w} and @var{out_h}.
+
+@item x
+@item y
+The x and y offsets as specified by the @var{x} and @var{y}
+expressions, or NAN if not yet specified.
+
+@item a
+same as @var{iw} / @var{ih}
+
+@item sar
+input sample aspect ratio
+
+@item dar
+input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
+@end table
+
 @c man end VAAPI VIDEO FILTERS
 
 @chapter Vulkan Video Filters
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 994d9773ba..babcc7b676 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -581,6 +581,7 @@ OBJS-$(CONFIG_XSTACK_VAAPI_FILTER)   += 
vf_stack_vaapi.o framesync.o vaa
 OBJS-$(CONFIG_HSTACK_QSV_FILTER) += vf_stack_qsv.o framesync.o
 OBJS-$(CONFIG_VSTACK_QSV_FILTER) += vf_stack_qsv.o framesync.o
 OBJS-$(CONFIG_XSTACK_QSV_FILTER) += vf_stack_qsv.o framesync.o
+OBJS-$(CONFIG_PAD_VAAPI_FILTER)  += vf_pad_vaapi.o vaapi_vpp.o
 
 OBJS-$(CONFIG_ALLRGB_FILTER) += vsrc_testsrc.o
 OBJS-$(CONFIG_ALLYUV_FILTER) += vsrc_testsrc.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 149bf50997..1e024b3376 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -546,6 +546,7 @@ extern const AVFilter ff_vf_xstack_vaapi;
 extern const AVFilter ff_vf_hstack_qsv;
 extern const AVFilter ff_vf_vstack_qsv;
 extern const AVFilter ff_vf_xstack_qsv;
+extern const AVFilter ff_vf_pad_vaapi;
 
 extern const AVFilter ff_vsrc_allrgb;
 extern const AVFilter ff_vsrc_allyuv;
diff --git a/libavfilter/vf_pad_vaapi.c b/libavfilter/vf_pad_vaapi.c
new file mode 100644
index 00..98f6285222
--- /dev/null
+++ b/libavfilter/vf_pad_vaapi.c
@@ -0,0 +1,283 @@
+/*
+ * 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 

Re: [FFmpeg-devel] [PATCH] lavu/hwcontext_vulkan: check both vendor and PCI IDs

2024-03-18 Thread Lynne
Mar 18, 2024, 07:33 by haihao.xiang-at-intel@ffmpeg.org:

> On Ma, 2024-03-18 at 07:18 +0100, Lynne wrote:
>
>> Mar 18, 2024, 06:57 by haihao.xiang-at-intel@ffmpeg.org:
>>
>> > On Vr, 2024-03-08 at 15:13 +0800, Xiang, Haihao wrote:
>> > 
>> > > From: Haihao Xiang 
>> > > 
>> > > Otherwise the derived device and the source device might have different
>> > > PCI ID or vendor ID in a multiple-device system.
>> > > 
>> > > Signed-off-by: Haihao Xiang 
>> > > ---
>> > >  libavutil/hwcontext_vulkan.c | 31 +--
>> > >  1 file changed, 29 insertions(+), 2 deletions(-)
>> > > 
>> > > diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
>> > > index 855f099e26..9d94f74d78 100644
>> > > --- a/libavutil/hwcontext_vulkan.c
>> > > +++ b/libavutil/hwcontext_vulkan.c
>> > > @@ -975,6 +975,20 @@ static int find_device(AVHWDeviceContext *ctx,
>> > > VulkanDeviceSelection *select)
>> > >     select->name);
>> > >  err = AVERROR(ENODEV);
>> > >  goto end;
>> > > +    } else if (select->vendor_id && select->pci_device) {
>> > > +    av_log(ctx, AV_LOG_VERBOSE, "Requested vendor:device
>> > > %04x:%04x\n",
>> > > +   select->vendor_id, select->pci_device);
>> > > +    for (int i = 0; i < num; i++) {
>> > > +    if (select->vendor_id == prop[i].properties.vendorID &&
>> > > +    select->pci_device == prop[i].properties.deviceID) {
>> > > +    choice = i;
>> > > +    goto end;
>> > > +    }
>> > > +    }
>> > > +    av_log(ctx, AV_LOG_ERROR, "Unable to find device with vendor ID
>> > > 0x%x
>> > > "
>> > > +   "and PCI ID 0x%x!\n", select->vendor_id, select-
>> > > >pci_device);
>> > > +    err = AVERROR(EINVAL);
>> > > +    goto end;
>> > >  } else if (select->pci_device) {
>> > >  av_log(ctx, AV_LOG_VERBOSE, "Requested device: 0x%x\n", select-
>> > > > pci_device);
>> > >  for (int i = 0; i < num; i++) {
>> > > @@ -1597,8 +1611,14 @@ static int vulkan_device_derive(AVHWDeviceContext
>> > > *ctx,
>> > >  #if CONFIG_VAAPI
>> > >  case AV_HWDEVICE_TYPE_VAAPI: {
>> > >  AVVAAPIDeviceContext *src_hwctx = src_ctx->hwctx;
>> > > -
>> > > -    const char *vendor = vaQueryVendorString(src_hwctx->display);
>> > > +    VADisplay dpy = src_hwctx->display;
>> > > +#if VA_CHECK_VERSION(1, 15, 0)
>> > > +    VAStatus vas;
>> > > +    VADisplayAttribute attr = {
>> > > +    .type = VADisplayPCIID,
>> > > +    };
>> > > +#endif
>> > > +    const char *vendor = vaQueryVendorString(dpy);
>> > >  if (!vendor) {
>> > >  av_log(ctx, AV_LOG_ERROR, "Unable to get device info from
>> > > VAAPI!\n");
>> > >  return AVERROR_EXTERNAL;
>> > > @@ -1607,6 +1627,13 @@ static int vulkan_device_derive(AVHWDeviceContext
>> > > *ctx,
>> > >  if (strstr(vendor, "AMD"))
>> > >  dev_select.vendor_id = 0x1002;
>> > >  
>> > > +#if VA_CHECK_VERSION(1, 15, 0)
>> > > +    vas = vaGetDisplayAttributes(dpy, , 1);
>> > > +    if (vas == VA_STATUS_SUCCESS && attr.flags !=
>> > > VA_DISPLAY_ATTRIB_NOT_SUPPORTED) {
>> > > +    dev_select.vendor_id = ((attr.value >> 16) & 0x);
>> > > +    dev_select.pci_device = (attr.value & 0x);
>> > > +    }
>> > > +#endif
>> > >  return vulkan_device_create_internal(ctx, _select, 0, opts,
>> > > flags);
>> > >  }
>> > >  #endif
>> > > 
>> > 
>> > Hi,
>> > 
>> > Any comment for this patch ? 
>> > 
>>
>> Is this possible? For two devices from different vendors to have the same PCI
>> ID?
>>
>
> I'm not sure for different vendors. But when two devices come from the same
> vendor (e.g. 8086:56a0 and 8086:4682), vulkan always picks up 8086:56a0 no
> matter the source device is 8086:4682 if we don't set the device id here.
>

Do you need to check for both vendor and PCI ID?
If not, could you resend without the custom vendor+pci check
and just using the regular pci ID check?
___
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/3] lavfi/tonemap_vaapi: Add support for HDR to HDR tone mapping

2024-03-18 Thread Xiang, Haihao
From: Xinpeng Sun 

Usage example:
ffmpeg -y -hwaccel vaapi -hwaccel_output_format vaapi -i hdr.mp4 \
-vf "tonemap_vaapi=display=7500 3000|34000 16000|13250 34500|15635 16450|500 
1000:extra_hw_frames=64" \
-c:v hevc_vaapi output.mp4

Signed-off-by: Xinpeng Sun 
Signed-off-by: Haihao Xiang 
---
 doc/filters.texi   |  42 +---
 libavfilter/vf_tonemap_vaapi.c | 191 +
 2 files changed, 203 insertions(+), 30 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 2cb84c1476..fb18fecfa5 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -27818,8 +27818,7 @@ The inputs have same memory layout for color channels, 
the overlay has additiona
 
 @section tonemap_vaapi
 
-Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with 
tone-mapping.
-It maps the dynamic range of HDR10 content to the SDR content.
+Perform HDR-to-SDR or HDR-to-HDR tone-mapping.
 It currently only accepts HDR10 as input.
 
 It accepts the following parameters:
@@ -27828,28 +27827,42 @@ It accepts the following parameters:
 @item format
 Specify the output pixel format.
 
-Currently supported formats are:
-@table @var
-@item p010
-@item nv12
-@end table
-
-Default is nv12.
+Default is nv12 for HDR-to-SDR tone-mapping and p010 for HDR-to-HDR
+tone-mapping.
 
 @item primaries, p
 Set the output color primaries.
 
-Default is bt709.
+Default is bt709 for HDR-to-SDR tone-mapping and same as input for HDR-to-HDR
+tone-mapping.
 
 @item transfer, t
 Set the output transfer characteristics.
 
-Default is bt709.
+Default is bt709 for HDR-to-SDR tone-mapping and same as input for HDR-to-HDR
+tone-mapping.
 
 @item matrix, m
 Set the output colorspace matrix.
 
-Default is bt709.
+Default is bt709 for HDR-to-SDR tone-mapping and same as input for HDR-to-HDR
+tone-mapping.
+
+@item display
+Set the output mastering display colour volume. It is given by a '|'-separated
+list of two values, two values are space separated. It set display primaries
+x & y in G, B, R order, then white point x & y, the the nominal minimum & 
maximum
+display luminances.
+
+HDR-to-HDR tone-mapping will be performed when this option is set.
+
+@item light
+Set the output content light level information. It accepts 2 space-separated
+values, the first input is the maximum light level and the second input is
+he maximum average light level.
+
+It is ignored for HDR-to-SDR tone-mapping, and optional for HDR-to-HDR
+tone-mapping.
 
 @end table
 
@@ -27861,6 +27874,11 @@ Convert HDR(HDR10) video to 
bt2020-transfer-characteristic p010 format
 @example
 tonemap_vaapi=format=p010:t=bt2020-10
 @end example
+@item
+Convert HDR video to HDR video
+@example
+tonemap_vaapi=display=7500\ 3000|34000\ 16000|13250\ 34500|15635\ 16450|500\ 
1000
+@end example
 @end itemize
 
 @section hstack_vaapi
diff --git a/libavfilter/vf_tonemap_vaapi.c b/libavfilter/vf_tonemap_vaapi.c
index 5d475e8ff2..7ebcb18f79 100644
--- a/libavfilter/vf_tonemap_vaapi.c
+++ b/libavfilter/vf_tonemap_vaapi.c
@@ -39,7 +39,11 @@ typedef struct HDRVAAPIContext {
 enum AVColorTransferCharacteristic color_transfer;
 enum AVColorSpace color_matrix;
 
+char *mastering_display;
+char *content_light;
+
 VAHdrMetaDataHDR10  in_metadata;
+VAHdrMetaDataHDR10  out_metadata;
 
 AVFrameSideData*src_display;
 AVFrameSideData*src_light;
@@ -146,6 +150,87 @@ static int tonemap_vaapi_save_metadata(AVFilterContext 
*avctx, AVFrame *input_fr
 return 0;
 }
 
+static int tonemap_vaapi_update_sidedata(AVFilterContext *avctx, AVFrame 
*output_frame)
+{
+HDRVAAPIContext *ctx = avctx->priv;
+AVFrameSideData *metadata;
+AVMasteringDisplayMetadata *hdr_meta;
+AVFrameSideData *metadata_lt;
+AVContentLightMetadata *hdr_meta_lt;
+int i;
+const int mapping[3] = {1, 2, 0};  //green, blue, red
+const int chroma_den = 5;
+const int luma_den   = 1;
+
+metadata = av_frame_new_side_data(output_frame,
+  AV_FRAME_DATA_MASTERING_DISPLAY_METADATA,
+  sizeof(AVMasteringDisplayMetadata));
+if (!metadata)
+return AVERROR(ENOMEM);
+
+hdr_meta = (AVMasteringDisplayMetadata *)metadata->data;
+
+for (i = 0; i < 3; i++) {
+const int j = mapping[i];
+hdr_meta->display_primaries[j][0].num = 
ctx->out_metadata.display_primaries_x[i];
+hdr_meta->display_primaries[j][0].den = chroma_den;
+
+hdr_meta->display_primaries[j][1].num = 
ctx->out_metadata.display_primaries_y[i];
+hdr_meta->display_primaries[j][1].den = chroma_den;
+}
+
+hdr_meta->white_point[0].num = ctx->out_metadata.white_point_x;
+hdr_meta->white_point[0].den = chroma_den;
+
+hdr_meta->white_point[1].num = ctx->out_metadata.white_point_y;
+hdr_meta->white_point[1].den = chroma_den;
+hdr_meta->has_primaries = 1;
+
+hdr_meta->max_luminance.num = 

[FFmpeg-devel] [PATCH 1/3] lavfi/tonemap_vaapi: By default use bt709 for output frame

2024-03-18 Thread Xiang, Haihao
From: Haihao Xiang 

By default don't use the color properties from input frame as output
frame properties when performing HDR to SDR conversion

Signed-off-by: Haihao Xiang 
---
 doc/filters.texi   | 4 ++--
 libavfilter/vf_tonemap_vaapi.c | 7 +--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 913365671d..2cb84c1476 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -27839,7 +27839,7 @@ Default is nv12.
 @item primaries, p
 Set the output color primaries.
 
-Default is same as input.
+Default is bt709.
 
 @item transfer, t
 Set the output transfer characteristics.
@@ -27849,7 +27849,7 @@ Default is bt709.
 @item matrix, m
 Set the output colorspace matrix.
 
-Default is same as input.
+Default is bt709.
 
 @end table
 
diff --git a/libavfilter/vf_tonemap_vaapi.c b/libavfilter/vf_tonemap_vaapi.c
index 0b767202d2..a21f565e3a 100644
--- a/libavfilter/vf_tonemap_vaapi.c
+++ b/libavfilter/vf_tonemap_vaapi.c
@@ -278,13 +278,16 @@ static int tonemap_vaapi_filter_frame(AVFilterLink 
*inlink, AVFrame *input_frame
 if (err < 0)
 goto fail;
 
+/* Use BT709 by default for HDR to SDR output frame */
+output_frame->color_primaries = AVCOL_PRI_BT709;
+output_frame->color_trc = AVCOL_TRC_BT709;
+output_frame->colorspace = AVCOL_SPC_BT709;
+
 if (ctx->color_primaries != AVCOL_PRI_UNSPECIFIED)
 output_frame->color_primaries = ctx->color_primaries;
 
 if (ctx->color_transfer != AVCOL_TRC_UNSPECIFIED)
 output_frame->color_trc = ctx->color_transfer;
-else
-output_frame->color_trc = AVCOL_TRC_BT709;
 
 if (ctx->color_matrix != AVCOL_SPC_UNSPECIFIED)
 output_frame->colorspace = ctx->color_matrix;
-- 
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/3] lavfi/tonemap_vaapi: Update the log

2024-03-18 Thread Xiang, Haihao
From: Haihao Xiang 

demote the message to AV_LOG_VERBOSE.

Signed-off-by: Haihao Xiang 
---
 libavfilter/vf_tonemap_vaapi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_tonemap_vaapi.c b/libavfilter/vf_tonemap_vaapi.c
index a21f565e3a..5d475e8ff2 100644
--- a/libavfilter/vf_tonemap_vaapi.c
+++ b/libavfilter/vf_tonemap_vaapi.c
@@ -336,7 +336,7 @@ static av_cold int tonemap_vaapi_init(AVFilterContext 
*avctx)
 vpp_ctx->output_format = av_get_pix_fmt(ctx->output_format_string);
 } else {
 vpp_ctx->output_format = AV_PIX_FMT_NV12;
-av_log(avctx, AV_LOG_WARNING, "Output format not set, use default 
format NV12\n");
+av_log(avctx, AV_LOG_VERBOSE, "Output format not set, use default 
format NV12 for HDR to SDR tone mapping.\n");
 }
 
 #define STRING_OPTION(var_name, func_name, default_value) do { \
-- 
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] lavu/hwcontext_vulkan: check PCI ID if possible

2024-03-18 Thread Xiang, Haihao
From: Haihao Xiang 

Otherwise the derived device and the source device might have different
PCI ID in a multiple-device system.

Signed-off-by: Haihao Xiang 
---
 libavutil/hwcontext_vulkan.c | 30 +++---
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 855f099e26..91b9f96ccf 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -1597,15 +1597,31 @@ static int vulkan_device_derive(AVHWDeviceContext *ctx,
 #if CONFIG_VAAPI
 case AV_HWDEVICE_TYPE_VAAPI: {
 AVVAAPIDeviceContext *src_hwctx = src_ctx->hwctx;
+VADisplay dpy = src_hwctx->display;
+#if VA_CHECK_VERSION(1, 15, 0)
+VAStatus vas;
+VADisplayAttribute attr = {
+.type = VADisplayPCIID,
+};
+#endif
+const char *vendor;
 
-const char *vendor = vaQueryVendorString(src_hwctx->display);
-if (!vendor) {
-av_log(ctx, AV_LOG_ERROR, "Unable to get device info from 
VAAPI!\n");
-return AVERROR_EXTERNAL;
-}
+#if VA_CHECK_VERSION(1, 15, 0)
+vas = vaGetDisplayAttributes(dpy, , 1);
+if (vas == VA_STATUS_SUCCESS && attr.flags != 
VA_DISPLAY_ATTRIB_NOT_SUPPORTED)
+dev_select.pci_device = (attr.value & 0x);
+#endif
+
+if (!dev_select.pci_device) {
+vendor = vaQueryVendorString(dpy);
+if (!vendor) {
+av_log(ctx, AV_LOG_ERROR, "Unable to get device info from 
VAAPI!\n");
+return AVERROR_EXTERNAL;
+}
 
-if (strstr(vendor, "AMD"))
-dev_select.vendor_id = 0x1002;
+if (strstr(vendor, "AMD"))
+dev_select.vendor_id = 0x1002;
+}
 
 return vulkan_device_create_internal(ctx, _select, 0, opts, flags);
 }
-- 
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".


Re: [FFmpeg-devel] [PATCH] lavu/hwcontext_vulkan: check both vendor and PCI IDs

2024-03-18 Thread Xiang, Haihao
On Ma, 2024-03-18 at 07:39 +0100, Lynne wrote:
> Mar 18, 2024, 07:33 by haihao.xiang-at-intel@ffmpeg.org:
> 
> > On Ma, 2024-03-18 at 07:18 +0100, Lynne wrote:
> > 
> > > Mar 18, 2024, 06:57 by haihao.xiang-at-intel@ffmpeg.org:
> > > 
> > > > On Vr, 2024-03-08 at 15:13 +0800, Xiang, Haihao wrote:
> > > > 
> > > > > From: Haihao Xiang 
> > > > > 
> > > > > Otherwise the derived device and the source device might have
> > > > > different
> > > > > PCI ID or vendor ID in a multiple-device system.
> > > > > 
> > > > > Signed-off-by: Haihao Xiang 
> > > > > ---
> > > > >  libavutil/hwcontext_vulkan.c | 31 +--
> > > > >  1 file changed, 29 insertions(+), 2 deletions(-)
> > > > > 
> > > > > diff --git a/libavutil/hwcontext_vulkan.c
> > > > > b/libavutil/hwcontext_vulkan.c
> > > > > index 855f099e26..9d94f74d78 100644
> > > > > --- a/libavutil/hwcontext_vulkan.c
> > > > > +++ b/libavutil/hwcontext_vulkan.c
> > > > > @@ -975,6 +975,20 @@ static int find_device(AVHWDeviceContext *ctx,
> > > > > VulkanDeviceSelection *select)
> > > > >     select->name);
> > > > >  err = AVERROR(ENODEV);
> > > > >  goto end;
> > > > > +    } else if (select->vendor_id && select->pci_device) {
> > > > > +    av_log(ctx, AV_LOG_VERBOSE, "Requested vendor:device
> > > > > %04x:%04x\n",
> > > > > +   select->vendor_id, select->pci_device);
> > > > > +    for (int i = 0; i < num; i++) {
> > > > > +    if (select->vendor_id == prop[i].properties.vendorID &&
> > > > > +    select->pci_device == prop[i].properties.deviceID) {
> > > > > +    choice = i;
> > > > > +    goto end;
> > > > > +    }
> > > > > +    }
> > > > > +    av_log(ctx, AV_LOG_ERROR, "Unable to find device with vendor
> > > > > ID
> > > > > 0x%x
> > > > > "
> > > > > +   "and PCI ID 0x%x!\n", select->vendor_id, select-
> > > > > > pci_device);
> > > > > +    err = AVERROR(EINVAL);
> > > > > +    goto end;
> > > > >  } else if (select->pci_device) {
> > > > >  av_log(ctx, AV_LOG_VERBOSE, "Requested device: 0x%x\n",
> > > > > select-
> > > > > > pci_device);
> > > > >  for (int i = 0; i < num; i++) {
> > > > > @@ -1597,8 +1611,14 @@ static int
> > > > > vulkan_device_derive(AVHWDeviceContext
> > > > > *ctx,
> > > > >  #if CONFIG_VAAPI
> > > > >  case AV_HWDEVICE_TYPE_VAAPI: {
> > > > >  AVVAAPIDeviceContext *src_hwctx = src_ctx->hwctx;
> > > > > -
> > > > > -    const char *vendor = vaQueryVendorString(src_hwctx->display);
> > > > > +    VADisplay dpy = src_hwctx->display;
> > > > > +#if VA_CHECK_VERSION(1, 15, 0)
> > > > > +    VAStatus vas;
> > > > > +    VADisplayAttribute attr = {
> > > > > +    .type = VADisplayPCIID,
> > > > > +    };
> > > > > +#endif
> > > > > +    const char *vendor = vaQueryVendorString(dpy);
> > > > >  if (!vendor) {
> > > > >  av_log(ctx, AV_LOG_ERROR, "Unable to get device info from
> > > > > VAAPI!\n");
> > > > >  return AVERROR_EXTERNAL;
> > > > > @@ -1607,6 +1627,13 @@ static int
> > > > > vulkan_device_derive(AVHWDeviceContext
> > > > > *ctx,
> > > > >  if (strstr(vendor, "AMD"))
> > > > >  dev_select.vendor_id = 0x1002;
> > > > >  
> > > > > +#if VA_CHECK_VERSION(1, 15, 0)
> > > > > +    vas = vaGetDisplayAttributes(dpy, , 1);
> > > > > +    if (vas == VA_STATUS_SUCCESS && attr.flags !=
> > > > > VA_DISPLAY_ATTRIB_NOT_SUPPORTED) {
> > > > > +    dev_select.vendor_id = ((attr.value >> 16) & 0x);
> > > > > +    dev_select.pci_device = (attr.value & 0x);
> > > > > +    }
> > > > > +#endif
> > > > >  return vulkan_device_create_internal(ctx, _select, 0,
> > > > > opts,
> > > > > flags);
> > > > >  }
> > > > >  #endif
> > > > > 
> > > > 
> > > > Hi,
> > > > 
> > > > Any comment for this patch ? 
> > > > 
> > > 
> > > Is this possible? For two devices from different vendors to have the same
> > > PCI
> > > ID?
> > > 
> > 
> > I'm not sure for different vendors. But when two devices come from the same
> > vendor (e.g. 8086:56a0 and 8086:4682), vulkan always picks up 8086:56a0 no
> > matter the source device is 8086:4682 if we don't set the device id here.
> > 
> 
> Do you need to check for both vendor and PCI ID?
> If not, could you resend without the custom vendor+pci check
> and just using the regular pci ID check?

I updated the patch to check PCI ID only, please see 
https://ffmpeg.org/pipermail/ffmpeg-devel/2024-March/323661.html

Thanks
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".


Re: [FFmpeg-devel] duplicate symbol '_dec_init' in: fftools/ffmpeg_dec.o

2024-03-18 Thread Martin Storsjö

On Sun, 17 Mar 2024, Rémi Denis-Courmont wrote:

Obviously not. Imported libraries are only there to resolve missing 
symbols.


Sure - but if resolving the missing symbols brings in those conflicting 
object files, there's not much to do about it. If the static library 
contains dec_init in a standalone object file that nothing references, 
then sure, it won't be an issue. But if linking libbr brings in the object 
file that defines that symbol, we can't get around it.


Example:

$ cat mylib.h
void mylib_func(void);
$ cat mylib.c
#include "mylib.h"
void mylib_func(void) { }
void dec_init(void) { }
$ cat main.c
#include "mylib.h"

void dec_init(void) { }

int main(int argc, char **argv) {
mylib_func();
return 0;
}
$ gcc -c mylib.c
$ ar rcs libmylib.a mylib.o
$ gcc -c main.c
$ gcc main.o -o main -L. -lmylib
/usr/bin/ld: ./libmylib.a(mylib.o): in function `dec_init':
mylib.c:(.text+0xb): multiple definition of `dec_init'; 
main.o:main.c:(.text+0x0): first defined here

collect2: error: ld returned 1 exit status

I don't see what you propose that the FFmpeg build system should do 
differently to get around this issue, other than libbr not exposing global 
symbols outside of their namespace.


// Martin
___
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 v5 1/3] avformat/flvdec: support enhanced flv PacketTypeMetadata

2024-03-18 Thread Dennis Mungai
On Mon, 18 Mar 2024 at 12:09, Steven Liu  wrote:

> Steven Liu  于2024年3月7日周四 17:33写道:
> >
> > zhupengfei via ffmpeg-devel  于2024年3月4日周一
> 21:52写道:
> > >
> > > From: Zhu Pengfei <411294...@qq.com>
> > >
> > > Signed-off-by: Zhu Pengfei <411294...@qq.com>
> > > ---
> > >  libavformat/flvdec.c | 177 ++-
> > >  1 file changed, 176 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
> > > index e25b5bd163..2a0aec7291 100644
> > > --- a/libavformat/flvdec.c
> > > +++ b/libavformat/flvdec.c
> > > @@ -33,6 +33,7 @@
> > >  #include "libavutil/internal.h"
> > >  #include "libavutil/intfloat.h"
> > >  #include "libavutil/intreadwrite.h"
> > > +#include "libavutil/mastering_display_metadata.h"
> > >  #include "libavutil/mathematics.h"
> > >  #include "avformat.h"
> > >  #include "demux.h"
> > > @@ -45,6 +46,28 @@
> > >
> > >  #define MAX_DEPTH 16  ///< arbitrary limit to prevent unbounded
> recursion
> > >
> > > +typedef struct FLVMasteringMeta {
> > > +double r_x;
> > > +double r_y;
> > > +double g_x;
> > > +double g_y;
> > > +double b_x;
> > > +double b_y;
> > > +double white_x;
> > > +double white_y;
> > > +double max_luminance;
> > > +double min_luminance;
> > > +} FLVMasteringMeta;
> > > +
> > > +typedef struct FLVMetaVideoColor {
> > > +uint64_t matrix_coefficients;
> > > +uint64_t transfer_characteristics;
> > > +uint64_t primaries;
> > > +uint64_t max_cll;
> > > +uint64_t max_fall;
> > > +FLVMasteringMeta mastering_meta;
> > > +} FLVMetaVideoColor;
> > > +
> > >  typedef struct FLVContext {
> > >  const AVClass *class; ///< Class for private options.
> > >  int trust_metadata;   ///< configure streams according onMetaData
> > > @@ -80,6 +103,8 @@ typedef struct FLVContext {
> > >  int64_t time_offset;
> > >  int64_t time_pos;
> > >
> > > +FLVMetaVideoColor *metaVideoColor;
> > > +int meta_color_info_flag;
> > >  } FLVContext;
> > >
> > >  /* AMF date type */
> > > @@ -524,6 +549,7 @@ static int amf_parse_object(AVFormatContext *s,
> AVStream *astream,
> > >  FLVContext *flv = s->priv_data;
> > >  AVIOContext *ioc;
> > >  AMFDataType amf_type;
> > > +FLVMetaVideoColor *meta_video_color = flv->metaVideoColor;
> > >  char str_val[1024];
> > >  double num_val;
> > >  amf_date date;
> > > @@ -672,6 +698,43 @@ static int amf_parse_object(AVFormatContext *s,
> AVStream *astream,
> > >  }
> > >  }
> > >
> > > +if (meta_video_color) {
> > > +if (amf_type == AMF_DATA_TYPE_NUMBER ||
> > > +amf_type == AMF_DATA_TYPE_BOOL) {
> > > +if (!strcmp(key, "colorPrimaries")) {
> > > +meta_video_color->primaries = num_val;
> > > +} else if (!strcmp(key, "transferCharacteristics")) {
> > > +meta_video_color->transfer_characteristics =
> num_val;
> > > +} else if (!strcmp(key, "matrixCoefficients")) {
> > > +meta_video_color->matrix_coefficients = num_val;
> > > +} else if (!strcmp(key, "maxFall")) {
> > > +meta_video_color->max_fall = num_val;
> > > +} else if (!strcmp(key, "maxCLL")) {
> > > +meta_video_color->max_cll = num_val;
> > > +} else if (!strcmp(key, "redX")) {
> > > +meta_video_color->mastering_meta.r_x = num_val;
> > > +} else if (!strcmp(key, "redY")) {
> > > +meta_video_color->mastering_meta.r_y = num_val;
> > > +} else if (!strcmp(key, "greenX")) {
> > > +meta_video_color->mastering_meta.g_x = num_val;
> > > +} else if (!strcmp(key, "greenY")) {
> > > +meta_video_color->mastering_meta.g_y = num_val;
> > > +} else if (!strcmp(key, "blueX")) {
> > > +meta_video_color->mastering_meta.b_x = num_val;
> > > +} else if (!strcmp(key, "blueY")) {
> > > +meta_video_color->mastering_meta.b_y = num_val;
> > > +} else if (!strcmp(key, "whitePointX")) {
> > > +meta_video_color->mastering_meta.white_x =
> num_val;
> > > +} else if (!strcmp(key, "whitePointY")) {
> > > +meta_video_color->mastering_meta.white_y =
> num_val;
> > > +} else if (!strcmp(key, "maxLuminance")) {
> > > +meta_video_color->mastering_meta.max_luminance =
> num_val;
> > > +} else if (!strcmp(key, "minLuminance")) {
> > > +meta_video_color->mastering_meta.min_luminance =
> num_val;
> > > +}
> > > +}
> > > +}
> > > +
> > >  if (amf_type == AMF_DATA_TYPE_OBJECT && s->nb_streams == 1 &&
> > > ((!apar && !strcmp(key, 

Re: [FFmpeg-devel] [PATCH] Changelog: Add Support PacketTypeMetadata of PacketType in enhanced flv

2024-03-18 Thread Liu Steven


> On Mar 18, 2024, at 18:23, Jean-Baptiste Kempf  wrote:
> 
> 
> 
> On Mon, 18 Mar 2024, at 11:01, Steven Liu via ffmpeg-devel wrote:
>> Changelog | 1 +
>> 1 file changed, 1 insertion(+)
> 
> Obviously LGTM.

Applied


> 
> jbk
Thanks jb
> 
> -- 
> Jean-Baptiste Kempf -  President
> +33 672 704 734
> https://jbkempf.com/
> ___
> 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”.


Thanks
Steven


___
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] tests/ref/lavf-fate/hevc.flv: Fix ref file

2024-03-18 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Unbreaks the lavf-fate-hevc.flv FATE test.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  tests/ref/lavf-fate/hevc.flv | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/ref/lavf-fate/hevc.flv b/tests/ref/lavf-fate/hevc.flv
> index 5f47c352fd..1105d8eddb 100644
> --- a/tests/ref/lavf-fate/hevc.flv
> +++ b/tests/ref/lavf-fate/hevc.flv
> @@ -1,3 +1,3 @@
> -eca3b99e846e509c6957260b1ce4d82d *tests/data/lavf-fate/lavf.hevc.flv
> -11784 tests/data/lavf-fate/lavf.hevc.flv
> +39cf3df5fc3a9c50ab71a294f45663fe *tests/data/lavf-fate/lavf.hevc.flv
> +11819 tests/data/lavf-fate/lavf.hevc.flv
>  tests/data/lavf-fate/lavf.hevc.flv CRC=0xd29da885

Will apply.

- 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".


Re: [FFmpeg-devel] [PATCH v1] avcodec/cbs_vp8: Improve the bitstream position check

2024-03-18 Thread Andreas Rheinhardt
Dai, Jianhui J:
> The VP8 compressed header may not be byte-aligned due to boolean
> coding. Use bitwise comparison to prevent the potential overread.
> 
> Signed-off-by: Jianhui Dai 
> ---
>  libavcodec/cbs_vp8.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/cbs_vp8.c b/libavcodec/cbs_vp8.c
> index 065156c248..13acad3724 100644
> --- a/libavcodec/cbs_vp8.c
> +++ b/libavcodec/cbs_vp8.c
> @@ -327,9 +327,10 @@ static int cbs_vp8_read_unit(CodedBitstreamContext *ctx,
>  if (err < 0)
>  return err;
>  
> +// Position may not be byte-aligned after compressed header; using bits
> +// count comparison for accuracy.
>  pos = get_bits_count();
> -pos /= 8;
> -av_assert0(pos <= unit->data_size);
> +av_assert0(pos <= unit->data_size * 8);

(pos + 7U) / 8 seems better to avoid potential overflow issues
(not an issue atm, but if we ever were to use e.g. 64bit for bitcount of
the GetBit API, then the multiplication on the right could overflow a
32bit size_t).

>  
>  frame->data_ref = av_buffer_ref(unit->data_ref);
>  if (!frame->data_ref)

___
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 v5 1/3] avformat/flvdec: support enhanced flv PacketTypeMetadata

2024-03-18 Thread Zhao Zhili



> On Mar 18, 2024, at 17:14, Dennis Mungai  wrote:
> 
> Steven and Zhu Pengfei,
> 
> Thank you for the patchset. Can this be back-ported to release/6.1?

Only bug fix and security fix can be back ported to stable release. This patch 
is for new feature.

> ___
> 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] fate/lavf-container: correct operator; unbreak build

2024-03-18 Thread Liu Steven


> On Mar 18, 2024, at 18:11, Gyan Doshi  wrote:
> 
> ---
> tests/fate/lavf-container.mak | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/fate/lavf-container.mak b/tests/fate/lavf-container.mak
> index b18ed2362b..7a925117c3 100644
> --- a/tests/fate/lavf-container.mak
> +++ b/tests/fate/lavf-container.mak
> @@ -80,7 +80,7 @@ FATE_LAVF_CONTAINER_FATE-$(call ALLYES, MOV_DEMUXER
> LATM_MUXER) +
> FATE_LAVF_CONTAINER_FATE-$(call ALLYES, MP3_DEMUXERMP3_MUXER) 
>  += mp3
> FATE_LAVF_CONTAINER_FATE-$(call ALLYES, MOV_DEMUXER MOV_MUXER 
> ARESAMPLE_FILTER) += qtrle_mace6.mov
> FATE_LAVF_CONTAINER_FATE-$(call ALLYES, AVI_DEMUXER AVI_MUXER 
> ARESAMPLE_FILTER) += cram.avi
> -FATE_LAVF_CONTAINER_FATE-$(call ALLYES, AVI_DEMUXERFLV_MUXER)
>   + = hevc.flv
> +FATE_LAVF_CONTAINER_FATE-$(call ALLYES, AVI_DEMUXERFLV_MUXER)
>+= hevc.flv

Good catch.
> 
> FATE_LAVF_CONTAINER_FATE = $(FATE_LAVF_CONTAINER_FATE-yes:%=fate-lavf-fate-%)
> 
> -- 
> 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”.
> 

Thanks Gyan
Steven
___
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] fate/lavf-container: correct operator; unbreak build

2024-03-18 Thread Gyan Doshi
---
 tests/fate/lavf-container.mak | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/fate/lavf-container.mak b/tests/fate/lavf-container.mak
index b18ed2362b..7a925117c3 100644
--- a/tests/fate/lavf-container.mak
+++ b/tests/fate/lavf-container.mak
@@ -80,7 +80,7 @@ FATE_LAVF_CONTAINER_FATE-$(call ALLYES, MOV_DEMUXER
LATM_MUXER) +
 FATE_LAVF_CONTAINER_FATE-$(call ALLYES, MP3_DEMUXERMP3_MUXER)  
+= mp3
 FATE_LAVF_CONTAINER_FATE-$(call ALLYES, MOV_DEMUXER MOV_MUXER 
ARESAMPLE_FILTER) += qtrle_mace6.mov
 FATE_LAVF_CONTAINER_FATE-$(call ALLYES, AVI_DEMUXER AVI_MUXER 
ARESAMPLE_FILTER) += cram.avi
-FATE_LAVF_CONTAINER_FATE-$(call ALLYES, AVI_DEMUXERFLV_MUXER)  
+ = hevc.flv
+FATE_LAVF_CONTAINER_FATE-$(call ALLYES, AVI_DEMUXERFLV_MUXER)  
 += hevc.flv
 
 FATE_LAVF_CONTAINER_FATE = $(FATE_LAVF_CONTAINER_FATE-yes:%=fate-lavf-fate-%)
 
-- 
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] Changelog: Add Support PacketTypeMetadata of PacketType in enhanced flv

2024-03-18 Thread Steven Liu via ffmpeg-devel
Signed-off-by: Steven Liu 
---
 Changelog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Changelog b/Changelog
index b7d7535a9e..e3ca52430c 100644
--- a/Changelog
+++ b/Changelog
@@ -34,6 +34,7 @@ version :
 - ffprobe (with -export_side_data film_grain) now prints film grain metadata
 - AEA muxer
 - ffmpeg CLI loopback decoders
+- Support PacketTypeMetadata of PacketType in enhanced flv format
 
 
 version 6.1:
-- 
2.39.3 (Apple Git-146)

___
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] fate/lavf-container: correct operator; unbreak build

2024-03-18 Thread Gyan Doshi




On 2024-03-18 04:11 pm, Liu Steven wrote:



On Mar 18, 2024, at 18:11, Gyan Doshi  wrote:

---
tests/fate/lavf-container.mak | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/fate/lavf-container.mak b/tests/fate/lavf-container.mak
index b18ed2362b..7a925117c3 100644
--- a/tests/fate/lavf-container.mak
+++ b/tests/fate/lavf-container.mak
@@ -80,7 +80,7 @@ FATE_LAVF_CONTAINER_FATE-$(call ALLYES, MOV_DEMUXER
LATM_MUXER) +
FATE_LAVF_CONTAINER_FATE-$(call ALLYES, MP3_DEMUXERMP3_MUXER)  
+= mp3
FATE_LAVF_CONTAINER_FATE-$(call ALLYES, MOV_DEMUXER MOV_MUXER ARESAMPLE_FILTER) 
+= qtrle_mace6.mov
FATE_LAVF_CONTAINER_FATE-$(call ALLYES, AVI_DEMUXER AVI_MUXER ARESAMPLE_FILTER) 
+= cram.avi
-FATE_LAVF_CONTAINER_FATE-$(call ALLYES, AVI_DEMUXERFLV_MUXER)  
+ = hevc.flv
+FATE_LAVF_CONTAINER_FATE-$(call ALLYES, AVI_DEMUXERFLV_MUXER)  
 += hevc.flv

Good catch.


I'll push this now.

Thanks,
Gyan

___
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] duplicate symbol '_dec_init' in: fftools/ffmpeg_dec.o

2024-03-18 Thread Andreas Rheinhardt
Martin Storsjö:
> On Sun, 17 Mar 2024, Rémi Denis-Courmont wrote:
> 
>> Obviously not. Imported libraries are only there to resolve missing
>> symbols.
> 
> Sure - but if resolving the missing symbols brings in those conflicting
> object files, there's not much to do about it. If the static library
> contains dec_init in a standalone object file that nothing references,
> then sure, it won't be an issue. But if linking libbr brings in the
> object file that defines that symbol, we can't get around it.
> 
> Example:
> 
> $ cat mylib.h
> void mylib_func(void);
> $ cat mylib.c
> #include "mylib.h"
> void mylib_func(void) { }
> void dec_init(void) { }
> $ cat main.c
> #include "mylib.h"
> 
> void dec_init(void) { }
> 
> int main(int argc, char **argv) {
>     mylib_func();
>     return 0;
> }
> $ gcc -c mylib.c
> $ ar rcs libmylib.a mylib.o
> $ gcc -c main.c
> $ gcc main.o -o main -L. -lmylib
> /usr/bin/ld: ./libmylib.a(mylib.o): in function `dec_init':
> mylib.c:(.text+0xb): multiple definition of `dec_init';
> main.o:main.c:(.text+0x0): first defined here
> collect2: error: ld returned 1 exit status
> 
> I don't see what you propose that the FFmpeg build system should do
> differently to get around this issue, other than libbr not exposing
> global symbols outside of their namespace.
> 

I think he wants us to use partial linking for the fftools: Link all the
object files for a given fftool into a single object file and make this
object file export nothing (except main).

- 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".


Re: [FFmpeg-devel] [PATCH 3/3] avutil/hwcontext_d3d11va: add logging to dxgi debug interfaces

2024-03-18 Thread Timo Rothenpieler

applied
___
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 v5 1/3] avformat/flvdec: support enhanced flv PacketTypeMetadata

2024-03-18 Thread Steven Liu
Steven Liu  于2024年3月7日周四 17:33写道:
>
> zhupengfei via ffmpeg-devel  于2024年3月4日周一 21:52写道:
> >
> > From: Zhu Pengfei <411294...@qq.com>
> >
> > Signed-off-by: Zhu Pengfei <411294...@qq.com>
> > ---
> >  libavformat/flvdec.c | 177 ++-
> >  1 file changed, 176 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
> > index e25b5bd163..2a0aec7291 100644
> > --- a/libavformat/flvdec.c
> > +++ b/libavformat/flvdec.c
> > @@ -33,6 +33,7 @@
> >  #include "libavutil/internal.h"
> >  #include "libavutil/intfloat.h"
> >  #include "libavutil/intreadwrite.h"
> > +#include "libavutil/mastering_display_metadata.h"
> >  #include "libavutil/mathematics.h"
> >  #include "avformat.h"
> >  #include "demux.h"
> > @@ -45,6 +46,28 @@
> >
> >  #define MAX_DEPTH 16  ///< arbitrary limit to prevent unbounded 
> > recursion
> >
> > +typedef struct FLVMasteringMeta {
> > +double r_x;
> > +double r_y;
> > +double g_x;
> > +double g_y;
> > +double b_x;
> > +double b_y;
> > +double white_x;
> > +double white_y;
> > +double max_luminance;
> > +double min_luminance;
> > +} FLVMasteringMeta;
> > +
> > +typedef struct FLVMetaVideoColor {
> > +uint64_t matrix_coefficients;
> > +uint64_t transfer_characteristics;
> > +uint64_t primaries;
> > +uint64_t max_cll;
> > +uint64_t max_fall;
> > +FLVMasteringMeta mastering_meta;
> > +} FLVMetaVideoColor;
> > +
> >  typedef struct FLVContext {
> >  const AVClass *class; ///< Class for private options.
> >  int trust_metadata;   ///< configure streams according onMetaData
> > @@ -80,6 +103,8 @@ typedef struct FLVContext {
> >  int64_t time_offset;
> >  int64_t time_pos;
> >
> > +FLVMetaVideoColor *metaVideoColor;
> > +int meta_color_info_flag;
> >  } FLVContext;
> >
> >  /* AMF date type */
> > @@ -524,6 +549,7 @@ static int amf_parse_object(AVFormatContext *s, 
> > AVStream *astream,
> >  FLVContext *flv = s->priv_data;
> >  AVIOContext *ioc;
> >  AMFDataType amf_type;
> > +FLVMetaVideoColor *meta_video_color = flv->metaVideoColor;
> >  char str_val[1024];
> >  double num_val;
> >  amf_date date;
> > @@ -672,6 +698,43 @@ static int amf_parse_object(AVFormatContext *s, 
> > AVStream *astream,
> >  }
> >  }
> >
> > +if (meta_video_color) {
> > +if (amf_type == AMF_DATA_TYPE_NUMBER ||
> > +amf_type == AMF_DATA_TYPE_BOOL) {
> > +if (!strcmp(key, "colorPrimaries")) {
> > +meta_video_color->primaries = num_val;
> > +} else if (!strcmp(key, "transferCharacteristics")) {
> > +meta_video_color->transfer_characteristics = num_val;
> > +} else if (!strcmp(key, "matrixCoefficients")) {
> > +meta_video_color->matrix_coefficients = num_val;
> > +} else if (!strcmp(key, "maxFall")) {
> > +meta_video_color->max_fall = num_val;
> > +} else if (!strcmp(key, "maxCLL")) {
> > +meta_video_color->max_cll = num_val;
> > +} else if (!strcmp(key, "redX")) {
> > +meta_video_color->mastering_meta.r_x = num_val;
> > +} else if (!strcmp(key, "redY")) {
> > +meta_video_color->mastering_meta.r_y = num_val;
> > +} else if (!strcmp(key, "greenX")) {
> > +meta_video_color->mastering_meta.g_x = num_val;
> > +} else if (!strcmp(key, "greenY")) {
> > +meta_video_color->mastering_meta.g_y = num_val;
> > +} else if (!strcmp(key, "blueX")) {
> > +meta_video_color->mastering_meta.b_x = num_val;
> > +} else if (!strcmp(key, "blueY")) {
> > +meta_video_color->mastering_meta.b_y = num_val;
> > +} else if (!strcmp(key, "whitePointX")) {
> > +meta_video_color->mastering_meta.white_x = num_val;
> > +} else if (!strcmp(key, "whitePointY")) {
> > +meta_video_color->mastering_meta.white_y = num_val;
> > +} else if (!strcmp(key, "maxLuminance")) {
> > +meta_video_color->mastering_meta.max_luminance = 
> > num_val;
> > +} else if (!strcmp(key, "minLuminance")) {
> > +meta_video_color->mastering_meta.min_luminance = 
> > num_val;
> > +}
> > +}
> > +}
> > +
> >  if (amf_type == AMF_DATA_TYPE_OBJECT && s->nb_streams == 1 &&
> > ((!apar && !strcmp(key, "audiocodecid")) ||
> >  (!vpar && !strcmp(key, "videocodecid"
> > @@ -824,6 +887,7 @@ static int flv_read_close(AVFormatContext *s)
> >  av_freep(>new_extradata[i]);
> >  av_freep(>keyframe_times);
> >  av_freep(>keyframe_filepositions);
> > 

Re: [FFmpeg-devel] [PATCH] Changelog: Add Support PacketTypeMetadata of PacketType in enhanced flv

2024-03-18 Thread Jean-Baptiste Kempf



On Mon, 18 Mar 2024, at 11:01, Steven Liu via ffmpeg-devel wrote:
>  Changelog | 1 +
>  1 file changed, 1 insertion(+)

Obviously LGTM.

jbk

-- 
Jean-Baptiste Kempf -  President
+33 672 704 734
https://jbkempf.com/
___
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] tests/ref/lavf-fate/hevc.flv: Fix ref file

2024-03-18 Thread Andreas Rheinhardt
Unbreaks the lavf-fate-hevc.flv FATE test.

Signed-off-by: Andreas Rheinhardt 
---
 tests/ref/lavf-fate/hevc.flv | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/ref/lavf-fate/hevc.flv b/tests/ref/lavf-fate/hevc.flv
index 5f47c352fd..1105d8eddb 100644
--- a/tests/ref/lavf-fate/hevc.flv
+++ b/tests/ref/lavf-fate/hevc.flv
@@ -1,3 +1,3 @@
-eca3b99e846e509c6957260b1ce4d82d *tests/data/lavf-fate/lavf.hevc.flv
-11784 tests/data/lavf-fate/lavf.hevc.flv
+39cf3df5fc3a9c50ab71a294f45663fe *tests/data/lavf-fate/lavf.hevc.flv
+11819 tests/data/lavf-fate/lavf.hevc.flv
 tests/data/lavf-fate/lavf.hevc.flv CRC=0xd29da885
-- 
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 v4 12/13] avcodec/h2645_sei: decode AFGS1 T.35 SEI

2024-03-18 Thread Niklas Haas
From: Niklas Haas 

I restricted this SEI to HEVC for now, until I see a H.264 sample.
---
 libavcodec/Makefile|  2 +-
 libavcodec/h2645_sei.c | 25 +
 libavcodec/h2645_sei.h |  3 +++
 3 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 708434ac76c..824845276ae 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -105,7 +105,7 @@ OBJS-$(CONFIG_H264_SEI)+= h264_sei.o 
h2645_sei.o
 OBJS-$(CONFIG_HEVCPARSE)   += hevc_parse.o hevc_ps.o hevc_data.o \
   h2645data.o h2645_parse.o h2645_vui.o
 OBJS-$(CONFIG_HEVC_SEI)+= hevc_sei.o h2645_sei.o \
-  dynamic_hdr_vivid.o
+  dynamic_hdr_vivid.o aom_film_grain.o
 OBJS-$(CONFIG_HPELDSP) += hpeldsp.o
 OBJS-$(CONFIG_HUFFMAN) += huffman.o
 OBJS-$(CONFIG_HUFFYUVDSP)  += huffyuvdsp.o
diff --git a/libavcodec/h2645_sei.c b/libavcodec/h2645_sei.c
index 73f894436fd..ea6d596ba39 100644
--- a/libavcodec/h2645_sei.c
+++ b/libavcodec/h2645_sei.c
@@ -209,6 +209,24 @@ static int decode_registered_user_data(H2645SEI *h, 
GetByteContext *gb,
 }
 break;
 }
+case 0x5890: { // aom_provider_code
+const uint16_t aom_grain_provider_oriented_code = 0x0001;
+uint16_t provider_oriented_code;
+
+if (!IS_HEVC(codec_id))
+goto unsupported_provider_code;
+
+if (bytestream2_get_bytes_left(gb) < 2)
+return AVERROR_INVALIDDATA;
+
+provider_oriented_code = bytestream2_get_byteu(gb);
+if (provider_oriented_code == aom_grain_provider_oriented_code) {
+return ff_aom_parse_film_grain_sets(>aom_film_grain,
+gb->buffer,
+
bytestream2_get_bytes_left(gb));
+}
+break;
+}
 unsupported_provider_code:
 #endif
 default:
@@ -702,6 +720,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
 avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
 }
 
+#if CONFIG_HEVC_SEI
+ret = ff_aom_attach_film_grain_sets(>aom_film_grain, frame);
+if (ret < 0)
+return ret;
+#endif
+
 if (sei->ambient_viewing_environment.present) {
 H2645SEIAmbientViewingEnvironment *env =
 >ambient_viewing_environment;
@@ -798,4 +822,5 @@ void ff_h2645_sei_reset(H2645SEI *s)
 s->ambient_viewing_environment.present = 0;
 s->mastering_display.present = 0;
 s->content_light.present = 0;
+s->aom_film_grain.enable = 0;
 }
diff --git a/libavcodec/h2645_sei.h b/libavcodec/h2645_sei.h
index 0ebf48011af..b9a6c7587b1 100644
--- a/libavcodec/h2645_sei.h
+++ b/libavcodec/h2645_sei.h
@@ -23,7 +23,9 @@
 
 #include "libavutil/buffer.h"
 #include "libavutil/frame.h"
+#include "libavutil/film_grain_params.h"
 
+#include "aom_film_grain.h"
 #include "avcodec.h"
 #include "bytestream.h"
 #include "codec_id.h"
@@ -132,6 +134,7 @@ typedef struct H2645SEI {
 H2645SEIAmbientViewingEnvironment ambient_viewing_environment;
 H2645SEIMasteringDisplay mastering_display;
 H2645SEIContentLight content_light;
+AVFilmGrainAFGS1Params aom_film_grain;
 } H2645SEI;
 
 enum {
-- 
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 v4 11/13] avcodec/aom_film_grain: implement AFGS1 parsing

2024-03-18 Thread Niklas Haas
From: Niklas Haas 

Based on the AOMedia Film Grain Synthesis 1 (AFGS1) spec:
  https://aomediacodec.github.io/afgs1-spec/

The parsing has been changed substantially relative to the AV1 film
grain OBU. In particular:

1. There is the possibility of maintaining multiple independent film
   grain parameter sets, and decoders/players are recommended to pick
   the one most appropriate for the intended display resolution. This
   could also be used to e.g. switch between different grain profiles
   without having to re-signal the appropriate coefficients.

2. Supporting this, it's possible to *predict* the grain coefficients
   from previously signalled parameter sets, transmitting only the
   residual.

3. When not predicting, the parameter sets are now stored as a series of
   increments, rather than being directly transmitted.

4. There are several new AFGS1-exclusive fields.

I placed this parser in its own file, rather than h2645_sei.c, since
nothing in the generic AFGS1 film grain payload is specific to T.35, and
to compartmentalize the code base.
---
 libavcodec/aom_film_grain.c | 238 
 libavcodec/aom_film_grain.h |  13 ++
 2 files changed, 251 insertions(+)

diff --git a/libavcodec/aom_film_grain.c b/libavcodec/aom_film_grain.c
index ffcd71b584b..e302567ba5f 100644
--- a/libavcodec/aom_film_grain.c
+++ b/libavcodec/aom_film_grain.c
@@ -29,6 +29,7 @@
 #include "libavutil/imgutils.h"
 
 #include "aom_film_grain.h"
+#include "get_bits.h"
 
 // Common/shared helpers (not dependent on BIT_DEPTH)
 static inline int get_random_number(const int bits, unsigned *const state) {
@@ -118,6 +119,243 @@ int ff_aom_apply_film_grain(AVFrame *out, const AVFrame 
*in,
 return AVERROR_INVALIDDATA;
 }
 
+int ff_aom_parse_film_grain_sets(AVFilmGrainAFGS1Params *s,
+ const uint8_t *payload, int payload_size)
+{
+GetBitContext gbc, *gb = 
+AVFilmGrainAOMParams *aom;
+AVFilmGrainParams *fgp, *ref = NULL;
+int ret, num_sets, n, i, uv, num_y_coeffs, update_grain, luma_only;
+
+ret = init_get_bits8(gb, payload, payload_size);
+if (ret < 0)
+return ret;
+
+s->enable = get_bits1(gb);
+if (!s->enable)
+return 0;
+
+skip_bits(gb, 4); // reserved
+num_sets = get_bits(gb, 3) + 1;
+for (n = 0; n < num_sets; n++) {
+int payload_4byte, payload_size, set_idx, apply_units_log2, vsc_flag;
+int predict_scaling, predict_y_scaling, predict_uv_scaling[2];
+int payload_bits, start_position;
+
+start_position = get_bits_count(gb);
+payload_4byte = get_bits1(gb);
+payload_size = get_bits(gb, payload_4byte ? 2 : 8);
+set_idx = get_bits(gb, 3);
+fgp = >sets[set_idx];
+aom = >codec.aom;
+
+fgp->type = get_bits1(gb) ? AV_FILM_GRAIN_PARAMS_AV1 : 
AV_FILM_GRAIN_PARAMS_NONE;
+if (!fgp->type)
+continue;
+
+fgp->seed = get_bits(gb, 16);
+update_grain = get_bits1(gb);
+if (!update_grain)
+continue;
+
+apply_units_log2  = get_bits(gb, 4);
+fgp->width  = get_bits(gb, 12) << apply_units_log2;
+fgp->height = get_bits(gb, 12) << apply_units_log2;
+luma_only = get_bits1(gb);
+if (luma_only) {
+fgp->subsampling_x = fgp->subsampling_y = 0;
+} else {
+fgp->subsampling_x = get_bits1(gb);
+fgp->subsampling_y = get_bits1(gb);
+}
+
+fgp->bit_depth_luma  = fgp->bit_depth_chroma = 0;
+fgp->color_primaries = AVCOL_PRI_UNSPECIFIED;
+fgp->color_trc   = AVCOL_TRC_UNSPECIFIED;
+fgp->color_space = AVCOL_SPC_UNSPECIFIED;
+fgp->color_range = AVCOL_RANGE_UNSPECIFIED;
+
+vsc_flag = get_bits1(gb); // video_signal_characteristics_flag
+if (vsc_flag) {
+int cicp_flag;
+fgp->bit_depth_luma = get_bits(gb, 3) + 8;
+if (!luma_only)
+fgp->bit_depth_chroma = fgp->bit_depth_luma;
+cicp_flag = get_bits1(gb);
+if (cicp_flag) {
+fgp->color_primaries = get_bits(gb, 8);
+fgp->color_trc = get_bits(gb, 8);
+fgp->color_space = get_bits(gb, 8);
+fgp->color_range = get_bits1(gb) ? AVCOL_RANGE_JPEG : 
AVCOL_RANGE_MPEG;
+if (fgp->color_primaries > AVCOL_PRI_NB ||
+fgp->color_primaries == AVCOL_PRI_RESERVED ||
+fgp->color_primaries == AVCOL_PRI_RESERVED0 ||
+fgp->color_trc > AVCOL_TRC_NB ||
+fgp->color_trc == AVCOL_TRC_RESERVED ||
+fgp->color_trc == AVCOL_TRC_RESERVED0 ||
+fgp->color_space > AVCOL_SPC_NB ||
+fgp->color_space == AVCOL_SPC_RESERVED)
+goto error;
+}
+}
+
+predict_scaling = get_bits1(gb);
+if (predict_scaling && (!ref || ref 

[FFmpeg-devel] [PATCH v4 05/13] avcodec/h2645_sei: signal new AVFilmGrainParams members

2024-03-18 Thread Niklas Haas
From: Niklas Haas 

H.274 specifies that film grain parameters are signalled as intended for
4:4:4 frames, so we always signal this, regardless of the frame's actual
subsampling.
---
 libavcodec/h2645_sei.c | 46 +-
 1 file changed, 28 insertions(+), 18 deletions(-)

diff --git a/libavcodec/h2645_sei.c b/libavcodec/h2645_sei.c
index e60606f43f9..73f894436fd 100644
--- a/libavcodec/h2645_sei.c
+++ b/libavcodec/h2645_sei.c
@@ -641,35 +641,45 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei,
 h274  = >codec.h274;
 
 fgp->seed = seed;
+fgp->width = frame->width;
+fgp->height = frame->height;
+
+/* H.274 mandates film grain be applied to 4:4:4 frames */
+fgp->subsampling_x = fgp->subsampling_y = 0;
 
 h274->model_id = fgc->model_id;
 if (fgc->separate_colour_description_present_flag) {
-h274->bit_depth_luma   = fgc->bit_depth_luma;
-h274->bit_depth_chroma = fgc->bit_depth_chroma;
-h274->color_range  = fgc->full_range + 1;
-h274->color_primaries  = fgc->color_primaries;
-h274->color_trc= fgc->transfer_characteristics;
-h274->color_space  = fgc->matrix_coeffs;
+fgp->bit_depth_luma   = fgc->bit_depth_luma;
+fgp->bit_depth_chroma = fgc->bit_depth_chroma;
+fgp->color_range  = fgc->full_range + 1;
+fgp->color_primaries  = fgc->color_primaries;
+fgp->color_trc= fgc->transfer_characteristics;
+fgp->color_space  = fgc->matrix_coeffs;
 } else {
-h274->bit_depth_luma   = bit_depth_luma;
-h274->bit_depth_chroma = bit_depth_chroma;
+fgp->bit_depth_luma   = bit_depth_luma;
+fgp->bit_depth_chroma = bit_depth_chroma;
 if (vui->video_signal_type_present_flag)
-h274->color_range = vui->video_full_range_flag + 1;
-else
-h274->color_range = AVCOL_RANGE_UNSPECIFIED;
+fgp->color_range = vui->video_full_range_flag + 1;
 if (vui->colour_description_present_flag) {
-h274->color_primaries = vui->colour_primaries;
-h274->color_trc   = vui->transfer_characteristics;
-h274->color_space = vui->matrix_coeffs;
-} else {
-h274->color_primaries = AVCOL_PRI_UNSPECIFIED;
-h274->color_trc   = AVCOL_TRC_UNSPECIFIED;
-h274->color_space = AVCOL_SPC_UNSPECIFIED;
+fgp->color_primaries = vui->colour_primaries;
+fgp->color_trc   = vui->transfer_characteristics;
+fgp->color_space = vui->matrix_coeffs;
 }
 }
 h274->blending_mode_id  = fgc->blending_mode_id;
 h274->log2_scale_factor = fgc->log2_scale_factor;
 
+#if FF_API_H274_FILM_GRAIN_VCS
+FF_DISABLE_DEPRECATION_WARNINGS
+h274->bit_depth_luma   = fgp->bit_depth_luma;
+h274->bit_depth_chroma = fgp->bit_depth_chroma;
+h274->color_range  = fgp->color_range;
+h274->color_primaries  = fgp->color_primaries;
+h274->color_trc= fgp->color_trc;
+h274->color_space  = fgp->color_space;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
 memcpy(>component_model_present, >comp_model_present_flag,
sizeof(h274->component_model_present));
 memcpy(>num_intensity_intervals, >num_intensity_intervals,
-- 
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 v4 09/13] avutil/film_grain_params: add av_film_grain_params_select()

2024-03-18 Thread Niklas Haas
From: Niklas Haas 

Common utility function that can be used by all codecs to select the
right (any valid) film grain parameter set. In particular, this is
useful for AFGS1, which has support for multiple parameters.

However, it also performs parameter validation for H274.
---
 doc/APIchanges|  3 ++
 libavutil/film_grain_params.c | 61 +++
 libavutil/film_grain_params.h | 11 +++
 libavutil/version.h   |  2 +-
 4 files changed, 76 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 256d9c7757a..f91f4fdcec4 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07
 
 API changes, most recent first:
 
+2024-03-xx - xx - lavu 59.4.100 - film_grain_params.h
+  Add av_film_grain_params_select().
+
 2024-03-xx - xx - lavu 59.3.100 - film_grain_params.h
   Add AVFilmGrainParams.color_range, color_primaries, color_trc, color_space,
   width, height, subsampling_x, subsampling_y, bit_depth_luma and
diff --git a/libavutil/film_grain_params.c b/libavutil/film_grain_params.c
index 230ce8d701c..fff7252f2f5 100644
--- a/libavutil/film_grain_params.c
+++ b/libavutil/film_grain_params.c
@@ -17,6 +17,7 @@
  */
 
 #include "film_grain_params.h"
+#include "pixdesc.h"
 
 AVFilmGrainParams *av_film_grain_params_alloc(size_t *size)
 {
@@ -47,3 +48,63 @@ AVFilmGrainParams 
*av_film_grain_params_create_side_data(AVFrame *frame)
 
 return fgp;
 }
+
+const AVFilmGrainParams *av_film_grain_params_select(const AVFrame *frame)
+{
+const AVFilmGrainParams *fgp, *best = NULL;
+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
+const AVFilmGrainAOMParams *aom;
+const AVFilmGrainH274Params *h274;
+int bit_depth_luma, bit_depth_chroma;
+if (!desc)
+return NULL;
+
+/* There are no YUV formats with different bit depth per component,
+ * so just check both against the first component for simplicity */
+bit_depth_luma = bit_depth_chroma = desc->comp[0].depth;
+
+for (int i = 0; i < frame->nb_side_data; i++) {
+if (frame->side_data[i]->type != AV_FRAME_DATA_FILM_GRAIN_PARAMS)
+continue;
+fgp = (const AVFilmGrainParams*)frame->side_data[i]->data;
+if (fgp->width  && fgp->width  > frame->width ||
+fgp->height && fgp->height > frame->height)
+continue;
+
+#define CHECK(a, b, unspec) \
+do {\
+if ((a) != (unspec) && (b) != (unspec) && (a) != (b))   \
+continue;   \
+} while (0)
+
+CHECK(fgp->bit_depth_luma,   bit_depth_luma, 0);
+CHECK(fgp->bit_depth_chroma, bit_depth_chroma,   0);
+CHECK(fgp->color_range,  frame->color_range, 
AVCOL_RANGE_UNSPECIFIED);
+CHECK(fgp->color_primaries,  frame->color_primaries, 
AVCOL_PRI_UNSPECIFIED);
+CHECK(fgp->color_trc,frame->color_trc,   
AVCOL_TRC_UNSPECIFIED);
+CHECK(fgp->color_space,  frame->colorspace,  
AVCOL_SPC_UNSPECIFIED);
+
+switch (fgp->type) {
+case AV_FILM_GRAIN_PARAMS_NONE:
+continue;
+case AV_FILM_GRAIN_PARAMS_AV1:
+aom = >codec.aom;
+/* AOM FGS needs an exact match for the chroma resolution */
+if (fgp->subsampling_x != desc->log2_chroma_w ||
+fgp->subsampling_y != desc->log2_chroma_h)
+continue;
+break;
+case AV_FILM_GRAIN_PARAMS_H274:
+/* H.274 FGS can be adapted to any lower chroma resolution */
+if (fgp->subsampling_x > desc->log2_chroma_w ||
+fgp->subsampling_y > desc->log2_chroma_h)
+continue;
+break;
+}
+
+if (!best || best->width < fgp->width || best->height < fgp->height)
+best = fgp;
+}
+
+return best;
+}
diff --git a/libavutil/film_grain_params.h b/libavutil/film_grain_params.h
index a9f243351c9..ccacab88fed 100644
--- a/libavutil/film_grain_params.h
+++ b/libavutil/film_grain_params.h
@@ -308,4 +308,15 @@ AVFilmGrainParams *av_film_grain_params_alloc(size_t 
*size);
  */
 AVFilmGrainParams *av_film_grain_params_create_side_data(AVFrame *frame);
 
+/**
+ * Select the most appropriate film grain parameters set for the frame,
+ * taking into account the frame's format, resolution and video signal
+ * characteristics.
+ *
+ * @note, for H.274, this may select a film grain parameter set with
+ * greater chroma resolution than the frame. Users should take care to
+ * correctly adjust the chroma grain frequency to the frame.
+ */
+const AVFilmGrainParams *av_film_grain_params_select(const AVFrame *frame);
+
 #endif /* AVUTIL_FILM_GRAIN_PARAMS_H */
diff --git a/libavutil/version.h b/libavutil/version.h
index 

[FFmpeg-devel] [PATCH v4 13/13] avcodec/hevcdec: apply AOM film grain synthesis

2024-03-18 Thread Niklas Haas
From: Niklas Haas 

Following the usual logic for H.274 film grain.
---
 libavcodec/Makefile  |  2 +-
 libavcodec/hevcdec.c | 29 ++---
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 824845276ae..7ef2e03ca6a 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -432,7 +432,7 @@ OBJS-$(CONFIG_HDR_ENCODER) += hdrenc.o
 OBJS-$(CONFIG_HEVC_DECODER)+= hevcdec.o hevc_mvs.o \
   hevc_cabac.o hevc_refs.o hevcpred.o  
  \
   hevcdsp.o hevc_filter.o hevc_data.o \
-  h274.o
+  h274.o aom_film_grain.o
 OBJS-$(CONFIG_HEVC_AMF_ENCODER)+= amfenc_hevc.o
 OBJS-$(CONFIG_HEVC_CUVID_DECODER)  += cuviddec.o
 OBJS-$(CONFIG_HEVC_MEDIACODEC_DECODER) += mediacodecdec.o
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 76aa6b45882..575836e340c 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -35,6 +35,7 @@
 #include "libavutil/pixdesc.h"
 #include "libavutil/timecode.h"
 
+#include "aom_film_grain.h"
 #include "bswapdsp.h"
 #include "cabac_functions.h"
 #include "codec_internal.h"
@@ -388,7 +389,8 @@ static int export_stream_params_from_sei(HEVCContext *s)
 avctx->color_trc = 
s->sei.common.alternative_transfer.preferred_transfer_characteristics;
 }
 
-if (s->sei.common.film_grain_characteristics.present)
+if (s->sei.common.film_grain_characteristics.present ||
+s->sei.common.aom_film_grain.enable)
 avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
 
 return 0;
@@ -2885,11 +2887,13 @@ static int hevc_frame_start(HEVCContext *s)
 else
 s->ref->frame->flags &= ~AV_FRAME_FLAG_KEY;
 
-s->ref->needs_fg = s->sei.common.film_grain_characteristics.present &&
+s->ref->needs_fg = (s->sei.common.film_grain_characteristics.present ||
+s->sei.common.aom_film_grain.enable) &&
 !(s->avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN) &&
 !s->avctx->hwaccel;
 
 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)) {
 av_log_once(s->avctx, AV_LOG_WARNING, AV_LOG_DEBUG, 
>film_grain_warning_shown,
@@ -2934,14 +2938,24 @@ fail:
 static int hevc_frame_end(HEVCContext *s)
 {
 HEVCFrame *out = s->ref;
-const AVFrameSideData *sd;
+const AVFilmGrainParams *fgp;
 av_unused int ret;
 
 if (out->needs_fg) {
-sd = av_frame_get_side_data(out->frame, 
AV_FRAME_DATA_FILM_GRAIN_PARAMS);
-av_assert0(out->frame_grain->buf[0] && sd);
-ret = ff_h274_apply_film_grain(out->frame_grain, out->frame, 
>h274db,
-   (AVFilmGrainParams *) sd->data);
+av_assert0(out->frame_grain->buf[0]);
+fgp = av_film_grain_params_select(out->frame);
+switch (fgp->type) {
+case AV_FILM_GRAIN_PARAMS_NONE:
+av_assert0(0);
+return AVERROR_BUG;
+case AV_FILM_GRAIN_PARAMS_H274:
+ret = ff_h274_apply_film_grain(out->frame_grain, out->frame,
+   >h274db, fgp);
+break;
+case AV_FILM_GRAIN_PARAMS_AV1:
+ret = ff_aom_apply_film_grain(out->frame_grain, out->frame, fgp);
+break;
+}
 av_assert1(ret >= 0);
 }
 
@@ -3596,6 +3610,7 @@ static int hevc_update_thread_context(AVCodecContext *dst,
 s->sei.common.alternative_transfer = s0->sei.common.alternative_transfer;
 s->sei.common.mastering_display= s0->sei.common.mastering_display;
 s->sei.common.content_light= s0->sei.common.content_light;
+s->sei.common.aom_film_grain   = s0->sei.common.aom_film_grain;
 
 ret = export_stream_params_from_sei(s);
 if (ret < 0)
-- 
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 v4 07/13] avcodec/libdavv1d: signal new AVFilmGrainParams members

2024-03-18 Thread Niklas Haas
From: Niklas Haas 

Not directly signalled by AV1, but we should still set this accordingly
so that users will know what the original intended video characteristics
and chroma resolution were.
---
 libavcodec/libdav1d.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 1aa2d1f3436..361b988825c 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -613,6 +613,8 @@ static int libdav1d_receive_frame(AVCodecContext *c, 
AVFrame *frame)
 if (p->frame_hdr->film_grain.present && (!dav1d->apply_grain ||
 (c->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN))) {
 AVFilmGrainParams *fgp = av_film_grain_params_create_side_data(frame);
+const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(frame->format);
+av_assert0(pixdesc);
 if (!fgp) {
 res = AVERROR(ENOMEM);
 goto fail;
@@ -620,6 +622,14 @@ static int libdav1d_receive_frame(AVCodecContext *c, 
AVFrame *frame)
 
 fgp->type = AV_FILM_GRAIN_PARAMS_AV1;
 fgp->seed = p->frame_hdr->film_grain.data.seed;
+fgp->width = frame->width;
+fgp->height = frame->height;
+fgp->color_range = frame->color_range;
+fgp->color_primaries = frame->color_primaries;
+fgp->color_trc = frame->color_trc;
+fgp->color_space = frame->colorspace;
+fgp->subsampling_x = pixdesc->log2_chroma_w;
+fgp->subsampling_y = pixdesc->log2_chroma_h;
 fgp->codec.aom.num_y_points = 
p->frame_hdr->film_grain.data.num_y_points;
 fgp->codec.aom.chroma_scaling_from_luma = 
p->frame_hdr->film_grain.data.chroma_scaling_from_luma;
 fgp->codec.aom.scaling_shift = 
p->frame_hdr->film_grain.data.scaling_shift;
-- 
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 v4 06/13] avcodec/av1dec: signal new AVFilmGrainParams members

2024-03-18 Thread Niklas Haas
From: Niklas Haas 

Not directly signalled by AV1, but we should still set this accordingly
so that users will know what the original intended video characteristics
and chroma resolution were.
---
 libavcodec/av1dec.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index e6346b51dbe..56e4af278be 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -1072,9 +1072,11 @@ static int export_film_grain(AVCodecContext *avctx, 
AVFrame *frame)
 {
 AV1DecContext *s = avctx->priv_data;
 const AV1RawFilmGrainParams *film_grain = >cur_frame.film_grain;
+const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(frame->format);
 AVFilmGrainParams *fgp;
 AVFilmGrainAOMParams *aom;
 
+av_assert0(pixdesc);
 if (!film_grain->apply_grain)
 return 0;
 
@@ -1084,6 +1086,14 @@ static int export_film_grain(AVCodecContext *avctx, 
AVFrame *frame)
 
 fgp->type = AV_FILM_GRAIN_PARAMS_AV1;
 fgp->seed = film_grain->grain_seed;
+fgp->width = frame->width;
+fgp->height = frame->height;
+fgp->color_range = frame->color_range;
+fgp->color_primaries = frame->color_primaries;
+fgp->color_trc = frame->color_trc;
+fgp->color_space = frame->colorspace;
+fgp->subsampling_x = pixdesc->log2_chroma_w;
+fgp->subsampling_y = pixdesc->log2_chroma_h;
 
 aom = >codec.aom;
 aom->chroma_scaling_from_luma = film_grain->chroma_scaling_from_luma;
-- 
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 14/14] avcodec/vvcdec: inter prediction, support subpicture

2024-03-18 Thread Nuo Mi
passed files:
CodingToolsSets_E_Tencent_1.bit
SUBPIC_A_HUAWEI_3.bit
SUBPIC_B_HUAWEI_3.bit
SUBPIC_C_ERICSSON_1.bit
SUBPIC_D_ERICSSON_1.bit
SUBPIC_E_MediaTek_1.bit

passed dvb conformance files 
(https://dvb.org/specifications/verification-validation/vvc-test-content):
VVC_HDR_UHDTV1_OpenGOP_3840x2160_50fps_HLG10_mosaic.bit
VVC_HDR_UHDTV1_OpenGOP_3840x2160_50fps_HLG10_PiP.bit
---
 libavcodec/vvc/vvc_inter.c | 79 +++---
 1 file changed, 56 insertions(+), 23 deletions(-)

diff --git a/libavcodec/vvc/vvc_inter.c b/libavcodec/vvc/vvc_inter.c
index c5629f7f6f..1a87cb71cf 100644
--- a/libavcodec/vvc/vvc_inter.c
+++ b/libavcodec/vvc/vvc_inter.c
@@ -30,14 +30,34 @@
 #define PROF_TEMP_OFFSET (MAX_PB_SIZE + 32)
 static const int bcw_w_lut[] = {4, 5, 3, 10, -2};
 
-static int emulated_edge(const VVCFrameContext *fc, uint8_t *dst, const 
uint8_t **src, ptrdiff_t *src_stride,
-const int x_off, const int y_off, const int block_w, const int block_h, 
const int is_luma)
+static void subpic_offset(int *x_off, int *y_off,
+const VVCSPS *sps, const VVCPPS *pps, const int subpic_idx, const int 
is_luma)
 {
-const int extra_before = is_luma ? LUMA_EXTRA_BEFORE : CHROMA_EXTRA_BEFORE;
-const int extra_after  = is_luma ? LUMA_EXTRA_AFTER : CHROMA_EXTRA_AFTER;
-const int extra= is_luma ? LUMA_EXTRA : CHROMA_EXTRA;
-const int pic_width= is_luma ? fc->ps.pps->width  : (fc->ps.pps->width 
>> fc->ps.sps->hshift[1]);
-const int pic_height   = is_luma ? fc->ps.pps->height : 
(fc->ps.pps->height >> fc->ps.sps->vshift[1]);
+*x_off -= pps->subpic_x[subpic_idx] >> sps->hshift[!is_luma];
+*y_off -= pps->subpic_y[subpic_idx] >> sps->vshift[!is_luma];
+}
+
+static void subpic_width_height(int *pic_width, int *pic_height,
+const VVCSPS *sps, const VVCPPS *pps, const int subpic_idx, const int 
is_luma)
+{
+*pic_width  = pps->subpic_width[subpic_idx]  >> sps->hshift[!is_luma];
+*pic_height = pps->subpic_height[subpic_idx] >> sps->vshift[!is_luma];
+}
+
+static int emulated_edge(const VVCLocalContext *lc, uint8_t *dst, const 
uint8_t **src, ptrdiff_t *src_stride,
+int x_off, int y_off, const int block_w, const int block_h, const int 
is_luma)
+{
+const VVCFrameContext *fc = lc->fc;
+const VVCSPS *sps = fc->ps.sps;
+const VVCPPS *pps = fc->ps.pps;
+const int subpic_idx  = lc->sc->sh.r->curr_subpic_idx;
+const int extra_before= is_luma ? LUMA_EXTRA_BEFORE : 
CHROMA_EXTRA_BEFORE;
+const int extra_after = is_luma ? LUMA_EXTRA_AFTER : 
CHROMA_EXTRA_AFTER;
+const int extra   = is_luma ? LUMA_EXTRA : CHROMA_EXTRA;
+int pic_width, pic_height;
+
+subpic_offset(_off, _off, sps, pps, subpic_idx, is_luma);
+subpic_width_height(_width, _height, sps, pps, subpic_idx, 
is_luma);
 
 if (x_off < extra_before || y_off < extra_before ||
 x_off >= pic_width - block_w - extra_after ||
@@ -57,14 +77,21 @@ static int emulated_edge(const VVCFrameContext *fc, uint8_t 
*dst, const uint8_t
 return 0;
 }
 
-static void emulated_edge_dmvr(const VVCFrameContext *fc, uint8_t *dst, const 
uint8_t **src, ptrdiff_t *src_stride,
-const int x_sb, const int y_sb, const int x_off, const int y_off, const 
int block_w, const int block_h, const int is_luma)
+static void emulated_edge_dmvr(const VVCLocalContext *lc, uint8_t *dst, const 
uint8_t **src, ptrdiff_t *src_stride,
+int x_sb, int y_sb, int x_off,  int y_off, const int block_w, const int 
block_h, const int is_luma)
 {
-const int extra_before = is_luma ? LUMA_EXTRA_BEFORE : CHROMA_EXTRA_BEFORE;
-const int extra_after  = is_luma ? LUMA_EXTRA_AFTER : CHROMA_EXTRA_AFTER;
-const int extra= is_luma ? LUMA_EXTRA : CHROMA_EXTRA;
-const int pic_width= is_luma ? fc->ps.pps->width  : (fc->ps.pps->width 
>> fc->ps.sps->hshift[1]);
-const int pic_height   = is_luma ? fc->ps.pps->height : 
(fc->ps.pps->height >> fc->ps.sps->vshift[1]);
+const VVCFrameContext *fc = lc->fc;
+const VVCSPS *sps = fc->ps.sps;
+const VVCPPS *pps = fc->ps.pps;
+const int subpic_idx  = lc->sc->sh.r->curr_subpic_idx;
+const int extra_before= is_luma ? LUMA_EXTRA_BEFORE : 
CHROMA_EXTRA_BEFORE;
+const int extra_after = is_luma ? LUMA_EXTRA_AFTER : 
CHROMA_EXTRA_AFTER;
+const int extra   = is_luma ? LUMA_EXTRA : CHROMA_EXTRA;
+int pic_width, pic_height;
+
+subpic_offset(_off, _off, sps, pps, subpic_idx, is_luma);
+subpic_offset(_sb, _sb, sps, pps, subpic_idx, is_luma);
+subpic_width_height(_width, _height, sps, pps, subpic_idx, 
is_luma);
 
 if (x_off < extra_before || y_off < extra_before ||
 x_off >= pic_width - block_w - extra_after ||
@@ -88,11 +115,17 @@ static void emulated_edge_dmvr(const VVCFrameContext *fc, 
uint8_t *dst, const ui
}
 }
 
-static void emulated_edge_bilinear(const VVCFrameContext *fc, uint8_t *dst, 

[FFmpeg-devel] [PATCH 05/14] avcodec/vvcdec: ff_vvc_decode_neighbour, support subpicture

2024-03-18 Thread Nuo Mi
---
 libavcodec/vvc/vvc_ctu.c | 4 
 libavcodec/vvc/vvc_ctu.h | 6 --
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vvc/vvc_ctu.c b/libavcodec/vvc/vvc_ctu.c
index 75b9e73ae3..75d9f07143 100644
--- a/libavcodec/vvc/vvc_ctu.c
+++ b/libavcodec/vvc/vvc_ctu.c
@@ -2493,6 +2493,10 @@ void ff_vvc_decode_neighbour(VVCLocalContext *lc, const 
int x_ctb, const int y_c
 lc->boundary_flags |= BOUNDARY_UPPER_TILE;
 if (ry > 0 && fc->tab.slice_idx[rs] != fc->tab.slice_idx[rs - 
fc->ps.pps->ctb_width])
 lc->boundary_flags |= BOUNDARY_UPPER_SLICE;
+if 
(fc->ps.sps->r->sps_subpic_ctu_top_left_x[lc->sc->sh.r->curr_subpic_idx] == rx)
+lc->boundary_flags |= BOUNDARY_LEFT_SUBPIC;
+if 
(fc->ps.sps->r->sps_subpic_ctu_top_left_y[lc->sc->sh.r->curr_subpic_idx] == ry)
+lc->boundary_flags |= BOUNDARY_UPPER_SUBPIC;
 lc->ctb_left_flag = rx > 0 && !(lc->boundary_flags & BOUNDARY_LEFT_TILE);
 lc->ctb_up_flag   = ry > 0 && !(lc->boundary_flags & BOUNDARY_UPPER_TILE) 
&& !(lc->boundary_flags & BOUNDARY_UPPER_SLICE);
 lc->ctb_up_right_flag = lc->ctb_up_flag && (fc->ps.pps->ctb_to_col_bd[rx] 
== fc->ps.pps->ctb_to_col_bd[rx + 1]) &&
diff --git a/libavcodec/vvc/vvc_ctu.h b/libavcodec/vvc/vvc_ctu.h
index 8020e184c5..460dbdba59 100644
--- a/libavcodec/vvc/vvc_ctu.h
+++ b/libavcodec/vvc/vvc_ctu.h
@@ -421,8 +421,10 @@ typedef struct VVCLocalContext {
 
 #define BOUNDARY_LEFT_SLICE (1 << 0)
 #define BOUNDARY_LEFT_TILE  (1 << 1)
-#define BOUNDARY_UPPER_SLICE(1 << 2)
-#define BOUNDARY_UPPER_TILE (1 << 3)
+#define BOUNDARY_LEFT_SUBPIC(1 << 2)
+#define BOUNDARY_UPPER_SLICE(1 << 3)
+#define BOUNDARY_UPPER_TILE (1 << 4)
+#define BOUNDARY_UPPER_SUBPIC   (1 << 5)
 /* properties of the boundary of the current CTB for the purposes
  * of the deblocking filter */
 int boundary_flags;
-- 
2.25.1

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

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


[FFmpeg-devel] [PATCH 08/14] avcodec/vvcdec: deblock, support subpicture

2024-03-18 Thread Nuo Mi
---
 libavcodec/vvc/vvc_filter.c | 52 +
 libavcodec/vvc/vvc_filter.h |  6 +++--
 libavcodec/vvc/vvc_thread.c |  4 +--
 3 files changed, 35 insertions(+), 27 deletions(-)

diff --git a/libavcodec/vvc/vvc_filter.c b/libavcodec/vvc/vvc_filter.c
index 11972bde41..ecb004d245 100644
--- a/libavcodec/vvc/vvc_filter.c
+++ b/libavcodec/vvc/vvc_filter.c
@@ -529,9 +529,10 @@ static av_always_inline int deblock_bs(const 
VVCLocalContext *lc,
 }
 
 static int deblock_is_boundary(const VVCLocalContext *lc, const int boundary,
-const int pos, const int vertical)
+const int pos, const int rs, const int vertical)
 {
 const VVCFrameContext *fc = lc->fc;
+const H266RawSPS *rsps= fc->ps.sps->r;
 const H266RawPPS *rpps= fc->ps.pps->r;
 int flag;
 if (boundary && (pos % fc->ps.sps->ctb_size_y) == 0) {
@@ -544,12 +545,22 @@ static int deblock_is_boundary(const VVCLocalContext *lc, 
const int boundary,
 if (lc->boundary_flags & flag &&
 !rpps->pps_loop_filter_across_tiles_enabled_flag)
 return 0;
+
+flag = vertical ? BOUNDARY_LEFT_SUBPIC : BOUNDARY_UPPER_SUBPIC;
+if (lc->boundary_flags & flag) {
+const int q_rs  = rs - (vertical ? 1 : 
fc->ps.pps->ctb_width);
+const SliceContext *q_slice = 
lc->fc->slices[lc->fc->tab.slice_idx[q_rs]];
+
+if 
(!rsps->sps_loop_filter_across_subpic_enabled_flag[q_slice->sh.r->curr_subpic_idx]
 ||
+
!rsps->sps_loop_filter_across_subpic_enabled_flag[lc->sc->sh.r->curr_subpic_idx])
+return 0;
+}
 }
 return boundary;
 }
 
 static void vvc_deblock_bs_luma_vertical(const VVCLocalContext *lc,
-const int x0, const int y0, const int width, const int height)
+const int x0, const int y0, const int width, const int height, const int 
rs)
 {
 const VVCFrameContext *fc  = lc->fc;
 const MvField *tab_mvf = fc->tab.mvf;
@@ -574,7 +585,7 @@ static void vvc_deblock_bs_luma_vertical(const 
VVCLocalContext *lc,
 }
 
 // bs for vertical TU boundaries
-boundary_left = deblock_is_boundary(lc, x0 > 0 && !(x0 & 3), x0, 1);
+boundary_left = deblock_is_boundary(lc, x0 > 0 && !(x0 & 3), x0, rs, 1);
 
 if (boundary_left) {
 const RefPicList *rpl_left =
@@ -598,7 +609,7 @@ static void vvc_deblock_bs_luma_vertical(const 
VVCLocalContext *lc,
 }
 
 static void vvc_deblock_bs_luma_horizontal(const VVCLocalContext *lc,
-const int x0, const int y0, const int width, const int height)
+const int x0, const int y0, const int width, const int height, const int 
rs)
 {
 const VVCFrameContext *fc  = lc->fc;
 const MvField *tab_mvf = fc->tab.mvf;
@@ -622,7 +633,7 @@ static void vvc_deblock_bs_luma_horizontal(const 
VVCLocalContext *lc,
 has_horizontal_sb = cb_height > 8;
 }
 
-boundary_upper = deblock_is_boundary(lc, y0 > 0 && !(y0 & 3), y0, 0);
+boundary_upper = deblock_is_boundary(lc, y0 > 0 && !(y0 & 3), y0, rs, 0);
 
 if (boundary_upper) {
 const RefPicList *rpl_top =
@@ -647,12 +658,11 @@ static void vvc_deblock_bs_luma_horizontal(const 
VVCLocalContext *lc,
 }
 
 static void vvc_deblock_bs_chroma_vertical(const VVCLocalContext *lc,
-const int x0, const int y0, const int width, const int height)
+const int x0, const int y0, const int width, const int height, const int 
rs)
 {
 const VVCFrameContext *fc = lc->fc;
-// bs for vertical TU boundaries
 const int boundary_left = deblock_is_boundary(lc,
- x0 > 0 && !(x0 & ((CHROMA_GRID << fc->ps.sps->hshift[CHROMA]) - 1)), 
x0, 1);
+ x0 > 0 && !(x0 & ((CHROMA_GRID << fc->ps.sps->hshift[CHROMA]) - 1)), 
x0, rs, 1);
 
 if (boundary_left) {
 for (int i = 0; i < height; i += 2) {
@@ -666,11 +676,11 @@ static void vvc_deblock_bs_chroma_vertical(const 
VVCLocalContext *lc,
 }
 
 static void vvc_deblock_bs_chroma_horizontal(const VVCLocalContext *lc,
-const int x0, const int y0, const int width, const int height)
+const int x0, const int y0, const int width, const int height, const int 
rs)
 {
 const VVCFrameContext *fc = lc->fc;
 const int boundary_upper  = deblock_is_boundary(lc,
-y0 > 0 && !(y0 & ((CHROMA_GRID << fc->ps.sps->vshift[CHROMA]) - 1)), 
y0, 0);
+y0 > 0 && !(y0 & ((CHROMA_GRID << fc->ps.sps->vshift[CHROMA]) - 1)), 
y0, rs, 0);
 
 if (boundary_upper) {
 for (int i = 0; i < width; i += 2) {
@@ -684,9 +694,9 @@ static void vvc_deblock_bs_chroma_horizontal(const 
VVCLocalContext *lc,
 }
 
 typedef void (*deblock_bs_fn)(const VVCLocalContext *lc, const int x0, const 
int y0,
-const int width, const int height);
+const int width, const int height, const int rs);
 
-static void vvc_deblock_bs(const VVCLocalContext *lc, const int x0, const int 
y0, const int vertical)
+static void vvc_deblock_bs(const VVCLocalContext *lc, const int x0, const int 
y0, const int rs, const int 

[FFmpeg-devel] [PATCH 03/14] avcodec/vvcdec: support rectangular single-slice subpics

2024-03-18 Thread Nuo Mi
From: Frank Plowman 

Co-authored-by: Nuo Mi 
---
 libavcodec/cbs_h266_syntax_template.c |  5 +-
 libavcodec/vvc/vvc_ps.c   | 93 +--
 2 files changed, 91 insertions(+), 7 deletions(-)

diff --git a/libavcodec/cbs_h266_syntax_template.c 
b/libavcodec/cbs_h266_syntax_template.c
index 15368502d7..9fa7e0eec8 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -2118,9 +2118,12 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, 
RWContext *rw,
 } else {
 if (current->pps_no_pic_partition_flag)
 infer(pps_num_slices_in_pic_minus1, 0);
-else if (current->pps_single_slice_per_subpic_flag)
+else if (current->pps_single_slice_per_subpic_flag) {
+for (i = 0; i <= sps->sps_num_subpics_minus1; i++)
+current->num_slices_in_subpic[i] = 1;
 infer(pps_num_slices_in_pic_minus1,
   sps->sps_num_subpics_minus1);
+}
 // else?
 }
 if (!current->pps_rect_slice_flag ||
diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c
index 7972803da6..bb13b04a5d 100644
--- a/libavcodec/vvc/vvc_ps.c
+++ b/libavcodec/vvc/vvc_ps.c
@@ -343,6 +343,83 @@ static int pps_add_ctus(VVCPPS *pps, int *off, const int 
ctu_x, const int ctu_y,
 return *off - start;
 }
 
+static void pps_single_slice_picture(VVCPPS *pps, int *off)
+{
+for (int j = 0; j < pps->r->num_tile_rows; j++) {
+for (int i = 0; i < pps->r->num_tile_columns; i++) {
+pps->num_ctus_in_slice[0] = pps_add_ctus(pps, off,
+pps->col_bd[i], pps->row_bd[j],
+pps->r->col_width_val[i], pps->r->row_height_val[j]);
+}
+}
+}
+
+static void subpic_tiles(int *tile_x, int *tile_y, int *tile_x_end, int 
*tile_y_end,
+const VVCSPS *sps, const VVCPPS *pps,  const int i)
+{
+const int rx = sps->r->sps_subpic_ctu_top_left_x[i];
+const int ry = sps->r->sps_subpic_ctu_top_left_y[i];
+
+*tile_x = *tile_y = 0;
+
+while (pps->col_bd[*tile_x] != rx)
+(*tile_x)++;
+
+while (pps->row_bd[*tile_y] != ry)
+(*tile_y)++;
+
+*tile_x_end = (*tile_x);
+*tile_y_end = (*tile_y);
+
+while (pps->col_bd[*tile_x_end] < rx + sps->r->sps_subpic_width_minus1[i] 
+ 1)
+(*tile_x_end)++;
+
+while (pps->row_bd[*tile_y_end] < ry + sps->r->sps_subpic_height_minus1[i] 
+ 1)
+(*tile_y_end)++;
+}
+
+static void pps_subpic_less_than_one_tile_slice(VVCPPS *pps, const VVCSPS 
*sps, const int i, const int tx, const int ty, int *off)
+{
+pps->num_ctus_in_slice[i] = pps_add_ctus(pps, off,
+pps->col_bd[tx], pps->row_bd[ty],
+pps->r->col_width_val[tx], sps->r->sps_subpic_height_minus1[i] + 1);
+}
+
+static void pps_subpic_multi_tiles_slice(VVCPPS *pps, const int tile_x, const 
int tile_y, const int x_end, const int y_end, const int i, int *off)
+{
+for (int ty = tile_y; ty < y_end; ty++) {
+for (int tx = tile_x; tx < x_end; tx++) {
+pps->num_ctus_in_slice[i] += pps_add_ctus(pps, off,
+pps->col_bd[tx], pps->row_bd[ty],
+pps->r->col_width_val[tx], pps->r->row_height_val[ty]);
+}
+}
+}
+
+static void pps_subpic_slice(VVCPPS *pps, const VVCSPS *sps, const int i, int 
*off)
+{
+int tx, ty, x_end, y_end;
+
+pps->slice_start_offset[i] = *off;
+pps->num_ctus_in_slice[i] = 0;
+
+subpic_tiles(, , _end, _end, sps, pps, i);
+if (ty + 1 == y_end && sps->r->sps_subpic_height_minus1[i] + 1 < 
pps->r->row_height_val[ty])
+pps_subpic_less_than_one_tile_slice(pps, sps, i, tx, ty, off);
+else
+pps_subpic_multi_tiles_slice(pps, tx, ty, x_end, y_end, i, off);
+}
+
+static void pps_single_slice_per_subpic(VVCPPS *pps, const VVCSPS *sps, int 
*off)
+{
+if (!sps->r->sps_subpic_info_present_flag) {
+pps_single_slice_picture(pps, off);
+} else {
+for (int i = 0; i < pps->r->pps_num_slices_in_pic_minus1 + 1; i++)
+pps_subpic_slice(pps, sps, i, off);
+}
+}
+
 static int pps_one_tile_slices(VVCPPS *pps, const int tile_idx, int i, int 
*off)
 {
 const H266RawPPS *r = pps->r;
@@ -378,18 +455,22 @@ static void pps_multi_tiles_slice(VVCPPS *pps, const int 
tile_idx, const int i,
 }
 }
 
-static void pps_rect_slice(VVCPPS* pps)
+static void pps_rect_slice(VVCPPS *pps, const VVCSPS *sps)
 {
-const H266RawPPS* r = pps->r;
+const H266RawPPS *r = pps->r;
 int tile_idx = 0, off = 0;
 
+if (r->pps_single_slice_per_subpic_flag) {
+pps_single_slice_per_subpic(pps, sps, );
+return;
+}
+
 for (int i = 0; i < r->pps_num_slices_in_pic_minus1 + 1; i++) {
 if (!r->pps_slice_width_in_tiles_minus1[i] &&
 !r->pps_slice_height_in_tiles_minus1[i]) {
 i = pps_one_tile_slices(pps, tile_idx, i, );
 } else {
 pps_multi_tiles_slice(pps, 

[FFmpeg-devel] [PATCH 01/14] avcodec/vvcdec: NoBackwardPredFlag, only check active pictures

2024-03-18 Thread Nuo Mi
see "8.3.6 Decoding process for collocated picture and no backward prediction"
---
 libavcodec/vvc/vvc_mvs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vvc/vvc_mvs.c b/libavcodec/vvc/vvc_mvs.c
index 6398fd3571..cf92202b5b 100644
--- a/libavcodec/vvc/vvc_mvs.c
+++ b/libavcodec/vvc/vvc_mvs.c
@@ -125,7 +125,7 @@ int ff_vvc_no_backward_pred_flag(const VVCLocalContext *lc)
 const RefPicList *rpl = lc->sc->rpl;
 
 for (j = 0; j < 2; j++) {
-for (i = 0; i < rpl[j].nb_refs; i++) {
+for (i = 0; i < lc->sc->sh.r->num_ref_idx_active[j]; i++) {
 if (rpl[j].list[i] > lc->fc->ps.ph.poc) {
 check_diffpicount++;
 break;
-- 
2.25.1

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

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


[FFmpeg-devel] [PATCH 04/14] avcodec/vvcdec: derive subpic postion for PPS

2024-03-18 Thread Nuo Mi
---
 libavcodec/vvc/vvc_ps.c | 19 +++
 libavcodec/vvc/vvc_ps.h |  4 
 2 files changed, 23 insertions(+)

diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c
index bb13b04a5d..bbd666307f 100644
--- a/libavcodec/vvc/vvc_ps.c
+++ b/libavcodec/vvc/vvc_ps.c
@@ -511,6 +511,24 @@ static void pps_ref_wraparound_offset(VVCPPS *pps, const 
VVCSPS *sps)
 pps->ref_wraparound_offset = (pps->width / sps->min_cb_size_y) - 
r->pps_pic_width_minus_wraparound_offset;
 }
 
+static void pps_subpic(VVCPPS *pps, const VVCSPS *sps)
+{
+const H266RawSPS *rsps = sps->r;
+for (int i = 0; i < rsps->sps_num_subpics_minus1 + 1; i++) {
+if (rsps->sps_subpic_treated_as_pic_flag[i]) {
+pps->subpic_x[i]  = rsps->sps_subpic_ctu_top_left_x[i] << 
sps->ctb_log2_size_y;
+pps->subpic_y[i]  = rsps->sps_subpic_ctu_top_left_y[i] << 
sps->ctb_log2_size_y;
+pps->subpic_width[i]  = FFMIN(pps->width  - pps->subpic_x[i], 
(rsps->sps_subpic_width_minus1[i]  + 1) << sps->ctb_log2_size_y);
+pps->subpic_height[i] = FFMIN(pps->height - pps->subpic_y[i], 
(rsps->sps_subpic_height_minus1[i] + 1) << sps->ctb_log2_size_y);
+} else {
+pps->subpic_x[i]  = 0;
+pps->subpic_y[i]  = 0;
+pps->subpic_width[i]  = pps->width;
+pps->subpic_height[i] = pps->height;
+}
+}
+}
+
 static int pps_derive(VVCPPS *pps, const VVCSPS *sps)
 {
 int ret;
@@ -527,6 +545,7 @@ static int pps_derive(VVCPPS *pps, const VVCSPS *sps)
 return ret;
 
 pps_ref_wraparound_offset(pps, sps);
+pps_subpic(pps, sps);
 
 return 0;
 }
diff --git a/libavcodec/vvc/vvc_ps.h b/libavcodec/vvc/vvc_ps.h
index 1164d0eab6..35b46e234b 100644
--- a/libavcodec/vvc/vvc_ps.h
+++ b/libavcodec/vvc/vvc_ps.h
@@ -127,6 +127,10 @@ typedef struct VVCPPS {
 
 uint16_t ref_wraparound_offset; ///< PpsRefWraparoundOffset
 
+uint16_t subpic_x[VVC_MAX_SLICES];  ///< SubpicLeftBoundaryPos
+uint16_t subpic_y[VVC_MAX_SLICES];  ///< SubpicTopBoundaryPos
+uint16_t subpic_width[VVC_MAX_SLICES];
+uint16_t subpic_height[VVC_MAX_SLICES];
 } VVCPPS;
 
 #define MAX_WEIGHTS 15
-- 
2.25.1

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

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


[FFmpeg-devel] [PATCH 07/14] avcodec/vvcdec: refact out deblock_is_boundary

2024-03-18 Thread Nuo Mi
---
 libavcodec/vvc/vvc_filter.c | 66 +++--
 1 file changed, 26 insertions(+), 40 deletions(-)

diff --git a/libavcodec/vvc/vvc_filter.c b/libavcodec/vvc/vvc_filter.c
index 10bd57e078..11972bde41 100644
--- a/libavcodec/vvc/vvc_filter.c
+++ b/libavcodec/vvc/vvc_filter.c
@@ -528,6 +528,26 @@ static av_always_inline int deblock_bs(const 
VVCLocalContext *lc,
 return boundary_strength(lc, mvf_q, mvf_p, rpl_p);
 }
 
+static int deblock_is_boundary(const VVCLocalContext *lc, const int boundary,
+const int pos, const int vertical)
+{
+const VVCFrameContext *fc = lc->fc;
+const H266RawPPS *rpps= fc->ps.pps->r;
+int flag;
+if (boundary && (pos % fc->ps.sps->ctb_size_y) == 0) {
+flag = vertical ? BOUNDARY_LEFT_SLICE : BOUNDARY_UPPER_SLICE;
+if (lc->boundary_flags & flag &&
+!rpps->pps_loop_filter_across_slices_enabled_flag)
+return 0;
+
+flag = vertical ? BOUNDARY_LEFT_TILE : BOUNDARY_UPPER_TILE;
+if (lc->boundary_flags & flag &&
+!rpps->pps_loop_filter_across_tiles_enabled_flag)
+return 0;
+}
+return boundary;
+}
+
 static void vvc_deblock_bs_luma_vertical(const VVCLocalContext *lc,
 const int x0, const int y0, const int width, const int height)
 {
@@ -554,15 +574,7 @@ static void vvc_deblock_bs_luma_vertical(const 
VVCLocalContext *lc,
 }
 
 // bs for vertical TU boundaries
-boundary_left = x0 > 0 && !(x0 & 3);
-if (boundary_left &&
-((!fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag &&
-lc->boundary_flags & BOUNDARY_LEFT_SLICE &&
-(x0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0) ||
-(!fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag &&
-lc->boundary_flags & BOUNDARY_LEFT_TILE &&
-(x0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0)))
-boundary_left = 0;
+boundary_left = deblock_is_boundary(lc, x0 > 0 && !(x0 & 3), x0, 1);
 
 if (boundary_left) {
 const RefPicList *rpl_left =
@@ -610,15 +622,7 @@ static void vvc_deblock_bs_luma_horizontal(const 
VVCLocalContext *lc,
 has_horizontal_sb = cb_height > 8;
 }
 
-boundary_upper = y0 > 0 && !(y0 & 3);
-if (boundary_upper &&
-((!fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag &&
-lc->boundary_flags & BOUNDARY_UPPER_SLICE &&
-(y0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0) ||
-(!fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag &&
-lc->boundary_flags & BOUNDARY_UPPER_TILE &&
-(y0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0)))
-boundary_upper = 0;
+boundary_upper = deblock_is_boundary(lc, y0 > 0 && !(y0 & 3), y0, 0);
 
 if (boundary_upper) {
 const RefPicList *rpl_top =
@@ -646,18 +650,9 @@ static void vvc_deblock_bs_chroma_vertical(const 
VVCLocalContext *lc,
 const int x0, const int y0, const int width, const int height)
 {
 const VVCFrameContext *fc = lc->fc;
-int boundary_left;
-
 // bs for vertical TU boundaries
-boundary_left = x0 > 0 && !(x0 & ((CHROMA_GRID << fc->ps.sps->hshift[1]) - 
1));
-if (boundary_left &&
-((!fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag &&
-  lc->boundary_flags & BOUNDARY_LEFT_SLICE &&
-  (x0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0) ||
- (!fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag &&
-  lc->boundary_flags & BOUNDARY_LEFT_TILE &&
-  (x0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0)))
-boundary_left = 0;
+const int boundary_left = deblock_is_boundary(lc,
+ x0 > 0 && !(x0 & ((CHROMA_GRID << fc->ps.sps->hshift[CHROMA]) - 1)), 
x0, 1);
 
 if (boundary_left) {
 for (int i = 0; i < height; i += 2) {
@@ -674,17 +669,8 @@ static void vvc_deblock_bs_chroma_horizontal(const 
VVCLocalContext *lc,
 const int x0, const int y0, const int width, const int height)
 {
 const VVCFrameContext *fc = lc->fc;
-int boundary_upper;
-
-boundary_upper = y0 > 0 && !(y0 & ((CHROMA_GRID << fc->ps.sps->vshift[1]) 
- 1));
-if (boundary_upper &&
-((!fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag &&
-lc->boundary_flags & BOUNDARY_UPPER_SLICE &&
-(y0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0) ||
-(!fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag &&
-lc->boundary_flags & BOUNDARY_UPPER_TILE &&
-(y0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0)))
-boundary_upper = 0;
+const int boundary_upper  = deblock_is_boundary(lc,
+y0 > 0 && !(y0 & ((CHROMA_GRID << fc->ps.sps->vshift[CHROMA]) - 1)), 
y0, 0);
 
 if (boundary_upper) {
 for (int i = 0; i < width; i += 2) {
-- 
2.25.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org

Re: [FFmpeg-devel] Fixes #10509

2024-03-18 Thread Poorva
>

On Sun, Mar 17, 2024 at 12:26 AM Marton Balint  wrote:
>
>
>
> On Sun, 17 Mar 2024, Poorva wrote:
>
> > On Mon, Mar 11, 2024 at 1:10 AM Leo Izen  wrote:
> >>
> >> On 3/9/24 15:49, Poorva wrote:
> >>> I have attached the git patch containing the changes for your review.
> >>>
> >>> This patch is submitted as part of my qualification task for Google Summer
> >>> of Code (GSoC)
> >>>
> >>
> >> Your editor appears to have stripped the newline at the end of the file.
>
> > diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
> > index 9b330a0673..965f5a0b54 100644
> > --- a/libavfilter/f_select.c
> > +++ b/libavfilter/f_select.c
> > @@ -90,6 +90,9 @@ static const char *const var_names[] = {
> >
> >  "concatdec_select",  ///< frame is within the interval set by the 
> > concat demuxer
> >
> > +"ih",///< ih: Represents the height of the input video 
> > frame.
> > +"iw",///< iw: Represents the width of the input video 
> > frame.
> > +
> >  NULL
> >  };
> >
> > @@ -144,6 +147,9 @@ enum var_name {
> >
> >  VAR_CONCATDEC_SELECT,
> >
> > +VAR_IH,
> > +VAR_IW,
> > +
> >  VAR_VARS_NB
> >  };
> >
> > @@ -264,6 +270,9 @@ static int config_input(AVFilterLink *inlink)
> >  select->var_values[VAR_CONSUMED_SAMPLES_N] = NAN;
> >  select->var_values[VAR_SAMPLES_N]  = NAN;
> >
> > +select->var_values[VAR_IH] = inlink->h;
> > +select->var_values[VAR_IW] = inlink->w;
>
> Initial valaues should be NAN. This may well be an audio filter, when
> ih/iw is not available.
>
> > +
> >  select->var_values[VAR_SAMPLE_RATE] =
> >  inlink->type == AVMEDIA_TYPE_AUDIO ? inlink->sample_rate : NAN;
> >
> > @@ -371,6 +380,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
> >  break;
> >  }
> >
> > +select->var_values[VAR_IH] = frame->height;
> > +select->var_values[VAR_IW] = frame->width;
>
> You shold only set these for the VIDEO case.
>
> > +
> >  select->select = res = av_expr_eval(select->expr, select->var_values, 
> > NULL);
> >  av_log(inlink->dst, AV_LOG_DEBUG,
> > "n:%f pts:%f t:%f key:%d",
> > @@ -546,3 +558,4 @@ const AVFilter ff_vf_select = {
> >  .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS | 
> > AVFILTER_FLAG_METADATA_ONLY,
> >  };
> >  #endif /* CONFIG_SELECT_FILTER */
> > +
>
> Extra added line.
>
> > --
> > 2.43.0.windows.1
>
> Documentation update missing.
Sir, I have made the changes as per your suggestions:

1)Initial values are now set to NaN.
2)Values are only set for the VIDEO case.
3)Documentation has been updated to reflect these changes accurately.
I have attached the patch with the updated code for your review.

> 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".


v2-0001-avfilter-f_select.c-add-support-for-iw-and-ih-con.patch
Description: Binary data
___
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 02/14] avcodec/cbs_h266: fix sh_collocated_from_l0_flag and sh_collocated_ref_idx infer

2024-03-18 Thread Nuo Mi
we have to infer sh_collocated_from_l0_flag and sh_collocated_ref_idx from 
picture head if pps_rpl_info_in_ph_flag is true
---
 libavcodec/cbs_h266_syntax_template.c | 32 +--
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/libavcodec/cbs_h266_syntax_template.c 
b/libavcodec/cbs_h266_syntax_template.c
index 49fb12ba77..15368502d7 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -3219,19 +3219,27 @@ static int FUNC(slice_header) (CodedBitstreamContext 
*ctx, RWContext *rw,
 flag(sh_cabac_init_flag);
 else
 infer(sh_cabac_init_flag, 0);
-if (ph->ph_temporal_mvp_enabled_flag && !pps->pps_rpl_info_in_ph_flag) 
{
-if (current->sh_slice_type == VVC_SLICE_TYPE_B)
-flag(sh_collocated_from_l0_flag);
-else
-infer(sh_collocated_from_l0_flag, 1);
-if ((current->sh_collocated_from_l0_flag &&
- current->num_ref_idx_active[0] > 1) ||
-(!current->sh_collocated_from_l0_flag &&
- current->num_ref_idx_active[1] > 1)) {
-unsigned int idx = current->sh_collocated_from_l0_flag ? 0 : 1;
-ue(sh_collocated_ref_idx, 0, current->num_ref_idx_active[idx] 
- 1);
+if (ph->ph_temporal_mvp_enabled_flag) {
+if (!pps->pps_rpl_info_in_ph_flag) {
+if (current->sh_slice_type == VVC_SLICE_TYPE_B)
+flag(sh_collocated_from_l0_flag);
+else
+infer(sh_collocated_from_l0_flag, 1);
+if ((current->sh_collocated_from_l0_flag &&
+current->num_ref_idx_active[0] > 1) ||
+(!current->sh_collocated_from_l0_flag &&
+current->num_ref_idx_active[1] > 1)) {
+unsigned int idx = current->sh_collocated_from_l0_flag ? 0 
: 1;
+ue(sh_collocated_ref_idx, 0, 
current->num_ref_idx_active[idx] - 1);
+} else {
+infer(sh_collocated_ref_idx, 0);
+}
 } else {
-infer(sh_collocated_ref_idx, 0);
+if (current->sh_slice_type == VVC_SLICE_TYPE_B)
+infer(sh_collocated_from_l0_flag, 
ph->ph_collocated_from_l0_flag);
+else
+infer(sh_collocated_from_l0_flag, 1);
+infer(sh_collocated_ref_idx, ph->ph_collocated_ref_idx);
 }
 }
 if (!pps->pps_wp_info_in_ph_flag &&
-- 
2.25.1

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

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


[FFmpeg-devel] [PATCH 00/14] avcodec/vvcdec: support subpicture

2024-03-18 Thread Nuo Mi
see introductions here: https://dashif.org/docs/VVC%20HLS%20overview%20.pdf

Frank Plowman (1):
  avcodec/vvcdec: support rectangular single-slice subpics

Nuo Mi (13):
  avcodec/vvcdec: NoBackwardPredFlag, only check active pictures
  avcodec/cbs_h266: fix sh_collocated_from_l0_flag and
sh_collocated_ref_idx infer
  avcodec/vvcdec: derive subpic postion for PPS
  avcodec/vvcdec: ff_vvc_decode_neighbour, support subpicture
  avcodec/vvcdec: misc, rename x_ctb, y_ctb, ctu_x, ctu_y to rx, ry to
avoid misleading
  avcodec/vvcdec: refact out deblock_is_boundary
  avcodec/vvcdec: deblock, support subpicture
  avcodec/vvcdec: refact, movie the lc->sc assignment to task_run_stage
to simplify the code
  avcodec/vvcdec: sao, refact out tile_edge arrays
  avcodec/vvcdec: sao, support subpicture
  avcodec/vvcdec: alf, support subpicture
  avcodec/vvcdec: mvs, support subpicture
  avcodec/vvcdec: inter prediction, support subpicture

 libavcodec/cbs_h266_syntax_template.c |  37 ++--
 libavcodec/vvc/vvc_ctu.c  |  12 +-
 libavcodec/vvc/vvc_ctu.h  |   6 +-
 libavcodec/vvc/vvc_filter.c   | 233 +-
 libavcodec/vvc/vvc_filter.h   |   6 +-
 libavcodec/vvc/vvc_inter.c|  79 ++---
 libavcodec/vvc/vvc_mvs.c  |  35 ++--
 libavcodec/vvc/vvc_ps.c   | 150 ++---
 libavcodec/vvc/vvc_ps.h   |   4 +
 libavcodec/vvc/vvc_thread.c   |  66 ++--
 10 files changed, 384 insertions(+), 244 deletions(-)

--
2.25.1

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

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


[FFmpeg-devel] [PATCH v4 00/13] AFGS1 film grain support

2024-03-18 Thread Niklas Haas
Changes since v3:

- Moved metadata into common AVFilmGrainParams struct, as per James
  Almer's recommendation
- Fixed width/height field validation
- Signal this metadata for AV1 (instead of setting it to unspecified)
- Implement ffprobe/showinfo support for the new fields

___
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 04/13] ffprobe: adapt to new AVFilmGrainParams

2024-03-18 Thread Niklas Haas
From: Niklas Haas 

Follow the establish convention of printing the bit depth metadata
per-component.
---
 fftools/ffprobe.c | 41 ++---
 1 file changed, 26 insertions(+), 15 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index fe2da82e24c..7d9998b428b 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2402,22 +2402,41 @@ static void 
print_ambient_viewing_environment(WriterContext *w,
 static void print_film_grain_params(WriterContext *w,
 const AVFilmGrainParams *fgp)
 {
+const char *color_range, *color_primaries, *color_trc, *color_space;
+const char *const film_grain_type_names[] = {
+[AV_FILM_GRAIN_PARAMS_NONE] = "none",
+[AV_FILM_GRAIN_PARAMS_AV1]  = "av1",
+[AV_FILM_GRAIN_PARAMS_H274] = "h274",
+};
+
 AVBPrint pbuf;
-if (!fgp)
+if (!fgp || fgp->type >= FF_ARRAY_ELEMS(film_grain_type_names))
 return;
 
+color_range = av_color_range_name(fgp->color_range);
+color_primaries = av_color_primaries_name(fgp->color_primaries);
+color_trc   = av_color_transfer_name(fgp->color_trc);
+color_space = av_color_space_name(fgp->color_space);
+
 av_bprint_init(, 1, AV_BPRINT_SIZE_UNLIMITED);
+print_str("type", film_grain_type_names[fgp->type]);
+print_fmt("seed", "%"PRIu64, fgp->seed);
+print_int("width", fgp->width);
+print_int("height", fgp->height);
+print_int("subsampling_x", fgp->subsampling_x);
+print_int("subsampling_y", fgp->subsampling_y);
+print_str("color_range", color_range ? color_range : "unknown");
+print_str("color_primaries", color_primaries ? color_primaries : 
"unknown");
+print_str("color_trc", color_trc ? color_trc : "unknown");
+print_str("color_space", color_space ? color_space : "unknown");
 
 switch (fgp->type) {
 case AV_FILM_GRAIN_PARAMS_NONE:
-print_str("type", "none");
 break;
 case AV_FILM_GRAIN_PARAMS_AV1: {
 const AVFilmGrainAOMParams *aom = >codec.aom;
 const int num_ar_coeffs_y = 2 * aom->ar_coeff_lag * (aom->ar_coeff_lag 
+ 1);
 const int num_ar_coeffs_uv = num_ar_coeffs_y + !!aom->num_y_points;
-print_str("type", "av1");
-print_fmt("seed", "%"PRIu64, fgp->seed);
 print_int("chroma_scaling_from_luma", aom->chroma_scaling_from_luma);
 print_int("scaling_shift", aom->scaling_shift);
 print_int("ar_coeff_lag", aom->ar_coeff_lag);
@@ -2431,6 +2450,7 @@ static void print_film_grain_params(WriterContext *w,
 if (aom->num_y_points) {
 writer_print_section_header(w, NULL, 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT);
 
+print_int("bit_depth_luma", fgp->bit_depth_luma);
 print_list_fmt("y_points_value", "%"PRIu8, aom->num_y_points, 1, 
aom->y_points[idx][0]);
 print_list_fmt("y_points_scaling", "%"PRIu8, aom->num_y_points, 1, 
aom->y_points[idx][1]);
 print_list_fmt("ar_coeffs_y", "%"PRId8, num_ar_coeffs_y, 1, 
aom->ar_coeffs_y[idx]);
@@ -2445,6 +2465,7 @@ static void print_film_grain_params(WriterContext *w,
 
 writer_print_section_header(w, NULL, 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT);
 
+print_int("bit_depth_chroma", fgp->bit_depth_chroma);
 print_list_fmt("uv_points_value", "%"PRIu8, 
aom->num_uv_points[uv], 1, aom->uv_points[uv][idx][0]);
 print_list_fmt("uv_points_scaling", "%"PRIu8, 
aom->num_uv_points[uv], 1, aom->uv_points[uv][idx][1]);
 print_list_fmt("ar_coeffs_uv", "%"PRId8, num_ar_coeffs_uv, 1, 
aom->ar_coeffs_uv[uv][idx]);
@@ -2462,17 +2483,7 @@ static void print_film_grain_params(WriterContext *w,
 }
 case AV_FILM_GRAIN_PARAMS_H274: {
 const AVFilmGrainH274Params *h274 = >codec.h274;
-const char *color_range_str = 
av_color_range_name(h274->color_range);
-const char *color_primaries_str = 
av_color_primaries_name(h274->color_primaries);
-const char *color_trc_str   = 
av_color_transfer_name(h274->color_trc);
-const char *color_space_str = 
av_color_space_name(h274->color_space);
-print_str("type", "h274");
-print_fmt("seed", "%"PRIu64, fgp->seed);
 print_int("model_id", h274->model_id);
-print_str("color_range", color_range_str ? color_range_str : 
"unknown");
-print_str("color_primaries", color_primaries_str ? color_primaries_str 
: "unknown");
-print_str("color_trc", color_trc_str ? color_trc_str : "unknown");
-print_str("color_space", color_space_str ? color_space_str : 
"unknown");
 print_int("blending_mode_id", h274->blending_mode_id);
 print_int("log2_scale_factor", h274->log2_scale_factor);
 
@@ -2483,7 +2494,7 @@ static void print_film_grain_params(WriterContext *w,
 continue;
 
 writer_print_section_header(w, NULL, 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT);
-print_int(c 

[FFmpeg-devel] [PATCH v4 08/13] avutil/frame: clarify AV_FRAME_DATA_FILM_GRAIN_PARAMS usage

2024-03-18 Thread Niklas Haas
From: Niklas Haas 

To allow for AFGS1 usage, which can expose multiple parameter sets for
a single frame.
---
 libavutil/frame.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavutil/frame.h b/libavutil/frame.h
index b94687941db..7f616488be8 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -180,6 +180,10 @@ enum AVFrameSideDataType {
 /**
  * Film grain parameters for a frame, described by AVFilmGrainParams.
  * Must be present for every frame which should have film grain applied.
+ *
+ * May be present multiple times, for example when there are multiple
+ * alternative parameter sets for different video signal characteristics.
+ * The user should select the most appropriate set for the application.
  */
 AV_FRAME_DATA_FILM_GRAIN_PARAMS,
 
-- 
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 v4 01/13] avutil/film_grain_params: add metadata to common struct

2024-03-18 Thread Niklas Haas
From: Niklas Haas 

This is needed for AV1 film grain as well, when using AFGS1 streams.
Also add extra width/height and subsampling information, which AFGS1
cares about, as part of the same API bump. (And in principle, H274
should also expose this information, since it is needed downstream to
correctly adjust the chroma grain frequency to the subsampling ratio)

Deprecate the equivalent H274-exclusive fields. To avoid breaking ABI,
add the new fields after the union; but with enough of a paper trail to
hopefully re-order them on the next bump.
---
 doc/APIchanges|  6 
 libavutil/film_grain_params.h | 57 +--
 libavutil/version.h   |  3 +-
 3 files changed, 62 insertions(+), 4 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index a44c8e4f108..256d9c7757a 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,12 @@ The last version increases of all libraries were on 2024-03-07
 
 API changes, most recent first:
 
+2024-03-xx - xx - lavu 59.3.100 - film_grain_params.h
+  Add AVFilmGrainParams.color_range, color_primaries, color_trc, color_space,
+  width, height, subsampling_x, subsampling_y, bit_depth_luma and
+  bit_depth_chroma. Deprecate the corresponding fields from
+  AVFilmGrainH274Params.
+
 2024-03-xx - xx - lavu 59.2.100 - channel_layout.h
   Add AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL.
 
diff --git a/libavutil/film_grain_params.h b/libavutil/film_grain_params.h
index f3bd0a4a6a3..a9f243351c9 100644
--- a/libavutil/film_grain_params.h
+++ b/libavutil/film_grain_params.h
@@ -136,20 +136,42 @@ typedef struct AVFilmGrainH274Params {
  */
 int model_id;
 
-/**
- * Specifies the bit depth used for the luma component.
- */
+#if FF_API_H274_FILM_GRAIN_VCS
+  /**
+   * TODO: On this ABI bump, please also re-order the fields in
+   * AVFilmGrainParams (see below)
+   */
+
+  /**
+   * Specifies the bit depth used for the luma component.
+   *
+   * @deprecated use AVFilmGrainParams.bit_depth_luma.
+   */
+attribute_deprecated
 int bit_depth_luma;
 
 /**
  * Specifies the bit depth used for the chroma components.
+ *
+ * @deprecated use AVFilmGrainParams.bit_depth_chroma.
  */
+attribute_deprecated
 int bit_depth_chroma;
 
+/**
+ * Specifies the video signal characteristics.
+ *
+ * @deprecated use AVFilmGrainParams.color_{range,primaries,trc,space}.
+ */
+attribute_deprecated
 enum AVColorRange  color_range;
+attribute_deprecated
 enum AVColorPrimaries  color_primaries;
+attribute_deprecated
 enum AVColorTransferCharacteristic color_trc;
+attribute_deprecated
 enum AVColorSpace  color_space;
+#endif
 
 /**
  * Specifies the blending mode used to blend the simulated film grain
@@ -231,11 +253,40 @@ typedef struct AVFilmGrainParams {
  * Additional fields may be added both here and in any structure included.
  * If a codec's film grain structure differs slightly over another
  * codec's, fields within may change meaning depending on the type.
+ *
+ * TODO: Move this to the end of the structure, at the next ABI bump.
  */
 union {
 AVFilmGrainAOMParams aom;
 AVFilmGrainH274Params h274;
 } codec;
+
+/**
+ * Intended display resolution. May be 0 if the codec does not specify
+ * any restrictions.
+ */
+
+int width, height;
+
+/**
+ * Intended subsampling ratio, or 0 for luma-only streams.
+ */
+int subsampling_x, subsampling_y;
+
+/**
+ * Intended video signal characteristics.
+ */
+enum AVColorRange  color_range;
+enum AVColorPrimaries  color_primaries;
+enum AVColorTransferCharacteristic color_trc;
+enum AVColorSpace  color_space;
+
+/**
+ * Intended bit depth, or 0 for unknown/unspecified.
+ */
+int bit_depth_luma;
+int bit_depth_chroma;
+
 } AVFilmGrainParams;
 
 /**
diff --git a/libavutil/version.h b/libavutil/version.h
index 57cad02ec0a..23351316b58 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  59
-#define LIBAVUTIL_VERSION_MINOR   2
+#define LIBAVUTIL_VERSION_MINOR   3
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -111,6 +111,7 @@
 #define FF_API_FRAME_KEY(LIBAVUTIL_VERSION_MAJOR < 60)
 #define FF_API_PALETTE_HAS_CHANGED  (LIBAVUTIL_VERSION_MAJOR < 60)
 #define FF_API_VULKAN_CONTIGUOUS_MEMORY (LIBAVUTIL_VERSION_MAJOR < 60)
+#define FF_API_H274_FILM_GRAIN_VCS  (LIBAVUTIL_VERSION_MAJOR < 60)
 
 /**
  * @}
-- 
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] [PATCH v4 03/13] avfilter/vf_showinfo: adapt to new AVFilmGrainParams

2024-03-18 Thread Niklas Haas
From: Niklas Haas 

---
 libavfilter/vf_showinfo.c | 26 +++---
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 095cb22639f..28d8ea76e9b 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -452,6 +452,11 @@ static void 
dump_sei_film_grain_params_metadata(AVFilterContext *ctx, const AVFr
 [AV_FILM_GRAIN_PARAMS_H274] = "h274",
 };
 
+const char *color_range_str = av_color_range_name(fgp->color_range);
+const char *color_primaries_str = 
av_color_primaries_name(fgp->color_primaries);
+const char *color_trc_str   = av_color_transfer_name(fgp->color_trc);
+const char *colorspace_str  = av_color_space_name(fgp->color_space);
+
 if (fgp->type >= FF_ARRAY_ELEMS(film_grain_type_names)) {
 av_log(ctx, AV_LOG_ERROR, "invalid data\n");
 return;
@@ -459,6 +464,16 @@ static void 
dump_sei_film_grain_params_metadata(AVFilterContext *ctx, const AVFr
 
 av_log(ctx, AV_LOG_INFO, "type %s; ", film_grain_type_names[fgp->type]);
 av_log(ctx, AV_LOG_INFO, "seed=%"PRIu64"; ", fgp->seed);
+av_log(ctx, AV_LOG_INFO, "width=%d; ", fgp->width);
+av_log(ctx, AV_LOG_INFO, "height=%d; ", fgp->height);
+av_log(ctx, AV_LOG_INFO, "subsampling_x=%d; ", fgp->subsampling_x);
+av_log(ctx, AV_LOG_INFO, "subsampling_y=%d; ", fgp->subsampling_y);
+av_log(ctx, AV_LOG_INFO, "color_range=%s; ", color_range_str ? 
color_range_str : "unknown");
+av_log(ctx, AV_LOG_INFO, "color_primaries=%s; ", color_primaries_str ? 
color_primaries_str : "unknown");
+av_log(ctx, AV_LOG_INFO, "color_trc=%s; ", color_trc_str ? color_trc_str : 
"unknown");
+av_log(ctx, AV_LOG_INFO, "color_space=%s; ", colorspace_str ? 
colorspace_str : "unknown");
+av_log(ctx, AV_LOG_INFO, "bit_depth_luma=%d; ", fgp->bit_depth_luma);
+av_log(ctx, AV_LOG_INFO, "bit_depth_chroma=%d; ", fgp->bit_depth_chroma);
 
 switch (fgp->type) {
 case AV_FILM_GRAIN_PARAMS_NONE:
@@ -504,18 +519,7 @@ static void 
dump_sei_film_grain_params_metadata(AVFilterContext *ctx, const AVFr
 }
 case AV_FILM_GRAIN_PARAMS_H274: {
 const AVFilmGrainH274Params *h274 = >codec.h274;
-const char *color_range_str = 
av_color_range_name(h274->color_range);
-const char *color_primaries_str = 
av_color_primaries_name(h274->color_primaries);
-const char *color_trc_str   = 
av_color_transfer_name(h274->color_trc);
-const char *colorspace_str  = 
av_color_space_name(h274->color_space);
-
 av_log(ctx, AV_LOG_INFO, "model_id=%d; ", h274->model_id);
-av_log(ctx, AV_LOG_INFO, "bit_depth_luma=%d; ", h274->bit_depth_luma);
-av_log(ctx, AV_LOG_INFO, "bit_depth_chroma=%d; ", 
h274->bit_depth_chroma);
-av_log(ctx, AV_LOG_INFO, "color_range=%s; ", color_range_str ? 
color_range_str : "unknown");
-av_log(ctx, AV_LOG_INFO, "color_primaries=%s; ", color_primaries_str ? 
color_primaries_str : "unknown");
-av_log(ctx, AV_LOG_INFO, "color_trc=%s; ", color_trc_str ? 
color_trc_str : "unknown");
-av_log(ctx, AV_LOG_INFO, "color_space=%s; ", colorspace_str ? 
colorspace_str : "unknown");
 av_log(ctx, AV_LOG_INFO, "blending_mode_id=%d; ", 
h274->blending_mode_id);
 av_log(ctx, AV_LOG_INFO, "log2_scale_factor=%d; ", 
h274->log2_scale_factor);
 
-- 
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 v4 02/13] avutil/film_grain_params: initialize VCS to UNSPECIFIED

2024-03-18 Thread Niklas Haas
From: Niklas Haas 

---
 libavutil/film_grain_params.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavutil/film_grain_params.c b/libavutil/film_grain_params.c
index 930d23c7fe9..230ce8d701c 100644
--- a/libavutil/film_grain_params.c
+++ b/libavutil/film_grain_params.c
@@ -30,13 +30,20 @@ AVFilmGrainParams *av_film_grain_params_alloc(size_t *size)
 
 AVFilmGrainParams *av_film_grain_params_create_side_data(AVFrame *frame)
 {
+AVFilmGrainParams *fgp;
 AVFrameSideData *side_data = av_frame_new_side_data(frame,
 
AV_FRAME_DATA_FILM_GRAIN_PARAMS,
 
sizeof(AVFilmGrainParams));
 if (!side_data)
 return NULL;
 
-memset(side_data->data, 0, sizeof(AVFilmGrainParams));
+fgp = (AVFilmGrainParams *) side_data->data;
+*fgp = (AVFilmGrainParams) {
+.color_range = AVCOL_RANGE_UNSPECIFIED,
+.color_primaries = AVCOL_PRI_UNSPECIFIED,
+.color_trc   = AVCOL_TRC_UNSPECIFIED,
+.color_space = AVCOL_SPC_UNSPECIFIED,
+};
 
-return (AVFilmGrainParams *)side_data->data;
+return fgp;
 }
-- 
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] avformat: enable UDP IPv6 multicast interface selection

2024-03-18 Thread RS

This message has been marked as Public on 03/18/2024 13:45Z.
On Thursday, March 14, 2024 10:14 PM, Michael Niedermayer wrote:

> breaks mingw64 build
>
> CC  libavformat/ip.o
> src/libavformat/ip.c: In function ‘ff_ip_resolve_interface_index’:
> src/libavformat/ip.c:206:1: error: control reaches end of non-void function 
> [-Werror=return-type]  }  ^
> cc1: some warnings being treated as errors
> src/ffbuild/common.mak:81: recipe for target 'libavformat/ip.o' failed
> make: *** [libavformat/ip.o] Error 1

I see the problem, when building for windows without iphlpapi.h, mentioned 
function has no code within.
Will account for such case.

> also configure produces
> ../configure: 6415: ../configure: network_extralibs+= -liphlpapi: not found

Problem here is that "+=" operator is a bashism, probably causing the previous 
error by not including iphlpapi properly.

Some questions I have:
Should I send another patch within this thread to address these comments, or 
should I create a V2 of the patch?
Also, if creating a V2, should the patch be sent within this thread, or should 
a new thread be opened?

Thank you for your time!

Sincirely,
Lazar Ignjatović
Associate Software Engineer

Cubic Defense
cubic.com
___
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] doc/fate: advise on --assert-level=2

2024-03-18 Thread Nicolas Gaullier
>De : Nicolas Gaullier  
>Envoyé : mardi 12 mars 2024 13:09
>Objet : [PATCH] doc/fate: advise on --assert-level=2
>
>diff --git a/doc/fate.texi b/doc/fate.texi index 2fa8c34c2d..17644ce65a 100644
>--- a/doc/fate.texi
>+++ b/doc/fate.texi
>@@ -79,6 +79,14 @@ Do not put a '~' character in the samples path to indicate 
>a home  directory. Because of shell nuances, this will cause FATE to fail.
> @end float
> 
>+Beware that some assertions are disabled by default, so mind setting 
>+@option{--assert-level=} at configuration time, e.g. when 
>+seeking the highest possible test coverage:
>+@example
>+./configure --assert-level=2
>+@end example
>+Note that raising the assert level could have a performance impact.

Ping ? (I forgot to raise the version to v2, but it actually includes a notice 
on performance impact following Michael's comment)
Feel free to amend/reauthor if my english is not good enough.

Nicolas
___
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] Changelog: mention ffplay with hwaccel decoding support

2024-03-18 Thread Zhao Zhili
From: Zhao Zhili 

---
 Changelog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Changelog b/Changelog
index e3ca52430c..c6e8f6bcaf 100644
--- a/Changelog
+++ b/Changelog
@@ -35,6 +35,7 @@ version :
 - AEA muxer
 - ffmpeg CLI loopback decoders
 - Support PacketTypeMetadata of PacketType in enhanced flv format
+- ffplay with hwaccel decoding support (depends on vulkan renderer via 
libplacebo)
 
 
 version 6.1:
-- 
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 v4 10/13] avcodec/aom_film_grain: add AOM film grain synthesis

2024-03-18 Thread Niklas Haas
From: Niklas Haas 

Implementation copied wholesale from dav1d, sans SIMD, under permissive
license. This implementation was extensively verified to be bit-exact,
so it serves as a much better starting point than trying to re-engineer
this from scratch for no reason. (I also authored the original
implementation in dav1d, so any "clean room" implementation would end up
looking much the same, anyway)

The notable changes I had to make while adapting this from the dav1d
code-base to the FFmpeg codebase include:

- reordering variable declarations to avoid triggering warnings
- replacing several inline helpers by avutil equivalents
- changing code that accesses frame metadata
- replacing raw plane copying logic by av_image_copy_plane

Apart from this, the implementation is basically unmodified.
---
 libavcodec/aom_film_grain.c  | 310 ++
 libavcodec/aom_film_grain.h  |  38 ++
 libavcodec/aom_film_grain_template.c | 577 +++
 3 files changed, 925 insertions(+)
 create mode 100644 libavcodec/aom_film_grain.c
 create mode 100644 libavcodec/aom_film_grain.h
 create mode 100644 libavcodec/aom_film_grain_template.c

diff --git a/libavcodec/aom_film_grain.c b/libavcodec/aom_film_grain.c
new file mode 100644
index 000..ffcd71b584b
--- /dev/null
+++ b/libavcodec/aom_film_grain.c
@@ -0,0 +1,310 @@
+/*
+ * AOM film grain synthesis
+ * Copyright (c) 2023 Niklas Haas 
+ *
+ * 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
+ * AOM film grain synthesis.
+ * @author Niklas Haas 
+ */
+
+#include "libavutil/avassert.h"
+#include "libavutil/imgutils.h"
+
+#include "aom_film_grain.h"
+
+// Common/shared helpers (not dependent on BIT_DEPTH)
+static inline int get_random_number(const int bits, unsigned *const state) {
+const int r = *state;
+unsigned bit = ((r >> 0) ^ (r >> 1) ^ (r >> 3) ^ (r >> 12)) & 1;
+*state = (r >> 1) | (bit << 15);
+
+return (*state >> (16 - bits)) & ((1 << bits) - 1);
+}
+
+static inline int round2(const int x, const uint64_t shift) {
+return (x + ((1 << shift) >> 1)) >> shift;
+}
+
+enum {
+GRAIN_WIDTH  = 82,
+GRAIN_HEIGHT = 73,
+SUB_GRAIN_WIDTH  = 44,
+SUB_GRAIN_HEIGHT = 38,
+FG_BLOCK_SIZE= 32,
+};
+
+static const int16_t gaussian_sequence[2048];
+
+#define BIT_DEPTH 16
+#include "aom_film_grain_template.c"
+#undef BIT_DEPTH
+
+#define BIT_DEPTH 8
+#include "aom_film_grain_template.c"
+#undef BIT_DEPTH
+
+
+int ff_aom_apply_film_grain(AVFrame *out, const AVFrame *in,
+const AVFilmGrainParams *params)
+{
+const AVFilmGrainAOMParams *const data = >codec.aom;
+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(out->format);
+const int subx = desc->log2_chroma_w, suby = desc->log2_chroma_h;
+const int pxstep = desc->comp[0].step;
+
+av_assert0(out->format == in->format);
+av_assert0(params->type == AV_FILM_GRAIN_PARAMS_AV1);
+
+// Copy over the non-modified planes
+if (!params->codec.aom.num_y_points) {
+av_image_copy_plane(out->data[0], out->linesize[0],
+in->data[0], in->linesize[0],
+out->width * pxstep, out->height);
+}
+for (int uv = 0; uv < 2; uv++) {
+if (!data->num_uv_points[uv]) {
+av_image_copy_plane(out->data[1+uv], out->linesize[1+uv],
+in->data[1+uv], in->linesize[1+uv],
+AV_CEIL_RSHIFT(out->width, subx) * pxstep,
+AV_CEIL_RSHIFT(out->height, suby));
+}
+}
+
+switch (in->format) {
+case AV_PIX_FMT_GRAY8:
+case AV_PIX_FMT_YUV420P:
+case AV_PIX_FMT_YUV422P:
+case AV_PIX_FMT_YUV444P:
+case AV_PIX_FMT_YUVJ420P:
+case AV_PIX_FMT_YUVJ422P:
+case AV_PIX_FMT_YUVJ444P:
+return apply_film_grain_8(out, in, params);
+case AV_PIX_FMT_GRAY9:
+case AV_PIX_FMT_YUV420P9:
+case AV_PIX_FMT_YUV422P9:
+case AV_PIX_FMT_YUV444P9:
+return apply_film_grain_16(out, in, params, 9);
+case AV_PIX_FMT_GRAY10:
+case AV_PIX_FMT_YUV420P10:
+case AV_PIX_FMT_YUV422P10:
+case AV_PIX_FMT_YUV444P10:
+return apply_film_grain_16(out, in, params, 10);
+

Re: [FFmpeg-devel] [PATCH] doc/muxers: add flac

2024-03-18 Thread Stefano Sabatini
On date Tuesday 2024-03-12 22:17:36 +0100, Andreas Rheinhardt wrote:
> Stefano Sabatini:
> > ---
> >  doc/muxers.texi | 11 +++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/doc/muxers.texi b/doc/muxers.texi
> > index de4b9b01f5..64d9221198 100644
> > --- a/doc/muxers.texi
> > +++ b/doc/muxers.texi
> > @@ -1612,6 +1612,17 @@ This image format is used to store astronomical data.
> >  For more information regarding the format, visit
> >  @url{https://fits.gsfc.nasa.gov}.
> >  
> > +@section flac
> > +Raw FLAC audio muxer.
> > +
> > +This muxer accepts exactly one FLAC audio stream. Additionally, it is 
> > possible to add a
> > +single 32x32 PNG image as attached picture.
> 

> This is wrong: Way more attached pictures are supported. The restriction
> you are referring to only applies to pictures of type "32x32 pixels
> 'file icon'".

Dropped mention to this limitation and amended, it's probably better
documented in the code than in the doc itself.
>From fce90431bba4f729521195d2ea8067a4f11a9a3d Mon Sep 17 00:00:00 2001
From: Stefano Sabatini 
Date: Tue, 12 Mar 2024 22:00:09 +0100
Subject: [PATCH] doc/muxers: add flac

---
 doc/muxers.texi | 20 
 1 file changed, 20 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 454f2347cf..fe4be49b1c 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1576,6 +1576,26 @@ This image format is used to store astronomical data.
 For more information regarding the format, visit
 @url{https://fits.gsfc.nasa.gov}.
 
+@section flac
+Raw FLAC audio muxer.
+
+This muxer accepts exactly one FLAC audio stream. Additionally, it is possible to add
+images with disposition @samp{attached_pic}.
+
+@subsection Options
+@table @option
+@item write_header @var{bool}
+write the file header if set to @code{true}, default is @code{true}
+@end table
+
+@subsection Example
+Use @command{ffmpeg} to store the audio stream from an input file,
+together with several pictures used with @samp{attached_pic}
+disposition:
+@example
+ffmpeg -i INPUT -i pic1.png -i pic2.jpg -map 0:a -map 1 -map 2 -disposition:v attached_pic OUTPUT
+@end example
+
 @section flv
 
 Adobe Flash Video Format 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 06/14] avcodec/vvcdec: misc, rename x_ctb, y_ctb, ctu_x, ctu_y to rx, ry to avoid misleading

2024-03-18 Thread Nuo Mi
---
 libavcodec/vvc/vvc_ctu.c|  8 ++--
 libavcodec/vvc/vvc_filter.c | 96 ++---
 libavcodec/vvc/vvc_ps.c | 38 +++
 3 files changed, 71 insertions(+), 71 deletions(-)

diff --git a/libavcodec/vvc/vvc_ctu.c b/libavcodec/vvc/vvc_ctu.c
index 75d9f07143..519bd1ba76 100644
--- a/libavcodec/vvc/vvc_ctu.c
+++ b/libavcodec/vvc/vvc_ctu.c
@@ -87,10 +87,10 @@ static int get_qp_y_pred(const VVCLocalContext *lc)
 const int min_cb_width  = fc->ps.pps->min_cb_width;
 const int x_cb  = cu->x0 >> sps->min_cb_log2_size_y;
 const int y_cb  = cu->y0 >> sps->min_cb_log2_size_y;
-const int x_ctb = cu->x0 >> ctb_log2_size;
-const int y_ctb = cu->y0 >> ctb_log2_size;
-const int in_same_ctb_a = ((xQg - 1) >> ctb_log2_size) == x_ctb && (yQg >> 
ctb_log2_size) == y_ctb;
-const int in_same_ctb_b = (xQg >> ctb_log2_size) == x_ctb && ((yQg - 1) >> 
ctb_log2_size) == y_ctb;
+const int rx= cu->x0 >> ctb_log2_size;
+const int ry= cu->y0 >> ctb_log2_size;
+const int in_same_ctb_a = ((xQg - 1) >> ctb_log2_size) == rx && (yQg >> 
ctb_log2_size) == ry;
+const int in_same_ctb_b = (xQg >> ctb_log2_size) == rx && ((yQg - 1) >> 
ctb_log2_size) == ry;
 int qPy_pred, qPy_a, qPy_b;
 
 if (lc->na.cand_up) {
diff --git a/libavcodec/vvc/vvc_filter.c b/libavcodec/vvc/vvc_filter.c
index dded447bfa..10bd57e078 100644
--- a/libavcodec/vvc/vvc_filter.c
+++ b/libavcodec/vvc/vvc_filter.c
@@ -99,7 +99,7 @@ static void copy_vert(uint8_t *dst, const uint8_t *src, const 
int pixel_shift, c
 
 static void copy_ctb_to_hv(VVCFrameContext *fc, const uint8_t *src,
 const ptrdiff_t src_stride, const int x, const int y, const int width, 
const int height,
-const int c_idx, const int x_ctb, const int y_ctb, const int top)
+const int c_idx, const int rx, const int ry, const int top)
 {
 const int ps = fc->ps.sps->pixel_shift;
 const int w  = fc->ps.pps->width >> fc->ps.sps->hshift[c_idx];
@@ -107,16 +107,16 @@ static void copy_ctb_to_hv(VVCFrameContext *fc, const 
uint8_t *src,
 
 if (top) {
 /* top */
-memcpy(fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * y_ctb) * w + x) << 
ps),
+memcpy(fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * ry) * w + x) << ps),
 src, width << ps);
 } else {
 /* bottom */
-memcpy(fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 1) * w + x) 
<< ps),
+memcpy(fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * ry + 1) * w + x) << 
ps),
 src + src_stride * (height - 1), width << ps);
 
 /* copy vertical edges */
-copy_vert(fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * x_ctb) * h + y) 
<< ps), src, ps, height, 1 << ps, src_stride);
-copy_vert(fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * x_ctb + 1) * h + 
y) << ps), src + ((width - 1) << ps), ps, height, 1 << ps, src_stride);
+copy_vert(fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * rx) * h + y) << 
ps), src, ps, height, 1 << ps, src_stride);
+copy_vert(fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * rx + 1) * h + y) 
<< ps), src + ((width - 1) << ps), ps, height, 1 << ps, src_stride);
 }
 }
 
@@ -158,9 +158,9 @@ void ff_vvc_sao_filter(VVCLocalContext *lc, int x, int y)
 static const uint8_t sao_tab[16] = { 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 
7, 7, 8, 8 };
 int c_idx;
 int edges[4];  // 0 left 1 top 2 right 3 bottom
-const int x_ctb  = x >> fc->ps.sps->ctb_log2_size_y;
-const int y_ctb  = y >> fc->ps.sps->ctb_log2_size_y;
-const SAOParams *sao = (fc->tab.sao, x_ctb, y_ctb);
+const int rx = x >> fc->ps.sps->ctb_log2_size_y;
+const int ry = y >> fc->ps.sps->ctb_log2_size_y;
+const SAOParams *sao = (fc->tab.sao, rx, ry);
 // flags indicating unfilterable edges
 uint8_t vert_edge[]  = { 0, 0 };
 uint8_t horiz_edge[] = { 0, 0 };
@@ -174,39 +174,39 @@ void ff_vvc_sao_filter(VVCLocalContext *lc, int x, int y)
 uint8_t up_tile_edge = 0;
 uint8_t bottom_tile_edge = 0;
 
-edges[LEFT]   = x_ctb == 0;
-edges[TOP]= y_ctb == 0;
-edges[RIGHT]  = x_ctb == fc->ps.pps->ctb_width  - 1;
-edges[BOTTOM] = y_ctb == fc->ps.pps->ctb_height - 1;
+edges[LEFT]   = rx == 0;
+edges[TOP]= ry == 0;
+edges[RIGHT]  = rx == fc->ps.pps->ctb_width  - 1;
+edges[BOTTOM] = ry == fc->ps.pps->ctb_height - 1;
 
 if (restore) {
 if (!edges[LEFT]) {
-left_tile_edge  = no_tile_filter && 
fc->ps.pps->ctb_to_col_bd[x_ctb] == x_ctb;
-vert_edge[0]= (!lfase && CTB(fc->tab.slice_idx, x_ctb, y_ctb) 
!= CTB(fc->tab.slice_idx, x_ctb - 1, y_ctb)) || left_tile_edge;
+left_tile_edge  = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] 
== rx;
+vert_edge[0]= (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx - 1, ry)) || left_tile_edge;
 }
 if 

[FFmpeg-devel] [PATCH 09/14] avcodec/vvcdec: refact, movie the lc->sc assignment to task_run_stage to simplify the code

2024-03-18 Thread Nuo Mi
This change also make the lc->sc assigned for run_sao
---
 libavcodec/vvc/vvc_thread.c | 66 ++---
 1 file changed, 17 insertions(+), 49 deletions(-)

diff --git a/libavcodec/vvc/vvc_thread.c b/libavcodec/vvc/vvc_thread.c
index 5d2e8c67b9..8f23b8138b 100644
--- a/libavcodec/vvc/vvc_thread.c
+++ b/libavcodec/vvc/vvc_thread.c
@@ -416,7 +416,6 @@ static int run_parse(VVCContext *s, VVCLocalContext *lc, 
VVCTask *t)
 const int rs= t->rs;
 const CTU *ctu  = fc->tab.ctus + rs;
 
-lc->sc = t->sc;
 lc->ep = t->ep;
 
 ret = ff_vvc_coding_tree_unit(lc, t->ctu_idx, rs, t->rx, t->ry);
@@ -432,15 +431,9 @@ static int run_parse(VVCContext *s, VVCLocalContext *lc, 
VVCTask *t)
 static int run_inter(VVCContext *s, VVCLocalContext *lc, VVCTask *t)
 {
 VVCFrameContext *fc = lc->fc;
-VVCFrameThread *ft  = fc->ft;
-const int rs= t->ry * ft->ctu_width + t->rx;
-const CTU *ctu  = fc->tab.ctus + rs;
-const int slice_idx = fc->tab.slice_idx[rs];
+const CTU *ctu  = fc->tab.ctus + t->rs;
 
-if (slice_idx != -1) {
-lc->sc = fc->slices[slice_idx];
-ff_vvc_predict_inter(lc, rs);
-}
+ff_vvc_predict_inter(lc, t->rs);
 
 if (ctu->has_dmvr)
 report_frame_progress(fc, t->ry, VVC_PROGRESS_MV);
@@ -450,14 +443,7 @@ static int run_inter(VVCContext *s, VVCLocalContext *lc, 
VVCTask *t)
 
 static int run_recon(VVCContext *s, VVCLocalContext *lc, VVCTask *t)
 {
-VVCFrameContext *fc = lc->fc;
-const int rs= t->rs;
-const int slice_idx = fc->tab.slice_idx[rs];
-
-if (slice_idx != -1) {
-lc->sc = fc->slices[slice_idx];
-ff_vvc_reconstruct(lc, rs, t->rx, t->ry);
-}
+ff_vvc_reconstruct(lc, t->rs, t->rx, t->ry);
 
 return 0;
 }
@@ -469,13 +455,8 @@ static int run_lmcs(VVCContext *s, VVCLocalContext *lc, 
VVCTask *t)
 const int ctu_size  = ft->ctu_size;
 const int x0= t->rx * ctu_size;
 const int y0= t->ry * ctu_size;
-const int rs= t->ry * ft->ctu_width + t->rx;
-const int slice_idx = fc->tab.slice_idx[rs];
 
-if (slice_idx != -1) {
-lc->sc = fc->slices[slice_idx];
-ff_vvc_lmcs_filter(lc, x0, y0);
-}
+ff_vvc_lmcs_filter(lc, x0, y0);
 
 return 0;
 }
@@ -484,18 +465,13 @@ static int run_deblock_v(VVCContext *s, VVCLocalContext 
*lc, VVCTask *t)
 {
 VVCFrameContext *fc = lc->fc;
 VVCFrameThread *ft  = fc->ft;
-const int rs= t->ry * ft->ctu_width + t->rx;
 const int ctb_size  = ft->ctu_size;
 const int x0= t->rx * ctb_size;
 const int y0= t->ry * ctb_size;
-const int slice_idx = fc->tab.slice_idx[rs];
 
-if (slice_idx != -1) {
-lc->sc = fc->slices[slice_idx];
-if (!lc->sc->sh.r->sh_deblocking_filter_disabled_flag) {
-ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, rs);
-ff_vvc_deblock_vertical(lc, x0, y0, rs);
-}
+if (!lc->sc->sh.r->sh_deblocking_filter_disabled_flag) {
+ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, t->rs);
+ff_vvc_deblock_vertical(lc, x0, y0, t->rs);
 }
 
 return 0;
@@ -506,20 +482,15 @@ static int run_deblock_h(VVCContext *s, VVCLocalContext 
*lc, VVCTask *t)
 VVCFrameContext *fc = lc->fc;
 VVCFrameThread *ft  = fc->ft;
 const int ctb_size  = ft->ctu_size;
-const int rs= t->ry * ft->ctu_width + t->rx;
 const int x0= t->rx * ctb_size;
 const int y0= t->ry * ctb_size;
-const int slice_idx = fc->tab.slice_idx[rs];
 
-if (slice_idx != -1) {
-lc->sc = fc->slices[slice_idx];
-if (!lc->sc->sh.r->sh_deblocking_filter_disabled_flag) {
-ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, rs);
-ff_vvc_deblock_horizontal(lc, x0, y0, rs);
-}
-if (fc->ps.sps->r->sps_sao_enabled_flag)
-ff_vvc_sao_copy_ctb_to_hv(lc, t->rx, t->ry, t->ry == 
ft->ctu_height - 1);
+if (!lc->sc->sh.r->sh_deblocking_filter_disabled_flag) {
+ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, t->rs);
+ff_vvc_deblock_horizontal(lc, x0, y0, t->rs);
 }
+if (fc->ps.sps->r->sps_sao_enabled_flag)
+ff_vvc_sao_copy_ctb_to_hv(lc, t->rx, t->ry, t->ry == ft->ctu_height - 
1);
 
 return 0;
 }
@@ -528,13 +499,12 @@ static int run_sao(VVCContext *s, VVCLocalContext *lc, 
VVCTask *t)
 {
 VVCFrameContext *fc = lc->fc;
 VVCFrameThread *ft  = fc->ft;
-const int rs= t->ry * fc->ps.pps->ctb_width + t->rx;
 const int ctb_size  = ft->ctu_size;
 const int x0= t->rx * ctb_size;
 const int y0= t->ry * ctb_size;
 
 if (fc->ps.sps->r->sps_sao_enabled_flag) {
-ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, rs);
+ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, t->rs);
 ff_vvc_sao_filter(lc, x0, y0);
 }
 
@@ -553,12 +523,8 @@ static int run_alf(VVCContext *s, 

[FFmpeg-devel] [PATCH 12/14] avcodec/vvcdec: alf, support subpicture

2024-03-18 Thread Nuo Mi
---
 libavcodec/vvc/vvc_filter.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/libavcodec/vvc/vvc_filter.c b/libavcodec/vvc/vvc_filter.c
index 6b4c2050c7..de0816619b 100644
--- a/libavcodec/vvc/vvc_filter.c
+++ b/libavcodec/vvc/vvc_filter.c
@@ -1199,6 +1199,7 @@ void ff_vvc_alf_copy_ctu_to_hv(VVCLocalContext* lc, const 
int x0, const int y0)
 void ff_vvc_alf_filter(VVCLocalContext *lc, const int x0, const int y0)
 {
 VVCFrameContext *fc = lc->fc;
+const VVCSPS *sps   = fc->ps.sps;
 const VVCPPS *pps   = fc->ps.pps;
 const int rx= x0 >> fc->ps.sps->ctb_log2_size_y;
 const int ry= y0 >> fc->ps.sps->ctb_log2_size_y;
@@ -1207,6 +1208,7 @@ void ff_vvc_alf_filter(VVCLocalContext *lc, const int x0, 
const int y0)
 const int padded_stride = EDGE_EMU_BUFFER_STRIDE << ps;
 const int padded_offset = padded_stride * ALF_PADDING_SIZE + 
(ALF_PADDING_SIZE << ps);
 const int c_end = fc->ps.sps->r->sps_chroma_format_idc ? 
VVC_MAX_SAMPLE_ARRAYS : 1;
+const int subpic_idx= lc->sc->sh.r->curr_subpic_idx;
 ALFParams *alf  = (fc->tab.alf, rx, ry);
 int edges[MAX_EDGES]= { rx == 0, ry == 0, rx == pps->ctb_width - 1, ry 
== pps->ctb_height - 1 };
 
@@ -1224,6 +1226,13 @@ void ff_vvc_alf_filter(VVCLocalContext *lc, const int 
x0, const int y0)
 edges[BOTTOM] = edges[BOTTOM] || CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx, ry + 1);
 }
 
+if (!sps->r->sps_loop_filter_across_subpic_enabled_flag[subpic_idx]) {
+edges[LEFT]   = edges[LEFT] || (lc->boundary_flags & 
BOUNDARY_LEFT_SUBPIC);
+edges[TOP]= edges[TOP] || (lc->boundary_flags & 
BOUNDARY_UPPER_SUBPIC);
+edges[RIGHT]  = edges[RIGHT] || 
fc->ps.sps->r->sps_subpic_ctu_top_left_x[subpic_idx] + 
fc->ps.sps->r->sps_subpic_width_minus1[subpic_idx] == rx;
+edges[BOTTOM] = edges[BOTTOM] || 
fc->ps.sps->r->sps_subpic_ctu_top_left_y[subpic_idx] + 
fc->ps.sps->r->sps_subpic_height_minus1[subpic_idx] == ry;
+}
+
 for (int c_idx = 0; c_idx < c_end; c_idx++) {
 const int hs = fc->ps.sps->hshift[c_idx];
 const int vs = fc->ps.sps->vshift[c_idx];
-- 
2.25.1

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

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


[FFmpeg-devel] [PATCH 10/14] avcodec/vvcdec: sao, refact out tile_edge arrays

2024-03-18 Thread Nuo Mi
---
 libavcodec/vvc/vvc_filter.c | 36 ++--
 1 file changed, 14 insertions(+), 22 deletions(-)

diff --git a/libavcodec/vvc/vvc_filter.c b/libavcodec/vvc/vvc_filter.c
index ecb004d245..1a3cd02a9f 100644
--- a/libavcodec/vvc/vvc_filter.c
+++ b/libavcodec/vvc/vvc_filter.c
@@ -157,56 +157,48 @@ void ff_vvc_sao_filter(VVCLocalContext *lc, int x, int y)
 const int ctb_size_y = fc->ps.sps->ctb_size_y;
 static const uint8_t sao_tab[16] = { 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 
7, 7, 8, 8 };
 int c_idx;
-int edges[4];  // 0 left 1 top 2 right 3 bottom
 const int rx = x >> fc->ps.sps->ctb_log2_size_y;
 const int ry = y >> fc->ps.sps->ctb_log2_size_y;
+int edges[4] = { !rx, !ry, rx == fc->ps.pps->ctb_width - 1, ry == 
fc->ps.pps->ctb_height - 1 };
 const SAOParams *sao = (fc->tab.sao, rx, ry);
 // flags indicating unfilterable edges
 uint8_t vert_edge[]  = { 0, 0 };
 uint8_t horiz_edge[] = { 0, 0 };
 uint8_t diag_edge[]  = { 0, 0, 0, 0 };
+uint8_t tile_edge[]  = { 0, 0, 0, 0 };
 const uint8_t lfase  = 
fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag;
 const uint8_t no_tile_filter = fc->ps.pps->r->num_tiles_in_pic > 1 &&

!fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag;
 const uint8_t restore= no_tile_filter || !lfase;
-uint8_t left_tile_edge   = 0;
-uint8_t right_tile_edge  = 0;
-uint8_t up_tile_edge = 0;
-uint8_t bottom_tile_edge = 0;
-
-edges[LEFT]   = rx == 0;
-edges[TOP]= ry == 0;
-edges[RIGHT]  = rx == fc->ps.pps->ctb_width  - 1;
-edges[BOTTOM] = ry == fc->ps.pps->ctb_height - 1;
 
 if (restore) {
 if (!edges[LEFT]) {
-left_tile_edge  = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] 
== rx;
-vert_edge[0]= (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx - 1, ry)) || left_tile_edge;
+tile_edge[LEFT]  = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] 
== rx;
+vert_edge[0]= (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx - 1, ry)) || tile_edge[LEFT];
 }
 if (!edges[RIGHT]) {
-right_tile_edge = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] 
!= fc->ps.pps->ctb_to_col_bd[rx + 1];
-vert_edge[1]= (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx + 1, ry)) || right_tile_edge;
+tile_edge[RIGHT] = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] 
!= fc->ps.pps->ctb_to_col_bd[rx + 1];
+vert_edge[1]= (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx + 1, ry)) || tile_edge[RIGHT];
 }
 if (!edges[TOP]) {
-up_tile_edge = no_tile_filter && fc->ps.pps->ctb_to_row_bd[ry] 
== ry;
-horiz_edge[0]= (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx, ry - 1)) || up_tile_edge;
+tile_edge[TOP] = no_tile_filter && 
fc->ps.pps->ctb_to_row_bd[ry] == ry;
+horiz_edge[0]= (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx, ry - 1)) || tile_edge[TOP];
 }
 if (!edges[BOTTOM]) {
-bottom_tile_edge = no_tile_filter && fc->ps.pps->ctb_to_row_bd[ry] 
!= fc->ps.pps->ctb_to_row_bd[ry + 1];
-horiz_edge[1]= (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx, ry + 1)) || bottom_tile_edge;
+tile_edge[BOTTOM] = no_tile_filter && 
fc->ps.pps->ctb_to_row_bd[ry] != fc->ps.pps->ctb_to_row_bd[ry + 1];
+horiz_edge[1]= (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx, ry + 1)) || tile_edge[BOTTOM];
 }
 if (!edges[LEFT] && !edges[TOP]) {
-diag_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx - 1, ry - 1)) || left_tile_edge || up_tile_edge;
+diag_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx - 1, ry - 1)) || tile_edge[LEFT] || tile_edge[TOP];
 }
 if (!edges[TOP] && !edges[RIGHT]) {
-diag_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx + 1, ry - 1)) || right_tile_edge || up_tile_edge;
+diag_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx + 1, ry - 1)) || tile_edge[RIGHT] || tile_edge[TOP];
 }
 if (!edges[RIGHT] && !edges[BOTTOM]) {
-diag_edge[2] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx + 1, ry + 1)) || right_tile_edge || bottom_tile_edge;
+diag_edge[2] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx + 1, ry + 1)) || tile_edge[RIGHT] || 
tile_edge[BOTTOM];
 }
 if (!edges[LEFT] && !edges[BOTTOM]) {
-diag_edge[3] = 

[FFmpeg-devel] [PATCH 11/14] avcodec/vvcdec: sao, support subpicture

2024-03-18 Thread Nuo Mi
---
 libavcodec/vvc/vvc_filter.c | 40 +
 1 file changed, 27 insertions(+), 13 deletions(-)

diff --git a/libavcodec/vvc/vvc_filter.c b/libavcodec/vvc/vvc_filter.c
index 1a3cd02a9f..6b4c2050c7 100644
--- a/libavcodec/vvc/vvc_filter.c
+++ b/libavcodec/vvc/vvc_filter.c
@@ -166,39 +166,53 @@ void ff_vvc_sao_filter(VVCLocalContext *lc, int x, int y)
 uint8_t horiz_edge[] = { 0, 0 };
 uint8_t diag_edge[]  = { 0, 0, 0, 0 };
 uint8_t tile_edge[]  = { 0, 0, 0, 0 };
+uint8_t subpic_edge[]= { 0, 0, 0, 0 };
+const int subpic_idx = lc->sc->sh.r->curr_subpic_idx;
 const uint8_t lfase  = 
fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag;
 const uint8_t no_tile_filter = fc->ps.pps->r->num_tiles_in_pic > 1 &&

!fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag;
-const uint8_t restore= no_tile_filter || !lfase;
+const uint8_t no_subpic_filter = fc->ps.sps->r->sps_num_subpics_minus1 &&
+!fc->ps.sps->r->sps_loop_filter_across_subpic_enabled_flag[subpic_idx];
+const uint8_t restore= no_subpic_filter || no_tile_filter || 
!lfase;
 
 if (restore) {
 if (!edges[LEFT]) {
-tile_edge[LEFT]  = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] 
== rx;
-vert_edge[0]= (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx - 1, ry)) || tile_edge[LEFT];
+tile_edge[LEFT]   = no_tile_filter && 
fc->ps.pps->ctb_to_col_bd[rx] == rx;
+subpic_edge[LEFT] = no_subpic_filter && 
fc->ps.sps->r->sps_subpic_ctu_top_left_x[subpic_idx] == rx;
+vert_edge[0]  = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx - 1, ry)) || tile_edge[LEFT] || subpic_edge[LEFT];
 }
 if (!edges[RIGHT]) {
-tile_edge[RIGHT] = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] 
!= fc->ps.pps->ctb_to_col_bd[rx + 1];
-vert_edge[1]= (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx + 1, ry)) || tile_edge[RIGHT];
+tile_edge[RIGHT]   = no_tile_filter && 
fc->ps.pps->ctb_to_col_bd[rx] != fc->ps.pps->ctb_to_col_bd[rx + 1];
+subpic_edge[RIGHT] = no_subpic_filter &&
+fc->ps.sps->r->sps_subpic_ctu_top_left_x[subpic_idx] + 
fc->ps.sps->r->sps_subpic_width_minus1[subpic_idx] == rx;
+vert_edge[1]   = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx + 1, ry)) || tile_edge[RIGHT] || subpic_edge[RIGHT];
 }
 if (!edges[TOP]) {
-tile_edge[TOP] = no_tile_filter && 
fc->ps.pps->ctb_to_row_bd[ry] == ry;
-horiz_edge[0]= (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx, ry - 1)) || tile_edge[TOP];
+tile_edge[TOP]   = no_tile_filter && fc->ps.pps->ctb_to_row_bd[ry] 
== ry;
+subpic_edge[TOP] = no_subpic_filter && 
fc->ps.sps->r->sps_subpic_ctu_top_left_y[subpic_idx] == ry;
+horiz_edge[0]= (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx, ry - 1)) || tile_edge[TOP] || subpic_edge[TOP];
 }
 if (!edges[BOTTOM]) {
-tile_edge[BOTTOM] = no_tile_filter && 
fc->ps.pps->ctb_to_row_bd[ry] != fc->ps.pps->ctb_to_row_bd[ry + 1];
-horiz_edge[1]= (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx, ry + 1)) || tile_edge[BOTTOM];
+tile_edge[BOTTOM]   = no_tile_filter && 
fc->ps.pps->ctb_to_row_bd[ry] != fc->ps.pps->ctb_to_row_bd[ry + 1];
+subpic_edge[BOTTOM] = no_subpic_filter &&
+fc->ps.sps->r->sps_subpic_ctu_top_left_y[subpic_idx] + 
fc->ps.sps->r->sps_subpic_height_minus1[subpic_idx] == ry;
+horiz_edge[1]   = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx, ry + 1)) || tile_edge[BOTTOM] || subpic_edge[BOTTOM];
 }
 if (!edges[LEFT] && !edges[TOP]) {
-diag_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx - 1, ry - 1)) || tile_edge[LEFT] || tile_edge[TOP];
+diag_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx - 1, ry - 1)) ||
+tile_edge[LEFT] || tile_edge[TOP] || subpic_edge[LEFT] || 
subpic_edge[TOP];
 }
 if (!edges[TOP] && !edges[RIGHT]) {
-diag_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx + 1, ry - 1)) || tile_edge[RIGHT] || tile_edge[TOP];
+diag_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx + 1, ry - 1)) ||
+tile_edge[RIGHT] || tile_edge[TOP] || subpic_edge[TOP] || 
subpic_edge[RIGHT];
 }
 if (!edges[RIGHT] && !edges[BOTTOM]) {
-diag_edge[2] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != 
CTB(fc->tab.slice_idx, rx + 1, 

[FFmpeg-devel] [PATCH 13/14] avcodec/vvcdec: mvs, support subpicture

2024-03-18 Thread Nuo Mi
---
 libavcodec/vvc/vvc_mvs.c | 33 +
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/libavcodec/vvc/vvc_mvs.c b/libavcodec/vvc/vvc_mvs.c
index cf92202b5b..37a2d0a228 100644
--- a/libavcodec/vvc/vvc_mvs.c
+++ b/libavcodec/vvc/vvc_mvs.c
@@ -200,10 +200,12 @@ static int derive_temporal_colocated_mvs(const 
VVCLocalContext *lc, MvField temp
 static int temporal_luma_motion_vector(const VVCLocalContext *lc,
 const int refIdxLx, Mv *mvLXCol, const int X, int check_center, int 
sb_flag)
 {
-const VVCFrameContext *fc   = lc->fc;
-const VVCSPS *sps   = fc->ps.sps;
-const CodingUnit *cu= lc->cu;
-int x, y, colPic, availableFlagLXCol = 0;
+const VVCFrameContext *fc = lc->fc;
+const VVCSPS *sps = fc->ps.sps;
+const VVCPPS *pps = fc->ps.pps;
+const CodingUnit *cu  = lc->cu;
+const int subpic_idx  = lc->sc->sh.r->curr_subpic_idx;
+int x, y, x_end, y_end, colPic, availableFlagLXCol = 0;
 int min_pu_width = fc->ps.pps->min_pu_width;
 VVCFrame *ref = fc->ref->collocated_ref;
 MvField *tab_mvf;
@@ -224,10 +226,12 @@ static int temporal_luma_motion_vector(const 
VVCLocalContext *lc,
 x = cu->x0 + cu->cb_width;
 y = cu->y0 + cu->cb_height;
 
+x_end = pps->subpic_x[subpic_idx] + pps->subpic_width[subpic_idx];
+y_end = pps->subpic_y[subpic_idx] + pps->subpic_height[subpic_idx];
+
 if (tab_mvf &&
 (cu->y0 >> sps->ctb_log2_size_y) == (y >> sps->ctb_log2_size_y) &&
-y < fc->ps.pps->height &&
-x < fc->ps.pps->width) {
+x < x_end && y < y_end) {
 x &= ~7;
 y &= ~7;
 temp_col   = TAB_MVF(x, y);
@@ -991,13 +995,18 @@ static av_always_inline int compare_pf_ref_idx(const 
MvField *A, const struct Mv
 return 1;
 }
 
-static av_always_inline void sb_clip_location(const VVCFrameContext *fc,
+static av_always_inline void sb_clip_location(const VVCLocalContext *lc,
 const int x_ctb, const int y_ctb, const Mv* temp_mv, int *x, int *y)
 {
-const VVCPPS *pps   = fc->ps.pps;
-const int ctb_log2_size = fc->ps.sps->ctb_log2_size_y;
-*y = av_clip(*y + temp_mv->y, y_ctb, FFMIN(pps->height - 1, y_ctb + (1 << 
ctb_log2_size) - 1)) & ~7;
-*x = av_clip(*x + temp_mv->x, x_ctb, FFMIN(pps->width - 1,  x_ctb + (1 << 
ctb_log2_size) + 3)) & ~7;
+const VVCFrameContext *fc = lc->fc;
+const VVCPPS *pps = fc->ps.pps;
+const int ctb_log2_size   = fc->ps.sps->ctb_log2_size_y;
+const int subpic_idx  = lc->sc->sh.r->curr_subpic_idx;
+const int x_end   = pps->subpic_x[subpic_idx] + 
pps->subpic_width[subpic_idx];
+const int y_end   = pps->subpic_y[subpic_idx] + 
pps->subpic_height[subpic_idx];
+
+*x = av_clip(*x + temp_mv->x, x_ctb, FFMIN(x_end - 1, x_ctb + (1 << 
ctb_log2_size) + 3)) & ~7;
+*y = av_clip(*y + temp_mv->y, y_ctb, FFMIN(y_end - 1, y_ctb + (1 << 
ctb_log2_size) - 1)) & ~7;
 }
 
 static void sb_temproal_luma_motion(const VVCLocalContext *lc,
@@ -1015,7 +1024,7 @@ static void sb_temproal_luma_motion(const VVCLocalContext 
*lc,
 int colPic  = ref->poc;
 int X   = 0;
 
-sb_clip_location(fc, x_ctb, y_ctb, temp_mv, , );
+sb_clip_location(lc, x_ctb, y_ctb, temp_mv, , );
 
 temp_col= TAB_MVF(x, y);
 mvLXCol = mv + 0;
-- 
2.25.1

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

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


[FFmpeg-devel] [PATCH] fftools/ffplay: use correct buffersink channel layout parameters

2024-03-18 Thread Marton Balint
Regression since 0995e1f1b31f6e937a1b527407ed3e850f138098.

Signed-off-by: Marton Balint 
---
 fftools/ffplay.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 09b4846deb..fcd1319ce7 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -2040,6 +2040,8 @@ static int configure_audio_filters(VideoState *is, const 
char *afilters, int for
 goto end;
 
 if (force_output_format) {
+av_bprint_clear();
+av_channel_layout_describe_bprint(>audio_tgt.ch_layout, );
 sample_rates   [0] = is->audio_tgt.freq;
 if ((ret = av_opt_set_int(filt_asink, "all_channel_counts", 0, 
AV_OPT_SEARCH_CHILDREN)) < 0)
 goto end;
-- 
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] [PATCH v2 1/1] avformat/demux: Fix accurate probing of durations in mpegts/ps

2024-03-18 Thread Nicolas Gaullier
Two issues affect accuracy of duration in estimate_timings_from_pts():
- pkt->duration typically reports the duration of a single audio frame,
whereas a pes often contain several audio frames
- for video, compute_frame_duration() use r_frame_rate which is not
reliable; typically, it is the duration of a single field for an
interlaced video using two field pictures.

Packet splitting/parsing is required to get accurate durations, so this
patch replaces ff_read_packet() calls by av_read_frame() calls.

Note that concatdec makes use of avformat_find_stream_info() to stitch
correctly the files, so it benefits from this patch (typically, overlap
is avoided).
e.g. in fate/concat-demuxer-simple2-lavf-ts: the input audio stream
duration is now longer than that of the video, which results in
concatdec joining on audio after the patch instead of joining on video
before that.

Signed-off-by: Nicolas Gaullier 
---
 libavformat/demux.c   |  36 ++--
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 170 +-
 tests/ref/fate/ts-opus-demux  |   4 +-
 3 files changed, 100 insertions(+), 110 deletions(-)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index 4c50eb5568..5b89eb71c9 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -1820,20 +1820,17 @@ static void 
estimate_timings_from_bit_rate(AVFormatContext *ic)
 #define DURATION_MAX_READ_SIZE 25LL
 #define DURATION_MAX_RETRY 6
 
-/* only usable for MPEG-PS streams */
+/* only usable for MPEG-PS/TS streams */
 static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
 {
 FFFormatContext *const si = ffformatcontext(ic);
 AVPacket *const pkt = si->pkt;
-int num, den, read_size, ret;
+int read_size, ret;
 int found_duration = 0;
 int is_end;
 int64_t filesize, offset, duration;
 int retry = 0;
 
-/* flush packet queue */
-ff_flush_packet_queue(ic);
-
 for (unsigned i = 0; i < ic->nb_streams; i++) {
 AVStream *const st  = ic->streams[i];
 FFStream *const sti = ffstream(st);
@@ -1844,10 +1841,13 @@ static void estimate_timings_from_pts(AVFormatContext 
*ic, int64_t old_offset)
 av_log(ic, AV_LOG_WARNING,
"start time for stream %d is not set in 
estimate_timings_from_pts\n", i);
 
-if (sti->parser) {
-av_parser_close(sti->parser);
-sti->parser = NULL;
-}
+/* Demuxer context updates may occur, particularly while seeking in 
mpegts,
+ * and this could loose codec parameters in avctx,
+ * so preserve them in codecpar.
+ */
+if (sti->avctx_inited &&
+avcodec_parameters_from_context(st->codecpar, sti->avctx))
+goto skip_duration_calc;
 }
 
 if (ic->skip_estimate_duration_from_pts) {
@@ -1865,6 +1865,7 @@ static void estimate_timings_from_pts(AVFormatContext 
*ic, int64_t old_offset)
 if (offset < 0)
 offset = 0;
 
+ff_read_frame_flush(ic);
 avio_seek(ic->pb, offset, SEEK_SET);
 read_size = 0;
 for (;;) {
@@ -1874,7 +1875,7 @@ static void estimate_timings_from_pts(AVFormatContext 
*ic, int64_t old_offset)
 break;
 
 do {
-ret = ff_read_packet(ic, pkt);
+ret = av_read_frame(ic, pkt);
 } while (ret == AVERROR(EAGAIN));
 if (ret != 0)
 break;
@@ -1884,15 +1885,6 @@ static void estimate_timings_from_pts(AVFormatContext 
*ic, int64_t old_offset)
 if (pkt->pts != AV_NOPTS_VALUE &&
 (st->start_time != AV_NOPTS_VALUE ||
  sti->first_dts != AV_NOPTS_VALUE)) {
-if (pkt->duration == 0) {
-compute_frame_duration(ic, , , st, sti->parser, 
pkt);
-if (den && num) {
-pkt->duration = av_rescale_rnd(1,
-   num * (int64_t) st->time_base.den,
-   den * (int64_t) st->time_base.num,
-   AV_ROUND_DOWN);
-}
-}
 duration = pkt->pts + pkt->duration;
 found_duration = 1;
 if (st->start_time != AV_NOPTS_VALUE)
@@ -1948,15 +1940,13 @@ skip_duration_calc:
 fill_all_stream_timings(ic);
 
 avio_seek(ic->pb, old_offset, SEEK_SET);
+
+ff_read_frame_flush(ic);
 for (unsigned i = 0; i < ic->nb_streams; i++) {
 AVStream *const st  = ic->streams[i];
 FFStream *const sti = ffstream(st);
 
 sti->cur_dts = sti->first_dts;
-sti->last_IP_pts = AV_NOPTS_VALUE;
-sti->last_dts_for_order_check = AV_NOPTS_VALUE;
-for (int j = 0; j < MAX_REORDER_DELAY + 1; j++)
-sti->pts_buffer[j] = AV_NOPTS_VALUE;
 }
 }
 
diff --git a/tests/ref/fate/concat-demuxer-simple2-lavf-ts 

Re: [FFmpeg-devel] [PATCH] avformat: enable UDP IPv6 multicast interface selection

2024-03-18 Thread Michael Niedermayer
Hi

On Mon, Mar 18, 2024 at 01:45:00PM +, Ignjatović, Lazar (RS)� wrote:
> 
> This message has been marked as Public on 03/18/2024 13:45Z.
> On Thursday, March 14, 2024 10:14 PM, Michael Niedermayer wrote:
> 
> > breaks mingw64 build
> >
> > CC  libavformat/ip.o
> > src/libavformat/ip.c: In function ‘ff_ip_resolve_interface_index’:
> > src/libavformat/ip.c:206:1: error: control reaches end of non-void function 
> > [-Werror=return-type]  }  ^
> > cc1: some warnings being treated as errors
> > src/ffbuild/common.mak:81: recipe for target 'libavformat/ip.o' failed
> > make: *** [libavformat/ip.o] Error 1
> 
> I see the problem, when building for windows without iphlpapi.h, mentioned 
> function has no code within.
> Will account for such case.
> 
> > also configure produces
> > ../configure: 6415: ../configure: network_extralibs+= -liphlpapi: not found
> 
> Problem here is that "+=" operator is a bashism, probably causing the 
> previous error by not including iphlpapi properly.
> 
> Some questions I have:
> Should I send another patch within this thread to address these comments, or 
> should I create a V2 of the patch?
> Also, if creating a V2, should the patch be sent within this thread, or 
> should a new thread be opened?

new patch with "V2"
it can be sent in the same or a new thread, developers are not consistent with
that.

thx

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

There will always be a question for which you do not know the correct answer.


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 2/2] avformat/riffdec: follow the MS docs more strictly for setting wav channel layouts

2024-03-18 Thread Michael Niedermayer
On Sun, Mar 17, 2024 at 08:57:29PM +0100, Marton Balint wrote:
> - Only parse the defined masks in dwChannelMask, unless strict_std_compliance
>   is less than normal. This matches with the behaviour of the wav muxer.
> - Ignore additional bits in dwChannelMasks as the MS documentation suggests 
> [1]
> - Assume UNKNOWN channels for missing bits as the MS documentation suggests 
> [1]
> 
> [1] 
> https://learn.microsoft.com/en-us/previous-versions/windows/hardware/design/dn653308(v=vs.85)#details-about-dwchannelmask
> 
> Signed-off-by: Marton Balint 
> ---
>  libavformat/riffdec.c | 28 +---
>  1 file changed, 25 insertions(+), 3 deletions(-)

breaks:
./ffmpeg  -i ~/tickets/2859/5.1plusdownmix.wav -ac 2 -t 100 -bitexact -c:a aac 
-y /tmp/2859-frenchspeack-nolibfaac.mp4

thx

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

There will always be a question for which you do not know the correct answer.


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] lavu/hwcontext_vulkan: check PCI ID if possible

2024-03-18 Thread Xiang, Haihao
On Ma, 2024-03-18 at 18:41 +0100, Lynne wrote:
> Mar 18, 2024, 08:27 by haihao.xiang-at-intel@ffmpeg.org:
> 
> > From: Haihao Xiang 
> > 
> > Otherwise the derived device and the source device might have different
> > PCI ID in a multiple-device system.
> > 
> > Signed-off-by: Haihao Xiang 
> > ---
> >  libavutil/hwcontext_vulkan.c | 30 +++---
> >  1 file changed, 23 insertions(+), 7 deletions(-)
> > 
> > diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
> > index 855f099e26..91b9f96ccf 100644
> > --- a/libavutil/hwcontext_vulkan.c
> > +++ b/libavutil/hwcontext_vulkan.c
> > @@ -1597,15 +1597,31 @@ static int vulkan_device_derive(AVHWDeviceContext
> > *ctx,
> >  #if CONFIG_VAAPI
> >  case AV_HWDEVICE_TYPE_VAAPI: {
> >  AVVAAPIDeviceContext *src_hwctx = src_ctx->hwctx;
> > +    VADisplay dpy = src_hwctx->display;
> > +#if VA_CHECK_VERSION(1, 15, 0)
> > +    VAStatus vas;
> > +    VADisplayAttribute attr = {
> > +    .type = VADisplayPCIID,
> > +    };
> > +#endif
> > +    const char *vendor;
> >  
> > -    const char *vendor = vaQueryVendorString(src_hwctx->display);
> > -    if (!vendor) {
> > -    av_log(ctx, AV_LOG_ERROR, "Unable to get device info from
> > VAAPI!\n");
> > -    return AVERROR_EXTERNAL;
> > -    }
> > +#if VA_CHECK_VERSION(1, 15, 0)
> > +    vas = vaGetDisplayAttributes(dpy, , 1);
> > +    if (vas == VA_STATUS_SUCCESS && attr.flags !=
> > VA_DISPLAY_ATTRIB_NOT_SUPPORTED)
> > +    dev_select.pci_device = (attr.value & 0x);
> > +#endif
> > +
> > +    if (!dev_select.pci_device) {
> > +    vendor = vaQueryVendorString(dpy);
> > +    if (!vendor) {
> > +    av_log(ctx, AV_LOG_ERROR, "Unable to get device info from
> > VAAPI!\n");
> > +    return AVERROR_EXTERNAL;
> > +    }
> >  
> > -    if (strstr(vendor, "AMD"))
> > -    dev_select.vendor_id = 0x1002;
> > +    if (strstr(vendor, "AMD"))
> > +    dev_select.vendor_id = 0x1002;
> > 
> 
> LGTM

Thanks for reviewing the patch, pushed.

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".


Re: [FFmpeg-devel] [PATCH] doc/fate: advise on --assert-level=2

2024-03-18 Thread Michael Niedermayer
On Tue, Mar 12, 2024 at 01:09:20PM +0100, Nicolas Gaullier wrote:
> Signed-off-by: Nicolas Gaullier 
> ---
>  doc/fate.texi | 8 
>  1 file changed, 8 insertions(+)

will apply

thx

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

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch


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 v3 2/2] lavc/get_buffer: Add a warning on failed allocation from a fixed pool

2024-03-18 Thread Mark Thompson

On 18/03/2024 05:53, Xiang, Haihao wrote:

On So, 2024-03-17 at 20:51 +, Mark Thompson wrote:

For hardware cases where we are forced to have a fixed pool of frames
allocated up-front (such as array textures on decoder output), suggest
a possible workaround to the user if an allocation fails because the
pool is exhausted.
---
Perhaps helpful; any thoughts?

The warning comes out before any errors, looking like:

[mpeg2video @ 0x560ff51b4600] Failed to allocate a vaapi/nv12 frame from a
fixed pool of hardware frames.
[mpeg2video @ 0x560ff51b4600] Consider setting extra_hw_frames to a larger
value (currently set to 8, giving a pool size of 14).
[mpeg2video @ 0x560ff51b4600] get_buffer() failed
[vist#0:0/mpeg2video @ 0x560ff5199840] [dec:mpeg2video @ 0x560ff51b3b40] Error
submitting packet to decoder: Operation not permitted


I'm OK to print such warning so user may know how to work around it. But now
many cases are impacted by this error (e.g. https://trac.ffmpeg.org/ticket/10856
), I think it is a regression to user. I still prefer to use a dynamic buffer
pool instead fixed frame pool to avoid such error when the dynamic buffer pool
can work.


How would we implement this on D3D11 or D3D12?

A way of doing the second in particular would be very useful, because the 
current decoder only works on a subset of drivers which don't require array 
textures.

Thanks,

- Mark
___
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 v10 14/14] avcodec/libx265: add support for writing out CLL and MDCV

2024-03-18 Thread Jan Ekström
The newer of these two are the separate integers for content light
level, introduced in 3952bf3e98c76c31594529a3fe34e056d3e3e2ea ,
with X265_BUILD 75. As we already require X265_BUILD of at least
89, no further conditions are required.
---
 libavcodec/libx265.c | 89 
 tests/fate/enc_external.mak  |  5 ++
 tests/ref/fate/libx265-hdr10 | 16 +++
 3 files changed, 110 insertions(+)
 create mode 100644 tests/ref/fate/libx265-hdr10

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 92183b9ca2..70ec6d3539 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -28,9 +28,11 @@
 #include 
 
 #include "libavutil/avassert.h"
+#include "libavutil/bprint.h"
 #include "libavutil/buffer.h"
 #include "libavutil/internal.h"
 #include "libavutil/common.h"
+#include "libavutil/mastering_display_metadata.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 #include "avcodec.h"
@@ -176,6 +178,86 @@ static av_cold int libx265_param_parse_int(AVCodecContext 
*avctx,
 return 0;
 }
 
+static int handle_mdcv(const AVClass **avcl, const x265_api *api,
+   x265_param *params,
+   const AVMasteringDisplayMetadata *mdcv)
+{
+int ret = AVERROR_BUG;
+AVBPrint buf;
+av_bprint_init(, 0, AV_BPRINT_SIZE_AUTOMATIC);
+
+// G(%hu,%hu)B(%hu,%hu)R(%hu,%hu)WP(%hu,%hu)L(%u,%u)
+av_bprintf(
+,
+"G(%"PRId64",%"PRId64")B(%"PRId64",%"PRId64")R(%"PRId64",%"PRId64")"
+"WP(%"PRId64",%"PRId64")L(%"PRId64",%"PRId64")",
+av_rescale_q(1, mdcv->display_primaries[1][0], (AVRational){ 1, 5 
}),
+av_rescale_q(1, mdcv->display_primaries[1][1], (AVRational){ 1, 5 
}),
+av_rescale_q(1, mdcv->display_primaries[2][0], (AVRational){ 1, 5 
}),
+av_rescale_q(1, mdcv->display_primaries[2][1], (AVRational){ 1, 5 
}),
+av_rescale_q(1, mdcv->display_primaries[0][0], (AVRational){ 1, 5 
}),
+av_rescale_q(1, mdcv->display_primaries[0][1], (AVRational){ 1, 5 
}),
+av_rescale_q(1, mdcv->white_point[0], (AVRational){ 1, 5 }),
+av_rescale_q(1, mdcv->white_point[1], (AVRational){ 1, 5 }),
+av_rescale_q(1, mdcv->max_luminance,  (AVRational){ 1, 1 }),
+av_rescale_q(1, mdcv->min_luminance,  (AVRational){ 1, 1 }));
+
+if (!av_bprint_is_complete()) {
+av_log(avcl, AV_LOG_ERROR,
+  "MDCV string too long for its available space!\n");
+ret = AVERROR(ENOMEM);
+goto end;
+}
+
+if (api->param_parse(params, "master-display", buf.str) ==
+X265_PARAM_BAD_VALUE) {
+av_log(avcl, AV_LOG_ERROR,
+   "Invalid value \"%s\" for param \"master-display\".\n",
+   buf.str);
+ret = AVERROR(EINVAL);
+goto end;
+}
+
+ret = 0;
+
+end:
+av_bprint_finalize(, NULL);
+
+return ret;
+}
+
+static int handle_side_data(AVCodecContext *avctx, const x265_api *api,
+x265_param *params)
+{
+const AVFrameSideData *cll_sd =
+av_frame_side_data_get(
+(const AVFrameSideData **)avctx->decoded_side_data,
+avctx->nb_decoded_side_data, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
+const AVFrameSideData *mdcv_sd =
+av_frame_side_data_get(
+(const AVFrameSideData **)avctx->decoded_side_data,
+avctx->nb_decoded_side_data,
+AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
+
+if (cll_sd) {
+const AVContentLightMetadata *cll =
+(AVContentLightMetadata *)cll_sd->data;
+
+params->maxCLL  = cll->MaxCLL;
+params->maxFALL = cll->MaxFALL;
+}
+
+if (mdcv_sd) {
+int ret = handle_mdcv(
+>av_class, api, params,
+(AVMasteringDisplayMetadata *)mdcv_sd->data);
+if (ret < 0)
+return ret;
+}
+
+return 0;
+}
+
 static av_cold int libx265_encode_init(AVCodecContext *avctx)
 {
 libx265Context *ctx = avctx->priv_data;
@@ -336,6 +418,13 @@ FF_ENABLE_DEPRECATION_WARNINGS
 return AVERROR_BUG;
 }
 
+ret = handle_side_data(avctx, ctx->api, ctx->params);
+if (ret < 0) {
+av_log(avctx, AV_LOG_ERROR, "Failed handling side data! (%s)\n",
+   av_err2str(ret));
+return ret;
+}
+
 if (ctx->crf >= 0) {
 char crf[6];
 
diff --git a/tests/fate/enc_external.mak b/tests/fate/enc_external.mak
index 4095a4b51a..30021efbcd 100644
--- a/tests/fate/enc_external.mak
+++ b/tests/fate/enc_external.mak
@@ -12,5 +12,10 @@ FATE_ENC_EXTERNAL-$(call ENCDEC, LIBX264 HEVC, MOV, 
LIBX264_HDR10 HEVC_DEMUXER H
 fate-libx264-hdr10: CMD = enc_external 
$(TARGET_SAMPLES)/hevc/hdr10_plus_h265_sample.hevc \
 mp4 "-c:v libx264" "-show_frames -show_entries frame=side_data_list -of 
flat"
 
+# test for x265 MDCV and CLL passthrough during encoding
+FATE_ENC_EXTERNAL-$(call ENCDEC, LIBX265 HEVC, MOV, HEVC_DEMUXER) += 

[FFmpeg-devel] [PATCH v10 13/14] avcodec/libx264: add support for writing out CLL and MDCV

2024-03-18 Thread Jan Ekström
Both of these two structures were first available with X264_BUILD
163, so make relevant functionality conditional on the version
being at least such.

Keep handle_side_data available in all cases as this way X264_init
does not require additional version based conditions within it.

Finally, add a FATE test which verifies that pass-through of the
MDCV/CLL side data is working during encoding.
---
 configure|  2 +
 libavcodec/libx264.c | 80 
 tests/fate/enc_external.mak  |  5 +++
 tests/ref/fate/libx264-hdr10 | 15 +++
 4 files changed, 102 insertions(+)
 create mode 100644 tests/ref/fate/libx264-hdr10

diff --git a/configure b/configure
index 2b4c4ec9a2..44be4ef819 100755
--- a/configure
+++ b/configure
@@ -2531,6 +2531,7 @@ CONFIG_EXTRA="
 jpegtables
 lgplv3
 libx262
+libx264_hdr10
 llauddsp
 llviddsp
 llvidencdsp
@@ -6925,6 +6926,7 @@ enabled libx264   && require_pkg_config libx264 
x264 "stdint.h x264.h" x
  require_cpp_condition libx264 x264.h "X264_BUILD 
>= 122" && {
  [ "$toolchain" != "msvc" ] ||
  require_cpp_condition libx264 x264.h "X264_BUILD 
>= 158"; } &&
+ check_cpp_condition libx264_hdr10 x264.h 
"X264_BUILD >= 163" &&
  check_cpp_condition libx262 x264.h "X264_MPEG2"
 enabled libx265   && require_pkg_config libx265 x265 x265.h 
x265_api_get &&
  require_cpp_condition libx265 x265.h "X265_BUILD 
>= 89"
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 0997c4e134..4804dae6e9 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -25,6 +25,7 @@
 #include "libavutil/eval.h"
 #include "libavutil/internal.h"
 #include "libavutil/opt.h"
+#include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mem.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/stereo3d.h"
@@ -853,6 +854,83 @@ static int convert_pix_fmt(enum AVPixelFormat pix_fmt)
 return AVERROR(EINVAL);\
 }
 
+#if CONFIG_LIBX264_HDR10
+static void handle_mdcv(x264_param_t *params,
+const AVMasteringDisplayMetadata *mdcv)
+{
+if (!mdcv->has_primaries && !mdcv->has_luminance)
+return;
+
+params->mastering_display.b_mastering_display = 1;
+
+if (mdcv->has_primaries) {
+int *const points[][2] = {
+{
+>mastering_display.i_red_x,
+>mastering_display.i_red_y
+},
+{
+>mastering_display.i_green_x,
+>mastering_display.i_green_y
+},
+{
+>mastering_display.i_blue_x,
+>mastering_display.i_blue_y
+},
+};
+
+for (int i = 0; i < 3; i++) {
+const AVRational *src = mdcv->display_primaries[i];
+int *dst[2] = { points[i][0], points[i][1] };
+
+*dst[0] = av_rescale_q(1, src[0], (AVRational){ 1, 5 });
+*dst[1] = av_rescale_q(1, src[1], (AVRational){ 1, 5 });
+}
+
+params->mastering_display.i_white_x =
+av_rescale_q(1, mdcv->white_point[0], (AVRational){ 1, 5 });
+params->mastering_display.i_white_y =
+av_rescale_q(1, mdcv->white_point[1], (AVRational){ 1, 5 });
+}
+
+if (mdcv->has_luminance) {
+params->mastering_display.i_display_max =
+av_rescale_q(1, mdcv->max_luminance, (AVRational){ 1, 1 });
+params->mastering_display.i_display_min =
+av_rescale_q(1, mdcv->min_luminance, (AVRational){ 1, 1 });
+}
+}
+#endif // CONFIG_LIBX264_HDR10
+
+static void handle_side_data(AVCodecContext *avctx, x264_param_t *params)
+{
+#if CONFIG_LIBX264_HDR10
+const AVFrameSideData *cll_sd =
+av_frame_side_data_get(
+(const AVFrameSideData **)avctx->decoded_side_data,
+avctx->nb_decoded_side_data, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
+const AVFrameSideData *mdcv_sd =
+av_frame_side_data_get(
+(const AVFrameSideData **)avctx->decoded_side_data,
+avctx->nb_decoded_side_data,
+AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
+
+if (cll_sd) {
+const AVContentLightMetadata *cll =
+(AVContentLightMetadata *)cll_sd->data;
+
+params->content_light_level.i_max_cll  = cll->MaxCLL;
+params->content_light_level.i_max_fall = cll->MaxFALL;
+
+params->content_light_level.b_cll = 1;
+}
+
+if (mdcv_sd) {
+handle_mdcv(params, (AVMasteringDisplayMetadata *)mdcv_sd->data);
+}
+#endif // CONFIG_LIBX264_HDR10
+}
+
 static av_cold int X264_init(AVCodecContext *avctx)
 {
 X264Context *x4 = avctx->priv_data;
@@ -1153,6 +1231,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
 if (avctx->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED)
 

[FFmpeg-devel] [PATCH v10 12/14] avcodec/libsvtav1: add support for writing out CLL and MDCV

2024-03-18 Thread Jan Ekström
These two were added in 28e23d7f348c78d49a726c7469f9d4e38edec341
and 3558c1f2e97455e0b89edef31b9a72ab7fa30550 for version 0.9.0 of
SVT-AV1, which is also our minimum requirement right now.

In other words, no additional version limiting conditions seem
to be required.

Additionally, add a FATE test which verifies that pass-through of
the MDCV/CLL side data is working during encoding.
---
 libavcodec/libsvtav1.c | 69 ++
 tests/fate/enc_external.mak|  5 +++
 tests/ref/fate/libsvtav1-hdr10 | 14 +++
 3 files changed, 88 insertions(+)
 create mode 100644 tests/ref/fate/libsvtav1-hdr10

diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index 7721e01677..6400a6507a 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -27,6 +27,8 @@
 #include "libavutil/common.h"
 #include "libavutil/frame.h"
 #include "libavutil/imgutils.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mastering_display_metadata.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/avassert.h"
@@ -136,6 +138,71 @@ static int alloc_buffer(EbSvtAv1EncConfiguration *config, 
SvtContext *svt_enc)
 
 }
 
+static void handle_mdcv(struct EbSvtAv1MasteringDisplayInfo *dst,
+const AVMasteringDisplayMetadata *mdcv)
+{
+if (mdcv->has_primaries) {
+const struct EbSvtAv1ChromaPoints *const points[] = {
+>r,
+>g,
+>b,
+};
+
+for (int i = 0; i < 3; i++) {
+const struct EbSvtAv1ChromaPoints *dst = points[i];
+const AVRational *src = mdcv->display_primaries[i];
+
+AV_WB16(>x,
+av_rescale_q(1, src[0], (AVRational){ 1, (1 << 16) }));
+AV_WB16(>y,
+av_rescale_q(1, src[1], (AVRational){ 1, (1 << 16) }));
+}
+
+AV_WB16(>white_point.x,
+av_rescale_q(1, mdcv->white_point[0],
+ (AVRational){ 1, (1 << 16) }));
+AV_WB16(>white_point.y,
+av_rescale_q(1, mdcv->white_point[1],
+ (AVRational){ 1, (1 << 16) }));
+}
+
+if (mdcv->has_luminance) {
+AV_WB32(>max_luma,
+av_rescale_q(1, mdcv->max_luminance,
+ (AVRational){ 1, (1 << 8) }));
+AV_WB32(>min_luma,
+av_rescale_q(1, mdcv->min_luminance,
+ (AVRational){ 1, (1 << 14) }));
+}
+}
+
+static void handle_side_data(AVCodecContext *avctx,
+ EbSvtAv1EncConfiguration *param)
+{
+const AVFrameSideData *cll_sd =
+av_frame_side_data_get(
+(const AVFrameSideData **)avctx->decoded_side_data,
+avctx->nb_decoded_side_data, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
+const AVFrameSideData *mdcv_sd =
+av_frame_side_data_get(
+(const AVFrameSideData **)avctx->decoded_side_data,
+avctx->nb_decoded_side_data,
+AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
+
+if (cll_sd) {
+const AVContentLightMetadata *cll =
+(AVContentLightMetadata *)cll_sd->data;
+
+AV_WB16(>content_light_level.max_cll, cll->MaxCLL);
+AV_WB16(>content_light_level.max_fall, cll->MaxFALL);
+}
+
+if (mdcv_sd) {
+handle_mdcv(>mastering_display,
+(AVMasteringDisplayMetadata *)mdcv_sd->data);
+}
+}
+
 static int config_enc_params(EbSvtAv1EncConfiguration *param,
  AVCodecContext *avctx)
 {
@@ -254,6 +321,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
 /* 2 = IDR, closed GOP, 1 = CRA, open GOP */
 param->intra_refresh_type = avctx->flags & AV_CODEC_FLAG_CLOSED_GOP ? 2 : 
1;
 
+handle_side_data(avctx, param);
+
 #if SVT_AV1_CHECK_VERSION(0, 9, 1)
 while ((en = av_dict_get(svt_enc->svtav1_opts, "", en, 
AV_DICT_IGNORE_SUFFIX))) {
 EbErrorType ret = svt_av1_enc_parse_parameter(param, en->key, 
en->value);
diff --git a/tests/fate/enc_external.mak b/tests/fate/enc_external.mak
index 7eabebcc51..d787941c16 100644
--- a/tests/fate/enc_external.mak
+++ b/tests/fate/enc_external.mak
@@ -2,5 +2,10 @@ FATE_ENC_EXTERNAL-$(call ENCDEC, LIBX264 H264, MOV, 
H264_DEMUXER) += fate-libx26
 fate-libx264-simple: CMD = enc_external 
$(TARGET_SAMPLES)/h264-conformance/BA1_Sony_D.jsv \
 mp4 "-c:v libx264" "-show_entries frame=width,height,pix_fmt,pts,pkt_dts 
-of flat"
 
+# test for SVT-AV1 MDCV and CLL passthrough during encoding
+FATE_ENC_EXTERNAL-$(call ENCDEC, LIBSVTAV1 HEVC, MOV, HEVC_DEMUXER 
LIBDAV1D_DECODER) += fate-libsvtav1-hdr10
+fate-libsvtav1-hdr10: CMD = enc_external 
$(TARGET_SAMPLES)/hevc/hdr10_plus_h265_sample.hevc \
+mp4 "-c:v libsvtav1" "-show_frames -show_entries frame=side_data_list -of 
flat"
+
 FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_ENC_EXTERNAL-yes)
 fate-enc-external: $(FATE_ENC_EXTERNAL-yes)
diff --git a/tests/ref/fate/libsvtav1-hdr10 

[FFmpeg-devel] [PATCH v10 11/14] ffmpeg: pass first video AVFrame's side data to encoder

2024-03-18 Thread Jan Ekström
This enables further configuration of output based on the results
of input decoding and filtering in a similar manner as the color
information.
---
 fftools/ffmpeg_enc.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index c9a12af139..f01be1c22f 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -246,6 +246,21 @@ int enc_open(void *opaque, const AVFrame *frame)
 enc_ctx->colorspace = frame->colorspace;
 enc_ctx->chroma_sample_location = frame->chroma_location;
 
+for (int i = 0; i < frame->nb_side_data; i++) {
+ret = av_frame_side_data_clone(
+_ctx->decoded_side_data, _ctx->nb_decoded_side_data,
+frame->side_data[i], AV_FRAME_SIDE_DATA_FLAG_UNIQUE);
+if (ret < 0) {
+av_frame_side_data_free(
+_ctx->decoded_side_data,
+_ctx->nb_decoded_side_data);
+av_log(NULL, AV_LOG_ERROR,
+"failed to configure video encoder: %s!\n",
+av_err2str(ret));
+return ret;
+}
+}
+
 if (enc_ctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT | 
AV_CODEC_FLAG_INTERLACED_ME) ||
 (frame->flags & AV_FRAME_FLAG_INTERLACED)
 #if FFMPEG_OPT_TOP
-- 
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 v10 10/14] avcodec: add frame side data array to AVCodecContext

2024-03-18 Thread Jan Ekström
This allows configuring an encoder by using AVFrameSideData.
---
 doc/APIchanges   |  3 +++
 libavcodec/avcodec.h | 13 +
 libavcodec/options.c |  2 ++
 libavcodec/version.h |  4 ++--
 4 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 4f906432d5..a025f1df14 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07
 
 API changes, most recent first:
 
+2024-03-xx - xx - lavc 61.2.100 - avcodec.h
+  Add AVCodecContext.[nb_]decoded_side_data.
+
 2024-03-xx - xx - lavu 59.3.100 - frame.h
   Add av_frame_side_data_free(), av_frame_side_data_new(),
   av_frame_side_data_clone(), av_frame_side_data_get() as well
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 554501aa44..83dc487251 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2062,6 +2062,19 @@ typedef struct AVCodecContext {
  * Number of entries in side_data_prefer_packet.
  */
 unsigned nb_side_data_prefer_packet;
+
+/**
+ * Array containing static side data, such as HDR10 CLL / MDCV structures.
+ * Side data entries should be allocated by usage of helpers defined in
+ * libavutil/frame.h.
+ *
+ * - encoding: may be set by user before calling avcodec_open2() for
+ * encoder configuration. Afterwards owned and freed by the
+ * encoder.
+ * - decoding: unused
+ */
+AVFrameSideData  **decoded_side_data;
+int nb_decoded_side_data;
 } AVCodecContext;
 
 /**
diff --git a/libavcodec/options.c b/libavcodec/options.c
index dcc67e497a..5169f2e476 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -176,6 +176,8 @@ void avcodec_free_context(AVCodecContext **pavctx)
 av_freep(>inter_matrix);
 av_freep(>rc_override);
 av_channel_layout_uninit(>ch_layout);
+av_frame_side_data_free(
+>decoded_side_data, >nb_decoded_side_data);
 
 av_freep(pavctx);
 }
diff --git a/libavcodec/version.h b/libavcodec/version.h
index b4616ccc27..0550d7b0d8 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,8 +29,8 @@
 
 #include "version_major.h"
 
-#define LIBAVCODEC_VERSION_MINOR   1
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MINOR   2
+#define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
-- 
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] lavu/hwcontext_vulkan: check PCI ID if possible

2024-03-18 Thread Lynne
Mar 18, 2024, 08:27 by haihao.xiang-at-intel@ffmpeg.org:

> From: Haihao Xiang 
>
> Otherwise the derived device and the source device might have different
> PCI ID in a multiple-device system.
>
> Signed-off-by: Haihao Xiang 
> ---
>  libavutil/hwcontext_vulkan.c | 30 +++---
>  1 file changed, 23 insertions(+), 7 deletions(-)
>
> diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
> index 855f099e26..91b9f96ccf 100644
> --- a/libavutil/hwcontext_vulkan.c
> +++ b/libavutil/hwcontext_vulkan.c
> @@ -1597,15 +1597,31 @@ static int vulkan_device_derive(AVHWDeviceContext 
> *ctx,
>  #if CONFIG_VAAPI
>  case AV_HWDEVICE_TYPE_VAAPI: {
>  AVVAAPIDeviceContext *src_hwctx = src_ctx->hwctx;
> +VADisplay dpy = src_hwctx->display;
> +#if VA_CHECK_VERSION(1, 15, 0)
> +VAStatus vas;
> +VADisplayAttribute attr = {
> +.type = VADisplayPCIID,
> +};
> +#endif
> +const char *vendor;
>  
> -const char *vendor = vaQueryVendorString(src_hwctx->display);
> -if (!vendor) {
> -av_log(ctx, AV_LOG_ERROR, "Unable to get device info from 
> VAAPI!\n");
> -return AVERROR_EXTERNAL;
> -}
> +#if VA_CHECK_VERSION(1, 15, 0)
> +vas = vaGetDisplayAttributes(dpy, , 1);
> +if (vas == VA_STATUS_SUCCESS && attr.flags != 
> VA_DISPLAY_ATTRIB_NOT_SUPPORTED)
> +dev_select.pci_device = (attr.value & 0x);
> +#endif
> +
> +if (!dev_select.pci_device) {
> +vendor = vaQueryVendorString(dpy);
> +if (!vendor) {
> +av_log(ctx, AV_LOG_ERROR, "Unable to get device info from 
> VAAPI!\n");
> +return AVERROR_EXTERNAL;
> +}
>  
> -if (strstr(vendor, "AMD"))
> -dev_select.vendor_id = 0x1002;
> +if (strstr(vendor, "AMD"))
> +dev_select.vendor_id = 0x1002;
>

LGTM
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] avformat/rcwtdec: add RCWT Closed Captions demuxer

2024-03-18 Thread Marth64
Bump on this small demuxer if possible. v4 in the last reply. Thank you.
___
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 v3 1/2] lavc/vaapi_encode_h265: Map HEVC AV REXT profile to VA REXT profile

2024-03-18 Thread Mark Thompson

On 18/03/2024 04:21, fei.w.wang-at-intel@ffmpeg.org wrote:

From: Fei Wang 

There is no Main8/10 profile defined in HEVC REXT profiles. Use Main12
which is compatible with 8/10bit.

Signed-off-by: Fei Wang 
---
  libavcodec/vaapi_encode_h265.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index c4aabbf5ed..43755e2188 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -1305,12 +1305,12 @@ static av_cold int 
vaapi_encode_h265_configure(AVCodecContext *avctx)
  
  static const VAAPIEncodeProfile vaapi_encode_h265_profiles[] = {

  { AV_PROFILE_HEVC_MAIN, 8, 3, 1, 1, VAProfileHEVCMain   },
-{ AV_PROFILE_HEVC_REXT, 8, 3, 1, 1, VAProfileHEVCMain   },
  #if VA_CHECK_VERSION(0, 37, 0)
  { AV_PROFILE_HEVC_MAIN_10, 10, 3, 1, 1, VAProfileHEVCMain10 },
-{ AV_PROFILE_HEVC_REXT,10, 3, 1, 1, VAProfileHEVCMain10 },
  #endif
  #if VA_CHECK_VERSION(1, 2, 0)
+{ AV_PROFILE_HEVC_REXT, 8, 3, 1, 1, VAProfileHEVCMain12 },
+{ AV_PROFILE_HEVC_REXT,10, 3, 1, 1, VAProfileHEVCMain12 },
  { AV_PROFILE_HEVC_REXT,12, 3, 1, 1, VAProfileHEVCMain12 },
  { AV_PROFILE_HEVC_REXT, 8, 3, 1, 0, VAProfileHEVCMain422_10 },
  { AV_PROFILE_HEVC_REXT,10, 3, 1, 0, VAProfileHEVCMain422_10 },


What are you actually trying to do here?

See 61aea246627787e80edd1f2eae01df63688dda68: these allow support for the Main 
Intra and Main 10 Intra profiles using Main and Main 10 encoders respectively 
(since they need not use any additional rext features).

Changing this to require a Main 12 encoder and marking the streams as requiring 
such a Main 12 decoder to decode when they don't does not seem helpful.

Thanks,

- Mark
___
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 v10 06/14] avutil/frame: add helper for adding existing side data to array

2024-03-18 Thread Jan Ekström
---
 libavutil/frame.c | 49 +++
 libavutil/frame.h | 20 +++
 2 files changed, 69 insertions(+)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index e4c2fa4f6a..9d3eae4bae 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -98,6 +98,23 @@ static void remove_side_data(AVFrameSideData ***sd, int 
*nb_side_data,
 }
 }
 
+static void remove_side_data_by_entry(AVFrameSideData ***sd, int *nb_sd,
+  const AVFrameSideData *target)
+{
+for (int i = *nb_sd - 1; i >= 0; i--) {
+AVFrameSideData *entry = ((*sd)[i]);
+if (entry != target)
+continue;
+
+free_side_data();
+
+((*sd)[i]) = ((*sd)[*nb_sd - 1]);
+(*nb_sd)--;
+
+return;
+}
+}
+
 AVFrame *av_frame_alloc(void)
 {
 AVFrame *frame = av_malloc(sizeof(*frame));
@@ -764,6 +781,38 @@ AVFrameSideData *av_frame_side_data_new(AVFrameSideData 
***sd, int *nb_sd,
 return ret;
 }
 
+int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd,
+ const AVFrameSideData *src, unsigned int flags)
+{
+AVBufferRef *buf= NULL;
+AVFrameSideData *sd_dst = NULL;
+int  ret= AVERROR_BUG;
+
+if (!sd || !src || !nb_sd || (*nb_sd && !*sd))
+return AVERROR(EINVAL);
+
+buf = av_buffer_ref(src->buf);
+if (!buf)
+return AVERROR(ENOMEM);
+
+if (flags & AV_FRAME_SIDE_DATA_FLAG_UNIQUE)
+remove_side_data(sd, nb_sd, src->type);
+
+sd_dst = add_side_data_from_buf(sd, nb_sd, src->type, buf);
+if (!sd_dst) {
+av_buffer_unref();
+return AVERROR(ENOMEM);
+}
+
+ret = av_dict_copy(_dst->metadata, src->metadata, 0);
+if (ret < 0) {
+remove_side_data_by_entry(sd, nb_sd, sd_dst);
+return ret;
+}
+
+return 0;
+}
+
 AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
 enum AVFrameSideDataType type)
 {
diff --git a/libavutil/frame.h b/libavutil/frame.h
index 5d68d1e7af..ce93421d60 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -1021,6 +1021,26 @@ AVFrameSideData *av_frame_side_data_new(AVFrameSideData 
***sd, int *nb_sd,
 enum AVFrameSideDataType type,
 size_t size, unsigned int flags);
 
+/**
+ * Add a new side data entry to an array based on existing side data, taking
+ * a reference towards the contained AVBufferRef.
+ *
+ * @param sdpointer to array of side data to which to add another entry,
+ *  or to NULL in order to start a new array.
+ * @param nb_sd pointer to an integer containing the number of entries in
+ *  the array.
+ * @param src   side data to be cloned, with a new reference utilized
+ *  for the buffer.
+ * @param flags Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0.
+ *
+ * @return negative error code on failure, >=0 on success. In case of
+ * AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of matching
+ * AVFrameSideDataType will be removed before the addition is
+ * attempted.
+ */
+int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd,
+ const AVFrameSideData *src, unsigned int flags);
+
 /**
  * @}
  */
-- 
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 v10 05/14] avutil/frame: add helper for adding side data to array

2024-03-18 Thread Jan Ekström
Additionally, add an API test to check that the no-duplicates
addition works after duplicates have been inserted.
---
 libavutil/Makefile|   1 +
 libavutil/frame.c |  17 +
 libavutil/frame.h |  22 +++
 libavutil/tests/side_data_array.c | 103 ++
 tests/fate/libavutil.mak  |   4 ++
 tests/ref/fate/side_data_array|  14 
 6 files changed, 161 insertions(+)
 create mode 100644 libavutil/tests/side_data_array.c
 create mode 100644 tests/ref/fate/side_data_array

diff --git a/libavutil/Makefile b/libavutil/Makefile
index e7709b97d0..008fcfcd9c 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -271,6 +271,7 @@ TESTPROGS = adler32 
\
 ripemd  \
 sha \
 sha512  \
+side_data_array \
 softfloat   \
 tree\
 twofish \
diff --git a/libavutil/frame.c b/libavutil/frame.c
index 2a319adb86..e4c2fa4f6a 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -747,6 +747,23 @@ AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
 return ret;
 }
 
+AVFrameSideData *av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd,
+enum AVFrameSideDataType type,
+size_t size, unsigned int flags)
+{
+AVBufferRef *buf = av_buffer_alloc(size);
+AVFrameSideData *ret = NULL;
+
+if (flags & AV_FRAME_SIDE_DATA_FLAG_UNIQUE)
+remove_side_data(sd, nb_sd, type);
+
+ret = add_side_data_from_buf(sd, nb_sd, type, buf);
+if (!ret)
+av_buffer_unref();
+
+return ret;
+}
+
 AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
 enum AVFrameSideDataType type)
 {
diff --git a/libavutil/frame.h b/libavutil/frame.h
index 27281c168f..5d68d1e7af 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -999,6 +999,28 @@ const char *av_frame_side_data_name(enum 
AVFrameSideDataType type);
  */
 void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd);
 
+#define AV_FRAME_SIDE_DATA_FLAG_UNIQUE (1 << 0)
+
+/**
+ * Add new side data entry to an array.
+ *
+ * @param sdpointer to array of side data to which to add another entry,
+ *  or to NULL in order to start a new array.
+ * @param nb_sd pointer to an integer containing the number of entries in
+ *  the array.
+ * @param type  type of the added side data
+ * @param size  size of the side data
+ * @param flags Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0.
+ *
+ * @return newly added side data on success, NULL on error. In case of
+ * AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of matching
+ * AVFrameSideDataType will be removed before the addition is
+ * attempted.
+ */
+AVFrameSideData *av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd,
+enum AVFrameSideDataType type,
+size_t size, unsigned int flags);
+
 /**
  * @}
  */
diff --git a/libavutil/tests/side_data_array.c 
b/libavutil/tests/side_data_array.c
new file mode 100644
index 00..793a62c009
--- /dev/null
+++ b/libavutil/tests/side_data_array.c
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2023 Jan Ekström 
+ *
+ * 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 
+#include "libavutil/frame.c"
+#include "libavutil/mastering_display_metadata.h"
+
+static void print_clls(const AVFrameSideData **sd, const int nb_sd)
+{
+for (int i = 0; i < nb_sd; i++) {
+const AVFrameSideData *entry = sd[i];
+
+printf("sd %d, %s",
+   i, av_frame_side_data_name(entry->type));
+
+if (entry->type != AV_FRAME_DATA_CONTENT_LIGHT_LEVEL) {
+putchar('\n');
+

[FFmpeg-devel] [PATCH v10 07/14] avutil/frame: add helper for adding side data w/ AVBufferRef to array

2024-03-18 Thread Jan Ekström
This was requested to be added in review.
---
 libavutil/frame.c | 43 ++-
 libavutil/frame.h | 21 +
 2 files changed, 51 insertions(+), 13 deletions(-)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index 9d3eae4bae..922185b823 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -781,29 +781,46 @@ AVFrameSideData *av_frame_side_data_new(AVFrameSideData 
***sd, int *nb_sd,
 return ret;
 }
 
-int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd,
- const AVFrameSideData *src, unsigned int flags)
+AVFrameSideData *av_frame_side_data_add(AVFrameSideData ***sd, int *nb_sd,
+enum AVFrameSideDataType type,
+const AVBufferRef *buf,
+unsigned int flags)
 {
-AVBufferRef *buf= NULL;
-AVFrameSideData *sd_dst = NULL;
-int  ret= AVERROR_BUG;
+AVBufferRef *new_buf = NULL;
+AVFrameSideData *sd_dst  = NULL;
 
-if (!sd || !src || !nb_sd || (*nb_sd && !*sd))
-return AVERROR(EINVAL);
+if (!sd || !buf || !nb_sd || (*nb_sd && !*sd))
+return NULL;
 
-buf = av_buffer_ref(src->buf);
+new_buf = av_buffer_ref(buf);
 if (!buf)
-return AVERROR(ENOMEM);
+return NULL;
 
 if (flags & AV_FRAME_SIDE_DATA_FLAG_UNIQUE)
-remove_side_data(sd, nb_sd, src->type);
+remove_side_data(sd, nb_sd, type);
 
-sd_dst = add_side_data_from_buf(sd, nb_sd, src->type, buf);
+sd_dst = add_side_data_from_buf(sd, nb_sd, type, new_buf);
 if (!sd_dst) {
-av_buffer_unref();
-return AVERROR(ENOMEM);
+av_buffer_unref(_buf);
+return NULL;
 }
 
+return sd_dst;
+}
+
+int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd,
+ const AVFrameSideData *src, unsigned int flags)
+{
+AVFrameSideData *sd_dst = NULL;
+int  ret= AVERROR_BUG;
+
+if (!src)
+return AVERROR(EINVAL);
+
+sd_dst = av_frame_side_data_add(sd, nb_sd, src->type, src->buf, flags);
+if (!sd_dst)
+return AVERROR(ENOMEM);
+
 ret = av_dict_copy(_dst->metadata, src->metadata, 0);
 if (ret < 0) {
 remove_side_data_by_entry(sd, nb_sd, sd_dst);
diff --git a/libavutil/frame.h b/libavutil/frame.h
index ce93421d60..a7e62ded15 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -1021,6 +1021,27 @@ AVFrameSideData *av_frame_side_data_new(AVFrameSideData 
***sd, int *nb_sd,
 enum AVFrameSideDataType type,
 size_t size, unsigned int flags);
 
+/**
+ * Add a new side data entry to an array from an existing AVBufferRef.
+ *
+ * @param sdpointer to array of side data to which to add another entry,
+ *  or to NULL in order to start a new array.
+ * @param nb_sd pointer to an integer containing the number of entries in
+ *  the array.
+ * @param type  type of the added side data
+ * @param buf   AVBufferRef for which a new reference will be made
+ * @param flags Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0.
+ *
+ * @return newly added side data on success, NULL on error. In case of
+ * AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of matching
+ * AVFrameSideDataType will be removed before the addition is
+ * attempted.
+ */
+AVFrameSideData *av_frame_side_data_add(AVFrameSideData ***sd, int *nb_sd,
+enum AVFrameSideDataType type,
+const AVBufferRef *buf,
+unsigned int flags);
+
 /**
  * Add a new side data entry to an array based on existing side data, taking
  * a reference towards the contained AVBufferRef.
-- 
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 v10 08/14] avutil/frame: add helper for getting side data from array

2024-03-18 Thread Jan Ekström
---
 libavutil/frame.c | 20 +++-
 libavutil/frame.h | 14 ++
 2 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index 922185b823..e8dfd4d926 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -830,16 +830,26 @@ int av_frame_side_data_clone(AVFrameSideData ***sd, int 
*nb_sd,
 return 0;
 }
 
-AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
-enum AVFrameSideDataType type)
+const AVFrameSideData *av_frame_side_data_get(const AVFrameSideData **sd,
+  const int nb_sd,
+  enum AVFrameSideDataType type)
 {
-for (int i = 0; i < frame->nb_side_data; i++) {
-if (frame->side_data[i]->type == type)
-return frame->side_data[i];
+for (int i = 0; i < nb_sd; i++) {
+if (sd[i]->type == type)
+return sd[i];
 }
 return NULL;
 }
 
+AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
+enum AVFrameSideDataType type)
+{
+return (AVFrameSideData *)av_frame_side_data_get(
+(const AVFrameSideData **)frame->side_data, frame->nb_side_data,
+type
+);
+}
+
 static int frame_copy_video(AVFrame *dst, const AVFrame *src)
 {
 int planes;
diff --git a/libavutil/frame.h b/libavutil/frame.h
index a7e62ded15..e59f033cce 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -1062,6 +1062,20 @@ AVFrameSideData *av_frame_side_data_add(AVFrameSideData 
***sd, int *nb_sd,
 int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd,
  const AVFrameSideData *src, unsigned int flags);
 
+/**
+ * Get a side data entry of a specific type from an array.
+ *
+ * @param sdarray of side data.
+ * @param nb_sd integer containing the number of entries in the array.
+ * @param type  type of side data to be queried
+ *
+ * @return a pointer to the side data of a given type on success, NULL if there
+ * is no side data with such type in this set.
+ */
+const AVFrameSideData *av_frame_side_data_get(const AVFrameSideData **sd,
+  const int nb_sd,
+  enum AVFrameSideDataType type);
+
 /**
  * @}
  */
-- 
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 v10 09/14] {avutil/version, APIchanges}: bump, document new AVFrameSideData functions

2024-03-18 Thread Jan Ekström
---
 doc/APIchanges  | 5 +
 libavutil/version.h | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index a44c8e4f10..4f906432d5 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,11 @@ The last version increases of all libraries were on 2024-03-07
 
 API changes, most recent first:
 
+2024-03-xx - xx - lavu 59.3.100 - frame.h
+  Add av_frame_side_data_free(), av_frame_side_data_new(),
+  av_frame_side_data_clone(), av_frame_side_data_get() as well
+  as AV_FRAME_SIDE_DATA_FLAG_UNIQUE.
+
 2024-03-xx - xx - lavu 59.2.100 - channel_layout.h
   Add AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL.
 
diff --git a/libavutil/version.h b/libavutil/version.h
index 57cad02ec0..5027b025be 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  59
-#define LIBAVUTIL_VERSION_MINOR   2
+#define LIBAVUTIL_VERSION_MINOR   3
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
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 v10 04/14] avutil/frame: split side data removal out to non-AVFrame function

2024-03-18 Thread Jan Ekström
This will make it possible to reuse logic in further commits.
---
 libavutil/frame.c | 24 
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index 382e1f6d58..2a319adb86 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -83,6 +83,21 @@ void av_frame_side_data_free(AVFrameSideData ***sd, int 
*nb_sd)
 wipe_side_data(sd, nb_sd);
 }
 
+static void remove_side_data(AVFrameSideData ***sd, int *nb_side_data,
+ const enum AVFrameSideDataType type)
+{
+for (int i = *nb_side_data - 1; i >= 0; i--) {
+AVFrameSideData *entry = ((*sd)[i]);
+if (entry->type != type)
+continue;
+
+free_side_data();
+
+((*sd)[i]) = ((*sd)[*nb_side_data - 1]);
+(*nb_side_data)--;
+}
+}
+
 AVFrame *av_frame_alloc(void)
 {
 AVFrame *frame = av_malloc(sizeof(*frame));
@@ -801,14 +816,7 @@ int av_frame_copy(AVFrame *dst, const AVFrame *src)
 
 void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
 {
-for (int i = frame->nb_side_data - 1; i >= 0; i--) {
-AVFrameSideData *sd = frame->side_data[i];
-if (sd->type == type) {
-free_side_data(>side_data[i]);
-frame->side_data[i] = frame->side_data[frame->nb_side_data - 1];
-frame->nb_side_data--;
-}
-}
+remove_side_data(>side_data, >nb_side_data, type);
 }
 
 const char *av_frame_side_data_name(enum AVFrameSideDataType type)
-- 
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 v10 03/14] avutil/frame: split side_data_from_buf to base and AVFrame func

2024-03-18 Thread Jan Ekström
---
 libavutil/frame.c | 25 +
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index baac0706db..382e1f6d58 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -679,23 +679,23 @@ AVBufferRef *av_frame_get_plane_buffer(const AVFrame 
*frame, int plane)
 return NULL;
 }
 
-AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame,
- enum AVFrameSideDataType type,
- AVBufferRef *buf)
+static AVFrameSideData *add_side_data_from_buf(AVFrameSideData ***sd,
+   int *nb_sd,
+   enum AVFrameSideDataType type,
+   AVBufferRef *buf)
 {
 AVFrameSideData *ret, **tmp;
 
 if (!buf)
 return NULL;
 
-if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1)
+if (*nb_sd > INT_MAX / sizeof(*sd) - 1)
 return NULL;
 
-tmp = av_realloc(frame->side_data,
- (frame->nb_side_data + 1) * sizeof(*frame->side_data));
+tmp = av_realloc(*sd, (*nb_sd + 1) * sizeof(*sd));
 if (!tmp)
 return NULL;
-frame->side_data = tmp;
+*sd = tmp;
 
 ret = av_mallocz(sizeof(*ret));
 if (!ret)
@@ -706,11 +706,20 @@ AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame 
*frame,
 ret->size = buf->size;
 ret->type = type;
 
-frame->side_data[frame->nb_side_data++] = ret;
+(*sd)[(*nb_sd)++] = ret;
 
 return ret;
 }
 
+AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame,
+ enum AVFrameSideDataType type,
+ AVBufferRef *buf)
+{
+return
+add_side_data_from_buf(
+>side_data, >nb_side_data, type, buf);
+}
+
 AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
 enum AVFrameSideDataType type,
 size_t size)
-- 
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] fftools/ffplay: use correct buffersink channel layout parameters

2024-03-18 Thread James Almer
LGTM if tested. Sorry for the breakage.
Please backport it to all the relevant release branches too.

On Mon, Mar 18, 2024 at 5:20 PM Marton Balint  wrote:

> Regression since 0995e1f1b31f6e937a1b527407ed3e850f138098.
>
> Signed-off-by: Marton Balint 
> ---
>  fftools/ffplay.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/fftools/ffplay.c b/fftools/ffplay.c
> index 09b4846deb..fcd1319ce7 100644
> --- a/fftools/ffplay.c
> +++ b/fftools/ffplay.c
> @@ -2040,6 +2040,8 @@ static int configure_audio_filters(VideoState *is,
> const char *afilters, int for
>  goto end;
>
>  if (force_output_format) {
> +av_bprint_clear();
> +av_channel_layout_describe_bprint(>audio_tgt.ch_layout, );
>  sample_rates   [0] = is->audio_tgt.freq;
>  if ((ret = av_opt_set_int(filt_asink, "all_channel_counts", 0,
> AV_OPT_SEARCH_CHILDREN)) < 0)
>  goto end;
> --
> 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".


[FFmpeg-devel] [PATCH v2 0/1] avformat/demux: Fix accurate probing of durations in mpegts/ps

2024-03-18 Thread Nicolas Gaullier
v1: There was an issue with teletext where resolution is set just once at 
decoder init
(teletext resolution is fixed/hard coded),
so it is somewhat fragile: when a demuxer context update occurs, it is 
lost/overriden
by avcodec_parameters_to_context(sti->avctx, st->codecpar) in 
read_frame_internal.
They could have been other scenario besides teletext, I don't know.

v2: So now at estimate_timings_from_pts, with one or more seeking involved 
(seeking
is detected by the mpegts demuxer and set last_vn=-1, so pmt is forced/updated
and results in demuxer context update),
it is required to preserve the info in codecpar at first.
Thanks to Michael for reporting the issue.

Nicolas Gaullier (1):
  avformat/demux: Fix accurate probing of durations in mpegts/ps

 libavformat/demux.c   |  36 ++--
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 170 +-
 tests/ref/fate/ts-opus-demux  |   4 +-
 3 files changed, 100 insertions(+), 110 deletions(-)

-- 
2.30.2

___
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 v3 2/2] lavc/vaapi_encode_h265: Set general_*_constriaint flags with profile

2024-03-18 Thread Mark Thompson

On 18/03/2024 04:21, fei.w.wang-at-intel@ffmpeg.org wrote:

From: Fei Wang 

According to Table A.2 in spec.

Signed-off-by: Fei Wang 
---
  libavcodec/vaapi_encode_h265.c | 176 +++--
  1 file changed, 123 insertions(+), 53 deletions(-)

diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index 43755e2188..5ed317ce11 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -258,6 +258,124 @@ fail:
  return err;
  }
  
+static int vaapi_encode_h265_init_ptl(AVCodecContext *avctx)

+{
+VAAPIEncodeContext  *ctx = avctx->priv_data;
+VAAPIEncodeH265Context *priv = avctx->priv_data;
+H265RawVPS  *vps = >raw_vps;
+H265RawProfileTierLevel *ptl = >profile_tier_level;
+
+ptl->general_profile_space = 0;
+ptl->general_profile_idc   = avctx->profile;
+ptl->general_tier_flag = priv->tier;
+
+ptl->general_profile_compatibility_flag[ptl->general_profile_idc] = 1;
+
+if (ptl->general_profile_compatibility_flag[1])
+ptl->general_profile_compatibility_flag[2] = 1;
+if (ptl->general_profile_compatibility_flag[3]) {
+ptl->general_profile_compatibility_flag[1] = 1;
+ptl->general_profile_compatibility_flag[2] = 1;
+}
+
+ptl->general_progressive_source_flag= 1;
+ptl->general_interlaced_source_flag = 0;
+ptl->general_non_packed_constraint_flag = 1;
+ptl->general_frame_only_constraint_flag = 1;
+
+if (avctx->profile >= 4) {
+ptl->general_intra_constraint_flag= ctx->gop_size == 1;
+ptl->general_one_picture_only_constraint_flag = 0;
+ptl->general_lower_bit_rate_constraint_flag   = 1;
+ptl->general_max_14bit_constraint_flag= 0;
+
+switch (ctx->va_profile) {
+#if VA_CHECK_VERSION(1, 2, 0)
+case VAProfileHEVCMain12:
+// Main 12
+ptl->general_max_12bit_constraint_flag  = 1;
+ptl->general_max_10bit_constraint_flag  = 0;
+ptl->general_max_8bit_constraint_flag   = 0;
+ptl->general_max_422chroma_constraint_flag  = 1;
+ptl->general_max_420chroma_constraint_flag  = 1;
+ptl->general_max_monochrome_constraint_flag = 0;
+break;
+case VAProfileHEVCMain422_10:
+// Main 4:2:2 10
+ptl->general_max_12bit_constraint_flag  = 1;
+ptl->general_max_10bit_constraint_flag  = 1;
+ptl->general_max_8bit_constraint_flag   = 0;
+ptl->general_max_422chroma_constraint_flag  = 1;
+ptl->general_max_420chroma_constraint_flag  = 0;
+ptl->general_max_monochrome_constraint_flag = 0;
+break;
+case VAProfileHEVCMain422_12:
+// Main 4:2:2 12
+ptl->general_max_12bit_constraint_flag  = 1;
+ptl->general_max_10bit_constraint_flag  = 0;
+ptl->general_max_8bit_constraint_flag   = 0;
+ptl->general_max_422chroma_constraint_flag  = 1;
+ptl->general_max_420chroma_constraint_flag  = 0;
+ptl->general_max_monochrome_constraint_flag = 0;
+break;
+case VAProfileHEVCMain444:
+// Main 4:4:4
+ptl->general_max_12bit_constraint_flag  = 1;
+ptl->general_max_10bit_constraint_flag  = 1;
+ptl->general_max_8bit_constraint_flag   = 1;
+ptl->general_max_422chroma_constraint_flag  = 0;
+ptl->general_max_420chroma_constraint_flag  = 0;
+ptl->general_max_monochrome_constraint_flag = 0;
+break;
+case VAProfileHEVCMain444_10:
+// Main 4:4:4 10
+ptl->general_max_12bit_constraint_flag  = 1;
+ptl->general_max_10bit_constraint_flag  = 1;
+ptl->general_max_8bit_constraint_flag   = 0;
+ptl->general_max_422chroma_constraint_flag  = 0;
+ptl->general_max_420chroma_constraint_flag  = 0;
+ptl->general_max_monochrome_constraint_flag = 0;
+break;
+case VAProfileHEVCMain444_12:
+// Main 4:4:4 12
+ptl->general_max_12bit_constraint_flag  = 1;
+ptl->general_max_10bit_constraint_flag  = 0;
+ptl->general_max_8bit_constraint_flag   = 0;
+ptl->general_max_422chroma_constraint_flag  = 0;
+ptl->general_max_420chroma_constraint_flag  = 0;
+ptl->general_max_monochrome_constraint_flag = 0;
+break;
+#endif
+default:
+av_log(avctx, AV_LOG_ERROR, "Unknown profile to init PTL.\n");
+return AVERROR(EINVAL);
+}
+}


Why is this an improvement over the current code which sets the constraint 
flags based on the actual content of the stream?

Note the requirement in A.3.5 for decoder support:

general_profile_idc is equal to 4 or 

[FFmpeg-devel] [PATCH v10 00/14] encoder AVCodecContext configuration side data

2024-03-18 Thread Jan Ekström
Differences to v9:
1. rebased on top of current master
2. renamed the avctx AVFrameSideData array according to Anton's naming sense,
   as at this point that is now OK by James as well and I just want to get this
   done with.
3. removed the avctx helper to get through review.
4. added "Afterwards owned and freed by the encoder" comment into the
   description of the side data array.
5. added APIchanges (missing the AVBufferRef function since that is for now to
   be skipped) and avutil/avcodec bumps.
6. removed all references to "_set" from internal functions and the newly added
   test. The only thing that is left around that is a set is a 100% internal
   helper struct for the side_data_array test called FrameSideDataSet.

Comparison URL (mostly configure and wrappers, avutil/frame.c):
https://github.com/jeeb/ffmpeg/compare/avcodec_cll_mdcv_side_data_v9..avcodec_cll_mdcv_side_data_v10

This patch set I've now been working for a while since I felt like it was weird
we couldn't pass through information such as static HDR metadata to encoders
from decoded input. This initial version adds the necessary framework, as well
as adds static HDR metadata support for libsvtav1, libx264 as well as libx265
wrappers.

An alternative to this would be to make encoders only properly initialize when
they receive the first AVFrame, but that seems to be a bigger, nastier change
than introducing an AVFrameSideDataSet in avctx as everything seems to
presume that extradata etc are available after opening the encoder.

Note: Any opinions on whether FFCodec or AVCodec should have
  handled_side_data list, so that if format specific generic logic is
  added, it could be checked whether the codec itself handles this side
  data? This could also be utilized to list handled side data from f.ex.
  `ffmpeg -h encoder=libsvtav1`.

Jan

Jan Ekström (14):
  avutil/frame: split side data list wiping out to non-AVFrame function
  avutil/frame: add helper for freeing arrays of side data
  avutil/frame: split side_data_from_buf to base and AVFrame func
  avutil/frame: split side data removal out to non-AVFrame function
  avutil/frame: add helper for adding side data to array
  avutil/frame: add helper for adding existing side data to array
  avutil/frame: add helper for adding side data w/ AVBufferRef to array
  avutil/frame: add helper for getting side data from array
  {avutil/version,APIchanges}: bump, document new AVFrameSideData
functions
  avcodec: add frame side data array to AVCodecContext
  ffmpeg: pass first video AVFrame's side data to encoder
  avcodec/libsvtav1: add support for writing out CLL and MDCV
  avcodec/libx264: add support for writing out CLL and MDCV
  avcodec/libx265: add support for writing out CLL and MDCV

 configure |   2 +
 doc/APIchanges|   8 ++
 fftools/ffmpeg_enc.c  |  15 +++
 libavcodec/avcodec.h  |  13 +++
 libavcodec/libsvtav1.c|  69 
 libavcodec/libx264.c  |  80 +
 libavcodec/libx265.c  |  89 +++
 libavcodec/options.c  |   2 +
 libavcodec/version.h  |   4 +-
 libavutil/Makefile|   1 +
 libavutil/frame.c | 180 +-
 libavutil/frame.h |  88 +++
 libavutil/tests/side_data_array.c | 103 +
 libavutil/version.h   |   2 +-
 tests/fate/enc_external.mak   |  15 +++
 tests/fate/libavutil.mak  |   4 +
 tests/ref/fate/libsvtav1-hdr10|  14 +++
 tests/ref/fate/libx264-hdr10  |  15 +++
 tests/ref/fate/libx265-hdr10  |  16 +++
 tests/ref/fate/side_data_array|  14 +++
 20 files changed, 701 insertions(+), 33 deletions(-)
 create mode 100644 libavutil/tests/side_data_array.c
 create mode 100644 tests/ref/fate/libsvtav1-hdr10
 create mode 100644 tests/ref/fate/libx264-hdr10
 create mode 100644 tests/ref/fate/libx265-hdr10
 create mode 100644 tests/ref/fate/side_data_array

Full diff based on the same base hash for v9->v10:

diff --git a/doc/APIchanges b/doc/APIchanges
index a44c8e4f10..a025f1df14 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,14 @@ The last version increases of all libraries were on 2024-03-07
 
 API changes, most recent first:
 
+2024-03-xx - xx - lavc 61.2.100 - avcodec.h
+  Add AVCodecContext.[nb_]decoded_side_data.
+
+2024-03-xx - xx - lavu 59.3.100 - frame.h
+  Add av_frame_side_data_free(), av_frame_side_data_new(),
+  av_frame_side_data_clone(), av_frame_side_data_get() as well
+  as AV_FRAME_SIDE_DATA_FLAG_UNIQUE.
+
 2024-03-xx - xx - lavu 59.2.100 - channel_layout.h
   Add AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL.
 
diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index c8d15fb999..f01be1c22f 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -246,14 +246,19 @@ int enc_open(void *opaque, const AVFrame *frame)
 

[FFmpeg-devel] [PATCH v10 01/14] avutil/frame: split side data list wiping out to non-AVFrame function

2024-03-18 Thread Jan Ekström
This will make it possible to to reuse logic in further commits.
---
 libavutil/frame.c | 23 ++-
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index 079cf6595b..ab425b2235 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -63,14 +63,19 @@ static void free_side_data(AVFrameSideData **ptr_sd)
 av_freep(ptr_sd);
 }
 
-static void wipe_side_data(AVFrame *frame)
+static void wipe_side_data(AVFrameSideData ***sd, int *nb_side_data)
 {
-for (int i = 0; i < frame->nb_side_data; i++) {
-free_side_data(>side_data[i]);
+for (int i = 0; i < *nb_side_data; i++) {
+free_side_data(&((*sd)[i]));
 }
-frame->nb_side_data = 0;
+*nb_side_data = 0;
+
+av_freep(sd);
+}
 
-av_freep(>side_data);
+static void frame_side_data_wipe(AVFrame *frame)
+{
+wipe_side_data(>side_data, >nb_side_data);
 }
 
 AVFrame *av_frame_alloc(void)
@@ -288,7 +293,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 sd_dst = av_frame_new_side_data(dst, sd_src->type,
 sd_src->size);
 if (!sd_dst) {
-wipe_side_data(dst);
+frame_side_data_wipe(dst);
 return AVERROR(ENOMEM);
 }
 memcpy(sd_dst->data, sd_src->data, sd_src->size);
@@ -297,7 +302,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 sd_dst = av_frame_new_side_data_from_buf(dst, sd_src->type, ref);
 if (!sd_dst) {
 av_buffer_unref();
-wipe_side_data(dst);
+frame_side_data_wipe(dst);
 return AVERROR(ENOMEM);
 }
 }
@@ -437,7 +442,7 @@ int av_frame_replace(AVFrame *dst, const AVFrame *src)
 if (ret < 0)
 goto fail;
 
-wipe_side_data(dst);
+frame_side_data_wipe(dst);
 av_dict_free(>metadata);
 ret = frame_copy_props(dst, src, 0);
 if (ret < 0)
@@ -536,7 +541,7 @@ void av_frame_unref(AVFrame *frame)
 if (!frame)
 return;
 
-wipe_side_data(frame);
+frame_side_data_wipe(frame);
 
 for (int i = 0; i < FF_ARRAY_ELEMS(frame->buf); i++)
 av_buffer_unref(>buf[i]);
-- 
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 v10 02/14] avutil/frame: add helper for freeing arrays of side data

2024-03-18 Thread Jan Ekström
---
 libavutil/frame.c |  5 +
 libavutil/frame.h | 11 +++
 2 files changed, 16 insertions(+)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index ab425b2235..baac0706db 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -78,6 +78,11 @@ static void frame_side_data_wipe(AVFrame *frame)
 wipe_side_data(>side_data, >nb_side_data);
 }
 
+void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd)
+{
+wipe_side_data(sd, nb_sd);
+}
+
 AVFrame *av_frame_alloc(void)
 {
 AVFrame *frame = av_malloc(sizeof(*frame));
diff --git a/libavutil/frame.h b/libavutil/frame.h
index b94687941d..27281c168f 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -988,6 +988,17 @@ int av_frame_apply_cropping(AVFrame *frame, int flags);
  */
 const char *av_frame_side_data_name(enum AVFrameSideDataType type);
 
+/**
+ * Free all side data entries and their contents, then zeroes out the
+ * values which the pointers are pointing to.
+ *
+ * @param sdpointer to array of side data to free. Will be set to NULL
+ *  upon return.
+ * @param nb_sd pointer to an integer containing the number of entries in
+ *  the array. Will be set to 0 upon return.
+ */
+void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd);
+
 /**
  * @}
  */
-- 
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] avformat/flvenc: Avoid avio_write(pb, "", 0)

2024-03-18 Thread Andreas Rheinhardt
When the compiler chooses to inline put_amf_string(pb, ""),
the avio_write(pb, "", 0) can be avoided. Happens with
Clang-17 with -O1 and higher and GCC 13 with -O2 and higher
here.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/flvenc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 7e410e627e..d6c9124d5d 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -231,6 +231,8 @@ static void put_amf_string(AVIOContext *pb, const char *str)
 {
 size_t len = strlen(str);
 avio_wb16(pb, len);
+if (av_builtin_constant_p(len == 0) && len == 0)
+return;
 avio_write(pb, str, len);
 }
 
-- 
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 2/3] avformat/iamfenc: Align check and error message

2024-03-18 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavformat/iamfenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/iamfenc.c b/libavformat/iamfenc.c
index bf4a268c95..5e53a7748f 100644
--- a/libavformat/iamfenc.c
+++ b/libavformat/iamfenc.c
@@ -72,7 +72,7 @@ static int iamf_init(AVFormatContext *s)
 }
 }
 
-if (!s->nb_stream_groups) {
+if (s->nb_stream_groups <= 1) {
 av_log(s, AV_LOG_ERROR, "There must be at least two stream groups\n");
 return AVERROR(EINVAL);
 }
-- 
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 3/3] avformat/iamfenc: Remove unused headers

2024-03-18 Thread Andreas Rheinhardt
Forgotten in c95c8a0158073be84338d84c46529561bcc70a03.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/iamfenc.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/libavformat/iamfenc.c b/libavformat/iamfenc.c
index 5e53a7748f..3169ff1eb8 100644
--- a/libavformat/iamfenc.c
+++ b/libavformat/iamfenc.c
@@ -21,12 +21,7 @@
 
 #include 
 
-#include "libavutil/avassert.h"
-#include "libavutil/common.h"
-#include "libavutil/iamf.h"
-#include "libavcodec/put_bits.h"
 #include "avformat.h"
-#include "avio_internal.h"
 #include "iamf.h"
 #include "iamf_writer.h"
 #include "internal.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/3] avformat/iamfenc: Remove always-false check

2024-03-18 Thread Andreas Rheinhardt
This muxer does not have the AVFMT_NOSTREAMS flag; therefore
it is checked generically that there is at least a stream.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/iamfenc.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/libavformat/iamfenc.c b/libavformat/iamfenc.c
index ebf0c2fd67..bf4a268c95 100644
--- a/libavformat/iamfenc.c
+++ b/libavformat/iamfenc.c
@@ -48,11 +48,6 @@ static int iamf_init(AVFormatContext *s)
 int nb_audio_elements = 0, nb_mix_presentations = 0;
 int ret;
 
-if (!s->nb_streams) {
-av_log(s, AV_LOG_ERROR, "There must be at least one stream\n");
-return AVERROR(EINVAL);
-}
-
 for (int i = 0; i < s->nb_streams; i++) {
 if (s->streams[i]->codecpar->codec_type != AVMEDIA_TYPE_AUDIO ||
 (s->streams[i]->codecpar->codec_tag != MKTAG('m','p','4','a') &&
-- 
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 v3 2/2] lavc/get_buffer: Add a warning on failed allocation from a fixed pool

2024-03-18 Thread Xiang, Haihao
On Ma, 2024-03-18 at 21:33 +, Mark Thompson wrote:
> On 18/03/2024 05:53, Xiang, Haihao wrote:
> > On So, 2024-03-17 at 20:51 +, Mark Thompson wrote:
> > > For hardware cases where we are forced to have a fixed pool of frames
> > > allocated up-front (such as array textures on decoder output), suggest
> > > a possible workaround to the user if an allocation fails because the
> > > pool is exhausted.
> > > ---
> > > Perhaps helpful; any thoughts?
> > > 
> > > The warning comes out before any errors, looking like:
> > > 
> > > [mpeg2video @ 0x560ff51b4600] Failed to allocate a vaapi/nv12 frame from a
> > > fixed pool of hardware frames.
> > > [mpeg2video @ 0x560ff51b4600] Consider setting extra_hw_frames to a larger
> > > value (currently set to 8, giving a pool size of 14).
> > > [mpeg2video @ 0x560ff51b4600] get_buffer() failed
> > > [vist#0:0/mpeg2video @ 0x560ff5199840] [dec:mpeg2video @ 0x560ff51b3b40]
> > > Error
> > > submitting packet to decoder: Operation not permitted
> > 
> > I'm OK to print such warning so user may know how to work around it. But now
> > many cases are impacted by this error
> > (e.g. https://trac.ffmpeg.org/ticket/10856
> > ), I think it is a regression to user. I still prefer to use a dynamic
> > buffer
> > pool instead fixed frame pool to avoid such error when the dynamic buffer
> > pool
> > can work.
> 
> How would we implement this on D3D11 or D3D12?

I understand not all can support dynamic frame pool, your patch is useful for
decoders using fixed pool. But for driver which doesn't require array textures,
I think we'd be better to use dynamic frame pool instead so user needn't worry
about frame allocation. For example, we may use dynamic frame pool for vaapi
with iHD driver, what do you think about adding a quirk to enable dynamic frame
pool for special drivers ? 

Thanks
Haihao

> 
> A way of doing the second in particular would be very useful, because the
> current decoder only works on a subset of drivers which don't require array
> textures.
> 
> Thanks,
> 
> - Mark
> ___
> 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".