[FFmpeg-cvslog] vf_colorspace: Add support for full range yuv

2016-08-27 Thread Vittorio Giovara
ffmpeg | branch: master | Vittorio Giovara  | Thu 
Aug 25 19:14:58 2016 -0400| [69abf4f93cb67cc52ff55f318ae09f261e7ad27e] | 
committer: Michael Niedermayer

vf_colorspace: Add support for full range yuv

Whenever a full range video is input, since the YUVJ* formats are not
listed as supported for this filter, a range reduction takes place
through the auto-inserted format filter, forcing the conversion to
operate on a limited range,

However the filter handles full range videos perfectly fine, so adding
support to YUVJ* formats will allow skipping a conversion step, while
providing completely identical results.

Signed-off-by: Vittorio Giovara 
Reviewed-by: "Ronald S. Bultje" 
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
index bf51c83..37e77d1 100644
--- a/libavfilter/vf_colorspace.c
+++ b/libavfilter/vf_colorspace.c
@@ -960,6 +960,7 @@ static int query_formats(AVFilterContext *ctx)
 AV_PIX_FMT_YUV420P,   AV_PIX_FMT_YUV422P,   AV_PIX_FMT_YUV444P,
 AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
 AV_PIX_FMT_YUV420P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444P12,
+AV_PIX_FMT_YUVJ420P,  AV_PIX_FMT_YUVJ422P,  AV_PIX_FMT_YUVJ444P,
 AV_PIX_FMT_NONE
 };
 int res;

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


[FFmpeg-cvslog] vf_colorspace: Check av_frame_copy_props() return value

2016-08-27 Thread Vittorio Giovara
ffmpeg | branch: master | Vittorio Giovara  | Thu 
Aug 25 19:14:57 2016 -0400| [6648da359114696351db7e7468f0769a7d61c387] | 
committer: Michael Niedermayer

vf_colorspace: Check av_frame_copy_props() return value

This function can potentially allocate memory.

Reviewed-by: "Ronald S. Bultje" 
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
index 3d39f13..bf51c83 100644
--- a/libavfilter/vf_colorspace.c
+++ b/libavfilter/vf_colorspace.c
@@ -861,7 +861,11 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
 av_frame_free(&in);
 return AVERROR(ENOMEM);
 }
-av_frame_copy_props(out, in);
+res = av_frame_copy_props(out, in);
+if (res < 0) {
+av_frame_free(&in);
+return res;
+}
 
 out->color_primaries = s->user_prm == AVCOL_PRI_UNSPECIFIED ?
default_prm[FFMIN(s->user_all, CS_NB)] : 
s->user_prm;

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


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

2016-08-27 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Aug 27 13:44:21 
2016 +0200| [b2c6a11fb60429c9698b9d1e8538d32d741e68c5] | committer: Paul B Mahol

avfilter/vf_atadenoise: add planes option

Make possible filtering only some planes.

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

 doc/filters.texi|  3 +++
 libavfilter/vf_atadenoise.c | 15 +++
 2 files changed, 18 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 15300d8..b50d7a6 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -4397,6 +4397,9 @@ threshold B is designed to react on continuous changes in 
the input signal.
 @item s
 Set number of frames filter will use for averaging. Default is 33. Must be odd
 number in range [5, 129].
+
+@item p
+Set what planes of frame filter will use for averaging. Default is all.
 @end table
 
 @section bbox
diff --git a/libavfilter/vf_atadenoise.c b/libavfilter/vf_atadenoise.c
index cdea298..07da792 100644
--- a/libavfilter/vf_atadenoise.c
+++ b/libavfilter/vf_atadenoise.c
@@ -25,6 +25,7 @@
  * David Bartovčak and Miroslav Vrankić
  */
 
+#include "libavutil/imgutils.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 #include "avfilter.h"
@@ -44,6 +45,7 @@ typedef struct ATADenoiseContext {
 float fthra[4], fthrb[4];
 int thra[4], thrb[4];
 
+int planes;
 int nb_planes;
 int planewidth[4];
 int planeheight[4];
@@ -68,6 +70,7 @@ static const AVOption atadenoise_options[] = {
 { "2a", "set threshold A for 3rd plane", OFFSET(fthra[2]), 
AV_OPT_TYPE_FLOAT, {.dbl=0.02}, 0, 0.3, FLAGS },
 { "2b", "set threshold B for 3rd plane", OFFSET(fthrb[2]), 
AV_OPT_TYPE_FLOAT, {.dbl=0.04}, 0, 5.0, FLAGS },
 { "s",  "set how many frames to use",OFFSET(size), 
AV_OPT_TYPE_INT,   {.i64=9},   5, SIZE, FLAGS },
+{ "p",  "set what planes to filter", OFFSET(planes),   
AV_OPT_TYPE_FLAGS, {.i64=7},0, 15,  FLAGS },
 { NULL }
 };
 
@@ -141,6 +144,12 @@ static int filter_slice8(AVFilterContext *ctx, void *arg, 
int jobnr, int nb_jobs
 const int *linesize = (const int *)s->linesize[p];
 const uint8_t *srcf[SIZE];
 
+if (!((1 << p) & s->planes)) {
+av_image_copy_plane(dst, out->linesize[p], src, in->linesize[p],
+w, slice_end - slice_start);
+continue;
+}
+
 for (i = 0; i < size; i++)
 srcf[i] = data[i] + slice_start * linesize[i];
 
@@ -212,6 +221,12 @@ static int filter_slice16(AVFilterContext *ctx, void *arg, 
int jobnr, int nb_job
 const int *linesize = (const int *)s->linesize[p];
 const uint16_t *srcf[SIZE];
 
+if (!((1 << p) & s->planes)) {
+av_image_copy_plane((uint8_t *)dst, out->linesize[p], (uint8_t 
*)src, in->linesize[p],
+w * 2, slice_end - slice_start);
+continue;
+}
+
 for (i = 0; i < s->size; i++)
 srcf[i] = (const uint16_t *)(data[i] + slice_start * linesize[i]);
 

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


[FFmpeg-cvslog] avfilter/vf_convolution: add >8 bit depth support

2016-08-27 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Aug 27 16:04:07 
2016 +0200| [f242d74d170e020d433267b6cd4c7fe400883939] | committer: Paul B Mahol

avfilter/vf_convolution: add >8 bit depth support

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

 libavfilter/vf_convolution.c | 190 +--
 1 file changed, 165 insertions(+), 25 deletions(-)

diff --git a/libavfilter/vf_convolution.c b/libavfilter/vf_convolution.c
index 2380cdc..2cfc3ba 100644
--- a/libavfilter/vf_convolution.c
+++ b/libavfilter/vf_convolution.c
@@ -35,6 +35,8 @@ typedef struct ConvolutionContext {
 float rdiv[4];
 float bias[4];
 
+int size[4];
+int depth;
 int bstride;
 uint8_t *buffer;
 int nb_planes;
@@ -81,46 +83,46 @@ static const int same5x5[25] = {0, 0, 0, 0, 0,
 static int query_formats(AVFilterContext *ctx)
 {
 static const enum AVPixelFormat pix_fmts[] = {
-AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P,
-AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV411P,
+AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV440P,
 AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P,
-AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ411P,
-AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV440P,
-AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP,
-AV_PIX_FMT_GRAY8,
+AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA420P, 
AV_PIX_FMT_YUV420P,
+AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P,
+AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P,
+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, 
AV_PIX_FMT_YUV440P12,
+AV_PIX_FMT_YUV420P14, AV_PIX_FMT_YUV422P14, AV_PIX_FMT_YUV444P14,
+AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16,
+AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA422P9, AV_PIX_FMT_YUVA444P9,
+AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUVA444P10,
+AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16,
+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_NONE
 };
 
 return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
 }
 
-static int config_input(AVFilterLink *inlink)
+static inline void line_copy8(uint8_t *line, const uint8_t *srcp, int width, 
int mergin)
 {
-ConvolutionContext *s = inlink->dst->priv;
-const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
-int ret;
-
-if ((ret = av_image_fill_linesizes(s->planewidth, inlink->format, 
inlink->w)) < 0)
-return ret;
-
-s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, 
desc->log2_chroma_h);
-s->planeheight[0] = s->planeheight[3] = inlink->h;
-
-s->nb_planes = av_pix_fmt_count_planes(inlink->format);
+int i;
 
-s->bstride = s->planewidth[0] + 32;
-s->buffer = av_malloc(5 * s->bstride);
-if (!s->buffer)
-return AVERROR(ENOMEM);
+memcpy(line, srcp, width);
 
-return 0;
+for (i = mergin; i > 0; i--) {
+line[-i] = line[i];
+line[width - 1 + i] = line[width - 1 - i];
+}
 }
 
-static inline void line_copy8(uint8_t *line, const uint8_t *srcp, int width, 
int mergin)
+static inline void line_copy16(uint16_t *line, const uint16_t *srcp, int 
width, int mergin)
 {
 int i;
 
-memcpy(line, srcp, width);
+memcpy(line, srcp, width * 2);
 
 for (i = mergin; i > 0; i--) {
 line[-i] = line[i];
@@ -128,6 +130,110 @@ static inline void line_copy8(uint8_t *line, const 
uint8_t *srcp, int width, int
 }
 }
 
+static void filter16_3x3(ConvolutionContext *s, AVFrame *in, AVFrame *out, int 
plane)
+{
+const uint16_t *src = (const uint16_t *)in->data[plane];
+uint16_t *dst = (uint16_t *)out->data[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];
+uint16_t *p0 = (uint16_t *)s->buffer + 16;
+uint16_t *p1 = p0 + bstride;
+uint16_t *p2 = p1 + bstride;
+uint16_t *orig = p0, *end = p2;
+const int *matrix = s->matrix[plane];
+const float rdiv = s->rdiv[plane];
+const float bias = s->bias[plane];
+int y, x;
+
+line_copy16(p0, src + stride, width, 1);
+line_copy16(p1, src, width, 1);
+
+for (y = 0; y < height; y++) {
+src += stride * (y < height - 1 ? 1 : -1);
+line_copy16(p2, src, width, 1);
+
+for (x = 0; x < width; x++) {
+int sum = p0[x - 1] * matrix[0] +
+ 

[FFmpeg-cvslog] avformat/utils: fix a codecpar non use

2016-08-27 Thread James Almer
ffmpeg | branch: master | James Almer  | Fri Aug 26 15:28:21 
2016 -0300| [dc7e5adbc0867956102afc85e2b59b878e5a27ed] | committer: James Almer

avformat/utils: fix a codecpar non use

Reviewed-by: Michael Niedermayer 
Signed-off-by: James Almer 

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

 libavformat/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index ba08792..7d23c4a 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -617,7 +617,7 @@ static void force_codec_ids(AVFormatContext *s, AVStream 
*st)
 break;
 case AVMEDIA_TYPE_DATA:
 if (s->data_codec_id)
-st->codec->codec_id = s->data_codec_id;
+st->codecpar->codec_id = s->data_codec_id;
 break;
 }
 }

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