Re: [FFmpeg-devel] [PATCH] lavfi/atempo: raise max tempo limit

2018-06-05 Thread Pavel Koshevoy
On Tue, Jun 5, 2018 at 8:59 PM, Pavel Koshevoy  wrote:
> ---
>  libavfilter/af_atempo.c | 5 +
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c
> index 8b214bccd7..daf4693321 100644
> --- a/libavfilter/af_atempo.c
> +++ b/libavfilter/af_atempo.c
> @@ -153,7 +153,7 @@ typedef struct ATempoContext {
>
>  static const AVOption atempo_options[] = {
>  { "tempo", "set tempo scale factor",
> -  OFFSET(tempo), AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 }, 0.5, 2.0,
> +  OFFSET(tempo), AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 }, 0.5, 100.0,
>AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM },
>  { NULL }
>  };
> @@ -439,9 +439,6 @@ static int yae_load_data(ATempoContext *atempo,
>  return 0;
>  }
>
> -// samples are not expected to be skipped:
> -av_assert0(read_size <= atempo->ring);
> -
>  while (atempo->position[0] < stop_here && src < src_end) {
>  int src_samples = (src_end - src) / atempo->stride;
>
> --
> 2.16.3
>


I've tested with atempo=3, 4, 5, 6, 7, 30, 100...  It sounds reasonable.
I've compared atempo=3 vs 'atempo=sqrt(3.0),atempo=sqrt(3.0)' and did
not hear any difference.

I've removed the assertion because at tempo >= 7 the assertion fails,
but I'm not concerned about it -- some samples will simply be dropped
rather than being blended in.  At that high tempo I don't think
including all samples in output is a foremost consideration.  If
someone is concerned about samples being dropped from output stream
they can still fall back to the technique of daisy-chaining several
atempo instances at lower tempo setting.

If the patch looks good to someone with commit rights -- please apply.

Thank you,
  Pavel.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Atempo limits

2018-06-05 Thread Pavel Koshevoy
On Mon, Jun 4, 2018 at 8:54 PM, Pavel Koshevoy  wrote:
> On 06/04/2018 08:35 PM, Ronak Patel wrote:
>>
>> Thanks. Is it okay if I push a patch for this? How high of a limit does
>> the algorithm support today?
>>
>
> I don't think there is an upper limit...  Post a patch here for review.  See
> http://www.ffmpeg.org/developer.html#Submitting-patches-1
>
> Pavel.
>


I've posted a patch myself --
http://ffmpeg.org/pipermail/ffmpeg-devel/2018-June/231004.html
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavfi/atempo: raise max tempo limit

2018-06-05 Thread Pavel Koshevoy
---
 libavfilter/af_atempo.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c
index 8b214bccd7..daf4693321 100644
--- a/libavfilter/af_atempo.c
+++ b/libavfilter/af_atempo.c
@@ -153,7 +153,7 @@ typedef struct ATempoContext {
 
 static const AVOption atempo_options[] = {
 { "tempo", "set tempo scale factor",
-  OFFSET(tempo), AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 }, 0.5, 2.0,
+  OFFSET(tempo), AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 }, 0.5, 100.0,
   AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM },
 { NULL }
 };
@@ -439,9 +439,6 @@ static int yae_load_data(ATempoContext *atempo,
 return 0;
 }
 
-// samples are not expected to be skipped:
-av_assert0(read_size <= atempo->ring);
-
 while (atempo->position[0] < stop_here && src < src_end) {
 int src_samples = (src_end - src) / atempo->stride;
 
-- 
2.16.3

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


Re: [FFmpeg-devel] [PATCH 2/2] fate: add Dolby E test

2018-06-05 Thread James Almer
On 7/31/2017 5:33 PM, foo86 wrote:
> ---
> 
> Samples are here: https://0x0.st/ket.xz

This was kind of forgotten, so i uploaded the samples and pushed it.
Only patch 1/2 remains now. Not sure if you were going to send an
updated version or not.

Thanks.

> 
>  tests/fate/audio.mak | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tests/fate/audio.mak b/tests/fate/audio.mak
> index 40c4ca7b75..4fab472f90 100644
> --- a/tests/fate/audio.mak
> +++ b/tests/fate/audio.mak
> @@ -19,6 +19,11 @@ fate-bmv-audio: CMD = framecrc -i 
> $(TARGET_SAMPLES)/bmv/SURFING-partial.BMV -vn
>  FATE_SAMPLES_AUDIO-$(call DEMDEC, DSICIN, DSICINAUDIO) += 
> fate-delphine-cin-audio
>  fate-delphine-cin-audio: CMD = framecrc -i 
> $(TARGET_SAMPLES)/delphine-cin/LOGO-partial.CIN -vn
>  
> +FATE_SAMPLES_AUDIO-$(call DEMDEC, S337M, DOLBY_E) += fate-dolby-e
> +fate-dolby-e: CMD = pcm -i $(TARGET_SAMPLES)/dolby_e/16-11
> +fate-dolby-e: CMP = oneoff
> +fate-dolby-e: REF = $(SAMPLES)/dolby_e/16-11.pcm
> +
>  FATE_SAMPLES_AUDIO-$(call DEMDEC, DSS, DSS_SP) += fate-dss-lp fate-dss-sp
>  fate-dss-lp: CMD = framecrc -i $(TARGET_SAMPLES)/dss/lp.dss -frames 30
>  fate-dss-sp: CMD = framecrc -i $(TARGET_SAMPLES)/dss/sp.dss -frames 30
> 

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


Re: [FFmpeg-devel] [PATCH] lavf/mov.c: Set st->start_time for video streams explicitly.

2018-06-05 Thread Michael Niedermayer
On Thu, May 31, 2018 at 04:26:24PM -0700, Sasi Inguva wrote:
> Pls find attached, the correctly signed patch
> Thanks.
> 
> On Thu, May 31, 2018 at 4:14 PM Sasi Inguva  wrote:
> 
> > Sorry. Forgot to attach the file. Pls find it attached. Also resending the
> > patch signed with correct email address
> >
> > On Thu, May 31, 2018 at 2:14 PM Michael Niedermayer 
> > wrote:
> >
> >> On Tue, May 29, 2018 at 03:39:40PM -0700, Sasi Inguva wrote:
> >> > If start_time is not set, ffmpeg takes the duration from the global
> >> > movie instead of the per stream duration.
> >> > Signed-off-by: Sasi Inguva  >> >
> >> > ---
> >> >  libavformat/mov.c| 20 +---
> >> >  tests/fate/mov.mak   |  4 +++
> >> >  tests/ref/fate/mov-neg-firstpts-discard  |  2 +-
> >> >  tests/ref/fate/mov-stream-shorter-than-movie | 33 
> >> >  4 files changed, 54 insertions(+), 5 deletions(-)
> >> >  create mode 100644 tests/ref/fate/mov-stream-shorter-than-movie
> >>
> >> i may have missed a link to a sample file
> >>
> >> fate-suite//mov/mov_stream_shorter_than_movie.mov: No such file or
> >> directory
> >> make: *** [fate-mov-stream-shorter-than-movie] Error 1
> >>
> >>
> >>
> >>
> >> [...]
> >> --
> >> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >>
> >> It is dangerous to be right in matters on which the established
> >> authorities
> >> are wrong. -- Voltaire
> >> ___
> >> ffmpeg-devel mailing list
> >> ffmpeg-devel@ffmpeg.org
> >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >>
> >

>  libavformat/mov.c|   20 +---
>  tests/fate/mov.mak   |4 +++
>  tests/ref/fate/mov-neg-firstpts-discard  |2 -
>  tests/ref/fate/mov-stream-shorter-than-movie |   33 
> +++
>  4 files changed, 54 insertions(+), 5 deletions(-)
> 5d8c7d670192a5f785f22bc79e8bf02be950c9f4  
> 0001-lavf-mov.c-Set-st-start_time-for-video-streams-expli.patch
> From ba2feb04ef1ca94f7e1972e23c84c2acde93bf68 Mon Sep 17 00:00:00 2001
> From: Sasi Inguva 
> Date: Tue, 29 May 2018 15:36:07 -0700
> Subject: [PATCH] lavf/mov.c: Set st->start_time for video streams explicitly.
> 
> If start_time is not set, ffmpeg takes the duration from the global
> movie instead of the per stream duration.
> Signed-off-by: Sasi Inguva 
> ---
>  libavformat/mov.c| 20 +---
>  tests/fate/mov.mak   |  4 +++
>  tests/ref/fate/mov-neg-firstpts-discard  |  2 +-
>  tests/ref/fate/mov-stream-shorter-than-movie | 33 
>  4 files changed, 54 insertions(+), 5 deletions(-)
>  create mode 100644 tests/ref/fate/mov-stream-shorter-than-movie

will apply

thanks


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH] Use the same name for stereo3d frame/packet side data

2018-06-05 Thread Michael Niedermayer
On Mon, Jun 04, 2018 at 04:40:30PM -0400, Vittorio Giovara wrote:
> ---
>  libavutil/frame.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

making them match should be ok.
Ive no comment on which text to choose

thx

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

Elect your leaders based on what they did after the last election, not
based on what they say before an election.



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


[FFmpeg-devel] [PATCH] libavfilter/boxblur_opencl filter.

2018-06-05 Thread Danil Iashchenko
Behaves like existing boxblur filter. 

---

Thanks! Fixed.

 libavfilter/Makefile|   2 +
 libavfilter/allfilters.c|   1 +
 libavfilter/vf_avgblur_opencl.c | 419 ++--
 3 files changed, 324 insertions(+), 98 deletions(-)

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index c68ef05..6f00059 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -153,6 +153,8 @@ OBJS-$(CONFIG_BLACKDETECT_FILTER)+= 
vf_blackdetect.o
 OBJS-$(CONFIG_BLACKFRAME_FILTER) += vf_blackframe.o
 OBJS-$(CONFIG_BLEND_FILTER)  += vf_blend.o framesync.o
 OBJS-$(CONFIG_BOXBLUR_FILTER)+= vf_boxblur.o
+OBJS-$(CONFIG_BOXBLUR_OPENCL_FILTER) += vf_avgblur_opencl.o opencl.o \
+   opencl/avgblur.o
 OBJS-$(CONFIG_BWDIF_FILTER)  += vf_bwdif.o
 OBJS-$(CONFIG_CHROMAKEY_FILTER)  += vf_chromakey.o
 OBJS-$(CONFIG_CIESCOPE_FILTER)   += vf_ciescope.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index b44093d..97d92a0 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -146,6 +146,7 @@ extern AVFilter ff_vf_blackdetect;
 extern AVFilter ff_vf_blackframe;
 extern AVFilter ff_vf_blend;
 extern AVFilter ff_vf_boxblur;
+extern AVFilter ff_vf_boxblur_opencl;
 extern AVFilter ff_vf_bwdif;
 extern AVFilter ff_vf_chromakey;
 extern AVFilter ff_vf_ciescope;
diff --git a/libavfilter/vf_avgblur_opencl.c b/libavfilter/vf_avgblur_opencl.c
index 48cebb5..d4759de 100644
--- a/libavfilter/vf_avgblur_opencl.c
+++ b/libavfilter/vf_avgblur_opencl.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2018 Dylan Fernando
+ * Copyright (c) 2018 Danil Iashchenko
  *
  * This file is part of FFmpeg.
  *
@@ -23,6 +24,7 @@
 #include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
+#include "libavutil/eval.h"
 
 #include "avfilter.h"
 #include "internal.h"
@@ -31,6 +33,35 @@
 #include "video.h"
 
 
+static const char *const var_names[] = {
+"w",
+"h",
+"cw",
+"ch",
+"hsub",
+"vsub",
+NULL
+};
+
+
+enum var_name {
+VAR_W,
+VAR_H,
+VAR_CW,
+VAR_CH,
+VAR_HSUB,
+VAR_VSUB,
+VARS_NB
+};
+
+
+typedef struct FilterParam {
+int   radius;
+int   power;
+char *radius_expr;
+} FilterParam;
+
+
 typedef struct AverageBlurOpenCLContext {
 OpenCLFilterContext ocf;
 
@@ -39,13 +70,26 @@ typedef struct AverageBlurOpenCLContext {
 cl_kernelkernel_vert;
 cl_command_queue command_queue;
 
-int radius;
+int radiusH;
 int radiusV;
 int planes;
 
+FilterParam luma_param;
+FilterParam chroma_param;
+FilterParam alpha_param;
+int hsub, vsub;
+int radius[4];
+int power[4];
+
 } AverageBlurOpenCLContext;
 
 
+#define Y 0
+#define U 1
+#define V 2
+#define A 3
+
+
 static int avgblur_opencl_init(AVFilterContext *avctx)
 {
 AverageBlurOpenCLContext *ctx = avctx->priv;
@@ -80,10 +124,6 @@ static int avgblur_opencl_init(AVFilterContext *avctx)
 goto fail;
 }
 
-if (ctx->radiusV <= 0) {
-ctx->radiusV = ctx->radius;
-}
-
 ctx->initialised = 1;
 return 0;
 
@@ -97,6 +137,122 @@ fail:
 return err;
 }
 
+
+static int avgblur_opencl_make_filter_params(AVFilterLink *inlink)
+{
+AVFilterContext*ctx = inlink->dst;
+AverageBlurOpenCLContext *s = ctx->priv;
+int i;
+
+if (s->radiusV <= 0) {
+s->radiusV = s->radiusH;
+}
+
+for (i = 0; i < 4; i++) {
+s->power[i] = 1;
+}
+return 0;
+}
+
+
+static int boxblur_opencl_make_filter_params(AVFilterLink *inlink)
+{
+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
+AVFilterContext*ctx = inlink->dst;
+AverageBlurOpenCLContext *s = ctx->priv;
+int w = inlink->w, h = inlink->h;
+int cw, ch;
+double var_values[VARS_NB], res;
+char *expr;
+int ret, i;
+
+if (!s->luma_param.radius_expr) {
+av_log(s, AV_LOG_ERROR, "Luma radius expression is not set.\n");
+return AVERROR(EINVAL);
+}
+
+/* fill missing params */
+if (!s->chroma_param.radius_expr) {
+s->chroma_param.radius_expr = av_strdup(s->luma_param.radius_expr);
+if (!s->chroma_param.radius_expr)
+return AVERROR(ENOMEM);
+}
+if (s->chroma_param.power < 0)
+s->chroma_param.power = s->luma_param.power;
+
+if (!s->alpha_param.radius_expr) {
+s->alpha_param.radius_expr = av_strdup(s->luma_param.radius_expr);
+if (!s->alpha_param.radius_expr)
+return AVERROR(ENOMEM);
+}
+if (s->alpha_param.power < 0)
+s->alpha_param.power = s->luma_param.power;
+
+s->hsub = desc->log2_chroma_w;
+s->vsub = desc->log2_chroma_h;
+
+var_values[VAR_W]   = inlink->w;
+var_values[VAR_H]   = inlink->h;
+var_values[VAR_CW] = cw = w>>s->hsub;
+var_values[VAR_CH] = ch 

Re: [FFmpeg-devel] [GSOC] [PATCH] TensorFlow backend introduction for DNN module

2018-06-05 Thread Sergey Lavrushkin
2018-06-05 17:20 GMT+03:00 James Almer :

> On 6/3/2018 3:02 PM, Sergey Lavrushkin wrote:
> > diff --git a/libavfilter/vf_srcnn.c b/libavfilter/vf_srcnn.c
> > index d6efe9b478..5c5e26b33a 100644
> > --- a/libavfilter/vf_srcnn.c
> > +++ b/libavfilter/vf_srcnn.c
> > @@ -41,7 +41,6 @@ typedef struct SRCNNContext {
> >  DNNData input_output;
> >  } SRCNNContext;
> >
> > -
> >  #define OFFSET(x) offsetof(SRCNNContext, x)
> >  #define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
> >  static const AVOption srcnn_options[] = {
> > @@ -55,10 +54,19 @@ static av_cold int init(AVFilterContext* context)
> >  {
> >  SRCNNContext* srcnn_context = context->priv;
> >
> > -srcnn_context->dnn_module = ff_get_dnn_module(DNN_NATIVE);
> > +srcnn_context->dnn_module = ff_get_dnn_module(DNN_TF);
>
> This should be a filter AVOption, not hardcoded to one or another. What
> if i, for whatever reason, want to use the native backend when i have
> libtensorflow enabled?
>
> >  if (!srcnn_context->dnn_module){
> > -av_log(context, AV_LOG_ERROR, "could not create dnn module\n");
> > -return AVERROR(ENOMEM);
> > +srcnn_context->dnn_module = ff_get_dnn_module(DNN_NATIVE);
> > +if (!srcnn_context->dnn_module){
> > +av_log(context, AV_LOG_ERROR, "could not create dnn
> module\n");
> > +return AVERROR(ENOMEM);
> > +}
> > +else{
> > +av_log(context, AV_LOG_INFO, "using native backend for DNN
> inference\n");
>
> VERBOSE, not INFO
>
> > +}
> > +}
> > +else{
> > +av_log(context, AV_LOG_INFO, "using tensorflow backend for DNN
> inference\n");
>
> Ditto.
>
> >  }
> >  if (!srcnn_context->model_filename){
> >  av_log(context, AV_LOG_INFO, "model file for network was not
> specified, using default network for x2 upsampling\n");


Here is the patch, that fixes described issues.
From 971e15b4b1e3f2747aa07d0221f99226cba622ac Mon Sep 17 00:00:00 2001
From: Sergey Lavrushkin 
Date: Wed, 6 Jun 2018 01:44:40 +0300
Subject: [PATCH] libavfilter/vf_srcnn.c: adds DNN module backend AVOption,
 changes AV_LOG_INFO message to AV_LOG_VERBOSE.

---
 libavfilter/vf_srcnn.c | 23 +--
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/libavfilter/vf_srcnn.c b/libavfilter/vf_srcnn.c
index 5c5e26b33a..17e380503e 100644
--- a/libavfilter/vf_srcnn.c
+++ b/libavfilter/vf_srcnn.c
@@ -36,6 +36,7 @@ typedef struct SRCNNContext {
 
 char* model_filename;
 float* input_output_buf;
+DNNBackendType backend_type;
 DNNModule* dnn_module;
 DNNModel* model;
 DNNData input_output;
@@ -44,6 +45,9 @@ typedef struct SRCNNContext {
 #define OFFSET(x) offsetof(SRCNNContext, x)
 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
 static const AVOption srcnn_options[] = {
+{ "dnn_backend", "DNN backend used for model execution", OFFSET(backend_type), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, 0, 1, FLAGS, "backend" },
+{ "native", "native backend flag", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, FLAGS, "backend" },
+{ "tensorflow", "tensorflow backend flag", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, "backend" },
 { "model_filename", "path to model file specifying network architecture and its parameters", OFFSET(model_filename), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
 { NULL }
 };
@@ -54,29 +58,20 @@ static av_cold int init(AVFilterContext* context)
 {
 SRCNNContext* srcnn_context = context->priv;
 
-srcnn_context->dnn_module = ff_get_dnn_module(DNN_TF);
+srcnn_context->dnn_module = ff_get_dnn_module(srcnn_context->backend_type);
 if (!srcnn_context->dnn_module){
-srcnn_context->dnn_module = ff_get_dnn_module(DNN_NATIVE);
-if (!srcnn_context->dnn_module){
-av_log(context, AV_LOG_ERROR, "could not create dnn module\n");
-return AVERROR(ENOMEM);
-}
-else{
-av_log(context, AV_LOG_INFO, "using native backend for DNN inference\n");
-}
-}
-else{
-av_log(context, AV_LOG_INFO, "using tensorflow backend for DNN inference\n");
+av_log(context, AV_LOG_ERROR, "could not create DNN module for requested backend\n");
+return AVERROR(ENOMEM);
 }
 if (!srcnn_context->model_filename){
-av_log(context, AV_LOG_INFO, "model file for network was not specified, using default network for x2 upsampling\n");
+av_log(context, AV_LOG_VERBOSE, "model file for network was not specified, using default network for x2 upsampling\n");
 srcnn_context->model = (srcnn_context->dnn_module->load_default_model)(DNN_SRCNN);
 }
 else{
 srcnn_context->model = (srcnn_context->dnn_module->load_model)(srcnn_context->model_filename);
 }
 if (!srcnn_context->model){
-av_log(context, AV_LOG_ERROR, "could not load dnn model\n");
+av_log(context, AV_LOG_ERROR, "could not load DNN model\n");
 

Re: [FFmpeg-devel] [PATCH] libavfilter/opencl.h: Add macro for setting opencl kernel

2018-06-05 Thread Mark Thompson
On 04/06/18 01:03, Danil Iashchenko wrote:
> Fixed, thanks!
> Also implemented macro for other filters: avgblur_opencl, convolution_opencl, 
> unsharp_opencl, overlay_opencl.
> 
> ---

^ When you add extra commentary to an email, put it after this line.  (What 
you've written here ends up in the commit message when applied, which probably 
wasn't intended.)

>  libavfilter/opencl.h| 13 +
>  libavfilter/vf_avgblur_opencl.c | 48 ---
>  libavfilter/vf_convolution_opencl.c | 43 
>  libavfilter/vf_overlay_opencl.c | 36 ++-
>  libavfilter/vf_unsharp_opencl.c | 57 
> ++---
>  5 files changed, 42 insertions(+), 155 deletions(-)
> 
> diff --git a/libavfilter/opencl.h b/libavfilter/opencl.h
> index c0a4519..c192f44 100644
> --- a/libavfilter/opencl.h
> +++ b/libavfilter/opencl.h
> @@ -46,6 +46,19 @@ typedef struct OpenCLFilterContext {
>  intoutput_height;
>  } OpenCLFilterContext;
>  
> +
> +/**
> + * set argument to specific Kernel.
> + * This macro relies on usage of local label "fail" and variable avctx.
> + */
> +#define CL_SET_KERNEL_ARG(kernel, arg_num, type, arg)  \
> +cle = clSetKernelArg(kernel, arg_num, sizeof(type), arg);  \
> +if (cle != CL_SUCCESS) {   \
> +av_log(avctx, AV_LOG_ERROR, "Failed to set kernel "\
> +   "argument %d: error %d.\n", arg_num, cle);  \

This should also set an error return here; otherwise it will return some 
uninitialised value (possibly zero, which looks like success).

> +goto fail; \
> +}
> +
>  /**
>   * Return that all inputs and outputs support only AV_PIX_FMT_OPENCL.
>   */
> diff --git a/libavfilter/vf_avgblur_opencl.c b/libavfilter/vf_avgblur_opencl.c
> index 48cebb5..8d4c264 100644
> --- a/libavfilter/vf_avgblur_opencl.c
> +++ b/libavfilter/vf_avgblur_opencl.c
> @@ -151,27 +151,9 @@ static int avgblur_opencl_filter_frame(AVFilterLink 
> *inlink, AVFrame *input)
>  radius_y = 0;
>  }
>  
> -cle = clSetKernelArg(ctx->kernel_horiz, 0, sizeof(cl_mem), );
> -if (cle != CL_SUCCESS) {
> -av_log(avctx, AV_LOG_ERROR, "Failed to set kernel "
> -   "destination image argument: %d.\n", cle);
> -err = AVERROR_UNKNOWN;
> -goto fail;
> -}
> -cle = clSetKernelArg(ctx->kernel_horiz, 1, sizeof(cl_mem), );
> -if (cle != CL_SUCCESS) {
> -av_log(avctx, AV_LOG_ERROR, "Failed to set kernel "
> -   "source image argument: %d.\n", cle);
> -err = AVERROR_UNKNOWN;
> -goto fail;
> -}
> -cle = clSetKernelArg(ctx->kernel_horiz, 2, sizeof(cl_int), 
> _x);
> -if (cle != CL_SUCCESS) {
> -av_log(avctx, AV_LOG_ERROR, "Failed to set kernel "
> -   "sizeX argument: %d.\n", cle);
> -err = AVERROR_UNKNOWN;
> -goto fail;
> -}
> +CL_SET_KERNEL_ARG(ctx->kernel_horiz, 0, cl_mem,   );
> +CL_SET_KERNEL_ARG(ctx->kernel_horiz, 1, cl_mem,   );
> +CL_SET_KERNEL_ARG(ctx->kernel_horiz, 2, cl_int,   _x);
>  
>  err = ff_opencl_filter_work_size_from_image(avctx, global_work,
>  intermediate, p, 0);
> @@ -192,27 +174,9 @@ static int avgblur_opencl_filter_frame(AVFilterLink 
> *inlink, AVFrame *input)
>  goto fail;
>  }
>  
> -cle = clSetKernelArg(ctx->kernel_vert, 0, sizeof(cl_mem), );
> -if (cle != CL_SUCCESS) {
> -av_log(avctx, AV_LOG_ERROR, "Failed to set kernel "
> -   "destination image argument: %d.\n", cle);
> -err = AVERROR_UNKNOWN;
> -goto fail;
> -}
> -cle = clSetKernelArg(ctx->kernel_vert, 1, sizeof(cl_mem), );
> -if (cle != CL_SUCCESS) {
> -av_log(avctx, AV_LOG_ERROR, "Failed to set kernel "
> -   "source image argument: %d.\n", cle);
> -err = AVERROR_UNKNOWN;
> -goto fail;
> -}
> -cle = clSetKernelArg(ctx->kernel_vert, 2, sizeof(cl_int), _y);
> -if (cle != CL_SUCCESS) {
> -av_log(avctx, AV_LOG_ERROR, "Failed to set kernel "
> -   "sizeY argument: %d.\n", cle);
> -err = AVERROR_UNKNOWN;
> -goto fail;
> -}
> +CL_SET_KERNEL_ARG(ctx->kernel_vert, 0, cl_mem,   );
> +CL_SET_KERNEL_ARG(ctx->kernel_vert, 1, cl_mem,   );
> +CL_SET_KERNEL_ARG(ctx->kernel_vert, 2, cl_int,   _y);
>  
>  err = ff_opencl_filter_work_size_from_image(avctx, global_work,
>  output, p, 0);
> diff --git a/libavfilter/vf_convolution_opencl.c 
> b/libavfilter/vf_convolution_opencl.c
> index 

Re: [FFmpeg-devel] [PATCH] libavutil/encryption_info: Add NULL checks.

2018-06-05 Thread Mark Thompson
On 05/06/18 17:30, Jacob Trimble wrote:
> Just because I can't check whether my food has salmonella doesn't mean
> I shouldn't check the temperature when I cook it.  Adding a NULL check
> is trivial and will catch the most common error case.  We also can't
> check whether malloc() allocates enough memory, so should we then not
> check for NULL?  NULL is used as an error signal, so if the caller
> didn't include a NULL check, they will pass it here.  Rather than
> crashing the program (hopefully it will crash, it is undefined
> behavior, so anything could happen), we should be nice and validate
> the input and error out.  Just because it is impossible to check other
> error cases doesn't mean we should ignore all error checks.

(My opinion, others may disagree.)

Please consider what is actually useful to an API user here.

The check you are suggesting will cause the function to, when passed entirely 
invalid arguments, silently return having done nothing.  Is this better than 
the almost-guaranteed segfault you will get instead?  Well, no.  There is much 
more scope for the error to go unnoticed and cause other hard-to-debug issues 
later, where it could have been caught immediately.

If there is a concern that a function like this could be misused then (since 
this is certainly undefined behaviour in any case) turning it into an abort() 
is the best case so that the program will definitely fail and any errors can be 
diagnosed immediately.  As such, I think argument checks for nonsensical 
invalid input like this should be done either with av_assert or not at all.

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


Re: [FFmpeg-devel] [PATCH] libavutil/encryption_info: Add NULL checks.

2018-06-05 Thread Michael Niedermayer
On Tue, Jun 05, 2018 at 09:30:51AM -0700, Jacob Trimble wrote:
> On Mon, Jun 4, 2018 at 2:24 PM Carl Eugen Hoyos  wrote:
> >
> > 2018-06-04 23:07 GMT+02:00, Jacob Trimble 
> > :
> > > On Mon, Jun 4, 2018 at 10:46 AM Carl Eugen Hoyos  
> > > wrote:
> > >>
> > >> 2018-06-04 18:59 GMT+02:00, Jacob Trimble
> > >> :
> > >> > On Fri, Jun 1, 2018 at 5:03 PM Michael Niedermayer
> > >> >  wrote:
> > >> >>
> > >> >> On Thu, May 31, 2018 at 09:33:36AM -0700, Jacob Trimble wrote:
> > >> >> > Found by Chrome's ClusterFuzz: http://crbug.com/846662.
> > >> >> >
> > >> >> > Signed-off-by: Jacob Trimble 
> > >> >> > ---
> > >> >> >  libavutil/encryption_info.c | 7 +--
> > >> >> >  1 file changed, 5 insertions(+), 2 deletions(-)
> > >> >> >
> > >> >> > diff --git a/libavutil/encryption_info.c
> > >> >> > b/libavutil/encryption_info.c
> > >> >> > index 20a752d6b4..a48ded922c 100644
> > >> >> > --- a/libavutil/encryption_info.c
> > >> >> > +++ b/libavutil/encryption_info.c
> > >> >> > @@ -64,6 +64,8 @@ AVEncryptionInfo *av_encryption_info_clone(const
> > >> >> > AVEncryptionInfo *info)
> > >> >> >  {
> > >> >> >  AVEncryptionInfo *ret;
> > >> >> >
> > >> >> > +if (!info)
> > >> >> > +return NULL;
> > >> >> >  ret = av_encryption_info_alloc(info->subsample_count,
> > >> >> > info->key_id_size, info->iv_size);
> > >> >> >  if (!ret)
> > >> >> >  return NULL;
> > >> >>
> > >> >> > @@ -127,7 +129,7 @@ uint8_t *av_encryption_info_add_side_data(const
> > >> >> > AVEncryptionInfo *info, size_t *
> > >> >> >  uint8_t *buffer, *cur_buffer;
> > >> >> >  uint32_t i;
> > >> >> >
> > >> >> > -if (UINT32_MAX - FF_ENCRYPTION_INFO_EXTRA < info->key_id_size 
> > >> >> > ||
> > >> >> > +if (!info || !size || UINT32_MAX - FF_ENCRYPTION_INFO_EXTRA <
> > >> >> > info->key_id_size ||
> > >> >> >  UINT32_MAX - FF_ENCRYPTION_INFO_EXTRA - info->key_id_size <
> > >> >> > info->iv_size ||
> > >> >> >  (UINT32_MAX - FF_ENCRYPTION_INFO_EXTRA - info->key_id_size 
> > >> >> > -
> > >> >> > info->iv_size) / 8 < info->subsample_count) {
> > >> >> >  return NULL;
> > >> >> > @@ -260,7 +262,8 @@ uint8_t
> > >> >> > *av_encryption_init_info_add_side_data(const
> > >> >> > AVEncryptionInitInfo *info,
> > >> >> >  uint8_t *buffer, *cur_buffer;
> > >> >> >  uint32_t i, max_size;
> > >> >> >
> > >> >> > -if (UINT32_MAX - FF_ENCRYPTION_INIT_INFO_EXTRA <
> > >> >> > info->system_id_size ||
> > >> >> > +if (!info || !side_data_size ||
> > >> >> > +UINT32_MAX - FF_ENCRYPTION_INIT_INFO_EXTRA <
> > >> >> > info->system_id_size ||
> > >> >> >  UINT32_MAX - FF_ENCRYPTION_INIT_INFO_EXTRA -
> > >> >> > info->system_id_size < info->data_size) {
> > >> >> >  return NULL;
> > >> >> >  }
> > >> >>
> > >> >> in which valid case would these be called with NULL input ?
> > >> >> iam asking as this feels as if it might be a bug in teh caller
> > >> >>
> > >> >
> > >> > This was found by Chrome's ClusterFuzz, which I am not that familiar
> > >> > with.  I think it was just running fuzz tests directly on FFmpeg code,
> > >> > so it wasn't in production code.  But since this is a public method,
> > >> > we should validate the input in any case.
> > >>
> > >> How do you validate the size of C buffers in general?
> > >
> > > I'm not sure I understand your comment.  You can't verify the
> > > length of buffers unless the size is given to the method.
> >
> > If we can't verify the size of the buffer (where both overread
> > and overwrite at least can have catastrophic impact) why
> > is it a good idea to check if the user passed an actual pointer
> > (as is required) or NULL as argument (where NULL typically
> > has limited impact)?
> >
> > > These functions do accept the size and verify that the data
> > > is valid for the given size.
> >
> > I may misunderstand the code but it looks to me as if the
> > given size is only checked because the needed space is
> > not necessarily known in advance / most functions do not
> > check.
> 
> This method doesn't need the size at all, the number of elements is
> actually encoded in the side-data.  These methods use the
> side_data_size to double-check that the number of bytes is large
> enough to hold the number of elements that the side-data says there
> are.
> 
> >
> > > Since we are verifying the data and the size we are
> > > given, we should be checking for NULL as well.
> >
> > Why?
> > (As we cannot check for the worse case anyway.)
> 
> Just because I can't check whether my food has salmonella doesn't mean
> I shouldn't check the temperature when I cook it.  Adding a NULL check
> is trivial and will catch the most common error case.  We also can't
> check whether malloc() allocates enough memory, so should we then not
> check for NULL?  NULL is used as an error signal, so if the caller
> didn't include a NULL check, they will pass it here.  Rather than
> crashing the program (hopefully it will crash, it is undefined
> 

Re: [FFmpeg-devel] [PATCH 4/6] avformat/mxfdec: remove check for NULL MXFTrack in mxf_set_pts

2018-06-05 Thread Marton Balint



On Tue, 5 Jun 2018, Tomas Härdin wrote:


tor 2018-05-31 klockan 02:05 +0200 skrev Marton Balint:

It cannot happen for video streams.

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

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index e80ef62d57..cf1cd71987 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -3221,7 +3221,7 @@ static int mxf_set_pts(MXFContext *mxf, AVStream *st, 
AVPacket *pkt, int64_t nex
 if (mxf->nb_index_tables >= 1 && mxf->current_edit_unit < t->nb_ptses) 
{
 pkt->dts = mxf->current_edit_unit + t->first_dts;
 pkt->pts = t->ptses[mxf->current_edit_unit];
-} else if (track && track->intra_only) {
+} else if (track->intra_only) {


I wonder what actually caused this check to be inserted. That is, what
could lead to track being NULL that is no longer the case?


I don't know, I cc'd the original patch author about it. IMHO this was 
never needed because only streams which are added in 
mxf_add_metadata_stream have their priv_data (track) set to NULL, 
and those streams are always DATA.


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


Re: [FFmpeg-devel] [PATCH 6/6] avformat/mxfdec: add support for recognizing timed text streams

2018-06-05 Thread Marton Balint



On Tue, 5 Jun 2018, Tomas Härdin wrote:


tor 2018-05-31 klockan 02:05 +0200 skrev Marton Balint:

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

+type = avcodec_get_type(st->codecpar->codec_id);
+if (type == AVMEDIA_TYPE_SUBTITLE)
+st->codecpar->codec_type = type;


This feels like something that belongs in more generic parts of lavf.
Filling codecpar with defaults for some given codec_id that is.


I assumed some codecs can be audio and video at the same time, and this is 
why it's not automatic. wrapped_avframe (like it or not) is such a codec. 
In any case, I'd rather not change the way it works here...


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


Re: [FFmpeg-devel] [PATCH 1/2] avdevice/decklink_dec: use a custom memory allocator

2018-06-05 Thread Dave Rice

> On Jun 5, 2018, at 1:17 PM, Marton Balint  wrote:
> 
> On Tue, 5 Jun 2018, Dave Rice wrote:
> 
>>> On Jun 4, 2018, at 4:21 PM, Marton Balint  wrote:
>>> 
>>> The default memory allocator is limited in the max number of frames 
>>> available,
>>> and therefore caused frame drops if the frames were not freed fast enough.
>> 
>> I’ve been testing this patchset today. Yesterday I was occasionally getting 
>> “Decklink input buffer overrun!” errors with this command:
>> 
>> /usr/local/opt/ffmpegdecklink/bin/ffmpeg-dl -v info -nostdin -nostats -t 
>> 1980 -f decklink -draw_bars 0 -audio_input embedded -video_input sdi 
>> -format_code ntsc -channels 8 -raw_format yuv422p10 -i "UltraStudio Express" 
>> -metadata:s:v:0 encoder="FFV1 version 3" -color_primaries smpte170m 
>> -color_trc bt709 -colorspace smpte170m -color_range mpeg -metadata 
>> creation_time=now -f_strict unofficial -c:v ffv1 -level 3 -g 1 -slices 16 
>> -slicecrc 1 -c:a pcm_s24le -filter_complex 
>> "[0:v:0]setfield=bff,setsar=40/27,setdar=4/3; [0:a:0]pan=stereo| c0=c0 | 
>> c1=c1[stereo1];[0:a:0]pan=stereo| c0=c2 | c1=c3[stereo2]" -map "[stereo1]" 
>> -map "[stereo2]" -f matroska output.mkv -an -f framemd5 output.framemd5
>> 
>> With the patchset applied, I haven’t had that buffer overrun error re-occur.
> 
> That is very strange, it should work the opposite way. Without the patch, the 
> decklink driver is dropping frames (silently), so you should never get a 
> Decklink input buffer overrun error message, but silent frame drops instead 
> if you don't release (transcode) the frames fast enough.
> 
> With the patch, you won't get silent frame drops, but you might fill the 
> internal queue and therefore get Decklink input buffer overruns. On the other 
> hand, if you get Decklink input buffer overruns, that typically means that 
> your computer is too slow to handle transcoding in real time…

Trying to detect unreported dropped frames is why I added the framemd5 output 
as a second output. After the command runs, I would use this command

grep -v "^#” output.framemd5 | awk -F',' '$2!=p+1{printf p+1"-"$2-1" "}{p=$2}'

to report the ranges of pts that weren’t incrementing the pts by 1 within the 
pts. I had presumed that getting a gap in the pts within the framemd5 was 
corresponding with the buffer overrun error in the terminal output. I’ve tested 
a few hours of recorded with your patch applied and haven’t gotten any pts 
discontinuity in the framemd5s yet.

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


Re: [FFmpeg-devel] [PATCH 1/2] avdevice/decklink_dec: use a custom memory allocator

2018-06-05 Thread Marton Balint



On Tue, 5 Jun 2018, Dave Rice wrote:




On Jun 4, 2018, at 4:21 PM, Marton Balint  wrote:

The default memory allocator is limited in the max number of frames available,
and therefore caused frame drops if the frames were not freed fast enough.


I’ve been testing this patchset today. Yesterday I was occasionally getting 
“Decklink input buffer overrun!” errors with this command:

/usr/local/opt/ffmpegdecklink/bin/ffmpeg-dl -v info -nostdin -nostats -t 1980 -f decklink -draw_bars 0 -audio_input embedded 
-video_input sdi -format_code ntsc -channels 8 -raw_format yuv422p10 -i "UltraStudio Express" -metadata:s:v:0 
encoder="FFV1 version 3" -color_primaries smpte170m -color_trc bt709 -colorspace smpte170m -color_range mpeg -metadata 
creation_time=now -f_strict unofficial -c:v ffv1 -level 3 -g 1 -slices 16 -slicecrc 1 -c:a pcm_s24le -filter_complex 
"[0:v:0]setfield=bff,setsar=40/27,setdar=4/3; [0:a:0]pan=stereo| c0=c0 | c1=c1[stereo1];[0:a:0]pan=stereo| c0=c2 | 
c1=c3[stereo2]" -map "[stereo1]" -map "[stereo2]" -f matroska output.mkv -an -f framemd5 output.framemd5

With the patchset applied, I haven’t had that buffer overrun error re-occur.


That is very strange, it should work the opposite way. Without the patch, 
the decklink driver is dropping frames (silently), so you should never 
get a Decklink input buffer overrun error message, but silent frame drops 
instead if you don't release (transcode) the frames fast enough.


With the patch, you won't get silent frame drops, but you might fill the 
internal queue and therefore get Decklink input buffer overruns. On the 
other hand, if you get Decklink input buffer overruns, that typically 
means that your computer is too slow to handle transcoding in real time...


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


Re: [FFmpeg-devel] [PATCH 1/6] avformat/mxfdec: use MXFCodecUL struct to store essence description for data_essence_container_uls

2018-06-05 Thread Marton Balint



On Tue, 5 Jun 2018, Tomas Härdin wrote:


tor 2018-05-31 klockan 02:05 +0200 skrev Marton Balint:

Signed-off-by: Marton Balint 

---
 libavformat/mxf.h|  1 +
 libavformat/mxfdec.c | 16 
 2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index ffcc429a8b..19f8d8a9f5 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -68,6 +68,7 @@ typedef struct MXFCodecUL {
 UID uid;
 unsigned matching_len;
 int id;


Is "id" really needed now?


Yes, there are other tables which are also using the MXFCodecUL struct.

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


Re: [FFmpeg-devel] [PATCH] libavutil/encryption_info: Add NULL checks.

2018-06-05 Thread Jacob Trimble
On Mon, Jun 4, 2018 at 2:24 PM Carl Eugen Hoyos  wrote:
>
> 2018-06-04 23:07 GMT+02:00, Jacob Trimble :
> > On Mon, Jun 4, 2018 at 10:46 AM Carl Eugen Hoyos  wrote:
> >>
> >> 2018-06-04 18:59 GMT+02:00, Jacob Trimble
> >> :
> >> > On Fri, Jun 1, 2018 at 5:03 PM Michael Niedermayer
> >> >  wrote:
> >> >>
> >> >> On Thu, May 31, 2018 at 09:33:36AM -0700, Jacob Trimble wrote:
> >> >> > Found by Chrome's ClusterFuzz: http://crbug.com/846662.
> >> >> >
> >> >> > Signed-off-by: Jacob Trimble 
> >> >> > ---
> >> >> >  libavutil/encryption_info.c | 7 +--
> >> >> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >> >> >
> >> >> > diff --git a/libavutil/encryption_info.c
> >> >> > b/libavutil/encryption_info.c
> >> >> > index 20a752d6b4..a48ded922c 100644
> >> >> > --- a/libavutil/encryption_info.c
> >> >> > +++ b/libavutil/encryption_info.c
> >> >> > @@ -64,6 +64,8 @@ AVEncryptionInfo *av_encryption_info_clone(const
> >> >> > AVEncryptionInfo *info)
> >> >> >  {
> >> >> >  AVEncryptionInfo *ret;
> >> >> >
> >> >> > +if (!info)
> >> >> > +return NULL;
> >> >> >  ret = av_encryption_info_alloc(info->subsample_count,
> >> >> > info->key_id_size, info->iv_size);
> >> >> >  if (!ret)
> >> >> >  return NULL;
> >> >>
> >> >> > @@ -127,7 +129,7 @@ uint8_t *av_encryption_info_add_side_data(const
> >> >> > AVEncryptionInfo *info, size_t *
> >> >> >  uint8_t *buffer, *cur_buffer;
> >> >> >  uint32_t i;
> >> >> >
> >> >> > -if (UINT32_MAX - FF_ENCRYPTION_INFO_EXTRA < info->key_id_size ||
> >> >> > +if (!info || !size || UINT32_MAX - FF_ENCRYPTION_INFO_EXTRA <
> >> >> > info->key_id_size ||
> >> >> >  UINT32_MAX - FF_ENCRYPTION_INFO_EXTRA - info->key_id_size <
> >> >> > info->iv_size ||
> >> >> >  (UINT32_MAX - FF_ENCRYPTION_INFO_EXTRA - info->key_id_size -
> >> >> > info->iv_size) / 8 < info->subsample_count) {
> >> >> >  return NULL;
> >> >> > @@ -260,7 +262,8 @@ uint8_t
> >> >> > *av_encryption_init_info_add_side_data(const
> >> >> > AVEncryptionInitInfo *info,
> >> >> >  uint8_t *buffer, *cur_buffer;
> >> >> >  uint32_t i, max_size;
> >> >> >
> >> >> > -if (UINT32_MAX - FF_ENCRYPTION_INIT_INFO_EXTRA <
> >> >> > info->system_id_size ||
> >> >> > +if (!info || !side_data_size ||
> >> >> > +UINT32_MAX - FF_ENCRYPTION_INIT_INFO_EXTRA <
> >> >> > info->system_id_size ||
> >> >> >  UINT32_MAX - FF_ENCRYPTION_INIT_INFO_EXTRA -
> >> >> > info->system_id_size < info->data_size) {
> >> >> >  return NULL;
> >> >> >  }
> >> >>
> >> >> in which valid case would these be called with NULL input ?
> >> >> iam asking as this feels as if it might be a bug in teh caller
> >> >>
> >> >
> >> > This was found by Chrome's ClusterFuzz, which I am not that familiar
> >> > with.  I think it was just running fuzz tests directly on FFmpeg code,
> >> > so it wasn't in production code.  But since this is a public method,
> >> > we should validate the input in any case.
> >>
> >> How do you validate the size of C buffers in general?
> >
> > I'm not sure I understand your comment.  You can't verify the
> > length of buffers unless the size is given to the method.
>
> If we can't verify the size of the buffer (where both overread
> and overwrite at least can have catastrophic impact) why
> is it a good idea to check if the user passed an actual pointer
> (as is required) or NULL as argument (where NULL typically
> has limited impact)?
>
> > These functions do accept the size and verify that the data
> > is valid for the given size.
>
> I may misunderstand the code but it looks to me as if the
> given size is only checked because the needed space is
> not necessarily known in advance / most functions do not
> check.

This method doesn't need the size at all, the number of elements is
actually encoded in the side-data.  These methods use the
side_data_size to double-check that the number of bytes is large
enough to hold the number of elements that the side-data says there
are.

>
> > Since we are verifying the data and the size we are
> > given, we should be checking for NULL as well.
>
> Why?
> (As we cannot check for the worse case anyway.)

Just because I can't check whether my food has salmonella doesn't mean
I shouldn't check the temperature when I cook it.  Adding a NULL check
is trivial and will catch the most common error case.  We also can't
check whether malloc() allocates enough memory, so should we then not
check for NULL?  NULL is used as an error signal, so if the caller
didn't include a NULL check, they will pass it here.  Rather than
crashing the program (hopefully it will crash, it is undefined
behavior, so anything could happen), we should be nice and validate
the input and error out.  Just because it is impossible to check other
error cases doesn't mean we should ignore all error checks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org

Re: [FFmpeg-devel] [PATCH] mov: Make sure PTS are both monotonically increasing, and unique

2018-06-05 Thread Derek Buitenhuis
On 30/05/2018 00:48, Michael Niedermayer wrote:
>> Sorry I missed that! I'd prefer to use your patch over mine.
> 
> iam fine with sasis original patch too

Pushed with the changes that were requested in that thread.

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


Re: [FFmpeg-devel] [PATCH 1/2] avdevice/decklink_dec: use a custom memory allocator

2018-06-05 Thread Dave Rice

> On Jun 4, 2018, at 4:21 PM, Marton Balint  wrote:
> 
> The default memory allocator is limited in the max number of frames available,
> and therefore caused frame drops if the frames were not freed fast enough.

I’ve been testing this patchset today. Yesterday I was occasionally getting 
“Decklink input buffer overrun!” errors with this command:

/usr/local/opt/ffmpegdecklink/bin/ffmpeg-dl -v info -nostdin -nostats -t 1980 
-f decklink -draw_bars 0 -audio_input embedded -video_input sdi -format_code 
ntsc -channels 8 -raw_format yuv422p10 -i "UltraStudio Express" -metadata:s:v:0 
encoder="FFV1 version 3" -color_primaries smpte170m -color_trc bt709 
-colorspace smpte170m -color_range mpeg -metadata creation_time=now -f_strict 
unofficial -c:v ffv1 -level 3 -g 1 -slices 16 -slicecrc 1 -c:a pcm_s24le 
-filter_complex "[0:v:0]setfield=bff,setsar=40/27,setdar=4/3; 
[0:a:0]pan=stereo| c0=c0 | c1=c1[stereo1];[0:a:0]pan=stereo| c0=c2 | 
c1=c3[stereo2]" -map "[stereo1]" -map "[stereo2]" -f matroska output.mkv -an -f 
framemd5 output.framemd5

With the patchset applied, I haven’t had that buffer overrun error re-occur. 

> Signed-off-by: Marton Balint 
> ---
> libavdevice/decklink_dec.cpp | 50 
> 1 file changed, 50 insertions(+)
> 
> diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
> index 510637676c..897fca1003 100644
> --- a/libavdevice/decklink_dec.cpp
> +++ b/libavdevice/decklink_dec.cpp
> @@ -21,6 +21,9 @@
>  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
>  */
> 
> +#include 
> +using std::atomic;
> +
> /* Include internal.h first to avoid conflict between winsock.h (used by
>  * DeckLink headers) and winsock2.h (used by libavformat) in MSVC++ builds */
> extern "C" {
> @@ -98,6 +101,44 @@ static VANCLineNumber vanc_line_numbers[] = {
> {bmdModeUnknown, 0, -1, -1, -1}
> };
> 
> +class decklink_allocator : public IDeckLinkMemoryAllocator
> +{
> +public:
> +decklink_allocator(): _refs(1) { }
> +virtual ~decklink_allocator() { }
> +
> +// IDeckLinkMemoryAllocator methods
> +virtual HRESULT STDMETHODCALLTYPE AllocateBuffer(unsigned int 
> bufferSize, void* *allocatedBuffer)
> +{
> +void *buf = av_malloc(bufferSize + AV_INPUT_BUFFER_PADDING_SIZE);
> +if (!buf)
> +return E_OUTOFMEMORY;
> +*allocatedBuffer = buf;
> +return S_OK;
> +}
> +virtual HRESULT STDMETHODCALLTYPE ReleaseBuffer(void* buffer)
> +{
> +av_free(buffer);
> +return S_OK;
> +}
> +virtual HRESULT STDMETHODCALLTYPE Commit() { return S_OK; }
> +virtual HRESULT STDMETHODCALLTYPE Decommit() { return S_OK; }
> +
> +// IUnknown methods
> +virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID 
> *ppv) { return E_NOINTERFACE; }
> +virtual ULONG   STDMETHODCALLTYPE AddRef(void) { return ++_refs; }
> +virtual ULONG   STDMETHODCALLTYPE Release(void)
> +{
> +int ret = --_refs;
> +if (!ret)
> +delete this;
> +return ret;
> +}
> +
> +private:
> +std::atomic  _refs;
> +};
> +
> extern "C" {
> static void decklink_object_free(void *opaque, uint8_t *data)
> {
> @@ -924,6 +965,7 @@ av_cold int ff_decklink_read_header(AVFormatContext 
> *avctx)
> {
> struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
> struct decklink_ctx *ctx;
> +class decklink_allocator *allocator;
> AVStream *st;
> HRESULT result;
> char fname[1024];
> @@ -1017,6 +1059,14 @@ av_cold int ff_decklink_read_header(AVFormatContext 
> *avctx)
> ctx->input_callback = new decklink_input_callback(avctx);
> ctx->dli->SetCallback(ctx->input_callback);
> 
> +allocator = new decklink_allocator();
> +ret = (ctx->dli->SetVideoInputFrameMemoryAllocator(allocator) == S_OK ? 
> 0 : AVERROR_EXTERNAL);
> +allocator->Release();
> +if (ret < 0) {
> +av_log(avctx, AV_LOG_ERROR, "Cannot set custom memory allocator\n");
> +goto error;
> +}
> +
> if (mode_num == 0 && !cctx->format_code) {
> if (decklink_autodetect(cctx) < 0) {
> av_log(avctx, AV_LOG_ERROR, "Cannot Autodetect input stream or No 
> signal\n");
> -- 
> 2.16.3
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH v4 3/4] configure: fix check for opencl

2018-06-05 Thread Jun Zhao
add pkg-config support for opencl check.

Signed-off-by: Jun Zhao 
---
 configure | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 53224f0..aaf7b02 100755
--- a/configure
+++ b/configure
@@ -6135,7 +6135,8 @@ enabled openal&& { { for al_extralibs in 
"${OPENAL_LIBS}" "-lopenal"
die "ERROR: openal not found"; } &&
  { test_cpp_condition "AL/al.h" 
"defined(AL_VERSION_1_1)" ||
die "ERROR: openal must be installed and 
version must be 1.1 or compatible"; }
-enabled opencl&& { check_lib opencl OpenCL/cl.h 
clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
+enabled opencl&& { check_pkg_config opencl OpenCL CL/cl.h 
clEnqueueNDRangeKernel ||
+   check_lib opencl OpenCL/cl.h 
clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
check_lib opencl CL/cl.h clEnqueueNDRangeKernel 
-lOpenCL ||
die "ERROR: opencl not found"; } &&
  { test_cpp_condition "OpenCL/cl.h" 
"defined(CL_VERSION_1_2)" ||
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v4 0/4] opencl misc clean

2018-06-05 Thread Jun Zhao
v4: - use av_unused mark fix the build warning
- fix typo in commit message
v3: - Abandoned v2 patchset.
- Change the pkg-config check as James Almer's comments.
- Splite libmfx and opencl_vaapi_intel_media.

Jun Zhao (4):
  lavu/hwcontext_opecl: fix the build warning
  lavfi/opencl: remove redundant header.
  configure: fix check for opencl
  configure: fix check for opencl_vaapi_intel_media.

 configure|  9 -
 libavfilter/opencl.c |  3 ---
 libavutil/hwcontext_opencl.c | 11 ---
 3 files changed, 12 insertions(+), 11 deletions(-)

-- 
2.7.4

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


[FFmpeg-devel] [PATCH v4 1/4] lavu/hwcontext_opecl: fix the build warning

2018-06-05 Thread Jun Zhao
fix the build warning when use Portable Computing Language (pocl).

Signed-off-by: Jun Zhao 
---
 libavutil/hwcontext_opencl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index 43b5c5a..b5208fa 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -2809,7 +2809,7 @@ static int opencl_map_from(AVHWFramesContext *hwfc, 
AVFrame *dst,
 static int opencl_map_to(AVHWFramesContext *hwfc, AVFrame *dst,
  const AVFrame *src, int flags)
 {
-OpenCLDeviceContext *priv = hwfc->device_ctx->internal->priv;
+av_unused OpenCLDeviceContext *priv = hwfc->device_ctx->internal->priv;
 av_assert0(dst->format == AV_PIX_FMT_OPENCL);
 switch (src->format) {
 #if HAVE_OPENCL_DRM_BEIGNET
@@ -2850,7 +2850,7 @@ static int opencl_map_to(AVHWFramesContext *hwfc, AVFrame 
*dst,
 static int opencl_frames_derive_to(AVHWFramesContext *dst_fc,
AVHWFramesContext *src_fc, int flags)
 {
-OpenCLDeviceContext *priv = dst_fc->device_ctx->internal->priv;
+av_unused OpenCLDeviceContext *priv = dst_fc->device_ctx->internal->priv;
 switch (src_fc->device_ctx->type) {
 #if HAVE_OPENCL_DRM_BEIGNET
 case AV_HWDEVICE_TYPE_DRM:
-- 
2.7.4

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


Re: [FFmpeg-devel] [GSOC] [PATCH] TensorFlow backend introduction for DNN module

2018-06-05 Thread James Almer
On 6/3/2018 3:02 PM, Sergey Lavrushkin wrote:
> diff --git a/libavfilter/vf_srcnn.c b/libavfilter/vf_srcnn.c
> index d6efe9b478..5c5e26b33a 100644
> --- a/libavfilter/vf_srcnn.c
> +++ b/libavfilter/vf_srcnn.c
> @@ -41,7 +41,6 @@ typedef struct SRCNNContext {
>  DNNData input_output;
>  } SRCNNContext;
>  
> -
>  #define OFFSET(x) offsetof(SRCNNContext, x)
>  #define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
>  static const AVOption srcnn_options[] = {
> @@ -55,10 +54,19 @@ static av_cold int init(AVFilterContext* context)
>  {
>  SRCNNContext* srcnn_context = context->priv;
>  
> -srcnn_context->dnn_module = ff_get_dnn_module(DNN_NATIVE);
> +srcnn_context->dnn_module = ff_get_dnn_module(DNN_TF);

This should be a filter AVOption, not hardcoded to one or another. What
if i, for whatever reason, want to use the native backend when i have
libtensorflow enabled?

>  if (!srcnn_context->dnn_module){
> -av_log(context, AV_LOG_ERROR, "could not create dnn module\n");
> -return AVERROR(ENOMEM);
> +srcnn_context->dnn_module = ff_get_dnn_module(DNN_NATIVE);
> +if (!srcnn_context->dnn_module){
> +av_log(context, AV_LOG_ERROR, "could not create dnn module\n");
> +return AVERROR(ENOMEM);
> +}
> +else{
> +av_log(context, AV_LOG_INFO, "using native backend for DNN 
> inference\n");

VERBOSE, not INFO

> +}
> +}
> +else{
> +av_log(context, AV_LOG_INFO, "using tensorflow backend for DNN 
> inference\n");

Ditto.

>  }
>  if (!srcnn_context->model_filename){
>  av_log(context, AV_LOG_INFO, "model file for network was not 
> specified, using default network for x2 upsampling\n");

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


[FFmpeg-devel] [PATCH v2 0/2] fix make checkheaders warning

2018-06-05 Thread Jun Zhao
v2: - clean up the commit message for James Almer's review

Jun Zhao (2):
  lavc/dolby_e: fix make checkheaders warning
  lavc/aacsbr: fix make checkheaders warning

 libavcodec/aacsbr_tablegen_common.h | 12 -
 libavcodec/aacsbr_template.c| 12 +
 libavcodec/dolby_e.c| 87 +
 libavcodec/dolby_e.h| 86 
 4 files changed, 99 insertions(+), 98 deletions(-)

-- 
2.7.4

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


[FFmpeg-devel] [PATCH v2 2/2] lavc/aacsbr: fix make checkheaders warning

2018-06-05 Thread Jun Zhao
move the the function aacsbr_tableinit definition from header file
to .c file to fix make checkheaders warning.

Signed-off-by: Jun Zhao 
---
 libavcodec/aacsbr_tablegen_common.h | 12 
 libavcodec/aacsbr_template.c| 12 
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavcodec/aacsbr_tablegen_common.h 
b/libavcodec/aacsbr_tablegen_common.h
index 8c8f6ef..8e0dd9e 100644
--- a/libavcodec/aacsbr_tablegen_common.h
+++ b/libavcodec/aacsbr_tablegen_common.h
@@ -111,16 +111,4 @@ static DECLARE_ALIGNED(32, INTFLOAT, 
sbr_qmf_window_us)[640] = {
 Q31( 0.8537385600f),
 };
 
-static av_cold void aacsbr_tableinit(void)
-{
-int n;
-for (n = 1; n < 320; n++)
-sbr_qmf_window_us[320 + n] = sbr_qmf_window_us[320 - n];
-sbr_qmf_window_us[384] = -sbr_qmf_window_us[384];
-sbr_qmf_window_us[512] = -sbr_qmf_window_us[512];
-
-for (n = 0; n < 320; n++)
-sbr_qmf_window_ds[n] = sbr_qmf_window_us[2*n];
-}
-
 #endif /* AVCODEC_AACSBR_TABLEGEN_COMMON_H */
diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c
index 3fe78d5..821615f 100644
--- a/libavcodec/aacsbr_template.c
+++ b/libavcodec/aacsbr_template.c
@@ -34,6 +34,18 @@
 
 #include "libavutil/qsort.h"
 
+static av_cold void aacsbr_tableinit(void)
+{
+int n;
+for (n = 1; n < 320; n++)
+sbr_qmf_window_us[320 + n] = sbr_qmf_window_us[320 - n];
+sbr_qmf_window_us[384] = -sbr_qmf_window_us[384];
+sbr_qmf_window_us[512] = -sbr_qmf_window_us[512];
+
+for (n = 0; n < 320; n++)
+sbr_qmf_window_ds[n] = sbr_qmf_window_us[2*n];
+}
+
 av_cold void AAC_RENAME(ff_aac_sbr_init)(void)
 {
 static const struct {
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v2 1/2] lavc/dolby_e: fix make checkheaders warning

2018-06-05 Thread Jun Zhao
move the the function init_tables() definitions from header file
to .c file to fix make checkheaders warning.

Signed-off-by: Jun Zhao 
---
 libavcodec/dolby_e.c | 87 
 libavcodec/dolby_e.h | 86 ---
 2 files changed, 87 insertions(+), 86 deletions(-)

diff --git a/libavcodec/dolby_e.c b/libavcodec/dolby_e.c
index 91a00ce..429612e 100644
--- a/libavcodec/dolby_e.c
+++ b/libavcodec/dolby_e.c
@@ -681,6 +681,93 @@ static av_cold int dolby_e_close(AVCodecContext *avctx)
 return 0;
 }
 
+
+static av_cold void init_tables(void)
+{
+int i, j;
+
+for (i = 1; i < 17; i++)
+mantissa_tab1[i][0] = 1.0f / (1 << i - 1);
+
+for (i = 2; i < 16; i++) {
+mantissa_tab1[i][1] = 1.0f  / ((1 << i) - 1);
+mantissa_tab1[i][2] = 0.5f  / ((1 << i) - 1);
+mantissa_tab1[i][3] = 0.25f / ((1 << i) - 1);
+}
+
+mantissa_tab1[i][1] = 0.5f   / (1 << 15);
+mantissa_tab1[i][2] = 0.75f  / (1 << 15);
+mantissa_tab1[i][3] = 0.875f / (1 << 15);
+
+for (i = 1; i < 17; i++) {
+mantissa_tab2[i][1] = mantissa_tab1[i][0] * 0.5f;
+mantissa_tab2[i][2] = mantissa_tab1[i][0] * 0.75f;
+mantissa_tab2[i][3] = mantissa_tab1[i][0] * 0.875f;
+for (j = 1; j < 4; j++)
+mantissa_tab3[i][j] = 1.0f / (1 << i) + 1.0f / (1 << j) - 1.0f / 
(1 << i + j);
+}
+
+mantissa_tab3[1][3] = 0.6875f;
+
+for (i = 0; i < 25; i++) {
+exponent_tab[i * 2] = 1.0f  / (1 << i);
+exponent_tab[i * 2 + 1] = M_SQRT1_2 / (1 << i);
+}
+
+for (i = 1; i < 1024; i++)
+gain_tab[i] = exp2f((i - 960) / 64.0f);
+
+// short 1
+ff_kbd_window_init(window, 3.0f, 128);
+for (i = 0; i < 128; i++)
+window[128 + i] = window[127 - i];
+
+// start
+for (i = 0; i < 192; i++)
+window[256 + i] = start_window[i];
+
+// short 2
+for (i = 0; i < 192; i++)
+window[448 + i] = short_window2[i];
+for (i = 0; i < 64; i++)
+window[640 + i] = window[63 - i];
+
+// short 3
+for (i = 0; i < 64; i++)
+window[704 + i] = short_window3[i];
+for (i = 0; i < 192; i++)
+window[768 + i] = window[64 + i];
+
+// bridge
+for (i = 0; i < 128; i++)
+window[960 + i] = window[i];
+for (i = 0; i < 64; i++)
+window[1088 + i] = 1.0f;
+
+// long
+ff_kbd_window_init(window + 1408, 3.0f, 256);
+for (i = 0; i < 640; i++)
+window[1664 + i] = 1.0f;
+for (i = 0; i < 256; i++)
+window[2304 + i] = window[1152 + i] = window[1663 - i];
+
+// reverse start
+for (i = 0; i < 192; i++)
+window[2560 + i] = window[447 - i];
+
+// reverse short 2
+for (i = 0; i < 256; i++)
+window[2752 + i] = window[703 - i];
+
+// reverse short 3
+for (i = 0; i < 256; i++)
+window[3008 + i] = window[959 - i];
+
+// reverse bridge
+for (i = 0; i < 448; i++)
+window[3264 + i] = window[1407 - i];
+}
+
 static av_cold int dolby_e_init(AVCodecContext *avctx)
 {
 static AVOnce init_once = AV_ONCE_INIT;
diff --git a/libavcodec/dolby_e.h b/libavcodec/dolby_e.h
index 0390233..ae04bf6 100644
--- a/libavcodec/dolby_e.h
+++ b/libavcodec/dolby_e.h
@@ -644,90 +644,4 @@ static float gain_tab[1024];
 
 DECLARE_ALIGNED(32, static float, window)[3712];
 
-static av_cold void init_tables(void)
-{
-int i, j;
-
-for (i = 1; i < 17; i++)
-mantissa_tab1[i][0] = 1.0f / (1 << i - 1);
-
-for (i = 2; i < 16; i++) {
-mantissa_tab1[i][1] = 1.0f  / ((1 << i) - 1);
-mantissa_tab1[i][2] = 0.5f  / ((1 << i) - 1);
-mantissa_tab1[i][3] = 0.25f / ((1 << i) - 1);
-}
-
-mantissa_tab1[i][1] = 0.5f   / (1 << 15);
-mantissa_tab1[i][2] = 0.75f  / (1 << 15);
-mantissa_tab1[i][3] = 0.875f / (1 << 15);
-
-for (i = 1; i < 17; i++) {
-mantissa_tab2[i][1] = mantissa_tab1[i][0] * 0.5f;
-mantissa_tab2[i][2] = mantissa_tab1[i][0] * 0.75f;
-mantissa_tab2[i][3] = mantissa_tab1[i][0] * 0.875f;
-for (j = 1; j < 4; j++)
-mantissa_tab3[i][j] = 1.0f / (1 << i) + 1.0f / (1 << j) - 1.0f / 
(1 << i + j);
-}
-
-mantissa_tab3[1][3] = 0.6875f;
-
-for (i = 0; i < 25; i++) {
-exponent_tab[i * 2] = 1.0f  / (1 << i);
-exponent_tab[i * 2 + 1] = M_SQRT1_2 / (1 << i);
-}
-
-for (i = 1; i < 1024; i++)
-gain_tab[i] = exp2f((i - 960) / 64.0f);
-
-// short 1
-ff_kbd_window_init(window, 3.0f, 128);
-for (i = 0; i < 128; i++)
-window[128 + i] = window[127 - i];
-
-// start
-for (i = 0; i < 192; i++)
-window[256 + i] = start_window[i];
-
-// short 2
-for (i = 0; i < 192; i++)
-window[448 + i] = short_window2[i];
-for (i = 0; i < 64; i++)
-window[640 + i] = window[63 - i];
-
-// short 3
-for (i = 0; i < 64; i++)
-window[704 + i] = 

[FFmpeg-devel] [PATCH v4 2/4] lavfi/opencl: remove redundant header.

2018-06-05 Thread Jun Zhao
remove redundant header

Signed-off-by: Jun Zhao 
---
 libavfilter/opencl.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libavfilter/opencl.c b/libavfilter/opencl.c
index ae61667..ac5eec6 100644
--- a/libavfilter/opencl.c
+++ b/libavfilter/opencl.c
@@ -19,12 +19,9 @@
 #include 
 #include 
 
-#include "libavutil/hwcontext.h"
-#include "libavutil/hwcontext_opencl.h"
 #include "libavutil/mem.h"
 #include "libavutil/pixdesc.h"
 
-#include "avfilter.h"
 #include "formats.h"
 #include "opencl.h"
 
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v4 4/4] configure: fix check for opencl_vaapi_intel_media.

2018-06-05 Thread Jun Zhao
opencl_vaapi_intel_media doesn't depend on libmfx, OpenCL™ Drivers
and Runtimes for Intel® Architectureis is a standalone release, more
information can be found in the link:
https://software.intel.com/en-us/articles/opencl-drivers.

Signed-off-by: Jun Zhao 
---
 configure| 6 ++
 libavutil/hwcontext_opencl.c | 7 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index aaf7b02..0501757 100755
--- a/configure
+++ b/configure
@@ -6333,10 +6333,8 @@ fi
 
 if enabled_all opencl vaapi ; then
 enabled opencl_drm_beignet && enable opencl_vaapi_beignet
-if enabled libmfx ; then
-check_type "CL/cl.h CL/va_ext.h" 
"clCreateFromVA_APIMediaSurfaceINTEL_fn" &&
-enable opencl_vaapi_intel_media
-fi
+check_type "CL/cl.h CL/va_ext.h" "clCreateFromVA_APIMediaSurfaceINTEL_fn" 
&&
+enable opencl_vaapi_intel_media
 fi
 
 if enabled_all opencl dxva2 ; then
diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index b5208fa..97c6c0c 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -46,7 +46,9 @@
 #endif
 
 #if HAVE_OPENCL_VAAPI_INTEL_MEDIA
+#if CONFIG_LIBMFX
 #include 
+#endif
 #include 
 #include 
 #include "hwcontext_vaapi.h"
@@ -2248,10 +2250,13 @@ static int opencl_map_from_qsv(AVHWFramesContext 
*dst_fc, AVFrame *dst,
 cl_int cle;
 int err, p;
 
+#if CONFIG_LIBMFX
 if (src->format == AV_PIX_FMT_QSV) {
 mfxFrameSurface1 *mfx_surface = (mfxFrameSurface1*)src->data[3];
 va_surface = *(VASurfaceID*)mfx_surface->Data.MemId;
-} else if (src->format == AV_PIX_FMT_VAAPI) {
+} else
+#endif
+if (src->format == AV_PIX_FMT_VAAPI) {
 va_surface = (VASurfaceID)(uintptr_t)src->data[3];
 } else {
 return AVERROR(ENOSYS);
-- 
2.7.4

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


Re: [FFmpeg-devel] [GSOC] [PATCH] TensorFlow backend introduction for DNN module

2018-06-05 Thread Pedro Arthur
Pushed.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 4/4] avcodec/shorten: Fix multiple integer overflows

2018-06-05 Thread Michael Niedermayer
Fixes: signed integer overflow: 3 * 1006632960 cannot be represented in type 
'int'
Fixes: 
8278/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5692857166856192

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

diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 0bd3e1e5f7..18a12d0b97 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -389,7 +389,7 @@ static int decode_subframe_lpc(ShortenContext *s, int 
command, int channel,
 for (i = 0; i < s->blocksize; i++) {
 sum = init_sum;
 for (j = 0; j < pred_order; j++)
-sum += coeffs[j] * s->decoded[channel][i - j - 1];
+sum += coeffs[j] * (unsigned)s->decoded[channel][i - j - 1];
 s->decoded[channel][i] = get_sr_golomb_shorten(>gb, residual_size) +
  (sum >> qshift);
 }
@@ -700,7 +700,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void 
*data,
 
 /* update means with info from the current block */
 if (s->nmean > 0) {
-int32_t sum = (s->version < 2) ? 0 : s->blocksize / 2;
+int64_t sum = (s->version < 2) ? 0 : s->blocksize / 2;
 for (i = 0; i < s->blocksize; i++)
 sum += s->decoded[channel][i];
 
-- 
2.17.1

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


[FFmpeg-devel] [PATCH 3/4] avcodec/shorten: Fix undefined shift in fix_bitshift()

2018-06-05 Thread Michael Niedermayer
Fixes: left shift of negative value -9
Fixes: 
8571/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5715966875926528

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

diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index f7475b4954..0bd3e1e5f7 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -177,7 +177,7 @@ static void fix_bitshift(ShortenContext *s, int32_t *buffer)
 buffer[i] = 0;
 } else if (s->bitshift != 0) {
 for (i = 0; i < s->blocksize; i++)
-buffer[i] <<= s->bitshift;
+buffer[i] *= 1 << s->bitshift;
 }
 }
 
-- 
2.17.1

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


[FFmpeg-devel] [PATCH 1/4] avcodec/shorten: Sanity check nmeans

2018-06-05 Thread Michael Niedermayer
Fixes: OOM
Fixes: 
8195/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5179785826271232

The reference software appears to use longs for 32bits and it uses int for 
nmeans
hinting that the intended maximum size was not 32bit.

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

diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index ae0cdfe09d..8aeacfeb31 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -450,6 +450,10 @@ static int read_header(ShortenContext *s)
 return AVERROR_INVALIDDATA;
 }
 s->nmean = get_uint(s, 0);
+if (s->nmean > 32768U) {
+av_log(s->avctx, AV_LOG_ERROR, "nmean is: %d\n", s->nmean);
+return AVERROR_INVALIDDATA;
+}
 
 skip_bytes = get_uint(s, NSKIPSIZE);
 if ((unsigned)skip_bytes > get_bits_left(>gb)/8) {
-- 
2.17.1

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


[FFmpeg-devel] [PATCH 2/4] avcodec/shorten: Fix a negative left shift in shorten_decode_frame()

2018-06-05 Thread Michael Niedermayer
Fixes: left shift of negative value -9057
Fixes: 
8527/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5666853924896768

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

diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 8aeacfeb31..f7475b4954 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -710,7 +710,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void 
*data,
 if (s->version < 2)
 s->offset[channel][s->nmean - 1] = sum / s->blocksize;
 else
-s->offset[channel][s->nmean - 1] = s->bitshift == 32 ? 0 : 
(sum / s->blocksize) << s->bitshift;
+s->offset[channel][s->nmean - 1] = s->bitshift == 32 ? 0 : 
(sum / s->blocksize) * (1 << s->bitshift);
 }
 
 /* copy wrap samples for use with next block */
-- 
2.17.1

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


Re: [FFmpeg-devel] [PATCH 6/6] avformat/mxfdec: add support for recognizing timed text streams

2018-06-05 Thread Tomas Härdin
tor 2018-05-31 klockan 02:05 +0200 skrev Marton Balint:
> > Signed-off-by: Marton Balint 
> ---
>  libavformat/mxfdec.c | 8 
>  1 file changed, 8 insertions(+)
> 
> +type = avcodec_get_type(st->codecpar->codec_id);
> +if (type == AVMEDIA_TYPE_SUBTITLE)
> +st->codecpar->codec_type = type;

This feels like something that belongs in more generic parts of lavf.
Filling codecpar with defaults for some given codec_id that is.

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


Re: [FFmpeg-devel] [PATCH 5/6] avcodec/avcodec.h: add AV_CODEC_ID_TIMED_TEXT_MARKUP

2018-06-05 Thread Tomas Härdin
tor 2018-05-31 klockan 02:05 +0200 skrev Marton Balint:
> > Signed-off-by: Marton Balint 
> ---
>  libavcodec/avcodec.h| 1 +
>  libavcodec/codec_desc.c | 8 
>  libavcodec/version.h| 2 +-
>  3 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index fb0c6fae70..91ccef538e 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -665,6 +665,7 @@ enum AVCodecID {
>  AV_CODEC_ID_PJS,
>  AV_CODEC_ID_ASS,
>  AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
> +AV_CODEC_ID_TIMED_TEXT_MARKUP,

[...]

>  #define LIBAVCODEC_VERSION_MAJOR  58
>  #define LIBAVCODEC_VERSION_MINOR  19
> -#define LIBAVCODEC_VERSION_MICRO 104
> +#define LIBAVCODEC_VERSION_MICRO 105

Adding CODEC_IDs needs a minor version bump, not micro

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


Re: [FFmpeg-devel] [PATCH 4/6] avformat/mxfdec: remove check for NULL MXFTrack in mxf_set_pts

2018-06-05 Thread Tomas Härdin
tor 2018-05-31 klockan 02:05 +0200 skrev Marton Balint:
> It cannot happen for video streams.
> 
> > Signed-off-by: Marton Balint 
> ---
>  libavformat/mxfdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> index e80ef62d57..cf1cd71987 100644
> --- a/libavformat/mxfdec.c
> +++ b/libavformat/mxfdec.c
> @@ -3221,7 +3221,7 @@ static int mxf_set_pts(MXFContext *mxf, AVStream *st, 
> AVPacket *pkt, int64_t nex
>  if (mxf->nb_index_tables >= 1 && mxf->current_edit_unit < 
> t->nb_ptses) {
>  pkt->dts = mxf->current_edit_unit + t->first_dts;
>  pkt->pts = t->ptses[mxf->current_edit_unit];
> -} else if (track && track->intra_only) {
> +} else if (track->intra_only) {

I wonder what actually caused this check to be inserted. That is, what
could lead to track being NULL that is no longer the case?

/Tomas

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


Re: [FFmpeg-devel] [PATCH 3/6] avformat/mxfdec: only disallow seek on metadata streams

2018-06-05 Thread Tomas Härdin
tor 2018-05-31 klockan 02:05 +0200 skrev Marton Balint:
> > Signed-off-by: Marton Balint 
> ---
>  libavformat/mxfdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> index 3d8c8e204c..e80ef62d57 100644
> --- a/libavformat/mxfdec.c
> +++ b/libavformat/mxfdec.c
> @@ -3447,7 +3447,7 @@ static int mxf_read_seek(AVFormatContext *s, int 
> stream_index, int64_t sample_ti
>  MXFIndexTable *t;
>  MXFTrack *source_track = st->priv_data;
>  
> -if(st->codecpar->codec_type == AVMEDIA_TYPE_DATA)
> +if (!source_track)
>  return 0;

This catches all streams that don't have timecode tracks, right? That
would probably be the most general and Correct(tm) way to do it. So
SourceTrack implies no timecode so this is of course OK

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


Re: [FFmpeg-devel] [PATCH 2/6] avformat/mxfdec: recognize SMPTE 436 VBI data

2018-06-05 Thread Tomas Härdin
tor 2018-05-31 klockan 02:05 +0200 skrev Marton Balint:
> > Signed-off-by: Marton Balint 
> ---
>  libavformat/mxfdec.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> index 1099616174..3d8c8e204c 100644
> --- a/libavformat/mxfdec.c
> +++ b/libavformat/mxfdec.c
> @@ -1278,6 +1278,7 @@ static const MXFCodecUL 
> mxf_sound_essence_container_uls[] = {
>  };
>  
>  static const MXFCodecUL mxf_data_essence_container_uls[] = {
> +{ { 
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x09,0x0d,0x01,0x03,0x01,0x02,0x0d,0x00,0x00
>  }, 16, AV_CODEC_ID_NONE,  "vbi_smpte_436M" },
>  { { 
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x09,0x0d,0x01,0x03,0x01,0x02,0x0e,0x00,0x00
>  }, 16, AV_CODEC_ID_NONE, "vbi_vanc_smpte_436M" },
>  { { 
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
>  },  0, AV_CODEC_ID_NONE },
>  };
> @@ -2497,6 +2498,7 @@ static const MXFMetadataReadTableEntry 
> mxf_metadata_read_table[] = {
>  { { 
> 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x48,0x00
>  }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* Wave 
> */
>  { { 
> 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x47,0x00
>  }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* AES3 
> */
>  { { 
> 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x51,0x00
>  }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* 
> MPEG2VideoDescriptor */
> +{ { 
> 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x5b,0x00
>  }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* VBI 
> - SMPTE 436M */
>  { { 
> 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x5c,0x00
>  }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* 
> VANC/VBI - SMPTE 436M */
>  { { 
> 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x5e,0x00
>  }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* 
> MPEG2AudioDescriptor */
>  { { 
> 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x3A,0x00
>  }, mxf_read_track, sizeof(MXFTrack), Track }, /* Static Track */

Nice and simple :)

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


Re: [FFmpeg-devel] [PATCH 1/6] avformat/mxfdec: use MXFCodecUL struct to store essence description for data_essence_container_uls

2018-06-05 Thread Tomas Härdin
tor 2018-05-31 klockan 02:05 +0200 skrev Marton Balint:
> > Signed-off-by: Marton Balint 
> ---
>  libavformat/mxf.h|  1 +
>  libavformat/mxfdec.c | 16 
>  2 files changed, 5 insertions(+), 12 deletions(-)
> 
> diff --git a/libavformat/mxf.h b/libavformat/mxf.h
> index ffcc429a8b..19f8d8a9f5 100644
> --- a/libavformat/mxf.h
> +++ b/libavformat/mxf.h
> @@ -68,6 +68,7 @@ typedef struct MXFCodecUL {
>  UID uid;
>  unsigned matching_len;
>  int id;

Is "id" really needed now?

> +const char *desc;
>  } MXFCodecUL;
>  
>  typedef struct {
> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> index bd46572e48..1099616174 100644
> --- a/libavformat/mxfdec.c
> +++ b/libavformat/mxfdec.c
> @@ -1278,14 +1278,10 @@ static const MXFCodecUL 
> mxf_sound_essence_container_uls[] = {
>  };
>  
>  static const MXFCodecUL mxf_data_essence_container_uls[] = {
> -{ { 
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x09,0x0d,0x01,0x03,0x01,0x02,0x0e,0x00,0x00
>  }, 16, 0 },
> +{ { 
> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x09,0x0d,0x01,0x03,0x01,0x02,0x0e,0x00,0x00
>  }, 16, AV_CODEC_ID_NONE, "vbi_vanc_smpte_436M" },
>  { { 
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
>  },  0, AV_CODEC_ID_NONE },
>  };
>  
> -static const char * const mxf_data_essence_descriptor[] = {
> -"vbi_vanc_smpte_436M",
> -};
> -
>  static int mxf_get_sorted_table_segments(MXFContext *mxf, int 
> *nb_sorted_segments, MXFIndexTableSegment ***sorted_segments)
>  {
>  int i, j, nb_segments = 0;
> @@ -2354,13 +2350,9 @@ static int mxf_parse_structural_metadata(MXFContext 
> *mxf)
>  st->need_parsing = AVSTREAM_PARSE_FULL;
>  }
>  } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) {
> -int codec_id = mxf_get_codec_ul(mxf_data_essence_container_uls,
> -essence_container_ul)->id;
> -if (codec_id >= 0 &&
> -codec_id < FF_ARRAY_ELEMS(mxf_data_essence_descriptor)) {
> -av_dict_set(>metadata, "data_type",
> -mxf_data_essence_descriptor[codec_id], 0);
> -}
> +container_ul = mxf_get_codec_ul(mxf_data_essence_container_uls, 
> essence_container_ul);
> +if (container_ul->desc)
> +av_dict_set(>metadata, "data_type", container_ul->desc, 
> 0);
>  }
>  if (descriptor->extradata) {
>  if (!ff_alloc_extradata(st->codecpar, 
> descriptor->extradata_size)) {

Else it looks good

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


Re: [FFmpeg-devel] NVIDIA CUVID decoding issue.

2018-06-05 Thread Timo Rothenpieler


On 04.06.2018 12:27, Nánási Ferenc wrote:
> Hi!
> I'm trying to transcode H.264 Stream to HEVC. Everything just working
> fine when I'm using the in-built CPU decoder, but when I turn on the
> Hardware-accelerated CUVID module, it throws some error with most of my
> streams.
> *
> **FFMPEG CMDLINE: *
> /root/bin/ffmpeg -hwaccel cuvid  -c:v h264_cuvid -i
> 'udp://239.192.26.8:1234' -map 0:0:v -map 0:1:a -c:v hevc_nvenc -f
> mpegts test.ts
> 
> [h264_cuvid @ 0x3d2b800] Video height 14 not within range from 16 to 4096
> Error while opening decoder for input stream #0:0 : Invalid argument

Try nvdec instead, cuvid uses nvidias parsers, and if they go wrong,
there's nothing to be done about that from the ffmpeg side.

> My video height with all of streams is HD or PAL resolution, so probably
> within that range.
> stream #0:0 is the video stream.
> 
> I've tried to add -analyzeduration 10M -probesize 10M flags, the results
> same.
> 
> FFREPORT file: https://1drv.ms/u/s!AlIDARy55xh44F2f_8C1TyKwxA0t
> 
> *It says: *
> data partitioning is not implemented. Update your FFmpeg version to the
> newest one from Git. If the problem still occurs, it means that your
> file has a feature which has not been implemented.
> [h264 @ 0x31df240] If you want to help, upload a sample of this file to
> ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing
> list. (ffmpeg-devel@ffmpeg.org)
> 
> 
> Sample from input: https://1drv.ms/v/s!AlIDARy55xh44F7_i2Ak_q8bmTTF
> The output file is empty.
> 
> My FFMPEG version is the newest: 4.0
> *
> **FFMPEG compilation parameters:*
> --prefix=/root/ffmpeg_build --pkg-config-flags=--static
> --extra-cflags='-I/root/ffmpeg_build/include -I/usr/local/cuda/include'
> --extra-ldflags='-L/root/ffmpeg_build/lib -L/usr/local/cuda/lib64'
> --extra-libs=-lpthread --bindir=/root/bin --enable-gpl --enable-libass
> --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame
> --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx
> --enable-libx264 --enable-libx265 --enable-nonfree --enable-cuda
> --enable-cuvid --enable-nvenc --enable-libnpp
> 
> CUDA Version: 9.2 (Patch installed)

CUDA version is irrelevant, it's not used.

> NVIDIA Driver: 390.48
> Card: NVIDIA Quadro P2000
> 
> Using Ubuntu 17.10 and I've Centos 7  server with the same parameters.
> 
> If using something like this:
> /root/bin/ffmpeg -i 'udp://239.192.26.8:1234' -map 0:0:v -map 0:1:a -c:v
> hevc_nvenc -f mpegts udp://224.1.1.80:1234/ or file

Don't run stuff as root. Specially not streams from the net.



signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] mxfdec: fix NULL pointer dereference in mxf_read_packet_old

2018-06-05 Thread Tomas Härdin
ons 2018-05-30 klockan 23:26 +0200 skrev Marton Balint:
> 
> On Thu, 17 Nov 2016, Andreas Cadhalpun wrote:
> 
> > Metadata streams have priv_data set to NULL.
> > 
> > > > Signed-off-by: Andreas Cadhalpun 
> > ---
> > libavformat/mxfdec.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> > index a1a79ce..2ad0c28 100644
> > --- a/libavformat/mxfdec.c
> > +++ b/libavformat/mxfdec.c
> > @@ -3135,7 +3135,7 @@ static int mxf_read_packet_old(AVFormatContext *s, 
> > AVPacket *pkt)
> > if (mxf->nb_index_tables >= 1 && mxf->current_edit_unit < 
> > t->nb_ptses) {
> > pkt->dts = mxf->current_edit_unit + t->first_dts;
> > pkt->pts = t->ptses[mxf->current_edit_unit];
> > -} else if (track->intra_only) {
> > +} else if (track && track->intra_only) {
> > /* intra-only -> PTS = EditUnit.
> >  * let utils.c figure out DTS since it can be < PTS if 
> > low_delay = 0 (Sony IMX30) */
> > pkt->pts = mxf->current_edit_unit;
> 
> Was this patch really necessary? Because as far as I see, metadata streams 
> (which have priv_data set to NULL) always have a AVMEDIA_TYPE_DATA 
> st->codecpar->codec_type, and since this code calculates video pts, it 
> never encounters a NULL track.
> 
> So is it OK to revert?

Maybe? It doesn't really hurt, but it also makes it seem like track can be NULL

I really want static analysis on code like this...

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