[FFmpeg-cvslog] avcodec/wmaprodec: reset offsets when error happens

2017-03-20 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Mar 20 15:05:01 
2017 +0100| [ce818d90bdb28d8591e6b81e020d1e7f87536649] | committer: Paul B Mahol

avcodec/wmaprodec: reset offsets when error happens

Fixes #6250.

Signed-off-by: Paul B Mahol 

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

 libavcodec/wmaprodec.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 1ad1e23..5b1fe40 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -1760,6 +1760,10 @@ static int xma_decode_packet(AVCodecContext *avctx, void 
*data,
 memcpy(&s->samples[s->current_stream * 2 + 
1][s->offset[s->current_stream] * 512],
s->frames[s->current_stream]->extended_data[1], 512 * 4);
 s->offset[s->current_stream]++;
+} else if (ret < 0) {
+memset(s->offset, 0, sizeof(s->offset));
+s->current_stream = 0;
+return ret;
 }
 
 if (s->xma[s->current_stream].packet_done ||

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


[FFmpeg-cvslog] avcodec/dnxhd_parser: take into account compressed frame size and skip it

2017-03-24 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Mar 20 22:47:48 
2017 +0100| [e1940d2458353943e2fab6bdb87d2278077e22a5] | committer: Paul B Mahol

avcodec/dnxhd_parser: take into account compressed frame size and skip it

Fixes #6214 and vsynth1-dnxhd-720p-hr-lb.

Signed-off-by: Paul B Mahol 

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

 libavcodec/dnxhd_parser.c | 65 +++
 tests/ref/vsynth/vsynth1-dnxhd-720p-hr-lb |  4 +-
 2 files changed, 60 insertions(+), 9 deletions(-)

diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c
index 033b8ee..4f9bbce 100644
--- a/libavcodec/dnxhd_parser.c
+++ b/libavcodec/dnxhd_parser.c
@@ -31,8 +31,24 @@ typedef struct {
 ParseContext pc;
 int interlaced;
 int cur_field; /* first field is 0, second is 1 */
+int cur_byte;
+int remaining;
+int w, h;
 } DNXHDParserContext;
 
+static int dnxhd_get_hr_frame_size(int cid, int w, int h)
+{
+int result, i = ff_dnxhd_get_cid_table(cid);
+
+if (i < 0)
+return i;
+
+result = ((h + 15) / 16) * ((w + 15) / 16) * 
ff_dnxhd_cid_table[i].packet_scale.num / ff_dnxhd_cid_table[i].packet_scale.den;
+result = (result + 2048) / 4096 * 4096;
+
+return FFMAX(result, 8192);
+}
+
 static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
 const uint8_t *buf, int buf_size)
 {
@@ -51,30 +67,65 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
 pic_found = 1;
 interlaced = (state&2)>>1; /* byte following the 5-byte header 
prefix */
 cur_field = state&1;
+dctx->cur_byte = 0;
+dctx->remaining = 0;
 break;
 }
 }
 }
 
-if (pic_found) {
+if (pic_found && !dctx->remaining) {
 if (!buf_size) /* EOF considered as end of frame */
 return 0;
 for (; i < buf_size; i++) {
+dctx->cur_byte++;
 state = (state << 8) | buf[i];
-if (ff_dnxhd_check_header_prefix(state & 0xff00LL) != 0) {
-if (!interlaced || dctx->cur_field) {
+
+if (dctx->cur_byte == 24) {
+dctx->h = (state >> 32) & 0x;
+} else if (dctx->cur_byte == 26) {
+dctx->w = (state >> 32) & 0x;
+} else if (dctx->cur_byte == 42) {
+int cid = (state >> 32) & 0x;
+
+if (cid <= 0)
+continue;
+
+dctx->remaining = avpriv_dnxhd_get_frame_size(cid);
+if (dctx->remaining <= 0) {
+dctx->remaining = dnxhd_get_hr_frame_size(cid, dctx->w, 
dctx->h);
+if (dctx->remaining <= 0)
+return dctx->remaining;
+}
+if (buf_size - i >= dctx->remaining && (!dctx->interlaced || 
dctx->cur_field)) {
+int remaining = dctx->remaining;
+
 pc->frame_start_found = 0;
 pc->state64 = -1;
 dctx->interlaced = interlaced;
 dctx->cur_field = 0;
-return i - 5;
+dctx->cur_byte = 0;
+dctx->remaining = 0;
+return remaining;
 } else {
-/* continue, to get the second field */
-dctx->interlaced = interlaced = (state&2)>>1;
-dctx->cur_field = cur_field = state&1;
+dctx->remaining -= buf_size;
 }
 }
 }
+} else if (pic_found) {
+if (dctx->remaining > buf_size) {
+dctx->remaining -= buf_size;
+} else {
+int remaining = dctx->remaining;
+
+pc->frame_start_found = 0;
+pc->state64 = -1;
+dctx->interlaced = interlaced;
+dctx->cur_field = 0;
+dctx->cur_byte = 0;
+dctx->remaining = 0;
+return remaining;
+}
 }
 pc->frame_start_found = pic_found;
 pc->state64 = state;
diff --git a/tests/ref/vsynth/vsynth1-dnxhd-720p-hr-lb 
b/tests/ref/vsynth/vsynth1-dnxhd-720p-hr-lb
index 3490d4a..27e5931 100644
--- a/tests/ref/vsynth/vsynth1-dnxhd-720p-hr-lb
+++ b/tests/ref/vsynth/vsynth1-dnxhd-720p-hr-lb
@@ -1,4 +1,4 @@
 08cbfe9b9f671cdb9dddc9307121d107 
*tests/data/fate/vsynth1-dnxhd-720p-hr-lb.dnxhd
 409600 tests/data/fate/vsynth1-dnxhd-720p-hr-lb.dnxhd
-22eb87f0f8a50278355006fef70073a9 
*tests/data/fate/vsynth1-dnxhd-720p-hr-lb.out.rawvideo
-stddev:7.49 PSNR: 30.63 MAXDIFF:   64 bytes:  7603200/   608256
+77e510e35

[FFmpeg-cvslog] avcodec/dnxhd_parser: take into account compressed frame size and skip it

2017-03-24 Thread Paul B Mahol
ffmpeg | branch: release/3.2 | Paul B Mahol  | Mon Mar 20 
22:47:48 2017 +0100| [a60e66516233f3c84545d90d8cfd64c1cb9f0a8d] | committer: 
Carl Eugen Hoyos

avcodec/dnxhd_parser: take into account compressed frame size and skip it

Fixes #6214 and vsynth1-dnxhd-720p-hr-lb.

Signed-off-by: Paul B Mahol 
(cherry picked from commit e1940d2458353943e2fab6bdb87d2278077e22a5)

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

 libavcodec/dnxhd_parser.c | 65 +++
 tests/ref/vsynth/vsynth1-dnxhd-720p-hr-lb |  4 +-
 2 files changed, 60 insertions(+), 9 deletions(-)

diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c
index 033b8ee..4f9bbce 100644
--- a/libavcodec/dnxhd_parser.c
+++ b/libavcodec/dnxhd_parser.c
@@ -31,8 +31,24 @@ typedef struct {
 ParseContext pc;
 int interlaced;
 int cur_field; /* first field is 0, second is 1 */
+int cur_byte;
+int remaining;
+int w, h;
 } DNXHDParserContext;
 
+static int dnxhd_get_hr_frame_size(int cid, int w, int h)
+{
+int result, i = ff_dnxhd_get_cid_table(cid);
+
+if (i < 0)
+return i;
+
+result = ((h + 15) / 16) * ((w + 15) / 16) * 
ff_dnxhd_cid_table[i].packet_scale.num / ff_dnxhd_cid_table[i].packet_scale.den;
+result = (result + 2048) / 4096 * 4096;
+
+return FFMAX(result, 8192);
+}
+
 static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
 const uint8_t *buf, int buf_size)
 {
@@ -51,30 +67,65 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
 pic_found = 1;
 interlaced = (state&2)>>1; /* byte following the 5-byte header 
prefix */
 cur_field = state&1;
+dctx->cur_byte = 0;
+dctx->remaining = 0;
 break;
 }
 }
 }
 
-if (pic_found) {
+if (pic_found && !dctx->remaining) {
 if (!buf_size) /* EOF considered as end of frame */
 return 0;
 for (; i < buf_size; i++) {
+dctx->cur_byte++;
 state = (state << 8) | buf[i];
-if (ff_dnxhd_check_header_prefix(state & 0xff00LL) != 0) {
-if (!interlaced || dctx->cur_field) {
+
+if (dctx->cur_byte == 24) {
+dctx->h = (state >> 32) & 0x;
+} else if (dctx->cur_byte == 26) {
+dctx->w = (state >> 32) & 0x;
+} else if (dctx->cur_byte == 42) {
+int cid = (state >> 32) & 0x;
+
+if (cid <= 0)
+continue;
+
+dctx->remaining = avpriv_dnxhd_get_frame_size(cid);
+if (dctx->remaining <= 0) {
+dctx->remaining = dnxhd_get_hr_frame_size(cid, dctx->w, 
dctx->h);
+if (dctx->remaining <= 0)
+return dctx->remaining;
+}
+if (buf_size - i >= dctx->remaining && (!dctx->interlaced || 
dctx->cur_field)) {
+int remaining = dctx->remaining;
+
 pc->frame_start_found = 0;
 pc->state64 = -1;
 dctx->interlaced = interlaced;
 dctx->cur_field = 0;
-return i - 5;
+dctx->cur_byte = 0;
+dctx->remaining = 0;
+return remaining;
 } else {
-/* continue, to get the second field */
-dctx->interlaced = interlaced = (state&2)>>1;
-dctx->cur_field = cur_field = state&1;
+dctx->remaining -= buf_size;
 }
 }
 }
+} else if (pic_found) {
+if (dctx->remaining > buf_size) {
+dctx->remaining -= buf_size;
+} else {
+int remaining = dctx->remaining;
+
+pc->frame_start_found = 0;
+pc->state64 = -1;
+dctx->interlaced = interlaced;
+dctx->cur_field = 0;
+dctx->cur_byte = 0;
+dctx->remaining = 0;
+return remaining;
+}
 }
 pc->frame_start_found = pic_found;
 pc->state64 = state;
diff --git a/tests/ref/vsynth/vsynth1-dnxhd-720p-hr-lb 
b/tests/ref/vsynth/vsynth1-dnxhd-720p-hr-lb
index 3490d4a..27e5931 100644
--- a/tests/ref/vsynth/vsynth1-dnxhd-720p-hr-lb
+++ b/tests/ref/vsynth/vsynth1-dnxhd-720p-hr-lb
@@ -1,4 +1,4 @@
 08cbfe9b9f671cdb9dddc9307121d107 
*tests/data/fate/vsynth1-dnxhd-720p-hr-lb.dnxhd
 409600 tests/data/fate/vsynth1-dnxhd-720p-hr-lb.dnxhd
-22eb87f0f8a50278355006fef70073a9 
*tests/data/fate/vsynth1-dnxhd-720p-hr-lb.out.rawvi

[FFmpeg-cvslog] avcodec/dnxhdenc: DNxHR 444 and HQX support

2017-04-01 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Mar 25 20:19:26 
2017 +0100| [f078bc4c5e6675a93166a7e5b23feb5b04ac9320] | committer: Paul B Mahol

avcodec/dnxhdenc: DNxHR 444 and HQX support

Signed-off-by: Paul B Mahol 

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

 libavcodec/dnxhdenc.c | 280 ++
 libavcodec/dnxhdenc.h |   6 +-
 2 files changed, 216 insertions(+), 70 deletions(-)

diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 33f25fb..7a889b6 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -112,6 +112,65 @@ void dnxhd_10bit_get_pixels_8x4_sym(int16_t *av_restrict 
block,
 memcpy(block + 4 * 8, pixels + 3 * line_size, 8 * sizeof(*block));
 }
 
+static int dnxhd_10bit_dct_quantize_444(MpegEncContext *ctx, int16_t *block,
+int n, int qscale, int *overflow)
+{
+int i, j, level, last_non_zero, start_i;
+const int *qmat;
+const uint8_t *scantable= ctx->intra_scantable.scantable;
+int bias;
+int max = 0;
+unsigned int threshold1, threshold2;
+
+ctx->fdsp.fdct(block);
+
+block[0] = (block[0] + 2) >> 2;
+start_i = 1;
+last_non_zero = 0;
+qmat = n < 4 ? ctx->q_intra_matrix[qscale] : 
ctx->q_chroma_intra_matrix[qscale];
+bias= ctx->intra_quant_bias * (1 << (16 - 8));
+threshold1 = (1 << 16) - bias - 1;
+threshold2 = (threshold1 << 1);
+
+for (i = 63; i >= start_i; i--) {
+j = scantable[i];
+level = block[j] * qmat[j];
+
+if (((unsigned)(level + threshold1)) > threshold2) {
+last_non_zero = i;
+break;
+} else{
+block[j]=0;
+}
+}
+
+for (i = start_i; i <= last_non_zero; i++) {
+j = scantable[i];
+level = block[j] * qmat[j];
+
+if (((unsigned)(level + threshold1)) > threshold2) {
+if (level > 0) {
+level = (bias + level) >> 16;
+block[j] = level;
+} else{
+level = (bias - level) >> 16;
+block[j] = -level;
+}
+max |= level;
+} else {
+block[j] = 0;
+}
+}
+*overflow = ctx->max_qcoeff < max; //overflow might have happened
+
+/* we need this permutation so that we correct the IDCT, we only permute 
the !=0 elements */
+if (ctx->idsp.perm_type != FF_IDCT_PERM_NONE)
+ff_block_permute(block, ctx->idsp.idct_permutation,
+ scantable, last_non_zero);
+
+return last_non_zero;
+}
+
 static int dnxhd_10bit_dct_quantize(MpegEncContext *ctx, int16_t *block,
 int n, int qscale, int *overflow)
 {
@@ -146,7 +205,7 @@ static int dnxhd_10bit_dct_quantize(MpegEncContext *ctx, 
int16_t *block,
 static av_cold int dnxhd_init_vlc(DNXHDEncContext *ctx)
 {
 int i, j, level, run;
-int max_level = 1 << (ctx->cid_table->bit_depth + 2);
+int max_level = 1 << (ctx->bit_depth + 2);
 
 FF_ALLOCZ_ARRAY_OR_GOTO(ctx->m.avctx, ctx->vlc_codes,
   max_level, 4 * sizeof(*ctx->vlc_codes), fail);
@@ -223,7 +282,7 @@ static av_cold int dnxhd_init_qmat(DNXHDEncContext *ctx, 
int lbias, int cbias)
   (ctx->m.avctx->qmax + 1), 64 * 2 * sizeof(uint16_t),
   fail);
 
-if (ctx->cid_table->bit_depth == 8) {
+if (ctx->bit_depth == 8) {
 for (i = 1; i < 64; i++) {
 int j = ctx->m.idsp.idct_permutation[ff_zigzag_direct[i]];
 weight_matrix[j] = ctx->cid_table->luma_weight[i];
@@ -309,17 +368,20 @@ static int dnxhd_get_hr_frame_size(const CIDEntry* 
profile, int mb_num)
   result = (result + 2048) / 4096 * 4096;
   return FFMAX(result, 8192);
 }
+
 static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
 {
 DNXHDEncContext *ctx = avctx->priv_data;
-int i, index, bit_depth, ret;
+int i, index, ret;
 
 switch (avctx->pix_fmt) {
 case AV_PIX_FMT_YUV422P:
-bit_depth = 8;
+ctx->bit_depth = 8;
 break;
 case AV_PIX_FMT_YUV422P10:
-bit_depth = 10;
+case AV_PIX_FMT_YUV444P10:
+case AV_PIX_FMT_GBRP10:
+ctx->bit_depth = 10;
 break;
 default:
 av_log(avctx, AV_LOG_ERROR,
@@ -327,15 +389,32 @@ static av_cold int dnxhd_encode_init(AVCodecContext 
*avctx)
 return AVERROR(EINVAL);
 }
 
-if (ctx->profile == FF_PROFILE_DNXHR_444 ||
-ctx->profile == FF_PROFILE_DNXHR_HQX) {
-avpriv_report_missing_feature(avctx,
-   "dnxhr_444 or dnxhr_hqx profile");
-return AVERROR_PATCHWELCOME;
+if ((ctx->profile == FF_PROFILE_DNXHR_444 && (avctx->pix_fmt != 
AV_PIX_FMT_YUV444P10 &am

[FFmpeg-cvslog] avcodec/dnxhdenc: fix indentation issue

2017-04-01 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Apr  1 18:50:30 
2017 +0200| [358d4524cc8fda2660679d8080cfe937b41c73c3] | committer: Paul B Mahol

avcodec/dnxhdenc: fix indentation issue

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 7a889b6..665a992 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -364,9 +364,9 @@ fail:
 
 static int dnxhd_get_hr_frame_size(const CIDEntry* profile, int mb_num)
 {
-  int result = mb_num * profile->packet_scale.num / profile->packet_scale.den;
-  result = (result + 2048) / 4096 * 4096;
-  return FFMAX(result, 8192);
+int result = mb_num * profile->packet_scale.num / 
profile->packet_scale.den;
+result = (result + 2048) / 4096 * 4096;
+return FFMAX(result, 8192);
 }
 
 static av_cold int dnxhd_encode_init(AVCodecContext *avctx)

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


[FFmpeg-cvslog] avfilter/vf_pad: add aspect option

2017-04-03 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Apr  2 22:07:04 
2017 +0200| [7e59393d40b784bcf34ae231fb8e99673585e3e1] | committer: Paul B Mahol

avfilter/vf_pad: add aspect option

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi |  3 +++
 libavfilter/vf_pad.c | 14 ++
 2 files changed, 17 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 8e5e21f..bc37e66 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10453,6 +10453,9 @@ Evaluate expressions for each incoming frame.
 
 Default value is @samp{init}.
 
+@item aspect
+Pad to aspect instead to a resolution.
+
 @end table
 
 The value for the @var{width}, @var{height}, @var{x}, and @var{y}
diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
index 61927b6..44a8fec 100644
--- a/libavfilter/vf_pad.c
+++ b/libavfilter/vf_pad.c
@@ -24,6 +24,8 @@
  * video padding filter
  */
 
+#include   /* DBL_MAX */
+
 #include "avfilter.h"
 #include "formats.h"
 #include "internal.h"
@@ -87,6 +89,7 @@ typedef struct PadContext {
 int x, y;   ///< offsets of the input area with respect to the 
padded area
 int in_w, in_h; ///< width and height for the padded input video, 
which has to be aligned to the chroma values in order to avoid chroma issues
 int inlink_w, inlink_h;
+AVRational aspect;
 
 char *w_expr;   ///< width  expression string
 char *h_expr;   ///< height expression string
@@ -103,6 +106,7 @@ static int config_input(AVFilterLink *inlink)
 {
 AVFilterContext *ctx = inlink->dst;
 PadContext *s = ctx->priv;
+AVRational adjusted_aspect = s->aspect;
 int ret;
 double var_values[VARS_NB], res;
 char *expr;
@@ -143,6 +147,15 @@ static int config_input(AVFilterLink *inlink)
 if (!s->w)
 var_values[VAR_OUT_W] = var_values[VAR_OW] = s->w = inlink->w;
 
+if (adjusted_aspect.num && adjusted_aspect.den) {
+adjusted_aspect = av_div_q(adjusted_aspect, 
inlink->sample_aspect_ratio);
+if (s->h < av_rescale(s->w, adjusted_aspect.den, adjusted_aspect.num)) 
{
+s->h = var_values[VAR_OUT_H] = var_values[VAR_OH] = 
av_rescale(s->w, adjusted_aspect.den, adjusted_aspect.num);
+} else {
+s->w = var_values[VAR_OUT_W] = var_values[VAR_OW] = 
av_rescale(s->h, adjusted_aspect.num, adjusted_aspect.den);
+}
+}
+
 /* evaluate x and y */
 av_expr_parse_and_eval(&res, (expr = s->x_expr),
var_names, var_values,
@@ -409,6 +422,7 @@ static const AVOption pad_options[] = {
 { "eval",   "specify when to evaluate expressions",OFFSET(eval_mode), 
AV_OPT_TYPE_INT, {.i64 = EVAL_MODE_INIT}, 0, EVAL_MODE_NB-1, FLAGS, "eval" },
  { "init",  "eval expressions once during initialization", 0, 
AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_INIT},  .flags = FLAGS, .unit = "eval" },
  { "frame", "eval expressions during initialization and per-frame", 0, 
AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_FRAME}, .flags = FLAGS, .unit = "eval" },
+{ "aspect",  "pad to fit an aspect instead of a resolution", 
OFFSET(aspect), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, 0, DBL_MAX, FLAGS },
 { NULL }
 };
 

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


[FFmpeg-cvslog] avcodec/utvideodec: add support for gradient prediction

2017-04-07 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Apr  7 20:09:22 
2017 +0200| [faa94a576f5f3de10fc7016e0d94229faa1c2159] | committer: Paul B Mahol

avcodec/utvideodec: add support for gradient prediction

Signed-off-by: Paul B Mahol 

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

 libavcodec/utvideodec.c | 230 ++--
 1 file changed, 225 insertions(+), 5 deletions(-)

diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index 7c65d77..a49cae8 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -602,6 +602,189 @@ static void restore_median_packed_il(uint8_t *src, int 
step, ptrdiff_t stride,
 }
 }
 
+static void restore_gradient_planar(UtvideoContext *c, uint8_t *src, ptrdiff_t 
stride,
+int width, int height, int slices, int 
rmode)
+{
+int i, j, slice;
+int A, B, C;
+uint8_t *bsrc;
+int slice_start, slice_height;
+const int cmask = ~rmode;
+
+for (slice = 0; slice < slices; slice++) {
+slice_start  = ((slice * height) / slices) & cmask;
+slice_height = slice + 1) * height) / slices) & cmask) -
+   slice_start;
+
+if (!slice_height)
+continue;
+bsrc = src + slice_start * stride;
+
+// first line - left neighbour prediction
+bsrc[0] += 0x80;
+c->llviddsp.add_left_pred(bsrc, bsrc, width, 0);
+bsrc += stride;
+if (slice_height <= 1)
+continue;
+for (j = 1; j < slice_height; j++) {
+// second line - first element has top prediction, the rest uses 
gradient
+bsrc[0] = (bsrc[0] + bsrc[-stride]) & 0xFF;
+for (i = 1; i < width; i++) {
+A = bsrc[i - stride];
+B = bsrc[i - (stride + 1)];
+C = bsrc[i - 1];
+bsrc[i] = (A - B + C + bsrc[i]) & 0xFF;
+}
+bsrc += stride;
+}
+}
+}
+
+static void restore_gradient_planar_il(UtvideoContext *c, uint8_t *src, 
ptrdiff_t stride,
+  int width, int height, int slices, int 
rmode)
+{
+int i, j, slice;
+int A, B, C;
+uint8_t *bsrc;
+int slice_start, slice_height;
+const int cmask   = ~(rmode ? 3 : 1);
+const ptrdiff_t stride2 = stride << 1;
+
+for (slice = 0; slice < slices; slice++) {
+slice_start= ((slice * height) / slices) & cmask;
+slice_height   = slice + 1) * height) / slices) & cmask) -
+ slice_start;
+slice_height >>= 1;
+if (!slice_height)
+continue;
+
+bsrc = src + slice_start * stride;
+
+// first line - left neighbour prediction
+bsrc[0] += 0x80;
+A = c->llviddsp.add_left_pred(bsrc, bsrc, width, 0);
+c->llviddsp.add_left_pred(bsrc + stride, bsrc + stride, width, A);
+bsrc += stride2;
+if (slice_height <= 1)
+continue;
+for (j = 1; j < slice_height; j++) {
+// second line - first element has top prediction, the rest uses 
gradient
+bsrc[0] = (bsrc[0] + bsrc[-stride2]) & 0xFF;
+for (i = 1; i < width; i++) {
+A = bsrc[i - stride2];
+B = bsrc[i - (stride2 + 1)];
+C = bsrc[i - 1];
+bsrc[i] = (A - B + C + bsrc[i]) & 0xFF;
+}
+for (i = 0; i < width; i++) {
+A = bsrc[i - stride];
+B = bsrc[i - (1 + stride)];
+C = bsrc[i - 1 + stride];
+bsrc[i + stride] = (A - B + C + bsrc[i + stride]) & 0xFF;
+}
+bsrc += stride2;
+}
+}
+}
+
+static void restore_gradient_packed(uint8_t *src, int step, ptrdiff_t stride,
+int width, int height, int slices, int 
rmode)
+{
+int i, j, slice;
+int A, B, C;
+uint8_t *bsrc;
+int slice_start, slice_height;
+const int cmask = ~rmode;
+
+for (slice = 0; slice < slices; slice++) {
+slice_start  = ((slice * height) / slices) & cmask;
+slice_height = slice + 1) * height) / slices) & cmask) -
+   slice_start;
+
+if (!slice_height)
+continue;
+bsrc = src + slice_start * stride;
+
+// first line - left neighbour prediction
+bsrc[0] += 0x80;
+A = bsrc[0];
+for (i = step; i < width * step; i += step) {
+bsrc[i] += A;
+A= bsrc[i];
+}
+bsrc += stride;
+if (slice_height <= 1)
+continue;
+for (j = 1; j < slice_height; j++) {
+// second line - first element has top prediction, the rest uses 
gradient
+C= bsrc[-stride

[FFmpeg-cvslog] avcodec/cllc: add support for frame threads

2017-04-09 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Apr  8 12:30:05 
2017 +0200| [24d9b0c29c9de41239c78d2c0b22fa791326bc50] | committer: Paul B Mahol

avcodec/cllc: add support for frame threads

Signed-off-by: Paul B Mahol 

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

 libavcodec/cllc.c | 24 
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/libavcodec/cllc.c b/libavcodec/cllc.c
index 80b049861e..e0895d2e1f 100644
--- a/libavcodec/cllc.c
+++ b/libavcodec/cllc.c
@@ -28,6 +28,7 @@
 #include "get_bits.h"
 #include "avcodec.h"
 #include "internal.h"
+#include "thread.h"
 
 typedef struct CLLCContext {
 AVCodecContext *avctx;
@@ -357,6 +358,7 @@ static int cllc_decode_frame(AVCodecContext *avctx, void 
*data,
 {
 CLLCContext *ctx = avctx->priv_data;
 AVFrame *pic = data;
+ThreadFrame frame = { .f = data };
 uint8_t *src = avpkt->data;
 uint32_t info_tag, info_offset;
 int data_size;
@@ -417,7 +419,7 @@ static int cllc_decode_frame(AVCodecContext *avctx, void 
*data,
 avctx->pix_fmt = AV_PIX_FMT_YUV422P;
 avctx->bits_per_raw_sample = 8;
 
-if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
+if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
 return ret;
 
 ret = decode_yuv_frame(ctx, &gb, pic);
@@ -430,7 +432,7 @@ static int cllc_decode_frame(AVCodecContext *avctx, void 
*data,
 avctx->pix_fmt = AV_PIX_FMT_RGB24;
 avctx->bits_per_raw_sample = 8;
 
-if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
+if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
 return ret;
 
 ret = decode_rgb24_frame(ctx, &gb, pic);
@@ -442,7 +444,7 @@ static int cllc_decode_frame(AVCodecContext *avctx, void 
*data,
 avctx->pix_fmt = AV_PIX_FMT_ARGB;
 avctx->bits_per_raw_sample = 8;
 
-if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
+if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
 return ret;
 
 ret = decode_argb_frame(ctx, &gb, pic);
@@ -463,6 +465,19 @@ static int cllc_decode_frame(AVCodecContext *avctx, void 
*data,
 return avpkt->size;
 }
 
+#if HAVE_THREADS
+static int cllc_init_thread_copy(AVCodecContext *avctx)
+{
+CLLCContext *ctx = avctx->priv_data;
+
+ctx->avctx= avctx;
+ctx->swapped_buf  = NULL;
+ctx->swapped_buf_size = 0;
+
+return 0;
+}
+#endif
+
 static av_cold int cllc_decode_close(AVCodecContext *avctx)
 {
 CLLCContext *ctx = avctx->priv_data;
@@ -493,8 +508,9 @@ AVCodec ff_cllc_decoder = {
 .id = AV_CODEC_ID_CLLC,
 .priv_data_size = sizeof(CLLCContext),
 .init   = cllc_decode_init,
+.init_thread_copy = ONLY_IF_THREADS_ENABLED(cllc_init_thread_copy),
 .decode = cllc_decode_frame,
 .close  = cllc_decode_close,
-.capabilities   = AV_CODEC_CAP_DR1,
+.capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
 .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };

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


[FFmpeg-cvslog] avcodec/hqx: add support for frame threads

2017-04-09 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Apr  8 12:11:39 
2017 +0200| [20f7872d9903120ca3609a1e3ad973132bd686cc] | committer: Paul B Mahol

avcodec/hqx: add support for frame threads

Signed-off-by: Paul B Mahol 

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

 libavcodec/hqx.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hqx.c b/libavcodec/hqx.c
index 1bc123e659..bc24ba91d1 100644
--- a/libavcodec/hqx.c
+++ b/libavcodec/hqx.c
@@ -27,6 +27,7 @@
 #include "canopus.h"
 #include "get_bits.h"
 #include "internal.h"
+#include "thread.h"
 
 #include "hqx.h"
 #include "hqxdsp.h"
@@ -405,6 +406,7 @@ static int hqx_decode_frame(AVCodecContext *avctx, void 
*data,
 int *got_picture_ptr, AVPacket *avpkt)
 {
 HQXContext *ctx = avctx->priv_data;
+ThreadFrame frame = { .f = data };
 uint8_t *src = avpkt->data;
 uint32_t info_tag;
 int data_start;
@@ -491,7 +493,7 @@ static int hqx_decode_frame(AVCodecContext *avctx, void 
*data,
 return AVERROR_INVALIDDATA;
 }
 
-ret = ff_get_buffer(avctx, ctx->pic, 0);
+ret = ff_thread_get_buffer(avctx, &frame, 0);
 if (ret < 0)
 return ret;
 
@@ -510,6 +512,9 @@ static av_cold int hqx_decode_close(AVCodecContext *avctx)
 int i;
 HQXContext *ctx = avctx->priv_data;
 
+if (avctx->internal->is_copy)
+return 0;
+
 ff_free_vlc(&ctx->cbp_vlc);
 for (i = 0; i < 3; i++) {
 ff_free_vlc(&ctx->dc_vlc[i]);
@@ -536,7 +541,8 @@ AVCodec ff_hqx_decoder = {
 .init   = hqx_decode_init,
 .decode = hqx_decode_frame,
 .close  = hqx_decode_close,
-.capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SLICE_THREADS,
+.capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SLICE_THREADS |
+  AV_CODEC_CAP_FRAME_THREADS,
 .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE |
   FF_CODEC_CAP_INIT_CLEANUP,
 };

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


[FFmpeg-cvslog] avfilter/vf_midequalizer: add gray10 and gray12 support

2017-04-09 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Apr  9 16:28:25 
2017 +0200| [c20cc61890a7a500dc3869a5e5464b4003f973c2] | committer: Paul B Mahol

avfilter/vf_midequalizer: add gray10 and gray12 support

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavfilter/vf_midequalizer.c b/libavfilter/vf_midequalizer.c
index b95a86dd70..99d26c751e 100644
--- a/libavfilter/vf_midequalizer.c
+++ b/libavfilter/vf_midequalizer.c
@@ -66,7 +66,7 @@ static int query_formats(AVFilterContext *ctx)
 AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P,
 AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P,
 AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP,
-AV_PIX_FMT_GRAY8,
+AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12,
 AV_PIX_FMT_YUV420P9, AV_PIX_FMT_YUV422P9, AV_PIX_FMT_YUV444P9,
 AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
 AV_PIX_FMT_YUV420P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444P12,

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


[FFmpeg-cvslog] avfilter/vf_dctdnoiz: add GBRP support

2017-04-10 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Apr  9 17:38:41 
2017 +0200| [7437602806db885d20fbf5f3d2e9d5961f2690e9] | committer: Paul B Mahol

avfilter/vf_dctdnoiz: add GBRP support

Signed-off-by: Paul B Mahol 

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

 libavfilter/vf_dctdnoiz.c | 85 +++
 1 file changed, 71 insertions(+), 14 deletions(-)

diff --git a/libavfilter/vf_dctdnoiz.c b/libavfilter/vf_dctdnoiz.c
index 62763bf349..cdbe5f853f 100644
--- a/libavfilter/vf_dctdnoiz.c
+++ b/libavfilter/vf_dctdnoiz.c
@@ -63,9 +63,9 @@ typedef struct DCTdnoizContext {
  float *dst, int dst_linesize,
  int thread_id);
 void (*color_decorrelation)(float **dst, int dst_linesize,
-const uint8_t *src, int src_linesize,
+const uint8_t **src, int src_linesize,
 int w, int h);
-void (*color_correlation)(uint8_t *dst, int dst_linesize,
+void (*color_correlation)(uint8_t **dst, int dst_linesize,
   float **src, int src_linesize,
   int w, int h);
 } DCTdnoizContext;
@@ -408,7 +408,7 @@ DEF_FILTER_FREQ_FUNCS(16)
 #define DCT3X3_2_2  0.4082482904638631f /*  1/sqrt(6) */
 
 static av_always_inline void color_decorrelation(float **dst, int dst_linesize,
- const uint8_t *src, int 
src_linesize,
+ const uint8_t **src, int 
src_linesize,
  int w, int h,
  int r, int g, int b)
 {
@@ -416,24 +416,23 @@ static av_always_inline void color_decorrelation(float 
**dst, int dst_linesize,
 float *dstp_r = dst[0];
 float *dstp_g = dst[1];
 float *dstp_b = dst[2];
+const uint8_t *srcp = src[0];
 
 for (y = 0; y < h; y++) {
-const uint8_t *srcp = src;
-
 for (x = 0; x < w; x++) {
 dstp_r[x] = srcp[r] * DCT3X3_0_0 + srcp[g] * DCT3X3_0_1 + srcp[b] 
* DCT3X3_0_2;
 dstp_g[x] = srcp[r] * DCT3X3_1_0 +srcp[b] 
* DCT3X3_1_2;
 dstp_b[x] = srcp[r] * DCT3X3_2_0 + srcp[g] * DCT3X3_2_1 + srcp[b] 
* DCT3X3_2_2;
 srcp += 3;
 }
-src += src_linesize;
+srcp   += src_linesize - w * 3;
 dstp_r += dst_linesize;
 dstp_g += dst_linesize;
 dstp_b += dst_linesize;
 }
 }
 
-static av_always_inline void color_correlation(uint8_t *dst, int dst_linesize,
+static av_always_inline void color_correlation(uint8_t **dst, int dst_linesize,
float **src, int src_linesize,
int w, int h,
int r, int g, int b)
@@ -442,17 +441,16 @@ static av_always_inline void color_correlation(uint8_t 
*dst, int dst_linesize,
 const float *src_r = src[0];
 const float *src_g = src[1];
 const float *src_b = src[2];
+uint8_t *dstp = dst[0];
 
 for (y = 0; y < h; y++) {
-uint8_t *dstp = dst;
-
 for (x = 0; x < w; x++) {
 dstp[r] = av_clip_uint8(src_r[x] * DCT3X3_0_0 + src_g[x] * 
DCT3X3_1_0 + src_b[x] * DCT3X3_2_0);
 dstp[g] = av_clip_uint8(src_r[x] * DCT3X3_0_1 +
 src_b[x] * DCT3X3_2_1);
 dstp[b] = av_clip_uint8(src_r[x] * DCT3X3_0_2 + src_g[x] * 
DCT3X3_1_2 + src_b[x] * DCT3X3_2_2);
 dstp += 3;
 }
-dst += dst_linesize;
+dstp  += dst_linesize - w * 3;
 src_r += src_linesize;
 src_g += src_linesize;
 src_b += src_linesize;
@@ -461,13 +459,13 @@ static av_always_inline void color_correlation(uint8_t 
*dst, int dst_linesize,
 
 #define DECLARE_COLOR_FUNCS(name, r, g, b) 
 \
 static void color_decorrelation_##name(float **dst, int dst_linesize,  
 \
-   const uint8_t *src, int src_linesize,   
 \
+   const uint8_t **src, int src_linesize,  
 \
int w, int h)   
 \
 {  
 \
 color_decorrelation(dst, dst_linesize, src, src_linesize, w, h, r, g, b);  
 \
 }  
 \

 \
-static void color_correlation_##name(uint8_t *dst, int dst_linesize,   
 \
+static void color_correlation_##name(uint8_t **dst, int dst_linesize,  
 \
  float **src, i

[FFmpeg-cvslog] avfilter/vf_paletteuse: silence warning about misaligned indentation

2017-04-10 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Apr 10 11:25:44 
2017 +0200| [9cd44e64be25ac301fd0ee9330d13c0e4bef63e0] | committer: Paul B Mahol

avfilter/vf_paletteuse: silence warning about misaligned indentation

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
index e8dde572cd..b25c6a9eac 100644
--- a/libavfilter/vf_paletteuse.c
+++ b/libavfilter/vf_paletteuse.c
@@ -444,7 +444,7 @@ static av_always_inline int set_frame(PaletteUseContext *s, 
AVFrame *out, AVFram
 if (down) {
 if (left2)  src[  src_linesize + x - 2] = 
dither_color(src[  src_linesize + x - 2], er, eg, eb, 1, 4);
 if (left)   src[  src_linesize + x - 1] = 
dither_color(src[  src_linesize + x - 1], er, eg, eb, 2, 4);
-src[  src_linesize + x] = 
dither_color(src[  src_linesize + x], er, eg, eb, 3, 4);
+if (1)  src[  src_linesize + x] = 
dither_color(src[  src_linesize + x], er, eg, eb, 3, 4);
 if (right)  src[  src_linesize + x + 1] = 
dither_color(src[  src_linesize + x + 1], er, eg, eb, 2, 4);
 if (right2) src[  src_linesize + x + 2] = 
dither_color(src[  src_linesize + x + 2], er, eg, eb, 1, 4);
 }

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


[FFmpeg-cvslog] avutil/float_dsp: add vector_dmac_scalar()

2017-04-10 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Apr 10 11:31:11 
2017 +0200| [4dc2dd80dc78f4abb19052682bfb68d64a7a96d6] | committer: Paul B Mahol

avutil/float_dsp: add vector_dmac_scalar()

Signed-off-by: Paul B Mahol 

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

 libavutil/float_dsp.c |  9 +
 libavutil/float_dsp.h | 16 
 libavutil/version.h   |  2 +-
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/libavutil/float_dsp.c b/libavutil/float_dsp.c
index c85daffc6a..1d4911d815 100644
--- a/libavutil/float_dsp.c
+++ b/libavutil/float_dsp.c
@@ -40,6 +40,14 @@ static void vector_fmac_scalar_c(float *dst, const float 
*src, float mul,
 dst[i] += src[i] * mul;
 }
 
+static void vector_dmac_scalar_c(double *dst, const double *src, double mul,
+ int len)
+{
+int i;
+for (i = 0; i < len; i++)
+dst[i] += src[i] * mul;
+}
+
 static void vector_fmul_scalar_c(float *dst, const float *src, float mul,
  int len)
 {
@@ -125,6 +133,7 @@ av_cold AVFloatDSPContext *avpriv_float_dsp_alloc(int 
bit_exact)
 fdsp->vector_fmul = vector_fmul_c;
 fdsp->vector_fmac_scalar = vector_fmac_scalar_c;
 fdsp->vector_fmul_scalar = vector_fmul_scalar_c;
+fdsp->vector_dmac_scalar = vector_dmac_scalar_c;
 fdsp->vector_dmul_scalar = vector_dmul_scalar_c;
 fdsp->vector_fmul_window = vector_fmul_window_c;
 fdsp->vector_fmul_add = vector_fmul_add_c;
diff --git a/libavutil/float_dsp.h b/libavutil/float_dsp.h
index d1be38f947..2c24d93471 100644
--- a/libavutil/float_dsp.h
+++ b/libavutil/float_dsp.h
@@ -55,6 +55,22 @@ typedef struct AVFloatDSPContext {
int len);
 
 /**
+ * Multiply a vector of doubles by a scalar double and add to
+ * destination vector.  Source and destination vectors must
+ * overlap exactly or not at all.
+ *
+ * @param dst result vector
+ *constraints: 32-byte aligned
+ * @param src input vector
+ *constraints: 32-byte aligned
+ * @param mul scalar value
+ * @param len length of vector
+ *constraints: multiple of 16
+ */
+void (*vector_dmac_scalar)(double *dst, const double *src, double mul,
+   int len);
+
+/**
  * Multiply a vector of floats by a scalar float.  Source and
  * destination vectors must overlap exactly or not at all.
  *
diff --git a/libavutil/version.h b/libavutil/version.h
index 95e1e929f3..f4d0930689 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -80,7 +80,7 @@
 
 #define LIBAVUTIL_VERSION_MAJOR  55
 #define LIBAVUTIL_VERSION_MINOR  60
-#define LIBAVUTIL_VERSION_MICRO 100
+#define LIBAVUTIL_VERSION_MICRO 101
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \

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


[FFmpeg-cvslog] avfilter/af_amix: add double sample format support

2017-04-10 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Apr  9 22:10:14 
2017 +0200| [75b854adbd4efeab36eba1f3fb3953951c6f2575] | committer: Paul B Mahol

avfilter/af_amix: add double sample format support

Signed-off-by: Paul B Mahol 

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

 libavfilter/af_amix.c | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c
index a4d138927f..9fe505b0dc 100644
--- a/libavfilter/af_amix.c
+++ b/libavfilter/af_amix.c
@@ -336,10 +336,19 @@ static int output_frame(AVFilterLink *outlink)
 plane_size = nb_samples * (s->planar ? 1 : s->nb_channels);
 plane_size = FFALIGN(plane_size, 16);
 
-for (p = 0; p < planes; p++) {
-s->fdsp->vector_fmac_scalar((float *)out_buf->extended_data[p],
-   (float *) in_buf->extended_data[p],
-   s->input_scale[i], plane_size);
+if (out_buf->format == AV_SAMPLE_FMT_FLT ||
+out_buf->format == AV_SAMPLE_FMT_FLTP) {
+for (p = 0; p < planes; p++) {
+s->fdsp->vector_fmac_scalar((float 
*)out_buf->extended_data[p],
+(float *) 
in_buf->extended_data[p],
+s->input_scale[i], plane_size);
+}
+} else {
+for (p = 0; p < planes; p++) {
+s->fdsp->vector_dmac_scalar((double 
*)out_buf->extended_data[p],
+(double *) 
in_buf->extended_data[p],
+s->input_scale[i], plane_size);
+}
 }
 }
 }
@@ -529,6 +538,8 @@ static int query_formats(AVFilterContext *ctx)
 
 if ((ret = ff_add_format(&formats, AV_SAMPLE_FMT_FLT ))  < 0 ||
 (ret = ff_add_format(&formats, AV_SAMPLE_FMT_FLTP))  < 0 ||
+(ret = ff_add_format(&formats, AV_SAMPLE_FMT_DBL ))  < 0 ||
+(ret = ff_add_format(&formats, AV_SAMPLE_FMT_DBLP))  < 0 ||
 (ret = ff_set_common_formats(ctx, formats))  < 0 ||
 (ret = ff_set_common_channel_layouts(ctx, layouts))  < 0 ||
 (ret = ff_set_common_samplerates(ctx, ff_all_samplerates())) < 0)

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


[FFmpeg-cvslog] avfilter/vf_blend: add GBRAP16

2017-04-10 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Apr 10 16:52:27 
2017 +0200| [0da3c568fd4924aaac79e7ddacd11c88fb3cb090] | committer: Paul B Mahol

avfilter/vf_blend: add GBRAP16

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index a3235e684b..9f003b29b6 100644
--- a/libavfilter/vf_blend.c
+++ b/libavfilter/vf_blend.c
@@ -421,7 +421,7 @@ static int query_formats(AVFilterContext *ctx)
 AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP, AV_PIX_FMT_GRAY8,
 AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16,
 AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16,
-AV_PIX_FMT_GBRP16, AV_PIX_FMT_GRAY16,
+AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_GRAY16,
 AV_PIX_FMT_NONE
 };
 

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


[FFmpeg-cvslog] avfilter/vf_alphamerge: use av_image_copy_plane()

2017-04-10 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Apr 10 17:23:49 
2017 +0200| [d6b9f2b7da8eff480c4c454841d769b75e30f536] | committer: Paul B Mahol

avfilter/vf_alphamerge: use av_image_copy_plane()

Signed-off-by: Paul B Mahol 

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

 libavfilter/vf_alphamerge.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/libavfilter/vf_alphamerge.c b/libavfilter/vf_alphamerge.c
index a8a8d56824..a4aa8dbe16 100644
--- a/libavfilter/vf_alphamerge.c
+++ b/libavfilter/vf_alphamerge.c
@@ -25,6 +25,7 @@
 
 #include 
 
+#include "libavutil/imgutils.h"
 #include "libavutil/pixfmt.h"
 #include "avfilter.h"
 #include "bufferqueue.h"
@@ -129,14 +130,11 @@ static void draw_frame(AVFilterContext *ctx,
 }
 }
 } else {
-int y;
 const int main_linesize = main_buf->linesize[A];
 const int alpha_linesize = alpha_buf->linesize[Y];
-for (y = 0; y < h && y < alpha_buf->height; y++) {
-memcpy(main_buf->data[A] + y * main_linesize,
-   alpha_buf->data[Y] + y * alpha_linesize,
-   FFMIN(main_linesize, alpha_linesize));
-}
+av_image_copy_plane(main_buf->data[A], main_linesize,
+alpha_buf->data[Y], alpha_linesize,
+FFMIN(main_linesize, alpha_linesize), 
alpha_buf->height);
 }
 }
 

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


[FFmpeg-cvslog] avfilter/vf_alphamerge: add GBRAP support

2017-04-10 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Apr 10 17:34:19 
2017 +0200| [0c4d75d92e3a4f3554b63e930255ac8efc5aae1f] | committer: Paul B Mahol

avfilter/vf_alphamerge: add GBRAP support

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavfilter/vf_alphamerge.c b/libavfilter/vf_alphamerge.c
index a4aa8dbe16..d0a2639689 100644
--- a/libavfilter/vf_alphamerge.c
+++ b/libavfilter/vf_alphamerge.c
@@ -54,6 +54,7 @@ static int query_formats(AVFilterContext *ctx)
 {
 static const enum AVPixelFormat main_fmts[] = {
 AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA420P,
+AV_PIX_FMT_GBRAP,
 AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA, AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR,
 AV_PIX_FMT_NONE
 };
@@ -85,7 +86,8 @@ static int config_input_main(AVFilterLink *inlink)
 {
 AlphaMergeContext *merge = inlink->dst->priv;
 merge->is_packed_rgb =
-ff_fill_rgba_map(merge->rgba_map, inlink->format) >= 0;
+ff_fill_rgba_map(merge->rgba_map, inlink->format) >= 0 &&
+inlink->format != AV_PIX_FMT_GBRAP;
 return 0;
 }
 

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


[FFmpeg-cvslog] avfilter: add GRAY10 and GRAY12 to some filters

2017-04-10 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Apr 10 18:12:33 
2017 +0200| [27ebdcf079ed54d294db010e9f50700f75ed5e3d] | committer: Paul B Mahol

avfilter: add GRAY10 and GRAY12 to some filters

Signed-off-by: Paul B Mahol 

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

 libavfilter/vf_atadenoise.c | 2 ++
 libavfilter/vf_avgblur.c| 2 +-
 libavfilter/vf_gblur.c  | 2 +-
 libavfilter/vf_hysteresis.c | 2 +-
 4 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_atadenoise.c b/libavfilter/vf_atadenoise.c
index bf75d53d92..8d34403847 100644
--- a/libavfilter/vf_atadenoise.c
+++ b/libavfilter/vf_atadenoise.c
@@ -80,6 +80,8 @@ static int query_formats(AVFilterContext *ctx)
 {
 static const enum AVPixelFormat pixel_fmts[] = {
 AV_PIX_FMT_GRAY8,
+AV_PIX_FMT_GRAY10,
+AV_PIX_FMT_GRAY12,
 AV_PIX_FMT_GRAY16,
 AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P,
 AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P,
diff --git a/libavfilter/vf_avgblur.c b/libavfilter/vf_avgblur.c
index 2bb2ab1ed5..17e022d22a 100644
--- a/libavfilter/vf_avgblur.c
+++ b/libavfilter/vf_avgblur.c
@@ -242,7 +242,7 @@ static int query_formats(AVFilterContext *ctx)
 AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10,
 AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16,
 AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16,
-AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY16,
+AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, 
AV_PIX_FMT_GRAY16,
 AV_PIX_FMT_NONE
 };
 
diff --git a/libavfilter/vf_gblur.c b/libavfilter/vf_gblur.c
index f843e3f376..fe1d5c77da 100644
--- a/libavfilter/vf_gblur.c
+++ b/libavfilter/vf_gblur.c
@@ -202,7 +202,7 @@ static int query_formats(AVFilterContext *ctx)
 AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10,
 AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16,
 AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16,
-AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY16,
+AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, 
AV_PIX_FMT_GRAY16,
 AV_PIX_FMT_NONE
 };
 
diff --git a/libavfilter/vf_hysteresis.c b/libavfilter/vf_hysteresis.c
index 8f05b716c9..c0369b2066 100644
--- a/libavfilter/vf_hysteresis.c
+++ b/libavfilter/vf_hysteresis.c
@@ -79,7 +79,7 @@ static int query_formats(AVFilterContext *ctx)
 AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10,
 AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16,
 AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16,
-AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY16,
+AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, 
AV_PIX_FMT_GRAY16,
 AV_PIX_FMT_NONE
 };
 

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


[FFmpeg-cvslog] avcodec/dnxhddec: add support for very big resolutions

2017-04-10 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Tue Apr 11 00:08:39 
2017 +0200| [25e491b6f9dba26bd4a10c256150debfb13252db] | committer: Paul B Mahol

avcodec/dnxhddec: add support for very big resolutions

Signed-off-by: Paul B Mahol 

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

 libavcodec/dnxhd_parser.c |  2 +-
 libavcodec/dnxhddec.c | 10 +++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c
index 4f9bbceeeb..d5844dffda 100644
--- a/libavcodec/dnxhd_parser.c
+++ b/libavcodec/dnxhd_parser.c
@@ -43,7 +43,7 @@ static int dnxhd_get_hr_frame_size(int cid, int w, int h)
 if (i < 0)
 return i;
 
-result = ((h + 15) / 16) * ((w + 15) / 16) * 
ff_dnxhd_cid_table[i].packet_scale.num / ff_dnxhd_cid_table[i].packet_scale.den;
+result = ((h + 15) / 16) * ((w + 15) / 16) * 
(int64_t)ff_dnxhd_cid_table[i].packet_scale.num / 
ff_dnxhd_cid_table[i].packet_scale.den;
 result = (result + 2048) / 4096 * 4096;
 
 return FFMAX(result, 8192);
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 383e64ca9e..cc24ebd58a 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -58,7 +58,7 @@ typedef struct DNXHDContext {
 unsigned int width, height;
 enum AVPixelFormat pix_fmt;
 unsigned int mb_width, mb_height;
-uint32_t mb_scan_index[256];
+uint32_t mb_scan_index[512];
 int data_offset;// End of mb_scan_index, where 
macroblocks start
 int cur_field;  ///< current interlaced field
 VLC ac_vlc, dc_vlc, run_vlc;
@@ -285,7 +285,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame 
*frame,
 }
 
 ctx->mb_width  = (ctx->width + 15)>> 4;
-ctx->mb_height = buf[0x16d];
+ctx->mb_height = AV_RB16(buf + 0x16c);
 
 if ((ctx->height + 15) >> 4 == ctx->mb_height && frame->interlaced_frame)
 ctx->height <<= 1;
@@ -313,7 +313,11 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame 
*frame,
 return AVERROR_INVALIDDATA;
 }
 
-av_assert0((unsigned)ctx->mb_height <= FF_ARRAY_ELEMS(ctx->mb_scan_index));
+if (ctx->mb_height > FF_ARRAY_ELEMS(ctx->mb_scan_index)) {
+av_log(ctx->avctx, AV_LOG_ERROR,
+   "mb_height too big (%d > %"PRIu64").\n", ctx->mb_height, 
FF_ARRAY_ELEMS(ctx->mb_scan_index));
+return AVERROR_INVALIDDATA;
+}
 
 for (i = 0; i < ctx->mb_height; i++) {
 ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i << 2));

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


[FFmpeg-cvslog] avcodec/lcldec: mark output frames as keyframes

2017-04-11 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Tue Apr 11 17:07:52 
2017 +0200| [da2fd3f73e88fe5a2956ce6a30e260f288694b9b] | committer: Paul B Mahol

avcodec/lcldec: mark output frames as keyframes

Signed-off-by: Paul B Mahol 

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

 libavcodec/lcldec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c
index abc04e35dc..104defa5f5 100644
--- a/libavcodec/lcldec.c
+++ b/libavcodec/lcldec.c
@@ -460,6 +460,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame, AVPac
 return AVERROR_INVALIDDATA;
 }
 
+frame->key_frame = 1;
+frame->pict_type = AV_PICTURE_TYPE_I;
+
 *got_frame = 1;
 
 /* always report that the buffer was completely consumed */

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


[FFmpeg-cvslog] avcodec/lcldec: add support for frame threads

2017-04-11 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Tue Apr 11 17:05:01 
2017 +0200| [c61dc289110c3aaed41517ce89e0d9dc9359d5d0] | committer: Paul B Mahol

avcodec/lcldec: add support for frame threads

Signed-off-by: Paul B Mahol 

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

 libavcodec/lcldec.c | 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c
index f5040c6609..abc04e35dc 100644
--- a/libavcodec/lcldec.c
+++ b/libavcodec/lcldec.c
@@ -46,6 +46,7 @@
 #include "bytestream.h"
 #include "internal.h"
 #include "lcl.h"
+#include "thread.h"
 
 #if CONFIG_ZLIB_DECODER
 #include 
@@ -157,6 +158,7 @@ static int zlib_decomp(AVCodecContext *avctx, const uint8_t 
*src, int src_len, i
 static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, 
AVPacket *avpkt)
 {
 AVFrame *frame = data;
+ThreadFrame tframe = { .f = data };
 const uint8_t *buf = avpkt->data;
 int buf_size = avpkt->size;
 LclDecContext * const c = avctx->priv_data;
@@ -173,7 +175,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame, AVPac
 unsigned int len = buf_size;
 int linesize;
 
-if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
+if ((ret = ff_thread_get_buffer(avctx, &tframe, 0)) < 0)
 return ret;
 
 outptr = frame->data[0]; // Output image pointer
@@ -618,6 +620,13 @@ static av_cold int decode_init(AVCodecContext *avctx)
 return 0;
 }
 
+#if HAVE_THREADS
+static int init_thread_copy(AVCodecContext *avctx)
+{
+return decode_init(avctx);
+}
+#endif
+
 static av_cold int decode_end(AVCodecContext *avctx)
 {
 LclDecContext * const c = avctx->priv_data;
@@ -639,9 +648,10 @@ AVCodec ff_mszh_decoder = {
 .id = AV_CODEC_ID_MSZH,
 .priv_data_size = sizeof(LclDecContext),
 .init   = decode_init,
+.init_thread_copy = ONLY_IF_THREADS_ENABLED(init_thread_copy),
 .close  = decode_end,
 .decode = decode_frame,
-.capabilities   = AV_CODEC_CAP_DR1,
+.capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
 .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
 #endif
@@ -654,9 +664,10 @@ AVCodec ff_zlib_decoder = {
 .id = AV_CODEC_ID_ZLIB,
 .priv_data_size = sizeof(LclDecContext),
 .init   = decode_init,
+.init_thread_copy = ONLY_IF_THREADS_ENABLED(init_thread_copy),
 .close  = decode_end,
 .decode = decode_frame,
-.capabilities   = AV_CODEC_CAP_DR1,
+.capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
 .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
 #endif

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


[FFmpeg-cvslog] avcodec/dnxhdenc: make sure that mb_height > 255 can be stored

2017-04-14 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Apr 14 16:00:35 
2017 +0200| [34c2eea3d8ec85de4f4e5a9085c174e4b09387b9] | committer: Paul B Mahol

avcodec/dnxhdenc: make sure that mb_height > 255 can be stored

Signed-off-by: Paul B Mahol 

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

 libavcodec/dnxhdenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 665a992706..35fa77794a 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -582,7 +582,7 @@ static int dnxhd_write_header(AVCodecContext *avctx, 
uint8_t *buf)
 
 buf[0x167] = 0x02; // reserved
 AV_WB16(buf + 0x16a, ctx->m.mb_height * 4 + 4); // MSIPS
-buf[0x16d] = ctx->m.mb_height; // Ns
+AV_WB16(buf + 0x16c, ctx->m.mb_height); // Ns
 buf[0x16f] = 0x10; // reserved
 
 ctx->msip = buf + 0x170;

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


[FFmpeg-cvslog] avcodec/dnxhd*: add ff_dnxhd_get_hr_frame_size()

2017-04-14 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Apr 14 16:09:07 
2017 +0200| [5dedb2afd64e27ad08308487e185f7e3a5bea1b9] | committer: Paul B Mahol

avcodec/dnxhd*: add ff_dnxhd_get_hr_frame_size()

Signed-off-by: Paul B Mahol 

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

 libavcodec/dnxhd_parser.c | 15 +--
 libavcodec/dnxhddata.h| 13 +
 libavcodec/dnxhdenc.c | 11 ++-
 3 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c
index d5844dffda..de1cf5a041 100644
--- a/libavcodec/dnxhd_parser.c
+++ b/libavcodec/dnxhd_parser.c
@@ -36,19 +36,6 @@ typedef struct {
 int w, h;
 } DNXHDParserContext;
 
-static int dnxhd_get_hr_frame_size(int cid, int w, int h)
-{
-int result, i = ff_dnxhd_get_cid_table(cid);
-
-if (i < 0)
-return i;
-
-result = ((h + 15) / 16) * ((w + 15) / 16) * 
(int64_t)ff_dnxhd_cid_table[i].packet_scale.num / 
ff_dnxhd_cid_table[i].packet_scale.den;
-result = (result + 2048) / 4096 * 4096;
-
-return FFMAX(result, 8192);
-}
-
 static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
 const uint8_t *buf, int buf_size)
 {
@@ -93,7 +80,7 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
 
 dctx->remaining = avpriv_dnxhd_get_frame_size(cid);
 if (dctx->remaining <= 0) {
-dctx->remaining = dnxhd_get_hr_frame_size(cid, dctx->w, 
dctx->h);
+dctx->remaining = ff_dnxhd_get_hr_frame_size(cid, dctx->w, 
dctx->h);
 if (dctx->remaining <= 0)
 return dctx->remaining;
 }
diff --git a/libavcodec/dnxhddata.h b/libavcodec/dnxhddata.h
index 89262a13c1..c96c5e8f65 100644
--- a/libavcodec/dnxhddata.h
+++ b/libavcodec/dnxhddata.h
@@ -91,6 +91,19 @@ static av_always_inline uint64_t 
ff_dnxhd_parse_header_prefix(const uint8_t *buf
 return ff_dnxhd_check_header_prefix(prefix);
 }
 
+static av_always_inline int ff_dnxhd_get_hr_frame_size(int cid, int w, int h)
+{
+int result, i = ff_dnxhd_get_cid_table(cid);
+
+if (i < 0)
+return i;
+
+result = ((h + 15) / 16) * ((w + 15) / 16) * 
(int64_t)ff_dnxhd_cid_table[i].packet_scale.num / 
ff_dnxhd_cid_table[i].packet_scale.den;
+result = (result + 2048) / 4096 * 4096;
+
+return FFMAX(result, 8192);
+}
+
 int avpriv_dnxhd_get_frame_size(int cid);
 int avpriv_dnxhd_get_interlaced(int cid);
 #if LIBAVCODEC_VERSION_MAJOR < 58
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 35fa77794a..1c270a4ad7 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -362,13 +362,6 @@ fail:
 return AVERROR(ENOMEM);
 }
 
-static int dnxhd_get_hr_frame_size(const CIDEntry* profile, int mb_num)
-{
-int result = mb_num * profile->packet_scale.num / 
profile->packet_scale.den;
-result = (result + 2048) / 4096 * 4096;
-return FFMAX(result, 8192);
-}
-
 static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
 {
 DNXHDEncContext *ctx = avctx->priv_data;
@@ -483,8 +476,8 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
 ctx->m.mb_num = ctx->m.mb_height * ctx->m.mb_width;
 
 if (ctx->cid_table->frame_size == DNXHD_VARIABLE) {
-ctx->frame_size = dnxhd_get_hr_frame_size(ctx->cid_table,
-  ctx->m.mb_num);
+ctx->frame_size = ff_dnxhd_get_hr_frame_size(ctx->cid,
+ ctx->m.mb_width, 
ctx->m.mb_height);
 ctx->coding_unit_size = ctx->frame_size;
 } else {
 ctx->frame_size = ctx->cid_table->frame_size;

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


[FFmpeg-cvslog] avcodec/dnxhdenc: fix recent regression

2017-04-15 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Apr 15 09:22:52 
2017 +0200| [f6b5a5c7d05aa92b7af1ce9f40b868542c414ad4] | committer: Paul B Mahol

avcodec/dnxhdenc: fix recent regression

Signed-off-by: Paul B Mahol 

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

 libavcodec/dnxhdenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 1c270a4ad7..59e3f73689 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -477,7 +477,7 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
 
 if (ctx->cid_table->frame_size == DNXHD_VARIABLE) {
 ctx->frame_size = ff_dnxhd_get_hr_frame_size(ctx->cid,
- ctx->m.mb_width, 
ctx->m.mb_height);
+ avctx->width, 
avctx->height);
 ctx->coding_unit_size = ctx->frame_size;
 } else {
 ctx->frame_size = ctx->cid_table->frame_size;

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


[FFmpeg-cvslog] avcodec: add Screen Recorder Gold Codec decoder

2017-04-18 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Apr 16 18:44:57 
2017 +0200| [61088051bd70e94224e8fbc95044ca1c6ca7240a] | committer: Paul B Mahol

avcodec: add Screen Recorder Gold Codec decoder

Signed-off-by: Paul B Mahol 

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

 configure   |  1 +
 doc/general.texi|  1 +
 libavcodec/Makefile |  1 +
 libavcodec/allcodecs.c  |  1 +
 libavcodec/avcodec.h|  1 +
 libavcodec/codec_desc.c |  7 +++
 libavcodec/mscc.c   | 24 +---
 libavcodec/version.h|  2 +-
 libavformat/riff.c  |  1 +
 9 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 2e2571493a..758607b502 100755
--- a/configure
+++ b/configure
@@ -2514,6 +2514,7 @@ sonic_decoder_select="golomb rangecoder"
 sonic_encoder_select="golomb rangecoder"
 sonic_ls_encoder_select="golomb rangecoder"
 sp5x_decoder_select="mjpeg_decoder"
+srgc_decoder_select="zlib"
 svq1_decoder_select="hpeldsp"
 svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc"
 svq3_decoder_select="golomb h264dsp h264parse h264pred hpeldsp tpeldsp 
videodsp"
diff --git a/doc/general.texi b/doc/general.texi
index 72f02b1d18..065374e3f2 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -857,6 +857,7 @@ following image formats are supported:
 @tab used in some games by Entertainment Software Partners
 @item ScreenPressor  @tab @tab  X
 @item Screenpresso   @tab @tab  X
+@item Screen Recorder Gold Codec  @tab @tab  X
 @item Sierra VMD video   @tab @tab  X
 @tab Used in Sierra VMD files.
 @item Silicon Graphics Motion Video Compressor 1 (MVC1)  @tab @tab  X
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 7398657dc4..3275654a45 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -541,6 +541,7 @@ OBJS-$(CONFIG_SONIC_ENCODER)   += sonic.o
 OBJS-$(CONFIG_SONIC_LS_ENCODER)+= sonic.o
 OBJS-$(CONFIG_SPEEDHQ_DECODER) += speedhq.o simple_idct.o
 OBJS-$(CONFIG_SP5X_DECODER)+= sp5xdec.o
+OBJS-$(CONFIG_SRGC_DECODER)+= mscc.o
 OBJS-$(CONFIG_SRT_DECODER) += srtdec.o ass.o htmlsubtitles.o
 OBJS-$(CONFIG_SRT_ENCODER) += srtenc.o ass_split.o
 OBJS-$(CONFIG_STL_DECODER) += textdec.o ass.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 5a708b3c3d..7fcc26f2c1 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -317,6 +317,7 @@ static void register_all(void)
 REGISTER_ENCDEC (SNOW,  snow);
 REGISTER_DECODER(SP5X,  sp5x);
 REGISTER_DECODER(SPEEDHQ,   speedhq);
+REGISTER_DECODER(SRGC,  srgc);
 REGISTER_ENCDEC (SUNRAST,   sunrast);
 REGISTER_ENCDEC (SVQ1,  svq1);
 REGISTER_DECODER(SVQ3,  svq3);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index da9d9dc256..fc928a1804 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -444,6 +444,7 @@ enum AVCodecID {
 AV_CODEC_ID_AV1,
 AV_CODEC_ID_BITPACKED,
 AV_CODEC_ID_MSCC,
+AV_CODEC_ID_SRGC,
 
 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
start of audio codecs
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index e342db714d..2d28f840af 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1395,6 +1395,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Mandsoft Screen Capture Codec"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
 },
+{
+.id= AV_CODEC_ID_SRGC,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "srgc",
+.long_name = NULL_IF_CONFIG_SMALL("Screen Recorder Gold Codec"),
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+},
 
 /* image codecs */
 {
diff --git a/libavcodec/mscc.c b/libavcodec/mscc.c
index c42889ae73..6e4dbb014d 100644
--- a/libavcodec/mscc.c
+++ b/libavcodec/mscc.c
@@ -121,6 +121,8 @@ static int decode_frame(AVCodecContext *avctx,
 {
 MSCCContext *s = avctx->priv_data;
 AVFrame *frame = data;
+uint8_t *buf = avpkt->data;
+int buf_size = avpkt->size;
 GetByteContext gb;
 PutByteContext pb;
 int ret, j;
@@ -130,15 +132,19 @@ static int decode_frame(AVCodecContext *avctx,
 if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
 return ret;
 
-avpkt->data[2] ^= avpkt->data[0];
+if (avctx->codec_id == AV_CODEC_ID_MSCC) {
+avpkt->data[2] ^= avpkt->data[0];
+buf += 2;
+buf_size -= 2;
+}
 
 ret = inflateReset(&s->zstream);
 if (ret != Z_O

[FFmpeg-cvslog] avcodec: add Mandsoft Screen Capture Codec decoder

2017-04-18 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Apr 15 10:57:07 
2017 +0200| [a96db6be06cfc7f179ed05f077e06bd1fa9d41ca] | committer: Paul B Mahol

avcodec: add Mandsoft Screen Capture Codec decoder

Signed-off-by: Paul B Mahol 

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

 configure   |   1 +
 doc/general.texi|   1 +
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/avcodec.h|   1 +
 libavcodec/codec_desc.c |   7 ++
 libavcodec/mscc.c   | 231 
 libavformat/riff.c  |   1 +
 8 files changed, 244 insertions(+)

diff --git a/configure b/configure
index c3cc32dc3a..2e2571493a 100755
--- a/configure
+++ b/configure
@@ -2471,6 +2471,7 @@ mpeg2video_encoder_select="aandcttables mpegvideoenc 
h263dsp"
 mpeg4_decoder_select="h263_decoder mpeg4video_parser"
 mpeg4_encoder_select="h263_encoder"
 msa1_decoder_select="mss34dsp"
+mscc_decoder_select="zlib"
 msmpeg4v1_decoder_select="h263_decoder"
 msmpeg4v2_decoder_select="h263_decoder"
 msmpeg4v2_encoder_select="h263_encoder"
diff --git a/doc/general.texi b/doc/general.texi
index a02437b7d2..72f02b1d18 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -789,6 +789,7 @@ following image formats are supported:
 @tab Used in LucasArts games / SMUSH animations.
 @item lossless MJPEG @tab  X  @tab  X
 @item MagicYUV Video @tab @tab  X
+@item Mandsoft Screen Capture Codec  @tab @tab  X
 @item Microsoft ATC Screen   @tab @tab  X
 @tab Also known as Microsoft Screen 3.
 @item Microsoft Expression Encoder Screen  @tab @tab  X
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 62f9db5c86..7398657dc4 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -429,6 +429,7 @@ OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec.o
 OBJS-$(CONFIG_MPEG4_OMX_ENCODER)   += omx.o
 OBJS-$(CONFIG_MPL2_DECODER)+= mpl2dec.o ass.o
 OBJS-$(CONFIG_MSA1_DECODER)+= mss3.o
+OBJS-$(CONFIG_MSCC_DECODER)+= mscc.o
 OBJS-$(CONFIG_MSMPEG4V1_DECODER)   += msmpeg4dec.o msmpeg4.o msmpeg4data.o
 OBJS-$(CONFIG_MSMPEG4V2_DECODER)   += msmpeg4dec.o msmpeg4.o msmpeg4data.o
 OBJS-$(CONFIG_MSMPEG4V2_ENCODER)   += msmpeg4enc.o msmpeg4.o msmpeg4data.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 379bd6e561..5a708b3c3d 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -258,6 +258,7 @@ static void register_all(void)
 REGISTER_DECODER(MPEG2_CRYSTALHD,   mpeg2_crystalhd);
 REGISTER_DECODER(MPEG2_QSV, mpeg2_qsv);
 REGISTER_DECODER(MSA1,  msa1);
+REGISTER_DECODER(MSCC,  mscc);
 REGISTER_DECODER(MSMPEG4V1, msmpeg4v1);
 REGISTER_ENCDEC (MSMPEG4V2, msmpeg4v2);
 REGISTER_ENCDEC (MSMPEG4V3, msmpeg4v3);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index ee133712b5..da9d9dc256 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -443,6 +443,7 @@ enum AVCodecID {
 AV_CODEC_ID_XPM,
 AV_CODEC_ID_AV1,
 AV_CODEC_ID_BITPACKED,
+AV_CODEC_ID_MSCC,
 
 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
start of audio codecs
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 7b2a1b9e93..e342db714d 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1388,6 +1388,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Bitpacked"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
 },
+{
+.id= AV_CODEC_ID_MSCC,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "mscc",
+.long_name = NULL_IF_CONFIG_SMALL("Mandsoft Screen Capture Codec"),
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+},
 
 /* image codecs */
 {
diff --git a/libavcodec/mscc.c b/libavcodec/mscc.c
new file mode 100644
index 00..c42889ae73
--- /dev/null
+++ b/libavcodec/mscc.c
@@ -0,0 +1,231 @@
+/*
+ * Mandsoft Screen Capture Codec decoder
+ *
+ * Copyright (c) 2017 Paul B Mahol
+ *
+ * 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 co

[FFmpeg-cvslog] avfilter: add deflicker filter

2017-04-20 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Tue Apr 18 15:18:40 
2017 +0200| [74acc1eec58288c9f3e35924a88807ab7dd33569] | committer: Paul B Mahol

avfilter: add deflicker filter

Signed-off-by: Paul B Mahol 

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

 Changelog  |   1 +
 doc/filters.texi   |  38 
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/version.h  |   4 +-
 libavfilter/vf_deflicker.c | 468 +
 6 files changed, 511 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index e76b324f61..8a4eb5ad76 100644
--- a/Changelog
+++ b/Changelog
@@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest 
within each release,
 releases are sorted from youngest to oldest.
 
 version :
+- deflicker video filter
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/doc/filters.texi b/doc/filters.texi
index e002f25932..83b811171a 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -6253,6 +6253,44 @@ Limit the maximum change for each plane, default is 
65535.
 If 0, plane will remain unchanged.
 @end table
 
+@section deflicker
+
+Remove temporal frame luminance variations.
+
+It accepts the following options:
+
+@table @option
+@item size, s
+Set moving-average filter size. Default is 5. Allowed range is 2 - 129.
+
+@item mode, m
+Set averaging mode to smooth temporal luminance variations.
+
+Available values are:
+@table @samp
+@item am
+Arithmetic mean
+
+@item gm
+Geometric mean
+
+@item hm
+Harmonic mean
+
+@item qm
+Quadratic mean
+
+@item cm
+Cubic mean
+
+@item pm
+Power mean
+
+@item median
+Median
+@end table
+@end table
+
 @section dejudder
 
 Remove judder produced by partially interlaced telecined content.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index d6daa7a8a8..6de7cc0ff3 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -155,6 +155,7 @@ OBJS-$(CONFIG_DCTDNOIZ_FILTER)   += 
vf_dctdnoiz.o
 OBJS-$(CONFIG_DEBAND_FILTER) += vf_deband.o
 OBJS-$(CONFIG_DECIMATE_FILTER)   += vf_decimate.o
 OBJS-$(CONFIG_DEFLATE_FILTER)+= vf_neighbor.o
+OBJS-$(CONFIG_DEFLICKER_FILTER)  += vf_deflicker.o
 OBJS-$(CONFIG_DEINTERLACE_QSV_FILTER)+= vf_deinterlace_qsv.o
 OBJS-$(CONFIG_DEINTERLACE_VAAPI_FILTER)  += vf_deinterlace_vaapi.o
 OBJS-$(CONFIG_DEJUDDER_FILTER)   += vf_dejudder.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index ec6ec048e8..0e69f99509 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -166,6 +166,7 @@ static void register_all(void)
 REGISTER_FILTER(DEBAND, deband, vf);
 REGISTER_FILTER(DECIMATE,   decimate,   vf);
 REGISTER_FILTER(DEFLATE,deflate,vf);
+REGISTER_FILTER(DEFLICKER,  deflicker,  vf);
 REGISTER_FILTER(DEINTERLACE_QSV,deinterlace_qsv,vf);
 REGISTER_FILTER(DEINTERLACE_VAAPI, deinterlace_vaapi, vf);
 REGISTER_FILTER(DEJUDDER,   dejudder,   vf);
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 1f9c7996c3..1f0b72a4fc 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -30,8 +30,8 @@
 #include "libavutil/version.h"
 
 #define LIBAVFILTER_VERSION_MAJOR   6
-#define LIBAVFILTER_VERSION_MINOR  84
-#define LIBAVFILTER_VERSION_MICRO 101
+#define LIBAVFILTER_VERSION_MINOR  85
+#define LIBAVFILTER_VERSION_MICRO 100
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
diff --git a/libavfilter/vf_deflicker.c b/libavfilter/vf_deflicker.c
new file mode 100644
index 00..3cda354b2b
--- /dev/null
+++ b/libavfilter/vf_deflicker.c
@@ -0,0 +1,468 @@
+/*
+ * Copyright (c) 2017 Paul B Mahol
+ *
+ * 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 "libavutil/imgutils.h"
+#include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/qsort.h"
+#include "avfilter.h"
+
+#define FF_BUFQUEUE_SIZE 129
+#include "buf

[FFmpeg-cvslog] avcodec/utvideodec: fix decoding odd sizes with interlaced video with some formats

2017-04-21 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Apr 21 12:27:17 
2017 +0200| [9ef21a897c64417a0575cbc6fad6222f3163d103] | committer: Paul B Mahol

avcodec/utvideodec: fix decoding odd sizes with interlaced video with some 
formats

Fixes #6316.

Signed-off-by: Paul B Mahol 

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

 libavcodec/utvideodec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index a49cae8e41..25e32a6055 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -238,7 +238,7 @@ static int decode_plane(UtvideoContext *c, int plane_no,
 VLC vlc;
 GetBitContext gb;
 int prev, fsym;
-const int cmask = ~(!plane_no && c->avctx->pix_fmt == AV_PIX_FMT_YUV420P);
+const int cmask = c->interlaced ? ~(1 + 2 * (!plane_no && 
c->avctx->pix_fmt == AV_PIX_FMT_YUV420P)) : ~(!plane_no && c->avctx->pix_fmt == 
AV_PIX_FMT_YUV420P);
 
 if (build_huff(src, &vlc, &fsym)) {
 av_log(c->avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n");

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


[FFmpeg-cvslog] avcodec/utvideodec: fix gradient prediction when stride does not match width

2017-04-21 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Apr 21 21:44:28 
2017 +0200| [49255370044cf4a58c81a88cb8206aee62086346] | committer: Paul B Mahol

avcodec/utvideodec: fix gradient prediction when stride does not match width

Fixes #6340.

Signed-off-by: Paul B Mahol 

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

 libavcodec/utvideodec.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index 25e32a6055..7979618f42 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -676,7 +676,11 @@ static void restore_gradient_planar_il(UtvideoContext *c, 
uint8_t *src, ptrdiff_
 C = bsrc[i - 1];
 bsrc[i] = (A - B + C + bsrc[i]) & 0xFF;
 }
-for (i = 0; i < width; i++) {
+A = bsrc[-stride];
+B = bsrc[-(1 + stride + stride - width)];
+C = bsrc[width - 1];
+bsrc[stride] = (A - B + C + bsrc[stride]) & 0xFF;
+for (i = 1; i < width; i++) {
 A = bsrc[i - stride];
 B = bsrc[i - (1 + stride)];
 C = bsrc[i - 1 + stride];
@@ -774,7 +778,11 @@ static void restore_gradient_packed_il(uint8_t *src, int 
step, ptrdiff_t stride,
 C = bsrc[i - step];
 bsrc[i] = (A - B + C + bsrc[i]) & 0xFF;
 }
-for (i = 0; i < width * step; i += step) {
+A = bsrc[-stride];
+B = bsrc[-(step + stride + stride - width * step)];
+C = bsrc[width * step - step];
+bsrc[stride] = (A - B + C + bsrc[stride]) & 0xFF;
+for (i = step; i < width * step; i += step) {
 A = bsrc[i - stride];
 B = bsrc[i - (step + stride)];
 C = bsrc[i - step + stride];

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


[FFmpeg-cvslog] avfilter: add doubleweave filter

2017-04-22 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Apr 22 13:07:33 
2017 +0200| [01729f77dd2a34d023d422e5d593861e864cf3de] | committer: Paul B Mahol

avfilter: add doubleweave filter

Signed-off-by: Paul B Mahol 

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

 Changelog|  1 +
 doc/filters.texi |  5 +++-
 libavfilter/Makefile |  1 +
 libavfilter/allfilters.c |  1 +
 libavfilter/version.h|  2 +-
 libavfilter/vf_weave.c   | 69 ++--
 6 files changed, 63 insertions(+), 16 deletions(-)

diff --git a/Changelog b/Changelog
index 8a4eb5ad76..ffc591d93f 100644
--- a/Changelog
+++ b/Changelog
@@ -3,6 +3,7 @@ releases are sorted from youngest to oldest.
 
 version :
 - deflicker video filter
+- doubleweave video filter
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/doc/filters.texi b/doc/filters.texi
index 36efc3369a..ac32995dea 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -14659,12 +14659,15 @@ Default is digital.
 Set background opacity.
 @end table
 
-@section weave
+@section weave, doubleweave
 
 The @code{weave} takes a field-based video input and join
 each two sequential fields into single frame, producing a new double
 height clip with half the frame rate and half the frame count.
 
+The @code{doubleweave} works same as @code{weave} but without
+halving frame rate and frame count.
+
 It accepts the following option:
 
 @table @option
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 6de7cc0ff3..50c5132555 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -164,6 +164,7 @@ OBJS-$(CONFIG_DESHAKE_FILTER)+= vf_deshake.o
 OBJS-$(CONFIG_DETELECINE_FILTER) += vf_detelecine.o
 OBJS-$(CONFIG_DILATION_FILTER)   += vf_neighbor.o
 OBJS-$(CONFIG_DISPLACE_FILTER)   += vf_displace.o framesync.o
+OBJS-$(CONFIG_DOUBLEWEAVE_FILTER)+= vf_weave.o
 OBJS-$(CONFIG_DRAWBOX_FILTER)+= vf_drawbox.o
 OBJS-$(CONFIG_DRAWGRAPH_FILTER)  += f_drawgraph.o
 OBJS-$(CONFIG_DRAWGRID_FILTER)   += vf_drawbox.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 0e69f99509..f482adb3c5 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -175,6 +175,7 @@ static void register_all(void)
 REGISTER_FILTER(DETELECINE, detelecine, vf);
 REGISTER_FILTER(DILATION,   dilation,   vf);
 REGISTER_FILTER(DISPLACE,   displace,   vf);
+REGISTER_FILTER(DOUBLEWEAVE,doubleweave,vf);
 REGISTER_FILTER(DRAWBOX,drawbox,vf);
 REGISTER_FILTER(DRAWGRAPH,  drawgraph,  vf);
 REGISTER_FILTER(DRAWGRID,   drawgrid,   vf);
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 1f0b72a4fc..8daadc3779 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  85
+#define LIBAVFILTER_VERSION_MINOR  86
 #define LIBAVFILTER_VERSION_MICRO 100
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
diff --git a/libavfilter/vf_weave.c b/libavfilter/vf_weave.c
index a5fc1b7403..6d3dd7c299 100644
--- a/libavfilter/vf_weave.c
+++ b/libavfilter/vf_weave.c
@@ -27,6 +27,7 @@
 typedef struct WeaveContext {
 const AVClass *class;
 int first_field;
+int double_weave;
 int nb_planes;
 int planeheight[4];
 int linesize[4];
@@ -56,10 +57,12 @@ static int config_props_output(AVFilterLink *outlink)
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
 int ret;
 
-outlink->time_base.num = inlink->time_base.num * 2;
-outlink->time_base.den = inlink->time_base.den;
-outlink->frame_rate.num = inlink->frame_rate.num;
-outlink->frame_rate.den = inlink->frame_rate.den * 2;
+if (!s->double_weave) {
+outlink->time_base.num = inlink->time_base.num * 2;
+outlink->time_base.den = inlink->time_base.den;
+outlink->frame_rate.num = inlink->frame_rate.num;
+outlink->frame_rate.den = inlink->frame_rate.den * 2;
+}
 outlink->w = inlink->w;
 outlink->h = inlink->h * 2;
 
@@ -96,22 +99,36 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 av_frame_copy_props(out, in);
 
 for (i = 0; i < s->nb_planes; i++) {
-av_image_copy_plane(out->data[i] + out->linesize[i] * s->first_field,
-out->linesize[i] * 2,
-in->data[i], in->linesize[i],
-s->linesize[i], s->planeheight[i]);
-av_image_copy_plane(out->data[i] + out->linesize[i] * !s->first_field,
-out->linesize[i]

[FFmpeg-cvslog] avcodec/dnxhd_parser: fix parsing interlaced video, simplify code

2017-04-23 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Apr 23 11:53:57 
2017 +0200| [ac30754a148df58822a272555d1f6f860e42037e] | committer: Paul B Mahol

avcodec/dnxhd_parser: fix parsing interlaced video, simplify code

There appears to be no need to treat interlaced videos differently,
also that code is flawed, as for at least one input cur_field would
be always 0.

Signed-off-by: Paul B Mahol 

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

 libavcodec/dnxhd_parser.c | 14 +-
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c
index de1cf5a041..d9914121a0 100644
--- a/libavcodec/dnxhd_parser.c
+++ b/libavcodec/dnxhd_parser.c
@@ -29,8 +29,6 @@
 
 typedef struct {
 ParseContext pc;
-int interlaced;
-int cur_field; /* first field is 0, second is 1 */
 int cur_byte;
 int remaining;
 int w, h;
@@ -43,8 +41,6 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
 uint64_t state = pc->state64;
 int pic_found = pc->frame_start_found;
 int i = 0;
-int interlaced = dctx->interlaced;
-int cur_field = dctx->cur_field;
 
 if (!pic_found) {
 for (i = 0; i < buf_size; i++) {
@@ -52,8 +48,6 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
 if (ff_dnxhd_check_header_prefix(state & 0xff00LL) != 0) {
 i++;
 pic_found = 1;
-interlaced = (state&2)>>1; /* byte following the 5-byte header 
prefix */
-cur_field = state&1;
 dctx->cur_byte = 0;
 dctx->remaining = 0;
 break;
@@ -84,13 +78,11 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
 if (dctx->remaining <= 0)
 return dctx->remaining;
 }
-if (buf_size - i >= dctx->remaining && (!dctx->interlaced || 
dctx->cur_field)) {
+if (buf_size - i + 47 >= dctx->remaining) {
 int remaining = dctx->remaining;
 
 pc->frame_start_found = 0;
 pc->state64 = -1;
-dctx->interlaced = interlaced;
-dctx->cur_field = 0;
 dctx->cur_byte = 0;
 dctx->remaining = 0;
 return remaining;
@@ -107,8 +99,6 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
 
 pc->frame_start_found = 0;
 pc->state64 = -1;
-dctx->interlaced = interlaced;
-dctx->cur_field = 0;
 dctx->cur_byte = 0;
 dctx->remaining = 0;
 return remaining;
@@ -116,8 +106,6 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
 }
 pc->frame_start_found = pic_found;
 pc->state64 = state;
-dctx->interlaced = interlaced;
-dctx->cur_field = cur_field;
 return END_NOT_FOUND;
 }
 

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


[FFmpeg-cvslog] avfilter/vf_maskedclamp: limit overshot and undershot to UINT16_MAX

2017-04-23 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Apr 23 17:36:33 
2017 +0200| [0699722ad050344c8bb04a7027849ec9e6e3ab90] | committer: Paul B Mahol

avfilter/vf_maskedclamp: limit overshot and undershot to UINT16_MAX

Signed-off-by: Paul B Mahol 

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

 libavfilter/vf_maskedclamp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_maskedclamp.c b/libavfilter/vf_maskedclamp.c
index 3e720b1972..3238e5146e 100644
--- a/libavfilter/vf_maskedclamp.c
+++ b/libavfilter/vf_maskedclamp.c
@@ -50,9 +50,9 @@ typedef struct MaskedClampContext {
 } MaskedClampContext;
 
 static const AVOption maskedclamp_options[] = {
-{ "undershoot", "set undershoot", OFFSET(undershoot), AV_OPT_TYPE_INT, 
{.i64=0},   0, INT_MAX, FLAGS },
-{ "overshoot",  "set overshoot",  OFFSET(overshoot),  AV_OPT_TYPE_INT, 
{.i64=0},   0, INT_MAX, FLAGS },
-{ "planes", "set planes", OFFSET(planes), AV_OPT_TYPE_INT, 
{.i64=0xF}, 0, 0xF, FLAGS },
+{ "undershoot", "set undershoot", OFFSET(undershoot), AV_OPT_TYPE_INT, 
{.i64=0},   0, UINT16_MAX, FLAGS },
+{ "overshoot",  "set overshoot",  OFFSET(overshoot),  AV_OPT_TYPE_INT, 
{.i64=0},   0, UINT16_MAX, FLAGS },
+{ "planes", "set planes", OFFSET(planes), AV_OPT_TYPE_INT, 
{.i64=0xF}, 0, 0xF,FLAGS },
 { NULL }
 };
 

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


[FFmpeg-cvslog] avfilter/vf_premultiply: add planes option

2017-04-23 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Apr 23 18:19:40 
2017 +0200| [710c97d5f6a880597701ea7b3ad56920cd0fb731] | committer: Paul B Mahol

avfilter/vf_premultiply: add planes option

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi |  8 
 libavfilter/vf_premultiply.c | 13 -
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index ac32995dea..4c733f016e 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -11077,6 +11077,14 @@ of second stream as alpha.
 
 Both streams must have same dimensions and same pixel format.
 
+The filter accepts the following option:
+
+@table @option
+@item planes
+Set which planes will be processed, unprocessed planes will be copied.
+By default value 0xf, all planes will be processed.
+@end table
+
 @section prewitt
 Apply prewitt operator to input video stream.
 
diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c
index e1b79ab779..8a5f9eac64 100644
--- a/libavfilter/vf_premultiply.c
+++ b/libavfilter/vf_premultiply.c
@@ -30,6 +30,7 @@
 typedef struct PreMultiplyContext {
 const AVClass *class;
 int width[4], height[4];
+int linesize[4];
 int nb_planes;
 int planes;
 int half, depth, offset;
@@ -47,6 +48,7 @@ typedef struct PreMultiplyContext {
 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
 static const AVOption premultiply_options[] = {
+{ "planes", "set planes", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=0xF}, 0, 
0xF, FLAGS },
 { NULL }
 };
 
@@ -269,6 +271,12 @@ static int process_frame(FFFrameSync *fs)
 }
 
 for (p = 0; p < s->nb_planes; p++) {
+if (!((1 << p) & s->planes)) {
+av_image_copy_plane(out->data[p], out->linesize[p], 
base->data[p], base->linesize[p],
+s->linesize[p], s->height[p]);
+continue;
+}
+
 s->premultiply[p](base->data[p], alpha->data[0],
   out->data[p],
   base->linesize[p], alpha->linesize[0],
@@ -287,10 +295,13 @@ static int config_input(AVFilterLink *inlink)
 AVFilterContext *ctx = inlink->dst;
 PreMultiplyContext *s = ctx->priv;
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
-int vsub, hsub;
+int vsub, hsub, ret;
 
 s->nb_planes = av_pix_fmt_count_planes(inlink->format);
 
+if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, 
inlink->w)) < 0)
+return ret;
+
 hsub = desc->log2_chroma_w;
 vsub = desc->log2_chroma_h;
 s->height[1] = s->height[2] = AV_CEIL_RSHIFT(inlink->h, vsub);

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


[FFmpeg-cvslog] avfilter/vf_maskedclamp: fix bug when copying >8bit plane(s)

2017-04-23 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Apr 23 18:01:00 
2017 +0200| [9d1f9ba582aa8b62d08922a126fe36784d434003] | committer: Paul B Mahol

avfilter/vf_maskedclamp: fix bug when copying >8bit plane(s)

Signed-off-by: Paul B Mahol 

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

 libavfilter/vf_maskedclamp.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_maskedclamp.c b/libavfilter/vf_maskedclamp.c
index 3238e5146e..25c1a73be0 100644
--- a/libavfilter/vf_maskedclamp.c
+++ b/libavfilter/vf_maskedclamp.c
@@ -37,6 +37,7 @@ typedef struct MaskedClampContext {
 int undershoot;
 int overshoot;
 
+int linesize[4];
 int width[4], height[4];
 int nb_planes;
 int depth;
@@ -112,7 +113,7 @@ static int process_frame(FFFrameSync *fs)
 for (p = 0; p < s->nb_planes; p++) {
 if (!((1 << p) & s->planes)) {
 av_image_copy_plane(out->data[p], out->linesize[p], 
base->data[p], base->linesize[p],
-s->width[p], s->height[p]);
+s->linesize[p], s->height[p]);
 continue;
 }
 
@@ -195,10 +196,13 @@ static int config_input(AVFilterLink *inlink)
 AVFilterContext *ctx = inlink->dst;
 MaskedClampContext *s = ctx->priv;
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
-int vsub, hsub;
+int vsub, hsub, ret;
 
 s->nb_planes = av_pix_fmt_count_planes(inlink->format);
 
+if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, 
inlink->w)) < 0)
+return ret;
+
 hsub = desc->log2_chroma_w;
 vsub = desc->log2_chroma_h;
 s->height[1] = s->height[2] = AV_CEIL_RSHIFT(inlink->h, vsub);

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


[FFmpeg-cvslog] avfilter/vf_maskedmerge: fix bug when copying >8bit plane(s)

2017-04-23 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Apr 23 18:31:05 
2017 +0200| [f4218d93efaefb2fb1a1dfcf45d6917a397e96ed] | committer: Paul B Mahol

avfilter/vf_maskedmerge: fix bug when copying >8bit plane(s)

Signed-off-by: Paul B Mahol 

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

 libavfilter/maskedmerge.h| 1 +
 libavfilter/vf_maskedmerge.c | 5 -
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavfilter/maskedmerge.h b/libavfilter/maskedmerge.h
index a8c7551bad..8e2b1cf676 100644
--- a/libavfilter/maskedmerge.h
+++ b/libavfilter/maskedmerge.h
@@ -27,6 +27,7 @@
 typedef struct MaskedMergeContext {
 const AVClass *class;
 int width[4], height[4];
+int linesize[4];
 int nb_planes;
 int planes;
 int half, depth;
diff --git a/libavfilter/vf_maskedmerge.c b/libavfilter/vf_maskedmerge.c
index 2c42d62d8a..cf8a56814e 100644
--- a/libavfilter/vf_maskedmerge.c
+++ b/libavfilter/vf_maskedmerge.c
@@ -91,7 +91,7 @@ static int process_frame(FFFrameSync *fs)
 for (p = 0; p < s->nb_planes; p++) {
 if (!((1 << p) & s->planes)) {
 av_image_copy_plane(out->data[p], out->linesize[p], 
base->data[p], base->linesize[p],
-s->width[p], s->height[p]);
+s->linesize[p], s->height[p]);
 continue;
 }
 
@@ -229,6 +229,9 @@ static int config_output(AVFilterLink *outlink)
 outlink->sample_aspect_ratio = base->sample_aspect_ratio;
 outlink->frame_rate = base->frame_rate;
 
+if ((ret = av_image_fill_linesizes(s->linesize, outlink->format, 
outlink->w)) < 0)
+return ret;
+
 if ((ret = ff_framesync_init(&s->fs, ctx, 3)) < 0)
 return ret;
 

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


[FFmpeg-cvslog] avfilter: add lumakey filter

2017-04-24 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Apr 23 19:59:32 
2017 +0200| [dfc4ce5f5ddb7ae0934bb3ca40b99932cf3e1cb0] | committer: Paul B Mahol

avfilter: add lumakey filter

Signed-off-by: Paul B Mahol 

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

 Changelog|   1 +
 doc/filters.texi |  20 +
 libavfilter/Makefile |   1 +
 libavfilter/allfilters.c |   1 +
 libavfilter/version.h|   2 +-
 libavfilter/vf_lumakey.c | 201 +++
 6 files changed, 225 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index ffc591d93f..f1fb014cdb 100644
--- a/Changelog
+++ b/Changelog
@@ -4,6 +4,7 @@ releases are sorted from youngest to oldest.
 version :
 - deflicker video filter
 - doubleweave video filter
+- lumakey video filter
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/doc/filters.texi b/doc/filters.texi
index 4c733f016e..0ee6792926 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -9278,6 +9278,26 @@ Interpolate values using a tetrahedron.
 @end table
 @end table
 
+@section lumakey
+
+Turn certain luma values into transparency.
+
+The filter accepts the following options:
+
+@table @option
+@item threshold
+Set the luma which will be used as base for transparency.
+Default value is @code{0}.
+
+@item tolerance
+Set the range of luma values to be keyed out.
+Default value is @code{0}.
+
+@item softness
+Set the range of softness. Default value is @code{0}.
+Use this to control gradual transition from zero to full transparency.
+@end table
+
 @section lut, lutrgb, lutyuv
 
 Compute a look-up table for binding each pixel component input value
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 50c5132555..074c6907ef 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -212,6 +212,7 @@ OBJS-$(CONFIG_INTERLEAVE_FILTER) += 
f_interleave.o
 OBJS-$(CONFIG_KERNDEINT_FILTER)  += vf_kerndeint.o
 OBJS-$(CONFIG_LENSCORRECTION_FILTER) += vf_lenscorrection.o
 OBJS-$(CONFIG_LOOP_FILTER)   += f_loop.o
+OBJS-$(CONFIG_LUMAKEY_FILTER)+= vf_lumakey.o
 OBJS-$(CONFIG_LUT_FILTER)+= vf_lut.o
 OBJS-$(CONFIG_LUT2_FILTER)   += vf_lut2.o framesync.o
 OBJS-$(CONFIG_LUT3D_FILTER)  += vf_lut3d.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index f482adb3c5..c69f79e6ac 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -223,6 +223,7 @@ static void register_all(void)
 REGISTER_FILTER(KERNDEINT,  kerndeint,  vf);
 REGISTER_FILTER(LENSCORRECTION, lenscorrection, vf);
 REGISTER_FILTER(LOOP,   loop,   vf);
+REGISTER_FILTER(LUMAKEY,lumakey,vf);
 REGISTER_FILTER(LUT,lut,vf);
 REGISTER_FILTER(LUT2,   lut2,   vf);
 REGISTER_FILTER(LUT3D,  lut3d,  vf);
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 8daadc3779..2fa8dbda95 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  86
+#define LIBAVFILTER_VERSION_MINOR  87
 #define LIBAVFILTER_VERSION_MICRO 100
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
diff --git a/libavfilter/vf_lumakey.c b/libavfilter/vf_lumakey.c
new file mode 100644
index 00..418538f929
--- /dev/null
+++ b/libavfilter/vf_lumakey.c
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2017 Paul B Mahol
+ *
+ * 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 "libavutil/opt.h"
+#include "libavutil/imgutils.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
+
+typedef struct LumakeyContext {
+const AVClass *class;
+
+int threshold;
+int tolerance;
+int softness;
+
+int white;
+int black;
+int max;
+
+int (*do_lumakey_slice)(AVFilterContext *ctx, void *arg, int jobnr, int 
nb_jobs);
+} LumakeyContext;
+
+static int d

[FFmpeg-cvslog] avcodec/dnxhd_parser: fix parsing interlaced video, simplify code

2017-04-24 Thread Paul B Mahol
ffmpeg | branch: release/3.3 | Paul B Mahol  | Sun Apr 23 
11:53:57 2017 +0200| [da693f8daa62cb76a2aa05021d6c8d53a1b816b2] | committer: 
Marton Balint

avcodec/dnxhd_parser: fix parsing interlaced video, simplify code

There appears to be no need to treat interlaced videos differently,
also that code is flawed, as for at least one input cur_field would
be always 0.

Fixes ticket #6344.

Signed-off-by: Paul B Mahol 
(cherry picked from commit ac30754a148df58822a272555d1f6f860e42037e)

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

 libavcodec/dnxhd_parser.c | 14 +-
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c
index 4f9bbceeeb..a1f632a620 100644
--- a/libavcodec/dnxhd_parser.c
+++ b/libavcodec/dnxhd_parser.c
@@ -29,8 +29,6 @@
 
 typedef struct {
 ParseContext pc;
-int interlaced;
-int cur_field; /* first field is 0, second is 1 */
 int cur_byte;
 int remaining;
 int w, h;
@@ -56,8 +54,6 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
 uint64_t state = pc->state64;
 int pic_found = pc->frame_start_found;
 int i = 0;
-int interlaced = dctx->interlaced;
-int cur_field = dctx->cur_field;
 
 if (!pic_found) {
 for (i = 0; i < buf_size; i++) {
@@ -65,8 +61,6 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
 if (ff_dnxhd_check_header_prefix(state & 0xff00LL) != 0) {
 i++;
 pic_found = 1;
-interlaced = (state&2)>>1; /* byte following the 5-byte header 
prefix */
-cur_field = state&1;
 dctx->cur_byte = 0;
 dctx->remaining = 0;
 break;
@@ -97,13 +91,11 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
 if (dctx->remaining <= 0)
 return dctx->remaining;
 }
-if (buf_size - i >= dctx->remaining && (!dctx->interlaced || 
dctx->cur_field)) {
+if (buf_size - i + 47 >= dctx->remaining) {
 int remaining = dctx->remaining;
 
 pc->frame_start_found = 0;
 pc->state64 = -1;
-dctx->interlaced = interlaced;
-dctx->cur_field = 0;
 dctx->cur_byte = 0;
 dctx->remaining = 0;
 return remaining;
@@ -120,8 +112,6 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
 
 pc->frame_start_found = 0;
 pc->state64 = -1;
-dctx->interlaced = interlaced;
-dctx->cur_field = 0;
 dctx->cur_byte = 0;
 dctx->remaining = 0;
 return remaining;
@@ -129,8 +119,6 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
 }
 pc->frame_start_found = pic_found;
 pc->state64 = state;
-dctx->interlaced = interlaced;
-dctx->cur_field = cur_field;
 return END_NOT_FOUND;
 }
 

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


[FFmpeg-cvslog] avfilter/af_biquads: allow filtering only selected channels

2017-04-25 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Tue Apr 25 18:08:26 
2017 +0200| [9d08c7bd424c60dc9f8816f91ca1856cbb70d57d] | committer: Paul B Mahol

avfilter/af_biquads: allow filtering only selected channels

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi | 26 ++
 libavfilter/af_biquads.c | 30 +-
 2 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 0ee6792926..2fe7ff7b8c 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1040,6 +1040,9 @@ slope
 
 @item width, w
 Specify the band-width of a filter in width_type units.
+
+@item channels, c
+Specify which channels to filter, by default all available are filtered.
 @end table
 
 @section aloop
@@ -1767,6 +1770,9 @@ slope
 
 @item width, w
 Specify the band-width of a filter in width_type units.
+
+@item channels, c
+Specify which channels to filter, by default all available are filtered.
 @end table
 
 @section bandreject
@@ -1796,6 +1802,9 @@ slope
 
 @item width, w
 Specify the band-width of a filter in width_type units.
+
+@item channels, c
+Specify which channels to filter, by default all available are filtered.
 @end table
 
 @section bass
@@ -1832,6 +1841,9 @@ slope
 
 @item width, w
 Determine how steep is the filter's shelf transition.
+
+@item channels, c
+Specify which channels to filter, by default all available are filtered.
 @end table
 
 @section biquad
@@ -1839,6 +1851,8 @@ Determine how steep is the filter's shelf transition.
 Apply a biquad IIR filter with the given coefficients.
 Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
 are the numerator and denominator coefficients respectively.
+and @var{channels}, @var{c} specify which channels to filter, by default all
+available are filtered.
 
 @section bs2b
 Bauer stereo to binaural transformation, which improves headphone listening of
@@ -2417,6 +2431,9 @@ Specify the band-width of a filter in width_type units.
 @item gain, g
 Set the required gain or attenuation in dB.
 Beware of clipping when using a positive gain.
+
+@item channels, c
+Specify which channels to filter, by default all available are filtered.
 @end table
 
 @subsection Examples
@@ -2718,6 +2735,9 @@ slope
 Specify the band-width of a filter in width_type units.
 Applies only to double-pole filter.
 The default is 0.707q and gives a Butterworth response.
+
+@item channels, c
+Specify which channels to filter, by default all available are filtered.
 @end table
 
 @section join
@@ -2977,6 +2997,9 @@ slope
 Specify the band-width of a filter in width_type units.
 Applies only to double-pole filter.
 The default is 0.707q and gives a Butterworth response.
+
+@item channels, c
+Specify which channels to filter, by default all available are filtered.
 @end table
 
 @anchor{pan}
@@ -3663,6 +3686,9 @@ slope
 
 @item width, w
 Determine how steep is the filter's shelf transition.
+
+@item channels, c
+Specify which channels to filter, by default all available are filtered.
 @end table
 
 @section tremolo
diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c
index a39d09dbec..f62ab9ef9f 100644
--- a/libavfilter/af_biquads.c
+++ b/libavfilter/af_biquads.c
@@ -105,12 +105,14 @@ typedef struct BiquadsContext {
 double gain;
 double frequency;
 double width;
+uint64_t channels;
 
 double a0, a1, a2;
 double b0, b1, b2;
 
 ChanCache *cache;
 int clippings;
+int block_align;
 
 void (*filter)(struct BiquadsContext *s, const void *ibuf, void *obuf, int 
len,
double *i1, double *i2, double *o1, double *o2,
@@ -388,6 +390,8 @@ static int config_output(AVFilterLink *outlink)
 default: av_assert0(0);
 }
 
+s->block_align = av_get_bytes_per_sample(inlink->format);
+
 return 0;
 }
 
@@ -411,12 +415,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*buf)
 av_frame_copy_props(out_buf, buf);
 }
 
-for (ch = 0; ch < buf->channels; ch++)
+for (ch = 0; ch < buf->channels; ch++) {
+if (!((av_channel_layout_extract_channel(inlink->channel_layout, ch) & 
s->channels))) {
+if (buf != out_buf)
+memcpy(out_buf->extended_data[ch], buf->extended_data[ch], 
nb_samples * s->block_align);
+continue;
+}
 s->filter(s, buf->extended_data[ch],
   out_buf->extended_data[ch], nb_samples,
   &s->cache[ch].i1, &s->cache[ch].i2,
   &s->cache[ch].o1, &s->cache[ch].o2,
   s->b0, s->b1, s->b2, s->a1, s->a2);
+}
 
 if (s->clippings > 0)
 av_log(ctx, AV_LOG_WARNING, "clipping %d times. Please reduce 
gain.\n", s->clippings);
@@ -491,6 +501,8 @@ static const

[FFmpeg-cvslog] doc/filters: add one lowpass filter example

2017-04-29 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Apr 29 11:44:21 
2017 +0200| [b8b0cece794d8338ec79833c55e77d53888f800f] | committer: Paul B Mahol

doc/filters: add one lowpass filter example

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 2fe7ff7b8c..d49fec1264 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3002,6 +3002,15 @@ The default is 0.707q and gives a Butterworth response.
 Specify which channels to filter, by default all available are filtered.
 @end table
 
+@subsection Examples
+@itemize
+@item
+Lowpass only LFE channel, it LFE is not present it does nothing:
+@example
+lowpass=c=LFE
+@end example
+@end itemize
+
 @anchor{pan}
 @section pan
 

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


[FFmpeg-cvslog] avfilter: add video oscilloscope filter

2017-04-29 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Tue Apr 25 19:31:05 
2017 +0200| [399c7ab9c6bc9e683c5a60b34d50290ae563e2f1] | committer: Paul B Mahol

avfilter: add video oscilloscope filter

Signed-off-by: Paul B Mahol 

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

 Changelog  |   2 +
 doc/filters.texi   |  78 ++
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/vf_datascope.c | 381 +
 5 files changed, 463 insertions(+)

diff --git a/Changelog b/Changelog
index 6deda6d64d..faaaf8a493 100644
--- a/Changelog
+++ b/Changelog
@@ -5,6 +5,8 @@ version :
 - deflicker video filter
 - doubleweave video filter
 - lumakey video filter
+- pixscope video filter
+- oscilloscope video filter
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/doc/filters.texi b/doc/filters.texi
index 773ab246b2..119e7474a5 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10233,6 +10233,84 @@ other parameters is 0.
 These parameters correspond to the parameters assigned to the
 libopencv function @code{cvSmooth}.
 
+@section oscilloscope
+
+2D Video Oscilloscope.
+
+Useful to measure spatial impulse, step responses, chroma delays, etc.
+
+It accepts the following parameters:
+
+@table @option
+@item x
+Set scope center x position.
+
+@item y
+Set scope center y position.
+
+@item s
+Set scope size, relative to frame diagonal.
+
+@item t
+Set scope tilt/rotation.
+
+@item o
+Set trace opacity.
+
+@item tx
+Set trace center x position.
+
+@item ty
+Set trace center y position.
+
+@item tw
+Set trace width, relative to width of frame.
+
+@item th
+Set trace height, relative to height of frame.
+
+@item c
+Set which components to trace. By default it traces first three components.
+
+@item g
+Draw trace grid. By default is enabled.
+
+@item st
+Draw some statistics. By default is enabled.
+
+@item sc
+Draw scope. By default is enabled.
+@end table
+
+@subsection Examples
+
+@itemize
+@item
+Inspect full first row of video frame.
+@example
+oscilloscope=x=0.5:y=0:s=1
+@end example
+
+@item
+Inspect full last row of video frame.
+@example
+oscilloscope=x=0.5:y=1:s=1
+@end example
+
+@item
+Inspect full 5th line of video frame of height 1080.
+@example
+oscilloscope=x=0.5:y=5/1080:s=1
+@end example
+
+@item
+Inspect full last column of video frame.
+@example
+oscilloscope=x=1:y=0.5:s=1:t=1
+@end example
+
+@end itemize
+
 @anchor{overlay}
 @section overlay
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index e40c6fea32..66c36e4d1d 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -236,6 +236,7 @@ OBJS-$(CONFIG_NULL_FILTER)   += vf_null.o
 OBJS-$(CONFIG_OCR_FILTER)+= vf_ocr.o
 OBJS-$(CONFIG_OCV_FILTER)+= vf_libopencv.o
 OBJS-$(CONFIG_OPENCL)+= deshake_opencl.o 
unsharp_opencl.o
+OBJS-$(CONFIG_OSCILLOSCOPE_FILTER)   += vf_datascope.o
 OBJS-$(CONFIG_OVERLAY_FILTER)+= vf_overlay.o dualinput.o 
framesync.o
 OBJS-$(CONFIG_OWDENOISE_FILTER)  += vf_owdenoise.o
 OBJS-$(CONFIG_PAD_FILTER)+= vf_pad.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 0852b54e6f..8fb87eb81e 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -246,6 +246,7 @@ static void register_all(void)
 REGISTER_FILTER(NULL,   null,   vf);
 REGISTER_FILTER(OCR,ocr,vf);
 REGISTER_FILTER(OCV,ocv,vf);
+REGISTER_FILTER(OSCILLOSCOPE,   oscilloscope,   vf);
 REGISTER_FILTER(OVERLAY,overlay,vf);
 REGISTER_FILTER(OWDENOISE,  owdenoise,  vf);
 REGISTER_FILTER(PAD,pad,vf);
diff --git a/libavfilter/vf_datascope.c b/libavfilter/vf_datascope.c
index 37425b4508..476e65f6c6 100644
--- a/libavfilter/vf_datascope.c
+++ b/libavfilter/vf_datascope.c
@@ -641,3 +641,384 @@ AVFilter ff_vf_pixscope = {
 .inputs= pixscope_inputs,
 .outputs   = pixscope_outputs,
 };
+
+typedef struct PixelValues {
+uint16_t p[4];
+} PixelValues;
+
+typedef struct OscilloscopeContext {
+const AVClass *class;
+
+float xpos, ypos;
+float tx, ty;
+float size;
+float tilt;
+float theight, twidth;
+float o;
+int components;
+int grid;
+int statistics;
+int scope;
+
+int x1, y1, x2, y2;
+int ox, oy;
+int height, width;
+
+int max;
+int nb_planes;
+int nb_comps;
+int is_rgb;
+uint8_t rgba_map[4];
+FFDrawContext draw;
+FFDrawColor   dark;
+FFDrawColor   black;
+FFDrawColor   white;
+FFDrawColor   green;
+FFDrawColor   blue;
+FFDrawColor   red;
+FFDrawColor   cyan;
+FFDrawColor   magenta;
+FFDrawColor   gray;
+FFDrawColor  *colors[4];
+
+int nb_val

[FFmpeg-cvslog] avfilter: add pixscope filter

2017-04-29 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Apr 22 22:02:49 
2017 +0200| [8341d0dd0e5fe5aecc2f4aca7e8447e6aeb7c124] | committer: Paul B Mahol

avfilter: add pixscope filter

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi   |  23 +
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/version.h  |   2 +-
 libavfilter/vf_datascope.c | 236 +++--
 5 files changed, 255 insertions(+), 8 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index d49fec1264..773ab246b2 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10925,6 +10925,29 @@ format=monow, pixdesctest
 
 can be used to test the monowhite pixel format descriptor definition.
 
+@section pixscope
+
+Display sample values of color channels. Mainly useful for checking color and 
levels.
+
+The filters accept the following options:
+
+@table @option
+@item x
+Set scope X position, offset on X axis.
+
+@item y
+Set scope Y position, offset on Y axis.
+
+@item w
+Set scope width.
+
+@item h
+Set scope height.
+
+@item o
+Set window opacity. This window also holds statistics about pixel area.
+@end table
+
 @section pp
 
 Enable the specified chain of postprocessing subfilters using libpostproc. This
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 074c6907ef..e40c6fea32 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -245,6 +245,7 @@ OBJS-$(CONFIG_PERMS_FILTER)  += f_perms.o
 OBJS-$(CONFIG_PERSPECTIVE_FILTER)+= vf_perspective.o
 OBJS-$(CONFIG_PHASE_FILTER)  += vf_phase.o
 OBJS-$(CONFIG_PIXDESCTEST_FILTER)+= vf_pixdesctest.o
+OBJS-$(CONFIG_PIXSCOPE_FILTER)   += vf_datascope.o
 OBJS-$(CONFIG_PP_FILTER) += vf_pp.o
 OBJS-$(CONFIG_PP7_FILTER)+= vf_pp7.o
 OBJS-$(CONFIG_PREMULTIPLY_FILTER)+= vf_premultiply.o framesync.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index c69f79e6ac..0852b54e6f 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -255,6 +255,7 @@ static void register_all(void)
 REGISTER_FILTER(PERSPECTIVE,perspective,vf);
 REGISTER_FILTER(PHASE,  phase,  vf);
 REGISTER_FILTER(PIXDESCTEST,pixdesctest,vf);
+REGISTER_FILTER(PIXSCOPE,   pixscope,   vf);
 REGISTER_FILTER(PP, pp, vf);
 REGISTER_FILTER(PP7,pp7,vf);
 REGISTER_FILTER(PREMULTIPLY,premultiply,vf);
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 2fa8dbda95..fb232c8e8a 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  87
+#define LIBAVFILTER_VERSION_MINOR  88
 #define LIBAVFILTER_VERSION_MICRO 100
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
diff --git a/libavfilter/vf_datascope.c b/libavfilter/vf_datascope.c
index 01a5d992b0..37425b4508 100644
--- a/libavfilter/vf_datascope.c
+++ b/libavfilter/vf_datascope.c
@@ -76,7 +76,7 @@ static int query_formats(AVFilterContext *ctx)
 return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0));
 }
 
-static void draw_text(DatascopeContext *s, AVFrame *frame, FFDrawColor *color,
+static void draw_text(FFDrawContext *draw, AVFrame *frame, FFDrawColor *color,
   int x0, int y0, const uint8_t *text, int vertical)
 {
 int x = x0;
@@ -87,7 +87,7 @@ static void draw_text(DatascopeContext *s, AVFrame *frame, 
FFDrawColor *color,
 y0 += 8;
 continue;
 }
-ff_blend_mask(&s->draw, color, frame->data, frame->linesize,
+ff_blend_mask(draw, color, frame->data, frame->linesize,
   frame->width, frame->height,
   avpriv_cga_font + *text * 8, 1, 8, 8, 0, 0, x, y0);
 if (vertical) {
@@ -201,7 +201,7 @@ static int filter_color2(AVFilterContext *ctx, void *arg, 
int jobnr, int nb_jobs
 char text[256];
 
 snprintf(text, sizeof(text), format[C>>2], value[p]);
-draw_text(s, out, &reverse, xoff + x * C * 10 + 2, yoff + y * 
P * 12 + p * 10 + 2, text, 0);
+draw_text(&s->draw, out, &reverse, xoff + x * C * 10 + 2, yoff 
+ y * P * 12 + p * 10 + 2, text, 0);
 }
 }
 }
@@ -239,7 +239,7 @@ static int filter_color(AVFilterContext *ctx, void *arg, 
int jobnr, int nb_jobs)
 char text[256];
 
 snprintf(text, sizeof(text), format[C>>2], value[p]);
-draw_text(s, out, &color, xoff + x * C * 10 + 2, yoff + y * P 
* 12 + p * 10 + 2, text, 0);
+

[FFmpeg-cvslog] avfilter/af_crystalizer: add support for more sample formats

2017-04-30 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Apr 30 12:56:23 
2017 +0200| [8dd3a53dbf7dfbca4f8a750936f0ba3849a3f0b8] | committer: Paul B Mahol

avfilter/af_crystalizer: add support for more sample formats

Signed-off-by: Paul B Mahol 

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

 libavfilter/af_crystalizer.c | 148 ---
 1 file changed, 126 insertions(+), 22 deletions(-)

diff --git a/libavfilter/af_crystalizer.c b/libavfilter/af_crystalizer.c
index 086549a93d..dec30aa5f4 100644
--- a/libavfilter/af_crystalizer.c
+++ b/libavfilter/af_crystalizer.c
@@ -29,6 +29,8 @@ typedef struct CrystalizerContext {
 float mult;
 int clip;
 AVFrame *prev;
+void (*filter)(void **dst, void **prv, const void **src,
+   int nb_samples, int channels, float mult, int clip);
 } CrystalizerContext;
 
 #define OFFSET(x) offsetof(CrystalizerContext, x)
@@ -46,10 +48,18 @@ static int query_formats(AVFilterContext *ctx)
 {
 AVFilterFormats *formats = NULL;
 AVFilterChannelLayouts *layouts = NULL;
+static const enum AVSampleFormat sample_fmts[] = {
+AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
+AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
+AV_SAMPLE_FMT_NONE
+};
 int ret;
 
-if ((ret = ff_add_format(&formats, AV_SAMPLE_FMT_FLT )) < 0 ||
-(ret = ff_set_common_formats(ctx , formats   )) < 0)
+formats = ff_make_format_list(sample_fmts);
+if (!formats)
+return AVERROR(ENOMEM);
+ret = ff_set_common_formats(ctx, formats);
+if (ret < 0)
 return ret;
 
 layouts = ff_all_channel_counts();
@@ -64,16 +74,123 @@ static int query_formats(AVFilterContext *ctx)
 return ff_set_common_samplerates(ctx, formats);
 }
 
+static void filter_flt(void **d, void **p, const void **s,
+   int nb_samples, int channels,
+   float mult, int clip)
+{
+const float *src = s[0];
+float *dst = d[0];
+float *prv = p[0];
+int n, c;
+
+for (n = 0; n < nb_samples; n++) {
+for (c = 0; c < channels; c++) {
+float current = src[c];
+
+dst[c] = current + (current - prv[c]) * mult;
+prv[c] = current;
+if (clip) {
+dst[c] = av_clipf(dst[c], -1, 1);
+}
+}
+
+dst += c;
+src += c;
+}
+}
+
+static void filter_dbl(void **d, void **p, const void **s,
+   int nb_samples, int channels,
+   float mult, int clip)
+{
+const double *src = s[0];
+double *dst = d[0];
+double *prv = p[0];
+int n, c;
+
+for (n = 0; n < nb_samples; n++) {
+for (c = 0; c < channels; c++) {
+double current = src[c];
+
+dst[c] = current + (current - prv[c]) * mult;
+prv[c] = current;
+if (clip) {
+dst[c] = av_clipd(dst[c], -1, 1);
+}
+}
+
+dst += c;
+src += c;
+}
+}
+
+static void filter_fltp(void **d, void **p, const void **s,
+int nb_samples, int channels,
+float mult, int clip)
+{
+int n, c;
+
+for (c = 0; c < channels; c++) {
+const float *src = s[c];
+float *dst = d[c];
+float *prv = p[c];
+
+for (n = 0; n < nb_samples; n++) {
+float current = src[n];
+
+dst[n] = current + (current - prv[0]) * mult;
+prv[0] = current;
+if (clip) {
+dst[n] = av_clipf(dst[n], -1, 1);
+}
+}
+}
+}
+
+static void filter_dblp(void **d, void **p, const void **s,
+int nb_samples, int channels,
+float mult, int clip)
+{
+int n, c;
+
+for (c = 0; c < channels; c++) {
+const double *src = s[c];
+double *dst = d[c];
+double *prv = p[c];
+
+for (n = 0; n < nb_samples; n++) {
+double current = src[n];
+
+dst[n] = current + (current - prv[0]) * mult;
+prv[0] = current;
+if (clip) {
+dst[n] = av_clipd(dst[n], -1, 1);
+}
+}
+}
+}
+
+static int config_input(AVFilterLink *inlink)
+{
+AVFilterContext *ctx = inlink->dst;
+CrystalizerContext *s= ctx->priv;
+
+switch (inlink->format) {
+case AV_SAMPLE_FMT_FLT:  s->filter = filter_flt;  break;
+case AV_SAMPLE_FMT_DBL:  s->filter = filter_dbl;  break;
+case AV_SAMPLE_FMT_FLTP: s->filter = filter_fltp; break;
+case AV_SAMPLE_FMT_DBLP: s->filter = filter_dblp; break;
+}
+
+return 0;
+}
+
 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 {
 AVFilterContext *ctx = inlink->dst;
 AVFilterLink *outlink = ctx->outputs[0];
 CrystalizerContext *s = ctx->priv;
-  

[FFmpeg-cvslog] avfilter/vf_histogram: actually add parade display mode

2017-05-09 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Tue May  9 16:14:06 
2017 +0200| [66be24262689c7ec16c28b156d5811c23433f73f] | committer: Paul B Mahol

avfilter/vf_histogram: actually add parade display mode

Rename previous parade mode to stack, what it really was from start.

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi   |  7 +--
 libavfilter/vf_histogram.c | 30 --
 2 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index f431274f0f..3739fbcc04 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -8757,15 +8757,18 @@ Allowed range is [0, 40].
 Set display mode.
 It accepts the following values:
 @table @samp
-@item parade
+@item stack
 Per color component graphs are placed below each other.
 
+@item parade
+Per color component graphs are placed side by side.
+
 @item overlay
 Presents information identical to that in the @code{parade}, except
 that the graphs representing color components are superimposed directly
 over one another.
 @end table
-Default is @code{parade}.
+Default is @code{stack}.
 
 @item levels_mode
 Set mode. Can be either @code{linear}, or @code{logarithmic}.
diff --git a/libavfilter/vf_histogram.c b/libavfilter/vf_histogram.c
index f04f5dea10..7ee5fcd84f 100644
--- a/libavfilter/vf_histogram.c
+++ b/libavfilter/vf_histogram.c
@@ -56,10 +56,11 @@ typedef struct HistogramContext {
 static const AVOption histogram_options[] = {
 { "level_height", "set level height", OFFSET(level_height), 
AV_OPT_TYPE_INT, {.i64=200}, 50, 2048, FLAGS},
 { "scale_height", "set scale height", OFFSET(scale_height), 
AV_OPT_TYPE_INT, {.i64=12}, 0, 40, FLAGS},
-{ "display_mode", "set display mode", OFFSET(display_mode), 
AV_OPT_TYPE_INT, {.i64=1}, 0, 1, FLAGS, "display_mode"},
-{ "d","set display mode", OFFSET(display_mode), 
AV_OPT_TYPE_INT, {.i64=1}, 0, 1, FLAGS, "display_mode"},
-{ "parade",  NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, 
"display_mode" },
+{ "display_mode", "set display mode", OFFSET(display_mode), 
AV_OPT_TYPE_INT, {.i64=2}, 0, 2, FLAGS, "display_mode"},
+{ "d","set display mode", OFFSET(display_mode), 
AV_OPT_TYPE_INT, {.i64=2}, 0, 2, FLAGS, "display_mode"},
 { "overlay", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, 
"display_mode" },
+{ "parade",  NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, 
"display_mode" },
+{ "stack",   NULL, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, 
"display_mode" },
 { "levels_mode", "set levels mode", OFFSET(levels_mode), AV_OPT_TYPE_INT, 
{.i64=0}, 0, 1, FLAGS, "levels_mode"},
 { "m",   "set levels mode", OFFSET(levels_mode), AV_OPT_TYPE_INT, 
{.i64=0}, 0, 1, FLAGS, "levels_mode"},
 { "linear",  NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, 
"levels_mode" },
@@ -233,8 +234,8 @@ static int config_output(AVFilterLink *outlink)
 if ((1 << i) & h->components)
 ncomp++;
 }
-outlink->w = h->histogram_size;
-outlink->h = (h->level_height + h->scale_height) * FFMAX(ncomp * 
h->display_mode, 1);
+outlink->w = h->histogram_size * FFMAX(ncomp * (h->display_mode == 1), 1);
+outlink->h = (h->level_height + h->scale_height) * FFMAX(ncomp * 
(h->display_mode == 2), 1);
 
 h->odesc = av_pix_fmt_desc_get(outlink->format);
 h->dncomp = h->odesc->nb_components;
@@ -286,11 +287,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 const int width = h->planewidth[p];
 double max_hval_log;
 unsigned max_hval = 0;
-int start;
+int start, startx;
 
 if (!((1 << k) & h->components))
 continue;
-start = m++ * (h->level_height + h->scale_height) * h->display_mode;
+startx = m * h->histogram_size * (h->display_mode == 1);
+start = m++ * (h->level_height + h->scale_height) * (h->display_mode 
== 2);
 
 if (h->histogram_size <= 256) {
 for (i = 0; i < height; i++) {
@@ -310,7 +312,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 max_hval = FFMAX(max_hval, h->histogram[i]);
 max_hval_log = log2(max_hval + 1);
 
-for (i = 0; i < outlink->w; i++) {
+for (i = 0; i < h->histogram_size; i++) {
 int col_height;
 
 if (h->levels_mode)
@@ -322,26 +324,26 @@ stat

[FFmpeg-cvslog] avfilter: add arbitrary audio FIR filter

2017-05-09 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Jan 26 17:03:08 
2017 +0100| [49bbfb9d13936ee8bb7fee9983ca3710dc683a2e] | committer: Paul B Mahol

avfilter: add arbitrary audio FIR filter

Signed-off-by: Paul B Mahol 

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

 configure  |   3 +
 doc/filters.texi   |  43 
 libavfilter/Makefile   |   1 +
 libavfilter/af_afir.c  | 535 +
 libavfilter/af_afir.h  |  83 +++
 libavfilter/allfilters.c   |   1 +
 libavfilter/version.h  |   2 +-
 libavfilter/x86/Makefile   |   2 +
 libavfilter/x86/af_afir.asm|  60 +
 libavfilter/x86/af_afir_init.c |  35 +++
 10 files changed, 764 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index e797567780..5ae5227868 100755
--- a/configure
+++ b/configure
@@ -3083,6 +3083,8 @@ unix_protocol_select="network"
 # filters
 afftfilt_filter_deps="avcodec"
 afftfilt_filter_select="fft"
+afir_filter_deps="avcodec"
+afir_filter_select="fft"
 amovie_filter_deps="avcodec avformat"
 aresample_filter_deps="swresample"
 ass_filter_deps="libass"
@@ -6476,6 +6478,7 @@ enabled zlib && add_cppflags -DZLIB_CONST
 
 # conditional library dependencies, in linking order
 enabled afftfilt_filter && prepend avfilter_deps "avcodec"
+enabled afir_filter && prepend avfilter_deps "avcodec"
 enabled amovie_filter   && prepend avfilter_deps "avformat avcodec"
 enabled aresample_filter&& prepend avfilter_deps "swresample"
 enabled atempo_filter   && prepend avfilter_deps "avcodec"
diff --git a/doc/filters.texi b/doc/filters.texi
index 3739fbcc04..c54f5f2dcd 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -878,6 +878,49 @@ afftfilt="1-clip((b/nb)*b,0,1)"
 @end example
 @end itemize
 
+@section afir
+
+Apply an arbitrary Frequency Impulse Response filter.
+
+This filter is designed for applying long FIR filters,
+up to 30 seconds long.
+
+It can be used as component for digital crossover filters,
+room equalization, cross talk cancellation, wavefield synthesis,
+auralization, ambiophonics and ambisonics.
+
+This filter uses second stream as FIR coefficients.
+If second stream holds single channel, it will be used
+for all input channels in first stream, otherwise
+number of channels in second stream must be same as
+number of channels in first stream.
+
+It accepts the following parameters:
+
+@table @option
+@item dry
+Set dry gain. This sets input gain.
+
+@item wet
+Set wet gain. This sets final output gain.
+
+@item length
+Set Impulse Response filter length. Default is 1, which means whole IR is 
processed.
+
+@item again
+Enable applying gain measured from power of IR.
+@end table
+
+@subsection Examples
+
+@itemize
+@item
+Apply reverb to stream using mono IR file as second input, complete command 
using ffmpeg:
+@example
+ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
+@end example
+@end itemize
+
 @anchor{aformat}
 @section aformat
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 0f990866e8..de5f992795 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -37,6 +37,7 @@ OBJS-$(CONFIG_AEMPHASIS_FILTER)  += af_aemphasis.o
 OBJS-$(CONFIG_AEVAL_FILTER)  += aeval.o
 OBJS-$(CONFIG_AFADE_FILTER)  += af_afade.o
 OBJS-$(CONFIG_AFFTFILT_FILTER)   += af_afftfilt.o window_func.o
+OBJS-$(CONFIG_AFIR_FILTER)   += af_afir.o
 OBJS-$(CONFIG_AFORMAT_FILTER)+= af_aformat.o
 OBJS-$(CONFIG_AGATE_FILTER)  += af_agate.o
 OBJS-$(CONFIG_AINTERLEAVE_FILTER)+= f_interleave.o
diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c
new file mode 100644
index 00..d85c70710e
--- /dev/null
+++ b/libavfilter/af_afir.c
@@ -0,0 +1,535 @@
+/*
+ * Copyright (c) 2017 Paul B Mahol
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * An arbitrary audio FIR filter
+ */
+

[FFmpeg-cvslog] Changelog: mention afir addition

2017-05-09 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Tue May  9 23:29:51 
2017 +0200| [65b71091053426d09185a556ecca958bec7c818a] | committer: Paul B Mahol

Changelog: mention afir addition

Signed-off-by: Paul B Mahol 

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

 Changelog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Changelog b/Changelog
index 399b06b826..1778980e7e 100644
--- a/Changelog
+++ b/Changelog
@@ -9,6 +9,7 @@ version :
 - oscilloscope video filter
 - config.log and other configuration files moved into ffbuild/ directory
 - update cuvid/nvenc headers to Video Codec SDK 8.0.14
+- afir audio filter
 
 version 3.3:
 - CrystalHD decoder moved to new decode API

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


[FFmpeg-cvslog] avfilter/af_afir: workaround nonsense limitation in vector_fmul_scalar()

2017-05-10 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed May 10 20:07:30 
2017 +0200| [bd404e3949b081788247e2e6e9df0581ef7cc190] | committer: Paul B Mahol

avfilter/af_afir: workaround nonsense limitation in vector_fmul_scalar()

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c
index d85c70710e..c4443fdffd 100644
--- a/libavfilter/af_afir.c
+++ b/libavfilter/af_afir.c
@@ -68,7 +68,7 @@ static int fir_channel(AVFilterContext *ctx, void *arg, int 
ch, int nb_jobs)
 block = s->block[ch] + s->part_index * s->block_size;
 memset(block, 0, sizeof(*block) * s->fft_length);
 
-s->fdsp->vector_fmul_scalar(block + s->part_size, src, s->dry_gain, 
s->nb_samples);
+s->fdsp->vector_fmul_scalar(block + s->part_size, src, s->dry_gain, 
FFALIGN(s->nb_samples, 4));
 emms_c();
 
 av_rdft_calc(s->rdft[ch], block);
@@ -105,7 +105,7 @@ static int fir_channel(AVFilterContext *ctx, void *arg, int 
ch, int nb_jobs)
 
 if (out) {
 float *ptr = (float *)out->extended_data[ch];
-s->fdsp->vector_fmul_scalar(ptr, dst, s->gain * s->wet_gain, 
out->nb_samples);
+s->fdsp->vector_fmul_scalar(ptr, dst, s->gain * s->wet_gain, 
FFALIGN(out->nb_samples, 4));
 emms_c();
 }
 

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


[FFmpeg-cvslog] avfilter: add acopy filter

2017-05-12 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Tue May  9 22:58:56 
2017 +0200| [eaf644e120b3bc42c0fb702dfe9e79615cb4593a] | committer: Paul B Mahol

avfilter: add acopy filter

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi |  7 +-
 libavfilter/Makefile |  1 +
 libavfilter/af_acopy.c   | 60 
 libavfilter/allfilters.c |  1 +
 4 files changed, 68 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index c54f5f2dcd..e1208d0f4a 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -395,6 +395,11 @@ How much to use compressed signal in output. Default is 1.
 Range is between 0 and 1.
 @end table
 
+@section acopy
+
+Copy the input audio source unchanged to the output. This is mainly useful for
+testing purposes.
+
 @section acrossfade
 
 Apply cross fade from one input audio stream to another input audio stream.
@@ -5665,7 +5670,7 @@ convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 
-1 0 -1 1 1 0 1 2:-2 -
 
 @section copy
 
-Copy the input source unchanged to the output. This is mainly useful for
+Copy the input video source unchanged to the output. This is mainly useful for
 testing purposes.
 
 @anchor{coreimage}
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index de5f992795..f7dfe8ad54 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -29,6 +29,7 @@ OBJS-$(HAVE_THREADS) += pthread.o
 # audio filters
 OBJS-$(CONFIG_ABENCH_FILTER) += f_bench.o
 OBJS-$(CONFIG_ACOMPRESSOR_FILTER)+= af_sidechaincompress.o
+OBJS-$(CONFIG_ACOPY_FILTER)  += af_acopy.o
 OBJS-$(CONFIG_ACROSSFADE_FILTER) += af_afade.o
 OBJS-$(CONFIG_ACRUSHER_FILTER)   += af_acrusher.o
 OBJS-$(CONFIG_ADELAY_FILTER) += af_adelay.o
diff --git a/libavfilter/af_acopy.c b/libavfilter/af_acopy.c
new file mode 100644
index 00..d849060966
--- /dev/null
+++ b/libavfilter/af_acopy.c
@@ -0,0 +1,60 @@
+/*
+ * 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 "audio.h"
+#include "avfilter.h"
+#include "internal.h"
+
+static int filter_frame(AVFilterLink *inlink, AVFrame *in)
+{
+AVFilterLink *outlink = inlink->dst->outputs[0];
+AVFrame *out = ff_get_audio_buffer(outlink, in->nb_samples);
+
+if (!out) {
+av_frame_free(&in);
+return AVERROR(ENOMEM);
+}
+av_frame_copy_props(out, in);
+av_frame_copy(out, in);
+av_frame_free(&in);
+return ff_filter_frame(outlink, out);
+}
+
+static const AVFilterPad acopy_inputs[] = {
+{
+.name = "default",
+.type = AVMEDIA_TYPE_AUDIO,
+.filter_frame = filter_frame,
+},
+{ NULL }
+};
+
+static const AVFilterPad acopy_outputs[] = {
+{
+.name = "default",
+.type = AVMEDIA_TYPE_AUDIO,
+},
+{ NULL }
+};
+
+AVFilter ff_af_acopy = {
+.name  = "acopy",
+.description   = NULL_IF_CONFIG_SMALL("Copy the input audio unchanged to 
the output."),
+.inputs= acopy_inputs,
+.outputs   = acopy_outputs,
+};
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 555c44250b..cd35ae4c9c 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -42,6 +42,7 @@ static void register_all(void)
 {
 REGISTER_FILTER(ABENCH, abench, af);
 REGISTER_FILTER(ACOMPRESSOR,acompressor,af);
+REGISTER_FILTER(ACOPY,  acopy,  af);
 REGISTER_FILTER(ACROSSFADE, acrossfade, af);
 REGISTER_FILTER(ACRUSHER,   acrusher,   af);
 REGISTER_FILTER(ADELAY, adelay, af);

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


[FFmpeg-cvslog] avfilter/vf_pad: revert part of 57c3670896c69714ca

2017-05-12 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri May 12 17:37:20 
2017 +0200| [9cd62b2ca49be372b95e54202c0dac0de4f8a464] | committer: Paul B Mahol

avfilter/vf_pad: revert part of 57c3670896c69714ca

Signed-off-by: Paul B Mahol 

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

 libavfilter/vf_pad.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
index 725dc29e96..ed155578e1 100644
--- a/libavfilter/vf_pad.c
+++ b/libavfilter/vf_pad.c
@@ -197,7 +197,10 @@ static int config_input(AVFilterLink *inlink)
inlink->w, inlink->h, s->w, s->h, s->x, s->y,
s->rgba_color[0], s->rgba_color[1], s->rgba_color[2], 
s->rgba_color[3]);
 
-if (s->w <= 0 || s->h <= 0) {
+if (s->x <  0 || s->y <  0  ||
+s->w <= 0 || s->h <= 0  ||
+(unsigned)s->x + (unsigned)inlink->w > s->w ||
+(unsigned)s->y + (unsigned)inlink->h > s->h) {
 av_log(ctx, AV_LOG_ERROR,
"Input area %d:%d:%d:%d not within the padded area 0:0:%d:%d or 
zero-sized\n",
s->x, s->y, s->x + inlink->w, s->y + inlink->h, s->w, s->h);

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


[FFmpeg-cvslog] avfilter/af_astats: add RMS difference too

2017-05-12 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri May 12 18:13:17 
2017 +0200| [e312ed0504c1ba45e1e1f8e3071100b602a939c1] | committer: Paul B Mahol

avfilter/af_astats: add RMS difference too

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi|  5 +
 libavfilter/af_astats.c | 15 +--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index e1208d0f4a..5985db6021 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1614,6 +1614,7 @@ Max_level
 Min_difference
 Max_difference
 Mean_difference
+RMS_difference
 Peak_level
 RMS_peak
 RMS_trough
@@ -1629,6 +1630,7 @@ Max_level
 Min_difference
 Max_difference
 Mean_difference
+RMS_difference
 Peak_level
 RMS_level
 RMS_peak
@@ -1670,6 +1672,9 @@ Maximal difference between two consecutive samples.
 Mean difference between two consecutive samples.
 The average of each difference between two consecutive samples.
 
+@item RMS difference
+Root Mean Square difference between two consecutive samples.
+
 @item Peak level dB
 @item RMS level dB
 Standard peak and RMS level measured in dBFS.
diff --git a/libavfilter/af_astats.c b/libavfilter/af_astats.c
index 8813b52109..51fc2cc0ae 100644
--- a/libavfilter/af_astats.c
+++ b/libavfilter/af_astats.c
@@ -36,6 +36,7 @@ typedef struct ChannelStats {
 double min_runs, max_runs;
 double min_diff, max_diff;
 double diff1_sum;
+double diff1_sum_x2;
 uint64_t mask, imask;
 uint64_t min_count, max_count;
 uint64_t nb_samples;
@@ -121,6 +122,7 @@ static void reset_stats(AudioStatsContext *s)
 p->min_runs = 0;
 p->max_runs = 0;
 p->diff1_sum = 0;
+p->diff1_sum_x2 = 0;
 p->mask = 0;
 p->imask = 0x;
 p->min_count = 0;
@@ -197,6 +199,7 @@ static inline void update_stat(AudioStatsContext *s, 
ChannelStats *p, double d,
 p->min_diff = FFMIN(p->min_diff, fabs(d - p->last));
 p->max_diff = FFMAX(p->max_diff, fabs(d - p->last));
 p->diff1_sum += fabs(d - p->last);
+p->diff1_sum_x2 += (d - p->last) * (d - p->last);
 p->last = d;
 p->mask |= i;
 p->imask &= i;
@@ -232,6 +235,7 @@ static void set_metadata(AudioStatsContext *s, AVDictionary 
**metadata)
nmin = DBL_MAX, nmax = DBL_MIN,
max_sigma_x = 0,
diff1_sum = 0,
+   diff1_sum_x2 = 0,
sigma_x = 0,
sigma_x2 = 0,
min_sigma_x2 = DBL_MAX,
@@ -251,7 +255,8 @@ static void set_metadata(AudioStatsContext *s, AVDictionary 
**metadata)
 nmax = FFMAX(nmax, p->nmax);
 min_diff = FFMIN(min_diff, p->min_diff);
 max_diff = FFMAX(max_diff, p->max_diff);
-diff1_sum += p->diff1_sum,
+diff1_sum += p->diff1_sum;
+diff1_sum_x2 += p->diff1_sum_x2;
 min_sigma_x2 = FFMIN(min_sigma_x2, p->min_sigma_x2);
 max_sigma_x2 = FFMAX(max_sigma_x2, p->max_sigma_x2);
 sigma_x += p->sigma_x;
@@ -272,6 +277,7 @@ static void set_metadata(AudioStatsContext *s, AVDictionary 
**metadata)
 set_meta(metadata, c + 1, "Min_difference", "%f", p->min_diff);
 set_meta(metadata, c + 1, "Max_difference", "%f", p->max_diff);
 set_meta(metadata, c + 1, "Mean_difference", "%f", p->diff1_sum / 
(p->nb_samples - 1));
+set_meta(metadata, c + 1, "RMS_difference", "%f", sqrt(p->diff1_sum_x2 
/ (p->nb_samples - 1)));
 set_meta(metadata, c + 1, "Peak_level", "%f", 
LINEAR_TO_DB(FFMAX(-p->nmin, p->nmax)));
 set_meta(metadata, c + 1, "RMS_level", "%f", 
LINEAR_TO_DB(sqrt(p->sigma_x2 / p->nb_samples)));
 set_meta(metadata, c + 1, "RMS_peak", "%f", 
LINEAR_TO_DB(sqrt(p->max_sigma_x2)));
@@ -290,6 +296,7 @@ static void set_metadata(AudioStatsContext *s, AVDictionary 
**metadata)
 set_meta(metadata, 0, "Overall.Min_difference", "%f", min_diff);
 set_meta(metadata, 0, "Overall.Max_difference", "%f", max_diff);
 set_meta(metadata, 0, "Overall.Mean_difference", "%f", diff1_sum / 
(nb_samples - s->nb_channels));
+set_meta(metadata, 0, "Overall.RMS_difference", "%f", sqrt(diff1_sum_x2 / 
(nb_samples - s->nb_channels)));
 set_meta(metadata, 0, "Overall.Peak_level", "%f", 
LINEAR_TO_DB(FFMAX(-nmin, nmax)));
 set_meta(metadata, 0, "Overall.RMS_level", "%f", 
LINEAR_TO_DB(sqrt(sigma_x2 / nb_samples)));
 set_meta(metadata, 0, "Overall.RMS_peak", "%f", 
LINEAR_TO_DB(sqrt(max_sigma_x2)));
@@ -419,6 +426,7 @@ static void print_stats(A

[FFmpeg-cvslog] avfilter/aeval: remove comment that was left from some other file

2017-05-12 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri May 12 21:47:36 
2017 +0200| [3d55e4883c2ad813641dedcdd4fff30d455cbbd7] | committer: Paul B Mahol

avfilter/aeval: remove comment that was left from some other file

Signed-off-by: Paul B Mahol 

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

 libavfilter/aeval.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavfilter/aeval.c b/libavfilter/aeval.c
index 9800a60d50..1f74f49c72 100644
--- a/libavfilter/aeval.c
+++ b/libavfilter/aeval.c
@@ -427,7 +427,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 double t0;
 int i, j;
 
-/* do volume scaling in-place if input buffer is writable */
 out = ff_get_audio_buffer(outlink, nb_samples);
 if (!out) {
 av_frame_free(&in);

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


[FFmpeg-cvslog] avfilter/aeval: free input frame on error

2017-05-12 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri May 12 21:42:21 
2017 +0200| [c02921417b24309559f4813f8ffee35d523e823e] | committer: Paul B Mahol

avfilter/aeval: free input frame on error

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavfilter/aeval.c b/libavfilter/aeval.c
index 42970f42e7..9800a60d50 100644
--- a/libavfilter/aeval.c
+++ b/libavfilter/aeval.c
@@ -429,8 +429,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 
 /* do volume scaling in-place if input buffer is writable */
 out = ff_get_audio_buffer(outlink, nb_samples);
-if (!out)
+if (!out) {
+av_frame_free(&in);
 return AVERROR(ENOMEM);
+}
 av_frame_copy_props(out, in);
 
 t0 = TS2T(in->pts, inlink->time_base);

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


[FFmpeg-cvslog] avfilter: don't anonymously typedef structs

2017-05-13 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri May 12 20:00:49 
2017 +0200| [ed93ed5ee320db299dc8c65d59c4f25e2eb0acdc] | committer: Paul B Mahol

avfilter: don't anonymously typedef structs

Signed-off-by: Paul B Mahol 

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

 libavfilter/aeval.c|  2 +-
 libavfilter/af_afade.c |  2 +-
 libavfilter/af_amerge.c|  2 +-
 libavfilter/af_apad.c  |  2 +-
 libavfilter/af_aresample.c |  2 +-
 libavfilter/af_asetnsamples.c  |  2 +-
 libavfilter/af_asetrate.c  |  2 +-
 libavfilter/af_astats.c|  2 +-
 libavfilter/af_atempo.c|  4 ++--
 libavfilter/af_earwax.c|  2 +-
 libavfilter/af_firequalizer.c  |  6 +++---
 libavfilter/af_hdcd.c  |  4 ++--
 libavfilter/af_volumedetect.c  |  2 +-
 libavfilter/asrc_anoisesrc.c   |  2 +-
 libavfilter/asrc_anullsrc.c|  2 +-
 libavfilter/asrc_flite.c   |  2 +-
 libavfilter/asrc_sine.c|  2 +-
 libavfilter/avf_concat.c   |  2 +-
 libavfilter/avf_showcqt.h  |  8 
 libavfilter/avf_showspectrum.c |  2 +-
 libavfilter/avf_showwaves.c|  2 +-
 libavfilter/bbox.h |  2 +-
 libavfilter/buffersink.h   |  4 ++--
 libavfilter/deshake.h  | 10 +-
 libavfilter/deshake_opencl.h   |  2 +-
 libavfilter/dualinput.h|  2 +-
 libavfilter/ebur128.h  |  2 +-
 libavfilter/f_bench.c  |  2 +-
 libavfilter/f_ebur128.c|  2 +-
 libavfilter/f_interleave.c |  2 +-
 libavfilter/f_perms.c  |  2 +-
 libavfilter/f_sendcmd.c|  6 +++---
 libavfilter/f_zmq.c|  4 ++--
 libavfilter/signature.h| 10 +-
 libavfilter/signature_lookup.c |  2 +-
 libavfilter/tinterlace.h   |  2 +-
 libavfilter/unsharp.h  |  2 +-
 libavfilter/vf_alphamerge.c|  2 +-
 libavfilter/vf_bbox.c  |  2 +-
 libavfilter/vf_blackdetect.c   |  2 +-
 libavfilter/vf_codecview.c |  2 +-
 libavfilter/vf_colorbalance.c  |  4 ++--
 libavfilter/vf_colorchannelmixer.c |  2 +-
 libavfilter/vf_colorlevels.c   |  4 ++--
 libavfilter/vf_colormatrix.c   |  2 +-
 libavfilter/vf_curves.c|  2 +-
 libavfilter/vf_decimate.c  |  2 +-
 libavfilter/vf_dejudder.c  |  2 +-
 libavfilter/vf_detelecine.c|  2 +-
 libavfilter/vf_edgedetect.c|  2 +-
 libavfilter/vf_eq.h|  2 +-
 libavfilter/vf_extractplanes.c |  2 +-
 libavfilter/vf_fftfilt.c   |  2 +-
 libavfilter/vf_field.c |  2 +-
 libavfilter/vf_fieldmatch.c|  2 +-
 libavfilter/vf_geq.c   |  2 +-
 libavfilter/vf_histeq.c|  2 +-
 libavfilter/vf_hqx.c   |  2 +-
 libavfilter/vf_hue.c   |  2 +-
 libavfilter/vf_idet.h  |  2 +-
 libavfilter/vf_il.c|  2 +-
 libavfilter/vf_kerndeint.c |  2 +-
 libavfilter/vf_mcdeint.c   |  2 +-
 libavfilter/vf_mpdecimate.c|  2 +-
 libavfilter/vf_nlmeans.c   |  2 +-
 libavfilter/vf_noise.h |  4 ++--
 libavfilter/vf_owdenoise.c |  2 +-
 libavfilter/vf_palettegen.c|  2 +-
 libavfilter/vf_pp.c|  2 +-
 libavfilter/vf_removelogo.c|  2 +-
 libavfilter/vf_sab.c   |  4 ++--
 libavfilter/vf_selectivecolor.c|  2 +-
 libavfilter/vf_separatefields.c|  2 +-
 libavfilter/vf_setfield.c  |  2 +-
 libavfilter/vf_showpalette.c   |  2 +-
 libavfilter/vf_signalstats.c   |  2 +-
 libavfilter/vf_smartblur.c |  4 ++--
 libavfilter/vf_spp.h   |  2 +-
 libavfilter/vf_subtitles.c |  2 +-
 libavfilter/vf_super2xsai.c|  2 +-
 libavfilter/vf_telecine.c  |  2 +-
 libavfilter/vf_thumbnail.c |  2 +-
 libavfilter/vf_tile.c  |  2 +-
 libavfilter/vf_uspp.c  |  2 +-
 libavfilter/vf_vidstabdetect.c |  2 +-
 libavfilter/vf_vidstabtransform.c  |  2 +-
 libavfilter/vf_vignette.c  |  2 +-
 libavfilter/vf_xbr.c   |  2 +-
 libavfilter/vidstabutils.c |  2 +-
 libavfilter/vsrc_cellauto.c|  2 +-
 libavfilter/vsrc_life.c|  2 +-
 libavfilter/vsrc_mandelbrot.c  |  2 +-
 92 files changed, 116 insertions(+), 116 deletions(-)

diff --git a/libavfilter/aeval.c b/libavfilter/aeval.c
index 1f74f49c72..cdddbaf31d 100644
--- a/libavfilter/aeval.c
+++ b/libavfilter/aeval.c
@@ -53,7 +53,7 @@ enum var_name {
 VAR_VARS_NB
 };
 
-typedef struct {
+typedef struct EvalContext {
 const AVClass *class;
 char *sample_rate_str;
 int sample_rate;
diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c
index 3a6266f0cd..ba7a2aba6c 100644
--- a/libavfilter/af_afade.c
+++ b/libavfilter/af_afade.c
@@ -29,7 +29,7 @@
 #include &qu

[FFmpeg-cvslog] avfilter/af_compand: fix default companding to avoid clipping

2017-05-14 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun May 14 11:59:04 
2017 +0200| [69b83f599224932a94d56081d008d373e1e51709] | committer: Paul B Mahol

avfilter/af_compand: fix default companding to avoid clipping

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi | 2 +-
 libavfilter/af_compand.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 5985db6021..0ea4e26998 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -2080,7 +2080,7 @@ the following syntax: @code{x0/y0|x1/y1|x2/y2|} or
 The input values must be in strictly increasing order but the transfer function
 does not have to be monotonically rising. The point @code{0/0} is assumed but
 may be overridden (by @code{0/out-dBn}). Typical values for the transfer
-function are @code{-70/-70|-60/-20}.
+function are @code{-70/-70|-60/-20|1/0}.
 
 @item soft-knee
 Set the curve radius in dB for all joints. It defaults to 0.01.
diff --git a/libavfilter/af_compand.c b/libavfilter/af_compand.c
index 2acaa99ea2..8ff0ff9465 100644
--- a/libavfilter/af_compand.c
+++ b/libavfilter/af_compand.c
@@ -74,7 +74,7 @@ typedef struct CompandContext {
 static const AVOption compand_options[] = {
 { "attacks", "set time over which increase of volume is determined", 
OFFSET(attacks), AV_OPT_TYPE_STRING, { .str = "0.3" }, 0, 0, A },
 { "decays", "set time over which decrease of volume is determined", 
OFFSET(decays), AV_OPT_TYPE_STRING, { .str = "0.8" }, 0, 0, A },
-{ "points", "set points of transfer function", OFFSET(points), 
AV_OPT_TYPE_STRING, { .str = "-70/-70|-60/-20" }, 0, 0, A },
+{ "points", "set points of transfer function", OFFSET(points), 
AV_OPT_TYPE_STRING, { .str = "-70/-70|-60/-20|1/0" }, 0, 0, A },
 { "soft-knee", "set soft-knee", OFFSET(curve_dB), AV_OPT_TYPE_DOUBLE, { 
.dbl = 0.01 }, 0.01, 900, A },
 { "gain", "set output gain", OFFSET(gain_dB), AV_OPT_TYPE_DOUBLE, { .dbl = 
0 }, -900, 900, A },
 { "volume", "set initial volume", OFFSET(initial_volume), 
AV_OPT_TYPE_DOUBLE, { .dbl = 0 }, -900, 0, A },

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


[FFmpeg-cvslog] avfilter/af_silenceremove: set output timestamps

2017-05-15 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon May 15 14:05:17 
2017 +0200| [7760ed7e9606203eea478fc3620665859c739dc0] | committer: Paul B Mahol

avfilter/af_silenceremove: set output timestamps

Signed-off-by: Paul B Mahol 

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

 libavfilter/af_silenceremove.c | 42 --
 1 file changed, 36 insertions(+), 6 deletions(-)

diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c
index f156d1883d..af50463059 100644
--- a/libavfilter/af_silenceremove.c
+++ b/libavfilter/af_silenceremove.c
@@ -217,11 +217,18 @@ static int config_input(AVFilterLink *inlink)
 return 0;
 }
 
-static void flush(AVFrame *out, AVFilterLink *outlink,
+static void flush(SilenceRemoveContext *s,
+  AVFrame *out, AVFilterLink *outlink,
   int *nb_samples_written, int *ret)
 {
 if (*nb_samples_written) {
 out->nb_samples = *nb_samples_written / outlink->channels;
+
+out->pts = s->next_pts;
+s->next_pts += av_rescale_q(out->nb_samples,
+(AVRational){1, outlink->sample_rate},
+outlink->time_base);
+
 *ret = ff_filter_frame(outlink, out);
 *nb_samples_written = 0;
 } else {
@@ -297,6 +304,12 @@ silence_trim_flush:
 
 memcpy(out->data[0], &s->start_holdoff[s->start_holdoff_offset],
nbs * sizeof(double));
+
+out->pts = s->next_pts;
+s->next_pts += av_rescale_q(out->nb_samples,
+(AVRational){1, outlink->sample_rate},
+outlink->time_base);
+
 s->start_holdoff_offset += nbs;
 
 ret = ff_filter_frame(outlink, out);
@@ -330,7 +343,7 @@ silence_copy:
 
 if (threshold && s->stop_holdoff_end && !s->leave_silence) {
 s->mode = SILENCE_COPY_FLUSH;
-flush(out, outlink, &nb_samples_written, &ret);
+flush(s, out, outlink, &nb_samples_written, &ret);
 goto silence_copy_flush;
 } else if (threshold) {
 for (j = 0; j < inlink->channels; j++) {
@@ -358,7 +371,7 @@ silence_copy:
 
 if (!s->restart) {
 s->mode = SILENCE_STOP;
-flush(out, outlink, &nb_samples_written, &ret);
+flush(s, out, outlink, &nb_samples_written, 
&ret);
 goto silence_stop;
 } else {
 s->stop_found_periods = 0;
@@ -367,19 +380,25 @@ silence_copy:
 s->start_holdoff_end = 0;
 clear_window(s);
 s->mode = SILENCE_TRIM;
-flush(out, outlink, &nb_samples_written, &ret);
+flush(s, out, outlink, &nb_samples_written, 
&ret);
 goto silence_trim;
 }
 }
 s->mode = SILENCE_COPY_FLUSH;
-flush(out, outlink, &nb_samples_written, &ret);
+flush(s, out, outlink, &nb_samples_written, &ret);
 goto silence_copy_flush;
 }
 }
 }
-flush(out, outlink, &nb_samples_written, &ret);
+flush(s, out, outlink, &nb_samples_written, &ret);
 } else {
 memcpy(obuf, ibuf, sizeof(double) * nbs * inlink->channels);
+
+out->pts = s->next_pts;
+s->next_pts += av_rescale_q(out->nb_samples,
+(AVRational){1, outlink->sample_rate},
+outlink->time_base);
+
 ret = ff_filter_frame(outlink, out);
 }
 break;
@@ -401,6 +420,11 @@ silence_copy_flush:
nbs * sizeof(double));
 s->stop_holdoff_offset += nbs;
 
+out->pts = s->next_pts;
+s->next_pts += av_rescale_q(out->nb_samples,
+(AVRational){1, outlink->sample_rate},
+outlink->time_base);
+
 ret = ff_filter_frame(outlink, out);
 
 if (s->stop_holdoff_offset == s->stop_holdoff_end) {
@@ -439,6 +463,12 @@ static int request_frame(AVFilterLink *outlink)
 
 memcpy(frame->data[0], &s->stop_holdoff[s->stop_holdoff_offset],
nbs * sizeof(double));
+
+   

[FFmpeg-cvslog] avfilter/af_compand: change default attack to 0

2017-05-15 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon May 15 14:05:43 
2017 +0200| [13f4d077ed27c53fffd114f92fbd7b2c9cfcec77] | committer: Paul B Mahol

avfilter/af_compand: change default attack to 0

Fixes many distortions.

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavfilter/af_compand.c b/libavfilter/af_compand.c
index 8ff0ff9465..8589b1ef09 100644
--- a/libavfilter/af_compand.c
+++ b/libavfilter/af_compand.c
@@ -72,7 +72,7 @@ typedef struct CompandContext {
 #define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
 static const AVOption compand_options[] = {
-{ "attacks", "set time over which increase of volume is determined", 
OFFSET(attacks), AV_OPT_TYPE_STRING, { .str = "0.3" }, 0, 0, A },
+{ "attacks", "set time over which increase of volume is determined", 
OFFSET(attacks), AV_OPT_TYPE_STRING, { .str = "0" }, 0, 0, A },
 { "decays", "set time over which decrease of volume is determined", 
OFFSET(decays), AV_OPT_TYPE_STRING, { .str = "0.8" }, 0, 0, A },
 { "points", "set points of transfer function", OFFSET(points), 
AV_OPT_TYPE_STRING, { .str = "-70/-70|-60/-20|1/0" }, 0, 0, A },
 { "soft-knee", "set soft-knee", OFFSET(curve_dB), AV_OPT_TYPE_DOUBLE, { 
.dbl = 0.01 }, 0.01, 900, A },

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


[FFmpeg-cvslog] avfilter/af_stereotools: introduce different balance modes

2017-05-15 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon May 15 19:56:55 
2017 +0200| [9bebad86c7f8736f3534ece22cd8095059e2560d] | committer: Paul B Mahol

avfilter/af_stereotools: introduce different balance modes

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi | 17 ++
 libavfilter/af_stereotools.c | 54 
 2 files changed, 66 insertions(+), 5 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 0ea4e26998..a86127f261 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3669,6 +3669,23 @@ Set S/C level. Default is 1. Allowed range is from 1 to 
100.
 
 @item phase
 Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
+
+@item bmode_in, bmode_out
+Set balance mode for balance_in/balance_out option.
+
+Can be one of the following:
+
+@table @samp
+@item balance
+Classic balance mode. Attenuate one channel at time.
+Gain is raised up to 1.
+
+@item amplitude
+Similar as classic mode above but gain is raised up to 2.
+
+@item power
+Equal power distribution, from -6dB to +6dB range.
+@end table
 @end table
 
 @subsection Examples
diff --git a/libavfilter/af_stereotools.c b/libavfilter/af_stereotools.c
index 8ab184df11..2d2a9bd625 100644
--- a/libavfilter/af_stereotools.c
+++ b/libavfilter/af_stereotools.c
@@ -33,6 +33,8 @@ typedef struct StereoToolsContext {
 int phase_l;
 int phase_r;
 int mode;
+int bmode_in;
+int bmode_out;
 double slev;
 double sbal;
 double mlev;
@@ -83,6 +85,11 @@ static const AVOption stereotools_options[] = {
 { "delay",   "set delay",OFFSET(delay),   
AV_OPT_TYPE_DOUBLE, {.dbl=0}, -20, 20, A },
 { "sclevel", "set S/C level",OFFSET(sc_level),
AV_OPT_TYPE_DOUBLE, {.dbl=1},   1,100, A },
 { "phase",   "set stereo phase", OFFSET(phase),   
AV_OPT_TYPE_DOUBLE, {.dbl=0},   0,360, A },
+{ "bmode_in","set balance in mode", OFFSET(bmode_in), AV_OPT_TYPE_INT, 
   {.i64=0},   0,  2, A, "bmode" },
+{ "balance",   0,0,   
AV_OPT_TYPE_CONST,  {.i64=0},   0,  0, A, "bmode" },
+{ "amplitude", 0,0,   
AV_OPT_TYPE_CONST,  {.i64=1},   0,  0, A, "bmode" },
+{ "power", 0,0,   
AV_OPT_TYPE_CONST,  {.i64=2},   0,  0, A, "bmode" },
+{ "bmode_out", "set balance out mode", OFFSET(bmode_out), AV_OPT_TYPE_INT, 
   {.i64=0},   0,  2, A, "bmode" },
 { NULL }
 };
 
@@ -167,13 +174,31 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 dst = (double *)out->data[0];
 
 for (n = 0; n < in->nb_samples; n++, src += 2, dst += 2) {
-double L = src[0], R = src[1], l, r, m, S;
+double L = src[0], R = src[1], l, r, m, S, gl, gr, gd;
 
 L *= level_in;
 R *= level_in;
 
-L *= 1. - FFMAX(0., balance_in);
-R *= 1. + FFMIN(0., balance_in);
+gl = 1. - FFMAX(0., balance_in);
+gr = 1. + FFMIN(0., balance_in);
+switch (s->bmode_in) {
+case 1:
+gd = gl - gr;
+gl = 1. + gd;
+gr = 1. - gd;
+break;
+case 2:
+if (balance_in < 0.) {
+gr = FFMAX(0.5, gr);
+gl = 1. / gr;
+} else if (balance_in > 0.) {
+gl = FFMAX(0.5, gl);
+gr = 1. / gl;
+}
+break;
+}
+L *= gl;
+R *= gr;
 
 if (s->softclip) {
 R = s->inv_atan_shape * atan(R * sc_level);
@@ -253,8 +278,27 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 
 s->pos = (s->pos + 2) % s->length;
 
-L *= 1. - FFMAX(0., balance_out);
-R *= 1. + FFMIN(0., balance_out);
+gl = 1. - FFMAX(0., balance_out);
+gr = 1. + FFMIN(0., balance_out);
+switch (s->bmode_out) {
+case 1:
+gd = gl - gr;
+gl = 1. + gd;
+gr = 1. - gd;
+break;
+case 2:
+if (balance_out < 0.) {
+gr = FFMAX(0.5, gr);
+gl = 1. / gr;
+} else if (balance_out > 0.) {
+gl = FFMAX(0.5, gl);
+gr = 1. / gl;
+}
+break;
+}
+L *= gl;
+R *= gr;
+
 
 L *= level_out;
 R *= level_out;

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


[FFmpeg-cvslog] avfilter/vf_deflicker: add bypass option

2017-05-15 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon May 15 21:32:44 
2017 +0200| [4c55144ee969a63bb5e469e3ebd7179b7b3616e8] | committer: Paul B Mahol

avfilter/vf_deflicker: add bypass option

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi   | 3 +++
 libavfilter/vf_deflicker.c | 9 ++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index a86127f261..9611a41e28 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -6394,6 +6394,9 @@ Power mean
 @item median
 Median
 @end table
+
+@item bypass
+Do not actually modify frame. Useful when one only wants metadata.
 @end table
 
 @section dejudder
diff --git a/libavfilter/vf_deflicker.c b/libavfilter/vf_deflicker.c
index e748109c8b..2a33adc503 100644
--- a/libavfilter/vf_deflicker.c
+++ b/libavfilter/vf_deflicker.c
@@ -49,6 +49,7 @@ typedef struct DeflickerContext {
 
 int size;
 int mode;
+int bypass;
 
 int eof;
 int depth;
@@ -84,6 +85,7 @@ static const AVOption deflicker_options[] = {
 { "cm",  "cubic mean",  0, AV_OPT_TYPE_CONST, 
{.i64=CUBIC_MEAN},   0, 0, FLAGS, "mode" },
 { "pm",  "power mean",  0, AV_OPT_TYPE_CONST, 
{.i64=POWER_MEAN},   0, 0, FLAGS, "mode" },
 { "median",  "median",  0, AV_OPT_TYPE_CONST, {.i64=MEDIAN},   
0, 0, FLAGS, "mode" },
+{ "bypass", "leave frames unchanged",  OFFSET(bypass), AV_OPT_TYPE_BOOL, 
{.i64=0}, 0, 1, FLAGS },
 { NULL }
 };
 
@@ -377,9 +379,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
 }
 
 s->get_factor(ctx, &f);
-s->deflicker(ctx, in->data[0], in->linesize[0], out->data[0], 
out->linesize[0],
- outlink->w, outlink->h, f);
-for (y = 1; y < s->nb_planes; y++) {
+if (!s->bypass)
+s->deflicker(ctx, in->data[0], in->linesize[0], out->data[0], 
out->linesize[0],
+ outlink->w, outlink->h, f);
+for (y = 1 - s->bypass; y < s->nb_planes; y++) {
 av_image_copy_plane(out->data[y], out->linesize[y],
 in->data[y], in->linesize[y],
 s->planewidth[y] * (1 + (s->depth > 8)), 
s->planeheight[y]);

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


[FFmpeg-cvslog] avfilter/af_bs2b: add missing flag for options

2017-05-16 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Tue May 16 19:16:50 
2017 +0200| [5605108f4dca9da70b5273243c4f6f11623283b7] | committer: Paul B Mahol

avfilter/af_bs2b: add missing flag for options

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavfilter/af_bs2b.c b/libavfilter/af_bs2b.c
index 54d52c5c6e..531a27bd73 100644
--- a/libavfilter/af_bs2b.c
+++ b/libavfilter/af_bs2b.c
@@ -45,7 +45,7 @@ typedef struct Bs2bContext {
 } Bs2bContext;
 
 #define OFFSET(x) offsetof(Bs2bContext, x)
-#define A AV_OPT_FLAG_AUDIO_PARAM
+#define A AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
 
 static const AVOption bs2b_options[] = {
 { "profile", "Apply a pre-defined crossfeed level",

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


[FFmpeg-cvslog] avfilter: add audio crossfeed filter

2017-05-17 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun May 14 18:30:12 
2017 +0200| [deaab31d61fd3679491a5e81cd26432886815ddf] | committer: Paul B Mahol

avfilter: add audio crossfeed filter

Signed-off-by: Paul B Mahol 

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

 Changelog  |   1 +
 doc/filters.texi   |  29 
 libavfilter/Makefile   |   1 +
 libavfilter/af_crossfeed.c | 169 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/version.h  |   4 +-
 6 files changed, 203 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index 3504b7ff35..ff982e5db2 100644
--- a/Changelog
+++ b/Changelog
@@ -12,6 +12,7 @@ version :
 - afir audio filter
 - scale_cuda CUDA based video scale filter
 - librsvg support for svg rasterization
+- crossfeed audio filter
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/doc/filters.texi b/doc/filters.texi
index a7c6063969..69907d4f75 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -2251,6 +2251,35 @@ Set temperature degree in Celsius. This is the 
temperature of the environment.
 Default is 20.
 @end table
 
+@section crossfeed
+Apply headphone crossfeed filter.
+
+Crossfeed is the process of blending the left and right channels of stereo
+audio recording.
+It is mainly used to reduce extreme stereo separation of low frequencies.
+
+The intent is to produce more speaker like sound to the listener.
+
+The filter accepts the following options:
+
+@table @option
+@item strength
+Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
+This sets gain of low shelf filter for side part of stereo image.
+Default is -6dB. Max allowed is -30db when strength is set to 1.
+
+@item range
+Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
+This sets cut off frequency of low shelf filter. Default is cut off near
+1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
+
+@item level_in
+Set input gain. Default is 0.9.
+
+@item level_out
+Set output gain. Default is 1.
+@end table
+
 @section crystalizer
 Simple algorithm to expand audio dynamic range.
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index f177fdb42b..434a989244 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -81,6 +81,7 @@ OBJS-$(CONFIG_CHANNELSPLIT_FILTER)   += 
af_channelsplit.o
 OBJS-$(CONFIG_CHORUS_FILTER) += af_chorus.o 
generate_wave_table.o
 OBJS-$(CONFIG_COMPAND_FILTER)+= af_compand.o
 OBJS-$(CONFIG_COMPENSATIONDELAY_FILTER)  += af_compensationdelay.o
+OBJS-$(CONFIG_CROSSFEED_FILTER)  += af_crossfeed.o
 OBJS-$(CONFIG_CRYSTALIZER_FILTER)+= af_crystalizer.o
 OBJS-$(CONFIG_DCSHIFT_FILTER)+= af_dcshift.o
 OBJS-$(CONFIG_DYNAUDNORM_FILTER) += af_dynaudnorm.o
diff --git a/libavfilter/af_crossfeed.c b/libavfilter/af_crossfeed.c
new file mode 100644
index 00..d3def92fb3
--- /dev/null
+++ b/libavfilter/af_crossfeed.c
@@ -0,0 +1,169 @@
+/*
+ * 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 "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
+#include "avfilter.h"
+#include "audio.h"
+#include "formats.h"
+
+typedef struct CrossfeedContext {
+const AVClass *class;
+
+double range;
+double strength;
+double level_in;
+double level_out;
+
+double a0, a1, a2;
+double b0, b1, b2;
+
+double i1, i2;
+double o1, o2;
+} CrossfeedContext;
+
+static int query_formats(AVFilterContext *ctx)
+{
+AVFilterFormats *formats = NULL;
+AVFilterChannelLayouts *layout = NULL;
+int ret;
+
+if ((ret = ff_add_format (&formats, AV_SAMPLE_FMT_DBL  )) 
< 0 ||
+(ret = ff_set_common_formats (ctx , formats)) 
< 0 ||
+(ret = ff_add_channel_layout (&layout , AV_CH_LAYOUT_STEREO)) 
< 0 ||
+(ret = ff_set_common_channel_layouts (ctx , layout )) 
< 0 ||
+(ret = ff_set_common_samplerates (ctx , ff_all_samplerates())) 
< 0)
+return ret;
+
+return 0;

[FFmpeg-cvslog] avfilter/af_afade: fix fading very long durations

2017-05-17 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed May 17 22:59:11 
2017 +0200| [6111ac73d9907101c5bfb7943675c76ee08f1789] | committer: Paul B Mahol

avfilter/af_afade: fix fading very long durations

Signed-off-by: Paul B Mahol 

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

 libavfilter/af_afade.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c
index ba7a2aba6c..7ad124e887 100644
--- a/libavfilter/af_afade.c
+++ b/libavfilter/af_afade.c
@@ -33,7 +33,7 @@ typedef struct AudioFadeContext {
 const AVClass *class;
 int type;
 int curve, curve2;
-int nb_samples;
+int64_t nb_samples;
 int64_t start_sample;
 int64_t duration;
 int64_t start_time;
@@ -45,7 +45,7 @@ typedef struct AudioFadeContext {
 
 void (*fade_samples)(uint8_t **dst, uint8_t * const *src,
  int nb_samples, int channels, int direction,
- int64_t start, int range, int curve);
+ int64_t start, int64_t range, int curve);
 void (*crossfade_samples)(uint8_t **dst, uint8_t * const *cf0,
   uint8_t * const *cf1,
   int nb_samples, int channels,
@@ -90,7 +90,7 @@ static int query_formats(AVFilterContext *ctx)
 return ff_set_common_samplerates(ctx, formats);
 }
 
-static double fade_gain(int curve, int64_t index, int range)
+static double fade_gain(int curve, int64_t index, int64_t range)
 {
 #define CUBE(a) ((a)*(a)*(a))
 double gain;
@@ -154,7 +154,7 @@ static double fade_gain(int curve, int64_t index, int range)
 #define FADE_PLANAR(name, type) \
 static void fade_samples_## name ##p(uint8_t **dst, uint8_t * const *src,   \
  int nb_samples, int channels, int dir, \
- int64_t start, int range, int curve)   \
+ int64_t start, int64_t range, int curve) \
 {   \
 int i, c;   \
 \
@@ -172,7 +172,7 @@ static void fade_samples_## name ##p(uint8_t **dst, uint8_t 
* const *src,   \
 #define FADE(name, type)\
 static void fade_samples_## name (uint8_t **dst, uint8_t * const *src,  \
   int nb_samples, int channels, int dir,\
-  int64_t start, int range, int curve)  \
+  int64_t start, int64_t range, int curve)  \
 {   \
 type *d = (type *)dst[0];   \
 const type *s = (type *)src[0]; \
@@ -228,10 +228,10 @@ static const AVOption afade_options[] = {
 { "out",  "fade-out",0,
AV_OPT_TYPE_CONST,  {.i64 = 1}, 0, 0, FLAGS, "type" },
 { "start_sample", "set number of first sample to start fading",  
OFFSET(start_sample), AV_OPT_TYPE_INT64,  {.i64 = 0}, 0, INT64_MAX, FLAGS },
 { "ss",   "set number of first sample to start fading",  
OFFSET(start_sample), AV_OPT_TYPE_INT64,  {.i64 = 0}, 0, INT64_MAX, FLAGS },
-{ "nb_samples",   "set number of samples for fade duration", 
OFFSET(nb_samples),   AV_OPT_TYPE_INT,{.i64 = 44100}, 1, INT32_MAX, FLAGS },
-{ "ns",   "set number of samples for fade duration", 
OFFSET(nb_samples),   AV_OPT_TYPE_INT,{.i64 = 44100}, 1, INT32_MAX, FLAGS },
-{ "start_time",   "set time to start fading",
OFFSET(start_time),   AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT32_MAX, FLAGS },
-{ "st",   "set time to start fading",
OFFSET(start_time),   AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT32_MAX, FLAGS },
+{ "nb_samples",   "set number of samples for fade duration", 
OFFSET(nb_samples),   AV_OPT_TYPE_INT64,  {.i64 = 44100}, 1, INT64_MAX, FLAGS },
+{ "ns",   "set number of samples for fade duration", 
OFFSET(nb_samples),   AV_OPT_TYPE_INT64,  {.i64 = 44100}, 1, INT64_MAX, FLAGS },
+{ "start_time",   "set time to start fading",
OFFSET(start_time),   AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
+{ "st",   "set time to start fading",
OFFSET(start_time),   AV_OPT_TYP

[FFmpeg-cvslog] doc/filters: add more ladspa examples

2017-05-18 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu May 18 17:38:18 
2017 +0200| [5c9e12bc6d3e4847896fcb51e76d26aa7922e5d7] | committer: Paul B Mahol

doc/filters: add more ladspa examples

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi | 25 +
 1 file changed, 25 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 69907d4f75..b684d8dec8 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -2979,6 +2979,31 @@ Attenuate low frequencies using Multiband EQ from Steve 
Harris
 @example
 ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
 @end example
+
+@item
+Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
+(CAPS) library:
+@example
+ladspa=caps:Narrower
+@end example
+
+@item
+Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
+@example
+ladspa=caps:White:.2
+@end example
+
+@item
+Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
+@example
+ladspa=caps:Fractal:c=c1=1
+@end example
+
+@item
+Dynamic volume normalization using @code{VLevel} plugin:
+@example
+ladspa=vlevel-ladspa:vlevel_mono
+@end example
 @end itemize
 
 @subsection Commands

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


[FFmpeg-cvslog] avfilter/af_sofalizer: avoid casting

2017-05-18 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu May 18 22:49:04 
2017 +0200| [79bf4d1450c105ecbe2b8ef64ca6c14bbdd761dc] | committer: Paul B Mahol

avfilter/af_sofalizer: avoid casting

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavfilter/af_sofalizer.c b/libavfilter/af_sofalizer.c
index 252f524c23..622eac577c 100644
--- a/libavfilter/af_sofalizer.c
+++ b/libavfilter/af_sofalizer.c
@@ -383,13 +383,13 @@ static int parse_channel_name(char **arg, int *rchannel, 
char *buf)
 layout0 = layout = av_get_channel_layout(buf);
 /* channel_id <- first set bit in layout */
 for (i = 32; i > 0; i >>= 1) {
-if (layout >= (int64_t)1 << i) {
+if (layout >= 1LL << i) {
 channel_id += i;
 layout >>= i;
 }
 }
 /* reject layouts that are not a single channel */
-if (channel_id >= 64 || layout0 != (int64_t)1 << channel_id)
+if (channel_id >= 64 || layout0 != 1LL << channel_id)
 return AVERROR(EINVAL);
 *rchannel = channel_id;
 *arg += len;

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


[FFmpeg-cvslog] avfilter/af_sofalizer: make lfe gain user configurable

2017-05-18 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu May 18 23:13:52 
2017 +0200| [f5e5c531170f0ce9c37e555e689ffd60694b47cd] | committer: Paul B Mahol

avfilter/af_sofalizer: make lfe gain user configurable

Default settings have it too low.

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi   | 3 +++
 libavfilter/af_sofalizer.c | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index b684d8dec8..296a8dcd03 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3606,6 +3606,9 @@ Each virtual loudspeaker description is separated by '|'.
 For example to override front left and front right channel positions use:
 'speakers=FL 45 15|FR 345 15'.
 Descriptions with unrecognised channel names are ignored.
+
+@item lfegain
+Set custom gain for LFE channels. Value is in dB. Default is 0.
 @end table
 
 @subsection Examples
diff --git a/libavfilter/af_sofalizer.c b/libavfilter/af_sofalizer.c
index 622eac577c..ef723ee2c4 100644
--- a/libavfilter/af_sofalizer.c
+++ b/libavfilter/af_sofalizer.c
@@ -70,6 +70,7 @@ typedef struct SOFAlizerContext {
 float *speaker_azim;/* azimuth of the virtual loudspeakers */
 float *speaker_elev;/* elevation of the virtual loudspeakers */
 char *speakers_pos; /* custom positions of the virtual 
loudspeakers */
+float lfe_gain; /* initial gain for the LFE channel */
 float gain_lfe; /* gain applied to LFE channel */
 int lfe_channel;/* LFE channel position in channel layout */
 
@@ -1067,7 +1068,7 @@ static int config_input(AVFilterLink *inlink)
 }
 
 /* gain -3 dB per channel, -6 dB to get LFE on a similar level */
-s->gain_lfe = expf((s->gain - 3 * inlink->channels - 6) / 20 * M_LN10);
+s->gain_lfe = expf((s->gain - 3 * inlink->channels - 6 + s->lfe_gain) / 20 
* M_LN10);
 
 s->n_conv = nb_input_channels;
 
@@ -1197,6 +1198,7 @@ static const AVOption sofalizer_options[] = {
 { "time",  "time domain",  0,   AV_OPT_TYPE_CONST,  
{.i64=0},   0,   0, .flags = FLAGS, "type" },
 { "freq",  "frequency domain", 0,   AV_OPT_TYPE_CONST,  
{.i64=1},   0,   0, .flags = FLAGS, "type" },
 { "speakers",  "set speaker custom positions", OFFSET(speakers_pos), 
AV_OPT_TYPE_STRING,  {.str=0},0, 0, .flags = FLAGS },
+{ "lfegain",   "set lfe gain", OFFSET(lfe_gain), 
AV_OPT_TYPE_FLOAT,   {.dbl=0},   -9, 9, .flags = FLAGS },
 { NULL }
 };
 

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


[FFmpeg-cvslog] avfilter/af_sidechaincompress: change default makeup gain to 1

2017-05-20 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat May 20 12:34:51 
2017 +0200| [e8ae23db27bd308b299c00f2a10e1243cdb08103] | committer: Paul B Mahol

avfilter/af_sidechaincompress: change default makeup gain to 1

This avoids producing out of range or clipped samples.

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi   | 8 
 libavfilter/af_sidechaincompress.c | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index e29c4d940f..a0ab2fb0c7 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -357,8 +357,8 @@ The filter accepts the following options:
 Set input gain. Default is 1. Range is between 0.015625 and 64.
 
 @item threshold
-If a signal of second stream rises above this level it will affect the gain
-reduction of the first stream.
+If a signal of stream rises above this level it will affect the gain
+reduction.
 By default it is 0.125. Range is between 0.00097563 and 1.
 
 @item ratio
@@ -376,7 +376,7 @@ reduction is decreased again. Default is 250. Range is 
between 0.01 and 9000.
 
 @item makeup
 Set the amount by how much signal will be amplified after processing.
-Default is 2. Range is from 1 and 64.
+Default is 1. Range is from 1 to 64.
 
 @item knee
 Curve the sharp knee around the threshold to enter gain reduction more softly.
@@ -3340,7 +3340,7 @@ reduction is decreased again. Default is 250. Range is 
between 0.01 and 9000.
 
 @item makeup
 Set the amount by how much signal will be amplified after processing.
-Default is 2. Range is from 1 and 64.
+Default is 1. Range is from 1 to 64.
 
 @item knee
 Curve the sharp knee around the threshold to enter gain reduction more softly.
diff --git a/libavfilter/af_sidechaincompress.c 
b/libavfilter/af_sidechaincompress.c
index 3f540e2dff..d1dfc106e2 100644
--- a/libavfilter/af_sidechaincompress.c
+++ b/libavfilter/af_sidechaincompress.c
@@ -72,7 +72,7 @@ static const AVOption options[] = {
 { "ratio", "set ratio",  OFFSET(ratio), 
AV_OPT_TYPE_DOUBLE, {.dbl=2},   1,   20, A|F },
 { "attack","set attack", OFFSET(attack),
AV_OPT_TYPE_DOUBLE, {.dbl=20},   0.01, 2000, A|F },
 { "release",   "set release",OFFSET(release),   
AV_OPT_TYPE_DOUBLE, {.dbl=250},  0.01, 9000, A|F },
-{ "makeup","set make up gain",   OFFSET(makeup),
AV_OPT_TYPE_DOUBLE, {.dbl=2},   1,   64, A|F },
+{ "makeup","set make up gain",   OFFSET(makeup),
AV_OPT_TYPE_DOUBLE, {.dbl=1},   1,   64, A|F },
 { "knee",  "set knee",   OFFSET(knee),  
AV_OPT_TYPE_DOUBLE, {.dbl=2.82843}, 1,8, A|F },
 { "link",  "set link type",  OFFSET(link),  AV_OPT_TYPE_INT,   
 {.i64=0},   0,1, A|F, "link" },
 {   "average", 0,0, AV_OPT_TYPE_CONST, 
 {.i64=0},   0,0, A|F, "link" },

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


[FFmpeg-cvslog] avfilter/avf_showspectrum: properly initialize pts

2017-05-22 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon May 22 11:06:48 
2017 +0200| [49d0678181af67455dfd23b98ab3857db1b68e67] | committer: Paul B Mahol

avfilter/avf_showspectrum: properly initialize pts

Signed-off-by: Paul B Mahol 

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

 libavfilter/avf_showspectrum.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index bf0c24437e..ff66740a3a 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -299,6 +299,8 @@ static int config_output(AVFilterLink *outlink)
 int i, fft_bits, h, w;
 float overlap;
 
+s->pts = AV_NOPTS_VALUE;
+
 if (!strcmp(ctx->filter->name, "showspectrumpic"))
 s->single_pic = 1;
 

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


[FFmpeg-cvslog] avfilter: add audio surround upmixer

2017-06-01 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri May 19 20:12:04 
2017 +0200| [dc72d1dde914c16d85673e80bbe3d21967e47deb] | committer: Paul B Mahol

avfilter: add audio surround upmixer

Signed-off-by: Paul B Mahol 

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

 Changelog |   1 +
 doc/filters.texi  |  30 ++
 libavfilter/Makefile  |   1 +
 libavfilter/af_surround.c | 835 ++
 libavfilter/allfilters.c  |   1 +
 libavfilter/version.h |   2 +-
 6 files changed, 869 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 1949ec7846..3533bdc682 100644
--- a/Changelog
+++ b/Changelog
@@ -16,6 +16,7 @@ version :
 - spec compliant VP9 muxing support in MP4
 - remove the libnut muxer/demuxer wrappers
 - remove the libschroedinger encoder/decoder wrappers
+- surround audio filter
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/doc/filters.texi b/doc/filters.texi
index 107fe61447..51fb6cdcee 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3792,6 +3792,36 @@ channels. Default is 0.3.
 Set level of input signal of original channel. Default is 0.8.
 @end table
 
+@section surround
+Apply audio surround upmix filter.
+
+This filter allows to produce multichannel output from stereo audio stream.
+
+The filter accepts the following options:
+
+@table @option
+@item chl_out
+Set output channel layout. By default, this is @var{5.1}.
+
+See @ref{channel layout syntax,,the Channel Layout section in the 
ffmpeg-utils(1) manual,ffmpeg-utils}
+for the required syntax.
+
+@item level_in
+Set input volume level. By default, this is @var{1}.
+
+@item level_out
+Set output volume level. By default, this is @var{1}.
+
+@item lfe
+Enable LFE channel output if output channel layout has it. By default, this is 
enabled.
+
+@item lfe_low
+Set LFE low cut off frequency. By default, this is @var{128} Hz.
+
+@item lfe_high
+Set LFE high cut off frequency. By default, this is @var{256} Hz.
+@end table
+
 @section treble
 
 Boost or cut treble (upper) frequencies of the audio using a two-pole
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 434a989244..c88dfb3264 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -108,6 +108,7 @@ OBJS-$(CONFIG_SILENCEREMOVE_FILTER)  += 
af_silenceremove.o
 OBJS-$(CONFIG_SOFALIZER_FILTER)  += af_sofalizer.o
 OBJS-$(CONFIG_STEREOTOOLS_FILTER)+= af_stereotools.o
 OBJS-$(CONFIG_STEREOWIDEN_FILTER)+= af_stereowiden.o
+OBJS-$(CONFIG_SURROUND_FILTER)   += af_surround.o
 OBJS-$(CONFIG_TREBLE_FILTER) += af_biquads.o
 OBJS-$(CONFIG_TREMOLO_FILTER)+= af_tremolo.o
 OBJS-$(CONFIG_VIBRATO_FILTER)+= af_vibrato.o 
generate_wave_table.o
diff --git a/libavfilter/af_surround.c b/libavfilter/af_surround.c
new file mode 100644
index 00..c7d86a50b8
--- /dev/null
+++ b/libavfilter/af_surround.c
@@ -0,0 +1,835 @@
+/*
+ * Copyright (c) 2017 Paul B Mahol
+ *
+ * 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 "libavutil/audio_fifo.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
+#include "libavcodec/avfft.h"
+#include "avfilter.h"
+#include "audio.h"
+#include "formats.h"
+
+typedef struct AudioSurroundContext {
+const AVClass *class;
+
+char *out_channel_layout_str;
+float level_in;
+float level_out;
+int output_lfe;
+int lowcutf;
+int highcutf;
+
+float lowcut;
+float highcut;
+
+uint64_t out_channel_layout;
+int nb_in_channels;
+int nb_out_channels;
+
+AVFrame *input;
+AVFrame *output;
+AVFrame *overlap_buffer;
+
+int buf_size;
+int hop_size;
+AVAudioFifo *fifo;
+RDFTContext **rdft, **irdft;
+float *window_func_lut;
+
+int64_t pts;
+
+void (*upmix)(AVFilterContext *ctx,
+  float l_phase,
+  float r_phase,
+  float c_phase,
+  float mag_total,
+  float x, float y,
+  int n);
+} AudioSurroundContext;
+
+static int query_

[FFmpeg-cvslog] avfilter/af_surround: add support for some upmixing of 3.0, 2.1 and 5.1 channel layout

2017-06-04 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Jun  3 22:44:08 
2017 +0200| [fab1863917b88bae7eb5c823927dc8ddd9ab6217] | committer: Paul B Mahol

avfilter/af_surround: add support for some upmixing of 3.0, 2.1 and 5.1 channel 
layout

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi  |   8 +-
 libavfilter/af_surround.c | 517 --
 2 files changed, 462 insertions(+), 63 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index d4fbb5ac9b..65eef89d07 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3795,7 +3795,7 @@ Set level of input signal of original channel. Default is 
0.8.
 @section surround
 Apply audio surround upmix filter.
 
-This filter allows to produce multichannel output from stereo audio stream.
+This filter allows to produce multichannel output from audio stream.
 
 The filter accepts the following options:
 
@@ -3806,6 +3806,12 @@ Set output channel layout. By default, this is @var{5.1}.
 See @ref{channel layout syntax,,the Channel Layout section in the 
ffmpeg-utils(1) manual,ffmpeg-utils}
 for the required syntax.
 
+@item chl_in
+Set input channel layout. By default, this is @var{stereo}.
+
+See @ref{channel layout syntax,,the Channel Layout section in the 
ffmpeg-utils(1) manual,ffmpeg-utils}
+for the required syntax.
+
 @item level_in
 Set input volume level. By default, this is @var{1}.
 
diff --git a/libavfilter/af_surround.c b/libavfilter/af_surround.c
index c7d86a50b8..01449d557a 100644
--- a/libavfilter/af_surround.c
+++ b/libavfilter/af_surround.c
@@ -30,6 +30,7 @@ typedef struct AudioSurroundContext {
 const AVClass *class;
 
 char *out_channel_layout_str;
+char *in_channel_layout_str;
 float level_in;
 float level_out;
 int output_lfe;
@@ -40,6 +41,7 @@ typedef struct AudioSurroundContext {
 float highcut;
 
 uint64_t out_channel_layout;
+uint64_t in_channel_layout;
 int nb_in_channels;
 int nb_out_channels;
 
@@ -55,13 +57,41 @@ typedef struct AudioSurroundContext {
 
 int64_t pts;
 
-void (*upmix)(AVFilterContext *ctx,
-  float l_phase,
-  float r_phase,
-  float c_phase,
-  float mag_total,
-  float x, float y,
-  int n);
+void (*filter)(AVFilterContext *ctx);
+void (*upmix_stereo)(AVFilterContext *ctx,
+ float l_phase,
+ float r_phase,
+ float c_phase,
+ float mag_total,
+ float x, float y,
+ int n);
+void (*upmix_2_1)(AVFilterContext *ctx,
+  float l_phase,
+  float r_phase,
+  float c_phase,
+  float mag_total,
+  float lfe_im,
+  float lfe_re,
+  float x, float y,
+  int n);
+void (*upmix_3_0)(AVFilterContext *ctx,
+  float l_phase,
+  float r_phase,
+  float c_mag,
+  float c_phase,
+  float mag_total,
+  float x, float y,
+  int n);
+void (*upmix_5_1)(AVFilterContext *ctx,
+  float c_re, float c_im,
+  float lfe_re, float lfe_im,
+  float mag_totall, float mag_totalr,
+  float fl_phase, float fr_phase,
+  float bl_phase, float br_phase,
+  float sl_phase, float sr_phase,
+  float xl, float yl,
+  float xr, float yr,
+  int n);
 } AudioSurroundContext;
 
 static int query_formats(AVFilterContext *ctx)
@@ -88,7 +118,7 @@ static int query_formats(AVFilterContext *ctx)
 return ret;
 
 layouts = NULL;
-ret = ff_add_channel_layout(&layouts, AV_CH_LAYOUT_STEREO);
+ret = ff_add_channel_layout(&layouts, s->in_channel_layout);
 if (ret)
 return ret;
 
@@ -313,6 +343,41 @@ static void upmix_3_1(AVFilterContext *ctx,
 dstlfe[2 * n + 1] = lfe_mag * sinf(c_phase);
 }
 
+static void upmix_3_1_surround(AVFilterContext *ctx,
+   float l_phase,
+   float r_phase,
+   float c_phase,
+   float c_mag,
+   float mag_total,
+   float x, float y,
+   int n)
+{
+AudioSurroundContext *s = ctx->priv;
+float lfe_mag, l_mag, r_mag, *dstc, *dstl, *dstr, *dstlfe;
+
+dstl = (float *)s->output->extended_data[0];
+dstr = (float *)s->output->extended_data[1];
+dstc = (float

[FFmpeg-cvslog] avfilter/af_afftfilt: fix memory leaks

2017-06-04 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Jun  4 22:51:57 
2017 +0200| [67162554d458c12f73c9461d5e661445693a201c] | committer: Paul B Mahol

avfilter/af_afftfilt: fix memory leaks

Signed-off-by: Paul B Mahol 

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

 libavfilter/af_afftfilt.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavfilter/af_afftfilt.c b/libavfilter/af_afftfilt.c
index 3fc1a1b4c9..d166fa4190 100644
--- a/libavfilter/af_afftfilt.c
+++ b/libavfilter/af_afftfilt.c
@@ -371,6 +371,9 @@ static av_cold void uninit(AVFilterContext *ctx)
 av_freep(&s->real);
 av_freep(&s->imag);
 av_frame_free(&s->buffer);
+av_freep(&s->window_func_lut);
+
+av_audio_fifo_free(s->fifo);
 }
 
 static const AVFilterPad inputs[] = {

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


[FFmpeg-cvslog] avfilter/af_sofalizer: switch to libmysofa

2017-06-08 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Jun  3 01:39:04 
2017 +0200| [2336c76b224628f20ed0ef8a683ad602ed1739c3] | committer: Paul B Mahol

avfilter/af_sofalizer: switch to libmysofa

Signed-off-by: Paul B Mahol 

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

 Changelog  |   1 +
 configure  |   8 +-
 doc/filters.texi   |   2 +-
 libavfilter/af_sofalizer.c | 700 -
 4 files changed, 195 insertions(+), 516 deletions(-)

diff --git a/Changelog b/Changelog
index 3533bdc682..ffb8b824f8 100644
--- a/Changelog
+++ b/Changelog
@@ -17,6 +17,7 @@ version :
 - remove the libnut muxer/demuxer wrappers
 - remove the libschroedinger encoder/decoder wrappers
 - surround audio filter
+- sofalizer filter switched to libmysofa
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/configure b/configure
index 9688b35fa1..e3941f9dfd 100755
--- a/configure
+++ b/configure
@@ -277,7 +277,7 @@ External library support:
   --disable-lzma   disable lzma [autodetect]
   --enable-decklinkenable Blackmagic DeckLink I/O support [no]
   --enable-mediacodec  enable Android MediaCodec support [no]
-  --enable-netcdf  enable NetCDF, needed for sofalizer filter [no]
+  --enable-libmysofa   enable libmysofa, needed for sofalizer filter [no]
   --enable-openal  enable OpenAL 1.1 capture support [no]
   --enable-opencl  enable OpenCL code
   --enable-opengl  enable OpenGL rendering [no]
@@ -1550,6 +1550,7 @@ EXTERNAL_LIBRARY_LIST="
 libkvazaar
 libmodplug
 libmp3lame
+libmysofa
 libopencv
 libopenh264
 libopenjpeg
@@ -1576,7 +1577,6 @@ EXTERNAL_LIBRARY_LIST="
 libzmq
 libzvbi
 mediacodec
-netcdf
 openal
 opencl
 opengl
@@ -3156,7 +3156,7 @@ showspectrumpic_filter_deps="avcodec"
 showspectrumpic_filter_select="fft"
 signature_filter_deps="gpl avcodec avformat"
 smartblur_filter_deps="gpl swscale"
-sofalizer_filter_deps="netcdf avcodec"
+sofalizer_filter_deps="libmysofa avcodec"
 sofalizer_filter_select="fft"
 spectrumsynth_filter_deps="avcodec"
 spectrumsynth_filter_select="fft"
@@ -5822,6 +5822,7 @@ enabled libmfx&& { use_pkg_config libmfx 
"mfx/mfxvideo.h" MFXInit ||
{ require libmfx "mfx/mfxvideo.h" MFXInit 
-llibmfx && warn "using libmfx without pkg-config"; } }
 enabled libmodplug&& require_pkg_config libmodplug 
libmodplug/modplug.h ModPlug_Load
 enabled libmp3lame&& require "libmp3lame >= 3.98.3" lame/lame.h 
lame_set_VBR_quality -lmp3lame
+enabled libmysofa && require libmysofa "mysofa.h" mysofa_load -lmysofa
 enabled libnpp&& require libnpp npp.h nppGetLibVersion -lnppi 
-lnppc
 enabled libopencore_amrnb && require libopencore_amrnb 
opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
 enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h 
D_IF_init -lopencore-amrwb
@@ -5919,7 +5920,6 @@ enabled mmal  && { check_lib mmal 
interface/mmal/mmal.h mmal_port_co
  check_lib mmal interface/mmal/mmal.h 
mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } ||
die "ERROR: mmal not found" &&
check_func_headers interface/mmal/mmal.h 
"MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; }
-enabled netcdf&& require_pkg_config netcdf netcdf.h nc_inq_libvers
 enabled openal&& { { for al_extralibs in "${OPENAL_LIBS}" 
"-lopenal" "-lOpenAL32"; do
check_lib openal 'AL/al.h' alGetError 
"${al_extralibs}" && break; done } ||
die "ERROR: openal not found"; } &&
diff --git a/doc/filters.texi b/doc/filters.texi
index ba9247d29e..9cc356b4df 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3571,7 +3571,7 @@ SOFAlizer is developed at the Acoustics Research 
Institute (ARI) of the
 Austrian Academy of Sciences.
 
 To enable compilation of this filter you need to configure FFmpeg with
-@code{--enable-netcdf}.
+@code{--enable-libmysofa}.
 
 The filter accepts the following options:
 
diff --git a/libavfilter/af_sofalizer.c b/libavfilter/af_sofalizer.c
index ef723ee2c4..d9098d7679 100644
--- a/libavfilter/af_sofalizer.c
+++ b/libavfilter/af_sofalizer.c
@@ -26,7 +26,7 @@
  */
 
 #include 
-#include 
+#include 
 
 #include "libavcodec/avfft.h&

[FFmpeg-cvslog] avcodec: add Gremlin DPCM decoder

2017-06-11 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Jun  2 12:43:02 
2017 +0200| [29bdcf588f81aceca268dbfff036eb46b8d8bf80] | committer: Paul B Mahol

avcodec: add Gremlin DPCM decoder

Signed-off-by: Paul B Mahol 

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

 libavcodec/Makefile |  1 +
 libavcodec/allcodecs.c  |  1 +
 libavcodec/avcodec.h|  1 +
 libavcodec/codec_desc.c |  7 +++
 libavcodec/dpcm.c   | 44 ++--
 libavcodec/version.h|  4 ++--
 6 files changed, 50 insertions(+), 8 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index a752f87ef5..7ce7d14d0e 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -310,6 +310,7 @@ OBJS-$(CONFIG_G723_1_ENCODER)  += g723_1enc.o 
g723_1.o \
 OBJS-$(CONFIG_G729_DECODER)+= g729dec.o lsp.o celp_math.o 
celp_filters.o acelp_filters.o acelp_pitch_delay.o acelp_vectors.o 
g729postfilter.o
 OBJS-$(CONFIG_GIF_DECODER) += gifdec.o lzw.o
 OBJS-$(CONFIG_GIF_ENCODER) += gif.o lzwenc.o
+OBJS-$(CONFIG_GREMLIN_DPCM_DECODER)+= dpcm.o
 OBJS-$(CONFIG_GSM_DECODER) += gsmdec.o gsmdec_data.o msgsmdec.o
 OBJS-$(CONFIG_GSM_MS_DECODER)  += gsmdec.o gsmdec_data.o msgsmdec.o
 OBJS-$(CONFIG_H261_DECODER)+= h261dec.o h261data.o h261.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 4373ebd975..995d58b144 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -520,6 +520,7 @@ static void register_all(void)
 REGISTER_DECODER(PCM_ZORK,  pcm_zork);
 
 /* DPCM codecs */
+REGISTER_DECODER(GREMLIN_DPCM,  gremlin_dpcm);
 REGISTER_DECODER(INTERPLAY_DPCM,interplay_dpcm);
 REGISTER_ENCDEC (ROQ_DPCM,  roq_dpcm);
 REGISTER_DECODER(SOL_DPCM,  sol_dpcm);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 00f9c82afc..59bd1c5a4a 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -548,6 +548,7 @@ enum AVCodecID {
 AV_CODEC_ID_SOL_DPCM,
 
 AV_CODEC_ID_SDX2_DPCM = 0x14800,
+AV_CODEC_ID_GREMLIN_DPCM,
 
 /* audio codecs */
 AV_CODEC_ID_MP2 = 0x15000,
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index f0ca4ba059..4cc572901e 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -2249,6 +2249,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("DPCM Squareroot-Delta-Exact"),
 .props = AV_CODEC_PROP_LOSSY,
 },
+{
+.id= AV_CODEC_ID_GREMLIN_DPCM,
+.type  = AVMEDIA_TYPE_AUDIO,
+.name  = "gremlin_dpcm",
+.long_name = NULL_IF_CONFIG_SMALL("DPCM Gremlin"),
+.props = AV_CODEC_PROP_LOSSY,
+},
 
 /* audio codecs */
 {
diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c
index 2edd4d5b0a..7d3934ee35 100644
--- a/libavcodec/dpcm.c
+++ b/libavcodec/dpcm.c
@@ -44,7 +44,7 @@
 #include "mathops.h"
 
 typedef struct DPCMContext {
-int16_t square_array[256];
+int16_t array[256];
 int sample[2];  ///< previous sample (for SOL_DPCM)
 const int8_t *sol_table;///< delta table for SOL_DPCM
 } DPCMContext;
@@ -130,8 +130,8 @@ static av_cold int dpcm_decode_init(AVCodecContext *avctx)
 /* initialize square table */
 for (i = 0; i < 128; i++) {
 int16_t square = i * i;
-s->square_array[i  ] =  square;
-s->square_array[i + 128] = -square;
+s->array[i  ] =  square;
+s->array[i + 128] = -square;
 }
 break;
 
@@ -156,7 +156,25 @@ static av_cold int dpcm_decode_init(AVCodecContext *avctx)
 case AV_CODEC_ID_SDX2_DPCM:
 for (i = -128; i < 128; i++) {
 int16_t square = i * i * 2;
-s->square_array[i+128] = i < 0 ? -square: square;
+s->array[i+128] = i < 0 ? -square: square;
+}
+break;
+
+case AV_CODEC_ID_GREMLIN_DPCM: {
+int delta = 0;
+int code = 64;
+int step = 45;
+
+s->array[0] = 0;
+for (i = 0; i < 127; i++) {
+delta += (code >> 5);
+code  += step;
+step  += 2;
+
+s->array[i*2 + 1] =  delta;
+s->array[i*2 + 2] = -delta;
+}
+s->array[255] = delta + (code >> 5);
 }
 break;
 
@@ -207,6 +225,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void 
*data,
 else
 out = buf_size;
 break;
+case AV_CODEC_ID_GREMLIN_DPCM:
 case AV_CODEC_ID_SDX2_DPCM:
 out = buf_size;
 break;
@@ -240,7 +259,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void 
*data,
 
 /* decode the samples */
 while (output_samples < sample

[FFmpeg-cvslog] avcodec: add Gremlin Digital Video decoder

2017-06-11 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Jun  2 12:52:07 
2017 +0200| [d1c08027d8e4eb77467926588f437dd946e8fb65] | committer: Paul B Mahol

avcodec: add Gremlin Digital Video decoder

Signed-off-by: Paul B Mahol 

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

 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/avcodec.h|   1 +
 libavcodec/codec_desc.c |   7 +
 libavcodec/gdv.c| 404 
 libavcodec/version.h|   2 +-
 6 files changed, 415 insertions(+), 1 deletion(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 7ce7d14d0e..2e7f19dba6 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -308,6 +308,7 @@ OBJS-$(CONFIG_G723_1_DECODER)  += g723_1dec.o 
g723_1.o \
 OBJS-$(CONFIG_G723_1_ENCODER)  += g723_1enc.o g723_1.o \
   acelp_vectors.o celp_filters.o 
celp_math.o
 OBJS-$(CONFIG_G729_DECODER)+= g729dec.o lsp.o celp_math.o 
celp_filters.o acelp_filters.o acelp_pitch_delay.o acelp_vectors.o 
g729postfilter.o
+OBJS-$(CONFIG_GDV_DECODER) += gdv.o
 OBJS-$(CONFIG_GIF_DECODER) += gifdec.o lzw.o
 OBJS-$(CONFIG_GIF_ENCODER) += gif.o lzwenc.o
 OBJS-$(CONFIG_GREMLIN_DPCM_DECODER)+= dpcm.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 995d58b144..27110e1cfd 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -195,6 +195,7 @@ static void register_all(void)
 REGISTER_DECODER(FRAPS, fraps);
 REGISTER_DECODER(FRWU,  frwu);
 REGISTER_DECODER(G2M,   g2m);
+REGISTER_DECODER(GDV,   gdv);
 REGISTER_ENCDEC (GIF,   gif);
 REGISTER_ENCDEC (H261,  h261);
 REGISTER_ENCDEC (H263,  h263);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 59bd1c5a4a..dcdcfe00ae 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -446,6 +446,7 @@ enum AVCodecID {
 AV_CODEC_ID_MSCC,
 AV_CODEC_ID_SRGC,
 AV_CODEC_ID_SVG,
+AV_CODEC_ID_GDV,
 
 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
start of audio codecs
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 4cc572901e..cf1246e431 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1410,6 +1410,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Screen Recorder Gold Codec"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
 },
+{
+.id= AV_CODEC_ID_GDV,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "gdv",
+.long_name = NULL_IF_CONFIG_SMALL("Gremlin Digital Video"),
+.props = AV_CODEC_PROP_LOSSY,
+},
 
 /* image codecs */
 {
diff --git a/libavcodec/gdv.c b/libavcodec/gdv.c
new file mode 100644
index 00..095cf4c40f
--- /dev/null
+++ b/libavcodec/gdv.c
@@ -0,0 +1,404 @@
+/*
+ * Gremlin Digital Video (GDV) decoder
+ * Copyright (c) 2017 Konstantin Shishkov
+ * Copyright (c) 2017 Paul B Mahol
+ *
+ * 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 "libavutil/common.h"
+#include "avcodec.h"
+#include "bytestream.h"
+#include "internal.h"
+
+typedef struct GDVContext {
+AVCodecContext *avctx;
+
+GetByteContext gb;
+GetByteContext g2;
+PutByteContext pb;
+
+uint32_t pal[256];
+uint8_t *frame;
+unsigned frame_size;
+unsigned scale_h, scale_v;
+} GDVContext;
+
+typedef struct Bits32 {
+uint32_t queue;
+uint8_t  fill;
+} Bits32;
+
+#define PREAMBLE_SIZE 4096
+
+static av_cold int gdv_decode_init(AVCodecContext *avctx)
+{
+GDVContext *gdv = avctx->priv_data;
+int i, j, k;
+
+avctx->pix_fmt  = AV_PIX_FMT_PAL8;
+gdv->frame_size = avctx->width * avctx->height + PREAMBLE_SIZE;
+gdv->frame = av_calloc(gdv->frame_size, 1);
+if (!gdv->frame)
+return AVERROR(ENOMEM);
+
+for (i = 0; i < 2; i++) {
+  

[FFmpeg-cvslog] avformat: add Gremlin Digital Video demuxer

2017-06-11 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Jun  2 11:28:35 
2017 +0200| [c94841487622e52f95e6c703514d604b6ae8e47d] | committer: Paul B Mahol

avformat: add Gremlin Digital Video demuxer

Signed-off-by: Paul B Mahol 

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

 Changelog|   1 +
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/gdv.c| 161 +++
 libavformat/version.h|   4 +-
 5 files changed, 166 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index ffb8b824f8..cf0adc90e4 100644
--- a/Changelog
+++ b/Changelog
@@ -18,6 +18,7 @@ version :
 - remove the libschroedinger encoder/decoder wrappers
 - surround audio filter
 - sofalizer filter switched to libmysofa
+- Gremlin Digital Video demuxer and decoder
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 00cba52a43..80aeed22c0 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -192,6 +192,7 @@ OBJS-$(CONFIG_G722_MUXER)+= rawenc.o
 OBJS-$(CONFIG_G723_1_DEMUXER)+= g723_1.o
 OBJS-$(CONFIG_G723_1_MUXER)  += rawenc.o
 OBJS-$(CONFIG_G729_DEMUXER)  += g729dec.o
+OBJS-$(CONFIG_GDV_DEMUXER)   += gdv.o
 OBJS-$(CONFIG_GENH_DEMUXER)  += genh.o
 OBJS-$(CONFIG_H261_DEMUXER)  += h261dec.o rawdec.o
 OBJS-$(CONFIG_H261_MUXER)+= rawenc.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index ad516eba06..a0e2fb8c85 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -134,6 +134,7 @@ static void register_all(void)
 REGISTER_MUXDEMUX(G722, g722);
 REGISTER_MUXDEMUX(G723_1,   g723_1);
 REGISTER_DEMUXER (G729, g729);
+REGISTER_DEMUXER (GDV,  gdv);
 REGISTER_DEMUXER (GENH, genh);
 REGISTER_MUXDEMUX(GIF,  gif);
 REGISTER_MUXDEMUX(GSM,  gsm);
diff --git a/libavformat/gdv.c b/libavformat/gdv.c
new file mode 100644
index 00..87bba2fdbd
--- /dev/null
+++ b/libavformat/gdv.c
@@ -0,0 +1,161 @@
+/*
+ * Gremlin Digital Video demuxer
+ * Copyright (c) 2017 Paul B Mahol
+ *
+ * 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 "libavutil/intreadwrite.h"
+
+#include "avformat.h"
+#include "avio.h"
+#include "internal.h"
+
+typedef struct GDVContext {
+int is_first_video;
+int is_audio;
+int audio_size;
+int audio_stream_index;
+int video_stream_index;
+unsigned pal[256];
+} GDVContext;
+
+static int gdv_read_probe(AVProbeData *p)
+{
+if (AV_RL32(p->buf) == 0x29111994)
+return AVPROBE_SCORE_MAX;
+
+return 0;
+}
+
+static int gdv_read_header(AVFormatContext *ctx)
+{
+GDVContext *gdv = ctx->priv_data;
+AVIOContext *pb = ctx->pb;
+AVStream *vst, *ast;
+unsigned fps, snd_flags, vid_depth;
+
+avio_skip(pb, 6);
+
+vst = avformat_new_stream(ctx, 0);
+if (!vst)
+return AVERROR(ENOMEM);
+
+vst->start_time= 0;
+vst->duration  =
+vst->nb_frames = avio_rl16(pb);
+
+fps = avio_rl16(pb);
+snd_flags = avio_rl16(pb);
+if (snd_flags & 1) {
+ast = avformat_new_stream(ctx, 0);
+if (!ast)
+return AVERROR(ENOMEM);
+
+ast->start_time = 0;
+ast->codecpar->codec_type  = AVMEDIA_TYPE_AUDIO;
+ast->codecpar->codec_tag   = 0;
+ast->codecpar->sample_rate = avio_rl16(pb);
+ast->codecpar->channels= 1 + !!(snd_flags & 2);
+if (snd_flags & 8) {
+ast->codecpar->codec_id = AV_CODEC_ID_GREMLIN_DPCM;
+} else {
+ast->codecpar->codec_id = (snd_flags & 4) ? AV_CODEC_ID_PCM_S16LE 
: AV_CODEC_ID_PCM_U8;
+}
+
+avpriv_set_pts_info(ast, 64, 1, ast->codecpar->sample_rate);
+gdv->audio_size = (ast->codecpar->sample_rate / fps) *
+   ast->codecpar->channels * (1 + !!(snd_flags & 4

[FFmpeg-cvslog] avcodec/gdv: fix compiler warnings

2017-06-11 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Jun 11 10:26:18 
2017 +0200| [9a949cdf8f6c5cea646a418886f807d06ab05ef5] | committer: Paul B Mahol

avcodec/gdv: fix compiler warnings

Signed-off-by: Paul B Mahol 

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

 libavcodec/gdv.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/libavcodec/gdv.c b/libavcodec/gdv.c
index 095cf4c40f..cae82b825d 100644
--- a/libavcodec/gdv.c
+++ b/libavcodec/gdv.c
@@ -235,14 +235,16 @@ static int decompress_68(AVCodecContext *avctx, unsigned 
skip, unsigned use8)
 int len = (subtag) + 3;
 lz_copy(pb, g2, (offs) - 4096, len);
 } else {
+int real_off, len, c1, c2;
+
 if (offs == 0xFFF) {
 return 0;
 }
 
-int real_off = ((offs >> 4) & 0x7) + 1;
-int len = ((offs & 0xF) + 2) * 2;
-int c1 = gdv->frame[bytestream2_tell_p(pb) - real_off];
-int c2 = gdv->frame[bytestream2_tell_p(pb) - real_off + 1];
+real_off = ((offs >> 4) & 0x7) + 1;
+len = ((offs & 0xF) + 2) * 2;
+c1 = gdv->frame[bytestream2_tell_p(pb) - real_off];
+c2 = gdv->frame[bytestream2_tell_p(pb) - real_off + 1];
 for (i = 0; i < len/2; i++) {
 bytestream2_put_byte(pb, c1);
 bytestream2_put_byte(pb, c2);
@@ -259,10 +261,10 @@ static int decompress_68(AVCodecContext *avctx, unsigned 
skip, unsigned use8)
 int len;
 int off;
 if (use8) {
-int b = bytestream2_get_byte(gb);
+int q, b = bytestream2_get_byte(gb);
 if ((b & 0xC0) == 0xC0) {
 len = ((b & 0x3F)) + 8;
-int q = read_bits32(&bits, gb, 4);
+q = read_bits32(&bits, gb, 4);
 off = (q << 8) + (bytestream2_get_byte(gb)) + 1;
 } else {
 int ofs1;
@@ -276,14 +278,14 @@ static int decompress_68(AVCodecContext *avctx, unsigned 
skip, unsigned use8)
 off = (ofs1 << 8) + (bytestream2_get_byte(gb)) - 4096;
 }
 } else {
-int b = bytestream2_get_byte(gb);
+int ofs1, b = bytestream2_get_byte(gb);
 
 if ((b >> 4) == 0xF) {
 len = bytestream2_get_byte(gb) + 21;
 } else {
 len = (b >> 4) + 6;
 }
-int ofs1 = (b & 0xF);
+ofs1 = (b & 0xF);
 off = (ofs1 << 8) + bytestream2_get_byte(gb) - 4096;
 }
 lz_copy(pb, g2, off, len);

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


[FFmpeg-cvslog] avfilter: add native headphone spatialization filter

2017-06-12 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed Jun  7 21:23:14 
2017 +0200| [d4d1fc823f99ab9cf13067fdd31b02c2c7fc4e2b] | committer: Paul B Mahol

avfilter: add native headphone spatialization filter

Signed-off-by: Paul B Mahol 

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

 Changelog  |   1 +
 doc/filters.texi   |  43 +++
 libavfilter/Makefile   |   1 +
 libavfilter/af_headphone.c | 811 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/version.h  |   2 +-
 6 files changed, 858 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index cf0adc90e4..cd91f63cb3 100644
--- a/Changelog
+++ b/Changelog
@@ -19,6 +19,7 @@ version :
 - surround audio filter
 - sofalizer filter switched to libmysofa
 - Gremlin Digital Video demuxer and decoder
+- headphone audio filter
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/doc/filters.texi b/doc/filters.texi
index 9cc356b4df..023096f4e0 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -2789,6 +2789,49 @@ Samples where the target gain does not match between 
channels
 @end table
 @end table
 
+@section headphone
+
+Apply head-related transfer functions (HRTFs) to create virtual
+loudspeakers around the user for binaural listening via headphones.
+The HRIRs are provided via additional streams, for each channel
+one stereo input stream is needed.
+
+The filter accepts the following options:
+
+@table @option
+@item map
+Set mapping of input streams for convolution.
+The argument is a '|'-separated list of channel names in order as they
+are given as additional stream inputs for filter.
+This also specify number of input streams. Number of input streams
+must be not less than number of channels in first stream plus one.
+
+@item gain
+Set gain applied to audio. Value is in dB. Default is 0.
+
+@item type
+Set processing type. Can be @var{time} or @var{freq}. @var{time} is
+processing audio in time domain which is slow.
+@var{freq} is processing audio in frequency domain which is fast.
+Default is @var{freq}.
+
+@item lfe
+Set custom gain for LFE channels. Value is in dB. Default is 0.
+@end table
+
+@subsection Examples
+
+@itemize
+@item
+Full example using wav files as coefficients with amovie filters for 7.1 
downmix,
+each amovie filter use stereo file with IR coefficients as input.
+The files give coefficients for each position of virtual loudspeaker:
+@example
+ffmpeg -i input.wav -lavfi-complex 
"amovie=azi_270_ele_0_DFC.wav[sr],amovie=azi_90_ele_0_DFC.wav[sl],amovie=azi_225_ele_0_DFC.wav[br],amovie=azi_135_ele_0_DFC.wav[bl],amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe],amovie=azi_35_ele_0_DFC.wav[fl],amovie=azi_325_ele_0_DFC.wav[fr],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
+output.wav
+@end example
+@end itemize
+
 @section highpass
 
 Apply a high-pass filter with 3dB point frequency.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index c88dfb3264..04ec9b8b8f 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -92,6 +92,7 @@ OBJS-$(CONFIG_EXTRASTEREO_FILTER)+= 
af_extrastereo.o
 OBJS-$(CONFIG_FIREQUALIZER_FILTER)   += af_firequalizer.o
 OBJS-$(CONFIG_FLANGER_FILTER)+= af_flanger.o 
generate_wave_table.o
 OBJS-$(CONFIG_HDCD_FILTER)   += af_hdcd.o
+OBJS-$(CONFIG_HEADPHONE_FILTER)  += af_headphone.o
 OBJS-$(CONFIG_HIGHPASS_FILTER)   += af_biquads.o
 OBJS-$(CONFIG_JOIN_FILTER)   += af_join.o
 OBJS-$(CONFIG_LADSPA_FILTER) += af_ladspa.o
diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c
new file mode 100644
index 00..3dd5a0c396
--- /dev/null
+++ b/libavfilter/af_headphone.c
@@ -0,0 +1,811 @@
+/*
+ * Copyright (C) 2017 Paul B Mahol
+ * Copyright (C) 2013-2015 Andreas Fuchs, Wolfgang Hrauda
+ * 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 
+
+#include "libavutil/audio_fifo.h"
+#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/float_dsp.h"
+#include "libavutil/intmath.h&quo

[FFmpeg-cvslog] tools: add sofa2wavs

2017-06-12 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Jun  9 13:18:31 
2017 +0200| [1a30bf60be9243830b68e8fe2e20539f08a85926] | committer: Paul B Mahol

tools: add sofa2wavs

Signed-off-by: Paul B Mahol 

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

 Makefile  |  1 +
 tools/Makefile|  1 +
 tools/sofa2wavs.c | 79 +++
 3 files changed, 81 insertions(+)

diff --git a/Makefile b/Makefile
index 685b613a1c..a2df8b9d8d 100644
--- a/Makefile
+++ b/Makefile
@@ -82,6 +82,7 @@ target_dec_%_fuzzer$(EXESUF): target_dec_%_fuzzer.o 
$(FF_DEP_LIBS)
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) 
$(LIBFUZZER_PATH)
 
 tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
+tools/sofa2wavs$(EXESUF): ELIBS = $(FF_EXTRALIBS)
 tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS)
 tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS)
 tools/target_dec_%_fuzzer$(EXESUF): $(FF_DEP_LIBS)
diff --git a/tools/Makefile b/tools/Makefile
index 3ebd3619ca..3909e7cfdd 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -1,4 +1,5 @@
 TOOLS = qt-faststart trasher uncoded_frame
+TOOLS-$(CONFIG_LIBMYSOFA) += sofa2wavs
 TOOLS-$(CONFIG_ZLIB) += cws2fws
 
 tools/target_dec_%_fuzzer.o: tools/target_dec_fuzzer.c
diff --git a/tools/sofa2wavs.c b/tools/sofa2wavs.c
new file mode 100644
index 00..f85e54f771
--- /dev/null
+++ b/tools/sofa2wavs.c
@@ -0,0 +1,79 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int main(int argc, char **argv)
+{
+struct MYSOFA_HRTF *hrtf;
+int sample_rate;
+int err, i, j;
+
+if (argc < 3) {
+printf("usage: %s input_SOFA_file output_directory\n", argv[0]);
+return 1;
+}
+
+hrtf = mysofa_load(argv[1], &err);
+if (!hrtf || err) {
+printf("invalid input SOFA file: %s\n", argv[1]);
+return 1;
+}
+
+if (hrtf->DataSamplingRate.elements != 1)
+goto fail;
+sample_rate = hrtf->DataSamplingRate.values[0];
+
+err = mkdir(argv[2], 0744);
+if (err)
+goto fail;
+
+err = chdir(argv[2]);
+if (err)
+goto fail;
+
+for (i = 0; i < hrtf->M; i++) {
+FILE *file;
+int bps = 32;
+int blkalign = 8;
+int bytespersec = blkalign * sample_rate;
+char filename[1024];
+int azi = hrtf->SourcePosition.values[i * 3];
+int ele = hrtf->SourcePosition.values[i * 3 + 1];
+int dis = hrtf->SourcePosition.values[i * 3 + 2];
+int size = 8 * hrtf->N;
+int offset = i * 2 * hrtf->N;
+
+snprintf(filename, sizeof(filename), "azi_%d_ele_%d_dis_%d.wav", azi, 
ele, dis);
+file = fopen(filename, "w+");
+fwrite("RIFF", 4, 1, file);
+fwrite("\xFF\xFF\xFF\xFF", 4, 1, file);
+fwrite("WAVE", 4, 1, file);
+fwrite("fmt ", 4, 1, file);
+fwrite("\x10\x00\00\00", 4, 1, file);
+fwrite("\x03\x00", 2, 1, file);
+fwrite("\x02\x00", 2, 1, file);
+fwrite(&sample_rate, 4, 1, file);
+fwrite(&bytespersec, 4, 1, file);
+fwrite(&blkalign, 2, 1, file);
+fwrite(&bps, 2, 1, file);
+fwrite("data", 4, 1, file);
+fwrite(&size, 4, 1, file);
+
+for (j = 0; j < hrtf->N; j++) {
+float l, r;
+
+l = hrtf->DataIR.values[offset + j];
+r = hrtf->DataIR.values[offset + j + hrtf->N];
+fwrite(&l, 4, 1, file);
+fwrite(&r, 4, 1, file);
+}
+fclose(file);
+}
+
+fail:
+mysofa_free(hrtf);
+
+return 0;
+}

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


[FFmpeg-cvslog] tools/sofa2wavs: add license header

2017-06-12 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Jun 12 22:13:09 
2017 +0200| [6e09e12641169da102853d944d7416e68a89d039] | committer: Paul B Mahol

tools/sofa2wavs: add license header

Signed-off-by: Paul B Mahol 

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

 tools/sofa2wavs.c | 20 
 1 file changed, 20 insertions(+)

diff --git a/tools/sofa2wavs.c b/tools/sofa2wavs.c
index f85e54f771..1f1075b22f 100644
--- a/tools/sofa2wavs.c
+++ b/tools/sofa2wavs.c
@@ -1,3 +1,23 @@
+/*
+ * Copyright (c) 2017 Paul B Mahol
+ *
+ * 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 
 #include 
 #include 

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


[FFmpeg-cvslog] avfilter: properly set SAR for A->V filters

2017-06-13 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Tue Jun 13 15:07:36 
2017 +0200| [f85cad799b52eb15f3dda40f4a400ee1a6e059a1] | committer: Paul B Mahol

avfilter: properly set SAR for A->V filters

Signed-off-by: Paul B Mahol 

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

 libavfilter/avf_abitscope.c| 2 ++
 libavfilter/avf_avectorscope.c | 1 +
 libavfilter/avf_showfreqs.c| 1 +
 libavfilter/avf_showspectrum.c | 3 ++-
 libavfilter/f_ebur128.c| 3 ++-
 5 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavfilter/avf_abitscope.c b/libavfilter/avf_abitscope.c
index 0f3e3594c1..0e3eaa422e 100644
--- a/libavfilter/avf_abitscope.c
+++ b/libavfilter/avf_abitscope.c
@@ -166,6 +166,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*insamples)
 memset(outpicref->data[0] + i * outpicref->linesize[0], 0, outlink->w 
* 4);
 
 outpicref->pts = insamples->pts;
+outpicref->sample_aspect_ratio = (AVRational){1,1};
+
 switch (insamples->format) {
 case AV_SAMPLE_FMT_S16P:
 for (ch = 0; ch < inlink->channels; ch++) {
diff --git a/libavfilter/avf_avectorscope.c b/libavfilter/avf_avectorscope.c
index c6e278d30d..7cb5efb402 100644
--- a/libavfilter/avf_avectorscope.c
+++ b/libavfilter/avf_avectorscope.c
@@ -246,6 +246,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*insamples)
 return AVERROR(ENOMEM);
 }
 
+s->outpicref->sample_aspect_ratio = (AVRational){1,1};
 for (i = 0; i < outlink->h; i++)
 memset(s->outpicref->data[0] + i * s->outpicref->linesize[0], 0, 
outlink->w * 4);
 }
diff --git a/libavfilter/avf_showfreqs.c b/libavfilter/avf_showfreqs.c
index 21735ed075..068ff1fb88 100644
--- a/libavfilter/avf_showfreqs.c
+++ b/libavfilter/avf_showfreqs.c
@@ -434,6 +434,7 @@ static int plot_freqs(AVFilterLink *inlink, AVFrame *in)
 
 av_free(colors);
 out->pts = in->pts;
+out->sample_aspect_ratio = (AVRational){1,1};
 return ff_filter_frame(outlink, out);
 }
 
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index ff66740a3a..4317161d79 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -306,6 +306,7 @@ static int config_output(AVFilterLink *outlink)
 
 outlink->w = s->w;
 outlink->h = s->h;
+outlink->sample_aspect_ratio = (AVRational){1,1};
 
 if (s->legend) {
 s->start_x = log10(inlink->sample_rate) * 25;
@@ -422,7 +423,7 @@ static int config_output(AVFilterLink *outlink)
 ff_get_video_buffer(outlink, outlink->w, outlink->h);
 if (!outpicref)
 return AVERROR(ENOMEM);
-outlink->sample_aspect_ratio = (AVRational){1,1};
+outpicref->sample_aspect_ratio = (AVRational){1,1};
 for (i = 0; i < outlink->h; i++) {
 memset(outpicref->data[0] + i * outpicref->linesize[0],   0, 
outlink->w);
 memset(outpicref->data[1] + i * outpicref->linesize[1], 128, 
outlink->w);
diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
index daeb9f9b58..1e8b90fa2f 100644
--- a/libavfilter/f_ebur128.c
+++ b/libavfilter/f_ebur128.c
@@ -269,6 +269,7 @@ static int config_video_output(AVFilterLink *outlink)
 }
 outlink->w = ebur128->w;
 outlink->h = ebur128->h;
+outlink->sample_aspect_ratio = (AVRational){1,1};
 
 #define PAD 8
 
@@ -299,7 +300,7 @@ static int config_video_output(AVFilterLink *outlink)
 ff_get_video_buffer(outlink, outlink->w, outlink->h);
 if (!outpicref)
 return AVERROR(ENOMEM);
-outlink->sample_aspect_ratio = (AVRational){1,1};
+outpicref->sample_aspect_ratio = (AVRational){1,1};
 
 /* init y references values (to draw LU lines) */
 ebur128->y_line_ref = av_calloc(ebur128->graph.h + 1, 
sizeof(*ebur128->y_line_ref));

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


[FFmpeg-cvslog] avfilter/af_headphone: fix possible memory leaks on failure

2017-06-15 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Jun 15 11:19:12 
2017 +0200| [9b667f609c509e84ae6ef496edcfb6c8b83c4a38] | committer: Paul B Mahol

avfilter/af_headphone: fix possible memory leaks on failure

Signed-off-by: Paul B Mahol 

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

 libavfilter/af_headphone.c | 71 +-
 1 file changed, 39 insertions(+), 32 deletions(-)

diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c
index 3dd5a0c396..00dbbcf386 100644
--- a/libavfilter/af_headphone.c
+++ b/libavfilter/af_headphone.c
@@ -398,7 +398,7 @@ static int convert_coeffs(AVFilterContext *ctx, 
AVFilterLink *inlink)
 FFTComplex *fft_in_r = NULL;
 float *data_ir_l = NULL;
 float *data_ir_r = NULL;
-int offset = 0;
+int offset = 0, ret = 0;
 int n_fft;
 int i, j;
 
@@ -409,7 +409,8 @@ static int convert_coeffs(AVFilterContext *ctx, 
AVFilterLink *inlink)
 fft_in_l = av_calloc(n_fft, sizeof(*fft_in_l));
 fft_in_r = av_calloc(n_fft, sizeof(*fft_in_r));
 if (!fft_in_l || !fft_in_r) {
-return AVERROR(ENOMEM);
+ret = AVERROR(ENOMEM);
+goto fail;
 }
 
 av_fft_end(s->fft[0]);
@@ -423,7 +424,8 @@ static int convert_coeffs(AVFilterContext *ctx, 
AVFilterLink *inlink)
 
 if (!s->fft[0] || !s->fft[1] || !s->ifft[0] || !s->ifft[1]) {
 av_log(ctx, AV_LOG_ERROR, "Unable to create FFT contexts of size 
%d.\n", s->n_fft);
-return AVERROR(ENOMEM);
+ret = AVERROR(ENOMEM);
+goto fail;
 }
 }
 
@@ -440,21 +442,29 @@ static int convert_coeffs(AVFilterContext *ctx, 
AVFilterLink *inlink)
 s->ringbuffer[1] = av_calloc(s->buffer_length, sizeof(float));
 s->temp_fft[0] = av_malloc_array(s->n_fft, sizeof(FFTComplex));
 s->temp_fft[1] = av_malloc_array(s->n_fft, sizeof(FFTComplex));
-if (!s->temp_fft[0] || !s->temp_fft[1])
-return AVERROR(ENOMEM);
+if (!s->temp_fft[0] || !s->temp_fft[1]) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
 }
 
 if (!s->data_ir[0] || !s->data_ir[1] ||
-!s->ringbuffer[0] || !s->ringbuffer[1])
-return AVERROR(ENOMEM);
+!s->ringbuffer[0] || !s->ringbuffer[1]) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
 
 s->in[0].frame = ff_get_audio_buffer(ctx->inputs[0], s->size);
-if (!s->in[0].frame)
-return AVERROR(ENOMEM);
+if (!s->in[0].frame) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
 for (i = 0; i < s->nb_irs; i++) {
 s->in[i + 1].frame = ff_get_audio_buffer(ctx->inputs[i + 1], 
s->ir_len);
-if (!s->in[i + 1].frame)
-return AVERROR(ENOMEM);
+if (!s->in[i + 1].frame) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
 }
 
 if (s->type == TIME_DOMAIN) {
@@ -464,17 +474,15 @@ static int convert_coeffs(AVFilterContext *ctx, 
AVFilterLink *inlink)
 data_ir_l = av_calloc(nb_irs * FFALIGN(ir_len, 16), 
sizeof(*data_ir_l));
 data_ir_r = av_calloc(nb_irs * FFALIGN(ir_len, 16), 
sizeof(*data_ir_r));
 if (!data_ir_r || !data_ir_l || !s->temp_src[0] || !s->temp_src[1]) {
-av_free(data_ir_l);
-av_free(data_ir_r);
-return AVERROR(ENOMEM);
+ret = AVERROR(ENOMEM);
+goto fail;
 }
 } else {
 data_hrtf_l = av_malloc_array(n_fft, sizeof(*data_hrtf_l) * nb_irs);
 data_hrtf_r = av_malloc_array(n_fft, sizeof(*data_hrtf_r) * nb_irs);
 if (!data_hrtf_r || !data_hrtf_l) {
-av_free(data_hrtf_l);
-av_free(data_hrtf_r);
-return AVERROR(ENOMEM);
+ret = AVERROR(ENOMEM);
+goto fail;
 }
 }
 
@@ -529,35 +537,34 @@ static int convert_coeffs(AVFilterContext *ctx, 
AVFilterLink *inlink)
 if (s->type == TIME_DOMAIN) {
 memcpy(s->data_ir[0], data_ir_l, sizeof(float) * nb_irs * 
FFALIGN(ir_len, 16));
 memcpy(s->data_ir[1], data_ir_r, sizeof(float) * nb_irs * 
FFALIGN(ir_len, 16));
-
-av_freep(&data_ir_l);
-av_freep(&data_ir_r);
 } else {
 s->data_hrtf[0] = av_malloc_array(n_fft * s->nb_irs, 
sizeof(FFTComplex));
 s->data_hrtf[1] = av_malloc_array(n_fft * s->nb_irs, 
sizeof(FFTComplex));
 if (!s->data_hrtf[0] || !s->data_hrtf[1]) {
-av_freep(&data_hrtf_l);
-av_freep(&data_hrtf_r);
-av_freep(&fft_in_l);
-av_freep(&fft_in_r);
-return AVERROR(ENOMEM);
+ret = AVERROR(ENOMEM);
+goto fail;
 }
 
 memcpy(s->data_hrtf[0], da

[FFmpeg-cvslog] libavfilter/af_biquads: add shorter option for width_type

2017-06-18 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Jun 18 17:31:03 
2017 +0200| [a23a56e77c0c2059f27baa194abc3213aee8825f] | committer: Paul B Mahol

libavfilter/af_biquads: add shorter option for width_type

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi | 20 ++--
 libavfilter/af_biquads.c |  8 
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index db0bdfe254..41b4b8249c 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1074,7 +1074,7 @@ The filter accepts the following options:
 @item frequency, f
 Set frequency in Hz.
 
-@item width_type
+@item width_type, t
 Set method to specify band-width of filter.
 @table @option
 @item h
@@ -1809,7 +1809,7 @@ Set the filter's central frequency. Default is 
@code{3000}.
 @item csg
 Constant skirt gain if set to 1. Defaults to 0.
 
-@item width_type
+@item width_type, t
 Set method to specify band-width of filter.
 @table @option
 @item h
@@ -1841,7 +1841,7 @@ The filter accepts the following options:
 @item frequency, f
 Set the filter's central frequency. Default is @code{3000}.
 
-@item width_type
+@item width_type, t
 Set method to specify band-width of filter.
 @table @option
 @item h
@@ -1880,7 +1880,7 @@ Set the filter's central frequency and so can be used
 to extend or reduce the frequency range to be boosted or cut.
 The default value is @code{100} Hz.
 
-@item width_type
+@item width_type, t
 Set method to specify band-width of filter.
 @table @option
 @item h
@@ -2498,7 +2498,7 @@ The filter accepts the following options:
 @item frequency, f
 Set the filter's central frequency in Hz.
 
-@item width_type
+@item width_type, t
 Set method to specify band-width of filter.
 @table @option
 @item h
@@ -2527,13 +2527,13 @@ Specify which channels to filter, by default all 
available are filtered.
 @item
 Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
 @example
-equalizer=f=1000:width_type=h:width=200:g=-10
+equalizer=f=1000:t=h:width=200:g=-10
 @end example
 
 @item
 Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
 @example
-equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
+equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
 @end example
 @end itemize
 
@@ -2847,7 +2847,7 @@ Set frequency in Hz. Default is 3000.
 @item poles, p
 Set number of poles. Default is 2.
 
-@item width_type
+@item width_type, t
 Set method to specify band-width of filter.
 @table @option
 @item h
@@ -3134,7 +3134,7 @@ Set frequency in Hz. Default is 500.
 @item poles, p
 Set number of poles. Default is 2.
 
-@item width_type
+@item width_type, t
 Set method to specify band-width of filter.
 @table @option
 @item h
@@ -3890,7 +3890,7 @@ Set the filter's central frequency and so can be used
 to extend or reduce the frequency range to be boosted or cut.
 The default value is @code{3000} Hz.
 
-@item width_type
+@item width_type, t
 Set method to specify band-width of filter.
 @table @option
 @item h
diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c
index f62ab9ef9f..c4f619a423 100644
--- a/libavfilter/af_biquads.c
+++ b/libavfilter/af_biquads.c
@@ -493,6 +493,7 @@ static const AVOption equalizer_options[] = {
 {"frequency", "set central frequency", OFFSET(frequency), 
AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 99, FLAGS},
 {"f", "set central frequency", OFFSET(frequency), 
AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 99, FLAGS},
 {"width_type", "set filter-width type", OFFSET(width_type), 
AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, SLOPE, FLAGS, "width_type"},
+{"t",  "set filter-width type", OFFSET(width_type), 
AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, SLOPE, FLAGS, "width_type"},
 {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
 {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, 
"width_type"},
 {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, 
"width_type"},
@@ -513,6 +514,7 @@ static const AVOption bass_options[] = {
 {"frequency", "set central frequency", OFFSET(frequency), 
AV_OPT_TYPE_DOUBLE, {.dbl=100}, 0, 99, FLAGS},
 {"f", "set central frequency", OFFSET(frequency), 
AV_OPT_TYPE_DOUBLE, {.dbl=100}, 0, 99, FLAGS},
 {"width_type", "set filter-width type", OFFSET(width_type), 
AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, SLOPE, FLAGS, "width_type"},
+{"t",  "set filter-width type", OFFSET(width_type), 
AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, SLOPE, FLAGS, "

[FFmpeg-cvslog] avfilter/af_amix: fix possible hang

2017-06-18 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Jun 18 18:38:36 
2017 +0200| [478a1949d92002969786d1422f9f860d8d6456de] | committer: Paul B Mahol

avfilter/af_amix: fix possible hang

Fixes #6424.

Signed-off-by: Paul B Mahol 

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

 libavfilter/af_amix.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c
index 9fe505b0dc..f19e6b39a5 100644
--- a/libavfilter/af_amix.c
+++ b/libavfilter/af_amix.c
@@ -268,7 +268,7 @@ static int calc_active_inputs(MixContext *s);
 /**
  * Read samples from the input FIFOs, mix, and write to the output link.
  */
-static int output_frame(AVFilterLink *outlink)
+static int output_frame(AVFilterLink *outlink, int need_request)
 {
 AVFilterContext *ctx = outlink->src;
 MixContext  *s = ctx->priv;
@@ -288,7 +288,7 @@ static int output_frame(AVFilterLink *outlink)
 if (ns < nb_samples) {
 if (!(s->input_state[i] & INPUT_EOF))
 /* unclosed input with not enough samples */
-return 0;
+return need_request ? ff_request_frame(ctx->inputs[i]) 
: 0;
 /* closed input to drain */
 nb_samples = ns;
 }
@@ -387,7 +387,7 @@ static int request_samples(AVFilterContext *ctx, int 
min_samples)
 } else if (ret < 0)
 return ret;
 }
-return output_frame(ctx->outputs[0]);
+return output_frame(ctx->outputs[0], 1);
 }
 
 /**
@@ -431,7 +431,7 @@ static int request_frame(AVFilterLink *outlink)
 s->input_state[0] = 0;
 if (s->nb_inputs == 1)
 return AVERROR_EOF;
-return output_frame(ctx->outputs[0]);
+return output_frame(ctx->outputs[0], 1);
 }
 return ret;
 }
@@ -470,7 +470,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
   buf->nb_samples);
 
 av_frame_free(&buf);
-return output_frame(outlink);
+return output_frame(outlink, 0);
 
 fail:
 av_frame_free(&buf);

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


[FFmpeg-cvslog] avfilter: add roberts cross operator

2017-06-19 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Jun 19 12:54:29 
2017 +0200| [b9d0a5fc215febfaa0c5b1ce5b0a799d59dd2a03] | committer: Paul B Mahol

avfilter: add roberts cross operator

Signed-off-by: Paul B Mahol 

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

 Changelog|   1 +
 doc/filters.texi |  17 ++
 libavfilter/Makefile |   1 +
 libavfilter/allfilters.c |   1 +
 libavfilter/version.h|   2 +-
 libavfilter/vf_convolution.c | 134 +++
 6 files changed, 155 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 1f5ca70655..a893efa4f0 100644
--- a/Changelog
+++ b/Changelog
@@ -21,6 +21,7 @@ version :
 - Gremlin Digital Video demuxer and decoder
 - headphone audio filter
 - superequalizer audio filter
+- roberts video filter
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/doc/filters.texi b/doc/filters.texi
index 53e057c774..40c89626db 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -12118,6 +12118,23 @@ trim=end=5,reverse
 @end example
 @end itemize
 
+@section roberts
+Apply roberts cross operator to input video stream.
+
+The filter accepts the following option:
+
+@table @option
+@item planes
+Set which planes will be processed, unprocessed planes will be copied.
+By default value 0xf, all planes will be processed.
+
+@item scale
+Set value which will be multiplied with filtered result.
+
+@item delta
+Set value which will be added to filtered result.
+@end table
+
 @section rotate
 
 Rotate video by an arbitrary angle expressed in radians.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 52c44d266f..f023a0d5d6 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -268,6 +268,7 @@ OBJS-$(CONFIG_REMOVEGRAIN_FILTER)+= 
vf_removegrain.o
 OBJS-$(CONFIG_REMOVELOGO_FILTER) += bbox.o lswsutils.o lavfutils.o 
vf_removelogo.o
 OBJS-$(CONFIG_REPEATFIELDS_FILTER)   += vf_repeatfields.o
 OBJS-$(CONFIG_REVERSE_FILTER)+= f_reverse.o
+OBJS-$(CONFIG_ROBERTS_FILTER)+= vf_convolution.o
 OBJS-$(CONFIG_ROTATE_FILTER) += vf_rotate.o
 OBJS-$(CONFIG_SAB_FILTER)+= vf_sab.o
 OBJS-$(CONFIG_SCALE_FILTER)  += vf_scale.o scale.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index bd81091000..c1c52330ef 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -279,6 +279,7 @@ static void register_all(void)
 REGISTER_FILTER(REMOVELOGO, removelogo, vf);
 REGISTER_FILTER(REPEATFIELDS,   repeatfields,   vf);
 REGISTER_FILTER(REVERSE,reverse,vf);
+REGISTER_FILTER(ROBERTS,roberts,vf);
 REGISTER_FILTER(ROTATE, rotate, vf);
 REGISTER_FILTER(SAB,sab,vf);
 REGISTER_FILTER(SCALE,  scale,  vf);
diff --git a/libavfilter/version.h b/libavfilter/version.h
index c37a34242f..3902801b2c 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  93
+#define LIBAVFILTER_VERSION_MINOR  94
 #define LIBAVFILTER_VERSION_MICRO 100
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
diff --git a/libavfilter/vf_convolution.c b/libavfilter/vf_convolution.c
index 41e92497c3..530859422c 100644
--- a/libavfilter/vf_convolution.c
+++ b/libavfilter/vf_convolution.c
@@ -198,6 +198,55 @@ static int filter16_prewitt(AVFilterContext *ctx, void 
*arg, int jobnr, int nb_j
 return 0;
 }
 
+static int filter16_roberts(AVFilterContext *ctx, void *arg, int jobnr, int 
nb_jobs)
+{
+ConvolutionContext *s = ctx->priv;
+ThreadData *td = arg;
+AVFrame *in = td->in;
+AVFrame *out = td->out;
+const int plane = td->plane;
+const int peak = (1 << s->depth) - 1;
+const int stride = in->linesize[plane] / 2;
+const int bstride = s->bstride;
+const int height = s->planeheight[plane];
+const int width  = s->planewidth[plane];
+const int slice_start = (height * jobnr) / nb_jobs;
+const int slice_end = (height * (jobnr+1)) / nb_jobs;
+const uint16_t *src = (const uint16_t *)in->data[plane] + slice_start * 
stride;
+uint16_t *dst = (uint16_t *)out->data[plane] + slice_start * 
(out->linesize[plane] / 2);
+const float scale = s->scale;
+const float delta = s->delta;
+uint16_t *p0 = (uint16_t *)s->bptrs[jobnr] + 16;
+uint16_t *p1 = p0 + bstride;
+uint16_t *p2 = p1 + bstride;
+uint16_t *orig = p0, *end = p2;
+int y, x;
+
+line_copy16(p0, src + stride * (slice_start == 0 ? 1 : -1), width, 1);
+line_copy16(p1, src, width, 1);
+
+for (y = slice_start; y < slice_end; y++) {
+   

[FFmpeg-cvslog] avfilter: add superequalizer filter

2017-06-19 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Jun 16 14:07:01 
2017 +0200| [ca5cf84655f38e8e1eaaff714d62ee824c21a309] | committer: Paul B Mahol

avfilter: add superequalizer filter

Signed-off-by: Paul B Mahol 

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

 Changelog   |   1 +
 doc/filters.texi|  43 +
 libavfilter/Makefile|   1 +
 libavfilter/af_superequalizer.c | 368 
 libavfilter/allfilters.c|   1 +
 libavfilter/version.h   |   2 +-
 6 files changed, 415 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index cd91f63cb3..1f5ca70655 100644
--- a/Changelog
+++ b/Changelog
@@ -20,6 +20,7 @@ version :
 - sofalizer filter switched to libmysofa
 - Gremlin Digital Video demuxer and decoder
 - headphone audio filter
+- superequalizer audio filter
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/doc/filters.texi b/doc/filters.texi
index 41b4b8249c..53e057c774 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3835,6 +3835,49 @@ channels. Default is 0.3.
 Set level of input signal of original channel. Default is 0.8.
 @end table
 
+@section superequalizer
+Apply 18th band equalizer.
+
+The filter accpets the following options:
+@table @option
+@item 1b
+Set 65Hz band gain.
+@item 2b
+Set 92Hz band gain.
+@item 3b
+Set 131Hz band gain.
+@item 4b
+Set 185Hz band gain.
+@item 5b
+Set 262Hz band gain.
+@item 6b
+Set 370Hz band gain.
+@item 7b
+Set 523Hz band gain.
+@item 8b
+Set 740Hz band gain.
+@item 9b
+Set 1047Hz band gain.
+@item 10b
+Set 1480Hz band gain.
+@item 11b
+Set 2093Hz band gain.
+@item 12b
+Set 2960Hz band gain.
+@item 13b
+Set 4186Hz band gain.
+@item 14b
+Set 5920Hz band gain.
+@item 15b
+Set 8372Hz band gain.
+@item 16b
+Set 11840Hz band gain.
+@item 17b
+Set 16744Hz band gain.
+@item 18b
+Set 2Hz band gain.
+@end table
+
 @section surround
 Apply audio surround upmix filter.
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 04ec9b8b8f..52c44d266f 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -109,6 +109,7 @@ OBJS-$(CONFIG_SILENCEREMOVE_FILTER)  += 
af_silenceremove.o
 OBJS-$(CONFIG_SOFALIZER_FILTER)  += af_sofalizer.o
 OBJS-$(CONFIG_STEREOTOOLS_FILTER)+= af_stereotools.o
 OBJS-$(CONFIG_STEREOWIDEN_FILTER)+= af_stereowiden.o
+OBJS-$(CONFIG_SUPEREQUALIZER_FILTER) += af_superequalizer.o
 OBJS-$(CONFIG_SURROUND_FILTER)   += af_surround.o
 OBJS-$(CONFIG_TREBLE_FILTER) += af_biquads.o
 OBJS-$(CONFIG_TREMOLO_FILTER)+= af_tremolo.o
diff --git a/libavfilter/af_superequalizer.c b/libavfilter/af_superequalizer.c
new file mode 100644
index 00..4c9f215f4c
--- /dev/null
+++ b/libavfilter/af_superequalizer.c
@@ -0,0 +1,368 @@
+/*
+ * Copyright (c) 2002 Naoki Shibata
+ * Copyright (c) 2017 Paul B Mahol
+ *
+ * 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 "libavutil/opt.h"
+
+#include "libavcodec/avfft.h"
+
+#include "audio.h"
+#include "avfilter.h"
+#include "internal.h"
+
+#define NBANDS 17
+#define M 15
+
+typedef struct EqParameter {
+float lower, upper, gain;
+} EqParameter;
+
+typedef struct SuperEqualizerContext {
+const AVClass *class;
+
+EqParameter params[NBANDS + 1];
+
+float gains[NBANDS + 1];
+
+float fact[M + 1];
+float aa;
+float iza;
+float *ires, *irest;
+float *fsamples;
+int winlen, tabsize;
+
+AVFrame *in, *out;
+RDFTContext *rdft, *irdft;
+} SuperEqualizerContext;
+
+static const float bands[] = {
+65.406392, 92.498606, 130.81278, 184.99721, 261.62557, 369.99442, 
523.25113, 739.9884, 1046.5023,
+1479.9768, 2093.0045, 2959.9536, 4186.0091, 5919.9072, 8372.0181, 
11839.814, 16744.036
+};
+
+static float izero(SuperEqualizerContext *s, float x)
+{
+float ret = 1;
+int m;
+
+for (m = 1; m <= M; m++) {
+float t;
+
+t = pow(x / 2, m) / s->fact[m];
+ret += t*t;
+}
+
+return ret;
+}
+
+static float hn_lpf(int n, float f, float fs)
+{
+float t = 1 / fs;
+  

[FFmpeg-cvslog] avfilter/af_superequalizer: improve description

2017-06-19 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Jun 19 18:15:51 
2017 +0200| [53624d62d9a360c3d43675ca2fdca57932591777] | committer: Paul B Mahol

avfilter/af_superequalizer: improve description

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi| 2 +-
 libavfilter/af_superequalizer.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 40c89626db..2ef375a3da 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3836,7 +3836,7 @@ Set level of input signal of original channel. Default is 
0.8.
 @end table
 
 @section superequalizer
-Apply 18th band equalizer.
+Apply 18 band equalizer.
 
 The filter accpets the following options:
 @table @option
diff --git a/libavfilter/af_superequalizer.c b/libavfilter/af_superequalizer.c
index 69d29f44c0..2885d4f652 100644
--- a/libavfilter/af_superequalizer.c
+++ b/libavfilter/af_superequalizer.c
@@ -357,7 +357,7 @@ AVFILTER_DEFINE_CLASS(superequalizer);
 
 AVFilter ff_af_superequalizer = {
 .name  = "superequalizer",
-.description   = NULL_IF_CONFIG_SMALL("Apply 18-th band equalization 
filter."),
+.description   = NULL_IF_CONFIG_SMALL("Apply 18 band equalization 
filter."),
 .priv_size = sizeof(SuperEqualizerContext),
 .priv_class= &superequalizer_class,
 .query_formats = query_formats,

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


[FFmpeg-cvslog] avfilter/af_superequalizer: fix out of array access

2017-06-19 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Jun 19 18:12:29 
2017 +0200| [2820c9dfaa1f4093fea471665fdbef9ca7080bcd] | committer: Paul B Mahol

avfilter/af_superequalizer: fix out of array access

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavfilter/af_superequalizer.c b/libavfilter/af_superequalizer.c
index 4c9f215f4c..69d29f44c0 100644
--- a/libavfilter/af_superequalizer.c
+++ b/libavfilter/af_superequalizer.c
@@ -126,7 +126,7 @@ static void process_param(float *bc, EqParameter *param, 
float fs)
 
 for (i = 0; i <= NBANDS; i++) {
 param[i].lower = i == 0 ? 0 : bands[i - 1];
-param[i].upper = i == NBANDS - 1 ? fs : bands[i];
+param[i].upper = i == NBANDS ? fs : bands[i];
 param[i].gain  = bc[i];
 }
 }

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


[FFmpeg-cvslog] avfilter/af_superequalizer: stop leaking s->out frame

2017-06-19 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Jun 19 18:34:04 
2017 +0200| [1a4236e025a8d7a58b751958f536301322ff2521] | committer: Paul B Mahol

avfilter/af_superequalizer: stop leaking s->out frame

Signed-off-by: Paul B Mahol 

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

 libavfilter/af_superequalizer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/af_superequalizer.c b/libavfilter/af_superequalizer.c
index 2885d4f652..f38cca5c8b 100644
--- a/libavfilter/af_superequalizer.c
+++ b/libavfilter/af_superequalizer.c
@@ -302,6 +302,7 @@ static av_cold void uninit(AVFilterContext *ctx)
 {
 SuperEqualizerContext *s = ctx->priv;
 
+av_frame_free(&s->out);
 av_freep(&s->irest);
 av_freep(&s->ires);
 av_freep(&s->fsamples);

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


[FFmpeg-cvslog] avfilter/af_stereotools: add 2 more modes

2017-06-19 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Jun 19 18:59:33 
2017 +0200| [ef178f630f79b6867f1a378aea948c1719994d4d] | committer: Paul B Mahol

avfilter/af_stereotools: add 2 more modes

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi |  6 ++
 libavfilter/af_stereotools.c | 13 -
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 2ef375a3da..1d003aebf7 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3743,6 +3743,12 @@ Left/Right to Left + Right.
 
 @item lr>rl
 Left/Right to Right/Left.
+
+@item ms>ll
+Mid/Side to Left/Left.
+
+@item ms>rr
+Mid/Side to Right/Right.
 @end table
 
 @item slev
diff --git a/libavfilter/af_stereotools.c b/libavfilter/af_stereotools.c
index 2d2a9bd625..cd2de869b9 100644
--- a/libavfilter/af_stereotools.c
+++ b/libavfilter/af_stereotools.c
@@ -69,7 +69,7 @@ static const AVOption stereotools_options[] = {
 { "muter",   "mute R",   OFFSET(mute_r),  
AV_OPT_TYPE_BOOL,   {.i64=0},   0,  1, A },
 { "phasel",  "phase L",  OFFSET(phase_l), 
AV_OPT_TYPE_BOOL,   {.i64=0},   0,  1, A },
 { "phaser",  "phase R",  OFFSET(phase_r), 
AV_OPT_TYPE_BOOL,   {.i64=0},   0,  1, A },
-{ "mode","set stereo mode",  OFFSET(mode),AV_OPT_TYPE_INT, 
   {.i64=0},   0,  6, A, "mode" },
+{ "mode","set stereo mode",  OFFSET(mode),AV_OPT_TYPE_INT, 
   {.i64=0},   0,  8, A, "mode" },
 { "lr>lr",   0,  0,   
AV_OPT_TYPE_CONST,  {.i64=0},   0,  0, A, "mode" },
 { "lr>ms",   0,  0,   
AV_OPT_TYPE_CONST,  {.i64=1},   0,  0, A, "mode" },
 { "ms>lr",   0,  0,   
AV_OPT_TYPE_CONST,  {.i64=2},   0,  0, A, "mode" },
@@ -77,6 +77,8 @@ static const AVOption stereotools_options[] = {
 { "lr>rr",   0,  0,   
AV_OPT_TYPE_CONST,  {.i64=4},   0,  0, A, "mode" },
 { "lr>l+r",  0,  0,   
AV_OPT_TYPE_CONST,  {.i64=5},   0,  0, A, "mode" },
 { "lr>rl",   0,  0,   
AV_OPT_TYPE_CONST,  {.i64=6},   0,  0, A, "mode" },
+{ "ms>ll",   0,  0,   
AV_OPT_TYPE_CONST,  {.i64=7},   0,  0, A, "mode" },
+{ "ms>rr",   0,  0,   
AV_OPT_TYPE_CONST,  {.i64=8},   0,  0, A, "mode" },
 { "slev","set side level",   OFFSET(slev),
AV_OPT_TYPE_DOUBLE, {.dbl=1},   0.015625,  64, A },
 { "sbal","set side balance", OFFSET(sbal),
AV_OPT_TYPE_DOUBLE, {.dbl=0},  -1,  1, A },
 { "mlev","set middle level", OFFSET(mlev),
AV_OPT_TYPE_DOUBLE, {.dbl=1},   0.015625,  64, A },
@@ -246,6 +248,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 r = m * mlev * FFMIN(1., mpan)  - S * slev * FFMIN(1., sbal);
 L = l;
 R = r;
+case 7:
+l = L * mlev * FFMIN(1., 2. - mpan) + R * slev * FFMIN(1., 2. - 
sbal);
+L = l;
+R = l;
+break;
+case 8:
+r = L * mlev * FFMIN(1., mpan)  - R * slev * FFMIN(1., sbal);
+L = r;
+R = r;
 break;
 }
 

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


[FFmpeg-cvslog] doc/filters: fix typo

2017-06-19 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Jun 19 19:28:43 
2017 +0200| [c7a2a379fd0517f5c7d716ecf468f935fe4802de] | committer: Paul B Mahol

doc/filters: fix typo

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 1d003aebf7..0e6a896eeb 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3844,7 +3844,7 @@ Set level of input signal of original channel. Default is 
0.8.
 @section superequalizer
 Apply 18 band equalizer.
 
-The filter accpets the following options:
+The filter accepts the following options:
 @table @option
 @item 1b
 Set 65Hz band gain.

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


[FFmpeg-cvslog] avfilter/af_stereotools: add forgotten break

2017-06-21 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed Jun 21 19:20:25 
2017 +0200| [664ac7c5e2e9b2b001be6124b90b398861c773af] | committer: Paul B Mahol

avfilter/af_stereotools: add forgotten break

Signed-off-by: Paul B Mahol 

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

 libavfilter/af_stereotools.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/af_stereotools.c b/libavfilter/af_stereotools.c
index cd2de869b9..a5e0b427f1 100644
--- a/libavfilter/af_stereotools.c
+++ b/libavfilter/af_stereotools.c
@@ -248,6 +248,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 r = m * mlev * FFMIN(1., mpan)  - S * slev * FFMIN(1., sbal);
 L = l;
 R = r;
+break;
 case 7:
 l = L * mlev * FFMIN(1., 2. - mpan) + R * slev * FFMIN(1., 2. - 
sbal);
 L = l;

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


[FFmpeg-cvslog] Revert "lavfi/buffersrc: push the frame deeper if requested."

2017-06-23 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Jun 23 16:18:42 
2017 +0200| [04aa09c4bcf2d5a634a35da3a3ae3fc1abe30ef8] | committer: Paul B Mahol

Revert "lavfi/buffersrc: push the frame deeper if requested."

Fixes framesync filters with shortest option enabled.

This reverts commit 0ff5567a30be6d7c804e95997ae282d6bacd76c3.

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

 libavfilter/buffersrc.c | 25 -
 1 file changed, 25 deletions(-)

diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index e8f59c2de7..587b29b91a 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -173,20 +173,6 @@ int attribute_align_arg 
av_buffersrc_add_frame_flags(AVFilterContext *ctx, AVFra
 return ret;
 }
 
-static int push_frame(AVFilterGraph *graph)
-{
-int ret;
-
-while (1) {
-ret = ff_filter_graph_run_once(graph);
-if (ret == AVERROR(EAGAIN))
-break;
-if (ret < 0)
-return ret;
-}
-return 0;
-}
-
 static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,
AVFrame *frame, int flags)
 {
@@ -199,11 +185,6 @@ static int av_buffersrc_add_frame_internal(AVFilterContext 
*ctx,
 if (!frame) {
 s->eof = 1;
 ff_avfilter_link_set_in_status(ctx->outputs[0], AVERROR_EOF, 
AV_NOPTS_VALUE);
-if ((flags & AV_BUFFERSRC_FLAG_PUSH)) {
-ret = push_frame(ctx->graph);
-if (ret < 0)
-return ret;
-}
 return 0;
 } else if (s->eof)
 return AVERROR(EINVAL);
@@ -258,12 +239,6 @@ static int av_buffersrc_add_frame_internal(AVFilterContext 
*ctx,
 if ((ret = ctx->output_pads[0].request_frame(ctx->outputs[0])) < 0)
 return ret;
 
-if ((flags & AV_BUFFERSRC_FLAG_PUSH)) {
-ret = push_frame(ctx->graph);
-if (ret < 0)
-return ret;
-}
-
 return 0;
 }
 

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


[FFmpeg-cvslog] avfilter/vf_overlay: add auto format mode

2017-06-24 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Jun 24 10:18:30 
2017 +0200| [565dc0e283a8480327313ffa5c1dc1931c08c456] | committer: Paul B Mahol

avfilter/vf_overlay: add auto format mode

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi |  3 +++
 libavfilter/vf_overlay.c | 57 
 2 files changed, 51 insertions(+), 9 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 11092a8d70..010d9f65c6 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10761,6 +10761,9 @@ force packed RGB output
 
 @item gbrp
 force planar RGB output
+
+@item auto
+automatically pick format
 @end table
 
 Default value is @samp{yuv420}.
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 37b799fcae..adbf633d9b 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -104,6 +104,7 @@ enum OverlayFormat {
 OVERLAY_FORMAT_YUV444,
 OVERLAY_FORMAT_RGB,
 OVERLAY_FORMAT_GBRP,
+OVERLAY_FORMAT_AUTO,
 OVERLAY_FORMAT_NB
 };
 
@@ -211,6 +212,12 @@ static int process_command(AVFilterContext *ctx, const 
char *cmd, const char *ar
 return ret;
 }
 
+static const enum AVPixelFormat alpha_pix_fmts[] = {
+AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P,
+AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR, AV_PIX_FMT_RGBA,
+AV_PIX_FMT_BGRA, AV_PIX_FMT_GBRAP, AV_PIX_FMT_NONE
+};
+
 static int query_formats(AVFilterContext *ctx)
 {
 OverlayContext *s = ctx->priv;
@@ -298,14 +305,26 @@ static int query_formats(AVFilterContext *ctx)
 goto fail;
 }
 break;
+case OVERLAY_FORMAT_AUTO:
+if (!(main_formats= ff_make_format_list(alpha_pix_fmts))) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+break;
 default:
 av_assert0(0);
 }
 
-if ((ret = ff_formats_ref(main_formats   , &ctx->inputs[MAIN]->out_formats 
  )) < 0 ||
-(ret = ff_formats_ref(overlay_formats, 
&ctx->inputs[OVERLAY]->out_formats)) < 0 ||
-(ret = ff_formats_ref(main_formats   , &ctx->outputs[MAIN]->in_formats 
  )) < 0)
+if (s->format == OVERLAY_FORMAT_AUTO) {
+ret = ff_set_common_formats(ctx, main_formats);
+if (ret < 0)
 goto fail;
+} else {
+if ((ret = ff_formats_ref(main_formats   , 
&ctx->inputs[MAIN]->out_formats   )) < 0 ||
+(ret = ff_formats_ref(overlay_formats, 
&ctx->inputs[OVERLAY]->out_formats)) < 0 ||
+(ret = ff_formats_ref(main_formats   , 
&ctx->outputs[MAIN]->in_formats   )) < 0)
+goto fail;
+}
 
 return 0;
 fail:
@@ -318,12 +337,6 @@ fail:
 return ret;
 }
 
-static const enum AVPixelFormat alpha_pix_fmts[] = {
-AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P,
-AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR, AV_PIX_FMT_RGBA,
-AV_PIX_FMT_BGRA, AV_PIX_FMT_GBRAP, AV_PIX_FMT_NONE
-};
-
 static int config_input_overlay(AVFilterLink *inlink)
 {
 AVFilterContext *ctx  = inlink->dst;
@@ -704,6 +717,31 @@ static int config_input_main(AVFilterLink *inlink)
 case OVERLAY_FORMAT_GBRP:
 s->blend_image = blend_image_gbrp;
 break;
+case OVERLAY_FORMAT_AUTO:
+switch (inlink->format) {
+case AV_PIX_FMT_YUVA420P:
+s->blend_image = blend_image_yuv420;
+break;
+case AV_PIX_FMT_YUVA422P:
+s->blend_image = blend_image_yuv422;
+break;
+case AV_PIX_FMT_YUVA444P:
+s->blend_image = blend_image_yuv444;
+break;
+case AV_PIX_FMT_ARGB:
+case AV_PIX_FMT_RGBA:
+case AV_PIX_FMT_BGRA:
+case AV_PIX_FMT_ABGR:
+s->blend_image = blend_image_packed_rgb;
+break;
+case AV_PIX_FMT_GBRAP:
+s->blend_image = blend_image_gbrp;
+break;
+default:
+av_assert0(0);
+break;
+}
+break;
 }
 return 0;
 }
@@ -798,6 +836,7 @@ static const AVOption overlay_options[] = {
 { "yuv444", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV444}, 
.flags = FLAGS, .unit = "format" },
 { "rgb","", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_RGB},
.flags = FLAGS, .unit = "format" },
 { "gbrp",   "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_GBRP},   
.flags = FLAGS, .unit = "format" },
+{ "auto",   "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_AUTO},   
.flags = FLAGS, .unit = "format" },
 { "repeatlast", "repeat overlay of the last overlay frame", 
OFFSET(dinput.repeatlast), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS },
 { NULL }
 };

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


[FFmpeg-cvslog] avfilter: do not leak AVFrame on failed buffer allocation

2017-06-24 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Jun 24 18:36:46 
2017 +0200| [c90b88090c260a0af018b6c1e955266e24ebf6f4] | committer: Paul B Mahol

avfilter: do not leak AVFrame on failed buffer allocation

Signed-off-by: Paul B Mahol 

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

 libavfilter/af_aphaser.c   | 4 +++-
 libavfilter/af_aresample.c | 4 +++-
 libavfilter/af_atempo.c| 4 +++-
 libavfilter/af_bs2b.c  | 4 +++-
 libavfilter/af_pan.c   | 4 +++-
 libavfilter/af_volume.c| 4 +++-
 libavfilter/vf_eq.c| 4 +++-
 libavfilter/vf_fftfilt.c   | 4 +++-
 8 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/libavfilter/af_aphaser.c b/libavfilter/af_aphaser.c
index 780407e924..dcffc216dd 100644
--- a/libavfilter/af_aphaser.c
+++ b/libavfilter/af_aphaser.c
@@ -248,8 +248,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*inbuf)
 outbuf = inbuf;
 } else {
 outbuf = ff_get_audio_buffer(inlink, inbuf->nb_samples);
-if (!outbuf)
+if (!outbuf) {
+av_frame_free(&inbuf);
 return AVERROR(ENOMEM);
+}
 av_frame_copy_props(outbuf, inbuf);
 }
 
diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c
index 0216432470..ef10621c35 100644
--- a/libavfilter/af_aresample.c
+++ b/libavfilter/af_aresample.c
@@ -195,8 +195,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*insamplesref)
 
 outsamplesref = ff_get_audio_buffer(outlink, n_out);
 
-if(!outsamplesref)
+if(!outsamplesref) {
+av_frame_free(&insamplesref);
 return AVERROR(ENOMEM);
+}
 
 av_frame_copy_props(outsamplesref, insamplesref);
 outsamplesref->format= outlink->format;
diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c
index d90910598c..76410221d6 100644
--- a/libavfilter/af_atempo.c
+++ b/libavfilter/af_atempo.c
@@ -1090,8 +1090,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*src_buffer)
 while (src < src_end) {
 if (!atempo->dst_buffer) {
 atempo->dst_buffer = ff_get_audio_buffer(outlink, n_out);
-if (!atempo->dst_buffer)
+if (!atempo->dst_buffer) {
+av_frame_free(&src_buffer);
 return AVERROR(ENOMEM);
+}
 av_frame_copy_props(atempo->dst_buffer, src_buffer);
 
 atempo->dst = atempo->dst_buffer->data[0];
diff --git a/libavfilter/af_bs2b.c b/libavfilter/af_bs2b.c
index 531a27bd73..b7cfd3815b 100644
--- a/libavfilter/af_bs2b.c
+++ b/libavfilter/af_bs2b.c
@@ -134,8 +134,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 out_frame = frame;
 } else {
 out_frame = ff_get_audio_buffer(inlink, frame->nb_samples);
-if (!out_frame)
+if (!out_frame) {
+av_frame_free(&frame);
 return AVERROR(ENOMEM);
+}
 av_frame_copy(out_frame, frame);
 ret = av_frame_copy_props(out_frame, frame);
 if (ret < 0) {
diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c
index 63d7750f35..23b29419b6 100644
--- a/libavfilter/af_pan.c
+++ b/libavfilter/af_pan.c
@@ -383,8 +383,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*insamples)
 AVFrame *outsamples = ff_get_audio_buffer(outlink, n);
 PanContext *pan = inlink->dst->priv;
 
-if (!outsamples)
+if (!outsamples) {
+av_frame_free(&insamples);
 return AVERROR(ENOMEM);
+}
 swr_convert(pan->swr, outsamples->extended_data, n,
 (void *)insamples->extended_data, n);
 av_frame_copy_props(outsamples, insamples);
diff --git a/libavfilter/af_volume.c b/libavfilter/af_volume.c
index 9ed2dbace3..3d76f12f2c 100644
--- a/libavfilter/af_volume.c
+++ b/libavfilter/af_volume.c
@@ -411,8 +411,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
 out_buf = buf;
 } else {
 out_buf = ff_get_audio_buffer(inlink, nb_samples);
-if (!out_buf)
+if (!out_buf) {
+av_frame_free(&buf);
 return AVERROR(ENOMEM);
+}
 ret = av_frame_copy_props(out_buf, buf);
 if (ret < 0) {
 av_frame_free(&out_buf);
diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c
index e8b4a46195..2c4c7e4d54 100644
--- a/libavfilter/vf_eq.c
+++ b/libavfilter/vf_eq.c
@@ -259,8 +259,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 int i;
 
 out = ff_get_video_buffer(outlink, inlink->w, inlink->h);
-if (!out)
+if (!out) {
+av_frame_free(&in);
 return AVERROR(ENOMEM);
+}
 
 av_frame_copy_props(out, in);
 desc = av_pix_fmt_desc_get(inlink->format);
diff --git a/libavfilter/vf_fftfilt.c b/libavfilter/vf_fftfilt.c
index c0c5eb400f..8a47ed5be4 100644
--- a/libavfilt

[FFmpeg-cvslog] avfilter/af_headphone: do not free frame that's gonna be reused later

2017-06-24 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Jun 24 18:47:04 
2017 +0200| [f483949188dcb2f4c546603bd478100190ee5312] | committer: Paul B Mahol

avfilter/af_headphone: do not free frame that's gonna be reused later

Signed-off-by: Paul B Mahol 

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

 libavfilter/af_headphone.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c
index 00dbbcf386..4fd6191bc4 100644
--- a/libavfilter/af_headphone.c
+++ b/libavfilter/af_headphone.c
@@ -357,10 +357,8 @@ static int headphone_frame(HeadphoneContext *s, 
AVFilterLink *outlink)
 av_audio_fifo_read(s->in[0].fifo, (void **)in->extended_data, s->size);
 
 out = ff_get_audio_buffer(outlink, in->nb_samples);
-if (!out) {
-av_frame_free(&in);
+if (!out)
 return AVERROR(ENOMEM);
-}
 out->pts = s->pts;
 if (s->pts != AV_NOPTS_VALUE)
 s->pts += av_rescale_q(out->nb_samples, (AVRational){1, 
outlink->sample_rate}, outlink->time_base);

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


[FFmpeg-cvslog] avfilter/vf_overlay: remove rgb option

2017-06-24 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Jun 24 10:30:43 
2017 +0200| [c1b43e8452e778edea757e912d17780df1ebd92d] | committer: Paul B Mahol

avfilter/vf_overlay: remove rgb option

Its been deprecated for over 3 years.

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi | 5 -
 libavfilter/vf_overlay.c | 7 ---
 2 files changed, 12 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 010d9f65c6..7ec7f5d959 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10768,11 +10768,6 @@ automatically pick format
 
 Default value is @samp{yuv420}.
 
-@item rgb @emph{(deprecated)}
-If set to 1, force the filter to accept inputs in the RGB
-color space. Default value is 0. This option is deprecated, use
-@option{format} instead.
-
 @item repeatlast
 If set to 1, force the filter to draw the last overlay frame over the
 main input until the end of the stream. A value of 0 disables this
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index adbf633d9b..beb61c1497 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -112,7 +112,6 @@ typedef struct OverlayContext {
 const AVClass *class;
 int x, y;   ///< position of overlaid picture
 
-int allow_packed_rgb;
 uint8_t main_is_packed_rgb;
 uint8_t main_rgba_map[4];
 uint8_t main_has_alpha;
@@ -795,11 +794,6 @@ static av_cold int init(AVFilterContext *ctx)
 {
 OverlayContext *s = ctx->priv;
 
-if (s->allow_packed_rgb) {
-av_log(ctx, AV_LOG_WARNING,
-   "The rgb option is deprecated and is overriding the format 
option, use format instead\n");
-s->format = OVERLAY_FORMAT_RGB;
-}
 if (!s->dinput.repeatlast || s->eof_action == EOF_ACTION_PASS) {
 s->dinput.repeatlast = 0;
 s->eof_action = EOF_ACTION_PASS;
@@ -828,7 +822,6 @@ static const AVOption overlay_options[] = {
 { "eval", "specify when to evaluate expressions", OFFSET(eval_mode), 
AV_OPT_TYPE_INT, {.i64 = EVAL_MODE_FRAME}, 0, EVAL_MODE_NB-1, FLAGS, "eval" },
  { "init",  "eval expressions once during initialization", 0, 
AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_INIT},  .flags = FLAGS, .unit = "eval" },
  { "frame", "eval expressions per-frame",  0, 
AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_FRAME}, .flags = FLAGS, .unit = "eval" },
-{ "rgb", "force packed RGB in input and output (deprecated)", 
OFFSET(allow_packed_rgb), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
 { "shortest", "force termination when the shortest input terminates", 
OFFSET(dinput.shortest), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
 { "format", "set output format", OFFSET(format), AV_OPT_TYPE_INT, 
{.i64=OVERLAY_FORMAT_YUV420}, 0, OVERLAY_FORMAT_NB-1, FLAGS, "format" },
 { "yuv420", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV420}, 
.flags = FLAGS, .unit = "format" },

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


[FFmpeg-cvslog] avcodec/adpcm_data: use uint16_t to handle all values

2017-06-24 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Jun 24 22:27:10 
2017 +0200| [10542491113d7b1378da669b8edcdc268b82322a] | committer: Paul B Mahol

avcodec/adpcm_data: use uint16_t to handle all values

Signed-off-by: Paul B Mahol 

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

 libavcodec/adpcm_data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/adpcm_data.c b/libavcodec/adpcm_data.c
index 52271be26e..4cce0a5857 100644
--- a/libavcodec/adpcm_data.c
+++ b/libavcodec/adpcm_data.c
@@ -106,7 +106,7 @@ const int8_t ff_adpcm_yamaha_difflookup[] = {
 -1, -3, -5, -7, -9, -11, -13, -15
 };
 
-const int16_t ff_adpcm_afc_coeffs[2][16] = {
+const uint16_t ff_adpcm_afc_coeffs[2][16] = {
 { 0, 2048, 0, 1024, 4096, 3584, 3072, 4608, 4200, 4800, 5120, 2048, 1024, 
64512, 64512, 63488 },
 { 0, 0, 2048, 1024, 63488, 64000, 64512, 62976, 63288, 63236, 62464, 
63488, 64512, 1024, 0, 0 }
 };

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


[FFmpeg-cvslog] avfilter/vf_lut2: add support for gray10 and gray12 pixel formats

2017-06-24 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Jun 24 22:40:32 
2017 +0200| [5c1f4330d4c35299ada5b5cfc7cf0b0be0abddab] | committer: Paul B Mahol

avfilter/vf_lut2: add support for gray10 and gray12 pixel formats

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavfilter/vf_lut2.c b/libavfilter/vf_lut2.c
index 85b10531b6..25790bb3a3 100644
--- a/libavfilter/vf_lut2.c
+++ b/libavfilter/vf_lut2.c
@@ -107,7 +107,7 @@ static int query_formats(AVFilterContext *ctx)
 AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10,
 AV_PIX_FMT_GBRP12,
 AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP12,
-AV_PIX_FMT_GRAY8,
+AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12,
 AV_PIX_FMT_NONE
 };
 

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


[FFmpeg-cvslog] avfilter/vf_overlay: separate functions with main alpha

2017-06-25 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Jun 25 12:07:50 
2017 +0200| [f269a1e0b8816737d421afce2908977c3e26fa7c] | committer: Paul B Mahol

avfilter/vf_overlay: separate functions with main alpha

~5-15% faster overall with main input without alpha.

Signed-off-by: Paul B Mahol 

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

 libavfilter/vf_overlay.c | 71 +++-
 1 file changed, 46 insertions(+), 25 deletions(-)

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index beb61c1497..ad292a61c1 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -416,7 +416,7 @@ static int config_output(AVFilterLink *outlink)
 
 static void blend_image_packed_rgb(AVFilterContext *ctx,
AVFrame *dst, const AVFrame *src,
-   int x, int y)
+   int main_has_alpha, int x, int y)
 {
 OverlayContext *s = ctx->priv;
 int i, imax, j, jmax;
@@ -435,7 +435,6 @@ static void blend_image_packed_rgb(AVFilterContext *ctx,
 const int sb = s->overlay_rgba_map[B];
 const int sa = s->overlay_rgba_map[A];
 const int sstep = s->overlay_pix_step[0];
-const int main_has_alpha = s->main_has_alpha;
 uint8_t *S, *sp, *d, *dp;
 
 i = FFMAX(-y, 0);
@@ -634,11 +633,11 @@ static av_always_inline void 
blend_image_yuv(AVFilterContext *ctx,
 s->main_desc->comp[2].plane, s->main_desc->comp[2].offset, 
s->main_desc->comp[2].step);
 }
 
-static av_always_inline void blend_image_rgb(AVFilterContext *ctx,
- AVFrame *dst, const AVFrame *src,
- int hsub, int vsub,
- int main_has_alpha,
- int x, int y)
+static av_always_inline void blend_image_planar_rgb(AVFilterContext *ctx,
+AVFrame *dst, const 
AVFrame *src,
+int hsub, int vsub,
+int main_has_alpha,
+int x, int y)
 {
 OverlayContext *s = ctx->priv;
 const int src_w = src->width;
@@ -659,30 +658,52 @@ static av_always_inline void 
blend_image_rgb(AVFilterContext *ctx,
 
 static void blend_image_yuv420(AVFilterContext *ctx, AVFrame *dst, const 
AVFrame *src, int x, int y)
 {
-OverlayContext *s = ctx->priv;
+blend_image_yuv(ctx, dst, src, 1, 1, 0, x, y);
+}
 
-blend_image_yuv(ctx, dst, src, 1, 1, s->main_has_alpha, x, y);
+static void blend_image_yuva420(AVFilterContext *ctx, AVFrame *dst, const 
AVFrame *src, int x, int y)
+{
+blend_image_yuv(ctx, dst, src, 1, 1, 1, x, y);
 }
 
 static void blend_image_yuv422(AVFilterContext *ctx, AVFrame *dst, const 
AVFrame *src, int x, int y)
 {
-OverlayContext *s = ctx->priv;
+blend_image_yuv(ctx, dst, src, 1, 0, 0, x, y);
+}
 
-blend_image_yuv(ctx, dst, src, 1, 0, s->main_has_alpha, x, y);
+static void blend_image_yuva422(AVFilterContext *ctx, AVFrame *dst, const 
AVFrame *src, int x, int y)
+{
+blend_image_yuv(ctx, dst, src, 1, 0, 1, x, y);
 }
 
 static void blend_image_yuv444(AVFilterContext *ctx, AVFrame *dst, const 
AVFrame *src, int x, int y)
 {
-OverlayContext *s = ctx->priv;
+blend_image_yuv(ctx, dst, src, 0, 0, 0, x, y);
+}
 
-blend_image_yuv(ctx, dst, src, 0, 0, s->main_has_alpha, x, y);
+static void blend_image_yuva444(AVFilterContext *ctx, AVFrame *dst, const 
AVFrame *src, int x, int y)
+{
+blend_image_yuv(ctx, dst, src, 0, 0, 1, x, y);
 }
 
 static void blend_image_gbrp(AVFilterContext *ctx, AVFrame *dst, const AVFrame 
*src, int x, int y)
 {
-OverlayContext *s = ctx->priv;
+blend_image_planar_rgb(ctx, dst, src, 0, 0, 0, x, y);
+}
 
-blend_image_rgb(ctx, dst, src, 0, 0, s->main_has_alpha, x, y);
+static void blend_image_gbrap(AVFilterContext *ctx, AVFrame *dst, const 
AVFrame *src, int x, int y)
+{
+blend_image_planar_rgb(ctx, dst, src, 0, 0, 1, x, y);
+}
+
+static void blend_image_rgb(AVFilterContext *ctx, AVFrame *dst, const AVFrame 
*src, int x, int y)
+{
+blend_image_packed_rgb(ctx, dst, src, 0, x, y);
+}
+
+static void blend_image_rgba(AVFilterContext *ctx, AVFrame *dst, const AVFrame 
*src, int x, int y)
+{
+blend_image_packed_rgb(ctx, dst, src, 1, x, y);
 }
 
 static int config_input_main(AVFilterLink *inlink)
@@ -702,39 +723,39 @@ static int config_input_main(AVFilterLink *inlink)
 s->main_has_alpha = ff_fmt_is_in(inlink->format, alpha_pix_fmts);
 switch (s->format) {
 case OVERLAY_FORMAT_YUV420:
-s->blend_image = blend_image_yuv420;
+s->blend_image = s->main_has_alpha ? blend_image_yuva420 : 
blend_im

[FFmpeg-cvslog] avfilter/vf_waveform: allow alpha output for >8 depth planar rgb inputs

2017-06-25 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Jun 25 13:14:22 
2017 +0200| [8a14374ab374d6c99c71cd98692d30cccfc0e039] | committer: Paul B Mahol

avfilter/vf_waveform: allow alpha output for >8 depth planar rgb inputs

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavfilter/vf_waveform.c b/libavfilter/vf_waveform.c
index 44e9bf4dc2..efca49d22e 100644
--- a/libavfilter/vf_waveform.c
+++ b/libavfilter/vf_waveform.c
@@ -218,12 +218,12 @@ static const enum AVPixelFormat 
out_rgb9_lowpass_pix_fmts[] = {
 };
 
 static const enum AVPixelFormat out_rgb10_lowpass_pix_fmts[] = {
-AV_PIX_FMT_GBRP10,
+AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRAP10,
 AV_PIX_FMT_NONE
 };
 
 static const enum AVPixelFormat out_rgb12_lowpass_pix_fmts[] = {
-AV_PIX_FMT_GBRP12,
+AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRAP12,
 AV_PIX_FMT_NONE
 };
 

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


[FFmpeg-cvslog] avfilter/vf_blend: add extremity blend mode

2017-06-25 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Jun 25 16:39:10 
2017 +0200| [22a03c29006e9c6b41ce6e63831bd3faa69a1fe8] | committer: Paul B Mahol

avfilter/vf_blend: add extremity blend mode

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi   | 1 +
 libavfilter/blend.h| 1 +
 libavfilter/vf_blend.c | 4 
 3 files changed, 6 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 7ec7f5d959..930ca4cfab 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -4859,6 +4859,7 @@ Available values for component modes are:
 @item dodge
 @item freeze
 @item exclusion
+@item extremity
 @item glow
 @item hardlight
 @item hardmix
diff --git a/libavfilter/blend.h b/libavfilter/blend.h
index 54c4fdb6d1..0f27b4d29d 100644
--- a/libavfilter/blend.h
+++ b/libavfilter/blend.h
@@ -58,6 +58,7 @@ enum BlendMode {
 BLEND_MULTIPLY128,
 BLEND_HEAT,
 BLEND_FREEZE,
+BLEND_EXTREMITY,
 BLEND_NB
 };
 
diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index 9f003b29b6..9bde3b22a1 100644
--- a/libavfilter/vf_blend.c
+++ b/libavfilter/vf_blend.c
@@ -76,6 +76,7 @@ typedef struct ThreadData {
 { "divide", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DIVIDE}, 0, 0, 
FLAGS, "mode" },\
 { "dodge",  "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DODGE},  0, 0, 
FLAGS, "mode" },\
 { "exclusion",  "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_EXCLUSION},  0, 0, 
FLAGS, "mode" },\
+{ "extremity",  "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_EXTREMITY},  0, 0, 
FLAGS, "mode" },\
 { "freeze", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_FREEZE}, 0, 0, 
FLAGS, "mode" },\
 { "glow",   "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_GLOW},   0, 0, 
FLAGS, "mode" },\
 { "hardlight",  "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_HARDLIGHT},  0, 0, 
FLAGS, "mode" },\
@@ -241,6 +242,7 @@ DEFINE_BLEND8(subtract,   FFMAX(0, A - B))
 DEFINE_BLEND8(multiply,   MULTIPLY(1, A, B))
 DEFINE_BLEND8(multiply128,av_clip_uint8((A - 128) * B / 32. + 128))
 DEFINE_BLEND8(negation,   255 - FFABS(255 - A - B))
+DEFINE_BLEND8(extremity,  FFABS(255 - A - B))
 DEFINE_BLEND8(difference, FFABS(A - B))
 DEFINE_BLEND8(difference128, av_clip_uint8(128 + A - B))
 DEFINE_BLEND8(screen, SCREEN(1, A, B))
@@ -283,6 +285,7 @@ DEFINE_BLEND16(subtract,   FFMAX(0, A - B))
 DEFINE_BLEND16(multiply,   MULTIPLY(1, A, B))
 DEFINE_BLEND16(multiply128, av_clip_uint16((A - 32768) * B / 8192. + 32768))
 DEFINE_BLEND16(negation,   65535 - FFABS(65535 - A - B))
+DEFINE_BLEND16(extremity,  FFABS(65535 - A - B))
 DEFINE_BLEND16(difference, FFABS(A - B))
 DEFINE_BLEND16(difference128, av_clip_uint16(32768 + A - B))
 DEFINE_BLEND16(screen, SCREEN(1, A, B))
@@ -457,6 +460,7 @@ void ff_blend_init(FilterParams *param, int is_16bit)
 case BLEND_DIVIDE: param->blend = is_16bit ? blend_divide_16bit : 
blend_divide_8bit; break;
 case BLEND_DODGE:  param->blend = is_16bit ? blend_dodge_16bit  : 
blend_dodge_8bit;  break;
 case BLEND_EXCLUSION:  param->blend = is_16bit ? blend_exclusion_16bit  : 
blend_exclusion_8bit;  break;
+case BLEND_EXTREMITY:  param->blend = is_16bit ? blend_extremity_16bit  : 
blend_extremity_8bit;  break;
 case BLEND_FREEZE: param->blend = is_16bit ? blend_freeze_16bit : 
blend_freeze_8bit; break;
 case BLEND_GLOW:   param->blend = is_16bit ? blend_glow_16bit   : 
blend_glow_8bit;   break;
 case BLEND_HARDLIGHT:  param->blend = is_16bit ? blend_hardlight_16bit  : 
blend_hardlight_8bit;  break;

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


[FFmpeg-cvslog] avcodec/proresenc_kostya: use frame metadata instead of avctx

2017-06-25 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Jun 26 00:01:07 
2017 +0200| [4bd4fc56abf946322fdd30fdc5cad11a309daabd] | committer: Paul B Mahol

avcodec/proresenc_kostya: use frame metadata instead of avctx

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c
index 25f7fcb9b1..9f0c23403c 100644
--- a/libavcodec/proresenc_kostya.c
+++ b/libavcodec/proresenc_kostya.c
@@ -969,9 +969,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
 bytestream_put_byte  (&buf, frame_flags);
 
 bytestream_put_byte  (&buf, 0); // reserved
-bytestream_put_byte  (&buf, avctx->color_primaries);
-bytestream_put_byte  (&buf, avctx->color_trc);
-bytestream_put_byte  (&buf, avctx->colorspace);
+bytestream_put_byte  (&buf, pic->color_primaries);
+bytestream_put_byte  (&buf, pic->color_trc);
+bytestream_put_byte  (&buf, pic->colorspace);
 bytestream_put_byte  (&buf, 0x40 | (ctx->alpha_bits >> 3));
 bytestream_put_byte  (&buf, 0); // reserved
 if (ctx->quant_sel != QUANT_MAT_DEFAULT) {

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


[FFmpeg-cvslog] avcodec/prores_kostya: increase bits usage when alpha is used

2017-06-25 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Jun 24 16:34:52 
2017 +0200| [315f51128a95ca34ac3212c86b2a938330ba6b6e] | committer: Paul B Mahol

avcodec/prores_kostya: increase bits usage when alpha is used

Also fix undefined left shift of negative variable.

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c
index 090dfa5c0a..25f7fcb9b1 100644
--- a/libavcodec/proresenc_kostya.c
+++ b/libavcodec/proresenc_kostya.c
@@ -358,7 +358,7 @@ static inline void encode_vlc_codeword(PutBitContext *pb, 
unsigned codebook, int
 }
 
 #define GET_SIGN(x)  ((x) >> 31)
-#define MAKE_CODE(x) (((x) << 1) ^ GET_SIGN(x))
+#define MAKE_CODE(x) x)) * 2) ^ GET_SIGN(x))
 
 static void encode_dcs(PutBitContext *pb, int16_t *blocks,
int blocks_per_slice, int scale)
@@ -1206,6 +1206,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
ctx->pictures_per_frame)
 break;
 ctx->bits_per_mb   = ctx->profile_info->br_tab[i];
+if (ctx->alpha_bits)
+ctx->bits_per_mb *= 20;
 } else if (ctx->bits_per_mb < 128) {
 av_log(avctx, AV_LOG_ERROR, "too few bits per MB, please set at 
least 128\n");
 return AVERROR_INVALIDDATA;

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


  1   2   3   4   5   6   7   8   9   10   >