[FFmpeg-cvslog] lavc/svq3: Do not write into memory defined as const.

2018-01-21 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Thu Jan 18 
23:31:48 2018 +0100| [55bdee7b07262a07d7c63475b1952b4ec17503d0] | committer: 
Carl Eugen Hoyos

lavc/svq3: Do not write into memory defined as const.

Fixes a warning on ppc:
libavcodec/svq3.c:1055:21: warning: passing argument 1 of ‘av_write_bswap32’ 
discards 'const' qualifier from pointer target type

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

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

diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index a937b2f951..fc17081ecf 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -1048,12 +1048,12 @@ static int svq3_decode_slice_header(AVCodecContext 
*avctx)
 }
 memcpy(s->slice_buf, s->gb.buffer + s->gb.index / 8, slice_bytes);
 
-init_get_bits(&s->gb_slice, s->slice_buf, slice_bits);
-
 if (s->watermark_key) {
-uint32_t header = AV_RL32(&s->gb_slice.buffer[1]);
-AV_WL32(&s->gb_slice.buffer[1], header ^ s->watermark_key);
+uint32_t header = AV_RL32(&s->slice_buf[1]);
+AV_WL32(&s->slice_buf[1], header ^ s->watermark_key);
 }
+init_get_bits(&s->gb_slice, s->slice_buf, slice_bits);
+
 if (length > 0) {
 memmove(s->slice_buf, &s->slice_buf[slice_length], length - 1);
 }

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


[FFmpeg-cvslog] MAINTAINERS: add myself for avcodec/v4l2_

2018-01-21 Thread Jorge Ramirez-Ortiz
ffmpeg | branch: master | Jorge Ramirez-Ortiz  | Fri Jan 
19 17:52:32 2018 +0100| [15a05d2b73c6e5ae530b7e2cafeabe2a383ef72b] | committer: 
Michael Niedermayer

MAINTAINERS: add myself for avcodec/v4l2_

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/MAINTAINERS b/MAINTAINERS
index e5839261af..d0de26c4f7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -240,6 +240,7 @@ Codecs:
   tta.c Alex Beregszaszi, Jaikrishnan Menon
   ttaenc.c  Paul B Mahol
   txd.c Ivo van Poorten
+  v4l2_*Jorge Ramirez-Ortiz
   vc2*  Rostislav Pehlivanov
   vcr1.cMichael Niedermayer
   videotoolboxenc.c Rick Kern, Aman Gupta

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


[FFmpeg-cvslog] avcodec/truemotion2: Fix integer overflow in TM2_RECALC_BLOCK()

2018-01-21 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Jan 20 04:10:50 2018 +0100| [56a53340ed4cc55898e49c07081311ebb2816630] | 
committer: Michael Niedermayer

avcodec/truemotion2: Fix integer overflow in TM2_RECALC_BLOCK()

Fixes: signed integer overflow: 1477974040 - -1877995504 cannot be represented 
in type 'int'
Fixes: 4861/clusterfuzz-testcase-minimized-4570316383715328

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
index f077f0e4bd..97c38f7f08 100644
--- a/libavcodec/truemotion2.c
+++ b/libavcodec/truemotion2.c
@@ -441,8 +441,8 @@ static inline int GET_TOK(TM2Context *ctx,int type)
 
 /* recalculate last and delta values for next blocks */
 #define TM2_RECALC_BLOCK(CHR, stride, last, CD) {\
-CD[0] = CHR[1] - last[1];\
-CD[1] = (int)CHR[stride + 1] - (int)CHR[1];\
+CD[0] = (unsigned)CHR[ 1] - (unsigned)last[1];\
+CD[1] = (unsigned)CHR[stride + 1] - (unsigned) CHR[1];\
 last[0] = (int)CHR[stride + 0];\
 last[1] = (int)CHR[stride + 1];}
 

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


[FFmpeg-cvslog] lavfi: use common VAAPI VPP infrastructure for vf_scale_vaapi.

2018-01-21 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Jan  8 16:02:35 
2018 +0800| [19214f005140b0ee7f706509bd3fab47f4af9b90] | committer: Mark 
Thompson

lavfi: use common VAAPI VPP infrastructure for vf_scale_vaapi.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavfilter/Makefile |   2 +-
 libavfilter/vf_scale_vaapi.c | 356 +--
 2 files changed, 42 insertions(+), 316 deletions(-)

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index ef4729dd3f..3d8dd2c890 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -296,7 +296,7 @@ OBJS-$(CONFIG_SCALE_FILTER)  += vf_scale.o 
scale.o
 OBJS-$(CONFIG_SCALE_CUDA_FILTER) += vf_scale_cuda.o 
vf_scale_cuda.ptx.o
 OBJS-$(CONFIG_SCALE_NPP_FILTER)  += vf_scale_npp.o scale.o
 OBJS-$(CONFIG_SCALE_QSV_FILTER)  += vf_scale_qsv.o
-OBJS-$(CONFIG_SCALE_VAAPI_FILTER)+= vf_scale_vaapi.o scale.o
+OBJS-$(CONFIG_SCALE_VAAPI_FILTER)+= vf_scale_vaapi.o scale.o 
vaapi_vpp.o
 OBJS-$(CONFIG_SCALE2REF_FILTER)  += vf_scale.o scale.o
 OBJS-$(CONFIG_SELECT_FILTER) += f_select.o
 OBJS-$(CONFIG_SELECTIVECOLOR_FILTER) += vf_selectivecolor.o
diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c
index 4bead5aaf4..d349ff0f90 100644
--- a/libavfilter/vf_scale_vaapi.c
+++ b/libavfilter/vf_scale_vaapi.c
@@ -18,12 +18,7 @@
 
 #include 
 
-#include 
-#include 
-
 #include "libavutil/avassert.h"
-#include "libavutil/hwcontext.h"
-#include "libavutil/hwcontext_vaapi.h"
 #include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
@@ -33,276 +28,74 @@
 #include "internal.h"
 #include "scale.h"
 #include "video.h"
+#include "vaapi_vpp.h"
 
 typedef struct ScaleVAAPIContext {
-const AVClass *class;
-
-AVVAAPIDeviceContext *hwctx;
-AVBufferRef *device_ref;
-
-int valid_ids;
-VAConfigID  va_config;
-VAContextID va_context;
-
-AVBufferRef   *input_frames_ref;
-AVHWFramesContext *input_frames;
-
-AVBufferRef   *output_frames_ref;
-AVHWFramesContext *output_frames;
+VAAPIVPPContext vpp_ctx; // must be the first fileld
 
 char *output_format_string;
-enum AVPixelFormat output_format;
 
 char *w_expr;  // width expression string
 char *h_expr;  // height expression string
-
-int output_width;  // computed width
-int output_height; // computed height
 } ScaleVAAPIContext;
 
-
-static int scale_vaapi_query_formats(AVFilterContext *avctx)
-{
-enum AVPixelFormat pix_fmts[] = {
-AV_PIX_FMT_VAAPI, AV_PIX_FMT_NONE,
-};
-int err;
-
-if ((err = ff_formats_ref(ff_make_format_list(pix_fmts),
-  &avctx->inputs[0]->out_formats)) < 0)
-return err;
-if ((err = ff_formats_ref(ff_make_format_list(pix_fmts),
-  &avctx->outputs[0]->in_formats)) < 0)
-return err;
-
-return 0;
-}
-
-static int scale_vaapi_pipeline_uninit(ScaleVAAPIContext *ctx)
-{
-if (ctx->va_context != VA_INVALID_ID) {
-vaDestroyContext(ctx->hwctx->display, ctx->va_context);
-ctx->va_context = VA_INVALID_ID;
-}
-
-if (ctx->va_config != VA_INVALID_ID) {
-vaDestroyConfig(ctx->hwctx->display, ctx->va_config);
-ctx->va_config = VA_INVALID_ID;
-}
-
-av_buffer_unref(&ctx->output_frames_ref);
-av_buffer_unref(&ctx->device_ref);
-ctx->hwctx = 0;
-
-return 0;
-}
-
-static int scale_vaapi_config_input(AVFilterLink *inlink)
-{
-AVFilterContext *avctx = inlink->dst;
-ScaleVAAPIContext *ctx = avctx->priv;
-
-scale_vaapi_pipeline_uninit(ctx);
-
-if (!inlink->hw_frames_ctx) {
-av_log(avctx, AV_LOG_ERROR, "A hardware frames reference is "
-   "required to associate the processing device.\n");
-return AVERROR(EINVAL);
-}
-
-ctx->input_frames_ref = av_buffer_ref(inlink->hw_frames_ctx);
-ctx->input_frames = (AVHWFramesContext*)ctx->input_frames_ref->data;
-
-return 0;
-}
-
 static int scale_vaapi_config_output(AVFilterLink *outlink)
 {
-AVFilterLink *inlink = outlink->src->inputs[0];
-AVFilterContext *avctx = outlink->src;
-ScaleVAAPIContext *ctx = avctx->priv;
-AVVAAPIHWConfig *hwconfig = NULL;
-AVHWFramesConstraints *constraints = NULL;
-AVVAAPIFramesContext *va_frames;
-VAStatus vas;
-int err, i;
-
-scale_vaapi_pipeline_uninit(ctx);
-
-ctx->device_ref = av_buffer_ref(ctx->input_frames->device_ref);
-ctx->hwctx = ((AVHWDeviceContext*)ctx->device_ref->data)->hwctx;
-
-av_assert0(ctx->va_config == VA_INVALID_ID);
-vas = vaCreateConfig(ctx->hwctx->display, VAProfileNone,
- VAEntrypointVideoProc, 0, 0, &ctx->va_config);
-if (vas != VA_STATUS_SUCCESS) {
-av_log(ctx, AV

[FFmpeg-cvslog] lavfi: add denoise and sharpness VAAPI video filters.

2018-01-21 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Jan  8 16:19:17 
2018 +0800| [9bba10c174c893b08b036898a522ed6dad1d3660] | committer: Mark 
Thompson

lavfi: add denoise and sharpness VAAPI video filters.

Most code between them is common, so put them in a new file for
miscellaneous VAAPI filters.

Signed-off-by: Yun Zhou 
Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 Changelog   |   2 +-
 configure   |   2 +
 libavfilter/Makefile|   2 +
 libavfilter/allfilters.c|   2 +
 libavfilter/vf_misc_vaapi.c | 293 
 5 files changed, 300 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index c7ecfffbb3..7a73447a6b 100644
--- a/Changelog
+++ b/Changelog
@@ -38,7 +38,7 @@ version :
 - Removed the ffserver program
 - Removed the ffmenc and ffmdec muxer and demuxer
 - VideoToolbox HEVC encoder and hwaccel
-- VAAPI-accelerated ProcAmp (color balance) filter
+- VAAPI-accelerated ProcAmp (color balance), denoise and sharpness filters
 
 
 version 3.4:
diff --git a/configure b/configure
index 12fb34a202..24c4f672a3 100755
--- a/configure
+++ b/configure
@@ -3204,6 +3204,7 @@ deconvolve_filter_select="fft"
 deinterlace_qsv_filter_deps="libmfx"
 deinterlace_vaapi_filter_deps="vaapi"
 delogo_filter_deps="gpl"
+denoise_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
 deshake_filter_select="pixelutils"
 drawtext_filter_deps="libfreetype"
 drawtext_filter_suggest="libfontconfig libfribidi"
@@ -3257,6 +3258,7 @@ scale2ref_filter_deps="swscale"
 scale_filter_deps="swscale"
 scale_qsv_filter_deps="libmfx"
 select_filter_select="pixelutils"
+sharpness_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
 showcqt_filter_deps="avcodec avformat swscale"
 showcqt_filter_suggest="libfontconfig libfreetype"
 showcqt_filter_select="fft"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 43d0dd36e6..34971ce6c1 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -174,6 +174,7 @@ OBJS-$(CONFIG_DEINTERLACE_QSV_FILTER)+= 
vf_deinterlace_qsv.o
 OBJS-$(CONFIG_DEINTERLACE_VAAPI_FILTER)  += vf_deinterlace_vaapi.o 
vaapi_vpp.o
 OBJS-$(CONFIG_DEJUDDER_FILTER)   += vf_dejudder.o
 OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
+OBJS-$(CONFIG_DENOISE_VAAPI_FILTER)  += vf_misc_vaapi.o vaapi_vpp.o
 OBJS-$(CONFIG_DESHAKE_FILTER)+= vf_deshake.o
 OBJS-$(CONFIG_DESPILL_FILTER)+= vf_despill.o
 OBJS-$(CONFIG_DETELECINE_FILTER) += vf_detelecine.o
@@ -309,6 +310,7 @@ OBJS-$(CONFIG_SETPTS_FILTER) += setpts.o
 OBJS-$(CONFIG_SETRANGE_FILTER)   += vf_setparams.o
 OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o
 OBJS-$(CONFIG_SETTB_FILTER)  += settb.o
+OBJS-$(CONFIG_SHARPNESS_VAAPI_FILTER)+= vf_misc_vaapi.o vaapi_vpp.o
 OBJS-$(CONFIG_SHOWINFO_FILTER)   += vf_showinfo.o
 OBJS-$(CONFIG_SHOWPALETTE_FILTER)+= vf_showpalette.o
 OBJS-$(CONFIG_SHUFFLEFRAMES_FILTER)  += vf_shuffleframes.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 63550628e5..9adb1090b7 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -184,6 +184,7 @@ static void register_all(void)
 REGISTER_FILTER(DEINTERLACE_VAAPI, deinterlace_vaapi, vf);
 REGISTER_FILTER(DEJUDDER,   dejudder,   vf);
 REGISTER_FILTER(DELOGO, delogo, vf);
+REGISTER_FILTER(DENOISE_VAAPI,  denoise_vaapi,  vf);
 REGISTER_FILTER(DESHAKE,deshake,vf);
 REGISTER_FILTER(DESPILL,despill,vf);
 REGISTER_FILTER(DETELECINE, detelecine, vf);
@@ -318,6 +319,7 @@ static void register_all(void)
 REGISTER_FILTER(SETRANGE,   setrange,   vf);
 REGISTER_FILTER(SETSAR, setsar, vf);
 REGISTER_FILTER(SETTB,  settb,  vf);
+REGISTER_FILTER(SHARPNESS_VAAPI, sharpness_vaapi, vf);
 REGISTER_FILTER(SHOWINFO,   showinfo,   vf);
 REGISTER_FILTER(SHOWPALETTE,showpalette,vf);
 REGISTER_FILTER(SHUFFLEFRAMES,  shuffleframes,  vf);
diff --git a/libavfilter/vf_misc_vaapi.c b/libavfilter/vf_misc_vaapi.c
new file mode 100644
index 00..316f15e38b
--- /dev/null
+++ b/libavfilter/vf_misc_vaapi.c
@@ -0,0 +1,293 @@
+/*
+ * 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 Publi

[FFmpeg-cvslog] lavfi: use common VAAPI VPP infrastructure for vf_deinterlace_vaapi.

2018-01-21 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Jan  8 16:07:38 
2018 +0800| [92704c480e811e0bd2a605173559d2baa974119f] | committer: Mark 
Thompson

lavfi: use common VAAPI VPP infrastructure for vf_deinterlace_vaapi.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavfilter/Makefile   |   2 +-
 libavfilter/vf_deinterlace_vaapi.c | 351 +
 2 files changed, 46 insertions(+), 307 deletions(-)

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 3d8dd2c890..bbc97a0831 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -171,7 +171,7 @@ OBJS-$(CONFIG_DECONVOLVE_FILTER) += 
vf_convolve.o framesync.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_DEINTERLACE_VAAPI_FILTER)  += vf_deinterlace_vaapi.o 
vaapi_vpp.o
 OBJS-$(CONFIG_DEJUDDER_FILTER)   += vf_dejudder.o
 OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
 OBJS-$(CONFIG_DESHAKE_FILTER)+= vf_deshake.o
diff --git a/libavfilter/vf_deinterlace_vaapi.c 
b/libavfilter/vf_deinterlace_vaapi.c
index a38da5d57b..9700f85817 100644
--- a/libavfilter/vf_deinterlace_vaapi.c
+++ b/libavfilter/vf_deinterlace_vaapi.c
@@ -18,13 +18,8 @@
 
 #include 
 
-#include 
-#include 
-
 #include "libavutil/avassert.h"
 #include "libavutil/common.h"
-#include "libavutil/hwcontext.h"
-#include "libavutil/hwcontext_vaapi.h"
 #include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
@@ -33,31 +28,17 @@
 #include "formats.h"
 #include "internal.h"
 #include "video.h"
+#include "vaapi_vpp.h"
 
 #define MAX_REFERENCES 8
 
 typedef struct DeintVAAPIContext {
-const AVClass *class;
-
-AVVAAPIDeviceContext *hwctx;
-AVBufferRef   *device_ref;
+VAAPIVPPContext vpp_ctx; // must be the first fileld
 
 intmode;
 intfield_rate;
 intauto_enable;
 
-intvalid_ids;
-VAConfigID va_config;
-VAContextIDva_context;
-
-AVBufferRef   *input_frames_ref;
-AVHWFramesContext *input_frames;
-
-AVBufferRef   *output_frames_ref;
-AVHWFramesContext *output_frames;
-intoutput_height;
-intoutput_width;
-
 VAProcFilterCapDeinterlacing
deint_caps[VAProcDeinterlacingCount];
 int nb_deint_caps;
@@ -67,8 +48,6 @@ typedef struct DeintVAAPIContext {
 intqueue_count;
 AVFrame   *frame_queue[MAX_REFERENCES];
 intextra_delay_for_timestamps;
-
-VABufferID filter_buffer;
 } DeintVAAPIContext;
 
 static const char *deint_vaapi_mode_name(int mode)
@@ -85,82 +64,29 @@ static const char *deint_vaapi_mode_name(int mode)
 }
 }
 
-static int deint_vaapi_query_formats(AVFilterContext *avctx)
+static void deint_vaapi_pipeline_uninit(AVFilterContext *avctx)
 {
-enum AVPixelFormat pix_fmts[] = {
-AV_PIX_FMT_VAAPI, AV_PIX_FMT_NONE,
-};
-int err;
-
-if ((err = ff_formats_ref(ff_make_format_list(pix_fmts),
-  &avctx->inputs[0]->out_formats)) < 0)
-return err;
-if ((err = ff_formats_ref(ff_make_format_list(pix_fmts),
-  &avctx->outputs[0]->in_formats)) < 0)
-return err;
-
-return 0;
-}
-
-static int deint_vaapi_pipeline_uninit(AVFilterContext *avctx)
-{
-DeintVAAPIContext *ctx = avctx->priv;
+DeintVAAPIContext *ctx   = avctx->priv;
 int i;
 
 for (i = 0; i < ctx->queue_count; i++)
 av_frame_free(&ctx->frame_queue[i]);
 ctx->queue_count = 0;
 
-if (ctx->filter_buffer != VA_INVALID_ID) {
-vaDestroyBuffer(ctx->hwctx->display, ctx->filter_buffer);
-ctx->filter_buffer = VA_INVALID_ID;
-}
-
-if (ctx->va_context != VA_INVALID_ID) {
-vaDestroyContext(ctx->hwctx->display, ctx->va_context);
-ctx->va_context = VA_INVALID_ID;
-}
-
-if (ctx->va_config != VA_INVALID_ID) {
-vaDestroyConfig(ctx->hwctx->display, ctx->va_config);
-ctx->va_config = VA_INVALID_ID;
-}
-
-av_buffer_unref(&ctx->device_ref);
-ctx->hwctx = NULL;
-
-return 0;
-}
-
-static int deint_vaapi_config_input(AVFilterLink *inlink)
-{
-AVFilterContext   *avctx = inlink->dst;
-DeintVAAPIContext *ctx = avctx->priv;
-
-deint_vaapi_pipeline_uninit(avctx);
-
-if (!inlink->hw_frames_ctx) {
-av_log(avctx, AV_LOG_ERROR, "A hardware frames reference is "
-   "required to associate the processing device.\n");
-return AVERROR(EINVAL);
-}
-
-ctx->input_fram

[FFmpeg-cvslog] lavfi: VAAPI VPP common infrastructure.

2018-01-21 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Jan  8 15:56:43 
2018 +0800| [dfdeed5a2c8f432d6c5eda1a3a6a1f333f3d4604] | committer: Mark 
Thompson

lavfi: VAAPI VPP common infrastructure.

Re-work the VAAPI common infrastructure to avoid code duplication
between filters.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavfilter/vaapi_vpp.c | 379 
 libavfilter/vaapi_vpp.h |  82 +++
 2 files changed, 461 insertions(+)

diff --git a/libavfilter/vaapi_vpp.c b/libavfilter/vaapi_vpp.c
new file mode 100644
index 00..9d917722a0
--- /dev/null
+++ b/libavfilter/vaapi_vpp.c
@@ -0,0 +1,379 @@
+/*
+ * 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/avassert.h"
+#include "libavutil/pixdesc.h"
+#include "formats.h"
+
+#include "vaapi_vpp.h"
+
+int ff_vaapi_vpp_query_formats(AVFilterContext *avctx)
+{
+enum AVPixelFormat pix_fmts[] = {
+AV_PIX_FMT_VAAPI, AV_PIX_FMT_NONE,
+};
+int err;
+
+if ((err = ff_formats_ref(ff_make_format_list(pix_fmts),
+  &avctx->inputs[0]->out_formats)) < 0)
+return err;
+if ((err = ff_formats_ref(ff_make_format_list(pix_fmts),
+  &avctx->outputs[0]->in_formats)) < 0)
+return err;
+
+return 0;
+}
+
+void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx)
+{
+VAAPIVPPContext *ctx   = avctx->priv;
+int i;
+for (i = 0; i < ctx->nb_filter_buffers; i++) {
+if (ctx->filter_buffers[i] != VA_INVALID_ID) {
+vaDestroyBuffer(ctx->hwctx->display, ctx->filter_buffers[i]);
+ctx->filter_buffers[i] = VA_INVALID_ID;
+}
+}
+ctx->nb_filter_buffers = 0;
+
+if (ctx->va_context != VA_INVALID_ID) {
+vaDestroyContext(ctx->hwctx->display, ctx->va_context);
+ctx->va_context = VA_INVALID_ID;
+}
+
+if (ctx->va_config != VA_INVALID_ID) {
+vaDestroyConfig(ctx->hwctx->display, ctx->va_config);
+ctx->va_config = VA_INVALID_ID;
+}
+
+av_buffer_unref(&ctx->output_frames_ref);
+av_buffer_unref(&ctx->device_ref);
+ctx->hwctx = NULL;
+}
+
+int ff_vaapi_vpp_config_input(AVFilterLink *inlink)
+{
+AVFilterContext *avctx = inlink->dst;
+VAAPIVPPContext *ctx   = avctx->priv;
+
+if (ctx->pipeline_uninit)
+ctx->pipeline_uninit(avctx);
+
+if (!inlink->hw_frames_ctx) {
+av_log(avctx, AV_LOG_ERROR, "A hardware frames reference is "
+   "required to associate the processing device.\n");
+return AVERROR(EINVAL);
+}
+
+ctx->input_frames_ref = av_buffer_ref(inlink->hw_frames_ctx);
+if (!ctx->input_frames_ref) {
+av_log(avctx, AV_LOG_ERROR, "A input frames reference create "
+   "failed.\n");
+return AVERROR(ENOMEM);
+}
+ctx->input_frames = (AVHWFramesContext*)ctx->input_frames_ref->data;
+
+return 0;
+}
+
+int ff_vaapi_vpp_config_output(AVFilterLink *outlink)
+{
+AVFilterContext *avctx = outlink->src;
+VAAPIVPPContext *ctx   = avctx->priv;
+AVVAAPIHWConfig *hwconfig = NULL;
+AVHWFramesConstraints *constraints = NULL;
+AVVAAPIFramesContext *va_frames;
+VAStatus vas;
+int err, i;
+
+if (ctx->pipeline_uninit)
+ctx->pipeline_uninit(avctx);
+
+if (!ctx->output_width)
+ctx->output_width  = avctx->inputs[0]->w;
+if (!ctx->output_height)
+ctx->output_height = avctx->inputs[0]->h;
+
+av_assert0(ctx->input_frames);
+ctx->device_ref = av_buffer_ref(ctx->input_frames->device_ref);
+if (!ctx->device_ref) {
+av_log(avctx, AV_LOG_ERROR, "A device reference create "
+   "failed.\n");
+return AVERROR(ENOMEM);
+}
+ctx->hwctx = ((AVHWDeviceContext*)ctx->device_ref->data)->hwctx;
+
+av_assert0(ctx->va_config == VA_INVALID_ID);
+vas = vaCreateConfig(ctx->hwctx->display, VAProfileNone,
+ VAEntrypointVideoProc, NULL, 0, &ctx->va_config);
+if (vas != VA_STATUS_SUCCESS) {
+av_log(avctx, AV_LOG_ERROR, "Failed to create processing pipeline "
+   "config: %d (%s).\n"

[FFmpeg-cvslog] v4l2_m2m: Fix free of the wrong pointer in an error path

2018-01-21 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Sun Jan 21 22:59:29 
2018 +| [bda5ad305e907d6e5eaa6abbb1b3bc1590ec20d8] | committer: Mark 
Thompson

v4l2_m2m: Fix free of the wrong pointer in an error path

Fixes CIDs #1427821 and #1427822.

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

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

diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c
index fd989ce601..427e165f58 100644
--- a/libavcodec/v4l2_m2m.c
+++ b/libavcodec/v4l2_m2m.c
@@ -390,7 +390,7 @@ int ff_v4l2_m2m_create_context(AVCodecContext *avctx, 
V4L2m2mContext **s)
 priv->context_ref = av_buffer_create((uint8_t *) *s, 
sizeof(V4L2m2mContext),
  &v4l2_m2m_destroy_context, NULL, 0);
 if (!priv->context_ref) {
-av_free(s);
+av_freep(s);
 return AVERROR(ENOMEM);
 }
 

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


[FFmpeg-cvslog] lavfi: add ProcAmp (color balance) VAAPI video filter.

2018-01-21 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Jan  8 16:12:41 
2018 +0800| [fcf5eae4bf24dac897da34b95cfe23634b9ac5fa] | committer: Mark 
Thompson

lavfi: add ProcAmp (color balance) VAAPI video filter.

Add ProcAmp(color balance) vaapi video filter, use the option
like -vf "procamp_vaapi=b=10:h=120:c=2.8:s=3.7" to set
brightness/hue/contrast/saturation.

Signed-off-by: Yun Zhou 
Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 Changelog  |   1 +
 configure  |   1 +
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/vf_procamp_vaapi.c | 281 +
 5 files changed, 285 insertions(+)

diff --git a/Changelog b/Changelog
index 61075b3392..c7ecfffbb3 100644
--- a/Changelog
+++ b/Changelog
@@ -38,6 +38,7 @@ version :
 - Removed the ffserver program
 - Removed the ffmenc and ffmdec muxer and demuxer
 - VideoToolbox HEVC encoder and hwaccel
+- VAAPI-accelerated ProcAmp (color balance) filter
 
 
 version 3.4:
diff --git a/configure b/configure
index 5d533621ae..12fb34a202 100755
--- a/configure
+++ b/configure
@@ -3245,6 +3245,7 @@ perspective_filter_deps="gpl"
 phase_filter_deps="gpl"
 pp7_filter_deps="gpl"
 pp_filter_deps="gpl postproc"
+procamp_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
 program_opencl_filter_deps="opencl"
 pullup_filter_deps="gpl"
 removelogo_filter_deps="avcodec avformat swscale"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index bbc97a0831..43d0dd36e6 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -275,6 +275,7 @@ OBJS-$(CONFIG_PP_FILTER) += vf_pp.o
 OBJS-$(CONFIG_PP7_FILTER)+= vf_pp7.o
 OBJS-$(CONFIG_PREMULTIPLY_FILTER)+= vf_premultiply.o framesync.o
 OBJS-$(CONFIG_PREWITT_FILTER)+= vf_convolution.o
+OBJS-$(CONFIG_PROCAMP_VAAPI_FILTER)  += vf_procamp_vaapi.o vaapi_vpp.o
 OBJS-$(CONFIG_PROGRAM_OPENCL_FILTER) += vf_program_opencl.o opencl.o 
framesync.o
 OBJS-$(CONFIG_PSEUDOCOLOR_FILTER)+= vf_pseudocolor.o
 OBJS-$(CONFIG_PSNR_FILTER)   += vf_psnr.o framesync.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 42516bbdf9..63550628e5 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -284,6 +284,7 @@ static void register_all(void)
 REGISTER_FILTER(PP7,pp7,vf);
 REGISTER_FILTER(PREMULTIPLY,premultiply,vf);
 REGISTER_FILTER(PREWITT,prewitt,vf);
+REGISTER_FILTER(PROCAMP_VAAPI,  procamp_vaapi,  vf);
 REGISTER_FILTER(PROGRAM_OPENCL, program_opencl, vf);
 REGISTER_FILTER(PSEUDOCOLOR,pseudocolor,vf);
 REGISTER_FILTER(PSNR,   psnr,   vf);
diff --git a/libavfilter/vf_procamp_vaapi.c b/libavfilter/vf_procamp_vaapi.c
new file mode 100644
index 00..10f9a6ba0c
--- /dev/null
+++ b/libavfilter/vf_procamp_vaapi.c
@@ -0,0 +1,281 @@
+/*
+ * 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/avassert.h"
+#include "libavutil/mem.h"
+#include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
+
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "vaapi_vpp.h"
+
+// ProcAmp Min/Max/Default Values
+#define BRIGHTNESS_MIN -100.0F
+#define BRIGHTNESS_MAX  100.0F
+#define BRIGHTNESS_DEFAULT0.0F
+
+#define CONTRAST_MIN  0.0F
+#define CONTRAST_MAX 10.0F
+#define CONTRAST_DEFAULT  1.0F
+
+#define HUE_MIN-180.0F
+#define HUE_MAX 180.0F
+#define HUE_DEFAULT   0.0F
+
+#define SATURATION_MIN0.0F
+#define SATURATION_MAX   10.0F
+#define SATURATION_DEFAULT1.0F
+
+#define EPSILON   0.1F
+
+typedef struct ProcampVAAPIContext {
+VAAPIVPPContext vpp_ctx; // must be the first fileld
+
+float bright;
+float hue;
+float saturation;
+float contrast;
+} ProcampVAAPIContext;
+
+static float map(float x, float in_min, float in_max, float out_min, float 
out_max)
+{
+double slope, output;
+
+slope = 1.0 * (out_max - out_min) / (in_ma

[FFmpeg-cvslog] avcodec/mpeg12dec: fix preprocessor check for mpeg1_nvdec hwaccel

2018-01-21 Thread James Almer
ffmpeg | branch: master | James Almer  | Sun Jan 21 22:57:41 
2018 -0300| [388a0f7869a852dec51482dc1802239f792775db] | committer: James Almer

avcodec/mpeg12dec: fix preprocessor check for mpeg1_nvdec hwaccel

Signed-off-by: James Almer 

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

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

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index ac5ac4bca4..f5f2c696c0 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -2893,7 +2893,7 @@ AVCodec ff_mpeg1video_decoder = {
 .max_lowres= 3,
 .update_thread_context = 
ONLY_IF_THREADS_ENABLED(mpeg_decode_update_thread_context),
 .hw_configs= (const AVCodecHWConfigInternal*[]) {
-#if CONFIG_MPEG2_NVDEC_HWACCEL
+#if CONFIG_MPEG1_NVDEC_HWACCEL
HWACCEL_NVDEC(mpeg1),
 #endif
 #if CONFIG_MPEG1_VDPAU_HWACCEL

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