Re: [FFmpeg-devel] [PATCH 1/5] avfilter/af_afade: fix crossfade duration maximum value

2018-10-01 Thread Paul B Mahol
On 9/30/18, Marton Balint  wrote:
> Signed-off-by: Marton Balint 
> ---
>  libavfilter/af_afade.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

Why?

Value is too big.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat: add H264 and HEVC support in IVF muxer

2018-10-01 Thread Paul B Mahol
On 9/30/18, Nicolas George  wrote:
> Paul B Mahol (2018-09-30):
>> > For consistency within a single function, an assert is the correct
>> > choice.
>> No, it is not. Asserts do not add any consistency.
>
> Asserts do not add consistency indeed. Their purpose is to check
> consistency, which is exactly what needs testing here: the consistency
> between the preliminary test and the later switch statement.
>
> If you want to argue for AVERROR_BUG, please give arguments.

Same is given with AVERROR_BUG, instead of hard crashing with assert, which is
very unprofessional.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/5] avfilter/af_afade: fix crossfade duration maximum value

2018-10-01 Thread Marton Balint



On Mon, 1 Oct 2018, Paul B Mahol wrote:


On 9/30/18, Marton Balint  wrote:

Signed-off-by: Marton Balint 
---
 libavfilter/af_afade.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



Why?

Value is too big.


AV_OPT_TYPE_DURATION is microsecond precision, therefore 60 is 60 usecs. 
Probably you meant 60 seconds as limit. That is what the patch fixes.


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


Re: [FFmpeg-devel] [PATCH 1/5] avfilter/af_afade: fix crossfade duration maximum value

2018-10-01 Thread Marton Balint



On Mon, 1 Oct 2018, Gyan wrote:


On Mon, Oct 1, 2018 at 2:15 AM Marton Balint  wrote:



+{ "duration", "set cross fade duration",
 OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, 6000,
FLAGS },
+{ "d","set cross fade duration",
 OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, 6000,
FLAGS },



What's the rationale for this non-standard value?


Maybe Paul can answer this.

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


Re: [FFmpeg-devel] [PATCH 1/5] avfilter/af_afade: fix crossfade duration maximum value

2018-10-01 Thread Paul B Mahol
On 10/1/18, Marton Balint  wrote:
>
>
> On Mon, 1 Oct 2018, Paul B Mahol wrote:
>
>> On 9/30/18, Marton Balint  wrote:
>>> Signed-off-by: Marton Balint 
>>> ---
>>>  libavfilter/af_afade.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>
>> Why?
>>
>> Value is too big.
>
> AV_OPT_TYPE_DURATION is microsecond precision, therefore 60 is 60 usecs.
> Probably you meant 60 seconds as limit. That is what the patch fixes.

I do not think so. Duration is interpreted as seconds, look how
variable is used in code.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat: add H264 and HEVC support in IVF muxer

2018-10-01 Thread Nicolas George
Paul B Mahol (2018-10-01):
> Same is given with AVERROR_BUG, instead of hard crashing with assert, which is
> very unprofessional.

A program crashing seems very professional to me. The most professional
program ever, windows, has a long history of crashing. Fortunately,
FFmpeg is not a professional project, we can afford to do things
properly.

A program that crashes is sloppy, indeed. Assert failures are bad. But
AVERROR_BUG is just as bad. It should not happen after commit either.
Therefore, this is not an argument to choose one over the other.

Regards,

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


Re: [FFmpeg-devel] [PATCH] lavfi/vf_colorconstancy: add weighted_greyedge

2018-10-01 Thread Moritz Barsnick
> +The standard deviation of Gaussian blur to be applied on the scene. Must be
 ^ to

> +The power applied to the weight map to emphasis heigher weights. Must be 
> chosen
  ^ emphasize

> +The angular error threshold in degrees for stoping the algorithm. Must be 
> chosen
  ^ stopping

> + * @cite
> + *  J. van de Weijer, Th. Gevers, and J. Geusebroek,
> + * ???Edge and corner detection by photometric quasi-invariants???.
  ^^^
You should fix the quotation marks here.

> - * @return 0 in case of success, a negative value corresponding to an
> - * AVERROR code in case of failure.
> + * @return 0.
>   */
> -static int filter_grey_edge(AVFilterContext *ctx, AVFrame *in)
> +static int filter_slice_weighted_grey_edge(AVFilterContext* ctx, void* arg, 
> int jobnr, int nb_jobs)

If it only ever returns 0, you can probably make it void - unless it
will be expanded later to require a return code.

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


Re: [FFmpeg-devel] [PATCH] avformat: add H264 and HEVC support in IVF muxer

2018-10-01 Thread Paul B Mahol
On 10/1/18, Nicolas George  wrote:
> Paul B Mahol (2018-10-01):
>> Same is given with AVERROR_BUG, instead of hard crashing with assert,
>> which is
>> very unprofessional.
>
> A program crashing seems very professional to me. The most professional
> program ever, windows, has a long history of crashing. Fortunately,
> FFmpeg is not a professional project, we can afford to do things
> properly.
>
> A program that crashes is sloppy, indeed. Assert failures are bad. But
> AVERROR_BUG is just as bad. It should not happen after commit either.
> Therefore, this is not an argument to choose one over the other.

I lost motivation to feed more.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] lavu/qsv: fix a random hwupload failure regression

2018-10-01 Thread Maxym Dmytrychenko
On Sun, Sep 30, 2018 at 11:14 AM Zhong Li  wrote:

> Variable 'ret' hasn't been initialized,thus introducing a random
> hwupload failure regression due to qsv session uninitialized.
>
> Signed-off-by: Zhong Li 
> ---
>  libavutil/hwcontext_qsv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
> index cb3e184..33e121b 100644
> --- a/libavutil/hwcontext_qsv.c
> +++ b/libavutil/hwcontext_qsv.c
> @@ -861,7 +861,7 @@ static int qsv_transfer_data_to(AVHWFramesContext
> *ctx, AVFrame *dst,
>
>  mfxSyncPoint sync = NULL;
>  mfxStatus err;
> -int ret;
> +int ret = 0;
>
>  while (!s->session_upload_init && !s->session_upload && !ret) {
>  #if HAVE_PTHREADS
> --
> 2.7.4
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



LGTM

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


Re: [FFmpeg-devel] [PATCH 2/2] lavu/qsv: make a copy as libmfx alignment requirement for uploading

2018-10-01 Thread Maxym Dmytrychenko
On Sun, Sep 30, 2018 at 11:14 AM Zhong Li  wrote:

> Libmfx requires 16 bytes aligned input/output for uploading.
> Currently only output is 16 byte aligned and assigning same width/height to
> input with smaller buffer size actually, thus definitely will cause
> segment fault.
>
> Can reproduce with any 1080p nv12 rawvideo input:
> ffmpeg -init_hw_device qsv=qsv:hw -hwaccel qsv -filter_hw_device qsv -f
> rawvideo -pix_fmt nv12 -s:v 1920x1080
> -i 1080p_nv12.yuv -vf
> 'format=nv12,hwupload=extra_hw_frames=16,hwdownload,format=nv12' -an -y
> out_nv12.yuv
>
> It can fix #7418
>
> Signed-off-by: Zhong Li 
> ---
>  libavutil/hwcontext_qsv.c | 31 +--
>  1 file changed, 29 insertions(+), 2 deletions(-)
>
> diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
> index 33e121b..3039cfa 100644
> --- a/libavutil/hwcontext_qsv.c
> +++ b/libavutil/hwcontext_qsv.c
> @@ -862,6 +862,10 @@ static int qsv_transfer_data_to(AVHWFramesContext
> *ctx, AVFrame *dst,
>  mfxSyncPoint sync = NULL;
>  mfxStatus err;
>  int ret = 0;
> +/* make a copy if the input is not padded as libmfx requires */
> +AVFrame tmp_frame, *src_frame;
> +int realigned = 0;
> +
>
>  while (!s->session_upload_init && !s->session_upload && !ret) {
>  #if HAVE_PTHREADS
> @@ -887,16 +891,36 @@ static int qsv_transfer_data_to(AVHWFramesContext
> *ctx, AVFrame *dst,
>  if (ret < 0)
>  return ret;
>
> +
> +if (src->height & 16 || src->linesize[0] & 16) {
> +realigned = 1;
> +memset(&tmp_frame, 0, sizeof(tmp_frame));
> +tmp_frame.format = src->format;
> +tmp_frame.width  = FFALIGN(src->width, 16);
> +tmp_frame.height = FFALIGN(src->height, 16);
> +ret = av_frame_get_buffer(&tmp_frame, 32);
> +if (ret < 0)
> +return ret;
> +
> +ret = av_frame_copy(&tmp_frame, src);
> +if (ret < 0) {
> +av_frame_unref(&tmp_frame);
> +return ret;
> +}
> +}
> +
> +src_frame = realigned ? &tmp_frame : src;
> +
>  if (!s->session_upload) {
>  if (s->child_frames_ref)
> -return qsv_transfer_data_child(ctx, dst, src);
> +return qsv_transfer_data_child(ctx, dst, src_frame);
>
>  av_log(ctx, AV_LOG_ERROR, "Surface upload not possible\n");
>  return AVERROR(ENOSYS);
>  }
>
>  in.Info = out->Info;
> -map_frame_to_surface(src, &in);
> +map_frame_to_surface(src_frame, &in);
>
>  do {
>  err = MFXVideoVPP_RunFrameVPPAsync(s->session_upload, &in, out,
> NULL, &sync);
> @@ -917,6 +941,9 @@ static int qsv_transfer_data_to(AVHWFramesContext
> *ctx, AVFrame *dst,
>  return AVERROR_UNKNOWN;
>  }
>
> +if (realigned)
> +av_frame_unref(&tmp_frame);
> +
>  return 0;
>  }
>
> --
> 2.7.4
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


LGTM

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


Re: [FFmpeg-devel] [PATCH 1/2] avfilter/filters: add ff_inlink_peek_frame and ff_inlink_queued_frames to access frames in the inlink fifo

2018-10-01 Thread Nicolas George
Marton Balint (2018-09-30):
> Signed-off-by: Marton Balint 
> ---
>  libavfilter/avfilter.c | 13 +
>  libavfilter/filters.h  | 14 ++
>  2 files changed, 27 insertions(+)
> 
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index 85eff0aa1d..9e4b8e5ca3 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -1448,6 +1448,11 @@ int ff_inlink_acknowledge_status(AVFilterLink *link, 
> int *rstatus, int64_t *rpts
>  return 1;
>  }
>  
> +size_t ff_inlink_queued_frames(AVFilterLink *link)
> +{
> +return ff_framequeue_queued_frames(&link->fifo);
> +}
> +
>  int ff_inlink_check_available_frame(AVFilterLink *link)
>  {
>  return ff_framequeue_queued_frames(&link->fifo) > 0;
> @@ -1507,6 +1512,14 @@ int ff_inlink_consume_samples(AVFilterLink *link, 
> unsigned min, unsigned max,
>  return 1;
>  }
>  
> +AVFrame *ff_inlink_peek_frame(AVFilterLink *link, size_t idx)
> +{
> +   if (ff_framequeue_queued_frames(&link->fifo) > idx)
> +   return ff_framequeue_peek(&link->fifo, idx);
> +   else
> +   return NULL;
> +}
> +
>  int ff_inlink_make_frame_writable(AVFilterLink *link, AVFrame **rframe)
>  {
>  AVFrame *frame = *rframe;
> diff --git a/libavfilter/filters.h b/libavfilter/filters.h
> index 4e2652ebe5..b310f1c5a8 100644
> --- a/libavfilter/filters.h
> +++ b/libavfilter/filters.h
> @@ -60,6 +60,12 @@ int ff_inlink_process_commands(AVFilterLink *link, const 
> AVFrame *frame);
>   */
>  int ff_inlink_evaluate_timeline_at_frame(AVFilterLink *link, const AVFrame 
> *frame);
>  
> +/**
> + * Get the number of frames available on the link.
> + * @return the number of frames available in the link fifo.
> + */
> +size_t ff_inlink_queued_frames(AVFilterLink *link);
> +
>  /**
>   * Test if a frame is available on the link.
>   * @return  >0 if a frame is available
> @@ -102,6 +108,14 @@ int ff_inlink_consume_frame(AVFilterLink *link, AVFrame 
> **rframe);
>  int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max,
>  AVFrame **rframe);
>  
> +/**

> + * Access a frame in the link fifo without consuming it.
> + * The first frame is numbered 0.
> + * @return the frame at idx position in the link fifo, NULL if idx is greater
> + * or equal to the fifo size.

I would like it better if the behaviour would match the wrapped
behaviour more closely:

 * The first frame is numbered 0; the designated frame must exist.

But we can discuss it.

> + */
> +AVFrame *ff_inlink_peek_frame(AVFilterLink *link, size_t idx);
> +
>  /**
>   * Make sure a frame is writable.
>   * This is similar to av_frame_make_writable() except it uses the link's

Apart from that, LGTM.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH 2/2] avfilter/f_cue: use inlink fifo for queueing frames

2018-10-01 Thread Nicolas George
Marton Balint (2018-09-30):
> Signed-off-by: Marton Balint 
> ---
>  libavfilter/f_cue.c | 87 
> ++---
>  1 file changed, 29 insertions(+), 58 deletions(-)

LGTM.

It would have been slightly easier to read with symbolic constants for
status, but that is unrelated.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] lavfi/vf_colorconstancy: add weighted_greyedge

2018-10-01 Thread Mina



On 10/01/2018 12:24 PM, Moritz Barsnick wrote:

+The standard deviation of Gaussian blur to be applied on the scene. Must be

  ^ to



Done.


+The power applied to the weight map to emphasis heigher weights. Must be chosen

   ^ emphasize


British spelling but done.


+The angular error threshold in degrees for stoping the algorithm. Must be 
chosen

   ^ stopping



Done.


+ * @cite
+ *  J. van de Weijer, Th. Gevers, and J. Geusebroek,
+ * ???Edge and corner detection by photometric quasi-invariants???.

   ^^^
You should fix the quotation marks here.


Done.


- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR code in case of failure.
+ * @return 0.
   */
-static int filter_grey_edge(AVFilterContext *ctx, AVFrame *in)
+static int filter_slice_weighted_grey_edge(AVFilterContext* ctx, void* arg, 
int jobnr, int nb_jobs)

If it only ever returns 0, you can probably make it void - unless it
will be expanded later to require a return code.


AVFilterInternal::execute expects such type of the function.



Moritz
___
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 v2] lavfi/vf_colorconstancy: add weighted_greyedge

2018-10-01 Thread Mina

Hi,

  This patch was part of GSoC Color Constancy filter. It introduces an 
improved color constancy filter(weighted_greyedge) based on the already 
pushed greyedge. I'm sending it again after updating it against latest 
version of master.


V2 changes:
- fixed some spelling mistakes in filters.texi
- fixed some text format error in filters.texi


Regards,
Mina Sami

>From 158159a2137d104763875718f1c217c472b12fa5 Mon Sep 17 00:00:00 2001
From: Mina 
Date: Mon, 1 Oct 2018 18:06:41 +0200
Subject: [PATCH] lavfi/vf_colorconstancy: add weighted_greyedge

Signed-off-by: Mina 
---
 doc/filters.texi|  39 
 libavfilter/Makefile|   1 +
 libavfilter/allfilters.c|   1 +
 libavfilter/vf_colorconstancy.c | 322 
 4 files changed, 288 insertions(+), 75 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 6d3833317e..d2b0ef024b 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -17526,6 +17526,45 @@ separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
 @end example
 @end itemize
 
+@section weighted_greyedge
+A color constancy variation filter which estimates scene illumination via weighted grey edge
+algorithm and corrects the scene colors accordingly.
+
+See: @url{http://refbase.cvc.uab.es/files/GGW2012.pdf}
+
+The filter accepts the following options:
+
+@table @option
+@item minknorm
+The Minkowski parameter to be used for calculating the Minkowski distance. Must
+be chosen in the range [1,20] and default value is 1.
+
+@item sigma
+The standard deviation of Gaussian blur to be applied to the scene. Must be
+chosen in the range [0.2,1024.0] and default value = 1.
+
+@item wmap_k
+The power applied to the weight map to emphasize heigher weights. Must be chosen
+in the range [1,20] and default value = 2.
+
+@item iters
+The max number of iterations for performing the algorithm. Must be chosen in the
+range [1,20] and default value = 5.
+
+@item angerr
+The angular error threshold in degrees for stopping the algorithm. Must be chosen
+in the range [0,360] and default value = 0.001.
+@end table
+
+@subsection Examples
+@itemize
+
+@item
+@example
+weighted_greyedge=minknorm=5:sigma=2:wmap_k=10:iters=10:angerr=0.0005
+@end example
+@end itemize
+
 @section xbr
 Apply the xBR high-quality magnification filter which is designed for pixel
 art. It follows a set of edge-detection rules, see
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 62cc2f561f..f9626d4e16 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -400,6 +400,7 @@ OBJS-$(CONFIG_VSTACK_FILTER) += vf_stack.o framesync.o
 OBJS-$(CONFIG_W3FDIF_FILTER) += vf_w3fdif.o
 OBJS-$(CONFIG_WAVEFORM_FILTER)   += vf_waveform.o
 OBJS-$(CONFIG_WEAVE_FILTER)  += vf_weave.o
+OBJS-$(CONFIG_WEIGHTED_GREYEDGE_FILTER)  += vf_colorconstancy.o
 OBJS-$(CONFIG_XBR_FILTER)+= vf_xbr.o
 OBJS-$(CONFIG_YADIF_FILTER)  += vf_yadif.o
 OBJS-$(CONFIG_ZMQ_FILTER)+= f_zmq.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 5e72803b13..095da84151 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -381,6 +381,7 @@ extern AVFilter ff_vf_vstack;
 extern AVFilter ff_vf_w3fdif;
 extern AVFilter ff_vf_waveform;
 extern AVFilter ff_vf_weave;
+extern AVFilter ff_vf_weighted_greyedge;
 extern AVFilter ff_vf_xbr;
 extern AVFilter ff_vf_yadif;
 extern AVFilter ff_vf_zmq;
diff --git a/libavfilter/vf_colorconstancy.c b/libavfilter/vf_colorconstancy.c
index e3bb39e51b..28b466f89a 100644
--- a/libavfilter/vf_colorconstancy.c
+++ b/libavfilter/vf_colorconstancy.c
@@ -26,6 +26,14 @@
  *
  * @cite
  * J. van de Weijer, Th. Gevers, A. Gijsenij "Edge-Based Color Constancy".
+ *
+ * @cite
+ *  J. van de Weijer, Th. Gevers, and J. Geusebroek,
+ * "Edge and corner detection by photometric quasi-invariants".
+ *
+ * @cite
+ * A. Gijsenij, Th. Gevers, J. van de Weijer,
+ * "Improving Color Constancy by Photometric Edge Weighting".
  */
 
 #include "libavutil/imgutils.h"
@@ -39,7 +47,8 @@
 
 #include 
 
-#define GREY_EDGE "greyedge"
+#define GREY_EDGE  "greyedge"
+#define WEIGHTED_GREY_EDGE "weighted_greyedge"
 
 #define SQRT3 1.73205080757
 
@@ -79,6 +88,10 @@ typedef struct ColorConstancyContext {
 int minknorm; /**< @minknorm = 0 : getMax instead */
 double sigma;
 
+int wmap_k;
+int iters;
+double angerr_thresh;
+
 int nb_threads;
 int planeheight[4];
 int planewidth[4];
@@ -477,53 +490,73 @@ static int filter_slice_grey_edge(AVFilterContext* ctx, void* arg, int jobnr, in
 }
 
 /**
- * Main control function for grey edge algorithm.
+ * Slice function for weighted grey edge algorithm that is called iteratively to
+ * calculate and apply weight scheme.
  *
  * @param ctx the filter context.
- * @param in frame to perfrom grey edge on.
+ * @param arg data to be passed between threads.
+ * @param jobnr cur

Re: [FFmpeg-devel] [PATCH 1/5] avfilter/af_afade: fix crossfade duration maximum value

2018-10-01 Thread Marton Balint



On Mon, 1 Oct 2018, Paul B Mahol wrote:


On 10/1/18, Marton Balint  wrote:



On Mon, 1 Oct 2018, Paul B Mahol wrote:


On 9/30/18, Marton Balint  wrote:

Signed-off-by: Marton Balint 
---
 libavfilter/af_afade.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



Why?

Value is too big.


AV_OPT_TYPE_DURATION is microsecond precision, therefore 60 is 60 usecs.
Probably you meant 60 seconds as limit. That is what the patch fixes.


I do not think so. Duration is interpreted as seconds, look how
variable is used in code.


As far as I see duration is rescaled from AV_TIME_BASE (microseconds) to 
sample_rate time base:


if (s->duration)
 s->nb_samples = av_rescale(s->duration, outlink->sample_rate, 
AV_TIME_BASE);

Duration is parsed as seconds (can be fractional as well), but internally 
it is stored as microseconds (int64). Another example is the f_realtime 
filter where the sleep time limit default according to the documentation 
is 2 seconds and it is expressed as 200 in the code.


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


Re: [FFmpeg-devel] [PATCH 1/5] avfilter/af_afade: fix crossfade duration maximum value

2018-10-01 Thread Paul B Mahol
On 10/1/18, Marton Balint  wrote:
>
>
> On Mon, 1 Oct 2018, Paul B Mahol wrote:
>
>> On 10/1/18, Marton Balint  wrote:
>>>
>>>
>>> On Mon, 1 Oct 2018, Paul B Mahol wrote:
>>>
 On 9/30/18, Marton Balint  wrote:
> Signed-off-by: Marton Balint 
> ---
>  libavfilter/af_afade.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

 Why?

 Value is too big.
>>>
>>> AV_OPT_TYPE_DURATION is microsecond precision, therefore 60 is 60 usecs.
>>> Probably you meant 60 seconds as limit. That is what the patch fixes.
>>
>> I do not think so. Duration is interpreted as seconds, look how
>> variable is used in code.
>
> As far as I see duration is rescaled from AV_TIME_BASE (microseconds) to
> sample_rate time base:
>
> if (s->duration)
>   s->nb_samples = av_rescale(s->duration, outlink->sample_rate,
> AV_TIME_BASE);
>
> Duration is parsed as seconds (can be fractional as well), but internally
> it is stored as microseconds (int64). Another example is the f_realtime
> filter where the sleep time limit default according to the documentation
> is 2 seconds and it is expressed as 200 in the code.

Yes, and current patch is wrong. Simply exceding max value is not proper fix.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/matroskaenc: add reserve free space option

2018-10-01 Thread James Almer
On 9/26/2018 10:45 AM, Dave Rice wrote:
> 
>> On Sep 12, 2018, at 11:56 AM, Sigríður Regína Sigurþórsdóttir 
>>  wrote:
>>
>> On Thu, Sep 6, 2018 at 3:31 PM James Almer > > wrote:
>>>
>>> On 9/6/2018 4:18 PM, James Darnley wrote:
 On 2018-09-06 19:39, Sigríður Regína Sigurþórsdóttir wrote:
> +if (s->metadata_header_padding) {
> +if (s->metadata_header_padding == 1)
> +s->metadata_header_padding++;
> +put_ebml_void(pb, s->metadata_header_padding);
> +}

 Unfortunately I was forced to make the default -1 so you want to check
 that the value is greater than 0 rather than just true.

 Furthermore I think you will still want to add to Changelog making a
 note that the matroska muxer will now listen to metadata_header_padding.
>>>
>>> No, this kind of change doesn't justify a Changelog entry as mentioned
>>> before.
>>>
 That may also want a micro version bump so that library users can check.
>>>
>>> Micro version bump is ok.
>>
>>
>> Thank you.
>>
>> Here is an updated patch with a bump and a change to make sure the value is 
>> > 0.
>>
>>
>>
>> From 08e140fa0b23274a4db18ce0b201e45fe7c1ac97 Mon Sep 17 00:00:00 2001
>> From: Sigga Regina mailto:siggareg...@gmail.com>>
>> Date: Wed, 12 Sep 2018 11:47:47 -0400
>> Subject: [PATCH] avformat/matroskaenc: add reserve free space option
>>
>> ---
>> libavformat/matroskaenc.c | 5 +
>> libavformat/version.h | 2 +-
>> 2 files changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
>> index 09a62e1..3f5febf 100644
>> --- a/libavformat/matroskaenc.c
>> +++ b/libavformat/matroskaenc.c
>> @@ -2005,6 +2005,11 @@ static int mkv_write_header(AVFormatContext *s)
>> ret = AVERROR(ENOMEM);
>> goto fail;
>> }
>> +if (s->metadata_header_padding > 0) {
>> +  if (s->metadata_header_padding == 1)
>> +s->metadata_header_padding++;
>> +  put_ebml_void(pb, s->metadata_header_padding);
>> +}
>> if ((pb->seekable & AVIO_SEEKABLE_NORMAL) && mkv->reserve_cues_space) {
>> mkv->cues_pos = avio_tell(pb);
>> if (mkv->reserve_cues_space == 1)
>> diff --git a/libavformat/version.h b/libavformat/version.h
>> index 4d21583..d7a1a35 100644
>> --- a/libavformat/version.h
>> +++ b/libavformat/version.h
>> @@ -33,7 +33,7 @@
>> // Also please add any ticket numbers that you believe might be affected here
>> #define LIBAVFORMAT_VERSION_MAJOR  58
>> #define LIBAVFORMAT_VERSION_MINOR  18
>> -#define LIBAVFORMAT_VERSION_MICRO 100
>> +#define LIBAVFORMAT_VERSION_MICRO 101
>>
>> #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
>>LIBAVFORMAT_VERSION_MINOR, \
>> -- 
>> 2.10.1 (Apple Git-78)
>> <0001-avformat-matroskaenc-add-reserve-free-space-option 
>> (1).patch>___
> 
> ping on this, as reserving such space in Matroska headers for later edits to 
> the Tracks element would be helpful.
> Dave Rice

Pushed. Sorry for the delay.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2] avcodec: libdav1d AV1 decoder wrapper.

2018-10-01 Thread Kyle Swanson
Hi,

On Sun, Sep 30, 2018 at 5:08 PM James Almer  wrote:

> From: Ronald S. Bultje 
>
> Originally written by Ronald S. Bultje, with fixes, optimizations and
> improvements by James Almer.
>
> Signed-off-by: James Almer 
> ---
> Updated with some refactoring and to use a few new public facing fields
> recently introduced.
>
> The API is unstable and in constant development, and it's not going to be
> frozen until a release is made, so I'm not sure if it's a good idea to push
> this before ffmpeg 4.1 is tagged.
>
>  configure  |   4 +
>  libavcodec/Makefile|   1 +
>  libavcodec/allcodecs.c |   1 +
>  libavcodec/libdav1d.c  | 273 +
>  4 files changed, 279 insertions(+)
>  create mode 100644 libavcodec/libdav1d.c
>

Not a review, but I was able to successfully build and decode.

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


[FFmpeg-devel] [PATCH] avformat: add H264 and HEVC support in IVF muxer

2018-10-01 Thread alx . sukhanov
From: Alex Sukhanov 

---
 libavformat/ivfenc.c | 50 +---
 1 file changed, 38 insertions(+), 12 deletions(-)

diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
index 66441a2a43..6410828533 100644
--- a/libavformat/ivfenc.c
+++ b/libavformat/ivfenc.c
@@ -36,19 +36,29 @@ static int ivf_write_header(AVFormatContext *s)
 return AVERROR(EINVAL);
 }
 par = s->streams[0]->codecpar;
-if (par->codec_type != AVMEDIA_TYPE_VIDEO ||
-!(par->codec_id == AV_CODEC_ID_AV1 ||
-  par->codec_id == AV_CODEC_ID_VP8 ||
-  par->codec_id == AV_CODEC_ID_VP9)) {
-av_log(s, AV_LOG_ERROR, "Currently only VP8, VP9 and AV1 are 
supported!\n");
-return AVERROR(EINVAL);
-}
 avio_write(pb, "DKIF", 4);
 avio_wl16(pb, 0); // version
 avio_wl16(pb, 32); // header length
-avio_wl32(pb,
-  par->codec_id == AV_CODEC_ID_VP9 ? AV_RL32("VP90") :
-  par->codec_id == AV_CODEC_ID_VP8 ? AV_RL32("VP80") : 
AV_RL32("AV01"));
+switch (par->codec_id) {
+  case AV_CODEC_ID_AV1:
+avio_wl32(pb, AV_RL32("AV01"));
+break;
+  case AV_CODEC_ID_H264:
+avio_wl32(pb, AV_RL32("H264"));
+break;
+  case AV_CODEC_ID_HEVC:
+avio_wl32(pb, AV_RL32("HEVC"));
+break;
+  case AV_CODEC_ID_VP8:
+avio_wl32(pb, AV_RL32("VP80"));
+break;
+  case AV_CODEC_ID_VP9:
+avio_wl32(pb, AV_RL32("VP90"));
+break;
+  default:
+av_log(s, AV_LOG_ERROR, "Currently only AV1, H264, HEVC, VP8 and VP9 
and AV1 are supported!\n");
+return AVERROR(EINVAL);
+}
 avio_wl16(pb, par->width);
 avio_wl16(pb, par->height);
 avio_wl32(pb, s->streams[0]->time_base.den);
@@ -95,16 +105,32 @@ static int ivf_check_bitstream(struct AVFormatContext *s, 
const AVPacket *pkt)
 int ret = 1;
 AVStream *st = s->streams[pkt->stream_index];
 
-if (st->codecpar->codec_id == AV_CODEC_ID_VP9)
+if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
+if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x001 &&
+ (AV_RB24(pkt->data) != 0x01 ||
+  (st->codecpar->extradata_size > 0 &&
+   st->codecpar->extradata[0] == 1)))
+ret = ff_stream_add_bitstream_filter(st, "h264_mp4toannexb", NULL);
+} else if (st->codecpar->codec_id == AV_CODEC_ID_HEVC) {
+if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x001 &&
+ (AV_RB24(pkt->data) != 0x01 ||
+  (st->codecpar->extradata_size > 0 &&
+   st->codecpar->extradata[0] == 1)))
+ret = ff_stream_add_bitstream_filter(st, "hevc_mp4toannexb", NULL);
+} else if (st->codecpar->codec_id == AV_CODEC_ID_VP9) {
 ret = ff_stream_add_bitstream_filter(st, "vp9_superframe", NULL);
+}
 
 return ret;
 }
 
 static const AVCodecTag codec_ivf_tags[] = {
+{ AV_CODEC_ID_AV1,  MKTAG('A', 'V', '0', '1') },
+{ AV_CODEC_ID_H264, MKTAG('H', '2', '6', '4') },
+{ AV_CODEC_ID_HEVC, MKTAG('H', 'E', 'V', 'C') },
 { AV_CODEC_ID_VP8,  MKTAG('V', 'P', '8', '0') },
 { AV_CODEC_ID_VP9,  MKTAG('V', 'P', '9', '0') },
-{ AV_CODEC_ID_AV1,  MKTAG('A', 'V', '0', '1') },
+
 { AV_CODEC_ID_NONE, 0 }
 };
 
-- 
2.19.0.605.g01d371f741-goog

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


Re: [FFmpeg-devel] [PATCH 1/5] avfilter/af_afade: fix crossfade duration maximum value

2018-10-01 Thread Marton Balint



On Mon, 1 Oct 2018, Paul B Mahol wrote:


On 10/1/18, Marton Balint  wrote:



On Mon, 1 Oct 2018, Paul B Mahol wrote:


On 10/1/18, Marton Balint  wrote:



On Mon, 1 Oct 2018, Paul B Mahol wrote:


On 9/30/18, Marton Balint  wrote:

Signed-off-by: Marton Balint 
---
 libavfilter/af_afade.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



Why?

Value is too big.


AV_OPT_TYPE_DURATION is microsecond precision, therefore 60 is 60 usecs.
Probably you meant 60 seconds as limit. That is what the patch fixes.


I do not think so. Duration is interpreted as seconds, look how
variable is used in code.


As far as I see duration is rescaled from AV_TIME_BASE (microseconds) to
sample_rate time base:

if (s->duration)
  s->nb_samples = av_rescale(s->duration, outlink->sample_rate,
AV_TIME_BASE);

Duration is parsed as seconds (can be fractional as well), but internally
it is stored as microseconds (int64). Another example is the f_realtime
filter where the sleep time limit default according to the documentation
is 2 seconds and it is expressed as 200 in the code.


Yes, and current patch is wrong. Simply exceding max value is not proper fix.


What is the proper fix then?

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


Re: [FFmpeg-devel] [PATCH 1/5] avfilter/af_afade: fix crossfade duration maximum value

2018-10-01 Thread Paul B Mahol
On 10/1/18, Marton Balint  wrote:
>
>
> On Mon, 1 Oct 2018, Paul B Mahol wrote:
>
>> On 10/1/18, Marton Balint  wrote:
>>>
>>>
>>> On Mon, 1 Oct 2018, Paul B Mahol wrote:
>>>
 On 10/1/18, Marton Balint  wrote:
>
>
> On Mon, 1 Oct 2018, Paul B Mahol wrote:
>
>> On 9/30/18, Marton Balint  wrote:
>>> Signed-off-by: Marton Balint 
>>> ---
>>>  libavfilter/af_afade.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>
>> Why?
>>
>> Value is too big.
>
> AV_OPT_TYPE_DURATION is microsecond precision, therefore 60 is 60
> usecs.
> Probably you meant 60 seconds as limit. That is what the patch fixes.

 I do not think so. Duration is interpreted as seconds, look how
 variable is used in code.
>>>
>>> As far as I see duration is rescaled from AV_TIME_BASE (microseconds) to
>>> sample_rate time base:
>>>
>>> if (s->duration)
>>>   s->nb_samples = av_rescale(s->duration, outlink->sample_rate,
>>> AV_TIME_BASE);
>>>
>>> Duration is parsed as seconds (can be fractional as well), but internally
>>> it is stored as microseconds (int64). Another example is the f_realtime
>>> filter where the sleep time limit default according to the documentation
>>> is 2 seconds and it is expressed as 200 in the code.
>>
>> Yes, and current patch is wrong. Simply exceding max value is not proper
>> fix.
>
> What is the proper fix then?

Interpreting duration correctly, like trim filters do.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat: add H264 and HEVC support in IVF muxer

2018-10-01 Thread Alex Sukhanov
On Sun, Sep 30, 2018 at 2:09 PM Jan Ekström  wrote:

> Sn Sun, Sep 30, 2018 at 8:56 PM  wrote:
> >
> >  ...
> > +if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
> > +if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x001 &&
> > + (AV_RB24(pkt->data) != 0x01 ||
> > +  (st->codecpar->extradata_size > 0 &&
> > +   st->codecpar->extradata[0] == 1)))
> > +ret = ff_stream_add_bitstream_filter(st,
> "h264_mp4toannexb", NULL);
> > +} else if (st->codecpar->codec_id == AV_CODEC_ID_HEVC) {
> > +if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x001 &&
> > + (AV_RB24(pkt->data) != 0x01 ||
> > +  (st->codecpar->extradata_size > 0 &&
> > +   st->codecpar->extradata[0] == 1)))
> > +ret = ff_stream_add_bitstream_filter(st,
> "hevc_mp4toannexb", NULL);
>
> Please verify that there is no AVCc/Annex B deciding helper function
> within lavf/lavc that could be used here. I tried to ask about this on
> IRC but didn't get responses so I can't straight up note you a
> function name. If there's none, then it might be worth making a lavf
> helper for that since I think at least movenc/matroskaenc try to
> figure out if the input bit stream is Annex B and convert it the other
> way.
>
> Additionally, please make sure that the files created with these
> changes can be demuxed with the FFmpeg IVF demuxer (ivfdec.c). I would
> guess the H.264 stuff would work, but since the IVF demuxer utilizes
> the ff_codec_bmp_tags list, which doesn't seem to contain HEVC entries
> I would guess additional stuff would be required there.
>
>
Verified that demuxer can handle the files by running  ffplay.
Thank you.


> That of course doesn't have to be within this patch, but just within
> this patch set (one patch for demuxer, one for muxer).
>
> Best regards,
> Jan
> ___
> 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] Unsupported video format

2018-10-01 Thread John Duchek
I think I found a video format that is not supported that would be 
useful (particularly for amateur astronomers) to be supported.
When taking webcam type photos of the moon and planets, these people 
have moved away from avi files, and are using .ser files.


My understanding of this comes from:

http://www.grischa-hahn.homepage.t-online.de/astro/ser/

which describes it.

Simple uncompressed video format for astronomical capturing:

unlimited file size
time stamps (UT) for every frame
8..16 bit per pixel and plane
Monochrome, Bayer RGB/CMY, full RGB (v3)
contains information about observer, camera and telescope
SER files are supported by:

Lucam Recorder (v2)
AiryLab Genika Astro (v2)
Open Astro Project - oaCapture (v2)
SIRIL (v3)
FireCapture (v3)
PIPP (v3)
WinJUPOS (v3)
AutoStakkert!2 (v3)
AviStack (v2)
RegiStax (v2)
ImagesPlus (v2)
Planetary impact flashes detection with DeTeCt (v2)

The website above has descriptions of version 2 and 3 of the format, and 
a sample implementation in Pascal.


Would there be any interest in supporting this format?

Thanks,

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


Re: [FFmpeg-devel] [PATCH] avformat/utils: Don't parse encrypted packets.

2018-10-01 Thread Jacob Trimble
On Mon, Sep 17, 2018 at 2:35 PM Jacob Trimble  wrote:
>
> On Wed, Sep 12, 2018 at 11:50 AM Michael Niedermayer
>  wrote:
> >
> > On Tue, Sep 11, 2018 at 03:50:57PM -0700, Jacob Trimble wrote:
> > > [...]
> > >
> > > So how about, when we see an encrypted frame, we flush the parser
> > > before skipping the frame?  Can we just flush the parser and then
> > > reuse it later?  Or would we need to create a new parser if we saw
> > > clear frames later?
> >
> > try/test it and review the code. only way to know for sure what works
> >
> > thanks
> >
> > [...]
> > --
> > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >
> > The bravest are surely those who have the clearest vision
> > of what is before them, glory and danger alike, and yet
> > notwithstanding go out to meet it. -- Thucydides
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> Here is a new patch that flushes the parser before returning the
> encrypted packets.  It also logs when it does this.

Ping.  Is this better?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Unsupported video format

2018-10-01 Thread Paul B Mahol
On 10/1/18, John Duchek  wrote:
> I think I found a video format that is not supported that would be
> useful (particularly for amateur astronomers) to be supported.
> When taking webcam type photos of the moon and planets, these people
> have moved away from avi files, and are using .ser files.
>
> My understanding of this comes from:
>
> http://www.grischa-hahn.homepage.t-online.de/astro/ser/
>
> which describes it.
>
> Simple uncompressed video format for astronomical capturing:
>
>  unlimited file size
>  time stamps (UT) for every frame
>  8..16 bit per pixel and plane
>  Monochrome, Bayer RGB/CMY, full RGB (v3)
>  contains information about observer, camera and telescope
>  SER files are supported by:
>
>  Lucam Recorder (v2)
>  AiryLab Genika Astro (v2)
>  Open Astro Project - oaCapture (v2)
>  SIRIL (v3)
>  FireCapture (v3)
>  PIPP (v3)
>  WinJUPOS (v3)
>  AutoStakkert!2 (v3)
>  AviStack (v2)
>  RegiStax (v2)
>  ImagesPlus (v2)
>  Planetary impact flashes detection with DeTeCt (v2)
>
> The website above has descriptions of version 2 and 3 of the format, and
> a sample implementation in Pascal.
>
> Would there be any interest in supporting this format?

Yes, if someone is going to sponsor such addition, even more.

Also are there any samples?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/5] avfilter/af_afade: fix crossfade duration maximum value

2018-10-01 Thread Marton Balint



On Mon, 1 Oct 2018, Paul B Mahol wrote:


On 10/1/18, Marton Balint  wrote:



On Mon, 1 Oct 2018, Paul B Mahol wrote:


On 10/1/18, Marton Balint  wrote:



On Mon, 1 Oct 2018, Paul B Mahol wrote:


On 10/1/18, Marton Balint  wrote:



On Mon, 1 Oct 2018, Paul B Mahol wrote:


On 9/30/18, Marton Balint  wrote:

Signed-off-by: Marton Balint 
---
 libavfilter/af_afade.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



Why?

Value is too big.


AV_OPT_TYPE_DURATION is microsecond precision, therefore 60 is 60
usecs.
Probably you meant 60 seconds as limit. That is what the patch fixes.


I do not think so. Duration is interpreted as seconds, look how
variable is used in code.


As far as I see duration is rescaled from AV_TIME_BASE (microseconds) to
sample_rate time base:

if (s->duration)
  s->nb_samples = av_rescale(s->duration, outlink->sample_rate,
AV_TIME_BASE);

Duration is parsed as seconds (can be fractional as well), but internally
it is stored as microseconds (int64). Another example is the f_realtime
filter where the sleep time limit default according to the documentation
is 2 seconds and it is expressed as 200 in the code.


Yes, and current patch is wrong. Simply exceding max value is not proper
fix.


What is the proper fix then?


Interpreting duration correctly, like trim filters do.


Somebody help me, because I truly don't get it.

1) OPT_TYPE_DURATION default value is given in the .i64 field in 
microseconds.


2) OPT_TYPE_DURATION min/max value is given in the min/max fields in 
microseconds.


Do you disagree with any of these? If yes, then what do you suggest?

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


Re: [FFmpeg-devel] [PATCH 1/5] avfilter/af_afade: fix crossfade duration maximum value

2018-10-01 Thread Paul B Mahol
On 10/1/18, Marton Balint  wrote:
>
>
> On Mon, 1 Oct 2018, Paul B Mahol wrote:
>
>> On 10/1/18, Marton Balint  wrote:
>>>
>>>
>>> On Mon, 1 Oct 2018, Paul B Mahol wrote:
>>>
 On 10/1/18, Marton Balint  wrote:
>
>
> On Mon, 1 Oct 2018, Paul B Mahol wrote:
>
>> On 10/1/18, Marton Balint  wrote:
>>>
>>>
>>> On Mon, 1 Oct 2018, Paul B Mahol wrote:
>>>
 On 9/30/18, Marton Balint  wrote:
> Signed-off-by: Marton Balint 
> ---
>  libavfilter/af_afade.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

 Why?

 Value is too big.
>>>
>>> AV_OPT_TYPE_DURATION is microsecond precision, therefore 60 is 60
>>> usecs.
>>> Probably you meant 60 seconds as limit. That is what the patch fixes.
>>
>> I do not think so. Duration is interpreted as seconds, look how
>> variable is used in code.
>
> As far as I see duration is rescaled from AV_TIME_BASE (microseconds)
> to
> sample_rate time base:
>
> if (s->duration)
>   s->nb_samples = av_rescale(s->duration, outlink->sample_rate,
> AV_TIME_BASE);
>
> Duration is parsed as seconds (can be fractional as well), but
> internally
> it is stored as microseconds (int64). Another example is the f_realtime
> filter where the sleep time limit default according to the
> documentation
> is 2 seconds and it is expressed as 200 in the code.

 Yes, and current patch is wrong. Simply exceding max value is not proper
 fix.
>>>
>>> What is the proper fix then?
>>
>> Interpreting duration correctly, like trim filters do.
>
> Somebody help me, because I truly don't get it.
>
> 1) OPT_TYPE_DURATION default value is given in the .i64 field in
> microseconds.
>
> 2) OPT_TYPE_DURATION min/max value is given in the min/max fields in
> microseconds.
>
> Do you disagree with any of these? If yes, then what do you suggest?

No, I do not disagree with any of those above. But patch is incomplete.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/5] avfilter/af_afade: fix crossfade duration maximum value

2018-10-01 Thread Marton Balint



On Mon, 1 Oct 2018, Paul B Mahol wrote:


On 10/1/18, Marton Balint  wrote:



On Mon, 1 Oct 2018, Paul B Mahol wrote:


On 10/1/18, Marton Balint  wrote:



On Mon, 1 Oct 2018, Paul B Mahol wrote:


On 10/1/18, Marton Balint  wrote:



On Mon, 1 Oct 2018, Paul B Mahol wrote:


On 10/1/18, Marton Balint  wrote:



On Mon, 1 Oct 2018, Paul B Mahol wrote:


On 9/30/18, Marton Balint  wrote:

Signed-off-by: Marton Balint 
---
 libavfilter/af_afade.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



Why?

Value is too big.


AV_OPT_TYPE_DURATION is microsecond precision, therefore 60 is 60
usecs.
Probably you meant 60 seconds as limit. That is what the patch fixes.


I do not think so. Duration is interpreted as seconds, look how
variable is used in code.


As far as I see duration is rescaled from AV_TIME_BASE (microseconds)
to
sample_rate time base:

if (s->duration)
  s->nb_samples = av_rescale(s->duration, outlink->sample_rate,
AV_TIME_BASE);

Duration is parsed as seconds (can be fractional as well), but
internally
it is stored as microseconds (int64). Another example is the f_realtime
filter where the sleep time limit default according to the
documentation
is 2 seconds and it is expressed as 200 in the code.


Yes, and current patch is wrong. Simply exceding max value is not proper
fix.


What is the proper fix then?


Interpreting duration correctly, like trim filters do.


Somebody help me, because I truly don't get it.

1) OPT_TYPE_DURATION default value is given in the .i64 field in
microseconds.

2) OPT_TYPE_DURATION min/max value is given in the min/max fields in
microseconds.

Do you disagree with any of these? If yes, then what do you suggest?


No, I do not disagree with any of those above. But patch is incomplete.


Post/push a better patch then please.

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


Re: [FFmpeg-devel] [PATCH 3/5] avutil/opt: check for minimum and maximum values when setting AV_OPT_TYPE_DURATION fields

2018-10-01 Thread Paul B Mahol
On 9/30/18, Marton Balint  wrote:
> Signed-off-by: Marton Balint 
> ---
>  libavutil/opt.c | 21 ++---
>  1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/libavutil/opt.c b/libavutil/opt.c
> index 99282605f5..93d6c26c11 100644
> --- a/libavutil/opt.c
> +++ b/libavutil/opt.c
> @@ -496,15 +496,22 @@ int av_opt_set(void *obj, const char *name, const char
> *val, int search_flags)
>  case AV_OPT_TYPE_SAMPLE_FMT:
>  return set_string_sample_fmt(obj, o, val, dst);
>  case AV_OPT_TYPE_DURATION:
> -if (!val) {
> -*(int64_t *)dst = 0;
> +{
> +int64_t usecs = 0;
> +if (val) {
> +if ((ret = av_parse_time(&usecs, val, 1)) < 0) {
> +av_log(obj, AV_LOG_ERROR, "Unable to parse option value
> \"%s\" as duration\n", val);
> +return ret;
> +}
> +}
> +if (usecs < o->min || usecs > o->max) {
> +av_log(obj, AV_LOG_ERROR, "Value %f for parameter '%s' out
> of range [%g - %g]\n",
> +   usecs / 100.0, o->name, o->min / 100.0,
> o->max / 100.0);
> +return AVERROR(ERANGE);
> +}
> +*(int64_t *)dst = usecs;
>  return 0;
> -} else {
> -if ((ret = av_parse_time(dst, val, 1)) < 0)
> -av_log(obj, AV_LOG_ERROR, "Unable to parse option value
> \"%s\" as duration\n", val);
> -return ret;
>  }
> -break;
>  case AV_OPT_TYPE_COLOR:
>  return set_string_color(obj, o, val, dst);
>  case AV_OPT_TYPE_CHANNEL_LAYOUT:
> --
> 2.16.4
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

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


Re: [FFmpeg-devel] [PATCH 2/5] avformat/segment: fix segment_time_delta option min/max value

2018-10-01 Thread Paul B Mahol
On 9/30/18, Marton Balint  wrote:
> Signed-off-by: Marton Balint 
> ---
>  libavformat/segment.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/segment.c b/libavformat/segment.c
> index 7fb4dc7d21..e2ac2c3a7f 100644
> --- a/libavformat/segment.c
> +++ b/libavformat/segment.c
> @@ -1045,7 +1045,7 @@ static const AVOption options[] = {
>  { "segment_clocktime_offset", "set segment clocktime offset",
> OFFSET(clocktime_offset), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0,
> 864LL, E},
>  { "segment_clocktime_wrap_duration", "set segment clocktime wrapping
> duration", OFFSET(clocktime_wrap_duration), AV_OPT_TYPE_DURATION, {.i64 =
> INT64_MAX}, 0, INT64_MAX, E},
>  { "segment_time",  "set segment duration",
> OFFSET(time_str),AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,   E },
> -{ "segment_time_delta","set approximation value used for the segment
> times", OFFSET(time_delta), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, 0, E },
> +{ "segment_time_delta","set approximation value used for the segment
> times", OFFSET(time_delta), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX,
> E },
>  { "segment_times", "set segment split time points",
> OFFSET(times_str),AV_OPT_TYPE_STRING,{.str = NULL},  0, 0,   E },
>  { "segment_frames","set segment split frame numbers",
> OFFSET(frames_str),AV_OPT_TYPE_STRING,{.str = NULL},  0, 0,   E },
>  { "segment_wrap",  "set number after which the index wraps",
> OFFSET(segment_idx_wrap), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E },
> --
> 2.16.4
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

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


Re: [FFmpeg-devel] [PATCH 1/5] avfilter/af_afade: fix crossfade duration maximum value

2018-10-01 Thread Paul B Mahol
On 10/1/18, Marton Balint  wrote:
>
>
> On Mon, 1 Oct 2018, Paul B Mahol wrote:
>
>> On 10/1/18, Marton Balint  wrote:
>>>
>>>
>>> On Mon, 1 Oct 2018, Paul B Mahol wrote:
>>>
 On 10/1/18, Marton Balint  wrote:
>
>
> On Mon, 1 Oct 2018, Paul B Mahol wrote:
>
>> On 10/1/18, Marton Balint  wrote:
>>>
>>>
>>> On Mon, 1 Oct 2018, Paul B Mahol wrote:
>>>
 On 10/1/18, Marton Balint  wrote:
>
>
> On Mon, 1 Oct 2018, Paul B Mahol wrote:
>
>> On 9/30/18, Marton Balint  wrote:
>>> Signed-off-by: Marton Balint 
>>> ---
>>>  libavfilter/af_afade.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>
>> Why?
>>
>> Value is too big.
>
> AV_OPT_TYPE_DURATION is microsecond precision, therefore 60 is 60
> usecs.
> Probably you meant 60 seconds as limit. That is what the patch
> fixes.

 I do not think so. Duration is interpreted as seconds, look how
 variable is used in code.
>>>
>>> As far as I see duration is rescaled from AV_TIME_BASE (microseconds)
>>> to
>>> sample_rate time base:
>>>
>>> if (s->duration)
>>>   s->nb_samples = av_rescale(s->duration, outlink->sample_rate,
>>> AV_TIME_BASE);
>>>
>>> Duration is parsed as seconds (can be fractional as well), but
>>> internally
>>> it is stored as microseconds (int64). Another example is the
>>> f_realtime
>>> filter where the sleep time limit default according to the
>>> documentation
>>> is 2 seconds and it is expressed as 200 in the code.
>>
>> Yes, and current patch is wrong. Simply exceding max value is not
>> proper
>> fix.
>
> What is the proper fix then?

 Interpreting duration correctly, like trim filters do.
>>>
>>> Somebody help me, because I truly don't get it.
>>>
>>> 1) OPT_TYPE_DURATION default value is given in the .i64 field in
>>> microseconds.
>>>
>>> 2) OPT_TYPE_DURATION min/max value is given in the min/max fields in
>>> microseconds.
>>>
>>> Do you disagree with any of these? If yes, then what do you suggest?
>>
>> No, I do not disagree with any of those above. But patch is incomplete.
>
> Post/push a better patch then please.

Actually patch is fine, sorry.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/2] ffplay: options to specify window position

2018-10-01 Thread Dave Rice
From 14d6833b564bd672613d50ecc4c3ede1768eee37 Mon Sep 17 00:00:00 2001
From: Dave Rice 
Date: Mon, 1 Oct 2018 17:07:44 -0400
Subject: [PATCH 1/2] ffplay: options to specify window position

---
 fftools/ffplay.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index e375a32ec2..e1ec2e9df2 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -314,6 +314,8 @@ static int default_width  = 640;
 static int default_height = 480;
 static int screen_width  = 0;
 static int screen_height = 0;
+static int window_x;
+static int window_y;
 static int audio_disable;
 static int video_disable;
 static int subtitle_disable;
@@ -1346,7 +1348,11 @@ static int video_open(VideoState *is)
 SDL_SetWindowTitle(window, window_title);
 
 SDL_SetWindowSize(window, w, h);
-SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, 
SDL_WINDOWPOS_CENTERED);
+if (!window_x)
+window_x = SDL_WINDOWPOS_CENTERED;
+if (!window_y)
+window_y = SDL_WINDOWPOS_CENTERED;
+SDL_SetWindowPosition(window, window_x, window_y);
 if (is_full_screen)
 SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
 SDL_ShowWindow(window);
@@ -3602,6 +3608,8 @@ static const OptionDef options[] = {
 { "framedrop", OPT_BOOL | OPT_EXPERT, { &framedrop }, "drop frames when 
cpu is too slow", "" },
 { "infbuf", OPT_BOOL | OPT_EXPERT, { &infinite_buffer }, "don't limit the 
input buffer size (useful with realtime streams)", "" },
 { "window_title", OPT_STRING | HAS_ARG, { &window_title }, "set window 
title", "window title" },
+{ "window_x", OPT_INT | HAS_ARG | OPT_EXPERT, { &window_x }, "set the x 
position of the window", "x pos" },
+{ "window_y", OPT_INT | HAS_ARG | OPT_EXPERT, { &window_y }, "set the y 
position of the window", "y pos" },
 #if CONFIG_AVFILTER
 { "vf", OPT_EXPERT | HAS_ARG, { .func_arg = opt_add_vfilter }, "set video 
filters", "filter_graph" },
 { "af", OPT_STRING | HAS_ARG, { &afilters }, "set audio filters", 
"filter_graph" },
-- 
2.19.0


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


[FFmpeg-devel] [PATCH 2/2] avdevice/sdl2 : add option to set window position

2018-10-01 Thread Dave Rice
Allows arrangement of multiple windows such as:
ffmpeg -re -f lavfi -i mandelbrot -f sdl -window_x 1 -window_y 1 mandelbrot -vf 
waveform,format=yuv420p -f sdl -window_x 641 -window_y 1 waveform -vf 
vectorscope,format=yuv420p -f sdl -window_x 1 -window_y 481 vectorscop

From 00438983c96b5db227b9975a2c160fc6aac5219d Mon Sep 17 00:00:00 2001
From: Dave Rice 
Date: Mon, 1 Oct 2018 17:08:35 -0400
Subject: [PATCH 2/2] avdevice/sdl2 : add option to set window position

---
 libavdevice/sdl2.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/libavdevice/sdl2.c b/libavdevice/sdl2.c
index da5143078e..69c541da23 100644
--- a/libavdevice/sdl2.c
+++ b/libavdevice/sdl2.c
@@ -40,6 +40,7 @@ typedef struct {
 SDL_Renderer *renderer;
 char *window_title;
 int window_width, window_height;  /**< size of the window */
+int window_x, window_y;   /**< position of the window */
 int window_fullscreen;
 int window_borderless;
 int enable_quit_action;
@@ -217,6 +218,12 @@ static int sdl2_write_header(AVFormatContext *s)
 
 SDL_SetWindowTitle(sdl->window, sdl->window_title);
 
+if (!sdl->window_x)
+sdl->window_x = SDL_WINDOWPOS_CENTERED;
+if (!sdl->window_y)
+sdl->window_y = SDL_WINDOWPOS_CENTERED;
+SDL_SetWindowPosition(sdl->window, sdl->window_x, sdl->window_y);
+
 sdl->texture = SDL_CreateTexture(sdl->renderer, sdl->texture_fmt, 
SDL_TEXTUREACCESS_STREAMING,
  codecpar->width, codecpar->height);
 
@@ -337,6 +344,8 @@ static int sdl2_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 static const AVOption options[] = {
 { "window_title",  "set SDL window title",   OFFSET(window_title), 
AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
 { "window_size",   "set SDL window forced size", OFFSET(window_width), 
AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
+{ "window_x",  "set SDL window x position",  OFFSET(window_x), 
AV_OPT_TYPE_INT,{ .i64 = 0 },0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM 
},
+{ "window_y",  "set SDL window y position",  OFFSET(window_y), 
AV_OPT_TYPE_INT,{ .i64 = 0 },0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM 
},
 { "window_fullscreen", "set SDL window fullscreen",  
OFFSET(window_fullscreen), AV_OPT_TYPE_BOOL,  { .i64 = 0 },0, 1, 
AV_OPT_FLAG_ENCODING_PARAM },
 { "window_borderless", "set SDL window border off",  
OFFSET(window_borderless), AV_OPT_TYPE_BOOL,  { .i64 = 0 },0, 1, 
AV_OPT_FLAG_ENCODING_PARAM },
 { "window_enable_quit", "set if quit action is available", 
OFFSET(enable_quit_action), AV_OPT_TYPE_INT, {.i64=1},   0, 1, 
AV_OPT_FLAG_ENCODING_PARAM },
-- 
2.19.0

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


Re: [FFmpeg-devel] [PATCH] lavfi/vf_colorconstancy: add weighted_greyedge

2018-10-01 Thread Moritz Barsnick
On Mon, Oct 01, 2018 at 18:02:19 +0200, Mina wrote:
> >> +The power applied to the weight map to emphasis heigher weights. Must be 
> >> chosen
> >^ emphasize
> 
> British spelling but done.

Your call, but "emphasis" was wrong either way, because that's a noun,
not a verb.

> AVFilterInternal::execute expects such type of the function.

I understand, I didn't see that part. Perfect.

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


Re: [FFmpeg-devel] [PATCH 1/2] ffplay: options to specify window position

2018-10-01 Thread Marton Balint



On Mon, 1 Oct 2018, Dave Rice wrote:


From 14d6833b564bd672613d50ecc4c3ede1768eee37 Mon Sep 17 00:00:00 2001
From: Dave Rice 
Date: Mon, 1 Oct 2018 17:07:44 -0400
Subject: [PATCH 1/2] ffplay: options to specify window position

---
fftools/ffplay.c | 10 +-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index e375a32ec2..e1ec2e9df2 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -314,6 +314,8 @@ static int default_width  = 640;
static int default_height = 480;
static int screen_width  = 0;
static int screen_height = 0;
+static int window_x;
+static int window_y;


static int screen_xleft = SDL_WINDOWPOS_CENTERED;
static int screen_ytop = SDL_WINDOWPOS_CENTERED;


static int audio_disable;
static int video_disable;
static int subtitle_disable;
@@ -1346,7 +1348,11 @@ static int video_open(VideoState *is)
SDL_SetWindowTitle(window, window_title);

SDL_SetWindowSize(window, w, h);
-SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, 
SDL_WINDOWPOS_CENTERED);
+if (!window_x)
+window_x = SDL_WINDOWPOS_CENTERED;
+if (!window_y)
+window_y = SDL_WINDOWPOS_CENTERED;


unneeded (also 0 pos should work)


+SDL_SetWindowPosition(window, window_x, window_y);


SDL_SetWindowPosition(window, screen_xleft, screen_ytop);


if (is_full_screen)
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
SDL_ShowWindow(window);
@@ -3602,6 +3608,8 @@ static const OptionDef options[] = {
{ "framedrop", OPT_BOOL | OPT_EXPERT, { &framedrop }, "drop frames when cpu is too 
slow", "" },
{ "infbuf", OPT_BOOL | OPT_EXPERT, { &infinite_buffer }, "don't limit the input buffer 
size (useful with realtime streams)", "" },
{ "window_title", OPT_STRING | HAS_ARG, { &window_title }, "set window title", 
"window title" },
+{ "window_x", OPT_INT | HAS_ARG | OPT_EXPERT, { &window_x }, "set the x position of the 
window", "x pos" },
+{ "window_y", OPT_INT | HAS_ARG | OPT_EXPERT, { &window_y }, "set the y position of the 
window", "y pos" },


I'd rather not call this "window_*", maybe "left" and "top" or "xleft", 
"ytop".



#if CONFIG_AVFILTER
{ "vf", OPT_EXPERT | HAS_ARG, { .func_arg = opt_add_vfilter }, "set video filters", 
"filter_graph" },
{ "af", OPT_STRING | HAS_ARG, { &afilters }, "set audio filters", 
"filter_graph" },
--


docs update missing.

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


[FFmpeg-devel] [PATCHv2 1/2] avfilter/filters: add ff_inlink_peek_frame and ff_inlink_queued_frames to access frames in the inlink fifo

2018-10-01 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 libavfilter/avfilter.c | 10 ++
 libavfilter/filters.h  | 13 +
 2 files changed, 23 insertions(+)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 85eff0aa1d..146e6e2b83 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1448,6 +1448,11 @@ int ff_inlink_acknowledge_status(AVFilterLink *link, int 
*rstatus, int64_t *rpts
 return 1;
 }
 
+size_t ff_inlink_queued_frames(AVFilterLink *link)
+{
+return ff_framequeue_queued_frames(&link->fifo);
+}
+
 int ff_inlink_check_available_frame(AVFilterLink *link)
 {
 return ff_framequeue_queued_frames(&link->fifo) > 0;
@@ -1507,6 +1512,11 @@ int ff_inlink_consume_samples(AVFilterLink *link, 
unsigned min, unsigned max,
 return 1;
 }
 
+AVFrame *ff_inlink_peek_frame(AVFilterLink *link, size_t idx)
+{
+return ff_framequeue_peek(&link->fifo, idx);
+}
+
 int ff_inlink_make_frame_writable(AVFilterLink *link, AVFrame **rframe)
 {
 AVFrame *frame = *rframe;
diff --git a/libavfilter/filters.h b/libavfilter/filters.h
index 4e2652ebe5..ff900da63f 100644
--- a/libavfilter/filters.h
+++ b/libavfilter/filters.h
@@ -60,6 +60,12 @@ int ff_inlink_process_commands(AVFilterLink *link, const 
AVFrame *frame);
  */
 int ff_inlink_evaluate_timeline_at_frame(AVFilterLink *link, const AVFrame 
*frame);
 
+/**
+ * Get the number of frames available on the link.
+ * @return the number of frames available in the link fifo.
+ */
+size_t ff_inlink_queued_frames(AVFilterLink *link);
+
 /**
  * Test if a frame is available on the link.
  * @return  >0 if a frame is available
@@ -102,6 +108,13 @@ int ff_inlink_consume_frame(AVFilterLink *link, AVFrame 
**rframe);
 int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max,
 AVFrame **rframe);
 
+/**
+ * Access a frame in the link fifo without consuming it.
+ * The first frame is numbered 0; the designated frame must exist.
+ * @return the frame at idx position in the link fifo.
+ */
+AVFrame *ff_inlink_peek_frame(AVFilterLink *link, size_t idx);
+
 /**
  * Make sure a frame is writable.
  * This is similar to av_frame_make_writable() except it uses the link's
-- 
2.16.4

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


[FFmpeg-devel] [PATCH 1/3] avcodec/tiff: check remaining packet size for strips

2018-10-01 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
10280/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5676217211027456

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

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index cfe0c27714..b537ec06a5 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1303,6 +1303,7 @@ static int decode_frame(AVCodecContext *avctx,
 
 planes = s->planar ? s->bppcount : 1;
 for (plane = 0; plane < planes; plane++) {
+int remaining = avpkt->size;
 stride = p->linesize[plane];
 dst = p->data[plane];
 for (i = 0; i < s->height; i += s->rps) {
@@ -1318,10 +1319,11 @@ static int decode_frame(AVCodecContext *avctx,
 else
 soff = s->stripoff;
 
-if (soff > avpkt->size || ssize > avpkt->size - soff) {
+if (soff > avpkt->size || ssize > avpkt->size - soff || ssize > 
remaining) {
 av_log(avctx, AV_LOG_ERROR, "Invalid strip size/offset\n");
 return AVERROR_INVALIDDATA;
 }
+remaining -= ssize;
 if ((ret = tiff_unpack_strip(s, p, dst, stride, avpkt->data + 
soff, ssize, i,
  FFMIN(s->rps, s->height - i))) < 0) {
 if (avctx->err_recognition & AV_EF_EXPLODE)
-- 
2.19.0

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


[FFmpeg-devel] [PATCH 2/3] avcodec/rasc: Fix off by 1 error in vertical coordinate

2018-10-01 Thread Michael Niedermayer
Fixes: out of array read
Fixes: 
10311/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RASC_fuzzer-4856330905452544

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

diff --git a/libavcodec/rasc.c b/libavcodec/rasc.c
index fbbb134f4b..eb021681c6 100644
--- a/libavcodec/rasc.c
+++ b/libavcodec/rasc.c
@@ -272,9 +272,9 @@ static int decode_move(AVCodecContext *avctx,
 if (!s->frame2->data[0] || !s->frame1->data[0])
 return AVERROR_INVALIDDATA;
 
-b1 = s->frame1->data[0] + s->frame1->linesize[0] * (start_y + h) + 
start_x * s->bpp;
-b2 = s->frame2->data[0] + s->frame2->linesize[0] * (start_y + h) + 
start_x * s->bpp;
-e2 = s->frame2->data[0] + s->frame2->linesize[0] * (mov_y + h) + mov_x 
* s->bpp;
+b1 = s->frame1->data[0] + s->frame1->linesize[0] * (start_y + h - 1) + 
start_x * s->bpp;
+b2 = s->frame2->data[0] + s->frame2->linesize[0] * (start_y + h - 1) + 
start_x * s->bpp;
+e2 = s->frame2->data[0] + s->frame2->linesize[0] * (mov_y + h - 1) + 
mov_x * s->bpp;
 
 if (type == 2) {
 for (int j = 0; j < h; j++) {
-- 
2.19.0

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


[FFmpeg-devel] [PATCH 3/3] avcodec/rasc: unref both frames on reinit

2018-10-01 Thread Michael Niedermayer
Fixes: integer overflow
Fixes: inconsistent frame dimensions
Fixes: 
10454/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RASC_fuzzer-5656301162463232

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

diff --git a/libavcodec/rasc.c b/libavcodec/rasc.c
index eb021681c6..e8e0740ddd 100644
--- a/libavcodec/rasc.c
+++ b/libavcodec/rasc.c
@@ -95,10 +95,10 @@ static int init_frames(AVCodecContext *avctx)
 int ret;
 
 av_frame_unref(s->frame1);
+av_frame_unref(s->frame2);
 if ((ret = ff_get_buffer(avctx, s->frame1, 0)) < 0)
 return ret;
 
-av_frame_unref(s->frame2);
 if ((ret = ff_get_buffer(avctx, s->frame2, 0)) < 0)
 return ret;
 
-- 
2.19.0

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


Re: [FFmpeg-devel] [PATCH 2/3] avcodec/rasc: Fix off by 1 error in vertical coordinate

2018-10-01 Thread Michael Niedermayer
On Tue, Oct 02, 2018 at 03:04:51AM +0200, Michael Niedermayer wrote:
> Fixes: out of array read
> Fixes: 
> 10311/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RASC_fuzzer-4856330905452544
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/rasc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

btw, i found no file that uses this codepath, if someone has some RASC files
please share a link so i can test this

thx

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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


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


Re: [FFmpeg-devel] [PATCH 2/2] avdevice/sdl2 : add option to set window position

2018-10-01 Thread Gyan
On Tue, Oct 2, 2018 at 2:47 AM Dave Rice  wrote:

> Allows arrangement of multiple windows such as:
> ffmpeg -re -f lavfi -i mandelbrot -f sdl -window_x 1 -window_y 1
> mandelbrot -vf waveform,format=yuv420p -f sdl -window_x 641 -window_y 1
> waveform -vf vectorscope,format=yuv420p -f sdl -window_x 1 -window_y 481
> vectorscop
>
> From 00438983c96b5db227b9975a2c160fc6aac5219d Mon Sep 17 00:00:00 2001
> From: Dave Rice 
> Date: Mon, 1 Oct 2018 17:08:35 -0400
> Subject: [PATCH 2/2] avdevice/sdl2 : add option to set window position
>
> +if (!sdl->window_x)
> +sdl->window_x = SDL_WINDOWPOS_CENTERED;
> +if (!sdl->window_y)
> +sdl->window_y = SDL_WINDOWPOS_CENTERED;
> +SDL_SetWindowPosition(sdl->window, sdl->window_x, sdl->window_y);
>

What happens if the user value implies fully or partially out-of-canvas
rendering?

For the former case, we may want to print a warning and reposition the
window.
If a partial window is drawable, then negative values can be valid and the
lower range bound should be INT_MIN
Also, the user can't position a window at top-left (0,0), so the default
should probably be INT_MAX.

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