Re: [FFmpeg-devel] [PATCH] fftools/ffplay: fix YUV conversion mode

2022-06-27 Thread Jan Ekström
On Tue, Jun 21, 2022 at 10:46 PM Niklas Haas  wrote:
>
> From: Niklas Haas 
>
> GL and Metal cache the state at time of texture creation. GLES2 and
> Direct3D 11 use the state at time of the render copy call.
>
> So the only way we can get the correct behavior consistently is by
> making sure the state is set for both the upload *and* the draw call.
> This probably isn't our bug to fix (upstream should make itself behave
> consistently and also document its functions), but as it stands,
> `ffplay` is misrendering BT.709 as BT.601 on my stock Linux system, and
> that leaves a bad taste in my mouth.
>
> Signed-off-by: Niklas Haas 
> ---

Moves the color space setting earlier, as well as clears the state in
case of an additional failure exit case with upload.

LGTM.

Jan
___
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 5/7] avformat/movenc: utilize existing AC-3 parsing workflow for AC-3

2022-06-27 Thread Jan Ekström
On Thu, Jun 23, 2022 at 1:11 PM Jan Ekström  wrote:
>
> On Thu, Jun 23, 2022 at 11:57 AM Andreas Rheinhardt
>  wrote:
> >
> > Jan Ekström:
> > > From: Jan Ekström 
> > >
> > > Signed-off-by: Jan Ekström 
> > > ---
> > >  libavcodec/Makefile   |  1 +
> > >  libavformat/Makefile  |  1 +
> > >  libavformat/ac3_bitrate_tab.c | 22 ++
> > >  libavformat/movenc.c  | 55 +--
> > >  4 files changed, 51 insertions(+), 28 deletions(-)
> > >  create mode 100644 libavformat/ac3_bitrate_tab.c
> > >
> > > diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> > > index 10697d31f7..7e0d278e3d 100644
> > > --- a/libavcodec/Makefile
> > > +++ b/libavcodec/Makefile
> > > @@ -1018,6 +1018,7 @@ STLIBOBJS-$(CONFIG_FLV_MUXER)  += 
> > > mpeg4audio_sample_rates.o
> > >  STLIBOBJS-$(CONFIG_HLS_DEMUXER)+= ac3_channel_layout_tab.o
> > >  STLIBOBJS-$(CONFIG_MATROSKA_DEMUXER)   += mpeg4audio_sample_rates.o
> > >  STLIBOBJS-$(CONFIG_MOV_DEMUXER)+= ac3_channel_layout_tab.o
> > > +STLIBOBJS-$(CONFIG_MOV_MUXER)  += ac3_bitrate_tab.o
> > >  STLIBOBJS-$(CONFIG_MXF_MUXER)  += golomb.o
> > >  STLIBOBJS-$(CONFIG_MP3_MUXER)  += mpegaudiotabs.o
> > >  STLIBOBJS-$(CONFIG_NUT_MUXER)  += mpegaudiotabs.o
> > > diff --git a/libavformat/Makefile b/libavformat/Makefile
> > > index 1416bf31bd..c71de95b2f 100644
> > > --- a/libavformat/Makefile
> > > +++ b/libavformat/Makefile
> > > @@ -699,6 +699,7 @@ SHLIBOBJS-$(CONFIG_FLV_MUXER)+= 
> > > mpeg4audio_sample_rates.o
> > >  SHLIBOBJS-$(CONFIG_HLS_DEMUXER)  += ac3_channel_layout_tab.o
> > >  SHLIBOBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio_sample_rates.o
> > >  SHLIBOBJS-$(CONFIG_MOV_DEMUXER)  += ac3_channel_layout_tab.o
> > > +SHLIBOBJS-$(CONFIG_MOV_MUXER)+= ac3_bitrate_tab.o
> > >  SHLIBOBJS-$(CONFIG_MP3_MUXER)+= mpegaudiotabs.o
> > >  SHLIBOBJS-$(CONFIG_MXF_MUXER)+= golomb_tab.o
> > >  SHLIBOBJS-$(CONFIG_NUT_MUXER)+= mpegaudiotabs.o
> > > diff --git a/libavformat/ac3_bitrate_tab.c b/libavformat/ac3_bitrate_tab.c
> > > new file mode 100644
> > > index 00..57b6181511
> > > --- /dev/null
> > > +++ b/libavformat/ac3_bitrate_tab.c
> > > @@ -0,0 +1,22 @@
> > > +/*
> > > + * AC-3 bit rate table
> > > + * copyright (c) 2001 Fabrice Bellard
> > > + *
> > > + * 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 "libavcodec/ac3_bitrate_tab.h"
> > > diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> > > index 103f958d75..a071f1cdd5 100644
> > > --- a/libavformat/movenc.c
> > > +++ b/libavformat/movenc.c
> > > @@ -36,6 +36,7 @@
> > >  #include "av1.h"
> > >  #include "avc.h"
> > >  #include "libavcodec/ac3_parser_internal.h"
> > > +#include "libavcodec/ac3tab.h"
> > >  #include "libavcodec/dnxhddata.h"
> > >  #include "libavcodec/flac.h"
> > >  #include "libavcodec/get_bits.h"
> > > @@ -362,44 +363,42 @@ struct eac3_info {
> > >
> > >  static int mov_write_ac3_tag(AVFormatContext *s, AVIOContext *pb, 
> > > MOVTrack *track)
> > >  {
> > > -GetBitContext gbc;
> > > +struct eac3_info *info = track->eac3_priv;
> > > +int8_t ac3_bit_rate_code = -1;
> > >  PutBitContext pbc;
> > >  uint8_t buf[3];
> > > -int fscod, bsid, bsmod, acmod, lfeon, frmsizecod;
> > >
> > > -if (track->vos_len < 7) {
> > > +if (!info || !info->ec3_done) {
> > >  av_log(s, AV_LOG_ERROR,
> > > "Cannot write moov atom before AC3 packets."
> > > " Set the delay_moov flag to fix this.\n");
> > >  return AVERROR(EINVAL);
> > >  }
> > >
> > > -avio_wb32(pb, 11);
> > > -ffio_wfourcc(pb, "dac3");
> > > +for (unsigned int i = 0; i < FF_ARRAY_ELEMS(ff_ac3_bitrate_tab); 
> > > i++) {
> > > +if (info->data_rate == ff_ac3_bitrate_tab[i]) {
> > > +ac3_bit_rate_code = i;
> > > +break;
> > > +}
> > > +}
> >
> > Why don't you just export the bit rate code instead of rederiving it?
> > This should be easy now that you intend to disallow AC-3 frames with
> > bsid > 8.
> >
>
> Other re

[FFmpeg-devel] [PATCH] libavcodec/qsvenc: Add support to qsv to encode external surface.

2022-06-27 Thread Wenbin Chen
Qsv encoder only encode the frame that are pre-allocated, so qsv encoder
cannot encode the frame mapped from other components. In fact, MediaSDK
can encode frame that are dynamically created. I add the support to qsv
to encode external frame. Now the following command line works:

ffmpeg -v verbose -init_hw_device vaapi=va -init_hw_device qsv=qs@va \
-hwaccel qsv -hwaccel_device qs -c:v h264_qsv -i input.264 -vf \
"hwmap=derive_device=vaapi,format=vaapi,hwmap=derive_device=vulkan, \
format=vulkan,scale_vulkan=w=1920:h=1080,hwmap=derive_device=vaapi, \
format=vaapi,hwmap=derive_device=qsv:reverse=1:extra_hw_frames=16, \
format=qsv" -c:v h264_qsv output.264

Signed-off-by: Wenbin Chen 
Signed-off-by: Tong Wu 
---
 libavcodec/qsv_internal.h |  1 +
 libavcodec/qsvenc.c   | 19 --
 libavutil/hwcontext_qsv.c | 79 ++-
 3 files changed, 86 insertions(+), 13 deletions(-)

diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index 8131acdae9..2ee523ec3d 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -90,6 +90,7 @@ typedef struct QSVFrame {
 
 int queued;
 int used;
+int external_frame;
 
 struct QSVFrame *next;
 } QSVFrame;
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 2382c2f5f7..e269ece5d9 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1421,6 +1421,10 @@ static void clear_unused_frames(QSVEncContext *q)
 memset(&cur->enc_ctrl, 0, sizeof(cur->enc_ctrl));
 cur->enc_ctrl.Payload = cur->payloads;
 cur->enc_ctrl.ExtParam = cur->extparam;
+if (cur->external_frame) {
+av_freep(&cur->surface.Data.MemId);
+cur->external_frame = 0;
+}
 if (cur->frame->format == AV_PIX_FMT_QSV) {
 av_frame_unref(cur->frame);
 }
@@ -1486,10 +1490,17 @@ static int submit_frame(QSVEncContext *q, const AVFrame 
*frame,
 
 if (q->frames_ctx.mids) {
 ret = ff_qsv_find_surface_idx(&q->frames_ctx, qf);
-if (ret < 0)
-return ret;
-
-qf->surface.Data.MemId = &q->frames_ctx.mids[ret];
+if (ret >= 0)
+qf->surface.Data.MemId = &q->frames_ctx.mids[ret];
+}
+if (!q->frames_ctx.mids || ret < 0) {
+QSVMid *mid = NULL;
+mid = (QSVMid *)av_mallocz(sizeof(*mid));
+if (!mid)
+return AVERROR(ENOMEM);
+mid->handle_pair = (mfxHDLPair *)qf->surface.Data.MemId;
+qf->surface.Data.MemId = mid;
+qf->external_frame = 1;
 }
 } else {
 /* make a copy if the input is not padded as libmfx requires */
diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index 56dffa1f25..565c79a4e0 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -1337,11 +1337,24 @@ static int qsv_frames_derive_to(AVHWFramesContext 
*dst_ctx,
 return 0;
 }
 
+static void qsv_umap_external_surface(AVHWFramesContext *dst_fc,
+ HWMapDescriptor *hwmap)
+{
+mfxFrameSurface1 *new_sur = (mfxFrameSurface1 *)hwmap->priv;
+mfxHDLPair *hdlpair = (mfxHDLPair *)new_sur->Data.MemId;
+if (hwmap->source->format == AV_PIX_FMT_VAAPI)
+av_freep(&hdlpair->first);
+av_freep(&new_sur->Data.MemId);
+av_freep(&new_sur);
+}
+
 static int qsv_map_to(AVHWFramesContext *dst_ctx,
   AVFrame *dst, const AVFrame *src, int flags)
 {
 AVQSVFramesContext *hwctx = dst_ctx->hwctx;
 int i, err, index = -1;
+mfxFrameSurface1 *new_sur = NULL;
+mfxHDLPair *new_hdlpair = NULL;
 
 for (i = 0; i < hwctx->nb_surfaces && index < 0; i++) {
 switch(src->format) {
@@ -1379,22 +1392,70 @@ static int qsv_map_to(AVHWFramesContext *dst_ctx,
 #endif
 }
 }
+/* If the surface is not in the pool, create a new surface */
 if (index < 0) {
-av_log(dst_ctx, AV_LOG_ERROR, "Trying to map from a surface which "
-   "is not in the mapped frames context.\n");
-return AVERROR(EINVAL);
+new_sur = (mfxFrameSurface1 *)av_mallocz(sizeof(*new_sur));
+if (!new_sur) {
+err = AVERROR(ENOMEM);
+goto fail;
+}
+err = qsv_init_surface(dst_ctx, new_sur);
+if (err < 0)
+goto fail;
+
+new_hdlpair = (mfxHDLPair *)av_mallocz(sizeof(*new_hdlpair));
+if (!new_hdlpair) {
+err = AVERROR(ENOMEM);
+goto fail;
+}
+switch (src->format) {
+#if CONFIG_VAAPI
+case AV_PIX_FMT_VAAPI:
+new_hdlpair->first = (VASurfaceID 
*)av_mallocz(sizeof(VASurfaceID));
+if (!new_hdlpair->first) {
+err = AVERROR(ENOMEM);
+goto fail;
+}
+*(VASurfaceID*)new_hdlpair->first = 
(VASurfaceID)(uintptr_t)src->data[3];
+break;
+#endif

Re: [FFmpeg-devel] [PATCH] fftools/ffprobe.c: Add new Function: The peak bit rate of video streams can be queried

2022-06-27 Thread Nicolas Gaullier
>Please review it! thks!
>
>Code Process
>- Calculate the frame rate first
>- Obtain the maximum value of the total bytes of all packets according to the 
>number of frames per second

Nicolas George already answered you the 23th about required documentation.
In my opinion, there is today a commonplace definition of max bitrate that 
involves computation over a sliding window of 1s. This is reinforced by ISO/MP4 
(14496-12), but even in the broadcast industry with the MXF file format, this 
is currently how a max bitrate is understood.
I fear that introducing another method of computation will raise some confusion 
for many end users.

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

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


[FFmpeg-devel] [PATCH] avformat/aaxdec: Check for empty segments

2022-06-27 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
48154/clusterfuzz-testcase-minimized-ffmpeg_dem_AAX_fuzzer-5149094353436672

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavformat/aaxdec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/aaxdec.c b/libavformat/aaxdec.c
index dd1fbde736..bcbff216db 100644
--- a/libavformat/aaxdec.c
+++ b/libavformat/aaxdec.c
@@ -252,6 +252,8 @@ static int aax_read_header(AVFormatContext *s)
 size  = avio_rb32(pb);
 a->segments[r].start = start + a->data_offset;
 a->segments[r].end   = a->segments[r].start + size;
+if (!size)
+return AVERROR_INVALIDDATA;
 if (r &&
 a->segments[r].start < a->segments[r-1].end &&
 a->segments[r].end   > a->segments[r-1].start)
-- 
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] avcodec/libdavs2: workaround memory leak

2022-06-27 Thread Zhao Zhili
davs2_decoder_close doesn't free those on the fly frames which
don't get output yet. It's a design bug, but easy to workaround.

Before the patch:
Direct leak of 1198606 byte(s) in 2 object(s) allocated from:
#0 0x563af5e1e5f0 in malloc (ffmpeg+0x6675f0)
#1 0x563af9765ef3 in davs2_malloc davs2/source/common/common.h:1240
#2 0x563af9765ef3 in davs2_alloc_picture davs2/source/common/header.cc:815

Indirect leak of 3595818 byte(s) in 6 object(s) allocated from:
#0 0x563af5e1e5f0 in malloc (ffmpeg+0x6675f0)
#1 0x563af9765ef3 in davs2_malloc davs2/source/common/common.h:1240
#2 0x563af9765ef3 in davs2_alloc_picture davs2/source/common/header.cc:815

Signed-off-by: Zhao Zhili 
---
 libavcodec/libdavs2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index d7625718a2..c2040775ae 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -177,6 +177,7 @@ static av_cold int davs2_end(AVCodecContext *avctx)
 
 /* close the decoder */
 if (cad->decoder) {
+davs2_flush(avctx);
 davs2_decoder_close(cad->decoder);
 cad->decoder = NULL;
 }
-- 
2.35.3

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

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


[FFmpeg-devel] [PATCH] lavf/sr: fix the segmentation fault caused by incorrect input frame free.

2022-06-27 Thread Ting Fu
This issue would cause segmetaion fault when running srcnn model with
sr filter by TensorFlow backend. This filter would free the frame incorectly.

Signed-off-by: Ting Fu 
---
 libavfilter/vf_sr.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c
index 0890c8ba18..cb24c096ce 100644
--- a/libavfilter/vf_sr.c
+++ b/libavfilter/vf_sr.c
@@ -159,8 +159,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 sws_scale(ctx->sws_uv_scale, (const uint8_t **)(in->data + 2), 
in->linesize + 2,
   0, ctx->sws_uv_height, out->data + 2, out->linesize + 2);
 }
-
-av_frame_free(&in);
+if (in != out) {
+av_frame_free(&in);
+}
 return ff_filter_frame(outlink, out);
 }
 
-- 
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] lavf/dnn: refine the error log of OpenVINO incorrect input/output name.

2022-06-27 Thread Ting Fu
Refine the error report of OpenVINO backend incorrect input or output node
name, help the users to locate issue.

Signed-off-by: Ting Fu 
---
 libavfilter/dnn/dnn_backend_openvino.c | 54 ++
 1 file changed, 47 insertions(+), 7 deletions(-)

diff --git a/libavfilter/dnn/dnn_backend_openvino.c 
b/libavfilter/dnn/dnn_backend_openvino.c
index cf012aca4c..02d40327a5 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -58,6 +58,8 @@ typedef struct OVModel{
 SafeQueue *request_queue;   // holds OVRequestItem
 Queue *task_queue;  // holds TaskItem
 Queue *lltask_queue; // holds LastLevelTaskItem
+char *all_input_names;
+char *all_output_names;
 } OVModel;
 
 // one request for one call to openvino
@@ -336,13 +338,23 @@ static int init_model_ov(OVModel *ov_model, const char 
*input_name, const char *
 // while we pass NHWC data from FFmpeg to openvino
 status = ie_network_set_input_layout(ov_model->network, input_name, NHWC);
 if (status != OK) {
-av_log(ctx, AV_LOG_ERROR, "Failed to set layout as NHWC for input 
%s\n", input_name);
+if (status == NOT_FOUND) {
+av_log(ctx, AV_LOG_ERROR, "Could not find \"%s\" in model, failed 
to set input layout as NHWC, "\
+  "all input(s) are: \"%s\"\n", 
input_name, ov_model->all_input_names);
+} else{
+av_log(ctx, AV_LOG_ERROR, "Failed to set layout as NHWC for input 
%s\n", input_name);
+}
 ret = DNN_GENERIC_ERROR;
 goto err;
 }
 status = ie_network_set_output_layout(ov_model->network, output_name, 
NHWC);
 if (status != OK) {
-av_log(ctx, AV_LOG_ERROR, "Failed to set layout as NHWC for output 
%s\n", output_name);
+if (status == NOT_FOUND) {
+av_log(ctx, AV_LOG_ERROR, "Could not find \"%s\" in model, failed 
to set output layout as NHWC, "\
+  "all output(s) are: \"%s\"\n", 
input_name, ov_model->all_output_names);
+} else{
+av_log(ctx, AV_LOG_ERROR, "Failed to set layout as NHWC for output 
%s\n", output_name);
+}
 ret = DNN_GENERIC_ERROR;
 goto err;
 }
@@ -505,7 +517,6 @@ static int get_input_ov(void *model, DNNData *input, const 
char *input_name)
 OVModel *ov_model = model;
 OVContext *ctx = &ov_model->ctx;
 char *model_input_name = NULL;
-char *all_input_names = NULL;
 IEStatusCode status;
 size_t model_input_count = 0;
 dimensions_t dims;
@@ -538,15 +549,12 @@ static int get_input_ov(void *model, DNNData *input, 
const char *input_name)
 input->width= input_resizable ? -1 : dims.dims[3];
 input->dt   = precision_to_datatype(precision);
 return 0;
-} else {
-//incorrect input name
-APPEND_STRING(all_input_names, model_input_name)
 }
 
 ie_network_name_free(&model_input_name);
 }
 
-av_log(ctx, AV_LOG_ERROR, "Could not find \"%s\" in model, all input(s) 
are: \"%s\"\n", input_name, all_input_names);
+av_log(ctx, AV_LOG_ERROR, "Could not find \"%s\" in model, all input(s) 
are: \"%s\"\n", input_name, ov_model->all_input_names);
 return AVERROR(EINVAL);
 }
 
@@ -729,6 +737,8 @@ DNNModel *ff_dnn_load_model_ov(const char *model_filename, 
DNNFunctionType func_
 OVModel *ov_model = NULL;
 OVContext *ctx = NULL;
 IEStatusCode status;
+size_t node_count = 0;
+char *node_name = NULL;
 
 model = av_mallocz(sizeof(DNNModel));
 if (!model){
@@ -744,6 +754,8 @@ DNNModel *ff_dnn_load_model_ov(const char *model_filename, 
DNNFunctionType func_
 ov_model->model = model;
 ov_model->ctx.class = &dnn_openvino_class;
 ctx = &ov_model->ctx;
+ov_model->all_input_names = NULL;
+ov_model->all_output_names = NULL;
 
 //parse options
 av_opt_set_defaults(ctx);
@@ -767,6 +779,34 @@ DNNModel *ff_dnn_load_model_ov(const char *model_filename, 
DNNFunctionType func_
 goto err;
 }
 
+//get all the input and output names
+status = ie_network_get_inputs_number(ov_model->network, &node_count);
+if (status != OK) {
+av_log(ctx, AV_LOG_ERROR, "Failed to get input count\n");
+goto err;
+}
+for (size_t i = 0; i < node_count; i++) {
+status = ie_network_get_input_name(ov_model->network, i, &node_name);
+if (status != OK) {
+av_log(ctx, AV_LOG_ERROR, "Failed to get No.%d input's name\n", 
(int)i);
+goto err;
+}
+APPEND_STRING(ov_model->all_input_names, node_name)
+}
+status = ie_network_get_outputs_number(ov_model->network, &node_count);
+if (status != OK) {
+av_log(ctx, AV_LOG_ERROR, "Failed to get output count\n");
+goto err;
+}
+for (size_t i = 0; i < node_count; i++) {
+status = ie_network_get_output_name(ov_model->network, i, &nod

Re: [FFmpeg-devel] [PATCH] fftools/ffplay: fix YUV conversion mode

2022-06-27 Thread Niklas Haas
On Mon, 27 Jun 2022 10:03:55 +0300 Jan Ekström  wrote:
> On Tue, Jun 21, 2022 at 10:46 PM Niklas Haas  wrote:
> >
> > From: Niklas Haas 
> >
> > GL and Metal cache the state at time of texture creation. GLES2 and
> > Direct3D 11 use the state at time of the render copy call.
> >
> > So the only way we can get the correct behavior consistently is by
> > making sure the state is set for both the upload *and* the draw call.
> > This probably isn't our bug to fix (upstream should make itself behave
> > consistently and also document its functions), but as it stands,
> > `ffplay` is misrendering BT.709 as BT.601 on my stock Linux system, and
> > that leaves a bad taste in my mouth.
> >
> > Signed-off-by: Niklas Haas 
> > ---
> 
> Moves the color space setting earlier, as well as clears the state in
> case of an additional failure exit case with upload.
> 
> LGTM.
> 
> Jan

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

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


Re: [FFmpeg-devel] [PATCH] lavf/sr: fix the segmentation fault caused by incorrect input frame free.

2022-06-27 Thread Paul B Mahol
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] avformat/mpegts: correct timestamp overflow on multiple pcr loopback

2022-06-27 Thread Sébastien Rossi
Hi,
Ok, my goal was to eliminate all wraparound for live transport stream
mainly. But as it seems hard to handle this particular case (long live
stream) and cover all the other use cases (scaning, smart stuff etc), I
will keep this patch on my side as an option for my personal usage.
Thanks for your help, have a good day.

Sébastien

Le ven. 24 juin 2022 à 22:35, Michael Niedermayer 
a écrit :

> Hi
>
> On Fri, Jun 24, 2022 at 02:30:19PM +0200, Sébastien Rossi wrote:
> > The issue I tried to patch is that on ts stream that last more than 26,5h
> > (time between pcr loopback) we had pts and dts discontinuities. In
> > wrap_timestamp function in demux.c, I've seen there's some code to
> correct
> > timestamp overflow, but when the stream last more than 26,5h, timestamps
> > are upper than pts_wrap_reference two times. So the second time we outrun
> > the pts_wrap_reference we lose the timestamp correction and have some
> > errors like pts < dts.
> > What I tried to do is to restamp pts and dts using mpegts pcr
> information.
> > The preserve_continuity function checks relative position between
> timestamp
> > (dts or pts) and pcr, and handle cases when pcr have already loopback and
> > timestamp not or vice versa. Then it applicates correction to the
> timestamp
> > depending on pcr loopback count.
>
> there can be more timestamp discontinuities than one per 26.5h
> if the goal is to remove all that requires more code. Either
> some scaning of the whole file or some quite smart stuff and either
> way a buffer to store where the discontinuities are so they are
> consistantly
> handled during seeking.
>
> if the goal is to eliminate 1 wraparound only, there should be some
> existing code i think that does this. IIRC see pts_wrap_behavior
>
> the wraping behavior is applies to multiple demuxers so code
> handling it really does not belong in a single demuxer
>
>
> >
> > I can provide a stream with a duration of 30h, if you want to.
>
> not needed
>
>
> >
> > Could you tell me how to reproduce the segfault you've seen ?
>
> it segfaults because filter is NULL.
> i can send you the file but as the code and why its segfaults is
> specific to one demxuer and this shouldnt be in one single demuxer
> i dont think it would help you
>
> thx
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> I am the wisest man alive, for I know one thing, and that is that I know
> nothing. -- Socrates
> ___
> 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/qpeldsp: copy less for the mc0x cases

2022-06-27 Thread Michael Niedermayer
On Mon, Jun 27, 2022 at 07:57:06AM +0200, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > Fixes: out of array access
> > Fixes: 
> > 47936/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-5745039940124672
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/qpeldsp.c | 12 ++--
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/libavcodec/qpeldsp.c b/libavcodec/qpeldsp.c
> > index 2b9146ceb1..5f937f9d9e 100644
> > --- a/libavcodec/qpeldsp.c
> > +++ b/libavcodec/qpeldsp.c
> > @@ -199,7 +199,7 @@ static void OPNAME ## qpel8_mc01_c(uint8_t *dst, const 
> > uint8_t *src,  \
> >  uint8_t full[16 * 9];  
> >\
> >  uint8_t half[64];  
> >\
> > 
> >\
> > -copy_block9(full, src, 16, stride, 9); 
> >\
> > +copy_block8(full, src, 16, stride, 9); 
> >\
> >  put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16);
> >\
> >  OPNAME ## pixels8_l2_8(dst, full, half, stride, 16, 8, 8); 
> >\
> >  }  
> >\
> > @@ -209,7 +209,7 @@ static void OPNAME ## qpel8_mc02_c(uint8_t *dst, const 
> > uint8_t *src,  \
> >  {  
> >\
> >  uint8_t full[16 * 9];  
> >\
> > 
> >\
> > -copy_block9(full, src, 16, stride, 9); 
> >\
> > +copy_block8(full, src, 16, stride, 9); 
> >\
> >  OPNAME ## mpeg4_qpel8_v_lowpass(dst, full, stride, 16);
> >\
> >  }  
> >\
> > 
> >\
> > @@ -219,7 +219,7 @@ static void OPNAME ## qpel8_mc03_c(uint8_t *dst, const 
> > uint8_t *src,  \
> >  uint8_t full[16 * 9];  
> >\
> >  uint8_t half[64];  
> >\
> > 
> >\
> > -copy_block9(full, src, 16, stride, 9); 
> >\
> > +copy_block8(full, src, 16, stride, 9); 
> >\
> >  put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16);
> >\
> >  OPNAME ## pixels8_l2_8(dst, full + 16, half, stride, 16, 8, 8);
> >\
> >  }  
> >\
> > @@ -459,7 +459,7 @@ static void OPNAME ## qpel16_mc01_c(uint8_t *dst, const 
> > uint8_t *src, \
> >  uint8_t full[24 * 17]; 
> >\
> >  uint8_t half[256]; 
> >\
> > 
> >\
> > -copy_block17(full, src, 24, stride, 17);   
> >\
> > +copy_block16(full, src, 24, stride, 17);   
> >\
> >  put ## RND ## mpeg4_qpel16_v_lowpass(half, full, 16, 24);  
> >\
> >  OPNAME ## pixels16_l2_8(dst, full, half, stride, 24, 16, 16);  
> >\
> >  }  
> >\
> > @@ -469,7 +469,7 @@ static void OPNAME ## qpel16_mc02_c(uint8_t *dst, const 
> > uint8_t *src, \
> >  {  
> >\
> >  uint8_t full[24 * 17]; 
> >\
> > 
> >\
> > -copy_block17(full, src, 24, stride, 17);   
> >\
> > +copy_block16(full, src, 24, stride, 17);   
> >\
> >  OPNAME ## mpeg4_qpel16_v_lowpass(dst, full, stride, 24);   
> >\
> >  }  
> >\
> > 
> >\
> > @@ -479,7 +479,7 @@ static void OPNAME ## qpel16_mc03_c(uint8_t *dst, const 
> > uint8_t *src, \
> >  uint8_t full[24 * 17]; 
> >\
> > 

Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Add resend_headers option

2022-06-27 Thread hu heng
Your are right, I will send a new version of this patch.

Thanks.

Steven Liu  于2022年6月27日周一 10:25写道:

> huheng  于2022年6月25日周六 23:36写道:
> >
> > Add pat and pmt table at start of each segment in single_file mode
> enhanced
> > compatibility of hls stream. Because some hls clients separate parsing
> segment
> > of hls stream, the absence of pat/pmt will cause parsing to fail.
> >
> > Signed-off-by: huheng 
> > ---
> >  libavformat/hlsenc.c | 5 +
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> > index 3bafddfa61..ee5c5afe56 100644
> > --- a/libavformat/hlsenc.c
> > +++ b/libavformat/hlsenc.c
> > @@ -2631,6 +2631,11 @@ static int hls_write_packet(AVFormatContext *s,
> AVPacket *pkt)
> >  vs->start_pos += vs->size;
> >  if (hls->key_info_file || hls->encrypt)
> >  ret = hls_start(s, vs);
> > +
> Is it need check hls->segment_type == SEGMENT_TYPE_MPEGTS here?
> > +if (oc->oformat->priv_class && oc->priv_data) {
> > +av_opt_set(oc->priv_data, "mpegts_flags",
> "resend_headers", 0);
> > +}
> > +
> >  } else if (hls->max_seg_size > 0) {
> >  if (vs->size + vs->start_pos >= hls->max_seg_size) {
> >  vs->sequence++;
> > --
> > 2.36.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
> Steven
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH v2 2/2] ffmpeg: add option -isync

2022-06-27 Thread Gyan Doshi

Ping for the set.

On 2022-06-25 01:59 pm, Gyan Doshi wrote:

This is a per-file input option that adjusts an input's timestamps
with reference to another input, so that emitted packet timestamps
account for the difference between the start times of the two inputs.

Typical use case is to sync two or more live inputs such as from capture
devices. Both the target and reference input source timestamps should be
based on the same clock source.

If not all inputs have timestamps, the wallclock times at the time of
reception of inputs shall be used.
---
  doc/ffmpeg.texi  | 16 
  fftools/ffmpeg.h |  2 ++
  fftools/ffmpeg_opt.c | 59 
  3 files changed, 77 insertions(+)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index d943f4d6f5..8fc85d3a15 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -518,6 +518,22 @@ see @ref{time duration syntax,,the Time duration section 
in the ffmpeg-utils(1)
  Like the @code{-ss} option but relative to the "end of file". That is negative
  values are earlier in the file, 0 is at EOF.
  
+@item -isync @var{input_index} (@emph{input})

+Assign an input as a sync source.
+
+This will take the difference between the start times of the target and 
referenced inputs and
+offset the timestamps of the target file by that difference. The source 
timestamps of the two
+inputs should derive from the same clock source for expected results. If 
@code{copyts} is set
+then @code{start_at_zero} must also be set. If at least one of the inputs has 
no starting
+timestamp then the wallclock time at time of reception of the inputs is used 
as a best-effort
+sync basis.
+
+Acceptable values are those that refer to a valid ffmpeg input index. If the 
sync reference is
+the target index itself or @var{-1}, then no adjustment is made to target 
timestamps. A sync
+reference may not itself be synced to any other input.
+
+Default value is @var{-1}.
+
  @item -itsoffset @var{offset} (@emph{input})
  Set the input time offset.
  
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h

index 69a368b8d1..dc74de6684 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -118,6 +118,7 @@ typedef struct OptionsContext {
  float readrate;
  int accurate_seek;
  int thread_queue_size;
+int input_sync_ref;
  
  SpecifierOpt *ts_scale;

  intnb_ts_scale;
@@ -410,6 +411,7 @@ typedef struct InputFile {
   at the moment when looping happens */
  AVRational time_base; /* time base of the duration */
  int64_t input_ts_offset;
+int input_sync_ref;
  
  int64_t ts_offset;

  int64_t last_ts;
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index e08455478f..de858efbe9 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -235,6 +235,7 @@ static void init_options(OptionsContext *o)
  o->chapters_input_file = INT_MAX;
  o->accurate_seek  = 1;
  o->thread_queue_size = -1;
+o->input_sync_ref = -1;
  }
  
  static int show_hwaccels(void *optctx, const char *opt, const char *arg)

@@ -287,6 +288,58 @@ static int parse_and_set_vsync(const char *arg, int 
*vsync_var, int file_idx, in
  return 0;
  }
  
+static int apply_sync_offsets(void)

+{
+for (int i = 0; i < nb_input_files; i++) {
+InputFile *ref, *self = input_files[i];
+int64_t adjustment;
+int64_t self_start_time, ref_start_time, self_seek_start, 
ref_seek_start;
+int sync_fpw = 0;
+
+if (self->input_sync_ref == -1 || self->input_sync_ref == i) continue;
+if (self->input_sync_ref >= nb_input_files || self->input_sync_ref < 
-1) {
+av_log(NULL, AV_LOG_FATAL, "-isync for input %d references non-existent 
input %d.\n", i, self->input_sync_ref);
+exit_program(1);
+}
+
+if (copy_ts && !start_at_zero) {
+av_log(NULL, AV_LOG_FATAL, "Use of -isync requires that start_at_zero 
be set if copyts is set.\n");
+exit_program(1);
+}
+
+ref = input_files[self->input_sync_ref];
+if (ref->input_sync_ref != -1 && ref->input_sync_ref != 
self->input_sync_ref) {
+av_log(NULL, AV_LOG_ERROR, "-isync for input %d references a resynced 
input %d. Sync not set.\n", i, self->input_sync_ref);
+continue;
+}
+
+if (self->ctx->start_time_realtime != AV_NOPTS_VALUE && 
ref->ctx->start_time_realtime != AV_NOPTS_VALUE) {
+self_start_time = self->ctx->start_time_realtime;
+ref_start_time  =  ref->ctx->start_time_realtime;
+} else if (self->ctx->start_time != AV_NOPTS_VALUE && 
ref->ctx->start_time != AV_NOPTS_VALUE) {
+self_start_time = self->ctx->start_time;
+ref_start_time  =  ref->ctx->start_time;
+} else {
+self_start_time = self->ctx->first_pkt_wallclock;
+ref_start_time  =  ref->ctx->first_pkt_wallclock;
+sync_fpw = 1;
+}
+
+self_

[FFmpeg-devel] [PATCH v1] avformat/hlsenc: Add resend_headers option

2022-06-27 Thread huheng
Add pat and pmt table at start of each segment in single_file mode enhanced
compatibility of hls stream. Because some hls clients separate parsing segment
of hls stream, the absence of pat/pmt will cause parsing to fail.

Signed-off-by: huheng 
---
 libavformat/hlsenc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 3bafddfa61..d18178e727 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2631,6 +2631,9 @@ static int hls_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 vs->start_pos += vs->size;
 if (hls->key_info_file || hls->encrypt)
 ret = hls_start(s, vs);
+if (hls->segment_type == SEGMENT_TYPE_MPEGTS && 
oc->oformat->priv_class && oc->priv_data) {
+av_opt_set(oc->priv_data, "mpegts_flags", "resend_headers", 0);
+}
 } else if (hls->max_seg_size > 0) {
 if (vs->size + vs->start_pos >= hls->max_seg_size) {
 vs->sequence++;
-- 
2.36.1

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

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


Re: [FFmpeg-devel] [PATCH] avformat/movenc: Support alpha channel for AVIF

2022-06-27 Thread Vignesh Venkatasubramanian
On Tue, Jun 21, 2022 at 10:12 AM Vignesh Venkatasubramanian
 wrote:
>
> On Mon, Jun 13, 2022 at 10:17 AM James Zern
>  wrote:
> >
> > On Wed, Jun 1, 2022 at 11:06 AM Vignesh Venkatasubramanian
> >  wrote:
> > >
> > > AVIF specification allows for alpha channel as an auxiliary item (in
> > > case of still images) or as an auxiliary track (in case of animated
> > > images).  Add support for both of these. The AVIF muxer will take
> > > exactly two streams (when alpha is present) as input (first one being
> > > the YUV planes and the second one being the alpha plane).
> > >
> > > The input has to come from two different images (one of it color and
> > > the other one being alpha), or it can come from a single file
> > > source with the alpha channel extracted using the "alphaextract"
> > > filter.
> > >
> > > Example using alphaextract:
> > > ffmpeg -i rgba.png -filter_complex "[0:v]alphaextract[a]" -map 0 -map 
> > > "[a]" -still-picture 1 avif_with_alpha.avif
> > >
> > > Example using two sources (first source can be in any pixel format and
> > > the second source has to be in monochrome grey pixel format):
> > > ffmpeg -i color.avif -i grey.avif -map 0 -map 1 -c copy 
> > > avif_with_alpha.avif
> > >
> > > The generated files pass the compliance checks in Compliance Warden:
> > > https://github.com/gpac/ComplianceWarden
> > >
> > > libavif (the reference avif library) is able to decode the files
> > > generated using this patch.
> > >
> > > They also play back properly (with transparent background) in:
> > > 1) Chrome
> > > 2) Firefox (only still AVIF, no animation support)
> > >
> > > Signed-off-by: Vignesh Venkatasubramanian 
> > > ---
> > >  libavformat/movenc.c | 188 +--
> > >  libavformat/movenc.h |   4 +-
> > >  2 files changed, 130 insertions(+), 62 deletions(-)
> > >
> >
> > 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".
>
> Any more comments on this? If not can this be merged please? :)
>

Another ping on this please.

> --
> Vignesh



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

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


Re: [FFmpeg-devel] [PATCH] avformat/mov: Only read the primary item for AVIF

2022-06-27 Thread Vignesh Venkatasubramanian
On Tue, Jun 21, 2022 at 10:12 AM Vignesh Venkatasubramanian
 wrote:
>
> On Mon, Jun 13, 2022 at 9:32 AM Vignesh Venkatasubramanian
>  wrote:
> >
> > On Fri, Jun 10, 2022 at 10:34 AM Vignesh Venkatasubramanian
> >  wrote:
> > >
> > > On Thu, Jun 9, 2022 at 12:50 AM Gyan Doshi  wrote:
> > > >
> > > >
> > > >
> > > > On 2022-06-08 10:51 pm, Vignesh Venkatasubramanian wrote:
> > > > > On Thu, Jun 2, 2022 at 1:35 PM James Zern  wrote:
> > > > >> On Wed, Jun 1, 2022 at 1:38 PM Vignesh Venkatasubramanian
> > > > >>  wrote:
> > > > >>> On Wed, Jun 1, 2022 at 10:30 AM James Zern  wrote:
> > > >  On Sun, Apr 24, 2022 at 11:35 AM Vignesh Venkatasubramanian
> > > >   wrote:
> > > > > Update the still AVIF parser to only read the primary item. With 
> > > > > this
> > > > > patch, AVIF still images with exif/icc/alpha channel will no 
> > > > > longer
> > > > > fail to parse.
> > > > >
> > > > > For example, this patch enables parsing of files in:
> > > > > https://github.com/AOMediaCodec/av1-avif/tree/master/testFiles/Microsoft
> > > > >
> > > >  Can some of the failing files or similar ones be added to fate?
> > > > >>> There are no fate tests for AVIF parsing as of now. I was thinking
> > > > >>> about adding some for the muxing. But i am not sure what can be done
> > > > >>> here for the parsing.
> > > > >>>
> > > > >> Thanks. Are there any for general mov/mp4 parsing that could be
> > > > >> extended? This looks good otherwise.
> > > > >  From what i see, most of the mov tests only seem to be for muxing. 
> > > > > I'm
> > > > > not entirely certain about how to add a test for AVIF parsing. If
> > > > > anybody has an idea, i'd be open to adding it.
> > > >
> > > > Basic test would use the framemd5 muxer to compare demuxed packets with
> > > > a reference.
> > > > See fate-ffmpeg-streamloop
> > > >
> > >
> > > Thank you i have added a couple of fate tests.
> > >
> > > I am not sure how to add the AVIF files to the fate test server. I
> > > have them on Google Drive here:
> > >
> > > https://drive.google.com/file/d/1diZoM0Ew7Co3Yh5w5y1J-3IiBYVmUv9J/view?usp=sharing
> > > https://drive.google.com/file/d/1DdrD1mW36evt40a4RkeLYpx-oojmbc3z/view?usp=sharing
> > >
> > > These links should be publicly available without any sign in required.
> > > Please let me know if there is another preferred way of sharing test
> > > files and i can share it that way.
> > >
> >
> > Also, i forgot to mention that these files have to be uploaded under a
> > new directory called "avif" in the fate server.
> >
> > > Also for the record, these files were created by remuxing an existing
> > > file in the fate suite.
> > >
> > > still_image.avif - contains the first frame from
> > > av1-test-vectors/av1-1-b8-02-allintra.ivf
> > > still_image_exif.avif - contains the first frame from
> > > av1-test-vectors/av1-1-b8-02-allintra.ivf with dummy exif data.
> > >
> > > > 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".
> > >
> > >
> > >
> > > --
> > > Vignesh
> >
> >
> >
> > --
> > Vignesh
>
> Ping on this please.
>
> --
> Vignesh

Another ping on this please. :)

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

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


Re: [FFmpeg-devel] [PATCH] avformat/movenc: Support alpha channel for AVIF

2022-06-27 Thread James Almer

On 6/27/2022 1:43 PM, Vignesh Venkatasubramanian wrote:

On Tue, Jun 21, 2022 at 10:12 AM Vignesh Venkatasubramanian
 wrote:


On Mon, Jun 13, 2022 at 10:17 AM James Zern
 wrote:


On Wed, Jun 1, 2022 at 11:06 AM Vignesh Venkatasubramanian
 wrote:


AVIF specification allows for alpha channel as an auxiliary item (in
case of still images) or as an auxiliary track (in case of animated
images).  Add support for both of these. The AVIF muxer will take
exactly two streams (when alpha is present) as input (first one being
the YUV planes and the second one being the alpha plane).

The input has to come from two different images (one of it color and
the other one being alpha), or it can come from a single file
source with the alpha channel extracted using the "alphaextract"
filter.

Example using alphaextract:
ffmpeg -i rgba.png -filter_complex "[0:v]alphaextract[a]" -map 0 -map "[a]" 
-still-picture 1 avif_with_alpha.avif

Example using two sources (first source can be in any pixel format and
the second source has to be in monochrome grey pixel format):
ffmpeg -i color.avif -i grey.avif -map 0 -map 1 -c copy avif_with_alpha.avif

The generated files pass the compliance checks in Compliance Warden:
https://github.com/gpac/ComplianceWarden

libavif (the reference avif library) is able to decode the files
generated using this patch.

They also play back properly (with transparent background) in:
1) Chrome
2) Firefox (only still AVIF, no animation support)

Signed-off-by: Vignesh Venkatasubramanian 
---
  libavformat/movenc.c | 188 +--
  libavformat/movenc.h |   4 +-
  2 files changed, 130 insertions(+), 62 deletions(-)



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


Any more comments on this? If not can this be merged please? :)



Another ping on this please.


--
Vignesh


I thought James Zern had push access, which is why i didn't apply it as 
soon as he reviewed it. Sorry.


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

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


Re: [FFmpeg-devel] [PATCH] avformat/movenc: Support alpha channel for AVIF

2022-06-27 Thread Vignesh Venkatasubramanian
On Mon, Jun 27, 2022 at 9:48 AM James Almer  wrote:
>
> On 6/27/2022 1:43 PM, Vignesh Venkatasubramanian wrote:
> > On Tue, Jun 21, 2022 at 10:12 AM Vignesh Venkatasubramanian
> >  wrote:
> >>
> >> On Mon, Jun 13, 2022 at 10:17 AM James Zern
> >>  wrote:
> >>>
> >>> On Wed, Jun 1, 2022 at 11:06 AM Vignesh Venkatasubramanian
> >>>  wrote:
> 
>  AVIF specification allows for alpha channel as an auxiliary item (in
>  case of still images) or as an auxiliary track (in case of animated
>  images).  Add support for both of these. The AVIF muxer will take
>  exactly two streams (when alpha is present) as input (first one being
>  the YUV planes and the second one being the alpha plane).
> 
>  The input has to come from two different images (one of it color and
>  the other one being alpha), or it can come from a single file
>  source with the alpha channel extracted using the "alphaextract"
>  filter.
> 
>  Example using alphaextract:
>  ffmpeg -i rgba.png -filter_complex "[0:v]alphaextract[a]" -map 0 -map 
>  "[a]" -still-picture 1 avif_with_alpha.avif
> 
>  Example using two sources (first source can be in any pixel format and
>  the second source has to be in monochrome grey pixel format):
>  ffmpeg -i color.avif -i grey.avif -map 0 -map 1 -c copy 
>  avif_with_alpha.avif
> 
>  The generated files pass the compliance checks in Compliance Warden:
>  https://github.com/gpac/ComplianceWarden
> 
>  libavif (the reference avif library) is able to decode the files
>  generated using this patch.
> 
>  They also play back properly (with transparent background) in:
>  1) Chrome
>  2) Firefox (only still AVIF, no animation support)
> 
>  Signed-off-by: Vignesh Venkatasubramanian 
>  ---
>    libavformat/movenc.c | 188 +--
>    libavformat/movenc.h |   4 +-
>    2 files changed, 130 insertions(+), 62 deletions(-)
> 
> >>>
> >>> 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".
> >>
> >> Any more comments on this? If not can this be merged please? :)
> >>
> >
> > Another ping on this please.
> >
> >> --
> >> Vignesh
>
> I thought James Zern had push access, which is why i didn't apply it as
> soon as he reviewed it. Sorry.
>
> Pushed it now.
>

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



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

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


Re: [FFmpeg-devel] [PATCH 2/2] avformat/mov: read PCM audio configuration box ('pcmC') if available

2022-06-27 Thread Marton Balint




On Sun, 19 Jun 2022, Marton Balint wrote:


From: Ivan Baykalov <4ru...@gmail.com>

For ipcm and fpcm streams, big-endian format is the default, but it can be 
changed
with additional 'pcmC' sub-atom of audio sample description.

Details can be found in ISO/IEC 23003-5:2020

Fixes ticket #9763.
Fixes ticket #9790.

Patch simplified by Marton Balint.


Applied the series.

Regards,
Marton



Signed-off-by: Marton Balint 
---
libavformat/mov.c | 22 ++
1 file changed, 22 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 0660a51492..c6fbe511c0 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1553,6 +1553,9 @@ static void set_last_stream_little_endian(AVFormatContext 
*fc)
st = fc->streams[fc->nb_streams-1];

switch (st->codecpar->codec_id) {
+case AV_CODEC_ID_PCM_S16BE:
+st->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE;
+break;
case AV_CODEC_ID_PCM_S24BE:
st->codecpar->codec_id = AV_CODEC_ID_PCM_S24LE;
break;
@@ -1579,6 +1582,24 @@ static int mov_read_enda(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
return 0;
}

+static int mov_read_pcmc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+int format_flags;
+
+if (atom.size < 6) {
+av_log(c->fc, AV_LOG_ERROR, "Empty pcmC box\n");
+return AVERROR_INVALIDDATA;
+}
+
+avio_r8(pb);// version
+avio_rb24(pb);  // flags
+format_flags = avio_r8(pb);
+if (format_flags == 1) // indicates little-endian format. If not present, 
big-endian format is used
+set_last_stream_little_endian(c->fc);
+
+return 0;
+}
+
static int mov_read_colr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
AVStream *st;
@@ -7674,6 +7695,7 @@ static const MOVParseTableEntry mov_default_parse_table[] 
= {
{ MKTAG('S','A','3','D'), mov_read_SA3D }, /* ambisonic audio box */
{ MKTAG('S','A','N','D'), mov_read_SAND }, /* non diegetic audio box */
{ MKTAG('i','l','o','c'), mov_read_iloc },
+{ MKTAG('p','c','m','C'), mov_read_pcmc }, /* PCM configuration box */
{ 0, NULL }
};

--
2.35.3

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

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


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

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


Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg: change frame counters to 64 bit

2022-06-27 Thread Marton Balint




On Mon, 20 Jun 2022, Marton Balint wrote:


Frame counters can overflow relatively easily (INT_MAX number of frames is
slightly more than 1 year for 60 fps content), so make sure we are always
using 64 bit values for them.

A live stream can easily run for more than a year and the framedup logic breaks
on an overflow.


Applied.

Regards,
Marton



Signed-off-by: Marton Balint 
---
fftools/ffmpeg.c | 38 +++---
fftools/ffmpeg.h |  6 +++---
2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 09caa3e3c4..e7384f052a 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -131,9 +131,9 @@ static BenchmarkTimeStamps get_benchmark_time_stamps(void);
static int64_t getmaxrss(void);
static int ifilter_has_all_input_formats(FilterGraph *fg);

-static int nb_frames_dup = 0;
-static unsigned dup_warning = 1000;
-static int nb_frames_drop = 0;
+static int64_t nb_frames_dup = 0;
+static uint64_t dup_warning = 1000;
+static int64_t nb_frames_drop = 0;
static int64_t decode_error_stat[2];
unsigned nb_output_dumped = 0;

@@ -839,7 +839,7 @@ static void update_video_stats(OutputStream *ost, const 
AVPacket *pkt, int write
const uint8_t *sd = av_packet_get_side_data(pkt, AV_PKT_DATA_QUALITY_STATS,
NULL);
AVCodecContext *enc = ost->enc_ctx;
-int frame_number;
+int64_t frame_number;
double ti1, bitrate, avg_bitrate;

ost->quality   = sd ? AV_RL32(sd) : -1;
@@ -866,10 +866,10 @@ static void update_video_stats(OutputStream *ost, const 
AVPacket *pkt, int write

frame_number = ost->packets_encoded;
if (vstats_version <= 1) {
-fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number,
+fprintf(vstats_file, "frame= %5"PRId64" q= %2.1f ", frame_number,
ost->quality / (float)FF_QP2LAMBDA);
} else  {
-fprintf(vstats_file, "out= %2d st= %2d frame= %5d q= %2.1f ", 
ost->file_index, ost->index, frame_number,
+fprintf(vstats_file, "out= %2d st= %2d frame= %5"PRId64" q= %2.1f ", 
ost->file_index, ost->index, frame_number,
ost->quality / (float)FF_QP2LAMBDA);
}

@@ -1082,7 +1082,7 @@ static void do_video_out(OutputFile *of,
int ret;
AVCodecContext *enc = ost->enc_ctx;
AVRational frame_rate;
-int nb_frames, nb0_frames, i;
+int64_t nb_frames, nb0_frames, i;
double delta, delta0;
double duration = 0;
double sync_ipts = AV_NOPTS_VALUE;
@@ -1152,7 +1152,7 @@ static void do_video_out(OutputFile *of,
} else if (delta < -1.1)
nb_frames = 0;
else if (delta > 1.1) {
-nb_frames = lrintf(delta);
+nb_frames = llrintf(delta);
if (delta0 > 1.1)
nb0_frames = llrintf(delta0 - 0.6);
}
@@ -1188,19 +1188,19 @@ static void do_video_out(OutputFile *of,
if (nb0_frames == 0 && ost->last_dropped) {
nb_frames_drop++;
av_log(NULL, AV_LOG_VERBOSE,
-   "*** dropping frame %d from stream %d at ts %"PRId64"\n",
+   "*** dropping frame %"PRId64" from stream %d at ts %"PRId64"\n",
   ost->frame_number, ost->st->index, ost->last_frame->pts);
}
if (nb_frames > (nb0_frames && ost->last_dropped) + (nb_frames > 
nb0_frames)) {
if (nb_frames > dts_error_threshold * 30) {
-av_log(NULL, AV_LOG_ERROR, "%d frame duplication too large, 
skipping\n", nb_frames - 1);
+av_log(NULL, AV_LOG_ERROR, "%"PRId64" frame duplication too large, 
skipping\n", nb_frames - 1);
nb_frames_drop++;
return;
}
nb_frames_dup += nb_frames - (nb0_frames && ost->last_dropped) - 
(nb_frames > nb0_frames);
-av_log(NULL, AV_LOG_VERBOSE, "*** %d dup!\n", nb_frames - 1);
+av_log(NULL, AV_LOG_VERBOSE, "*** %"PRId64" dup!\n", nb_frames - 1);
if (nb_frames_dup > dup_warning) {
-av_log(NULL, AV_LOG_WARNING, "More than %d frames duplicated\n", 
dup_warning);
+av_log(NULL, AV_LOG_WARNING, "More than %"PRIu64" frames 
duplicated\n", dup_warning);
dup_warning *= 10;
}
}
@@ -1511,7 +1511,7 @@ static void print_report(int is_last_report, int64_t 
timer_start, int64_t cur_ti
AVFormatContext *oc;
int64_t total_size;
AVCodecContext *enc;
-int frame_number, vid, i;
+int vid, i;
double bitrate;
double speed;
int64_t pts = INT64_MIN + 1;
@@ -1562,12 +1562,12 @@ static void print_report(int is_last_report, int64_t 
timer_start, int64_t cur_ti
}
if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
float fps;
+int64_t frame_number = ost->frame_number;

-frame_number = ost->frame_number;
fps = t > 1 ? frame_number / t : 0;
-av_bprintf(&buf, "frame=%5d fps=%3.*f q=%3.1f ",
+av_bprintf(&buf, "frame=%5"PRId64" fps=%3.*f q=%3.1f

Re: [FFmpeg-devel] [PATCH] avformat/movenc: Support alpha channel for AVIF

2022-06-27 Thread James Zern
On Mon, Jun 27, 2022 at 9:48 AM James Almer  wrote:
>
> On 6/27/2022 1:43 PM, Vignesh Venkatasubramanian wrote:
> > On Tue, Jun 21, 2022 at 10:12 AM Vignesh Venkatasubramanian
> >  wrote:
> >>
> >> On Mon, Jun 13, 2022 at 10:17 AM James Zern
> >>  wrote:
> >>>
> >>> On Wed, Jun 1, 2022 at 11:06 AM Vignesh Venkatasubramanian
> >>>  wrote:
> 
>  AVIF specification allows for alpha channel as an auxiliary item (in
>  case of still images) or as an auxiliary track (in case of animated
>  images).  Add support for both of these. The AVIF muxer will take
>  exactly two streams (when alpha is present) as input (first one being
>  the YUV planes and the second one being the alpha plane).
> 
>  The input has to come from two different images (one of it color and
>  the other one being alpha), or it can come from a single file
>  source with the alpha channel extracted using the "alphaextract"
>  filter.
> 
>  Example using alphaextract:
>  ffmpeg -i rgba.png -filter_complex "[0:v]alphaextract[a]" -map 0 -map 
>  "[a]" -still-picture 1 avif_with_alpha.avif
> 
>  Example using two sources (first source can be in any pixel format and
>  the second source has to be in monochrome grey pixel format):
>  ffmpeg -i color.avif -i grey.avif -map 0 -map 1 -c copy 
>  avif_with_alpha.avif
> 
>  The generated files pass the compliance checks in Compliance Warden:
>  https://github.com/gpac/ComplianceWarden
> 
>  libavif (the reference avif library) is able to decode the files
>  generated using this patch.
> 
>  They also play back properly (with transparent background) in:
>  1) Chrome
>  2) Firefox (only still AVIF, no animation support)
> 
>  Signed-off-by: Vignesh Venkatasubramanian 
>  ---
>    libavformat/movenc.c | 188 +--
>    libavformat/movenc.h |   4 +-
>    2 files changed, 130 insertions(+), 62 deletions(-)
> 
> >>>
> >>> 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".
> >>
> >> Any more comments on this? If not can this be merged please? :)
> >>
> >
> > Another ping on this please.
> >
> >> --
> >> Vignesh
>
> I thought James Zern had push access, which is why i didn't apply it as
> soon as he reviewed it. Sorry.
>
> Pushed it now.
>

Sorry for the confusion James. I held off because I'm not a maintainer
of this file, so I wanted to make sure there was another reviewer.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 1/3] Revert "avformat/demux: Count EAGAIN as 100 bytes in relation to read limit in avformat_find_stream_info()"

2022-06-27 Thread Marton Balint
Modifying avformat_find_stream_info() behaviour based on the number of EAGAINs
it encounters is a hack which usually only hides the real issue if such thing
happen.

This reverts commit b0cac7082d8a3ff2d4f039af01b45c48bb578de7.
---
 libavformat/demux.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index e121253dfd..57720f4311 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -2615,10 +2615,8 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
 /* NOTE: A new stream can be added there if no header in file
  * (AVFMTCTX_NOHEADER). */
 ret = read_frame_internal(ic, pkt1);
-if (ret == AVERROR(EAGAIN)) {
-read_size += 100;
+if (ret == AVERROR(EAGAIN))
 continue;
-}
 
 if (ret < 0) {
 /* EOF or error*/
-- 
2.35.3

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

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


[FFmpeg-devel] [PATCH 2/3] Revert "avformat/demux: Make read_frame_internal() return AVERREOR(EAGAIN) on stuck empty input parser"

2022-06-27 Thread Marton Balint
Hides the underlying real problem with a demuxer returning 0 sized packets.

This reverts commit 02699490c14e86105104940c009953081f69432c.
---
 libavformat/demux.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index 57720f4311..1620716716 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -1235,15 +1235,11 @@ static int read_frame_internal(AVFormatContext *s, 
AVPacket *pkt)
 FFFormatContext *const si = ffformatcontext(s);
 int ret, got_packet = 0;
 AVDictionary *metadata = NULL;
-int empty = 0;
 
 while (!got_packet && !si->parse_queue.head) {
 AVStream *st;
 FFStream *sti;
 
-if (empty > 1)
-return AVERROR(EAGAIN);
-
 /* read next packet */
 ret = ff_read_packet(s, pkt);
 if (ret < 0) {
@@ -1334,8 +1330,6 @@ static int read_frame_internal(AVFormatContext *s, 
AVPacket *pkt)
 }
 got_packet = 1;
 } else if (st->discard < AVDISCARD_ALL) {
-if (pkt->size == 0)
-empty ++;
 if ((ret = parse_packet(s, pkt, pkt->stream_index, 0)) < 0)
 return ret;
 st->codecpar->sample_rate = sti->avctx->sample_rate;
-- 
2.35.3

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

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


[FFmpeg-devel] [PATCH 3/3] avformat/mov: disallow a zero sample size in trun atoms

2022-06-27 Thread Marton Balint
In order to not generate 0 sized packets or create a huge index table
needlessly.

Fixes: Timeout
Fixes: 
43717/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5206008287330304
Fixes: 
45738/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6142535657979904

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index c6fbe511c0..d7ef6ba6d6 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5179,6 +5179,8 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 distance++;
 if (av_sat_add64(dts, sample_duration) != dts + 
(uint64_t)sample_duration)
 return AVERROR_INVALIDDATA;
+if (!sample_size)
+return AVERROR_INVALIDDATA;
 dts += sample_duration;
 offset += sample_size;
 sc->data_size += sample_size;
-- 
2.35.3

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

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


Re: [FFmpeg-devel] [PATCH] libavcodec/hevc_mp4toannexb_bsf: insert extradata before non-AUD unit

2022-06-27 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Andreas Rheinhardt
> Sent: Tuesday, March 22, 2022 10:30 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH] libavcodec/hevc_mp4toannexb_bsf:
> insert extradata before non-AUD unit
> 
> Xiang, Haihao:
> > From: Haihao Xiang 
> >
> > It is possible that an IRAP frame in input AVPacket contains VPS,
> SPS
> > and PPS, and these headers should take effect. However the
> prepended
> > extradata might override these headers. This patch inserts
> extradata
> > before non-AUD unit, hence VPS, SPS and PPS from the input AVPacket
> will
> > take effect if they are present.
> >
> > This should fix #7799
> >
> > Signed-off-by: Haihao Xiang 
> > ---
> >  libavcodec/hevc_mp4toannexb_bsf.c | 12 ++--
> >  1 file changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/hevc_mp4toannexb_bsf.c
> b/libavcodec/hevc_mp4toannexb_bsf.c
> > index 790dfb0394..77551ba221 100644
> > --- a/libavcodec/hevc_mp4toannexb_bsf.c
> > +++ b/libavcodec/hevc_mp4toannexb_bsf.c
> > @@ -124,6 +124,7 @@ static int hevc_mp4toannexb_filter(AVBSFContext
> *ctx, AVPacket *out)
> >
> >  int got_irap = 0;
> >  int i, ret = 0;
> > +int prev_nalu_is_aud = 0, extradata_offset = 0;
> >
> >  ret = ff_bsf_get_packet(ctx, &in);
> >  if (ret < 0)
> > @@ -169,14 +170,21 @@ static int
> hevc_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out)
> >
> >  prev_size = out->size;
> >
> > +if (prev_nalu_is_aud)
> > +extradata_offset = prev_size;
> > +
> >  ret = av_grow_packet(out, 4 + nalu_size + extra_size);
> >  if (ret < 0)
> >  goto fail;
> >
> > -if (extra_size)
> > -memcpy(out->data + prev_size, ctx->par_out->extradata,
> extra_size);
> > +if (extra_size) {
> > +memmove(out->data + extradata_offset + extra_size,
> out->data + extradata_offset, prev_size - extradata_offset);
> > +memcpy(out->data + extradata_offset, ctx->par_out-
> >extradata, extra_size);
> > +}
> > +
> >  AV_WB32(out->data + prev_size + extra_size, 1);
> >  bytestream2_get_buffer(&gb, out->data + prev_size + 4 +
> extra_size, nalu_size);
> > +prev_nalu_is_aud = nalu_type == HEVC_NAL_AUD;
> >  }
> >
> >  ret = av_packet_copy_props(out, in);
> 
> 1. prev_nalu_is_aud is unnecessary: You can just use "if (nalu_type
> ==
> HEVC_NAL_AUD) extradata_offset = out->size;" at the end of the loop.
> 2. This only mitigates a certain case of wrongly inserted extradata;
> it
> does not fix the underlying issue which is that this BSF does not
> track
> the current state of extradata and therefore inserts parameter sets
> that
> have already been superseded by new in-band extradata. Your patch
> ensures that the extradata parameter sets will be prepended to the
> in-band extradata. Yet the already deactivated parameter sets will
> still
> be inserted. The output can still be invalid, because 7.4.2.4.2 of
> the
> HEVC spec requires the following: "Any SPS NAL unit with nuh_layer_id
> equal to 0 containing the value of sps_seq_parameter_set_id for the
> active SPS
> RBSP for the base layer for a CVS shall have the same content as that
> of
> the active SPS RBSP for the base layer for the CVS, unless it follows
> the last access unit of the CVS and precedes the first VCL NAL unit
> and
> the first SEI NAL unit containing an active parameter sets SEI
> message
> (when present) of another CVS." Furthermore in case a preceding
> packet
> contained updated parameter sets that (perhaps partially) overwrite
> parameter sets from extradata and the current packet does not
> contain/repeat these parameter sets, then the above code will still
> insert the outdated and incorrect parameter set and these parameter
> sets
> will not be overwritten before being used.
> 3. Andriy Gelman once proposed a patchset that tracked the parameter
> sets and inserted only the needed ones. See
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20191016025040.3127
> 3-2-andriy.gel...@gmail.com/
> The problem with this patchset was the complexity emanating from
> HEVC's
> layers.
> 4. Lacking proper tracking of parameter sets we should probably err
> on
> the side of caution and stop inserting parameter sets if the input
> contained in-band parameter sets (similar to h264_mp4toannexb). I can
> write a patch for this.

Hi Andreas,

I had missed this conversation and just recently noticed that Haihao's
Patch fixes HEVC decoding issues with certain files that I'm seeing 
for a long time already. The cases I know are with the hevc_qsv, 
hevc_cuvid and mediacodec hevc decoders, but obviously it's about 
all usages of the bitstream filter.

You mentioned you might want to write a patch. Would you still be able
to do so? Would this be a complete fix for the problem or just about
a part of it?

Or would this patch be acceptable as a temporary workaround?

Thanks,
softworkz

Re: [FFmpeg-devel] [PATCH v4 1/1] lavc/aarch64: motion estimation functions in neon

2022-06-27 Thread Martin Storsjö

On Sun, 26 Jun 2022, Swinney, Jonathan wrote:


- ff_pix_abs16_neon
- ff_pix_abs16_xy2_neon

In direct micro benchmarks of these ff functions verses their C implementations,
these functions performed as follows on AWS Graviton 3.

ff_pix_abs16_neon:
pix_abs_0_0_c: 141.1
pix_abs_0_0_neon: 19.6

ff_pix_abs16_xy2_neon:
pix_abs_0_3_c: 269.1
pix_abs_0_3_neon: 39.3

Tested with:
./tests/checkasm/checkasm --test=motion --bench --disable-linux-perf

Signed-off-by: Jonathan Swinney 


Thanks! This looked great to me, and you seem to have applied all my 
feedback!


(There was one last case of "ldur" missing that I fixed up locally.)

With that fixed, I pushed this one now. Thanks!

// Martin

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

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


Re: [FFmpeg-devel] [PATCH 3/3] avformat/mov: disallow a zero sample size in trun atoms

2022-06-27 Thread zhilizhao(赵志立)



> On Jun 28, 2022, at 4:02 AM, Marton Balint  wrote:
> 
> In order to not generate 0 sized packets or create a huge index table
> needlessly.
> 
> Fixes: Timeout
> Fixes: 
> 43717/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5206008287330304
> Fixes: 
> 45738/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6142535657979904
> 
> Signed-off-by: Marton Balint 
> ---
> libavformat/mov.c | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index c6fbe511c0..d7ef6ba6d6 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -5179,6 +5179,8 @@ static int mov_read_trun(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
> distance++;
> if (av_sat_add64(dts, sample_duration) != dts + 
> (uint64_t)sample_duration)
> return AVERROR_INVALIDDATA;
> +if (!sample_size)
> +return AVERROR_INVALIDDATA;
> dts += sample_duration;
> offset += sample_size;
> sc->data_size += sample_size;

LGTM.

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

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

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


Re: [FFmpeg-devel] [PATCH v4 6/6] avcodec/qsvdec: Implement SEI parsing for QSV decoders

2022-06-27 Thread Andreas Rheinhardt
softworkz:
> From: softworkz 
> 
> Signed-off-by: softworkz 
> ---
>  libavcodec/qsvdec.c | 234 
>  1 file changed, 234 insertions(+)
> 
> diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
> index 5fc5bed4c8..e854f363ec 100644
> --- a/libavcodec/qsvdec.c
> +++ b/libavcodec/qsvdec.c
> @@ -49,6 +49,12 @@
>  #include "hwconfig.h"
>  #include "qsv.h"
>  #include "qsv_internal.h"
> +#include "h264dec.h"
> +#include "h264_sei.h"
> +#include "hevcdec.h"
> +#include "hevc_ps.h"
> +#include "hevc_sei.h"
> +#include "mpeg12.h"
>  
>  static const AVRational mfx_tb = { 1, 9 };
>  
> @@ -60,6 +66,8 @@ static const AVRational mfx_tb = { 1, 9 };
>  AV_NOPTS_VALUE : pts_tb.num ? \
>  av_rescale_q(mfx_pts, mfx_tb, pts_tb) : mfx_pts)
>  
> +#define PAYLOAD_BUFFER_SIZE 65535
> +
>  typedef struct QSVAsyncFrame {
>  mfxSyncPoint *sync;
>  QSVFrame *frame;
> @@ -101,6 +109,9 @@ typedef struct QSVContext {
>  
>  mfxExtBuffer **ext_buffers;
>  int nb_ext_buffers;
> +
> +mfxU8 payload_buffer[PAYLOAD_BUFFER_SIZE];
> +Mpeg1Context mpeg_ctx;
>  } QSVContext;
>  
>  static const AVCodecHWConfigInternal *const qsv_hw_configs[] = {
> @@ -599,6 +610,210 @@ static int qsv_export_film_grain(AVCodecContext *avctx, 
> mfxExtAV1FilmGrainParam
>  return 0;
>  }
>  #endif
> +static int find_start_offset(mfxU8 data[4])
> +{
> +if (data[0] == 0 && data[1] == 0 && data[2] == 1)
> +return 3;
> +
> +if (data[0] == 0 && data[1] == 0 && data[2] == 0 && data[3] == 1)
> +return 4;
> +
> +return 0;
> +}
> +
> +static int parse_sei_h264(AVCodecContext* avctx, QSVContext* q, AVFrame* out)
> +{
> +H264SEIContext sei = { 0 };
> +GetBitContext gb = { 0 };
> +mfxPayload payload = { 0, .Data = &q->payload_buffer[0], .BufSize = 
> sizeof(q->payload_buffer) };
> +mfxU64 ts;
> +int ret;
> +
> +while (1) {
> +int start;
> +memset(payload.Data, 0, payload.BufSize);
> +
> +ret = MFXVideoDECODE_GetPayload(q->session, &ts, &payload);
> +if (ret == MFX_ERR_NOT_ENOUGH_BUFFER) {
> +av_log(avctx, AV_LOG_WARNING, "Warning: Insufficient buffer on 
> GetPayload(). Size: %"PRIu64" Needed: %d\n", sizeof(q->payload_buffer), 
> payload.BufSize);
> +return 0;
> +}
> +if (ret != MFX_ERR_NONE)
> +return ret;
> +
> +if (payload.NumBit == 0 || payload.NumBit >= payload.BufSize * 8)
> +break;
> +
> +start = find_start_offset(payload.Data);
> +
> +switch (payload.Type) {
> +case SEI_TYPE_BUFFERING_PERIOD:
> +case SEI_TYPE_PIC_TIMING:
> +continue;
> +}
> +
> +if (init_get_bits(&gb, &payload.Data[start], payload.NumBit - start 
> * 8) < 0)
> +av_log(avctx, AV_LOG_ERROR, "Error initializing bitstream reader 
> SEI type: %d  Numbits %d error: %d\n", payload.Type, payload.NumBit, ret);
> +else {
> +ret = ff_h264_sei_decode(&sei, &gb, NULL, avctx);
> +
> +if (ret < 0)
> +av_log(avctx, AV_LOG_WARNING, "Failed to parse SEI type: %d  
> Numbits %d error: %d\n", payload.Type, payload.NumBit, ret);
> +else
> +av_log(avctx, AV_LOG_DEBUG, "mfxPayload Type: %d  Numbits 
> %d\n", payload.Type, payload.NumBit);
> +}
> +}
> +
> +if (out)
> +return ff_h264_export_frame_props(avctx, &sei, NULL, out);
> +
> +return 0;
> +}
> +
> +static int parse_sei_hevc(AVCodecContext* avctx, QSVContext* q, QSVFrame* 
> out)
> +{
> +HEVCSEI sei = { 0 };
> +HEVCParamSets ps = { 0 };
> +GetBitContext gb = { 0 };
> +mfxPayload payload = { 0, .Data = &q->payload_buffer[0], .BufSize = 
> sizeof(q->payload_buffer) };
> +mfxFrameSurface1 *surface = &out->surface;
> +mfxU64 ts;
> +int ret, has_logged = 0;
> +
> +while (1) {
> +int start;
> +memset(payload.Data, 0, payload.BufSize);
> +
> +ret = MFXVideoDECODE_GetPayload(q->session, &ts, &payload);
> +if (ret == MFX_ERR_NOT_ENOUGH_BUFFER) {
> +av_log(avctx, AV_LOG_WARNING, "Warning: Insufficient buffer on 
> GetPayload(). Size: %"PRIu64" Needed: %d\n", sizeof(q->payload_buffer), 
> payload.BufSize);
> +return 0;
> +}
> +if (ret != MFX_ERR_NONE)
> +return ret;
> +
> +if (payload.NumBit == 0 || payload.NumBit >= payload.BufSize * 8)
> +break;
> +
> +if (!has_logged) {
> +has_logged = 1;
> +av_log(avctx, AV_LOG_VERBOSE, 
> "-\n");
> +av_log(avctx, AV_LOG_VERBOSE, "Start reading SEI - payload 
> timestamp: %llu - surface timestamp: %llu\n", ts, surface->Data.TimeStamp);
> +}
> +
> +if (ts != surface->Data.TimeStamp) {
> +av_log(avctx, AV_LOG_WARNING, "GetPayload timestamp (%llu) does 
> not match 

[FFmpeg-devel] [PATCH] avutil/wchar_filename: Make the header C++ compatible

2022-06-27 Thread Andreas Rheinhardt
When compiling decklink, this header is included from
a C++ file (albeit inside 'extern "C"') and this
causes compilation failures because of an implicit
void* -> char* conversion. So add an explicit cast.
Should fix ticket #9819.

Signed-off-by: Andreas Rheinhardt 
---
If we didn't include os_support.h in lots of places via lavf/internal.h,
this issue wouldn't exist.

 libavutil/wchar_filename.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/wchar_filename.h b/libavutil/wchar_filename.h
index 08de073ed7..9a04a069f1 100644
--- a/libavutil/wchar_filename.h
+++ b/libavutil/wchar_filename.h
@@ -54,7 +54,7 @@ static inline int wchartocp(unsigned int code_page, const 
wchar_t *filename_w,
 *filename = NULL;
 return 0;
 }
-*filename = av_malloc_array(num_chars, sizeof *filename);
+*filename = (char*)av_malloc_array(num_chars, sizeof *filename);
 if (!*filename) {
 errno = ENOMEM;
 return -1;
-- 
2.34.1

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

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


Re: [FFmpeg-devel] [PATCH v2 1/2] avformat: add AVFormatContext.first_pkt_wallclock

2022-06-27 Thread Anton Khirnov
Quoting Gyan Doshi (2022-06-25 10:29:50)
> Stores wallclock time for the first packet received.
> Used for crude sync offset among inputs.
> ---
>  doc/APIchanges |  3 +++
>  libavformat/avformat.h | 10 ++
>  libavformat/demux.c|  3 +++
>  libavformat/options.c  |  1 +
>  libavformat/version.h  |  2 +-
>  5 files changed, 18 insertions(+), 1 deletion(-)

Why should this be in the library? Seems to me this can be just as
easily done by the callers who need it.

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

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


Re: [FFmpeg-devel] [PATCH 1/3] Revert "avformat/demux: Count EAGAIN as 100 bytes in relation to read limit in avformat_find_stream_info()"

2022-06-27 Thread Anton Khirnov
Quoting Marton Balint (2022-06-27 22:02:39)
> Modifying avformat_find_stream_info() behaviour based on the number of EAGAINs
> it encounters is a hack which usually only hides the real issue if such thing
> happen.
> 
> This reverts commit b0cac7082d8a3ff2d4f039af01b45c48bb578de7.
> ---
>  libavformat/demux.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

very much ok

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

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


Re: [FFmpeg-devel] [PATCH] avformat/aaxdec: Check for empty segments

2022-06-27 Thread Anton Khirnov
Quoting Michael Niedermayer (2022-06-27 10:43:47)
> Fixes: Timeout
> Fixes: 
> 48154/clusterfuzz-testcase-minimized-ffmpeg_dem_AAX_fuzzer-5149094353436672
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/aaxdec.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavformat/aaxdec.c b/libavformat/aaxdec.c
> index dd1fbde736..bcbff216db 100644
> --- a/libavformat/aaxdec.c
> +++ b/libavformat/aaxdec.c
> @@ -252,6 +252,8 @@ static int aax_read_header(AVFormatContext *s)
>  size  = avio_rb32(pb);
>  a->segments[r].start = start + a->data_offset;
>  a->segments[r].end   = a->segments[r].start + size;
> +if (!size)
> +return AVERROR_INVALIDDATA;

Why check for invalid size only after some things are set based on it
and not before?

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

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


Re: [FFmpeg-devel] [PATCH v4 6/6] avcodec/qsvdec: Implement SEI parsing for QSV decoders

2022-06-27 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Andreas Rheinhardt
> Sent: Tuesday, June 28, 2022 6:17 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v4 6/6] avcodec/qsvdec: Implement
> SEI parsing for QSV decoders
> 
> softworkz:
> > From: softworkz 
> >
> > Signed-off-by: softworkz 
> > ---
> >  libavcodec/qsvdec.c | 234
> 
> >  1 file changed, 234 insertions(+)
> >
> > diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
> > index 5fc5bed4c8..e854f363ec 100644
> > --- a/libavcodec/qsvdec.c
> > +++ b/libavcodec/qsvdec.c
> > @@ -49,6 +49,12 @@
> >  #include "hwconfig.h"
> >  #include "qsv.h"
> >  #include "qsv_internal.h"
> > +#include "h264dec.h"
> > +#include "h264_sei.h"
> > +#include "hevcdec.h"
> > +#include "hevc_ps.h"
> > +#include "hevc_sei.h"
> > +#include "mpeg12.h"
> >
> >  static const AVRational mfx_tb = { 1, 9 };
> >
> > @@ -60,6 +66,8 @@ static const AVRational mfx_tb = { 1, 9 };
> >  AV_NOPTS_VALUE : pts_tb.num ? \
> >  av_rescale_q(mfx_pts, mfx_tb, pts_tb) : mfx_pts)
> >
> > +#define PAYLOAD_BUFFER_SIZE 65535
> > +
> >  typedef struct QSVAsyncFrame {
> >  mfxSyncPoint *sync;
> >  QSVFrame *frame;
> > @@ -101,6 +109,9 @@ typedef struct QSVContext {
> >
> >  mfxExtBuffer **ext_buffers;
> >  int nb_ext_buffers;
> > +
> > +mfxU8 payload_buffer[PAYLOAD_BUFFER_SIZE];
> > +Mpeg1Context mpeg_ctx;
> >  } QSVContext;
> >
> >  static const AVCodecHWConfigInternal *const qsv_hw_configs[] = {
> > @@ -599,6 +610,210 @@ static int
> qsv_export_film_grain(AVCodecContext *avctx, mfxExtAV1FilmGrainParam
> >  return 0;
> >  }
> >  #endif
> > +static int find_start_offset(mfxU8 data[4])
> > +{
> > +if (data[0] == 0 && data[1] == 0 && data[2] == 1)
> > +return 3;
> > +
> > +if (data[0] == 0 && data[1] == 0 && data[2] == 0 && data[3] ==
> 1)
> > +return 4;
> > +
> > +return 0;
> > +}
> > +
> > +static int parse_sei_h264(AVCodecContext* avctx, QSVContext* q,
> AVFrame* out)
> > +{
> > +H264SEIContext sei = { 0 };
> > +GetBitContext gb = { 0 };
> > +mfxPayload payload = { 0, .Data = &q->payload_buffer[0],
> .BufSize = sizeof(q->payload_buffer) };
> > +mfxU64 ts;
> > +int ret;
> > +
> > +while (1) {
> > +int start;
> > +memset(payload.Data, 0, payload.BufSize);
> > +
> > +ret = MFXVideoDECODE_GetPayload(q->session, &ts,
> &payload);
> > +if (ret == MFX_ERR_NOT_ENOUGH_BUFFER) {
> > +av_log(avctx, AV_LOG_WARNING, "Warning: Insufficient
> buffer on GetPayload(). Size: %"PRIu64" Needed: %d\n", sizeof(q-
> >payload_buffer), payload.BufSize);
> > +return 0;
> > +}
> > +if (ret != MFX_ERR_NONE)
> > +return ret;
> > +
> > +if (payload.NumBit == 0 || payload.NumBit >=
> payload.BufSize * 8)
> > +break;
> > +
> > +start = find_start_offset(payload.Data);
> > +
> > +switch (payload.Type) {
> > +case SEI_TYPE_BUFFERING_PERIOD:
> > +case SEI_TYPE_PIC_TIMING:
> > +continue;
> > +}
> > +
> > +if (init_get_bits(&gb, &payload.Data[start],
> payload.NumBit - start * 8) < 0)
> > +av_log(avctx, AV_LOG_ERROR, "Error initializing
> bitstream reader SEI type: %d  Numbits %d error: %d\n", payload.Type,
> payload.NumBit, ret);
> > +else {
> > +ret = ff_h264_sei_decode(&sei, &gb, NULL, avctx);
> > +
> > +if (ret < 0)
> > +av_log(avctx, AV_LOG_WARNING, "Failed to parse SEI
> type: %d  Numbits %d error: %d\n", payload.Type, payload.NumBit,
> ret);
> > +else
> > +av_log(avctx, AV_LOG_DEBUG, "mfxPayload Type: %d
> Numbits %d\n", payload.Type, payload.NumBit);
> > +}
> > +}
> > +
> > +if (out)
> > +return ff_h264_export_frame_props(avctx, &sei, NULL, out);
> > +
> > +return 0;
> > +}
> > +
> > +static int parse_sei_hevc(AVCodecContext* avctx, QSVContext* q,
> QSVFrame* out)
> > +{
> > +HEVCSEI sei = { 0 };
> > +HEVCParamSets ps = { 0 };
> > +GetBitContext gb = { 0 };
> > +mfxPayload payload = { 0, .Data = &q->payload_buffer[0],
> .BufSize = sizeof(q->payload_buffer) };
> > +mfxFrameSurface1 *surface = &out->surface;
> > +mfxU64 ts;
> > +int ret, has_logged = 0;
> > +
> > +while (1) {
> > +int start;
> > +memset(payload.Data, 0, payload.BufSize);
> > +
> > +ret = MFXVideoDECODE_GetPayload(q->session, &ts,
> &payload);
> > +if (ret == MFX_ERR_NOT_ENOUGH_BUFFER) {
> > +av_log(avctx, AV_LOG_WARNING, "Warning: Insufficient
> buffer on GetPayload(). Size: %"PRIu64" Needed: %d\n", sizeof(q-
> >payload_buffer), payload.BufSize);
> > +return 0;
> > +}
> > +if (ret != MFX_ERR_NONE)
> > +return ret;
> > +
> > +if (payload.NumBit == 0 || payload.NumBit 

Re: [FFmpeg-devel] [PATCH v2 1/2] avformat: add AVFormatContext.first_pkt_wallclock

2022-06-27 Thread Gyan Doshi



On 2022-06-28 10:43 am, Anton Khirnov wrote:

Quoting Gyan Doshi (2022-06-25 10:29:50)

Stores wallclock time for the first packet received.
Used for crude sync offset among inputs.
---
  doc/APIchanges |  3 +++
  libavformat/avformat.h | 10 ++
  libavformat/demux.c|  3 +++
  libavformat/options.c  |  1 +
  libavformat/version.h  |  2 +-
  5 files changed, 18 insertions(+), 1 deletion(-)

Why should this be in the library? Seems to me this can be just as
easily done by the callers who need it.


To not add some extra latency,  just like how 
`use_wallclock_as_timestamps` was implemented inside lavf.


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