[FFmpeg-cvslog] lavfi/curves: remove pointless logging since the addition of plot option

2016-07-24 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Fri Jul 22 22:01:37 
2016 +0200| [51a873d44114cdd9446a38aa32a0b9223995ffd7] | committer: Clément 
Bœsch

lavfi/curves: remove pointless logging since the addition of plot option

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=51a873d44114cdd9446a38aa32a0b9223995ffd7
---

 libavfilter/vf_curves.c |5 -
 1 file changed, 5 deletions(-)

diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c
index 84df448..d58ba42 100644
--- a/libavfilter/vf_curves.c
+++ b/libavfilter/vf_curves.c
@@ -501,11 +501,6 @@ static av_cold int init(AVFilterContext *ctx)
 av_log(ctx, AV_LOG_VERBOSE, " (%f;%f)", point->x, point->y);
 point = point->next;
 }
-av_log(ctx, AV_LOG_VERBOSE, "\n");
-av_log(ctx, AV_LOG_VERBOSE, "#%d values:", i);
-for (j = 0; j < 256; j++)
-av_log(ctx, AV_LOG_VERBOSE, " %02X", curves->graph[i][j]);
-av_log(ctx, AV_LOG_VERBOSE, "\n");
 }
 }
 

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


[FFmpeg-cvslog] lavfi/curves: add plot option

2016-07-24 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Fri Jul 22 01:17:44 
2016 +0200| [4a8f5f1fd83dfa92e02901e543d79124c4e551dc] | committer: Clément 
Bœsch

lavfi/curves: add plot option

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4a8f5f1fd83dfa92e02901e543d79124c4e551dc
---

 doc/filters.texi|   10 
 libavfilter/vf_curves.c |   64 +++
 2 files changed, 74 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 03da9b0..5a64853 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -5750,6 +5750,8 @@ options. In this case, the unset component(s) will 
fallback on this
 @option{all} setting.
 @item psfile
 Specify a Photoshop curves file (@code{.acv}) to import the settings from.
+@item plot
+Save Gnuplot script of the curves in specified file.
 @end table
 
 To avoid some filtergraph syntax conflicts, each key points list need to be
@@ -5796,6 +5798,14 @@ Use a Photoshop preset and redefine the points of the 
green component:
 @example
 curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
 @end example
+
+@item
+Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
+and @command{gnuplot}:
+@example
+ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt 
-frames:v 1 -f null -
+gnuplot -p /tmp/curves.plt
+@end example
 @end itemize
 
 @section datascope
diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c
index 7128fbe..84df448 100644
--- a/libavfilter/vf_curves.c
+++ b/libavfilter/vf_curves.c
@@ -67,6 +67,7 @@ typedef struct {
 char *psfile;
 uint8_t rgba_map[4];
 int step;
+char *plot_filename;
 } CurvesContext;
 
 typedef struct ThreadData {
@@ -98,6 +99,7 @@ static const AVOption curves_options[] = {
 { "b", "set blue points coordinates",  OFFSET(comp_points_str[2]), 
AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
 { "all",   "set points coordinates for all components", 
OFFSET(comp_points_str_all), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
 { "psfile", "set Photoshop curves file name", OFFSET(psfile), 
AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
+{ "plot", "save Gnuplot script of the curves in specified file", 
OFFSET(plot_filename), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
 { NULL }
 };
 
@@ -377,6 +379,65 @@ end:
 return ret;
 }
 
+static int dump_curves(const char *fname, uint8_t graph[NB_COMP + 1][256],
+   struct keypoint *comp_points[NB_COMP + 1])
+{
+int i;
+AVBPrint buf;
+static const char * const colors[] = { "red", "green", "blue", "#404040", 
};
+FILE *f = av_fopen_utf8(fname, "w");
+
+av_assert0(FF_ARRAY_ELEMS(colors) == NB_COMP + 1);
+
+if (!f) {
+int ret = AVERROR(errno);
+av_log(NULL, AV_LOG_ERROR, "Cannot open file '%s' for writing: %s\n",
+   fname, av_err2str(ret));
+return ret;
+}
+
+av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
+
+av_bprintf(&buf, "set xtics 0.1\n");
+av_bprintf(&buf, "set ytics 0.1\n");
+av_bprintf(&buf, "set size square\n");
+av_bprintf(&buf, "set grid\n");
+
+for (i = 0; i < FF_ARRAY_ELEMS(colors); i++) {
+av_bprintf(&buf, "%s'-' using 1:2 with lines lc '%s' title ''",
+   i ? ", " : "plot ", colors[i]);
+if (comp_points[i])
+av_bprintf(&buf, ", '-' using 1:2 with points pointtype 3 lc '%s' 
title ''",
+colors[i]);
+}
+av_bprintf(&buf, "\n");
+
+for (i = 0; i < FF_ARRAY_ELEMS(colors); i++) {
+int x;
+
+/* plot generated values */
+for (x = 0; x < 256; x++)
+av_bprintf(&buf, "%f %f\n", x/255., graph[i][x]/255.);
+av_bprintf(&buf, "e\n");
+
+/* plot user knots */
+if (comp_points[i]) {
+const struct keypoint *point = comp_points[i];
+
+while (point) {
+av_bprintf(&buf, "%f %f\n", point->x, point->y);
+point = point->next;
+}
+av_bprintf(&buf, "e\n");
+}
+}
+
+fwrite(buf.str, 1, buf.len, f);
+fclose(f);
+av_bprint_finalize(&buf, NULL);
+return 0;
+}
+
 static av_cold int init(AVFilterContext *ctx)
 {
 int i, j, ret;
@@ -448,6 +509,9 @@ static av_cold int init(AVFilterContext *ctx)
 }
 }
 
+if (curves->plot_filename)
+dump_curves(curves->plot_filename, curves->graph, comp_points);
+
 for (i = 0; i < NB_COMP + 1; i++) {
 struct keypoint *point = comp_points[i];
 while (point) {

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


[FFmpeg-cvslog] lavfi/curves: reindent after previous commit

2016-07-24 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Sun Jul 24 12:11:30 
2016 +0200| [39c6d4a8c592028a0f4f1a2af0cffe9c977d2ea1] | committer: Clément 
Bœsch

lavfi/curves: reindent after previous commit

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=39c6d4a8c592028a0f4f1a2af0cffe9c977d2ea1
---

 libavfilter/vf_curves.c |   26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c
index 153ca45..7220935 100644
--- a/libavfilter/vf_curves.c
+++ b/libavfilter/vf_curves.c
@@ -609,20 +609,20 @@ static int filter_slice(AVFilterContext *ctx, void *arg, 
int jobnr, int nb_jobs)
 }
 }
 } else {
-uint8_t   *dst = out->data[0] + slice_start * out->linesize[0];
-const uint8_t *src =  in->data[0] + slice_start *  in->linesize[0];
-
-for (y = slice_start; y < slice_end; y++) {
-for (x = 0; x < in->width * step; x += step) {
-dst[x + r] = curves->graph[R][src[x + r]];
-dst[x + g] = curves->graph[G][src[x + g]];
-dst[x + b] = curves->graph[B][src[x + b]];
-if (!direct && step == 4)
-dst[x + a] = src[x + a];
+uint8_t   *dst = out->data[0] + slice_start * out->linesize[0];
+const uint8_t *src =  in->data[0] + slice_start *  in->linesize[0];
+
+for (y = slice_start; y < slice_end; y++) {
+for (x = 0; x < in->width * step; x += step) {
+dst[x + r] = curves->graph[R][src[x + r]];
+dst[x + g] = curves->graph[G][src[x + g]];
+dst[x + b] = curves->graph[B][src[x + b]];
+if (!direct && step == 4)
+dst[x + a] = src[x + a];
+}
+dst += out->linesize[0];
+src += in ->linesize[0];
 }
-dst += out->linesize[0];
-src += in ->linesize[0];
-}
 }
 return 0;
 }

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


[FFmpeg-cvslog] lavfi/curves: dynamically allocate LUTs

2016-07-24 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Fri Jul 22 22:20:53 
2016 +0200| [050f790594ee21cc1b9e36ffbbe23dde9617451f] | committer: Clément 
Bœsch

lavfi/curves: dynamically allocate LUTs

This simplifies following commits.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=050f790594ee21cc1b9e36ffbbe23dde9617451f
---

 libavfilter/vf_curves.c |   17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c
index 5b56968..85bffb1 100644
--- a/libavfilter/vf_curves.c
+++ b/libavfilter/vf_curves.c
@@ -63,7 +63,7 @@ typedef struct {
 int preset;
 char *comp_points_str[NB_COMP + 1];
 char *comp_points_str_all;
-uint8_t graph[NB_COMP + 1][256];
+uint8_t *graph[NB_COMP + 1];
 char *psfile;
 uint8_t rgba_map[4];
 int step;
@@ -379,7 +379,7 @@ end:
 return ret;
 }
 
-static int dump_curves(const char *fname, uint8_t graph[NB_COMP + 1][256],
+static int dump_curves(const char *fname, uint8_t *graph[NB_COMP + 1],
struct keypoint *comp_points[NB_COMP + 1])
 {
 int i;
@@ -479,6 +479,9 @@ static av_cold int init(AVFilterContext *ctx)
 }
 
 for (i = 0; i < NB_COMP + 1; i++) {
+curves->graph[i] = av_mallocz(256);
+if (!curves->graph[i])
+return AVERROR(ENOMEM);
 ret = parse_points_str(ctx, comp_points + i, 
curves->comp_points_str[i]);
 if (ret < 0)
 return ret;
@@ -606,6 +609,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 return ff_filter_frame(outlink, out);
 }
 
+static av_cold void uninit(AVFilterContext *ctx)
+{
+int i;
+CurvesContext *curves = ctx->priv;
+
+for (i = 0; i < NB_COMP + 1; i++)
+av_freep(&curves->graph[i]);
+}
+
 static const AVFilterPad curves_inputs[] = {
 {
 .name = "default",
@@ -629,6 +641,7 @@ AVFilter ff_vf_curves = {
 .description   = NULL_IF_CONFIG_SMALL("Adjust components curves."),
 .priv_size = sizeof(CurvesContext),
 .init  = init,
+.uninit= uninit,
 .query_formats = query_formats,
 .inputs= curves_inputs,
 .outputs   = curves_outputs,

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


[FFmpeg-cvslog] lavfi/curves: do not automatically insert points at x=0 and x=1

2016-07-24 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Sat Jul 16 13:46:32 
2016 +0200| [5c14018fc4f6ae9fcce7eaf8dd2d66cb6fbfc7bc] | committer: Clément 
Bœsch

lavfi/curves: do not automatically insert points at x=0 and x=1

There is actually a need for the origin and end point not to be defined.
We can not automatically insert them with the y value of the first and
last point as it will influence the curves in a wrong way.

Fixes #5397

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5c14018fc4f6ae9fcce7eaf8dd2d66cb6fbfc7bc
---

 Changelog   |1 +
 doc/filters.texi|   10 ++
 libavfilter/vf_curves.c |   90 +--
 3 files changed, 52 insertions(+), 49 deletions(-)

diff --git a/Changelog b/Changelog
index 2bd18ec..6affe97 100644
--- a/Changelog
+++ b/Changelog
@@ -7,6 +7,7 @@ version :
 - Changed metadata print option to accept general urls
 - Alias muxer for Ogg Video (.ogv)
 - VP8 in Ogg muxing
+- curves filter doesn't automatically insert points at x=0 and x=1 anymore
 
 
 version 3.1:
diff --git a/doc/filters.texi b/doc/filters.texi
index 24abdda..03da9b0 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -5710,10 +5710,6 @@ strictly increasing over the x-axis, and their @var{x} 
and @var{y} values must
 be in the @var{[0;1]} interval.  If the computed curves happened to go outside
 the vector spaces, the values will be clipped accordingly.
 
-If there is no key point defined in @code{x=0}, the filter will automatically
-insert a @var{(0;0)} point. In the same way, if there is no key point defined
-in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
-
 The filter accepts the following options:
 
 @table @option
@@ -5765,13 +5761,13 @@ defined using the following syntax: @code{x0/y0 x1/y1 
x2/y2 ...}.
 @item
 Increase slightly the middle level of blue:
 @example
-curves=blue='0.5/0.58'
+curves=blue='0/0 0.5/0.58 1/1'
 @end example
 
 @item
 Vintage effect:
 @example
-curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
+curves=r='0/0.11 .42/.51 1/0.95':g='0/0 0.50/0.48 1/1':b='0/0.22 .49/.44 1/0.8'
 @end example
 Here we obtain the following coordinates for each components:
 @table @var
@@ -5798,7 +5794,7 @@ curves=vintage
 @item
 Use a Photoshop preset and redefine the points of the green component:
 @example
-curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
+curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
 @end example
 @end itemize
 
diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c
index 1c51c1b..7128fbe 100644
--- a/libavfilter/vf_curves.c
+++ b/libavfilter/vf_curves.c
@@ -110,25 +110,25 @@ static const struct {
 const char *master;
 } curves_presets[] = {
 [PRESET_COLOR_NEGATIVE] = {
-"0/1 0.129/1 0.466/0.498 0.725/0 1/0",
-"0/1 0.109/1 0.301/0.498 0.517/0 1/0",
-"0/1 0.098/1 0.235/0.498 0.423/0 1/0",
+"0.129/1 0.466/0.498 0.725/0",
+"0.109/1 0.301/0.498 0.517/0",
+"0.098/1 0.235/0.498 0.423/0",
 },
 [PRESET_CROSS_PROCESS] = {
-"0.25/0.156 0.501/0.501 0.686/0.745",
-"0.25/0.188 0.38/0.501 0.745/0.815 1/0.815",
-"0.231/0.094 0.709/0.874",
+"0/0 0.25/0.156 0.501/0.501 0.686/0.745 1/1",
+"0/0 0.25/0.188 0.38/0.501 0.745/0.815 1/0.815",
+"0/0 0.231/0.094 0.709/0.874 1/1",
 },
-[PRESET_DARKER] = { .master = "0.5/0.4" },
-[PRESET_INCREASE_CONTRAST]  = { .master = "0.149/0.066 0.831/0.905 
0.905/0.98" },
-[PRESET_LIGHTER]= { .master = "0.4/0.5" },
-[PRESET_LINEAR_CONTRAST]= { .master = "0.305/0.286 0.694/0.713" },
-[PRESET_MEDIUM_CONTRAST]= { .master = "0.286/0.219 0.639/0.643" },
+[PRESET_DARKER] = { .master = "0/0 0.5/0.4 1/1" },
+[PRESET_INCREASE_CONTRAST]  = { .master = "0/0 0.149/0.066 0.831/0.905 
0.905/0.98 1/1" },
+[PRESET_LIGHTER]= { .master = "0/0 0.4/0.5 1/1" },
+[PRESET_LINEAR_CONTRAST]= { .master = "0/0 0.305/0.286 0.694/0.713 
1/1" },
+[PRESET_MEDIUM_CONTRAST]= { .master = "0/0 0.286/0.219 0.639/0.643 
1/1" },
 [PRESET_NEGATIVE]   = { .master = "0/1 1/0" },
-[PRESET_STRONG_CONTRAST]= { .master = "0.301/0.196 0.592/0.6 
0.686/0.737" },
+[PRESET_STRONG_CONTRAST]= { .master = "0/0 0.301/0.196 0.592/0.6 
0.686/0.737 1/1" },
 [PRESET_VINTAGE] = {
 "0/0.11 0.42/0.51 1/0.95",
-"0.50/0.48",
+"0/0 0.50/0.48 1/1",
 "0/0.22 0.49/0.44 1/0.8",
 }
 };
@@ -177,28 +177,11 @@ static int parse_points_str(AVFilterContext *ctx, struct 
keypoint **points, cons
 last = point;
 }
 
-/* auto insert first key point if missing at x=0 */
-if (!*points) {
-last = make_point(0, 0, NULL);
-if (!last)
-return AVERROR(ENOMEM);
-last->x = last->y = 0;
-*points = last;
-} else if ((*points)->x != 0.) {
-struct 

[FFmpeg-cvslog] lavfi/curves: move alloc and init of LUTs inside config_input()

2016-07-24 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Sun Jul 24 11:13:29 
2016 +0200| [f19f5b906d706d4c4d55e5588668956ea288f433] | committer: Clément 
Bœsch

lavfi/curves: move alloc and init of LUTs inside config_input()

This is needed in order to have different sizes of LUTs according to the
input.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f19f5b906d706d4c4d55e5588668956ea288f433
---

 libavfilter/vf_curves.c |   61 +--
 1 file changed, 32 insertions(+), 29 deletions(-)

diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c
index 85bffb1..9ab6f73 100644
--- a/libavfilter/vf_curves.c
+++ b/libavfilter/vf_curves.c
@@ -440,9 +440,8 @@ static int dump_curves(const char *fname, uint8_t 
*graph[NB_COMP + 1],
 
 static av_cold int init(AVFilterContext *ctx)
 {
-int i, j, ret;
+int i, ret;
 CurvesContext *curves = ctx->priv;
-struct keypoint *comp_points[NB_COMP + 1] = {0};
 char **pts = curves->comp_points_str;
 const char *allp = curves->comp_points_str_all;
 
@@ -478,6 +477,37 @@ static av_cold int init(AVFilterContext *ctx)
 SET_COMP_IF_NOT_SET(3, master);
 }
 
+return 0;
+}
+
+static int query_formats(AVFilterContext *ctx)
+{
+static const enum AVPixelFormat pix_fmts[] = {
+AV_PIX_FMT_RGB24,  AV_PIX_FMT_BGR24,
+AV_PIX_FMT_RGBA,   AV_PIX_FMT_BGRA,
+AV_PIX_FMT_ARGB,   AV_PIX_FMT_ABGR,
+AV_PIX_FMT_0RGB,   AV_PIX_FMT_0BGR,
+AV_PIX_FMT_RGB0,   AV_PIX_FMT_BGR0,
+AV_PIX_FMT_NONE
+};
+AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
+if (!fmts_list)
+return AVERROR(ENOMEM);
+return ff_set_common_formats(ctx, fmts_list);
+}
+
+static int config_input(AVFilterLink *inlink)
+{
+int i, j, ret;
+AVFilterContext *ctx = inlink->dst;
+CurvesContext *curves = ctx->priv;
+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
+char **pts = curves->comp_points_str;
+struct keypoint *comp_points[NB_COMP + 1] = {0};
+
+ff_fill_rgba_map(curves->rgba_map, inlink->format);
+curves->step = av_get_padded_bits_per_pixel(desc) >> 3;
+
 for (i = 0; i < NB_COMP + 1; i++) {
 curves->graph[i] = av_mallocz(256);
 if (!curves->graph[i])
@@ -522,33 +552,6 @@ static av_cold int init(AVFilterContext *ctx)
 return 0;
 }
 
-static int query_formats(AVFilterContext *ctx)
-{
-static const enum AVPixelFormat pix_fmts[] = {
-AV_PIX_FMT_RGB24,  AV_PIX_FMT_BGR24,
-AV_PIX_FMT_RGBA,   AV_PIX_FMT_BGRA,
-AV_PIX_FMT_ARGB,   AV_PIX_FMT_ABGR,
-AV_PIX_FMT_0RGB,   AV_PIX_FMT_0BGR,
-AV_PIX_FMT_RGB0,   AV_PIX_FMT_BGR0,
-AV_PIX_FMT_NONE
-};
-AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
-if (!fmts_list)
-return AVERROR(ENOMEM);
-return ff_set_common_formats(ctx, fmts_list);
-}
-
-static int config_input(AVFilterLink *inlink)
-{
-CurvesContext *curves = inlink->dst->priv;
-const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
-
-ff_fill_rgba_map(curves->rgba_map, inlink->format);
-curves->step = av_get_padded_bits_per_pixel(desc) >> 3;
-
-return 0;
-}
-
 static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int 
nb_jobs)
 {
 int x, y;

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


[FFmpeg-cvslog] lavfi/curves: pass log ctx as void* instead of AVFilterContext*

2016-07-24 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Sun Jul 24 12:13:46 
2016 +0200| [62a31aecf607da82f5bd7ad6e578e0d708d55f0e] | committer: Clément 
Bœsch

lavfi/curves: pass log ctx as void* instead of AVFilterContext*

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=62a31aecf607da82f5bd7ad6e578e0d708d55f0e
---

 libavfilter/vf_curves.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c
index 7220935..e39bb49 100644
--- a/libavfilter/vf_curves.c
+++ b/libavfilter/vf_curves.c
@@ -211,7 +211,7 @@ static int get_nb_points(const struct keypoint *d)
 
 #define CLIP(v) (nbits == 8 ? av_clip_uint8(v) : av_clip_uint16(v))
 
-static inline int interpolate(AVFilterContext *ctx, uint16_t *y,
+static inline int interpolate(void *log_ctx, uint16_t *y,
   const struct keypoint *points, int nbits)
 {
 int i, ret = 0;
@@ -315,7 +315,7 @@ static inline int interpolate(AVFilterContext *ctx, 
uint16_t *y,
 const double xx = (x - x_start) * 1./scale;
 const double yy = a + b*xx + c*xx*xx + d*xx*xx*xx;
 y[x] = CLIP(yy * scale);
-av_log(ctx, AV_LOG_DEBUG, "f(%f)=%f -> y[%d]=%d\n", xx, yy, x, 
y[x]);
+av_log(log_ctx, AV_LOG_DEBUG, "f(%f)=%f -> y[%d]=%d\n", xx, yy, x, 
y[x]);
 }
 
 point = point->next;
@@ -334,10 +334,10 @@ end:
 }
 
 #define DECLARE_INTERPOLATE_FUNC(nbits) \
-static const int interpolate##nbits(AVFilterContext *ctx, uint16_t *y,  \
+static const int interpolate##nbits(void *log_ctx, uint16_t *y, \
 const struct keypoint *points)  \
 {   \
-return interpolate(ctx, y, points, nbits);  \
+return interpolate(log_ctx, y, points, nbits);  \
 }
 
 DECLARE_INTERPOLATE_FUNC(8)

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


[FFmpeg-cvslog] lavfi/curves: add various const where it makes sense

2016-07-24 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Fri Jul 22 22:00:37 
2016 +0200| [4eee06ae873095ad7413830753c9bd7d793d31ba] | committer: Clément 
Bœsch

lavfi/curves: add various const where it makes sense

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4eee06ae873095ad7413830753c9bd7d793d31ba
---

 libavfilter/vf_curves.c |   34 +-
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c
index d58ba42..5b56968 100644
--- a/libavfilter/vf_curves.c
+++ b/libavfilter/vf_curves.c
@@ -212,7 +212,7 @@ static int interpolate(AVFilterContext *ctx, uint8_t *y, 
const struct keypoint *
 
 double (*matrix)[3];
 double *h, *r;
-int n = get_nb_points(points); // number of splines
+const int n = get_nb_points(points); // number of splines
 
 if (n == 0) {
 for (i = 0; i < 256; i++)
@@ -247,9 +247,9 @@ static int interpolate(AVFilterContext *ctx, uint8_t *y, 
const struct keypoint *
 /* right-side of the polynomials, will be modified to contains the 
solution */
 point = points;
 for (i = 1; i < n - 1; i++) {
-double yp = point->y,
-   yc = point->next->y,
-   yn = point->next->next->y;
+const double yp = point->y;
+const double yc = point->next->y;
+const double yn = point->next->next->y;
 r[i] = 6 * ((yn-yc)/h[i] - (yc-yp)/h[i-1]);
 point = point->next;
 }
@@ -268,8 +268,8 @@ static int interpolate(AVFilterContext *ctx, uint8_t *y, 
const struct keypoint *
 
 /* tridiagonal solving of the linear system */
 for (i = 1; i < n; i++) {
-double den = matrix[i][MD] - matrix[i][BD] * matrix[i-1][AD];
-double k = den ? 1./den : 1.;
+const double den = matrix[i][MD] - matrix[i][BD] * matrix[i-1][AD];
+const double k = den ? 1./den : 1.;
 matrix[i][AD] *= k;
 r[i] = (r[i] - matrix[i][BD] * r[i - 1]) * k;
 }
@@ -286,24 +286,24 @@ static int interpolate(AVFilterContext *ctx, uint8_t *y, 
const struct keypoint *
 i = 0;
 av_assert0(point->next); // always at least 2 key points
 while (point->next) {
-double yc = point->y;
-double yn = point->next->y;
+const double yc = point->y;
+const double yn = point->next->y;
 
-double a = yc;
-double b = (yn-yc)/h[i] - h[i]*r[i]/2. - h[i]*(r[i+1]-r[i])/6.;
-double c = r[i] / 2.;
-double d = (r[i+1] - r[i]) / (6.*h[i]);
+const double a = yc;
+const double b = (yn-yc)/h[i] - h[i]*r[i]/2. - h[i]*(r[i+1]-r[i])/6.;
+const double c = r[i] / 2.;
+const double d = (r[i+1] - r[i]) / (6.*h[i]);
 
 int x;
-int x_start = point->x   * 255;
-int x_end   = point->next->x * 255;
+const int x_start = point->x   * 255;
+const int x_end   = point->next->x * 255;
 
 av_assert0(x_start >= 0 && x_start <= 255 &&
x_end   >= 0 && x_end   <= 255);
 
 for (x = x_start; x <= x_end; x++) {
-double xx = (x - x_start) * 1/255.;
-double yy = a + b*xx + c*xx*xx + d*xx*xx*xx;
+const double xx = (x - x_start) * 1/255.;
+const double yy = a + b*xx + c*xx*xx + d*xx*xx*xx;
 y[x] = av_clip_uint8(yy * 255);
 av_log(ctx, AV_LOG_DEBUG, "f(%f)=%f -> y[%d]=%d\n", xx, yy, x, 
y[x]);
 }
@@ -495,7 +495,7 @@ static av_cold int init(AVFilterContext *ctx)
 
 if (av_log_get_level() >= AV_LOG_VERBOSE) {
 for (i = 0; i < NB_COMP; i++) {
-struct keypoint *point = comp_points[i];
+const struct keypoint *point = comp_points[i];
 av_log(ctx, AV_LOG_VERBOSE, "#%d points:", i);
 while (point) {
 av_log(ctx, AV_LOG_VERBOSE, " (%f;%f)", point->x, point->y);

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


[FFmpeg-cvslog] lavfi/curves: prefix init and uninit function names

2016-07-24 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Sun Jul 24 12:17:01 
2016 +0200| [b470d81f4e8e65ad1c44b8fb9b1748a94c6f209f] | committer: Clément 
Bœsch

lavfi/curves: prefix init and uninit function names

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b470d81f4e8e65ad1c44b8fb9b1748a94c6f209f
---

 libavfilter/vf_curves.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c
index e39bb49..64e4fa4 100644
--- a/libavfilter/vf_curves.c
+++ b/libavfilter/vf_curves.c
@@ -460,7 +460,7 @@ static int dump_curves(const char *fname, uint16_t 
*graph[NB_COMP + 1],
 return 0;
 }
 
-static av_cold int init(AVFilterContext *ctx)
+static av_cold int curves_init(AVFilterContext *ctx)
 {
 int i, ret;
 CurvesContext *curves = ctx->priv;
@@ -655,7 +655,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 return ff_filter_frame(outlink, out);
 }
 
-static av_cold void uninit(AVFilterContext *ctx)
+static av_cold void curves_uninit(AVFilterContext *ctx)
 {
 int i;
 CurvesContext *curves = ctx->priv;
@@ -686,8 +686,8 @@ AVFilter ff_vf_curves = {
 .name  = "curves",
 .description   = NULL_IF_CONFIG_SMALL("Adjust components curves."),
 .priv_size = sizeof(CurvesContext),
-.init  = init,
-.uninit= uninit,
+.init  = curves_init,
+.uninit= curves_uninit,
 .query_formats = query_formats,
 .inputs= curves_inputs,
 .outputs   = curves_outputs,

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


[FFmpeg-cvslog] lavfi/curves: add 16-bit support

2016-07-24 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Sat Jul 23 11:56:56 
2016 +0200| [e30cdac14b55ef290e26e055a88055ba9cde2f46] | committer: Clément 
Bœsch

lavfi/curves: add 16-bit support

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e30cdac14b55ef290e26e055a88055ba9cde2f46
---

 Changelog   |1 +
 libavfilter/vf_curves.c |   97 ++-
 2 files changed, 71 insertions(+), 27 deletions(-)

diff --git a/Changelog b/Changelog
index 6affe97..a5d25f2 100644
--- a/Changelog
+++ b/Changelog
@@ -8,6 +8,7 @@ version :
 - Alias muxer for Ogg Video (.ogv)
 - VP8 in Ogg muxing
 - curves filter doesn't automatically insert points at x=0 and x=1 anymore
+- 16-bit support in curves filter
 
 
 version 3.1:
diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c
index 9ab6f73..153ca45 100644
--- a/libavfilter/vf_curves.c
+++ b/libavfilter/vf_curves.c
@@ -63,11 +63,13 @@ typedef struct {
 int preset;
 char *comp_points_str[NB_COMP + 1];
 char *comp_points_str_all;
-uint8_t *graph[NB_COMP + 1];
+uint16_t *graph[NB_COMP + 1];
+int lut_size;
 char *psfile;
 uint8_t rgba_map[4];
 int step;
 char *plot_filename;
+int is_16bit;
 } CurvesContext;
 
 typedef struct ThreadData {
@@ -147,10 +149,12 @@ static struct keypoint *make_point(double x, double y, 
struct keypoint *next)
 return point;
 }
 
-static int parse_points_str(AVFilterContext *ctx, struct keypoint **points, 
const char *s)
+static int parse_points_str(AVFilterContext *ctx, struct keypoint **points, 
const char *s,
+int lut_size)
 {
 char *p = (char *)s; // strtod won't alter the string
 struct keypoint *last = NULL;
+const int scale = lut_size - 1;
 
 /* construct a linked list based on the key points string */
 while (p && *p) {
@@ -167,7 +171,7 @@ static int parse_points_str(AVFilterContext *ctx, struct 
keypoint **points, cons
 if (!*points)
 *points = point;
 if (last) {
-if ((int)(last->x * 255) >= (int)(point->x * 255)) {
+if ((int)(last->x * scale) >= (int)(point->x * scale)) {
 av_log(ctx, AV_LOG_ERROR, "Key point coordinates (%f;%f) "
"and (%f;%f) are too close from each other or not "
"strictly increasing on the x-axis\n",
@@ -204,25 +208,31 @@ static int get_nb_points(const struct keypoint *d)
  * Finding curves using Cubic Splines notes by Steven Rauch and John Stockie.
  * @see http://people.math.sfu.ca/~stockie/teaching/macm316/notes/splines.pdf
  */
-static int interpolate(AVFilterContext *ctx, uint8_t *y, const struct keypoint 
*points)
+
+#define CLIP(v) (nbits == 8 ? av_clip_uint8(v) : av_clip_uint16(v))
+
+static inline int interpolate(AVFilterContext *ctx, uint16_t *y,
+  const struct keypoint *points, int nbits)
 {
 int i, ret = 0;
 const struct keypoint *point = points;
 double xprev = 0;
+const int lut_size = 1y * scale);
 return 0;
 }
 
@@ -279,8 +289,8 @@ static int interpolate(AVFilterContext *ctx, uint8_t *y, 
const struct keypoint *
 point = points;
 
 /* left padding */
-for (i = 0; i < (int)(point->x * 255); i++)
-y[i] = av_clip_uint8(point->y * 255);
+for (i = 0; i < (int)(point->x * scale); i++)
+y[i] = CLIP(point->y * scale);
 
 /* compute the graph with x=[x0..xN] */
 i = 0;
@@ -295,16 +305,16 @@ static int interpolate(AVFilterContext *ctx, uint8_t *y, 
const struct keypoint *
 const double d = (r[i+1] - r[i]) / (6.*h[i]);
 
 int x;
-const int x_start = point->x   * 255;
-const int x_end   = point->next->x * 255;
+const int x_start = point->x   * scale;
+const int x_end   = point->next->x * scale;
 
-av_assert0(x_start >= 0 && x_start <= 255 &&
-   x_end   >= 0 && x_end   <= 255);
+av_assert0(x_start >= 0 && x_start < lut_size &&
+   x_end   >= 0 && x_end   < lut_size);
 
 for (x = x_start; x <= x_end; x++) {
-const double xx = (x - x_start) * 1/255.;
+const double xx = (x - x_start) * 1./scale;
 const double yy = a + b*xx + c*xx*xx + d*xx*xx*xx;
-y[x] = av_clip_uint8(yy * 255);
+y[x] = CLIP(yy * scale);
 av_log(ctx, AV_LOG_DEBUG, "f(%f)=%f -> y[%d]=%d\n", xx, yy, x, 
y[x]);
 }
 
@@ -313,8 +323,8 @@ static int interpolate(AVFilterContext *ctx, uint8_t *y, 
const struct keypoint *
 }
 
 /* right padding */
-for (i = (int)(point->x * 255); i <= 255; i++)
-y[i] = av_clip_uint8(point->y * 255);
+for (i = (int)(point->x * scale); i < lut_size; i++)
+y[i] = CLIP(point->y * scale);
 
 end:
 av_free(matrix);
@@ -323,6 +333,16 @@ end:
 return ret;
 }
 
+#define 

[FFmpeg-cvslog] lavfi: bump minor after recent curves filter additions

2016-07-24 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Sun Jul 24 12:22:41 
2016 +0200| [6e971f7d66f95f6683a0f52a9df2afdc1ea4bf2b] | committer: Clément 
Bœsch

lavfi: bump minor after recent curves filter additions

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6e971f7d66f95f6683a0f52a9df2afdc1ea4bf2b
---

 libavfilter/version.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/version.h b/libavfilter/version.h
index 6d56dad..89d6fbc 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -30,7 +30,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVFILTER_VERSION_MAJOR   6
-#define LIBAVFILTER_VERSION_MINOR  47
+#define LIBAVFILTER_VERSION_MINOR  48
 #define LIBAVFILTER_VERSION_MICRO 100
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \

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


[FFmpeg-cvslog] tests/fate: add dnxhr encoding tests

2016-07-24 Thread Mark Reid
ffmpeg | branch: master | Mark Reid  | Sat Jul 23 18:10:33 
2016 -0700| [6108cb2ce3ee6c051629ff59495edd2a1a58830e] | committer: Michael 
Niedermayer

tests/fate: add dnxhr encoding tests

added sws_flags flags and tested against x86_32

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6108cb2ce3ee6c051629ff59495edd2a1a58830e
---

 tests/fate/seek.mak   |2 ++
 tests/fate/vcodec.mak |   26 +++-
 tests/ref/seek/vsynth_lena-dnxhd-4k-hr-lb |   40 +
 tests/ref/vsynth/vsynth1-dnxhd-2k-hr-hq   |4 +++
 tests/ref/vsynth/vsynth1-dnxhd-4k-hr-lb   |4 +++
 tests/ref/vsynth/vsynth1-dnxhd-720p-hr-lb |4 +++
 tests/ref/vsynth/vsynth1-dnxhd-uhd-hr-sq  |4 +++
 tests/ref/vsynth/vsynth2-dnxhd-2k-hr-hq   |4 +++
 tests/ref/vsynth/vsynth2-dnxhd-4k-hr-lb   |4 +++
 tests/ref/vsynth/vsynth2-dnxhd-720p-hr-lb |4 +++
 tests/ref/vsynth/vsynth2-dnxhd-uhd-hr-sq  |4 +++
 tests/ref/vsynth/vsynth3-dnxhd-2k-hr-hq   |4 +++
 tests/ref/vsynth/vsynth3-dnxhd-4k-hr-lb   |4 +++
 tests/ref/vsynth/vsynth3-dnxhd-720p-hr-lb |4 +++
 tests/ref/vsynth/vsynth3-dnxhd-uhd-hr-sq  |4 +++
 tests/ref/vsynth/vsynth_lena-dnxhd-2k-hr-hq   |4 +++
 tests/ref/vsynth/vsynth_lena-dnxhd-4k-hr-lb   |4 +++
 tests/ref/vsynth/vsynth_lena-dnxhd-720p-hr-lb |4 +++
 tests/ref/vsynth/vsynth_lena-dnxhd-uhd-hr-sq  |4 +++
 19 files changed, 131 insertions(+), 1 deletion(-)

diff --git a/tests/fate/seek.mak b/tests/fate/seek.mak
index f120f56..b831cf8 100644
--- a/tests/fate/seek.mak
+++ b/tests/fate/seek.mak
@@ -64,6 +64,7 @@ FATE_SEEK_VSYNTH_LENA-$(call ENCDEC, ASV1,  AVI) 
+= asv1
 FATE_SEEK_VSYNTH_LENA-$(call ENCDEC, ASV2,  AVI) += asv2
 FATE_SEEK_VSYNTH_LENA-$(call ENCDEC, DNXHD, DNXHD)   += dnxhd-720p
 FATE_SEEK_VSYNTH_LENA-$(call ENCDEC, DNXHD, DNXHD)   += dnxhd-720p-rd
+FATE_SEEK_VSYNTH_LENA-$(call ENCDEC, DNXHD, DNXHD)   += dnxhd-4k-hr-lb
 FATE_SEEK_VSYNTH_LENA-$(call ENCDEC, DNXHD, MOV) += dnxhd-1080i
 FATE_SEEK_VSYNTH_LENA-$(call ENCDEC, DVVIDEO,   DV)  += dv
 FATE_SEEK_VSYNTH_LENA-$(call ENCDEC, DVVIDEO,   DV)  += dv-411
@@ -111,6 +112,7 @@ fate-seek-vsynth_lena-asv2:  SRC = 
fate/vsynth_lena-asv2.avi
 fate-seek-vsynth_lena-dnxhd-1080i:   SRC = fate/vsynth_lena-dnxhd-1080i.mov
 fate-seek-vsynth_lena-dnxhd-720p:SRC = 
fate/vsynth_lena-dnxhd-720p.dnxhd
 fate-seek-vsynth_lena-dnxhd-720p-rd: SRC = 
fate/vsynth_lena-dnxhd-720p.dnxhd
+fate-seek-vsynth_lena-dnxhd-4k-hr-lb:SRC = 
fate/vsynth_lena-dnxhd-4k-hr-lb.dnxhd
 fate-seek-vsynth_lena-dv:SRC = fate/vsynth_lena-dv.dv
 fate-seek-vsynth_lena-dv-411:SRC = fate/vsynth_lena-dv-411.dv
 fate-seek-vsynth_lena-dv-50: SRC = fate/vsynth_lena-dv-50.dv
diff --git a/tests/fate/vcodec.mak b/tests/fate/vcodec.mak
index 0e08894..c62abe4 100644
--- a/tests/fate/vcodec.mak
+++ b/tests/fate/vcodec.mak
@@ -27,7 +27,11 @@ fate-vsynth%-cljr:   ENCOPTS = -strict -1
 
 FATE_VCODEC-$(call ENCDEC, DNXHD, DNXHD) += dnxhd-720p  \
 dnxhd-720p-rd   \
-dnxhd-720p-10bit
+dnxhd-720p-10bit\
+dnxhd-720p-hr-lb\
+dnxhd-4k-hr-lb  \
+dnxhd-uhd-hr-sq \
+dnxhd-2k-hr-hq
 
 FATE_VCODEC-$(call ENCDEC, VC2 DIRAC, MOV) += vc2-420p vc2-420p10 vc2-420p12 \
   vc2-422p vc2-422p10 vc2-422p12 \
@@ -54,6 +58,26 @@ fate-vsynth%-dnxhd-720p-10bit:   ENCOPTS = -s hd720 -b 90M   
   \
-pix_fmt yuv422p10 -frames 5 -qmax 8
 fate-vsynth%-dnxhd-720p-10bit:   FMT = dnxhd
 
+fate-vsynth%-dnxhd-720p-hr-lb: ENCOPTS   = -s hd720 -profile:v dnxhr_lb \
+   -pix_fmt yuv422p -frames 5
+fate-vsynth%-dnxhd-720p-hr-lb: DECOPTS= -sws_flags 
area+accurate_rnd+bitexact
+fate-vsynth%-dnxhd-720p-hr-lb: FMT   = dnxhd
+
+fate-vsynth%-dnxhd-4k-hr-lb:  ENCOPTS= -s 4k -profile:v dnxhr_lb \
+   -pix_fmt yuv422p -frames 5
+fate-vsynth%-dnxhd-4k-hr-lb:  DECOPTS= -sws_flags 
area+accurate_rnd+bitexact
+fate-vsynth%-dnxhd-4k-hr-lb:  FMT= dnxhd
+
+fate-vsynth%-dnxhd-uhd-hr-sq: ENCOPTS= -s uhd2160 -profile:v dnxhr_sq \
+   -pix_fmt yuv422p -frames 5
+fate-vsynth%-dnxhd-uhd-hr-sq: DECOPTS= -sws_flags 
area+accurate_rnd+bitexact
+fate-vsynth%-dnxhd-uhd-hr-sq: FMT= dnxhd
+
+fate-vsynt

[FFmpeg-cvslog] lavfi/selectivecolor: fix picking black as neutral when alpha is present

2016-07-24 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Sun Jul 24 14:21:01 
2016 +0200| [b8aaedcd0147be00c7d9b58c85a9caf49fb6b6db] | committer: Clément 
Bœsch

lavfi/selectivecolor: fix picking black as neutral when alpha is present

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b8aaedcd0147be00c7d9b58c85a9caf49fb6b6db
---

 libavfilter/vf_selectivecolor.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_selectivecolor.c b/libavfilter/vf_selectivecolor.c
index e590094..38e6ad5 100644
--- a/libavfilter/vf_selectivecolor.c
+++ b/libavfilter/vf_selectivecolor.c
@@ -338,7 +338,7 @@ static inline int selective_color(AVFilterContext *ctx, 
ThreadData *td,
   | (b == max_color) << RANGE_BLUES
   | (b == min_color) << RANGE_YELLOWS
   | (r > 128 && g > 128 && b > 128) << 
RANGE_WHITES
-  | (color && (color & 0xff) != 
0xff) << RANGE_NEUTRALS
+  | ((r || g || b) && (r != 255 || g != 
255 || b != 255)) << RANGE_NEUTRALS
   | (r < 128 && g < 128 && b < 128) << 
RANGE_BLACKS;
 
 const float rnorm = r / 255.;

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


[FFmpeg-cvslog] lavfi/selectivecolor: add 16-bit support

2016-07-24 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Thu Jul 14 17:23:08 
2016 +0200| [308f9b1c49445abefc85c02e1c8ccf8eb463465b] | committer: Clément 
Bœsch

lavfi/selectivecolor: add 16-bit support

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=308f9b1c49445abefc85c02e1c8ccf8eb463465b
---

 Changelog   |1 +
 libavfilter/version.h   |2 +-
 libavfilter/vf_selectivecolor.c |  270 +++
 3 files changed, 162 insertions(+), 111 deletions(-)

diff --git a/Changelog b/Changelog
index a5d25f2..479f164 100644
--- a/Changelog
+++ b/Changelog
@@ -9,6 +9,7 @@ version :
 - VP8 in Ogg muxing
 - curves filter doesn't automatically insert points at x=0 and x=1 anymore
 - 16-bit support in curves filter
+- 16-bit support in selectivecolor filter
 
 
 version 3.1:
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 89d6fbc..9d21de4 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -30,7 +30,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVFILTER_VERSION_MAJOR   6
-#define LIBAVFILTER_VERSION_MINOR  48
+#define LIBAVFILTER_VERSION_MINOR  49
 #define LIBAVFILTER_VERSION_MICRO 100
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
diff --git a/libavfilter/vf_selectivecolor.c b/libavfilter/vf_selectivecolor.c
index 38e6ad5..33716ec 100644
--- a/libavfilter/vf_selectivecolor.c
+++ b/libavfilter/vf_selectivecolor.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Clément Bœsch 
+ * Copyright (c) 2015-2016 Clément Bœsch 
  *
  * This file is part of FFmpeg.
  *
@@ -21,18 +21,24 @@
 /**
  * @todo
  * - use integers so it can be made bitexact and a FATE test can be added
- * - >8 bit support
  */
 
 #include "libavutil/avassert.h"
 #include "libavutil/file.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
 #include "avfilter.h"
+#include "drawutils.h"
 #include "formats.h"
 #include "internal.h"
 #include "video.h"
 
+#define R 0
+#define G 1
+#define B 2
+#define A 3
+
 enum color_range {
 // WARNING: do NOT reorder (see parse_psfile())
 RANGE_REDS,
@@ -77,6 +83,9 @@ typedef struct {
 struct process_range process_ranges[NB_RANGES]; // color ranges to process
 int nb_process_ranges;
 char *psfile;
+uint8_t rgba_map[4];
+int is_16bit;
+int step;
 } SelectiveColorContext;
 
 #define OFFSET(x) offsetof(SelectiveColorContext, x)
@@ -141,23 +150,28 @@ static int get_cmy_adjust_range(int r, int g, int b, int 
min_val, int max_val)
 return mid_val - min_val;
 }
 
-static int get_neutrals_adjust_range(int r, int g, int b, int min_val, int 
max_val)
-{
-// 1 - (|max-0.5| + |min-0.5|)
-return (255*2 - (abs((max_val<<1) - 255) + abs((min_val<<1) - 255)) + 1) 
>> 1;
-}
-
-static int get_whites_adjust_range(int r, int g, int b, int min_val, int 
max_val)
-{
-// (min - 0.5) * 2
-return (min_val<<1) - 255;
-}
+#define DECLARE_ADJUST_RANGE_FUNCS(nbits)  
 \
+static int get_neutrals_adjust_range##nbits(int r, int g, int b, int min_val, 
int max_val)  \
+{  
 \
+/* 1 - (|max-0.5| + |min-0.5|) */  
 \
+return (((1<> 
1;\
+}  
 \
+   
 \
+static int get_whites_adjust_range##nbits(int r, int g, int b, int min_val, 
int max_val)\
+{  
 \
+/* (min - 0.5) * 2 */  
 \
+return (min_val<<1) - ((1mask & (1mask & (1mask & 1mask & 1mask & 1is_16bit && (pr->mask & 1is_16bit && (pr->mask & 1is_16bit && (pr->mask & 1is_16bit && (pr->mask & 1is_16bit && (pr->mask & 1is_16bit && (pr->mask & 1

[FFmpeg-cvslog] Revert "Merge commit '3c53627ac17fc6bdea5029be57da1e03b32d265d'"

2016-07-24 Thread Ivan Uskov
ffmpeg | branch: master | Ivan Uskov  | Sun Jul 24 
09:59:42 2016 -0400| [b4054100f675b395204f1a0471fba0b06fe08e9f] | committer: 
Michael Niedermayer

Revert "Merge commit '3c53627ac17fc6bdea5029be57da1e03b32d265d'"

This reverts commit d30cf57a7b2097b565db02ecfffbdc9c16423d0e, reversing changes 
made to
acc155ac55baa95d1c16c0364b02244bc04d83a8. The commit 
d30cf57a7b2097b565db02ecfffbdc9c16423d0e
provided irrelevant code complexity and decoding slowdown. But the main 
disadvantage of this
commit is a decoder crash. So it should be reverted.

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b4054100f675b395204f1a0471fba0b06fe08e9f
---

 libavcodec/qsvdec.c |   34 ++
 1 file changed, 6 insertions(+), 28 deletions(-)

diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index c17606d..9125700 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -142,7 +142,7 @@ static int qsv_decode_init(AVCodecContext *avctx, 
QSVContext *q, AVPacket *avpkt
  */
 if (!q->async_fifo) {
 q->async_fifo = av_fifo_alloc((1 + 16) *
-  (sizeof(mfxSyncPoint*) + 
sizeof(QSVFrame*)));
+  (sizeof(mfxSyncPoint) + 
sizeof(QSVFrame*)));
 if (!q->async_fifo)
 return AVERROR(ENOMEM);
 }
@@ -297,16 +297,6 @@ static void close_decoder(QSVContext *q)
 if (q->session)
 MFXVideoDECODE_Close(q->session);
 
-while (q->async_fifo && av_fifo_size(q->async_fifo)) {
-QSVFrame *out_frame;
-mfxSyncPoint *sync;
-
-av_fifo_generic_read(q->async_fifo, &out_frame, sizeof(out_frame), 
NULL);
-av_fifo_generic_read(q->async_fifo, &sync,  sizeof(sync),  
NULL);
-
-av_freep(&sync);
-}
-
 cur = q->work_frames;
 while (cur) {
 q->work_frames = cur->next;
@@ -326,7 +316,7 @@ static int do_qsv_decode(AVCodecContext *avctx, QSVContext 
*q,
 QSVFrame *out_frame;
 mfxFrameSurface1 *insurf;
 mfxFrameSurface1 *outsurf;
-mfxSyncPoint *sync;
+mfxSyncPoint sync;
 mfxBitstream bs = { { { 0 } } };
 int ret;
 int n_out_frames;
@@ -359,19 +349,13 @@ static int do_qsv_decode(AVCodecContext *avctx, 
QSVContext *q,
 bs.TimeStamp  = avpkt->pts;
 }
 
-sync = av_mallocz(sizeof(*sync));
-if (!sync) {
-av_freep(&sync);
-return AVERROR(ENOMEM);
-}
-
 while (1) {
 ret = get_surface(avctx, q, &insurf);
 if (ret < 0)
 return ret;
 do {
 ret = MFXVideoDECODE_DecodeFrameAsync(q->session, flush ? NULL : 
&bs,
-  insurf, &outsurf, sync);
+  insurf, &outsurf, &sync);
 if (ret != MFX_WRN_DEVICE_BUSY)
 break;
 av_usleep(500);
@@ -385,11 +369,10 @@ static int do_qsv_decode(AVCodecContext *avctx, 
QSVContext *q,
 continue;
 }
 
-if (*sync) {
+if (sync) {
 QSVFrame *out_frame = find_frame(q, outsurf);
 
 if (!out_frame) {
-av_freep(&sync);
 av_log(avctx, AV_LOG_ERROR,
"The returned surface does not correspond to any 
frame\n");
 return AVERROR_BUG;
@@ -400,8 +383,6 @@ static int do_qsv_decode(AVCodecContext *avctx, QSVContext 
*q,
 av_fifo_generic_write(q->async_fifo, &sync,  sizeof(sync), 
 NULL);
 
 continue;
-} else {
-av_freep(&sync);
 }
 if (MFX_ERR_MORE_SURFACE != ret && ret < 0)
 break;
@@ -409,7 +390,7 @@ static int do_qsv_decode(AVCodecContext *avctx, QSVContext 
*q,
 
 /* make sure we do not enter an infinite loop if the SDK
  * did not consume any data and did not return anything */
-if (!*sync && !bs.DataOffset && !flush) {
+if (!sync && !bs.DataOffset && !flush) {
 av_log(avctx, AV_LOG_WARNING, "A decode call did not consume any 
data\n");
 bs.DataOffset = avpkt->size;
 }
@@ -423,7 +404,6 @@ static int do_qsv_decode(AVCodecContext *avctx, QSVContext 
*q,
 }
 
 if (MFX_ERR_MORE_DATA!=ret && ret < 0) {
-av_freep(&sync);
 av_log(avctx, AV_LOG_ERROR, "Error %d during QSV decoding.\n", ret);
 return ff_qsv_error(ret);
 }
@@ -437,11 +417,9 @@ static int do_qsv_decode(AVCodecContext *avctx, QSVContext 
*q,
 out_frame->queued = 0;
 
 do {
-ret = MFXVideoCORE_SyncOperation(q->session, *sync, 1000);
+ret = MFXVideoCORE_SyncOperation(q->session, sync, 1000);
 } while (ret == MFX_WRN_IN_EXECUTION);
 
-av_freep(&sync);
-
 src_frame = out_frame->frame;
 
 ret = av_frame_ref(frame, src_frame);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mail

[FFmpeg-cvslog] lavc/h264_ps: Be more verbose when truncating likely oversized PPS.

2016-07-24 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Fri Jul 22 
19:24:15 2016 +0200| [9bd35a76fc94e2ac633c9b3e831859e2846e59ea] | committer: 
Carl Eugen Hoyos

lavc/h264_ps: Be more verbose when truncating likely oversized PPS.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9bd35a76fc94e2ac633c9b3e831859e2846e59ea
---

 libavcodec/h264_ps.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 3bcc6e1..7d1cf19 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -732,7 +732,9 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, 
AVCodecContext *avct
 
 pps->data_size = gb->buffer_end - gb->buffer;
 if (pps->data_size > sizeof(pps->data)) {
-av_log(avctx, AV_LOG_WARNING, "Truncating likely oversized PPS\n");
+av_log(avctx, AV_LOG_WARNING, "Truncating likely oversized PPS "
+   "(%"SIZE_SPECIFIER" > %"SIZE_SPECIFIER")\n",
+   pps->data_size, sizeof(pps->data));
 pps->data_size = sizeof(pps->data);
 }
 memcpy(pps->data, gb->buffer, pps->data_size);

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


[FFmpeg-cvslog] lavc: always build dnxhddata

2016-07-24 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Sun 
Jul 24 22:26:47 2016 +0200| [2adbea4e216ce38a8bf6c72de16267c9162c174d] | 
committer: Matthieu Bouron

lavc: always build dnxhddata

lavc/movenc rely on avpriv_dnxhd_parse_header_prefix declared by
dnxhddata.h since e47981dab7fb7c9499b959cb0125b7281301969a.

Fixes a missing symbol error in lavc/movenc if the dnxhd encoder is not
enabled.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2adbea4e216ce38a8bf6c72de16267c9162c174d
---

 libavcodec/Makefile |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index abef19e..4fc4b09 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -32,6 +32,7 @@ OBJS = allcodecs.o
  \
codec_desc.o \
d3d11va.o\
dirac.o  \
+   dnxhddata.o  \
dv_profile.o \
imgconvert.o \
jni.o\
@@ -241,8 +242,8 @@ OBJS-$(CONFIG_DIRAC_DECODER)   += diracdec.o 
dirac.o diracdsp.o diractab
   dirac_arith.o mpeg12data.o 
dirac_dwt.o \
   dirac_vlc.o
 OBJS-$(CONFIG_DFA_DECODER) += dfa.o
-OBJS-$(CONFIG_DNXHD_DECODER)   += dnxhddec.o dnxhddata.o
-OBJS-$(CONFIG_DNXHD_ENCODER)   += dnxhdenc.o dnxhddata.o
+OBJS-$(CONFIG_DNXHD_DECODER)   += dnxhddec.o
+OBJS-$(CONFIG_DNXHD_ENCODER)   += dnxhdenc.o
 OBJS-$(CONFIG_DPX_DECODER) += dpx.o
 OBJS-$(CONFIG_DPX_ENCODER) += dpxenc.o
 OBJS-$(CONFIG_DSD_LSBF_DECODER)+= dsddec.o dsd.o

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


[FFmpeg-cvslog] lavc/Makefile: Fix standalone compilation of the svq3 decoder.

2016-07-24 Thread Carl Eugen Hoyos
ffmpeg | branch: release/3.1 | Carl Eugen Hoyos  | Sun Jul 24 
23:50:33 2016 +0200| [2e1be2271506c0589ab68583d6b524a4b5acc9be] | committer: 
Carl Eugen Hoyos

lavc/Makefile: Fix standalone compilation of the svq3 decoder.

Regression since 0bf5fd2e
(cherry picked from commit 71167f7f8434341b3f76da68a10923b6525e2e87)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2e1be2271506c0589ab68583d6b524a4b5acc9be
---

 libavcodec/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index fd0d1f0..bb28aea 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -528,7 +528,8 @@ OBJS-$(CONFIG_SUNRAST_ENCODER) += sunrastenc.o
 OBJS-$(CONFIG_SVQ1_DECODER)+= svq1dec.o svq1.o svq13.o h263data.o
 OBJS-$(CONFIG_SVQ1_ENCODER)+= svq1enc.o svq1.o  h263data.o  \
   h263.o ituh263enc.o
-OBJS-$(CONFIG_SVQ3_DECODER)+= svq3.o svq13.o mpegutils.o 
h264_parse.o h264data.o
+OBJS-$(CONFIG_SVQ3_DECODER)+= svq3.o svq13.o mpegutils.o \
+  h264_parse.o h264data.o h264_ps.o 
h2645_parse.o
 OBJS-$(CONFIG_TEXT_DECODER)+= textdec.o ass.o
 OBJS-$(CONFIG_TEXT_ENCODER)+= srtenc.o ass_split.o
 OBJS-$(CONFIG_TAK_DECODER) += takdec.o tak.o takdsp.o

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


[FFmpeg-cvslog] lavc/Makefile: Fix standalone compilation of the svq3 decoder.

2016-07-24 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Sun Jul 24 
23:50:33 2016 +0200| [71167f7f8434341b3f76da68a10923b6525e2e87] | committer: 
Carl Eugen Hoyos

lavc/Makefile: Fix standalone compilation of the svq3 decoder.

Regression since 0bf5fd2e

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=71167f7f8434341b3f76da68a10923b6525e2e87
---

 libavcodec/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 4fc4b09..2564ab8 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -532,7 +532,8 @@ OBJS-$(CONFIG_SUNRAST_ENCODER) += sunrastenc.o
 OBJS-$(CONFIG_SVQ1_DECODER)+= svq1dec.o svq1.o svq13.o h263data.o
 OBJS-$(CONFIG_SVQ1_ENCODER)+= svq1enc.o svq1.o  h263data.o  \
   h263.o ituh263enc.o
-OBJS-$(CONFIG_SVQ3_DECODER)+= svq3.o svq13.o mpegutils.o 
h264_parse.o h264data.o
+OBJS-$(CONFIG_SVQ3_DECODER)+= svq3.o svq13.o mpegutils.o \
+  h264_parse.o h264data.o h264_ps.o 
h2645_parse.o
 OBJS-$(CONFIG_TEXT_DECODER)+= textdec.o ass.o
 OBJS-$(CONFIG_TEXT_ENCODER)+= srtenc.o ass_split.o
 OBJS-$(CONFIG_TAK_DECODER) += takdec.o tak.o takdsp.o

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