[FFmpeg-cvslog] avfilter/vf_colorbalance: add planar rgb support

2018-05-05 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat May  5 12:22:52 
2018 +0200| [db8777cef0929418cef040c2fdb7676af9ceaecd] | committer: Paul B Mahol

avfilter/vf_colorbalance: add planar rgb support

Signed-off-by: Paul B Mahol 

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

 libavfilter/vf_colorbalance.c | 79 ++-
 1 file changed, 78 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_colorbalance.c b/libavfilter/vf_colorbalance.c
index 4c37bc0214..d502080d45 100644
--- a/libavfilter/vf_colorbalance.c
+++ b/libavfilter/vf_colorbalance.c
@@ -79,6 +79,12 @@ static int query_formats(AVFilterContext *ctx)
 AV_PIX_FMT_RGB0,  AV_PIX_FMT_BGR0,
 AV_PIX_FMT_RGB48,  AV_PIX_FMT_BGR48,
 AV_PIX_FMT_RGBA64, AV_PIX_FMT_BGRA64,
+AV_PIX_FMT_GBRP,   AV_PIX_FMT_GBRAP,
+AV_PIX_FMT_GBRP9,
+AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRAP10,
+AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRAP12,
+AV_PIX_FMT_GBRP14,
+AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16,
 AV_PIX_FMT_NONE
 };
 AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
@@ -87,6 +93,72 @@ static int query_formats(AVFilterContext *ctx)
 return ff_set_common_formats(ctx, fmts_list);
 }
 
+static void apply_lut8_p(AVFilterContext *ctx, AVFrame *in, AVFrame *out)
+{
+ColorBalanceContext *s = ctx->priv;
+const uint8_t *srcg = in->data[0];
+const uint8_t *srcb = in->data[1];
+const uint8_t *srcr = in->data[2];
+const uint8_t *srca = in->data[3];
+uint8_t *dstg = out->data[0];
+uint8_t *dstb = out->data[1];
+uint8_t *dstr = out->data[2];
+uint8_t *dsta = out->data[3];
+int i, j;
+
+for (i = 0; i < out->height; i++) {
+for (j = 0; j < out->width; j++) {
+dstg[j] = s->lut[G][srcg[j]];
+dstb[j] = s->lut[B][srcb[j]];
+dstr[j] = s->lut[R][srcr[j]];
+if (in != out && out->linesize[3])
+dsta[j] = srca[j];
+}
+
+srcg += in->linesize[0];
+srcb += in->linesize[1];
+srcr += in->linesize[2];
+srca += in->linesize[3];
+dstg += out->linesize[0];
+dstb += out->linesize[1];
+dstr += out->linesize[2];
+dsta += out->linesize[3];
+}
+}
+
+static void apply_lut16_p(AVFilterContext *ctx, AVFrame *in, AVFrame *out)
+{
+ColorBalanceContext *s = ctx->priv;
+const uint16_t *srcg = (const uint16_t *)in->data[0];
+const uint16_t *srcb = (const uint16_t *)in->data[1];
+const uint16_t *srcr = (const uint16_t *)in->data[2];
+const uint16_t *srca = (const uint16_t *)in->data[3];
+uint16_t *dstg = (uint16_t *)out->data[0];
+uint16_t *dstb = (uint16_t *)out->data[1];
+uint16_t *dstr = (uint16_t *)out->data[2];
+uint16_t *dsta = (uint16_t *)out->data[3];
+int i, j;
+
+for (i = 0; i < out->height; i++) {
+for (j = 0; j < out->width; j++) {
+dstg[j] = s->lut[G][srcg[j]];
+dstb[j] = s->lut[B][srcb[j]];
+dstr[j] = s->lut[R][srcr[j]];
+if (in != out && out->linesize[3])
+dsta[j] = srca[j];
+}
+
+srcg += in->linesize[0] / 2;
+srcb += in->linesize[1] / 2;
+srcr += in->linesize[2] / 2;
+srca += in->linesize[3] / 2;
+dstg += out->linesize[0] / 2;
+dstb += out->linesize[1] / 2;
+dstr += out->linesize[2] / 2;
+dsta += out->linesize[3] / 2;
+}
+}
+
 static void apply_lut8(AVFilterContext *ctx, AVFrame *in, AVFrame *out)
 {
 ColorBalanceContext *s = ctx->priv;
@@ -156,10 +228,15 @@ static int config_output(AVFilterLink *outlink)
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(outlink->format);
 const int depth = desc->comp[0].depth;
 const int max = 1 << depth;
+const int planar = av_pix_fmt_count_planes(outlink->format) > 1;
 double *shadows, *midtones, *highlights, *buffer;
 int i, r, g, b;
 
-if (max == 256) {
+if (max == 256 && planar) {
+s->apply_lut = apply_lut8_p;
+} else if (planar) {
+s->apply_lut = apply_lut16_p;
+} else if (max == 256) {
 s->apply_lut = apply_lut8;
 } else {
 s->apply_lut = apply_lut16;

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


[FFmpeg-cvslog] avfilter/vf_convolution: use already available dstride

2018-05-05 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat May  5 10:59:56 
2018 +0200| [4cd4aa08a689049efe028cd56db12f2aa552ede6] | committer: Paul B Mahol

avfilter/vf_convolution: use already available dstride

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavfilter/vf_convolution.c b/libavfilter/vf_convolution.c
index e8fc6553d2..96d40b40f1 100644
--- a/libavfilter/vf_convolution.c
+++ b/libavfilter/vf_convolution.c
@@ -541,7 +541,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, 
int jobnr, int nb_jobs)
 const float rdiv = s->rdiv[plane];
 const float bias = s->bias[plane];
 const uint8_t *src = in->data[plane];
-const int dst_pos = slice_start * (mode == MATRIX_COLUMN ? bpc : 
out->linesize[plane]);
+const int dst_pos = slice_start * (mode == MATRIX_COLUMN ? bpc : 
dstride);
 uint8_t *dst = out->data[plane] + dst_pos;
 const int *matrix = s->matrix[plane];
 const uint8_t *c[49];

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


[FFmpeg-cvslog] avfilter/vf_colorbalance: add slice threading

2018-05-05 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat May  5 12:50:16 
2018 +0200| [0ef7a4519745967473f69fd8819af9d558132d4b] | committer: Paul B Mahol

avfilter/vf_colorbalance: add slice threading

Signed-off-by: Paul B Mahol 

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

 libavfilter/vf_colorbalance.c | 98 +--
 1 file changed, 66 insertions(+), 32 deletions(-)

diff --git a/libavfilter/vf_colorbalance.c b/libavfilter/vf_colorbalance.c
index d502080d45..4e7476ae2f 100644
--- a/libavfilter/vf_colorbalance.c
+++ b/libavfilter/vf_colorbalance.c
@@ -31,6 +31,10 @@
 #define B 2
 #define A 3
 
+typedef struct ThreadData {
+AVFrame *in, *out;
+} ThreadData;
+
 typedef struct Range {
 double shadows;
 double midtones;
@@ -48,8 +52,7 @@ typedef struct ColorBalanceContext {
 uint8_t rgba_map[4];
 int step;
 
-int (*clip)(int x);
-void (*apply_lut)(AVFilterContext *ctx, AVFrame *in, AVFrame *out);
+int (*apply_lut)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
 } ColorBalanceContext;
 
 #define OFFSET(x) offsetof(ColorBalanceContext, x)
@@ -93,20 +96,25 @@ static int query_formats(AVFilterContext *ctx)
 return ff_set_common_formats(ctx, fmts_list);
 }
 
-static void apply_lut8_p(AVFilterContext *ctx, AVFrame *in, AVFrame *out)
+static int apply_lut8_p(AVFilterContext *ctx, void *arg, int jobnr, int 
nb_jobs)
 {
 ColorBalanceContext *s = ctx->priv;
-const uint8_t *srcg = in->data[0];
-const uint8_t *srcb = in->data[1];
-const uint8_t *srcr = in->data[2];
-const uint8_t *srca = in->data[3];
-uint8_t *dstg = out->data[0];
-uint8_t *dstb = out->data[1];
-uint8_t *dstr = out->data[2];
-uint8_t *dsta = out->data[3];
+ThreadData *td = arg;
+AVFrame *in = td->in;
+AVFrame *out = td->out;
+const int slice_start = (out->height * jobnr) / nb_jobs;
+const int slice_end = (out->height * (jobnr+1)) / nb_jobs;
+const uint8_t *srcg = in->data[0] + slice_start * in->linesize[0];
+const uint8_t *srcb = in->data[1] + slice_start * in->linesize[1];
+const uint8_t *srcr = in->data[2] + slice_start * in->linesize[2];
+const uint8_t *srca = in->data[3] + slice_start * in->linesize[3];
+uint8_t *dstg = out->data[0] + slice_start * out->linesize[0];
+uint8_t *dstb = out->data[1] + slice_start * out->linesize[1];
+uint8_t *dstr = out->data[2] + slice_start * out->linesize[2];
+uint8_t *dsta = out->data[3] + slice_start * out->linesize[3];
 int i, j;
 
-for (i = 0; i < out->height; i++) {
+for (i = slice_start; i < slice_end; i++) {
 for (j = 0; j < out->width; j++) {
 dstg[j] = s->lut[G][srcg[j]];
 dstb[j] = s->lut[B][srcb[j]];
@@ -124,22 +132,29 @@ static void apply_lut8_p(AVFilterContext *ctx, AVFrame 
*in, AVFrame *out)
 dstr += out->linesize[2];
 dsta += out->linesize[3];
 }
+
+return 0;
 }
 
-static void apply_lut16_p(AVFilterContext *ctx, AVFrame *in, AVFrame *out)
+static int apply_lut16_p(AVFilterContext *ctx, void *arg, int jobnr, int 
nb_jobs)
 {
 ColorBalanceContext *s = ctx->priv;
-const uint16_t *srcg = (const uint16_t *)in->data[0];
-const uint16_t *srcb = (const uint16_t *)in->data[1];
-const uint16_t *srcr = (const uint16_t *)in->data[2];
-const uint16_t *srca = (const uint16_t *)in->data[3];
-uint16_t *dstg = (uint16_t *)out->data[0];
-uint16_t *dstb = (uint16_t *)out->data[1];
-uint16_t *dstr = (uint16_t *)out->data[2];
-uint16_t *dsta = (uint16_t *)out->data[3];
+ThreadData *td = arg;
+AVFrame *in = td->in;
+AVFrame *out = td->out;
+const int slice_start = (out->height * jobnr) / nb_jobs;
+const int slice_end = (out->height * (jobnr+1)) / nb_jobs;
+const uint16_t *srcg = (const uint16_t *)in->data[0] + slice_start * 
in->linesize[0] / 2;
+const uint16_t *srcb = (const uint16_t *)in->data[1] + slice_start * 
in->linesize[1] / 2;
+const uint16_t *srcr = (const uint16_t *)in->data[2] + slice_start * 
in->linesize[2] / 2;
+const uint16_t *srca = (const uint16_t *)in->data[3] + slice_start * 
in->linesize[3] / 2;
+uint16_t *dstg = (uint16_t *)out->data[0] + slice_start * out->linesize[0] 
/ 2;
+uint16_t *dstb = (uint16_t *)out->data[1] + slice_start * out->linesize[1] 
/ 2;
+uint16_t *dstr = (uint16_t *)out->data[2] + slice_start * out->linesize[2] 
/ 2;
+uint16_t *dsta = (uint16_t *)out->data[3] + slice_start * out->linesize[3] 
/ 2;
 int i, j;
 
-for (i = 0; i < out->height; i++) {
+for (i = slice_start; i < slice_end; i++) {
 for (j = 0; j < out->width; j++) {
 dstg[j] = s->lut[G][srcg[j]];
 dstb[j] = s->lut[B][srcb[j]];
@@ -157,13 +172,20 @@ static void apply_lut16_p(AVFilterContext *ctx, AVFrame 
*in, AVFrame *out)
 dstr += out->linesize[2] / 2;
 dsta += out->linesize[3] / 2;
 }
+

[FFmpeg-cvslog] avcodec/flac_parser: Fix infinite loop

2018-05-05 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Mon 
Apr 30 22:20:28 2018 +0200| [15a2e35e9e74bba5a27e39c26da5be2361f27945] | 
committer: Michael Niedermayer

avcodec/flac_parser: Fix infinite loop

Fixes: crbug/827204

Reported-by: Frank Liberato 
Reviewed-by: Frank Liberato 
Signed-off-by: Michael Niedermayer 

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

 libavcodec/flac_parser.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index 84da23f327..2721286464 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -686,12 +686,17 @@ static int flac_parse(AVCodecParserContext *s, 
AVCodecContext *avctx,
 }
 
 for (curr = fpc->headers; curr; curr = curr->next) {
-if (curr->max_score > 0 &&
-(!fpc->best_header || curr->max_score > 
fpc->best_header->max_score)) {
+if (!fpc->best_header || curr->max_score > 
fpc->best_header->max_score) {
 fpc->best_header = curr;
 }
 }
 
+if (fpc->best_header && fpc->best_header->max_score <= 0) {
+// Only accept a bad header if there is no other option to continue
+if (!buf_size || !buf || read_end != buf || fpc->nb_headers_buffered < 
FLAC_MIN_HEADERS)
+fpc->best_header = NULL;
+}
+
 if (fpc->best_header) {
 fpc->best_header_valid = 1;
 if (fpc->best_header->offset > 0) {

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


[FFmpeg-cvslog] avfilter/vf_colorchannelmixer: add slice threading

2018-05-05 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat May  5 16:09:29 
2018 +0200| [d1e18724187d3c49f0b0cfeb4810c710ac3db875] | committer: Paul B Mahol

avfilter/vf_colorchannelmixer: add slice threading

Signed-off-by: Paul B Mahol 

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

 libavfilter/vf_colorchannelmixer.c | 433 +++--
 1 file changed, 270 insertions(+), 163 deletions(-)

diff --git a/libavfilter/vf_colorchannelmixer.c 
b/libavfilter/vf_colorchannelmixer.c
index 2e068fa794..cdd5aed8a5 100644
--- a/libavfilter/vf_colorchannelmixer.c
+++ b/libavfilter/vf_colorchannelmixer.c
@@ -30,6 +30,10 @@
 #define B 2
 #define A 3
 
+typedef struct ThreadData {
+AVFrame *in, *out;
+} ThreadData;
+
 typedef struct ColorChannelMixerContext {
 const AVClass *class;
 double rr, rg, rb, ra;
@@ -42,6 +46,8 @@ typedef struct ColorChannelMixerContext {
 int *buffer;
 
 uint8_t rgba_map[4];
+
+int (*filter_slice)(AVFilterContext *ctx, void *arg, int jobnr, int 
nb_jobs);
 } ColorChannelMixerContext;
 
 #define OFFSET(x) offsetof(ColorChannelMixerContext, x)
@@ -87,6 +93,237 @@ static int query_formats(AVFilterContext *ctx)
 return ff_set_common_formats(ctx, fmts_list);
 }
 
+static int filter_slice_rgba64(AVFilterContext *ctx, void *arg, int jobnr, int 
nb_jobs)
+{
+ColorChannelMixerContext *s = ctx->priv;
+ThreadData *td = arg;
+AVFrame *in = td->in;
+AVFrame *out = td->out;
+const int slice_start = (out->height * jobnr) / nb_jobs;
+const int slice_end = (out->height * (jobnr+1)) / nb_jobs;
+const uint8_t roffset = s->rgba_map[R];
+const uint8_t goffset = s->rgba_map[G];
+const uint8_t boffset = s->rgba_map[B];
+const uint8_t aoffset = s->rgba_map[A];
+const uint8_t *srcrow = in->data[0] + slice_start * in->linesize[0];
+uint8_t *dstrow = out->data[0] + slice_start * out->linesize[0];
+int i, j;
+
+for (i = slice_start; i < slice_end; i++) {
+const uint16_t *src = (const uint16_t *)srcrow;
+uint16_t *dst = (uint16_t *)dstrow;
+
+for (j = 0; j < out->width * 4; j += 4) {
+const uint16_t rin = src[j + roffset];
+const uint16_t gin = src[j + goffset];
+const uint16_t bin = src[j + boffset];
+const uint16_t ain = src[j + aoffset];
+
+dst[j + roffset] = av_clip_uint16(s->lut[R][R][rin] +
+  s->lut[R][G][gin] +
+  s->lut[R][B][bin] +
+  s->lut[R][A][ain]);
+dst[j + goffset] = av_clip_uint16(s->lut[G][R][rin] +
+  s->lut[G][G][gin] +
+  s->lut[G][B][bin] +
+  s->lut[G][A][ain]);
+dst[j + boffset] = av_clip_uint16(s->lut[B][R][rin] +
+  s->lut[B][G][gin] +
+  s->lut[B][B][bin] +
+  s->lut[B][A][ain]);
+dst[j + aoffset] = av_clip_uint16(s->lut[A][R][rin] +
+  s->lut[A][G][gin] +
+  s->lut[A][B][bin] +
+  s->lut[A][A][ain]);
+}
+
+srcrow += in->linesize[0];
+dstrow += out->linesize[0];
+}
+
+return 0;
+}
+
+static int filter_slice_rgb48(AVFilterContext *ctx, void *arg, int jobnr, int 
nb_jobs)
+{
+ColorChannelMixerContext *s = ctx->priv;
+ThreadData *td = arg;
+AVFrame *in = td->in;
+AVFrame *out = td->out;
+const int slice_start = (out->height * jobnr) / nb_jobs;
+const int slice_end = (out->height * (jobnr+1)) / nb_jobs;
+const uint8_t roffset = s->rgba_map[R];
+const uint8_t goffset = s->rgba_map[G];
+const uint8_t boffset = s->rgba_map[B];
+const uint8_t *srcrow = in->data[0] + slice_start * in->linesize[0];
+uint8_t *dstrow = out->data[0] + slice_start * out->linesize[0];
+int i, j;
+
+for (i = slice_start; i < slice_end; i++) {
+const uint16_t *src = (const uint16_t *)srcrow;
+uint16_t *dst = (uint16_t *)dstrow;
+
+for (j = 0; j < out->width * 3; j += 3) {
+const uint16_t rin = src[j + roffset];
+const uint16_t gin = src[j + goffset];
+const uint16_t bin = src[j + boffset];
+
+dst[j + roffset] = av_clip_uint16(s->lut[R][R][rin] +
+  s->lut[R][G][gin] +
+  s->lut[R][B][bin]);
+dst[j + goffset] = av_clip_uint16(s->lut[G][R][rin] +
+  s->lut[G][G][gin] +
+  s->lut[G][B][bin]);
+

[FFmpeg-cvslog] avfilter/vf_colorbalance: fix off by one overflow

2018-05-05 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat May  5 16:11:35 
2018 +0200| [2017b4b1c25bd72aaa9098ed4c3c669b9c11c0e0] | committer: Paul B Mahol

avfilter/vf_colorbalance: fix off by one overflow

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavfilter/vf_colorbalance.c b/libavfilter/vf_colorbalance.c
index 4e7476ae2f..dd8189f548 100644
--- a/libavfilter/vf_colorbalance.c
+++ b/libavfilter/vf_colorbalance.c
@@ -291,7 +291,7 @@ static int config_output(AVFilterLink *outlink)
 
 shadows[i] = low;
 midtones[i] = mid;
-highlights[max - i] = low;
+highlights[max - i - 1] = low;
 }
 
 for (i = 0; i < max; i++) {

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


[FFmpeg-cvslog] avfilter/vf_colorchannelmixer: add planar rgb support

2018-05-05 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat May  5 17:25:13 
2018 +0200| [0f4ca420bca4a8b4629a5e3fed7b169dace2a47f] | committer: Paul B Mahol

avfilter/vf_colorchannelmixer: add planar rgb support

Signed-off-by: Paul B Mahol 

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

 libavfilter/vf_colorchannelmixer.c | 240 ++---
 1 file changed, 221 insertions(+), 19 deletions(-)

diff --git a/libavfilter/vf_colorchannelmixer.c 
b/libavfilter/vf_colorchannelmixer.c
index bbd7eaa902..3a9cd37b78 100644
--- a/libavfilter/vf_colorchannelmixer.c
+++ b/libavfilter/vf_colorchannelmixer.c
@@ -19,6 +19,7 @@
  */
 
 #include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
 #include "avfilter.h"
 #include "drawutils.h"
 #include "formats.h"
@@ -84,6 +85,12 @@ static int query_formats(AVFilterContext *ctx)
 AV_PIX_FMT_RGB0,   AV_PIX_FMT_BGR0,
 AV_PIX_FMT_RGB48,  AV_PIX_FMT_BGR48,
 AV_PIX_FMT_RGBA64, AV_PIX_FMT_BGRA64,
+AV_PIX_FMT_GBRP,   AV_PIX_FMT_GBRAP,
+AV_PIX_FMT_GBRP9,
+AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRAP10,
+AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRAP12,
+AV_PIX_FMT_GBRP14,
+AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16,
 AV_PIX_FMT_NONE
 };
 
@@ -93,6 +100,174 @@ static int query_formats(AVFilterContext *ctx)
 return ff_set_common_formats(ctx, fmts_list);
 }
 
+static av_always_inline int filter_slice_rgba_planar(AVFilterContext *ctx, 
void *arg, int jobnr, int nb_jobs,
+ int have_alpha)
+{
+ColorChannelMixerContext *s = ctx->priv;
+ThreadData *td = arg;
+AVFrame *in = td->in;
+AVFrame *out = td->out;
+const int slice_start = (out->height * jobnr) / nb_jobs;
+const int slice_end = (out->height * (jobnr+1)) / nb_jobs;
+const uint8_t *srcg = in->data[0] + slice_start * in->linesize[0];
+const uint8_t *srcb = in->data[1] + slice_start * in->linesize[1];
+const uint8_t *srcr = in->data[2] + slice_start * in->linesize[2];
+const uint8_t *srca = in->data[3] + slice_start * in->linesize[3];
+uint8_t *dstg = out->data[0] + slice_start * out->linesize[0];
+uint8_t *dstb = out->data[1] + slice_start * out->linesize[1];
+uint8_t *dstr = out->data[2] + slice_start * out->linesize[2];
+uint8_t *dsta = out->data[3] + slice_start * out->linesize[3];
+int i, j;
+
+for (i = slice_start; i < slice_end; i++) {
+for (j = 0; j < out->width; j++) {
+const uint8_t rin = srcr[j];
+const uint8_t gin = srcg[j];
+const uint8_t bin = srcb[j];
+const uint8_t ain = srca[j];
+
+dstr[j] = av_clip_uint8(s->lut[R][R][rin] +
+s->lut[R][G][gin] +
+s->lut[R][B][bin] +
+(have_alpha == 1 ? s->lut[R][A][ain] : 0));
+dstg[j] = av_clip_uint8(s->lut[G][R][rin] +
+s->lut[G][G][gin] +
+s->lut[G][B][bin] +
+(have_alpha == 1 ? s->lut[G][A][ain] : 0));
+dstb[j] = av_clip_uint8(s->lut[B][R][rin] +
+s->lut[B][G][gin] +
+s->lut[B][B][bin] +
+(have_alpha == 1 ? s->lut[B][A][ain] : 0));
+if (have_alpha == 1) {
+dsta[j] = av_clip_uint8(s->lut[A][R][rin] +
+s->lut[A][G][gin] +
+s->lut[A][B][bin] +
+s->lut[A][A][ain]);
+}
+}
+
+srcg += in->linesize[0];
+srcb += in->linesize[1];
+srcr += in->linesize[2];
+srca += in->linesize[3];
+dstg += out->linesize[0];
+dstb += out->linesize[1];
+dstr += out->linesize[2];
+dsta += out->linesize[3];
+}
+
+return 0;
+}
+
+static av_always_inline int filter_slice_rgba16_planar(AVFilterContext *ctx, 
void *arg, int jobnr, int nb_jobs,
+   int have_alpha, int 
depth)
+{
+ColorChannelMixerContext *s = ctx->priv;
+ThreadData *td = arg;
+AVFrame *in = td->in;
+AVFrame *out = td->out;
+const int slice_start = (out->height * jobnr) / nb_jobs;
+const int slice_end = (out->height * (jobnr+1)) / nb_jobs;
+const uint16_t *srcg = (const uint16_t *)(in->data[0] + slice_start * 
in->linesize[0]);
+const uint16_t *srcb = (const uint16_t *)(in->data[1] + slice_start * 
in->linesize[1]);
+const uint16_t *srcr = (const uint16_t *)(in->data[2] + slice_start * 
in->linesize[2]);
+const uint16_t *srca = (const uint16_t *)(in->data[3] + slice_start * 
in->linesize[3]);
+uint16_t *dstg = (uint16_t *)(out->data[0] + slice_start * 
out->linesize[0]);

[FFmpeg-cvslog] avfilter/vf_colorchannelmixer: refactor code

2018-05-05 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat May  5 16:31:54 
2018 +0200| [931e2c4541e0298a439383f4ffd44475babc38f0] | committer: Paul B Mahol

avfilter/vf_colorchannelmixer: refactor code

Signed-off-by: Paul B Mahol 

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

 libavfilter/vf_colorchannelmixer.c | 200 +
 1 file changed, 49 insertions(+), 151 deletions(-)

diff --git a/libavfilter/vf_colorchannelmixer.c 
b/libavfilter/vf_colorchannelmixer.c
index cdd5aed8a5..bbd7eaa902 100644
--- a/libavfilter/vf_colorchannelmixer.c
+++ b/libavfilter/vf_colorchannelmixer.c
@@ -93,7 +93,8 @@ static int query_formats(AVFilterContext *ctx)
 return ff_set_common_formats(ctx, fmts_list);
 }
 
-static int filter_slice_rgba64(AVFilterContext *ctx, void *arg, int jobnr, int 
nb_jobs)
+static av_always_inline int filter_slice_rgba_packed(AVFilterContext *ctx, 
void *arg, int jobnr, int nb_jobs,
+ int have_alpha, int step)
 {
 ColorChannelMixerContext *s = ctx->priv;
 ThreadData *td = arg;
@@ -110,31 +111,31 @@ static int filter_slice_rgba64(AVFilterContext *ctx, void 
*arg, int jobnr, int n
 int i, j;
 
 for (i = slice_start; i < slice_end; i++) {
-const uint16_t *src = (const uint16_t *)srcrow;
-uint16_t *dst = (uint16_t *)dstrow;
+const uint8_t *src = srcrow;
+uint8_t *dst = dstrow;
 
-for (j = 0; j < out->width * 4; j += 4) {
-const uint16_t rin = src[j + roffset];
-const uint16_t gin = src[j + goffset];
-const uint16_t bin = src[j + boffset];
-const uint16_t ain = src[j + aoffset];
+for (j = 0; j < out->width * step; j += step) {
+const uint8_t rin = src[j + roffset];
+const uint8_t gin = src[j + goffset];
+const uint8_t bin = src[j + boffset];
+const uint8_t ain = src[j + aoffset];
 
-dst[j + roffset] = av_clip_uint16(s->lut[R][R][rin] +
-  s->lut[R][G][gin] +
-  s->lut[R][B][bin] +
-  s->lut[R][A][ain]);
-dst[j + goffset] = av_clip_uint16(s->lut[G][R][rin] +
-  s->lut[G][G][gin] +
-  s->lut[G][B][bin] +
-  s->lut[G][A][ain]);
-dst[j + boffset] = av_clip_uint16(s->lut[B][R][rin] +
-  s->lut[B][G][gin] +
-  s->lut[B][B][bin] +
-  s->lut[B][A][ain]);
-dst[j + aoffset] = av_clip_uint16(s->lut[A][R][rin] +
-  s->lut[A][G][gin] +
-  s->lut[A][B][bin] +
-  s->lut[A][A][ain]);
+dst[j + roffset] = av_clip_uint8(s->lut[R][R][rin] +
+ s->lut[R][G][gin] +
+ s->lut[R][B][bin]);
+dst[j + goffset] = av_clip_uint8(s->lut[G][R][rin] +
+ s->lut[G][G][gin] +
+ s->lut[G][B][bin]);
+dst[j + boffset] = av_clip_uint8(s->lut[B][R][rin] +
+ s->lut[B][G][gin] +
+ s->lut[B][B][bin]);
+if (have_alpha == 1) {
+dst[j + aoffset] = av_clip_uint8(s->lut[A][R][rin] +
+ s->lut[A][G][gin] +
+ s->lut[A][B][bin] +
+ s->lut[A][A][ain]);
+} else if (have_alpha == -1 && in != out)
+dst[j + aoffset] = 0;
 }
 
 srcrow += in->linesize[0];
@@ -144,7 +145,8 @@ static int filter_slice_rgba64(AVFilterContext *ctx, void 
*arg, int jobnr, int n
 return 0;
 }
 
-static int filter_slice_rgb48(AVFilterContext *ctx, void *arg, int jobnr, int 
nb_jobs)
+static av_always_inline int filter_slice_rgba16_packed(AVFilterContext *ctx, 
void *arg, int jobnr, int nb_jobs,
+   int have_alpha, int 
step)
 {
 ColorChannelMixerContext *s = ctx->priv;
 ThreadData *td = arg;
@@ -155,6 +157,7 @@ static int filter_slice_rgb48(AVFilterContext *ctx, void 
*arg, int jobnr, int nb
 const uint8_t roffset = s->rgba_map[R];
 const uint8_t goffset = s->rgba_map[G];
 const uint8_t boffset = s->rgba_map[B];
+const uint8_t aoffset = s->rgba_map[A];
 const uint8_t *srcrow = in->data[0] + slice_start * in->linesize[0];
 uint8_t *dstrow = ou

[FFmpeg-cvslog] mpegvideo: remove support for libxvid's RC system

2018-05-05 Thread Rostislav Pehlivanov
ffmpeg | branch: master | Rostislav Pehlivanov  | Tue May  
1 19:58:38 2018 +0100| [a1c6fc773f941fd6a6ef3f12f102a7902ae69453] | committer: 
Rostislav Pehlivanov

mpegvideo: remove support for libxvid's RC system

Signed-off-by: Rostislav Pehlivanov 

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

 MAINTAINERS|   1 -
 libavcodec/Makefile|   2 +-
 libavcodec/libxvid_rc.c| 164 -
 libavcodec/mpegvideo.h |  14 ++--
 libavcodec/mpegvideo_enc.c |  24 +--
 5 files changed, 6 insertions(+), 199 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index b61856243c..ca3f4e5a2f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -121,7 +121,6 @@ Generic Parts:
 motion* Michael Niedermayer
   rate control:
 ratecontrol.c   Michael Niedermayer
-libxvid_rc.cMichael Niedermayer
   simple IDCT:
 simple_idct.c, simple_idct.hMichael Niedermayer
   postprocessing:
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 663bdce4e4..3ab071a039 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -985,7 +985,7 @@ OBJS-$(CONFIG_LIBX262_ENCODER)+= libx264.o
 OBJS-$(CONFIG_LIBX264_ENCODER)+= libx264.o
 OBJS-$(CONFIG_LIBX265_ENCODER)+= libx265.o
 OBJS-$(CONFIG_LIBXAVS_ENCODER)+= libxavs.o
-OBJS-$(CONFIG_LIBXVID_ENCODER)+= libxvid.o libxvid_rc.o
+OBJS-$(CONFIG_LIBXVID_ENCODER)+= libxvid.o
 OBJS-$(CONFIG_LIBZVBI_TELETEXT_DECODER)   += libzvbi-teletextdec.o ass.o
 
 # parsers
diff --git a/libavcodec/libxvid_rc.c b/libavcodec/libxvid_rc.c
deleted file mode 100644
index 076c32c413..00
--- a/libavcodec/libxvid_rc.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Xvid rate control wrapper for lavc video encoders
- *
- * Copyright (c) 2006 Michael Niedermayer 
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-
-#if HAVE_IO_H
-#include 
-#endif
-
-#if HAVE_UNISTD_H
-#include 
-#endif
-
-#include 
-
-#include "libavutil/attributes.h"
-#include "libavutil/internal.h"
-
-#include "avcodec.h"
-#include "libxvid.h"
-#include "mpegvideo.h"
-
-av_cold int ff_xvid_rate_control_init(MpegEncContext *s)
-{
-char *tmp_name;
-int fd, i;
-xvid_plg_create_t xvid_plg_create = { 0 };
-xvid_plugin_2pass2_t xvid_2pass2  = { 0 };
-
-fd = avpriv_tempfile("xvidrc.", &tmp_name, 0, s->avctx);
-if (fd < 0) {
-av_log(s, AV_LOG_ERROR, "Can't create temporary pass2 file.\n");
-return fd;
-}
-
-for (i = 0; i < s->rc_context.num_entries; i++) {
-static const char frame_types[] = " ipbs";
-char tmp[256];
-RateControlEntry *rce;
-
-rce = &s->rc_context.entry[i];
-
-snprintf(tmp, sizeof(tmp), "%c %d %d %d %d %d %d\n",
- frame_types[rce->pict_type],
- (int) lrintf(rce->qscale / FF_QP2LAMBDA),
- rce->i_count, s->mb_num - rce->i_count - rce->skip_count,
- rce->skip_count,
- (rce->i_tex_bits + rce->p_tex_bits + rce->misc_bits + 7) / 8,
- (rce->header_bits + rce->mv_bits + 7) / 8);
-
-if (write(fd, tmp, strlen(tmp)) < 0) {
-int ret = AVERROR(errno);
-av_log(s, AV_LOG_ERROR, "Error %s writing 2pass logfile\n", 
av_err2str(ret));
-av_free(tmp_name);
-close(fd);
-return ret;
-}
-}
-
-close(fd);
-
-xvid_2pass2.version = XVID_MAKE_VERSION(1, 1, 0);
-xvid_2pass2.filename= tmp_name;
-xvid_2pass2.bitrate = s->avctx->bit_rate;
-xvid_2pass2.vbv_size= s->avctx->rc_buffer_size;
-xvid_2pass2.vbv_maxrate = s->avctx->rc_max_rate;
-xvid_2pass2.vbv_initial = s->avctx->rc_initial_buffer_occupancy;
-
-xvid_plg_create.version = XVID_MAKE_VERSION(1, 1, 0);
-xvid_plg_create.fbase   = s->avctx->time_base.den;
-xvid_plg_create.fincr   = s->avctx->time_base.num;
-xvid_plg_create.param   = &xvid_2pass2;
-
-if (xvid_plugin_2pass2(NULL, XVID_PLG_CREATE, &xvid_plg_create,
-   &s->rc_context.non_lavc_opaque) < 0) {

[FFmpeg-cvslog] dcaenc: fix segfault when attempting to encode with invalid samplerate

2018-05-05 Thread Rostislav Pehlivanov
ffmpeg | branch: master | Rostislav Pehlivanov  | Sat May  
5 18:42:53 2018 +0100| [c1b282dc74d801f943db282e89f7729e90897669] | committer: 
Rostislav Pehlivanov

dcaenc: fix segfault when attempting to encode with invalid samplerate

Signed-off-by: Rostislav Pehlivanov 

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

 libavcodec/dcaenc.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
index 186997c631..4b4ceeff05 100644
--- a/libavcodec/dcaenc.c
+++ b/libavcodec/dcaenc.c
@@ -152,8 +152,11 @@ static int subband_bufer_alloc(DCAEncContext *c)
 
 static void subband_bufer_free(DCAEncContext *c)
 {
-int32_t *bufer = c->subband[0][0] - DCA_ADPCM_COEFFS;
-av_freep(&bufer);
+if (c->subband[0][0]) {
+int32_t *bufer = c->subband[0][0] - DCA_ADPCM_COEFFS;
+av_free(bufer);
+c->subband[0][0] = NULL;
+}
 }
 
 static int encode_init(AVCodecContext *avctx)

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


[FFmpeg-cvslog] mpegvideo: add deprecated flags to the rc_strategy option

2018-05-05 Thread Rostislav Pehlivanov
ffmpeg | branch: master | Rostislav Pehlivanov  | Sat May  
5 20:14:43 2018 +0100| [d05c3b9ceeb9d00d4500c376448230e45f6ab108] | committer: 
Rostislav Pehlivanov

mpegvideo: add deprecated flags to the rc_strategy option

Forgotten with the commit which removed support for libxvid_rc.

Signed-off-by: Rostislav Pehlivanov 

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

 libavcodec/mpegvideo.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 8a5296e493..e16deb64e7 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -640,9 +640,9 @@ FF_MPV_OPT_CMP_FUNC, \
 {"lmax", "maximum Lagrange factor (VBR)",   
FF_MPV_OFFSET(lmax), AV_OPT_TYPE_INT, {.i64 = 31*FF_QP2LAMBDA }, 0, INT_MAX, 
FF_MPV_OPT_FLAGS },\
 {"ibias", "intra quant bias",   
FF_MPV_OFFSET(intra_quant_bias), AV_OPT_TYPE_INT, {.i64 = FF_DEFAULT_QUANT_BIAS 
}, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },   \
 {"pbias", "inter quant bias",   
FF_MPV_OFFSET(inter_quant_bias), AV_OPT_TYPE_INT, {.i64 = FF_DEFAULT_QUANT_BIAS 
}, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },   \
-{"rc_strategy", "ratecontrol method",   
FF_MPV_OFFSET(rc_strategy), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, 
FF_MPV_OPT_FLAGS, "rc_strategy" },   \
-{ "ffmpeg", "deprecated, does nothing", 0, AV_OPT_TYPE_CONST, { .i64 = 0 
}, 0, 0, FF_MPV_OPT_FLAGS, "rc_strategy" }, \
-{ "xvid",   "deprecated, does nothing", 0, AV_OPT_TYPE_CONST, { .i64 = 0 
}, 0, 0, FF_MPV_OPT_FLAGS, "rc_strategy" }, \
+{"rc_strategy", "ratecontrol method",   
FF_MPV_OFFSET(rc_strategy), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, 
FF_MPV_OPT_FLAGS | AV_OPT_FLAG_DEPRECATED, "rc_strategy" },   \
+{ "ffmpeg", "deprecated, does nothing", 0, AV_OPT_TYPE_CONST, { .i64 = 0 
}, 0, 0, FF_MPV_OPT_FLAGS | AV_OPT_FLAG_DEPRECATED, "rc_strategy" }, \
+{ "xvid",   "deprecated, does nothing", 0, AV_OPT_TYPE_CONST, { .i64 = 0 
}, 0, 0, FF_MPV_OPT_FLAGS | AV_OPT_FLAG_DEPRECATED, "rc_strategy" }, \
 {"motion_est", "motion estimation algorithm",   
FF_MPV_OFFSET(motion_est), AV_OPT_TYPE_INT, {.i64 = FF_ME_EPZS }, FF_ME_ZERO, 
FF_ME_XONE, FF_MPV_OPT_FLAGS, "motion_est" },   \
 { "zero", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_ZERO }, 0, 0, 
FF_MPV_OPT_FLAGS, "motion_est" }, \
 { "epzs", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_EPZS }, 0, 0, 
FF_MPV_OPT_FLAGS, "motion_est" }, \

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


[FFmpeg-cvslog] avfilter/af_amerge: port to activate API

2018-05-05 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri May  4 11:48:35 
2018 +0200| [ac86011b1fa74fada3fe8c3b9e89985bec0bc413] | committer: Paul B Mahol

avfilter/af_amerge: port to activate API

Signed-off-by: Paul B Mahol 

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

 libavfilter/af_amerge.c | 146 +++-
 1 file changed, 69 insertions(+), 77 deletions(-)

diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c
index 09c660ef49..9bed8e7127 100644
--- a/libavfilter/af_amerge.c
+++ b/libavfilter/af_amerge.c
@@ -31,8 +31,8 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/opt.h"
 #include "avfilter.h"
+#include "filters.h"
 #include "audio.h"
-#include "bufferqueue.h"
 #include "internal.h"
 
 #define SWR_CH_MAX 64
@@ -43,10 +43,7 @@ typedef struct AMergeContext {
 int route[SWR_CH_MAX]; /**< channels routing, see copy_samples */
 int bps;
 struct amerge_input {
-struct FFBufQueue queue;
 int nb_ch; /**< number of channels for the input */
-int nb_samples;
-int pos;
 } *in;
 } AMergeContext;
 
@@ -67,8 +64,6 @@ static av_cold void uninit(AVFilterContext *ctx)
 int i;
 
 for (i = 0; i < s->nb_inputs; i++) {
-if (s->in)
-ff_bufqueue_discard_all(&s->in[i].queue);
 if (ctx->input_pads)
 av_freep(&ctx->input_pads[i].name);
 }
@@ -183,21 +178,6 @@ static int config_output(AVFilterLink *outlink)
 return 0;
 }
 
-static int request_frame(AVFilterLink *outlink)
-{
-AVFilterContext *ctx = outlink->src;
-AMergeContext *s = ctx->priv;
-int i, ret;
-
-for (i = 0; i < s->nb_inputs; i++)
-if (!s->in[i].nb_samples ||
-/* detect EOF immediately */
-(ctx->inputs[i]->status_in && !ctx->inputs[i]->status_out))
-if ((ret = ff_request_frame(ctx->inputs[i])) < 0)
-return ret;
-return 0;
-}
-
 /**
  * Copy samples from several input streams to one output stream.
  * @param nb_inputs number of inputs
@@ -235,90 +215,103 @@ static inline void copy_samples(int nb_inputs, struct 
amerge_input in[],
 }
 }
 
-static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
+static void free_frames(int nb_inputs, AVFrame **input_frames)
+{
+int i;
+for (i = 0; i < nb_inputs; i++)
+av_frame_free(&input_frames[i]);
+}
+
+static int try_push_frame(AVFilterContext *ctx, int nb_samples)
 {
-AVFilterContext *ctx = inlink->dst;
 AMergeContext *s = ctx->priv;
-AVFilterLink *const outlink = ctx->outputs[0];
-int input_number;
-int nb_samples, ns, i;
-AVFrame *outbuf, *inbuf[SWR_CH_MAX];
-uint8_t *ins[SWR_CH_MAX], *outs;
-
-for (input_number = 0; input_number < s->nb_inputs; input_number++)
-if (inlink == ctx->inputs[input_number])
-break;
-av_assert1(input_number < s->nb_inputs);
-if (ff_bufqueue_is_full(&s->in[input_number].queue)) {
-av_frame_free(&insamples);
-return AVERROR(ENOMEM);
+AVFilterLink *outlink = ctx->outputs[0];
+int i, ret;
+AVFrame *outbuf, *inbuf[SWR_CH_MAX] = { NULL };
+uint8_t *outs, *ins[SWR_CH_MAX];
+
+for (i = 0; i < ctx->nb_inputs; i++) {
+ret = ff_inlink_consume_samples(ctx->inputs[i], nb_samples, 
nb_samples, &inbuf[i]);
+if (ret < 0) {
+free_frames(i, inbuf);
+return ret;
+}
+ins[i] = inbuf[i]->data[0];
 }
-ff_bufqueue_add(ctx, &s->in[input_number].queue, 
av_frame_clone(insamples));
-s->in[input_number].nb_samples += insamples->nb_samples;
-av_frame_free(&insamples);
-nb_samples = s->in[0].nb_samples;
-for (i = 1; i < s->nb_inputs; i++)
-nb_samples = FFMIN(nb_samples, s->in[i].nb_samples);
-if (!nb_samples)
-return 0;
 
 outbuf = ff_get_audio_buffer(ctx->outputs[0], nb_samples);
-if (!outbuf)
+if (!outbuf) {
+free_frames(s->nb_inputs, inbuf);
 return AVERROR(ENOMEM);
-outs = outbuf->data[0];
-for (i = 0; i < s->nb_inputs; i++) {
-inbuf[i] = ff_bufqueue_peek(&s->in[i].queue, 0);
-ins[i] = inbuf[i]->data[0] +
- s->in[i].pos * s->in[i].nb_ch * s->bps;
 }
-av_frame_copy_props(outbuf, inbuf[0]);
-outbuf->pts = inbuf[0]->pts == AV_NOPTS_VALUE ? AV_NOPTS_VALUE :
-  inbuf[0]->pts +
-  av_rescale_q(s->in[0].pos,
-   av_make_q(1, ctx->inputs[0]->sample_rate),
-   ctx->outputs[0]->time_base);
+
+outs = outbuf->data[0];
+outbuf->pts = inbuf[0]->pts;
 
 outbuf->nb_samples = nb_samples;
 outbuf->channel_layout = outlink->channel_layout;
 outbuf->channels   = outlink->channels;
 
 while (nb_samples) {
-ns = nb_samples;
-for (i = 0; i < s->nb_inputs; i++)
-ns = FFMIN(ns, inbuf[i]->nb_samples - s->

[FFmpeg-cvslog] avfilter: forward status back in some filters that missed it

2018-05-05 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat May  5 21:24:41 
2018 +0200| [20a3c4f606e7b0bc24cf2116f716317d6826bdf8] | committer: Paul B Mahol

avfilter: forward status back in some filters that missed it

Signed-off-by: Paul B Mahol 

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

 libavfilter/af_afade.c | 2 ++
 libavfilter/af_amix.c  | 2 ++
 libavfilter/af_join.c  | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c
index 285b5b6557..d823e82d39 100644
--- a/libavfilter/af_afade.c
+++ b/libavfilter/af_afade.c
@@ -441,6 +441,8 @@ static int activate(AVFilterContext *ctx)
 int ret = 0, nb_samples, status;
 int64_t pts;
 
+FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, ctx);
+
 if (s->crossfade_is_over) {
 ret = ff_inlink_consume_frame(ctx->inputs[1], &in);
 if (ret < 0) {
diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c
index 46f1bf63d7..ec2556f920 100644
--- a/libavfilter/af_amix.c
+++ b/libavfilter/af_amix.c
@@ -425,6 +425,8 @@ static int activate(AVFilterContext *ctx)
 AVFrame *buf = NULL;
 int i, ret;
 
+FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, ctx);
+
 for (i = 0; i < s->nb_inputs; i++) {
 AVFilterLink *inlink = ctx->inputs[i];
 
diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c
index 4f86e13558..930c9e48e7 100644
--- a/libavfilter/af_join.c
+++ b/libavfilter/af_join.c
@@ -472,6 +472,8 @@ static int activate(AVFilterContext *ctx)
 int nb_samples = 0;
 int64_t pts;
 
+FF_FILTER_FORWARD_STATUS_BACK_ALL(ctx->outputs[0], ctx);
+
 if (!s->input_frames[0]) {
 ret = ff_inlink_consume_frame(ctx->inputs[0], &s->input_frames[0]);
 if (ret < 0) {

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


[FFmpeg-cvslog] avutil: add gray14 pixel format

2018-05-05 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu May  3 22:15:53 
2018 +0200| [aef93c6aa57234c21cec527e8cd368acb96f7d2f] | committer: Paul B Mahol

avutil: add gray14 pixel format

Signed-off-by: Paul B Mahol 

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

 libavutil/pixdesc.c | 21 +
 libavutil/pixfmt.h  |  4 
 2 files changed, 25 insertions(+)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index df03b3372d..ff5c20d50e 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -611,6 +611,27 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 },
 .alias = "y12le",
 },
+[AV_PIX_FMT_GRAY14BE] = {
+.name = "gray14be",
+.nb_components = 1,
+.log2_chroma_w = 0,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 2, 0, 0, 14, 1, 13, 1 },   /* Y */
+},
+.flags = AV_PIX_FMT_FLAG_BE,
+.alias = "y14be",
+},
+[AV_PIX_FMT_GRAY14LE] = {
+.name = "gray14le",
+.nb_components = 1,
+.log2_chroma_w = 0,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 2, 0, 0, 14, 1, 13, 1 },   /* Y */
+},
+.alias = "y14le",
+},
 [AV_PIX_FMT_GRAY16BE] = {
 .name = "gray16be",
 .nb_components = 1,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index e184a56672..aea008bbdc 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -330,6 +330,9 @@ enum AVPixelFormat {
  */
 AV_PIX_FMT_OPENCL,
 
+AV_PIX_FMT_GRAY14BE,   ///

[FFmpeg-cvslog] avfilter/drawutils: support gray14

2018-05-05 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat May  5 21:50:22 
2018 +0200| [72b29c02f4ba0609da45433eb9706b38ac583a01] | committer: Paul B Mahol

avfilter/drawutils: support gray14

Signed-off-by: Paul B Mahol 

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

 libavfilter/drawutils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c
index 650ef25aba..5f4cb548f0 100644
--- a/libavfilter/drawutils.c
+++ b/libavfilter/drawutils.c
@@ -271,7 +271,8 @@ void ff_draw_color(FFDrawContext *draw, FFDrawColor *color, 
const uint8_t rgba[4
draw->format == AV_PIX_FMT_GRAY16LE || draw->format == 
AV_PIX_FMT_YA16LE ||
draw->format == AV_PIX_FMT_GRAY9LE  ||
draw->format == AV_PIX_FMT_GRAY10LE ||
-   draw->format == AV_PIX_FMT_GRAY12LE) {
+   draw->format == AV_PIX_FMT_GRAY12LE ||
+   draw->format == AV_PIX_FMT_GRAY14LE) {
 const AVPixFmtDescriptor *desc = draw->desc;
 color->comp[0].u8[0] = RGB_TO_Y_CCIR(rgba[0], rgba[1], rgba[2]);
 EXPAND(0);

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


[FFmpeg-cvslog] swscale: add gray14 support

2018-05-05 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu May  3 22:19:38 
2018 +0200| [b9dd058f7a9df0119ad1cb7a0b115fbfa77d7cf4] | committer: Paul B Mahol

swscale: add gray14 support

Signed-off-by: Paul B Mahol 

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

 libavcodec/raw.c | 2 ++
 libavformat/nut.c| 3 +++
 libswscale/input.c   | 2 ++
 libswscale/swscale_unscaled.c| 1 +
 libswscale/utils.c   | 4 
 tests/ref/fate/filter-pixdesc-gray14be   | 1 +
 tests/ref/fate/filter-pixdesc-gray14le   | 1 +
 tests/ref/fate/filter-pixfmts-copy   | 2 ++
 tests/ref/fate/filter-pixfmts-crop   | 2 ++
 tests/ref/fate/filter-pixfmts-field  | 2 ++
 tests/ref/fate/filter-pixfmts-fieldorder | 2 ++
 tests/ref/fate/filter-pixfmts-hflip  | 2 ++
 tests/ref/fate/filter-pixfmts-il | 2 ++
 tests/ref/fate/filter-pixfmts-null   | 2 ++
 tests/ref/fate/filter-pixfmts-pad| 1 +
 tests/ref/fate/filter-pixfmts-scale  | 2 ++
 tests/ref/fate/filter-pixfmts-transpose  | 2 ++
 tests/ref/fate/filter-pixfmts-vflip  | 2 ++
 18 files changed, 35 insertions(+)

diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index 8da2a9735e..d731c087d1 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -125,6 +125,8 @@ const PixelFormatTag ff_raw_pix_fmt_tags[] = {
 { AV_PIX_FMT_GRAY10BE,MKTAG(10 ,  0 , '1', 'Y') },
 { AV_PIX_FMT_GRAY12LE,MKTAG('Y', '1',  0 , 12 ) },
 { AV_PIX_FMT_GRAY12BE,MKTAG(12 ,  0 , '1', 'Y') },
+{ AV_PIX_FMT_GRAY14LE,MKTAG('Y', '1',  0 , 14 ) },
+{ AV_PIX_FMT_GRAY14BE,MKTAG(14 ,  0 , '1', 'Y') },
 { AV_PIX_FMT_GRAY16LE,MKTAG('Y', '1',  0 , 16 ) },
 { AV_PIX_FMT_GRAY16BE,MKTAG(16 ,  0 , '1', 'Y') },
 { AV_PIX_FMT_YUV420P9LE,  MKTAG('Y', '3', 11 ,  9 ) },
diff --git a/libavformat/nut.c b/libavformat/nut.c
index 592fe4dc28..e65f42438b 100644
--- a/libavformat/nut.c
+++ b/libavformat/nut.c
@@ -154,6 +154,9 @@ const AVCodecTag ff_nut_video_tags[] = {
 { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4',   0,  16) },
 { AV_CODEC_ID_RAWVIDEO, MKTAG(16,0, '4', 'Y') },
 
+{ AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '1',   0,  14) },
+{ AV_CODEC_ID_RAWVIDEO, MKTAG(14,0, '1', 'Y') },
+
 { AV_CODEC_ID_RAWVIDEO, MKTAG('G', '3',   0,   8) },
 
 { AV_CODEC_ID_RAWVIDEO, MKTAG('G', '3',   0,   9) },
diff --git a/libswscale/input.c b/libswscale/input.c
index bb2f4933ec..3fd3a5d81e 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -1365,6 +1365,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_GRAY9LE:
 case AV_PIX_FMT_GRAY10LE:
 case AV_PIX_FMT_GRAY12LE:
+case AV_PIX_FMT_GRAY14LE:
 case AV_PIX_FMT_GRAY16LE:
 
 case AV_PIX_FMT_P016LE:
@@ -1404,6 +1405,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_GRAY9BE:
 case AV_PIX_FMT_GRAY10BE:
 case AV_PIX_FMT_GRAY12BE:
+case AV_PIX_FMT_GRAY14BE:
 case AV_PIX_FMT_GRAY16BE:
 
 case AV_PIX_FMT_P016BE:
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 13f9cd83e3..6480070cbf 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -1852,6 +1852,7 @@ void ff_get_unscaled_swscale(SwsContext *c)
 IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY9)  ||
 IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY10) ||
 IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY12) ||
+IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY14) ||
 IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY16) ||
 IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YA16)   ||
 IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_AYUV64) ||
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 98a6b99476..61b47182f8 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -137,6 +137,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
 [AV_PIX_FMT_GRAY10LE]= { 1, 1 },
 [AV_PIX_FMT_GRAY12BE]= { 1, 1 },
 [AV_PIX_FMT_GRAY12LE]= { 1, 1 },
+[AV_PIX_FMT_GRAY14BE]= { 1, 1 },
+[AV_PIX_FMT_GRAY14LE]= { 1, 1 },
 [AV_PIX_FMT_GRAY16BE]= { 1, 1 },
 [AV_PIX_FMT_GRAY16LE]= { 1, 1 },
 [AV_PIX_FMT_YUV440P] = { 1, 1 },
@@ -1024,6 +1026,8 @@ static int handle_jpeg(enum AVPixelFormat *format)
 case AV_PIX_FMT_GRAY10BE:
 case AV_PIX_FMT_GRAY12LE:
 case AV_PIX_FMT_GRAY12BE:
+case AV_PIX_FMT_GRAY14LE:
+case AV_PIX_FMT_GRAY14BE:
 case AV_PIX_FMT_GRAY16LE:
 case AV_PIX_FMT_GRAY16BE:
 case AV_PIX_FMT_YA16BE:
diff --git a/tests/ref/fate/filter-pixdesc-gray14be 
b/tests/ref/fate/filter-pixdesc-gray14be
new file mode 100644
index 00..dc7836a10e
--- /dev/null
+++ b/tests/ref/fate/filte

[FFmpeg-cvslog] avfilter/vf_extractplanes: add support for extracting planes with 14 depth

2018-05-05 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu May  3 22:48:16 
2018 +0200| [41ebbae9dd65edbdaa1006a685c98e3016d9c48e] | committer: Paul B Mahol

avfilter/vf_extractplanes: add support for extracting planes with 14 depth

Signed-off-by: Paul B Mahol 

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

 libavfilter/vf_extractplanes.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavfilter/vf_extractplanes.c b/libavfilter/vf_extractplanes.c
index fc676a25fa..cbd0c422a2 100644
--- a/libavfilter/vf_extractplanes.c
+++ b/libavfilter/vf_extractplanes.c
@@ -165,6 +165,8 @@ static int query_formats(AVFilterContext *ctx)
 static const enum AVPixelFormat out10be_pixfmts[] = { AV_PIX_FMT_GRAY10BE, 
AV_PIX_FMT_NONE };
 static const enum AVPixelFormat out12le_pixfmts[] = { AV_PIX_FMT_GRAY12LE, 
AV_PIX_FMT_NONE };
 static const enum AVPixelFormat out12be_pixfmts[] = { AV_PIX_FMT_GRAY12BE, 
AV_PIX_FMT_NONE };
+static const enum AVPixelFormat out14le_pixfmts[] = { AV_PIX_FMT_GRAY14LE, 
AV_PIX_FMT_NONE };
+static const enum AVPixelFormat out14be_pixfmts[] = { AV_PIX_FMT_GRAY14BE, 
AV_PIX_FMT_NONE };
 static const enum AVPixelFormat out16le_pixfmts[] = { AV_PIX_FMT_GRAY16LE, 
AV_PIX_FMT_NONE };
 static const enum AVPixelFormat out16be_pixfmts[] = { AV_PIX_FMT_GRAY16BE, 
AV_PIX_FMT_NONE };
 const enum AVPixelFormat *out_pixfmts, *in_pixfmts;
@@ -212,6 +214,10 @@ static int query_formats(AVFilterContext *ctx)
 out_pixfmts = out12le_pixfmts;
 else if (be && depth == 12)
 out_pixfmts = out12be_pixfmts;
+else if (!be && depth == 14)
+out_pixfmts = out14le_pixfmts;
+else if (be && depth == 14)
+out_pixfmts = out14be_pixfmts;
 else if (be)
 out_pixfmts = out16be_pixfmts;
 else

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


[FFmpeg-cvslog] fate: update pad pixfmt test

2018-05-05 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat May  5 22:05:07 
2018 +0200| [a26367493c13058c5021ddef318da726b57ff4a2] | committer: Paul B Mahol

fate: update pad pixfmt test

Signed-off-by: Paul B Mahol 

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

 tests/ref/fate/filter-pixfmts-pad | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/ref/fate/filter-pixfmts-pad 
b/tests/ref/fate/filter-pixfmts-pad
index 4f16029551..71f5ddf100 100644
--- a/tests/ref/fate/filter-pixfmts-pad
+++ b/tests/ref/fate/filter-pixfmts-pad
@@ -18,7 +18,7 @@ gbrp9le 9e827f438e081d334a6cae7e282698b0
 grayddc663a0491df3959d9c5795dceaa72e
 gray10lee6559c1c8c05ce89f44b465573db44e7
 gray12le1e6c6757658c7ae8a1f830432c5b7722
-gray14le1a25a0a3f064297b79d83c591898e638
+gray14leaf3f2f911c71cb34a8179a3291b5c90f
 gray16le468bda6155bdc7a7a20c34d6e599fd16
 gray9le f8f3dfe31ca5fcba828285bceefdab9a
 nv12381574979cb04be10c9168540310afad

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


[FFmpeg-cvslog] fate: update fate-sws-pixdesc-query reference file

2018-05-05 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat May  5 19:20:29 
2018 -0300| [08032331ac4ca7a3de7d0e0428bd35f0d2e954be] | committer: James Almer

fate: update fate-sws-pixdesc-query reference file

Signed-off-by: James Almer 

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

 libavfilter/vf_srcnn.c   | 4 +++-
 tests/ref/fate/sws-pixdesc-query | 5 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_srcnn.c b/libavfilter/vf_srcnn.c
index d9b4891f7f..dace2b99b5 100644
--- a/libavfilter/vf_srcnn.c
+++ b/libavfilter/vf_srcnn.c
@@ -28,7 +28,9 @@
 #include "formats.h"
 #include "internal.h"
 #include "libavutil/opt.h"
-#include "unistd.h"
+#if HAVE_UNISTD_H
+#include 
+#endif
 #include "vf_srcnn.h"
 #include "libavformat/avio.h"
 
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index 0adfdcaf98..8071ec484d 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -49,6 +49,8 @@ isNBPS:
   gray10le
   gray12be
   gray12le
+  gray14be
+  gray14le
   gray9be
   gray9le
   nv20be
@@ -121,6 +123,7 @@ isBE:
   gbrpf32be
   gray10be
   gray12be
+  gray14be
   gray16be
   gray9be
   nv20be
@@ -403,6 +406,8 @@ Gray:
   gray10le
   gray12be
   gray12le
+  gray14be
+  gray14le
   gray16be
   gray16le
   gray9be

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