Re: [FFmpeg-devel] [PATCH v2] avfilter/vpp_qsv: fix regression on older api versions (e.g. 1.11)

2022-01-04 Thread Xiang, Haihao
On Sun, 2022-01-02 at 03:41 +, ffmpegagent wrote:
> From: softworkz 
> 
> Commit 8b83dad82512a6948b63408f964463b063ad24c9 introduced a
> regression in a way that scaling via vpp_qsv doesn't work any longer
> for devices with an MSDK runtime version lower than 1.19. This is true
> for older CPUs which are stuck at 1.11.
> The commit added checks for the compile-sdk version but it didn't test
> for the runtime version.
> 
> Signed-off-by: softworkz 
> ---
> avfilter/vpp_qsv: fix regression on older api versions (e.g. 1.11)
> 
> Fix a recently introduced regression when using QSV VPP.
> 
> v2: Fixed commit message wrapping
> 
> Published-As: 
> https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-15%2Fsoftworkz%2Fqsv_vpp_regression-v2
> Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-
> 15/softworkz/qsv_vpp_regression-v2
> Pull-Request: https://github.com/ffstaging/FFmpeg/pull/15
> 
> Range-diff vs v1:
> 
>  1:  eea966f702 ! 1:  ccede9d840 avfilter/vpp_qsv: fix regression on older api
> versions (e.g. 1.11)
>  @@ Metadata
>## Commit message ##
>   avfilter/vpp_qsv: fix regression on older api versions (e.g. 1.11)
>   
>  -Commit 8b83dad82512a6948b63408f964463b063ad24c9 introduced a
> regression in a way
>  -that scaling via vpp_qsv didn't work any longer for devices with an
> MSDK runtime
>  -version lower than 1.19. This is true for older CPUs which are stuck
> at 1.11.
>  -The commit added checks for the compile-sdk version but it didn't
> test for the
>  -runtime version.
>  +Commit 8b83dad82512a6948b63408f964463b063ad24c9 introduced a
>  +regression in a way that scaling via vpp_qsv doesn't work any longer
>  +for devices with an MSDK runtime version lower than 1.19. This is
> true
>  +for older CPUs which are stuck at 1.11.
>  +The commit added checks for the compile-sdk version but it didn't
> test
>  +for the runtime version.
>   
>   Signed-off-by: softworkz 
>   
> 
> 
>  libavfilter/vf_vpp_qsv.c | 32 
>  1 file changed, 20 insertions(+), 12 deletions(-)
> 
> diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
> index ab58a5777e..09590157e3 100644
> --- a/libavfilter/vf_vpp_qsv.c
> +++ b/libavfilter/vf_vpp_qsv.c
> @@ -139,8 +139,9 @@ static const AVOption options[] = {
>  { "height", "Output video height", OFFSET(oh), AV_OPT_TYPE_STRING, {
> .str="w*ch/cw" }, 0, 255, .flags = FLAGS },
>  { "format", "Output pixel format", OFFSET(output_format_str),
> AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS },
>  { "async_depth", "Internal parallelization depth, the higher the value
> the higher the latency.", OFFSET(async_depth), AV_OPT_TYPE_INT, { .i64 = 0 },
> 0, INT_MAX, .flags = FLAGS },
> +#ifdef QSV_HAVE_SCALING_CONFIG
>  { "scale_mode", "scale mode: 0=auto, 1=low power, 2=high quality",
> OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT },
> MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, .flags = FLAGS, "scale
> mode" },
> -
> +#endif
>  { NULL }
>  };
>  
> @@ -304,6 +305,7 @@ static int config_output(AVFilterLink *outlink)
>  QSVVPPParam param = { NULL };
>  QSVVPPCrop  crop  = { 0 };
>  mfxExtBuffer*ext_buf[ENH_FILTERS_COUNT];
> +mfxVersion  mfx_version;
>  AVFilterLink*inlink = ctx->inputs[0];
>  enum AVPixelFormat in_format;
>  
> @@ -317,6 +319,11 @@ static int config_output(AVFilterLink *outlink)
>  param.ext_buf   = ext_buf;
>  param.async_depth   = vpp->async_depth;
>  
> +if (MFXQueryVersion(vpp->qsv->session, &mfx_version) < 0) {

It resulted in segmentation fault in testing because vpp->qsv is NULL here. Note
vpp->qsv is set in ff_qsvvpp_create.

Thanks
Haihao


> +av_log(ctx, AV_LOG_ERROR, "Failed to query mfx version.\n");
> +return AVERROR(EINVAL);
> +}
> +
>  if (inlink->format == AV_PIX_FMT_QSV) {
>   if (!inlink->hw_frames_ctx || !inlink->hw_frames_ctx->data)
>   return AVERROR(EINVAL);
> @@ -467,19 +474,20 @@ static int config_output(AVFilterLink *outlink)
>  #endif
>  }
>  
> -if (inlink->w != outlink->w || inlink->h != outlink->h) {
>  #ifdef QSV_HAVE_SCALING_CONFIG
> -memset(&vpp->scale_conf, 0, sizeof(mfxExtVPPScaling));
> -vpp->scale_conf.Header.BufferId= MFX_EXTBUFF_VPP_SCALING;
> -vpp->scale_conf.Header.BufferSz= sizeof(mfxExtVPPScaling);
> -vpp->scale_conf.ScalingMode= vpp->scale_mode;
> -
> -param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->scale_conf;
> -#else
> -av_log(ctx, AV_LOG_WARNING, "The QSV VPP Scale option is "
> -"not supported with this MSDK version.\n");
> -#endif
> +if (inlink->w != outlink->w || inlink->h != outlink->h) {
> +if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19))

Re: [FFmpeg-devel] [PATCH v1] lavc/av1dec: use frame split bsf

2022-01-04 Thread Xiang, Haihao
On Tue, 2021-12-28 at 06:00 +, Xiang, Haihao wrote:
> On Wed, 2021-12-15 at 16:06 +0800, Fei Wang wrote:
> > Split packed data in case of its contains multiple show frame in some
> > non-standard bitstream. This can benefit decoder which can decode
> > continuously instead of interrupt with unexpected error.
> > 
> > Signed-off-by: Fei Wang 
> > ---
> > This is an improvement fix for my previous patch:
> > 
> 
> 
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20211203080920.1948453-1-fei.w.w...@intel.com/
> > 
> >  libavcodec/av1dec.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
> > index db110c50c7..09df2bf421 100644
> > --- a/libavcodec/av1dec.c
> > +++ b/libavcodec/av1dec.c
> > @@ -1240,6 +1240,7 @@ const AVCodec ff_av1_decoder = {
> >  .flush = av1_decode_flush,
> >  .profiles  = NULL_IF_CONFIG_SMALL(ff_av1_profiles),
> >  .priv_class= &av1_class,
> > +.bsfs  = "av1_frame_split",
> >  .hw_configs= (const AVCodecHWConfigInternal *const []) {
> >  #if CONFIG_AV1_DXVA2_HWACCEL
> >  HWACCEL_DXVA2(av1),
> 
> LGTM

This patch works well for me when using vaapi av1 decoding. I'll apply it if 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 v11] lavu/frame: Add Dolby Vision metadata side data type

2022-01-04 Thread Andreas Rheinhardt
Niklas Haas:
> From: Niklas Haas 
> 
> Yeah, I think I agree that this is probably the best compromise here.
> 
> Updated documentation (and also changed one unnecessarily-large uint64_t
> to uint16_t)
> 
> ---
> In order to be able to extend this struct later (as the Dolby Vision RPU
> evolves), all of the 'container' structs are considered extensible, and
> the individual constituent fields must instead be accessed via offsets.
> The precedent for this style of access is set in
> 
> 
> Signed-off-by: Niklas Haas 
> ---
>  doc/APIchanges|   3 +
>  libavutil/dovi_meta.c |  25 +++
>  libavutil/dovi_meta.h | 166 ++
>  libavutil/frame.c |   1 +
>  libavutil/frame.h |   9 ++-
>  libavutil/version.h   |   2 +-
>  6 files changed, 204 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 670a59329e..5721486f09 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -14,6 +14,9 @@ libavutil: 2021-04-27
>  
>  API changes, most recent first:
>  
> +2021-12-xx - xx - lavu 57.14.100 - frame.h
> +  Add AV_FRAME_DATA_DOVI_METADATA.
> +
>  2021-12-xx - xx - lavu 57.13.100 - hwcontext_videotoolbox.h
>Add av_vt_pixbuf_set_attachments
>  
> diff --git a/libavutil/dovi_meta.c b/libavutil/dovi_meta.c
> index 7bd08f6c54..9c50da561e 100644
> --- a/libavutil/dovi_meta.c
> +++ b/libavutil/dovi_meta.c
> @@ -33,3 +33,28 @@ AVDOVIDecoderConfigurationRecord *av_dovi_alloc(size_t 
> *size)
>  
>  return dovi;
>  }
> +
> +typedef struct AVDOVIMetadataInternal {
> +AVDOVIMetadata metadata;
> +AVDOVIRpuDataHeader header;
> +AVDOVIDataMapping mapping;
> +AVDOVIColorMetadata color;
> +} AVDOVIMetadataInternal;
> +
> +AVDOVIMetadata *av_dovi_metadata_alloc(size_t *size)
> +{
> +AVDOVIMetadataInternal *dovi = 
> av_mallocz(sizeof(AVDOVIMetadataInternal));
> +if (!dovi)
> +return NULL;
> +
> +if (size)
> +*size = sizeof(*dovi);
> +
> +dovi->metadata = (struct AVDOVIMetadata) {
> +.header_offset  = offsetof(AVDOVIMetadataInternal, header),
> +.mapping_offset = offsetof(AVDOVIMetadataInternal, mapping),
> +.color_offset   = offsetof(AVDOVIMetadataInternal, color),
> +};
> +
> +return &dovi->metadata;
> +}
> diff --git a/libavutil/dovi_meta.h b/libavutil/dovi_meta.h
> index 299911d434..3d11e02bff 100644
> --- a/libavutil/dovi_meta.h
> +++ b/libavutil/dovi_meta.h
> @@ -29,6 +29,7 @@
>  
>  #include 
>  #include 
> +#include "rational.h"
>  
>  /*
>   * DOVI configuration
> @@ -67,4 +68,169 @@ typedef struct AVDOVIDecoderConfigurationRecord {
>   */
>  AVDOVIDecoderConfigurationRecord *av_dovi_alloc(size_t *size);
>  
> +/**
> + * Dolby Vision RPU data header.
> + *
> + * @note sizeof(AVDOVIRpuDataHeader) is not part of the public ABI.
> + */
> +typedef struct AVDOVIRpuDataHeader {
> +uint8_t rpu_type;
> +uint16_t rpu_format;
> +uint8_t vdr_rpu_profile;
> +uint8_t vdr_rpu_level;
> +uint8_t chroma_resampling_explicit_filter_flag;
> +uint8_t coef_data_type; /* informative, lavc always converts to fixed */
> +uint8_t coef_log2_denom;
> +uint8_t vdr_rpu_normalized_idc;
> +uint8_t bl_video_full_range_flag;
> +uint8_t bl_bit_depth; /* [8, 16] */
> +uint8_t el_bit_depth; /* [8, 16] */
> +uint8_t vdr_bit_depth; /* [8, 16] */
> +uint8_t spatial_resampling_filter_flag;
> +uint8_t el_spatial_resampling_filter_flag;
> +uint8_t disable_residual_flag;
> +} AVDOVIRpuDataHeader;
> +
> +enum AVDOVIMappingMethod {
> +AV_DOVI_MAPPING_POLYNOMIAL = 0,
> +AV_DOVI_MAPPING_MMR = 1,
> +};
> +
> +/**
> + * Coefficients of a piece-wise function. The pieces of the function span the
> + * value ranges between two adjacent pivot values.
> + */
> +#define AV_DOVI_MAX_PIECES 8
> +typedef struct AVDOVIReshapingCurve {
> +uint8_t num_pivots; /* [2, 9] */
> +uint16_t pivots[AV_DOVI_MAX_PIECES + 1];/* sorted ascending */
> +enum AVDOVIMappingMethod mapping_idc[AV_DOVI_MAX_PIECES];
> +/* AV_DOVI_MAPPING_POLYNOMIAL */
> +uint8_t poly_order[AV_DOVI_MAX_PIECES]; /* [1, 2] */
> +int64_t poly_coef[AV_DOVI_MAX_PIECES][3];   /* x^0, x^1, x^2 */
> +/* AV_DOVI_MAPPING_MMR */
> +uint8_t mmr_order[AV_DOVI_MAX_PIECES];  /* [1, 3] */
> +int64_t mmr_constant[AV_DOVI_MAX_PIECES];
> +int64_t mmr_coef[AV_DOVI_MAX_PIECES][3/* order - 1 */][7];
> +} AVDOVIReshapingCurve;
> +
> +enum AVDOVINLQMethod {
> +AV_DOVI_NLQ_NONE = -1,
> +AV_DOVI_NLQ_LINEAR_DZ = 0,
> +};
> +
> +/**
> + * Coefficients of the non-linear inverse quantization. For the 
> interpretation
> + * of these, see ETSI GS CCM 001.
> + */
> +typedef struct AVDOVINLQParams {
> +uint16_t nlq_offset;
> +uint64_t vdr_in_max;
> +/* AV_DOVI_NLQ_LINEAR_DZ */
> +uint64_t linear_deadzone_slope;
> +uint64_t linear_deadzone_threshold;
> +} AVDOVINLQParams;
> +
> +/**
> + * Dolby Vis

[FFmpeg-devel] [PATCH v5 1/7] avcodec/v4l2_context: don't reinit output queue when dynamic resolution change

2022-01-04 Thread Ming Qian
in the v4l2 stateful video document, we can see the following
description:
During the resolution change sequence, the OUTPUT queue must remain
streaming. Calling VIDIOC_STREAMOFF() on the OUTPUT queue would
abort the sequence and initiate a seek.

In principle, the OUTPUT queue operates separately from the CAPTURE
queue and this remains true for the duration of the entire
resolution change sequence as well.

so don't reinit the output queue when handling the resolution change
event

Signed-off-by: Ming Qian 
---
 libavcodec/v4l2_context.c | 27 ++-
 1 file changed, 2 insertions(+), 25 deletions(-)

diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index ff1ea8e57b08..dda5157698c3 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -162,9 +162,8 @@ static int v4l2_handle_event(V4L2Context *ctx)
 {
 V4L2m2mContext *s = ctx_to_m2mctx(ctx);
 struct v4l2_format cap_fmt = s->capture.format;
-struct v4l2_format out_fmt = s->output.format;
 struct v4l2_event evt = { 0 };
-int full_reinit, reinit, ret;
+int reinit, ret;
 
 ret = ioctl(s->fd, VIDIOC_DQEVENT, &evt);
 if (ret < 0) {
@@ -180,25 +179,12 @@ static int v4l2_handle_event(V4L2Context *ctx)
 if (evt.type != V4L2_EVENT_SOURCE_CHANGE)
 return 0;
 
-ret = ioctl(s->fd, VIDIOC_G_FMT, &out_fmt);
-if (ret) {
-av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_G_FMT\n", s->output.name);
-return 0;
-}
-
 ret = ioctl(s->fd, VIDIOC_G_FMT, &cap_fmt);
 if (ret) {
 av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_G_FMT\n", 
s->capture.name);
 return 0;
 }
 
-full_reinit = v4l2_resolution_changed(&s->output, &out_fmt);
-if (full_reinit) {
-s->output.height = v4l2_get_height(&out_fmt);
-s->output.width = v4l2_get_width(&out_fmt);
-s->output.sample_aspect_ratio = v4l2_get_sar(&s->output);
-}
-
 reinit = v4l2_resolution_changed(&s->capture, &cap_fmt);
 if (reinit) {
 s->capture.height = v4l2_get_height(&cap_fmt);
@@ -206,18 +192,9 @@ static int v4l2_handle_event(V4L2Context *ctx)
 s->capture.sample_aspect_ratio = v4l2_get_sar(&s->capture);
 }
 
-if (full_reinit || reinit)
+if (reinit)
 s->reinit = 1;
 
-if (full_reinit) {
-ret = ff_v4l2_m2m_codec_full_reinit(s);
-if (ret) {
-av_log(logger(ctx), AV_LOG_ERROR, "v4l2_m2m_codec_full_reinit\n");
-return AVERROR(EINVAL);
-}
-goto reinit_run;
-}
-
 if (reinit) {
 if (s->avctx)
 ret = ff_set_dimensions(s->avctx, s->capture.width, 
s->capture.height);
-- 
2.33.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 v5 2/7] avcodec/v4l2_m2m: remove ff_v4l2_m2m_codec_full_reinit

2022-01-04 Thread Ming Qian
ff_v4l2_m2m_codec_full_reinit is not used any more,
so remove it.

Signed-off-by: Ming Qian 
---
 libavcodec/v4l2_m2m.c | 76 ---
 libavcodec/v4l2_m2m.h | 10 --
 2 files changed, 86 deletions(-)

diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c
index cdfd579810f2..a0ee5a201360 100644
--- a/libavcodec/v4l2_m2m.c
+++ b/libavcodec/v4l2_m2m.c
@@ -245,82 +245,6 @@ int ff_v4l2_m2m_codec_reinit(V4L2m2mContext *s)
 return 0;
 }
 
-int ff_v4l2_m2m_codec_full_reinit(V4L2m2mContext *s)
-{
-void *log_ctx = s->avctx;
-int ret;
-
-av_log(log_ctx, AV_LOG_DEBUG, "%s full reinit\n", s->devname);
-
-/* wait for pending buffer references */
-if (atomic_load(&s->refcount))
-while(sem_wait(&s->refsync) == -1 && errno == EINTR);
-
-ret = ff_v4l2_context_set_status(&s->output, VIDIOC_STREAMOFF);
-if (ret) {
-av_log(log_ctx, AV_LOG_ERROR, "output VIDIOC_STREAMOFF\n");
-goto error;
-}
-
-ret = ff_v4l2_context_set_status(&s->capture, VIDIOC_STREAMOFF);
-if (ret) {
-av_log(log_ctx, AV_LOG_ERROR, "capture VIDIOC_STREAMOFF\n");
-goto error;
-}
-
-/* release and unmmap the buffers */
-ff_v4l2_context_release(&s->output);
-ff_v4l2_context_release(&s->capture);
-
-/* start again now that we know the stream dimensions */
-s->draining = 0;
-s->reinit = 0;
-
-ret = ff_v4l2_context_get_format(&s->output, 0);
-if (ret) {
-av_log(log_ctx, AV_LOG_DEBUG, "v4l2 output format not supported\n");
-goto error;
-}
-
-ret = ff_v4l2_context_get_format(&s->capture, 0);
-if (ret) {
-av_log(log_ctx, AV_LOG_DEBUG, "v4l2 capture format not supported\n");
-goto error;
-}
-
-ret = ff_v4l2_context_set_format(&s->output);
-if (ret) {
-av_log(log_ctx, AV_LOG_ERROR, "can't set v4l2 output format\n");
-goto error;
-}
-
-ret = ff_v4l2_context_set_format(&s->capture);
-if (ret) {
-av_log(log_ctx, AV_LOG_ERROR, "can't to set v4l2 capture format\n");
-goto error;
-}
-
-ret = ff_v4l2_context_init(&s->output);
-if (ret) {
-av_log(log_ctx, AV_LOG_ERROR, "no v4l2 output context's buffers\n");
-goto error;
-}
-
-/* decoder's buffers need to be updated at a later stage */
-if (s->avctx && !av_codec_is_decoder(s->avctx->codec)) {
-ret = ff_v4l2_context_init(&s->capture);
-if (ret) {
-av_log(log_ctx, AV_LOG_ERROR, "no v4l2 capture context's 
buffers\n");
-goto error;
-}
-}
-
-return 0;
-
-error:
-return ret;
-}
-
 static void v4l2_m2m_destroy_context(void *opaque, uint8_t *context)
 {
 V4L2m2mContext *s = (V4L2m2mContext*)context;
diff --git a/libavcodec/v4l2_m2m.h b/libavcodec/v4l2_m2m.h
index b67b21633109..16e0a6d6b90f 100644
--- a/libavcodec/v4l2_m2m.h
+++ b/libavcodec/v4l2_m2m.h
@@ -119,14 +119,4 @@ int ff_v4l2_m2m_codec_end(V4L2m2mPriv *priv);
  */
 int ff_v4l2_m2m_codec_reinit(V4L2m2mContext *ctx);
 
-/**
- * Reinitializes the V4L2m2mContext when the driver cannot continue processing
- * with the  any of the current V4L2Contexts (ie, changes in output and 
capture).
- *
- * @param[in] ctx The V4L2m2mContext instantiated by the encoder/decoder.
- *
- * @returns 0 in case of success, negative number otherwise
- */
-int ff_v4l2_m2m_codec_full_reinit(V4L2m2mContext *ctx);
-
 #endif /* AVCODEC_V4L2_M2M_H */
-- 
2.33.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 v5 6/7] avcodec/v4l2_context: sync v4l2 context status with driver.

2022-01-04 Thread Ming Qian
Check v4l2 context before call VIDIOC_STREAMON() or
VIDIOC_STREAMOFF().

Signed-off-by: Ming Qian 
---
 libavcodec/v4l2_context.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index b7b584dfbef6..8910ae08d3a5 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -562,6 +562,9 @@ int ff_v4l2_context_set_status(V4L2Context* ctx, uint32_t 
cmd)
 int type = ctx->type;
 int ret;
 
+if (ctx->streamon == (cmd == VIDIOC_STREAMON))
+return 0;
+
 ret = ioctl(ctx_to_m2mctx(ctx)->fd, cmd, &type);
 if (ret < 0)
 return AVERROR(errno);
-- 
2.33.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 v5 3/7] avcodec/v4l2_context: add v4l2_start_decode

2022-01-04 Thread Ming Qian
on dynamic resolution change,
The decoding process must be resumed with either a pair of calls to
VIDIOC_STREAMOFF() and VIDIOC_STREAMON() on the CAPTURE queue, or a call
to VIDIOC_DECODER_CMD() with the V4L2_DEC_CMD_START command.

Signed-off-by: Ming Qian 
---
 libavcodec/v4l2_context.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index dda5157698c3..a181f884d2a6 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -153,6 +153,21 @@ static inline void v4l2_save_to_context(V4L2Context* ctx, 
struct v4l2_format_upd
 }
 }
 
+static int v4l2_start_decode(V4L2Context *ctx)
+{
+struct v4l2_decoder_cmd cmd = {
+.cmd = V4L2_DEC_CMD_START,
+.flags = 0,
+};
+int ret;
+
+ret = ioctl(ctx_to_m2mctx(ctx)->fd, VIDIOC_DECODER_CMD, &cmd);
+if (ret)
+return AVERROR(errno);
+
+return 0;
+}
+
 /**
  * handle resolution change event and end of stream event
  * returns 1 if reinit was successful, negative if it failed
@@ -190,6 +205,9 @@ static int v4l2_handle_event(V4L2Context *ctx)
 s->capture.height = v4l2_get_height(&cap_fmt);
 s->capture.width = v4l2_get_width(&cap_fmt);
 s->capture.sample_aspect_ratio = v4l2_get_sar(&s->capture);
+} else {
+v4l2_start_decode(ctx);
+return 0;
 }
 
 if (reinit)
-- 
2.33.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 v5 7/7] avcodec/v4l2_m2m_dec: setup capture queue before enqueue the first frame

2022-01-04 Thread Ming Qian
there are two proper ways to setup capture queue.
1. client wait the source change event,
   then setup the capture queue and streamon
2. client setup the capture queue in advance,
   but to avoid time issues, client should start
   the capture queue before it enqueue the sequence
   header to decoder driver through output queue.
   and the sequence header is always in the first
   frame, so client should start capture before
   enqueue the first frame.

ffmpeg use the method 2 to setup capture queue,
but currently ffmpeg enqueue the first frame
before starting the capture queue.
so in driver side, there are time issues.
when driver has parsed the resolution from sequence header,
but the client may not finished setup the capture.
so driver can't decide whether to notify a source change event to
client. and the following flow may be chaotic.

And it's OK that client setup capture queue first, then enqueue the
first frame.

Signed-off-by: Ming Qian 
---
 libavcodec/v4l2_m2m_dec.c | 18 --
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index b0c3d30ac8ae..e67758531ace 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -153,6 +153,14 @@ static int v4l2_receive_frame(AVCodecContext *avctx, 
AVFrame *frame)
 if (s->draining)
 goto dequeue;
 
+ret = v4l2_try_start(avctx);
+if (ret) {
+/* can't recover */
+if (ret != AVERROR(ENOMEM))
+ret = 0;
+goto fail;
+}
+
 ret = ff_v4l2_context_enqueue_packet(output, &s->buf_pkt);
 if (ret < 0 && ret != AVERROR(EAGAIN))
 goto fail;
@@ -161,16 +169,6 @@ static int v4l2_receive_frame(AVCodecContext *avctx, 
AVFrame *frame)
 if (ret != AVERROR(EAGAIN))
 av_packet_unref(&s->buf_pkt);
 
-if (!s->draining) {
-ret = v4l2_try_start(avctx);
-if (ret) {
-/* cant recover */
-if (ret != AVERROR(ENOMEM))
-ret = 0;
-goto fail;
-}
-}
-
 dequeue:
 return ff_v4l2_context_dequeue_frame(capture, frame, -1);
 fail:
-- 
2.33.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 v5 4/7] avcodec/v4l2_context: set resolution change if decoded format changed

2022-01-04 Thread Ming Qian
The dynamic resoltuion change occurs when he decoder detects a coded
frame with one or more of the following parameters different from those
previously established (and reflected by corresponding queries):
1. coded resolution (OUTPUT width and height)
2. visible resolution (selection rectangles)
3. the minimum number of buffers needed for decoding
4. bit-depth of the bitstream has been changed

when the bit-depth is changed, the pixel format will be changed,
so the format is changed after a source change event,
we should handle it and reinit the capture queue.

Signed-off-by: Ming Qian 
---
 libavcodec/v4l2_context.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index a181f884d2a6..0a0f5b226960 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -85,9 +85,11 @@ static inline unsigned int 
v4l2_resolution_changed(V4L2Context *ctx, struct v4l2
 {
 struct v4l2_format *fmt1 = &ctx->format;
 int ret =  V4L2_TYPE_IS_MULTIPLANAR(ctx->type) ?
+fmt1->fmt.pix_mp.pixelformat != fmt2->fmt.pix_mp.pixelformat ||
 fmt1->fmt.pix_mp.width != fmt2->fmt.pix_mp.width ||
 fmt1->fmt.pix_mp.height != fmt2->fmt.pix_mp.height
 :
+fmt1->fmt.pix.pixelformat != fmt2->fmt.pix.pixelformat ||
 fmt1->fmt.pix.width != fmt2->fmt.pix.width ||
 fmt1->fmt.pix.height != fmt2->fmt.pix.height;
 
-- 
2.33.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 v5 5/7] avcodec/v4l2_context: resume the decoding process after source change event received.

2022-01-04 Thread Ming Qian
client need to resume the decoding process
after it dequeues the source change event.
no matter what's the return value of v4l2_resolution_changed().
if the client doesn't resume the decoding process,
the decoder may keep waiting

in documentation of v4l2 stateful decoder, we can see the following
description:
The client must continue the sequence as described below to
continue the decoding process.
1.  Dequeue the source change event.
Important
A source change triggers an implicit decoder drain,
similar to the explicit Drain sequence. The decoder is
stopped after it completes. The decoding process must be
resumed with either a pair of calls to
VIDIOC_STREAMOFF() and VIDIOC_STREAMON() on the CAPTURE
queue, or a call to VIDIOC_DECODER_CMD() with the
V4L2_DEC_CMD_START command.
2.  Continue with the Capture Setup sequence.

Signed-off-by: Ming Qian 
---
 libavcodec/v4l2_context.c | 31 +++
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index 0a0f5b226960..b7b584dfbef6 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -180,7 +180,7 @@ static int v4l2_handle_event(V4L2Context *ctx)
 V4L2m2mContext *s = ctx_to_m2mctx(ctx);
 struct v4l2_format cap_fmt = s->capture.format;
 struct v4l2_event evt = { 0 };
-int reinit, ret;
+int ret;
 
 ret = ioctl(s->fd, VIDIOC_DQEVENT, &evt);
 if (ret < 0) {
@@ -202,8 +202,7 @@ static int v4l2_handle_event(V4L2Context *ctx)
 return 0;
 }
 
-reinit = v4l2_resolution_changed(&s->capture, &cap_fmt);
-if (reinit) {
+if (v4l2_resolution_changed(&s->capture, &cap_fmt)) {
 s->capture.height = v4l2_get_height(&cap_fmt);
 s->capture.width = v4l2_get_width(&cap_fmt);
 s->capture.sample_aspect_ratio = v4l2_get_sar(&s->capture);
@@ -212,28 +211,20 @@ static int v4l2_handle_event(V4L2Context *ctx)
 return 0;
 }
 
-if (reinit)
-s->reinit = 1;
+s->reinit = 1;
 
-if (reinit) {
-if (s->avctx)
-ret = ff_set_dimensions(s->avctx, s->capture.width, 
s->capture.height);
-if (ret < 0)
-av_log(logger(ctx), AV_LOG_WARNING, "update avcodec height and 
width\n");
+if (s->avctx)
+ret = ff_set_dimensions(s->avctx, s->capture.width, s->capture.height);
+if (ret < 0)
+av_log(logger(ctx), AV_LOG_WARNING, "update avcodec height and 
width\n");
 
-ret = ff_v4l2_m2m_codec_reinit(s);
-if (ret) {
-av_log(logger(ctx), AV_LOG_ERROR, "v4l2_m2m_codec_reinit\n");
-return AVERROR(EINVAL);
-}
-goto reinit_run;
+ret = ff_v4l2_m2m_codec_reinit(s);
+if (ret) {
+av_log(logger(ctx), AV_LOG_ERROR, "v4l2_m2m_codec_reinit\n");
+return AVERROR(EINVAL);
 }
 
-/* dummy event received */
-return 0;
-
 /* reinit executed */
-reinit_run:
 return 1;
 }
 
-- 
2.33.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 v10 4/6] lavc: Implement Dolby Vision RPU parsing

2022-01-04 Thread Andreas Rheinhardt
Niklas Haas:
> From: Niklas Haas 
> 
> Based on a mixture of guesswork, partial documentation in patents, and
> reverse engineering of real-world samples. Confirmed working for all the
> samples I've thrown at it.
> 
> Contains some annoying machinery to persist these values in between
> frames, which is needed in theory even though I've never actually seen a
> sample that relies on it in practice. May or may not work.
> 
> Since the distinction matters greatly for parsing the color matrix
> values, this includes a small helper function to guess the right profile
> from the RPU itself in case the user has forgotten to forward the dovi
> configuration record to the decoder. (Which in practice, only ffmpeg.c
> and ffplay do..)
> 
> Notable omissions / deviations:
> - CRC32 verification. This is based on the MPEG2 CRC32 type, which is
>   similar to IEEE CRC32 but apparently different in subtle enough ways
>   that I could not get it to pass verification no matter what parameters
>   I fed to av_crc. It's possible the code needs some changes.
> - Linear interpolation support. Nothing documents this (beyond its
>   existence) and no samples use it, so impossible to implement.
> - All of the extension metadata blocks, but these contain values that
>   seem largely congruent with ST2094, HDR10, or other existing forms of
>   side data, so I will defer parsing/attaching them to a future commit.
> - The patent describes a mechanism for predicting coefficients from
>   previous RPUs, but the bit for the flag whether to use the
>   prediction deltas or signal entirely new coefficients does not seem to
>   be present in actual RPUs, so we ignore this subsystem entirely.
> - In the patent's spec, the NLQ subsystem also loops over
>   num_nlq_pivots, but even in the patent the number is hard-coded to one
>   iteration rather than signalled. So we only store one set of coefs.
> 
> Heavily influenced by https://github.com/quietvoid/dovi_tool
> Documentation drawn from US Patent 10,701,399 B2 and ETSI GS CCM 001
> 
> Signed-off-by: Niklas Haas 
> ---
>  configure |   2 +
>  libavcodec/Makefile   |   1 +
>  libavcodec/dovi_rpu.c | 449 ++
>  libavcodec/dovi_rpu.h |  87 
>  4 files changed, 539 insertions(+)
>  create mode 100644 libavcodec/dovi_rpu.c
>  create mode 100644 libavcodec/dovi_rpu.h
> 
> diff --git a/configure b/configure
> index 6ad70b9f7b..8303e1329e 100755
> --- a/configure
> +++ b/configure
> @@ -2434,6 +2434,7 @@ CONFIG_EXTRA="
>  cbs_vp9
>  dirac_parse
>  dnn
> +dovi_rpu
>  dvprofile
>  exif
>  faandct
> @@ -2706,6 +2707,7 @@ cbs_mpeg2_select="cbs"
>  cbs_vp9_select="cbs"
>  dct_select="rdft"
>  dirac_parse_select="golomb"
> +dovi_rpu_select="golomb"
>  dnn_suggest="libtensorflow libopenvino"
>  dnn_deps="avformat swscale"
>  error_resilience_select="me_cmp"
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 9577062eec..ceecdf05e1 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -77,6 +77,7 @@ OBJS-$(CONFIG_CBS_MPEG2)   += cbs_mpeg2.o
>  OBJS-$(CONFIG_CBS_VP9) += cbs_vp9.o
>  OBJS-$(CONFIG_CRYSTALHD)   += crystalhd.o
>  OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o
> +OBJS-$(CONFIG_DOVI_RPU)+= dovi_rpu.o
>  OBJS-$(CONFIG_ERROR_RESILIENCE)+= error_resilience.o
>  OBJS-$(CONFIG_EXIF)+= exif.o tiff_common.o
>  OBJS-$(CONFIG_FAANDCT) += faandct.o
> diff --git a/libavcodec/dovi_rpu.c b/libavcodec/dovi_rpu.c
> new file mode 100644
> index 00..a87562c8a3
> --- /dev/null
> +++ b/libavcodec/dovi_rpu.c
> @@ -0,0 +1,449 @@
> +/*
> + * Dolby Vision RPU decoder
> + *
> + * Copyright (C) 2021 Jan Ekström
> + * Copyright (C) 2021 Niklas Haas
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +#include "libavutil/buffer.h"
> +
> +#include "dovi_rpu.h"
> +#include "golomb.h"
> +#include "get_bits.h"
> +
> +enum {
> +RPU_COEFF_FIXED = 0,
> +RPU_COEFF_FLOAT = 1,
> +};
> +
> +/**
> + * Private contents of vdr_ref.
> + */
> +typedef struct DOVIVdrRef {
> +AVDOVIDataMapping mapping;
> +AVDOVIColorMetad

Re: [FFmpeg-devel] [PATCH v10 6/6] lavc/hevcdec: Parse DOVI RPU NALs

2022-01-04 Thread Andreas Rheinhardt
Niklas Haas:
> From: Niklas Haas 
> 
> And expose the parsed values as frame side data. Update FATE results to
> match.
> 
> It's worth documenting that this relies on the dovi configuration record
> being present on the first AVPacket fed to the decoder, which in
> practice is the case if if the API user has called something like
> av_format_inject_global_side_data, which is unfortunately not the
> default.
> 
> This commit is not the time and place to change that behavior, though.
> 
> Signed-off-by: Niklas Haas 
> ---
>  configure  |   2 +-
>  libavcodec/hevcdec.c   |  37 --
>  libavcodec/hevcdec.h   |   2 +
>  tests/ref/fate/hevc-dv-rpu | 224 +
>  4 files changed, 256 insertions(+), 9 deletions(-)
> 
> diff --git a/configure b/configure
> index 8303e1329e..3f71af77db 100755
> --- a/configure
> +++ b/configure
> @@ -2826,7 +2826,7 @@ h264_decoder_suggest="error_resilience"
>  hap_decoder_select="snappy texturedsp"
>  hap_encoder_deps="libsnappy"
>  hap_encoder_select="texturedspenc"
> -hevc_decoder_select="atsc_a53 bswapdsp cabac golomb hevcparse videodsp"
> +hevc_decoder_select="atsc_a53 bswapdsp cabac dovi_rpu golomb hevcparse 
> videodsp"
>  huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp"
>  huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp"
>  hymt_decoder_select="huffyuv_decoder"
> diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
> index 3aa70e2245..8d7a4f7147 100644
> --- a/libavcodec/hevcdec.c
> +++ b/libavcodec/hevcdec.c
> @@ -2723,6 +2723,7 @@ error:
>  static int set_side_data(HEVCContext *s)
>  {
>  AVFrame *out = s->ref->frame;
> +int ret;
>  
>  if (s->sei.frame_packing.present &&
>  s->sei.frame_packing.arrangement_type >= 3 &&
> @@ -2977,6 +2978,9 @@ static int set_side_data(HEVCContext *s)
>  s->rpu_buf = NULL;
>  }
>  
> +if ((ret = ff_dovi_attach_side_data(&s->dovi_ctx, out)) < 0)
> +return ret;
> +
>  return 0;
>  }
>  
> @@ -3308,16 +3312,23 @@ static int decode_nal_units(HEVCContext *s, const 
> uint8_t *buf, int length)
>  if (s->pkt.nb_nals > 1 && s->pkt.nals[s->pkt.nb_nals - 1].type == 
> HEVC_NAL_UNSPEC62 &&
>  s->pkt.nals[s->pkt.nb_nals - 1].size > 2 && 
> !s->pkt.nals[s->pkt.nb_nals - 1].nuh_layer_id
>  && !s->pkt.nals[s->pkt.nb_nals - 1].temporal_id) {
> +H2645NAL *nal = &s->pkt.nals[s->pkt.nb_nals - 1];
>  if (s->rpu_buf) {
>  av_buffer_unref(&s->rpu_buf);
>  av_log(s->avctx, AV_LOG_WARNING, "Multiple Dolby Vision RPUs 
> found in one AU. Skipping previous.\n");
>  }
>  
> -s->rpu_buf = av_buffer_alloc(s->pkt.nals[s->pkt.nb_nals - 
> 1].raw_size - 2);
> +s->rpu_buf = av_buffer_alloc(nal->raw_size - 2);
>  if (!s->rpu_buf)
>  return AVERROR(ENOMEM);
> +memcpy(s->rpu_buf->data, nal->raw_data + 2, nal->raw_size - 2);
>  
> -memcpy(s->rpu_buf->data, s->pkt.nals[s->pkt.nb_nals - 1].raw_data + 
> 2, s->pkt.nals[s->pkt.nb_nals - 1].raw_size - 2);
> +ret = ff_dovi_rpu_parse(&s->dovi_ctx, nal->data + 2, nal->size - 2);
> +if (ret < 0) {
> +av_buffer_unref(&s->rpu_buf);
> +av_log(s->avctx, AV_LOG_WARNING, "Error parsing DOVI NAL 
> unit.\n");
> +/* ignore */
> +}
>  }
>  
>  /* decode the NAL units */
> @@ -3450,8 +3461,8 @@ static int hevc_decode_frame(AVCodecContext *avctx, 
> void *data, int *got_output,
>   AVPacket *avpkt)
>  {
>  int ret;
> -size_t new_extradata_size;
> -uint8_t *new_extradata;
> +uint8_t *sd;
> +size_t sd_size;
>  HEVCContext *s = avctx->priv_data;
>  
>  if (!avpkt->size) {
> @@ -3463,14 +3474,17 @@ static int hevc_decode_frame(AVCodecContext *avctx, 
> void *data, int *got_output,
>  return 0;
>  }
>  
> -new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,
> -&new_extradata_size);
> -if (new_extradata && new_extradata_size > 0) {
> -ret = hevc_decode_extradata(s, new_extradata, new_extradata_size, 0);
> +sd = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &sd_size);
> +if (sd && sd_size > 0) {
> +ret = hevc_decode_extradata(s, sd, sd_size, 0);
>  if (ret < 0)
>  return ret;
>  }
>  
> +sd = av_packet_get_side_data(avpkt, AV_PKT_DATA_DOVI_CONF, &sd_size);
> +if (sd && sd_size > 0)
> +ff_dovi_update_cfg(&s->dovi_ctx, (AVDOVIDecoderConfigurationRecord 
> *) sd);

Looks good (and so much simpler than the earlier version).

> +
>  s->ref = NULL;
>  ret= decode_nal_units(s, avpkt->data, avpkt->size);
>  if (ret < 0)
> @@ -3563,6 +3577,7 @@ static av_cold int hevc_decode_free(AVCodecContext 
> *avctx)
>  
>  pic_arrays_free(s);
>  
> +ff_dovi_ctx_unref(&s->dovi_ctx);
>  av_buffer_unref(&s->rpu_buf);
>

[FFmpeg-devel] [PATCH] avformat/tests/imf: Don't use uninitialized value

2022-01-04 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
I'll apply this pretty soon.

 libavformat/tests/imf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/tests/imf.c b/libavformat/tests/imf.c
index 68e4c8b6af..142aa04261 100644
--- a/libavformat/tests/imf.c
+++ b/libavformat/tests/imf.c
@@ -347,7 +347,7 @@ static int test_bad_cpl_parsing(void)
 doc = xmlReadMemory(cpl_bad_doc, strlen(cpl_bad_doc), NULL, NULL, 0);
 if (doc == NULL) {
 printf("XML parsing failed.\n");
-return ret;
+return 1;
 }
 
 ret = ff_imf_parse_cpl_from_xml_dom(doc, &cpl);
-- 
2.32.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] doc/encoders.texi Add doc for qsv

2022-01-04 Thread Wenbin Chen
Add doc for qsv decoder.
Add more option's introduction to qsv encoder.

Signed-off-by: Wenbin Chen 
---
 doc/decoders.texi |  42 
 doc/encoders.texi | 253 +-
 2 files changed, 292 insertions(+), 3 deletions(-)

diff --git a/doc/decoders.texi b/doc/decoders.texi
index 49ab735dce..de2429abba 100644
--- a/doc/decoders.texi
+++ b/doc/decoders.texi
@@ -126,6 +126,48 @@ Set amount of frame threads to use during decoding. The 
default value is 0 (auto
 
 @end table
 
+@section QSV Decoders
+
+The family of Intel QuickSync Video decoders (VC1, MPEG-2, H.264, HEVC,
+JPEG/MJPEG, VP8, VP9, AV1).
+
+@subsection Common Options
+
+The following options are supported by all qsv decoders.
+
+@table @option
+
+@item @var{async_depth}
+Internal parallelization depth, the higher the value the higher the latency.
+
+@item @var{gpu_copy}
+A GPU-accelerated copy between video and system memory
+@table @samp
+@item default
+@item on
+@item off
+@end table
+
+@end table
+
+@subsection HEVC Options
+Extra options for hevc_qsv.
+
+@table @option
+
+@item @var{load_plugin}
+A user plugin to load in an internal session
+@table @samp
+@item none
+@item hevc_sw
+@item hevc_hw
+@end table
+
+@item @var{load_plugins}
+A :-separate list of hexadecimal plugin UIDs to load in an internal session
+
+@end table
+
 @c man end VIDEO DECODERS
 
 @chapter Audio Decoders
diff --git a/doc/encoders.texi b/doc/encoders.texi
index e3b61de5a1..7cc8be1209 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -3123,12 +3123,13 @@ Setting a higher @option{bits_per_mb} limit will 
improve the speed.
 For the fastest encoding speed set the @option{qscale} parameter (4 is the
 recommended value) and do not set a size constraint.
 
-@section QSV encoders
+@section QSV Encoders
 
-The family of Intel QuickSync Video encoders (MPEG-2, H.264, HEVC, JPEG/MJPEG 
and VP9)
+The family of Intel QuickSync Video encoders (MPEG-2, H.264, HEVC, JPEG/MJPEG
+and VP9)
 
+@subsection Ratecontrol Method
 The ratecontrol method is selected as follows:
-
 @itemize @bullet
 @item
 When @option{global_quality} is specified, a quality-based mode is used.
@@ -3176,6 +3177,7 @@ Note that depending on your system, a different mode than 
the one you specified
 may be selected by the encoder. Set the verbosity level to @var{verbose} or
 higher to see the actual settings used by the QSV runtime.
 
+@subsection Global Options -> MSDK Options
 Additional libavcodec global options are mapped to MSDK options as follows:
 
 @itemize
@@ -3212,6 +3214,251 @@ encoder use CAVLC instead of CABAC.
 
 @end itemize
 
+@subsection Common Options
+Following options are used by all qsv encoders.
+
+@table @option
+@item @var{async_depth}
+Specifies how many asynchronous operations an application performs
+before the application explicitly synchronizes the result. If zero,
+the value is not specified.
+
+@item @var{avbr_accuracy}
+Accuracy of the AVBR ratecontrol (unit of tenth of percent).
+
+@item @var{avbr_convergence}
+Convergence of the AVBR ratecontrol (unit of 100 frames)
+
+The parameters @var{avbr_accuracy} and @var{avbr_convergence} are for the
+average variable bitrate control (AVBR) algorithm.
+The algorithm focuses on overall encoding quality while meeting the specified
+bitrate, @var{target_bitrate}, within the accuracy range @var{avbr_accuracy},
+after a @var{avbr_Convergence} period. This method does not follow HRD and the
+instant bitrate is not capped or padded.
+
+@item @var{preset}
+This option itemizes a range of choices from veryfast (best speed) to veryslow
+(best quality).
+@table @samp
+@item veryfast
+@item faster
+@item fast
+@item medium
+@item slow
+@item slower
+@item veryslow
+@end table
+
+@item @var{forced_idr}
+Forcing I frames as IDR frames.
+
+@item @var{low_power}
+For encoders set this flag to ON to reduce power consumption and GPU usage.
+@end table
+
+@subsection H264 options
+These options are used by h264_qsv
+
+@table @option
+@item @var{extbrc}
+Extended bitrate control.
+
+@item @var{recovery_point_sei}
+Set this flag to insert the recovery point SEI message at the beginning of 
every
+intra refresh cycle.
+
+@item @var{rdo}
+Enable rate distortion optimization.
+
+@item @var{max_frame_size}
+Maximum encoded frame size in bytes.
+
+@item @var{max_slice_size}
+Maximum encoded slice size in bytes.
+
+@item @var{bitrate_limit}
+Toggle bitrate limitations.
+Modifies bitrate to be in the range imposed by the QSV encoder. Setting this
+flag off may lead to violation of HRD conformance. Mind that specifying bitrate
+below the QSV encoder range might significantly affect quality. If on this
+option takes effect in non CQP modes: if bitrate is not in the range imposed
+by the QSV encoder, it will be changed to be in the range.
+
+@item @var{mbbrc}
+Setting this flag enables macroblock level bitrate control that generally
+improves subjective visual quality. Enabling this flag may have negative impact
+on perform

Re: [FFmpeg-devel] [PATCH] avformat/tests/imf: Don't use uninitialized value

2022-01-04 Thread Zane van Iperen




On 4/1/22 19:25, Andreas Rheinhardt wrote:

Signed-off-by: Andreas Rheinhardt 
---
I'll apply this pretty soon.


lgtm, Please do.

___
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 6/6] lavc/aarch64: add hevc sao band 8x8 tiling

2022-01-04 Thread Martin Storsjö

On Tue, 4 Jan 2022, J. Dekker wrote:


--bench on AWS Graviton:

hevc_sao_band_8x8_8_c: 317.5
hevc_sao_band_8x8_8_neon: 97.5
hevc_sao_band_16x16_8_c: 1115.0
hevc_sao_band_16x16_8_neon: 322.7
hevc_sao_band_32x32_8_c: 4599.2
hevc_sao_band_32x32_8_neon: 1246.2
hevc_sao_band_48x48_8_c: 10021.7
hevc_sao_band_48x48_8_neon: 2740.5
hevc_sao_band_64x64_8_c: 17635.0
hevc_sao_band_64x64_8_neon: 4875.7

Signed-off-by: J. Dekker 
---
libavcodec/aarch64/hevcdsp_init_aarch64.c |  6 +-
libavcodec/aarch64/hevcdsp_sao_neon.S | 11 +++
2 files changed, 12 insertions(+), 5 deletions(-)


LGTM, please push.

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


[FFmpeg-devel] [PATCH] avcodec/videotoolbox: Fix undefined symbol with minimal configuration

2022-01-04 Thread lance . lmwang
From: Limin Wang 

Please reproduced with the following minimal configure command:
./configure --enable-shared --disable-all --enable-avcodec 
--enable-decoder=h264 --enable-hwaccel=h264_videotoolbox

You'll get below error:

Undefined symbols for architecture x86_64:
  "_ff_videotoolbox_vpcc_extradata_create", referenced from:
  _videotoolbox_start in videotoolbox.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Reported-by: Cameron Gutman 
Signed-off-by: Limin Wang 
---
 libavcodec/videotoolbox.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 69beb38..51d4eac 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -825,11 +825,13 @@ static CFDictionaryRef 
videotoolbox_decoder_config_create(CMVideoCodecType codec
 if (data)
 CFDictionarySetValue(avc_info, CFSTR("hvcC"), data);
 break;
+#if CONFIG_VP9_VIDEOTOOLBOX_HWACCEL
 case kCMVideoCodecType_VP9 :
 data = ff_videotoolbox_vpcc_extradata_create(avctx);
 if (data)
 CFDictionarySetValue(avc_info, CFSTR("vpcC"), data);
 break;
+#endif
 default:
 break;
 }
-- 
1.8.3.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] Build break: VideoToolbox VP9 support breaks H.264-only build

2022-01-04 Thread lance . lmwang
On Mon, Jan 03, 2022 at 01:18:34PM -0600, Cameron Gutman wrote:
> I am building minimal ffmpeg libraries for my application using the following
> configure command:
> 
> ./configure --enable-shared --disable-all --enable-avcodec 
> --enable-decoder=h264 --enable-hwaccel=h264_videotoolbox
> 
> libavcodec.dylib now fails to link after the following commit:
> 
> commit a41a2efc85f8c88caec10040ee437562f9d0b947
> Author: rcombs 
> Date:   Sat Nov 13 02:43:06 2021 -0600
> 
> lavc/videotoolbox: add VP9 hardware acceleration
> 
> On M1 Max, this supports profiles 0 and 2, but not 1 and 3.
> 
> 
> The error is:
> 
> Undefined symbols for architecture x86_64:
>   "_ff_videotoolbox_vpcc_extradata_create", referenced from:
>   _videotoolbox_start in videotoolbox.o
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see 
> invocation)
> make: *** [libavcodec/libavcodec.59.dylib] Error 1
> 
> 
> Perhaps ff_videotoolbox_vpcc_extradata_create() needs to go in videotoolbox.c
> like the other ff_videotoolbox_*_extradata_create() functions?

I submit one patch for the error. If we move the function to videotoolbox.c, 
it's necessary to 
include vp9shared.h which will caused redefinitions of IntraPredMode with 
hevcdec.h.

> 
> 
> 
> Regards,
> Cam
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

-- 
Thanks,
Limin Wang
___
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 0/5] avdevice/dshow fixups

2022-01-04 Thread Diederick C. Niehorster
On Tue, Jan 4, 2022 at 5:10 AM Gyan Doshi  wrote:
> On 2022-01-04 05:02 am, Roger Pack wrote:
> > These LGTM.  Feel free to add yourself as a dshow maintainer if so
> > interested, as well! :)
>
> I assume these need to be pushed too.

Yes thanks, please push. Would be good to get in before the release
branch, fixing the regressions.

Thanks!
Dee
___
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 0/5] avdevice/dshow fixups

2022-01-04 Thread Gyan Doshi




On 2022-01-04 04:06 pm, Diederick C. Niehorster wrote:

On Tue, Jan 4, 2022 at 5:10 AM Gyan Doshi  wrote:

On 2022-01-04 05:02 am, Roger Pack wrote:

These LGTM.  Feel free to add yourself as a dshow maintainer if so
interested, as well! :)

I assume these need to be pushed too.

Yes thanks, please push. Would be good to get in before the release
branch, fixing the regressions.


Too late for that. But I will backport to 5.0

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 v3 6/6] lavc/aarch64: add hevc sao band 8x8 tiling

2022-01-04 Thread J. Dekker
On 4 Jan 2022, at 10:41, Martin Storsjö wrote:

> On Tue, 4 Jan 2022, J. Dekker wrote:
>
> [...]
>
> LGTM, please push.
>
> // Martin
>

Thanks, pushed.

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

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


[FFmpeg-devel] [PATCH 1/2] lavfi/libplacebo: apply dovi metadata correctly

2022-01-04 Thread Niklas Haas
From: Niklas Haas 

libplacebo supports dolby vision application, but it requires some help
from us to set a sensible default output color space, and also strip the
dolby vision metadata from the output frame. Failing to do the latter
results in an error inside libplacebo. (It can't encode back into a
dolby vision color space)

Make this functionality toggleable by the user. Note that we also strip
dovi metadata from the output in the apply_dolbyvision=0 case, which is
partly out of laziness but also partly justified by the fact that dolby
vision metadata will generally no longer make sense after passing
through a color space conversion or tone mapping filter. (And in the
general case, we don't know what libplacebo is doing internally)

Signed-off-by: Niklas Haas 
---
 libavfilter/vf_libplacebo.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index 5b1e7b5285..e479d6c935 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -47,6 +47,7 @@ typedef struct LibplaceboContext {
 int force_divisible_by;
 int normalize_sar;
 int apply_filmgrain;
+int apply_dovi;
 int colorspace;
 int color_range;
 int color_primaries;
@@ -400,6 +401,22 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
 out->width = outlink->w;
 out->height = outlink->h;
 
+#if PL_API_VER >= 191
+/* libplacebo cannot (currently) encode back to Dolby Vision */
+av_frame_remove_side_data(out, AV_FRAME_DATA_DOVI_RPU_BUFFER);
+av_frame_remove_side_data(out, AV_FRAME_DATA_DOVI_METADATA);
+if (s->apply_dovi && av_frame_get_side_data(in, 
AV_FRAME_DATA_DOVI_METADATA)) {
+/* Output of dovi reshaping is always BT.2020+PQ, so infer the correct
+ * output colorspace defaults */
+out->colorspace = AVCOL_SPC_BT2020_NCL;
+out->color_primaries = AVCOL_PRI_BT2020;
+out->color_trc = AVCOL_TRC_SMPTE2084;
+} else {
+/* Prevent Dolby Vision metadata from getting applied by libplacebo */
+av_frame_remove_side_data(in, AV_FRAME_DATA_DOVI_METADATA);
+}
+#endif
+
 if (s->colorspace >= 0)
 out->colorspace = s->colorspace;
 if (s->color_range >= 0)
@@ -559,6 +576,7 @@ static const AVOption libplacebo_options[] = {
 { "antiringing", "Antiringing strength (for non-EWA filters)", 
OFFSET(antiringing), AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, 0.0, 1.0, DYNAMIC },
 { "sigmoid", "Enable sigmoid upscaling", OFFSET(sigmoid), 
AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DYNAMIC },
 { "apply_filmgrain", "Apply film grain metadata", OFFSET(apply_filmgrain), 
AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DYNAMIC },
+{ "apply_dolbyvision", "Apply Dolby Vision metadata", OFFSET(apply_dovi), 
AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DYNAMIC },
 
 { "deband", "Enable debanding", OFFSET(deband), AV_OPT_TYPE_BOOL, {.i64 = 
0}, 0, 1, DYNAMIC },
 { "deband_iterations", "Deband iterations", OFFSET(deband_iterations), 
AV_OPT_TYPE_INT, {.i64 = 1}, 0, 16, DYNAMIC },
-- 
2.34.1

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

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


[FFmpeg-devel] [PATCH 2/2] lavfi/showinfo: fix printf precision for dovi metadata

2022-01-04 Thread Niklas Haas
From: Niklas Haas 

Fix warning caused by this field changing from uint64_t to uint16_t.

Signed-off-by: Niklas Haas 
---
 libavfilter/vf_showinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 909ad4f8d7..71728bced4 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -499,7 +499,7 @@ static void dump_dovi_metadata(AVFilterContext *ctx, const 
AVFrameSideData *sd)
 av_log(ctx, AV_LOG_INFO, "} ");
 }
 
-av_log(ctx, AV_LOG_INFO, "}; nlq_offset=%"PRIu64"; ", nlq->nlq_offset);
+av_log(ctx, AV_LOG_INFO, "}; nlq_offset=%"PRIu16"; ", nlq->nlq_offset);
 av_log(ctx, AV_LOG_INFO, "vdr_in_max=%"PRIu64"; ", nlq->vdr_in_max);
 switch (mapping->nlq_method_idc) {
 case AV_DOVI_NLQ_LINEAR_DZ:
-- 
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] Adds DVD protocol

2022-01-04 Thread Lucien Murray-Pitts
Copies the Bluray protocol but uses libdvdnav to add simple DVD protocol 
support.Since title selection is mandatory, ffprobe cant provide 
information for the complete disk but a single title only.  Chapter 
information for probe will also be missing.


To see a complete disk catalog the tools/dvd2concat perl script should 
be used


Signed-off-by: Lucien Murray-Pitts 
---
 configure   |   4 +
 libavformat/Makefile|   1 +
 libavformat/dvd.c   | 268 
 libavformat/protocols.c |   1 +
 4 files changed, 274 insertions(+)
 create mode 100644 libavformat/dvd.c

diff --git a/configure b/configure
index 6ad70b9f7b..46216ea785 100755
--- a/configure
+++ b/configure
@@ -230,6 +230,7 @@ External library support:
   --enable-libdavs2enable AVS2 decoding via libdavs2 [no]
   --enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
and libraw1394 [no]
+  --enable-libdvdnav   enable DVD reading using libdvdnav [no] 
 --enable-libfdk-aac  enable AAC de/encoding 
via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via 
libflite [no]
   --enable-libfontconfig   enable libfontconfig, useful for drawtext 
filter [no]

@@ -1822,6 +1823,7 @@ EXTERNAL_LIBRARY_LIST="
 libdav1d
 libdc1394
 libdrm
+libdvdnav
 libflite
 libfontconfig
 libfreetype
@@ -3532,6 +3534,7 @@ xv_outdev_deps="xlib_xv xlib_x11 xlib_xext"
 # protocols
 async_protocol_deps="threads"
 bluray_protocol_deps="libbluray"
+dvd_protocol_deps="libdvdnav"
 ffrtmpcrypt_protocol_conflict="librtmp_protocol"
 ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl mbedtls"
 ffrtmpcrypt_protocol_select="tcp_protocol"
@@ -6519,6 +6522,7 @@ enabled libdav1d  && require_pkg_config 
libdav1d "dav1d >= 0.5.0" "dav1d
 enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 
1.6.0" davs2.h davs2_decoder_open
 enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 
dc1394/dc1394.h dc1394_new
 enabled libdrm&& require_pkg_config libdrm libdrm 
xf86drm.h drmGetVersion
+enabled libdvdnav && require_pkg_config libdvdnav dvdnav 
dvdnav/dvdnav.h dvdnav_open
 enabled libfdk_aac&& { check_pkg_config libfdk_aac fdk-aac 
"fdk-aac/aacenc_lib.h" aacEncOpen ||
{ require libfdk_aac 
fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac &&
  warn "using libfdk without 
pkg-config"; } }

diff --git a/libavformat/Makefile b/libavformat/Makefile
index e31b248ac0..fea05d7886 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -627,6 +627,7 @@ OBJS-$(CONFIG_CONCAT_PROTOCOL)   += concat.o
 OBJS-$(CONFIG_CONCATF_PROTOCOL)  += concat.o
 OBJS-$(CONFIG_CRYPTO_PROTOCOL)   += crypto.o
 OBJS-$(CONFIG_DATA_PROTOCOL) += data_uri.o
+OBJS-$(CONFIG_DVD_PROTOCOL)  += dvd.o
 OBJS-$(CONFIG_FFRTMPCRYPT_PROTOCOL)  += rtmpcrypt.o rtmpdigest.o 
rtmpdh.o

 OBJS-$(CONFIG_FFRTMPHTTP_PROTOCOL)   += rtmphttp.o
 OBJS-$(CONFIG_FILE_PROTOCOL) += file.o
diff --git a/libavformat/dvd.c b/libavformat/dvd.c
new file mode 100644
index 00..9c65241238
--- /dev/null
+++ b/libavformat/dvd.c
@@ -0,0 +1,268 @@
+/*
+ * DVD (libdvdnav) protocol based on BluRay (libbluray) protocol by 
Petri Hintukainen.

+ *
+ * Copyright (c) 2022 Lucien Murray-Pitts  
gmail.com>

+ *
+ * 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

+ */
+
+
+/* REFERENCES: 
https://code.videolan.org/videolan/libdvdnav/-/blob/master/src/dvdnav/dvdnav.h
+ * 
https://code.videolan.org/videolan/libdvdnav/-/blob/master/examples/menus.c

+ *
+ * EXAMPLE USE:
+ *   Choose Title 4, map 1/2/3 (video/audio/subtitles), copy the 
subtitles as is into mkv
+ *   ./ffmpeg -playlist 4 -i dvd:"/mnt/MURDER_SHE_WROTE_TS.S10D1" -map 
0:1 -map 0:2 -map 0:3 -vb 20M  -codec:s copy  remuxed-dvd.mkv

+ *
+ *   Probe for info
+ *   ./ffprobe -loglevel trace -fdebug 8 -playlist 19 -i 
dvd:"/mnt/MURDER_SHE_WROTE_TS.S10D1" -threads 0 -v warning -print_format 
json -show_streams -show_chapters -show_format

+ */
+#include 
+
+#include "libavutil/avstring.h"
+#include "libavformat/avformat.h"
+#include "li

[FFmpeg-devel] [PATCH] avfilter/vf_showinfo: Fix printf format specifier

2022-01-04 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
The type of nlq_offset was changed in v11 compared to v10, leading
to this. Sorry.

 libavfilter/vf_showinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 909ad4f8d7..71728bced4 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -499,7 +499,7 @@ static void dump_dovi_metadata(AVFilterContext *ctx, const 
AVFrameSideData *sd)
 av_log(ctx, AV_LOG_INFO, "} ");
 }
 
-av_log(ctx, AV_LOG_INFO, "}; nlq_offset=%"PRIu64"; ", nlq->nlq_offset);
+av_log(ctx, AV_LOG_INFO, "}; nlq_offset=%"PRIu16"; ", nlq->nlq_offset);
 av_log(ctx, AV_LOG_INFO, "vdr_in_max=%"PRIu64"; ", nlq->vdr_in_max);
 switch (mapping->nlq_method_idc) {
 case AV_DOVI_NLQ_LINEAR_DZ:
-- 
2.32.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] Pixel format support fixes in swscale and drawutils

2022-01-04 Thread Michael Niedermayer
On Fri, Dec 24, 2021 at 07:17:10PM +0100, Michael Niedermayer wrote:
> On Thu, Dec 23, 2021 at 09:08:48PM -0600, rcombs wrote:
> > This patchset is also available as a GitHub pull request for review 
> > simplicity:
> > https://github.com/FFmpeg/FFmpeg/pull/380
> > 
> > - Reduce hardcoding of pixfmt lists, preferring deriving properties from 
> > pixdesc
> > - Fix big-endian support for P[N]10/P[N]16 in swscale
> > - Fix several drawutils issues and add new pixfmt support
> > - Add more defensive checks in drawutils
> 
> I can confirm that this fixes the failed test on MIPS

please apply and backport this to 5.0 to fix the MIPS regression

thx


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"Nothing to hide" only works if the folks in power share the values of
you and everyone you know entirely and always will -- Tom Scott



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] Optimize Mpeg4 decoding for loongarch

2022-01-04 Thread Michael Niedermayer
On Mon, Jan 03, 2022 at 07:24:32PM +0800, 殷时友 wrote:
> 
> > 2021年12月29日 下午6:18,Hao Chen  写道:
> > 
> > ./ffmpeg -i 8_mpeg4_1080p_24fps_12Mbps.avi -f rawvideo -y /dev/null -an
> > before:376fps
> > after :552fps
> > 
> > V2: Revised PATCH 1/3 according to the comments.
> > V3: Resubmit these patches due to miss PATCH v2 1/3.
> > 
> > [PATCH v3 1/3] avcodec: [loongarch] Optimize hpeldsp with LASX.
> > [PATCH v3 2/3] avcodec: [loongarch] Optimize idctdstp with LASX.
> > [PATCH v3 3/3] avcodec: [loongarch] Optimize prefetch with loongarch.
> > 
> 
> LGTM.

will apply

thx

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

The smallest minority on earth is the individual. Those who deny 
individual rights cannot claim to be defenders of minorities. - Ayn Rand


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

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


[FFmpeg-devel] [PATCH] Website release notes for 5.0

2022-01-04 Thread Lynne
Since I couldn't find a codename preference, I went with "Desitter"
(even though the correct spelling is "De Sitter"). There's a joke in
here that if we mess up and need a 5.1 release quickly, we could
codename it "anti-Desitter" :)

The release notes go as follows:
    FFmpeg 5.0 "Desitter", a new
    major release, is now available! For this long-overdue release, a major 
effort
    underwent to remove the old encode/decode APIs and replace them with an
    N:M-based API, the entire libavresample library was removed, libswscale
    got a new, easier to use AVframe-based API, the Vulkan code was much 
improved,
    many new filters were added, including libplacebo integration, and finally,
    DoVi support was added, including tonemapping and remuxing.
    Some of the changelog highlights:
    

The 'N' dates on the news entry and the download page
should be substituted with whenever we tag the release
and make the signed archives.

Patch attached.

>From 1dabf232f805be212dbdb740c3b6bffd6bb4a3e5 Mon Sep 17 00:00:00 2001
From: Lynne 
Date: Tue, 4 Jan 2022 15:59:31 +0100
Subject: [PATCH] Website release notes for 5.0

---
 src/download | 36 +++
 src/index| 61 +++-
 2 files changed, 96 insertions(+), 1 deletion(-)

diff --git a/src/download b/src/download
index b723674..6e82193 100644
--- a/src/download
+++ b/src/download
@@ -304,6 +304,42 @@ gpg: Good signature from "FFmpeg release signing key Changelog
+  https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/refs/heads/release/5.0:/RELEASE_NOTES";>Release Notes
+ 
+   
+
   FFmpeg 4.4.1 "Rao"
 
   
diff --git a/src/index b/src/index
index 982fa33..839833a 100644
--- a/src/index
+++ b/src/index
@@ -35,13 +35,72 @@
 News
   
 
+  January Nth, 2022, FFmpeg 5.0 "Desitter"
+  
+FFmpeg 5.0 "Desitter", a new
+major release, is now available! For this long-overdue release, a major effort
+underwent to remove the old encode/decode APIs and replace them with an
+N:M-based API, the entire libavresample library was removed, libswscale
+got a new, easier to use AVframe-based API, the Vulkan code was much improved,
+many new filters were added, including libplacebo integration, and finally,
+DoVi support was added, including tonemapping and remuxing.
+Some of the changelog highlights:
+  
+  
+ADPCM IMA Westwood encoder
+Westwood AUD muxer
+ADPCM IMA Acorn Replay decoder
+Argonaut Games CVG demuxer
+Argonaut Games CVG muxer
+Concatf protocol
+afwtdn audio filter
+audio and video segment filters
+Apple Graphics (SMC) encoder
+hsvkey and hsvhold video filters
+adecorrelate audio filter
+atilt audio filter
+grayworld video filter
+AV1 Low overhead bitstream format muxer
+swscale slice threading
+MSN Siren decoder
+scharr video filter
+apsyclip audio filter
+morpho video filter
+amr parser
+(a)latency filters
+GEM Raster image decoder
+asdr audio filter
+speex decoder
+limitdiff video filter
+xcorrelate video filter
+varblur video filter
+huesaturation video filter
+colorspectrum source video filter
+RTP packetizer for uncompressed video (RFC 4175)
+bitpacked encoder
+VideoToolbox VP9 hwaccel
+VideoToolbox ProRes hwaccel
+support loongarch.
+aspectralstats audio filter
+adynamicsmooth audio filter
+libplacebo filter
+vflip_vulkan, hflip_vulkan and flip_vulkan filters
+adynamicequalizer audio filter
+yadif_videotoolbox filter
+VideoToolbox ProRes encoder
+anlmf audio filter
+  
+  
+We strongly recommend users, distributors, and system integrators to
+upgrade unless they use current git master.
+  
+
   June 19th, 2021, IRC
   
 We have a new IRC home at Libera Chat
 now! Feel free to join us at #ffmpeg and #ffmpeg-devel. More info at https://ffmpeg.org/contact.html#IRCChannels";>contact#IRCChannels
   
 
-
   April 8th, 2021, FFmpeg 4.4 "Rao"
   
 FFmpeg 4.4 "Rao", a new
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpe

[FFmpeg-devel] [PATCH v2 1/5] avcodec/jpegxl: add Jpeg XL image codec and parser

2022-01-04 Thread Leo Izen
This commit adds support to libavcodec to read and parse
encoded Jpeg XL images. Jpeg XL is intended to be an
extended-life replacement to legacy mjpeg.
---
 MAINTAINERS|   2 +
 libavcodec/Makefile|   1 +
 libavcodec/codec_desc.c|   9 +
 libavcodec/codec_id.h  |   1 +
 libavcodec/jpegxl.h| 204 ++
 libavcodec/jpegxl_parser.c | 794 +
 libavcodec/parsers.c   |   1 +
 libavcodec/version.h   |   4 +-
 8 files changed, 1014 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/jpegxl.h
 create mode 100644 libavcodec/jpegxl_parser.c

diff --git a/MAINTAINERS b/MAINTAINERS
index c065e94498..17c0104672 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -187,6 +187,7 @@ Codecs:
   interplayvideo.c  Mike Melanson
   jni*, ffjni*  Matthieu Bouron
   jpeg2000* Nicolas Bertrand
+  jpegxl.h, jpegxl_parser.c Leo Izen
   jvdec.c   Peter Ross
   lcl*.cRoberto Togni, Reimar Doeffinger
   libcelt_dec.c Nicolas George
@@ -615,6 +616,7 @@ Haihao Xiang (haihao) 1F0C 31E8 B4FE F7A4 4DC1 DC99 
E0F5 76D4 76FC 437F
 Jaikrishnan Menon 61A1 F09F 01C9 2D45 78E1 C862 25DC 8831 AF70 D368
 James Almer   7751 2E8C FD94 A169 57E6 9A7A 1463 01AD 7376 59E0
 Jean Delvare  7CA6 9F44 60F1 BDC4 1FD2 C858 A552 6B9B B3CD 4E6A
+Leo Izen (thebombzen) B6FD 3CFC 7ACF 83FC 9137 6945 5A71 C331 FD2F A19A
 Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE
 Lynne FE50 139C 6805 72CA FD52 1F8D A2FE A5F0 3F03 4464
 Michael Niedermayer   9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 9577062eec..4a41bb2825 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -43,6 +43,7 @@ OBJS = ac3_parser.o   
  \
dv_profile.o \
encode.o \
imgconvert.o \
+   jpegxl_parser.o  \
jni.o\
mathtables.o \
mediacodec.o \
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 0974ee03de..0f3d0f910b 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1862,6 +1862,15 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("GEM Raster image"),
 .props = AV_CODEC_PROP_LOSSY,
 },
+{
+.id= AV_CODEC_ID_JPEGXL,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "jpegxl",
+.long_name = NULL_IF_CONFIG_SMALL("JPEG XL"),
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY |
+ AV_CODEC_PROP_LOSSLESS,
+.mime_types= MT("image/jxl"),
+},
 
 /* various PCM "codecs" */
 {
diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
index ab265ec584..551a516446 100644
--- a/libavcodec/codec_id.h
+++ b/libavcodec/codec_id.h
@@ -308,6 +308,7 @@ enum AVCodecID {
 AV_CODEC_ID_SIMBIOSIS_IMX,
 AV_CODEC_ID_SGA_VIDEO,
 AV_CODEC_ID_GEM,
+AV_CODEC_ID_JPEGXL,
 
 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
start of audio codecs
diff --git a/libavcodec/jpegxl.h b/libavcodec/jpegxl.h
new file mode 100644
index 00..434247a85d
--- /dev/null
+++ b/libavcodec/jpegxl.h
@@ -0,0 +1,204 @@
+/*
+ * JPEG XL header
+ * Copyright (c) 2021 Leo Izen 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * JPEG XL header
+ */
+
+#ifndef AVCODEC_JPEGXL_H
+#define AVCODEC_JPEGXL_H
+
+#include 
+
+#define FF_JPEGXL_CODESTREAM_SIGNATURE_LE 0x0aff
+#define FF_JPEGXL_CODESTREAM_SIGNATURE_BE 0xff0a
+#define FF_JPEGXL_CONTAI

[FFmpeg-devel] [PATCH v2 2/5] avcodec/libjxl: add Jpeg XL decoding via libjxl

2022-01-04 Thread Leo Izen
This commit adds decoding support to libavcodec
for Jpeg XL images via the external library libjxl.
---
 MAINTAINERS   |   1 +
 configure |   5 +
 doc/general_contents.texi |   7 +
 libavcodec/Makefile   |   1 +
 libavcodec/allcodecs.c|   1 +
 libavcodec/libjxl.c   |  70 ++
 libavcodec/libjxl.h   |  48 +++
 libavcodec/libjxldec.c| 276 ++
 8 files changed, 409 insertions(+)
 create mode 100644 libavcodec/libjxl.c
 create mode 100644 libavcodec/libjxl.h
 create mode 100644 libavcodec/libjxldec.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 17c0104672..a649223bcb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -194,6 +194,7 @@ Codecs:
   libcodec2.c   Tomas Härdin
   libdirac* David Conrad
   libdavs2.cHuiwen Ren
+  libjxl*.c, libjxl.h   Leo Izen
   libgsm.c  Michel Bardiaux
   libkvazaar.c  Arttu Ylä-Outinen
   libopenh264enc.c  Martin Storsjo, Linjie Fu
diff --git a/configure b/configure
index 23ef2abc9b..9317485131 100755
--- a/configure
+++ b/configure
@@ -241,6 +241,7 @@ External library support:
   --enable-libiec61883 enable iec61883 via libiec61883 [no]
   --enable-libilbc enable iLBC de/encoding via libilbc [no]
   --enable-libjack enable JACK audio sound server [no]
+  --enable-libjxl  enable JPEG XL decoding via libjxl [no]
   --enable-libklvanc   enable Kernel Labs VANC processing [no]
   --enable-libkvazaar  enable HEVC encoding via libkvazaar [no]
   --enable-liblensfun  enable lensfun lens correction [no]
@@ -1832,6 +1833,7 @@ EXTERNAL_LIBRARY_LIST="
 libiec61883
 libilbc
 libjack
+libjxl
 libklvanc
 libkvazaar
 libmodplug
@@ -3328,6 +3330,7 @@ libgsm_ms_decoder_deps="libgsm"
 libgsm_ms_encoder_deps="libgsm"
 libilbc_decoder_deps="libilbc"
 libilbc_encoder_deps="libilbc"
+libjxl_decoder_deps="libjxl libjxl_threads"
 libkvazaar_encoder_deps="libkvazaar"
 libmodplug_demuxer_deps="libmodplug"
 libmp3lame_encoder_deps="libmp3lame"
@@ -6539,6 +6542,8 @@ enabled libgsm&& { for gsm_hdr in "gsm.h" 
"gsm/gsm.h"; do
check_lib libgsm "${gsm_hdr}" gsm_create 
-lgsm && break;
done || die "ERROR: libgsm not found"; }
 enabled libilbc   && require libilbc ilbc.h WebRtcIlbcfix_InitDecode 
-lilbc $pthreads_extralibs
+enabled libjxl&& require_pkg_config libjxl "libjxl >= 0.7.0" 
jxl/decode.h JxlDecoderVersion &&
+ require_pkg_config libjxl_threads "libjxl_threads 
>= 0.7.0" jxl/thread_parallel_runner.h JxlThreadParallelRunner
 enabled libklvanc && require libklvanc libklvanc/vanc.h 
klvanc_context_create -lklvanc
 enabled libkvazaar&& require_pkg_config libkvazaar "kvazaar >= 0.8.1" 
kvazaar.h kvz_api_get
 enabled liblensfun&& require_pkg_config liblensfun lensfun lensfun.h 
lf_db_new
diff --git a/doc/general_contents.texi b/doc/general_contents.texi
index df1692c8df..2778e20091 100644
--- a/doc/general_contents.texi
+++ b/doc/general_contents.texi
@@ -171,6 +171,13 @@ Go to @url{https://github.com/TimothyGu/libilbc} and 
follow the instructions for
 installing the library. Then pass @code{--enable-libilbc} to configure to
 enable it.
 
+@section libjxl
+
+JPEG XL is an image format intended to fully replace legacy JPEG for an 
extended
+period of life. See @url{https://jpegxl.info/} for more information, and see
+@url{https://github.com/libjxl/libjxl} for the library source. You can pass
+@code{--enable-libjxl} to configure in order enable the libjxl wrapper.
+
 @section libvpx
 
 FFmpeg can make use of the libvpx library for VP8/VP9 decoding and encoding.
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 4a41bb2825..b3dcc7dcb1 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1038,6 +1038,7 @@ OBJS-$(CONFIG_LIBGSM_MS_DECODER)  += libgsmdec.o
 OBJS-$(CONFIG_LIBGSM_MS_ENCODER)  += libgsmenc.o
 OBJS-$(CONFIG_LIBILBC_DECODER)+= libilbc.o
 OBJS-$(CONFIG_LIBILBC_ENCODER)+= libilbc.o
+OBJS-$(CONFIG_LIBJXL_DECODER) += libjxldec.o libjxl.o
 OBJS-$(CONFIG_LIBKVAZAAR_ENCODER) += libkvazaar.o
 OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o
 OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER)  += libopencore-amr.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index d1e10197de..b41da3b0de 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -744,6 +744,7 @@ extern const AVCodec ff_libgsm_ms_encoder;
 extern const AVCodec ff_libgsm_ms_decoder;
 extern const AVCodec ff_libilbc_encoder;
 extern const AVCodec ff_libilbc_decoder;
+extern const AVCodec ff_libjxl_decoder;
 extern const AVCodec ff_libmp3lame_encoder;
 extern const AVCodec ff_libo

[FFmpeg-devel] [PATCH v2 3/5] avcodec/libjxl: add Jpeg XL encoding via libjxl

2022-01-04 Thread Leo Izen
This commit adds encoding support to libavcodec
for Jpeg XL images via the external library libjxl.
---
 configure  |   3 +-
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/libjxlenc.c | 383 +
 4 files changed, 387 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/libjxlenc.c

diff --git a/configure b/configure
index 9317485131..9188e56fb5 100755
--- a/configure
+++ b/configure
@@ -241,7 +241,7 @@ External library support:
   --enable-libiec61883 enable iec61883 via libiec61883 [no]
   --enable-libilbc enable iLBC de/encoding via libilbc [no]
   --enable-libjack enable JACK audio sound server [no]
-  --enable-libjxl  enable JPEG XL decoding via libjxl [no]
+  --enable-libjxl  enable JPEG XL de/encoding via libjxl [no]
   --enable-libklvanc   enable Kernel Labs VANC processing [no]
   --enable-libkvazaar  enable HEVC encoding via libkvazaar [no]
   --enable-liblensfun  enable lensfun lens correction [no]
@@ -3331,6 +3331,7 @@ libgsm_ms_encoder_deps="libgsm"
 libilbc_decoder_deps="libilbc"
 libilbc_encoder_deps="libilbc"
 libjxl_decoder_deps="libjxl libjxl_threads"
+libjxl_encoder_deps="libjxl libjxl_threads"
 libkvazaar_encoder_deps="libkvazaar"
 libmodplug_demuxer_deps="libmodplug"
 libmp3lame_encoder_deps="libmp3lame"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index b3dcc7dcb1..946deacdcd 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1039,6 +1039,7 @@ OBJS-$(CONFIG_LIBGSM_MS_ENCODER)  += libgsmenc.o
 OBJS-$(CONFIG_LIBILBC_DECODER)+= libilbc.o
 OBJS-$(CONFIG_LIBILBC_ENCODER)+= libilbc.o
 OBJS-$(CONFIG_LIBJXL_DECODER) += libjxldec.o libjxl.o
+OBJS-$(CONFIG_LIBJXL_ENCODER) += libjxlenc.o libjxl.o
 OBJS-$(CONFIG_LIBKVAZAAR_ENCODER) += libkvazaar.o
 OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o
 OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER)  += libopencore-amr.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index b41da3b0de..2e50991652 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -745,6 +745,7 @@ extern const AVCodec ff_libgsm_ms_decoder;
 extern const AVCodec ff_libilbc_encoder;
 extern const AVCodec ff_libilbc_decoder;
 extern const AVCodec ff_libjxl_decoder;
+extern const AVCodec ff_libjxl_encoder;
 extern const AVCodec ff_libmp3lame_encoder;
 extern const AVCodec ff_libopencore_amrnb_encoder;
 extern const AVCodec ff_libopencore_amrnb_decoder;
diff --git a/libavcodec/libjxlenc.c b/libavcodec/libjxlenc.c
new file mode 100644
index 00..4309a91e22
--- /dev/null
+++ b/libavcodec/libjxlenc.c
@@ -0,0 +1,383 @@
+/*
+ * JPEG XL encoding support via libjxl
+ * Copyright (c) 2021 Leo Izen 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * JPEG XL encoder using libjxl
+ */
+
+#include "libavutil/avutil.h"
+#include "libavutil/error.h"
+#include "libavutil/frame.h"
+#include "libavutil/libm.h"
+#include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/pixfmt.h"
+#include "libavutil/version.h"
+
+#include "avcodec.h"
+#include "internal.h"
+
+#include 
+#include 
+#include "libjxl.h"
+
+typedef struct LibJxlEncodeContext {
+AVClass *class;
+void *runner;
+JxlEncoder *encoder;
+JxlEncoderFrameSettings *options;
+int effort;
+float distance;
+int modular;
+uint8_t *buffer;
+size_t buffer_size;
+} LibJxlEncodeContext;
+
+/**
+ * Map a quality setting for -qscale roughly from libjpeg
+ * quality numbers to libjxl's butteraugli distance for
+ * photographic content.
+ *
+ * Setting distance explicitly is preferred, but this will
+ * allow qscale to be used as a fallback.
+ *
+ * This function is continuous and injective on [0, 100] which
+ * makes it monotonic.
+ *
+ * @param  quality 0.0 to 100.0 quality setting, libjpeg quality
+ * @return Butteraugli distance between 0.0 and 15.0
+ */
+static float quality_to_distance(float quality){
+if (quality >= 100.0) {
+return 0.0;
+} else if (quality >= 90.0) {
+return (100.0 - quality) * 0.10;
+} else if (quality >= 30.0) {
+return 0.1 + (100.0 - quality) * 0.09;
+

[FFmpeg-devel] [PATCH v2 4/5] avformat/image2: add Jpeg XL as image2 format

2022-01-04 Thread Leo Izen
This commit adds support to libavformat for muxing
and demuxing Jpeg XL images as image2 streams.
---
 libavformat/allformats.c |  1 +
 libavformat/img2.c   |  1 +
 libavformat/img2dec.c| 19 +++
 libavformat/img2enc.c|  6 +++---
 libavformat/mov.c|  1 +
 libavformat/version.h|  2 +-
 6 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 1054ac9667..0fa1c82ddb 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -506,6 +506,7 @@ extern const AVInputFormat  ff_image_gif_pipe_demuxer;
 extern const AVInputFormat  ff_image_j2k_pipe_demuxer;
 extern const AVInputFormat  ff_image_jpeg_pipe_demuxer;
 extern const AVInputFormat  ff_image_jpegls_pipe_demuxer;
+extern const AVInputFormat  ff_image_jpegxl_pipe_demuxer;
 extern const AVInputFormat  ff_image_pam_pipe_demuxer;
 extern const AVInputFormat  ff_image_pbm_pipe_demuxer;
 extern const AVInputFormat  ff_image_pcx_pipe_demuxer;
diff --git a/libavformat/img2.c b/libavformat/img2.c
index 4153102c92..13b1b997b8 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -87,6 +87,7 @@ const IdStrMap ff_img_tags[] = {
 { AV_CODEC_ID_GEM,"img"  },
 { AV_CODEC_ID_GEM,"ximg" },
 { AV_CODEC_ID_GEM,"timg" },
+{ AV_CODEC_ID_JPEGXL, "jxl"  },
 { AV_CODEC_ID_NONE,   NULL   }
 };
 
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index a6084ceef0..44336d812d 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -30,6 +30,7 @@
 #include "libavutil/parseutils.h"
 #include "libavutil/intreadwrite.h"
 #include "libavcodec/gif.h"
+#include "libavcodec/jpegxl.h"
 #include "avformat.h"
 #include "avio_internal.h"
 #include "internal.h"
@@ -834,6 +835,23 @@ static int jpegls_probe(const AVProbeData *p)
 return 0;
 }
 
+static int jpegxl_probe(const AVProbeData *p)
+{
+const uint8_t *b = p->buf;
+
+/* ISOBMFF-based container */
+/* 0x4a584c20 == "JXL " */
+if (AV_RL64(b) == FF_JPEGXL_CONTAINER_SIGNATURE_LE)
+return AVPROBE_SCORE_EXTENSION + 1;
+/* Raw codestreams all start with 0xff0a */
+if (AV_RL16(b) != FF_JPEGXL_CODESTREAM_SIGNATURE_LE)
+return 0;
+if (avpriv_jpegxl_verify_codestream_header(NULL, p->buf, p->buf_size, 5) 
== 0)
+return AVPROBE_SCORE_MAX - 2;
+else
+return 0;
+}
+
 static int pcx_probe(const AVProbeData *p)
 {
 const uint8_t *b = p->buf;
@@ -1153,6 +1171,7 @@ IMAGEAUTO_DEMUXER(gif, AV_CODEC_ID_GIF)
 IMAGEAUTO_DEMUXER(j2k, AV_CODEC_ID_JPEG2000)
 IMAGEAUTO_DEMUXER(jpeg,AV_CODEC_ID_MJPEG)
 IMAGEAUTO_DEMUXER(jpegls,  AV_CODEC_ID_JPEGLS)
+IMAGEAUTO_DEMUXER(jpegxl,  AV_CODEC_ID_JPEGXL)
 IMAGEAUTO_DEMUXER(pam, AV_CODEC_ID_PAM)
 IMAGEAUTO_DEMUXER(pbm, AV_CODEC_ID_PBM)
 IMAGEAUTO_DEMUXER(pcx, AV_CODEC_ID_PCX)
diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index ded91d6b98..6ac430c6dd 100644
--- a/libavformat/img2enc.c
+++ b/libavformat/img2enc.c
@@ -261,9 +261,9 @@ static const AVClass img2mux_class = {
 const AVOutputFormat ff_image2_muxer = {
 .name   = "image2",
 .long_name  = NULL_IF_CONFIG_SMALL("image2 sequence"),
-.extensions = 
"bmp,dpx,exr,jls,jpeg,jpg,ljpg,pam,pbm,pcx,pfm,pgm,pgmyuv,png,"
-  
"ppm,sgi,tga,tif,tiff,jp2,j2c,j2k,xwd,sun,ras,rs,im1,im8,im24,"
-  "sunras,xbm,xface,pix,y",
+.extensions = 
"bmp,dpx,exr,jls,jpeg,jpg,jxl,ljpg,pam,pbm,pcx,pfm,pgm,pgmyuv,"
+  
"png,ppm,sgi,tga,tif,tiff,jp2,j2c,j2k,xwd,sun,ras,rs,im1,im8,"
+  "im24,sunras,xbm,xface,pix,y",
 .priv_data_size = sizeof(VideoMuxData),
 .video_codec= AV_CODEC_ID_MJPEG,
 .write_header   = write_header,
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 2aed6e80ef..4dcae73c3b 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -7463,6 +7463,7 @@ static int mov_probe(const AVProbeData *p)
 if (tag == MKTAG('f','t','y','p') &&
(   AV_RL32(p->buf + offset + 8) == MKTAG('j','p','2',' 
')
 || AV_RL32(p->buf + offset + 8) == MKTAG('j','p','x',' 
')
+|| AV_RL32(p->buf + offset + 8) == MKTAG('j','x','l',' 
')
 )) {
 score = FFMAX(score, 5);
 } else {
diff --git a/libavformat/version.h b/libavformat/version.h
index 379a68cc7c..9b90bbf156 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  59
-#define LIBAVFORMAT_VERSION_MINOR  10
+#define LIBAVFORMAT_VERSION_MINOR  11
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
-- 
2.34.1

[FFmpeg-devel] [PATCH v2 5/5] fate/jpegxl: add JPEG XL demux and parse FATE test

2022-01-04 Thread Leo Izen
Add a fate test for the JPEG XL parser in libavcodec and
its image2 wrapper inside libavformat.
---
 tests/fate/image.mak| 10 ++
 tests/ref/fate/jxl-parse-codestream |  6 ++
 tests/ref/fate/jxl-parse-container  |  6 ++
 3 files changed, 22 insertions(+)
 create mode 100644 tests/ref/fate/jxl-parse-codestream
 create mode 100644 tests/ref/fate/jxl-parse-container

diff --git a/tests/fate/image.mak b/tests/fate/image.mak
index 573d398915..15b6145c58 100644
--- a/tests/fate/image.mak
+++ b/tests/fate/image.mak
@@ -357,6 +357,16 @@ FATE_JPEGLS-$(call DEMDEC, IMAGE2, JPEGLS) += 
$(FATE_JPEGLS)
 FATE_IMAGE += $(FATE_JPEGLS-yes)
 fate-jpegls: $(FATE_JPEGLS-yes)
 
+FATE_JPEGXL += fate-jxl-parse-codestream
+fate-jxl-parse-codestream: CMD = framecrc -i $(TARGET_SAMPLES)/jxl/belgium.jxl 
-c:v copy
+
+FATE_JPEGXL += fate-jxl-parse-container
+fate-jxl-parse-container: CMD = framecrc -i 
$(TARGET_SAMPLES)/jxl/lenna-256.jxl -c:v copy
+
+FATE_JPEGXL-$(call DEMDEC, IMAGE2) += $(FATE_JPEGXL)
+FATE_IMAGE += $(FATE_JPEGXL-yes)
+fate-jxl: $(FATE_JPEGXL-yes)
+
 FATE_IMAGE-$(call DEMDEC, IMAGE2, QDRAW) += fate-pict
 fate-pict: CMD = framecrc -i $(TARGET_SAMPLES)/quickdraw/TRU256.PCT -pix_fmt 
rgb24
 
diff --git a/tests/ref/fate/jxl-parse-codestream 
b/tests/ref/fate/jxl-parse-codestream
new file mode 100644
index 00..b2fe5035ac
--- /dev/null
+++ b/tests/ref/fate/jxl-parse-codestream
@@ -0,0 +1,6 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: jpegxl
+#dimensions 0: 768x512
+#sar 0: 0/1
+0,  0,  0,1,   32, 0xa2930a20
diff --git a/tests/ref/fate/jxl-parse-container 
b/tests/ref/fate/jxl-parse-container
new file mode 100644
index 00..99233d612a
--- /dev/null
+++ b/tests/ref/fate/jxl-parse-container
@@ -0,0 +1,6 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: jpegxl
+#dimensions 0: 256x256
+#sar 0: 0/1
+0,  0,  0,1, 8088, 0xbbfea9bd
-- 
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 v2 0/5] avdevice/dshow fixups

2022-01-04 Thread Diederick C. Niehorster
Hi Gyan,

On Tue, Jan 4, 2022 at 1:05 PM Gyan Doshi  wrote:
>
> On 2022-01-04 04:06 pm, Diederick C. Niehorster wrote:
> > On Tue, Jan 4, 2022 at 5:10 AM Gyan Doshi  wrote:
> >> On 2022-01-04 05:02 am, Roger Pack wrote:
> >>> These LGTM.  Feel free to add yourself as a dshow maintainer if so
> >>> interested, as well! :)
> >> I assume these need to be pushed too.
> > Yes thanks, please push. Would be good to get in before the release
> > branch, fixing the regressions.
>
> Too late for that. But I will backport to 5.0

Super! Its still on time for the actual release, thats what matters.

Thanks and cheers,
Dee
___
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 1/5] avcodec/jpegxl: add Jpeg XL image codec and parser

2022-01-04 Thread Lynne
4 Jan 2022, 17:26 by leo.i...@gmail.com:

> This commit adds support to libavcodec to read and parse
> encoded Jpeg XL images. Jpeg XL is intended to be an
> extended-life replacement to legacy mjpeg.
> ---
>  MAINTAINERS|   2 +
>  libavcodec/Makefile|   1 +
>  libavcodec/codec_desc.c|   9 +
>  libavcodec/codec_id.h  |   1 +
>  libavcodec/jpegxl.h| 204 ++
>  libavcodec/jpegxl_parser.c | 794 +
>  libavcodec/parsers.c   |   1 +
>  libavcodec/version.h   |   4 +-
>  8 files changed, 1014 insertions(+), 2 deletions(-)
>  create mode 100644 libavcodec/jpegxl.h
>  create mode 100644 libavcodec/jpegxl_parser.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index c065e94498..17c0104672 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -187,6 +187,7 @@ Codecs:
>  interplayvideo.c  Mike Melanson
>  jni*, ffjni*  Matthieu Bouron
>  jpeg2000* Nicolas Bertrand
> +  jpegxl.h, jpegxl_parser.c Leo Izen
>  jvdec.c   Peter Ross
>  lcl*.cRoberto Togni, Reimar Doeffinger
>  libcelt_dec.c Nicolas George
> @@ -615,6 +616,7 @@ Haihao Xiang (haihao) 1F0C 31E8 B4FE F7A4 4DC1 
> DC99 E0F5 76D4 76FC 437F
>  Jaikrishnan Menon 61A1 F09F 01C9 2D45 78E1 C862 25DC 8831 AF70 
> D368
>  James Almer   7751 2E8C FD94 A169 57E6 9A7A 1463 01AD 7376 
> 59E0
>  Jean Delvare  7CA6 9F44 60F1 BDC4 1FD2 C858 A552 6B9B B3CD 
> 4E6A
> +Leo Izen (thebombzen) B6FD 3CFC 7ACF 83FC 9137 6945 5A71 C331 FD2F 
> A19A
>  Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 
> 56DE
>  Lynne FE50 139C 6805 72CA FD52 1F8D A2FE A5F0 3F03 
> 4464
>  Michael Niedermayer   9FF2 128B 147E F673 0BAD F133 611E C787 040B 
> 0FAB
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 9577062eec..4a41bb2825 100644
>

Could you not add yourself as a maintainer in the same
patchset? In theory, the maintainers file contains those
with push access, and while I don't object, adding yourself
without even having a chance for anyone who's interested
in that but not interested in jpegxl to review isn't right.
___
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 0/5] avdevice/dshow fixups

2022-01-04 Thread Gyan Doshi




On 2022-01-04 09:58 pm, Diederick C. Niehorster wrote:

Hi Gyan,

On Tue, Jan 4, 2022 at 1:05 PM Gyan Doshi  wrote:

On 2022-01-04 04:06 pm, Diederick C. Niehorster wrote:

On Tue, Jan 4, 2022 at 5:10 AM Gyan Doshi  wrote:

On 2022-01-04 05:02 am, Roger Pack wrote:

These LGTM.  Feel free to add yourself as a dshow maintainer if so
interested, as well! :)

I assume these need to be pushed too.

Yes thanks, please push. Would be good to get in before the release
branch, fixing the regressions.

Too late for that. But I will backport to 5.0

Super! Its still on time for the actual release, thats what matters.


Done in both master and release/5.0

Pushed to master as 
d1f7700133312929d64aaa69ab3a08b5ae171390...e84d8ba44141b55f2b28e0ad3b597d2e7d422336


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 v2 1/5] avcodec/jpegxl: add Jpeg XL image codec and parser

2022-01-04 Thread Leo Izen

On 1/4/22 11:56, Lynne wrote:

4 Jan 2022, 17:26 by leo.i...@gmail.com:


This commit adds support to libavcodec to read and parse
encoded Jpeg XL images. Jpeg XL is intended to be an
extended-life replacement to legacy mjpeg.
---
  MAINTAINERS|   2 +
+Leo Izen (thebombzen) B6FD 3CFC 7ACF 83FC 9137 6945 5A71 C331 FD2F A19A

Could you not add yourself as a maintainer in the same
patchset? In theory, the maintainers file contains those
with push access, and while I don't object, adding yourself
without even having a chance for anyone who's interested
in that but not interested in jpegxl to review isn't right.
___


If this is the case, would I remove my GPG signature from this part of 
the file, but keep myself listed as the contributor for the individual 
.c and .h files?


-Leo

___
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/developer: patches should not cross libs or mix MAINTAINER changes in

2022-01-04 Thread Michael Niedermayer
maintainer part inspired by IRC comments by lynne

Signed-off-by: Michael Niedermayer 
---
 doc/developer.texi | 4 
 1 file changed, 4 insertions(+)

diff --git a/doc/developer.texi b/doc/developer.texi
index addee0d8263..eae3ade48a7 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -683,6 +683,10 @@ are notoriously left unchecked, which is a serious problem.
 @item
 Test your code with valgrind and or Address Sanitizer to ensure it's free
 of leaks, out of array accesses, etc.
+
+@item
+Changes to 2 libs which change both versions should be in 2 seperate patches.
+Non cosmetic changes to @file{MAINTAINERS} should not be in a patch with other 
changes.
 @end enumerate
 
 @chapter Patch review process
-- 
2.17.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 v5 1/7] avcodec/v4l2_context: don't reinit output queue when dynamic resolution change

2022-01-04 Thread Andriy Gelman
On Tue, 04. Jan 17:08, Ming Qian wrote:
> in the v4l2 stateful video document, we can see the following
> description:
> During the resolution change sequence, the OUTPUT queue must remain
> streaming. Calling VIDIOC_STREAMOFF() on the OUTPUT queue would
> abort the sequence and initiate a seek.
> 
> In principle, the OUTPUT queue operates separately from the CAPTURE
> queue and this remains true for the duration of the entire
> resolution change sequence as well.
> 
> so don't reinit the output queue when handling the resolution change
> event
> 
> Signed-off-by: Ming Qian 
> ---
>  libavcodec/v4l2_context.c | 27 ++-
>  1 file changed, 2 insertions(+), 25 deletions(-)
> 
> diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
> index ff1ea8e57b08..dda5157698c3 100644
> --- a/libavcodec/v4l2_context.c
> +++ b/libavcodec/v4l2_context.c
> @@ -162,9 +162,8 @@ static int v4l2_handle_event(V4L2Context *ctx)
>  {
>  V4L2m2mContext *s = ctx_to_m2mctx(ctx);
>  struct v4l2_format cap_fmt = s->capture.format;
> -struct v4l2_format out_fmt = s->output.format;
>  struct v4l2_event evt = { 0 };
> -int full_reinit, reinit, ret;
> +int reinit, ret;
>  
>  ret = ioctl(s->fd, VIDIOC_DQEVENT, &evt);
>  if (ret < 0) {
> @@ -180,25 +179,12 @@ static int v4l2_handle_event(V4L2Context *ctx)
>  if (evt.type != V4L2_EVENT_SOURCE_CHANGE)
>  return 0;
>  
> -ret = ioctl(s->fd, VIDIOC_G_FMT, &out_fmt);
> -if (ret) {
> -av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_G_FMT\n", 
> s->output.name);
> -return 0;
> -}
> -
>  ret = ioctl(s->fd, VIDIOC_G_FMT, &cap_fmt);
>  if (ret) {
>  av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_G_FMT\n", 
> s->capture.name);
>  return 0;
>  }
>  
> -full_reinit = v4l2_resolution_changed(&s->output, &out_fmt);
> -if (full_reinit) {
> -s->output.height = v4l2_get_height(&out_fmt);
> -s->output.width = v4l2_get_width(&out_fmt);
> -s->output.sample_aspect_ratio = v4l2_get_sar(&s->output);
> -}
> -
>  reinit = v4l2_resolution_changed(&s->capture, &cap_fmt);
>  if (reinit) {
>  s->capture.height = v4l2_get_height(&cap_fmt);
> @@ -206,18 +192,9 @@ static int v4l2_handle_event(V4L2Context *ctx)
>  s->capture.sample_aspect_ratio = v4l2_get_sar(&s->capture);
>  }
>  
> -if (full_reinit || reinit)
> +if (reinit)
>  s->reinit = 1;
>  
> -if (full_reinit) {
> -ret = ff_v4l2_m2m_codec_full_reinit(s);
> -if (ret) {
> -av_log(logger(ctx), AV_LOG_ERROR, 
> "v4l2_m2m_codec_full_reinit\n");
> -return AVERROR(EINVAL);
> -}
> -goto reinit_run;
> -}
> -
>  if (reinit) {
>  if (s->avctx)
>  ret = ff_set_dimensions(s->avctx, s->capture.width, 
> s->capture.height);
> -- 
> 2.33.0

lgtm

Thanks,
-- 
Andriy
___
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 3/7] avcodec/v4l2_context: add v4l2_start_decode

2022-01-04 Thread Andriy Gelman
On Tue, 04. Jan 17:08, Ming Qian wrote:
> on dynamic resolution change,
> The decoding process must be resumed with either a pair of calls to
> VIDIOC_STREAMOFF() and VIDIOC_STREAMON() on the CAPTURE queue, or a call
> to VIDIOC_DECODER_CMD() with the V4L2_DEC_CMD_START command.
> 

For the patch title, I think something like the following would be better:
avcodec/v4l2_context: send start decode command after dynamic resolution change
event

I'll add that this fixes decoding of 
https://streams.videolan.org/ffmpeg/incoming/720p60.mp4 on RPi4.

> Signed-off-by: Ming Qian 
> ---
>  libavcodec/v4l2_context.c | 18 ++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
> index dda5157698c3..a181f884d2a6 100644
> --- a/libavcodec/v4l2_context.c
> +++ b/libavcodec/v4l2_context.c
> @@ -153,6 +153,21 @@ static inline void v4l2_save_to_context(V4L2Context* 
> ctx, struct v4l2_format_upd
>  }
>  }
>  
> +static int v4l2_start_decode(V4L2Context *ctx)
> +{
> +struct v4l2_decoder_cmd cmd = {
> +.cmd = V4L2_DEC_CMD_START,
> +.flags = 0,
> +};
> +int ret;
> +
> +ret = ioctl(ctx_to_m2mctx(ctx)->fd, VIDIOC_DECODER_CMD, &cmd);
> +if (ret)
> +return AVERROR(errno);
> +
> +return 0;
> +}
> +
>  /**
>   * handle resolution change event and end of stream event
>   * returns 1 if reinit was successful, negative if it failed
> @@ -190,6 +205,9 @@ static int v4l2_handle_event(V4L2Context *ctx)
>  s->capture.height = v4l2_get_height(&cap_fmt);
>  s->capture.width = v4l2_get_width(&cap_fmt);
>  s->capture.sample_aspect_ratio = v4l2_get_sar(&s->capture);
> +} else {
> +v4l2_start_decode(ctx);
> +return 0;
>  }
>  
>  if (reinit)

lgtm otherwise.

Thanks
-- 
Andriy
___
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 5/7] avcodec/v4l2_context: resume the decoding process after source change event received.

2022-01-04 Thread Andriy Gelman
On Tue, 04. Jan 17:08, Ming Qian wrote:
> client need to resume the decoding process
> after it dequeues the source change event.
> no matter what's the return value of v4l2_resolution_changed().
> if the client doesn't resume the decoding process,
> the decoder may keep waiting
> 
> in documentation of v4l2 stateful decoder, we can see the following
> description:
>   The client must continue the sequence as described below to
>   continue the decoding process.
>   1.  Dequeue the source change event.
>   Important
>   A source change triggers an implicit decoder drain,
>   similar to the explicit Drain sequence. The decoder is
>   stopped after it completes. The decoding process must be
>   resumed with either a pair of calls to
>   VIDIOC_STREAMOFF() and VIDIOC_STREAMON() on the CAPTURE
>   queue, or a call to VIDIOC_DECODER_CMD() with the
>   V4L2_DEC_CMD_START command.
>   2.  Continue with the Capture Setup sequence.
> 

This is just a clean up to remove the reinit variable so the commit title and
description are wrong.

Thanks,
-- 
Andriy
___
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] [EXT] Re: [PATCH v4 2/3] avcodec/v4l2_context: resume the decoding process after source change event received.

2022-01-04 Thread Andriy Gelman
Hi Ming,

On Tue, 04. Jan 07:51, Ming Qian wrote:
> 
> > -Original Message-
> > From: Andriy Gelman [mailto:andriy.gel...@gmail.com]
> > Sent: Monday, January 3, 2022 12:41 AM
> > To: FFmpeg development discussions and patches 
> > Cc: Ming Qian 
> > Subject: [EXT] Re: [FFmpeg-devel] [PATCH v4 2/3] avcodec/v4l2_context:
> > resume the decoding process after source change event received.
> > 
> > Caution: EXT Email
> > 
> > On Thu, 19. Aug 16:55, Ming Qian wrote:
> > > client need to resume the decoding process after it dequeues the
> > > source change event.
> > > no matter what's the return value of v4l2_resolution_changed().
> > > if the client doesn't resume the decoding process, the decoder may
> > > keep waiting
> > >
> > > in documentation of v4l2 stateful decoder, we can see the following
> > > description:
> > >   The client must continue the sequence as described below to
> > >   continue the decoding process.
> > >   1.  Dequeue the source change event.
> > >   Important
> > >   A source change triggers an implicit decoder drain,
> > >   similar to the explicit Drain sequence. The decoder is
> > >   stopped after it completes. The decoding process must be
> > >   resumed with either a pair of calls to
> > >   VIDIOC_STREAMOFF() and VIDIOC_STREAMON() on the
> > CAPTURE
> > >   queue, or a call to VIDIOC_DECODER_CMD() with the
> > >   V4L2_DEC_CMD_START command.
> > >   2.  Continue with the Capture Setup sequence.
> > 
> > Please also add that this fixes decoding of
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstreams
> > .videolan.org%2Fffmpeg%2Fincoming%2F720p60.mp4&data=04%7C01%
> > 7Cming.qian%40nxp.com%7Cea94a9c4cc0643b0a41f08d9ce0eadc5%7C686e
> > a1d3bc2b4c6fa92cd99c5c301635%7C0%7C1%7C637767384703207931%7CU
> > nknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6
> > Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=X4rKQX19MQg1gO3ILiBCQ
> > qSLIvqovZLA95KKiyoVNzI%3D&reserved=0 on RPi4.
> > 

> 
> Hi Andriy,
> What's wrong with this stream? Everything is normal on my side when I 
> play it using ffplay.
> 

I couldn't decode the file on the Raspberry Pi4. After enqueuing the first few 
packets
there was a dynamic resolution change event, and the start decode command
was not sent. This is fixed by your patch.

Thanks,
-- 
Andriy
___
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] [EXT] Re: [PATCH v4 2/3] avcodec/v4l2_context: resume the decoding process after source change event received.

2022-01-04 Thread Andriy Gelman
On Tue, 04. Jan 17:48, Andriy Gelman wrote:
> Hi Ming,
> 
> On Tue, 04. Jan 07:51, Ming Qian wrote:
> > 
> > > -Original Message-
> > > From: Andriy Gelman [mailto:andriy.gel...@gmail.com]
> > > Sent: Monday, January 3, 2022 12:41 AM
> > > To: FFmpeg development discussions and patches 
> > > Cc: Ming Qian 
> > > Subject: [EXT] Re: [FFmpeg-devel] [PATCH v4 2/3] avcodec/v4l2_context:
> > > resume the decoding process after source change event received.
> > > 
> > > Caution: EXT Email
> > > 
> > > On Thu, 19. Aug 16:55, Ming Qian wrote:
> > > > client need to resume the decoding process after it dequeues the
> > > > source change event.
> > > > no matter what's the return value of v4l2_resolution_changed().
> > > > if the client doesn't resume the decoding process, the decoder may
> > > > keep waiting
> > > >
> > > > in documentation of v4l2 stateful decoder, we can see the following
> > > > description:
> > > >   The client must continue the sequence as described below to
> > > >   continue the decoding process.
> > > >   1.  Dequeue the source change event.
> > > >   Important
> > > >   A source change triggers an implicit decoder drain,
> > > >   similar to the explicit Drain sequence. The decoder is
> > > >   stopped after it completes. The decoding process must be
> > > >   resumed with either a pair of calls to
> > > >   VIDIOC_STREAMOFF() and VIDIOC_STREAMON() on the
> > > CAPTURE
> > > >   queue, or a call to VIDIOC_DECODER_CMD() with the
> > > >   V4L2_DEC_CMD_START command.
> > > >   2.  Continue with the Capture Setup sequence.
> > > 
> > > Please also add that this fixes decoding of
> > > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstreams
> > > .videolan.org%2Fffmpeg%2Fincoming%2F720p60.mp4&data=04%7C01%
> > > 7Cming.qian%40nxp.com%7Cea94a9c4cc0643b0a41f08d9ce0eadc5%7C686e
> > > a1d3bc2b4c6fa92cd99c5c301635%7C0%7C1%7C637767384703207931%7CU
> > > nknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6
> > > Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=X4rKQX19MQg1gO3ILiBCQ
> > > qSLIvqovZLA95KKiyoVNzI%3D&reserved=0 on RPi4.
> > > 
> 
> > 
> > Hi Andriy,
> > What's wrong with this stream? Everything is normal on my side when I 
> > play it using ffplay.
> > 

> 
> I couldn't decode the file on the Raspberry Pi4. After enqueuing the first 
> few packets
> there was a dynamic resolution change event, and the start decode command
> was not sent. This is fixed by your patch.

Also you may have to upgrade kernel to reproduce. It may have been working fine
before this commit:
https://github.com/raspberrypi/linux/commit/b7e6b495eff31298ba4665f71b2414cc9a8f99c2#diff-93defb6da917ce9bb43cb195d0e61f81673c5183ac75d631f3e1ee475a810dd6

-- 
Andriy
___
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/videotoolbox: Fix undefined symbol with minimal configuration

2022-01-04 Thread Cameron Gutman


> On Jan 4, 2022, at 3:43 AM, lance.lmw...@gmail.com wrote:
> 
> From: Limin Wang 
> 
> Please reproduced with the following minimal configure command:
> ./configure --enable-shared --disable-all --enable-avcodec 
> --enable-decoder=h264 --enable-hwaccel=h264_videotoolbox
> 
> You'll get below error:
> 
> Undefined symbols for architecture x86_64:
>  "_ff_videotoolbox_vpcc_extradata_create", referenced from:
>  _videotoolbox_start in videotoolbox.o
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see 
> invocation)
> 
> Reported-by: Cameron Gutman 
> Signed-off-by: Limin Wang 
> ---

Thanks, this fixes the build break for me. Please merge it into 5.0 if possible.

Tested-by: Cameron Gutman 

> libavcodec/videotoolbox.c | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> index 69beb38..51d4eac 100644
> --- a/libavcodec/videotoolbox.c
> +++ b/libavcodec/videotoolbox.c
> @@ -825,11 +825,13 @@ static CFDictionaryRef 
> videotoolbox_decoder_config_create(CMVideoCodecType codec
> if (data)
> CFDictionarySetValue(avc_info, CFSTR("hvcC"), data);
> break;
> +#if CONFIG_VP9_VIDEOTOOLBOX_HWACCEL
> case kCMVideoCodecType_VP9 :
> data = ff_videotoolbox_vpcc_extradata_create(avctx);
> if (data)
> CFDictionarySetValue(avc_info, CFSTR("vpcC"), data);
> break;
> +#endif
> default:
> break;
> }
> -- 
> 1.8.3.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 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] avformat/imf: fix error CPL root element is absent

2022-01-04 Thread Zane van Iperen




On 4/1/22 16:11, p...@sandflow.com wrote:

  cpl_element = xmlDocGetRootElement(doc);
-if (xmlStrcmp(cpl_element->name, "CompositionPlaylist")) {
+if ((!cpl_element) || xmlStrcmp(cpl_element->name, "CompositionPlaylist")) 
{


Nit: Extra set of parens around "!cpl_element".

Otherwise, this lgtm, I'll apply and backport this soon with that change.


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

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


[FFmpeg-devel] [PATCH] Changelog: add IMF demuxer

2022-01-04 Thread Zane van Iperen
Suggested-By: Pierre-Anthony Lemieux 
Signed-off-by: Zane van Iperen 
---
 Changelog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Changelog b/Changelog
index edb4152d0f..8e11fe6d35 100644
--- a/Changelog
+++ b/Changelog
@@ -44,6 +44,7 @@ version :
 - yadif_videotoolbox filter
 - VideoToolbox ProRes encoder
 - anlmf audio filter
+- IMF demuxer (experimental)
 
 
 version 4.4:
-- 
2.33.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 v1] avformat/imf: fix CPL parsing error handling

2022-01-04 Thread Zane van Iperen




On 4/1/22 16:10, p...@sandflow.com wrote:

From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
---
  libavformat/imf_cpl.c | 51 +++
  1 file changed, 27 insertions(+), 24 deletions(-)


Could you please resend this as two separate commits? One with the change, one
with the re-indenting? It makes it easier to review (and bisect) in the future.

For reference, the effective change is:

diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c
index 28798d3e36..366a1be9e2 100644
--- a/libavformat/imf_cpl.c
+++ b/libavformat/imf_cpl.c
@@ -807,7 +807,9 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl)
 av_log(NULL, AV_LOG_ERROR, "Cannot read IMF CPL\n");
 if (ret == 0)
 ret = AVERROR_INVALIDDATA;
-} else {
+goto clean_up;
+}
+
 LIBXML_TEST_VERSION
 
 filesize = buf.len;

@@ -817,6 +819,7 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl)
AV_LOG_ERROR,
"XML parsing failed when reading the IMF CPL\n");
 ret = AVERROR_INVALIDDATA;
+goto clean_up;
 }
 
 if ((ret = ff_imf_parse_cpl_from_xml_dom(doc, cpl))) {

@@ -833,8 +836,8 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl)
 }
 
 xmlFreeDoc(doc);

-}
 
+clean_up:

 av_bprint_finalize(&buf, NULL);
 
 return ret;




+av_log(NULL,
+AV_LOG_INFO,
+"IMF CPL Id: " FF_IMF_UUID_FORMAT "\n",
+UID_ARG((*cpl)->id_uuid));
+}
+
+xmlFreeDoc(doc);
+


Trailing whitespace here.


___
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/videotoolbox: Fix undefined symbol with minimal configuration

2022-01-04 Thread lance . lmwang
On Tue, Jan 04, 2022 at 05:51:56PM -0600, Cameron Gutman wrote:
> 
> > On Jan 4, 2022, at 3:43 AM, lance.lmw...@gmail.com wrote:
> > 
> > From: Limin Wang 
> > 
> > Please reproduced with the following minimal configure command:
> > ./configure --enable-shared --disable-all --enable-avcodec 
> > --enable-decoder=h264 --enable-hwaccel=h264_videotoolbox
> > 
> > You'll get below error:
> > 
> > Undefined symbols for architecture x86_64:
> >  "_ff_videotoolbox_vpcc_extradata_create", referenced from:
> >  _videotoolbox_start in videotoolbox.o
> > ld: symbol(s) not found for architecture x86_64
> > clang: error: linker command failed with exit code 1 (use -v to see 
> > invocation)
> > 
> > Reported-by: Cameron Gutman 
> > Signed-off-by: Limin Wang 
> > ---
> 
> Thanks, this fixes the build break for me. Please merge it into 5.0 if 
> possible.
> 
> Tested-by: Cameron Gutman 

thank for the testing, will apply and try to merge to 5.0.

> 
> > libavcodec/videotoolbox.c | 2 ++
> > 1 file changed, 2 insertions(+)
> > 
> > diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> > index 69beb38..51d4eac 100644
> > --- a/libavcodec/videotoolbox.c
> > +++ b/libavcodec/videotoolbox.c
> > @@ -825,11 +825,13 @@ static CFDictionaryRef 
> > videotoolbox_decoder_config_create(CMVideoCodecType codec
> > if (data)
> > CFDictionarySetValue(avc_info, CFSTR("hvcC"), data);
> > break;
> > +#if CONFIG_VP9_VIDEOTOOLBOX_HWACCEL
> > case kCMVideoCodecType_VP9 :
> > data = ff_videotoolbox_vpcc_extradata_create(avctx);
> > if (data)
> > CFDictionarySetValue(avc_info, CFSTR("vpcC"), data);
> > break;
> > +#endif
> > default:
> > break;
> > }
> > -- 
> > 1.8.3.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".
> 

-- 
Thanks,
Limin Wang
___
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/videotoolbox: Fix undefined symbol with minimal configuration

2022-01-04 Thread James Almer




On 1/4/2022 10:15 PM, lance.lmw...@gmail.com wrote:

On Tue, Jan 04, 2022 at 05:51:56PM -0600, Cameron Gutman wrote:



On Jan 4, 2022, at 3:43 AM, lance.lmw...@gmail.com wrote:

From: Limin Wang 

Please reproduced with the following minimal configure command:
./configure --enable-shared --disable-all --enable-avcodec 
--enable-decoder=h264 --enable-hwaccel=h264_videotoolbox

You'll get below error:

Undefined symbols for architecture x86_64:
  "_ff_videotoolbox_vpcc_extradata_create", referenced from:
  _videotoolbox_start in videotoolbox.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Reported-by: Cameron Gutman 
Signed-off-by: Limin Wang 
---


Thanks, this fixes the build break for me. Please merge it into 5.0 if possible.

Tested-by: Cameron Gutman 


thank for the testing, will apply and try to merge to 5.0.


A cherry-pick should work without conflicts for this change.






libavcodec/videotoolbox.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 69beb38..51d4eac 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -825,11 +825,13 @@ static CFDictionaryRef 
videotoolbox_decoder_config_create(CMVideoCodecType codec
 if (data)
 CFDictionarySetValue(avc_info, CFSTR("hvcC"), data);
 break;
+#if CONFIG_VP9_VIDEOTOOLBOX_HWACCEL
 case kCMVideoCodecType_VP9 :
 data = ff_videotoolbox_vpcc_extradata_create(avctx);
 if (data)
 CFDictionarySetValue(avc_info, CFSTR("vpcC"), data);
 break;
+#endif
 default:
 break;
 }
--
1.8.3.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 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/videotoolbox: Fix undefined symbol with minimal configuration

2022-01-04 Thread lance . lmwang
On Tue, Jan 04, 2022 at 10:17:17PM -0300, James Almer wrote:
> 
> 
> On 1/4/2022 10:15 PM, lance.lmw...@gmail.com wrote:
> > On Tue, Jan 04, 2022 at 05:51:56PM -0600, Cameron Gutman wrote:
> > > 
> > > > On Jan 4, 2022, at 3:43 AM, lance.lmw...@gmail.com wrote:
> > > > 
> > > > From: Limin Wang 
> > > > 
> > > > Please reproduced with the following minimal configure command:
> > > > ./configure --enable-shared --disable-all --enable-avcodec 
> > > > --enable-decoder=h264 --enable-hwaccel=h264_videotoolbox
> > > > 
> > > > You'll get below error:
> > > > 
> > > > Undefined symbols for architecture x86_64:
> > > >   "_ff_videotoolbox_vpcc_extradata_create", referenced from:
> > > >   _videotoolbox_start in videotoolbox.o
> > > > ld: symbol(s) not found for architecture x86_64
> > > > clang: error: linker command failed with exit code 1 (use -v to see 
> > > > invocation)
> > > > 
> > > > Reported-by: Cameron Gutman 
> > > > Signed-off-by: Limin Wang 
> > > > ---
> > > 
> > > Thanks, this fixes the build break for me. Please merge it into 5.0 if 
> > > possible.
> > > 
> > > Tested-by: Cameron Gutman 
> > 
> > thank for the testing, will apply and try to merge to 5.0.
> 
> A cherry-pick should work without conflicts for this change.

Yes, I'm glad to use cherry-pick for merge always.

> 
> > 
> > > 
> > > > libavcodec/videotoolbox.c | 2 ++
> > > > 1 file changed, 2 insertions(+)
> > > > 
> > > > diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> > > > index 69beb38..51d4eac 100644
> > > > --- a/libavcodec/videotoolbox.c
> > > > +++ b/libavcodec/videotoolbox.c
> > > > @@ -825,11 +825,13 @@ static CFDictionaryRef 
> > > > videotoolbox_decoder_config_create(CMVideoCodecType codec
> > > >  if (data)
> > > >  CFDictionarySetValue(avc_info, CFSTR("hvcC"), data);
> > > >  break;
> > > > +#if CONFIG_VP9_VIDEOTOOLBOX_HWACCEL
> > > >  case kCMVideoCodecType_VP9 :
> > > >  data = ff_videotoolbox_vpcc_extradata_create(avctx);
> > > >  if (data)
> > > >  CFDictionarySetValue(avc_info, CFSTR("vpcC"), data);
> > > >  break;
> > > > +#endif
> > > >  default:
> > > >  break;
> > > >  }
> > > > -- 
> > > > 1.8.3.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 mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

-- 
Thanks,
Limin Wang
___
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] avformat/imf: fix bad free() when directory name of the input url is empty

2022-01-04 Thread Zane van Iperen




On 4/1/22 01:59, p...@sandflow.com wrote:

From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
---

Notes:
 Found through manual fuzzing.

  libavformat/imfdec.c | 6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c
index f17064cfcd..4e42db8d30 100644
--- a/libavformat/imfdec.c
+++ b/libavformat/imfdec.c
@@ -622,11 +622,15 @@ static int imf_read_header(AVFormatContext *s)
  int ret = 0;
  
  c->interrupt_callback = &s->interrupt_callback;

+
  tmp_str = av_strdup(s->url);
  if (!tmp_str)
  return AVERROR(ENOMEM);
+c->base_url = av_strdup(av_dirname(tmp_str));


Is the second av_strdup() here required? You've already done it above
and av_dirname() just sticks a '\0' at the last separator, so it should
be safe to remove it:

  if (!(c->base_url = av_strdup(s->url)))
  return AVERROR(ENOMEM);

  c->base_url = av_dirname(c->base_url);
___
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] avformat/imf: fix bad free() when directory name of the input url is empty

2022-01-04 Thread Pierre-Anthony Lemieux
On Tue, Jan 4, 2022 at 5:39 PM Zane van Iperen  wrote:
>
>
>
> On 4/1/22 01:59, p...@sandflow.com wrote:
> > From: Pierre-Anthony Lemieux 
> >
> > Signed-off-by: Pierre-Anthony Lemieux 
> > ---
> >
> > Notes:
> >  Found through manual fuzzing.
> >
> >   libavformat/imfdec.c | 6 +-
> >   1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c
> > index f17064cfcd..4e42db8d30 100644
> > --- a/libavformat/imfdec.c
> > +++ b/libavformat/imfdec.c
> > @@ -622,11 +622,15 @@ static int imf_read_header(AVFormatContext *s)
> >   int ret = 0;
> >
> >   c->interrupt_callback = &s->interrupt_callback;
> > +
> >   tmp_str = av_strdup(s->url);
> >   if (!tmp_str)
> >   return AVERROR(ENOMEM);
> > +c->base_url = av_strdup(av_dirname(tmp_str));
>
> Is the second av_strdup() here required? You've already done it above
> and av_dirname() just sticks a '\0' at the last separator,

This is what I thought.

> so it should
> be safe to remove it:

As I understand it, av_dirname() actually returns a pointer to its own
"." string when the input is either empty or does not contain, in
which case we must make a copy.

>
>if (!(c->base_url = av_strdup(s->url)))
>return AVERROR(ENOMEM);
>
>c->base_url = av_dirname(c->base_url);
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [EXT] Re: [PATCH v4 2/3] avcodec/v4l2_context: resume the decoding process after source change event received.

2022-01-04 Thread Ming Qian


> -Original Message-
> From: Andriy Gelman [mailto:andriy.gel...@gmail.com]
> Sent: Wednesday, January 5, 2022 6:58 AM
> To: Ming Qian 
> Cc: FFmpeg development discussions and patches 
> Subject: Re: [EXT] Re: [FFmpeg-devel] [PATCH v4 2/3] avcodec/v4l2_context:
> resume the decoding process after source change event received.
> 
> Caution: EXT Email
> 
> On Tue, 04. Jan 17:48, Andriy Gelman wrote:
> > Hi Ming,
> >
> > On Tue, 04. Jan 07:51, Ming Qian wrote:
> > >
> > > > -Original Message-
> > > > From: Andriy Gelman [mailto:andriy.gel...@gmail.com]
> > > > Sent: Monday, January 3, 2022 12:41 AM
> > > > To: FFmpeg development discussions and patches
> > > > 
> > > > Cc: Ming Qian 
> > > > Subject: [EXT] Re: [FFmpeg-devel] [PATCH v4 2/3] avcodec/v4l2_context:
> > > > resume the decoding process after source change event received.
> > > >
> > > > Caution: EXT Email
> > > >
> > > > On Thu, 19. Aug 16:55, Ming Qian wrote:
> > > > > client need to resume the decoding process after it dequeues the
> > > > > source change event.
> > > > > no matter what's the return value of v4l2_resolution_changed().
> > > > > if the client doesn't resume the decoding process, the decoder
> > > > > may keep waiting
> > > > >
> > > > > in documentation of v4l2 stateful decoder, we can see the
> > > > > following
> > > > > description:
> > > > >   The client must continue the sequence as described below to
> > > > >   continue the decoding process.
> > > > >   1.  Dequeue the source change event.
> > > > >   Important
> > > > >   A source change triggers an implicit decoder drain,
> > > > >   similar to the explicit Drain sequence. The decoder is
> > > > >   stopped after it completes. The decoding process must
> be
> > > > >   resumed with either a pair of calls to
> > > > >   VIDIOC_STREAMOFF() and VIDIOC_STREAMON() on
> the
> > > > CAPTURE
> > > > >   queue, or a call to VIDIOC_DECODER_CMD() with the
> > > > >   V4L2_DEC_CMD_START command.
> > > > >   2.  Continue with the Capture Setup sequence.
> > > >
> > > > Please also add that this fixes decoding of
> > > > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
> > > > streams
> > > > .videolan.org%2Fffmpeg%2Fincoming%2F720p60.mp4&data=04%7
> C01%
> > > >
> 7Cming.qian%40nxp.com%7Cea94a9c4cc0643b0a41f08d9ce0eadc5%7C686e
> > > >
> a1d3bc2b4c6fa92cd99c5c301635%7C0%7C1%7C637767384703207931%7CU
> > > >
> nknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6
> > > >
> Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=X4rKQX19MQg1gO3ILiBCQ
> > > > qSLIvqovZLA95KKiyoVNzI%3D&reserved=0 on RPi4.
> > > >
> >
> > >
> > > Hi Andriy,
> > > What's wrong with this stream? Everything is normal on my side
> when I play it using ffplay.
> > >
> 
> >
> > I couldn't decode the file on the Raspberry Pi4. After enqueuing the
> > first few packets there was a dynamic resolution change event, and the
> > start decode command was not sent. This is fixed by your patch.
> 
> Also you may have to upgrade kernel to reproduce. It may have been working
> fine before this commit:
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.
> com%2Fraspberrypi%2Flinux%2Fcommit%2Fb7e6b495eff31298ba4665f71b2
> 414cc9a8f99c2%23diff-93defb6da917ce9bb43cb195d0e61f81673c5183ac75
> d631f3e1ee475a810dd6&data=04%7C01%7Cming.qian%40nxp.com%7C
> 64fa84ae1325497b2b4408d9cfd5aabd%7C686ea1d3bc2b4c6fa92cd99c5c301
> 635%7C0%7C1%7C637769338865335050%7CUnknown%7CTWFpbGZsb3d8e
> yJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%
> 7C3000&sdata=ZCuu2FL5EusXxilM%2BkdpLjQDXnvVhFIXsKeIVHPKWHY%
> 3D&reserved=0
> 

I got it, but I didn't have a Raspberry Pi4 on hand right now, maybe I can test 
it again after I get one.
I make this patch according the v4l2 decoder specification and test it on NXP 
i.MX 8Q and i.MX8M

> --
> Andriy
___
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] lavfi/libplacebo: support dovi metadata application

2022-01-04 Thread Niklas Haas
From: Niklas Haas 

libplacebo supports automatic dolby vision application, but it requires
us to switch to a new API. Also add some logic to strip the dolby vision
metadata from the output frames in any case where we end up changing the
colorimetry.

The libplacebo dependency bump is justified because neither 184 nor 192
are part of any stable libplacebo release, so users have to build from
git anyways for this filter to exist.

Signed-off-by: Niklas Haas 
---
 configure   |  2 +-
 libavfilter/vf_libplacebo.c | 35 ---
 2 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 64538b17e2..8392c26015 100755
--- a/configure
+++ b/configure
@@ -6588,7 +6588,7 @@ enabled libopus   && {
 require_pkg_config libopus opus opus_multistream.h 
opus_multistream_surround_encoder_create
 }
 }
-enabled libplacebo&& require_pkg_config libplacebo "libplacebo >= 
4.184.0" libplacebo/vulkan.h pl_vulkan_create
+enabled libplacebo&& require_pkg_config libplacebo "libplacebo >= 
4.192.0" libplacebo/vulkan.h pl_vulkan_create
 enabled libpulse  && require_pkg_config libpulse libpulse 
pulse/pulseaudio.h pa_context_new
 enabled librabbitmq   && require_pkg_config librabbitmq "librabbitmq >= 
0.7.1" amqp.h amqp_new_connection
 enabled librav1e  && require_pkg_config librav1e "rav1e >= 0.4.0" 
rav1e.h rav1e_context_new
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index 5b1e7b5285..1386aaeb3a 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -47,6 +47,7 @@ typedef struct LibplaceboContext {
 int force_divisible_by;
 int normalize_sar;
 int apply_filmgrain;
+int apply_dovi;
 int colorspace;
 int color_range;
 int color_primaries;
@@ -281,8 +282,16 @@ static int process_frames(AVFilterContext *avctx, AVFrame 
*out, AVFrame *in)
 LibplaceboContext *s = avctx->priv;
 struct pl_render_params params;
 struct pl_frame image, target;
-ok = pl_map_avframe(s->gpu, &image, NULL, in);
-ok &= pl_map_avframe(s->gpu, &target, NULL, out);
+ok = pl_map_avframe_ex(s->gpu, &image, pl_avframe_params(
+.frame= in,
+.map_dovi = s->apply_dovi,
+));
+
+ok &= pl_map_avframe_ex(s->gpu, &target, pl_avframe_params(
+.frame= out,
+.map_dovi = false,
+));
+
 if (!ok) {
 err = AVERROR_EXTERNAL;
 goto fail;
@@ -381,7 +390,7 @@ fail:
 
 static int filter_frame(AVFilterLink *link, AVFrame *in)
 {
-int err;
+int err, changed;
 AVFilterContext *ctx = link->dst;
 LibplaceboContext *s = ctx->priv;
 AVFilterLink *outlink = ctx->outputs[0];
@@ -400,6 +409,14 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
 out->width = outlink->w;
 out->height = outlink->h;
 
+if (s->apply_dovi && av_frame_get_side_data(in, 
AV_FRAME_DATA_DOVI_METADATA)) {
+/* Output of dovi reshaping is always BT.2020+PQ, so infer the correct
+ * output colorspace defaults */
+out->colorspace = AVCOL_SPC_BT2020_NCL;
+out->color_primaries = AVCOL_PRI_BT2020;
+out->color_trc = AVCOL_TRC_SMPTE2084;
+}
+
 if (s->colorspace >= 0)
 out->colorspace = s->colorspace;
 if (s->color_range >= 0)
@@ -411,6 +428,17 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
 
 RET(process_frames(ctx, out, in));
 
+int changed_csp = s->colorspace  != out->colorspace ||
+  s->color_range != out->color_range||
+  s->color_trc   != out->color_trc  ||
+  s->color_primaries != out->color_primaries;
+
+if (s->apply_dovi || changed_csp) {
+/* Strip side data if no longer relevant */
+av_frame_remove_side_data(out, AV_FRAME_DATA_DOVI_RPU_BUFFER);
+av_frame_remove_side_data(out, AV_FRAME_DATA_DOVI_METADATA);
+}
+
 if (s->apply_filmgrain)
 av_frame_remove_side_data(out, AV_FRAME_DATA_FILM_GRAIN_PARAMS);
 
@@ -559,6 +587,7 @@ static const AVOption libplacebo_options[] = {
 { "antiringing", "Antiringing strength (for non-EWA filters)", 
OFFSET(antiringing), AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, 0.0, 1.0, DYNAMIC },
 { "sigmoid", "Enable sigmoid upscaling", OFFSET(sigmoid), 
AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DYNAMIC },
 { "apply_filmgrain", "Apply film grain metadata", OFFSET(apply_filmgrain), 
AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DYNAMIC },
+{ "apply_dolbyvision", "Apply Dolby Vision metadata", OFFSET(apply_dovi), 
AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DYNAMIC },
 
 { "deband", "Enable debanding", OFFSET(deband), AV_OPT_TYPE_BOOL, {.i64 = 
0}, 0, 1, DYNAMIC },
 { "deband_iterations", "Deband iterations", OFFSET(deband_iterations), 
AV_OPT_TYPE_INT, {.i64 = 1}, 0, 16, DYNAMIC },
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpe

Re: [FFmpeg-devel] [PATCH v1] avformat/imf: fix bad free() when directory name of the input url is empty

2022-01-04 Thread Zane van Iperen




On 5/1/22 11:44, Pierre-Anthony Lemieux wrote:

On Tue, Jan 4, 2022 at 5:39 PM Zane van Iperen  wrote:




On 4/1/22 01:59, p...@sandflow.com wrote:

From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
---

Notes:
  Found through manual fuzzing.

   libavformat/imfdec.c | 6 +-
   1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c
index f17064cfcd..4e42db8d30 100644
--- a/libavformat/imfdec.c
+++ b/libavformat/imfdec.c
@@ -622,11 +622,15 @@ static int imf_read_header(AVFormatContext *s)
   int ret = 0;

   c->interrupt_callback = &s->interrupt_callback;
+
   tmp_str = av_strdup(s->url);
   if (!tmp_str)
   return AVERROR(ENOMEM);
+c->base_url = av_strdup(av_dirname(tmp_str));


Is the second av_strdup() here required? You've already done it above
and av_dirname() just sticks a '\0' at the last separator,


This is what I thought.


so it should
be safe to remove it:


As I understand it, av_dirname() actually returns a pointer to its own
"." string when the input is either empty or does not contain, in
which case we must make a copy.



You're right. This is ugly, but I don't see a nicer way to do it.

This lgtm then.



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

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


Re: [FFmpeg-devel] [PATCH] doc/developer: patches should not cross libs or mix MAINTAINER changes in

2022-01-04 Thread Lynne
4 Jan 2022, 21:06 by mich...@niedermayer.cc:

> maintainer part inspired by IRC comments by lynne
>
> Signed-off-by: Michael Niedermayer 
> ---
>  doc/developer.texi | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/doc/developer.texi b/doc/developer.texi
> index addee0d8263..eae3ade48a7 100644
> --- a/doc/developer.texi
> +++ b/doc/developer.texi
> @@ -683,6 +683,10 @@ are notoriously left unchecked, which is a serious 
> problem.
>  @item
>  Test your code with valgrind and or Address Sanitizer to ensure it's free
>  of leaks, out of array accesses, etc.
> +
> +@item
> +Changes to 2 libs which change both versions should be in 2 seperate patches.
> +Non cosmetic changes to @file{MAINTAINERS} should not be in a patch with 
> other changes.
>  @end enumerate 
>

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

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


[FFmpeg-devel] [PATCH v2 1/2] avformat/imf: fix CPL parsing error handling

2022-01-04 Thread pal
From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
---
 libavformat/imf_cpl.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c
index 7055b49ae8..f49469f56e 100644
--- a/libavformat/imf_cpl.c
+++ b/libavformat/imf_cpl.c
@@ -807,7 +807,9 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl)
 av_log(NULL, AV_LOG_ERROR, "Cannot read IMF CPL\n");
 if (ret == 0)
 ret = AVERROR_INVALIDDATA;
-} else {
+goto clean_up;
+}
+
 LIBXML_TEST_VERSION
 
 filesize = buf.len;
@@ -817,6 +819,7 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl)
AV_LOG_ERROR,
"XML parsing failed when reading the IMF CPL\n");
 ret = AVERROR_INVALIDDATA;
+goto clean_up;
 }
 
 if ((ret = ff_imf_parse_cpl_from_xml_dom(doc, cpl))) {
@@ -833,8 +836,8 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl)
 }
 
 xmlFreeDoc(doc);
-}
 
+clean_up:
 av_bprint_finalize(&buf, NULL);
 
 return ret;
-- 
2.17.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 v2 2/2] avformat/imf: Fix indentation

2022-01-04 Thread pal
From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
---
 libavformat/imf_cpl.c | 48 +--
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c
index f49469f56e..32e805cdd4 100644
--- a/libavformat/imf_cpl.c
+++ b/libavformat/imf_cpl.c
@@ -810,32 +810,32 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl)
 goto clean_up;
 }
 
-LIBXML_TEST_VERSION
-
-filesize = buf.len;
-doc = xmlReadMemory(buf.str, filesize, NULL, NULL, 0);
-if (!doc) {
-av_log(NULL,
-   AV_LOG_ERROR,
-   "XML parsing failed when reading the IMF CPL\n");
-ret = AVERROR_INVALIDDATA;
-goto clean_up;
-}
+LIBXML_TEST_VERSION
+
+filesize = buf.len;
+doc = xmlReadMemory(buf.str, filesize, NULL, NULL, 0);
+if (!doc) {
+av_log(NULL,
+AV_LOG_ERROR,
+"XML parsing failed when reading the IMF CPL\n");
+ret = AVERROR_INVALIDDATA;
+goto clean_up;
+}
 
-if ((ret = ff_imf_parse_cpl_from_xml_dom(doc, cpl))) {
-av_log(NULL, AV_LOG_ERROR, "Cannot parse IMF CPL\n");
-} else {
-av_log(NULL,
-   AV_LOG_INFO,
-   "IMF CPL ContentTitle: %s\n",
-   (*cpl)->content_title_utf8);
-av_log(NULL,
-   AV_LOG_INFO,
-   "IMF CPL Id: " FF_IMF_UUID_FORMAT "\n",
-   UID_ARG((*cpl)->id_uuid));
-}
+if ((ret = ff_imf_parse_cpl_from_xml_dom(doc, cpl))) {
+av_log(NULL, AV_LOG_ERROR, "Cannot parse IMF CPL\n");
+} else {
+av_log(NULL,
+AV_LOG_INFO,
+"IMF CPL ContentTitle: %s\n",
+(*cpl)->content_title_utf8);
+av_log(NULL,
+AV_LOG_INFO,
+"IMF CPL Id: " FF_IMF_UUID_FORMAT "\n",
+UID_ARG((*cpl)->id_uuid));
+}
 
-xmlFreeDoc(doc);
+xmlFreeDoc(doc);
 
 clean_up:
 av_bprint_finalize(&buf, NULL);
-- 
2.17.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 v1] avformat/imf: fix CPL parsing error handling

2022-01-04 Thread Pierre-Anthony Lemieux
On Tue, Jan 4, 2022 at 4:58 PM Zane van Iperen  wrote:
>
>
>
> On 4/1/22 16:10, p...@sandflow.com wrote:
> > From: Pierre-Anthony Lemieux 
> >
> > Signed-off-by: Pierre-Anthony Lemieux 
> > ---
> >   libavformat/imf_cpl.c | 51 +++
> >   1 file changed, 27 insertions(+), 24 deletions(-)
>
> Could you please resend this as two separate commits? One with the change, one
> with the re-indenting? It makes it easier to review (and bisect) in the 
> future.

Ok. Got it. See v2 at:

http://ffmpeg.org/pipermail/ffmpeg-devel/2022-January/290840.html

>
> For reference, the effective change is:
>
> diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c
> index 28798d3e36..366a1be9e2 100644
> --- a/libavformat/imf_cpl.c
> +++ b/libavformat/imf_cpl.c
> @@ -807,7 +807,9 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl)
>   av_log(NULL, AV_LOG_ERROR, "Cannot read IMF CPL\n");
>   if (ret == 0)
>   ret = AVERROR_INVALIDDATA;
> -} else {
> +goto clean_up;
> +}
> +
>   LIBXML_TEST_VERSION
>
>   filesize = buf.len;
> @@ -817,6 +819,7 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl)
>  AV_LOG_ERROR,
>  "XML parsing failed when reading the IMF CPL\n");
>   ret = AVERROR_INVALIDDATA;
> +goto clean_up;
>   }
>
>   if ((ret = ff_imf_parse_cpl_from_xml_dom(doc, cpl))) {
> @@ -833,8 +836,8 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl)
>   }
>
>   xmlFreeDoc(doc);
> -}
>
> +clean_up:
>   av_bprint_finalize(&buf, NULL);
>
>   return ret;
>
>
> > +av_log(NULL,
> > +AV_LOG_INFO,
> > +"IMF CPL Id: " FF_IMF_UUID_FORMAT "\n",
> > +UID_ARG((*cpl)->id_uuid));
> > +}
> > +
> > +xmlFreeDoc(doc);
> > +
>
> Trailing whitespace here.
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH V2 1/3] libavcodec/vaapi_encode: Add new API adaption to vaapi_encode

2022-01-04 Thread Wenbin Chen
Add vaSyncBuffer to VAAPI encoder. Old version API vaSyncSurface wait
surface to complete. When surface is used for multiple operation, it
waits all operations to finish. vaSyncBuffer only wait one channel to
finish.

Add wait param to vaapi_encode_wait() to prepare for the async_depth
option. "wait=1" means wait until operation ready. "wait=0" means
query operation's status. If it is ready return 0, if it is still
in progress return EAGAIN.

Signed-off-by: Wenbin Chen 
---
 libavcodec/vaapi_encode.c | 47 +--
 1 file changed, 40 insertions(+), 7 deletions(-)

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 3bf379b1a0..b87b58a42b 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -134,7 +134,8 @@ static int 
vaapi_encode_make_misc_param_buffer(AVCodecContext *avctx,
 }
 
 static int vaapi_encode_wait(AVCodecContext *avctx,
- VAAPIEncodePicture *pic)
+ VAAPIEncodePicture *pic,
+ uint8_t wait)
 {
 VAAPIEncodeContext *ctx = avctx->priv_data;
 VAStatus vas;
@@ -150,11 +151,43 @@ static int vaapi_encode_wait(AVCodecContext *avctx,
"(input surface %#x).\n", pic->display_order,
pic->encode_order, pic->input_surface);
 
-vas = vaSyncSurface(ctx->hwctx->display, pic->input_surface);
-if (vas != VA_STATUS_SUCCESS) {
-av_log(avctx, AV_LOG_ERROR, "Failed to sync to picture completion: "
-   "%d (%s).\n", vas, vaErrorStr(vas));
+#if VA_CHECK_VERSION(1, 9, 0)
+// Try vaSyncBuffer.
+vas = vaSyncBuffer(ctx->hwctx->display,
+   pic->output_buffer,
+   wait ? VA_TIMEOUT_INFINITE : 0);
+if (vas == VA_STATUS_ERROR_TIMEDOUT) {
+return AVERROR(EAGAIN);
+} else if (vas != VA_STATUS_SUCCESS && vas != 
VA_STATUS_ERROR_UNIMPLEMENTED) {
+av_log(avctx, AV_LOG_ERROR, "Failed to sync to output buffer 
completion: "
+"%d (%s).\n", vas, vaErrorStr(vas));
 return AVERROR(EIO);
+} else if (vas == VA_STATUS_ERROR_UNIMPLEMENTED)
+// If vaSyncBuffer is not implemented, try old version API.
+#endif
+{
+if (!wait) {
+VASurfaceStatus surface_status;
+vas = vaQuerySurfaceStatus(ctx->hwctx->display,
+pic->input_surface,
+&surface_status);
+if (vas == VA_STATUS_SUCCESS &&
+surface_status != VASurfaceReady &&
+surface_status != VASurfaceSkipped) {
+return AVERROR(EAGAIN);
+} else if (vas != VA_STATUS_SUCCESS) {
+av_log(avctx, AV_LOG_ERROR, "Failed to query surface status: "
+"%d (%s).\n", vas, vaErrorStr(vas));
+return AVERROR(EIO);
+}
+} else {
+vas = vaSyncSurface(ctx->hwctx->display, pic->input_surface);
+if (vas != VA_STATUS_SUCCESS) {
+av_log(avctx, AV_LOG_ERROR, "Failed to sync to picture 
completion: "
+"%d (%s).\n", vas, vaErrorStr(vas));
+return AVERROR(EIO);
+}
+}
 }
 
 // Input is definitely finished with now.
@@ -633,7 +666,7 @@ static int vaapi_encode_output(AVCodecContext *avctx,
 uint8_t *ptr;
 int err;
 
-err = vaapi_encode_wait(avctx, pic);
+err = vaapi_encode_wait(avctx, pic, 1);
 if (err < 0)
 return err;
 
@@ -695,7 +728,7 @@ fail:
 static int vaapi_encode_discard(AVCodecContext *avctx,
 VAAPIEncodePicture *pic)
 {
-vaapi_encode_wait(avctx, pic);
+vaapi_encode_wait(avctx, pic, 1);
 
 if (pic->output_buffer_ref) {
 av_log(avctx, AV_LOG_DEBUG, "Discard output for pic "
-- 
2.25.1

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

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


[FFmpeg-devel] [PATCH V2 2/3] libavcodec/vaapi_encode: Change the way to call async to increase performance

2022-01-04 Thread Wenbin Chen
Fix: #7706. After commit 5fdcf85bbffe7451c2, vaapi encoder's performance
decrease. The reason is that vaRenderPicture() and vaSyncBuffer() are
called at the same time (vaRenderPicture() always followed by a
vaSyncBuffer()). When we encode stream with B frames, we need buffer to
reorder frames, so we can send serveral frames to HW at once to increase
performance. Now I changed them to be called in a asynchronous way, which
will make better use of hardware. 1080p transcoding increases about 17%
fps on my environment.

This change fits vaSyncBuffer(), so if driver does not support
vaSyncBuffer, it will keep previous operation.

Signed-off-by: Wenbin Chen 
---
 libavcodec/vaapi_encode.c | 64 ---
 libavcodec/vaapi_encode.h |  5 +++
 2 files changed, 58 insertions(+), 11 deletions(-)

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index b87b58a42b..9a3b3ba4ad 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -984,8 +984,10 @@ static int vaapi_encode_pick_next(AVCodecContext *avctx,
 if (!pic && ctx->end_of_stream) {
 --b_counter;
 pic = ctx->pic_end;
-if (pic->encode_issued)
+if (pic->encode_complete)
 return AVERROR_EOF;
+else if (pic->encode_issued)
+return AVERROR(EAGAIN);
 }
 
 if (!pic) {
@@ -1210,18 +1212,45 @@ int ff_vaapi_encode_receive_packet(AVCodecContext 
*avctx, AVPacket *pkt)
 return AVERROR(EAGAIN);
 }
 
-pic = NULL;
-err = vaapi_encode_pick_next(avctx, &pic);
-if (err < 0)
-return err;
-av_assert0(pic);
+#if VA_CHECK_VERSION(1, 9, 0)
+if (ctx->has_sync_buffer_func) {
+while (av_fifo_size(ctx->encode_fifo) <=
+   MAX_PICTURE_REFERENCES * sizeof(VAAPIEncodePicture *)) {
+pic = NULL;
+err = vaapi_encode_pick_next(avctx, &pic);
+if (err < 0)
+break;
+
+av_assert0(pic);
+pic->encode_order = ctx->encode_order +
+(av_fifo_size(ctx->encode_fifo) / sizeof(VAAPIEncodePicture 
*));
+err = vaapi_encode_issue(avctx, pic);
+if (err < 0) {
+av_log(avctx, AV_LOG_ERROR, "Encode failed: %d.\n", err);
+return err;
+}
+av_fifo_generic_write(ctx->encode_fifo, &pic, sizeof(pic), NULL);
+}
+if (!av_fifo_size(ctx->encode_fifo))
+return err;
+av_fifo_generic_read(ctx->encode_fifo, &pic, sizeof(pic), NULL);
+ctx->encode_order = pic->encode_order + 1;
+} else
+#endif
+{
+pic = NULL;
+err = vaapi_encode_pick_next(avctx, &pic);
+if (err < 0)
+return err;
+av_assert0(pic);
 
-pic->encode_order = ctx->encode_order++;
+pic->encode_order = ctx->encode_order++;
 
-err = vaapi_encode_issue(avctx, pic);
-if (err < 0) {
-av_log(avctx, AV_LOG_ERROR, "Encode failed: %d.\n", err);
-return err;
+err = vaapi_encode_issue(avctx, pic);
+if (err < 0) {
+av_log(avctx, AV_LOG_ERROR, "Encode failed: %d.\n", err);
+return err;
+}
 }
 
 err = vaapi_encode_output(avctx, pic, pkt);
@@ -2555,6 +2584,18 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
 }
 }
 
+#if VA_CHECK_VERSION(1, 9, 0)
+//check vaSyncBuffer function
+vas = vaSyncBuffer(ctx->hwctx->display, 0, 0);
+if (vas != VA_STATUS_ERROR_UNIMPLEMENTED) {
+ctx->has_sync_buffer_func = 1;
+ctx->encode_fifo = av_fifo_alloc((MAX_PICTURE_REFERENCES + 1) *
+sizeof(VAAPIEncodePicture *));
+if (!ctx->encode_fifo)
+return AVERROR(ENOMEM);
+}
+#endif
+
 return 0;
 
 fail:
@@ -2592,6 +2633,7 @@ av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
 
 av_freep(&ctx->codec_sequence_params);
 av_freep(&ctx->codec_picture_params);
+av_fifo_freep(&ctx->encode_fifo);
 
 av_buffer_unref(&ctx->recon_frames_ref);
 av_buffer_unref(&ctx->input_frames_ref);
diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
index b41604a883..560a1c42a9 100644
--- a/libavcodec/vaapi_encode.h
+++ b/libavcodec/vaapi_encode.h
@@ -29,6 +29,7 @@
 
 #include "libavutil/hwcontext.h"
 #include "libavutil/hwcontext_vaapi.h"
+#include "libavutil/fifo.h"
 
 #include "avcodec.h"
 #include "hwconfig.h"
@@ -345,6 +346,10 @@ typedef struct VAAPIEncodeContext {
 int roi_warned;
 
 AVFrame *frame;
+//Store buffered pic
+AVFifoBuffer *encode_fifo;
+//Whether the driver support vaSyncBuffer
+int has_sync_buffer_func;
 } VAAPIEncodeContext;
 
 enum {
-- 
2.25.1

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

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

[FFmpeg-devel] [PATCH V2 3/3] libavcodec/vaapi_encode: Add async_depth to vaapi_encoder to increase performance

2022-01-04 Thread Wenbin Chen
Add async_depth to increase encoder's performance. Reuse encode_fifo as
async buffer. Encoder puts all reordered frame to HW and then check
fifo size. If fifo < async_depth and the top frame is not ready, it will
return AVERROR(EAGAIN) to require more frames.

1080p transcoding (no B frames) with -async_depth=4 can increase 20%
performance on my environment.
The async increases performance but also introduces frame delay.

Signed-off-by: Wenbin Chen 
---
 libavcodec/vaapi_encode.c | 19 ++-
 libavcodec/vaapi_encode.h | 12 ++--
 2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 9a3b3ba4ad..f9ffca0475 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -1158,7 +1158,8 @@ static int vaapi_encode_send_frame(AVCodecContext *avctx, 
AVFrame *frame)
 if (ctx->input_order == ctx->decode_delay)
 ctx->dts_pts_diff = pic->pts - ctx->first_pts;
 if (ctx->output_delay > 0)
-ctx->ts_ring[ctx->input_order % (3 * ctx->output_delay)] = 
pic->pts;
+ctx->ts_ring[ctx->input_order %
+(3 * ctx->output_delay + ctx->async_depth)] = pic->pts;
 
 pic->display_order = ctx->input_order;
 ++ctx->input_order;
@@ -1214,8 +1215,8 @@ int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, 
AVPacket *pkt)
 
 #if VA_CHECK_VERSION(1, 9, 0)
 if (ctx->has_sync_buffer_func) {
-while (av_fifo_size(ctx->encode_fifo) <=
-   MAX_PICTURE_REFERENCES * sizeof(VAAPIEncodePicture *)) {
+while (av_fifo_size(ctx->encode_fifo) <
+MAX_ASYNC_DEPTH * sizeof(VAAPIEncodePicture *)) {
 pic = NULL;
 err = vaapi_encode_pick_next(avctx, &pic);
 if (err < 0)
@@ -1233,6 +1234,14 @@ int ff_vaapi_encode_receive_packet(AVCodecContext 
*avctx, AVPacket *pkt)
 }
 if (!av_fifo_size(ctx->encode_fifo))
 return err;
+if (av_fifo_size(ctx->encode_fifo) <
+ctx->async_depth * sizeof(VAAPIEncodePicture *) &&
+!ctx->end_of_stream) {
+av_fifo_generic_peek(ctx->encode_fifo, &pic, sizeof(pic), NULL);
+err = vaapi_encode_wait(avctx, pic, 0);
+if (err < 0)
+return err;
+}
 av_fifo_generic_read(ctx->encode_fifo, &pic, sizeof(pic), NULL);
 ctx->encode_order = pic->encode_order + 1;
 } else
@@ -1268,7 +1277,7 @@ int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, 
AVPacket *pkt)
 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)];
+(3 * ctx->output_delay + ctx->async_depth)];
 }
 av_log(avctx, AV_LOG_DEBUG, "Output packet: pts %"PRId64" dts 
%"PRId64".\n",
pkt->pts, pkt->dts);
@@ -2589,7 +2598,7 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
 vas = vaSyncBuffer(ctx->hwctx->display, 0, 0);
 if (vas != VA_STATUS_ERROR_UNIMPLEMENTED) {
 ctx->has_sync_buffer_func = 1;
-ctx->encode_fifo = av_fifo_alloc((MAX_PICTURE_REFERENCES + 1) *
+ctx->encode_fifo = av_fifo_alloc(MAX_ASYNC_DEPTH *
 sizeof(VAAPIEncodePicture *));
 if (!ctx->encode_fifo)
 return AVERROR(ENOMEM);
diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
index 560a1c42a9..1a5824e702 100644
--- a/libavcodec/vaapi_encode.h
+++ b/libavcodec/vaapi_encode.h
@@ -48,6 +48,7 @@ enum {
 MAX_TILE_ROWS  = 22,
 // A.4.1: table A.6 allows at most 20 tile columns for any level.
 MAX_TILE_COLS  = 20,
+MAX_ASYNC_DEPTH= 64,
 };
 
 extern const AVCodecHWConfigInternal *const ff_vaapi_encode_hw_configs[];
@@ -298,7 +299,8 @@ typedef struct VAAPIEncodeContext {
 // Timestamp handling.
 int64_t first_pts;
 int64_t dts_pts_diff;
-int64_t ts_ring[MAX_REORDER_DELAY * 3];
+int64_t ts_ring[MAX_REORDER_DELAY * 3 +
+MAX_ASYNC_DEPTH];
 
 // Slice structure.
 int slice_block_rows;
@@ -350,6 +352,8 @@ typedef struct VAAPIEncodeContext {
 AVFifoBuffer *encode_fifo;
 //Whether the driver support vaSyncBuffer
 int has_sync_buffer_func;
+//Max number of frame buffered in encoder.
+int async_depth;
 } VAAPIEncodeContext;
 
 enum {
@@ -460,7 +464,11 @@ int ff_vaapi_encode_close(AVCodecContext *avctx);
 { "b_depth", \
   "Maximum B-frame reference depth", \
   OFFSET(common.desired_b_depth), AV_OPT_TYPE_INT, \
-  { .i64 = 1 }, 1, INT_MAX, FLAGS }
+  { .i64 = 1 }, 1, INT_MAX, FLAGS }, \
+{ "async_depth", "Maximum processing parallelism. " \
+  "Increase this to improve single channel performance", \
+  OFFSET(common.async_de

Re: [FFmpeg-devel] [PATCH v4 1/1] avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions

2022-01-04 Thread James Almer




On 12/27/2021 12:08 AM, Xiang, Haihao wrote:

On Thu, 2021-12-23 at 14:01 +, Xiang, Haihao wrote:

On Fri, 2021-11-26 at 19:29 +, Soft Works wrote:

-Original Message-
From: ffmpeg-devel  On Behalf Of Anton
Khirnov
Sent: Friday, November 26, 2021 8:12 PM
To: FFmpeg development discussions and patches 
Subject: Re: [FFmpeg-devel] [PATCH v4 1/1] avutils/hwcontext: When
deriving
a
hwdevice, search for existing device in both directions

Quoting Soft Works (2021-11-26 19:43:58)

Maybe I'm missing something, but hw device contexts are refcounted.
What happens in hwdevice_ctx_free() is this:

av_buffer_unref(&ctx->internal->source_device);


IIUC this only happens after the parent device is freed. My concern is
the following situation:
- the caller creates a parent hwdevice
- the caller derives a child from it, which may acquire some additional
   resources beyond what the parent holds
- the caller unrefs all his references to the child, but the child does
   not get freed because the parent still holds a reference to it

Since av_hwdevice_ctx_create_derived() has a flags parameter, we might
want to introduce a flag to control this behavior.


I understand what you mean. I'm just not sure whether a practical case
with such a requirement exists. Should that turn out to be required,
such flag can be added at any time, IMO.



I agree we may add such flag later if required. May we merge this patch to fix
the annoying derivation limitation if no other concern ?


Any other comment for this patch version? I'll add the note pointed out by Lynne
and push this patch if no objection.

Thanks
Haihao


Why was this pushed? There were objections.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] avcodec/Makefile: fix mp2float and mp3 dependencies

2022-01-04 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavcodec/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 7dc4ccb85f..8cd2d6f849 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -481,8 +481,8 @@ OBJS-$(CONFIG_MP2_ENCODER) += 
mpegaudioenc_float.o mpegaudio.o \
 OBJS-$(CONFIG_MP2FIXED_ENCODER)+= mpegaudioenc_fixed.o mpegaudio.o \
   mpegaudiodata.o mpegaudiodsp_data.o \
   mpegaudiotabs.o
-OBJS-$(CONFIG_MP2FLOAT_DECODER)+= mpegaudiodec_float.o
-OBJS-$(CONFIG_MP3_DECODER) += mpegaudiodec_fixed.o
+OBJS-$(CONFIG_MP2FLOAT_DECODER)+= mpegaudiodec_float.o mpegaudiodata.o
+OBJS-$(CONFIG_MP3_DECODER) += mpegaudiodec_fixed.o mpegaudiodata.o
 OBJS-$(CONFIG_MP3_MF_ENCODER)  += mfenc.o mf_utils.o
 OBJS-$(CONFIG_MP3ADU_DECODER)  += mpegaudiodec_fixed.o
 OBJS-$(CONFIG_MP3ADUFLOAT_DECODER) += mpegaudiodec_float.o
-- 
2.33.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 1/5] avcodec/jpegxl: add Jpeg XL image codec and parser

2022-01-04 Thread Leo Izen



On 1/4/22 11:56, Lynne wrote:

4 Jan 2022, 17:26 by leo.i...@gmail.com:


This commit adds support to libavcodec to read and parse
encoded Jpeg XL images. Jpeg XL is intended to be an
extended-life replacement to legacy mjpeg.
---
  MAINTAINERS|   2 +
+Leo Izen (thebombzen) B6FD 3CFC 7ACF 83FC 9137 6945 5A71 C331 FD2F A19A

Could you not add yourself as a maintainer in the same
patchset? In theory, the maintainers file contains those
with push access, and while I don't object, adding yourself
without even having a chance for anyone who's interested
in that but not interested in jpegxl to review isn't right.
___


Re: earlier discussion on IRC, michaelni says I can be added without 
push access. Just repeating this info on the ML for those who don't 
follow IRC.


-Leo Izen


___
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 1/2] avformat/imf: fix CPL parsing error handling

2022-01-04 Thread Zane van Iperen




On 5/1/22 12:42, p...@sandflow.com wrote:

From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
---
  libavformat/imf_cpl.c | 7 +--
  1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c
index 7055b49ae8..f49469f56e 100644
--- a/libavformat/imf_cpl.c
+++ b/libavformat/imf_cpl.c
@@ -807,7 +807,9 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl)
  av_log(NULL, AV_LOG_ERROR, "Cannot read IMF CPL\n");
  if (ret == 0)
  ret = AVERROR_INVALIDDATA;
-} else {
+goto clean_up;
+}
+


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

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


Re: [FFmpeg-devel] [PATCH v4 1/1] avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions

2022-01-04 Thread Xiang, Haihao
On Wed, 2022-01-05 at 00:19 -0300, James Almer wrote:
> 
> On 12/27/2021 12:08 AM, Xiang, Haihao wrote:
> > On Thu, 2021-12-23 at 14:01 +, Xiang, Haihao wrote:
> > > On Fri, 2021-11-26 at 19:29 +, Soft Works wrote:
> > > > > -Original Message-
> > > > > From: ffmpeg-devel  On Behalf Of
> > > > > Anton
> > > > > Khirnov
> > > > > Sent: Friday, November 26, 2021 8:12 PM
> > > > > To: FFmpeg development discussions and patches <
> > > > > ffmpeg-devel@ffmpeg.org>
> > > > > Subject: Re: [FFmpeg-devel] [PATCH v4 1/1] avutils/hwcontext: When
> > > > > deriving
> > > > > a
> > > > > hwdevice, search for existing device in both directions
> > > > > 
> > > > > Quoting Soft Works (2021-11-26 19:43:58)
> > > > > > Maybe I'm missing something, but hw device contexts are refcounted.
> > > > > > What happens in hwdevice_ctx_free() is this:
> > > > > > 
> > > > > > av_buffer_unref(&ctx->internal->source_device);
> > > > > 
> > > > > IIUC this only happens after the parent device is freed. My concern is
> > > > > the following situation:
> > > > > - the caller creates a parent hwdevice
> > > > > - the caller derives a child from it, which may acquire some
> > > > > additional
> > > > >resources beyond what the parent holds
> > > > > - the caller unrefs all his references to the child, but the child
> > > > > does
> > > > >not get freed because the parent still holds a reference to it
> > > > > 
> > > > > Since av_hwdevice_ctx_create_derived() has a flags parameter, we might
> > > > > want to introduce a flag to control this behavior.
> > > > 
> > > > I understand what you mean. I'm just not sure whether a practical case
> > > > with such a requirement exists. Should that turn out to be required,
> > > > such flag can be added at any time, IMO.
> > > 
> > > 
> > > I agree we may add such flag later if required. May we merge this patch to
> > > fix
> > > the annoying derivation limitation if no other concern ?
> > 
> > Any other comment for this patch version? I'll add the note pointed out by
> > Lynne
> > and push this patch if no objection.
> > 
> > Thanks
> > Haihao
> 
> Why was this pushed? There were objections.

I apologize that I missed the new discussion on ML, thought no objection since
my email, so I pushed Softworks' patch as this patch really fixed some issues 
for me and others. I'll revert it and check the ML more carefully. 

Thanks
Haihao


> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avcodec/Makefile: fix mp2float and mp3 dependencies

2022-01-04 Thread Andreas Rheinhardt
Zane van Iperen:
> Signed-off-by: Zane van Iperen 
> ---
>  libavcodec/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 7dc4ccb85f..8cd2d6f849 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -481,8 +481,8 @@ OBJS-$(CONFIG_MP2_ENCODER) += 
> mpegaudioenc_float.o mpegaudio.o \
>  OBJS-$(CONFIG_MP2FIXED_ENCODER)+= mpegaudioenc_fixed.o mpegaudio.o \
>mpegaudiodata.o 
> mpegaudiodsp_data.o \
>mpegaudiotabs.o
> -OBJS-$(CONFIG_MP2FLOAT_DECODER)+= mpegaudiodec_float.o
> -OBJS-$(CONFIG_MP3_DECODER) += mpegaudiodec_fixed.o
> +OBJS-$(CONFIG_MP2FLOAT_DECODER)+= mpegaudiodec_float.o 
> mpegaudiodata.o
> +OBJS-$(CONFIG_MP3_DECODER) += mpegaudiodec_fixed.o 
> mpegaudiodata.o
>  OBJS-$(CONFIG_MP3_MF_ENCODER)  += mfenc.o mf_utils.o
>  OBJS-$(CONFIG_MP3ADU_DECODER)  += mpegaudiodec_fixed.o
>  OBJS-$(CONFIG_MP3ADUFLOAT_DECODER) += mpegaudiodec_float.o
> 

1. This is a regression since 33e6d57f01dd4742a2e25ac5fa072b487d9d02ce.
Before that all mpegaudio-decoders had a mpegaudiodata dependency via
mpegaudioheader, yet now the latter only needs (and therefore provides)
mpegaudiotabs. I should have checked for such indirect dependencies
(which should actually not exist, but they unfortunately do), but haven't.
2. This does not fix everything; e.g. it won't fix the issue in which
only the mp2 (fixed) decoder is active. Instead mpegaudio should have a
mpegaudiodata.o dependency (mpegaudio is the common group for all the
decoders that use mpegaudiodec_template). I'll send a patch that does
this (and backport it) unless you want to.

- 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 v3] libavcodec/flacenc: add backward-compatible 32 bit-per-sample capability

2022-01-04 Thread Lynne
3 Jan 2022, 21:26 by mva...@gmail.com:

> +if (pmax > 0) {
> +if (lpc_reduction_tries >= 2)
> +return 0;
> +lpc_reduction_tries++;
> +for (int i = 0; i < order; i++)
> +coefs[i] = ((int64_t)coefs[i] * INT32_MAX) / pmax;
> +}
> +} while (pmax > 0);
> +return 1;
> +}
>

Could you invert the return value of the function?
Return 0 if there's no overflow and 1 if there is? That's
usually how we use return values throughout the code
too, and it saves you from having to invert it when you
use it.


>  static void flac_lpc_16_c(int32_t *decoded, const int coeffs[32],
>  int pred_order, int qlevel, int len)
>  {
> diff --git a/libavcodec/flacdsp.h b/libavcodec/flacdsp.h
> index 7bb0dd0e9a..5978a4722a 100644
> --- a/libavcodec/flacdsp.h
> +++ b/libavcodec/flacdsp.h
> @@ -40,4 +40,7 @@ void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat 
> fmt, int channels, i
>  void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, int 
> channels, int bps);
>  void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int 
> channels, int bps);
>  
> +int ff_flacdsp_lpc_encode_c_32_overflow_detect(int32_t *res, const int32_t 
> *smp, int len,
> +   int order, int32_t *coefs, 
> int shift);
>

Could you also move the function to flacenc.c? The flacdsp.c
file gets compiled if either is enabled, but if flacenc.c isn't
enabled, then this code shouldn't be enabled, to save space.
The function isn't likely to get SIMD, and the compiler could
do more aggressive optimizations if it's in the same file.
 

>  put_sbits(&s->pb, sub->obits, res[0]);
>  } else if (sub->type == FLAC_SUBFRAME_VERBATIM) {
> -while (res < frame_end)
> -put_sbits(&s->pb, sub->obits, *res++);
> +if (sub->obits < 32) {
> +while (res < frame_end)
> +put_sbits(&s->pb, sub->obits, *res++);
> +} else {
> +while (res < frame_end)
> +put_bits32(&s->pb, *res++);
> +}
>  } else {
>  /* warm-up samples */
> -for (i = 0; i < sub->order; i++)
> -put_sbits(&s->pb, sub->obits, *res++);
> +if (sub->obits < 32) {
> +for (i = 0; i < sub->order; i++)
> +put_sbits(&s->pb, sub->obits, *res++);
> +}else{
> +for (i = 0; i < sub->order; i++)
> +put_bits32(&s->pb, *res++);
> +}
>

Small nit, but could you put spaces in the }else{

Apart from that, looks good.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] avcodec/Makefile: Add missing mpegaudiodata.o dependency to MPEGAUDIO

2022-01-04 Thread Andreas Rheinhardt
Before 33e6d57f01dd4742a2e25ac5fa072b487d9d02ce all mpegaudio-decoders
had an indirect mpegaudiodata dependency via mpegaudioheader,
yet now the latter only needs (and therefore provides) mpegaudiotabs.
Given that mpegaudiodec_template.c uses stuff from mpegaudiodata,
it should always have had a direct dependency, yet hadn't.
This commit adds this missing dependency.
(Sorry for not having checked indirect dependencies.)

Found-by: Zane van Iperen 
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 7dc4ccb85f..242b48ff7c 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -118,7 +118,8 @@ OBJS-$(CONFIG_MDCT)+= mdct_float.o 
mdct_fixed_32.o
 OBJS-$(CONFIG_ME_CMP)  += me_cmp.o
 OBJS-$(CONFIG_MEDIACODEC)  += mediacodecdec_common.o 
mediacodec_surface.o mediacodec_wrapper.o mediacodec_sw_buffer.o
 OBJS-$(CONFIG_MPEG_ER) += mpeg_er.o
-OBJS-$(CONFIG_MPEGAUDIO)   += mpegaudio.o mpegaudiodec_common.o
+OBJS-$(CONFIG_MPEGAUDIO)   += mpegaudio.o mpegaudiodec_common.o \
+  mpegaudiodata.o
 OBJS-$(CONFIG_MPEGAUDIODSP)+= mpegaudiodsp.o\
   mpegaudiodsp_data.o   \
   mpegaudiodsp_fixed.o  \
-- 
2.32.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] configure: Make nvenc select atsc_a53

2022-01-04 Thread Andreas Rheinhardt
It is the common code (that is compiled depending upon CONFIG_NVENC)
that uses ff_alloc_a53_sei(), so it is natural to make nvenc itself
select atsc_a53.
This fixes compilation errors in case nvenc is enabled
(e.g. autodected) with both nvenc-based encoders disabled.
(This works in case of static linking (nothing pulls in nvenc.o),
but it fails with shared builds.)

Signed-off-by: Andreas Rheinhardt 
---
It would also be obviously desirable to disable nvenc if it is
not needed if it is only autodetected and not explicitly enabled.
Maybe it should even be unconditionally disabled if unused.

There is btw a similar issue with crystalhd: If it is enabled,
yet all the decoders are disabled and if one uses -O0, then
the unused functions in crystalhd.c are not stripped away and
linking errors ensue.

 configure | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/configure b/configure
index 8392c26015..f76876ceff 100755
--- a/configure
+++ b/configure
@@ -3153,6 +3153,7 @@ sharpen_npp_filter_deps="ffnvcodec libnpp"
 amf_deps_any="libdl LoadLibrary"
 nvenc_deps="ffnvcodec"
 nvenc_deps_any="libdl LoadLibrary"
+nvenc_select="atsc_a53"
 
 aac_mf_encoder_deps="mediafoundation"
 ac3_mf_encoder_deps="mediafoundation"
@@ -3168,7 +3169,6 @@ h264_mediacodec_decoder_select="h264_mp4toannexb_bsf 
h264_parser"
 h264_mf_encoder_deps="mediafoundation"
 h264_mmal_decoder_deps="mmal"
 h264_nvenc_encoder_deps="nvenc"
-h264_nvenc_encoder_select="atsc_a53"
 h264_omx_encoder_deps="omx"
 h264_qsv_decoder_select="h264_mp4toannexb_bsf qsvdec"
 h264_qsv_encoder_select="atsc_a53 qsvenc"
@@ -3185,7 +3185,6 @@ hevc_mediacodec_decoder_deps="mediacodec"
 hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser"
 hevc_mf_encoder_deps="mediafoundation"
 hevc_nvenc_encoder_deps="nvenc"
-hevc_nvenc_encoder_select="atsc_a53"
 hevc_qsv_decoder_select="hevc_mp4toannexb_bsf qsvdec"
 hevc_qsv_encoder_select="hevcparse qsvenc"
 hevc_rkmpp_decoder_deps="rkmpp"
-- 
2.32.0

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

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


Re: [FFmpeg-devel] [PATCH V2 2/3] libavcodec/vaapi_encode: Change the way to call async to increase performance

2022-01-04 Thread Andreas Rheinhardt
Wenbin Chen:
> Fix: #7706. After commit 5fdcf85bbffe7451c2, vaapi encoder's performance
> decrease. The reason is that vaRenderPicture() and vaSyncBuffer() are
> called at the same time (vaRenderPicture() always followed by a
> vaSyncBuffer()). When we encode stream with B frames, we need buffer to
> reorder frames, so we can send serveral frames to HW at once to increase
> performance. Now I changed them to be called in a asynchronous way, which
> will make better use of hardware. 1080p transcoding increases about 17%
> fps on my environment.
> 
> This change fits vaSyncBuffer(), so if driver does not support
> vaSyncBuffer, it will keep previous operation.
> 
> Signed-off-by: Wenbin Chen 
> ---
>  libavcodec/vaapi_encode.c | 64 ---
>  libavcodec/vaapi_encode.h |  5 +++
>  2 files changed, 58 insertions(+), 11 deletions(-)
> 
> diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
> index b87b58a42b..9a3b3ba4ad 100644
> --- a/libavcodec/vaapi_encode.c
> +++ b/libavcodec/vaapi_encode.c
> @@ -984,8 +984,10 @@ static int vaapi_encode_pick_next(AVCodecContext *avctx,
>  if (!pic && ctx->end_of_stream) {
>  --b_counter;
>  pic = ctx->pic_end;
> -if (pic->encode_issued)
> +if (pic->encode_complete)
>  return AVERROR_EOF;
> +else if (pic->encode_issued)
> +return AVERROR(EAGAIN);
>  }
>  
>  if (!pic) {
> @@ -1210,18 +1212,45 @@ int ff_vaapi_encode_receive_packet(AVCodecContext 
> *avctx, AVPacket *pkt)
>  return AVERROR(EAGAIN);
>  }
>  
> -pic = NULL;
> -err = vaapi_encode_pick_next(avctx, &pic);
> -if (err < 0)
> -return err;
> -av_assert0(pic);
> +#if VA_CHECK_VERSION(1, 9, 0)
> +if (ctx->has_sync_buffer_func) {
> +while (av_fifo_size(ctx->encode_fifo) <=
> +   MAX_PICTURE_REFERENCES * sizeof(VAAPIEncodePicture *)) {
> +pic = NULL;
> +err = vaapi_encode_pick_next(avctx, &pic);
> +if (err < 0)
> +break;
> +
> +av_assert0(pic);
> +pic->encode_order = ctx->encode_order +
> +(av_fifo_size(ctx->encode_fifo) / sizeof(VAAPIEncodePicture 
> *));
> +err = vaapi_encode_issue(avctx, pic);
> +if (err < 0) {
> +av_log(avctx, AV_LOG_ERROR, "Encode failed: %d.\n", err);
> +return err;
> +}
> +av_fifo_generic_write(ctx->encode_fifo, &pic, sizeof(pic), NULL);
> +}
> +if (!av_fifo_size(ctx->encode_fifo))
> +return err;
> +av_fifo_generic_read(ctx->encode_fifo, &pic, sizeof(pic), NULL);
> +ctx->encode_order = pic->encode_order + 1;
> +} else
> +#endif
> +{
> +pic = NULL;
> +err = vaapi_encode_pick_next(avctx, &pic);
> +if (err < 0)
> +return err;
> +av_assert0(pic);
>  
> -pic->encode_order = ctx->encode_order++;
> +pic->encode_order = ctx->encode_order++;
>  
> -err = vaapi_encode_issue(avctx, pic);
> -if (err < 0) {
> -av_log(avctx, AV_LOG_ERROR, "Encode failed: %d.\n", err);
> -return err;
> +err = vaapi_encode_issue(avctx, pic);
> +if (err < 0) {
> +av_log(avctx, AV_LOG_ERROR, "Encode failed: %d.\n", err);
> +return err;
> +}
>  }
>  
>  err = vaapi_encode_output(avctx, pic, pkt);
> @@ -2555,6 +2584,18 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
>  }
>  }
>  
> +#if VA_CHECK_VERSION(1, 9, 0)
> +//check vaSyncBuffer function
> +vas = vaSyncBuffer(ctx->hwctx->display, 0, 0);
> +if (vas != VA_STATUS_ERROR_UNIMPLEMENTED) {
> +ctx->has_sync_buffer_func = 1;
> +ctx->encode_fifo = av_fifo_alloc((MAX_PICTURE_REFERENCES + 1) *
> +sizeof(VAAPIEncodePicture *));
> +if (!ctx->encode_fifo)
> +return AVERROR(ENOMEM);
> +}
> +#endif
> +
>  return 0;
>  
>  fail:
> @@ -2592,6 +2633,7 @@ av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
>  
>  av_freep(&ctx->codec_sequence_params);
>  av_freep(&ctx->codec_picture_params);
> +av_fifo_freep(&ctx->encode_fifo);

Is it guaranteed that the fifo is empty at this point? I don't think so.

>  
>  av_buffer_unref(&ctx->recon_frames_ref);
>  av_buffer_unref(&ctx->input_frames_ref);
> diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
> index b41604a883..560a1c42a9 100644
> --- a/libavcodec/vaapi_encode.h
> +++ b/libavcodec/vaapi_encode.h
> @@ -29,6 +29,7 @@
>  
>  #include "libavutil/hwcontext.h"
>  #include "libavutil/hwcontext_vaapi.h"
> +#include "libavutil/fifo.h"
>  
>  #include "avcodec.h"
>  #include "hwconfig.h"
> @@ -345,6 +346,10 @@ typedef struct VAAPIEncodeContext {
>  int roi_warned;
>  
>  AVFrame *frame;
> +//Store buffered pic
> +AVFifoBuffer *enc

Re: [FFmpeg-devel] [PATCH 2/2] ffmpeg_opt: consider HW acceleration method when selecting decoder

2022-01-04 Thread Xiang, Haihao
On Tue, 2021-11-16 at 02:21 +, Xiang, Haihao wrote:
> > On Wed, 2021-09-22 at 15:42 +0800, Haihao Xiang wrote:
> > > Usually a HW decoder is expected when user specifies a HW acceleration
> > > method via -hwaccel option, however the current implementation doesn't
> > > take HW acceleration method into account, it is possible to select a SW
> > > decoder.
> > > 
> > > For example:
> > > 
> > > $> ffmpeg -hwaccel vaapi -i av1.ivf -f null -
> > > ...
> > > Stream #0:0 -> #0:0 (av1 (libdav1d) -> wrapped_avframe (native))
> > > 
> > > libdav1d is selected in this case even if vaapi is specified.
> > > 
> > > After applying this patch, the native av1 decoder (with vaapi support)
> > > is selected.
> > > ...
> > > Stream #0:0 -> #0:0 (av1 (native) -> wrapped_avframe (native))
> > 
> > Any comment for this patchset? We may simplify the command line using HW
> > acceleration method after applying this patchset.
> 
> Ping again. 
> 
> According to the help string for -hwaccel option, HW accelerated decoding is
> used if -hwaccel arg is specified. However in the current code, hwaccel is not
> taken into account when choosing a codec for the video stream, (see 
> https://github.com/FFmpeg/FFmpeg/blob/master/fftools/ffmpeg_opt.c#L792-L805).
> 
> For example, libdav1d is selected (if libdav1d is available) when running the
> command below because libdav1d has higher priority than the native av1 decoder
> in the current FFmpeg. 
> 
> $> ffmpeg -hwaccel vaapi -i av1.ivf -f null -
> 
> (Note `ffmpeg -hwaccel vaapi -i input.h264 -f null -` works as expected, the
> native h264 decoder is selected)
> 
> This patch enabled the automatic codec selection for hw accelerated decoding,
> -hwaccel option can work as expected after applying this patch. 
> 

Hi Mark

Do you have any comment for automatically codec selection for hw accelerated
decoding ?

Thanks
Haihao


> > > ---
> > >  fftools/ffmpeg_opt.c | 44 +++-
> > >  1 file changed, 43 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
> > > index 2d9a8a2ea0..914078add9 100644
> > > --- a/fftools/ffmpeg_opt.c
> > > +++ b/fftools/ffmpeg_opt.c
> > > @@ -804,6 +804,48 @@ static const AVCodec *choose_decoder(OptionsContext
> > > *o,
> > > AVFormatContext *s, AVSt
> > >  return avcodec_find_decoder(st->codecpar->codec_id);
> > >  }
> > >  
> > > +static const AVCodec *choose_decoder2(InputStream *ist, OptionsContext
> > > *o,
> > > AVFormatContext *s, AVStream *st)
> > > +{
> > > +char *codec_name = NULL;
> > > +
> > > +MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, st);
> > > +if (codec_name) {
> > > +const AVCodec *codec = find_codec_or_die(codec_name, st-
> > > >codecpar-
> > > > codec_type, 0);
> > > 
> > > +st->codecpar->codec_id = codec->id;
> > > +if (recast_media && st->codecpar->codec_type != codec->type)
> > > +st->codecpar->codec_type = codec->type;
> > > +return codec;
> > > +} else {
> > > +if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
> > > +ist->hwaccel_id == HWACCEL_GENERIC &&
> > > +ist->hwaccel_device_type != AV_HWDEVICE_TYPE_NONE) {
> > > +const AVCodec *p;
> > > +void *i = 0;
> > > +
> > > +while ((p = av_codec_iterate(&i))) {
> > > +int j;
> > > +
> > > +if (p->id != st->codecpar->codec_id ||
> > > +!av_codec_is_decoder(p) ||
> > > +!avcodec_get_hw_config(p, 0))
> > > +continue;
> > > +
> > > +for (j = 0; ;j++) {
> > > +const AVCodecHWConfig *config =
> > > avcodec_get_hw_config(p,
> > > j);
> > > +
> > > +if (!config)
> > > +break;
> > > +
> > > +if (config->device_type == ist->hwaccel_device_type)
> > > +return p;
> > > +}
> > > +}
> > > +}
> > > +
> > > +return avcodec_find_decoder(st->codecpar->codec_id);
> > > +}
> > > +}
> > > +
> > >  /* Add all the streams from the given input file to the global
> > >   * list of input streams. */
> > >  static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
> > > @@ -932,7 +974,7 @@ static void add_input_streams(OptionsContext *o,
> > > AVFormatContext *ic)
> > >  ist->hwaccel_pix_fmt = AV_PIX_FMT_NONE;
> > >  }
> > >  
> > > -ist->dec = choose_decoder(o, ic, st);
> > > +ist->dec = choose_decoder2(ist, o, ic, st);
> > >  ist->decoder_opts = filter_codec_opts(o->g->codec_opts, ist->st-
> > > > codecpar->codec_id, ic, st, ist->dec);
> > > 
> > >  
> > >  ist->reinit_filters = -1;
> > 
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > 
> > To u

Re: [FFmpeg-devel] [PATCH v2 0/2] avformat/mvdec: make audio stream conditional

2022-01-04 Thread Peter Ross
On Fri, Dec 31, 2021 at 08:11:46PM -0500, John-Paul Stewart wrote:
> Changed in v2:
> Allocate the audio stream first to maintain consistent behaviour
> with prior code.
> 
> Recent discussion on the list led me to realize that libavformat was
> unconditionally creating an audio stream for all SGI movie format
> (version 2) files, even when no audio is present in the file.  
> 
> A sample of a movie file with no audio can be found at
> http://www.personalprojects.net/ffmpeg/silent.movie
> 
> Unpatched ffmpeg will report an audio stream even though no audio is
> present.  After the following patch no audio stream is reported.
> 
> Incidentally, the silent.movie sample above is at 25fps and can also be
> used by anyone who wants to double-check the earlier patch 3c9ffbd009
> that reads and sets the framerate.  The sample file is only about 88 KB.

v2 patchset looks good to me. I will apply in a couple of days. Thanks.

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)


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

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


Re: [FFmpeg-devel] [PATCH v3 1/6] lavc/arm: dont assign hevc_qpel functions for non-multiple of 8 widths

2022-01-04 Thread Andreas Rheinhardt
J. Dekker:
> The assembly is written assuming that the width is a multiple of 8.
> 
> However the real issue is the functions were errorneously assigned to
> the 2, 4, 6 & 12 widths. This behaviour never broke the decoder as
> samples which trigger the functions for these widths have not been found
> in the wild. This relies on the mappings in ff_hevc_pel_weight[].
> 
> Signed-off-by: J. Dekker 
> ---
>  libavcodec/arm/hevcdsp_init_neon.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
>  This set has already been reviewed by Martin, sending to list for
>  transparency.
> 
> diff --git a/libavcodec/arm/hevcdsp_init_neon.c 
> b/libavcodec/arm/hevcdsp_init_neon.c
> index 201a088dac..112edb5edd 100644
> --- a/libavcodec/arm/hevcdsp_init_neon.c
> +++ b/libavcodec/arm/hevcdsp_init_neon.c
> @@ -270,7 +270,8 @@ av_cold void ff_hevc_dsp_init_neon(HEVCDSPContext *c, 
> const int bit_depth)
>  put_hevc_qpel_uw_neon[3][1]  = ff_hevc_put_qpel_uw_h1v3_neon_8;
>  put_hevc_qpel_uw_neon[3][2]  = ff_hevc_put_qpel_uw_h2v3_neon_8;
>  put_hevc_qpel_uw_neon[3][3]  = ff_hevc_put_qpel_uw_h3v3_neon_8;
> -for (x = 0; x < 10; x++) {
> +for (x = 3; x < 10; x++) {
> +if (x == 4) continue;
>  c->put_hevc_qpel[x][1][0] = 
> ff_hevc_put_qpel_neon_wrapper;
>  c->put_hevc_qpel[x][0][1] = 
> ff_hevc_put_qpel_neon_wrapper;
>  c->put_hevc_qpel[x][1][1] = 
> ff_hevc_put_qpel_neon_wrapper;
> 

This patchset led to regressions; see e.g.
http://fate.ffmpeg.org/report.cgi?time=20220104162724&slot=aarch64-linux-qemu-ubuntu-gcc-4.8

- 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 V2 2/3] libavcodec/vaapi_encode: Change the way to call async to increase performance

2022-01-04 Thread Chen, Wenbin
> Wenbin Chen:
> > Fix: #7706. After commit 5fdcf85bbffe7451c2, vaapi encoder's performance
> > decrease. The reason is that vaRenderPicture() and vaSyncBuffer() are
> > called at the same time (vaRenderPicture() always followed by a
> > vaSyncBuffer()). When we encode stream with B frames, we need buffer to
> > reorder frames, so we can send serveral frames to HW at once to increase
> > performance. Now I changed them to be called in a asynchronous way,
> which
> > will make better use of hardware. 1080p transcoding increases about 17%
> > fps on my environment.
> >
> > This change fits vaSyncBuffer(), so if driver does not support
> > vaSyncBuffer, it will keep previous operation.
> >
> > Signed-off-by: Wenbin Chen 
> > ---
> >  libavcodec/vaapi_encode.c | 64 -
> --
> >  libavcodec/vaapi_encode.h |  5 +++
> >  2 files changed, 58 insertions(+), 11 deletions(-)
> >
> > diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
> > index b87b58a42b..9a3b3ba4ad 100644
> > --- a/libavcodec/vaapi_encode.c
> > +++ b/libavcodec/vaapi_encode.c
> > @@ -984,8 +984,10 @@ static int
> vaapi_encode_pick_next(AVCodecContext *avctx,
> >  if (!pic && ctx->end_of_stream) {
> >  --b_counter;
> >  pic = ctx->pic_end;
> > -if (pic->encode_issued)
> > +if (pic->encode_complete)
> >  return AVERROR_EOF;
> > +else if (pic->encode_issued)
> > +return AVERROR(EAGAIN);
> >  }
> >
> >  if (!pic) {
> > @@ -1210,18 +1212,45 @@ int
> ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
> >  return AVERROR(EAGAIN);
> >  }
> >
> > -pic = NULL;
> > -err = vaapi_encode_pick_next(avctx, &pic);
> > -if (err < 0)
> > -return err;
> > -av_assert0(pic);
> > +#if VA_CHECK_VERSION(1, 9, 0)
> > +if (ctx->has_sync_buffer_func) {
> > +while (av_fifo_size(ctx->encode_fifo) <=
> > +   MAX_PICTURE_REFERENCES * sizeof(VAAPIEncodePicture *)) {
> > +pic = NULL;
> > +err = vaapi_encode_pick_next(avctx, &pic);
> > +if (err < 0)
> > +break;
> > +
> > +av_assert0(pic);
> > +pic->encode_order = ctx->encode_order +
> > +(av_fifo_size(ctx->encode_fifo) / 
> > sizeof(VAAPIEncodePicture *));
> > +err = vaapi_encode_issue(avctx, pic);
> > +if (err < 0) {
> > +av_log(avctx, AV_LOG_ERROR, "Encode failed: %d.\n", err);
> > +return err;
> > +}
> > +av_fifo_generic_write(ctx->encode_fifo, &pic, sizeof(pic), 
> > NULL);
> > +}
> > +if (!av_fifo_size(ctx->encode_fifo))
> > +return err;
> > +av_fifo_generic_read(ctx->encode_fifo, &pic, sizeof(pic), NULL);
> > +ctx->encode_order = pic->encode_order + 1;
> > +} else
> > +#endif
> > +{
> > +pic = NULL;
> > +err = vaapi_encode_pick_next(avctx, &pic);
> > +if (err < 0)
> > +return err;
> > +av_assert0(pic);
> >
> > -pic->encode_order = ctx->encode_order++;
> > +pic->encode_order = ctx->encode_order++;
> >
> > -err = vaapi_encode_issue(avctx, pic);
> > -if (err < 0) {
> > -av_log(avctx, AV_LOG_ERROR, "Encode failed: %d.\n", err);
> > -return err;
> > +err = vaapi_encode_issue(avctx, pic);
> > +if (err < 0) {
> > +av_log(avctx, AV_LOG_ERROR, "Encode failed: %d.\n", err);
> > +return err;
> > +}
> >  }
> >
> >  err = vaapi_encode_output(avctx, pic, pkt);
> > @@ -2555,6 +2584,18 @@ av_cold int
> ff_vaapi_encode_init(AVCodecContext *avctx)
> >  }
> >  }
> >
> > +#if VA_CHECK_VERSION(1, 9, 0)
> > +//check vaSyncBuffer function
> > +vas = vaSyncBuffer(ctx->hwctx->display, 0, 0);
> > +if (vas != VA_STATUS_ERROR_UNIMPLEMENTED) {
> > +ctx->has_sync_buffer_func = 1;
> > +ctx->encode_fifo = av_fifo_alloc((MAX_PICTURE_REFERENCES + 1) *
> > +sizeof(VAAPIEncodePicture *));
> > +if (!ctx->encode_fifo)
> > +return AVERROR(ENOMEM);
> > +}
> > +#endif
> > +
> >  return 0;
> >
> >  fail:
> > @@ -2592,6 +2633,7 @@ av_cold int
> ff_vaapi_encode_close(AVCodecContext *avctx)
> >
> >  av_freep(&ctx->codec_sequence_params);
> >  av_freep(&ctx->codec_picture_params);
> > +av_fifo_freep(&ctx->encode_fifo);
> 
> Is it guaranteed that the fifo is empty at this point? I don't think so.

I don't check the fifo size, because in ff_vaapi_encode_close() all pics
are already freed and encode_fifo only buffer pic.
```
for (pic = ctx->pic_start; pic; pic = next) {
next = pic->next;
vaapi_encode_free(avctx, pic);
}
```

> 
> >
> >  av_buffer_unref(&ctx->recon_frames_ref);
> >  av_buffer_unref(&ctx->input_frames_ref);
> > diff --git a/libavcodec/vaapi_encode.h b/liba