Re: [FFmpeg-devel] [PATCH 1/2] avcodec/takdec: move tmp declaration to where its used

2014-08-03 Thread Paul B Mahol
On Sat, Aug 2, 2014 at 9:43 PM, Michael Niedermayer 
wrote:

> Makes the code a bit easier to read
>
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/takdec.c |8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> ok
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/takdec: remove unused variable

2014-08-03 Thread Paul B Mahol
On Sat, Aug 2, 2014 at 9:43 PM, Michael Niedermayer 
wrote:

> Found-by: CSA
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/takdec.c |1 -
>  1 file changed, 1 deletion(-)
>
> ok
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] New p2p mode for showwaves filter

2014-08-03 Thread Paul B Mahol
On Thu, Jul 31, 2014 at 2:50 PM, mrskman  wrote:

> A few months ago I sent this patch and got some comments, which helped me
> to understand how this filter works. Thank you for that and I'm sorry it
> took me so long to reply. Here is a better version (atleast for me).
>
> Problem with the current mode=point is, you can get almost invisible wave
> when you set higher resolution output or when there are high amplitudes
> in audio stream.
>
> With this new mode additional points are drawn to make a line between
> points and output is readable regardless of the resolution or amplitudes.
>
> Please review and comment.
>
> ---
>  doc/filters.texi|3 +++
>  libavfilter/avf_showwaves.c |   38 +-
>  2 files changed, 36 insertions(+), 5 deletions(-)
>
> diff --git a/doc/filters.texi b/doc/filters.texi
> index a7919a3..145acbf 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -10698,6 +10698,9 @@ Draw a point for each sample.
>
>  @item line
>  Draw a vertical line for each sample.
> +
> +@item p2p
> +Draw a point for each sample and a line between them.
>  @end table
>
>  Default value is @code{point}.
> diff --git a/libavfilter/avf_showwaves.c b/libavfilter/avf_showwaves.c
> index 0b45bd0..48e61d1 100644
> --- a/libavfilter/avf_showwaves.c
> +++ b/libavfilter/avf_showwaves.c
> @@ -35,6 +35,7 @@
>  enum ShowWavesMode {
>  MODE_POINT,
>  MODE_LINE,
> +MODE_P2P,
>  MODE_NB,
>  };
>
> @@ -43,6 +44,8 @@ typedef struct {
>  int w, h;
>  AVRational rate;
>  int buf_idx;
> +int *buf_idy;/* y coordinate of previous sample for each channel
> */
> +int nb_channels;
>

This change is not needed.


>  AVFrame *outpicref;
>  int req_fullfilled;
>  int n;
> @@ -59,6 +62,7 @@ static const AVOption showwaves_options[] = {
>  { "mode", "select display mode", OFFSET(mode), AV_OPT_TYPE_INT,
> {.i64=MODE_POINT}, 0, MODE_NB-1, FLAGS, "mode"},
>  { "point", "draw a point for each sample", 0, AV_OPT_TYPE_CONST,
> {.i64=MODE_POINT}, .flags=FLAGS, .unit="mode"},
>  { "line",  "draw a line for each sample",  0, AV_OPT_TYPE_CONST,
> {.i64=MODE_LINE},  .flags=FLAGS, .unit="mode"},
> +{ "p2p", "draw a line between samples", 0, AV_OPT_TYPE_CONST,
> {.i64=MODE_P2P}, .flags=FLAGS, .unit="mode"},
>  { "n","set how many samples to show in the same point",
> OFFSET(n), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS },
>  { "rate", "set video rate", OFFSET(rate), AV_OPT_TYPE_VIDEO_RATE,
> {.str = "25"}, 0, 0, FLAGS },
>  { "r","set video rate", OFFSET(rate), AV_OPT_TYPE_VIDEO_RATE,
> {.str = "25"}, 0, 0, FLAGS },
> @@ -72,6 +76,8 @@ static av_cold void uninit(AVFilterContext *ctx)
>  ShowWavesContext *showwaves = ctx->priv;
>
>  av_frame_free(&showwaves->outpicref);
> +if (showwaves->buf_idy)
> +av_freep(showwaves->buf_idy);
>  }
>
>  static int query_formats(AVFilterContext *ctx)
> @@ -110,6 +116,7 @@ static int query_formats(AVFilterContext *ctx)
>
>  static int config_output(AVFilterLink *outlink)
>  {
> +int i;
>  AVFilterContext *ctx = outlink->src;
>  AVFilterLink *inlink = ctx->inputs[0];
>  ShowWavesContext *showwaves = ctx->priv;
> @@ -117,7 +124,14 @@ static int config_output(AVFilterLink *outlink)
>  if (!showwaves->n)
>  showwaves->n = FFMAX(1, ((double)inlink->sample_rate /
> (showwaves->w * av_q2d(showwaves->rate))) + 0.5);
>
> +showwaves->nb_channels = inlink->channels;
>  showwaves->buf_idx = 0;
> +if (!(showwaves->buf_idy = av_malloc_array(showwaves->nb_channels,
> 1))) {
> +av_log(NULL, AV_LOG_ERROR, "Could not allocate showwaves
> buffer\n");
> +return AVERROR(ENOMEM);
> +}
> +for (i = 0; i <= showwaves->nb_channels; i++)
> +showwaves->buf_idy[i] = 0;
>  outlink->w = showwaves->w;
>  outlink->h = showwaves->h;
>  outlink->sample_aspect_ratio = (AVRational){1,1};
> @@ -133,12 +147,14 @@ static int config_output(AVFilterLink *outlink)
>  inline static int push_frame(AVFilterLink *outlink)
>  {
>  ShowWavesContext *showwaves = outlink->src->priv;
> -int ret;
> +int ret, i;
>
>  if ((ret = ff_filter_frame(outlink, showwaves->outpicref)) >= 0)
>  showwaves->req_fullfilled = 1;
>  showwaves->outpicref = NULL;
>  showwaves->buf_idx = 0;
> +for (i = 0; i <= showwaves->nb_channels; i++)
> +showwaves->buf_idy[i] = 0;
>  return ret;
>  }
>
> @@ -169,10 +185,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
> *insamples)
>  AVFrame *outpicref = showwaves->outpicref;
>  int linesize = outpicref ? outpicref->linesize[0] : 0;
>  int16_t *p = (int16_t *)insamples->data[0];
> -int nb_channels = inlink->channels;
>  int i, j, k, h, ret = 0;
>  const int n = showwaves->n;
> -const int x = 255 / (nb_channels * n); /* multiplication factor,
> pre-computed to avoid in-loop divisions */
> +const int x =

Re: [FFmpeg-devel] [PATCH] doc/ffserver: merge paragraph starting with "What happens next?" with previous one

2014-08-03 Thread Stefano Sabatini
On date Saturday 2014-08-02 07:50:14 -0700, Timothy Gu encoded:
> On Aug 2, 2014 7:40 AM, "Stefano Sabatini"  wrote:
> >
> > The name of the paragraph sounded a bit silly, and its text is small so
> > it's better to merge it with the previous paragraph.
> > ---
> >  doc/ffserver.texi | 8 +++-
> >  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> OK.

Applied, thanks.
-- 
FFmpeg = Friendly & Fabulous Mastodontic Philosofic Epic Generator
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/takdec: move tmp declaration to where its used

2014-08-03 Thread Michael Niedermayer
On Sun, Aug 03, 2014 at 09:47:53AM +0200, Paul B Mahol wrote:
> On Sat, Aug 2, 2014 at 9:43 PM, Michael Niedermayer 
> wrote:
> 
> > Makes the code a bit easier to read
> >
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/takdec.c |8 
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > ok

applied

thanks

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

Democracy is the form of government in which you can choose your dictator


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


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/takdec: remove unused variable

2014-08-03 Thread Michael Niedermayer
On Sun, Aug 03, 2014 at 09:52:41AM +0200, Paul B Mahol wrote:
> On Sat, Aug 2, 2014 at 9:43 PM, Michael Niedermayer 
> wrote:
> 
> > Found-by: CSA
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/takdec.c |1 -
> >  1 file changed, 1 deletion(-)
> >
> > ok

applied
thanks

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

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data


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


Re: [FFmpeg-devel] [PATCH] ffserver: deprecate Port and BindAddress options in favor of HTTPPort and HTTPBindAddress

2014-08-03 Thread Michael Niedermayer
On Sat, Aug 02, 2014 at 04:40:53PM +0200, Stefano Sabatini wrote:
> The new option names are more explicit.
> ---
>  doc/ffserver.conf |  4 ++--
>  doc/ffserver.texi | 19 ++-
>  ffserver.c| 10 +++---
>  3 files changed, 23 insertions(+), 10 deletions(-)

agree but iam not ffserver maintainer

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

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.


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


[FFmpeg-devel] [PATCH 2/5] lavfi/buffersrc: add add av_buffersrc_close().

2014-08-03 Thread Nicolas George
Also deprecate adding a NULL frame to mark EOF.

TODO APIchanges entry, version bump.

Signed-off-by: Nicolas George 
---
 libavfilter/buffersrc.c | 40 ++--
 libavfilter/buffersrc.h | 15 +++
 2 files changed, 45 insertions(+), 10 deletions(-)


Note: relying on the frame duration for the end timestamp would be fragile
(no filters update it), and technically an API break.


diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index 27d3db0..6d71587 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -63,6 +63,7 @@ typedef struct BufferSourceContext {
 char*channel_layout_str;
 
 int eof;
+int64_t eof_pts;
 } BufferSourceContext;
 
 #define CHECK_VIDEO_PARAM_CHANGE(s, c, width, height, format)\
@@ -77,6 +78,27 @@ typedef struct BufferSourceContext {
 return AVERROR(EINVAL);\
 }
 
+static int push_if_flag(AVFilterContext *ctx, int flags)
+{
+return (flags & AV_BUFFERSRC_FLAG_PUSH) ?
+ctx->output_pads[0].request_frame(ctx->outputs[0]) : 0;
+}
+
+int av_buffersrc_close(AVFilterContext *ctx, int64_t pts, int flags)
+{
+BufferSourceContext *s = ctx->priv;
+
+if (pts == AV_NOPTS_VALUE) {
+av_log(ctx, AV_LOG_WARNING, "No EOF timestamp\n");
+/* FIXME use duration for audio */
+pts = av_rescale_q(ctx->outputs[0]->current_pts,
+   AV_TIME_BASE_Q, ctx->outputs[0]->time_base) + 1;
+}
+s->eof_pts = pts;
+s->eof = 1;
+return push_if_flag(ctx, flags);
+}
+
 int attribute_align_arg av_buffersrc_write_frame(AVFilterContext *ctx, const 
AVFrame *frame)
 {
 return av_buffersrc_add_frame_flags(ctx, (AVFrame *)frame,
@@ -125,8 +147,7 @@ static int av_buffersrc_add_frame_internal(AVFilterContext 
*ctx,
 s->nb_failed_requests = 0;
 
 if (!frame) {
-s->eof = 1;
-return 0;
+return av_buffersrc_close(ctx, AV_NOPTS_VALUE, flags);
 } else if (s->eof)
 return AVERROR(EINVAL);
 
@@ -177,11 +198,7 @@ static int av_buffersrc_add_frame_internal(AVFilterContext 
*ctx,
 return ret;
 }
 
-if ((flags & AV_BUFFERSRC_FLAG_PUSH))
-if ((ret = ctx->output_pads[0].request_frame(ctx->outputs[0])) < 0)
-return ret;
-
-return 0;
+return push_if_flag(ctx, flags);
 }
 
 #if FF_API_AVFILTERBUFFER
@@ -211,8 +228,7 @@ int av_buffersrc_add_ref(AVFilterContext *ctx, 
AVFilterBufferRef *buf,
 int ret = 0, planes, i;
 
 if (!buf) {
-s->eof = 1;
-return 0;
+return av_buffersrc_close(ctx, AV_NOPTS_VALUE, flags);
 } else if (s->eof)
 return AVERROR(EINVAL);
 
@@ -487,10 +503,14 @@ static int request_frame(AVFilterLink *link)
 {
 BufferSourceContext *c = link->src->priv;
 AVFrame *frame;
+int ret;
 
 if (!av_fifo_size(c->fifo)) {
-if (c->eof)
+if (c->eof) {
+if ((ret = ff_filter_link_close(link, c->eof_pts)) < 0)
+return ret;
 return AVERROR_EOF;
+}
 c->nb_failed_requests++;
 return AVERROR(EAGAIN);
 }
diff --git a/libavfilter/buffersrc.h b/libavfilter/buffersrc.h
index ea34c04..28ca545 100644
--- a/libavfilter/buffersrc.h
+++ b/libavfilter/buffersrc.h
@@ -145,6 +145,8 @@ int av_buffersrc_add_frame(AVFilterContext *ctx, AVFrame 
*frame);
  *
  * @param buffer_src  pointer to a buffer source context
  * @param frame   a frame, or NULL to mark EOF
+ *(Using NULL to mark EOF is deprecated, use
+ *av_buffersrc_close() instead.)
  * @param flags   a combination of AV_BUFFERSRC_FLAG_*
  * @return>= 0 in case of success, a negative AVERROR code
  *in case of failure
@@ -154,6 +156,19 @@ int av_buffersrc_add_frame_flags(AVFilterContext 
*buffer_src,
 
 
 /**
+ * Close a buffer source.
+ *
+ * This cause EOF to be propagated along the filter graph.
+ *
+ * @param buffer_src  pointer to a buffer source context
+ * @param pts the timestamp of the end of stream
+ * @param flags   a combination of AV_BUFFERSRC_FLAG_*
+ * @return>= 0 in case of success, a negative AVERROR code
+ *in case of failure
+ */
+int av_buffersrc_close(AVFilterContext *buffer_src, int64_t pts, int flags);
+
+/**
  * @}
  */
 
-- 
2.0.1

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


[FFmpeg-devel] [PATCH 1/5] lavfi: add filter metaframes infrastructure.

2014-08-03 Thread Nicolas George
Metaframes are frames without data, identified by a negative
format code, used to carry special conditions.
They are sent only to filter that declare supporting them.

The only metaframe for now is EOF; this mechanism augments
the current mechanism based on request_frame() returning
AVERROR_EOF, with the advantage that the EOF metaframe carries
a timestamp.
The API has also the advantage to work in push-only mode if
all the filters in the chain support metaframes.

The metaframes are a purely internal API and do not leak to
the application.

Signed-off-by: Nicolas George 
---
 libavfilter/avfilter.c | 73 +-
 libavfilter/internal.h | 34 +++
 2 files changed, 100 insertions(+), 7 deletions(-)


TODO: find a way of forwarding the EOF, and hopefully the timestamp for
filters that do not support metaframes. Possibly triggering a request_frame
on filters that have exactly one output would help.


diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 7b11467..d3fbe56 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -346,15 +346,16 @@ int ff_request_frame(AVFilterLink *link)
 ret = link->srcpad->request_frame(link);
 else if (link->src->inputs[0])
 ret = ff_request_frame(link->src->inputs[0]);
-if (ret == AVERROR_EOF && link->partial_buf) {
-AVFrame *pbuf = link->partial_buf;
-link->partial_buf = NULL;
-ret = ff_filter_frame_framed(link, pbuf);
-}
 if (ret < 0) {
+if (!link->frame_requested) {
+av_assert0(ret == AVERROR_EOF);
+ret = 0;
+}
 link->frame_requested = 0;
-if (ret == AVERROR_EOF)
-link->closed = 1;
+if (ret == AVERROR_EOF) {
+ret = ff_filter_link_close(link, AV_NOPTS_VALUE);
+return ret < 0 ? ret : AVERROR_EOF;
+}
 } else {
 av_assert0(!link->frame_requested ||
link->flags & FF_LINK_FLAG_REQUEST_LOOP);
@@ -1132,10 +1133,52 @@ static int ff_filter_frame_needs_framing(AVFilterLink 
*link, AVFrame *frame)
 return ret;
 }
 
+static int ff_filter_metaframe(AVFilterLink *link, AVFrame *frame)
+{
+AVFrame *pbuf = link->partial_buf;
+int ret = 0;
+
+if (pbuf) {
+link->partial_buf = NULL;
+if ((ret = ff_filter_frame_framed(link, pbuf)) < 0)
+return ret;
+}
+
+if ((link->dst->filter->flags & FF_FILTER_FLAG_SUPPORT_METAFRAMES)) {
+ret = link->dstpad->filter_frame ?
+  link->dstpad->filter_frame(link, frame) :
+  default_filter_frame(link, frame);
+if (ret < 0)
+return ret;
+}
+
+switch (frame->format) {
+
+case FF_METAFRAME_EOF:
+link->closed = 1;
+break;
+
+case 0:
+case FF_METAFRAME_NOP:
+/* Not implemented yet because not used either for now.
+   Caveat: if the same metaframe is forwarded to the next filter
+   and the next filter changes the type, the type change must not be
+   taken into account for the first link. */
+
+default:
+av_assert0(!"reached");
+}
+
+return ret;
+}
+
 int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
 {
 FF_TPRINTF_START(NULL, filter_frame); ff_tlog_link(NULL, link, 1); 
ff_tlog(NULL, " "); ff_tlog_ref(NULL, frame, 1);
 
+if (frame->format < -1)
+return ff_filter_metaframe(link, frame);
+
 /* Consistency checks */
 if (link->type == AVMEDIA_TYPE_VIDEO) {
 if (strcmp(link->dst->filter->name, "scale")) {
@@ -1162,6 +1205,22 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
 }
 }
 
+int ff_filter_link_close(AVFilterLink *link, int64_t pts)
+{
+AVFrame *frame;
+int ret;
+
+if (link->closed)
+return 0;
+if (!(frame = av_frame_alloc()))
+return AVERROR(ENOMEM);
+frame->format = FF_METAFRAME_EOF;
+frame->pts = pts;
+ret = ff_filter_frame(link, frame);
+av_frame_free(&frame);
+return ret;
+}
+
 const AVClass *avfilter_get_class(void)
 {
 return &avfilter_class;
diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index 308b115..fbe603a 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -374,4 +374,38 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, 
const char *inst_name);
  */
 void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext 
*filter);
 
+/**
+ * The filter can accept metaframes.
+ * Metaframes are AVFrame structures with a negative format field.
+ * The framework will take default actions based on the metaframe type.
+ * The destination filter is allowed to reset the type to inhibit the
+ * default actions.
+ */
+#define FF_FILTER_FLAG_SUPPORT_METAFRAMES (1 << 24)
+
+/**
+ * Types of metaframes that can be passer to a filter.
+ */
+enum {
+/**
+ 

[FFmpeg-devel] [PATCH 3/5] ffmpeg: use av_buffersrc_close().

2014-08-03 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 ffmpeg.c | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 1c1a559..3ac6620 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1741,12 +1741,9 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, 
int *got_output)
 
 if (!*got_output || ret < 0) {
 if (!pkt->size) {
+int64_t pts = av_rescale_q(ist->next_pts, AV_TIME_BASE_Q, 
ist->st->time_base);
 for (i = 0; i < ist->nb_filters; i++)
-#if 1
-av_buffersrc_add_ref(ist->filters[i]->filter, NULL, 0);
-#else
-av_buffersrc_add_frame(ist->filters[i]->filter, NULL);
-#endif
+av_buffersrc_close(ist->filters[i]->filter, pts, 0);
 }
 return ret;
 }
@@ -1894,12 +1891,9 @@ static int decode_video(InputStream *ist, AVPacket *pkt, 
int *got_output)
 
 if (!*got_output || ret < 0) {
 if (!pkt->size) {
+int64_t pts = av_rescale_q(ist->next_pts, AV_TIME_BASE_Q, 
ist->st->time_base);
 for (i = 0; i < ist->nb_filters; i++)
-#if 1
-av_buffersrc_add_ref(ist->filters[i]->filter, NULL, 0);
-#else
-av_buffersrc_add_frame(ist->filters[i]->filter, NULL);
-#endif
+av_buffersrc_close(ist->filters[i]->filter, pts, 0);
 }
 return ret;
 }
-- 
2.0.1

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


[FFmpeg-devel] [PATCH 4/5] vf_fps: move flushing remaining frames in a separate function.

2014-08-03 Thread Nicolas George
Also remove unused loop counter, rename obsolete "buf",
and add a comment about a similar function.

Signed-off-by: Nicolas George 
---
 libavfilter/vf_fps.c | 38 +-
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c
index a38633d..a3ad1bb 100644
--- a/libavfilter/vf_fps.c
+++ b/libavfilter/vf_fps.c
@@ -88,6 +88,7 @@ static av_cold int init(AVFilterContext *ctx)
 return 0;
 }
 
+/* FIXME: misnommer, the frames are discarded, not flushed */
 static void flush_fifo(AVFifoBuffer *fifo)
 {
 while (av_fifo_size(fifo)) {
@@ -97,6 +98,24 @@ static void flush_fifo(AVFifoBuffer *fifo)
 }
 }
 
+static int flush_fifo_to_out(AVFilterContext *ctx)
+{
+FPSContext *s = ctx->priv;
+AVFilterLink *outlink = ctx->outputs[0];
+AVFrame *frame;
+int ret;
+
+while (av_fifo_size(s->fifo)) {
+av_fifo_generic_read(s->fifo, &frame, sizeof(frame), NULL);
+frame->pts = av_rescale_q(s->first_pts, ctx->inputs[0]->time_base,
+  outlink->time_base) + s->frames_out;
+if ((ret = ff_filter_frame(outlink, frame)) < 0)
+return ret;
+s->frames_out++;
+}
+return 0;
+}
+
 static av_cold void uninit(AVFilterContext *ctx)
 {
 FPSContext *s = ctx->priv;
@@ -133,23 +152,8 @@ static int request_frame(AVFilterLink *outlink)
 ret = ff_request_frame(ctx->inputs[0]);
 
 /* flush the fifo */
-if (ret == AVERROR_EOF && av_fifo_size(s->fifo)) {
-int i;
-for (i = 0; av_fifo_size(s->fifo); i++) {
-AVFrame *buf;
-
-av_fifo_generic_read(s->fifo, &buf, sizeof(buf), NULL);
-buf->pts = av_rescale_q(s->first_pts, ctx->inputs[0]->time_base,
-outlink->time_base) + s->frames_out;
-
-if ((ret = ff_filter_frame(outlink, buf)) < 0)
-return ret;
-
-s->frames_out++;
-}
-return 0;
-}
-
+if (ret == AVERROR_EOF && av_fifo_size(s->fifo))
+return flush_fifo_to_out(ctx);
 return ret;
 }
 
-- 
2.0.1

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


[FFmpeg-devel] [PATCH 5/5] lavfi/vf_fps: accept EOF timestamp.

2014-08-03 Thread Nicolas George
This makes the FPS filter duplicate the last frame to take
its duration into account, exactly like the other ones.

Fix trac ticket #2674.

Signed-off-by: Nicolas George 
---
 libavfilter/vf_fps.c | 33 +
 1 file changed, 25 insertions(+), 8 deletions(-)


Aded a ref to the trac ticket and fixed a corner case raised by it.
Note that the whole logic of vf_fps is overly complex, but this is for
another patch.


diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c
index a3ad1bb..5bf5bda 100644
--- a/libavfilter/vf_fps.c
+++ b/libavfilter/vf_fps.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 
+#include "libavutil/avassert.h"
 #include "libavutil/common.h"
 #include "libavutil/fifo.h"
 #include "libavutil/mathematics.h"
@@ -150,10 +151,8 @@ static int request_frame(AVFilterLink *outlink)
 
 while (ret >= 0 && s->frames_out == frames_out)
 ret = ff_request_frame(ctx->inputs[0]);
-
-/* flush the fifo */
-if (ret == AVERROR_EOF && av_fifo_size(s->fifo))
-return flush_fifo_to_out(ctx);
+if (ret == AVERROR_EOF)
+av_assert1(!av_fifo_size(s->fifo));
 return ret;
 }
 
@@ -161,6 +160,7 @@ static int write_to_fifo(AVFifoBuffer *fifo, AVFrame *buf)
 {
 int ret;
 
+av_assert1(buf->format >= 0);
 if (!av_fifo_space(fifo) &&
 (ret = av_fifo_realloc2(fifo, 2*av_fifo_size(fifo {
 av_frame_free(&buf);
@@ -198,6 +198,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
 } else {
 s->first_pts = buf->pts;
 }
+} else if (buf->format < 0) {
+return 0;
 } else {
 av_log(ctx, AV_LOG_WARNING, "Discarding initial frame(s) with no "
"timestamp.\n");
@@ -207,8 +209,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
 return 0;
 }
 
+if (buf->format < 0) {
+if (buf->format != FF_METAFRAME_EOF)
+return 0;
+if (buf->pts == AV_NOPTS_VALUE)
+return flush_fifo_to_out(ctx);
+if (!av_fifo_size(s->fifo))
+return 0;
+}
+
 /* now wait for the next timestamp */
 if (buf->pts == AV_NOPTS_VALUE || av_fifo_size(s->fifo) <= 0) {
+av_assert1(buf->format >= 0);
 return write_to_fifo(s->fifo, buf);
 }
 
@@ -226,10 +238,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*buf)
 
 av_fifo_generic_read(s->fifo, &tmp, sizeof(tmp), NULL);
 flush_fifo(s->fifo);
-ret = write_to_fifo(s->fifo, tmp);
 
-av_frame_free(&buf);
-return ret;
+if (buf->format >= 0) {
+/* requeue last frame if not EOF */
+ret = write_to_fifo(s->fifo, tmp);
+av_frame_free(&buf);
+return ret;
+}
+return 0;
 }
 
 /* can output >= 1 frames */
@@ -268,7 +284,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
 }
 flush_fifo(s->fifo);
 
-ret = write_to_fifo(s->fifo, buf);
+ret = buf->format < 0 ? 0 : write_to_fifo(s->fifo, buf);
 
 return ret;
 }
@@ -299,6 +315,7 @@ AVFilter ff_vf_fps = {
 .uninit  = uninit,
 .priv_size   = sizeof(FPSContext),
 .priv_class  = &fps_class,
+.flags   = FF_FILTER_FLAG_SUPPORT_METAFRAMES,
 .inputs  = avfilter_vf_fps_inputs,
 .outputs = avfilter_vf_fps_outputs,
 };
-- 
2.0.1

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


Re: [FFmpeg-devel] [PATCH 1/4] lavfi: add filter metaframes infrastructure.

2014-08-03 Thread Nicolas George
Le quintidi 15 thermidor, an CCXXII, Stefano Sabatini a écrit :
> It shall probably execute the remaining part of the function even in
> case of failure.

I am not completely sure about that. AFAIK, we consider most filtering
failures fatal at some point or another anyway.

> I find this a bit confusing. Can you explain why the NOP metaframe is
> needed?

Depending on the type of the message and the default action taken, filters
may need to inhibit the default action because they already did the work or
changed something else somewhere that would conflict. I can remove that hunk
and wait for something to actually use it if you prefer.

> LGTM otherwise.

Thanks to everyone for the reviews. New series posted.

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] Inconsistent UDP output packet size - patch

2014-08-03 Thread Michael Niedermayer
On Tue, Jul 22, 2014 at 05:13:39PM +0600, Konstantin Shpinev wrote:
> Following https://trac.ffmpeg.org/ticket/2748

>  aviobuf.c |6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> e26d95e9b0392d7b59a33700a9fe8ba7354cfd48  
> 0001-fix-flush_buffer-in-aviobuf.c-to-produce-constant-pa.patch
> From a9d25569645e4031cd789ddbf696baaf6918f9dc Mon Sep 17 00:00:00 2001
> From: Konstantin Shpinev 
> Date: Tue, 22 Jul 2014 17:06:07 +0600
> Subject: [PATCH] fix flush_buffer in aviobuf.c to produce constant packet
>  size, see https://trac.ffmpeg.org/ticket/2748

breaks fate

--- ./tests/ref/lavf/mov2014-08-02 22:37:50.706658076 +0200
+++ tests/data/fate/lavf-mov2014-08-03 16:25:15.048007384 +0200
@@ -1,5 +1,5 @@
-a10d50f2679df92264e1fc21cb8be630 *./tests/data/lavf/lavf.mov
-366449 ./tests/data/lavf/lavf.mov
+7cee6e2ae88c286973ecda52d0bf05b5 *./tests/data/lavf/lavf.mov
+396081 ./tests/data/lavf/lavf.mov
 ./tests/data/lavf/lavf.mov CRC=0xbb2b949b
 6258f70f974e3c802e01d02ac33c7bbd *./tests/data/lavf/lavf.mov
 357539 ./tests/data/lavf/lavf.mov




-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"


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


[FFmpeg-devel] [PATCH 1/2] lavfi/avf_showspectrum: set output frame rate.

2014-08-03 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 libavfilter/avf_showspectrum.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index 4a4b4f4..e3ae6ea 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -246,6 +246,8 @@ static int config_output(AVFilterLink *outlink)
 if (s->xpos >= outlink->w)
 s->xpos = 0;
 
+outlink->frame_rate = av_make_q(inlink->sample_rate, win_size);
+
 s->combine_buffer =
 av_realloc_f(s->combine_buffer, outlink->h * 3,
  sizeof(*s->combine_buffer));
-- 
2.0.1

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


[FFmpeg-devel] [PATCH 2/2] lavfi/avf_showspectrum: fix output pts computation.

2014-08-03 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 libavfilter/avf_showspectrum.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


These two patches fix a bunch of "non-monotonically" warnings/errors.


diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index e3ae6ea..28db8b1 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -468,7 +468,7 @@ static int plot_spectrum_column(AVFilterLink *inlink, 
AVFrame *insamples, int nb
 }
 
 outpicref->pts = insamples->pts +
-av_rescale_q(s->consumed,
+av_rescale_q(s->consumed + add_samples - win_size,
  (AVRational){ 1, inlink->sample_rate },
  outlink->time_base);
 ret = push_frame(outlink);
-- 
2.0.1

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


[FFmpeg-devel] [PATCH] lavfi/avf_showspectrum: do not push the frame at EOF.

2014-08-03 Thread Nicolas George
It is always identical to the last pushed frame.
The samples in the last incomplete window were ignored,
this is unchanged.
Possible enhancement: pad the last incomplete window with
silence.

Signed-off-by: Nicolas George 
---
 libavfilter/avf_showspectrum.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index 28db8b1..e925556 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -281,8 +281,6 @@ static int request_frame(AVFilterLink *outlink)
 ret = ff_request_frame(inlink);
 } while (!s->req_fullfilled && ret >= 0);
 
-if (ret == AVERROR_EOF && s->outpicref)
-push_frame(outlink);
 return ret;
 }
 
-- 
2.0.1

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


[FFmpeg-devel] [PATCH] lavfi/avf_showspectrum: use automatic framing.

2014-08-03 Thread Nicolas George
The framework can ensure that each input frame has exactly
the correct number of samples, except the last one.

Signed-off-by: Nicolas George 
---
 libavfilter/avf_showspectrum.c | 47 +++---
 1 file changed, 17 insertions(+), 30 deletions(-)

diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index e925556..b354571 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -55,8 +55,6 @@ typedef struct {
 RDFTContext *rdft;  ///< Real Discrete Fourier Transform context
 int rdft_bits;  ///< number of bits (RDFT window size = 
1filled = 0;
 
 /* pre-calc windowing function */
 s->window_func_lut =
@@ -248,6 +245,9 @@ static int config_output(AVFilterLink *outlink)
 
 outlink->frame_rate = av_make_q(inlink->sample_rate, win_size);
 
+inlink->min_samples = inlink->max_samples = inlink->partial_buf_size =
+win_size;
+
 s->combine_buffer =
 av_realloc_f(s->combine_buffer, outlink->h * 3,
  sizeof(*s->combine_buffer));
@@ -264,7 +264,6 @@ inline static int push_frame(AVFilterLink *outlink)
 s->xpos++;
 if (s->xpos >= outlink->w)
 s->xpos = 0;
-s->filled = 0;
 s->req_fullfilled = 1;
 
 return ff_filter_frame(outlink, av_frame_clone(s->outpicref));
@@ -284,7 +283,7 @@ static int request_frame(AVFilterLink *outlink)
 return ret;
 }
 
-static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples, int 
nb_samples)
+static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples)
 {
 int ret;
 AVFilterContext *ctx = inlink->dst;
@@ -297,26 +296,22 @@ static int plot_spectrum_column(AVFilterLink *inlink, 
AVFrame *insamples, int nb
 const int nb_freq = 1 << (s->rdft_bits - 1);
 const int win_size = nb_freq << 1;
 const double w = 1. / (sqrt(nb_freq) * 32768.);
+int h = s->channel_height; /* channel height */
 
 int ch, plane, n, y;
-const int start = s->filled;
-const int add_samples = FFMIN(win_size - start, nb_samples);
+const int start = 0;
+
+av_assert0(insamples->nb_samples == win_size);
 
 /* fill RDFT input with the number of samples available */
 for (ch = 0; ch < s->nb_display_channels; ch++) {
 const int16_t *p = (int16_t *)insamples->extended_data[ch];
 
-p += s->consumed;
-for (n = 0; n < add_samples; n++)
+for (n = 0; n < win_size; n++)
 s->rdft_data[ch][start + n] = p[n] * s->window_func_lut[start + n];
 }
-s->filled += add_samples;
 
-/* complete RDFT window size? */
-if (s->filled == win_size) {
-
-/* channel height */
-int h = s->channel_height;
+/* TODO reindent */
 
 /* run RDFT on each samples set */
 for (ch = 0; ch < s->nb_display_channels; ch++)
@@ -465,32 +460,24 @@ static int plot_spectrum_column(AVFilterLink *inlink, 
AVFrame *insamples, int nb
 }
 }
 
-outpicref->pts = insamples->pts +
-av_rescale_q(s->consumed + add_samples - win_size,
- (AVRational){ 1, inlink->sample_rate },
- outlink->time_base);
+outpicref->pts = insamples->pts;
 ret = push_frame(outlink);
 if (ret < 0)
 return ret;
-}
 
-return add_samples;
+return win_size;
 }
 
 static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
 {
 AVFilterContext *ctx = inlink->dst;
 ShowSpectrumContext *s = ctx->priv;
-int ret = 0, left_samples = insamples->nb_samples;
+unsigned win_size = 1 << s->rdft_bits;
+int ret = 0;
 
-s->consumed = 0;
-while (left_samples) {
-int ret = plot_spectrum_column(inlink, insamples, left_samples);
-if (ret < 0)
-break;
-s->consumed += ret;
-left_samples -= ret;
-}
+av_assert0(insamples->nb_samples <= win_size);
+if (insamples->nb_samples == win_size)
+ret = plot_spectrum_column(inlink, insamples);
 
 av_frame_free(&insamples);
 return ret;
-- 
2.0.1

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


Re: [FFmpeg-devel] rectification filter

2014-08-03 Thread Daniel Oberhoff

Am 03.08.2014 um 03:15 schrieb Daniel Oberhoff :

> Am 03.08.2014 um 00:12 schrieb Clément Bœsch :
> 
>> On Fri, Aug 01, 2014 at 12:56:42PM +0200, Daniel Oberhoff wrote:
>>> 
>>> Am 01.08.2014 um 12:22 schrieb Clément Bœsch :
>>> 
 On Fri, Aug 01, 2014 at 12:13:22PM +0200, Daniel Oberhoff wrote:
> 
> Am 29.07.2014 um 09:54 schrieb Carl Eugen Hoyos :
> 
>> Daniel Oberhoff  gmail.com> writes:
>> 
>>> OBJS-$(CONFIG_ZOOMPAN_FILTER)+= vf_zoompan.o
>>> +OBJS-$(CONFIG_RECTIFICATION_FILTER)  += vf_rectification.o
>> 
>>>   REGISTER_FILTER(ZOOMPAN,zoompan,vf);
>>> +REGISTER_FILTER(RECTIFICATION,  rectification,  vf);
>> 
>> Keep the alphabetic ordering please.
>> 
> 
> Ok
> 
>>> +AV_PIX_FMT_YUV410P,
>>> +AV_PIX_FMT_YUV444P,  AV_PIX_FMT_YUVJ444P,
>>> +AV_PIX_FMT_YUV420P,  AV_PIX_FMT_YUVJ420P,
>>> +AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA420P,
>>> +AV_PIX_FMT_NONE
>> 
>> I have no idea what this filter does and since the 
>> most important format (yuv420p) is supported, this 
>> doesn't really matter but yuv410p and yuva444p are 
>> quite exotic formats, I would at least have 
>> expected yuv422p, yuva420p and yuv444p in the list.
>> 
>> Did you test all above formats (at least the left row)?
> 
> Added the one from your list that was missing. Can you suggest an easy 
> way of testing all these formats?
> 
 
 
 add a format filter before yours in the filtergraph (-vf
 format=yuv410p,rectification …)
>>> 
>>> Ok, borders can be a bitt different, but otherwise all work now, except 
>>> vuy444p, which ffmpeg reports as invalid. btw, how can I get the components 
>>> of a given color in the colorspace?
>>> 
 If you want to add a FATE test (which would be really awesome), you can
 grep for "video_filter" in tests/fate/filter-video.mak (to test all pixel
 formats the filter supports), or just make a standard test with framecrc.
 
 [...]
>>> 
>>> I did that by adding this:
>>> 
>>> FATE_FILTER_PIXFMTS-$(CONFIG_RECTIFICATION_FILTER) += 
>>> fate-filter-pixfmts-rectification
>>> fate-filter-pixfmts-rectification: CMD = pixfmts "0.6:0.4:0.65:0.4"
>>> 
>>> then I ran 
>>> 
>>> make fate-filter-pixfmts-rectification GEN=1
>>> 
>>> which made a file
>>> 
>>> test/data/fate/filter-pixfmts-rectification.rep
>>> 
>> 
>> This is the result of a normal run to be compared by with the reference
>> which should have also been generated with the help of GEN=1 for your
>> first run. The file(s) generated by GEN=1 need to be tracked.
>> 
>>> do I check this in or not?
>>> 
>> 
>> Of course you are supposed to check if the results make sense.
>> 
>> Use make fate-filter-pixfmts-rectifications V=1 to see what's going on.
>> 
>>> running
>>> 
>>> make fate-filter-pixfmts-rectification GEN=1
>>> 
>>> runs fine…
>>> 
>> 
>> Of course, it doesn't do the comparison, it generates the reference.
>> 
>>> Best
>>> 
>>> Daniel
>> 
>> -- 
>> Clément B.
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> Alright, will get that cleaned up. Since I seem to have all consent I need to 
> also change the license I will see that I get a new patch ready soon.
> 
> Best and thanks for feedback!
> 
> Daniel

Hello all,

I updated the patch trying to incorporate all review feedback. I also got 
consent from the original author to put this filter under LGPL, and thus have 
it compiled in by default. I also conversed with Cyrille from Krita
and he doesn’t see any more copyright issues, as at that point it boils down to 
the use of a well known algorithm, in a straight-forward implementation.

Compared to the previous patch I renamed the filter to lenscorrection, since 
that is the name in the frei0r suite, and it will make using this instead of 
the frei0r one as easy as stating

lenscorrection=...

instead of 

frei0r=lenscorrection:...

Last but not least I adapted the format list, inspected results on all formats, 
and supplied a fate test. Release notes and docs where also adapted. Please 
check if this is ok to push now.

>From dc552ae06a41725988250896327af2cceee1b812 Mon Sep 17 00:00:00 2001
From: Daniel Oberhoff 
Date: Mon, 28 Jul 2014 23:58:12 +0200
Subject: [PATCH] ported lenscorrection filter from frei0r

---
 Changelog|   2 +-
 doc/filters.texi |  36 +
 libavfilter/Makefile |   1 +
 libavfilter/allfilters.c |   1 +
 libavfilter/version.h|   4 +-
 libavfilter/vf_lenscorrection.c  | 208 +++
 tests/fate/filter-video.mak  |   3 +
 tests/ref/fate/filter-pixfmts-lenscorrection |   8 ++
 8 files changed, 260 insertions(+

Re: [FFmpeg-devel] Reintroducing FFmpeg to Debian

2014-08-03 Thread Jose Luis Rivas
On 28/07/14, 01:20am, Andreas Cadhalpun wrote:
> Hi all,
> 
> some of you may have noticed a weird ffmpeg package in the NEW queue[1].
> Let me explain:
> 
> In 2011 Libav[2] was forked from FFmpeg[3]. It was a time of great
> uncertainty, the fork happened with much drama that didn't help making a
> technical cut, and at that peculiar time Debian switched to Libav.
 
Hi Andreas and everyone,

FWIW, my experience with this is that I had to make my own FFmpeg
package a while ago [0] because I needed it for a project I was working
on at the moment [1].

[0] https://github.com/ghostbar/FFmpeg.deb
[1] https://github.com/ghostbar/RTSP-Streaming.js

The reason for having to package my own FFmpeg is the current libav
which is taking the space of ffmpeg seemed to conflict with every other
ffmpeg package out there, including marillat's and for my project I
actually needed ffmpeg, not libav since it didn't had the functionality.
(More specifically: the ability to take still images from an rtsp
stream).

Not having FFmpeg available in the debian repositories is a nuissance,
and certainly having libav instead which seems to be a fork yet not
having the full FFmpeg functionality and using the same package name is
worst. I didn't figured this out at first because the binary said
`ffmpeg`. Of course, I'm talking about [2] since now that seems to not
be an issue yet remains the lack of functionality.

[2] https://packages.debian.org/wheezy/ffmpeg

If the issue is that this would mean having to fix security bugs twice
then it would be reasonable to stop shipping libav and instead ship
ffmpeg, since has more functionality and AFAICS from their repos bunch 
of active bug-fixing.

I honestly do not understand why ffmpeg is not in the repos nor why
there seems to be an active movement to block it.

Kind regards.
-- 
Jose Luis Rivas · ghostbar 
The Debian Project · 
GPG · D278 F9C1 5E54 61AA 3C1E  2FCD 13EC 43EE B9AC 8C43


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


Re: [FFmpeg-devel] rectification filter

2014-08-03 Thread Paul B Mahol
On Sun, Aug 3, 2014 at 5:39 PM, Daniel Oberhoff 
wrote:

>
> Am 03.08.2014 um 03:15 schrieb Daniel Oberhoff <
> danieloberh...@googlemail.com>:
>
> > Am 03.08.2014 um 00:12 schrieb Clément Bœsch :
> >
> >> On Fri, Aug 01, 2014 at 12:56:42PM +0200, Daniel Oberhoff wrote:
> >>>
> >>> Am 01.08.2014 um 12:22 schrieb Clément Bœsch :
> >>>
>  On Fri, Aug 01, 2014 at 12:13:22PM +0200, Daniel Oberhoff wrote:
> >
> > Am 29.07.2014 um 09:54 schrieb Carl Eugen Hoyos :
> >
> >> Daniel Oberhoff  gmail.com> writes:
> >>
> >>> OBJS-$(CONFIG_ZOOMPAN_FILTER)+= vf_zoompan.o
> >>> +OBJS-$(CONFIG_RECTIFICATION_FILTER)  += vf_rectification.o
> >>
> >>>   REGISTER_FILTER(ZOOMPAN,zoompan,vf);
> >>> +REGISTER_FILTER(RECTIFICATION,  rectification,  vf);
> >>
> >> Keep the alphabetic ordering please.
> >>
> >
> > Ok
> >
> >>> +AV_PIX_FMT_YUV410P,
> >>> +AV_PIX_FMT_YUV444P,  AV_PIX_FMT_YUVJ444P,
> >>> +AV_PIX_FMT_YUV420P,  AV_PIX_FMT_YUVJ420P,
> >>> +AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA420P,
> >>> +AV_PIX_FMT_NONE
> >>
> >> I have no idea what this filter does and since the
> >> most important format (yuv420p) is supported, this
> >> doesn't really matter but yuv410p and yuva444p are
> >> quite exotic formats, I would at least have
> >> expected yuv422p, yuva420p and yuv444p in the list.
> >>
> >> Did you test all above formats (at least the left row)?
> >
> > Added the one from your list that was missing. Can you suggest an
> easy way of testing all these formats?
> >
> 
> 
>  add a format filter before yours in the filtergraph (-vf
>  format=yuv410p,rectification …)
> >>>
> >>> Ok, borders can be a bitt different, but otherwise all work now,
> except vuy444p, which ffmpeg reports as invalid. btw, how can I get the
> components of a given color in the colorspace?
> >>>
>  If you want to add a FATE test (which would be really awesome), you
> can
>  grep for "video_filter" in tests/fate/filter-video.mak (to test all
> pixel
>  formats the filter supports), or just make a standard test with
> framecrc.
> 
>  [...]
> >>>
> >>> I did that by adding this:
> >>>
> >>> FATE_FILTER_PIXFMTS-$(CONFIG_RECTIFICATION_FILTER) +=
> fate-filter-pixfmts-rectification
> >>> fate-filter-pixfmts-rectification: CMD = pixfmts "0.6:0.4:0.65:0.4"
> >>>
> >>> then I ran
> >>>
> >>> make fate-filter-pixfmts-rectification GEN=1
> >>>
> >>> which made a file
> >>>
> >>> test/data/fate/filter-pixfmts-rectification.rep
> >>>
> >>
> >> This is the result of a normal run to be compared by with the reference
> >> which should have also been generated with the help of GEN=1 for your
> >> first run. The file(s) generated by GEN=1 need to be tracked.
> >>
> >>> do I check this in or not?
> >>>
> >>
> >> Of course you are supposed to check if the results make sense.
> >>
> >> Use make fate-filter-pixfmts-rectifications V=1 to see what's going on.
> >>
> >>> running
> >>>
> >>> make fate-filter-pixfmts-rectification GEN=1
> >>>
> >>> runs fine…
> >>>
> >>
> >> Of course, it doesn't do the comparison, it generates the reference.
> >>
> >>> Best
> >>>
> >>> Daniel
> >>
> >> --
> >> Clément B.
> >> ___
> >> ffmpeg-devel mailing list
> >> ffmpeg-devel@ffmpeg.org
> >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > Alright, will get that cleaned up. Since I seem to have all consent I
> need to also change the license I will see that I get a new patch ready
> soon.
> >
> > Best and thanks for feedback!
> >
> > Daniel
>
> Hello all,
>
> I updated the patch trying to incorporate all review feedback. I also got
> consent from the original author to put this filter under LGPL, and thus
> have it compiled in by default. I also conversed with Cyrille from Krita
> and he doesn’t see any more copyright issues, as at that point it boils
> down to the use of a well known algorithm, in a straight-forward
> implementation.
>
> Compared to the previous patch I renamed the filter to lenscorrection,
> since that is the name in the frei0r suite, and it will make using this
> instead of the frei0r one as easy as stating
>
> lenscorrection=...
>
> instead of
>
> frei0r=lenscorrection:...
>
> Last but not least I adapted the format list, inspected results on all
> formats, and supplied a fate test. Release notes and docs where also
> adapted. Please check if this is ok to push now.
>
> From dc552ae06a41725988250896327af2cceee1b812 Mon Sep 17 00:00:00 2001
> From: Daniel Oberhoff 
> Date: Mon, 28 Jul 2014 23:58:12 +0200
> Subject: [PATCH] ported lenscorrection filter from frei0r
>
> ---
>  Changelog|   2 +-
>  doc/filters.texi |  36 +
>  libavfilter/Makefile |   1 +
>  libavfilter/allfilters.c  

Re: [FFmpeg-devel] [PATCH 1/4] libavcodec: new API for frame threading by step

2014-08-03 Thread Christophe Gisquet
Hi,

note: I'm using "step" throughout the patch because of the step
function and what the causal part most often looks like. I have no
idea for another less confusing wording.

2014-07-28 23:15 GMT+02:00 Michael Niedermayer :
> maybe i misunderstand but the "progress[1] > y" check looks odd,
> shouldnt progress[0] be updated to a larger value even if
> progress[1] > y
> ?

Let's look at the following schema, that maybe should be added to the
documentation:
 ___ p[0]
p[1] ___|
   p[2]

p(rogress)[0] and p[1] are the ordinates of the step. p[2] is the abscissa.

This is stranger than needed because I wanted progress[0] to keep its
meaning from previous API:
- you can somewhat easily revert back to this previous API way of working
- whether intentionally or erroneously, you can somewhat mix the 2 (eg
wait using previous API while using reporting using new one); this is
not a great benefit but I was wondering if in some cases you couldn't
avoid operating the 2 (for hevc, wpp/slice threading in a frame and
normal in another)

I think this makes the meaning of progress[] less obvious, but it had
some practicality at the time.

> from ff_thread_await_progress3()
> > +if (!progress || progress[0] >= y ||
> > +(progress[2] >= x && progress[1] >= y)) return;
>
>
> i would have expected report to do:
>
> if (progress[1] <= y + step &&  progress[2] <= x)
> update progress[1..2]
>
> but again, maybe iam missing something

I'm not sure how much the previous explanation changes your
understanding. I think you've been made fully aware by the comment in
the code, but that step parameter is only useful for the x/y progress,
and in a limited way. Sorry in advance if the following rationale is
more confusing than anything else.

The step parameter assumes square elements (blocks) are being decoded
and advance the progress.

_raster_end really does not care about the step: it just signals the
end of the raster line, thus the progress is just flat (no step).
The step parameter is only useful while in a step progress.

Now, the one concern with the step progress API is when concurrent
parts of a line are being decoded (think of a slice starting on this
line). This may break if slice threading is also activated. The
increment checking that uses the step tries to avoid this.

But in some cases (several wpp threads), the progress is more like
several staircases. Handling this would get out of hand and is less
practical, so we are only dealing with one at a time.

Nevertheless, when the raster line completes, the step progress on the
following line may be well underway because of this, and the step
increment check would force waiting for line completion, loosing any
benefit of the API. So the step parameter can be used to both:
- check the increment
- immediately update progress on next line to allow some progress in it.

> if progress[0] starts with 0 then this should be unneeded

It's not always 0 if not enough attention is being paid by the user.
Example with hevc: a block might have been completely
in-loop-filtered, while the right neighbour isn't. In that case, a
+/-4 pixels band around the top of the unfiltered neighbour can't
used. If we are on the start of the image, this makes it -4. We can
check this in the hevc code (clipping y position) but I thought it
would simpler to handle it inside of the API.

> also if the x and y step size is constant then one could use a
> single variable based progress with
> x_in_steps + y_in_steps * width_in_steps

Yes, Donald mentioned this and so people could probably rewrite codecs
to benefit from this finer granularity. My cursory look revealed
nothing regarding vp8/9 but I may be wrong.

However, I think it wouldn't allow the detail of the jumping position,
though. Regarding the constant position, most likely, yes.

A contrived counter-example are hevc post-filters that can be disabled
on a slice-basis. Currently that doesn't matter, because we only look
at the sps info, but it is possible to consider different steps
depending on the frame etc.

Overall, I don't think this new API is much future-proof, because the
threading options in ffhevc are limited. I tried to start looking at
vp9 but I realistically don't have that much time and will to come
with a working version in that case.

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


Re: [FFmpeg-devel] rectification filter

2014-08-03 Thread Daniel Oberhoff

Am 03.08.2014 um 18:38 schrieb Paul B Mahol :

> On Sun, Aug 3, 2014 at 5:39 PM, Daniel Oberhoff 
> wrote:
> 
>> 
>> Am 03.08.2014 um 03:15 schrieb Daniel Oberhoff <
>> danieloberh...@googlemail.com>:
>> 
>>> Am 03.08.2014 um 00:12 schrieb Clément Bœsch :
>>> 
 On Fri, Aug 01, 2014 at 12:56:42PM +0200, Daniel Oberhoff wrote:
> 
> Am 01.08.2014 um 12:22 schrieb Clément Bœsch :
> 
>> On Fri, Aug 01, 2014 at 12:13:22PM +0200, Daniel Oberhoff wrote:
>>> 
>>> Am 29.07.2014 um 09:54 schrieb Carl Eugen Hoyos :
>>> 
 Daniel Oberhoff  gmail.com> writes:
 
> OBJS-$(CONFIG_ZOOMPAN_FILTER)+= vf_zoompan.o
> +OBJS-$(CONFIG_RECTIFICATION_FILTER)  += vf_rectification.o
 
>  REGISTER_FILTER(ZOOMPAN,zoompan,vf);
> +REGISTER_FILTER(RECTIFICATION,  rectification,  vf);
 
 Keep the alphabetic ordering please.
 
>>> 
>>> Ok
>>> 
> +AV_PIX_FMT_YUV410P,
> +AV_PIX_FMT_YUV444P,  AV_PIX_FMT_YUVJ444P,
> +AV_PIX_FMT_YUV420P,  AV_PIX_FMT_YUVJ420P,
> +AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA420P,
> +AV_PIX_FMT_NONE
 
 I have no idea what this filter does and since the
 most important format (yuv420p) is supported, this
 doesn't really matter but yuv410p and yuva444p are
 quite exotic formats, I would at least have
 expected yuv422p, yuva420p and yuv444p in the list.
 
 Did you test all above formats (at least the left row)?
>>> 
>>> Added the one from your list that was missing. Can you suggest an
>> easy way of testing all these formats?
>>> 
>> 
>> 
>> add a format filter before yours in the filtergraph (-vf
>> format=yuv410p,rectification …)
> 
> Ok, borders can be a bitt different, but otherwise all work now,
>> except vuy444p, which ffmpeg reports as invalid. btw, how can I get the
>> components of a given color in the colorspace?
> 
>> If you want to add a FATE test (which would be really awesome), you
>> can
>> grep for "video_filter" in tests/fate/filter-video.mak (to test all
>> pixel
>> formats the filter supports), or just make a standard test with
>> framecrc.
>> 
>> [...]
> 
> I did that by adding this:
> 
> FATE_FILTER_PIXFMTS-$(CONFIG_RECTIFICATION_FILTER) +=
>> fate-filter-pixfmts-rectification
> fate-filter-pixfmts-rectification: CMD = pixfmts "0.6:0.4:0.65:0.4"
> 
> then I ran
> 
> make fate-filter-pixfmts-rectification GEN=1
> 
> which made a file
> 
> test/data/fate/filter-pixfmts-rectification.rep
> 
 
 This is the result of a normal run to be compared by with the reference
 which should have also been generated with the help of GEN=1 for your
 first run. The file(s) generated by GEN=1 need to be tracked.
 
> do I check this in or not?
> 
 
 Of course you are supposed to check if the results make sense.
 
 Use make fate-filter-pixfmts-rectifications V=1 to see what's going on.
 
> running
> 
> make fate-filter-pixfmts-rectification GEN=1
> 
> runs fine…
> 
 
 Of course, it doesn't do the comparison, it generates the reference.
 
> Best
> 
> Daniel
 
 --
 Clément B.
 ___
 ffmpeg-devel mailing list
 ffmpeg-devel@ffmpeg.org
 http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>> 
>>> Alright, will get that cleaned up. Since I seem to have all consent I
>> need to also change the license I will see that I get a new patch ready
>> soon.
>>> 
>>> Best and thanks for feedback!
>>> 
>>> Daniel
>> 
>> Hello all,
>> 
>> I updated the patch trying to incorporate all review feedback. I also got
>> consent from the original author to put this filter under LGPL, and thus
>> have it compiled in by default. I also conversed with Cyrille from Krita
>> and he doesn’t see any more copyright issues, as at that point it boils
>> down to the use of a well known algorithm, in a straight-forward
>> implementation.
>> 
>> Compared to the previous patch I renamed the filter to lenscorrection,
>> since that is the name in the frei0r suite, and it will make using this
>> instead of the frei0r one as easy as stating
>> 
>> lenscorrection=...
>> 
>> instead of
>> 
>> frei0r=lenscorrection:...
>> 
>> Last but not least I adapted the format list, inspected results on all
>> formats, and supplied a fate test. Release notes and docs where also
>> adapted. Please check if this is ok to push now.
>> 
>> From dc552ae06a41725988250896327af2cceee1b812 Mon Sep 17 00:00:00 2001
>> From: Daniel Oberhoff 
>> Date: Mon, 28 Jul 2014 23:58:12 +0200
>> Subject: [PATCH] ported lenscorrection filter from frei0r
>> 
>> ---
>> Changelog|   2 +-
>> doc/

Re: [FFmpeg-devel] [PATCH 0/4] Exploit compile-time constant

2014-08-03 Thread Christophe Gisquet
Hi,

2014-08-02 14:48 GMT+02:00 Michael Niedermayer :
> is this for apply/push or just RFC/WIP ?

in-between. I had expected Mickael Raulet to comment if he was seeing
something not compatible with this. I think the bipred code is a bit
more mature since Ronald comments (iirc), so premature optimization is
probably a bit strong. Once Mickael is OK, then I'd agree with you
about applying it.

> you say "Premature optimization and overall not that useful."
> i would tend to suggest to apply it as it improves speed ...

I was saying this mostly because it doesn't really register overall:
MC is around 20% in ffhevc for starters.

> seems to fail with
> libavcodec/x86/hevc_mc.asm:1258: error: (add:2) cannot reference symbol 
> `MAX_PB_SIZE' in preprocessor

That's actually the biggest beef I have with this patchset:
MAX_PB_SIZE is a C and asm define, and the 2 need to be synchronized
manually. I don't see how it could go beyond 64 (max block size in
hevc), so the issue is rhetorical.

I'm busy atm so I don't expect a new patchset soon.

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


Re: [FFmpeg-devel] rectification filter

2014-08-03 Thread Timothy Gu


On 08/03/2014 08:39 AM, Daniel Oberhoff wrote:

> 
> Hello all,
> 
> I updated the patch trying to incorporate all review feedback. I also got 
> consent from the original author to put this filter under LGPL, and thus have 
> it compiled in by default. I also conversed with Cyrille from Krita
> and he doesn’t see any more copyright issues, as at that point it boils down 
> to the use of a well known algorithm, in a straight-forward implementation.
> 
> Compared to the previous patch I renamed the filter to lenscorrection, since 
> that is the name in the frei0r suite, and it will make using this instead of 
> the frei0r one as easy as stating
> 
> lenscorrection=...
> 
> instead of 
> 
> frei0r=lenscorrection:...
> 
> Last but not least I adapted the format list, inspected results on all 
> formats, and supplied a fate test. Release notes and docs where also adapted. 
> Please check if this is ok to push now.
> 
> From dc552ae06a41725988250896327af2cceee1b812 Mon Sep 17 00:00:00 2001
> From: Daniel Oberhoff 
> Date: Mon, 28 Jul 2014 23:58:12 +0200

> Subject: [PATCH] ported lenscorrection filter from frei0r

avfilter: port lenscorrection filter from frei0r

> 
> ---
>  Changelog|   2 +-
>  doc/filters.texi |  36 +
>  libavfilter/Makefile |   1 +
>  libavfilter/allfilters.c |   1 +
>  libavfilter/version.h|   4 +-
>  libavfilter/vf_lenscorrection.c  | 208 
> +++
>  tests/fate/filter-video.mak  |   3 +
>  tests/ref/fate/filter-pixfmts-lenscorrection |   8 ++
>  8 files changed, 260 insertions(+), 3 deletions(-)
>  create mode 100644 libavfilter/vf_lenscorrection.c
>  create mode 100644 tests/ref/fate/filter-pixfmts-lenscorrection

If you would like to maintain this filter, you can choose to add your
name to the MAINTAINERS file.

> 
> diff --git a/Changelog b/Changelog
> index 067f72a..3c1ee51 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -2,7 +2,7 @@ Entries are sorted chronologically from oldest to youngest 
> within each release,
>  releases are sorted from youngest to oldest.
>  
>  version :
> -
> +- ported lenscorrection filter from frei0r filter

Just say frei0r and drop the "filter"

>  
>  version 2.3:
>  - AC3 fixed-point decoding
> diff --git a/doc/filters.texi b/doc/filters.texi
> index c5caa77..2af311a 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -5532,6 +5532,42 @@ kerndeint=map=1
>  @end example
>  @end itemize
>  
> +@section lenscorrection
> +

Add an one-line description here:

Compensates for lens distortion.

or

Correct lens distortion.

> +This filter can be used to correct for radial distortion as can result from 
> the use
> +of wide angle lenses, and thereby re-rectify the image. To find the right 
> parameters
> +one can use tools available for example as part of opencv or simply 
> trial-and-error.

OpenCV

Can you offer some examples on how to find the right parameters? FFmpeg
has support for libopencv. Can you use that?

> +Note that effectively the same filter is available in the open-source tools 
> Krita and
> +Digikam from the KDE project.

Add an empty line here to make the two paragraphs separate on the built
documentation.

> +In contrast to the vignette filter, which can also be used to compensate 
> lens errors,

Use @ref{vignette} here, and add @anchor{vignette} before @section
vignette later in the file.

> +this filter corrects the distortion of the image, whereas vignette corrects 
> the
> +brightness distribution, so you may want to use both filters together in 
> certain
> +cases, though you will have to take care of ordering, i.e. wether vignette 
> should

whether

I also think you should probably use regular English and not filter
names here, which makes the documentation more readable. So it's
"vignetting" here, and "lens correction" below.

> +be applied before or after lenscorrection.
> +

Add `@subsection Options` here.

> +The filter accepts the following options:
> +
> +@table @option
> +@item cx
> +Relative x-coordinate of the focal point of the image, and thereby the 
> center of the
> +distrortion. This value has a range [0,1] and is expressed as fractions of 
> the image
> +width.
> +@item cy
> +Relative y-coordinate of the focal point of the image, and thereby the 
> center of the
> +distrortion. This value has a range [0,1] and is expressed as fractions of 
> the image
> +height.
> +@item k1
> +Coefficient of the quadratic correction term. 0.5 means no correction.
> +@item k2
> +Coefficient of the double quadratic correction term. 0.5 means no correction.
> +@end table
> +
> +The formula that generates the correction is:
> +

> +r_src = r_tgt * (1 + (k1 - 0.5) * (r_tgt/r_0)^2 + (k2 - 0.5) * (r_tgt/r_0)^4)

Please add @var{} to all of the variables, or, if you prefer, surround
this block with @example and @end example.

> +
> +where r_0 is halve

[FFmpeg-devel] [PATCH] lavfi/avf_showspectrum: add full frame sliding mode.

2014-08-03 Thread Nicolas George
Signed-off-by: Nicolas George 
---
 doc/filters.texi   | 15 +++--
 libavfilter/avf_showspectrum.c | 50 +++---
 2 files changed, 45 insertions(+), 20 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index c5caa77..8739e84 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10589,8 +10589,19 @@ the "Video size" section in the ffmpeg-utils manual. 
Default value is
 @code{640x512}.
 
 @item slide
-Specify if the spectrum should slide along the window. Default value is
-@code{0}.
+Specify how the spectrum should slide along the window.
+
+It accepts the following values:
+@table @samp
+@item replace
+the samples start again on the left when they reach the right
+@item scroll
+the samples scroll from right to left
+@item fullframe
+frames are only produced when the samples reach the right
+@end table
+
+Default value is @code{replace}.
 
 @item mode
 Specify display mode.
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index b354571..56759ff 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -38,6 +38,7 @@ enum DisplayMode  { COMBINED, SEPARATE, NB_MODES };
 enum DisplayScale { LINEAR, SQRT, CBRT, LOG, NB_SCALES };
 enum ColorMode{ CHANNEL, INTENSITY, NB_CLMODES };
 enum WindowFunc   { WFUNC_NONE, WFUNC_HANN, WFUNC_HAMMING, WFUNC_BLACKMAN, 
NB_WFUNC };
+enum SlideMode{ REPLACE, SCROLL, FULLFRAME, NB_SLIDES };
 
 typedef struct {
 const AVClass *class;
@@ -66,7 +67,10 @@ typedef struct {
 static const AVOption showspectrum_options[] = {
 { "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = 
"640x512"}, 0, 0, FLAGS },
 { "s","set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = 
"640x512"}, 0, 0, FLAGS },
-{ "slide", "set sliding mode", OFFSET(sliding), AV_OPT_TYPE_INT, {.i64 = 
0}, 0, 1, FLAGS },
+{ "slide", "set sliding mode", OFFSET(sliding), AV_OPT_TYPE_INT, {.i64 = 
0}, 0, NB_SLIDES, FLAGS, "slide" },
+{ "replace", "replace old colums with new", 0, AV_OPT_TYPE_CONST, 
{.i64=REPLACE}, 0, 0, FLAGS, "slide" },
+{ "scroll", "scroll from right to left", 0, AV_OPT_TYPE_CONST, 
{.i64=SCROLL}, 0, 0, FLAGS, "slide" },
+{ "fullframe", "return full frames", 0, AV_OPT_TYPE_CONST, 
{.i64=FULLFRAME}, 0, 0, FLAGS, "slide" },
 { "mode", "set channel display mode", OFFSET(mode), AV_OPT_TYPE_INT, 
{.i64=COMBINED}, COMBINED, NB_MODES-1, FLAGS, "mode" },
 { "combined", "combined mode", 0, AV_OPT_TYPE_CONST, {.i64=COMBINED}, 
0, 0, FLAGS, "mode" },
 { "separate", "separate mode", 0, AV_OPT_TYPE_CONST, {.i64=SEPARATE}, 
0, 0, FLAGS, "mode" },
@@ -244,6 +248,8 @@ static int config_output(AVFilterLink *outlink)
 s->xpos = 0;
 
 outlink->frame_rate = av_make_q(inlink->sample_rate, win_size);
+if (s->sliding == FULLFRAME)
+outlink->frame_rate.den *= outlink->w;
 
 inlink->min_samples = inlink->max_samples = inlink->partial_buf_size =
 win_size;
@@ -257,27 +263,27 @@ static int config_output(AVFilterLink *outlink)
 return 0;
 }
 
-inline static int push_frame(AVFilterLink *outlink)
-{
-ShowSpectrumContext *s = outlink->src->priv;
-
-s->xpos++;
-if (s->xpos >= outlink->w)
-s->xpos = 0;
-s->req_fullfilled = 1;
-
-return ff_filter_frame(outlink, av_frame_clone(s->outpicref));
-}
-
 static int request_frame(AVFilterLink *outlink)
 {
 ShowSpectrumContext *s = outlink->src->priv;
 AVFilterLink *inlink = outlink->src->inputs[0];
+unsigned i;
 int ret;
 
 s->req_fullfilled = 0;
 do {
 ret = ff_request_frame(inlink);
+if (ret == AVERROR_EOF && s->sliding == FULLFRAME && s->xpos > 0 &&
+s->outpicref) {
+for (i = 0; i < outlink->h; i++) {
+memset(s->outpicref->data[0] + i * s->outpicref->linesize[0] + 
s->xpos,   0, outlink->w - s->xpos);
+memset(s->outpicref->data[1] + i * s->outpicref->linesize[1] + 
s->xpos, 128, outlink->w - s->xpos);
+memset(s->outpicref->data[2] + i * s->outpicref->linesize[2] + 
s->xpos, 128, outlink->w - s->xpos);
+}
+ret = ff_filter_frame(outlink, s->outpicref);
+s->outpicref = NULL;
+s->req_fullfilled = 1;
+}
 } while (!s->req_fullfilled && ret >= 0);
 
 return ret;
@@ -440,7 +446,7 @@ static int plot_spectrum_column(AVFilterLink *inlink, 
AVFrame *insamples)
 }
 
 /* copy to output */
-if (s->sliding) {
+if (s->sliding == SCROLL) {
 for (plane = 0; plane < 3; plane++) {
 for (y = 0; y < outlink->h; y++) {
 uint8_t *p = outpicref->data[plane] +
@@ -460,10 +466,18 @@ static int plot_spectrum_column(AVFilterLink *inlink, 
AVFrame *insamples)
 }
 }
 
-outpicref->pts = insamples->pts;
-ret = push_frame(outlink);
-if (ret < 0)
- 

[FFmpeg-devel] [PATCH] lavfi/avf_showspectrum: use automatic framing.

2014-08-03 Thread Nicolas George
The framework can ensure that each input frame has exactly
the correct number of samples, except the last one.

Signed-off-by: Nicolas George 
---
 libavfilter/avf_showspectrum.c | 48 +++---
 1 file changed, 17 insertions(+), 31 deletions(-)


Forgot to remove a variable that is no longer useful.


diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index e925556..c59a4f6 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -55,8 +55,6 @@ typedef struct {
 RDFTContext *rdft;  ///< Real Discrete Fourier Transform context
 int rdft_bits;  ///< number of bits (RDFT window size = 
1filled = 0;
 
 /* pre-calc windowing function */
 s->window_func_lut =
@@ -248,6 +245,9 @@ static int config_output(AVFilterLink *outlink)
 
 outlink->frame_rate = av_make_q(inlink->sample_rate, win_size);
 
+inlink->min_samples = inlink->max_samples = inlink->partial_buf_size =
+win_size;
+
 s->combine_buffer =
 av_realloc_f(s->combine_buffer, outlink->h * 3,
  sizeof(*s->combine_buffer));
@@ -264,7 +264,6 @@ inline static int push_frame(AVFilterLink *outlink)
 s->xpos++;
 if (s->xpos >= outlink->w)
 s->xpos = 0;
-s->filled = 0;
 s->req_fullfilled = 1;
 
 return ff_filter_frame(outlink, av_frame_clone(s->outpicref));
@@ -284,7 +283,7 @@ static int request_frame(AVFilterLink *outlink)
 return ret;
 }
 
-static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples, int 
nb_samples)
+static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples)
 {
 int ret;
 AVFilterContext *ctx = inlink->dst;
@@ -297,26 +296,21 @@ static int plot_spectrum_column(AVFilterLink *inlink, 
AVFrame *insamples, int nb
 const int nb_freq = 1 << (s->rdft_bits - 1);
 const int win_size = nb_freq << 1;
 const double w = 1. / (sqrt(nb_freq) * 32768.);
+int h = s->channel_height; /* channel height */
 
 int ch, plane, n, y;
-const int start = s->filled;
-const int add_samples = FFMIN(win_size - start, nb_samples);
+
+av_assert0(insamples->nb_samples == win_size);
 
 /* fill RDFT input with the number of samples available */
 for (ch = 0; ch < s->nb_display_channels; ch++) {
 const int16_t *p = (int16_t *)insamples->extended_data[ch];
 
-p += s->consumed;
-for (n = 0; n < add_samples; n++)
-s->rdft_data[ch][start + n] = p[n] * s->window_func_lut[start + n];
+for (n = 0; n < win_size; n++)
+s->rdft_data[ch][n] = p[n] * s->window_func_lut[n];
 }
-s->filled += add_samples;
 
-/* complete RDFT window size? */
-if (s->filled == win_size) {
-
-/* channel height */
-int h = s->channel_height;
+/* TODO reindent */
 
 /* run RDFT on each samples set */
 for (ch = 0; ch < s->nb_display_channels; ch++)
@@ -465,32 +459,24 @@ static int plot_spectrum_column(AVFilterLink *inlink, 
AVFrame *insamples, int nb
 }
 }
 
-outpicref->pts = insamples->pts +
-av_rescale_q(s->consumed + add_samples - win_size,
- (AVRational){ 1, inlink->sample_rate },
- outlink->time_base);
+outpicref->pts = insamples->pts;
 ret = push_frame(outlink);
 if (ret < 0)
 return ret;
-}
 
-return add_samples;
+return win_size;
 }
 
 static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
 {
 AVFilterContext *ctx = inlink->dst;
 ShowSpectrumContext *s = ctx->priv;
-int ret = 0, left_samples = insamples->nb_samples;
+unsigned win_size = 1 << s->rdft_bits;
+int ret = 0;
 
-s->consumed = 0;
-while (left_samples) {
-int ret = plot_spectrum_column(inlink, insamples, left_samples);
-if (ret < 0)
-break;
-s->consumed += ret;
-left_samples -= ret;
-}
+av_assert0(insamples->nb_samples <= win_size);
+if (insamples->nb_samples == win_size)
+ret = plot_spectrum_column(inlink, insamples);
 
 av_frame_free(&insamples);
 return ret;
-- 
2.0.1

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


[FFmpeg-devel] [PATCHv3] Deprecate AFD field and add AFD as side-data

2014-08-03 Thread Kieran Kunhya
---
 doc/APIchanges|4 
 libavcodec/avcodec.h  |5 -
 libavcodec/mpeg12dec.c|   20 +++-
 libavcodec/version.h  |5 -
 libavfilter/vf_showinfo.c |3 +++
 libavutil/frame.h |   16 
 libavutil/version.h   |2 +-
 7 files changed, 51 insertions(+), 4 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index fd202aa..e50768d 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,10 @@ libavutil: 2013-12-xx
 
 API changes, most recent first:
 
+2014-07-xx - xxx - lavc 55.57.2 - avcodec.h
+2014-07-xx - xxx - lavu 53.20.0 - frame.h
+  Deprecate AVCodecContext.dtg_active_format and use side-data instead
+
 2014-08-xx - xxx - lavc 55.57.1 - avcodec.h
   Deprecate unused FF_IDCT_IPP define and ipp avcodec option.
   Deprecate unused FF_DEBUG_PTS define and pts avcodec option.
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index dc8d57e..4261b46 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1503,6 +1503,7 @@ typedef struct AVCodecContext {
  */
 int me_subpel_quality;
 
+#if FF_API_AFD
 /**
  * DTG active format information (additional aspect ratio
  * information only used in DVB MPEG-2 transport streams)
@@ -1510,8 +1511,9 @@ typedef struct AVCodecContext {
  *
  * - encoding: unused
  * - decoding: Set by decoder.
+ * @deprecated Deprecated in favour of AVSideData
  */
-int dtg_active_format;
+attribute_deprecated int dtg_active_format;
 #define FF_DTG_AFD_SAME 8
 #define FF_DTG_AFD_4_3  9
 #define FF_DTG_AFD_16_9 10
@@ -1519,6 +1521,7 @@ typedef struct AVCodecContext {
 #define FF_DTG_AFD_4_3_SP_14_9  13
 #define FF_DTG_AFD_16_9_SP_14_9 14
 #define FF_DTG_AFD_SP_4_3   15
+#endif
 
 /**
  * maximum motion estimation search range in subpel units
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index aa98454..e36295d 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -54,6 +54,8 @@ typedef struct Mpeg1Context {
 int has_stereo3d;
 uint8_t *a53_caption;
 int a53_caption_size;
+uint8_t afd;
+int has_afd;
 int slice_count;
 int save_aspect_info;
 int save_width, save_height, save_progressive_seq;
@@ -1631,6 +1633,18 @@ static int mpeg_field_start(MpegEncContext *s, const 
uint8_t *buf, int buf_size)
 *stereo = s1->stereo3d;
 s1->has_stereo3d = 0;
 }
+
+if (s1->has_afd) {
+AVFrameSideData *sd = av_frame_new_side_data(
+s->current_picture_ptr->f, AV_FRAME_DATA_AFD,
+1);
+if (!sd)
+return AVERROR(ENOMEM);
+
+sd->data = s1->afd;
+s1->has_afd = 0;
+}
+
 if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_FRAME))
 ff_thread_finish_setup(avctx);
 } else { // second field
@@ -2221,6 +2235,7 @@ static void mpeg_decode_user_data(AVCodecContext *avctx,
   const uint8_t *p, int buf_size)
 {
 const uint8_t *buf_end = p + buf_size;
+Mpeg1Context *s1   = avctx->priv_data;
 
 /* we parse the DTG active format information */
 if (buf_end - p >= 5 &&
@@ -2234,7 +2249,11 @@ static void mpeg_decode_user_data(AVCodecContext *avctx,
 if (flags & 0x40) {
 if (buf_end - p < 1)
 return;
+#if FF_API_AFD
 avctx->dtg_active_format = p[0] & 0x0f;
+#endif
+s1->has_afd = 1;
+s1->afd = p[0] & 0x0f;
 }
 } else if (buf_end - p >= 6 &&
p[0] == 'J' && p[1] == 'P' && p[2] == '3' && p[3] == 'D' &&
@@ -2246,7 +2265,6 @@ static void mpeg_decode_user_data(AVCodecContext *avctx,
 S3D_video_format_type == 0x04 ||
 S3D_video_format_type == 0x08 ||
 S3D_video_format_type == 0x23) {
-Mpeg1Context *s1   = avctx->priv_data;
 
 s1->has_stereo3d = 1;
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index cd35ae6..2c22adb 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -30,7 +30,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR 55
 #define LIBAVCODEC_VERSION_MINOR 57
-#define LIBAVCODEC_VERSION_MICRO  1
+#define LIBAVCODEC_VERSION_MICRO  2
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
@@ -147,5 +147,8 @@
 #ifndef FF_API_CODEC_NAME
 #define FF_API_CODEC_NAME(LIBAVCODEC_VERSION_MAJOR < 57)
 #endif
+#ifndef FF_API_AFD
+#define FF_API_AFD   (LIBAVCODEC_VERSION_MAJOR < 57)
+#endif
 
 #endif /* AVCODEC_VERSION_H */
diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index cf90995..23af422 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -122,6 +122,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
  

[FFmpeg-devel] [PATCH] lavfi/avf_showspectrum: check RDFT contet init.

2014-08-03 Thread Nicolas George
Fix a segfault with large window size.

Signed-off-by: Nicolas George 
---
 libavfilter/avf_showspectrum.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index 7bf3aab..764a000 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -177,6 +177,11 @@ static int config_output(AVFilterLink *outlink)
 
 av_rdft_end(s->rdft);
 s->rdft = av_rdft_init(rdft_bits, DFT_R2C);
+if (!s->rdft) {
+av_log(ctx, AV_LOG_ERROR, "Unable to allocate RDFT context. "
+   "Maybe window too high.\n");
+return AVERROR(EINVAL);
+}
 s->rdft_bits = rdft_bits;
 
 /* RDFT buffers: x2 for each (display) channel buffer.
-- 
2.0.1

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


Re: [FFmpeg-devel] [PATCH] lavfi/avf_showspectrum: check RDFT contet init.

2014-08-03 Thread Timothy Gu
On Sun, Aug 3, 2014 at 11:40 AM, Nicolas George  wrote:
> Fix a segfault with large window size.
>
> Signed-off-by: Nicolas George 
> ---
>  libavfilter/avf_showspectrum.c | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
> index 7bf3aab..764a000 100644
> --- a/libavfilter/avf_showspectrum.c
> +++ b/libavfilter/avf_showspectrum.c
> @@ -177,6 +177,11 @@ static int config_output(AVFilterLink *outlink)
>
>  av_rdft_end(s->rdft);
>  s->rdft = av_rdft_init(rdft_bits, DFT_R2C);
> +if (!s->rdft) {
> +av_log(ctx, AV_LOG_ERROR, "Unable to allocate RDFT context. "
> +   "Maybe window too high.\n");
> +return AVERROR(EINVAL);

ENOMEM?

> +}
>  s->rdft_bits = rdft_bits;
>
>  /* RDFT buffers: x2 for each (display) channel buffer.
> --
> 2.0.1
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 4/5] vf_fps: move flushing remaining frames in a separate function.

2014-08-03 Thread Michael Niedermayer
On Sun, Aug 03, 2014 at 03:15:39PM +0200, Nicolas George wrote:
> Also remove unused loop counter, rename obsolete "buf",
> and add a comment about a similar function.
> 
> Signed-off-by: Nicolas George 

LGTM

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.


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/5] lavfi/vf_fps: accept EOF timestamp.

2014-08-03 Thread Michael Niedermayer
On Sun, Aug 03, 2014 at 03:15:40PM +0200, Nicolas George wrote:
> This makes the FPS filter duplicate the last frame to take
> its duration into account, exactly like the other ones.
> 
> Fix trac ticket #2674.
> 
> Signed-off-by: Nicolas George 
> ---
>  libavfilter/vf_fps.c | 33 +
>  1 file changed, 25 insertions(+), 8 deletions(-)

probably ok

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

Democracy is the form of government in which you can choose your dictator


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


[FFmpeg-devel] [PATCH] avfilter/dctdnoiz: rewrite [f/i]dct

2014-08-03 Thread Clément Bœsch
This removes the avcodec dependency and make the code almost twice as
fast. More to come.

The DCT factorization is based on "Fast and numerically stable
algorithms for discrete cosine transforms" from Gerlind Plonkaa &
Manfred Tasche (DOI: 10.1016/j.laa.2004.07.015).
---
 configure |   2 -
 libavfilter/vf_dctdnoiz.c | 328 +-
 2 files changed, 240 insertions(+), 90 deletions(-)

diff --git a/configure b/configure
index 9c3af50..6196b2a 100755
--- a/configure
+++ b/configure
@@ -2526,8 +2526,6 @@ boxblur_filter_deps="gpl"
 bs2b_filter_deps="libbs2b"
 colormatrix_filter_deps="gpl"
 cropdetect_filter_deps="gpl"
-dctdnoiz_filter_deps="avcodec"
-dctdnoiz_filter_select="dct"
 delogo_filter_deps="gpl"
 deshake_filter_deps="avcodec"
 deshake_filter_select="me_cmp"
diff --git a/libavfilter/vf_dctdnoiz.c b/libavfilter/vf_dctdnoiz.c
index 71b8536..6d24934 100644
--- a/libavfilter/vf_dctdnoiz.c
+++ b/libavfilter/vf_dctdnoiz.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Clément Bœsch
+ * Copyright (c) 2013-2014 Clément Bœsch
  *
  * This file is part of FFmpeg.
  *
@@ -23,7 +23,6 @@
  * @see http://www.ipol.im/pub/art/2011/ys-dct/
  */
 
-#include "libavcodec/avfft.h"
 #include "libavutil/eval.h"
 #include "libavutil/opt.h"
 #include "drawutils.h"
@@ -35,7 +34,7 @@
 static const char *const var_names[] = { "c", NULL };
 enum { VAR_C, VAR_VARS_NB };
 
-typedef struct {
+typedef struct DCTdnoizContext {
 const AVClass *class;
 
 /* coefficient factor expression */
@@ -52,8 +51,9 @@ typedef struct {
 int p_linesize; // line sizes for color and weights
 int overlap;// number of block overlapping pixels
 int step;   // block step increment (BSIZE - overlap)
-DCTContext *dct, *idct; // DCT and inverse DCT contexts
-float *block, *tmp_block;   // two BSIZE x BSIZE block buffers
+void (*filter_freq_func)(struct DCTdnoizContext *s,
+ const float *src, int src_linesize,
+ float *dst, int dst_linesize);
 } DCTdnoizContext;
 
 #define OFFSET(x) offsetof(DCTdnoizContext, x)
@@ -69,66 +69,245 @@ static const AVOption dctdnoiz_options[] = {
 
 AVFILTER_DEFINE_CLASS(dctdnoiz);
 
-static float *dct_block(DCTdnoizContext *ctx, const float *src, int 
src_linesize)
+static void av_always_inline fdct16_1d(float *dst, const float *src,
+   int dst_stridea, int dst_strideb,
+   int src_stridea, int src_strideb)
 {
-int x, y;
-float *column;
-
-for (y = 0; y < BSIZE; y++) {
-float *line = ctx->block;
+int i;
 
-memcpy(line, src, BSIZE * sizeof(*line));
-src += src_linesize;
-av_dct_calc(ctx->dct, line);
-
-column = ctx->tmp_block + y;
-column[0] = line[0] * (1. / sqrt(BSIZE));
-column += BSIZE;
-for (x = 1; x < BSIZE; x++) {
-*column = line[x] * sqrt(2. / BSIZE);
-column += BSIZE;
-}
+for (i = 0; i < BSIZE; i++) {
+const float x0_0 = src[ 0*src_stridea] + src[15*src_stridea];
+const float x0_1 = src[ 1*src_stridea] + src[14*src_stridea];
+const float x0_2 = src[ 2*src_stridea] + src[13*src_stridea];
+const float x0_3 = src[ 3*src_stridea] + src[12*src_stridea];
+const float x0_4 = src[ 4*src_stridea] + src[11*src_stridea];
+const float x0_5 = src[ 5*src_stridea] + src[10*src_stridea];
+const float x0_6 = src[ 6*src_stridea] + src[ 9*src_stridea];
+const float x0_7 = src[ 7*src_stridea] + src[ 8*src_stridea];
+const float x0_8 = src[ 0*src_stridea] - src[15*src_stridea];
+const float x0_9 = src[ 1*src_stridea] - src[14*src_stridea];
+const float x0_a = src[ 2*src_stridea] - src[13*src_stridea];
+const float x0_b = src[ 3*src_stridea] - src[12*src_stridea];
+const float x0_c = src[ 4*src_stridea] - src[11*src_stridea];
+const float x0_d = src[ 5*src_stridea] - src[10*src_stridea];
+const float x0_e = src[ 6*src_stridea] - src[ 9*src_stridea];
+const float x0_f = src[ 7*src_stridea] - src[ 8*src_stridea];
+const float x2_0 = x0_0 + x0_7;
+const float x2_1 = x0_1 + x0_6;
+const float x2_2 = x0_2 + x0_5;
+const float x2_3 = x0_3 + x0_4;
+const float x2_4 = x0_0 - x0_7;
+const float x2_5 = x0_1 - x0_6;
+const float x2_6 = x0_2 - x0_5;
+const float x2_7 = x0_3 - x0_4;
+const float x4_0 = x2_0 + x2_3;
+const float x4_1 = x2_1 + x2_2;
+const float x4_2 = x2_0 - x2_3;
+const float x4_3 = x2_1 - x2_2;
+const float x5_0 = x4_0 + x4_1;
+const float x5_1 = x4_0 - x4_1;
+const float x5_2 =  1.306562964876380*x4_2 + 0.541196100146197*x4_3;
+const float x5_3 =  0.541196100146197*x4_2 - 1.306562964876380*x4_3;
+const float x6

Re: [FFmpeg-devel] [PATCH] avfilter/dctdnoiz: rewrite [f/i]dct

2014-08-03 Thread Clément Bœsch
On Sun, Aug 03, 2014 at 10:27:21PM +0200, Clément Bœsch wrote:
> This removes the avcodec dependency and make the code almost twice as
> fast. More to come.
> 
> The DCT factorization is based on "Fast and numerically stable
> algorithms for discrete cosine transforms" from Gerlind Plonkaa &
> Manfred Tasche (DOI: 10.1016/j.laa.2004.07.015).
> ---
>  configure |   2 -
>  libavfilter/vf_dctdnoiz.c | 328 
> +-
>  2 files changed, 240 insertions(+), 90 deletions(-)
> 

BTW, for the details on the factorization: https://github.com/ubitux/dct

I have a few more things planed to improve the performances; typically,
moving from 16x16 to 8x8 with the previous dct made the code something
like 6 or 7x faster, so I expect a similar gain with the new dct (I'll add
a runtime user option for this).

Also, the way color correction/decorrelation is implemented is kind of
very stupid and thus slow, so I'll fix that as well.

I would like to add tests, but the float are probably a no-go, but we
probably have a threshold system in FATE for this? (FUZZ?).

On a side note, I have an experiment with integer operations which worked
with the previous DCT, so maybe that's a solution for FATE (although I'm
uncertain about the performance gain and the precision loss).

Last thing is the threading. While it will definitely helps for the
simple sigma case, it will be a problem for the eval method. I guess I'll
just ignore threading when that option is selected by the user.

[...]

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCHv3] Deprecate AFD field and add AFD as side-data

2014-08-03 Thread Michael Niedermayer
On Sun, Aug 03, 2014 at 07:24:56PM +0100, Kieran Kunhya wrote:
> ---
>  doc/APIchanges|4 
>  libavcodec/avcodec.h  |5 -
>  libavcodec/mpeg12dec.c|   20 +++-
>  libavcodec/version.h  |5 -
>  libavfilter/vf_showinfo.c |3 +++
>  libavutil/frame.h |   16 
>  libavutil/version.h   |2 +-
>  7 files changed, 51 insertions(+), 4 deletions(-)
[...]
> @@ -1631,6 +1633,18 @@ static int mpeg_field_start(MpegEncContext *s, const 
> uint8_t *buf, int buf_size)
>  *stereo = s1->stereo3d;
>  s1->has_stereo3d = 0;
>  }
> +
> +if (s1->has_afd) {
> +AVFrameSideData *sd = av_frame_new_side_data(
> +s->current_picture_ptr->f, AV_FRAME_DATA_AFD,
> +1);
> +if (!sd)
> +return AVERROR(ENOMEM);
> +

> +sd->data = s1->afd;

this should be
*(uint8_t*)sd->data = s1->afd;

also in case you had this applied locally, this could have caused
crashes in memory allocation functions like the one you talked about
in relation to opus


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

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates


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


Re: [FFmpeg-devel] [PATCHv3] Deprecate AFD field and add AFD as side-data

2014-08-03 Thread Michael Niedermayer
On Sun, Aug 03, 2014 at 10:46:58PM +0200, Michael Niedermayer wrote:
> On Sun, Aug 03, 2014 at 07:24:56PM +0100, Kieran Kunhya wrote:
> > ---
> >  doc/APIchanges|4 
> >  libavcodec/avcodec.h  |5 -
> >  libavcodec/mpeg12dec.c|   20 +++-
> >  libavcodec/version.h  |5 -
> >  libavfilter/vf_showinfo.c |3 +++
> >  libavutil/frame.h |   16 
> >  libavutil/version.h   |2 +-
> >  7 files changed, 51 insertions(+), 4 deletions(-)
> [...]
> > @@ -1631,6 +1633,18 @@ static int mpeg_field_start(MpegEncContext *s, const 
> > uint8_t *buf, int buf_size)
> >  *stereo = s1->stereo3d;
> >  s1->has_stereo3d = 0;
> >  }
> > +
> > +if (s1->has_afd) {
> > +AVFrameSideData *sd = av_frame_new_side_data(
> > +s->current_picture_ptr->f, AV_FRAME_DATA_AFD,
> > +1);
> > +if (!sd)
> > +return AVERROR(ENOMEM);
> > +
> 
> > +sd->data = s1->afd;
> 
> this should be
> *(uint8_t*)sd->data = s1->afd;

or simpler
*sd->data = s1->afd;

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


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


Re: [FFmpeg-devel] [PATCH] lavfi/avf_showspectrum: check RDFT contet init.

2014-08-03 Thread Nicolas George
Le sextidi 16 thermidor, an CCXXII, Timothy Gu a écrit :
> >  s->rdft = av_rdft_init(rdft_bits, DFT_R2C);
> > +if (!s->rdft) {
> > +av_log(ctx, AV_LOG_ERROR, "Unable to allocate RDFT context. "
> > +   "Maybe window too high.\n");
> > +return AVERROR(EINVAL);
> ENOMEM?

Ideally, av_rdft_init() would return a proper error code, but that is not
the case. In practice, on modern operating systems, memory allocation for
something that small will never fail. On the other hand, trying to init for
an unsupported window size (<4 or >16) is a very obvious error. Therefore I
believe EINVAL is more likely to reflect the actual error than ENOMEM.

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] avfilter/dctdnoiz: rewrite [f/i]dct

2014-08-03 Thread Timothy Gu
On Aug 3, 2014 1:27 PM, "Clément Bœsch"  wrote:
>
> This removes the avcodec dependency and make the code almost twice as
> fast. More to come.
>
> The DCT factorization is based on "Fast and numerically stable
> algorithms for discrete cosine transforms" from Gerlind Plonkaa &
> Manfred Tasche (DOI: 10.1016/j.laa.2004.07.015).
> ---
>  configure |   2 -
>  libavfilter/vf_dctdnoiz.c | 328
+-
>  2 files changed, 240 insertions(+), 90 deletions(-)

This change warrants a Changelog entry.

>
> diff --git a/configure b/configure
> index 9c3af50..6196b2a 100755
> --- a/configure
> +++ b/configure
> @@ -2526,8 +2526,6 @@ boxblur_filter_deps="gpl"
>  bs2b_filter_deps="libbs2b"
>  colormatrix_filter_deps="gpl"
>  cropdetect_filter_deps="gpl"
> -dctdnoiz_filter_deps="avcodec"
> -dctdnoiz_filter_select="dct"
>  delogo_filter_deps="gpl"
>  deshake_filter_deps="avcodec"
>  deshake_filter_select="me_cmp"
> diff --git a/libavfilter/vf_dctdnoiz.c b/libavfilter/vf_dctdnoiz.c
> index 71b8536..6d24934 100644
> --- a/libavfilter/vf_dctdnoiz.c
> +++ b/libavfilter/vf_dctdnoiz.c
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2013 Clément Bœsch
> + * Copyright (c) 2013-2014 Clément Bœsch
>   *
>   * This file is part of FFmpeg.
>   *
> @@ -23,7 +23,6 @@
>   * @see http://www.ipol.im/pub/art/2011/ys-dct/
>   */
>
> -#include "libavcodec/avfft.h"
>  #include "libavutil/eval.h"
>  #include "libavutil/opt.h"
>  #include "drawutils.h"
> @@ -35,7 +34,7 @@
>  static const char *const var_names[] = { "c", NULL };
>  enum { VAR_C, VAR_VARS_NB };
>
> -typedef struct {
> +typedef struct DCTdnoizContext {
>  const AVClass *class;
>
>  /* coefficient factor expression */
> @@ -52,8 +51,9 @@ typedef struct {
>  int p_linesize; // line sizes for color and weights
>  int overlap;// number of block overlapping pixels
>  int step;   // block step increment (BSIZE - overlap)
> -DCTContext *dct, *idct; // DCT and inverse DCT contexts
> -float *block, *tmp_block;   // two BSIZE x BSIZE block buffers
> +void (*filter_freq_func)(struct DCTdnoizContext *s,
> + const float *src, int src_linesize,
> + float *dst, int dst_linesize);
>  } DCTdnoizContext;
>
>  #define OFFSET(x) offsetof(DCTdnoizContext, x)
> @@ -69,66 +69,245 @@ static const AVOption dctdnoiz_options[] = {
>
>  AVFILTER_DEFINE_CLASS(dctdnoiz);
>
> -static float *dct_block(DCTdnoizContext *ctx, const float *src, int
src_linesize)
> +static void av_always_inline fdct16_1d(float *dst, const float *src,
> +   int dst_stridea, int dst_strideb,
> +   int src_stridea, int src_strideb)
>  {
> -int x, y;
> -float *column;
> -
> -for (y = 0; y < BSIZE; y++) {
> -float *line = ctx->block;
> +int i;
>
> -memcpy(line, src, BSIZE * sizeof(*line));
> -src += src_linesize;
> -av_dct_calc(ctx->dct, line);
> -
> -column = ctx->tmp_block + y;
> -column[0] = line[0] * (1. / sqrt(BSIZE));
> -column += BSIZE;
> -for (x = 1; x < BSIZE; x++) {
> -*column = line[x] * sqrt(2. / BSIZE);
> -column += BSIZE;
> -}
> +for (i = 0; i < BSIZE; i++) {
> +const float x0_0 = src[ 0*src_stridea] + src[15*src_stridea];
> +const float x0_1 = src[ 1*src_stridea] + src[14*src_stridea];
> +const float x0_2 = src[ 2*src_stridea] + src[13*src_stridea];
> +const float x0_3 = src[ 3*src_stridea] + src[12*src_stridea];
> +const float x0_4 = src[ 4*src_stridea] + src[11*src_stridea];
> +const float x0_5 = src[ 5*src_stridea] + src[10*src_stridea];
> +const float x0_6 = src[ 6*src_stridea] + src[ 9*src_stridea];
> +const float x0_7 = src[ 7*src_stridea] + src[ 8*src_stridea];
> +const float x0_8 = src[ 0*src_stridea] - src[15*src_stridea];
> +const float x0_9 = src[ 1*src_stridea] - src[14*src_stridea];
> +const float x0_a = src[ 2*src_stridea] - src[13*src_stridea];
> +const float x0_b = src[ 3*src_stridea] - src[12*src_stridea];
> +const float x0_c = src[ 4*src_stridea] - src[11*src_stridea];
> +const float x0_d = src[ 5*src_stridea] - src[10*src_stridea];
> +const float x0_e = src[ 6*src_stridea] - src[ 9*src_stridea];
> +const float x0_f = src[ 7*src_stridea] - src[ 8*src_stridea];
> +const float x2_0 = x0_0 + x0_7;
> +const float x2_1 = x0_1 + x0_6;
> +const float x2_2 = x0_2 + x0_5;
> +const float x2_3 = x0_3 + x0_4;
> +const float x2_4 = x0_0 - x0_7;
> +const float x2_5 = x0_1 - x0_6;
> +const float x2_6 = x0_2 - x0_5;
> +const float x2_7 = x0_3 - x0_4;
> +const float x4_0 = x2_0 + x2_3;
> +const float x4_1 = x2_1 + x2_2;
> +const float x4_2 = x2

Re: [FFmpeg-devel] [PATCH] lavfi/avf_showspectrum: check RDFT contet init.

2014-08-03 Thread Michael Niedermayer
On Sun, Aug 03, 2014 at 08:40:36PM +0200, Nicolas George wrote:
> Fix a segfault with large window size.
> 
> Signed-off-by: Nicolas George 
> ---
>  libavfilter/avf_showspectrum.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
> index 7bf3aab..764a000 100644
> --- a/libavfilter/avf_showspectrum.c
> +++ b/libavfilter/avf_showspectrum.c
> @@ -177,6 +177,11 @@ static int config_output(AVFilterLink *outlink)
>  
>  av_rdft_end(s->rdft);
>  s->rdft = av_rdft_init(rdft_bits, DFT_R2C);
> +if (!s->rdft) {
> +av_log(ctx, AV_LOG_ERROR, "Unable to allocate RDFT context. "
> +   "Maybe window too high.\n");
> +return AVERROR(EINVAL);
> +}

idependant of the exact error code
LGTM

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

The real ebay dictionary, page 1
"Used only once"- "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."


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


Re: [FFmpeg-devel] [PATCH] avcodec/avdct: Add get_pixels()

2014-08-03 Thread Michael Niedermayer
On Sat, Aug 02, 2014 at 09:05:56PM +0200, Michael Niedermayer wrote:
> TODO: version bump, update libavfilters to use it
> 
> Suggested-by: ubitux
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/avdct.c |9 +
>  libavcodec/avdct.h |4 
>  2 files changed, 13 insertions(+)

applied

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

The real ebay dictionary, page 1
"Used only once"- "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."


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


Re: [FFmpeg-devel] [PATCH] libavformat/icecast.c Add Icecast protocol

2014-08-03 Thread Marvin Scholz

+if (user)
+av_freep(&user);
+if (headers)
+av_freep(&headers);


pointless ifs


I'm pretty sure I need it, since there are possible cases where these 
are not allocated and I can't free them.

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


Re: [FFmpeg-devel] [PATCH] libavformat/icecast.c Add Icecast protocol

2014-08-03 Thread Michael Niedermayer
On Sun, Aug 03, 2014 at 11:53:21PM +0200, Marvin Scholz wrote:
> >>+if (user)
> >>+av_freep(&user);
> >>+if (headers)
> >>+av_freep(&headers);
> >
> >pointless ifs
> 
> I'm pretty sure I need it, since there are possible cases where
> these are not allocated and I can't free them.

av_freep() should be safe to be used with NULL

[...]
-- 
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] libavformat/icecast.c Add Icecast protocol

2014-08-03 Thread Marvin Scholz

av_freep() should be safe to be used with NULL


Since av_freep takes a pointer I am nearly sure that it doesn't, at 
least I remember that I had some issues without the if's… But please 
correct me if I'm wrong.

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


Re: [FFmpeg-devel] [PATCH] avfilter/dctdnoiz: rewrite [f/i]dct

2014-08-03 Thread Michael Niedermayer
On Sun, Aug 03, 2014 at 10:27:21PM +0200, Clément Bœsch wrote:
> This removes the avcodec dependency and make the code almost twice as
> fast. More to come.
> 
> The DCT factorization is based on "Fast and numerically stable
> algorithms for discrete cosine transforms" from Gerlind Plonkaa &
> Manfred Tasche (DOI: 10.1016/j.laa.2004.07.015).
> ---
>  configure |   2 -
>  libavfilter/vf_dctdnoiz.c | 328 
> +-
>  2 files changed, 240 insertions(+), 90 deletions(-)
> 
> diff --git a/configure b/configure
> index 9c3af50..6196b2a 100755
> --- a/configure
> +++ b/configure
> @@ -2526,8 +2526,6 @@ boxblur_filter_deps="gpl"
>  bs2b_filter_deps="libbs2b"
>  colormatrix_filter_deps="gpl"
>  cropdetect_filter_deps="gpl"
> -dctdnoiz_filter_deps="avcodec"
> -dctdnoiz_filter_select="dct"
>  delogo_filter_deps="gpl"
>  deshake_filter_deps="avcodec"
>  deshake_filter_select="me_cmp"
> diff --git a/libavfilter/vf_dctdnoiz.c b/libavfilter/vf_dctdnoiz.c
> index 71b8536..6d24934 100644
> --- a/libavfilter/vf_dctdnoiz.c
> +++ b/libavfilter/vf_dctdnoiz.c
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2013 Clément Bœsch
> + * Copyright (c) 2013-2014 Clément Bœsch
>   *
>   * This file is part of FFmpeg.
>   *
> @@ -23,7 +23,6 @@
>   * @see http://www.ipol.im/pub/art/2011/ys-dct/
>   */
>  
> -#include "libavcodec/avfft.h"
>  #include "libavutil/eval.h"
>  #include "libavutil/opt.h"
>  #include "drawutils.h"
> @@ -35,7 +34,7 @@
>  static const char *const var_names[] = { "c", NULL };
>  enum { VAR_C, VAR_VARS_NB };
>  
> -typedef struct {
> +typedef struct DCTdnoizContext {
>  const AVClass *class;
>  
>  /* coefficient factor expression */
> @@ -52,8 +51,9 @@ typedef struct {
>  int p_linesize; // line sizes for color and weights
>  int overlap;// number of block overlapping pixels
>  int step;   // block step increment (BSIZE - overlap)
> -DCTContext *dct, *idct; // DCT and inverse DCT contexts
> -float *block, *tmp_block;   // two BSIZE x BSIZE block buffers
> +void (*filter_freq_func)(struct DCTdnoizContext *s,
> + const float *src, int src_linesize,
> + float *dst, int dst_linesize);
>  } DCTdnoizContext;
>  
>  #define OFFSET(x) offsetof(DCTdnoizContext, x)
> @@ -69,66 +69,245 @@ static const AVOption dctdnoiz_options[] = {
>  
>  AVFILTER_DEFINE_CLASS(dctdnoiz);
>  
> -static float *dct_block(DCTdnoizContext *ctx, const float *src, int 
> src_linesize)
> +static void av_always_inline fdct16_1d(float *dst, const float *src,
> +   int dst_stridea, int dst_strideb,
> +   int src_stridea, int src_strideb)
>  {
> -int x, y;
> -float *column;
> -
> -for (y = 0; y < BSIZE; y++) {
> -float *line = ctx->block;
> +int i;
>  
> -memcpy(line, src, BSIZE * sizeof(*line));
> -src += src_linesize;
> -av_dct_calc(ctx->dct, line);
> -
> -column = ctx->tmp_block + y;
> -column[0] = line[0] * (1. / sqrt(BSIZE));
> -column += BSIZE;
> -for (x = 1; x < BSIZE; x++) {
> -*column = line[x] * sqrt(2. / BSIZE);
> -column += BSIZE;
> -}
> +for (i = 0; i < BSIZE; i++) {
> +const float x0_0 = src[ 0*src_stridea] + src[15*src_stridea];
> +const float x0_1 = src[ 1*src_stridea] + src[14*src_stridea];
> +const float x0_2 = src[ 2*src_stridea] + src[13*src_stridea];
> +const float x0_3 = src[ 3*src_stridea] + src[12*src_stridea];
> +const float x0_4 = src[ 4*src_stridea] + src[11*src_stridea];
> +const float x0_5 = src[ 5*src_stridea] + src[10*src_stridea];
> +const float x0_6 = src[ 6*src_stridea] + src[ 9*src_stridea];
> +const float x0_7 = src[ 7*src_stridea] + src[ 8*src_stridea];
> +const float x0_8 = src[ 0*src_stridea] - src[15*src_stridea];
> +const float x0_9 = src[ 1*src_stridea] - src[14*src_stridea];
> +const float x0_a = src[ 2*src_stridea] - src[13*src_stridea];
> +const float x0_b = src[ 3*src_stridea] - src[12*src_stridea];
> +const float x0_c = src[ 4*src_stridea] - src[11*src_stridea];
> +const float x0_d = src[ 5*src_stridea] - src[10*src_stridea];
> +const float x0_e = src[ 6*src_stridea] - src[ 9*src_stridea];
> +const float x0_f = src[ 7*src_stridea] - src[ 8*src_stridea];
> +const float x2_0 = x0_0 + x0_7;
> +const float x2_1 = x0_1 + x0_6;
> +const float x2_2 = x0_2 + x0_5;
> +const float x2_3 = x0_3 + x0_4;
> +const float x2_4 = x0_0 - x0_7;
> +const float x2_5 = x0_1 - x0_6;
> +const float x2_6 = x0_2 - x0_5;
> +const float x2_7 = x0_3 - x0_4;
> +const float x4_0 = x2_0 + x2_3;
> +const float x4_1 = x2_1 + x2_2;
> +const float x4_2 = x2_0 - x2

Re: [FFmpeg-devel] [PATCH] libavformat/icecast.c Add Icecast protocol

2014-08-03 Thread Michael Niedermayer
On Mon, Aug 04, 2014 at 12:24:27AM +0200, Marvin Scholz wrote:
> >av_freep() should be safe to be used with NULL
> 
> Since av_freep takes a pointer I am nearly sure that it doesn't, at
> least I remember that I had some issues without the if's… But please
> correct me if I'm wrong.

in the quoted code you pass the address of a pointer to av_freep()
the address of a pointer is never NULL.
The check checks if the pointer is NULL, which is passed to free()
POSIX, says about free() that
"If ptr is a null pointer, no action shall occur."

http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html

ill make sure this is explicitly mentioned for av_freep() and not
just av_free()

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

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle


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


Re: [FFmpeg-devel] [PATCH] avfilter/dctdnoiz: rewrite [f/i]dct

2014-08-03 Thread Michael Niedermayer
On Mon, Aug 04, 2014 at 12:44:48AM +0200, Michael Niedermayer wrote:
> On Sun, Aug 03, 2014 at 10:27:21PM +0200, Clément Bœsch wrote:
> > This removes the avcodec dependency and make the code almost twice as
> > fast. More to come.
> > 
> > The DCT factorization is based on "Fast and numerically stable
> > algorithms for discrete cosine transforms" from Gerlind Plonkaa &
> > Manfred Tasche (DOI: 10.1016/j.laa.2004.07.015).
> > ---
> >  configure |   2 -
> >  libavfilter/vf_dctdnoiz.c | 328 
> > +-
> >  2 files changed, 240 insertions(+), 90 deletions(-)
> > 
> > diff --git a/configure b/configure
> > index 9c3af50..6196b2a 100755
> > --- a/configure
> > +++ b/configure
> > @@ -2526,8 +2526,6 @@ boxblur_filter_deps="gpl"
> >  bs2b_filter_deps="libbs2b"
> >  colormatrix_filter_deps="gpl"
> >  cropdetect_filter_deps="gpl"
> > -dctdnoiz_filter_deps="avcodec"
> > -dctdnoiz_filter_select="dct"
> >  delogo_filter_deps="gpl"
> >  deshake_filter_deps="avcodec"
> >  deshake_filter_select="me_cmp"
> > diff --git a/libavfilter/vf_dctdnoiz.c b/libavfilter/vf_dctdnoiz.c
> > index 71b8536..6d24934 100644
> > --- a/libavfilter/vf_dctdnoiz.c
> > +++ b/libavfilter/vf_dctdnoiz.c
> > @@ -1,5 +1,5 @@
> >  /*
> > - * Copyright (c) 2013 Clément Bœsch
> > + * Copyright (c) 2013-2014 Clément Bœsch
> >   *
> >   * This file is part of FFmpeg.
> >   *
> > @@ -23,7 +23,6 @@
> >   * @see http://www.ipol.im/pub/art/2011/ys-dct/
> >   */
> >  
> > -#include "libavcodec/avfft.h"
> >  #include "libavutil/eval.h"
> >  #include "libavutil/opt.h"
> >  #include "drawutils.h"
> > @@ -35,7 +34,7 @@
> >  static const char *const var_names[] = { "c", NULL };
> >  enum { VAR_C, VAR_VARS_NB };
> >  
> > -typedef struct {
> > +typedef struct DCTdnoizContext {
> >  const AVClass *class;
> >  
> >  /* coefficient factor expression */
> > @@ -52,8 +51,9 @@ typedef struct {
> >  int p_linesize; // line sizes for color and weights
> >  int overlap;// number of block overlapping pixels
> >  int step;   // block step increment (BSIZE - overlap)
> > -DCTContext *dct, *idct; // DCT and inverse DCT contexts
> > -float *block, *tmp_block;   // two BSIZE x BSIZE block buffers
> > +void (*filter_freq_func)(struct DCTdnoizContext *s,
> > + const float *src, int src_linesize,
> > + float *dst, int dst_linesize);
> >  } DCTdnoizContext;
> >  
> >  #define OFFSET(x) offsetof(DCTdnoizContext, x)
> > @@ -69,66 +69,245 @@ static const AVOption dctdnoiz_options[] = {
> >  
> >  AVFILTER_DEFINE_CLASS(dctdnoiz);
> >  
> > -static float *dct_block(DCTdnoizContext *ctx, const float *src, int 
> > src_linesize)
> > +static void av_always_inline fdct16_1d(float *dst, const float *src,
> > +   int dst_stridea, int dst_strideb,
> > +   int src_stridea, int src_strideb)
> >  {
> > -int x, y;
> > -float *column;
> > -
> > -for (y = 0; y < BSIZE; y++) {
> > -float *line = ctx->block;
> > +int i;
> >  
> > -memcpy(line, src, BSIZE * sizeof(*line));
> > -src += src_linesize;
> > -av_dct_calc(ctx->dct, line);
> > -
> > -column = ctx->tmp_block + y;
> > -column[0] = line[0] * (1. / sqrt(BSIZE));
> > -column += BSIZE;
> > -for (x = 1; x < BSIZE; x++) {
> > -*column = line[x] * sqrt(2. / BSIZE);
> > -column += BSIZE;
> > -}
> > +for (i = 0; i < BSIZE; i++) {
> > +const float x0_0 = src[ 0*src_stridea] + src[15*src_stridea];
> > +const float x0_1 = src[ 1*src_stridea] + src[14*src_stridea];
> > +const float x0_2 = src[ 2*src_stridea] + src[13*src_stridea];
> > +const float x0_3 = src[ 3*src_stridea] + src[12*src_stridea];
> > +const float x0_4 = src[ 4*src_stridea] + src[11*src_stridea];
> > +const float x0_5 = src[ 5*src_stridea] + src[10*src_stridea];
> > +const float x0_6 = src[ 6*src_stridea] + src[ 9*src_stridea];
> > +const float x0_7 = src[ 7*src_stridea] + src[ 8*src_stridea];
> > +const float x0_8 = src[ 0*src_stridea] - src[15*src_stridea];
> > +const float x0_9 = src[ 1*src_stridea] - src[14*src_stridea];
> > +const float x0_a = src[ 2*src_stridea] - src[13*src_stridea];
> > +const float x0_b = src[ 3*src_stridea] - src[12*src_stridea];
> > +const float x0_c = src[ 4*src_stridea] - src[11*src_stridea];
> > +const float x0_d = src[ 5*src_stridea] - src[10*src_stridea];
> > +const float x0_e = src[ 6*src_stridea] - src[ 9*src_stridea];
> > +const float x0_f = src[ 7*src_stridea] - src[ 8*src_stridea];
> > +const float x2_0 = x0_0 + x0_7;
> > +const float x2_1 = x0_1 + x0_6;
> > +const float x2_2 = x0_2 + x0_5;
> > +const float x2_3 = x0_3 + x0_4

Re: [FFmpeg-devel] [PATCH 1/4] libavcodec: new API for frame threading by step

2014-08-03 Thread Michael Niedermayer
On Sun, Aug 03, 2014 at 06:39:38PM +0200, Christophe Gisquet wrote:
> Hi,
> 
> note: I'm using "step" throughout the patch because of the step
> function and what the causal part most often looks like. I have no
> idea for another less confusing wording.
> 
> 2014-07-28 23:15 GMT+02:00 Michael Niedermayer :
> > maybe i misunderstand but the "progress[1] > y" check looks odd,
> > shouldnt progress[0] be updated to a larger value even if
> > progress[1] > y
> > ?
> 
> Let's look at the following schema, that maybe should be added to the
> documentation:
>  ___ p[0]
> p[1] ___|
>p[2]
> 
> p(rogress)[0] and p[1] are the ordinates of the step. p[2] is the abscissa.

another way to vissualize the same thing is to consider

1)  0..p[2] 2) 0...w
.| .
p[1]_| p[0]_

that is two convex shapes, first a rectangle from (0,0) to (p[2], p[1])
and second the old "all above line"

and consider them finished&available to be all points that are in
either.

I had based my suggestions of what how to update based on this
vissualization

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.


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


Re: [FFmpeg-devel] [PATCH] fix tls/tcp protocol after a 302 move in https

2014-08-03 Thread Michael Niedermayer
On Sat, Aug 02, 2014 at 02:57:10AM +0200, Michael Niedermayer wrote:
> On Fri, Aug 01, 2014 at 08:37:27PM -0400, compn wrote:
> > patch from https://trac.ffmpeg.org/ticket/3824
> > 
> > -compn
> 
> > diff --git a/libavformat/http.c b/libavformat/http.c
> > index 33585b0..3dffaee 100644
> > --- a/libavformat/http.c
> > +++ b/libavformat/http.c
> > @@ -229,6 +229,7 @@ redo:
> >  memset(&s->auth_state, 0, sizeof(s->auth_state));
> >  attempts = 0;
> >  location_changed = 0;
> > +lower_proto  = "tcp";
> >  goto redo;
> >  }
> >  return 0;
> 
> probably ok, iam not maintainer of http.c though
> 
> who is the author of this change though (as you write "patch from")
> ?
> if its not you, please set the author of the commit correctly

author fixed & applied

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates


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


[FFmpeg-devel] [PATCH 2/3] x86/ttadsp: remove an unnecessary mova

2014-08-03 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/x86/ttadsp.asm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/x86/ttadsp.asm b/libavcodec/x86/ttadsp.asm
index 8346cab..8f48949 100644
--- a/libavcodec/x86/ttadsp.asm
+++ b/libavcodec/x86/ttadsp.asm
@@ -72,7 +72,7 @@ cglobal ttafilter_process_dec, 5,5,%2, qm, dx, dl, error, in, 
shift, round
 ; Using horizontal add (phaddd) seems to be slower than shuffling stuff 
around
 paddd  m2, m3   ; int sum = filter->round +
 ;   filter->dl[0] * filter->qm[0] +
-punpckhqdq m3, m2, m2   ;   filter->dl[1] * filter->qm[1] +
+pshufd m3, m2, 0xe  ;   filter->dl[1] * filter->qm[1] +
 paddd  m2, m3   ;   filter->dl[2] * filter->qm[2] +
 ;   filter->dl[3] * filter->qm[3] +
 movd   m6, roundm   ;   filter->dl[4] * filter->qm[4] +
-- 
1.8.5.5

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


[FFmpeg-devel] [PATCH 1/3] x86/hevc_mc: remove an unnecessary pxor

2014-08-03 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/x86/hevc_mc.asm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/x86/hevc_mc.asm b/libavcodec/x86/hevc_mc.asm
index fc78062..a16b0ab 100644
--- a/libavcodec/x86/hevc_mc.asm
+++ b/libavcodec/x86/hevc_mc.asm
@@ -551,8 +551,7 @@ cglobal hevc_put_hevc_pel_pixels%1_%2, 5, 5, 3, dst, 
dststride, src, srcstride,h
 LOOP_END dst, dststride, src, srcstride
 RET
 
-cglobal hevc_put_hevc_uni_pel_pixels%1_%2, 5, 5, 3, dst, dststride, src, 
srcstride,height
-pxor  m2, m2
+cglobal hevc_put_hevc_uni_pel_pixels%1_%2, 5, 5, 2, dst, dststride, src, 
srcstride,height
 .loop
 SIMPLE_LOAD   %1, %2, srcq, m0
 PEL_%2STORE%1   dstq, m0, m1
-- 
1.8.5.5

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


[FFmpeg-devel] [PATCH 3/3] x86/vp9lpf: use fewer instructions in SPLATB_MIX

2014-08-03 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/x86/vp9lpf.asm | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/x86/vp9lpf.asm b/libavcodec/x86/vp9lpf.asm
index c5db0ca..def7d5a 100644
--- a/libavcodec/x86/vp9lpf.asm
+++ b/libavcodec/x86/vp9lpf.asm
@@ -302,9 +302,8 @@ SECTION .text
 pshufb %1, %2
 %else
 punpcklbw  %1, %1
-punpcklqdq %1, %1
-pshuflw%1, %1, 0
-pshufhw%1, %1, 0x55
+punpcklwd  %1, %1
+punpckldq  %1, %1
 %endif
 %endmacro
 
-- 
1.8.5.5

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


Re: [FFmpeg-devel] [PATCHv3] Deprecate AFD field and add AFD as side-data

2014-08-03 Thread Michael Niedermayer
On Sun, Aug 03, 2014 at 10:49:39PM +0200, Michael Niedermayer wrote:
> On Sun, Aug 03, 2014 at 10:46:58PM +0200, Michael Niedermayer wrote:
> > On Sun, Aug 03, 2014 at 07:24:56PM +0100, Kieran Kunhya wrote:
> > > ---
> > >  doc/APIchanges|4 
> > >  libavcodec/avcodec.h  |5 -
> > >  libavcodec/mpeg12dec.c|   20 +++-
> > >  libavcodec/version.h  |5 -
> > >  libavfilter/vf_showinfo.c |3 +++
> > >  libavutil/frame.h |   16 
> > >  libavutil/version.h   |2 +-
> > >  7 files changed, 51 insertions(+), 4 deletions(-)
> > [...]
> > > @@ -1631,6 +1633,18 @@ static int mpeg_field_start(MpegEncContext *s, 
> > > const uint8_t *buf, int buf_size)
> > >  *stereo = s1->stereo3d;
> > >  s1->has_stereo3d = 0;
> > >  }
> > > +
> > > +if (s1->has_afd) {
> > > +AVFrameSideData *sd = av_frame_new_side_data(
> > > +s->current_picture_ptr->f, AV_FRAME_DATA_AFD,
> > > +1);
> > > +if (!sd)
> > > +return AVERROR(ENOMEM);
> > > +
> > 
> > > +sd->data = s1->afd;
> > 
> > this should be
> > *(uint8_t*)sd->data = s1->afd;
> 
> or simpler
> *sd->data = s1->afd;

applied with that fix

merged the reformatted one

thanks to all

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Observe your enemies, for they first find out your faults. -- Antisthenes


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


[FFmpeg-devel] [PATCH] x86/hevc_mc: use fewer instructions in hevc_put_hevc_{uni, bi}_w[24]_{8, 10, 12}

2014-08-03 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/x86/hevc_mc.asm | 35 ++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/libavcodec/x86/hevc_mc.asm b/libavcodec/x86/hevc_mc.asm
index fc78062..3ef0149 100644
--- a/libavcodec/x86/hevc_mc.asm
+++ b/libavcodec/x86/hevc_mc.asm
@@ -1158,9 +1158,16 @@ cglobal hevc_put_hevc_uni_w%1_%2, 6, 6, 7, dst, 
dststride, src, srcstride, heigh
 %define SHIFT  denomd
 %endif
 lea   SHIFT, [SHIFT+14-%2]  ; shift = 14 - bitd + denom
+%if %1 <= 4
+pxor m1, m1
+%endif
 movd m2, wxm; WX
 movd m4, SHIFT  ; shift
+%if %1 <= 4
+punpcklwdm2, m1
+%else
 punpcklwdm2, m2
+%endif
 dec   SHIFT
 movdqu   m5, [one_per_32]
 movd m6, SHIFT
@@ -1177,6 +1184,13 @@ cglobal hevc_put_hevc_uni_w%1_%2, 6, 6, 7, dst, 
dststride, src, srcstride, heigh
 %endif
 .loop
SIMPLE_LOAD%1, 10, srcq, m0
+%if %1 <= 4
+punpcklwd m0, m1
+pmaddwd   m0, m2
+paddd m0, m5
+psrad m0, m4
+paddd m0, m3
+%else
 pmulhwm6, m0, m2
 pmullwm0, m2
 punpckhwd m1, m0, m6
@@ -1187,6 +1201,7 @@ cglobal hevc_put_hevc_uni_w%1_%2, 6, 6, 7, dst, 
dststride, src, srcstride, heigh
 psrad m1, m4
 paddd m0, m3
 paddd m1, m3
+%endif
 packusdw  m0, m1
 %if %2 == 8
 packuswb  m0, m0
@@ -1202,13 +1217,21 @@ cglobal hevc_put_hevc_uni_w%1_%2, 6, 6, 7, dst, 
dststride, src, srcstride, heigh
 
 cglobal hevc_put_hevc_bi_w%1_%2, 6, 7, 10, dst, dststride, src, srcstride, 
src2, src2stride, height, denom, wx0, wx1, ox0, ox1
 mov  r6d, denomm
+%if %1 <= 4
+pxor  m1, m1
+%endif
 movd  m2, wx0m ; WX0
 lea  r6d, [r6d+14-%2]  ; shift = 14 - bitd + denom
 movd  m3, wx1m ; WX1
 movd  m0, r6d  ; shift
+%if %1 <= 4
+punpcklwd m2, m1
+punpcklwd m3, m1
+%else
 punpcklwd m2, m2
-inc  r6d
 punpcklwd m3, m3
+%endif
+inc  r6d
 movd  m5, r6d  ; shift+1
 pshufdm2, m2, 0
 mov  r6d, ox0m
@@ -1226,6 +1249,15 @@ cglobal hevc_put_hevc_bi_w%1_%2, 6, 7, 10, dst, 
dststride, src, srcstride, src2,
 .loop
SIMPLE_LOAD%1, 10, srcq,  m0
SIMPLE_LOAD%1, 10, src2q, m8
+%if %1 <= 4
+punpcklwd m0, m1
+punpcklwd m8, m1
+pmaddwd   m0, m3
+pmaddwd   m8, m2
+paddd m0, m4
+paddd m0, m8
+psrad m0, m5
+%else
 pmulhwm6, m0, m3
 pmullwm0, m3
 pmulhwm7, m8, m2
@@ -1240,6 +1272,7 @@ cglobal hevc_put_hevc_bi_w%1_%2, 6, 7, 10, dst, 
dststride, src, srcstride, src2,
 paddd m1, m4
 psrad m0, m5
 psrad m1, m5
+%endif
 packusdw  m0, m1
 %if %2 == 8
 packuswb  m0, m0
-- 
1.8.5.5

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