Re: [FFmpeg-devel] [PATCH v12] - Added Turing codec interface for ffmpeg

2017-07-17 Thread Saverio Blasi
>> Thanks a lot, this makes sense. I thought that flag was compulsory and 
>> therefore we only included linking against libraries in "Libs.private" in 
>> the pc file. I have just pushed a fix to the Turing repo to include that in 
>> the Libs as well.
>> 
>> I have tested this and it seems to work fine in my machine and in the Docker 
>> with Ubuntu and debian with and without the flag now. No changes are needed 
>> to the actual patch, it should work as long as you update Turing to the 
>> latest commit.


So we have now further tested this extensively in different machines. I believe 
the problems with linking against dynamic libraries are solved in v 12 of the 
patch. In all our tests the patch works correctly with either settings of the 
pkg-config-flags. Could you please help us and confirm that this is the case? I 
think this was the only blocker with this latest version of the patch?

Thanks,

Saverio Blasi
Senior Research Engineer 
BBC Research & Development
Centre House|56 Wood Lane|London|W12 7SB



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


Re: [FFmpeg-devel] [PATCH] lavfi/buffersrc: push the frame deeper if requested.

2017-07-17 Thread Nicolas George
Le tridi 23 messidor, an CCXXV, Paul B Mahol a écrit :
> You never asked for one.

Indeed, since I forgot to answer your mail. But you know what is
necessary in a bug report.

> Here it is attached just for you.

I think you sent it to the mailing-list, not just to me.

Anyway, I have a working version now, I need to clean it up before
sending. In the meantime, instead of duelling while riding office
chairs, I can point what did not work in this patch:

> From 20d00cead1e47b2e389fde99a3c0f9c36b6587ec Mon Sep 17 00:00:00 2001
> From: Paul B Mahol 
> Date: Tue, 20 Jun 2017 19:44:54 +0200
> Subject: [PATCH] shit
> 
> Signed-off-by: Paul B Mahol 
> ---
>  libavfilter/framesync.c | 47 +++
>  libavfilter/framesync.h |  4 
>  libavfilter/vf_stack.c  |  9 -
>  3 files changed, 55 insertions(+), 5 deletions(-)
> 
> diff --git a/libavfilter/framesync.c b/libavfilter/framesync.c
> index eb05d66..f2a4450 100644
> --- a/libavfilter/framesync.c
> +++ b/libavfilter/framesync.c
> @@ -23,6 +23,7 @@
>  
>  #include "libavutil/avassert.h"
>  #include "avfilter.h"
> +#include "filters.h"
>  #include "bufferqueue.h"
>  #include "framesync.h"
>  #include "internal.h"
> @@ -224,6 +225,22 @@ void ff_framesync_next(FFFrameSync *fs)
>  framesync_advance(fs);
>  }
>  
> +void ff_framesync_next2(FFFrameSync *fs)
> +{
> +AVFilterContext *ctx = fs->parent;
> +unsigned i;
> +
> +av_assert0(!fs->frame_ready);
> +for (i = 0; i < fs->nb_in; i++)

> +if (!fs->in[i].have_next && 
> ff_framequeue_queued_frames(&ctx->inputs[i]->fifo)) {
> +framesync_inject_frame(fs, i, 
> ff_framequeue_take(&ctx->inputs[i]->fifo));

Do not access link->fifo directly.

> +ctx->inputs[i]->frame_wanted_out = 1;

This must not be done unconditionally, it must only be done if (1)
frame_wanted_out is set on the output or (2) there are frame queued in
other inputs and a frame is necessary to process them.

> +ff_filter_set_ready(ctx->inputs[i]->src, 100);

Use ff_inlink_request_frame().

> +}
> +fs->frame_ready = 0;
> +framesync_advance(fs);
> +}
> +
>  void ff_framesync_drop(FFFrameSync *fs)
>  {
>  fs->frame_ready = 0;
> @@ -300,6 +317,27 @@ int ff_framesync_process_frame(FFFrameSync *fs, unsigned 
> all)
>  return count;
>  }
>  
> +int ff_framesync_process_frame2(FFFrameSync *fs, unsigned all)
> +{
> +int ret, count = 0;
> +
> +av_assert0(fs->on_event);
> +while (1) {
> +ff_framesync_next2(fs);
> +if (fs->eof || !fs->frame_ready)
> +break;
> +if ((ret = fs->on_event(fs)) < 0)
> +return ret;
> +ff_framesync_drop(fs);
> +count++;
> +if (!all)
> +break;
> +}
> +if (!count && fs->eof)
> +return AVERROR_EOF;
> +return count;
> +}
> +
>  int ff_framesync_filter_frame(FFFrameSync *fs, AVFilterLink *inlink,
>AVFrame *in)
>  {
> @@ -314,6 +352,15 @@ int ff_framesync_filter_frame(FFFrameSync *fs, 
> AVFilterLink *inlink,
>  return 0;
>  }
>  
> +int ff_framesync_activate(FFFrameSync *fs, AVFilterContext *ctx)
> +{
> +int ret;
> +

> +if ((ret = ff_framesync_process_frame2(fs, 1)) < 0)
> +return ret;

At no point your code calls ff_inlink_acknowledge_status(). Therefore,
it can not detect EOF.

> +return 0;
> +}
> +
>  int ff_framesync_request_frame(FFFrameSync *fs, AVFilterLink *outlink)
>  {
>  AVFilterContext *ctx = outlink->src;
> diff --git a/libavfilter/framesync.h b/libavfilter/framesync.h
> index 7ba99d5..0f381e3 100644
> --- a/libavfilter/framesync.h
> +++ b/libavfilter/framesync.h
> @@ -250,6 +250,7 @@ int ff_framesync_add_frame(FFFrameSync *fs, unsigned in, 
> AVFrame *frame);
>   * The status of the operation can be found in fs->frame_ready and fs->eof.
>   */
>  void ff_framesync_next(FFFrameSync *fs);
> +void ff_framesync_next2(FFFrameSync *fs);
>  
>  /**
>   * Drop the current frame event.
> @@ -275,6 +276,7 @@ int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, 
> AVFrame **rframe,
>   * @return  number of frames processed or negative error code
>   */
>  int ff_framesync_process_frame(FFFrameSync *fs, unsigned all);
> +int ff_framesync_process_frame2(FFFrameSync *fs, unsigned all);
>  
>  
>  /**
> @@ -286,6 +288,8 @@ int ff_framesync_process_frame(FFFrameSync *fs, unsigned 
> all);
>  int ff_framesync_filter_frame(FFFrameSync *fs, AVFilterLink *inlink,
>AVFrame *in);
>  
> +int ff_framesync_activate(FFFrameSync *fs, AVFilterContext *ctx);
> +
>  /**
>   * Request a frame on the filter output.
>   *
> diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c
> index 03643b6..0e45952 100644
> --- a/libavfilter/vf_stack.c
> +++ b/libavfilter/vf_stack.c
> @@ -58,10 +58,10 @@ static int query_formats(AVFilterContext *ctx)
>  return ff_set_common_formats(ctx, pix_fmts);
>  }
>  
> -static int filter_fram

[FFmpeg-devel] [PATCH 1/7] Revert "Revert "lavfi/buffersrc: push the frame deeper if requested.""

2017-07-17 Thread Nicolas George
This reverts commit 04aa09c4bcf2d5a634a35da3a3ae3fc1abe30ef8.

The fate-ffm change is caused by field_order now being set
on the output format because the first frame arrives earlier.
The fate-mxf change is assumed to be the same.

Signed-off-by: Nicolas George 
---
 libavfilter/buffersrc.c | 25 +
 tests/ref/lavf/ffm  |  2 +-
 tests/ref/lavf/mxf  |  6 +++---
 3 files changed, 29 insertions(+), 4 deletions(-)


The field_order info seems to not be printed by any tool, and I do not know
the MXF format to check directly in the file; with FFM it was easy to see in
a hexdump. Anyway, the fact that field order was not set before de-reverting
hints at something fishy happening in the initialization code of ffmpeg. I
do not have time nor motivation to investigate that, so I will assume the
change is for the best like FFM.

If someone wants to investigate, the change can be toggled by simply adding
"return 0" at the beginning of push_frame(), below.


diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index 587b29b91a..e8f59c2de7 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -173,6 +173,20 @@ int attribute_align_arg 
av_buffersrc_add_frame_flags(AVFilterContext *ctx, AVFra
 return ret;
 }
 
+static int push_frame(AVFilterGraph *graph)
+{
+int ret;
+
+while (1) {
+ret = ff_filter_graph_run_once(graph);
+if (ret == AVERROR(EAGAIN))
+break;
+if (ret < 0)
+return ret;
+}
+return 0;
+}
+
 static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,
AVFrame *frame, int flags)
 {
@@ -185,6 +199,11 @@ static int av_buffersrc_add_frame_internal(AVFilterContext 
*ctx,
 if (!frame) {
 s->eof = 1;
 ff_avfilter_link_set_in_status(ctx->outputs[0], AVERROR_EOF, 
AV_NOPTS_VALUE);
+if ((flags & AV_BUFFERSRC_FLAG_PUSH)) {
+ret = push_frame(ctx->graph);
+if (ret < 0)
+return ret;
+}
 return 0;
 } else if (s->eof)
 return AVERROR(EINVAL);
@@ -239,6 +258,12 @@ static int av_buffersrc_add_frame_internal(AVFilterContext 
*ctx,
 if ((ret = ctx->output_pads[0].request_frame(ctx->outputs[0])) < 0)
 return ret;
 
+if ((flags & AV_BUFFERSRC_FLAG_PUSH)) {
+ret = push_frame(ctx->graph);
+if (ret < 0)
+return ret;
+}
+
 return 0;
 }
 
diff --git a/tests/ref/lavf/ffm b/tests/ref/lavf/ffm
index 54c56034aa..d9fa8d52cb 100644
--- a/tests/ref/lavf/ffm
+++ b/tests/ref/lavf/ffm
@@ -1,3 +1,3 @@
-a0e9616f0d9a8c1029f3220b1b9175f4 *./tests/data/lavf/lavf.ffm
+ca2a450cd0d1e299514a345923b4c82a *./tests/data/lavf/lavf.ffm
 376832 ./tests/data/lavf/lavf.ffm
 ./tests/data/lavf/lavf.ffm CRC=0x000e23ae
diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
index 9ab4432c63..48fe95a235 100644
--- a/tests/ref/lavf/mxf
+++ b/tests/ref/lavf/mxf
@@ -1,9 +1,9 @@
-dbdbb7d8677dc29b0d90eedcf418ce13 *./tests/data/lavf/lavf.mxf
+eaac3125ac1a61fe5f968c7af83fa71e *./tests/data/lavf/lavf.mxf
 525369 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
-40fcb0a898f8825a17f5754b23762f49 *./tests/data/lavf/lavf.mxf
+1562530330b13e9e70f522fe20265632 *./tests/data/lavf/lavf.mxf
 560697 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0xf21b1b48
-9233d192af20fc2a89304f5ae93c21ee *./tests/data/lavf/lavf.mxf
+e07858715997313ae66a1cdd6fde5f66 *./tests/data/lavf/lavf.mxf
 525369 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
-- 
2.13.2

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


[FFmpeg-devel] [PATCH 3/7] lavfi/framesync2: rename all conflicting symbols.

2017-07-17 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 libavfilter/framesync2.c | 42 +-
 libavfilter/framesync2.h | 30 +++---
 2 files changed, 36 insertions(+), 36 deletions(-)


Trivial change to make the next patches more readable.


diff --git a/libavfilter/framesync2.c b/libavfilter/framesync2.c
index eb05d66a86..8d81bb5c48 100644
--- a/libavfilter/framesync2.c
+++ b/libavfilter/framesync2.c
@@ -24,7 +24,7 @@
 #include "libavutil/avassert.h"
 #include "avfilter.h"
 #include "bufferqueue.h"
-#include "framesync.h"
+#include "framesync2.h"
 #include "internal.h"
 
 #define OFFSET(member) offsetof(FFFrameSync, member)
@@ -49,7 +49,7 @@ enum {
 STATE_EOF,
 };
 
-int ff_framesync_init(FFFrameSync *fs, void *parent, unsigned nb_in)
+int ff_framesync2_init(FFFrameSync *fs, void *parent, unsigned nb_in)
 {
 fs->class  = &framesync_class;
 fs->parent = parent;
@@ -77,7 +77,7 @@ static void framesync_sync_level_update(FFFrameSync *fs)
 fs->eof = 1;
 }
 
-int ff_framesync_configure(FFFrameSync *fs)
+int ff_framesync2_configure(FFFrameSync *fs)
 {
 unsigned i;
 int64_t gcd, lcm;
@@ -202,7 +202,7 @@ static void framesync_inject_frame(FFFrameSync *fs, 
unsigned in, AVFrame *frame)
 fs->in[in].have_next  = 1;
 }
 
-int ff_framesync_add_frame(FFFrameSync *fs, unsigned in, AVFrame *frame)
+int ff_framesync2_add_frame(FFFrameSync *fs, unsigned in, AVFrame *frame)
 {
 av_assert1(in < fs->nb_in);
 if (!fs->in[in].have_next)
@@ -212,7 +212,7 @@ int ff_framesync_add_frame(FFFrameSync *fs, unsigned in, 
AVFrame *frame)
 return 0;
 }
 
-void ff_framesync_next(FFFrameSync *fs)
+void ff_framesync2_next(FFFrameSync *fs)
 {
 unsigned i;
 
@@ -224,13 +224,13 @@ void ff_framesync_next(FFFrameSync *fs)
 framesync_advance(fs);
 }
 
-void ff_framesync_drop(FFFrameSync *fs)
+void ff_framesync2_drop(FFFrameSync *fs)
 {
 fs->frame_ready = 0;
 }
 
-int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe,
-   unsigned get)
+int ff_framesync2_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe,
+unsigned get)
 {
 AVFrame *frame;
 unsigned need_copy = 0, i;
@@ -266,7 +266,7 @@ int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, 
AVFrame **rframe,
 return 0;
 }
 
-void ff_framesync_uninit(FFFrameSync *fs)
+void ff_framesync2_uninit(FFFrameSync *fs)
 {
 unsigned i;
 
@@ -279,18 +279,18 @@ void ff_framesync_uninit(FFFrameSync *fs)
 av_freep(&fs->in);
 }
 
-int ff_framesync_process_frame(FFFrameSync *fs, unsigned all)
+int ff_framesync2_process_frame(FFFrameSync *fs, unsigned all)
 {
 int ret, count = 0;
 
 av_assert0(fs->on_event);
 while (1) {
-ff_framesync_next(fs);
+ff_framesync2_next(fs);
 if (fs->eof || !fs->frame_ready)
 break;
 if ((ret = fs->on_event(fs)) < 0)
 return ret;
-ff_framesync_drop(fs);
+ff_framesync2_drop(fs);
 count++;
 if (!all)
 break;
@@ -300,26 +300,26 @@ int ff_framesync_process_frame(FFFrameSync *fs, unsigned 
all)
 return count;
 }
 
-int ff_framesync_filter_frame(FFFrameSync *fs, AVFilterLink *inlink,
-  AVFrame *in)
+int ff_framesync2_filter_frame(FFFrameSync *fs, AVFilterLink *inlink,
+   AVFrame *in)
 {
 int ret;
 
-if ((ret = ff_framesync_process_frame(fs, 1)) < 0)
+if ((ret = ff_framesync2_process_frame(fs, 1)) < 0)
 return ret;
-if ((ret = ff_framesync_add_frame(fs, FF_INLINK_IDX(inlink), in)) < 0)
+if ((ret = ff_framesync2_add_frame(fs, FF_INLINK_IDX(inlink), in)) < 0)
 return ret;
-if ((ret = ff_framesync_process_frame(fs, 0)) < 0)
+if ((ret = ff_framesync2_process_frame(fs, 0)) < 0)
 return ret;
 return 0;
 }
 
-int ff_framesync_request_frame(FFFrameSync *fs, AVFilterLink *outlink)
+int ff_framesync2_request_frame(FFFrameSync *fs, AVFilterLink *outlink)
 {
 AVFilterContext *ctx = outlink->src;
 int input, ret, i;
 
-if ((ret = ff_framesync_process_frame(fs, 0)) < 0)
+if ((ret = ff_framesync2_process_frame(fs, 0)) < 0)
 return ret;
 if (ret > 0)
 return 0;
@@ -333,9 +333,9 @@ int ff_framesync_request_frame(FFFrameSync *fs, 
AVFilterLink *outlink)
 input = i;
 ret = ff_request_frame(ctx->inputs[input]);
 if (ret == AVERROR_EOF) {
-if ((ret = ff_framesync_add_frame(fs, input, NULL)) < 0)
+if ((ret = ff_framesync2_add_frame(fs, input, NULL)) < 0)
 return ret;
-if ((ret = ff_framesync_process_frame(fs, 0)) < 0)
+if ((ret = ff_framesync2_process_frame(fs, 0)) < 0)
 return ret;
 ret = 0;
 }
diff --git a/libavfilter/framesync2.h b/libavfilter/framesync2.h
index 074d30394f..e19d0f37e8 100644
--- a/libavfilter/framesync2.h
+++ b/libavfilter/framesync2.h
@@ -44,13 +44,13 @@
 

[FFmpeg-devel] [PATCH 2/7] lavfi: copy framesync into framesync2.

2017-07-17 Thread Nicolas George
framesync2 will be the base for the version using activate.
Most of the logic will be the same, but the code cannot be shared.
Copying the file initially without change will make the diff
easier to read.

Signed-off-by: Nicolas George 
---
 libavfilter/framesync2.c | 343 +++
 libavfilter/framesync2.h | 297 
 2 files changed, 640 insertions(+)
 create mode 100644 libavfilter/framesync2.c
 create mode 100644 libavfilter/framesync2.h


Except for the include guards, the files are identical to framesync.[ch].

I realize this level of code duplication is not good, but the duplication
goes way down in the next patches. Plus, I think we can move all filters to
this interfaec rather quickly and get rid of framesync1 and dualinput.


diff --git a/libavfilter/framesync2.c b/libavfilter/framesync2.c
new file mode 100644
index 00..eb05d66a86
--- /dev/null
+++ b/libavfilter/framesync2.c
@@ -0,0 +1,343 @@
+/*
+ * Copyright (c) 2013 Nicolas George
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define FF_INTERNAL_FIELDS 1
+#include "framequeue.h"
+
+#include "libavutil/avassert.h"
+#include "avfilter.h"
+#include "bufferqueue.h"
+#include "framesync.h"
+#include "internal.h"
+
+#define OFFSET(member) offsetof(FFFrameSync, member)
+
+static const char *framesync_name(void *ptr)
+{
+return "framesync";
+}
+
+static const AVClass framesync_class = {
+.version   = LIBAVUTIL_VERSION_INT,
+.class_name= "framesync",
+.item_name = framesync_name,
+.category  = AV_CLASS_CATEGORY_FILTER,
+.option= NULL,
+.parent_log_context_offset = OFFSET(parent),
+};
+
+enum {
+STATE_BOF,
+STATE_RUN,
+STATE_EOF,
+};
+
+int ff_framesync_init(FFFrameSync *fs, void *parent, unsigned nb_in)
+{
+fs->class  = &framesync_class;
+fs->parent = parent;
+fs->nb_in  = nb_in;
+
+fs->in = av_calloc(nb_in, sizeof(*fs->in));
+if (!fs->in)
+return AVERROR(ENOMEM);
+return 0;
+}
+
+static void framesync_sync_level_update(FFFrameSync *fs)
+{
+unsigned i, level = 0;
+
+for (i = 0; i < fs->nb_in; i++)
+if (fs->in[i].state != STATE_EOF)
+level = FFMAX(level, fs->in[i].sync);
+av_assert0(level <= fs->sync_level);
+if (level < fs->sync_level)
+av_log(fs, AV_LOG_VERBOSE, "Sync level %u\n", level);
+if (level)
+fs->sync_level = level;
+else
+fs->eof = 1;
+}
+
+int ff_framesync_configure(FFFrameSync *fs)
+{
+unsigned i;
+int64_t gcd, lcm;
+
+if (!fs->time_base.num) {
+for (i = 0; i < fs->nb_in; i++) {
+if (fs->in[i].sync) {
+if (fs->time_base.num) {
+gcd = av_gcd(fs->time_base.den, fs->in[i].time_base.den);
+lcm = (fs->time_base.den / gcd) * fs->in[i].time_base.den;
+if (lcm < AV_TIME_BASE / 2) {
+fs->time_base.den = lcm;
+fs->time_base.num = av_gcd(fs->time_base.num,
+   fs->in[i].time_base.num);
+} else {
+fs->time_base.num = 1;
+fs->time_base.den = AV_TIME_BASE;
+break;
+}
+} else {
+fs->time_base = fs->in[i].time_base;
+}
+}
+}
+if (!fs->time_base.num) {
+av_log(fs, AV_LOG_ERROR, "Impossible to set time base\n");
+return AVERROR(EINVAL);
+}
+av_log(fs, AV_LOG_VERBOSE, "Selected %d/%d time base\n",
+   fs->time_base.num, fs->time_base.den);
+}
+
+for (i = 0; i < fs->nb_in; i++)
+fs->in[i].pts = fs->in[i].pts_next = AV_NOPTS_VALUE;
+fs->sync_level = UINT_MAX;
+framesync_sync_level_update(fs);
+
+return 0;
+}
+
+static void framesync_advance(FFFrameSync *fs)
+{
+int latest;
+unsigned i;
+int64_t pts;
+
+if (fs->eof)
+return;
+while (!fs->frame_ready) {
+latest = -1;
+for (i = 0; i < fs->nb_in; i++) {
+if (!fs->in[i].h

[FFmpeg-devel] [PATCH 4/7] lavfi: make FFERROR_NOT_READY available to filters.

2017-07-17 Thread Nicolas George
I am not entirely sure that this return code is useful,
but having and using it makes no harm.

Signed-off-by: Nicolas George 
---
 libavfilter/avfilter.c | 2 --
 libavfilter/filters.h  | 5 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index e60b0247bc..185ba8df00 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1304,8 +1304,6 @@ static int forward_status_change(AVFilterContext *filter, 
AVFilterLink *in)
 return 0;
 }
 
-#define FFERROR_NOT_READY FFERRTAG('N','R','D','Y')
-
 static int ff_filter_activate_default(AVFilterContext *filter)
 {
 unsigned i;
diff --git a/libavfilter/filters.h b/libavfilter/filters.h
index 2c78d60e62..370d99b38b 100644
--- a/libavfilter/filters.h
+++ b/libavfilter/filters.h
@@ -28,6 +28,11 @@
 #include "avfilter.h"
 
 /**
+ * Special return code when activate() did not do anything.
+ */
+#define FFERROR_NOT_READY FFERRTAG('N','R','D','Y')
+
+/**
  * Mark a filter ready and schedule it for activation.
  *
  * This is automatically done when something happens to the filter (queued
-- 
2.13.2

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


[FFmpeg-devel] [PATCH 5/7] lavfi: add outlink helper functions.

2017-07-17 Thread Nicolas George
These wrappers cost nothing, they make the namespace more
consistent and they will be useful if/when locking becomes
necessary.

Signed-off-by: Nicolas George 
---
 libavfilter/filters.h | 21 +
 1 file changed, 21 insertions(+)

diff --git a/libavfilter/filters.h b/libavfilter/filters.h
index 370d99b38b..1cbc18158f 100644
--- a/libavfilter/filters.h
+++ b/libavfilter/filters.h
@@ -26,6 +26,7 @@
  */
 
 #include "avfilter.h"
+#include "internal.h"
 
 /**
  * Special return code when activate() did not do anything.
@@ -139,4 +140,24 @@ int ff_inlink_acknowledge_status(AVFilterLink *link, int 
*rstatus, int64_t *rpts
  */
 void ff_inlink_request_frame(AVFilterLink *link);
 
+/**
+ * Test if a frame is wanted on an output link.
+ */
+static inline int ff_outlink_frame_wanted(AVFilterLink *link)
+{
+return link->frame_wanted_out;
+}
+
+/**
+ * Set the status field of a link from the source filter.
+ * The pts should reflect the timestamp of the status change,
+ * in link time base and relative to the frames timeline.
+ * In particular, for AVERROR_EOF, it should reflect the
+ * end time of the last frame.
+ */
+static inline void ff_outlink_set_status(AVFilterLink *link, int status, 
int64_t pts)
+{
+ff_avfilter_link_set_in_status(link, status, pts);
+}
+
 #endif /* AVFILTER_FILTERS_H */
-- 
2.13.2

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


[FFmpeg-devel] [PATCH 6/7] lavfi/framesync2: implement activate design.

2017-07-17 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 libavfilter/framesync2.c | 166 +++
 libavfilter/framesync2.h |  77 --
 2 files changed, 82 insertions(+), 161 deletions(-)

diff --git a/libavfilter/framesync2.c b/libavfilter/framesync2.c
index 8d81bb5c48..0e9f6f210c 100644
--- a/libavfilter/framesync2.c
+++ b/libavfilter/framesync2.c
@@ -18,12 +18,9 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#define FF_INTERNAL_FIELDS 1
-#include "framequeue.h"
-
 #include "libavutil/avassert.h"
 #include "avfilter.h"
-#include "bufferqueue.h"
+#include "filters.h"
 #include "framesync2.h"
 #include "internal.h"
 
@@ -49,8 +46,13 @@ enum {
 STATE_EOF,
 };
 
-int ff_framesync2_init(FFFrameSync *fs, void *parent, unsigned nb_in)
+int ff_framesync2_init(FFFrameSync *fs, AVFilterContext *parent, unsigned 
nb_in)
 {
+/* For filters with several outputs, we will not be able to assume which
+   output is relevant for ff_outlink_frame_wanted() and
+   ff_outlink_set_status(). To be designed when needed. */
+av_assert0(parent->nb_outputs == 1);
+
 fs->class  = &framesync_class;
 fs->parent = parent;
 fs->nb_in  = nb_in;
@@ -61,6 +63,13 @@ int ff_framesync2_init(FFFrameSync *fs, void *parent, 
unsigned nb_in)
 return 0;
 }
 
+static void framesync_eof(FFFrameSync *fs)
+{
+fs->eof = 1;
+fs->frame_ready = 0;
+ff_outlink_set_status(fs->parent->outputs[0], AVERROR_EOF, AV_NOPTS_VALUE);
+}
+
 static void framesync_sync_level_update(FFFrameSync *fs)
 {
 unsigned i, level = 0;
@@ -74,7 +83,7 @@ static void framesync_sync_level_update(FFFrameSync *fs)
 if (level)
 fs->sync_level = level;
 else
-fs->eof = 1;
+framesync_eof(fs);
 }
 
 int ff_framesync2_configure(FFFrameSync *fs)
@@ -144,7 +153,7 @@ static void framesync_advance(FFFrameSync *fs)
 if (fs->in[i].pts_next < pts)
 pts = fs->in[i].pts_next;
 if (pts == INT64_MAX) {
-fs->eof = 1;
+framesync_eof(fs);
 break;
 }
 for (i = 0; i < fs->nb_in; i++) {
@@ -162,11 +171,9 @@ static void framesync_advance(FFFrameSync *fs)
 fs->frame_ready = 1;
 if (fs->in[i].state == STATE_EOF &&
 fs->in[i].after == EXT_STOP)
-fs->eof = 1;
+framesync_eof(fs);
 }
 }
-if (fs->eof)
-fs->frame_ready = 0;
 if (fs->frame_ready)
 for (i = 0; i < fs->nb_in; i++)
 if ((fs->in[i].state == STATE_BOF &&
@@ -188,45 +195,24 @@ static void framesync_inject_frame(FFFrameSync *fs, 
unsigned in, AVFrame *frame)
 int64_t pts;
 
 av_assert0(!fs->in[in].have_next);
-if (frame) {
-pts = av_rescale_q(frame->pts, fs->in[in].time_base, fs->time_base);
-frame->pts = pts;
-} else {
-pts = fs->in[in].state != STATE_RUN || fs->in[in].after == EXT_INFINITY
-? INT64_MAX : framesync_pts_extrapolate(fs, in, fs->in[in].pts);
-fs->in[in].sync = 0;
-framesync_sync_level_update(fs);
-}
+av_assert0(frame);
+pts = av_rescale_q(frame->pts, fs->in[in].time_base, fs->time_base);
+frame->pts = pts;
 fs->in[in].frame_next = frame;
 fs->in[in].pts_next   = pts;
 fs->in[in].have_next  = 1;
 }
 
-int ff_framesync2_add_frame(FFFrameSync *fs, unsigned in, AVFrame *frame)
-{
-av_assert1(in < fs->nb_in);
-if (!fs->in[in].have_next)
-framesync_inject_frame(fs, in, frame);
-else
-ff_bufqueue_add(fs, &fs->in[in].queue, frame);
-return 0;
-}
-
-void ff_framesync2_next(FFFrameSync *fs)
-{
-unsigned i;
-
-av_assert0(!fs->frame_ready);
-for (i = 0; i < fs->nb_in; i++)
-if (!fs->in[i].have_next && fs->in[i].queue.available)
-framesync_inject_frame(fs, i, ff_bufqueue_get(&fs->in[i].queue));
-fs->frame_ready = 0;
-framesync_advance(fs);
-}
-
-void ff_framesync2_drop(FFFrameSync *fs)
+static void framesync_inject_status(FFFrameSync *fs, unsigned in, int status, 
int64_t pts)
 {
-fs->frame_ready = 0;
+av_assert0(!fs->in[in].have_next);
+pts = fs->in[in].state != STATE_RUN || fs->in[in].after == EXT_INFINITY
+? INT64_MAX : framesync_pts_extrapolate(fs, in, fs->in[in].pts);
+fs->in[in].sync = 0;
+framesync_sync_level_update(fs);
+fs->in[in].frame_next = NULL;
+fs->in[in].pts_next   = pts;
+fs->in[in].have_next  = 1;
 }
 
 int ff_framesync2_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe,
@@ -273,71 +259,55 @@ void ff_framesync2_uninit(FFFrameSync *fs)
 for (i = 0; i < fs->nb_in; i++) {
 av_frame_free(&fs->in[i].frame);
 av_frame_free(&fs->in[i].frame_next);
-ff_bufqueue_discard_all(&fs->in[i].queue);
 }
 
 av_freep(&fs->in);
 }
 
-int ff_framesync2_process_frame(FFFrameSync *fs, unsigned all)
+int ff_framesy

[FFmpeg-devel] [PATCH 7/7] lavfi/vf_stack: move to activate design.

2017-07-17 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 libavfilter/Makefile   |  4 ++--
 libavfilter/vf_stack.c | 32 +---
 2 files changed, 15 insertions(+), 21 deletions(-)


Works as expected. Including shortest.
And no longer subject to bufferqueue overflows.


diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 4d85f658f3..3d4e55a33c 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -202,7 +202,7 @@ OBJS-$(CONFIG_HISTEQ_FILTER) += vf_histeq.o
 OBJS-$(CONFIG_HISTOGRAM_FILTER)  += vf_histogram.o
 OBJS-$(CONFIG_HQDN3D_FILTER) += vf_hqdn3d.o
 OBJS-$(CONFIG_HQX_FILTER)+= vf_hqx.o
-OBJS-$(CONFIG_HSTACK_FILTER) += vf_stack.o framesync.o
+OBJS-$(CONFIG_HSTACK_FILTER) += vf_stack.o framesync2.o
 OBJS-$(CONFIG_HUE_FILTER)+= vf_hue.o
 OBJS-$(CONFIG_HWDOWNLOAD_FILTER) += vf_hwdownload.o
 OBJS-$(CONFIG_HWMAP_FILTER)  += vf_hwmap.o
@@ -321,7 +321,7 @@ OBJS-$(CONFIG_VFLIP_FILTER)  += vf_vflip.o
 OBJS-$(CONFIG_VIDSTABDETECT_FILTER)  += vidstabutils.o 
vf_vidstabdetect.o
 OBJS-$(CONFIG_VIDSTABTRANSFORM_FILTER)   += vidstabutils.o 
vf_vidstabtransform.o
 OBJS-$(CONFIG_VIGNETTE_FILTER)   += vf_vignette.o
-OBJS-$(CONFIG_VSTACK_FILTER) += vf_stack.o framesync.o
+OBJS-$(CONFIG_VSTACK_FILTER) += vf_stack.o framesync2.o
 OBJS-$(CONFIG_W3FDIF_FILTER) += vf_w3fdif.o
 OBJS-$(CONFIG_WAVEFORM_FILTER)   += vf_waveform.o
 OBJS-$(CONFIG_WEAVE_FILTER)  += vf_weave.o
diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c
index 03643b6f96..fa8a02257e 100644
--- a/libavfilter/vf_stack.c
+++ b/libavfilter/vf_stack.c
@@ -26,7 +26,7 @@
 #include "avfilter.h"
 #include "formats.h"
 #include "internal.h"
-#include "framesync.h"
+#include "framesync2.h"
 #include "video.h"
 
 typedef struct StackContext {
@@ -58,12 +58,6 @@ static int query_formats(AVFilterContext *ctx)
 return ff_set_common_formats(ctx, pix_fmts);
 }
 
-static int filter_frame(AVFilterLink *inlink, AVFrame *in)
-{
-StackContext *s = inlink->dst->priv;
-return ff_framesync_filter_frame(&s->fs, inlink, in);
-}
-
 static av_cold int init(AVFilterContext *ctx)
 {
 StackContext *s = ctx->priv;
@@ -83,7 +77,6 @@ static av_cold int init(AVFilterContext *ctx)
 pad.name = av_asprintf("input%d", i);
 if (!pad.name)
 return AVERROR(ENOMEM);
-pad.filter_frame = filter_frame;
 
 if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) {
 av_freep(&pad.name);
@@ -104,7 +97,7 @@ static int process_frame(FFFrameSync *fs)
 int i, p, ret, offset[4] = { 0 };
 
 for (i = 0; i < s->nb_inputs; i++) {
-if ((ret = ff_framesync_get_frame(&s->fs, i, &in[i], 0)) < 0)
+if ((ret = ff_framesync2_get_frame(&s->fs, i, &in[i], 0)) < 0)
 return ret;
 }
 
@@ -187,7 +180,7 @@ static int config_output(AVFilterLink *outlink)
 outlink->time_base  = time_base;
 outlink->frame_rate = frame_rate;
 
-if ((ret = ff_framesync_init(&s->fs, ctx, s->nb_inputs)) < 0)
+if ((ret = ff_framesync2_init(&s->fs, ctx, s->nb_inputs)) < 0)
 return ret;
 
 in = s->fs.in;
@@ -203,13 +196,7 @@ static int config_output(AVFilterLink *outlink)
 in[i].after  = s->shortest ? EXT_STOP : EXT_INFINITY;
 }
 
-return ff_framesync_configure(&s->fs);
-}
-
-static int request_frame(AVFilterLink *outlink)
-{
-StackContext *s = outlink->src->priv;
-return ff_framesync_request_frame(&s->fs, outlink);
+return ff_framesync2_configure(&s->fs);
 }
 
 static av_cold void uninit(AVFilterContext *ctx)
@@ -217,13 +204,19 @@ static av_cold void uninit(AVFilterContext *ctx)
 StackContext *s = ctx->priv;
 int i;
 
-ff_framesync_uninit(&s->fs);
+ff_framesync2_uninit(&s->fs);
 av_freep(&s->frames);
 
 for (i = 0; i < ctx->nb_inputs; i++)
 av_freep(&ctx->input_pads[i].name);
 }
 
+static int activate(AVFilterContext *ctx)
+{
+StackContext *s = ctx->priv;
+return ff_framesync2_activate(&s->fs);
+}
+
 #define OFFSET(x) offsetof(StackContext, x)
 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
 static const AVOption stack_options[] = {
@@ -237,7 +230,6 @@ static const AVFilterPad outputs[] = {
 .name  = "default",
 .type  = AVMEDIA_TYPE_VIDEO,
 .config_props  = config_output,
-.request_frame = request_frame,
 },
 { NULL }
 };
@@ -256,6 +248,7 @@ AVFilter ff_vf_hstack = {
 .outputs   = outputs,
 .init  = init,
 .uninit= uninit,
+.activate  = activate,
 .flags = AVFILTER_FLAG_DYNAMIC_INPUTS,
 };
 
@@ -275,6 +268,7 @@ AVFilter ff_vf_vstack = {
 .outputs   = outputs,
 .init  = init,
 .uninit= uninit,
+.activate  = activ

Re: [FFmpeg-devel] [PATCH 1/7] Revert "Revert "lavfi/buffersrc: push the frame deeper if requested.""

2017-07-17 Thread James Almer
On 7/17/2017 11:19 AM, Nicolas George wrote:
> This reverts commit 04aa09c4bcf2d5a634a35da3a3ae3fc1abe30ef8.

You could mention this is also reverting
e5bce8b4ce7b1f3a83998febdfa86a3771df96ce.

> 
> The fate-ffm change is caused by field_order now being set
> on the output format because the first frame arrives earlier.
> The fate-mxf change is assumed to be the same.
> 
> Signed-off-by: Nicolas George 
> ---
>  libavfilter/buffersrc.c | 25 +
>  tests/ref/lavf/ffm  |  2 +-
>  tests/ref/lavf/mxf  |  6 +++---
>  3 files changed, 29 insertions(+), 4 deletions(-)
> 
> 
> The field_order info seems to not be printed by any tool, and I do not know
> the MXF format to check directly in the file; with FFM it was easy to see in
> a hexdump. Anyway, the fact that field order was not set before de-reverting
> hints at something fishy happening in the initialization code of ffmpeg. I
> do not have time nor motivation to investigate that, so I will assume the
> change is for the best like FFM.
> 
> If someone wants to investigate, the change can be toggled by simply adding
> "return 0" at the beginning of push_frame(), below.
> 
> 
> diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
> index 587b29b91a..e8f59c2de7 100644
> --- a/libavfilter/buffersrc.c
> +++ b/libavfilter/buffersrc.c
> @@ -173,6 +173,20 @@ int attribute_align_arg 
> av_buffersrc_add_frame_flags(AVFilterContext *ctx, AVFra
>  return ret;
>  }
>  
> +static int push_frame(AVFilterGraph *graph)
> +{
> +int ret;
> +
> +while (1) {
> +ret = ff_filter_graph_run_once(graph);
> +if (ret == AVERROR(EAGAIN))
> +break;
> +if (ret < 0)
> +return ret;
> +}
> +return 0;
> +}
> +
>  static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,
> AVFrame *frame, int flags)
>  {
> @@ -185,6 +199,11 @@ static int 
> av_buffersrc_add_frame_internal(AVFilterContext *ctx,
>  if (!frame) {
>  s->eof = 1;
>  ff_avfilter_link_set_in_status(ctx->outputs[0], AVERROR_EOF, 
> AV_NOPTS_VALUE);
> +if ((flags & AV_BUFFERSRC_FLAG_PUSH)) {
> +ret = push_frame(ctx->graph);
> +if (ret < 0)
> +return ret;
> +}
>  return 0;
>  } else if (s->eof)
>  return AVERROR(EINVAL);
> @@ -239,6 +258,12 @@ static int 
> av_buffersrc_add_frame_internal(AVFilterContext *ctx,
>  if ((ret = ctx->output_pads[0].request_frame(ctx->outputs[0])) < 0)
>  return ret;
>  
> +if ((flags & AV_BUFFERSRC_FLAG_PUSH)) {
> +ret = push_frame(ctx->graph);
> +if (ret < 0)
> +return ret;
> +}
> +
>  return 0;
>  }
>  
> diff --git a/tests/ref/lavf/ffm b/tests/ref/lavf/ffm
> index 54c56034aa..d9fa8d52cb 100644
> --- a/tests/ref/lavf/ffm
> +++ b/tests/ref/lavf/ffm
> @@ -1,3 +1,3 @@
> -a0e9616f0d9a8c1029f3220b1b9175f4 *./tests/data/lavf/lavf.ffm
> +ca2a450cd0d1e299514a345923b4c82a *./tests/data/lavf/lavf.ffm
>  376832 ./tests/data/lavf/lavf.ffm
>  ./tests/data/lavf/lavf.ffm CRC=0x000e23ae
> diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
> index 9ab4432c63..48fe95a235 100644
> --- a/tests/ref/lavf/mxf
> +++ b/tests/ref/lavf/mxf
> @@ -1,9 +1,9 @@
> -dbdbb7d8677dc29b0d90eedcf418ce13 *./tests/data/lavf/lavf.mxf
> +eaac3125ac1a61fe5f968c7af83fa71e *./tests/data/lavf/lavf.mxf
>  525369 ./tests/data/lavf/lavf.mxf
>  ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
> -40fcb0a898f8825a17f5754b23762f49 *./tests/data/lavf/lavf.mxf
> +1562530330b13e9e70f522fe20265632 *./tests/data/lavf/lavf.mxf
>  560697 ./tests/data/lavf/lavf.mxf
>  ./tests/data/lavf/lavf.mxf CRC=0xf21b1b48
> -9233d192af20fc2a89304f5ae93c21ee *./tests/data/lavf/lavf.mxf
> +e07858715997313ae66a1cdd6fde5f66 *./tests/data/lavf/lavf.mxf
>  525369 ./tests/data/lavf/lavf.mxf
>  ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
> 

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


Re: [FFmpeg-devel] [PATCH 1/7] Revert "Revert "lavfi/buffersrc: push the frame deeper if requested.""

2017-07-17 Thread Nicolas George
Le nonidi 29 messidor, an CCXXV, James Almer a écrit :
> You could mention this is also reverting
> e5bce8b4ce7b1f3a83998febdfa86a3771df96ce.

I had not noticed that the FATE changes were introduced in a separate
commit. I added this:

It also reverts e5bce8b4ce7b1f3a83998febdfa86a3771df96ce that fixed FATE refs.

to the commit message, at the beginning of the second paragraph.

Thanks for noticing.

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 1/7] Revert "Revert "lavfi/buffersrc: push the frame deeper if requested.""

2017-07-17 Thread Tobias Rapp

On 17.07.2017 16:19, Nicolas George wrote:

This reverts commit 04aa09c4bcf2d5a634a35da3a3ae3fc1abe30ef8.

The fate-ffm change is caused by field_order now being set
on the output format because the first frame arrives earlier.
The fate-mxf change is assumed to be the same.

Signed-off-by: Nicolas George 
---
 libavfilter/buffersrc.c | 25 +
 tests/ref/lavf/ffm  |  2 +-
 tests/ref/lavf/mxf  |  6 +++---
 3 files changed, 29 insertions(+), 4 deletions(-)


The field_order info seems to not be printed by any tool, and I do not know
the MXF format to check directly in the file; with FFM it was easy to see in
a hexdump. Anyway, the fact that field order was not set before de-reverting
hints at something fishy happening in the initialization code of ffmpeg. I
do not have time nor motivation to investigate that, so I will assume the
change is for the best like FFM.


ffprobe should be able to print the stream's field_order since commit 
54350f06e11727f255e3d1829cb1afde49931d8b




If someone wants to investigate, the change can be toggled by simply adding
"return 0" at the beginning of push_frame(), below.

[...]


Regards,
Tobias


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


[FFmpeg-devel] [PATCH V2 2/2] avcodec/vorbisenc: Apply dynamic frame lengths

2017-07-17 Thread Tyler Jones
Additional codebooks are added for shorter 128-sample frames. Changes in
codeword generation are made to handle valid values of 0 that prepend some
codebooks, otherwise books are classified incorrectly and cause unreadable
streams.

A second residue, floor, and mapping is created for short window lengths
so that values are partitioned correctly for transient frames.

Signed-off-by: Tyler Jones 
---
V2 -- Remove double arithmetic in window scale constant

 libavcodec/vorbis.c  |  10 +-
 libavcodec/vorbis_enc_data.h | 289 +++--
 libavcodec/vorbisenc.c   | 422 ++-
 tests/fate/vorbis.mak|   2 +-
 4 files changed, 453 insertions(+), 270 deletions(-)

diff --git a/libavcodec/vorbis.c b/libavcodec/vorbis.c
index 399020eec5..8befab8338 100644
--- a/libavcodec/vorbis.c
+++ b/libavcodec/vorbis.c
@@ -59,7 +59,7 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, 
unsigned num)
 unsigned i, j, p, code;
 
 for (p = 0; (bits[p] == 0) && (p < num); ++p)
-;
+codes[p] = 0;
 if (p == num)
 return 0;
 
@@ -78,9 +78,11 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, 
unsigned num)
 
 for (; p < num; ++p) {
 if (bits[p] > 32)
- return AVERROR_INVALIDDATA;
-if (bits[p] == 0)
- continue;
+return AVERROR_INVALIDDATA;
+if (bits[p] == 0) {
+codes[p] = 0;
+continue;
+}
 // find corresponding exit(node which the tree can grow further from)
 for (i = bits[p]; i > 0; --i)
 if (exit_at_level[i])
diff --git a/libavcodec/vorbis_enc_data.h b/libavcodec/vorbis_enc_data.h
index a51aaec978..eca43dfded 100644
--- a/libavcodec/vorbis_enc_data.h
+++ b/libavcodec/vorbis_enc_data.h
@@ -23,15 +23,78 @@
 
 #include 
 
-static const uint8_t codebook0[] = {
+static const uint8_t floor_128_c0[] = {
+10,  7,  8, 13,  9,  6,  7, 11, 10,  8,  8, 12, 17, 17, 17,
+17,  7,  5,  5,  9,  6,  4,  4,  8,  8,  5,  5,  8, 16, 14,
+13, 16,  7,  5,  5,  7,  6,  3,  3,  5,  8,  5,  4,  7, 14,
+12, 12, 15, 10,  7,  8,  9,  7,  5,  5,  6,  9,  6,  5,  5,
+15, 12,  9, 10,
+};
+
+static const uint8_t floor_128_c1[] = {
+ 8, 13, 17, 17,  8, 11, 17, 17, 11, 13, 17, 17, 17, 17, 17,
+17,  6, 10, 16, 17,  6, 10, 15, 17,  8, 10, 16, 17, 17, 17,
+17, 17,  9, 13, 15, 17,  8, 11, 17, 17, 10, 12, 17, 17, 17,
+17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+17, 17, 17, 17,  6, 11, 15, 17,  7, 10, 15, 17,  8, 10, 17,
+17, 17, 15, 17, 17,  4,  8, 13, 17,  4,  7, 13, 17,  6,  8,
+15, 17, 16, 15, 17, 17,  6, 11, 15, 17,  6,  9, 13, 17,  8,
+10, 17, 17, 15, 17, 17, 17, 16, 17, 17, 17, 12, 14, 15, 17,
+13, 14, 15, 17, 17, 17, 17, 17,  5, 10, 14, 17,  5,  9, 14,
+17,  7,  9, 15, 17, 15, 15, 17, 17,  3,  7, 12, 17,  3,  6,
+11, 17,  5,  7, 13, 17, 12, 12, 17, 17,  5,  9, 14, 17,  3,
+ 7, 11, 17,  5,  8, 13, 17, 13, 11, 16, 17, 12, 17, 17, 17,
+ 9, 14, 15, 17, 10, 11, 14, 17, 16, 14, 17, 17,  8, 12, 17,
+17,  8, 12, 17, 17, 10, 12, 17, 17, 17, 17, 17, 17,  5, 10,
+17, 17,  5,  9, 15, 17,  7,  9, 17, 17, 13, 13, 17, 17,  7,
+11, 17, 17,  6, 10, 15, 17,  7,  9, 15, 17, 12, 11, 17, 17,
+12, 15, 17, 17, 11, 14, 17, 17, 11, 10, 15, 17, 17, 16, 17,
+17,
+};
+
+static const uint8_t floor_128_0sub1[] = {
+ 0,  3,  3,  3,  3,  3,  3,  3,  3,
+};
+
+static const uint8_t floor_128_0sub2[] = {
+ 0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  3,  3,  4,  4,  4,
+ 4,  5,  4,  5,  4,  5,  4,  6,  4,  6,
+};
+
+static const uint8_t floor_128_0sub3[] = {
+ 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  5,  3,  5,  3,
+ 5,  4,  5,  4,  5,  5,  5,  5,  6,  5,  6,  5,  6,  5,  6,
+ 5,  6,  5,  7,  8,  9, 11, 13, 13, 13, 13, 13, 13, 13, 13,
+13, 13, 13, 13,
+};
+
+static const uint8_t floor_128_1sub1[] = {
+ 0,  3,  3,  2,  3,  3,  4,  3,  4,
+};
+
+static const uint8_t floor_128_1sub2[] = {
+ 0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  4,  3,  6,  3,  6,
+ 3,  6,  3,  7,  3,  8,  4,  9,  4,  9,
+};
+
+static const uint8_t floor_128_1sub3[] = {
+ 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  7,  2,  7,  3,
+ 8,  4,  9,  5,  9,  8, 10, 11, 11, 12, 14, 14, 14, 14, 14,
+14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+13, 13, 13, 13,
+};
+
+static const uint8_t floor_1024_c1[] = {
 2, 10,  8, 14,  7, 12, 11, 14,  1,  5,  3,  7,  4,  9,  7, 13,
 };
 
-static const uint8_t codebook1[] = {
+static const uint8_t floor_1024_c2[] = {
 1,  4,  2,  6,  3,  7,  5,  7,
 };
 
-static const uint8_t codebook2[] = {
+static const uint8_t floor_1024_c3[] = {
  1,  5,  7, 21,  5,  8,  9, 21, 10,  9, 12, 20, 20, 16, 20,
 20,  4,  8,  9, 20,  6,  8,  9, 20, 11, 11, 13, 20, 20, 15,

[FFmpeg-devel] [PATCH V2 1/2] avcodec/vorbisenc: Add pre-echo detection

2017-07-17 Thread Tyler Jones
The encoder will attempt to determine the existence of transient
signals by applying a 4th order highpass filter to remove dominant
low frequency waveforms. Frames are then split up into blocks
where the variance is calculated and compared with blocks from
the previous frame. A preecho is only likely to be noticeable when
relatively quiet audio is followed by a loud transient signal.

Signed-off-by: Tyler Jones 
---
V2 - Properly prefix non-static functions with "ff_"

 libavcodec/Makefile|   2 +-
 libavcodec/vorbisenc.c |  28 +++--
 libavcodec/vorbispsy.c | 153 +
 libavcodec/vorbispsy.h |  79 +
 4 files changed, 256 insertions(+), 6 deletions(-)
 create mode 100644 libavcodec/vorbispsy.c
 create mode 100644 libavcodec/vorbispsy.h

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 59029a853c..8c2beb3315 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -610,7 +610,7 @@ OBJS-$(CONFIG_VMNC_DECODER)+= vmnc.o
 OBJS-$(CONFIG_VORBIS_DECODER)  += vorbisdec.o vorbisdsp.o vorbis.o \
   vorbis_data.o
 OBJS-$(CONFIG_VORBIS_ENCODER)  += vorbisenc.o vorbis.o \
-  vorbis_data.o
+  vorbis_data.o vorbispsy.o
 OBJS-$(CONFIG_VP3_DECODER) += vp3.o
 OBJS-$(CONFIG_VP5_DECODER) += vp5.o vp56.o vp56data.o vp56rac.o
 OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o \
diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c
index bf21a3b1ff..5dc803aabb 100644
--- a/libavcodec/vorbisenc.c
+++ b/libavcodec/vorbisenc.c
@@ -33,6 +33,7 @@
 #include "mathops.h"
 #include "vorbis.h"
 #include "vorbis_enc_data.h"
+#include "vorbispsy.h"
 
 #include "audio_frame_queue.h"
 #include "libavfilter/bufferqueue.h"
@@ -136,6 +137,7 @@ typedef struct vorbis_enc_context {
 int64_t next_pts;
 
 AVFloatDSPContext *fdsp;
+VorbisPsyContext *vpctx;
 } vorbis_enc_context;
 
 #define MAX_CHANNELS 2
@@ -272,11 +274,12 @@ static int create_vorbis_context(vorbis_enc_context *venc,
 vorbis_enc_floor   *fc;
 vorbis_enc_residue *rc;
 vorbis_enc_mapping *mc;
-int i, book, ret;
+int i, book, ret, blocks;
 
 venc->channels= avctx->channels;
 venc->sample_rate = avctx->sample_rate;
-venc->log2_blocksize[0] = venc->log2_blocksize[1] = 11;
+venc->log2_blocksize[0] = 8;
+venc->log2_blocksize[1] = 11;
 
 venc->ncodebooks = FF_ARRAY_ELEMS(cvectors);
 venc->codebooks  = av_malloc(sizeof(vorbis_enc_codebook) * 
venc->ncodebooks);
@@ -464,6 +467,12 @@ static int create_vorbis_context(vorbis_enc_context *venc,
 if ((ret = dsp_init(avctx, venc)) < 0)
 return ret;
 
+blocks = 1 << (venc->log2_blocksize[1] - venc->log2_blocksize[0]);
+venc->vpctx = av_mallocz(sizeof(VorbisPsyContext));
+if (!venc->vpctx || (ret = ff_psy_vorbis_init(venc->vpctx, 
venc->sample_rate,
+  venc->channels, blocks)) < 0)
+return AVERROR(ENOMEM);
+
 return 0;
 }
 
@@ -1071,22 +1080,23 @@ static void move_audio(vorbis_enc_context *venc, int 
sf_size)
 float *save = venc->saved + ch * frame_size;
 const float *input = (float *) cur->extended_data[ch];
 const size_t len  = cur->nb_samples * sizeof(float);
-
 memcpy(offset + sf*sf_size, input, len);
 memcpy(save + sf*sf_size, input, len);   // Move samples for next 
frame
 }
 av_frame_free(&cur);
 }
 venc->have_saved = 1;
-memcpy(venc->scratch, venc->samples, 2 * venc->channels * frame_size);
+memcpy(venc->scratch, venc->samples, sizeof(float) * venc->channels * 2 * 
frame_size);
 }
 
 static int vorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
const AVFrame *frame, int *got_packet_ptr)
 {
 vorbis_enc_context *venc = avctx->priv_data;
-int i, ret, need_more;
+int i, ret, need_more, ch;
+int curr_win = 1;
 int frame_size = 1 << (venc->log2_blocksize[1] - 1);
+int block_size = 1 << (venc->log2_blocksize[0] - 1);
 vorbis_enc_mode *mode;
 vorbis_enc_mapping *mapping;
 PutBitContext pb;
@@ -1121,6 +1131,13 @@ static int vorbis_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 
 move_audio(venc, avctx->frame_size);
 
+for (ch = 0; ch < venc->channels; ch++) {
+float *scratch = venc->scratch + 2 * ch * frame_size + frame_size;
+
+if (!ff_psy_vorbis_block_frame(venc->vpctx, scratch, ch, frame_size, 
block_size))
+curr_win = 0;
+}
+
 if (!apply_window_and_mdct(venc))
 return 0;
 
@@ -1252,6 +1269,7 @@ static av_cold int vorbis_encode_close(AVCodecContext 
*avctx)
 ff_mdct_end(&venc->mdct[1]);
 ff_af_queue_close(&venc->afq);
 ff_bufqueue_discard_all(&venc->bufqueue);
+ff_psy_vorbis_close

[FFmpeg-devel] [PATCH 01/10] lavfi/vf_threshold: move to activate design.

2017-07-17 Thread Nicolas George
Also fix missing dependency.

Signed-off-by: Nicolas George 
---
 libavfilter/Makefile   |  2 +-
 libavfilter/vf_threshold.c | 34 --
 2 files changed, 13 insertions(+), 23 deletions(-)


For all this series: the filter builds, FATE passes, but no further tests
have been done.

These are all the filters that use framesync directly except streamselect
that will require a more careful look. TODO: dualinput.


diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 6f8e7b5ae1..b34272830e 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -308,7 +308,7 @@ OBJS-$(CONFIG_SWAPRECT_FILTER)   += 
vf_swaprect.o
 OBJS-$(CONFIG_SWAPUV_FILTER) += vf_swapuv.o
 OBJS-$(CONFIG_TBLEND_FILTER) += vf_blend.o dualinput.o 
framesync.o
 OBJS-$(CONFIG_TELECINE_FILTER)   += vf_telecine.o
-OBJS-$(CONFIG_THRESHOLD_FILTER)  += vf_threshold.o
+OBJS-$(CONFIG_THRESHOLD_FILTER)  += vf_threshold.o framesync2.o
 OBJS-$(CONFIG_THUMBNAIL_FILTER)  += vf_thumbnail.o
 OBJS-$(CONFIG_TILE_FILTER)   += vf_tile.o
 OBJS-$(CONFIG_TINTERLACE_FILTER) += vf_tinterlace.o
diff --git a/libavfilter/vf_threshold.c b/libavfilter/vf_threshold.c
index 1cb4c9aab8..6a64f270fe 100644
--- a/libavfilter/vf_threshold.c
+++ b/libavfilter/vf_threshold.c
@@ -28,7 +28,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 #include "avfilter.h"
-#include "framesync.h"
+#include "framesync2.h"
 #include "internal.h"
 #include "video.h"
 
@@ -96,10 +96,10 @@ static int process_frame(FFFrameSync *fs)
 AVFrame *out, *in, *threshold, *min, *max;
 int ret;
 
-if ((ret = ff_framesync_get_frame(&s->fs, 0, &in,0)) < 0 ||
-(ret = ff_framesync_get_frame(&s->fs, 1, &threshold, 0)) < 0 ||
-(ret = ff_framesync_get_frame(&s->fs, 2, &min,   0)) < 0 ||
-(ret = ff_framesync_get_frame(&s->fs, 3, &max,   0)) < 0)
+if ((ret = ff_framesync2_get_frame(&s->fs, 0, &in,0)) < 0 ||
+(ret = ff_framesync2_get_frame(&s->fs, 1, &threshold, 0)) < 0 ||
+(ret = ff_framesync2_get_frame(&s->fs, 2, &min,   0)) < 0 ||
+(ret = ff_framesync2_get_frame(&s->fs, 3, &max,   0)) < 0)
 return ret;
 
 if (ctx->is_disabled) {
@@ -256,7 +256,7 @@ static int config_output(AVFilterLink *outlink)
 outlink->sample_aspect_ratio = base->sample_aspect_ratio;
 outlink->frame_rate = base->frame_rate;
 
-if ((ret = ff_framesync_init(&s->fs, ctx, 4)) < 0)
+if ((ret = ff_framesync2_init(&s->fs, ctx, 4)) < 0)
 return ret;
 
 in = s->fs.in;
@@ -279,49 +279,39 @@ static int config_output(AVFilterLink *outlink)
 s->fs.opaque   = s;
 s->fs.on_event = process_frame;
 
-return ff_framesync_configure(&s->fs);
+return ff_framesync2_configure(&s->fs);
 }
 
-static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
+static int activate(AVFilterContext *ctx)
 {
-ThresholdContext *s = inlink->dst->priv;
-return ff_framesync_filter_frame(&s->fs, inlink, buf);
-}
-
-static int request_frame(AVFilterLink *outlink)
-{
-ThresholdContext *s = outlink->src->priv;
-return ff_framesync_request_frame(&s->fs, outlink);
+ThresholdContext *s = ctx->priv;
+return ff_framesync2_activate(&s->fs);
 }
 
 static av_cold void uninit(AVFilterContext *ctx)
 {
 ThresholdContext *s = ctx->priv;
 
-ff_framesync_uninit(&s->fs);
+ff_framesync2_uninit(&s->fs);
 }
 
 static const AVFilterPad inputs[] = {
 {
 .name = "default",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 .config_props = config_input,
 },
 {
 .name = "threshold",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 },
 {
 .name = "min",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 },
 {
 .name = "max",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 },
 { NULL }
 };
@@ -331,7 +321,6 @@ static const AVFilterPad outputs[] = {
 .name  = "default",
 .type  = AVMEDIA_TYPE_VIDEO,
 .config_props  = config_output,
-.request_frame = request_frame,
 },
 { NULL }
 };
@@ -343,6 +332,7 @@ AVFilter ff_vf_threshold = {
 .priv_class= &threshold_class,
 .uninit= uninit,
 .query_formats = query_formats,
+.activate  = activate,
 .inputs= inputs,
 .outputs   = outputs,
 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL,
-- 
2.13.2

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


[FFmpeg-devel] [PATCH 03/10] lavfi/vf_premultiply: move to activate design.

2017-07-17 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 libavfilter/Makefile |  2 +-
 libavfilter/vf_premultiply.c | 28 ++--
 2 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 7acf13b0aa..5acda236e6 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -256,7 +256,7 @@ OBJS-$(CONFIG_PIXDESCTEST_FILTER)+= 
vf_pixdesctest.o
 OBJS-$(CONFIG_PIXSCOPE_FILTER)   += vf_datascope.o
 OBJS-$(CONFIG_PP_FILTER) += vf_pp.o
 OBJS-$(CONFIG_PP7_FILTER)+= vf_pp7.o
-OBJS-$(CONFIG_PREMULTIPLY_FILTER)+= vf_premultiply.o framesync.o
+OBJS-$(CONFIG_PREMULTIPLY_FILTER)+= vf_premultiply.o framesync2.o
 OBJS-$(CONFIG_PREWITT_FILTER)+= vf_convolution.o
 OBJS-$(CONFIG_PSNR_FILTER)   += vf_psnr.o dualinput.o 
framesync.o
 OBJS-$(CONFIG_PULLUP_FILTER) += vf_pullup.o
diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c
index 8a5f9eac64..4bb850edd5 100644
--- a/libavfilter/vf_premultiply.c
+++ b/libavfilter/vf_premultiply.c
@@ -23,7 +23,7 @@
 #include "libavutil/opt.h"
 #include "avfilter.h"
 #include "formats.h"
-#include "framesync.h"
+#include "framesync2.h"
 #include "internal.h"
 #include "video.h"
 
@@ -207,8 +207,8 @@ static int process_frame(FFFrameSync *fs)
 AVFrame *out, *base, *alpha;
 int ret;
 
-if ((ret = ff_framesync_get_frame(&s->fs, 0, &base,  0)) < 0 ||
-(ret = ff_framesync_get_frame(&s->fs, 1, &alpha, 0)) < 0)
+if ((ret = ff_framesync2_get_frame(&s->fs, 0, &base,  0)) < 0 ||
+(ret = ff_framesync2_get_frame(&s->fs, 1, &alpha, 0)) < 0)
 return ret;
 
 if (ctx->is_disabled) {
@@ -345,7 +345,7 @@ static int config_output(AVFilterLink *outlink)
 outlink->sample_aspect_ratio = base->sample_aspect_ratio;
 outlink->frame_rate = base->frame_rate;
 
-if ((ret = ff_framesync_init(&s->fs, ctx, 2)) < 0)
+if ((ret = ff_framesync2_init(&s->fs, ctx, 2)) < 0)
 return ret;
 
 in = s->fs.in;
@@ -360,39 +360,31 @@ static int config_output(AVFilterLink *outlink)
 s->fs.opaque   = s;
 s->fs.on_event = process_frame;
 
-return ff_framesync_configure(&s->fs);
+return ff_framesync2_configure(&s->fs);
 }
 
-static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
+static int activate(AVFilterContext *ctx)
 {
-PreMultiplyContext *s = inlink->dst->priv;
-return ff_framesync_filter_frame(&s->fs, inlink, buf);
-}
-
-static int request_frame(AVFilterLink *outlink)
-{
-PreMultiplyContext *s = outlink->src->priv;
-return ff_framesync_request_frame(&s->fs, outlink);
+PreMultiplyContext *s = ctx->priv;
+return ff_framesync2_activate(&s->fs);
 }
 
 static av_cold void uninit(AVFilterContext *ctx)
 {
 PreMultiplyContext *s = ctx->priv;
 
-ff_framesync_uninit(&s->fs);
+ff_framesync2_uninit(&s->fs);
 }
 
 static const AVFilterPad premultiply_inputs[] = {
 {
 .name = "main",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 .config_props = config_input,
 },
 {
 .name = "alpha",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 },
 { NULL }
 };
@@ -402,7 +394,6 @@ static const AVFilterPad premultiply_outputs[] = {
 .name  = "default",
 .type  = AVMEDIA_TYPE_VIDEO,
 .config_props  = config_output,
-.request_frame = request_frame,
 },
 { NULL }
 };
@@ -413,6 +404,7 @@ AVFilter ff_vf_premultiply = {
 .priv_size = sizeof(PreMultiplyContext),
 .uninit= uninit,
 .query_formats = query_formats,
+.activate  = activate,
 .inputs= premultiply_inputs,
 .outputs   = premultiply_outputs,
 .priv_class= &premultiply_class,
-- 
2.13.2

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


[FFmpeg-devel] [PATCH 02/10] lavfi/vf_remap: move to activate design.

2017-07-17 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 libavfilter/Makefile   |  2 +-
 libavfilter/vf_remap.c | 30 +++---
 2 files changed, 12 insertions(+), 20 deletions(-)

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index b34272830e..7acf13b0aa 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -265,7 +265,7 @@ OBJS-$(CONFIG_RANDOM_FILTER) += vf_random.o
 OBJS-$(CONFIG_READEIA608_FILTER) += vf_readeia608.o
 OBJS-$(CONFIG_READVITC_FILTER)   += vf_readvitc.o
 OBJS-$(CONFIG_REALTIME_FILTER)   += f_realtime.o
-OBJS-$(CONFIG_REMAP_FILTER)  += vf_remap.o framesync.o
+OBJS-$(CONFIG_REMAP_FILTER)  += vf_remap.o framesync2.o
 OBJS-$(CONFIG_REMOVEGRAIN_FILTER)+= vf_removegrain.o
 OBJS-$(CONFIG_REMOVELOGO_FILTER) += bbox.o lswsutils.o lavfutils.o 
vf_removelogo.o
 OBJS-$(CONFIG_REPEATFIELDS_FILTER)   += vf_repeatfields.o
diff --git a/libavfilter/vf_remap.c b/libavfilter/vf_remap.c
index b7182e9556..d549912fcf 100644
--- a/libavfilter/vf_remap.c
+++ b/libavfilter/vf_remap.c
@@ -41,7 +41,7 @@
 #include "libavutil/opt.h"
 #include "avfilter.h"
 #include "formats.h"
-#include "framesync.h"
+#include "framesync2.h"
 #include "internal.h"
 #include "video.h"
 
@@ -283,9 +283,9 @@ static int process_frame(FFFrameSync *fs)
 AVFrame *out, *in, *xpic, *ypic;
 int ret;
 
-if ((ret = ff_framesync_get_frame(&s->fs, 0, &in,   0)) < 0 ||
-(ret = ff_framesync_get_frame(&s->fs, 1, &xpic, 0)) < 0 ||
-(ret = ff_framesync_get_frame(&s->fs, 2, &ypic, 0)) < 0)
+if ((ret = ff_framesync2_get_frame(&s->fs, 0, &in,   0)) < 0 ||
+(ret = ff_framesync2_get_frame(&s->fs, 1, &xpic, 0)) < 0 ||
+(ret = ff_framesync2_get_frame(&s->fs, 2, &ypic, 0)) < 0)
 return ret;
 
 if (ctx->is_disabled) {
@@ -330,7 +330,7 @@ static int config_output(AVFilterLink *outlink)
 outlink->sample_aspect_ratio = srclink->sample_aspect_ratio;
 outlink->frame_rate = srclink->frame_rate;
 
-ret = ff_framesync_init(&s->fs, ctx, 3);
+ret = ff_framesync2_init(&s->fs, ctx, 3);
 if (ret < 0)
 return ret;
 
@@ -350,44 +350,36 @@ static int config_output(AVFilterLink *outlink)
 s->fs.opaque   = s;
 s->fs.on_event = process_frame;
 
-return ff_framesync_configure(&s->fs);
+return ff_framesync2_configure(&s->fs);
 }
 
-static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
+static int activate(AVFilterContext *ctx)
 {
-RemapContext *s = inlink->dst->priv;
-return ff_framesync_filter_frame(&s->fs, inlink, buf);
+RemapContext *s = ctx->priv;
+return ff_framesync2_activate(&s->fs);
 }
 
-static int request_frame(AVFilterLink *outlink)
-{
-RemapContext *s = outlink->src->priv;
-return ff_framesync_request_frame(&s->fs, outlink);
-}
 
 static av_cold void uninit(AVFilterContext *ctx)
 {
 RemapContext *s = ctx->priv;
 
-ff_framesync_uninit(&s->fs);
+ff_framesync2_uninit(&s->fs);
 }
 
 static const AVFilterPad remap_inputs[] = {
 {
 .name = "source",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 .config_props = config_input,
 },
 {
 .name = "xmap",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 },
 {
 .name = "ymap",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 },
 { NULL }
 };
@@ -397,7 +389,6 @@ static const AVFilterPad remap_outputs[] = {
 .name  = "default",
 .type  = AVMEDIA_TYPE_VIDEO,
 .config_props  = config_output,
-.request_frame = request_frame,
 },
 { NULL }
 };
@@ -408,6 +399,7 @@ AVFilter ff_vf_remap = {
 .priv_size = sizeof(RemapContext),
 .uninit= uninit,
 .query_formats = query_formats,
+.activate  = activate,
 .inputs= remap_inputs,
 .outputs   = remap_outputs,
 .priv_class= &remap_class,
-- 
2.13.2

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


[FFmpeg-devel] [PATCH 04/10] lavfi/vf_midequalizer: move to activate design.

2017-07-17 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 libavfilter/Makefile  |  2 +-
 libavfilter/vf_midequalizer.c | 28 ++--
 2 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 5acda236e6..0edd33576f 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -231,7 +231,7 @@ OBJS-$(CONFIG_MCDEINT_FILTER)+= vf_mcdeint.o
 OBJS-$(CONFIG_MERGEPLANES_FILTER)+= vf_mergeplanes.o framesync.o
 OBJS-$(CONFIG_MESTIMATE_FILTER)  += vf_mestimate.o 
motion_estimation.o
 OBJS-$(CONFIG_METADATA_FILTER)   += f_metadata.o
-OBJS-$(CONFIG_MIDEQUALIZER_FILTER)   += vf_midequalizer.o framesync.o
+OBJS-$(CONFIG_MIDEQUALIZER_FILTER)   += vf_midequalizer.o framesync2.o
 OBJS-$(CONFIG_MINTERPOLATE_FILTER)   += vf_minterpolate.o 
motion_estimation.o
 OBJS-$(CONFIG_MPDECIMATE_FILTER) += vf_mpdecimate.o
 OBJS-$(CONFIG_NEGATE_FILTER) += vf_lut.o
diff --git a/libavfilter/vf_midequalizer.c b/libavfilter/vf_midequalizer.c
index 99d26c751e..9d9ad1aec1 100644
--- a/libavfilter/vf_midequalizer.c
+++ b/libavfilter/vf_midequalizer.c
@@ -25,7 +25,7 @@
 #include "formats.h"
 #include "internal.h"
 #include "video.h"
-#include "framesync.h"
+#include "framesync2.h"
 
 typedef struct MidEqualizerContext {
 const AVClass *class;
@@ -89,8 +89,8 @@ static int process_frame(FFFrameSync *fs)
 AVFrame *out, *in0, *in1;
 int ret;
 
-if ((ret = ff_framesync_get_frame(&s->fs, 0, &in0, 0)) < 0 ||
-(ret = ff_framesync_get_frame(&s->fs, 1, &in1, 0)) < 0)
+if ((ret = ff_framesync2_get_frame(&s->fs, 0, &in0, 0)) < 0 ||
+(ret = ff_framesync2_get_frame(&s->fs, 1, &in1, 0)) < 0)
 return ret;
 
 if (ctx->is_disabled) {
@@ -311,7 +311,7 @@ static int config_output(AVFilterLink *outlink)
 outlink->sample_aspect_ratio = in0->sample_aspect_ratio;
 outlink->frame_rate = in0->frame_rate;
 
-if ((ret = ff_framesync_init(&s->fs, ctx, 2)) < 0)
+if ((ret = ff_framesync2_init(&s->fs, ctx, 2)) < 0)
 return ret;
 
 in = s->fs.in;
@@ -326,26 +326,20 @@ static int config_output(AVFilterLink *outlink)
 s->fs.opaque   = s;
 s->fs.on_event = process_frame;
 
-return ff_framesync_configure(&s->fs);
+return ff_framesync2_configure(&s->fs);
 }
 
-static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
+static int activate(AVFilterContext *ctx)
 {
-MidEqualizerContext *s = inlink->dst->priv;
-return ff_framesync_filter_frame(&s->fs, inlink, buf);
-}
-
-static int request_frame(AVFilterLink *outlink)
-{
-MidEqualizerContext *s = outlink->src->priv;
-return ff_framesync_request_frame(&s->fs, outlink);
+MidEqualizerContext *s = ctx->priv;
+return ff_framesync2_activate(&s->fs);
 }
 
 static av_cold void uninit(AVFilterContext *ctx)
 {
 MidEqualizerContext *s = ctx->priv;
 
-ff_framesync_uninit(&s->fs);
+ff_framesync2_uninit(&s->fs);
 av_freep(&s->histogram[0]);
 av_freep(&s->histogram[1]);
 av_freep(&s->cchange);
@@ -355,13 +349,11 @@ static const AVFilterPad midequalizer_inputs[] = {
 {
 .name = "in0",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 .config_props = config_input0,
 },
 {
 .name = "in1",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 .config_props = config_input1,
 },
 { NULL }
@@ -372,7 +364,6 @@ static const AVFilterPad midequalizer_outputs[] = {
 .name  = "default",
 .type  = AVMEDIA_TYPE_VIDEO,
 .config_props  = config_output,
-.request_frame = request_frame,
 },
 { NULL }
 };
@@ -383,6 +374,7 @@ AVFilter ff_vf_midequalizer = {
 .priv_size = sizeof(MidEqualizerContext),
 .uninit= uninit,
 .query_formats = query_formats,
+.activate  = activate,
 .inputs= midequalizer_inputs,
 .outputs   = midequalizer_outputs,
 .priv_class= &midequalizer_class,
-- 
2.13.2

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


[FFmpeg-devel] [PATCH 05/10] lavfi/vf_maskedmerge: move to activate design.

2017-07-17 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 libavfilter/Makefile |  2 +-
 libavfilter/maskedmerge.h|  2 +-
 libavfilter/vf_maskedmerge.c | 29 ++---
 3 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 0edd33576f..5128f0f937 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -226,7 +226,7 @@ OBJS-$(CONFIG_LUT3D_FILTER)  += vf_lut3d.o
 OBJS-$(CONFIG_LUTRGB_FILTER) += vf_lut.o
 OBJS-$(CONFIG_LUTYUV_FILTER) += vf_lut.o
 OBJS-$(CONFIG_MASKEDCLAMP_FILTER)+= vf_maskedclamp.o framesync.o
-OBJS-$(CONFIG_MASKEDMERGE_FILTER)+= vf_maskedmerge.o framesync.o
+OBJS-$(CONFIG_MASKEDMERGE_FILTER)+= vf_maskedmerge.o framesync2.o
 OBJS-$(CONFIG_MCDEINT_FILTER)+= vf_mcdeint.o
 OBJS-$(CONFIG_MERGEPLANES_FILTER)+= vf_mergeplanes.o framesync.o
 OBJS-$(CONFIG_MESTIMATE_FILTER)  += vf_mestimate.o 
motion_estimation.o
diff --git a/libavfilter/maskedmerge.h b/libavfilter/maskedmerge.h
index 8e2b1cf676..3d670f6d5d 100644
--- a/libavfilter/maskedmerge.h
+++ b/libavfilter/maskedmerge.h
@@ -22,7 +22,7 @@
 #define AVFILTER_MASKEDMERGE_H
 
 #include "avfilter.h"
-#include "framesync.h"
+#include "framesync2.h"
 
 typedef struct MaskedMergeContext {
 const AVClass *class;
diff --git a/libavfilter/vf_maskedmerge.c b/libavfilter/vf_maskedmerge.c
index cf8a56814e..54def62820 100644
--- a/libavfilter/vf_maskedmerge.c
+++ b/libavfilter/vf_maskedmerge.c
@@ -71,9 +71,9 @@ static int process_frame(FFFrameSync *fs)
 AVFrame *out, *base, *overlay, *mask;
 int ret;
 
-if ((ret = ff_framesync_get_frame(&s->fs, 0, &base,0)) < 0 ||
-(ret = ff_framesync_get_frame(&s->fs, 1, &overlay, 0)) < 0 ||
-(ret = ff_framesync_get_frame(&s->fs, 2, &mask,0)) < 0)
+if ((ret = ff_framesync2_get_frame(&s->fs, 0, &base,0)) < 0 ||
+(ret = ff_framesync2_get_frame(&s->fs, 1, &overlay, 0)) < 0 ||
+(ret = ff_framesync2_get_frame(&s->fs, 2, &mask,0)) < 0)
 return ret;
 
 if (ctx->is_disabled) {
@@ -232,7 +232,7 @@ static int config_output(AVFilterLink *outlink)
 if ((ret = av_image_fill_linesizes(s->linesize, outlink->format, 
outlink->w)) < 0)
 return ret;
 
-if ((ret = ff_framesync_init(&s->fs, ctx, 3)) < 0)
+if ((ret = ff_framesync2_init(&s->fs, ctx, 3)) < 0)
 return ret;
 
 in = s->fs.in;
@@ -251,44 +251,35 @@ static int config_output(AVFilterLink *outlink)
 s->fs.opaque   = s;
 s->fs.on_event = process_frame;
 
-return ff_framesync_configure(&s->fs);
+return ff_framesync2_configure(&s->fs);
 }
 
-static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
+static int activate(AVFilterContext *ctx)
 {
-MaskedMergeContext *s = inlink->dst->priv;
-return ff_framesync_filter_frame(&s->fs, inlink, buf);
-}
-
-static int request_frame(AVFilterLink *outlink)
-{
-MaskedMergeContext *s = outlink->src->priv;
-return ff_framesync_request_frame(&s->fs, outlink);
+MaskedMergeContext *s = ctx->priv;
+return ff_framesync2_activate(&s->fs);
 }
 
 static av_cold void uninit(AVFilterContext *ctx)
 {
 MaskedMergeContext *s = ctx->priv;
 
-ff_framesync_uninit(&s->fs);
+ff_framesync2_uninit(&s->fs);
 }
 
 static const AVFilterPad maskedmerge_inputs[] = {
 {
 .name = "base",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 .config_props = config_input,
 },
 {
 .name = "overlay",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 },
 {
 .name = "mask",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 },
 { NULL }
 };
@@ -298,7 +289,6 @@ static const AVFilterPad maskedmerge_outputs[] = {
 .name  = "default",
 .type  = AVMEDIA_TYPE_VIDEO,
 .config_props  = config_output,
-.request_frame = request_frame,
 },
 { NULL }
 };
@@ -309,6 +299,7 @@ AVFilter ff_vf_maskedmerge = {
 .priv_size = sizeof(MaskedMergeContext),
 .uninit= uninit,
 .query_formats = query_formats,
+.activate  = activate,
 .inputs= maskedmerge_inputs,
 .outputs   = maskedmerge_outputs,
 .priv_class= &maskedmerge_class,
-- 
2.13.2

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


[FFmpeg-devel] [PATCH 06/10] lavfi/vf_mergeplanes: move to activate design.

2017-07-17 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 libavfilter/Makefile |  2 +-
 libavfilter/vf_mergeplanes.c | 25 +
 2 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 5128f0f937..16a7e87c04 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -228,7 +228,7 @@ OBJS-$(CONFIG_LUTYUV_FILTER) += vf_lut.o
 OBJS-$(CONFIG_MASKEDCLAMP_FILTER)+= vf_maskedclamp.o framesync.o
 OBJS-$(CONFIG_MASKEDMERGE_FILTER)+= vf_maskedmerge.o framesync2.o
 OBJS-$(CONFIG_MCDEINT_FILTER)+= vf_mcdeint.o
-OBJS-$(CONFIG_MERGEPLANES_FILTER)+= vf_mergeplanes.o framesync.o
+OBJS-$(CONFIG_MERGEPLANES_FILTER)+= vf_mergeplanes.o framesync2.o
 OBJS-$(CONFIG_MESTIMATE_FILTER)  += vf_mestimate.o 
motion_estimation.o
 OBJS-$(CONFIG_METADATA_FILTER)   += f_metadata.o
 OBJS-$(CONFIG_MIDEQUALIZER_FILTER)   += vf_midequalizer.o framesync2.o
diff --git a/libavfilter/vf_mergeplanes.c b/libavfilter/vf_mergeplanes.c
index c21104320d..b8ccee0802 100644
--- a/libavfilter/vf_mergeplanes.c
+++ b/libavfilter/vf_mergeplanes.c
@@ -25,7 +25,7 @@
 #include "libavutil/pixdesc.h"
 #include "avfilter.h"
 #include "internal.h"
-#include "framesync.h"
+#include "framesync2.h"
 
 typedef struct InputParam {
 int depth[4];
@@ -58,12 +58,6 @@ static const AVOption mergeplanes_options[] = {
 
 AVFILTER_DEFINE_CLASS(mergeplanes);
 
-static int filter_frame(AVFilterLink *inlink, AVFrame *in)
-{
-MergePlanesContext *s = inlink->dst->priv;
-return ff_framesync_filter_frame(&s->fs, inlink, in);
-}
-
 static av_cold int init(AVFilterContext *ctx)
 {
 MergePlanesContext *s = ctx->priv;
@@ -101,7 +95,6 @@ static av_cold int init(AVFilterContext *ctx)
 pad.name = av_asprintf("in%d", i);
 if (!pad.name)
 return AVERROR(ENOMEM);
-pad.filter_frame = filter_frame;
 
 if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0){
 av_freep(&pad.name);
@@ -150,7 +143,7 @@ static int process_frame(FFFrameSync *fs)
 int i, ret;
 
 for (i = 0; i < s->nb_inputs; i++) {
-if ((ret = ff_framesync_get_frame(&s->fs, i, &in[i], 0)) < 0)
+if ((ret = ff_framesync2_get_frame(&s->fs, i, &in[i], 0)) < 0)
 return ret;
 }
 
@@ -179,7 +172,7 @@ static int config_output(AVFilterLink *outlink)
 FFFrameSyncIn *in;
 int i, ret;
 
-if ((ret = ff_framesync_init(&s->fs, ctx, s->nb_inputs)) < 0)
+if ((ret = ff_framesync2_init(&s->fs, ctx, s->nb_inputs)) < 0)
 return ret;
 
 in = s->fs.in;
@@ -272,15 +265,15 @@ static int config_output(AVFilterLink *outlink)
 }
 }
 
-return ff_framesync_configure(&s->fs);
+return ff_framesync2_configure(&s->fs);
 fail:
 return AVERROR(EINVAL);
 }
 
-static int request_frame(AVFilterLink *outlink)
+static int activate(AVFilterContext *ctx)
 {
-MergePlanesContext *s = outlink->src->priv;
-return ff_framesync_request_frame(&s->fs, outlink);
+MergePlanesContext *s = ctx->priv;
+return ff_framesync2_activate(&s->fs);
 }
 
 static av_cold void uninit(AVFilterContext *ctx)
@@ -288,7 +281,7 @@ static av_cold void uninit(AVFilterContext *ctx)
 MergePlanesContext *s = ctx->priv;
 int i;
 
-ff_framesync_uninit(&s->fs);
+ff_framesync2_uninit(&s->fs);
 
 for (i = 0; i < ctx->nb_inputs; i++)
 av_freep(&ctx->input_pads[i].name);
@@ -299,7 +292,6 @@ static const AVFilterPad mergeplanes_outputs[] = {
 .name  = "default",
 .type  = AVMEDIA_TYPE_VIDEO,
 .config_props  = config_output,
-.request_frame = request_frame,
 },
 { NULL }
 };
@@ -312,6 +304,7 @@ AVFilter ff_vf_mergeplanes = {
 .init  = init,
 .uninit= uninit,
 .query_formats = query_formats,
+.activate  = activate,
 .inputs= NULL,
 .outputs   = mergeplanes_outputs,
 .flags = AVFILTER_FLAG_DYNAMIC_INPUTS,
-- 
2.13.2

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


[FFmpeg-devel] [PATCH 07/10] lavfi/vf_maskedclamp: move to activate design.

2017-07-17 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 libavfilter/Makefile |  2 +-
 libavfilter/vf_maskedclamp.c | 31 +++
 2 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 16a7e87c04..18d42a7596 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -225,7 +225,7 @@ OBJS-$(CONFIG_LUT2_FILTER)   += vf_lut2.o 
framesync.o
 OBJS-$(CONFIG_LUT3D_FILTER)  += vf_lut3d.o
 OBJS-$(CONFIG_LUTRGB_FILTER) += vf_lut.o
 OBJS-$(CONFIG_LUTYUV_FILTER) += vf_lut.o
-OBJS-$(CONFIG_MASKEDCLAMP_FILTER)+= vf_maskedclamp.o framesync.o
+OBJS-$(CONFIG_MASKEDCLAMP_FILTER)+= vf_maskedclamp.o framesync2.o
 OBJS-$(CONFIG_MASKEDMERGE_FILTER)+= vf_maskedmerge.o framesync2.o
 OBJS-$(CONFIG_MCDEINT_FILTER)+= vf_mcdeint.o
 OBJS-$(CONFIG_MERGEPLANES_FILTER)+= vf_mergeplanes.o framesync2.o
diff --git a/libavfilter/vf_maskedclamp.c b/libavfilter/vf_maskedclamp.c
index 25c1a73be0..5ad8aa7f66 100644
--- a/libavfilter/vf_maskedclamp.c
+++ b/libavfilter/vf_maskedclamp.c
@@ -25,7 +25,7 @@
 #include "formats.h"
 #include "internal.h"
 #include "video.h"
-#include "framesync.h"
+#include "framesync2.h"
 
 #define OFFSET(x) offsetof(MaskedClampContext, x)
 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
@@ -93,9 +93,9 @@ static int process_frame(FFFrameSync *fs)
 AVFrame *out, *base, *dark, *bright;
 int ret;
 
-if ((ret = ff_framesync_get_frame(&s->fs, 0, &base,   0)) < 0 ||
-(ret = ff_framesync_get_frame(&s->fs, 1, &dark,   0)) < 0 ||
-(ret = ff_framesync_get_frame(&s->fs, 2, &bright, 0)) < 0)
+if ((ret = ff_framesync2_get_frame(&s->fs, 0, &base,   0)) < 0 ||
+(ret = ff_framesync2_get_frame(&s->fs, 1, &dark,   0)) < 0 ||
+(ret = ff_framesync2_get_frame(&s->fs, 2, &bright, 0)) < 0)
 return ret;
 
 if (ctx->is_disabled) {
@@ -265,7 +265,7 @@ static int config_output(AVFilterLink *outlink)
 outlink->sample_aspect_ratio = base->sample_aspect_ratio;
 outlink->frame_rate = base->frame_rate;
 
-if ((ret = ff_framesync_init(&s->fs, ctx, 3)) < 0)
+if ((ret = ff_framesync2_init(&s->fs, ctx, 3)) < 0)
 return ret;
 
 in = s->fs.in;
@@ -284,44 +284,35 @@ static int config_output(AVFilterLink *outlink)
 s->fs.opaque   = s;
 s->fs.on_event = process_frame;
 
-return ff_framesync_configure(&s->fs);
+return ff_framesync2_configure(&s->fs);
 }
 
-static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
+static int activate(AVFilterContext *ctx)
 {
-MaskedClampContext *s = inlink->dst->priv;
-return ff_framesync_filter_frame(&s->fs, inlink, buf);
-}
-
-static int request_frame(AVFilterLink *outlink)
-{
-MaskedClampContext *s = outlink->src->priv;
-return ff_framesync_request_frame(&s->fs, outlink);
+MaskedClampContext *s = ctx->priv;
+return ff_framesync2_activate(&s->fs);
 }
 
 static av_cold void uninit(AVFilterContext *ctx)
 {
 MaskedClampContext *s = ctx->priv;
 
-ff_framesync_uninit(&s->fs);
+ff_framesync2_uninit(&s->fs);
 }
 
 static const AVFilterPad maskedclamp_inputs[] = {
 {
 .name = "base",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 .config_props = config_input,
 },
 {
 .name = "dark",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 },
 {
 .name = "bright",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 },
 { NULL }
 };
@@ -331,7 +322,6 @@ static const AVFilterPad maskedclamp_outputs[] = {
 .name  = "default",
 .type  = AVMEDIA_TYPE_VIDEO,
 .config_props  = config_output,
-.request_frame = request_frame,
 },
 { NULL }
 };
@@ -341,6 +331,7 @@ AVFilter ff_vf_maskedclamp = {
 .description   = NULL_IF_CONFIG_SMALL("Clamp first stream with second 
stream and third stream."),
 .priv_size = sizeof(MaskedClampContext),
 .uninit= uninit,
+.activate  = activate,
 .query_formats = query_formats,
 .inputs= maskedclamp_inputs,
 .outputs   = maskedclamp_outputs,
-- 
2.13.2

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


[FFmpeg-devel] [PATCH 08/10] lavfi/vf_lut2: move to activate design.

2017-07-17 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 libavfilter/Makefile  |  2 +-
 libavfilter/vf_lut2.c | 26 +-
 2 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 18d42a7596..27ceb339a4 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -221,7 +221,7 @@ OBJS-$(CONFIG_LIMITER_FILTER)+= vf_limiter.o
 OBJS-$(CONFIG_LOOP_FILTER)   += f_loop.o
 OBJS-$(CONFIG_LUMAKEY_FILTER)+= vf_lumakey.o
 OBJS-$(CONFIG_LUT_FILTER)+= vf_lut.o
-OBJS-$(CONFIG_LUT2_FILTER)   += vf_lut2.o framesync.o
+OBJS-$(CONFIG_LUT2_FILTER)   += vf_lut2.o framesync2.o
 OBJS-$(CONFIG_LUT3D_FILTER)  += vf_lut3d.o
 OBJS-$(CONFIG_LUTRGB_FILTER) += vf_lut.o
 OBJS-$(CONFIG_LUTYUV_FILTER) += vf_lut.o
diff --git a/libavfilter/vf_lut2.c b/libavfilter/vf_lut2.c
index 25790bb3a3..f7e4a6a656 100644
--- a/libavfilter/vf_lut2.c
+++ b/libavfilter/vf_lut2.c
@@ -28,7 +28,7 @@
 #include "formats.h"
 #include "internal.h"
 #include "video.h"
-#include "framesync.h"
+#include "framesync2.h"
 
 static const char *const var_names[] = {
 "w",///< width of the input video
@@ -206,8 +206,8 @@ static int process_frame(FFFrameSync *fs)
 AVFrame *out, *srcx, *srcy;
 int ret;
 
-if ((ret = ff_framesync_get_frame(&s->fs, 0, &srcx, 0)) < 0 ||
-(ret = ff_framesync_get_frame(&s->fs, 1, &srcy, 0)) < 0)
+if ((ret = ff_framesync2_get_frame(&s->fs, 0, &srcx, 0)) < 0 ||
+(ret = ff_framesync2_get_frame(&s->fs, 1, &srcy, 0)) < 0)
 return ret;
 
 if (ctx->is_disabled) {
@@ -266,7 +266,7 @@ static int config_output(AVFilterLink *outlink)
 outlink->sample_aspect_ratio = srcx->sample_aspect_ratio;
 outlink->frame_rate = srcx->frame_rate;
 
-if ((ret = ff_framesync_init(&s->fs, ctx, 2)) < 0)
+if ((ret = ff_framesync2_init(&s->fs, ctx, 2)) < 0)
 return ret;
 
 in = s->fs.in;
@@ -323,32 +323,24 @@ static int config_output(AVFilterLink *outlink)
 }
 }
 
-return ff_framesync_configure(&s->fs);
+return ff_framesync2_configure(&s->fs);
 }
 
-static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
+static int activate(AVFilterContext *ctx)
 {
-LUT2Context *s = inlink->dst->priv;
-return ff_framesync_filter_frame(&s->fs, inlink, buf);
-}
-
-static int request_frame(AVFilterLink *outlink)
-{
-LUT2Context *s = outlink->src->priv;
-return ff_framesync_request_frame(&s->fs, outlink);
+LUT2Context *s = ctx->priv;
+return ff_framesync2_activate(&s->fs);
 }
 
 static const AVFilterPad inputs[] = {
 {
 .name = "srcx",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 .config_props = config_inputx,
 },
 {
 .name = "srcy",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 .config_props = config_inputy,
 },
 { NULL }
@@ -359,7 +351,6 @@ static const AVFilterPad outputs[] = {
 .name  = "default",
 .type  = AVMEDIA_TYPE_VIDEO,
 .config_props  = config_output,
-.request_frame = request_frame,
 },
 { NULL }
 };
@@ -373,6 +364,7 @@ AVFilter ff_vf_lut2 = {
 .priv_class= &lut2_class,
 .uninit= uninit,
 .query_formats = query_formats,
+.activate  = activate,
 .inputs= inputs,
 .outputs   = outputs,
 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL,
-- 
2.13.2

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


[FFmpeg-devel] [PATCH 09/10] lavfi/vf_hysteresis: move to activate design.

2017-07-17 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 libavfilter/Makefile|  2 +-
 libavfilter/vf_hysteresis.c | 28 ++--
 2 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 27ceb339a4..441e07843f 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -208,7 +208,7 @@ OBJS-$(CONFIG_HWDOWNLOAD_FILTER) += 
vf_hwdownload.o
 OBJS-$(CONFIG_HWMAP_FILTER)  += vf_hwmap.o
 OBJS-$(CONFIG_HWUPLOAD_CUDA_FILTER)  += vf_hwupload_cuda.o
 OBJS-$(CONFIG_HWUPLOAD_FILTER)   += vf_hwupload.o
-OBJS-$(CONFIG_HYSTERESIS_FILTER) += vf_hysteresis.o framesync.o
+OBJS-$(CONFIG_HYSTERESIS_FILTER) += vf_hysteresis.o framesync2.o
 OBJS-$(CONFIG_IDET_FILTER)   += vf_idet.o
 OBJS-$(CONFIG_IL_FILTER) += vf_il.o
 OBJS-$(CONFIG_INFLATE_FILTER)+= vf_neighbor.o
diff --git a/libavfilter/vf_hysteresis.c b/libavfilter/vf_hysteresis.c
index c0369b2066..c3b769b8a7 100644
--- a/libavfilter/vf_hysteresis.c
+++ b/libavfilter/vf_hysteresis.c
@@ -26,7 +26,7 @@
 #include "formats.h"
 #include "internal.h"
 #include "video.h"
-#include "framesync.h"
+#include "framesync2.h"
 
 #define OFFSET(x) offsetof(HysteresisContext, x)
 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
@@ -94,8 +94,8 @@ static int process_frame(FFFrameSync *fs)
 AVFrame *out, *base, *alt;
 int ret;
 
-if ((ret = ff_framesync_get_frame(&s->fs, 0, &base, 0)) < 0 ||
-(ret = ff_framesync_get_frame(&s->fs, 1, &alt,  0)) < 0)
+if ((ret = ff_framesync2_get_frame(&s->fs, 0, &base, 0)) < 0 ||
+(ret = ff_framesync2_get_frame(&s->fs, 1, &alt,  0)) < 0)
 return ret;
 
 if (ctx->is_disabled) {
@@ -324,7 +324,7 @@ static int config_output(AVFilterLink *outlink)
 outlink->sample_aspect_ratio = base->sample_aspect_ratio;
 outlink->frame_rate = base->frame_rate;
 
-if ((ret = ff_framesync_init(&s->fs, ctx, 2)) < 0)
+if ((ret = ff_framesync2_init(&s->fs, ctx, 2)) < 0)
 return ret;
 
 in = s->fs.in;
@@ -339,26 +339,20 @@ static int config_output(AVFilterLink *outlink)
 s->fs.opaque   = s;
 s->fs.on_event = process_frame;
 
-return ff_framesync_configure(&s->fs);
+return ff_framesync2_configure(&s->fs);
 }
 
-static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
+static int activate(AVFilterContext *ctx)
 {
-HysteresisContext *s = inlink->dst->priv;
-return ff_framesync_filter_frame(&s->fs, inlink, buf);
-}
-
-static int request_frame(AVFilterLink *outlink)
-{
-HysteresisContext *s = outlink->src->priv;
-return ff_framesync_request_frame(&s->fs, outlink);
+HysteresisContext *s = ctx->priv;
+return ff_framesync2_activate(&s->fs);
 }
 
 static av_cold void uninit(AVFilterContext *ctx)
 {
 HysteresisContext *s = ctx->priv;
 
-ff_framesync_uninit(&s->fs);
+ff_framesync2_uninit(&s->fs);
 av_freep(&s->map);
 av_freep(&s->xy);
 }
@@ -367,13 +361,11 @@ static const AVFilterPad hysteresis_inputs[] = {
 {
 .name = "base",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 .config_props = config_input,
 },
 {
 .name = "alt",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 },
 { NULL }
 };
@@ -383,7 +375,6 @@ static const AVFilterPad hysteresis_outputs[] = {
 .name  = "default",
 .type  = AVMEDIA_TYPE_VIDEO,
 .config_props  = config_output,
-.request_frame = request_frame,
 },
 { NULL }
 };
@@ -394,6 +385,7 @@ AVFilter ff_vf_hysteresis = {
 .priv_size = sizeof(HysteresisContext),
 .uninit= uninit,
 .query_formats = query_formats,
+.activate  = activate,
 .inputs= hysteresis_inputs,
 .outputs   = hysteresis_outputs,
 .priv_class= &hysteresis_class,
-- 
2.13.2

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


[FFmpeg-devel] [PATCH 10/10] lavfi/vf_displace: move to activate design.

2017-07-17 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 libavfilter/Makefile  |  2 +-
 libavfilter/vf_displace.c | 31 +++
 2 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 441e07843f..4d61d7835e 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -168,7 +168,7 @@ OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
 OBJS-$(CONFIG_DESHAKE_FILTER)+= vf_deshake.o
 OBJS-$(CONFIG_DETELECINE_FILTER) += vf_detelecine.o
 OBJS-$(CONFIG_DILATION_FILTER)   += vf_neighbor.o
-OBJS-$(CONFIG_DISPLACE_FILTER)   += vf_displace.o framesync.o
+OBJS-$(CONFIG_DISPLACE_FILTER)   += vf_displace.o framesync2.o
 OBJS-$(CONFIG_DOUBLEWEAVE_FILTER)+= vf_weave.o
 OBJS-$(CONFIG_DRAWBOX_FILTER)+= vf_drawbox.o
 OBJS-$(CONFIG_DRAWGRAPH_FILTER)  += f_drawgraph.o
diff --git a/libavfilter/vf_displace.c b/libavfilter/vf_displace.c
index 9daa0c9ddb..6100a249c6 100644
--- a/libavfilter/vf_displace.c
+++ b/libavfilter/vf_displace.c
@@ -23,7 +23,7 @@
 #include "libavutil/opt.h"
 #include "avfilter.h"
 #include "formats.h"
-#include "framesync.h"
+#include "framesync2.h"
 #include "internal.h"
 #include "video.h"
 
@@ -212,9 +212,9 @@ static int process_frame(FFFrameSync *fs)
 AVFrame *out, *in, *xpic, *ypic;
 int ret;
 
-if ((ret = ff_framesync_get_frame(&s->fs, 0, &in,   0)) < 0 ||
-(ret = ff_framesync_get_frame(&s->fs, 1, &xpic, 0)) < 0 ||
-(ret = ff_framesync_get_frame(&s->fs, 2, &ypic, 0)) < 0)
+if ((ret = ff_framesync2_get_frame(&s->fs, 0, &in,   0)) < 0 ||
+(ret = ff_framesync2_get_frame(&s->fs, 1, &xpic, 0)) < 0 ||
+(ret = ff_framesync2_get_frame(&s->fs, 2, &ypic, 0)) < 0)
 return ret;
 
 if (ctx->is_disabled) {
@@ -310,7 +310,7 @@ static int config_output(AVFilterLink *outlink)
 outlink->sample_aspect_ratio = srclink->sample_aspect_ratio;
 outlink->frame_rate = srclink->frame_rate;
 
-ret = ff_framesync_init(&s->fs, ctx, 3);
+ret = ff_framesync2_init(&s->fs, ctx, 3);
 if (ret < 0)
 return ret;
 
@@ -330,44 +330,35 @@ static int config_output(AVFilterLink *outlink)
 s->fs.opaque   = s;
 s->fs.on_event = process_frame;
 
-return ff_framesync_configure(&s->fs);
+return ff_framesync2_configure(&s->fs);
 }
 
-static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
+static int activate(AVFilterContext *ctx)
 {
-DisplaceContext *s = inlink->dst->priv;
-return ff_framesync_filter_frame(&s->fs, inlink, buf);
-}
-
-static int request_frame(AVFilterLink *outlink)
-{
-DisplaceContext *s = outlink->src->priv;
-return ff_framesync_request_frame(&s->fs, outlink);
+DisplaceContext *s = ctx->priv;
+return ff_framesync2_activate(&s->fs);
 }
 
 static av_cold void uninit(AVFilterContext *ctx)
 {
 DisplaceContext *s = ctx->priv;
 
-ff_framesync_uninit(&s->fs);
+ff_framesync2_uninit(&s->fs);
 }
 
 static const AVFilterPad displace_inputs[] = {
 {
 .name = "source",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 .config_props = config_input,
 },
 {
 .name = "xmap",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 },
 {
 .name = "ymap",
 .type = AVMEDIA_TYPE_VIDEO,
-.filter_frame = filter_frame,
 },
 { NULL }
 };
@@ -377,7 +368,6 @@ static const AVFilterPad displace_outputs[] = {
 .name  = "default",
 .type  = AVMEDIA_TYPE_VIDEO,
 .config_props  = config_output,
-.request_frame = request_frame,
 },
 { NULL }
 };
@@ -388,6 +378,7 @@ AVFilter ff_vf_displace = {
 .priv_size = sizeof(DisplaceContext),
 .uninit= uninit,
 .query_formats = query_formats,
+.activate  = activate,
 .inputs= displace_inputs,
 .outputs   = displace_outputs,
 .priv_class= &displace_class,
-- 
2.13.2

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


[FFmpeg-devel] [PATCH] avcodec/documentation: fixing a typo in AVCodecContext->field_order description

2017-07-17 Thread Александр Слободенюк


0001-avcodec-documentation-fixing-a-typo-in-AVCodecContex.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/documentation: fixing a typo in AVCodecContext->field_order description

2017-07-17 Thread Александр Слободенюк
Well,  sorry,  I  was  wrong..  I  see from the code (by grep) that
encoders  don't  use field_order field at all.. I hope it was helpful
anyway, because the decoding is set by libavcodec.







-- 
С уважением,
 Александр  mailto:alexander.sloboden...@bramtech.ru

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


[FFmpeg-devel] SSL certificate for ffmpeg.org website is not valid anymore

2017-07-17 Thread Boris Pek
Hi there,

I am not sure where bug-reports about your web-site should be sent to,
so I am writing here. Please CC me in replies, I am not subscribed.

Recently in my Debian Sid (unstable) system I have faced with problem
of downloading of tarballs from https://ffmpeg.org/releases/ using wget
command line tool. For example:

$ LC_ALL=C wget -v https://ffmpeg.org/releases/ffmpeg-3.3.2.tar.xz
--2017-07-03 16:54:21--  https://ffmpeg.org/releases/ffmpeg-3.3.2.tar.xz
Resolving ffmpeg.org (ffmpeg.org)... 79.124.17.100
Connecting to ffmpeg.org (ffmpeg.org)|79.124.17.100|:443... connected.
ERROR: The certificate of 'ffmpeg.org' is not trusted.
ERROR: The certificate of 'ffmpeg.org' hasn't got a known issuer.
ERROR: The certificate of 'ffmpeg.org' was signed using an insecure algorithm.

Yes, command line option "--no-check-certificate" may be used in this case,
but I have tried to find the root of problem and have found that ffmpeg.org
uses SSL certificate from StartCom Ltd. which is not trusted certification
authority for now.

Latest news about this topic:
https://groups.google.com/a/chromium.org/forum/#!topic/net-dev/FKXe-76GO8Y

Older news:
https://blog.mozilla.org/security/2016/10/24/distrusting-new-wosign-and-startcom-certificates/
https://security.googleblog.com/2016/10/distrusting-wosign-and-startcom.html

Other links:
https://bugs.chromium.org/p/chromium/issues/detail?id=685826
https://bugzilla.mozilla.org/show_bug.cgi?id=1309707

Consider switching to another certification authority in the nearest future.
For example, you may use free service from Let's Encrypt, which is very simple
in use and quite good automated.

Please forward this email to people who maintain your website, if they are
not subscribed to this mailing list.

Best regards,
Boris
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] SSL certificate for ffmpeg.org website is not valid anymore

2017-07-17 Thread Moritz Barsnick
On Mon, Jul 10, 2017 at 13:53:02 +0300, Boris Pek wrote:
> Latest news about this topic:
> https://groups.google.com/a/chromium.org/forum/#!topic/net-dev/FKXe-76GO8Y

Ah, thanks, I neglected to report this, because I thought it was an
issue with my Opera Developer (48), which uses the Chrome engine. Opera
(like Chrome) recently reports ffmpeg.org's certificate as revoked, but
I found no tool which could verify this...

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


Re: [FFmpeg-devel] SSL certificate for ffmpeg.org website is not valid anymore

2017-07-17 Thread Hendrik Leppkes
On Tue, Jul 18, 2017 at 12:49 AM, Moritz Barsnick  wrote:
> On Mon, Jul 10, 2017 at 13:53:02 +0300, Boris Pek wrote:
>> Latest news about this topic:
>> https://groups.google.com/a/chromium.org/forum/#!topic/net-dev/FKXe-76GO8Y
>
> Ah, thanks, I neglected to report this, because I thought it was an
> issue with my Opera Developer (48), which uses the Chrome engine. Opera
> (like Chrome) recently reports ffmpeg.org's certificate as revoked, but
> I found no tool which could verify this...
>

Chrome 59 (latest stable) still trusts the certificate just fine.

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


Re: [FFmpeg-devel] SSL certificate for ffmpeg.org website is not valid anymore

2017-07-17 Thread James Almer
On 7/17/2017 7:49 PM, Moritz Barsnick wrote:
> On Mon, Jul 10, 2017 at 13:53:02 +0300, Boris Pek wrote:
>> Latest news about this topic:
>> https://groups.google.com/a/chromium.org/forum/#!topic/net-dev/FKXe-76GO8Y
> 
> Ah, thanks, I neglected to report this, because I thought it was an
> issue with my Opera Developer (48), which uses the Chrome engine. Opera
> (like Chrome) recently reports ffmpeg.org's certificate as revoked, but
> I found no tool which could verify this...

The cert is by StartCom. Afaik everyone blacklisted certs issued by them
after a certain date, and now some, like Google, are also blacklisting
certs issued before that date as well.
Mozilla hasn't done the latter yet, so Firefox doesn't complain about
it, but i guess a new cert is overdue.

PS: Vivaldi (Also Chromium/Blink) doesn't complain about the cert.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] SSL certificate for ffmpeg.org website is not valid anymore

2017-07-17 Thread Moritz Barsnick
On Tue, Jul 18, 2017 at 00:57:10 +0200, Hendrik Leppkes wrote:
> Chrome 59 (latest stable) still trusts the certificate just fine.

As Boris's links clearly explain: Chrome rejects these licenses
starting with version 61.

My Opera "developer" build has recently been bumped to Chrome 61
(unlike Opera stable and Opera beta), that's why I noticed.

IOW, only the bleeding edgers are suffering as of now. ;-) (Not sure
whether Debian Sid is considered "bleeding edge" though.)

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


Re: [FFmpeg-devel] SSL certificate for ffmpeg.org website is not valid anymore

2017-07-17 Thread Reimar Döffinger
On 18.07.2017, at 00:59, James Almer  wrote:

> On 7/17/2017 7:49 PM, Moritz Barsnick wrote:
>> On Mon, Jul 10, 2017 at 13:53:02 +0300, Boris Pek wrote:
>>> Latest news about this topic:
>>> https://groups.google.com/a/chromium.org/forum/#!topic/net-dev/FKXe-76GO8Y
>> 
>> Ah, thanks, I neglected to report this, because I thought it was an
>> issue with my Opera Developer (48), which uses the Chrome engine. Opera
>> (like Chrome) recently reports ffmpeg.org's certificate as revoked, but
>> I found no tool which could verify this...
> 
> The cert is by StartCom. Afaik everyone blacklisted certs issued by them
> after a certain date, and now some, like Google, are also blacklisting
> certs issued before that date as well.
> Mozilla hasn't done the latter yet, so Firefox doesn't complain about
> it, but i guess a new cert is overdue.

New certs are already being generated, but nobody had the time to do the 
transition, there is a risk of the automation failing (I think the web server 
needs to be made to reload the certificate, which is problematic as an ordinary 
user and there is no way I'd ever run any of that letsencrypt stuff as root), 
it is also a step backwards as the letsencrypt one is a domain-only 
certificate, and due to TLS's idiotic design decisions it's not possible to 
just deliver both certificates...
Thus the current situation.
Lack of time for proper testing being the biggest issue though...
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] SSL certificate for ffmpeg.org website is not valid anymore

2017-07-17 Thread Michael Niedermayer
On Tue, Jul 18, 2017 at 01:52:53AM +0200, Reimar Döffinger wrote:
> On 18.07.2017, at 00:59, James Almer  wrote:
> 
> > On 7/17/2017 7:49 PM, Moritz Barsnick wrote:
> >> On Mon, Jul 10, 2017 at 13:53:02 +0300, Boris Pek wrote:
> >>> Latest news about this topic:
> >>> https://groups.google.com/a/chromium.org/forum/#!topic/net-dev/FKXe-76GO8Y
> >> 
> >> Ah, thanks, I neglected to report this, because I thought it was an
> >> issue with my Opera Developer (48), which uses the Chrome engine. Opera
> >> (like Chrome) recently reports ffmpeg.org's certificate as revoked, but
> >> I found no tool which could verify this...
> > 
> > The cert is by StartCom. Afaik everyone blacklisted certs issued by them
> > after a certain date, and now some, like Google, are also blacklisting
> > certs issued before that date as well.
> > Mozilla hasn't done the latter yet, so Firefox doesn't complain about
> > it, but i guess a new cert is overdue.
> 
> New certs are already being generated, but nobody had the time to do the 
> transition, there is a risk of the automation failing (I think the web server 
> needs to be made to reload the certificate, which is problematic as an 
> ordinary user and there is no way I'd ever run any of that letsencrypt stuff 
> as root), it is also a step backwards as the letsencrypt one is a domain-only 
> certificate, and due to TLS's idiotic design decisions it's not possible to 
> just deliver both certificates...
> Thus the current situation.
> Lack of time for proper testing being the biggest issue though...

maybe a non free certificate would be a solution ?

a few minutes with google found this:
https://www.ssl2buy.com/comodo-multi-domain-wildcard-ssl.php
IIUC this is 128 USD per year

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope


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


Re: [FFmpeg-devel] [PATCH 4/7] lavfi: make FFERROR_NOT_READY available to filters.

2017-07-17 Thread Michael Niedermayer
On Mon, Jul 17, 2017 at 04:19:23PM +0200, Nicolas George wrote:
> I am not entirely sure that this return code is useful,
> but having and using it makes no harm.
> 
> Signed-off-by: Nicolas George 
> ---
>  libavfilter/avfilter.c | 2 --
>  libavfilter/filters.h  | 5 +
>  2 files changed, 5 insertions(+), 2 deletions(-)

LGTM

thx

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

There will always be a question for which you do not know the correct answer.


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


Re: [FFmpeg-devel] [PATCH 5/7] lavfi: add outlink helper functions.

2017-07-17 Thread Michael Niedermayer
On Mon, Jul 17, 2017 at 04:19:24PM +0200, Nicolas George wrote:
> These wrappers cost nothing, they make the namespace more
> consistent and they will be useful if/when locking becomes
> necessary.
> 
> Signed-off-by: Nicolas George 
> ---
>  libavfilter/filters.h | 21 +
>  1 file changed, 21 insertions(+)
> 
> diff --git a/libavfilter/filters.h b/libavfilter/filters.h
> index 370d99b38b..1cbc18158f 100644
> --- a/libavfilter/filters.h
> +++ b/libavfilter/filters.h
> @@ -26,6 +26,7 @@
>   */
>  
>  #include "avfilter.h"
> +#include "internal.h"
>  
>  /**
>   * Special return code when activate() did not do anything.
> @@ -139,4 +140,24 @@ int ff_inlink_acknowledge_status(AVFilterLink *link, int 
> *rstatus, int64_t *rpts
>   */
>  void ff_inlink_request_frame(AVFilterLink *link);
>  
> +/**
> + * Test if a frame is wanted on an output link.
> + */
> +static inline int ff_outlink_frame_wanted(AVFilterLink *link)
> +{
> +return link->frame_wanted_out;
> +}

LGTM

[...]
-- 
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: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/mov: add support for sidx fragment indexes

2017-07-17 Thread Dale Curtis
Okay the following patch should fix this issue. Chromium/reviewable version
here https://chromium-review.googlesource.com/c/572585/

- dale

On Fri, Jul 14, 2017 at 6:31 PM, Dale Curtis 
wrote:

> On Fri, Jul 14, 2017 at 5:38 PM, Michael Niedermayer <
> mich...@niedermayer.cc> wrote:
>
>>
>> I dont think CTTS is the only affected atom.
>>
>>
> Thanks for the response. Yes, I think that's likely true. The ctts one is
> just likely the most important since it controls timestamp ordering.
>
>
>> what you describe sounds like an option. but i might be missing something,
>> possibly even something significant. I dont feel that confident with
>> this code after quickly looking at it.
>>
>
> Here are my experiments thus far if you have further thoughts:
> https://chromium-review.googlesource.com/c/572730/
> https://chromium-review.googlesource.com/c/572585/
>
> Both fixes and the existing code seem to suffer from assuming that the
> sample number in the AVIndex and that of the ctts_data are the same; which
> seems questionable. The second experiment should be viable with the
> addition of memmove() when inserting in the middle of the array. Will look
> at it more next week.
>
> - dale
>
>
>
From 4460d4b16472d1fd201818df6c18ba3e515941c4 Mon Sep 17 00:00:00 2001
From: Dale Curtis 
Date: Mon, 17 Jul 2017 17:38:09 -0700
Subject: [PATCH] Fix trampling of ctts during seeks when sidx support is
 enabled.

When sidx box support is enabled, the code will skip reading all
trun boxes (each containing ctts entries for samples inthat box).

If seeks are attempted before all ctts values are known, the old
code would dump ctts entries into the wrong location. These are
then used to compute pts values which leads to out of order and
incorrectly timestamped packets.

This patch fixes ctts processing by always using the index returned
by av_add_index_entry() as the ctts_data index. When the index gains
new entries old values are reshuffled as appropriate.

This approach makes sense since the mov demuxer is already relying
on the mapping of AVIndex entries to samples for correct demuxing.

Notes for future improvement:
Probably there are other boxes (stts, stsc, etc) that are impacted
by this issue... this patch only attempts to fix ctts since it
completely breaks packet timestamping.

This patch continues using an array for the ctts data, which is not
the most ideal given the rearrangement that needs to happen (via
memmove as new entries are read in). Ideally AVIndex and the ctts
data would be set-type structures so addition is always worst case
O(lg(n)) instead of the O(n^2) that exists now; this slowdown is
noticeable during seeks.

Additionally since ctts samples from trun boxes always have a count
of 1, there's probably an opportunity to avoid the post-seek fixup
that iterates O(n) over all samples with an O(1) when no non-1 count
samples are present.

Signed-off-by: Dale Curtis 
---
 libavformat/isom.h |  1 +
 libavformat/mov.c  | 46 +++---
 2 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index ff009b0896..fdd98c28f5 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -137,6 +137,7 @@ typedef struct MOVStreamContext {
 unsigned int stts_count;
 MOVStts *stts_data;
 unsigned int ctts_count;
+unsigned int ctts_allocated_size;
 MOVStts *ctts_data;
 unsigned int stsc_count;
 MOVStsc *stsc_data;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 63f84be782..412290b435 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4297,11 +4297,6 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 }
 if ((uint64_t)entries+sc->ctts_count >= UINT_MAX/sizeof(*sc->ctts_data))
 return AVERROR_INVALIDDATA;
-if ((err = av_reallocp_array(&sc->ctts_data, entries + sc->ctts_count,
- sizeof(*sc->ctts_data))) < 0) {
-sc->ctts_count = 0;
-return err;
-}
 if (flags & MOV_TRUN_DATA_OFFSET)data_offset= avio_rb32(pb);
 if (flags & MOV_TRUN_FIRST_SAMPLE_FLAGS) first_sample_flags = avio_rb32(pb);
 dts= sc->track_end - sc->time_offset;
@@ -4312,26 +4307,28 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 unsigned sample_size = frag->size;
 int sample_flags = i ? frag->flags : first_sample_flags;
 unsigned sample_duration = frag->duration;
+unsigned ctts_duration = 0;
 int keyframe = 0;
+int ctts_index = 0;
+int old_nb_index_entries = st->nb_index_entries;
 
 if (flags & MOV_TRUN_SAMPLE_DURATION) sample_duration = avio_rb32(pb);
 if (flags & MOV_TRUN_SAMPLE_SIZE) sample_size = avio_rb32(pb);
 if (flags & MOV_TRUN_SAMPLE_FLAGS)sample_flags= avio_rb32(pb);
-sc->ctts_data[sc->ctts_count].count = 1;
-sc->ctts_data[sc->ctts_count].duration = (flags & MOV_TRUN_SAMPL

Re: [FFmpeg-devel] SSL certificate for ffmpeg.org website is not valid anymore

2017-07-17 Thread Gerion Entrup
Am Dienstag, 18. Juli 2017, 01:52:53 CEST schrieb Reimar Döffinger:
> On 18.07.2017, at 00:59, James Almer  wrote:
> 
> > On 7/17/2017 7:49 PM, Moritz Barsnick wrote:
> >> On Mon, Jul 10, 2017 at 13:53:02 +0300, Boris Pek wrote:
> >>> Latest news about this topic:
> >>> https://groups.google.com/a/chromium.org/forum/#!topic/net-dev/FKXe-76GO8Y
> >> 
> >> Ah, thanks, I neglected to report this, because I thought it was an
> >> issue with my Opera Developer (48), which uses the Chrome engine. Opera
> >> (like Chrome) recently reports ffmpeg.org's certificate as revoked, but
> >> I found no tool which could verify this...
> > 
> > The cert is by StartCom. Afaik everyone blacklisted certs issued by them
> > after a certain date, and now some, like Google, are also blacklisting
> > certs issued before that date as well.
> > Mozilla hasn't done the latter yet, so Firefox doesn't complain about
> > it, but i guess a new cert is overdue.
> 
> New certs are already being generated, but nobody had the time to do the 
> transition, there is a risk of the automation failing
> (I think the web server needs to be made to reload the certificate, which is 
> problematic as an ordinary user and there is no way I'd ever run any of that 
> letsencrypt stuff as root),
This seems to work as cronjob:
```
#!/bin/sh

su -c "certbot renew 2>/dev/null | grep 'No renewals' >/dev/null" letsencrypt 
-s /bin/bash
if [ $? -eq 1 ]; then
service nginx reload
fi
```

Gerion

> it is also a step backwards as the letsencrypt one is a domain-only 
> certificate, and due to TLS's idiotic design decisions it's not possible to 
> just deliver both certificates...
> Thus the current situation.
> Lack of time for proper testing being the biggest issue though...


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


Re: [FFmpeg-devel] [WIP][PATCH]v4 Opus Pyramid Vector Quantization Search in x86 SIMD asm

2017-07-17 Thread Rostislav Pehlivanov
On 9 July 2017 at 01:49, Ivan Kalvachev  wrote:

> This should be the final work-in-progress patch.
>
> What's changed:
>
> 1. Removed macros conditional defines. The defaults seems to be
> optimal on all machines that I got benchmarks from. HADDPS and PHADDD
> are always slower, "BLEND"s are never slower than the emulation.
>
> 2. Remove SHORT_SYY_UPDATE. It is always slower.
>
> 3. Remove ALL_FLOAT_PRESEARCH, it is always slower. Remove the ugly
> hack to use 256bit ymm with avx1 and integer operations.
>
> 4. Remove remaining disabled code.
>
> 5. Use HADDD macro from "x86util", I don't need the result in all
> lanes/elements
>
> 6. Use v-prefix for all avx code.
>
> 7. Small optimization: Move some of the HSUMPS in the K!=0 branch.
>
> 8. Small optimization: Instead of pre-calculation 2*Y[i] and then
> correcting it on exit, It is possible to use Syy/2 instead in
> distortion parameter calculations. It saves few multiplications in
> pre-search and sign restore loop. It however gives different
> approximation of sqrt(). It's not (consistently) better or worse than
> the previous approximation.
>
> 9. Using movdqa to load "const_int32_offsets". Wrong type might
> explain why directly using mem constants is sometimes faster.
>
> 10. Move some code around and do minor tweaks.
> ---
>
> I do not intend of removing "PRESEARCH_ROUNDING" and
> "USE_APPROXIMATION", (while for the latter I think I will remove
> method#1, I've left it this time just for consistency").
> These defines control the precision and the type of results that the
> function generates.
> E.g. This function can produce same results as opus functions with
> "PRESEARCH_ROUNDING 0".
> If you want same results as the ffmpeg improved function, then you
> need "approx#0". It uses real division and is much slower on older
> cpu's, but reasonably fast on anything recent.
>
> I've left 2 other defines. "CONST_IN_X64_REG_IS_FASTER" and
> "STALL_WRITE_FORWARDING".
> On Sandy Bridge and laters, "const_in_x64" has always been faster. On
> my cpu it is about the same.
> On Ryzen the "const_in_x64" was consistently faster in all sse/avx
> variants, with about 5%. But not if "stall_write" is enabled too.
> Ryzen (allegedly) has no write stalling, but that method alone is just
> a few cycles faster (about 0.5% ).
>
> I'd like to see if the changes I've done this time, would affect the
> above results.
>
>
> The code is much cleaner and you are free to nitpick on it.
>
> There is something that I'm not exactly sure if I need it.
> The function gets 2 integer parameters, and I am not sure
> if I have to sign extend them in 64 bit more, in order to clear
> the high 32 bits. These parameters should never be negative, so the
> sign is not needed.
> All 32bit operands should also clear the high bits.
> Still I'm not sure if there is guarantee that
> the high bits won't contain garbage.
>
>
> Best Regards
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
No detectable regression from v3.

Whitespace error though:
.git/rebase-apply/patch:154: trailing whitespace.
; Horizontal Sum Packed Single precision float
warning: 1 line adds whitespace errors.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavc/vaapi_encode_h265: Remove duplicate slice_segment_address.

2017-07-17 Thread Jun Zhao
From ee094ddd0fedecc81ee0107df58fc0ec80369c13 Mon Sep 17 00:00:00 2001
From: Jun Zhao 
Date: Tue, 18 Jul 2017 00:01:09 -0400
Subject: [PATCH] lavc/vaapi_encode_h265: Remove duplicate
 slice_segment_address.

the VAEncSliceParameterBufferHEVC in libva have support this field,
so remove the duplicate field in VAAPIEncodeH265MiscSliceParams.

Signed-off-by: Jun Zhao 
---
 libavcodec/vaapi_encode_h265.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index 1d648a6d87..cf6b9388d1 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -149,7 +149,6 @@ typedef struct VAAPIEncodeH265MiscSequenceParams {
 typedef struct VAAPIEncodeH265MiscSliceParams {
 // Slice segments.
 char first_slice_segment_in_pic_flag;
-unsigned int slice_segment_address;
 
 // Short-term reference picture sets.
 char short_term_ref_pic_set_sps_flag;
@@ -586,7 +585,7 @@ static void 
vaapi_encode_h265_write_slice_header2(PutBitContext *pbc,
 if (vpic->pic_fields.bits.dependent_slice_segments_enabled_flag)
 u(1, vslice_field(dependent_slice_segment_flag));
 u(av_log2((priv->ctu_width * priv->ctu_height) - 1) + 1,
-  mslice_var(slice_segment_address));
+  vslice_var(slice_segment_address));
 }
 if (!vslice->slice_fields.bits.dependent_slice_segment_flag) {
 for (i = 0; i < mseq->num_extra_slice_header_bits; i++)
-- 
2.11.0

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


Re: [FFmpeg-devel] [PATCH] lavc/vaapi_encode_h265: Remove duplicate slice_segment_address.

2017-07-17 Thread Steven Liu
2017-07-18 12:08 GMT+08:00 Jun Zhao :
>

From ee094ddd0fedecc81ee0107df58fc0ec80369c13 Mon Sep 17 00:00:00 2001
From: Jun Zhao 
Date: Tue, 18 Jul 2017 00:01:09 -0400
Subject: [PATCH] lavc/vaapi_encode_h265: Remove duplicate
 slice_segment_address.

the VAEncSliceParameterBufferHEVC in libva have support this field,
so remove the duplicate field in VAAPIEncodeH265MiscSliceParams.

Signed-off-by: Jun Zhao 
---
 libavcodec/vaapi_encode_h265.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index 1d648a6d87..cf6b9388d1 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -149,7 +149,6 @@ typedef struct VAAPIEncodeH265MiscSequenceParams {
 typedef struct VAAPIEncodeH265MiscSliceParams {
 // Slice segments.
 char first_slice_segment_in_pic_flag;
-unsigned int slice_segment_address;

 // Short-term reference picture sets.
 char short_term_ref_pic_set_sps_flag;
@@ -586,7 +585,7 @@ static void
vaapi_encode_h265_write_slice_header2(PutBitContext *pbc,
 if (vpic->pic_fields.bits.dependent_slice_segments_enabled_flag)
 u(1, vslice_field(dependent_slice_segment_flag));
 u(av_log2((priv->ctu_width * priv->ctu_height) - 1) + 1,
-  mslice_var(slice_segment_address));
+  vslice_var(slice_segment_address));
 }
 if (!vslice->slice_fields.bits.dependent_slice_segment_flag) {
 for (i = 0; i < mseq->num_extra_slice_header_bits; i++)
-- 
2.11.0

___
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