[FFmpeg-devel] [PATCH v6] libavfi/dnn: add LibTorch as one of DNN backend

2024-03-14 Thread wenbin . chen-at-intel . com
From: Wenbin Chen 

PyTorch is an open source machine learning framework that accelerates
the path from research prototyping to production deployment. Official
website: https://pytorch.org/. We call the C++ library of PyTorch as
LibTorch, the same below.

To build FFmpeg with LibTorch, please take following steps as
reference:
1. download LibTorch C++ library in
 https://pytorch.org/get-started/locally/,
please select C++/Java for language, and other options as your need.
Please download cxx11 ABI version:
 (libtorch-cxx11-abi-shared-with-deps-*.zip).
2. unzip the file to your own dir, with command
unzip libtorch-shared-with-deps-latest.zip -d your_dir
3. export libtorch_root/libtorch/include and
libtorch_root/libtorch/include/torch/csrc/api/include to $PATH
export libtorch_root/libtorch/lib/ to $LD_LIBRARY_PATH
4. config FFmpeg with ../configure --enable-libtorch \
 --extra-cflag=-I/libtorch_root/libtorch/include \
 --extra-cflag=-I/libtorch_root/libtorch/include/torch/csrc/api/include \
 --extra-ldflags=-L/libtorch_root/libtorch/lib/
5. make

To run FFmpeg DNN inference with LibTorch backend:
./ffmpeg -i input.jpg -vf \
dnn_processing=dnn_backend=torch:model=LibTorch_model.pt -y output.jpg

The LibTorch_model.pt can be generated by Python with torch.jit.script()
api. https://pytorch.org/tutorials/advanced/cpp_export.html. This is
pytorch official guide about how to convert and load torchscript model.
Please note, torch.jit.trace() is not recommanded, since it does
not support ambiguous input size.

Signed-off-by: Ting Fu 
Signed-off-by: Wenbin Chen 
---
 configure |   5 +-
 libavfilter/dnn/Makefile  |   1 +
 libavfilter/dnn/dnn_backend_torch.cpp | 597 ++
 libavfilter/dnn/dnn_interface.c   |   5 +
 libavfilter/dnn_filter_common.c   |  15 +-
 libavfilter/dnn_interface.h   |   2 +-
 libavfilter/vf_dnn_processing.c   |   3 +
 7 files changed, 624 insertions(+), 4 deletions(-)
 create mode 100644 libavfilter/dnn/dnn_backend_torch.cpp

diff --git a/configure b/configure
index c34bdd13f5..e68b6f22b0 100755
--- a/configure
+++ b/configure
@@ -281,6 +281,7 @@ External library support:
   --enable-libtheora   enable Theora encoding via libtheora [no]
   --enable-libtls  enable LibreSSL (via libtls), needed for https 
support
if openssl, gnutls or mbedtls is not used [no]
+  --enable-libtorchenable Torch as one DNN backend [no]
   --enable-libtwolame  enable MP2 encoding via libtwolame [no]
   --enable-libuavs3d   enable AVS3 decoding via libuavs3d [no]
   --enable-libv4l2 enable libv4l2/v4l-utils [no]
@@ -1905,6 +1906,7 @@ EXTERNAL_LIBRARY_LIST="
 libtensorflow
 libtesseract
 libtheora
+libtorch
 libtwolame
 libuavs3d
 libv4l2
@@ -2785,7 +2787,7 @@ cbs_vp9_select="cbs"
 deflate_wrapper_deps="zlib"
 dirac_parse_select="golomb"
 dovi_rpu_select="golomb"
-dnn_suggest="libtensorflow libopenvino"
+dnn_suggest="libtensorflow libopenvino libtorch"
 dnn_deps="avformat swscale"
 error_resilience_select="me_cmp"
 evcparse_select="golomb"
@@ -6888,6 +6890,7 @@ enabled libtensorflow && require libtensorflow 
tensorflow/c/c_api.h TF_Versi
 enabled libtesseract  && require_pkg_config libtesseract tesseract 
tesseract/capi.h TessBaseAPICreate
 enabled libtheora && require libtheora theora/theoraenc.h th_info_init 
-ltheoraenc -ltheoradec -logg
 enabled libtls&& require_pkg_config libtls libtls tls.h 
tls_configure
+enabled libtorch  && check_cxxflags -std=c++17 && require_cpp libtorch 
torch/torch.h "torch::Tensor" -ltorch -lc10 -ltorch_cpu -lstdc++ -lpthread
 enabled libtwolame&& require libtwolame twolame.h twolame_init 
-ltwolame &&
  { check_lib libtwolame twolame.h 
twolame_encode_buffer_float32_interleaved -ltwolame ||
die "ERROR: libtwolame must be installed and 
version must be >= 0.3.10"; }
diff --git a/libavfilter/dnn/Makefile b/libavfilter/dnn/Makefile
index 5d5697ea42..3d09927c98 100644
--- a/libavfilter/dnn/Makefile
+++ b/libavfilter/dnn/Makefile
@@ -6,5 +6,6 @@ OBJS-$(CONFIG_DNN)   += 
dnn/dnn_backend_common.o
 
 DNN-OBJS-$(CONFIG_LIBTENSORFLOW) += dnn/dnn_backend_tf.o
 DNN-OBJS-$(CONFIG_LIBOPENVINO)   += dnn/dnn_backend_openvino.o
+DNN-OBJS-$(CONFIG_LIBTORCH)  += dnn/dnn_backend_torch.o
 
 OBJS-$(CONFIG_DNN)   += $(DNN-OBJS-yes)
diff --git a/libavfilter/dnn/dnn_backend_torch.cpp 
b/libavfilter/dnn/dnn_backend_torch.cpp
new file mode 100644
index 00..fa9a2e6d99
--- /dev/null
+++ b/libavfilter/dnn/dnn_backend_torch.cpp
@@ -0,0 +1,597 @@
+/*
+ * Copyright (c) 2024
+ *
+ * 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 

Re: [FFmpeg-devel] [FFmpeg-cvslog] fftools/ffmpeg: add loopback decoding

2024-03-14 Thread Gyan Doshi




On 2024-03-14 03:46 pm, Anton Khirnov wrote:

Quoting Gyan Doshi (2024-03-13 08:49:52)


Are there any limitations to loopback decoding e.g. would a vpx w/alpha
encode be decoded back to a alpha pix fmt?

I don't know how vpx alpha works, was it a separate stream in the
demuxer or something like that?


The encoder attaches the coded alpha as side data to the packet. Only a 
couple of containers support this SD.

The demuxer, in turn, attaches the alpha as SD upon export.


Loopback decoders work exactly like normal decoders, except their
packets arrive from an encoder instead of a demuxer.
In terms of syntax, do all LB streams have to be specified in the first 
output? Does that output muxer have to be null, or can those packets be 
routed to both output and LB? Regards, 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] [PATCH] avcodec/mips/aaccoder_mips: Remove MIPS-specific aaccoder

2024-03-14 Thread Lynne
Mar 15, 2024, 02:20 by andreas.rheinha...@outlook.com:

> ff_aac_coder_init_mips() modifies a static const structure of
> function pointers. This will crash if the binary uses relro
> and is a data race in any case.
>
> Furthermore it points to a maintainability issue: The
> AACCoefficientsEncoder structures have been constified
> in commit fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3,
> a Libav commit merged in 318778de9ebec276cb9dfc65509231ca56590d13.
> Libav did not have the MIPS-specific AAC code and so this was
> fine for them; yet FFmpeg had them, but this was not recognized.
>
> Commit 75a099fc734a4ee2b1347d0a3d8c53d883b95174 points to another
> maintainability issue: Contrary to ordinary DSP code, this code
> here is way more complex and needs to be constantly kept in sync
> with the ordinary code which it mimicks and replaces. Said commit
> is the only commit actually changing aaccoder.c in the last few
> years and the same change has not been performed for the MIPS
> clone; before that, it even happened several times that the mips
> code was broken due to changes of the generic code (see commits
> 97437bd17a8c5d4135b2f3b1b299bd7bb72ce02c and
> de262d018d7d7d9c967af1dfd1b861c4b9eb2a60 or
> 860dbe0275e57cbf4228f3f653f872ff66ca596b or
> 933309a6ca0f18bf1d40e917fff455221f57fb4b or
> b65ffa316e377213c29736929beba584d0d80d7c). This might even lead
> to scenarios where someone changing non-dsp aacenc code would
> have to modify mips inline asm in order to keep them in sync.
> This is obviously a significant burden (if the AAC encoder were
> actively developed).
>
> Finally, the code does not even compile here due to errors like
> "Error: float register should be even, was 1".
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/aacenc.c |4 -
>  libavcodec/aacenc.h |1 -
>  libavcodec/mips/Makefile|1 -
>  libavcodec/mips/aaccoder_mips.c | 2503 ---
>  4 files changed, 2509 deletions(-)
>  delete mode 100644 libavcodec/mips/aaccoder_mips.c
>

I didn't even know we had one.
Looks good to me.

Most MIPS code except Loongson is unmaintained
and largely untested, we should consider removing
it in a few years.
___
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_qsv: Join the download/upload session to the main session

2024-03-14 Thread Xiang, Haihao
On Ma, 2024-03-11 at 12:56 +0800, Xiang, Haihao wrote:
> From: Haihao Xiang 
> 
> This may reduce the number of internal threads when using hwupload or
> hwdownload filter.
> 
> Signed-off-by: Haihao Xiang 
> ---
>  libavutil/hwcontext_qsv.c | 24 
>  1 file changed, 24 insertions(+)
> 
> diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
> index 378cd5e826..e5e043d2d1 100644
> --- a/libavutil/hwcontext_qsv.c
> +++ b/libavutil/hwcontext_qsv.c
> @@ -55,6 +55,10 @@
>  (MFX_VERSION_MAJOR > (MAJOR) || \
>   MFX_VERSION_MAJOR == (MAJOR) && MFX_VERSION_MINOR >= (MINOR))
>  
> +#define QSV_RUNTIME_VERSION_ATLEAST(MFX_VERSION, MAJOR, MINOR)  \
> +    ((MFX_VERSION.Major > (MAJOR)) ||   \
> + (MFX_VERSION.Major == (MAJOR) && MFX_VERSION.Minor >= (MINOR)))
> +
>  #define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
>  #define QSV_ONEVPL   QSV_VERSION_ATLEAST(2, 0)
>  #define QSV_HAVE_OPAQUE  !QSV_ONEVPL
> @@ -1136,6 +1140,17 @@ static int qsv_init_internal_session(AVHWFramesContext
> *ctx,
>  int   ret = AVERROR_UNKNOWN;
>  /* hwctx->loader is non-NULL for oneVPL user and NULL for non-oneVPL user
> */
>  void **loader = >loader;
> +    mfxSession parent_session = hwctx->session;
> +    mfxIMPL impl;
> +    mfxVersion ver;
> +
> +    err = MFXQueryIMPL(parent_session, );
> +    if (err == MFX_ERR_NONE)
> +    err = MFXQueryVersion(parent_session, );
> +    if (err != MFX_ERR_NONE) {
> +    av_log(ctx, AV_LOG_ERROR, "Error querying the session
> attributes.\n");
> +    return AVERROR_UNKNOWN;
> +    }
>  
>  #if QSV_HAVE_OPAQUE
>  QSVFramesContext  *s = ctx->hwctx;
> @@ -1156,6 +1171,15 @@ static int qsv_init_internal_session(AVHWFramesContext
> *ctx,
>  }
>  }
>  
> +    if (QSV_RUNTIME_VERSION_ATLEAST(ver, 1, 25)) {
> +    err = MFXJoinSession(parent_session, *session);
> +    if (err != MFX_ERR_NONE) {
> +    av_log(ctx, AV_LOG_ERROR, "Error joining session.\n");
> +    ret = AVERROR_UNKNOWN;
> +    goto fail;
> +    }
> +    }
> +
>  if (!opaque) {
>  err = MFXVideoCORE_SetFrameAllocator(*session, _allocator);
>  if (err != MFX_ERR_NONE) {

Will apply

- 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] lavc/qsvdec: Do not print warning when draining cached frames

2024-03-14 Thread Xiang, Haihao
On Ma, 2024-03-11 at 12:37 +0800, Xiang, Haihao wrote:
> From: Haihao Xiang 
> 
> When all cached frames are drained, the output mfxSyncPoint pointer is
> NULL and  MFX_ERR_MORE_DATA is returned, hence needn't print warning for
> this expected behavior, otherwise the user might think the output from
> qsv decoders are wrong.
> 
> Signed-off-by: Haihao Xiang 
> ---
>  libavcodec/qsvdec.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
> index 4f39f6942a..fd9267c6f4 100644
> --- a/libavcodec/qsvdec.c
> +++ b/libavcodec/qsvdec.c
> @@ -762,7 +762,9 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext
> *q,
>  if (!*sync && !bs.DataOffset) {
>  bs.DataOffset = avpkt->size;
>  ++q->zero_consume_run;
> -    if (q->zero_consume_run > 1)
> +    if (q->zero_consume_run > 1 &&
> +    (avpkt->size ||
> +    ret != MFX_ERR_MORE_DATA))
>  ff_qsv_print_warning(avctx, ret, "A decode call did not consume
> any data");
>  } else {
>  q->zero_consume_run = 0;

Will apply,

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

2024-03-14 Thread Xiang, Haihao
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.

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] [PATCH] avcodec/vaapi_encode: add customized surface alignment

2024-03-14 Thread Xiang, Haihao
On Do, 2024-03-07 at 00:55 +0100, Araz Iusubov wrote:
> This commit fixes issues with AMD HEVC encoding. 
> By default AMD hevc encoder asks for the alignment 64x16, while FFMPEG VAAPI
> has 16x16. 
> Adding support for customzied surface size from VASurfaceAttribAlignmentSize

s/customzied/customized

Thanks
Haihao

> in VAAPI version 1.21.0.
> 
> To: primeadv...@gmail.com
> 
> Signed-off-by: Araz Iusubov 
> ---
>  libavcodec/vaapi_encode.c   | 11 +++
>  libavutil/hwcontext.h   |  7 +++
>  libavutil/hwcontext_vaapi.c |  5 +
>  3 files changed, 23 insertions(+)
> 
> diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
> index 808b79c0c7..dc1b7465b7 100644
> --- a/libavcodec/vaapi_encode.c
> +++ b/libavcodec/vaapi_encode.c
> @@ -2700,6 +2700,17 @@ static av_cold int
> vaapi_encode_create_recon_frames(AVCodecContext *avctx)
>  av_log(avctx, AV_LOG_DEBUG, "Using %s as format of "
>     "reconstructed frames.\n", av_get_pix_fmt_name(recon_format));
>  
> +    if (constraints->log2_alignment) {
> +    ctx->surface_width = FFALIGN(avctx->width,
> +  1 << (constraints->log2_alignment & 0xf));
> +    ctx->surface_height = FFALIGN(avctx->height,
> +  1 << ((constraints->log2_alignment & 0xf0) >>
> 4));
> +    av_log(avctx, AV_LOG_VERBOSE, "Using customized alignment size "
> +    "[%dx%d].\n",
> +    (1 << (constraints->log2_alignment & 0xf)),
> +    (1 << ((constraints->log2_alignment & 0xf0) >> 4)));
> +    }
> +
>  if (ctx->surface_width  < constraints->min_width  ||
>  ctx->surface_height < constraints->min_height ||
>  ctx->surface_width  > constraints->max_width ||
> diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h
> index df7733fe5e..5725245be4 100644
> --- a/libavutil/hwcontext.h
> +++ b/libavutil/hwcontext.h
> @@ -481,6 +481,13 @@ typedef struct AVHWFramesConstraints {
>   */
>  int max_width;
>  int max_height;
> +
> +    /**
> + * The frame width/height log2 alignment when available
> + * the lower 4 bits, width; another 4 bits, height
> + * (Zero is not applied, use the default value)
> + */
> +    int log2_alignment;
>  } AVHWFramesConstraints;
>  
>  /**
> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
> index 2c75f5f5b1..161623bc27 100644
> --- a/libavutil/hwcontext_vaapi.c
> +++ b/libavutil/hwcontext_vaapi.c
> @@ -294,6 +294,11 @@ static int vaapi_frames_get_constraints(AVHWDeviceContext
> *hwdev,
>  case VASurfaceAttribMaxHeight:
>  constraints->max_height = attr_list[i].value.value.i;
>  break;
> +#if VA_CHECK_VERSION(1, 21, 0)
> +    case VASurfaceAttribAlignmentSize:
> +    constraints->log2_alignment = attr_list[i].value.value.i;
> +    break;
> +#endif
>  }
>  }
>  if (pix_fmt_count == 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 v1] lavc/vaapi_decode: Don't update buffer number if allocataion fail

2024-03-14 Thread Xiang, Haihao
On Do, 2024-03-14 at 08:38 +0800, fei.w.wang-at-intel@ffmpeg.org wrote:
> From: Fei Wang 
> 
> Signed-off-by: Fei Wang 
> ---
>  libavcodec/vaapi_decode.c | 9 +++--
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
> index ceac769c52..cca94b5336 100644
> --- a/libavcodec/vaapi_decode.c
> +++ b/libavcodec/vaapi_decode.c
> @@ -72,17 +72,14 @@ int ff_vaapi_decode_make_slice_buffer(AVCodecContext
> *avctx,
>  
>  av_assert0(pic->nb_slices <= pic->slices_allocated);
>  if (pic->nb_slices == pic->slices_allocated) {
> -    if (pic->slices_allocated > 0)
> -    pic->slices_allocated *= 2;
> -    else
> -    pic->slices_allocated = 64;
> -
>  pic->slice_buffers =
>  av_realloc_array(pic->slice_buffers,
> - pic->slices_allocated,
> + pic->slices_allocated ? pic->slices_allocated *
> 2 : 64,
>   2 * sizeof(*pic->slice_buffers));
>  if (!pic->slice_buffers)
>  return AVERROR(ENOMEM);
> +
> +    pic->slices_allocated = pic->slices_allocated ? pic->slices_allocated
> * 2 : 64;
>  }
>  av_assert0(pic->nb_slices + 1 <= pic->slices_allocated);

LGTM, will apply

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

2024-03-14 Thread Xiang, Haihao
On Vr, 2024-03-08 at 16:47 +0800, 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 | 181 +++--
>  1 file changed, 128 insertions(+), 53 deletions(-)
> 
> diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
> index 43755e2188..7c9916eac8 100644
> --- a/libavcodec/vaapi_encode_h265.c
> +++ b/libavcodec/vaapi_encode_h265.c
> @@ -258,6 +258,129 @@ 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;
> +
> +    switch (ctx->va_profile) {
> +#if VA_CHECK_VERSION(1, 2, 0)
> +    case VAProfileHEVCMain12:
> +    // Main 12
> +    ptl->general_max_14bit_constraint_flag  = 0;

There isn't a requirement about general_max_14bit_constraint_flag in Table A.2,
it is unnecessary to set this flag here.

Thanks
Haihao

> +    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_14bit_constraint_flag  = 0;
> +    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_14bit_constraint_flag  = 0;
> +    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_14bit_constraint_flag  = 0;
> +    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_14bit_constraint_flag  = 0;
> +    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_14bit_constraint_flag  = 0;
> +    ptl->general_max_12bit_constraint_flag  = 1;
> +    ptl->general_max_10bit_constraint_flag  = 0;
> 

Re: [FFmpeg-devel] [PATCH v5] libavfi/dnn: add LibTorch as one of DNN backend

2024-03-14 Thread Chen, Wenbin
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of
> > wenbin.chen-at-intel@ffmpeg.org
> > Sent: Monday, March 11, 2024 1:02 PM
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: [FFmpeg-devel] [PATCH v5] libavfi/dnn: add LibTorch as one of DNN
> > backend
> >
> > From: Wenbin Chen 
> >
> > PyTorch is an open source machine learning framework that accelerates
> > the path from research prototyping to production deployment. Official
> > website: https://pytorch.org/. We call the C++ library of PyTorch as
> > LibTorch, the same below.
> >
> > To build FFmpeg with LibTorch, please take following steps as reference:
> > 1. download LibTorch C++ library in 
> > https://pytorch.org/get-started/locally/,
> > please select C++/Java for language, and other options as your need.
> > Please download cxx11 ABI version (libtorch-cxx11-abi-shared-with-deps-
> > *.zip).
> > 2. unzip the file to your own dir, with command
> > unzip libtorch-shared-with-deps-latest.zip -d your_dir
> > 3. export libtorch_root/libtorch/include and
> > libtorch_root/libtorch/include/torch/csrc/api/include to $PATH
> > export libtorch_root/libtorch/lib/ to $LD_LIBRARY_PATH
> > 4. config FFmpeg with ../configure --enable-libtorch --extra-cflag=-
> > I/libtorch_root/libtorch/include --extra-cflag=-
> > I/libtorch_root/libtorch/include/torch/csrc/api/include --extra-ldflags=-
> > L/libtorch_root/libtorch/lib/
> > 5. make
> >
> > To run FFmpeg DNN inference with LibTorch backend:
> > ./ffmpeg -i input.jpg -vf
> > dnn_processing=dnn_backend=torch:model=LibTorch_model.pt -y
> output.jpg
> > The LibTorch_model.pt can be generated by Python with torch.jit.script()
> api.
> > Please note, torch.jit.trace() is not recommanded, since it does not support
> > ambiguous input size.
> 
> Can you provide more detail (maybe a link from pytorch) about the
> libtorch_model.py generation and so we can have a try.
> 


This is a guide from pytorch: 
https://pytorch.org/tutorials/advanced/cpp_export.html
I will add it into commit log.

I didn't find a ready-made torchscript model to download. I'm afraid you'll 
have to export
the model yourself to test.

> >
> > Signed-off-by: Ting Fu 
> > Signed-off-by: Wenbin Chen 
> > ---
> >  configure |   5 +-
> >  libavfilter/dnn/Makefile  |   1 +
> >  libavfilter/dnn/dnn_backend_torch.cpp | 597
> > ++
> >  libavfilter/dnn/dnn_interface.c   |   5 +
> >  libavfilter/dnn_filter_common.c   |  15 +-
> >  libavfilter/dnn_interface.h   |   2 +-
> >  libavfilter/vf_dnn_processing.c   |   3 +
> >  7 files changed, 624 insertions(+), 4 deletions(-)
> >  create mode 100644 libavfilter/dnn/dnn_backend_torch.cpp
> >
> > +static int fill_model_input_th(THModel *th_model, THRequestItem
> *request)
> > +{
> > +LastLevelTaskItem *lltask = NULL;
> > +TaskItem *task = NULL;
> > +THInferRequest *infer_request = NULL;
> > +DNNData input = { 0 };
> > +THContext *ctx = _model->ctx;
> > +int ret, width_idx, height_idx, channel_idx;
> > +
> > +lltask = (LastLevelTaskItem *)ff_queue_pop_front(th_model-
> > >lltask_queue);
> > +if (!lltask) {
> > +ret = AVERROR(EINVAL);
> > +goto err;
> > +}
> > +request->lltask = lltask;
> > +task = lltask->task;
> > +infer_request = request->infer_request;
> > +
> > +ret = get_input_th(th_model, , NULL);
> > +if ( ret != 0) {
> > +goto err;
> > +}
> > +width_idx = dnn_get_width_idx_by_layout(input.layout);
> > +height_idx = dnn_get_height_idx_by_layout(input.layout);
> > +channel_idx = dnn_get_channel_idx_by_layout(input.layout);
> > +input.dims[height_idx] = task->in_frame->height;
> > +input.dims[width_idx] = task->in_frame->width;
> > +input.data = av_malloc(input.dims[height_idx] * input.dims[width_idx] *
> > +   input.dims[channel_idx] * sizeof(float));
> > +if (!input.data)
> > +return AVERROR(ENOMEM);
> > +infer_request->input_tensor = new torch::Tensor();
> > +infer_request->output = new torch::Tensor();
> > +
> > +switch (th_model->model->func_type) {
> > +case DFT_PROCESS_FRAME:
> > +input.scale = 255;
> > +if (task->do_ioproc) {
> > +if (th_model->model->frame_pre_proc != NULL) {
> > +th_model->model->frame_pre_proc(task->in_frame, ,
> > th_model->model->filter_ctx);
> > +} else {
> > +ff_proc_from_frame_to_dnn(task->in_frame, , ctx);
> > +}
> > +}
> > +break;
> > +default:
> > +avpriv_report_missing_feature(NULL, "model function type %d",
> > th_model->model->func_type);
> > +break;
> > +}
> > +*infer_request->input_tensor = torch::from_blob(input.data,
> > +{1, 1, input.dims[channel_idx], input.dims[height_idx],
> > input.dims[width_idx]},
> 
> An extra dimension is added to support multiple frames for algorithms
> 

[FFmpeg-devel] [PATCH] avcodec/mips/aaccoder_mips: Remove MIPS-specific aaccoder

2024-03-14 Thread Andreas Rheinhardt
ff_aac_coder_init_mips() modifies a static const structure of
function pointers. This will crash if the binary uses relro
and is a data race in any case.

Furthermore it points to a maintainability issue: The
AACCoefficientsEncoder structures have been constified
in commit fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3,
a Libav commit merged in 318778de9ebec276cb9dfc65509231ca56590d13.
Libav did not have the MIPS-specific AAC code and so this was
fine for them; yet FFmpeg had them, but this was not recognized.

Commit 75a099fc734a4ee2b1347d0a3d8c53d883b95174 points to another
maintainability issue: Contrary to ordinary DSP code, this code
here is way more complex and needs to be constantly kept in sync
with the ordinary code which it mimicks and replaces. Said commit
is the only commit actually changing aaccoder.c in the last few
years and the same change has not been performed for the MIPS
clone; before that, it even happened several times that the mips
code was broken due to changes of the generic code (see commits
97437bd17a8c5d4135b2f3b1b299bd7bb72ce02c and
de262d018d7d7d9c967af1dfd1b861c4b9eb2a60 or
860dbe0275e57cbf4228f3f653f872ff66ca596b or
933309a6ca0f18bf1d40e917fff455221f57fb4b or
b65ffa316e377213c29736929beba584d0d80d7c). This might even lead
to scenarios where someone changing non-dsp aacenc code would
have to modify mips inline asm in order to keep them in sync.
This is obviously a significant burden (if the AAC encoder were
actively developed).

Finally, the code does not even compile here due to errors like
"Error: float register should be even, was 1".

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/aacenc.c |4 -
 libavcodec/aacenc.h |1 -
 libavcodec/mips/Makefile|1 -
 libavcodec/mips/aaccoder_mips.c | 2503 ---
 4 files changed, 2509 deletions(-)
 delete mode 100644 libavcodec/mips/aaccoder_mips.c

diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 3f99188be4..55fa307809 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -1383,10 +1383,6 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
 
 ff_aacenc_dsp_init(>aacdsp);
 
-#if HAVE_MIPSDSP
-ff_aac_coder_init_mips(s);
-#endif
-
 ff_af_queue_init(avctx, >afq);
 
 return 0;
diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h
index c18e828905..8899f90ac7 100644
--- a/libavcodec/aacenc.h
+++ b/libavcodec/aacenc.h
@@ -241,7 +241,6 @@ typedef struct AACEncContext {
 } buffer;
 } AACEncContext;
 
-void ff_aac_coder_init_mips(AACEncContext *c);
 void ff_quantize_band_cost_cache_init(struct AACEncContext *s);
 
 
diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile
index 45c56e8ad9..50fe38a50e 100644
--- a/libavcodec/mips/Makefile
+++ b/libavcodec/mips/Makefile
@@ -19,7 +19,6 @@ OBJS-$(CONFIG_AAC_DECODER)+= 
mips/aacdec_mips.o\
  mips/aacsbr_mips.o\
  mips/sbrdsp_mips.o\
  mips/aacpsdsp_mips.o
-MIPSDSP-OBJS-$(CONFIG_AAC_ENCODER)+= mips/aaccoder_mips.o
 MIPSFPU-OBJS-$(CONFIG_AAC_ENCODER)+= mips/iirfilter_mips.o
 OBJS-$(CONFIG_HEVC_DECODER)   += mips/hevcdsp_init_mips.o  \
  mips/hevcpred_init_mips.o
diff --git a/libavcodec/mips/aaccoder_mips.c b/libavcodec/mips/aaccoder_mips.c
deleted file mode 100644
index dd9661fbdd..00
--- a/libavcodec/mips/aaccoder_mips.c
+++ /dev/null
@@ -1,2503 +0,0 @@
-/*
- * Copyright (c) 2012
- *  MIPS Technologies, Inc., California.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the MIPS Technologies, Inc., nor the names of its
- *contributors may be used to endorse or promote products derived from
- *this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF 

[FFmpeg-devel] [PATCH] avutil/hash: Avoid relocations for hash names

2024-03-14 Thread Andreas Rheinhardt
These strings are so short (longest takes 11B) that using
pointers is wasteful. Avoiding them also moves hashdesc
into .rodata (from .data.rel.ro).

Signed-off-by: Andreas Rheinhardt 
---
 libavutil/hash.c | 71 +++-
 1 file changed, 40 insertions(+), 31 deletions(-)

diff --git a/libavutil/hash.c b/libavutil/hash.c
index 12333982fb..43f77852da 100644
--- a/libavutil/hash.c
+++ b/libavutil/hash.c
@@ -38,22 +38,27 @@
 #include "intreadwrite.h"
 #include "mem.h"
 
+// ENTRY(HASH_TYPE, HASH_NAME, HASH_SIZE)
+#define HASHES(ENTRY)   \
+ENTRY(MD5,"MD5",16) \
+ENTRY(MURMUR3,"murmur3",16) \
+ENTRY(RIPEMD128,  "RIPEMD128",  16) \
+ENTRY(RIPEMD160,  "RIPEMD160",  20) \
+ENTRY(RIPEMD256,  "RIPEMD256",  32) \
+ENTRY(RIPEMD320,  "RIPEMD320",  40) \
+ENTRY(SHA160, "SHA160", 20) \
+ENTRY(SHA224, "SHA224", 28) \
+ENTRY(SHA256, "SHA256", 32) \
+ENTRY(SHA512_224, "SHA512/224", 28) \
+ENTRY(SHA512_256, "SHA512/256", 32) \
+ENTRY(SHA384, "SHA384", 48) \
+ENTRY(SHA512, "SHA512", 64) \
+ENTRY(CRC32,  "CRC32",   4) \
+ENTRY(ADLER32,"adler32", 4) \
+
 enum hashtype {
-MD5,
-MURMUR3,
-RIPEMD128,
-RIPEMD160,
-RIPEMD256,
-RIPEMD320,
-SHA160,
-SHA224,
-SHA256,
-SHA512_224,
-SHA512_256,
-SHA384,
-SHA512,
-CRC32,
-ADLER32,
+#define HASH_TYPE(TYPE, NAME, SIZE) TYPE,
+HASHES(HASH_TYPE)
 NUM_HASHES
 };
 
@@ -64,25 +69,29 @@ typedef struct AVHashContext {
 uint32_t crc;
 } AVHashContext;
 
+#define HASH_MAX_SIZE(TYPE, NAME, SIZE) \
+HASH_MAX_SIZE_BEFORE_ ## TYPE,  \
+HASH_MAX_SIZE_UNTIL_ ## TYPE ## _MINUS_ONE = FFMAX(SIZE, 
HASH_MAX_SIZE_BEFORE_ ## TYPE) - 1,
+enum {
+HASHES(HASH_MAX_SIZE)
+MAX_HASH_SIZE
+};
+_Static_assert(AV_HASH_MAX_SIZE >= MAX_HASH_SIZE, "AV_HASH_MAX_SIZE needs to 
be updated!");
+
+#define HASH_MAX_NAME_SIZE(TYPE, NAME, SIZE) \
+HASH_MAX_NAME_SIZE_BEFORE_ ## TYPE,  \
+HASH_MAX_NAME_SIZE_UNTIL_ ## TYPE ## _MINUS_ONE = FFMAX(sizeof(NAME), 
HASH_MAX_NAME_SIZE_BEFORE_ ## TYPE) - 1,
+enum {
+HASHES(HASH_MAX_NAME_SIZE)
+MAX_HASH_NAME_SIZE
+};
+
 static const struct {
-const char *name;
+const char name[MAX_HASH_NAME_SIZE];
 int size;
 } hashdesc[] = {
-[MD5] = {"MD5", 16},
-[MURMUR3] = {"murmur3", 16},
-[RIPEMD128] = {"RIPEMD128", 16},
-[RIPEMD160] = {"RIPEMD160", 20},
-[RIPEMD256] = {"RIPEMD256", 32},
-[RIPEMD320] = {"RIPEMD320", 40},
-[SHA160]  = {"SHA160",  20},
-[SHA224]  = {"SHA224",  28},
-[SHA256]  = {"SHA256",  32},
-[SHA512_224]  = {"SHA512/224",  28},
-[SHA512_256]  = {"SHA512/256",  32},
-[SHA384]  = {"SHA384",  48},
-[SHA512]  = {"SHA512",  64},
-[CRC32]   = {"CRC32",4},
-[ADLER32] = {"adler32",  4},
+#define HASH_DESC(TYPE, NAME, SIZE) [TYPE] = { NAME, SIZE },
+HASHES(HASH_DESC)
 };
 
 const char *av_hash_names(int i)
-- 
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 v3 7/9] avformat/pcm: factorize and improve determining the default packet size

2024-03-14 Thread Marton Balint
- Remove the 1024 cap on the number of samples, for high sample rate audio it
  was suboptimal, calculate the low neighbour power of two for the number of
  samples (audio blocks) instead.
- Make the function work correctly also for non-pcm codecs by using the stream
  bitrate to estimate the target packet size. A previous version of this patch
  used av_get_audio_frame_duration2() the estimate the desired packet size, but
  for some codecs that returns the duration of a single audio frame regardless
  of frame_bytes.
- Fallback to 4096/block_align*block_align if bitrate is not available.

Signed-off-by: Marton Balint 
---
 libavformat/pcm.c  | 41 ++---
 libavformat/pcm.h  |  1 +
 tests/ref/seek/lavf-al | 46 +-
 tests/ref/seek/lavf-ul | 46 +-
 4 files changed, 76 insertions(+), 58 deletions(-)

diff --git a/libavformat/pcm.c b/libavformat/pcm.c
index 9741f73667..9676da3251 100644
--- a/libavformat/pcm.c
+++ b/libavformat/pcm.c
@@ -24,27 +24,44 @@
 #include "internal.h"
 #include "pcm.h"
 
-#define RAW_SAMPLES 1024
+#define PCM_DEMUX_TARGET_FPS  25
 
-int ff_pcm_read_packet(AVFormatContext *s, AVPacket *pkt)
+int ff_pcm_default_packet_size(AVCodecParameters *par)
 {
-AVCodecParameters *par = s->streams[0]->codecpar;
-int ret, size;
+int nb_samples, max_samples, bits_per_sample;
+int64_t bitrate;
 
 if (par->block_align <= 0)
 return AVERROR(EINVAL);
 
-/*
- * Compute read size to complete a read every 62ms.
- * Clamp to RAW_SAMPLES if larger.
- */
-size = FFMAX(par->sample_rate/25, 1);
-if (par->block_align <= INT_MAX / RAW_SAMPLES) {
-size = FFMIN(size, RAW_SAMPLES) * par->block_align;
+max_samples = INT_MAX / par->block_align;
+bits_per_sample = av_get_bits_per_sample(par->codec_id);
+bitrate = par->bit_rate;
+
+/* Don't trust the codecpar bitrate if we can calculate it ourselves */
+if (bits_per_sample > 0 && par->sample_rate > 0 && 
par->ch_layout.nb_channels > 0)
+if ((int64_t)par->sample_rate * par->ch_layout.nb_channels < INT64_MAX 
/ bits_per_sample)
+bitrate = bits_per_sample * par->sample_rate * 
par->ch_layout.nb_channels;
+
+if (bitrate > 0) {
+nb_samples = av_clip64(bitrate / 8 / PCM_DEMUX_TARGET_FPS / 
par->block_align, 1, max_samples);
+nb_samples = 1 << av_log2(nb_samples);
 } else {
-size = par->block_align;
+/* Fallback to a size based method for a non-pcm codec with unknown 
bitrate */
+nb_samples = av_clip(4096 / par->block_align, 1, max_samples);
 }
 
+return par->block_align * nb_samples;
+}
+
+int ff_pcm_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+int ret, size;
+
+size = ff_pcm_default_packet_size(s->streams[0]->codecpar);
+if (size < 0)
+return size;
+
 ret = av_get_packet(s->pb, pkt, size);
 
 pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
diff --git a/libavformat/pcm.h b/libavformat/pcm.h
index 9af36d5a2e..1928497eed 100644
--- a/libavformat/pcm.h
+++ b/libavformat/pcm.h
@@ -24,6 +24,7 @@
 
 #include "avformat.h"
 
+int ff_pcm_default_packet_size(AVCodecParameters *par);
 int ff_pcm_read_packet(AVFormatContext *s, AVPacket *pkt);
 int ff_pcm_read_seek(AVFormatContext *s,
  int stream_index, int64_t timestamp, int flags);
diff --git a/tests/ref/seek/lavf-al b/tests/ref/seek/lavf-al
index 5a4085af4e..ebf7993425 100644
--- a/tests/ref/seek/lavf-al
+++ b/tests/ref/seek/lavf-al
@@ -1,50 +1,50 @@
-ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
882
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
512
 ret: 0 st:-1 flags:0  ts:-1.00
-ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
882
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
512
 ret: 0 st:-1 flags:1  ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.894150 pts: 1.894150 pos:  41766 size:   
882
+ret: 0 st: 0 flags:1 dts: 1.894150 pts: 1.894150 pos:  41766 size:   
512
 ret: 0 st: 0 flags:0  ts: 0.788345
-ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos:  17383 size:   
882
+ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos:  17383 size:   
512
 ret: 0 st: 0 flags:1  ts:-0.317506
-ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
882
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
512
 ret:-1 st:-1 flags:0  ts: 2.576668
 ret: 0 st:-1 flags:1  ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos:  32432 size:   
882
+ret: 0 st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos:  32432 size:   
512
 ret: 0 st: 0 flags:0  ts: 0.364989
-ret: 0 st: 0 flags:1 dts: 0.364989 pts: 0.364989 pos:   8048 size:   
882
+ret: 0 

[FFmpeg-devel] [PATCH 26/26] fate/wmavoice: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/wma.mak | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/fate/wma.mak b/tests/fate/wma.mak
index 308dced9d6..ed29edae3a 100644
--- a/tests/fate/wma.mak
+++ b/tests/fate/wma.mak
@@ -1,14 +1,14 @@
-FATE_WMAPRO-$(call DEMDEC, ASF, WMAPRO) += fate-wmapro-2ch
+FATE_WMAPRO-$(call DEMDEC, ASF, WMAPRO, ARESAMPLE_FILTER) += fate-wmapro-2ch
 fate-wmapro-2ch: CMD = pcm -i 
$(TARGET_SAMPLES)/wmapro/Beethovens_9th-1_small.wma -frames 43
 fate-wmapro-2ch: REF = $(SAMPLES)/wmapro/Beethovens_9th-1_small.pcm
 fate-wmapro-2ch: SIZE_TOLERANCE = 8192
 
-FATE_WMAPRO-$(call DEMDEC, ASF, WMAPRO) += fate-wmapro-5.1
+FATE_WMAPRO-$(call DEMDEC, ASF, WMAPRO, ARESAMPLE_FILTER) += fate-wmapro-5.1
 fate-wmapro-5.1: CMD = pcm -i 
$(TARGET_SAMPLES)/wmapro/latin_192_mulitchannel_cut.wma -frames 101
 fate-wmapro-5.1: REF = $(SAMPLES)/wmapro/latin_192_mulitchannel_cut.pcm
 fate-wmapro-5.1: SIZE_TOLERANCE = 24576
 
-FATE_WMAPRO-$(call DEMDEC, MOV, WMAPRO) += fate-wmapro-ism
+FATE_WMAPRO-$(call DEMDEC, MOV, WMAPRO, ARESAMPLE_FILTER) += fate-wmapro-ism
 fate-wmapro-ism: CMD = pcm -i $(TARGET_SAMPLES)/isom/vc1-wmapro.ism -vn
 fate-wmapro-ism: REF = $(SAMPLES)/isom/vc1-wmapro.pcm
 fate-wmapro-ism: SIZE_TOLERANCE = 4784
@@ -18,19 +18,19 @@ $(FATE_WMAPRO-yes): CMP = oneoff
 FATE_SAMPLES_AVCONV += $(FATE_WMAPRO-yes)
 fate-wmapro: $(FATE_WMAPRO-yes)
 
-FATE_WMAVOICE-$(call DEMDEC, ASF, WMAVOICE) += fate-wmavoice-7k
+FATE_WMAVOICE-$(call DEMDEC, ASF, WMAVOICE, ARESAMPLE_FILTER) += 
fate-wmavoice-7k
 fate-wmavoice-7k: CMD = pcm -i $(TARGET_SAMPLES)/wmavoice/streaming_CBR-7K.wma
 fate-wmavoice-7k: REF = $(SAMPLES)/wmavoice/streaming_CBR-7K_ref.pcm
 fate-wmavoice-7k: CMP_TARGET = 1368.61
 fate-wmavoice-7k: FUZZ = 3
 
-FATE_WMAVOICE-$(call DEMDEC, ASF, WMAVOICE) += fate-wmavoice-11k
+FATE_WMAVOICE-$(call DEMDEC, ASF, WMAVOICE, ARESAMPLE_FILTER) += 
fate-wmavoice-11k
 fate-wmavoice-11k: CMD = pcm -i 
$(TARGET_SAMPLES)/wmavoice/streaming_CBR-11K.wma
 fate-wmavoice-11k: REF = $(SAMPLES)/wmavoice/streaming_CBR-11K_ref.pcm
 fate-wmavoice-11k: CMP_TARGET = 965.24
 fate-wmavoice-11k: FUZZ = 3
 
-FATE_WMAVOICE-$(call DEMDEC, ASF, WMAVOICE) += fate-wmavoice-19k
+FATE_WMAVOICE-$(call DEMDEC, ASF, WMAVOICE, ARESAMPLE_FILTER) += 
fate-wmavoice-19k
 fate-wmavoice-19k: CMD = pcm -i 
$(TARGET_SAMPLES)/wmavoice/streaming_CBR-19K.wma
 fate-wmavoice-19k: REF = $(SAMPLES)/wmavoice/streaming_CBR-19K_ref.pcm
 fate-wmavoice-19k: CMP_TARGET = 689.33
@@ -41,13 +41,13 @@ $(FATE_WMAVOICE-yes): CMP = stddev
 FATE_SAMPLES_AVCONV += $(FATE_WMAVOICE-yes)
 fate-wmavoice: $(FATE_WMAVOICE-yes)
 
-FATE_WMA_ENCODE-$(call ENCDEC, WMAV1, ASF) += fate-wmav1-encode
+FATE_WMA_ENCODE-$(call ENCDEC, WMAV1, ASF, ARESAMPLE_FILTER) += 
fate-wmav1-encode
 fate-wmav1-encode: CMD = enc_dec_pcm asf wav s16le $(subst 
$(SAMPLES),$(TARGET_SAMPLES),$(REF)) -c:a wmav1 -b:a 128k
 fate-wmav1-encode: CMP_SHIFT = 8192
 fate-wmav1-encode: CMP_TARGET = 299.99
 fate-wmav1-encode: SIZE_TOLERANCE = 4632
 
-FATE_WMA_ENCODE-$(call ENCDEC, WMAV2, ASF) += fate-wmav2-encode
+FATE_WMA_ENCODE-$(call ENCDEC, WMAV2, ASF, ARESAMPLE_FILTER) += 
fate-wmav2-encode
 fate-wmav2-encode: CMD = enc_dec_pcm asf wav s16le $(subst 
$(SAMPLES),$(TARGET_SAMPLES),$(REF)) -c:a wmav2 -b:a 128k
 fate-wmav2-encode: CMP_SHIFT = 8192
 fate-wmav2-encode: CMP_TARGET = 267.92
-- 
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 25/26] fate/vqf: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/vqf.mak | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/fate/vqf.mak b/tests/fate/vqf.mak
index df5ff44f9d..ccdbe50033 100644
--- a/tests/fate/vqf.mak
+++ b/tests/fate/vqf.mak
@@ -1,4 +1,4 @@
-FATE_VQF-$(call DEMDEC, VQF, TWINVQ) += fate-twinvq
+FATE_VQF-$(call DEMDEC, VQF, TWINVQ, ARESAMPLE_FILTER) += fate-twinvq
 fate-twinvq: CMD = pcm -i $(TARGET_SAMPLES)/vqf/achterba.vqf
 fate-twinvq: CMP = oneoff
 fate-twinvq: REF = $(SAMPLES)/vqf/achterba.pcm
-- 
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 24/26] fate/voice: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/voice.mak | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/fate/voice.mak b/tests/fate/voice.mak
index 61a4617b44..ab34e353f7 100644
--- a/tests/fate/voice.mak
+++ b/tests/fate/voice.mak
@@ -33,7 +33,7 @@ fate-g723_1-dec-7: CMD = framecrc -postfilter 1 -i 
$(TARGET_SAMPLES)/g723_1/dtx6
 FATE_G723_1 += fate-g723_1-dec-8
 fate-g723_1-dec-8: CMD = framecrc -postfilter 1 -i 
$(TARGET_SAMPLES)/g723_1/dtx63e.tco -af aresample
 
-FATE_VOICE-$(call DEMDEC, G723_1, G723_1) += $(FATE_G723_1)
+FATE_VOICE-$(call DEMDEC, G723_1, G723_1, ARESAMPLE_FILTER) += $(FATE_G723_1)
 fate-g723_1: $(FATE_G723_1)
 
 FATE_G726 += fate-g726-encode-2bit
@@ -63,7 +63,7 @@ fate-gsm-toast: CMD = framecrc -i 
$(TARGET_SAMPLES)/gsm/sample-gsm-8000.mov -t 1
 FATE_VOICE-yes += $(FATE_GSM-yes)
 fate-gsm: $(FATE_GSM-yes)
 
-FATE_VOICE-$(call DEMDEC, QCP, QCELP) += fate-qcelp
+FATE_VOICE-$(call DEMDEC, QCP, QCELP, ARESAMPLE_FILTER) += fate-qcelp
 fate-qcelp: CMD = pcm -i $(TARGET_SAMPLES)/qcp/0036580847.QCP
 fate-qcelp: CMP = oneoff
 fate-qcelp: REF = $(SAMPLES)/qcp/0036580847.pcm
-- 
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 23/26] fate/vorbis: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/vorbis.mak | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/fate/vorbis.mak b/tests/fate/vorbis.mak
index b9b7405e87..781430bcd3 100644
--- a/tests/fate/vorbis.mak
+++ b/tests/fate/vorbis.mak
@@ -94,7 +94,9 @@ fate-vorbis-1833-chapters: CMD = probechapters 
$(TARGET_SAMPLES)/vorbis/vorbis_c
 
 FATE_SAMPLES_FFPROBE += $(FATE_VORBIS_FFPROBE-yes)
 
-FATE_SAMPLES_AVCONV-$(call DEMDEC, OGG, VORBIS) += $(FATE_VORBIS)
-fate-vorbis: $(FATE_VORBIS) $(FATE_VORBIS_FFPROBE-yes)
-$(FATE_VORBIS): CMP = oneoff
+FATE_VORBIS-$(call DEMDEC, OGG, VORBIS, ARESAMPLE_FILTER) += $(FATE_VORBIS)
+
+FATE_SAMPLES_AVCONV += $(FATE_VORBIS-yes)
+fate-vorbis: $(FATE_VORBIS-yes) $(FATE_VORBIS_FFPROBE-yes)
+$(FATE_VORBIS-yes): CMP = oneoff
 fate-vorbis-encode: CMP = stddev
-- 
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 22/26] fate/real: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/real.mak | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/fate/real.mak b/tests/fate/real.mak
index dd5f9c61db..13ceab7adf 100644
--- a/tests/fate/real.mak
+++ b/tests/fate/real.mak
@@ -9,13 +9,13 @@ fate-ra4-288: CMP = oneoff
 FATE_REALMEDIA_AUDIO-$(call DEMDEC, RM, RA_144) += fate-ra-144
 fate-ra-144: CMD = md5 -i $(TARGET_SAMPLES)/real/ra3_in_rm_file.rm -f s16le
 
-FATE_REALMEDIA_AUDIO-$(call DEMDEC, RM, RA_288) += fate-ra-288
+FATE_REALMEDIA_AUDIO-$(call DEMDEC, RM, RA_288, ARESAMPLE_FILTER) += 
fate-ra-288
 fate-ra-288: CMD = pcm -i $(TARGET_SAMPLES)/real/ra_288.rm
 fate-ra-288: CMP = oneoff
 fate-ra-288: REF = $(SAMPLES)/real/ra_288.pcm
 fate-ra-288: FUZZ = 2
 
-FATE_REALMEDIA_AUDIO-$(call DEMDEC, RM, COOK) += fate-ra-cook
+FATE_REALMEDIA_AUDIO-$(call DEMDEC, RM, COOK, ARESAMPLE_FILTER) += fate-ra-cook
 fate-ra-cook: CMD = pcm -i $(TARGET_SAMPLES)/real/ra_cook.rm
 fate-ra-cook: CMP = oneoff
 fate-ra-cook: REF = $(SAMPLES)/real/ra_cook.pcm
@@ -48,7 +48,7 @@ fate-sipr-16k: SIZE_TOLERANCE = 4
 
 $(FATE_SIPR): CMP = oneoff
 
-FATE_REALMEDIA_AUDIO-$(call DEMDEC, RM, SIPR) += $(FATE_SIPR)
+FATE_REALMEDIA_AUDIO-$(call DEMDEC, RM, SIPR, ARESAMPLE_FILTER) += $(FATE_SIPR)
 fate-sipr: $(FATE_SIPR)
 
 fate-realaudio: $(FATE_REALAUDIO-yes)
-- 
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 21/26] fate/pcm: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/pcm.mak | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/fate/pcm.mak b/tests/fate/pcm.mak
index 4e79fc7c41..b10233a9eb 100644
--- a/tests/fate/pcm.mak
+++ b/tests/fate/pcm.mak
@@ -1,10 +1,10 @@
-FATE_SAMPLES_PCM-$(call DEMDEC, WAV, PCM_U8) += fate-iff-pcm
+FATE_SAMPLES_PCM-$(call DEMDEC, WAV, PCM_U8, ARESAMPLE_FILTER) += fate-iff-pcm
 fate-iff-pcm: CMD = md5 -i $(TARGET_SAMPLES)/iff/Bells -f s16le -af aresample
 
-FATE_SAMPLES_PCM-$(call DEMDEC, MPEGPS, PCM_DVD) += fate-pcm_dvd
+FATE_SAMPLES_PCM-$(call DEMDEC, MPEGPS, PCM_DVD, ARESAMPLE_FILTER) += 
fate-pcm_dvd
 fate-pcm_dvd: CMD = framecrc -i 
$(TARGET_SAMPLES)/pcm-dvd/coolitnow-partial.vob -vn -af aresample
 
-FATE_SAMPLES_PCM-$(call DEMDEC, EA, PCM_S16LE_PLANAR) += fate-pcm-planar
+FATE_SAMPLES_PCM-$(call DEMDEC, EA, PCM_S16LE_PLANAR, ARESAMPLE_FILTER) += 
fate-pcm-planar
 fate-pcm-planar: CMD = framecrc -i $(TARGET_SAMPLES)/ea-mad/xeasport.mad -vn 
-af aresample
 
 FATE_SAMPLES_PCM-$(call DEMDEC, MOV, PCM_S16BE) += fate-pcm_s16be-stereo
@@ -13,10 +13,10 @@ fate-pcm_s16be-stereo: CMD = md5 -i 
$(TARGET_SAMPLES)/qt-surge-suite/surge-2-16-
 FATE_SAMPLES_PCM-$(call DEMDEC, MOV, PCM_S16LE) += fate-pcm_s16le-stereo
 fate-pcm_s16le-stereo: CMD = md5 -i 
$(TARGET_SAMPLES)/qt-surge-suite/surge-2-16-L-sowt.mov -f s16le
 
-FATE_SAMPLES_PCM-$(call DEMDEC, MOV, PCM_U8) += fate-pcm_u8-mono
+FATE_SAMPLES_PCM-$(call DEMDEC, MOV, PCM_U8, ARESAMPLE_FILTER) += 
fate-pcm_u8-mono
 fate-pcm_u8-mono: CMD = md5 -i 
$(TARGET_SAMPLES)/qt-surge-suite/surge-1-8-raw.mov -f s16le -af aresample
 
-FATE_SAMPLES_PCM-$(call DEMDEC, MOV, PCM_U8) += fate-pcm_u8-stereo
+FATE_SAMPLES_PCM-$(call DEMDEC, MOV, PCM_U8, ARESAMPLE_FILTER) += 
fate-pcm_u8-stereo
 fate-pcm_u8-stereo: CMD = md5 -i 
$(TARGET_SAMPLES)/qt-surge-suite/surge-2-8-raw.mov -f s16le -af aresample
 
 FATE_SAMPLES_PCM-$(call DEMDEC, W64, PCM_S16LE) += fate-w64
-- 
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 20/26] fate/mpc: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/mpc.mak | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/fate/mpc.mak b/tests/fate/mpc.mak
index cde6e55177..b737da449b 100644
--- a/tests/fate/mpc.mak
+++ b/tests/fate/mpc.mak
@@ -4,7 +4,7 @@ fate-mpc7-demux: CMD = crc -i 
$(TARGET_SAMPLES)/musepack/inside-mp7.mpc -c:a cop
 FATE_MPC-$(CONFIG_MPC8_DEMUXER) += fate-mpc8-demux
 fate-mpc8-demux: CMD = crc -i $(TARGET_SAMPLES)/musepack/inside-mp8.mpc -c:a 
copy
 
-FATE_MPC-$(call DEMDEC, MPC, MPC7) += fate-musepack7
+FATE_MPC-$(call DEMDEC, MPC, MPC7, ARESAMPLE_FILTER) += fate-musepack7
 fate-musepack7: CMD = pcm -i $(TARGET_SAMPLES)/musepack/inside-mp7.mpc
 fate-musepack7: CMP = oneoff
 fate-musepack7: REF = $(SAMPLES)/musepack/inside-mp7.pcm
-- 
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 19/26] fate/mp3: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/mp3.mak | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/fate/mp3.mak b/tests/fate/mp3.mak
index b874e7c7a4..638ff63264 100644
--- a/tests/fate/mp3.mak
+++ b/tests/fate/mp3.mak
@@ -36,7 +36,7 @@ $(FATE_MP3): FUZZ = 18
 
 fate-mp3-float-extra_overread: FUZZ = 23
 
-FATE_MP3-$(call DEMDEC, MP3, MP3FLOAT) += $(FATE_MP3)
+FATE_MP3-$(call DEMDEC, MP3, MP3FLOAT, ARESAMPLE_FILTER) += $(FATE_MP3)
 
 FATE_SAMPLES_AVCONV += $(FATE_MP3-yes)
 fate-mp3: $(FATE_MP3-yes)
-- 
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 18/26] fate/mov: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/mov.mak | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 51fd5fa2f3..b54fe19620 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -10,11 +10,9 @@ FATE_MOV = fate-mov-3elist \
fate-mov-tenc-only-encrypted \
fate-mov-invalid-elst-entry-count \
fate-mov-gpmf-remux \
-   fate-mov-440hz-10ms \
fate-mov-ibi-elst-starts-b \
fate-mov-elst-ends-betn-b-and-i \
fate-mov-frag-overlap \
-   fate-mov-bbi-elst-starts-b \
fate-mov-neg-firstpts-discard-frames \
fate-mov-stream-shorter-than-movie \
fate-mov-pcm-remux \
@@ -69,6 +67,8 @@ fate-mov-2elist-elist1-ends-bframe: CMD = framemd5 -i 
$(TARGET_SAMPLES)/mov/mov-
 fate-mov-elst-ends-betn-b-and-i: CMD = framemd5 -i 
$(TARGET_SAMPLES)/mov/elst_ends_betn_b_and_i.mp4
 
 # Makes sure that we handle edit lists and start padding correctly.
+FATE_MOV_FFMPEG_SAMPLES-$(call FRAMEMD5, MOV, AAC, ARESAMPLE_FILTER) \
++= fate-mov-440hz-10ms
 fate-mov-440hz-10ms: CMD = framemd5 -i $(TARGET_SAMPLES)/mov/440hz-10ms.m4a 
-af aresample
 
 # Makes sure that we handle invalid edit list entry count correctly.
@@ -87,6 +87,8 @@ fate-mov-frag-overlap: CMD = framemd5 -i 
$(TARGET_SAMPLES)/mov/frag_overlap.mp4
 # Makes sure that we pick the right frames according to edit list when there 
is no keyframe with PTS < edit list start.
 # For example, when video starts on a B-frame, and edit list starts on that 
B-frame too.
 # GOP structure : B B I in presentation order.
+FATE_MOV_FFMPEG_SAMPLES-$(call FRAMEMD5, MOV, AAC_FIXED, ARESAMPLE_FILTER) \
++= fate-mov-bbi-elst-starts-b
 fate-mov-bbi-elst-starts-b: CMD = framemd5 -flags +bitexact -acodec aac_fixed 
-i $(TARGET_SAMPLES)/h264/twofields_packet.mp4 -af aresample
 
 # Makes sure that the stream start_time is not negative when the first packet 
is a DISCARD packet with negative timestamp.
@@ -225,7 +227,7 @@ fate-mov-mp4-iamf-stereo: CMD = transcode wav $(SRC) mp4 " \
   -streamid 0:0 -c:a flac -t 1" "-c:a copy -map 0" \
   "-show_entries 
stream_group=index,id,nb_streams,type:stream_group_components:stream_group_disposition:stream_group_tags:stream_group_stream=index,id:stream_group_stream_disposition"
 
-FATE_MOV_FFMPEG_FFPROBE-$(call TRANSCODE, FLAC, MOV, WAV_DEMUXER 
PCM_S16LE_DECODER) += fate-mov-mp4-iamf-5_1_4
+FATE_MOV_FFMPEG_FFPROBE-$(call TRANSCODE, FLAC, MOV, WAV_DEMUXER 
PCM_S16LE_DECODER ARESAMPLE_FILTER) += fate-mov-mp4-iamf-5_1_4
 fate-mov-mp4-iamf-5_1_4: tests/data/asynth-44100-10.wav 
tests/data/filtergraphs/iamf_5_1_4 tests/data/streamgroups/audio_element-5_1_4 
tests/data/streamgroups/mix_presentation-5_1_4
 fate-mov-mp4-iamf-5_1_4: SRC = $(TARGET_PATH)/tests/data/asynth-44100-10.wav
 fate-mov-mp4-iamf-5_1_4: CMD = transcode wav $(SRC) mp4 
"-auto_conversion_filters \
@@ -235,7 +237,7 @@ fate-mov-mp4-iamf-5_1_4: CMD = transcode wav $(SRC) mp4 
"-auto_conversion_filter
   -streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 -streamid 4:4 
-streamid 5:5 -map [FRONT] -map [BACK] -map [CENTER] -map [LFE] -map 
[TOP_FRONT] -map [TOP_BACK] -c:a flac -t 1" "-c:a copy -map 0" \
   "-show_entries 
stream_group=index,id,nb_streams,type:stream_group_components:stream_group_disposition:stream_group_tags:stream_group_stream=index,id:stream_group_stream_disposition"
 
-FATE_MOV_FFMPEG_FFPROBE-$(call TRANSCODE, FLAC, MOV, WAV_DEMUXER 
PCM_S16LE_DECODER) += fate-mov-mp4-iamf-7_1_4
+FATE_MOV_FFMPEG_FFPROBE-$(call TRANSCODE, FLAC, MOV, WAV_DEMUXER 
PCM_S16LE_DECODER ARESAMPLE_FILTER) += fate-mov-mp4-iamf-7_1_4
 fate-mov-mp4-iamf-7_1_4: tests/data/asynth-44100-12.wav 
tests/data/filtergraphs/iamf_7_1_4 tests/data/streamgroups/audio_element-7_1_4 
tests/data/streamgroups/mix_presentation-7_1_4
 fate-mov-mp4-iamf-7_1_4: SRC = $(TARGET_PATH)/tests/data/asynth-44100-12.wav
 fate-mov-mp4-iamf-7_1_4: CMD = transcode wav $(SRC) mp4 
"-auto_conversion_filters \
@@ -245,7 +247,7 @@ fate-mov-mp4-iamf-7_1_4: CMD = transcode wav $(SRC) mp4 
"-auto_conversion_filter
   -streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 -streamid 4:4 
-streamid 5:5 -streamid 6:6 -map [FRONT] -map [BACK] -map [CENTER] -map [LFE] 
-map [SIDE] -map [TOP_FRONT] -map [TOP_BACK] -c:a flac -t 1" "-c:a copy -map 0" 
\
   "-show_entries 
stream_group=index,id,nb_streams,type:stream_group_components:stream_group_disposition:stream_group_tags:stream_group_stream=index,id:stream_group_stream_disposition"
 
-FATE_MOV_FFMPEG_FFPROBE-$(call TRANSCODE, FLAC, MOV, WAV_DEMUXER 
PCM_S16LE_DECODER) += fate-mov-mp4-iamf-ambisonic_1
+FATE_MOV_FFMPEG_FFPROBE-$(call TRANSCODE, FLAC, MOV, WAV_DEMUXER 
PCM_S16LE_DECODER ARESAMPLE_FILTER) += fate-mov-mp4-iamf-ambisonic_1
 fate-mov-mp4-iamf-ambisonic_1: tests/data/asynth-44100-4.wav 
tests/data/filtergraphs/iamf_ambisonic_1 

[FFmpeg-devel] [PATCH 17/26] fate/monkeysaudio: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/monkeysaudio.mak | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/fate/monkeysaudio.mak b/tests/fate/monkeysaudio.mak
index 03c646cd47..7ffe2fcdcf 100644
--- a/tests/fate/monkeysaudio.mak
+++ b/tests/fate/monkeysaudio.mak
@@ -19,5 +19,5 @@ fate-lossless-monkeysaudio-399: CMD = md5 -i 
$(TARGET_SAMPLES)/lossless-audio/lu
 FATE_APE += fate-lossless-monkeysaudio-legacy
 fate-lossless-monkeysaudio-legacy: CMD = md5 -i 
$(TARGET_SAMPLES)/lossless-audio/NoLegacy-cut.ape -f s32le -af aresample
 
-FATE_SAMPLES_AVCONV-$(call DEMDEC, APE, APE) += $(FATE_APE)
+FATE_SAMPLES_AVCONV-$(call DEMDEC, APE, APE, ARESAMPLE_FILTER) += $(FATE_APE)
 fate-lossless-monkeysaudio: $(FATE_APE)
-- 
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 16/26] fate/lossless-audio: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/lossless-audio.mak | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/fate/lossless-audio.mak b/tests/fate/lossless-audio.mak
index f3aa700743..7c5af885b4 100644
--- a/tests/fate/lossless-audio.mak
+++ b/tests/fate/lossless-audio.mak
@@ -1,22 +1,22 @@
-FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, MOV, ALAC) += fate-lossless-alac
+FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, MOV, ALAC, ARESAMPLE_FILTER) += 
fate-lossless-alac
 fate-lossless-alac: CMD = md5 -i $(TARGET_SAMPLES)/lossless-audio/inside.m4a 
-f s16le -af aresample
 
 FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, MLP, MLP) += 
fate-lossless-meridianaudio
 fate-lossless-meridianaudio: CMD = md5 -i 
$(TARGET_SAMPLES)/lossless-audio/luckynight-partial.mlp -f s16le
 
-FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, RM, RALF) += fate-ralf
+FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, RM, RALF, ARESAMPLE_FILTER) += 
fate-ralf
 fate-ralf: CMD = md5 -i 
$(TARGET_SAMPLES)/lossless-audio/luckynight-partial.rmvb -vn -f s16le -af 
aresample
 
-FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, SHORTEN, SHORTEN) += 
fate-lossless-shorten
+FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, SHORTEN, SHORTEN, ARESAMPLE_FILTER) 
+= fate-lossless-shorten
 fate-lossless-shorten: CMD = md5 -i 
$(TARGET_SAMPLES)/lossless-audio/luckynight-partial.shn -f s16le -af aresample
 
-FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, RKA, RKA) += fate-lossless-rka
+FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, RKA, RKA, ARESAMPLE_FILTER) += 
fate-lossless-rka
 fate-lossless-rka: CMD = md5 -i 
$(TARGET_SAMPLES)/lossless-audio/luckynight-partial.rka -f s16le -af aresample
 
-FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, OSQ, OSQ) += fate-lossless-osq
+FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, OSQ, OSQ, ARESAMPLE_FILTER) += 
fate-lossless-osq
 fate-lossless-osq: CMD = md5 -i 
$(TARGET_SAMPLES)/lossless-audio/luckynight-partial.osq -f s16le -af aresample
 
-FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, TAK, TAK) += fate-lossless-tak
+FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, TAK, TAK, ARESAMPLE_FILTER) += 
fate-lossless-tak
 fate-lossless-tak: CMD = crc -i 
$(TARGET_SAMPLES)/lossless-audio/luckynight-partial.tak -af aresample
 
 FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, TTA, TTA) += fate-lossless-tta
@@ -25,7 +25,7 @@ fate-lossless-tta: CMD = crc -i 
$(TARGET_SAMPLES)/lossless-audio/inside.tta
 FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, TTA, TTA) += 
fate-lossless-tta-encrypted
 fate-lossless-tta-encrypted: CMD = crc -password ffmpeg -i 
$(TARGET_SAMPLES)/lossless-audio/encrypted.tta
 
-FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, ASF, WMALOSSLESS) += 
fate-lossless-wma fate-lossless-wma24-1 fate-lossless-wma24-2 
fate-lossless-wma24-rawtile
+FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, ASF, WMALOSSLESS, ARESAMPLE_FILTER) 
+= fate-lossless-wma fate-lossless-wma24-1 fate-lossless-wma24-2 
fate-lossless-wma24-rawtile
 fate-lossless-wma: CMD = md5 -i 
$(TARGET_SAMPLES)/lossless-audio/luckynight-partial.wma -f s16le -frames 209 
-af aresample
 fate-lossless-wma24-1: CMD = md5 -i 
$(TARGET_SAMPLES)/lossless-audio/master_audio_2.0_24bit.wma -f s24le -af 
aresample
 fate-lossless-wma24-2: CMD = md5 -i 
$(TARGET_SAMPLES)/lossless-audio/Mega_Weird_Audio_Test_24bit.wma -f s24le -af 
aresample
-- 
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 15/26] fate/libswresample: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/libswresample.mak | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/fate/libswresample.mak b/tests/fate/libswresample.mak
index 405328797e..a1e5ab91fa 100644
--- a/tests/fate/libswresample.mak
+++ b/tests/fate/libswresample.mak
@@ -1089,7 +1089,7 @@ FATE_SWR_RESAMPLE-$(call FILTERDEMDECENCMUX, ARESAMPLE, 
WAV, PCM_S16LE, PCM_S16L
 fate-swr-resample: $(FATE_SWR_RESAMPLE-yes)
 FATE_SWR += $(FATE_SWR_RESAMPLE-yes)
 
-FATE_SWR_AUDIOCONVERT-$(call FILTERDEMDECENCMUX, AFORMAT AEVAL, WAV, 
PCM_S16LE, PCM_S16LE, WAV) += fate-swr-audioconvert
+FATE_SWR_AUDIOCONVERT-$(call FILTERDEMDECENCMUX, ARESAMPLE AFORMAT AEVAL, WAV, 
PCM_S16LE, PCM_S16LE, WAV) += fate-swr-audioconvert
 fate-swr-audioconvert: tests/data/asynth-44100-1.wav
 fate-swr-audioconvert: REF = tests/data/asynth-44100-1.wav
 fate-swr-audioconvert: CMD = ffmpeg -i 
$(TARGET_PATH)/tests/data/asynth-44100-1.wav -af 
"aresample,aformat=fltp,aresample,aeval=val(0)+(random(0)-0.5)/33000,aresample,aformat=fltp,aresample"
 -f wav -c:a pcm_s16le -
-- 
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/26] fate/iamf: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/iamf.mak | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/fate/iamf.mak b/tests/fate/iamf.mak
index 6fe0d54762..cf56a67e6f 100644
--- a/tests/fate/iamf.mak
+++ b/tests/fate/iamf.mak
@@ -1,4 +1,4 @@
-FATE_IAMF += fate-iamf-stereo
+FATE_IAMF-$(call TRANSCODE, FLAC, IAMF, WAV_DEMUXER PCM_S16LE_DECODER) += 
fate-iamf-stereo
 fate-iamf-stereo: tests/data/asynth-44100-2.wav 
tests/data/streamgroups/audio_element-stereo 
tests/data/streamgroups/mix_presentation-stereo
 fate-iamf-stereo: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-iamf-stereo: CMD = transcode wav $(SRC) iamf " \
@@ -7,7 +7,7 @@ fate-iamf-stereo: CMD = transcode wav $(SRC) iamf " \
   -streamid 0:0 -c:a flac -t 1" "-c:a copy -map 0" \
   "-show_entries 
stream_group=index,id,nb_streams,type:stream_group_components:stream_group_stream=index,id:stream_group_stream_disposition"
 
-FATE_IAMF += fate-iamf-5_1_4
+FATE_IAMF-$(call TRANSCODE, FLAC, IAMF, WAV_DEMUXER PCM_S16LE_DECODER 
ARESAMPLE_FILTER) += fate-iamf-5_1_4
 fate-iamf-5_1_4: tests/data/asynth-44100-10.wav 
tests/data/filtergraphs/iamf_5_1_4 tests/data/streamgroups/audio_element-5_1_4 
tests/data/streamgroups/mix_presentation-5_1_4
 fate-iamf-5_1_4: SRC = $(TARGET_PATH)/tests/data/asynth-44100-10.wav
 fate-iamf-5_1_4: CMD = transcode wav $(SRC) iamf "-auto_conversion_filters \
@@ -17,7 +17,7 @@ fate-iamf-5_1_4: CMD = transcode wav $(SRC) iamf 
"-auto_conversion_filters \
   -streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 -streamid 4:4 
-streamid 5:5 -map [FRONT] -map [BACK] -map [CENTER] -map [LFE] -map 
[TOP_FRONT] -map [TOP_BACK] -c:a flac -t 1" "-c:a copy -map 0" \
   "-show_entries 
stream_group=index,id,nb_streams,type:stream_group_components:stream_group_stream=index,id:stream_group_stream_disposition"
 
-FATE_IAMF += fate-iamf-7_1_4
+FATE_IAMF-$(call TRANSCODE, FLAC, IAMF, WAV_DEMUXER PCM_S16LE_DECODER 
ARESAMPLE_FILTER) += fate-iamf-7_1_4
 fate-iamf-7_1_4: tests/data/asynth-44100-12.wav 
tests/data/filtergraphs/iamf_7_1_4 tests/data/streamgroups/audio_element-7_1_4 
tests/data/streamgroups/mix_presentation-7_1_4
 fate-iamf-7_1_4: SRC = $(TARGET_PATH)/tests/data/asynth-44100-12.wav
 fate-iamf-7_1_4: CMD = transcode wav $(SRC) iamf "-auto_conversion_filters \
@@ -27,7 +27,7 @@ fate-iamf-7_1_4: CMD = transcode wav $(SRC) iamf 
"-auto_conversion_filters \
   -streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 -streamid 4:4 
-streamid 5:5 -streamid 6:6 -map [FRONT] -map [BACK] -map [CENTER] -map [LFE] 
-map [SIDE] -map [TOP_FRONT] -map [TOP_BACK] -c:a flac -t 1" "-c:a copy -map 0" 
\
   "-show_entries 
stream_group=index,id,nb_streams,type:stream_group_components:stream_group_stream=index,id:stream_group_stream_disposition"
 
-FATE_IAMF += fate-iamf-ambisonic_1
+FATE_IAMF-$(call TRANSCODE, FLAC, IAMF, WAV_DEMUXER PCM_S16LE_DECODER 
ARESAMPLE_FILTER) += fate-iamf-ambisonic_1
 fate-iamf-ambisonic_1: tests/data/asynth-44100-4.wav 
tests/data/filtergraphs/iamf_ambisonic_1 
tests/data/streamgroups/audio_element-ambisonic_1 
tests/data/streamgroups/mix_presentation-ambisonic_1
 fate-iamf-ambisonic_1: SRC = $(TARGET_PATH)/tests/data/asynth-44100-4.wav
 fate-iamf-ambisonic_1: CMD = transcode wav $(SRC) iamf 
"-auto_conversion_filters \
@@ -37,8 +37,8 @@ fate-iamf-ambisonic_1: CMD = transcode wav $(SRC) iamf 
"-auto_conversion_filters
   -streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 -map [MONO0] -map 
[MONO1] -map [MONO2] -map [MONO3] -c:a flac -t 1" "-c:a copy -map 0" \
   "-show_entries 
stream_group=index,id,nb_streams,type:stream_group_components:stream_group_stream=index,id:stream_group_stream_disposition"
 
-FATE_IAMF-$(call TRANSCODE, FLAC, IAMF, WAV_DEMUXER PCM_S16LE_DECODER) += 
$(FATE_IAMF)
+FATE_IAMF += $(FATE_IAMF-yes)
 
-FATE_FFMPEG_FFPROBE += $(FATE_IAMF-yes)
+FATE_FFMPEG_FFPROBE += $(FATE_IAMF)
 
-fate-iamf: $(FATE_IAMF-yes)
+fate-iamf: $(FATE_IAMF)
-- 
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 13/26] fate/gapless: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/gapless.mak | 78 +-
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/tests/fate/gapless.mak b/tests/fate/gapless.mak
index 68a396e187..dfae964662 100644
--- a/tests/fate/gapless.mak
+++ b/tests/fate/gapless.mak
@@ -1,47 +1,47 @@
-FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3
+FATE_GAPLESS-$(call DEMDEC, MP3, MP3, ARESAMPLE_FILTER) += fate-gapless-mp3
 fate-gapless-mp3: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 "-c:a 
mp3"
 
 FATE_GAPLESSINFO_PROBE-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3-side-data
 fate-gapless-mp3-side-data: CMD = ffprobe_demux 
$(TARGET_SAMPLES)/gapless/gapless.mp3
 
-FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-audiomatch-square-mp3
+FATE_GAPLESS-$(call DEMDEC, MP3, MP3, ARESAMPLE_FILTER) += 
fate-audiomatch-square-mp3
 fate-audiomatch-square-mp3: CMD = audio_match 
$(TARGET_SAMPLES)/audiomatch/square3.mp3 $(SAMPLES)/audiomatch/square3.wav
 
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += fate-audiomatch-square-aac
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += 
fate-audiomatch-afconvert-16000-mono-lc-adts
fate-audiomatch-afconvert-16000-mono-lc-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += 
fate-audiomatch-afconvert-44100-mono-lc-adts
fate-audiomatch-afconvert-44100-mono-lc-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += 
fate-audiomatch-afconvert-16000-mono-he-adts
fate-audiomatch-afconvert-16000-mono-he-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += 
fate-audiomatch-afconvert-44100-mono-he-adts
fate-audiomatch-afconvert-44100-mono-he-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += 
fate-audiomatch-afconvert-16000-stereo-he-adts  
fate-audiomatch-afconvert-16000-stereo-he-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += 
fate-audiomatch-afconvert-44100-stereo-he-adts  
fate-audiomatch-afconvert-44100-stereo-he-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += 
fate-audiomatch-afconvert-16000-stereo-he2-adts 
fate-audiomatch-afconvert-16000-stereo-he2-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += 
fate-audiomatch-afconvert-44100-stereo-he2-adts 
fate-audiomatch-afconvert-44100-stereo-he2-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += 
fate-audiomatch-afconvert-16000-stereo-lc-adts  
fate-audiomatch-afconvert-16000-stereo-lc-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += 
fate-audiomatch-afconvert-44100-stereo-lc-adts  
fate-audiomatch-afconvert-44100-stereo-lc-m4a
-
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += fate-audiomatch-faac-16000-mono-lc-adts  
  fate-audiomatch-faac-16000-mono-lc-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += fate-audiomatch-faac-44100-mono-lc-adts  
  fate-audiomatch-faac-44100-mono-lc-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += 
fate-audiomatch-faac-16000-stereo-lc-adts  
fate-audiomatch-faac-16000-stereo-lc-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += 
fate-audiomatch-faac-44100-stereo-lc-adts  
fate-audiomatch-faac-44100-stereo-lc-m4a
-
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += fate-audiomatch-dolby-44100-mono-lc-mp4
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += fate-audiomatch-dolby-44100-mono-he-mp4
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += fate-audiomatch-dolby-44100-stereo-he-mp4
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += 
fate-audiomatch-dolby-44100-stereo-he2-mp4
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += fate-audiomatch-dolby-44100-stereo-lc-mp4
-
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += fate-audiomatch-nero-16000-mono-lc-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += fate-audiomatch-nero-44100-mono-lc-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += fate-audiomatch-nero-16000-mono-he-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += fate-audiomatch-nero-44100-mono-he-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += fate-audiomatch-nero-16000-stereo-he-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += fate-audiomatch-nero-44100-stereo-he-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += fate-audiomatch-nero-16000-stereo-he2-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += fate-audiomatch-nero-44100-stereo-he2-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += fate-audiomatch-nero-16000-stereo-lc-m4a
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += fate-audiomatch-nero-44100-stereo-lc-m4a
-
-FATE_GAPLESS-$(CONFIG_MOV_DEMUXER) += 
fate-audiomatch-quicktime7-44100-stereo-lc-mp4 
fate-audiomatch-quicktimeX-44100-stereo-lc-m4a
+FATE_GAPLESS-$(call DEMDEC, MOV, AAC, ARESAMPLE_FILTER) += 
fate-audiomatch-square-aac
+FATE_GAPLESS-$(call DEMDEC, MOV, AAC, ARESAMPLE_FILTER) += 
fate-audiomatch-afconvert-16000-mono-lc-adts
fate-audiomatch-afconvert-16000-mono-lc-m4a
+FATE_GAPLESS-$(call DEMDEC, MOV, AAC, ARESAMPLE_FILTER) += 
fate-audiomatch-afconvert-44100-mono-lc-adts
fate-audiomatch-afconvert-44100-mono-lc-m4a
+FATE_GAPLESS-$(call DEMDEC, MOV, AAC, ARESAMPLE_FILTER) += 
fate-audiomatch-afconvert-16000-mono-he-adts
fate-audiomatch-afconvert-16000-mono-he-m4a
+FATE_GAPLESS-$(call DEMDEC, MOV, AAC, ARESAMPLE_FILTER) += 
fate-audiomatch-afconvert-44100-mono-he-adts
fate-audiomatch-afconvert-44100-mono-he-m4a
+FATE_GAPLESS-$(call DEMDEC, MOV, AAC, ARESAMPLE_FILTER) 

[FFmpeg-devel] [PATCH 12/26] fate/ffmpeg: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/ffmpeg.mak | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
index c242c4fe53..9cf05ead68 100644
--- a/tests/fate/ffmpeg.mak
+++ b/tests/fate/ffmpeg.mak
@@ -129,7 +129,7 @@ fate-ffmpeg-fix_sub_duration_heartbeat: CMD = fmtstdout srt 
-fix_sub_duration \
 
 # FIXME: the integer AAC decoder does not produce the same output on all 
platforms
 # so until that is fixed we use the volume filter to silence the data
-FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MATROSKA, H264 AAC_FIXED, 
PCM_S32LE_ENCODER VOLUME_FILTER) += fate-ffmpeg-streamloop-transcode-av
+FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MATROSKA, H264 AAC_FIXED, 
PCM_S32LE_ENCODER VOLUME_FILTER ARESAMPLE_FILTER) += 
fate-ffmpeg-streamloop-transcode-av
 fate-ffmpeg-streamloop-transcode-av: CMD = \
 framecrc -auto_conversion_filters -stream_loop 3 -c:a aac_fixed -i 
$(TARGET_SAMPLES)/mkv/1242-small.mkv \
 -af volume=0:precision=fixed -c:a pcm_s32le
-- 
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 08/26] fate/audio: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/audio.mak | 28 +++-
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/tests/fate/audio.mak b/tests/fate/audio.mak
index 65317c8d45..cfac90424b 100644
--- a/tests/fate/audio.mak
+++ b/tests/fate/audio.mak
@@ -5,12 +5,12 @@ FATE_SAMPLES_AUDIO-$(call TRANSCODE, APTX_HD, APTX_HD, 
WAV_DEMUXER PCM_S16LE_DEC
   ARESAMPLE_FILTER PCM_S32LE_ENCODER) += fate-aptx-hd
 fate-aptx-hd: CMD = transcode wav 
$(TARGET_SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav aptx_hd "-af 
aresample -c aptx_hd" "-af aresample -c:a pcm_s32le -t 0.25" "" "" "-f aptx_hd 
-sample_rate 44100"
 
-FATE_BINKAUDIO-$(call DEMDEC, BINK, BINKAUDIO_DCT) += fate-binkaudio-dct
+FATE_BINKAUDIO-$(call DEMDEC, BINK, BINKAUDIO_DCT, ARESAMPLE_FILTER) += 
fate-binkaudio-dct
 fate-binkaudio-dct: CMD = pcm -i $(TARGET_SAMPLES)/bink/binkaudio_dct.bik
 fate-binkaudio-dct: REF = $(SAMPLES)/bink/binkaudio_dct.pcm
 fate-binkaudio-dct: FUZZ = 2
 
-FATE_BINKAUDIO-$(call DEMDEC, BINK, BINKAUDIO_RDFT) += fate-binkaudio-rdft
+FATE_BINKAUDIO-$(call DEMDEC, BINK, BINKAUDIO_RDFT, ARESAMPLE_FILTER) += 
fate-binkaudio-rdft
 fate-binkaudio-rdft: CMD = pcm -i $(TARGET_SAMPLES)/bink/binkaudio_rdft.bik
 fate-binkaudio-rdft: REF = $(SAMPLES)/bink/binkaudio_rdft.pcm
 fate-binkaudio-rdft: FUZZ = 2
@@ -26,37 +26,39 @@ fate-bmv-audio: CMD = framecrc -i 
$(TARGET_SAMPLES)/bmv/SURFING-partial.BMV -vn
 FATE_SAMPLES_AUDIO-$(call DEMDEC, DSICIN, DSICINAUDIO) += 
fate-delphine-cin-audio
 fate-delphine-cin-audio: CMD = framecrc -i 
$(TARGET_SAMPLES)/delphine-cin/LOGO-partial.CIN -vn
 
-FATE_SAMPLES_AUDIO-$(call DEMDEC, S337M, DOLBY_E) += fate-dolby-e
+FATE_SAMPLES_AUDIO-$(call DEMDEC, S337M, DOLBY_E, ARESAMPLE_FILTER) += 
fate-dolby-e
 fate-dolby-e: CMD = pcm -i $(TARGET_SAMPLES)/dolby_e/16-11
 fate-dolby-e: CMP = oneoff
 fate-dolby-e: REF = $(SAMPLES)/dolby_e/16-11.pcm
 
-FATE_SAMPLES_AUDIO-$(call DEMDEC, DSS, DSS_SP) += fate-dss-lp fate-dss-sp
+FATE_SAMPLES_AUDIO-$(call DEMDEC, DSS, DSS_SP, ARESAMPLE_FILTER) += fate-dss-lp
 fate-dss-lp: CMD = framecrc -i $(TARGET_SAMPLES)/dss/lp.dss -frames 30 -af 
aresample
+
+FATE_SAMPLES_AUDIO-$(call DEMDEC, DSS, DSS_SP) += fate-dss-sp
 fate-dss-sp: CMD = framecrc -i $(TARGET_SAMPLES)/dss/sp.dss -frames 30
 
-FATE_SAMPLES_AUDIO-$(call DEMDEC, DSF, DST) += fate-dsf-dst
+FATE_SAMPLES_AUDIO-$(call DEMDEC, DSF, DST, ARESAMPLE_FILTER) += fate-dsf-dst
 fate-dsf-dst: CMD = pcm -i $(TARGET_SAMPLES)/dst/dst-64fs44-2ch.dff
 fate-dsf-dst: CMP = oneoff
 fate-dsf-dst: REF = $(SAMPLES)/dst/dst-64fs44-2ch.pcm
 
-FATE_SAMPLES_AUDIO-$(call DEMDEC, AVI, IMC) += fate-imc
+FATE_SAMPLES_AUDIO-$(call DEMDEC, AVI, IMC, ARESAMPLE_FILTER) += fate-imc
 fate-imc: CMD = pcm -i $(TARGET_SAMPLES)/imc/imc.avi
 fate-imc: CMP = oneoff
 fate-imc: CMP_TARGET = 59416
 fate-imc: REF = $(SAMPLES)/imc/imc-201706.pcm
 
-FATE_SAMPLES_AUDIO-$(call DEMDEC, WAV, MSNSIREN) += fate-msnsiren
+FATE_SAMPLES_AUDIO-$(call DEMDEC, WAV, MSNSIREN, ARESAMPLE_FILTER) += 
fate-msnsiren
 fate-msnsiren: CMD = pcm -i $(TARGET_SAMPLES)/msnsiren/msnsiren2.wav
 fate-msnsiren: CMP = oneoff
 fate-msnsiren: REF = $(SAMPLES)/msnsiren/msnsiren2.pcm
 
-FATE_SAMPLES_AUDIO-$(call DEMDEC, FLV, NELLYMOSER) += fate-nellymoser
+FATE_SAMPLES_AUDIO-$(call DEMDEC, FLV, NELLYMOSER, ARESAMPLE_FILTER) += 
fate-nellymoser
 fate-nellymoser: CMD = pcm -i $(TARGET_SAMPLES)/nellymoser/nellymoser.flv
 fate-nellymoser: CMP = oneoff
 fate-nellymoser: REF = $(SAMPLES)/nellymoser/nellymoser.pcm
 
-FATE_SAMPLES_AUDIO-$(call ENCMUX, NELLYMOSER, FLV) += 
fate-nellymoser-aref-encode
+FATE_SAMPLES_AUDIO-$(call ENCMUX, NELLYMOSER, FLV, ARESAMPLE_FILTER) += 
fate-nellymoser-aref-encode
 fate-nellymoser-aref-encode: $(AREF) ./tests/data/asynth-16000-1.wav
 fate-nellymoser-aref-encode: CMD = enc_dec_pcm flv wav s16le $(REF) -c:a 
nellymoser
 fate-nellymoser-aref-encode: CMP = stddev
@@ -65,19 +67,19 @@ fate-nellymoser-aref-encode: CMP_SHIFT = -256
 fate-nellymoser-aref-encode: CMP_TARGET = 3863
 fate-nellymoser-aref-encode: SIZE_TOLERANCE = 268
 
-FATE_SAMPLES_AUDIO-$(call DEMDEC, AVI, ON2AVC) += fate-on2avc
+FATE_SAMPLES_AUDIO-$(call DEMDEC, AVI, ON2AVC, ARESAMPLE_FILTER) += fate-on2avc
 fate-on2avc: CMD = framecrc -i $(TARGET_SAMPLES)/vp7/potter-40.vp7 -frames 30 
-vn -af aresample
 
 FATE_SAMPLES_AUDIO-$(call DEMDEC, PAF, PAF_AUDIO) += fate-paf-audio
 fate-paf-audio: CMD = framecrc -i $(TARGET_SAMPLES)/paf/hod1-partial.paf -vn
 
-FATE_SAMPLES_AUDIO-$(call DEMDEC, VMD, VMDAUDIO) += fate-sierra-vmd-audio
+FATE_SAMPLES_AUDIO-$(call DEMDEC, VMD, VMDAUDIO, ARESAMPLE_FILTER) += 
fate-sierra-vmd-audio
 fate-sierra-vmd-audio: CMD = framecrc -i $(TARGET_SAMPLES)/vmd/12.vmd -vn -af 
aresample
 
-FATE_SAMPLES_AUDIO-$(call DEMDEC, SMACKER, SMACKAUD) += fate-smacker-audio
+FATE_SAMPLES_AUDIO-$(call DEMDEC, SMACKER, SMACKAUD, ARESAMPLE_FILTER) += 
fate-smacker-audio
 fate-smacker-audio: CMD = framecrc -i $(TARGET_SAMPLES)/smacker/wetlogo.smk 
-vn 

[FFmpeg-devel] [PATCH 11/26] fate/filter-audio: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/filter-audio.mak | 40 ++---
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak
index 6ddc0baf57..3a929121a3 100644
--- a/tests/fate/filter-audio.mak
+++ b/tests/fate/filter-audio.mak
@@ -1,9 +1,9 @@
-FATE_AFILTER-$(call FILTERDEMDECENCMUX, ADELAY, WAV, PCM_S16LE, PCM_S16LE, 
WAV) += fate-filter-adelay
+FATE_AFILTER-$(call FILTERDEMDECENCMUX, ADELAY ARESAMPLE, WAV, PCM_S16LE, 
PCM_S16LE, WAV) += fate-filter-adelay
 fate-filter-adelay: tests/data/asynth-44100-2.wav
 fate-filter-adelay: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-filter-adelay: CMD = framecrc -i $(SRC) -af aresample,adelay=42,aresample
 
-FATE_AFILTER-$(call FILTERDEMDECENCMUX, AECHO, WAV, PCM_S16LE, PCM_S16LE, WAV) 
+= fate-filter-aecho
+FATE_AFILTER-$(call FILTERDEMDECENCMUX, AECHO ARESAMPLE, WAV, PCM_S16LE, 
PCM_S16LE, WAV) += fate-filter-aecho
 fate-filter-aecho: tests/data/asynth-44100-2.wav
 fate-filter-aecho: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-filter-aecho: CMD = framecrc -i $(SRC) -af 
aresample,aecho=0.5:0.5:32:0.5,aresample
@@ -18,7 +18,7 @@ fate-filter-aemphasis-75kf: tests/data/asynth-44100-2.wav
 fate-filter-aemphasis-75kf: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-filter-aemphasis-75kf: CMD = framecrc -i $(SRC) -af 
aresample,aemphasis=2:8:reproduction:75kf,aresample
 
-FATE_AFILTER-$(call FILTERDEMDECENCMUX, AEMPHASIS, WAV, PCM_S16LE, PCM_S16LE, 
WAV) += $(FATE_FILTER_AEMPHASIS)
+FATE_AFILTER-$(call FILTERDEMDECENCMUX, AEMPHASIS ARESAMPLE, WAV, PCM_S16LE, 
PCM_S16LE, WAV) += $(FATE_FILTER_AEMPHASIS)
 
 FATE_FILTER_AFADE += fate-filter-afade-qsin
 fate-filter-afade-qsin: tests/data/asynth-44100-2.wav
@@ -58,12 +58,12 @@ fate-filter-acrossfade: SRC = 
$(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-filter-acrossfade: SRC2 = 
$(TARGET_SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
 fate-filter-acrossfade: CMD = framecrc -i $(SRC) -i $(SRC2) -filter_complex 
acrossfade=d=2:c1=log:c2=exp
 
-FATE_AFILTER-$(call FILTERDEMDECENCMUX, AFADE, WAV, PCM_S16LE, PCM_S16LE, WAV) 
+= fate-filter-agate
+FATE_AFILTER-$(call FILTERDEMDECENCMUX, AGATE ARESAMPLE, WAV, PCM_S16LE, 
PCM_S16LE, WAV) += fate-filter-agate
 fate-filter-agate: tests/data/asynth-44100-2.wav
 fate-filter-agate: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-filter-agate: CMD = framecrc -i $(SRC) -af 
aresample,agate=level_in=10:range=0:threshold=1:ratio=1:attack=1:knee=1:makeup=4,aresample
 
-FATE_AFILTER-$(call FILTERDEMDECENCMUX, AFADE, WAV, PCM_S16LE, PCM_S16LE, WAV) 
+= fate-filter-alimiter
+FATE_AFILTER-$(call FILTERDEMDECENCMUX, ALIMITER ARESAMPLE, WAV, PCM_S16LE, 
PCM_S16LE, WAV) += fate-filter-alimiter
 fate-filter-alimiter: tests/data/asynth-44100-2.wav
 fate-filter-alimiter: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-filter-alimiter: CMD = framecrc -i $(SRC) -af 
aresample,alimiter=level_in=1:level_out=2:limit=0.2,aresample
@@ -78,7 +78,7 @@ fate-filter-apad: tests/data/asynth-44100-2.wav
 fate-filter-apad: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-filter-apad: CMD = framecrc -i $(SRC) -af apad=pad_len=10
 
-FATE_AFILTER-$(call FILTERDEMDECENCMUX, ANEQUALIZER, WAV, PCM_S16LE, 
PCM_S16LE, WAV) += fate-filter-anequalizer
+FATE_AFILTER-$(call FILTERDEMDECENCMUX, ANEQUALIZER ARESAMPLE, WAV, PCM_S16LE, 
PCM_S16LE, WAV) += fate-filter-anequalizer
 fate-filter-anequalizer: tests/data/asynth-44100-2.wav
 fate-filter-anequalizer: tests/data/filtergraphs/anequalizer
 fate-filter-anequalizer: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
@@ -99,32 +99,32 @@ fate-filter-asetrate: tests/data/asynth-44100-2.wav
 fate-filter-asetrate: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-filter-asetrate: CMD = framecrc -i $(SRC) -frames:a 20 -af asetrate=2
 
-FATE_AFILTER-$(call FILTERDEMDECENCMUX, CHORUS, WAV, PCM_S16LE, PCM_S16LE, 
WAV) += fate-filter-chorus
+FATE_AFILTER-$(call FILTERDEMDECENCMUX, CHORUS ARESAMPLE, WAV, PCM_S16LE, 
PCM_S16LE, WAV) += fate-filter-chorus
 fate-filter-chorus: tests/data/asynth-22050-1.wav
 fate-filter-chorus: SRC = $(TARGET_PATH)/tests/data/asynth-22050-1.wav
 fate-filter-chorus: CMD = framecrc -i $(SRC) -frames:a 10 -af 
aresample,chorus=0.050001:0.050002:64:0.050001:0.025003:2.4,aresample
 
-FATE_AFILTER-$(call FILTERDEMDECENCMUX, CRYSTALIZER, WAV, PCM_S16LE, 
PCM_S16LE, WAV) += fate-filter-crystalizer
+FATE_AFILTER-$(call FILTERDEMDECENCMUX, CRYSTALIZER ARESAMPLE, WAV, PCM_S16LE, 
PCM_S16LE, WAV) += fate-filter-crystalizer
 fate-filter-crystalizer: tests/data/asynth-44100-2.wav
 fate-filter-crystalizer: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-filter-crystalizer: CMD = framecrc -i $(SRC) -af 
aresample,crystalizer=2:0,crystalizer=-2:0,aresample
 
-FATE_AFILTER-$(call FILTERDEMDECENCMUX, DCSHIFT, WAV, PCM_S16LE, PCM_S16LE, 
WAV) += fate-filter-dcshift

[FFmpeg-devel] [PATCH 07/26] fate/atrac: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/atrac.mak | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/fate/atrac.mak b/tests/fate/atrac.mak
index acf79a539c..1c91357559 100644
--- a/tests/fate/atrac.mak
+++ b/tests/fate/atrac.mak
@@ -7,7 +7,7 @@ fate-atrac1-2: CMD = pcm -i 
$(TARGET_SAMPLES)/atrac1/chirp_tone_10-16000.aea
 fate-atrac1-2: REF = $(SAMPLES)/atrac1/chirp_tone_10-16000.pcm
 fate-atrac1-2: FUZZ = 61
 
-FATE_ATRAC1-$(call DEMDEC, AEA, ATRAC1) += $(FATE_ATRAC1)
+FATE_ATRAC1-$(call DEMDEC, AEA, ATRAC1, ARESAMPLE_FILTER) += $(FATE_ATRAC1)
 
 FATE_ATRAC3 += fate-atrac3-1
 fate-atrac3-1: CMD = pcm -i $(TARGET_SAMPLES)/atrac3/mc_sich_at3_066_small.wav
@@ -21,7 +21,7 @@ FATE_ATRAC3 += fate-atrac3-3
 fate-atrac3-3: CMD = pcm -i $(TARGET_SAMPLES)/atrac3/mc_sich_at3_132_small.wav
 fate-atrac3-3: REF = $(SAMPLES)/atrac3/mc_sich_at3_132_small.pcm
 
-FATE_ATRAC3-$(call DEMDEC, WAV, ATRAC3) += $(FATE_ATRAC3)
+FATE_ATRAC3-$(call DEMDEC, WAV, ATRAC3, ARESAMPLE_FILTER) += $(FATE_ATRAC3)
 
 FATE_ATRAC3P += fate-atrac3p-1
 fate-atrac3p-1: CMD = pcm -i $(TARGET_SAMPLES)/atrac3p/at3p_sample1.oma
@@ -31,7 +31,7 @@ FATE_ATRAC3P += fate-atrac3p-2
 fate-atrac3p-2: CMD = pcm -i $(TARGET_SAMPLES)/atrac3p/sonateno14op27-2-cut.aa3
 fate-atrac3p-2: REF = $(SAMPLES)/atrac3p/sonateno14op27-2-cut.pcm
 
-FATE_ATRAC3P-$(call DEMDEC, OMA, ATRAC3P) += $(FATE_ATRAC3P)
+FATE_ATRAC3P-$(call DEMDEC, OMA, ATRAC3P, ARESAMPLE_FILTER) += $(FATE_ATRAC3P)
 
 FATE_ATRAC_ALL = $(FATE_ATRAC1-yes) $(FATE_ATRAC3-yes) $(FATE_ATRAC3P-yes)
 
-- 
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 10/26] fate/fate-container: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/lavf-container.mak | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/fate/lavf-container.mak b/tests/fate/lavf-container.mak
index fa7ecd2cb5..ce5fdd0f05 100644
--- a/tests/fate/lavf-container.mak
+++ b/tests/fate/lavf-container.mak
@@ -78,8 +78,8 @@ FATE_LAVF_CONTAINER_FATE-$(call ALLYES, MATROSKA_DEMUXER   
OGG_MUXER)  +
 FATE_LAVF_CONTAINER_FATE-$(call ALLYES, MATROSKA_DEMUXER   OGV_MUXER)  
+= vp8.ogg
 FATE_LAVF_CONTAINER_FATE-$(call ALLYES, MOV_DEMUXERLATM_MUXER) 
+= latm
 FATE_LAVF_CONTAINER_FATE-$(call ALLYES, MP3_DEMUXERMP3_MUXER)  
+= mp3
-FATE_LAVF_CONTAINER_FATE-$(call ALLYES, MOV_DEMUXERMOV_MUXER)  
+= qtrle_mace6.mov
-FATE_LAVF_CONTAINER_FATE-$(call ALLYES, AVI_DEMUXERAVI_MUXER)  
+= cram.avi
+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 = $(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 06/26] fate/amrwb: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/amrwb.mak | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/fate/amrwb.mak b/tests/fate/amrwb.mak
index 7cd17d266e..5e0a47bb82 100644
--- a/tests/fate/amrwb.mak
+++ b/tests/fate/amrwb.mak
@@ -46,6 +46,6 @@ fate-amrwb-remux: CMD = transcode mov 
$(TARGET_SAMPLES)/amrwb/seed-23k85.awb amr
 
 $(FATE_AMRWB): CMP = stddev
 
-FATE_SAMPLES_FFMPEG-$(call DEMDEC, MOV, AMRWB) += $(FATE_AMRWB)
+FATE_SAMPLES_FFMPEG-$(call DEMDEC, MOV, AMRWB, ARESAMPLE_FILTER) += 
$(FATE_AMRWB)
 FATE_SAMPLES_FFMPEG += $(FATE_AMRWB_REMUX-yes)
 fate-amrwb: $(FATE_AMRWB) $(FATE_AMRWB_REMUX-yes)
-- 
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 09/26] fate/demux: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/demux.mak | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/fate/demux.mak b/tests/fate/demux.mak
index ace8fa0b52..d9b9045f0b 100644
--- a/tests/fate/demux.mak
+++ b/tests/fate/demux.mak
@@ -79,7 +79,7 @@ fate-mlv-demux: CMD = crc -i 
$(TARGET_SAMPLES)/mlv/M19-0333-cut.MLV -c copy
 FATE_SAMPLES_DEMUX-$(CONFIG_MOV_DEMUXER) += fate-mov-mp3-demux
 fate-mov-mp3-demux: CMD = framecrc -i 
$(TARGET_SAMPLES)/mpegaudio/packed_maindata.mp3.mp4 -c copy
 
-FATE_FFPROBE_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-opus-demux
+FATE_FFPROBE_DEMUX-$(call ALLYES, MPEGTS_DEMUXER ARESAMPLE_FILTER) += 
fate-ts-opus-demux
 fate-ts-opus-demux: CMD = ffprobe_demux 
$(TARGET_SAMPLES)/opus/test-8-7.1.opus-small.ts
 
 FATE_FFPROBE_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-small-demux
@@ -100,7 +100,7 @@ fate-nistsphere-demux: CMD = crc -i 
$(TARGET_SAMPLES)/nistsphere/nist-ulaw.nist
 FATE_SAMPLES_DEMUX-$(CONFIG_NSV_DEMUXER) += fate-nsv-demux
 fate-nsv-demux: CMD = framecrc -i $(TARGET_SAMPLES)/nsv/witchblade-51kbps.nsv 
-t 6 -c:v copy -c:a copy
 
-FATE_FFPROBE_DEMUX-$(CONFIG_OGG_DEMUXER) += fate-oggopus-demux
+FATE_FFPROBE_DEMUX-$(call ALLYES, OGG_DEMUXER ARESAMPLE_FILTER) += 
fate-oggopus-demux
 fate-oggopus-demux: CMD = ffprobe_demux 
$(TARGET_SAMPLES)/ogg/intro-partial.opus
 
 FATE_SAMPLES_DEMUX-$(CONFIG_OGG_DEMUXER) += fate-oggvp8-demux
-- 
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 05/26] fate/amrnb: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/amrnb.mak | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/fate/amrnb.mak b/tests/fate/amrnb.mak
index 6f5ed413e3..3eb8b324f3 100644
--- a/tests/fate/amrnb.mak
+++ b/tests/fate/amrnb.mak
@@ -30,11 +30,11 @@ FATE_AMRNB += fate-amrnb-12k2
 fate-amrnb-12k2: CMD = pcm -i $(TARGET_SAMPLES)/amrnb/12.2k.amr
 fate-amrnb-12k2: REF = $(SAMPLES)/amrnb/12.2k.pcm
 
-FATE_AMRNB_REMUX-$(call REMUX, AMR, AMR_PARSER) += fate-amrnb-remux
+FATE_AMRNB_REMUX-$(call REMUX, AMR, AMR_PARSER ARESAMPLE_FILTER) += 
fate-amrnb-remux
 fate-amrnb-remux: CMD = transcode amr $(TARGET_SAMPLES)/amrnb/10.2k.amr amr 
"-c copy" "-c copy -t 1"
 
 $(FATE_AMRNB): CMP = stddev
 
-FATE_SAMPLES_AVCONV-$(call DEMDEC, AMR, AMRNB) += $(FATE_AMRNB)
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AMR, AMRNB, ARESAMPLE_FILTER) += 
$(FATE_AMRNB)
 FATE_SAMPLES_FFMPEG += $(FATE_AMRNB_REMUX-yes)
 fate-amrnb: $(FATE_AMRNB) $(FATE_AMRNB_REMUX-yes)
-- 
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 04/26] fate/alac: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/alac.mak | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/fate/alac.mak b/tests/fate/alac.mak
index 5e29e90cbd..bb27e9db4e 100644
--- a/tests/fate/alac.mak
+++ b/tests/fate/alac.mak
@@ -20,5 +20,7 @@ fate-alac-24-%: CMD = enc_dec_pcm mov wav s24le $(subst 
$(SAMPLES),$(TARGET_SAMP
 fate-alac-%: CMP = oneoff
 fate-alac-%: FUZZ = 0
 
-FATE_SAMPLES_AVCONV-$(call ENCDEC, ALAC, MOV) += $(FATE_ALAC)
-fate-alac: $(FATE_ALAC)
+FATE_ALAC-$(call ENCDEC, ALAC, MOV, ARESAMPLE_FILTER) += $(FATE_ALAC)
+
+FATE_SAMPLES_AVCONV += $(FATE_ALAC-yes)
+fate-alac: $(FATE_ALAC-yes)
-- 
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 03/26] fate/adpcm: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/adpcm.mak | 44 ++--
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/tests/fate/adpcm.mak b/tests/fate/adpcm.mak
index a7d4dbcf6c..7265211f09 100644
--- a/tests/fate/adpcm.mak
+++ b/tests/fate/adpcm.mak
@@ -1,7 +1,7 @@
-FATE_ADPCM-$(call DEMDEC, FOURXM, ADPCM_4XM) += fate-adpcm-4xm
+FATE_ADPCM-$(call DEMDEC, FOURXM, ADPCM_4XM, ARESAMPLE_FILTER) += 
fate-adpcm-4xm
 fate-adpcm-4xm: CMD = framecrc -i $(TARGET_SAMPLES)/4xm/dracula.4xm -vn -map 
0:6 -af aresample
 
-FATE_ADPCM-$(call DEMDEC, AST, ADPCM_AFC) += fate-adpcm-afc
+FATE_ADPCM-$(call DEMDEC, AST, ADPCM_AFC, ARESAMPLE_FILTER) += fate-adpcm-afc
 fate-adpcm-afc: CMD = framecrc -i $(TARGET_SAMPLES)/ast/demo11_02_partial.ast 
-af aresample
 
 FATE_ADPCM-$(call DEMDEC, WAV, ADPCM_CT) += fate-adpcm-creative
@@ -16,7 +16,7 @@ fate-adpcm-creative-8-2.6bit: CMD = md5 -i 
$(TARGET_SAMPLES)/creative/BBC_3BIT.V
 FATE_ADPCM-$(call DEMDEC, VOC, ADPCM_SBPRO_4) += fate-adpcm-creative-8-4bit
 fate-adpcm-creative-8-4bit: CMD = md5 -i 
$(TARGET_SAMPLES)/creative/BBC_4BIT.VOC -f s16le
 
-FATE_ADPCM-$(call DEMDEC, ADP, ADPCM_DTK) += fate-adpcm-dtk
+FATE_ADPCM-$(call DEMDEC, ADP, ADPCM_DTK, ARESAMPLE_FILTER) += fate-adpcm-dtk
 fate-adpcm-dtk: CMD = framecrc -i $(TARGET_SAMPLES)/adp/shakespr_partial.adp 
-f s16le -af aresample
 
 FATE_ADPCM-$(call DEMDEC, EA, ADPCM_EA) += fate-adpcm-ea-1
@@ -28,13 +28,13 @@ fate-adpcm-ea-2: CMD = framecrc -i 
$(TARGET_SAMPLES)/ea-dct/NFS2Esprit-partial.d
 FATE_ADPCM-$(call DEMDEC, XA, ADPCM_EA_MAXIS_XA) += fate-adpcm-ea-maxis-xa
 fate-adpcm-ea-maxis-xa: CMD = framecrc -i 
$(TARGET_SAMPLES)/maxis-xa/SC2KBUG.XA -frames:a 30
 
-FATE_ADPCM-$(call DEMDEC, EA, ADPCM_EA_R1) += fate-adpcm-ea-r1
+FATE_ADPCM-$(call DEMDEC, EA, ADPCM_EA_R1, ARESAMPLE_FILTER) += 
fate-adpcm-ea-r1
 fate-adpcm-ea-r1: CMD = framecrc -i $(TARGET_SAMPLES)/ea-mad/NFS6LogoE.mad -vn 
-af aresample
 
-FATE_ADPCM-$(call DEMDEC, EA, ADPCM_EA_R2) += fate-adpcm-ea-r2
+FATE_ADPCM-$(call DEMDEC, EA, ADPCM_EA_R2, ARESAMPLE_FILTER) += 
fate-adpcm-ea-r2
 fate-adpcm-ea-r2: CMD = crc -i $(TARGET_SAMPLES)/ea-mpc/THX_logo.mpc -vn -af 
aresample
 
-FATE_ADPCM-$(call DEMDEC, EA, ADPCM_EA_R3) += fate-adpcm-ea-r3
+FATE_ADPCM-$(call DEMDEC, EA, ADPCM_EA_R3, ARESAMPLE_FILTER) += 
fate-adpcm-ea-r3
 fate-adpcm-ea-r3: CMD = crc -i $(TARGET_SAMPLES)/ea-vp6/THX_logo.vp6 -vn -af 
aresample
 
 FATE_ADPCM-$(call DEMDEC, AVI, ADPCM_IMA_AMV) += fate-adpcm-ima-amv
@@ -67,13 +67,13 @@ fate-adpcm-ima-rad: CMD = md5 -i 
$(TARGET_SAMPLES)/rsd/hit_run_partial.rsd -f s1
 FATE_ADPCM-$(call DEMDEC, SMJPEG, ADPCM_IMA_SMJPEG) += fate-adpcm-ima-smjpeg
 fate-adpcm-ima-smjpeg: CMD = framecrc -i $(TARGET_SAMPLES)/smjpeg/scenwin.mjpg 
-vn
 
-FATE_ADPCM-$(call DEMDEC, MOV, ADPCM_IMA_WAV) += fate-adpcm-ima_wav-stereo
+FATE_ADPCM-$(call DEMDEC, MOV, ADPCM_IMA_WAV, ARESAMPLE_FILTER) += 
fate-adpcm-ima_wav-stereo
 fate-adpcm-ima_wav-stereo: CMD = md5 -i 
$(TARGET_SAMPLES)/qt-surge-suite/surge-2-16-L-ms11.mov -f s16le -af aresample
 
 FATE_ADPCM-$(call DEMDEC, WSVQA, ADPCM_IMA_WS) += fate-adpcm-ima-ws
 fate-adpcm-ima-ws: CMD = framecrc -i 
$(TARGET_SAMPLES)/vqa/cc-demo1-partial.vqa -vn
 
-FATE_ADPCM-$(call DEMDEC, WSVQA, ADPCM_IMA_WS) += fate-adpcm-ima-ws-vqa3
+FATE_ADPCM-$(call DEMDEC, WSVQA, ADPCM_IMA_WS, ARESAMPLE_FILTER) += 
fate-adpcm-ima-ws-vqa3
 fate-adpcm-ima-ws-vqa3: CMD = framecrc -i 
$(TARGET_SAMPLES)/vqa/small-cut-v3.vqa -vn -af aresample
 
 FATE_ADPCM-$(call DEMDEC, DXA, ADPCM_MS) += fate-adpcm-ms-mono
@@ -82,19 +82,19 @@ fate-adpcm-ms-mono: CMD = framecrc -i 
$(TARGET_SAMPLES)/dxa/meetsquid.dxa -t 2 -
 FATE_ADPCM-$(call DEMDEC, MOV, ADPCM_MS) += fate-adpcm_ms-stereo
 fate-adpcm_ms-stereo: CMD = md5 -i 
$(TARGET_SAMPLES)/qt-surge-suite/surge-2-16-L-ms02.mov -f s16le
 
-FATE_ADPCM-$(call DEMDEC, THP, ADPCM_THP) += fate-adpcm-thp
+FATE_ADPCM-$(call DEMDEC, THP, ADPCM_THP, ARESAMPLE_FILTER) += fate-adpcm-thp
 fate-adpcm-thp: CMD = framecrc -i 
$(TARGET_SAMPLES)/thp/pikmin2-opening1-partial.thp -vn -af aresample
 
 FATE_ADPCM-$(call DEMDEC, SMUSH, ADPCM_VIMA) += fate-adpcm-vima
 fate-adpcm-vima: CMD = framecrc -i $(TARGET_SAMPLES)/smush/ronin_part.znm -vn
 
-FATE_ADPCM-$(call DEMDEC, STR, ADPCM_XA) += fate-adpcm-xa
+FATE_ADPCM-$(call DEMDEC, STR, ADPCM_XA, ARESAMPLE_FILTER) += fate-adpcm-xa
 fate-adpcm-xa: CMD = framecrc -i $(TARGET_SAMPLES)/psx-str/abc000_cut.str -vn 
-af aresample
 
-FATE_ADPCM-$(call DEMDEC, ARGO_ASF, ADPCM_ARGO) += fate-adpcm-argo-mono
+FATE_ADPCM-$(call DEMDEC, ARGO_ASF, ADPCM_ARGO, ARESAMPLE_FILTER) += 
fate-adpcm-argo-mono
 fate-adpcm-argo-mono: CMD = md5 -i $(TARGET_SAMPLES)/argo-asf/PWIN22M.ASF -f 
s16le -af aresample
 
-FATE_ADPCM-$(call DEMDEC, ARGO_ASF, ADPCM_ARGO) += fate-adpcm-argo-stereo
+FATE_ADPCM-$(call DEMDEC, ARGO_ASF, ADPCM_ARGO, ARESAMPLE_FILTER) += 
fate-adpcm-argo-stereo
 fate-adpcm-argo-stereo: CMD = md5 -i $(TARGET_SAMPLES)/argo-asf/CBK2_cut.asf 
-f s16le -af aresample
 
 

[FFmpeg-devel] [PATCH 02/26] fate/ac3: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/ac3.mak | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/fate/ac3.mak b/tests/fate/ac3.mak
index 2dfd59dfb1..1ecb5a3f54 100644
--- a/tests/fate/ac3.mak
+++ b/tests/fate/ac3.mak
@@ -65,17 +65,17 @@ fate-eac3-5: REF = $(SAMPLES)/eac3/the_great_wall_7.1.pcm
 
 $(FATE_AC3) $(FATE_EAC3): CMP = oneoff
 
-FATE_AC3-$(call  DEMDEC, AC3,  AC3)  += $(FATE_AC3)
-FATE_EAC3-$(call DEMDEC, EAC3, EAC3) += $(FATE_EAC3)
+FATE_AC3-$(call  DEMDEC, AC3,  AC3,  ARESAMPLE_FILTER)  += $(FATE_AC3)
+FATE_EAC3-$(call DEMDEC, EAC3, EAC3, ARESAMPLE_FILTER) += $(FATE_EAC3)
 
-FATE_AC3-$(call ENCDEC, AC3, AC3) += fate-ac3-encode
+FATE_AC3-$(call ENCDEC, AC3, AC3, ARESAMPLE_FILTER) += fate-ac3-encode
 fate-ac3-encode: CMD = enc_dec_pcm ac3 wav s16le $(subst 
$(SAMPLES),$(TARGET_SAMPLES),$(REF)) -c:a ac3 -b:a 128k
 fate-ac3-encode: CMP_SHIFT = -1024
 fate-ac3-encode: CMP_TARGET = 404.53
 fate-ac3-encode: SIZE_TOLERANCE = 488
 
 
-FATE_EAC3-$(call ENCDEC, EAC3, EAC3) += fate-eac3-encode
+FATE_EAC3-$(call ENCDEC, EAC3, EAC3, ARESAMPLE_FILTER) += fate-eac3-encode
 fate-eac3-encode: CMD = enc_dec_pcm eac3 wav s16le $(subst 
$(SAMPLES),$(TARGET_SAMPLES),$(REF)) -c:a eac3 -b:a 128k
 fate-eac3-encode: CMP_SHIFT = -1024
 fate-eac3-encode: CMP_TARGET = 516.94
@@ -84,7 +84,7 @@ fate-eac3-encode: SIZE_TOLERANCE = 488
 fate-ac3-encode fate-eac3-encode: CMP = stddev
 fate-ac3-encode fate-eac3-encode: REF = 
$(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
 
-FATE_AC3-$(call ENCMUX, AC3_FIXED, AC3) += fate-ac3-fixed-encode
+FATE_AC3-$(call ENCMUX, AC3_FIXED, AC3, ARESAMPLE_FILTER) += 
fate-ac3-fixed-encode
 fate-ac3-fixed-encode: tests/data/asynth-44100-2.wav
 fate-ac3-fixed-encode: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-ac3-fixed-encode: CMD = md5 -i $(SRC) -c ac3_fixed -ab 128k -f ac3 -flags 
+bitexact -af aresample
-- 
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 01/26] fate/aac: add missing aresample filter dependency

2024-03-14 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/aac.mak | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/fate/aac.mak b/tests/fate/aac.mak
index 4f8d1cdcea..817944773d 100644
--- a/tests/fate/aac.mak
+++ b/tests/fate/aac.mak
@@ -243,17 +243,17 @@ fate-aac-latm_stereo_to_51: REF = 
$(SAMPLES)/aac/latm_stereo_to_51_ref.s16
 fate-aac-autobsf-adtstoasc: CMD = transcode "aac" 
$(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.adts \
 matroska "-c:a copy" "-c:a copy"
 
-FATE_AAC-$(call  DEMDEC, AAC,AAC)  += $(FATE_AAC_CT_RAW)
-FATE_AAC-$(call  DEMDEC, MOV,AAC)  += $(FATE_AAC)
-FATE_AAC_LATM-$(call DEMDEC, MPEGTS, AAC_LATM) += $(FATE_AAC_LATM)
-FATE_AAC-$(call  DEMDEC, AAC,AAC_FIXED)+= $(FATE_AAC_FIXED)
+FATE_AAC-$(call  DEMDEC, AAC,AAC,   ARESAMPLE_FILTER) += 
$(FATE_AAC_CT_RAW)
+FATE_AAC-$(call  DEMDEC, MOV,AAC,   ARESAMPLE_FILTER) += 
$(FATE_AAC)
+FATE_AAC_LATM-$(call DEMDEC, MPEGTS, AAC_LATM,  ARESAMPLE_FILTER) += 
$(FATE_AAC_LATM)
+FATE_AAC-$(call  DEMDEC, AAC,AAC_FIXED, ARESAMPLE_FILTER) += 
$(FATE_AAC_FIXED)
 
 FATE_AAC_ALL = $(FATE_AAC-yes) $(FATE_AAC_LATM-yes) $(FATE_AAC_FIXED-yes)
 
 $(FATE_AAC_ALL): CMP  = oneoff
 $(FATE_AAC_ALL): FUZZ = 2
 
-FATE_AAC_ENCODE-$(call ENCMUX, AAC, ADTS) += $(FATE_AAC_ENCODE)
+FATE_AAC_ENCODE-$(call ENCMUX, AAC, ADTS, ARESAMPLE_FILTER) += 
$(FATE_AAC_ENCODE)
 
 FATE_AAC_BSF-$(call ALLYES, AAC_DEMUXER AAC_ADTSTOASC_BSF MATROSKA_MUXER) += 
fate-aac-autobsf-adtstoasc
 
-- 
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] tools/target_dec_fuzzer: force experimental flag for VVC

2024-03-14 Thread Michael Niedermayer
On Thu, Mar 14, 2024 at 12:43:00PM -0300, James Almer wrote:
> Otherwise the decoder will not even open.
> 
> Signed-off-by: James Almer 
> ---
>  tools/target_dec_fuzzer.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
> index 84b646b7f4..459b07070e 100644
> --- a/tools/target_dec_fuzzer.c
> +++ b/tools/target_dec_fuzzer.c
> @@ -176,6 +176,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
> size) {
>  AVCodecParserContext *parser = NULL;
>  uint64_t keyframes = 0;
>  uint64_t flushpattern = -1;
> +int strict_std_compliance = 0;
>  AVDictionary *opts = NULL;
>  
>  if (!c) {
> @@ -307,6 +308,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
> size) {
>  case AV_CODEC_ID_VP6A:maxpixels  /= 4096;  break;
>  case AV_CODEC_ID_VP7: maxpixels  /= 256;   break;
>  case AV_CODEC_ID_VP9: maxpixels  /= 4096;  break;
> +case AV_CODEC_ID_VVC: strict_std_compliance = 
> FF_COMPLIANCE_EXPERIMENTAL;  break;
>  case AV_CODEC_ID_WAVPACK: maxsamples /= 1024;  break;
>  case AV_CODEC_ID_WCMV:maxpixels  /= 1024;  break;
>  case AV_CODEC_ID_WMV3IMAGE:   maxpixels  /= 8192;  break;
> @@ -333,6 +335,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
> size) {
>  
>  ctx->max_samples = maxsamples_per_frame;
>  ctx->get_buffer2 = fuzz_get_buffer2;
> +ctx->strict_std_compliance = strict_std_compliance;
>  
>  if (size > 1024) {
>  GetByteContext gbc;

I think this should look more like

if( decoder is AV_CODEC_CAP_EXPERIMENTAL && strict_std_compliance too high)
strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL

i would not expect to see a check for AV_CODEC_ID_VVC in the patch

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
than the original author, trying to rewrite it will not make it better.


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] vvcdec: Mark as experimental

2024-03-14 Thread Michael Niedermayer
On Wed, Feb 07, 2024 at 10:55:18PM +, Kieran Kunhya wrote:
> On Wed, 7 Feb 2024 at 22:06, Paul B Mahol  wrote:
> 
> > On Wed, Feb 7, 2024 at 10:13 PM Kieran Kunhya  wrote:
> >
> > > $subj
> > >
> > > As discussed at FOSDEM.
> > >
> >
> > Author of this patch above is forced to FUZZ this decoder until
> > experimental flag is removed.
> >
> 
> Sure, I will set some fuzzers up over the weekend.

over a month later ...
has this been done ?


thx

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

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


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

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


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

2024-03-14 Thread Michael Niedermayer
On Thu, Mar 14, 2024 at 06:57:39PM +0100, Nicolas Gaullier wrote:
> 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   |  30 +---
>  tests/ref/fate/concat-demuxer-simple2-lavf-ts | 170 +-
>  tests/ref/fate/ts-opus-demux  |   4 +-
>  3 files changed, 93 insertions(+), 111 deletions(-)

for some reason this seems to loose a resolution of some subtitle stream when 
probing:

make -j32 && ./ffprobe -v 99 -analyzeduration 2G -probesize 2G -i 
tickets/2471/part.ts 2>&1 | grep dvb_teletext
  Stream #0:2[0x240](eng), 1020, 1/9: Subtitle: dvb_teletext 
(libzvbi_teletextdec) ([6][0][0][0] / 0x0006), 492x250
  Stream #0:4[0x247](eng), 1902, 1/9: Subtitle: dvb_teletext 
(libzvbi_teletextdec) ([6][0][0][0] / 0x0006), 492x250
vs.
  Stream #0:2[0x240](eng), 1020, 1/9: Subtitle: dvb_teletext 
(libzvbi_teletextdec) ([6][0][0][0] / 0x0006), 492x250
  Stream #0:4[0x247](eng), 1902, 1/9: Subtitle: dvb_teletext 
(libzvbi_teletextdec) ([6][0][0][0] / 0x0006)

ive not looked at this so i have no idea this is a bug, just wanted to report it

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates


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 v2 9/9] avformat/pcm: decrease target audio frame per sec to 10

2024-03-14 Thread Marton Balint




On Thu, 14 Mar 2024, Paul B Mahol wrote:


This is just ugly hack for workaround around broken ffmpeg threading.


This actually improves single threaded performance as well, check it with 
ffprobe if you want. Sure, the reason I turned my attention to this is 
the speed loss of ffmpeg.c because of threaded processing, but this is an 
improvement regardless of threaded or non-threaded use.


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

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


Re: [FFmpeg-devel] [PATCH v2 9/9] avformat/pcm: decrease target audio frame per sec to 10

2024-03-14 Thread Marton Balint




On Thu, 14 Mar 2024, Tobias Rapp wrote:


On 08/03/2024 01:53, Marton Balint wrote:


 This makes the wav and pcm demuxer demux bigger packets, which is more
 efficient.



[...]


 +0, 136000, 136000, 2000,24000,
 f952be1e1c7d48acd73d652ef4ea3aad
 +0, 138000, 138000, 2000,24000,
 e42cbabef9d9675429dcb6fa28ce39f4
 +0, 14, 14, 2000,24000,
 9c6613b980bcbe9ebacbb6a492f53b16
 +0, 142000, 142000, 2000,24000,
 1882d1ae4b08fa7cc848eba60d645463
 +0, 144000, 144000, 2000,24000,
 a361b56ba31c90557689631f0e7afc63
 +0, 146000, 146000, 2000,24000,
 341fbe24112c4060bb643750895a9041
 +0, 148000, 148000, 2000,24000,
 38340ef2ef764bb8007efe9cd0af54d7
 +0, 15, 15, 2000,24000,
 9b013a00bbedad211ba33326a3cfaa6e
 +0, 152000, 152000, 2000,24000,
 9d3469da4442cdfd2b8a5beacb789701
 +0, 154000, 154000, 2000,24000,
 cf8e3880ecb46011328135dba1015044
 +0, 156000, 156000, 2000,24000,
 3be9fa7d0e0541269339ee032bda4021
 +0, 158000, 158000, 2000,24000,
 ffd2646acf86524651416bc412afd846
 +0, 16, 16, 2000,24000,
 715163d8f82f007b1b6c42b06bd08b5a
 +0, 162000, 162000, 1840,22080,
 c2079a237d021d7aa27e44acf979b1f0


Noob question: Isn't a much larger total number of samples produced here?


The command line which generates the daud file specifies -frames:a 20, and 
20 from bigger packets will cause a longer output file.




Also it might be good to mention in the commit that the audio duration is 
less exact when using commands like "ffmpeg -i $INPUT -c:a copy -t 1.0 
$OUTPUT".


Ok, will add this to the commit message.

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

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


Re: [FFmpeg-devel] [PATCH 1/3] fate/lavf-audio: Test writing AIFF-native tags

2024-03-14 Thread Andreas Rheinhardt
Michael Niedermayer:
> On Thu, Mar 14, 2024 at 01:35:36AM +0100, Andreas Rheinhardt wrote:
>> In particular, test writing tags with odd strlen.
>> (These tags are zero-padded to even size.)
>>
>> Signed-off-by: Andreas Rheinhardt 
>> ---
>>  tests/fate/lavf-audio.mak | 1 +
>>  tests/ref/lavf/aiff   | 4 ++--
>>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> needs to update seek test too:
> 

Yeah, I already did it locally. Sorry for this.

- 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 1/3] fate/lavf-audio: Test writing AIFF-native tags

2024-03-14 Thread Michael Niedermayer
On Thu, Mar 14, 2024 at 01:35:36AM +0100, Andreas Rheinhardt wrote:
> In particular, test writing tags with odd strlen.
> (These tags are zero-padded to even size.)
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  tests/fate/lavf-audio.mak | 1 +
>  tests/ref/lavf/aiff   | 4 ++--
>  2 files changed, 3 insertions(+), 2 deletions(-)

needs to update seek test too:


--- ./tests/ref/seek/lavf-aiff  2024-03-05 02:37:36.243300240 +0100
+++ tests/data/fate/seek-lavf-aiff  2024-03-14 22:24:47.357654173 +0100
@@ -1,53 +1,53 @@
-ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos: 70 size:  
4096
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos: 84 size:  
4096
 ret: 0 st:-1 flags:0  ts:-1.00
-ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos: 70 size:  
4096
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos: 84 size:  
4096
 ret: 0 st:-1 flags:1  ts: 1.894167
 ret:-EOF
 ret: 0 st: 0 flags:0  ts: 0.788345
-ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos:  69602 size:  
4096
+ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos:  69616 size:  
4096
 ret: 0 st: 0 flags:1  ts:-0.317506
-ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos: 70 size:  
4096
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos: 84 size:  
4096
...

thx

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

You can kill me, but you cannot change the truth.


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] avformat/internal: Remove declaration for ff_format_io_close_default()

2024-03-14 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Forgotten in d6799ee0e41dee35ebf9c664173aed8e3ab24141.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/internal.h | 4 
>  1 file changed, 4 deletions(-)
> 
> diff --git a/libavformat/internal.h b/libavformat/internal.h
> index 2e59036a53..e5f8337130 100644
> --- a/libavformat/internal.h
> +++ b/libavformat/internal.h
> @@ -719,10 +719,6 @@ int ff_copy_whiteblacklists(AVFormatContext *dst, const 
> AVFormatContext *src);
>   */
>  int ff_format_io_close(AVFormatContext *s, AVIOContext **pb);
>  
> -/* Default io_close callback, not to be used directly, use ff_format_io_close
> - * instead. */
> -void ff_format_io_close_default(AVFormatContext *s, AVIOContext *pb);
> -
>  /**
>   * Utility function to check if the file uses http or https protocol
>   *

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


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

2024-03-14 Thread Timo Rothenpieler
---
 libavutil/hwcontext_d3d11va.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
index 1b96c38d25..e30c8fc238 100644
--- a/libavutil/hwcontext_d3d11va.c
+++ b/libavutil/hwcontext_d3d11va.c
@@ -685,9 +685,17 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, 
const char *device,
 if (pf_DXGIGetDebugInterface) {
 IDXGIDebug *dxgi_debug = NULL;
 hr = pf_DXGIGetDebugInterface(_IDXGIDebug, 
(void**)_debug);
-if (SUCCEEDED(hr) && dxgi_debug)
+if (SUCCEEDED(hr) && dxgi_debug) {
 IDXGIDebug_ReportLiveObjects(dxgi_debug, DXGI_DEBUG_ALL, 
DXGI_DEBUG_RLO_ALL);
+av_log(ctx, AV_LOG_INFO, "Enabled dxgi debugging.\n");
+} else {
+av_log(ctx, AV_LOG_WARNING, "Failed enabling dxgi 
debugging.\n");
+}
+} else {
+av_log(ctx, AV_LOG_WARNING, "Failed getting dxgi debug 
interface.\n");
 }
+} else {
+av_log(ctx, AV_LOG_WARNING, "Failed loading dxgi debug 
library.\n");
 }
 }
 #endif
-- 
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] avutil/hwcontext_d3d11va: prefer DXGI 1.1 factory when available

2024-03-14 Thread Timo Rothenpieler
A lot of modern stuff straight up fails on the old 1.0 factory, which is
masked by the fact that it's only used when an explicit adapter is
specified.
---
 libavutil/hwcontext_d3d11va.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
index a45e53595d..1b96c38d25 100644
--- a/libavutil/hwcontext_d3d11va.c
+++ b/libavutil/hwcontext_d3d11va.c
@@ -62,7 +62,9 @@ static av_cold void load_functions(void)
 return;
 
 mD3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE) GetProcAddress(d3dlib, 
"D3D11CreateDevice");
-mCreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY) GetProcAddress(dxgilib, 
"CreateDXGIFactory");
+mCreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY) GetProcAddress(dxgilib, 
"CreateDXGIFactory1");
+if (!mCreateDXGIFactory)
+mCreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY) GetProcAddress(dxgilib, 
"CreateDXGIFactory");
 #else
 // In UWP (which lacks LoadLibrary), CreateDXGIFactory isn't available,
 // only CreateDXGIFactory1
-- 
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] avutil/hwcontext_d3d11va: remove check for d3d11 debug layer dll

2024-03-14 Thread Timo Rothenpieler
At least on latest Win 11 and Visual Studio 2022, that DLL does not
exist anymore and can't be installed via any of the usual means.
However, debugging works just fine regardless, so this check makes
debugging impossible.

D3D11CreateDevice will fail anyway if debugging is not supported, so
let's rely on that instead.
---
 libavutil/hwcontext_d3d11va.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
index 24b3546e7b..a45e53595d 100644
--- a/libavutil/hwcontext_d3d11va.c
+++ b/libavutil/hwcontext_d3d11va.c
@@ -612,14 +612,10 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, 
const char *device,
 int ret;
 int adapter = -1;
 
-// (On UWP we can't check this.)
-#if !HAVE_UWP
-if (!LoadLibrary("d3d11_1sdklayers.dll"))
-is_debug = 0;
-#endif
-
-if (is_debug)
+if (is_debug) {
 creationFlags |= D3D11_CREATE_DEVICE_DEBUG;
+av_log(ctx, AV_LOG_INFO, "Enabling d3d11 debugging.\n");
+}
 
 if ((ret = ff_thread_once(_loaded, load_functions)) != 0)
 return AVERROR_UNKNOWN;
-- 
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] fftools/ffmpeg_sched: Remove set-but-unused variable

2024-03-14 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt 
> ---
>  fftools/ffmpeg_sched.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/fftools/ffmpeg_sched.c b/fftools/ffmpeg_sched.c
> index d1fb942c34..f739066921 100644
> --- a/fftools/ffmpeg_sched.c
> +++ b/fftools/ffmpeg_sched.c
> @@ -2310,7 +2310,6 @@ int sch_enc_send(Scheduler *sch, unsigned enc_idx, 
> AVPacket *pkt)
>  {
>  SchEnc *enc;
>  int ret;
> -unsigned nb_done = 0;
>  
>  av_assert0(enc_idx < sch->nb_enc);
>  enc = >enc[enc_idx];
> @@ -2332,7 +2331,6 @@ int sch_enc_send(Scheduler *sch, unsigned enc_idx, 
> AVPacket *pkt)
>  if (ret < 0) {
>  av_packet_unref(to_send);
>  if (ret == AVERROR_EOF) {
> -nb_done++;
>  ret = 0;
>  continue;
>  }

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] avcodec/ppc/vp8dsp_altivec: Fix out-of-bounds access

2024-03-14 Thread Sean McGovern
Andreas:

On Tue, Mar 12, 2024 at 9:14 PM Andreas Rheinhardt
 wrote:
>
> h_subpel_filters_inner[i] and h_subpel_filters_outer[i / 2]
> belong together and the former allows the range 0..6,
> so the latter needs to support 0..3. But it has only three
> elements. Add another one.
> The value for the last element has been guesstimated
> from subpel_filters in libavcodec/vp8dsp.c.
>
> This is also intended to fix FATE-failures with UBSan here:
> https://fate.ffmpeg.org/report.cgi?time=20240312011016=ppc-linux-gcc-13.2-ubsan-altivec-qemu
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/ppc/vp8dsp_altivec.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/ppc/vp8dsp_altivec.c b/libavcodec/ppc/vp8dsp_altivec.c
> index 12dac8b0a8..061914fc38 100644
> --- a/libavcodec/ppc/vp8dsp_altivec.c
> +++ b/libavcodec/ppc/vp8dsp_altivec.c
> @@ -50,11 +50,12 @@ static const vec_s8 h_subpel_filters_inner[7] =
>  // for 6tap filters, these are the outer two taps
>  // The zeros mask off pixels 4-7 when filtering 0-3
>  // and vice-versa
> -static const vec_s8 h_subpel_filters_outer[3] =
> +static const vec_s8 h_subpel_filters_outer[4] =
>  {
>  REPT4(0, 0, 2, 1),
>  REPT4(0, 0, 3, 3),
>  REPT4(0, 0, 1, 2),
> +REPT4(0, 0, 0, 0),
>  };
>
>  #define LOAD_H_SUBPEL_FILTER(i) \
> --
> 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".

Confirming this patch fixes fate-checkasm-vp8dsp (and presumably the
other vp8 tests in GCC UBsan) on PowerPC QEMU, POWER7 (ppc64), and
POWER9 (ppc64le).

Thanks again,
Sean McGovern
___
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-14 Thread Michael Niedermayer
On Thu, Mar 14, 2024 at 12:04:47PM +, Ignjatović, Lazar (RS) wrote:
> localaddr option now properly works with IPv6 addresses. Properly
> resolved interface index in places where default 0 interface index is
> used (marked with TODO: within udp.c). Added SO_BINDTODEVICE for mcast
> sockets that are used for reading from the network. Need for this
> arises from the fact that [ffx1::*] and [ffx2::*] mcast addresses need
> to have a defined interface for binding to avoid ambiguity between
> multiple link-local networks on the same host. Failing to set this
> option causes errors on Linux systems for interface and link-local
> scopes.
> 
> For mcast addresses, bind to mcast address is attempted as before.
> In case that this fails, which will happen on Windows, socket is bound
> to INADDR_ANY/IN6ADDR_ANY_INIT depending on address family. Actual
> interface selection is performed using udp_set_multicast_interface to
> point to the desired interface for sending/listening.
> 
> Utilization of sin6_scope_id field enables usage and adequate resolving
> of IPv6 addresses that utilize zone index
> (e.g. fe80::1ff:fe23:4567:890a%eth2)
> This is not fully supported on Windows, thus relying on this field
> is not done on Windows systems.
> 
> Closes: #368
> 
> Signed-off-by: Lazar Ignjatovic 
> ---
>  configure |  3 ++
>  libavformat/ip.c  | 45 
>  libavformat/ip.h  |  6 
>  libavformat/network.h |  6 
>  libavformat/udp.c | 80 ++-
>  5 files changed, 132 insertions(+), 8 deletions(-)

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

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


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

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus


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] avcodec/mpeg4videodec: Align idct-block appropriately

2024-03-14 Thread Andreas Rheinhardt
Sean McGovern:
> Andreas:
> 
> On Tue, Mar 12, 2024 at 8:53 PM Andreas Rheinhardt
>  wrote:
>>
>> It is accessed via AV_RN64() in ff_simple_idct_put_int32_10bit().
>> Should fix the UBSan failures in the mpeg4-simple-studio-profile
>> test here:
>> https://fate.ffmpeg.org/report.cgi?time=20240312011016=ppc-linux-gcc-13.2-ubsan-altivec-qemu
>>
>> Signed-off-by: Andreas Rheinhardt 
>> ---
>>  libavcodec/mpeg4videodec.h | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/mpeg4videodec.h b/libavcodec/mpeg4videodec.h
>> index c0e6ec6592..4a26d18987 100644
>> --- a/libavcodec/mpeg4videodec.h
>> +++ b/libavcodec/mpeg4videodec.h
>> @@ -29,6 +29,7 @@
>>  #include "mpegvideo.h"
>>  #include "mpeg4videodsp.h"
>>
>> +#include "libavutil/mem_internal.h"
>>
>>  typedef struct Mpeg4DecContext {
>>  MpegEncContext m;
>> @@ -83,7 +84,7 @@ typedef struct Mpeg4DecContext {
>>
>>  Mpeg4VideoDSPContext mdsp;
>>
>> -int32_t block32[12][64];
>> +DECLARE_ALIGNED(8, int32_t, block32)[12][64];
>>  // 0 = DCT, 1 = DPCM top to bottom scan, -1 = DPCM bottom to top scan
>>  int dpcm_direction;
>>  int16_t dpcm_macroblock[3][256];
>> --
>> 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".
> 
> Confirming that this fixes fate-mpeg4-simple-studio-profile on PowerPC
> QEMU with GCC UBsan as noted.
> 
> It was not failing on POWER7 (ppc64) or POWER9 (ppc64le).
> 

Not surprising: The Mpeg4VideoDSPContext immediately before block32
contains (function) pointers and therefore has alignment 8 on 64bit
machines, so that block32 happens to be properly aligned already.

- 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] avcodec/mpeg4videodec: Align idct-block appropriately

2024-03-14 Thread Sean McGovern
Andreas:

On Tue, Mar 12, 2024 at 8:53 PM Andreas Rheinhardt
 wrote:
>
> It is accessed via AV_RN64() in ff_simple_idct_put_int32_10bit().
> Should fix the UBSan failures in the mpeg4-simple-studio-profile
> test here:
> https://fate.ffmpeg.org/report.cgi?time=20240312011016=ppc-linux-gcc-13.2-ubsan-altivec-qemu
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/mpeg4videodec.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/mpeg4videodec.h b/libavcodec/mpeg4videodec.h
> index c0e6ec6592..4a26d18987 100644
> --- a/libavcodec/mpeg4videodec.h
> +++ b/libavcodec/mpeg4videodec.h
> @@ -29,6 +29,7 @@
>  #include "mpegvideo.h"
>  #include "mpeg4videodsp.h"
>
> +#include "libavutil/mem_internal.h"
>
>  typedef struct Mpeg4DecContext {
>  MpegEncContext m;
> @@ -83,7 +84,7 @@ typedef struct Mpeg4DecContext {
>
>  Mpeg4VideoDSPContext mdsp;
>
> -int32_t block32[12][64];
> +DECLARE_ALIGNED(8, int32_t, block32)[12][64];
>  // 0 = DCT, 1 = DPCM top to bottom scan, -1 = DPCM bottom to top scan
>  int dpcm_direction;
>  int16_t dpcm_macroblock[3][256];
> --
> 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".

Confirming that this fixes fate-mpeg4-simple-studio-profile on PowerPC
QEMU with GCC UBsan as noted.

It was not failing on POWER7 (ppc64) or POWER9 (ppc64le).

Thanks,
Sean McGovern
___
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] avcodec/lossless_videoencdsp: Fix unaligned access

2024-03-14 Thread Sean McGovern
Andreas:

On Tue, Mar 12, 2024 at 8:42 PM Andreas Rheinhardt
 wrote:
>
> HAVE_FAST_UNALIGNED being true does not imply that
> one can simply read from any pointer via *(long*).
> It is undefined behaviour in case the pointer is not
> sufficiently aligned; and even if it is, it is (likely)
> a violation of the effective-type rules. Fix both
> of these by using the appropriate AV_[RW]N macros.
>
> Also, the current code used sizeof(long) as if this
> were the CPU's native arithmetic size, but this is
> not true on 64bit Windows. This has been fixed, too.
>
> This affected huffyuv FATE-tests.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/lossless_videoencdsp.c | 27 +++
>  1 file changed, 19 insertions(+), 8 deletions(-)
>
> diff --git a/libavcodec/lossless_videoencdsp.c 
> b/libavcodec/lossless_videoencdsp.c
> index e2dc99e201..8d03a5b5c6 100644
> --- a/libavcodec/lossless_videoencdsp.c
> +++ b/libavcodec/lossless_videoencdsp.c
> @@ -18,19 +18,31 @@
>
>  #include "config.h"
>  #include "libavutil/attributes.h"
> +#include "libavutil/intreadwrite.h"
>  #include "lossless_videoencdsp.h"
>  #include "mathops.h"
>
> +#if HAVE_FAST_64BIT
> +typedef uint64_t uint_native;
> +#define READ   AV_RN64
> +#define READA  AV_RN64A
> +#define WRITEA AV_WN64A
> +#else
> +typedef uint32_t uint_native;
> +#define READ   AV_RN32
> +#define READA  AV_RN32A
> +#define WRITEA AV_WN32A
> +#endif
>  // 0x7f7f7f7f or 0x7f7f7f7f7f7f7f7f or whatever, depending on the cpu's 
> native arithmetic size
> -#define pb_7f (~0UL / 255 * 0x7f)
> -#define pb_80 (~0UL / 255 * 0x80)
> +#define pb_7f (~(uint_native)0 / 255 * 0x7f)
> +#define pb_80 (~(uint_native)0 / 255 * 0x80)
>
>  static void diff_bytes_c(uint8_t *dst, const uint8_t *src1, const uint8_t 
> *src2, intptr_t w)
>  {
>  long i;
>
>  #if !HAVE_FAST_UNALIGNED
> -if (((long)src1 | (long)src2) & (sizeof(long) - 1)) {
> +if (((uintptr_t)src1 | (uintptr_t)src2) & (sizeof(uint_native) - 1)) {
>  for (i = 0; i + 7 < w; i += 8) {
>  dst[i + 0] = src1[i + 0] - src2[i + 0];
>  dst[i + 1] = src1[i + 1] - src2[i + 1];
> @@ -43,11 +55,10 @@ static void diff_bytes_c(uint8_t *dst, const uint8_t 
> *src1, const uint8_t *src2,
>  }
>  } else
>  #endif
> -for (i = 0; i <= w - (int) sizeof(long); i += sizeof(long)) {
> -long a = *(long *) (src1 + i);
> -long b = *(long *) (src2 + i);
> -*(long *) (dst + i) = ((a | pb_80) - (b & pb_7f)) ^
> -  ((a ^ b ^ pb_80) & pb_80);
> +for (i = 0; i <= w - (int) sizeof(uint_native); i += 
> sizeof(uint_native)) {
> +uint_native a = READA(src1 + i);
> +uint_native b = READ(src2 + i);
> +WRITEA(dst + i, ((a | pb_80) - (b & pb_7f)) ^ ((a ^ b ^ pb_80) & 
> pb_80));
>  }
>  for (; i < w; i++)
>  dst[i + 0] = src1[i + 0] - src2[i + 0];
> --
> 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".

Confirming that this fixes 'fate-vsynth[123]-ffvhuff' and probably others on my
PowerPC QEMU setup (provided the avidec fix is applied as well),
POWER7 (ppc64) and POWER9 (ppc64le).

Thanks,
Sean McGovern
___
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/avidec: Fix integer overflow iff ULONG_MAX < INT64_MAX

2024-03-14 Thread Sean McGovern
Andreas:

On Tue, Mar 12, 2024 at 6:57 PM Andreas Rheinhardt
 wrote:
>
> Affects many FATE-tests, see
> http://fate.ffmpeg.org/report.cgi?time=20240312011016=ppc-linux-gcc-13.2-ubsan-altivec-qemu
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/avidec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/avidec.c b/libavformat/avidec.c
> index f3183b2698..b7cbf148af 100644
> --- a/libavformat/avidec.c
> +++ b/libavformat/avidec.c
> @@ -1696,7 +1696,7 @@ static int check_stream_max_drift(AVFormatContext *s)
>  int *idx = av_calloc(s->nb_streams, sizeof(*idx));
>  if (!idx)
>  return AVERROR(ENOMEM);
> -for (min_pos = pos = 0; min_pos != INT64_MAX; pos = min_pos + 1LU) {
> +for (min_pos = pos = 0; min_pos != INT64_MAX; pos = min_pos + 
> (uint64_t)1) {
>  int64_t max_dts = INT64_MIN / 2;
>  int64_t min_dts = INT64_MAX / 2;
>  int64_t max_buffer = 0;
> --
> 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".

Confirming that this fixes fate-v210 (and probably many more) on my
PowerPC QEMU setup -- it was not failing on POWER7 (ppc64) or POWER9
(ppc64le) and remains so with the patch applied.

Thanks,
Sean McGovern
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH v2] avcodec/ppc/h264dsp: Fix unaligned stores

2024-03-14 Thread Andreas Rheinhardt
Sean McGovern:
> Andreas:
> 
> On Wed, Mar 13, 2024 at 7:31 AM Andreas Rheinhardt
>  wrote:
>>
>> Also fix an effective-type violation.
>> Exposed by 
>> https://fate.ffmpeg.org/report.cgi?time=20240312011016=ppc-linux-gcc-13.2-ubsan-altivec-qemu
>>
>> Signed-off-by: Andreas Rheinhardt 
>> ---
>>  libavcodec/ppc/h264dsp.c | 35 +--
>>  1 file changed, 17 insertions(+), 18 deletions(-)
>>
>> diff --git a/libavcodec/ppc/h264dsp.c b/libavcodec/ppc/h264dsp.c
>> index c02733dda2..f50f2553a2 100644
>> --- a/libavcodec/ppc/h264dsp.c
>> +++ b/libavcodec/ppc/h264dsp.c
>> @@ -401,30 +401,29 @@ static inline void write16x4(uint8_t *dst, int 
>> dst_stride,
>>   register vec_u8 r0, register vec_u8 r1,
>>   register vec_u8 r2, register vec_u8 r3) {
>>  DECLARE_ALIGNED(16, unsigned char, result)[64];
>> -uint32_t *src_int = (uint32_t *)result, *dst_int = (uint32_t *)dst;
>> -int int_dst_stride = dst_stride/4;
>> +uint32_t *src_int = (uint32_t *)result;
>>
>>  vec_st(r0, 0, result);
>>  vec_st(r1, 16, result);
>>  vec_st(r2, 32, result);
>>  vec_st(r3, 48, result);
>>  /* FIXME: there has to be a better way */
>> -*dst_int = *src_int;
>> -*(dst_int+   int_dst_stride) = *(src_int + 1);
>> -*(dst_int+ 2*int_dst_stride) = *(src_int + 2);
>> -*(dst_int+ 3*int_dst_stride) = *(src_int + 3);
>> -*(dst_int+ 4*int_dst_stride) = *(src_int + 4);
>> -*(dst_int+ 5*int_dst_stride) = *(src_int + 5);
>> -*(dst_int+ 6*int_dst_stride) = *(src_int + 6);
>> -*(dst_int+ 7*int_dst_stride) = *(src_int + 7);
>> -*(dst_int+ 8*int_dst_stride) = *(src_int + 8);
>> -*(dst_int+ 9*int_dst_stride) = *(src_int + 9);
>> -*(dst_int+10*int_dst_stride) = *(src_int + 10);
>> -*(dst_int+11*int_dst_stride) = *(src_int + 11);
>> -*(dst_int+12*int_dst_stride) = *(src_int + 12);
>> -*(dst_int+13*int_dst_stride) = *(src_int + 13);
>> -*(dst_int+14*int_dst_stride) = *(src_int + 14);
>> -*(dst_int+15*int_dst_stride) = *(src_int + 15);
>> +AV_WN32(dst,   AV_RN32A(src_int + 0));
>> +AV_WN32(dst +  dst_stride, AV_RN32A(src_int + 1));
>> +AV_WN32(dst +  2 * dst_stride, AV_RN32A(src_int + 2));
>> +AV_WN32(dst +  3 * dst_stride, AV_RN32A(src_int + 3));
>> +AV_WN32(dst +  4 * dst_stride, AV_RN32A(src_int + 4));
>> +AV_WN32(dst +  5 * dst_stride, AV_RN32A(src_int + 5));
>> +AV_WN32(dst +  6 * dst_stride, AV_RN32A(src_int + 6));
>> +AV_WN32(dst +  7 * dst_stride, AV_RN32A(src_int + 7));
>> +AV_WN32(dst +  8 * dst_stride, AV_RN32A(src_int + 8));
>> +AV_WN32(dst +  9 * dst_stride, AV_RN32A(src_int + 9));
>> +AV_WN32(dst + 10 * dst_stride, AV_RN32A(src_int + 10));
>> +AV_WN32(dst + 11 * dst_stride, AV_RN32A(src_int + 11));
>> +AV_WN32(dst + 12 * dst_stride, AV_RN32A(src_int + 12));
>> +AV_WN32(dst + 13 * dst_stride, AV_RN32A(src_int + 13));
>> +AV_WN32(dst + 14 * dst_stride, AV_RN32A(src_int + 14));
>> +AV_WN32(dst + 15 * dst_stride, AV_RN32A(src_int + 15));
>>  }
>>
>>  /** @brief performs a 6x16 transpose of data in src, and stores it to dst
>> --
>> 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".
> 
> First of all, thank you for looking into this.
> 
> Second, do we feel that this change covers the FIXME immediately above
> it that exclaims "there has to be a better way"?
> If so, we can remove the comment.

I don't think so. This code comes from a time when FFmpeg did not care
about the effective-type-rules or about alignment due to undefined
behaviour; it only cared about alignment when it led to crashes.
The old discussion confirms this:
https://ffmpeg.org/pipermail/ffmpeg-devel/2007-May/034609.html
https://ffmpeg.org/pipermail/ffmpeg-devel/2007-May/034612.html contains
the following:
"As I said, I submitted this patch in order to have PPC users get some
speed-up now rather than having a hypothetic optimal code when some of
us who work on Altivec sit down and work on it.

I do think it's better to have a committed faster code that leaves
room for improvement than a fastest code that never sees the light."

The fixme relates to this; it was probably considered advantageous to
avoid storing the vectors in stack buffers.

> 
> I did not perform a full FATE run as it is expensive on my QEMU setup,
> but I can confirm that this fixes the checkasm-h264dsp test under GCC
> UBsan there as well as on a POWER7 (ppc64) and a POWER9 (ppc64le).
> 

Ok, will apply then. Thanks for testing.

- Andreas

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

To unsubscribe, visit link above, 

Re: [FFmpeg-devel] [PATCH v2] avcodec/ppc/h264dsp: Fix unaligned stores

2024-03-14 Thread James Almer

On 3/14/2024 4:13 PM, Sean McGovern wrote:

Andreas:

On Wed, Mar 13, 2024 at 7:31 AM Andreas Rheinhardt
 wrote:


Also fix an effective-type violation.
Exposed by 
https://fate.ffmpeg.org/report.cgi?time=20240312011016=ppc-linux-gcc-13.2-ubsan-altivec-qemu

Signed-off-by: Andreas Rheinhardt 
---
  libavcodec/ppc/h264dsp.c | 35 +--
  1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/libavcodec/ppc/h264dsp.c b/libavcodec/ppc/h264dsp.c
index c02733dda2..f50f2553a2 100644
--- a/libavcodec/ppc/h264dsp.c
+++ b/libavcodec/ppc/h264dsp.c
@@ -401,30 +401,29 @@ static inline void write16x4(uint8_t *dst, int dst_stride,
   register vec_u8 r0, register vec_u8 r1,
   register vec_u8 r2, register vec_u8 r3) {
  DECLARE_ALIGNED(16, unsigned char, result)[64];
-uint32_t *src_int = (uint32_t *)result, *dst_int = (uint32_t *)dst;
-int int_dst_stride = dst_stride/4;
+uint32_t *src_int = (uint32_t *)result;

  vec_st(r0, 0, result);
  vec_st(r1, 16, result);
  vec_st(r2, 32, result);
  vec_st(r3, 48, result);
  /* FIXME: there has to be a better way */
-*dst_int = *src_int;
-*(dst_int+   int_dst_stride) = *(src_int + 1);
-*(dst_int+ 2*int_dst_stride) = *(src_int + 2);
-*(dst_int+ 3*int_dst_stride) = *(src_int + 3);
-*(dst_int+ 4*int_dst_stride) = *(src_int + 4);
-*(dst_int+ 5*int_dst_stride) = *(src_int + 5);
-*(dst_int+ 6*int_dst_stride) = *(src_int + 6);
-*(dst_int+ 7*int_dst_stride) = *(src_int + 7);
-*(dst_int+ 8*int_dst_stride) = *(src_int + 8);
-*(dst_int+ 9*int_dst_stride) = *(src_int + 9);
-*(dst_int+10*int_dst_stride) = *(src_int + 10);
-*(dst_int+11*int_dst_stride) = *(src_int + 11);
-*(dst_int+12*int_dst_stride) = *(src_int + 12);
-*(dst_int+13*int_dst_stride) = *(src_int + 13);
-*(dst_int+14*int_dst_stride) = *(src_int + 14);
-*(dst_int+15*int_dst_stride) = *(src_int + 15);
+AV_WN32(dst,   AV_RN32A(src_int + 0));
+AV_WN32(dst +  dst_stride, AV_RN32A(src_int + 1));
+AV_WN32(dst +  2 * dst_stride, AV_RN32A(src_int + 2));
+AV_WN32(dst +  3 * dst_stride, AV_RN32A(src_int + 3));
+AV_WN32(dst +  4 * dst_stride, AV_RN32A(src_int + 4));
+AV_WN32(dst +  5 * dst_stride, AV_RN32A(src_int + 5));
+AV_WN32(dst +  6 * dst_stride, AV_RN32A(src_int + 6));
+AV_WN32(dst +  7 * dst_stride, AV_RN32A(src_int + 7));
+AV_WN32(dst +  8 * dst_stride, AV_RN32A(src_int + 8));
+AV_WN32(dst +  9 * dst_stride, AV_RN32A(src_int + 9));
+AV_WN32(dst + 10 * dst_stride, AV_RN32A(src_int + 10));
+AV_WN32(dst + 11 * dst_stride, AV_RN32A(src_int + 11));
+AV_WN32(dst + 12 * dst_stride, AV_RN32A(src_int + 12));
+AV_WN32(dst + 13 * dst_stride, AV_RN32A(src_int + 13));
+AV_WN32(dst + 14 * dst_stride, AV_RN32A(src_int + 14));
+AV_WN32(dst + 15 * dst_stride, AV_RN32A(src_int + 15));
  }

  /** @brief performs a 6x16 transpose of data in src, and stores it to dst
--
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".


First of all, thank you for looking into this.

Second, do we feel that this change covers the FIXME immediately above
it that exclaims "there has to be a better way"?
If so, we can remove the comment.


Doubt it. Even after Andreas' change it's essentially the same as before 
(load four bytes, write four bytes) but without the UB. The FIXME 
probably refers to finding a way to do this with vector intrinsics.




I did not perform a full FATE run as it is expensive on my QEMU setup,
but I can confirm that this fixes the checkasm-h264dsp test under GCC
UBsan there as well as on a POWER7 (ppc64) and a POWER9 (ppc64le).

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

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


Re: [FFmpeg-devel] [PATCH v2] avcodec/ppc/h264dsp: Fix unaligned stores

2024-03-14 Thread Sean McGovern
Andreas:

On Wed, Mar 13, 2024 at 7:31 AM Andreas Rheinhardt
 wrote:
>
> Also fix an effective-type violation.
> Exposed by 
> https://fate.ffmpeg.org/report.cgi?time=20240312011016=ppc-linux-gcc-13.2-ubsan-altivec-qemu
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/ppc/h264dsp.c | 35 +--
>  1 file changed, 17 insertions(+), 18 deletions(-)
>
> diff --git a/libavcodec/ppc/h264dsp.c b/libavcodec/ppc/h264dsp.c
> index c02733dda2..f50f2553a2 100644
> --- a/libavcodec/ppc/h264dsp.c
> +++ b/libavcodec/ppc/h264dsp.c
> @@ -401,30 +401,29 @@ static inline void write16x4(uint8_t *dst, int 
> dst_stride,
>   register vec_u8 r0, register vec_u8 r1,
>   register vec_u8 r2, register vec_u8 r3) {
>  DECLARE_ALIGNED(16, unsigned char, result)[64];
> -uint32_t *src_int = (uint32_t *)result, *dst_int = (uint32_t *)dst;
> -int int_dst_stride = dst_stride/4;
> +uint32_t *src_int = (uint32_t *)result;
>
>  vec_st(r0, 0, result);
>  vec_st(r1, 16, result);
>  vec_st(r2, 32, result);
>  vec_st(r3, 48, result);
>  /* FIXME: there has to be a better way */
> -*dst_int = *src_int;
> -*(dst_int+   int_dst_stride) = *(src_int + 1);
> -*(dst_int+ 2*int_dst_stride) = *(src_int + 2);
> -*(dst_int+ 3*int_dst_stride) = *(src_int + 3);
> -*(dst_int+ 4*int_dst_stride) = *(src_int + 4);
> -*(dst_int+ 5*int_dst_stride) = *(src_int + 5);
> -*(dst_int+ 6*int_dst_stride) = *(src_int + 6);
> -*(dst_int+ 7*int_dst_stride) = *(src_int + 7);
> -*(dst_int+ 8*int_dst_stride) = *(src_int + 8);
> -*(dst_int+ 9*int_dst_stride) = *(src_int + 9);
> -*(dst_int+10*int_dst_stride) = *(src_int + 10);
> -*(dst_int+11*int_dst_stride) = *(src_int + 11);
> -*(dst_int+12*int_dst_stride) = *(src_int + 12);
> -*(dst_int+13*int_dst_stride) = *(src_int + 13);
> -*(dst_int+14*int_dst_stride) = *(src_int + 14);
> -*(dst_int+15*int_dst_stride) = *(src_int + 15);
> +AV_WN32(dst,   AV_RN32A(src_int + 0));
> +AV_WN32(dst +  dst_stride, AV_RN32A(src_int + 1));
> +AV_WN32(dst +  2 * dst_stride, AV_RN32A(src_int + 2));
> +AV_WN32(dst +  3 * dst_stride, AV_RN32A(src_int + 3));
> +AV_WN32(dst +  4 * dst_stride, AV_RN32A(src_int + 4));
> +AV_WN32(dst +  5 * dst_stride, AV_RN32A(src_int + 5));
> +AV_WN32(dst +  6 * dst_stride, AV_RN32A(src_int + 6));
> +AV_WN32(dst +  7 * dst_stride, AV_RN32A(src_int + 7));
> +AV_WN32(dst +  8 * dst_stride, AV_RN32A(src_int + 8));
> +AV_WN32(dst +  9 * dst_stride, AV_RN32A(src_int + 9));
> +AV_WN32(dst + 10 * dst_stride, AV_RN32A(src_int + 10));
> +AV_WN32(dst + 11 * dst_stride, AV_RN32A(src_int + 11));
> +AV_WN32(dst + 12 * dst_stride, AV_RN32A(src_int + 12));
> +AV_WN32(dst + 13 * dst_stride, AV_RN32A(src_int + 13));
> +AV_WN32(dst + 14 * dst_stride, AV_RN32A(src_int + 14));
> +AV_WN32(dst + 15 * dst_stride, AV_RN32A(src_int + 15));
>  }
>
>  /** @brief performs a 6x16 transpose of data in src, and stores it to dst
> --
> 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".

First of all, thank you for looking into this.

Second, do we feel that this change covers the FIXME immediately above
it that exclaims "there has to be a better way"?
If so, we can remove the comment.

I did not perform a full FATE run as it is expensive on my QEMU setup,
but I can confirm that this fixes the checkasm-h264dsp test under GCC
UBsan there as well as on a POWER7 (ppc64) and a POWER9 (ppc64le).

Thanks,
Sean McGovern
___
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/1] avformat/demux: Fix accurate probing of durations in mpegts/ps

2024-03-14 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   |  30 +---
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 170 +-
 tests/ref/fate/ts-opus-demux  |   4 +-
 3 files changed, 93 insertions(+), 111 deletions(-)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index 4c50eb5568..7e75e7149c 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);
@@ -1843,11 +1840,6 @@ static void estimate_timings_from_pts(AVFormatContext 
*ic, int64_t old_offset)
 st->codecpar->codec_type != AVMEDIA_TYPE_UNKNOWN)
 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;
-}
 }
 
 if (ic->skip_estimate_duration_from_pts) {
@@ -1865,6 +1857,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 +1867,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 +1877,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 +1932,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 
b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
index 548cab01c6..86e5e6670f 100644
--- a/tests/ref/fate/concat-demuxer-simple2-lavf-ts
+++ b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
@@ -62,90 +62,90 @@ 
audio|0|86988|0.966533|86988|0.966533|2351|0.026122|209|N/A|K__
 

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

2024-03-14 Thread Nicolas Gaullier
ff_read_packet() is more lightweight, but it leads to important issues
when looking for accurate durations.
As a side effect, the code looks also simpler with regular av_read_frame() 
calls.

1)
Updates in the fate tests do exhibit most of the results.

2)
See also more directly the case of an audio PES containing many frames:

>ffprobe tests/data/lavf/lavf.ts -select_streams a -show_entries 
>stream=duration -of flat
Before patch:
  streams.stream.0.duration="0.757556"
After patch:
  streams.stream.0.duration="1.018778"

3)
Here is an additional (commonplace) sample to demonstrate the benefit for 
twofields-encoded video:
https://0x0.st/HFbm.ts (say h264-50i_mp2.ts)

>ffprobe h264-50i_mp2.ts -show_entries stream=duration -of flat
Before patch:
  streams.stream.0.duration="2.06"
  streams.stream.1.duration="1.176000"
After patch:
  streams.stream.0.duration="2.08"
  streams.stream.1.duration="1.20"

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

 libavformat/demux.c   |  30 +---
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 170 +-
 tests/ref/fate/ts-opus-demux  |   4 +-
 3 files changed, 93 insertions(+), 111 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".


[FFmpeg-devel] [PATCH] doc/filters: Change rdiv (vf_convolution) documentation to reflect actual behavior

2024-03-14 Thread Stone Chen
The documentation correctly states that the rdiv is a multiplier but 
incorrectly states the default behavior is to multiply by the sum of all matrix 
elements - it multiplies by 1/sum.

This changes the documentation to match the code.

Address trac #10889
---
 doc/filters.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index e0436a5755..913365671d 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10497,7 +10497,7 @@ and from 1 to 49 odd number of signed integers in 
@var{row} mode.
 @item 2rdiv
 @item 3rdiv
 Set multiplier for calculated value for each plane.
-If unset or 0, it will be sum of all matrix elements.
+If unset or 0, it will be 1/sum of all matrix elements.
 
 @item 0bias
 @item 1bias
-- 
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] tools/target_dec_fuzzer: force experimental flag for VVC

2024-03-14 Thread James Almer
Otherwise the decoder will not even open.

Signed-off-by: James Almer 
---
 tools/target_dec_fuzzer.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index 84b646b7f4..459b07070e 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -176,6 +176,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 AVCodecParserContext *parser = NULL;
 uint64_t keyframes = 0;
 uint64_t flushpattern = -1;
+int strict_std_compliance = 0;
 AVDictionary *opts = NULL;
 
 if (!c) {
@@ -307,6 +308,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_VP6A:maxpixels  /= 4096;  break;
 case AV_CODEC_ID_VP7: maxpixels  /= 256;   break;
 case AV_CODEC_ID_VP9: maxpixels  /= 4096;  break;
+case AV_CODEC_ID_VVC: strict_std_compliance = 
FF_COMPLIANCE_EXPERIMENTAL;  break;
 case AV_CODEC_ID_WAVPACK: maxsamples /= 1024;  break;
 case AV_CODEC_ID_WCMV:maxpixels  /= 1024;  break;
 case AV_CODEC_ID_WMV3IMAGE:   maxpixels  /= 8192;  break;
@@ -333,6 +335,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 
 ctx->max_samples = maxsamples_per_frame;
 ctx->get_buffer2 = fuzz_get_buffer2;
+ctx->strict_std_compliance = strict_std_compliance;
 
 if (size > 1024) {
 GetByteContext gbc;
-- 
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/mxfdec: signal channel layouts using the new channel layout api

2024-03-14 Thread Tomas Härdin
fre 2024-03-08 klockan 21:13 +0100 skrev Marton Balint:
> Signed-off-by: Marton Balint 
> ---
>  libavformat/mxfdec.c | 129 ++---
> --
>  1 file changed, 53 insertions(+), 76 deletions(-)

No idea how the new API works, but it's less code which seems nice.

Changing AV_CH_* to AV_CHAN_* seems like needless busywork. But that
has little to do with this patch.

No objections from my end.

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

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


Re: [FFmpeg-devel] [PATCH 1/4] aarch64: Fix ff_hevc_put_hevc_epel_h48_8_neon_i8mm

2024-03-14 Thread Martin Storsjö

On Thu, 14 Mar 2024, J. Dekker wrote:



Martin Storsjö  writes:


The first 32 elements of each row were correct, while the
last 16 were scrambled.

This hasn't been noticed, because the checkasm test erroneously
only checked half of the output (for 8 bit functions), and
apparently none of the samples as part of "fate-hevc" seem to
trigger this specific function.
---
 libavcodec/aarch64/hevcdsp_epel_neon.S | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)


Thanks for the fixes, wonder if we should use checkasm_check()
exclusively in checkasm rather than memcmp(), would probably be useful.


Wherever it makes sense and works, then yes, using checkasm_check() 
probably is useful. (Within dav1d, we use it in most tests except for a 
few.)


FWIW, many checkasm tests seem to have pretty naive setups, where e.g. all 
rows are tightly packed. If they'd use a bigger stride with more padding 
between rows, one can also detect some other cases of potential asm bugs.



Pushed set


Thanks!

// 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] avcodec/libx264: fix extradata when config annexb=0

2024-03-14 Thread Andreas Rheinhardt
Zhao Zhili:
> From: Zhao Zhili 
> 
> ---
> v5: Decode chroma_format_idc directly instead of 
> ff_h264_decode_seq_parameter_set
> v4: Fix missing SEI in set_avcc_extradata
> v3: Remove unnecessary inclusion
> 
>  libavcodec/libx264.c | 162 ---
>  1 file changed, 138 insertions(+), 24 deletions(-)
> 
> diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
> index 10d646bd76..64cefb5fb0 100644
> --- a/libavcodec/libx264.c
> +++ b/libavcodec/libx264.c
> @@ -38,6 +38,7 @@
>  #include "packet_internal.h"
>  #include "atsc_a53.h"
>  #include "sei.h"
> +#include "golomb.h"
>  
>  #include 
>  #include 
> @@ -865,6 +866,140 @@ static int convert_pix_fmt(enum AVPixelFormat pix_fmt)
>  return 0;
>  }
>  
> +static int save_sei(AVCodecContext *avctx, x264_nal_t *nal)
> +{
> +X264Context *x4 = avctx->priv_data;
> +
> +av_log(avctx, AV_LOG_INFO, "%s\n", nal->p_payload + 25);
> +x4->sei_size = nal->i_payload;
> +x4->sei = av_malloc(x4->sei_size);
> +if (!x4->sei)
> +return AVERROR(ENOMEM);
> +
> +memcpy(x4->sei, nal->p_payload, nal->i_payload);
> +
> +return 0;
> +}
> +
> +static int set_avcc_extradata(AVCodecContext *avctx, x264_nal_t *nal, int 
> nnal)
> +{
> +X264Context *x4 = avctx->priv_data;
> +x264_nal_t *sps_nal = NULL;
> +x264_nal_t *pps_nal = NULL;
> +uint8_t *p, *sps;
> +int ret;
> +
> +/* We know it's in the order of SPS/PPS/SEI, but it's not documented in 
> x264 API.
> + * The x264 param i_sps_id implies there is a single pair of SPS/PPS.
> + */
> +for (int i = 0; i < nnal; i++) {
> +switch (nal[i].i_type) {
> +case NAL_SPS:
> +sps_nal = [i];
> +break;
> +case NAL_PPS:
> +pps_nal = [i];
> +break;
> +case NAL_SEI:
> +ret = save_sei(avctx, [i]);
> +if (ret < 0)
> +return ret;
> +break;
> +}
> +}
> +if (!sps_nal || !pps_nal)
> +return AVERROR_EXTERNAL;
> +
> +avctx->extradata_size = sps_nal->i_payload + pps_nal->i_payload + 7;
> +avctx->extradata = av_mallocz(avctx->extradata_size + 
> AV_INPUT_BUFFER_PADDING_SIZE);
> +if (!avctx->extradata)
> +return AVERROR(ENOMEM);
> +
> +// Now create AVCDecoderConfigurationRecord
> +p = avctx->extradata;
> +// Skip size part
> +sps = sps_nal->p_payload + 4;
> +*p++ = 1; // version
> +*p++ = sps[1]; // AVCProfileIndication
> +*p++ = sps[2]; // profile_compatibility
> +*p++ = sps[3]; // AVCLevelIndication
> +*p++ = 0xFF;
> +*p++ = 0xE0 | 0x01; // 3 bits reserved (111) + 5 bits number of sps
> +memcpy(p, sps_nal->p_payload + 2, sps_nal->i_payload - 2);
> +// Make sps has AV_INPUT_BUFFER_PADDING_SIZE padding, so it can be used
> +// with GetBitContext
> +sps = p + 2;
> +p += sps_nal->i_payload - 2;
> +*p++ = 1;
> +memcpy(p, pps_nal->p_payload + 2, pps_nal->i_payload - 2);
> +p += pps_nal->i_payload - 2;
> +
> +if (sps[3] != 66 && sps[3] != 77 && sps[3] != 88) {
> +GetBitContext gbc;
> +int chroma_format_idc;
> +int bit_depth_luma_minus8, bit_depth_chroma_minus8;
> +
> +/* It's not possible to have emulation prevention byte before
> + * bit_depth_chroma_minus8 due to the range of sps id, 
> chroma_format_idc
> + * and so on. So we can read directly without need to escape 
> emulation
> + * prevention byte.

There is a slight problem here: You ignore the possibility of
profile_idc being zero. After all, all values not being used are merely
reserved and can be used at any time (although I doubt that they will
ever use this). Shall we ignore this?
The above check (and presumably the ISOBMFF spec for this) uses an
opt-out check for profile, whereas the H.264 spec actually uses an
opt-in check. I just wanted to mention it, feel free to ignore it.

> + *
> + * +4 to skip until sps id.
> + */
> +init_get_bits8(, sps + 4, sps_nal->i_payload - 4 - 4);
> +// Skip sps id
> +get_ue_golomb_31();
> +chroma_format_idc = get_ue_golomb_31();
> +if (chroma_format_idc == 3)
> +skip_bits1();
> +bit_depth_luma_minus8 = get_ue_golomb_31();
> +bit_depth_chroma_minus8 = get_ue_golomb_31();
> +
> +*p++ = 0xFC | chroma_format_idc;
> +*p++ = 0xF8 | bit_depth_luma_minus8;
> +*p++ = 0xF8 | bit_depth_chroma_minus8;
> +*p++ = 0;
> +}
> +av_assert0(avctx->extradata + avctx->extradata_size >= p);

Does this have to be an av_assert0?

> +avctx->extradata_size = p - avctx->extradata;
> +
> +return 0;
> +}
> +
> +static int set_extradata(AVCodecContext *avctx)
> +{
> +X264Context *x4 = avctx->priv_data;
> +x264_nal_t *nal;
> +uint8_t *p;
> +int nnal, s;
> +
> +s = x264_encoder_headers(x4->enc, , );
> +if (s < 0)
> +return 

Re: [FFmpeg-devel] [PATCH 1/4] aarch64: Fix ff_hevc_put_hevc_epel_h48_8_neon_i8mm

2024-03-14 Thread J. Dekker

Martin Storsjö  writes:

> The first 32 elements of each row were correct, while the
> last 16 were scrambled.
>
> This hasn't been noticed, because the checkasm test erroneously
> only checked half of the output (for 8 bit functions), and
> apparently none of the samples as part of "fate-hevc" seem to
> trigger this specific function.
> ---
>  libavcodec/aarch64/hevcdsp_epel_neon.S | 14 +-
>  1 file changed, 9 insertions(+), 5 deletions(-)

Thanks for the fixes, wonder if we should use checkasm_check()
exclusively in checkasm rather than memcmp(), would probably be useful.

Pushed set

-- 
jd
___
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: enable UDP IPv6 multicast interface selection

2024-03-14 Thread RS
localaddr option now properly works with IPv6 addresses. Properly
resolved interface index in places where default 0 interface index is
used (marked with TODO: within udp.c). Added SO_BINDTODEVICE for mcast
sockets that are used for reading from the network. Need for this
arises from the fact that [ffx1::*] and [ffx2::*] mcast addresses need
to have a defined interface for binding to avoid ambiguity between
multiple link-local networks on the same host. Failing to set this
option causes errors on Linux systems for interface and link-local
scopes.

For mcast addresses, bind to mcast address is attempted as before.
In case that this fails, which will happen on Windows, socket is bound
to INADDR_ANY/IN6ADDR_ANY_INIT depending on address family. Actual
interface selection is performed using udp_set_multicast_interface to
point to the desired interface for sending/listening.

Utilization of sin6_scope_id field enables usage and adequate resolving
of IPv6 addresses that utilize zone index
(e.g. fe80::1ff:fe23:4567:890a%eth2)
This is not fully supported on Windows, thus relying on this field
is not done on Windows systems.

Closes: #368

Signed-off-by: Lazar Ignjatovic 
---
 configure |  3 ++
 libavformat/ip.c  | 45 
 libavformat/ip.h  |  6 
 libavformat/network.h |  6 
 libavformat/udp.c | 80 ++-
 5 files changed, 132 insertions(+), 8 deletions(-)

diff --git a/configure b/configure
index c34bdd13f5..77f03948ce 100755
--- a/configure
+++ b/configure
@@ -2256,6 +2256,7 @@ HEADERS_LIST="
 valgrind_valgrind_h
 windows_h
 winsock2_h
+iphlpapi_h
 "

 INTRINSICS_LIST="
@@ -6408,6 +6409,8 @@ if ! disabled network; then
 check_struct winsock2.h "struct sockaddr" sa_len
 check_type ws2tcpip.h "struct sockaddr_in6"
 check_type ws2tcpip.h "struct sockaddr_storage"
+check_headers iphlpapi.h && network_extralibs+=" -liphlpapi" || 
disable iphlpapi_h
+check_func_headers iphlpapi.h GetBestInterfaceEx
 else
 disable network
 fi
diff --git a/libavformat/ip.c b/libavformat/ip.c
index b2c7ef07e5..4f2d998c34 100644
--- a/libavformat/ip.c
+++ b/libavformat/ip.c
@@ -18,6 +18,9 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */

+#define _DEFAULT_SOURCE
+#define _SVID_SOURCE
+
 #include 
 #include "ip.h"
 #include "libavutil/avstring.h"
@@ -159,3 +162,45 @@ void ff_ip_reset_filters(IPSourceFilters *filters)
 filters->nb_include_addrs = 0;
 filters->nb_exclude_addrs = 0;
 }
+
+unsigned int ff_ip_resolve_interface_index(struct sockaddr_storage *local_addr)
+{
+#if HAVE_WINSOCK2_H && HAVE_IPHLPAPI_H
+DWORD retval;
+unsigned long iface;
+
+if (local_addr == NULL)
+return 0;
+
+retval = GetBestInterfaceEx((struct sockaddr*)local_addr, );
+if (retval == NO_ERROR)
+return iface;
+
+return 0;
+#elif !HAVE_WINSOCK2_H
+struct ifaddrs *ifaddr, *ifa;
+
+if (local_addr == NULL)
+return 0;
+
+/* Special case for link-local addresses, relevant interface is stored in 
sin6_scope_id */
+#if HAVE_STRUCT_SOCKADDR_IN6 && defined(IN6_IS_ADDR_LINKLOCAL)
+if (local_addr->ss_family == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&((struct 
sockaddr_in6*)local_addr)->sin6_addr)) {
+unsigned int interface;
+interface = ((struct sockaddr_in6*)local_addr)->sin6_scope_id;
+
+if (interface != 0)
+return interface;
+}
+#endif
+if (getifaddrs() == -1)
+return 0;
+
+for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
+if (ifa->ifa_addr != NULL && compare_addr((struct 
sockaddr_storage*)ifa->ifa_addr, local_addr) == 0)
+return if_nametoindex(ifa->ifa_name);
+}
+
+return 0;
+#endif
+}
diff --git a/libavformat/ip.h b/libavformat/ip.h
index b76cdab91c..4085e96f08 100644
--- a/libavformat/ip.h
+++ b/libavformat/ip.h
@@ -69,4 +69,10 @@ int ff_ip_parse_blocks(void *log_ctx, const char *buf, 
IPSourceFilters *filters)
  */
 void ff_ip_reset_filters(IPSourceFilters *filters);

+/**
+ * Resolves IP address to an associated interface index
+ * @return interface index, 0 as default interface value on error
+ */
+unsigned int ff_ip_resolve_interface_index(struct sockaddr_storage 
*local_addr);
+
 #endif /* AVFORMAT_IP_H */
diff --git a/libavformat/network.h b/libavformat/network.h
index ca214087fc..2461b651d4 100644
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -38,6 +38,10 @@
 #include 
 #include 

+#if HAVE_IPHLPAPI_H
+#include 
+#endif
+
 #ifndef EPROTONOSUPPORT
 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
 #endif
@@ -64,6 +68,8 @@ int ff_neterrno(void);
 #include 
 #include 
 #include 
+#include 
+#include 

 #define ff_neterrno() AVERROR(errno)
 #endif /* HAVE_WINSOCK2_H */
diff --git a/libavformat/udp.c b/libavformat/udp.c
index d9514f5026..a603a9961e 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -220,8 +220,7 @@ static 

Re: [FFmpeg-devel] [PATCH v5] libavfi/dnn: add LibTorch as one of DNN backend

2024-03-14 Thread Guo, Yejun



> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> wenbin.chen-at-intel@ffmpeg.org
> Sent: Monday, March 11, 2024 1:02 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH v5] libavfi/dnn: add LibTorch as one of DNN
> backend
> 
> From: Wenbin Chen 
> 
> PyTorch is an open source machine learning framework that accelerates
> the path from research prototyping to production deployment. Official
> website: https://pytorch.org/. We call the C++ library of PyTorch as
> LibTorch, the same below.
> 
> To build FFmpeg with LibTorch, please take following steps as reference:
> 1. download LibTorch C++ library in https://pytorch.org/get-started/locally/,
> please select C++/Java for language, and other options as your need.
> Please download cxx11 ABI version (libtorch-cxx11-abi-shared-with-deps-
> *.zip).
> 2. unzip the file to your own dir, with command
> unzip libtorch-shared-with-deps-latest.zip -d your_dir
> 3. export libtorch_root/libtorch/include and
> libtorch_root/libtorch/include/torch/csrc/api/include to $PATH
> export libtorch_root/libtorch/lib/ to $LD_LIBRARY_PATH
> 4. config FFmpeg with ../configure --enable-libtorch --extra-cflag=-
> I/libtorch_root/libtorch/include --extra-cflag=-
> I/libtorch_root/libtorch/include/torch/csrc/api/include --extra-ldflags=-
> L/libtorch_root/libtorch/lib/
> 5. make
> 
> To run FFmpeg DNN inference with LibTorch backend:
> ./ffmpeg -i input.jpg -vf
> dnn_processing=dnn_backend=torch:model=LibTorch_model.pt -y output.jpg
> The LibTorch_model.pt can be generated by Python with torch.jit.script() api.
> Please note, torch.jit.trace() is not recommanded, since it does not support
> ambiguous input size.

Can you provide more detail (maybe a link from pytorch) about the 
libtorch_model.py generation and so we can have a try.

> 
> Signed-off-by: Ting Fu 
> Signed-off-by: Wenbin Chen 
> ---
>  configure |   5 +-
>  libavfilter/dnn/Makefile  |   1 +
>  libavfilter/dnn/dnn_backend_torch.cpp | 597
> ++
>  libavfilter/dnn/dnn_interface.c   |   5 +
>  libavfilter/dnn_filter_common.c   |  15 +-
>  libavfilter/dnn_interface.h   |   2 +-
>  libavfilter/vf_dnn_processing.c   |   3 +
>  7 files changed, 624 insertions(+), 4 deletions(-)
>  create mode 100644 libavfilter/dnn/dnn_backend_torch.cpp
> 
> +static int fill_model_input_th(THModel *th_model, THRequestItem *request)
> +{
> +LastLevelTaskItem *lltask = NULL;
> +TaskItem *task = NULL;
> +THInferRequest *infer_request = NULL;
> +DNNData input = { 0 };
> +THContext *ctx = _model->ctx;
> +int ret, width_idx, height_idx, channel_idx;
> +
> +lltask = (LastLevelTaskItem *)ff_queue_pop_front(th_model-
> >lltask_queue);
> +if (!lltask) {
> +ret = AVERROR(EINVAL);
> +goto err;
> +}
> +request->lltask = lltask;
> +task = lltask->task;
> +infer_request = request->infer_request;
> +
> +ret = get_input_th(th_model, , NULL);
> +if ( ret != 0) {
> +goto err;
> +}
> +width_idx = dnn_get_width_idx_by_layout(input.layout);
> +height_idx = dnn_get_height_idx_by_layout(input.layout);
> +channel_idx = dnn_get_channel_idx_by_layout(input.layout);
> +input.dims[height_idx] = task->in_frame->height;
> +input.dims[width_idx] = task->in_frame->width;
> +input.data = av_malloc(input.dims[height_idx] * input.dims[width_idx] *
> +   input.dims[channel_idx] * sizeof(float));
> +if (!input.data)
> +return AVERROR(ENOMEM);
> +infer_request->input_tensor = new torch::Tensor();
> +infer_request->output = new torch::Tensor();
> +
> +switch (th_model->model->func_type) {
> +case DFT_PROCESS_FRAME:
> +input.scale = 255;
> +if (task->do_ioproc) {
> +if (th_model->model->frame_pre_proc != NULL) {
> +th_model->model->frame_pre_proc(task->in_frame, ,
> th_model->model->filter_ctx);
> +} else {
> +ff_proc_from_frame_to_dnn(task->in_frame, , ctx);
> +}
> +}
> +break;
> +default:
> +avpriv_report_missing_feature(NULL, "model function type %d",
> th_model->model->func_type);
> +break;
> +}
> +*infer_request->input_tensor = torch::from_blob(input.data,
> +{1, 1, input.dims[channel_idx], input.dims[height_idx],
> input.dims[width_idx]},

An extra dimension is added to support multiple frames for algorithms 
such as VideoSuperResolution, besides batch size, channel, height and width.

Let's first support the regular dimension for NCHW/NHWC,  and then
add support for multiple frames.

___
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 0/5] avcodec/parser: fix fetch_timestamp in a scenario with unaligned packets

2024-03-14 Thread Nicolas Gaullier
>De : Nicolas Gaullier  
>Envoyé : lundi 4 mars 2024 18:32
>Objet : [PATCH v3 0/5] avcodec/parser: fix fetch_timestamp in a scenario with 
>unaligned packets
>
>Updated from v2:
>patch 1: fix audio case where pts=AV_NOPTS_VALUE but dts exists (thanks to 
>Michael)
>now pass fate with --assert-level=2
>patch 5: add inline comments and moved a line to make it more easy to read 
>(thanks to James)
>
>Nicolas Gaullier (5):
>  avcodec/parser: merge packets from the same frame
>  avcodec/parser: reindent after previous commit
>  avcodec/parser: fix fetch_timestamp in a scenario with unaligned
>packets
>  avcodec/h264_parser: fix start of packet for some broken streams
>  lavf/demux: duplicate side_data in parse_packet()

Ping ?
https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=10999
still apply (auto-merge) on current master

Note this is presented as a patch serie because it is a use case, but it can be 
split.
Notably:
- patch 4/5 is an independent fix for the h264 parser (actually a hack to 
support corrupted streams properly instead of relying on a faulty 
implementation)
- patch 5/5 is also an independent fix

These two patches could possibly be reviewed independently, and that would 
prepare the ground for the parser patches.

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


Re: [FFmpeg-devel] [PATCH v2 9/9] avformat/pcm: decrease target audio frame per sec to 10

2024-03-14 Thread Paul B Mahol
This is just ugly hack for workaround around broken ffmpeg threading.

On Thu, Mar 14, 2024 at 9:10 AM Tobias Rapp  wrote:

> On 08/03/2024 01:53, Marton Balint wrote:
>
> > This makes the wav and pcm demuxer demux bigger packets, which is more
> > efficient.
> >
> > Signed-off-by: Marton Balint
> > ---
> >   libavformat/pcm.c |   2 +-
> >   tests/ref/acodec/pcm-s16be|   2 +-
> >   tests/ref/acodec/pcm-s16be_planar |   4 +-
> >   tests/ref/acodec/pcm-s16le_planar |   4 +-
> >   tests/ref/acodec/pcm-s24be|   2 +-
> >   tests/ref/acodec/pcm-s24le_planar |   4 +-
> >   tests/ref/acodec/pcm-s32be|   2 +-
> >   tests/ref/acodec/pcm-s32le_planar |   4 +-
> >   tests/ref/acodec/pcm-s8_planar|   4 +-
> >   tests/ref/acodec/pcm-u16be|   4 +-
> >   tests/ref/acodec/pcm-u16le|   4 +-
> >   tests/ref/acodec/pcm-u24be|   4 +-
> >   tests/ref/acodec/pcm-u24le|   4 +-
> >   tests/ref/acodec/pcm-u32be|   4 +-
> >   tests/ref/acodec/pcm-u32le|   4 +-
> >   tests/ref/acodec/s302m|   8 +-
> >   tests/ref/fate/dcinema-encode |  63 +-
> >   tests/ref/fate/filter-acrossfade  | 623 --
> >   tests/ref/fate/filter-adelay  | 324 ++---
> >   tests/ref/fate/filter-aecho   | 324 ++---
> >   tests/ref/fate/filter-aemphasis-50fm  | 324 ++---
> >   tests/ref/fate/filter-aemphasis-75kf  | 324 ++---
> >   tests/ref/fate/filter-afade-esin  | 324 ++---
> >   tests/ref/fate/filter-afade-exp   | 324 ++---
> >   tests/ref/fate/filter-afade-hsin  | 324 ++---
> >   tests/ref/fate/filter-afade-iqsin | 324 ++---
> >   tests/ref/fate/filter-afade-log   | 324 ++---
> >   tests/ref/fate/filter-afade-qsin  | 324 ++---
> >   tests/ref/fate/filter-agate   | 324 ++---
> >   tests/ref/fate/filter-alimiter| 324 ++---
> >   tests/ref/fate/filter-amerge  | 324 ++---
> >   tests/ref/fate/filter-anequalizer | 324 ++---
> >   tests/ref/fate/filter-apad| 324 ++---
> >   .../ref/fate/filter-asegment-samples-absolute | 324 ++---
> >   .../ref/fate/filter-asegment-samples-relative | 324 ++---
> >   .../fate/filter-asegment-timestamps-absolute  | 326 ++---
> >   .../fate/filter-asegment-timestamps-relative  | 326 ++---
> >   tests/ref/fate/filter-asetrate|  40 +-
> >   tests/ref/fate/filter-atrim-mixed |   4 +-
> >   tests/ref/fate/filter-atrim-time  |   5 +-
> >   tests/ref/fate/filter-chorus  |  20 +-
> >   tests/ref/fate/filter-compand |  40 +-
> >   tests/ref/fate/filter-crystalizer | 324 ++---
> >   tests/ref/fate/filter-dcshift |  40 +-
> >   tests/ref/fate/filter-earwax  |  40 +-
> >   tests/ref/fate/filter-extrastereo |  40 +-
> >   tests/ref/fate/filter-pan-downmix1|  40 +-
> >   tests/ref/fate/filter-pan-downmix2|  40 +-
> >   tests/ref/fate/filter-pan-mono1   |  40 +-
> >   tests/ref/fate/filter-pan-mono2   |  40 +-
> >   tests/ref/fate/filter-pan-stereo1 |  40 +-
> >   tests/ref/fate/filter-pan-stereo2 |  40 +-
> >   tests/ref/fate/filter-pan-stereo3 |  40 +-
> >   tests/ref/fate/filter-pan-stereo4 |  40 +-
> >   tests/ref/fate/filter-pan-upmix1  |  40 +-
> >   tests/ref/fate/filter-pan-upmix2  |  40 +-
> >   tests/ref/fate/filter-stereotools |  40 +-
> >   tests/ref/fate/flcl1905   | 612 -
> >   tests/ref/fate/g722-encode| 282 +++-
> >   tests/ref/fate/g726-encode-2bit   | 282 +++-
> >   tests/ref/fate/g726-encode-3bit   | 282 +++-
> >   tests/ref/fate/g726-encode-4bit   | 282 +++-
> >   tests/ref/fate/g726-encode-5bit   | 282 +++-
> >   tests/ref/fate/matroska-move-cues-to-front|  18 +-
> >   tests/ref/fate/mov-channel-description|   4 +-
> >   tests/ref/fate/mov-mp4-pcm|   4 +-
> >   tests/ref/fate/mov-mp4-pcm-float  |   2 +-
> >   tests/ref/lavf/ast|   4 +-
> >   tests/ref/lavf/mov|  12 +-
> >   tests/ref/lavf/mov_rtphint|   4 +-
> >   tests/ref/lavf/s16.voc|   4 +-
> >   tests/ref/lavf/smjpeg |   6 +-
> >   tests/ref/lavf/voc|   4 +-
> >   

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

2024-03-14 Thread RS
>> +if (if_indextoname(iface, ifr.ifr_name)) {
>> +if (setsockopt(udp_fd, SOL_SOCKET, SO_BINDTODEVICE, (void 
>> *), sizeof(ifr)) < 0) {
>> +perror("setsockopt SO_BINDTODEVICE");
>
> This should use the proper av_log logging instead.

Will fix and resubmit corrected version.

Thanks,
Lazar Ignjatović
Associate Software Engineer

Cubic Defense
cubic.com


This message has been marked as Public on 03/14/2024 11:02Z.
___
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] libavcodec/amfenc: Update AMF encoder options

2024-03-14 Thread Araz Iusubov
The encoder options have been updated to the current version of the AMF.

Signed-off-by: Araz Iusubov 
---
 libavcodec/amfenc.c  |   1 +
 libavcodec/amfenc.h  |   4 +
 libavcodec/amfenc_av1.c  | 154 +-
 libavcodec/amfenc_h264.c | 155 +-
 libavcodec/amfenc_hevc.c | 158 ++-
 5 files changed, 314 insertions(+), 158 deletions(-)

diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c
index 061859f85c..6b1e635a03 100644
--- a/libavcodec/amfenc.c
+++ b/libavcodec/amfenc.c
@@ -468,6 +468,7 @@ static int amf_copy_buffer(AVCodecContext *avctx, AVPacket 
*pkt, AMFBuffer *buff
 if (var.int64Value == AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_KEY) 
{
 pkt->flags = AV_PKT_FLAG_KEY;
 }
+break;
 default:
 break;
 }
diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
index 2dbd378ef8..1b8cfdf4a5 100644
--- a/libavcodec/amfenc.h
+++ b/libavcodec/amfenc.h
@@ -59,6 +59,7 @@ typedef struct AmfContext {
 AMFContext *context; ///< AMF context
 //encoder
 AMFComponent   *encoder; ///< AMF encoder object
+AMFCaps*encoder_caps;
 amf_booleof; ///< flag indicating EOF happened
 AMF_SURFACE_FORMAT  format;  ///< AMF surface format
 
@@ -85,6 +86,7 @@ typedef struct AmfContext {
 int usage;
 int profile;
 int level;
+int latency;
 int preencode;
 int quality;
 int b_frame_delta_qp;
@@ -112,6 +114,7 @@ typedef struct AmfContext {
 int max_b_frames;
 int qvbr_quality_level;
 int hw_high_motion_quality_boost;
+int encoder_instance_id;
 
 // HEVC - specific options
 
@@ -126,6 +129,7 @@ typedef struct AmfContext {
 // AV1 - specific options
 
 enum AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_ENUM align;
+enum AMF_VIDEO_ENCODER_AV1_AQ_MODE_ENUMaq_mode;
 
 // Preanalysis - specific options
 
diff --git a/libavcodec/amfenc_av1.c b/libavcodec/amfenc_av1.c
index 3878f0d461..50f75b53e2 100644
--- a/libavcodec/amfenc_av1.c
+++ b/libavcodec/amfenc_av1.c
@@ -24,12 +24,17 @@
 
 #define OFFSET(x) offsetof(AmfContext, x)
 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
-static const AVOption options[] = {
-{ "usage",  "Set the encoding usage",   
OFFSET(usage),  AV_OPT_TYPE_INT,   {.i64 = 
AMF_VIDEO_ENCODER_AV1_USAGE_TRANSCODING }, 
AMF_VIDEO_ENCODER_AV1_USAGE_TRANSCODING, 
AMF_VIDEO_ENCODER_AV1_USAGE_LOW_LATENCY, VE, .unit = "usage" },
-{ "transcoding","", 0, AV_OPT_TYPE_CONST, {.i64 = 
AMF_VIDEO_ENCODER_AV1_USAGE_TRANSCODING }, 0, 0, VE, .unit = "usage" },
-{ "lowlatency", "", 0, AV_OPT_TYPE_CONST, {.i64 = 
AMF_VIDEO_ENCODER_AV1_USAGE_LOW_LATENCY }, 0, 0, VE, .unit = "usage" },
 
-{ "profile","Set the profile (default main)",   
OFFSET(profile),AV_OPT_TYPE_INT,{.i64 = 
AMF_VIDEO_ENCODER_AV1_PROFILE_MAIN }, AMF_VIDEO_ENCODER_AV1_PROFILE_MAIN, 
AMF_VIDEO_ENCODER_AV1_PROFILE_MAIN, VE, .unit = "profile" },
+static const AVOption options[] = {
+{ "usage",  "Set the encoding usage",   
OFFSET(usage),  AV_OPT_TYPE_INT,   {.i64 = -1 }, -1, 
AMF_VIDEO_ENCODER_AV1_USAGE_LOW_LATENCY_HIGH_QUALITY, VE, "usage" },
+{ "transcoding","Generic Transcoding",  0, 
AV_OPT_TYPE_CONST, {.i64 = AMF_VIDEO_ENCODER_AV1_USAGE_TRANSCODING  
 }, 0, 0, VE, "usage" },
+{ "ultralowlatency","ultra low latency trancoding", 0, 
AV_OPT_TYPE_CONST, {.i64 = AMF_VIDEO_ENCODER_AV1_USAGE_ULTRA_LOW_LATENCY
 }, 0, 0, VE, "usage" },
+{ "lowlatency", "low latency trancoding",   0, 
AV_OPT_TYPE_CONST, {.i64 = AMF_VIDEO_ENCODER_AV1_USAGE_LOW_LATENCY  
 }, 0, 0, VE, "usage" },
+{ "webcam", "Webcam",   0, 
AV_OPT_TYPE_CONST, {.i64 = AMF_VIDEO_ENCODER_AV1_USAGE_WEBCAM   
 }, 0, 0, VE, "usage" },
+{ "high_quality",   "high quality trancoding",  0, 
AV_OPT_TYPE_CONST, {.i64 = AMF_VIDEO_ENCODER_AV1_USAGE_HIGH_QUALITY 
 }, 0, 0, VE, "usage" },
+{ "lowlatency_high_quality","low latency yet high quality trancoding",  0, 
AV_OPT_TYPE_CONST, {.i64 = AMF_VIDEO_ENCODER_AV1_USAGE_LOW_LATENCY_HIGH_QUALITY 
 }, 0, 0, VE, "usage" },
+
+{ "profile","Set the profile",   OFFSET(profile),  
  AV_OPT_TYPE_INT,{.i64 = -1 }, -1, 
AMF_VIDEO_ENCODER_AV1_PROFILE_MAIN, VE, "profile" },
 { "main",  

Re: [FFmpeg-devel] [PATCH 5/6] avcodec/tiff_data: Avoid relocations for TiffGeoTagNameType

2024-03-14 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Instead store all the strings in one continugous string
> (with internal \0) and use offsets to access the actual
> substrings. This replaces the pointers to the strings
> and therefore avoids relocations (and on x64, it actually
> shrinks TiffGeoTagNameType by reusing padding to store
> the offset field).
> 
> This saves 720B of .data.rel.ro and 1080B of .rela.dyn
> (containing the relocation records) here while increasing
> .rodata by 384B.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
> I also have patches for the remaining tables, but am not
> satisfied with them yet.
> 
>  libavcodec/tiff.c  |  28 +
>  libavcodec/tiff.h  |   5 --
>  libavcodec/tiff_data.h | 129 -
>  3 files changed, 92 insertions(+), 70 deletions(-)
> 
> diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
> index 15e5edd93b..004db89c6b 100644
> --- a/libavcodec/tiff.c
> +++ b/libavcodec/tiff.c
> @@ -139,27 +139,31 @@ static void free_geotags(TiffContext *const s)
>  s->geotag_count = 0;
>  }
>  
> -#define RET_GEOKEY(TYPE, array, element)\
> +static const char *get_geokey_name(int key)
> +{
> +#define RET_GEOKEY_STR(TYPE, array)\
>  if (key >= TIFF_##TYPE##_KEY_ID_OFFSET &&\
>  key - TIFF_##TYPE##_KEY_ID_OFFSET < 
> FF_ARRAY_ELEMS(tiff_##array##_name_type_map))\
> -return tiff_##array##_name_type_map[key - 
> TIFF_##TYPE##_KEY_ID_OFFSET].element;
> +return tiff_##array##_name_type_string + 
> tiff_##array##_name_type_map[key - TIFF_##TYPE##_KEY_ID_OFFSET].offset;
>  
> -static const char *get_geokey_name(int key)
> -{
> -RET_GEOKEY(VERT, vert, name);
> -RET_GEOKEY(PROJ, proj, name);
> -RET_GEOKEY(GEOG, geog, name);
> -RET_GEOKEY(CONF, conf, name);
> +RET_GEOKEY_STR(VERT, vert);
> +RET_GEOKEY_STR(PROJ, proj);
> +RET_GEOKEY_STR(GEOG, geog);
> +RET_GEOKEY_STR(CONF, conf);
>  
>  return NULL;
>  }
>  
>  static int get_geokey_type(int key)
>  {
> -RET_GEOKEY(VERT, vert, type);
> -RET_GEOKEY(PROJ, proj, type);
> -RET_GEOKEY(GEOG, geog, type);
> -RET_GEOKEY(CONF, conf, type);
> +#define RET_GEOKEY_TYPE(TYPE, array)\
> +if (key >= TIFF_##TYPE##_KEY_ID_OFFSET &&\
> +key - TIFF_##TYPE##_KEY_ID_OFFSET < 
> FF_ARRAY_ELEMS(tiff_##array##_name_type_map))\
> +return tiff_##array##_name_type_map[key - 
> TIFF_##TYPE##_KEY_ID_OFFSET].type;
> +RET_GEOKEY_TYPE(VERT, vert);
> +RET_GEOKEY_TYPE(PROJ, proj);
> +RET_GEOKEY_TYPE(GEOG, geog);
> +RET_GEOKEY_TYPE(CONF, conf);
>  
>  return AVERROR_INVALIDDATA;
>  }
> diff --git a/libavcodec/tiff.h b/libavcodec/tiff.h
> index 2dd21dea52..12afcfa6e5 100644
> --- a/libavcodec/tiff.h
> +++ b/libavcodec/tiff.h
> @@ -222,9 +222,4 @@ typedef struct TiffGeoTagKeyName {
>  const char *const name;
>  } TiffGeoTagKeyName;
>  
> -typedef struct TiffGeoTagNameType {
> -const char *const name;
> -const enum TiffGeoTagType type;
> -} TiffGeoTagNameType;
> -
>  #endif /* AVCODEC_TIFF_H */
> diff --git a/libavcodec/tiff_data.h b/libavcodec/tiff_data.h
> index 9b123ca8df..9ed46d31af 100644
> --- a/libavcodec/tiff_data.h
> +++ b/libavcodec/tiff_data.h
> @@ -32,66 +32,89 @@
>  
>  #include "tiff.h"
>  
> +typedef struct TiffGeoTagNameType {
> +enum TiffGeoTagType type;
> +unsigned offset;
> +} TiffGeoTagNameType;
> +
>  #define TIFF_CONF_KEY_ID_OFFSET 1024
> -static const TiffGeoTagNameType tiff_conf_name_type_map[] = {
> -{"GTModelTypeGeoKey",  GEOTIFF_SHORT },
> -{"GTRasterTypeGeoKey", GEOTIFF_SHORT },
> -{"GTCitationGeoKey",   GEOTIFF_STRING}
> -};
> +#define CONF_NAME_TYPE_MAP(KEY) \
> +KEY(GTModelTypeGeoKey,  SHORT ) \
> +KEY(GTRasterTypeGeoKey, SHORT ) \
> +KEY(GTCitationGeoKey,   STRING) \
>  
>  #define TIFF_GEOG_KEY_ID_OFFSET 2048
> -static const TiffGeoTagNameType tiff_geog_name_type_map[] = {
> -{"GeographicTypeGeoKey",   GEOTIFF_SHORT },
> -{"GeogCitationGeoKey", GEOTIFF_STRING},
> -{"GeogGeodeticDatumGeoKey",GEOTIFF_SHORT },
> -{"GeogPrimeMeridianGeoKey",GEOTIFF_SHORT },
> -{"GeogLinearUnitsGeoKey",  GEOTIFF_SHORT },
> -{"GeogLinearUnitSizeGeoKey",   GEOTIFF_DOUBLE},
> -{"GeogAngularUnitsGeoKey", GEOTIFF_SHORT },
> -{"GeogAngularUnitSizeGeoKey",  GEOTIFF_DOUBLE},
> -{"GeogEllipsoidGeoKey",GEOTIFF_SHORT },
> -{"GeogSemiMajorAxisGeoKey",GEOTIFF_DOUBLE},
> -{"GeogSemiMinorAxisGeoKey",GEOTIFF_DOUBLE},
> -{"GeogInvFlatteningGeoKey",GEOTIFF_DOUBLE},
> -{"GeogAzimuthUnitsGeoKey", GEOTIFF_SHORT },
> -{"GeogPrimeMeridianLongGeoKey",GEOTIFF_DOUBLE}
> -};
> +#define GEOG_NAME_TYPE_MAP(KEY) \
> +KEY(GeographicTypeGeoKey,   SHORT ) \
> +KEY(GeogCitationGeoKey, STRING) \
> +

Re: [FFmpeg-devel] [FFmpeg-cvslog] fftools/ffmpeg: add loopback decoding

2024-03-14 Thread Anton Khirnov
Quoting Gyan Doshi (2024-03-13 08:49:52)
> 
> 
> On 2024-03-13 12:57 pm, Anton Khirnov wrote:
> > ffmpeg | branch: master | Anton Khirnov  | Mon Feb 19 
> > 10:27:44 2024 +0100| [a9193f7b7d65aafa326e25571c6672636a8ee3d2] | 
> > committer: Anton Khirnov
> >
> > fftools/ffmpeg: add loopback decoding
> ...
> > +E.g. the following example:
> > +
> > +@example
> > +ffmpeg -i INPUT\
> > +  -map 0:v:0 -c:v libx264 -crf 45 -f null -\
> > +  -dec 0:0 -filter_complex '[0:v][dec:0]hstack[stack]' \
> > +  -map '[stack]' -c:v ffv1 OUTPUT
> 
> Can you add an example showing the assignment of a specific decoder 
> along with a lavc generic + private option to a loopbacked stream?

Sent a patch with some notes on this.

> Are there any limitations to loopback decoding e.g. would a vpx w/alpha 
> encode be decoded back to a alpha pix fmt?

I don't know how vpx alpha works, was it a separate stream in the
demuxer or something like that?

Loopback decoders work exactly like normal decoders, except their
packets arrive from an encoder instead of a demuxer.

-- 
Anton Khirnov
___
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] doc/ffmpeg: mention how to pass options to loopback decoders

2024-03-14 Thread Anton Khirnov
---
 doc/ffmpeg.texi | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index a38ef834e1..801c083705 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -229,12 +229,16 @@ successive integers starting at zero. These indices 
should then be used to refer
 to loopback decoders in complex filtergraph link labels, as described in the
 documentation for @option{-filter_complex}.
 
+Decoding AVOptions can be passed to loopback decoders by placing them before
+@code{-dec}, analogously to input/output options.
+
 E.g. the following example:
 
 @example
 ffmpeg -i INPUT\
   -map 0:v:0 -c:v libx264 -crf 45 -f null -\
-  -dec 0:0 -filter_complex '[0:v][dec:0]hstack[stack]' \
+  -threads 3 -dec 0:0  \
+  -filter_complex '[0:v][dec:0]hstack[stack]'  \
   -map '[stack]' -c:v ffv1 OUTPUT
 @end example
 
@@ -244,11 +248,13 @@ reads an input video and
 (line 2) encodes it with @code{libx264} at low quality;
 
 @item
-(line 3) decodes this encoded stream and places it side by side with the
-original input video;
+(line 3) decodes this encoded stream using 3 threads;
 
 @item
-(line 4) combined video is then losslessly encoded and written into
+(line 4) places decoded video side by side with the original input video;
+
+@item
+(line 5) combined video is then losslessly encoded and written into
 @file{OUTPUT}.
 
 @end itemize
-- 
2.43.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-14 Thread epirat07


On 14 Mar 2024, at 10:22, Ignjatović, Lazar wrote:

> avformat: enable UDP IPv6 multicast interface selection
>
> localaddr option now properly works with IPv6 addresses. Properly resolved
> interface index in places where default 0 interface index is used (marked with
> TODO: within udp.c). Added SO_BINDTODEVICE for mcast sockets that are used for
> reading from the network. Need for this arises from the fact that [ffx1::*] 
> and
> [ffx2::*] mcast addresses need to have a defined interface for binding to 
> avoid
> ambiguity between multiple link-local networks on the same host. Failing to 
> set
> this option causes errors on Linux systems for interface and link-local 
> scopes.
>
> For mcast addresses, bind to mcast address is attempted as before. In case
> that this fails, which will happen on Windows, socket is bound to
> INADDR_ANY/IN6ADDR_ANY_INIT depending on address family. Actual interface
> selection is performed using udp_set_multicast_interface to point to the
> desired interface for sending/listening.
>
> Utilization of sin6_scope_id field enables usage and adequate resolving of
> IPv6 addresses that utilize zone index (e.g. fe80::1ff:fe23:4567:890a%eth2 )
> This is not fully supported on Windows, thus relying on this field is not done
> on Windows systems.
>
> Closes: #368
>
> Signed-off-by: Lazar Ignjatovic 
> ---
>  configure |  3 ++
>  libavformat/ip.c  | 45 
>  libavformat/ip.h  |  6 
>  libavformat/network.h |  6 
>  libavformat/udp.c | 80 ++-
>  5 files changed, 132 insertions(+), 8 deletions(-)
>
> diff --git a/configure b/configure
> index c34bdd13f5..77f03948ce 100755
> --- a/configure
> +++ b/configure
> @@ -2256,6 +2256,7 @@ HEADERS_LIST="
>  valgrind_valgrind_h
>  windows_h
>  winsock2_h
> +iphlpapi_h
>  "
>
>  INTRINSICS_LIST="
> @@ -6408,6 +6409,8 @@ if ! disabled network; then
>  check_struct winsock2.h "struct sockaddr" sa_len
>  check_type ws2tcpip.h "struct sockaddr_in6"
>  check_type ws2tcpip.h "struct sockaddr_storage"
> +check_headers iphlpapi.h && network_extralibs+=" -liphlpapi" || 
> disable iphlpapi_h
> +check_func_headers iphlpapi.h GetBestInterfaceEx
>  else
>  disable network
>  fi
> diff --git a/libavformat/ip.c b/libavformat/ip.c
> index b2c7ef07e5..4f2d998c34 100644
> --- a/libavformat/ip.c
> +++ b/libavformat/ip.c
> @@ -18,6 +18,9 @@
>   * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>   */
>
> +#define _DEFAULT_SOURCE
> +#define _SVID_SOURCE
> +
>  #include 
>  #include "ip.h"
>  #include "libavutil/avstring.h"
> @@ -159,3 +162,45 @@ void ff_ip_reset_filters(IPSourceFilters *filters)
>  filters->nb_include_addrs = 0;
>  filters->nb_exclude_addrs = 0;
>  }
> +
> +unsigned int ff_ip_resolve_interface_index(struct sockaddr_storage 
> *local_addr)
> +{
> +#if HAVE_WINSOCK2_H && HAVE_IPHLPAPI_H
> +DWORD retval;
> +unsigned long iface;
> +
> +if (local_addr == NULL)
> +return 0;
> +
> +retval = GetBestInterfaceEx((struct sockaddr*)local_addr, );
> +if (retval == NO_ERROR)
> +return iface;
> +
> +return 0;
> +#elif !HAVE_WINSOCK2_H
> +struct ifaddrs *ifaddr, *ifa;
> +
> +if (local_addr == NULL)
> +return 0;
> +
> +/* Special case for link-local addresses, relevant interface is stored 
> in sin6_scope_id */
> +#if HAVE_STRUCT_SOCKADDR_IN6 && defined(IN6_IS_ADDR_LINKLOCAL)
> +if (local_addr->ss_family == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&((struct 
> sockaddr_in6*)local_addr)->sin6_addr)) {
> +unsigned int interface;
> +interface = ((struct sockaddr_in6*)local_addr)->sin6_scope_id;
> +
> +if (interface != 0)
> +return interface;
> +}
> +#endif
> +if (getifaddrs() == -1)
> +return 0;
> +
> +for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
> +if (ifa->ifa_addr != NULL && compare_addr((struct 
> sockaddr_storage*)ifa->ifa_addr, local_addr) == 0)
> +return if_nametoindex(ifa->ifa_name);
> +}
> +
> +return 0;
> +#endif
> +}
> diff --git a/libavformat/ip.h b/libavformat/ip.h
> index b76cdab91c..4085e96f08 100644
> --- a/libavformat/ip.h
> +++ b/libavformat/ip.h
> @@ -69,4 +69,10 @@ int ff_ip_parse_blocks(void *log_ctx, const char *buf, 
> IPSourceFilters *filters)
>   */
>  void ff_ip_reset_filters(IPSourceFilters *filters);
>
> +/**
> + * Resolves IP address to an associated interface index
> + * @return interface index, 0 as default interface value on error
> + */
> +unsigned int ff_ip_resolve_interface_index(struct sockaddr_storage 
> *local_addr);
> +
>  #endif /* AVFORMAT_IP_H */
> diff --git a/libavformat/network.h b/libavformat/network.h
> index ca214087fc..2461b651d4 100644
> --- a/libavformat/network.h
> +++ b/libavformat/network.h
> @@ -38,6 +38,10 @@
>  #include 
>  #include 
>
> +#if HAVE_IPHLPAPI_H
> +#include 
> 

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

2024-03-14 Thread RS
avformat: enable UDP IPv6 multicast interface selection

localaddr option now properly works with IPv6 addresses. Properly resolved
interface index in places where default 0 interface index is used (marked with
TODO: within udp.c). Added SO_BINDTODEVICE for mcast sockets that are used for
reading from the network. Need for this arises from the fact that [ffx1::*] and
[ffx2::*] mcast addresses need to have a defined interface for binding to avoid
ambiguity between multiple link-local networks on the same host. Failing to set
this option causes errors on Linux systems for interface and link-local scopes.

For mcast addresses, bind to mcast address is attempted as before. In case
that this fails, which will happen on Windows, socket is bound to
INADDR_ANY/IN6ADDR_ANY_INIT depending on address family. Actual interface
selection is performed using udp_set_multicast_interface to point to the
desired interface for sending/listening.

Utilization of sin6_scope_id field enables usage and adequate resolving of
IPv6 addresses that utilize zone index (e.g. fe80::1ff:fe23:4567:890a%eth2 )
This is not fully supported on Windows, thus relying on this field is not done
on Windows systems.

Closes: #368

Signed-off-by: Lazar Ignjatovic 
---
 configure |  3 ++
 libavformat/ip.c  | 45 
 libavformat/ip.h  |  6 
 libavformat/network.h |  6 
 libavformat/udp.c | 80 ++-
 5 files changed, 132 insertions(+), 8 deletions(-)

diff --git a/configure b/configure
index c34bdd13f5..77f03948ce 100755
--- a/configure
+++ b/configure
@@ -2256,6 +2256,7 @@ HEADERS_LIST="
 valgrind_valgrind_h
 windows_h
 winsock2_h
+iphlpapi_h
 "

 INTRINSICS_LIST="
@@ -6408,6 +6409,8 @@ if ! disabled network; then
 check_struct winsock2.h "struct sockaddr" sa_len
 check_type ws2tcpip.h "struct sockaddr_in6"
 check_type ws2tcpip.h "struct sockaddr_storage"
+check_headers iphlpapi.h && network_extralibs+=" -liphlpapi" || 
disable iphlpapi_h
+check_func_headers iphlpapi.h GetBestInterfaceEx
 else
 disable network
 fi
diff --git a/libavformat/ip.c b/libavformat/ip.c
index b2c7ef07e5..4f2d998c34 100644
--- a/libavformat/ip.c
+++ b/libavformat/ip.c
@@ -18,6 +18,9 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */

+#define _DEFAULT_SOURCE
+#define _SVID_SOURCE
+
 #include 
 #include "ip.h"
 #include "libavutil/avstring.h"
@@ -159,3 +162,45 @@ void ff_ip_reset_filters(IPSourceFilters *filters)
 filters->nb_include_addrs = 0;
 filters->nb_exclude_addrs = 0;
 }
+
+unsigned int ff_ip_resolve_interface_index(struct sockaddr_storage *local_addr)
+{
+#if HAVE_WINSOCK2_H && HAVE_IPHLPAPI_H
+DWORD retval;
+unsigned long iface;
+
+if (local_addr == NULL)
+return 0;
+
+retval = GetBestInterfaceEx((struct sockaddr*)local_addr, );
+if (retval == NO_ERROR)
+return iface;
+
+return 0;
+#elif !HAVE_WINSOCK2_H
+struct ifaddrs *ifaddr, *ifa;
+
+if (local_addr == NULL)
+return 0;
+
+/* Special case for link-local addresses, relevant interface is stored in 
sin6_scope_id */
+#if HAVE_STRUCT_SOCKADDR_IN6 && defined(IN6_IS_ADDR_LINKLOCAL)
+if (local_addr->ss_family == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&((struct 
sockaddr_in6*)local_addr)->sin6_addr)) {
+unsigned int interface;
+interface = ((struct sockaddr_in6*)local_addr)->sin6_scope_id;
+
+if (interface != 0)
+return interface;
+}
+#endif
+if (getifaddrs() == -1)
+return 0;
+
+for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
+if (ifa->ifa_addr != NULL && compare_addr((struct 
sockaddr_storage*)ifa->ifa_addr, local_addr) == 0)
+return if_nametoindex(ifa->ifa_name);
+}
+
+return 0;
+#endif
+}
diff --git a/libavformat/ip.h b/libavformat/ip.h
index b76cdab91c..4085e96f08 100644
--- a/libavformat/ip.h
+++ b/libavformat/ip.h
@@ -69,4 +69,10 @@ int ff_ip_parse_blocks(void *log_ctx, const char *buf, 
IPSourceFilters *filters)
  */
 void ff_ip_reset_filters(IPSourceFilters *filters);

+/**
+ * Resolves IP address to an associated interface index
+ * @return interface index, 0 as default interface value on error
+ */
+unsigned int ff_ip_resolve_interface_index(struct sockaddr_storage 
*local_addr);
+
 #endif /* AVFORMAT_IP_H */
diff --git a/libavformat/network.h b/libavformat/network.h
index ca214087fc..2461b651d4 100644
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -38,6 +38,10 @@
 #include 
 #include 

+#if HAVE_IPHLPAPI_H
+#include 
+#endif
+
 #ifndef EPROTONOSUPPORT
 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
 #endif
@@ -64,6 +68,8 @@ int ff_neterrno(void);
 #include 
 #include 
 #include 
+#include 
+#include 

 #define ff_neterrno() AVERROR(errno)
 #endif /* HAVE_WINSOCK2_H */
diff --git a/libavformat/udp.c b/libavformat/udp.c
index d9514f5026..9b8ca74282 100644
--- 

[FFmpeg-devel] [PATCH v7 12/12] Changelog: add D3D12VA HEVC encoder changelog

2024-03-14 Thread tong1 . wu-at-intel . com
From: Tong Wu 

Signed-off-by: Tong Wu 
---
 Changelog | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index b7d7535a9e..81ee3a7837 100644
--- a/Changelog
+++ b/Changelog
@@ -34,7 +34,7 @@ version :
 - ffprobe (with -export_side_data film_grain) now prints film grain metadata
 - AEA muxer
 - ffmpeg CLI loopback decoders
-
+- D3D12VA HEVC encoder
 
 version 6.1:
 - libaribcaption decoder
-- 
2.41.0.windows.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 v7 11/12] avcodec: add D3D12VA hardware HEVC encoder

2024-03-14 Thread tong1 . wu-at-intel . com
From: Tong Wu 

This implementation is based on D3D12 Video Encoding Spec:
https://microsoft.github.io/DirectX-Specs/d3d/D3D12VideoEncoding.html

Sample command line for transcoding:
ffmpeg.exe -hwaccel d3d12va -hwaccel_output_format d3d12 -i input.mp4
-c:v hevc_d3d12va output.mp4

Signed-off-by: Tong Wu 
---
 configure|6 +
 libavcodec/Makefile  |4 +-
 libavcodec/allcodecs.c   |1 +
 libavcodec/d3d12va_encode.c  | 1550 ++
 libavcodec/d3d12va_encode.h  |  321 +++
 libavcodec/d3d12va_encode_hevc.c |  957 ++
 6 files changed, 2838 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/d3d12va_encode.c
 create mode 100644 libavcodec/d3d12va_encode.h
 create mode 100644 libavcodec/d3d12va_encode_hevc.c

diff --git a/configure b/configure
index c34bdd13f5..53076fbf22 100755
--- a/configure
+++ b/configure
@@ -2570,6 +2570,7 @@ CONFIG_EXTRA="
 tpeldsp
 vaapi_1
 vaapi_encode
+d3d12va_encode
 vc1dsp
 videodsp
 vp3dsp
@@ -3214,6 +3215,7 @@ wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
 wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
 
 # hardware-accelerated codecs
+d3d12va_encode_deps="d3d12va ID3D12VideoEncoder d3d12_encoder_feature"
 mediafoundation_deps="mftransform_h MFCreateAlignedMemoryBuffer"
 omx_deps="libdl pthreads"
 omx_rpi_select="omx"
@@ -3280,6 +3282,7 @@ h264_v4l2m2m_encoder_deps="v4l2_m2m h264_v4l2_m2m"
 hevc_amf_encoder_deps="amf"
 hevc_cuvid_decoder_deps="cuvid"
 hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf"
+hevc_d3d12va_encoder_select="cbs_h265 d3d12va_encode"
 hevc_mediacodec_decoder_deps="mediacodec"
 hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser"
 hevc_mediacodec_encoder_deps="mediacodec"
@@ -6620,6 +6623,9 @@ check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
 check_type "windows.h d3d11.h" "ID3D11VideoContext"
 check_type "windows.h d3d12.h" "ID3D12Device"
 check_type "windows.h d3d12video.h" "ID3D12VideoDecoder"
+check_type "windows.h d3d12video.h" "ID3D12VideoEncoder"
+test_code cc "windows.h d3d12video.h" "D3D12_FEATURE_VIDEO feature = 
D3D12_FEATURE_VIDEO_ENCODER_CODEC" && \
+test_code cc "windows.h d3d12video.h" 
"D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS req" && enable 
d3d12_encoder_feature
 check_type "windows.h" "DPI_AWARENESS_CONTEXT" -D_WIN32_WINNT=0x0A00
 check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
 check_func_headers mfapi.h MFCreateAlignedMemoryBuffer -lmfplat
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index cbfae5f182..cdda3f0d0a 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -84,6 +84,7 @@ OBJS-$(CONFIG_CBS_JPEG)+= cbs_jpeg.o
 OBJS-$(CONFIG_CBS_MPEG2)   += cbs_mpeg2.o
 OBJS-$(CONFIG_CBS_VP8) += cbs_vp8.o vp8data.o
 OBJS-$(CONFIG_CBS_VP9) += cbs_vp9.o
+OBJS-$(CONFIG_D3D12VA_ENCODE)  += d3d12va_encode.o hw_base_encode.o
 OBJS-$(CONFIG_DEFLATE_WRAPPER) += zlib_wrapper.o
 OBJS-$(CONFIG_DOVI_RPU)+= dovi_rpu.o
 OBJS-$(CONFIG_ERROR_RESILIENCE)+= error_resilience.o
@@ -435,6 +436,7 @@ OBJS-$(CONFIG_HEVC_DECODER)+= hevcdec.o 
hevc_mvs.o \
   h274.o
 OBJS-$(CONFIG_HEVC_AMF_ENCODER)+= amfenc_hevc.o
 OBJS-$(CONFIG_HEVC_CUVID_DECODER)  += cuviddec.o
+OBJS-$(CONFIG_HEVC_D3D12VA_ENCODER)+= d3d12va_encode_hevc.o
 OBJS-$(CONFIG_HEVC_MEDIACODEC_DECODER) += mediacodecdec.o
 OBJS-$(CONFIG_HEVC_MEDIACODEC_ENCODER) += mediacodecenc.o
 OBJS-$(CONFIG_HEVC_MF_ENCODER) += mfenc.o mf_utils.o
@@ -1263,7 +1265,7 @@ SKIPHEADERS+= %_tablegen.h
  \
 
 SKIPHEADERS-$(CONFIG_AMF)  += amfenc.h
 SKIPHEADERS-$(CONFIG_D3D11VA)  += d3d11va.h dxva2_internal.h
-SKIPHEADERS-$(CONFIG_D3D12VA)  += d3d12va_decode.h
+SKIPHEADERS-$(CONFIG_D3D12VA)  += d3d12va_decode.h d3d12va_encode.h
 SKIPHEADERS-$(CONFIG_DXVA2)+= dxva2.h dxva2_internal.h
 SKIPHEADERS-$(CONFIG_JNI)  += ffjni.h
 SKIPHEADERS-$(CONFIG_LCMS2)+= fflcms2.h
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 2386b450a6..7b5093233c 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -855,6 +855,7 @@ extern const FFCodec ff_h264_vaapi_encoder;
 extern const FFCodec ff_h264_videotoolbox_encoder;
 extern const FFCodec ff_hevc_amf_encoder;
 extern const FFCodec ff_hevc_cuvid_decoder;
+extern const FFCodec ff_hevc_d3d12va_encoder;
 extern const FFCodec ff_hevc_mediacodec_decoder;
 extern const FFCodec ff_hevc_mediacodec_encoder;
 extern const FFCodec ff_hevc_mf_encoder;
diff --git a/libavcodec/d3d12va_encode.c b/libavcodec/d3d12va_encode.c
new file mode 100644
index 00..88a08efa76
--- /dev/null
+++ b/libavcodec/d3d12va_encode.c
@@ -0,0 +1,1550 @@
+/*
+ * Direct3D 12 HW acceleration video encoder
+ *
+ * 

[FFmpeg-devel] [PATCH v7 10/12] avutil/hwcontext_d3d12va: add Flags for resource creation

2024-03-14 Thread tong1 . wu-at-intel . com
From: Tong Wu 

Flags field is added to support diffferent resource creation.

Signed-off-by: Tong Wu 
---
 doc/APIchanges| 3 +++
 libavutil/hwcontext_d3d12va.c | 2 +-
 libavutil/hwcontext_d3d12va.h | 8 
 libavutil/version.h   | 2 +-
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index cf58c8c5f0..7e003ddf65 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-01-xx - xx - lavu 59.2.100 - hwcontext_d3d12va.h
+ Add AVD3D12VAFramesContext.flags
+
 2024-03-08 - xx - lavc 61.1.100 - avcodec.h
   Add AVCodecContext.[nb_]side_data_prefer_packet.
 
diff --git a/libavutil/hwcontext_d3d12va.c b/libavutil/hwcontext_d3d12va.c
index 353807359b..3abe90247f 100644
--- a/libavutil/hwcontext_d3d12va.c
+++ b/libavutil/hwcontext_d3d12va.c
@@ -246,7 +246,7 @@ static AVBufferRef *d3d12va_pool_alloc(void *opaque, size_t 
size)
 .Format   = hwctx->format,
 .SampleDesc   = {.Count = 1, .Quality = 0 },
 .Layout   = D3D12_TEXTURE_LAYOUT_UNKNOWN,
-.Flags= D3D12_RESOURCE_FLAG_NONE,
+.Flags= hwctx->flags,
 };
 
 frame = av_mallocz(sizeof(AVD3D12VAFrame));
diff --git a/libavutil/hwcontext_d3d12va.h b/libavutil/hwcontext_d3d12va.h
index ff06e6f2ef..608dbac97f 100644
--- a/libavutil/hwcontext_d3d12va.h
+++ b/libavutil/hwcontext_d3d12va.h
@@ -129,6 +129,14 @@ typedef struct AVD3D12VAFramesContext {
  * If unset, will be automatically set.
  */
 DXGI_FORMAT format;
+
+/**
+ * This field is used to specify options for working with resources.
+ * If unset, this will be D3D12_RESOURCE_FLAG_NONE.
+ *
+ * @see: 
https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ne-d3d12-d3d12_resource_flags.
+ */
+D3D12_RESOURCE_FLAGS flags;
 } AVD3D12VAFramesContext;
 
 #endif /* AVUTIL_HWCONTEXT_D3D12VA_H */
diff --git a/libavutil/version.h b/libavutil/version.h
index 09f8cdc292..57cad02ec0 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  59
-#define LIBAVUTIL_VERSION_MINOR   1
+#define LIBAVUTIL_VERSION_MINOR   2
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
2.41.0.windows.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 v7 09/12] avcodec/vaapi_encode: extract a free funtion to base layer

2024-03-14 Thread tong1 . wu-at-intel . com
From: Tong Wu 

Signed-off-by: Tong Wu 
---
 libavcodec/hw_base_encode.c | 11 +++
 libavcodec/hw_base_encode.h |  2 ++
 libavcodec/vaapi_encode.c   |  6 +-
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/libavcodec/hw_base_encode.c b/libavcodec/hw_base_encode.c
index d21137b64a..ad221ae4b0 100644
--- a/libavcodec/hw_base_encode.c
+++ b/libavcodec/hw_base_encode.c
@@ -750,6 +750,17 @@ fail:
 return err;
 }
 
+int ff_hw_base_encode_free(AVCodecContext *avctx, HWBaseEncodePicture *pic)
+{
+av_frame_free(>input_image);
+av_frame_free(>recon_image);
+
+av_buffer_unref(>opaque_ref);
+av_freep(>priv_data);
+
+return 0;
+}
+
 int ff_hw_base_encode_init(AVCodecContext *avctx)
 {
 HWBaseEncodeContext *ctx = avctx->priv_data;
diff --git a/libavcodec/hw_base_encode.h b/libavcodec/hw_base_encode.h
index 9957786a3f..225ca68d3e 100644
--- a/libavcodec/hw_base_encode.h
+++ b/libavcodec/hw_base_encode.h
@@ -234,6 +234,8 @@ int ff_hw_base_init_gop_structure(AVCodecContext *avctx, 
uint32_t ref_l0, uint32
 
 int ff_hw_base_get_recon_format(AVCodecContext *avctx, const void *hwconfig, 
enum AVPixelFormat *fmt);
 
+int ff_hw_base_encode_free(AVCodecContext *avctx, HWBaseEncodePicture *pic);
+
 int ff_hw_base_encode_init(AVCodecContext *avctx);
 
 int ff_hw_base_encode_close(AVCodecContext *avctx);
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index b2fa3dc93c..c75e8ba5fb 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -874,17 +874,13 @@ static int vaapi_encode_free(AVCodecContext *avctx,
 av_freep(>slices[i].codec_slice_params);
 }
 
-av_frame_free(_pic->input_image);
-av_frame_free(_pic->recon_image);
-
-av_buffer_unref(_pic->opaque_ref);
+ff_hw_base_encode_free(avctx, base_pic);
 
 av_freep(>param_buffers);
 av_freep(>slices);
 // Output buffer should already be destroyed.
 av_assert0(pic->output_buffer == VA_INVALID_ID);
 
-av_freep(_pic->priv_data);
 av_freep(>codec_picture_params);
 av_freep(>roi);
 
-- 
2.41.0.windows.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 v7 08/12] avcodec/vaapi_encode: extract a get_recon_format function to base layer

2024-03-14 Thread tong1 . wu-at-intel . com
From: Tong Wu 

Get constraints and set recon frame format can be shared with other HW
encoder such as D3D12. Extract this part as a new function to base
layer.

Signed-off-by: Tong Wu 
---
 libavcodec/hw_base_encode.c | 58 +
 libavcodec/hw_base_encode.h |  2 ++
 libavcodec/vaapi_encode.c   | 51 ++--
 3 files changed, 63 insertions(+), 48 deletions(-)

diff --git a/libavcodec/hw_base_encode.c b/libavcodec/hw_base_encode.c
index 8044b83292..d21137b64a 100644
--- a/libavcodec/hw_base_encode.c
+++ b/libavcodec/hw_base_encode.c
@@ -692,6 +692,64 @@ int ff_hw_base_init_gop_structure(AVCodecContext *avctx, 
uint32_t ref_l0, uint32
 return 0;
 }
 
+int ff_hw_base_get_recon_format(AVCodecContext *avctx, const void *hwconfig, 
enum AVPixelFormat *fmt)
+{
+HWBaseEncodeContext *ctx = avctx->priv_data;
+AVHWFramesConstraints *constraints = NULL;
+enum AVPixelFormat recon_format;
+int err, i;
+
+constraints = av_hwdevice_get_hwframe_constraints(ctx->device_ref,
+  hwconfig);
+if (!constraints) {
+err = AVERROR(ENOMEM);
+goto fail;
+}
+
+// Probably we can use the input surface format as the surface format
+// of the reconstructed frames.  If not, we just pick the first (only?)
+// format in the valid list and hope that it all works.
+recon_format = AV_PIX_FMT_NONE;
+if (constraints->valid_sw_formats) {
+for (i = 0; constraints->valid_sw_formats[i] != AV_PIX_FMT_NONE; i++) {
+if (ctx->input_frames->sw_format ==
+constraints->valid_sw_formats[i]) {
+recon_format = ctx->input_frames->sw_format;
+break;
+}
+}
+if (recon_format == AV_PIX_FMT_NONE) {
+// No match.  Just use the first in the supported list and
+// hope for the best.
+recon_format = constraints->valid_sw_formats[0];
+}
+} else {
+// No idea what to use; copy input format.
+recon_format = ctx->input_frames->sw_format;
+}
+av_log(avctx, AV_LOG_DEBUG, "Using %s as format of "
+   "reconstructed frames.\n", av_get_pix_fmt_name(recon_format));
+
+if (ctx->surface_width  < constraints->min_width  ||
+ctx->surface_height < constraints->min_height ||
+ctx->surface_width  > constraints->max_width ||
+ctx->surface_height > constraints->max_height) {
+av_log(avctx, AV_LOG_ERROR, "Hardware does not support encoding at "
+   "size %dx%d (constraints: width %d-%d height %d-%d).\n",
+   ctx->surface_width, ctx->surface_height,
+   constraints->min_width,  constraints->max_width,
+   constraints->min_height, constraints->max_height);
+err = AVERROR(EINVAL);
+goto fail;
+}
+
+*fmt = recon_format;
+err = 0;
+fail:
+av_hwframe_constraints_free();
+return err;
+}
+
 int ff_hw_base_encode_init(AVCodecContext *avctx)
 {
 HWBaseEncodeContext *ctx = avctx->priv_data;
diff --git a/libavcodec/hw_base_encode.h b/libavcodec/hw_base_encode.h
index 39893a8cc5..9957786a3f 100644
--- a/libavcodec/hw_base_encode.h
+++ b/libavcodec/hw_base_encode.h
@@ -232,6 +232,8 @@ int ff_hw_base_encode_receive_packet(AVCodecContext *avctx, 
AVPacket *pkt);
 int ff_hw_base_init_gop_structure(AVCodecContext *avctx, uint32_t ref_l0, 
uint32_t ref_l1,
   int flags, int prediction_pre_only);
 
+int ff_hw_base_get_recon_format(AVCodecContext *avctx, const void *hwconfig, 
enum AVPixelFormat *fmt);
+
 int ff_hw_base_encode_init(AVCodecContext *avctx);
 
 int ff_hw_base_encode_close(AVCodecContext *avctx);
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 4633cf08b7..b2fa3dc93c 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -2022,9 +2022,8 @@ static av_cold int 
vaapi_encode_create_recon_frames(AVCodecContext *avctx)
 HWBaseEncodeContext *base_ctx = avctx->priv_data;
 VAAPIEncodeContext   *ctx = avctx->priv_data;
 AVVAAPIHWConfig *hwconfig = NULL;
-AVHWFramesConstraints *constraints = NULL;
 enum AVPixelFormat recon_format;
-int err, i;
+int err;
 
 hwconfig = av_hwdevice_hwconfig_alloc(base_ctx->device_ref);
 if (!hwconfig) {
@@ -2033,52 +2032,9 @@ static av_cold int 
vaapi_encode_create_recon_frames(AVCodecContext *avctx)
 }
 hwconfig->config_id = ctx->va_config;
 
-constraints = av_hwdevice_get_hwframe_constraints(base_ctx->device_ref,
-  hwconfig);
-if (!constraints) {
-err = AVERROR(ENOMEM);
-goto fail;
-}
-
-// Probably we can use the input surface format as the surface format
-// of the reconstructed frames.  If not, we just pick the first (only?)
-// format in the valid list and hope that it all works.
-

[FFmpeg-devel] [PATCH v7 07/12] avcodec/vaapi_encode: extract gop configuration to base layer

2024-03-14 Thread tong1 . wu-at-intel . com
From: Tong Wu 

Signed-off-by: Tong Wu 
---
 libavcodec/hw_base_encode.c | 54 +
 libavcodec/hw_base_encode.h |  3 +++
 libavcodec/vaapi_encode.c   | 52 +++
 3 files changed, 61 insertions(+), 48 deletions(-)

diff --git a/libavcodec/hw_base_encode.c b/libavcodec/hw_base_encode.c
index c7aed019fa..8044b83292 100644
--- a/libavcodec/hw_base_encode.c
+++ b/libavcodec/hw_base_encode.c
@@ -638,6 +638,60 @@ end:
 return 0;
 }
 
+int ff_hw_base_init_gop_structure(AVCodecContext *avctx, uint32_t ref_l0, 
uint32_t ref_l1,
+  int flags, int prediction_pre_only)
+{
+HWBaseEncodeContext *ctx = avctx->priv_data;
+
+if (flags & FLAG_INTRA_ONLY || avctx->gop_size <= 1) {
+av_log(avctx, AV_LOG_VERBOSE, "Using intra frames only.\n");
+ctx->gop_size = 1;
+} else if (ref_l0 < 1) {
+av_log(avctx, AV_LOG_ERROR, "Driver does not support any "
+   "reference frames.\n");
+return AVERROR(EINVAL);
+} else if (!(flags & FLAG_B_PICTURES) || ref_l1 < 1 ||
+   avctx->max_b_frames < 1 || prediction_pre_only) {
+if (ctx->p_to_gpb)
+   av_log(avctx, AV_LOG_VERBOSE, "Using intra and B-frames "
+  "(supported references: %d / %d).\n",
+  ref_l0, ref_l1);
+else
+av_log(avctx, AV_LOG_VERBOSE, "Using intra and P-frames "
+   "(supported references: %d / %d).\n", ref_l0, ref_l1);
+ctx->gop_size = avctx->gop_size;
+ctx->p_per_i  = INT_MAX;
+ctx->b_per_p  = 0;
+} else {
+   if (ctx->p_to_gpb)
+   av_log(avctx, AV_LOG_VERBOSE, "Using intra and B-frames "
+  "(supported references: %d / %d).\n",
+  ref_l0, ref_l1);
+   else
+   av_log(avctx, AV_LOG_VERBOSE, "Using intra, P- and B-frames "
+  "(supported references: %d / %d).\n", ref_l0, ref_l1);
+ctx->gop_size = avctx->gop_size;
+ctx->p_per_i  = INT_MAX;
+ctx->b_per_p  = avctx->max_b_frames;
+if (flags & FLAG_B_PICTURE_REFERENCES) {
+ctx->max_b_depth = FFMIN(ctx->desired_b_depth,
+ av_log2(ctx->b_per_p) + 1);
+} else {
+ctx->max_b_depth = 1;
+}
+}
+
+if (flags & FLAG_NON_IDR_KEY_PICTURES) {
+ctx->closed_gop  = !!(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP);
+ctx->gop_per_idr = ctx->idr_interval + 1;
+} else {
+ctx->closed_gop  = 1;
+ctx->gop_per_idr = 1;
+}
+
+return 0;
+}
+
 int ff_hw_base_encode_init(AVCodecContext *avctx)
 {
 HWBaseEncodeContext *ctx = avctx->priv_data;
diff --git a/libavcodec/hw_base_encode.h b/libavcodec/hw_base_encode.h
index 3af696a21a..39893a8cc5 100644
--- a/libavcodec/hw_base_encode.h
+++ b/libavcodec/hw_base_encode.h
@@ -229,6 +229,9 @@ int ff_hw_base_encode_set_output_property(AVCodecContext 
*avctx, HWBaseEncodePic
 
 int ff_hw_base_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt);
 
+int ff_hw_base_init_gop_structure(AVCodecContext *avctx, uint32_t ref_l0, 
uint32_t ref_l1,
+  int flags, int prediction_pre_only);
+
 int ff_hw_base_encode_init(AVCodecContext *avctx);
 
 int ff_hw_base_encode_close(AVCodecContext *avctx);
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 0c8be3a1e6..4633cf08b7 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -1567,7 +1567,7 @@ static av_cold int 
vaapi_encode_init_gop_structure(AVCodecContext *avctx)
 VAStatus vas;
 VAConfigAttrib attr = { VAConfigAttribEncMaxRefFrames };
 uint32_t ref_l0, ref_l1;
-int prediction_pre_only;
+int prediction_pre_only, err;
 
 vas = vaGetConfigAttributes(ctx->hwctx->display,
 ctx->va_profile,
@@ -1631,53 +1631,9 @@ static av_cold int 
vaapi_encode_init_gop_structure(AVCodecContext *avctx)
 }
 #endif
 
-if (ctx->codec->flags & FLAG_INTRA_ONLY ||
-avctx->gop_size <= 1) {
-av_log(avctx, AV_LOG_VERBOSE, "Using intra frames only.\n");
-base_ctx->gop_size = 1;
-} else if (ref_l0 < 1) {
-av_log(avctx, AV_LOG_ERROR, "Driver does not support any "
-   "reference frames.\n");
-return AVERROR(EINVAL);
-} else if (!(ctx->codec->flags & FLAG_B_PICTURES) ||
-   ref_l1 < 1 || avctx->max_b_frames < 1 ||
-   prediction_pre_only) {
-if (base_ctx->p_to_gpb)
-   av_log(avctx, AV_LOG_VERBOSE, "Using intra and B-frames "
-  "(supported references: %d / %d).\n",
-  ref_l0, ref_l1);
-else
-av_log(avctx, AV_LOG_VERBOSE, "Using intra and P-frames "
-   "(supported references: %d / %d).\n", ref_l0, ref_l1);
-base_ctx->gop_size = avctx->gop_size;
-base_ctx->p_per_i  = INT_MAX;
-

[FFmpeg-devel] [PATCH v7 06/12] avcodec/vaapi_encode: extract set_output_property to base layer

2024-03-14 Thread tong1 . wu-at-intel . com
From: Tong Wu 

Signed-off-by: Tong Wu 
---
 libavcodec/hw_base_encode.c | 40 +
 libavcodec/hw_base_encode.h |  3 +++
 libavcodec/vaapi_encode.c   | 44 ++---
 3 files changed, 45 insertions(+), 42 deletions(-)

diff --git a/libavcodec/hw_base_encode.c b/libavcodec/hw_base_encode.c
index 754f990ed0..c7aed019fa 100644
--- a/libavcodec/hw_base_encode.c
+++ b/libavcodec/hw_base_encode.c
@@ -490,6 +490,46 @@ fail:
 return err;
 }
 
+int ff_hw_base_encode_set_output_property(AVCodecContext *avctx,
+  HWBaseEncodePicture *pic,
+  AVPacket *pkt, int flag_no_delay)
+{
+HWBaseEncodeContext *ctx = avctx->priv_data;
+
+if (pic->type == PICTURE_TYPE_IDR)
+pkt->flags |= AV_PKT_FLAG_KEY;
+
+pkt->pts = pic->pts;
+pkt->duration = pic->duration;
+
+// for no-delay encoders this is handled in generic codec
+if (avctx->codec->capabilities & AV_CODEC_CAP_DELAY &&
+avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
+pkt->opaque  = pic->opaque;
+pkt->opaque_ref  = pic->opaque_ref;
+pic->opaque_ref = NULL;
+}
+
+if (flag_no_delay) {
+pkt->dts = pkt->pts;
+return 0;
+}
+
+if (ctx->output_delay == 0) {
+pkt->dts = pkt->pts;
+} else if (pic->encode_order < ctx->decode_delay) {
+if (ctx->ts_ring[pic->encode_order] < INT64_MIN + ctx->dts_pts_diff)
+pkt->dts = INT64_MIN;
+else
+pkt->dts = ctx->ts_ring[pic->encode_order] - ctx->dts_pts_diff;
+} else {
+pkt->dts = ctx->ts_ring[(pic->encode_order - ctx->decode_delay) %
+(3 * ctx->output_delay + ctx->async_depth)];
+}
+
+return 0;
+}
+
 int ff_hw_base_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
 {
 HWBaseEncodeContext *ctx = avctx->priv_data;
diff --git a/libavcodec/hw_base_encode.h b/libavcodec/hw_base_encode.h
index 436767b706..3af696a21a 100644
--- a/libavcodec/hw_base_encode.h
+++ b/libavcodec/hw_base_encode.h
@@ -224,6 +224,9 @@ typedef struct HWBaseEncodeContext {
 AVPacket*tail_pkt;
 } HWBaseEncodeContext;
 
+int ff_hw_base_encode_set_output_property(AVCodecContext *avctx, 
HWBaseEncodePicture *pic,
+  AVPacket *pkt, int flag_no_delay);
+
 int ff_hw_base_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt);
 
 int ff_hw_base_encode_init(AVCodecContext *avctx);
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index ffac27a08f..0c8be3a1e6 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -657,47 +657,6 @@ fail_at_end:
 return err;
 }
 
-static int vaapi_encode_set_output_property(AVCodecContext *avctx,
-HWBaseEncodePicture *pic,
-AVPacket *pkt)
-{
-HWBaseEncodeContext *base_ctx = avctx->priv_data;
-VAAPIEncodeContext *ctx = avctx->priv_data;
-
-if (pic->type == PICTURE_TYPE_IDR)
-pkt->flags |= AV_PKT_FLAG_KEY;
-
-pkt->pts = pic->pts;
-pkt->duration = pic->duration;
-
-// for no-delay encoders this is handled in generic codec
-if (avctx->codec->capabilities & AV_CODEC_CAP_DELAY &&
-avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
-pkt->opaque = pic->opaque;
-pkt->opaque_ref = pic->opaque_ref;
-pic->opaque_ref = NULL;
-}
-
-if (ctx->codec->flags & FLAG_TIMESTAMP_NO_DELAY) {
-pkt->dts = pkt->pts;
-return 0;
-}
-
-if (base_ctx->output_delay == 0) {
-pkt->dts = pkt->pts;
-} else if (pic->encode_order < base_ctx->decode_delay) {
-if (base_ctx->ts_ring[pic->encode_order] < INT64_MIN + 
base_ctx->dts_pts_diff)
-pkt->dts = INT64_MIN;
-else
-pkt->dts = base_ctx->ts_ring[pic->encode_order] - 
base_ctx->dts_pts_diff;
-} else {
-pkt->dts = base_ctx->ts_ring[(pic->encode_order - 
base_ctx->decode_delay) %
- (3 * base_ctx->output_delay + 
base_ctx->async_depth)];
-}
-
-return 0;
-}
-
 static int vaapi_encode_get_coded_buffer_size(AVCodecContext *avctx, 
VABufferID buf_id)
 {
 VAAPIEncodeContext *ctx = avctx->priv_data;
@@ -849,7 +808,8 @@ static int vaapi_encode_output(AVCodecContext *avctx,
 av_log(avctx, AV_LOG_DEBUG, "Output read for pic %"PRId64"/%"PRId64".\n",
base_pic->display_order, base_pic->encode_order);
 
-vaapi_encode_set_output_property(avctx, (HWBaseEncodePicture*)base_pic, 
pkt_ptr);
+ff_hw_base_encode_set_output_property(avctx, 
(HWBaseEncodePicture*)base_pic, pkt_ptr,
+  ctx->codec->flags & 
FLAG_TIMESTAMP_NO_DELAY);
 
 end:
 ff_refstruct_unref(>output_buffer_ref);
-- 
2.41.0.windows.1

___
ffmpeg-devel 

[FFmpeg-devel] [PATCH v7 05/12] avcodec/vaapi_encode: extract a close function for base layer

2024-03-14 Thread tong1 . wu-at-intel . com
From: Tong Wu 

Signed-off-by: Tong Wu 
---
 libavcodec/hw_base_encode.c | 16 
 libavcodec/hw_base_encode.h |  2 ++
 libavcodec/vaapi_encode.c   |  8 +---
 3 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/libavcodec/hw_base_encode.c b/libavcodec/hw_base_encode.c
index 71ead512c0..754f990ed0 100644
--- a/libavcodec/hw_base_encode.c
+++ b/libavcodec/hw_base_encode.c
@@ -630,3 +630,19 @@ int ff_hw_base_encode_init(AVCodecContext *avctx)
 
 return 0;
 }
+
+int ff_hw_base_encode_close(AVCodecContext *avctx)
+{
+HWBaseEncodeContext *ctx = avctx->priv_data;
+
+av_fifo_freep2(>encode_fifo);
+
+av_frame_free(>frame);
+av_packet_free(>tail_pkt);
+
+av_buffer_unref(>device_ref);
+av_buffer_unref(>input_frames_ref);
+av_buffer_unref(>recon_frames_ref);
+
+return 0;
+}
diff --git a/libavcodec/hw_base_encode.h b/libavcodec/hw_base_encode.h
index c9c8fb43c9..436767b706 100644
--- a/libavcodec/hw_base_encode.h
+++ b/libavcodec/hw_base_encode.h
@@ -228,6 +228,8 @@ int ff_hw_base_encode_receive_packet(AVCodecContext *avctx, 
AVPacket *pkt);
 
 int ff_hw_base_encode_init(AVCodecContext *avctx);
 
+int ff_hw_base_encode_close(AVCodecContext *avctx);
+
 #define HW_BASE_ENCODE_COMMON_OPTIONS \
 { "idr_interval", \
   "Distance (in I-frames) between key frames", \
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 887543734b..ffac27a08f 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -2412,16 +2412,10 @@ av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
 ctx->va_config = VA_INVALID_ID;
 }
 
-av_frame_free(_ctx->frame);
-av_packet_free(_ctx->tail_pkt);
-
 av_freep(>codec_sequence_params);
 av_freep(>codec_picture_params);
-av_fifo_freep2(_ctx->encode_fifo);
 
-av_buffer_unref(_ctx->recon_frames_ref);
-av_buffer_unref(_ctx->input_frames_ref);
-av_buffer_unref(_ctx->device_ref);
+ff_hw_base_encode_close(avctx);
 
 return 0;
 }
-- 
2.41.0.windows.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 v7 04/12] avcodec/vaapi_encode: extract a init function to base layer

2024-03-14 Thread tong1 . wu-at-intel . com
From: Tong Wu 

Move the base_ctx parameter initialization to base layer.

Signed-off-by: Tong Wu 
---
 libavcodec/hw_base_encode.c | 33 +
 libavcodec/hw_base_encode.h |  2 ++
 libavcodec/vaapi_encode.c   | 36 
 3 files changed, 39 insertions(+), 32 deletions(-)

diff --git a/libavcodec/hw_base_encode.c b/libavcodec/hw_base_encode.c
index dcba902f44..71ead512c0 100644
--- a/libavcodec/hw_base_encode.c
+++ b/libavcodec/hw_base_encode.c
@@ -597,3 +597,36 @@ end:
 
 return 0;
 }
+
+int ff_hw_base_encode_init(AVCodecContext *avctx)
+{
+HWBaseEncodeContext *ctx = avctx->priv_data;
+
+ctx->frame = av_frame_alloc();
+if (!ctx->frame)
+return AVERROR(ENOMEM);
+
+if (!avctx->hw_frames_ctx) {
+av_log(avctx, AV_LOG_ERROR, "A hardware frames reference is "
+   "required to associate the encoding device.\n");
+return AVERROR(EINVAL);
+}
+
+ctx->input_frames_ref = av_buffer_ref(avctx->hw_frames_ctx);
+if (!ctx->input_frames_ref)
+return AVERROR(ENOMEM);
+
+ctx->input_frames = (AVHWFramesContext *)ctx->input_frames_ref->data;
+
+ctx->device_ref = av_buffer_ref(ctx->input_frames->device_ref);
+if (!ctx->device_ref)
+return AVERROR(ENOMEM);
+
+ctx->device = (AVHWDeviceContext *)ctx->device_ref->data;
+
+ctx->tail_pkt = av_packet_alloc();
+if (!ctx->tail_pkt)
+return AVERROR(ENOMEM);
+
+return 0;
+}
diff --git a/libavcodec/hw_base_encode.h b/libavcodec/hw_base_encode.h
index c9df95f952..c9c8fb43c9 100644
--- a/libavcodec/hw_base_encode.h
+++ b/libavcodec/hw_base_encode.h
@@ -226,6 +226,8 @@ typedef struct HWBaseEncodeContext {
 
 int ff_hw_base_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt);
 
+int ff_hw_base_encode_init(AVCodecContext *avctx);
+
 #define HW_BASE_ENCODE_COMMON_OPTIONS \
 { "idr_interval", \
   "Distance (in I-frames) between key frames", \
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index c6742c4301..887543734b 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -2208,45 +2208,17 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
 VAStatus vas;
 int err;
 
+err = ff_hw_base_encode_init(avctx);
+if (err < 0)
+goto fail;
+
 ctx->va_config  = VA_INVALID_ID;
 ctx->va_context = VA_INVALID_ID;
 
 base_ctx->op = _op;
 
-/* If you add something that can fail above this av_frame_alloc(),
- * modify ff_vaapi_encode_close() accordingly. */
-base_ctx->frame = av_frame_alloc();
-if (!base_ctx->frame) {
-return AVERROR(ENOMEM);
-}
-
-if (!avctx->hw_frames_ctx) {
-av_log(avctx, AV_LOG_ERROR, "A hardware frames reference is "
-   "required to associate the encoding device.\n");
-return AVERROR(EINVAL);
-}
-
-base_ctx->input_frames_ref = av_buffer_ref(avctx->hw_frames_ctx);
-if (!base_ctx->input_frames_ref) {
-err = AVERROR(ENOMEM);
-goto fail;
-}
-base_ctx->input_frames = 
(AVHWFramesContext*)base_ctx->input_frames_ref->data;
-
-base_ctx->device_ref = av_buffer_ref(base_ctx->input_frames->device_ref);
-if (!base_ctx->device_ref) {
-err = AVERROR(ENOMEM);
-goto fail;
-}
-base_ctx->device = (AVHWDeviceContext*)base_ctx->device_ref->data;
 ctx->hwctx = base_ctx->device->hwctx;
 
-base_ctx->tail_pkt = av_packet_alloc();
-if (!base_ctx->tail_pkt) {
-err = AVERROR(ENOMEM);
-goto fail;
-}
-
 err = vaapi_encode_profile_entrypoint(avctx);
 if (err < 0)
 goto fail;
-- 
2.41.0.windows.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 v7 03/12] avcodec/vaapi_encode: move the dpb logic from VAAPI to base layer

2024-03-14 Thread tong1 . wu-at-intel . com
From: Tong Wu 

Move receive_packet function to base. Add *alloc, *issue, *output, *free
as hardware callback. DPB management logic can be fully extracted to
base layer as-is.

Signed-off-by: Tong Wu 
---
 libavcodec/Makefile |   2 +-
 libavcodec/hw_base_encode.c | 599 
 libavcodec/hw_base_encode.h |   2 +
 libavcodec/vaapi_encode.c   | 586 +--
 libavcodec/vaapi_encode.h   |   3 -
 libavcodec/vaapi_encode_av1.c   |   2 +-
 libavcodec/vaapi_encode_h264.c  |   2 +-
 libavcodec/vaapi_encode_h265.c  |   2 +-
 libavcodec/vaapi_encode_mjpeg.c |   2 +-
 libavcodec/vaapi_encode_mpeg2.c |   2 +-
 libavcodec/vaapi_encode_vp8.c   |   2 +-
 libavcodec/vaapi_encode_vp9.c   |   2 +-
 12 files changed, 625 insertions(+), 581 deletions(-)
 create mode 100644 libavcodec/hw_base_encode.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 708434ac76..cbfae5f182 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -162,7 +162,7 @@ OBJS-$(CONFIG_STARTCODE)   += startcode.o
 OBJS-$(CONFIG_TEXTUREDSP)  += texturedsp.o
 OBJS-$(CONFIG_TEXTUREDSPENC)   += texturedspenc.o
 OBJS-$(CONFIG_TPELDSP) += tpeldsp.o
-OBJS-$(CONFIG_VAAPI_ENCODE)+= vaapi_encode.o
+OBJS-$(CONFIG_VAAPI_ENCODE)+= vaapi_encode.o hw_base_encode.o
 OBJS-$(CONFIG_AV1_AMF_ENCODER) += amfenc_av1.o
 OBJS-$(CONFIG_VC1DSP)  += vc1dsp.o
 OBJS-$(CONFIG_VIDEODSP)+= videodsp.o
diff --git a/libavcodec/hw_base_encode.c b/libavcodec/hw_base_encode.c
new file mode 100644
index 00..dcba902f44
--- /dev/null
+++ b/libavcodec/hw_base_encode.c
@@ -0,0 +1,599 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/avassert.h"
+#include "libavutil/common.h"
+#include "libavutil/internal.h"
+#include "libavutil/log.h"
+#include "libavutil/pixdesc.h"
+
+#include "encode.h"
+#include "avcodec.h"
+#include "hw_base_encode.h"
+
+static void hw_base_encode_add_ref(AVCodecContext *avctx,
+   HWBaseEncodePicture *pic,
+   HWBaseEncodePicture *target,
+   int is_ref, int in_dpb, int prev)
+{
+int refs = 0;
+
+if (is_ref) {
+av_assert0(pic != target);
+av_assert0(pic->nb_refs[0] < MAX_PICTURE_REFERENCES &&
+   pic->nb_refs[1] < MAX_PICTURE_REFERENCES);
+if (target->display_order < pic->display_order)
+pic->refs[0][pic->nb_refs[0]++] = target;
+else
+pic->refs[1][pic->nb_refs[1]++] = target;
+++refs;
+}
+
+if (in_dpb) {
+av_assert0(pic->nb_dpb_pics < MAX_DPB_SIZE);
+pic->dpb[pic->nb_dpb_pics++] = target;
+++refs;
+}
+
+if (prev) {
+av_assert0(!pic->prev);
+pic->prev = target;
+++refs;
+}
+
+target->ref_count[0] += refs;
+target->ref_count[1] += refs;
+}
+
+static void hw_base_encode_remove_refs(AVCodecContext *avctx,
+   HWBaseEncodePicture *pic,
+   int level)
+{
+int i;
+
+if (pic->ref_removed[level])
+return;
+
+for (i = 0; i < pic->nb_refs[0]; i++) {
+av_assert0(pic->refs[0][i]);
+--pic->refs[0][i]->ref_count[level];
+av_assert0(pic->refs[0][i]->ref_count[level] >= 0);
+}
+
+for (i = 0; i < pic->nb_refs[1]; i++) {
+av_assert0(pic->refs[1][i]);
+--pic->refs[1][i]->ref_count[level];
+av_assert0(pic->refs[1][i]->ref_count[level] >= 0);
+}
+
+for (i = 0; i < pic->nb_dpb_pics; i++) {
+av_assert0(pic->dpb[i]);
+--pic->dpb[i]->ref_count[level];
+av_assert0(pic->dpb[i]->ref_count[level] >= 0);
+}
+
+av_assert0(pic->prev || pic->type == PICTURE_TYPE_IDR);
+if (pic->prev) {
+--pic->prev->ref_count[level];
+av_assert0(pic->prev->ref_count[level] >= 0);
+}
+
+pic->ref_removed[level] = 1;
+}
+
+static void hw_base_encode_set_b_pictures(AVCodecContext *avctx,
+  HWBaseEncodePicture *start,
+  

[FFmpeg-devel] [PATCH v7 02/12] avcodec/vaapi_encode: introduce a base layer for vaapi encode

2024-03-14 Thread tong1 . wu-at-intel . com
From: Tong Wu 

Since VAAPI and future D3D12VA implementation may share some common parameters,
a base layer encode context is introduced as vaapi context's base.

Signed-off-by: Tong Wu 
---
 libavcodec/hw_base_encode.h | 241 
 libavcodec/vaapi_encode.c   | 392 +---
 libavcodec/vaapi_encode.h   | 198 +---
 libavcodec/vaapi_encode_av1.c   |  69 +++---
 libavcodec/vaapi_encode_h264.c  | 197 
 libavcodec/vaapi_encode_h265.c  | 159 ++---
 libavcodec/vaapi_encode_mjpeg.c |  20 +-
 libavcodec/vaapi_encode_mpeg2.c |  49 ++--
 libavcodec/vaapi_encode_vp8.c   |  24 +-
 libavcodec/vaapi_encode_vp9.c   |  66 +++---
 10 files changed, 764 insertions(+), 651 deletions(-)
 create mode 100644 libavcodec/hw_base_encode.h

diff --git a/libavcodec/hw_base_encode.h b/libavcodec/hw_base_encode.h
new file mode 100644
index 00..41b68aa073
--- /dev/null
+++ b/libavcodec/hw_base_encode.h
@@ -0,0 +1,241 @@
+/*
+ * 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
+ */
+
+#ifndef AVCODEC_HW_BASE_ENCODE_H
+#define AVCODEC_HW_BASE_ENCODE_H
+
+#include "libavutil/hwcontext.h"
+#include "libavutil/fifo.h"
+
+#include "avcodec.h"
+
+#define MAX_DPB_SIZE 16
+#define MAX_PICTURE_REFERENCES 2
+#define MAX_REORDER_DELAY 16
+#define MAX_ASYNC_DEPTH 64
+#define MAX_REFERENCE_LIST_NUM 2
+
+static inline const char *ff_hw_base_encode_get_pictype_name(const int type) {
+const char * const picture_type_name[] = { "IDR", "I", "P", "B" };
+return picture_type_name[type];
+}
+
+enum {
+PICTURE_TYPE_IDR = 0,
+PICTURE_TYPE_I   = 1,
+PICTURE_TYPE_P   = 2,
+PICTURE_TYPE_B   = 3,
+};
+
+enum {
+// Codec supports controlling the subdivision of pictures into slices.
+FLAG_SLICE_CONTROL = 1 << 0,
+// Codec only supports constant quality (no rate control).
+FLAG_CONSTANT_QUALITY_ONLY = 1 << 1,
+// Codec is intra-only.
+FLAG_INTRA_ONLY= 1 << 2,
+// Codec supports B-pictures.
+FLAG_B_PICTURES= 1 << 3,
+// Codec supports referencing B-pictures.
+FLAG_B_PICTURE_REFERENCES  = 1 << 4,
+// Codec supports non-IDR key pictures (that is, key pictures do
+// not necessarily empty the DPB).
+FLAG_NON_IDR_KEY_PICTURES  = 1 << 5,
+};
+
+typedef struct HWBaseEncodePicture {
+struct HWBaseEncodePicture *next;
+
+int64_t display_order;
+int64_t encode_order;
+int64_t pts;
+int64_t duration;
+int force_idr;
+
+void   *opaque;
+AVBufferRef*opaque_ref;
+
+int type;
+int b_depth;
+int encode_issued;
+int encode_complete;
+
+AVFrame*input_image;
+AVFrame*recon_image;
+
+void   *priv_data;
+
+// Whether this picture is a reference picture.
+int is_reference;
+
+// The contents of the DPB after this picture has been decoded.
+// This will contain the picture itself if it is a reference picture,
+// but not if it isn't.
+int nb_dpb_pics;
+struct HWBaseEncodePicture *dpb[MAX_DPB_SIZE];
+// The reference pictures used in decoding this picture. If they are
+// used by later pictures they will also appear in the DPB. ref[0][] for
+// previous reference frames. ref[1][] for future reference frames.
+int nb_refs[MAX_REFERENCE_LIST_NUM];
+struct HWBaseEncodePicture 
*refs[MAX_REFERENCE_LIST_NUM][MAX_PICTURE_REFERENCES];
+// The previous reference picture in encode order.  Must be in at least
+// one of the reference list and DPB list.
+struct HWBaseEncodePicture *prev;
+// Reference count for other pictures referring to this one through
+// the above pointers, directly from incomplete pictures and indirectly
+// through completed pictures.
+int ref_count[2];
+int ref_removed[2];
+} HWBaseEncodePicture;
+
+typedef struct HWEncodePictureOperation {
+// Alloc memory for the picture structure.
+HWBaseEncodePicture * (*alloc)(AVCodecContext *avctx, const AVFrame 
*frame);
+// Issue the picture structure, which will send the frame 

[FFmpeg-devel] [PATCH v7 01/12] avcodec/vaapi_encode: move pic->input_surface initialization to encode_alloc

2024-03-14 Thread tong1 . wu-at-intel . com
From: Tong Wu 

When allocating the VAAPIEncodePicture, pic->input_surface can be
initialized right in the place. This movement simplifies the send_frame
logic and is the preparation for moving vaapi_encode_send_frame to the base 
layer.

Signed-off-by: Tong Wu 
---
 libavcodec/vaapi_encode.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 808b79c0c7..bd29dbf0b4 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -878,7 +878,8 @@ static int vaapi_encode_discard(AVCodecContext *avctx,
 return 0;
 }
 
-static VAAPIEncodePicture *vaapi_encode_alloc(AVCodecContext *avctx)
+static VAAPIEncodePicture *vaapi_encode_alloc(AVCodecContext *avctx,
+  const AVFrame *frame)
 {
 VAAPIEncodeContext *ctx = avctx->priv_data;
 VAAPIEncodePicture *pic;
@@ -895,7 +896,7 @@ static VAAPIEncodePicture 
*vaapi_encode_alloc(AVCodecContext *avctx)
 }
 }
 
-pic->input_surface = VA_INVALID_ID;
+pic->input_surface = (VASurfaceID)(uintptr_t)frame->data[3];
 pic->recon_surface = VA_INVALID_ID;
 pic->output_buffer = VA_INVALID_ID;
 
@@ -1331,7 +1332,7 @@ static int vaapi_encode_send_frame(AVCodecContext *avctx, 
AVFrame *frame)
 if (err < 0)
 return err;
 
-pic = vaapi_encode_alloc(avctx);
+pic = vaapi_encode_alloc(avctx, frame);
 if (!pic)
 return AVERROR(ENOMEM);
 
@@ -1344,7 +1345,6 @@ static int vaapi_encode_send_frame(AVCodecContext *avctx, 
AVFrame *frame)
 if (ctx->input_order == 0 || frame->pict_type == AV_PICTURE_TYPE_I)
 pic->force_idr = 1;
 
-pic->input_surface = (VASurfaceID)(uintptr_t)frame->data[3];
 pic->pts = frame->pts;
 pic->duration = frame->duration;
 
-- 
2.41.0.windows.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 v2 9/9] avformat/pcm: decrease target audio frame per sec to 10

2024-03-14 Thread Tobias Rapp

On 08/03/2024 01:53, Marton Balint wrote:


This makes the wav and pcm demuxer demux bigger packets, which is more
efficient.

Signed-off-by: Marton Balint
---
  libavformat/pcm.c |   2 +-
  tests/ref/acodec/pcm-s16be|   2 +-
  tests/ref/acodec/pcm-s16be_planar |   4 +-
  tests/ref/acodec/pcm-s16le_planar |   4 +-
  tests/ref/acodec/pcm-s24be|   2 +-
  tests/ref/acodec/pcm-s24le_planar |   4 +-
  tests/ref/acodec/pcm-s32be|   2 +-
  tests/ref/acodec/pcm-s32le_planar |   4 +-
  tests/ref/acodec/pcm-s8_planar|   4 +-
  tests/ref/acodec/pcm-u16be|   4 +-
  tests/ref/acodec/pcm-u16le|   4 +-
  tests/ref/acodec/pcm-u24be|   4 +-
  tests/ref/acodec/pcm-u24le|   4 +-
  tests/ref/acodec/pcm-u32be|   4 +-
  tests/ref/acodec/pcm-u32le|   4 +-
  tests/ref/acodec/s302m|   8 +-
  tests/ref/fate/dcinema-encode |  63 +-
  tests/ref/fate/filter-acrossfade  | 623 --
  tests/ref/fate/filter-adelay  | 324 ++---
  tests/ref/fate/filter-aecho   | 324 ++---
  tests/ref/fate/filter-aemphasis-50fm  | 324 ++---
  tests/ref/fate/filter-aemphasis-75kf  | 324 ++---
  tests/ref/fate/filter-afade-esin  | 324 ++---
  tests/ref/fate/filter-afade-exp   | 324 ++---
  tests/ref/fate/filter-afade-hsin  | 324 ++---
  tests/ref/fate/filter-afade-iqsin | 324 ++---
  tests/ref/fate/filter-afade-log   | 324 ++---
  tests/ref/fate/filter-afade-qsin  | 324 ++---
  tests/ref/fate/filter-agate   | 324 ++---
  tests/ref/fate/filter-alimiter| 324 ++---
  tests/ref/fate/filter-amerge  | 324 ++---
  tests/ref/fate/filter-anequalizer | 324 ++---
  tests/ref/fate/filter-apad| 324 ++---
  .../ref/fate/filter-asegment-samples-absolute | 324 ++---
  .../ref/fate/filter-asegment-samples-relative | 324 ++---
  .../fate/filter-asegment-timestamps-absolute  | 326 ++---
  .../fate/filter-asegment-timestamps-relative  | 326 ++---
  tests/ref/fate/filter-asetrate|  40 +-
  tests/ref/fate/filter-atrim-mixed |   4 +-
  tests/ref/fate/filter-atrim-time  |   5 +-
  tests/ref/fate/filter-chorus  |  20 +-
  tests/ref/fate/filter-compand |  40 +-
  tests/ref/fate/filter-crystalizer | 324 ++---
  tests/ref/fate/filter-dcshift |  40 +-
  tests/ref/fate/filter-earwax  |  40 +-
  tests/ref/fate/filter-extrastereo |  40 +-
  tests/ref/fate/filter-pan-downmix1|  40 +-
  tests/ref/fate/filter-pan-downmix2|  40 +-
  tests/ref/fate/filter-pan-mono1   |  40 +-
  tests/ref/fate/filter-pan-mono2   |  40 +-
  tests/ref/fate/filter-pan-stereo1 |  40 +-
  tests/ref/fate/filter-pan-stereo2 |  40 +-
  tests/ref/fate/filter-pan-stereo3 |  40 +-
  tests/ref/fate/filter-pan-stereo4 |  40 +-
  tests/ref/fate/filter-pan-upmix1  |  40 +-
  tests/ref/fate/filter-pan-upmix2  |  40 +-
  tests/ref/fate/filter-stereotools |  40 +-
  tests/ref/fate/flcl1905   | 612 -
  tests/ref/fate/g722-encode| 282 +++-
  tests/ref/fate/g726-encode-2bit   | 282 +++-
  tests/ref/fate/g726-encode-3bit   | 282 +++-
  tests/ref/fate/g726-encode-4bit   | 282 +++-
  tests/ref/fate/g726-encode-5bit   | 282 +++-
  tests/ref/fate/matroska-move-cues-to-front|  18 +-
  tests/ref/fate/mov-channel-description|   4 +-
  tests/ref/fate/mov-mp4-pcm|   4 +-
  tests/ref/fate/mov-mp4-pcm-float  |   2 +-
  tests/ref/lavf/ast|   4 +-
  tests/ref/lavf/mov|  12 +-
  tests/ref/lavf/mov_rtphint|   4 +-
  tests/ref/lavf/s16.voc|   4 +-
  tests/ref/lavf/smjpeg |   6 +-
  tests/ref/lavf/voc|   4 +-
  tests/ref/seek/acodec-adpcm-ima_wav   |  54 +-
  tests/ref/seek/acodec-adpcm-ima_wav-trellis   |  54 +-
  tests/ref/seek/acodec-adpcm-ms|  54 +-
  tests/ref/seek/acodec-adpcm-ms-trellis|  54 +-
  tests/ref/seek/acodec-adpcm-yamaha|  54 +-
  tests/ref/seek/acodec-adpcm-yamaha-trellis|  54 +-
  tests/ref/seek/acodec-pcm-alaw|  54 +-
  tests/ref/seek/acodec-pcm-f32be   |  54 +-
  

Re: [FFmpeg-devel] Add protocol for Android content providers (v2)

2024-03-14 Thread Matthieu Bouron
On Mon, Mar 04, 2024 at 09:21:43AM +0100, Matthieu Bouron wrote:
> On Tue, Feb 27, 2024 at 03:50:36PM +0100, Matthieu Bouron wrote:
> > Diff from initial patchset:
> > - directly include libavcodec/ffjni.c from libavformat/file.c instead of
> >   migrating ffjni to libavutil (avpriv_*)
> > - check that the passed application context reference is a global one and 
> > error
> >   out if it's not the case
> > 
> 
> Ping.
> 
> Note: I reworded locally the commit msgs using avutil/jni to avcodec/jni.

If there is no objection, I will push the patchset in a few days.
___
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".