[FFmpeg-cvslog] avfilter: add lv2 wrapper filter

2017-11-26 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Nov 23 16:08:42 
2017 +0100| [ffc01280be6316ae625972a0976fef077a3a0b51] | committer: Paul B Mahol

avfilter: add lv2 wrapper filter

Signed-off-by: Paul B Mahol 

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

 Changelog|   1 +
 configure|   4 +
 doc/filters.texi |  59 +
 libavfilter/Makefile |   1 +
 libavfilter/af_lv2.c | 602 +++
 libavfilter/allfilters.c |   1 +
 libavfilter/version.h|   2 +-
 7 files changed, 669 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 0b7e02392d..e3092e211f 100644
--- a/Changelog
+++ b/Changelog
@@ -20,6 +20,7 @@ version :
 - OpenCL overlay filter
 - video mix filter
 - video normalize filter
+- audio lv2 wrapper filter
 
 
 version 3.4:
diff --git a/configure b/configure
index 7769427ffb..0cc97e 100755
--- a/configure
+++ b/configure
@@ -283,6 +283,7 @@ External library support:
   --enable-libzimg enable z.lib, needed for zscale filter [no]
   --enable-libzmq  enable message passing via libzmq [no]
   --enable-libzvbi enable teletext support via libzvbi [no]
+  --enable-lv2 enable LV2 audio filtering [no]
   --disable-lzma   disable lzma [autodetect]
   --enable-decklinkenable Blackmagic DeckLink I/O support [no]
   --enable-libndi_newtek   enable Newteck NDI I/O support [no]
@@ -1631,6 +1632,7 @@ EXTERNAL_LIBRARY_LIST="
 libzimg
 libzmq
 libzvbi
+lv2
 mediacodec
 openal
 opengl
@@ -3229,6 +3231,7 @@ hqdn3d_filter_deps="gpl"
 interlace_filter_deps="gpl"
 kerndeint_filter_deps="gpl"
 ladspa_filter_deps="ladspa libdl"
+lv2_filter_deps="lv2"
 mcdeint_filter_deps="avcodec gpl"
 movie_filter_deps="avcodec avformat"
 mpdecimate_filter_deps="gpl"
@@ -5825,6 +5828,7 @@ enabled gmp   && require gmp gmp.h mpz_export 
-lgmp
 enabled gnutls&& require_pkg_config gnutls gnutls gnutls/gnutls.h 
gnutls_global_init
 enabled jni   && { [ $target_os = "android" ] && check_header 
jni.h && enabled pthreads || die "ERROR: jni not found"; }
 enabled ladspa&& require_header ladspa.h
+enabled lv2   && require_pkg_config lv2 lilv-0 
"lilv-0/lilv/lilv.h" lilv_world_new
 enabled libiec61883   && require libiec61883 libiec61883/iec61883.h 
iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
 enabled libass&& require_pkg_config libass libass ass/ass.h 
ass_library_init
 enabled libbluray && require_pkg_config libbluray libbluray 
libbluray/bluray.h bd_open
diff --git a/doc/filters.texi b/doc/filters.texi
index fda789630b..476f014ac8 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3281,6 +3281,65 @@ lowpass=c=LFE
 @end example
 @end itemize
 
+@section lv2
+
+Load a LV2 (LADSPA Version 2) plugin.
+
+To enable compilation of this filter you need to configure FFmpeg with
+@code{--enable-lv2}.
+
+@table @option
+@item plugin, p
+Specifies the plugin URI. You may need to escape ':'.
+
+@item controls, c
+Set the '|' separated list of controls which are zero or more floating point
+values that determine the behavior of the loaded plugin (for example delay,
+threshold or gain).
+If @option{controls} is set to @code{help}, all available controls and
+their valid ranges are printed.
+
+@item sample_rate, s
+Specify the sample rate, default to 44100. Only used if plugin have
+zero inputs.
+
+@item nb_samples, n
+Set the number of samples per channel per each output frame, default
+is 1024. Only used if plugin have zero inputs.
+
+@item duration, d
+Set the minimum duration of the sourced audio. See
+@ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) 
manual,ffmpeg-utils}
+for the accepted syntax.
+Note that the resulting duration may be greater than the specified duration,
+as the generated audio is always cut at the end of a complete frame.
+If not specified, or the expressed duration is negative, the audio is
+supposed to be generated forever.
+Only used if plugin have zero inputs.
+@end table
+
+@subsection Examples
+
+@itemize
+@item
+Apply bass enhancer plugin from Calf:
+@example
+lv2=p=http://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
+@end example
+
+@item
+Apply bass vinyl plugin from Calf:
+@example
+lv2=p=http://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
+@end example
+
+@item
+Apply bit crusher plugin from ArtyFX:
+@example
+lv2=p=http://www.openavproductions.com/artyfx#bitta:c=crush=0.3
+@end example
+@end itemize
+
 @section mcompand
 Multiband Compress or expand the audio's dynamic range.
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index dd195d2538..0b77d7a01f 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -101,6 +101,7 @@ OBJS-$(CONFIG_JOIN_FILTER)   += af_join.o
 OBJS-$(CONFIG_LADSP

[FFmpeg-cvslog] h264_picture: Actually return error during alloc failure

2017-11-26 Thread Derek Buitenhuis
ffmpeg | branch: master | Derek Buitenhuis  | Fri 
Nov 24 18:21:57 2017 +| [52a44d50beb2ecf77213c9445649dcfd7ef44e92] | 
committer: Derek Buitenhuis

h264_picture: Actually return error during alloc failure

Fixes NULL dereference during alloc failure.

Signed-off-by: Derek Buitenhuis 

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

 libavcodec/h264_picture.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c
index e7dd84bc47..e833835a77 100644
--- a/libavcodec/h264_picture.c
+++ b/libavcodec/h264_picture.c
@@ -78,24 +78,30 @@ int ff_h264_ref_picture(H264Context *h, H264Picture *dst, 
H264Picture *src)
 
 dst->qscale_table_buf = av_buffer_ref(src->qscale_table_buf);
 dst->mb_type_buf  = av_buffer_ref(src->mb_type_buf);
-if (!dst->qscale_table_buf || !dst->mb_type_buf)
+if (!dst->qscale_table_buf || !dst->mb_type_buf) {
+ret = AVERROR(ENOMEM);
 goto fail;
+}
 dst->qscale_table = src->qscale_table;
 dst->mb_type  = src->mb_type;
 
 for (i = 0; i < 2; i++) {
 dst->motion_val_buf[i] = av_buffer_ref(src->motion_val_buf[i]);
 dst->ref_index_buf[i]  = av_buffer_ref(src->ref_index_buf[i]);
-if (!dst->motion_val_buf[i] || !dst->ref_index_buf[i])
+if (!dst->motion_val_buf[i] || !dst->ref_index_buf[i]) {
+ret = AVERROR(ENOMEM);
 goto fail;
+}
 dst->motion_val[i] = src->motion_val[i];
 dst->ref_index[i]  = src->ref_index[i];
 }
 
 if (src->hwaccel_picture_private) {
 dst->hwaccel_priv_buf = av_buffer_ref(src->hwaccel_priv_buf);
-if (!dst->hwaccel_priv_buf)
+if (!dst->hwaccel_priv_buf) {
+ret = AVERROR(ENOMEM);
 goto fail;
+}
 dst->hwaccel_picture_private = dst->hwaccel_priv_buf->data;
 }
 

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


[FFmpeg-cvslog] hwcontext_vaapi: Do not assume that sw_format is transferable

2017-11-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Fri Nov 24 00:21:26 
2017 +| [6e0e3e1d8ddc83984876ed0e534fef42e7870b41] | committer: Mark 
Thompson

hwcontext_vaapi: Do not assume that sw_format is transferable

Drivers can support a format for surfaces without also supporting it for
images, so we can't assume that sw_format is usable for transfer.  This
would previously hit an assert in cases where it isn't.

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

 libavutil/hwcontext_vaapi.c | 21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index fcff25dc9b..29698d1b27 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -627,24 +627,31 @@ static int vaapi_transfer_get_formats(AVHWFramesContext 
*hwfc,
   enum AVPixelFormat **formats)
 {
 VAAPIDeviceContext *ctx = hwfc->device_ctx->internal->priv;
-enum AVPixelFormat *pix_fmts, preferred_format;
-int i, k;
+enum AVPixelFormat *pix_fmts;
+int i, k, sw_format_available;
 
-preferred_format = hwfc->sw_format;
+sw_format_available = 0;
+for (i = 0; i < ctx->nb_formats; i++) {
+if (ctx->formats[i].pix_fmt == hwfc->sw_format)
+sw_format_available = 1;
+}
 
 pix_fmts = av_malloc((ctx->nb_formats + 1) * sizeof(*pix_fmts));
 if (!pix_fmts)
 return AVERROR(ENOMEM);
 
-pix_fmts[0] = preferred_format;
-k = 1;
+if (sw_format_available) {
+pix_fmts[0] = hwfc->sw_format;
+k = 1;
+} else {
+k = 0;
+}
 for (i = 0; i < ctx->nb_formats; i++) {
-if (ctx->formats[i].pix_fmt == preferred_format)
+if (ctx->formats[i].pix_fmt == hwfc->sw_format)
 continue;
 av_assert0(k < ctx->nb_formats);
 pix_fmts[k++] = ctx->formats[i].pix_fmt;
 }
-av_assert0(k == ctx->nb_formats);
 pix_fmts[k] = AV_PIX_FMT_NONE;
 
 *formats = pix_fmts;

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


[FFmpeg-cvslog] nvenc: Include config.h before checking for D3D11 support

2017-11-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Sat Nov 25 23:05:24 
2017 +| [3fbd4fc47621a5ef0a814814ea0c931821ee074e] | committer: Mark 
Thompson

nvenc: Include config.h before checking for D3D11 support

Reviewed-by: Timo Rothenpieler 

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

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

diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index 8c1769e768..2e51f1e946 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -19,6 +19,8 @@
 #ifndef AVCODEC_NVENC_H
 #define AVCODEC_NVENC_H
 
+#include "config.h"
+
 #if CONFIG_D3D11VA
 #define COBJMACROS
 #include "libavutil/hwcontext_d3d11va.h"
@@ -28,8 +30,6 @@ typedef void ID3D11Device;
 
 #include "compat/nvenc/nvEncodeAPI.h"
 
-#include "config.h"
-
 #include "compat/cuda/dynlink_loader.h"
 #include "libavutil/fifo.h"
 #include "libavutil/opt.h"

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


[FFmpeg-cvslog] doc/ffmpeg: Document opencl for -init_hw_device

2017-11-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Sun Nov 26 15:35:27 
2017 +| [37c57df18e7c46436fa791abf40f4c3031ab56f4] | committer: Mark 
Thompson

doc/ffmpeg: Document opencl for -init_hw_device

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

 doc/ffmpeg.texi | 37 +
 1 file changed, 37 insertions(+)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index d767e48c44..ba1e62f06f 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -757,6 +757,43 @@ If not specified, @samp{auto_any} is used.
 platform-appropriate subdevice (@samp{dxva2} or @samp{vaapi}) and then 
deriving a
 QSV device from that.)
 
+@item opencl
+@var{device} selects the platform and device as 
@emph{platform_index.device_index}.
+
+The set of devices can also be filtered using the key-value pairs to find only
+devices matching particular platform or device strings.
+
+The strings usable as filters are:
+@table @option
+@item platform_profile
+@item platform_version
+@item platform_name
+@item platform_vendor
+@item platform_extensions
+@item device_name
+@item device_vendor
+@item driver_version
+@item device_version
+@item device_profile
+@item device_extensions
+@item device_type
+@end table
+
+The indices and filters must together uniquely select a device.
+
+Examples:
+@table @emph
+@item -init_hw_device opencl:0.1
+Choose the second device on the first platform.
+
+@item -init_hw_device opencl:,device_name=Foo9000
+Choose the device with a name containing the string @emph{Foo9000}.
+
+@item -init_hw_device opencl:1,device_type=gpu,device_extensions=cl_khr_fp16
+Choose the GPU device on the second platform supporting the @emph{cl_khr_fp16}
+extension.
+@end table
+
 @end table
 
 @item -init_hw_device @var{type}[=@var{name}]@@@var{source}

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


[FFmpeg-cvslog] doc/fftools: Remove documentation for old -opencl_bench option

2017-11-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Sun Nov 26 10:29:24 
2017 +| [022ddff0b2c2710a368f100cd481831b3649a15e] | committer: Mark 
Thompson

doc/fftools: Remove documentation for old -opencl_bench option

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

 doc/fftools-common-opts.texi | 45 
 1 file changed, 45 deletions(-)

diff --git a/doc/fftools-common-opts.texi b/doc/fftools-common-opts.texi
index 2eff33a36f..185ec218d5 100644
--- a/doc/fftools-common-opts.texi
+++ b/doc/fftools-common-opts.texi
@@ -315,51 +315,6 @@ Possible flags for this option are:
 @item k8
 @end table
 @end table
-
-@item -opencl_bench
-This option is used to benchmark all available OpenCL devices and print the
-results. This option is only available when FFmpeg has been compiled with
-@code{--enable-opencl}.
-
-When FFmpeg is configured with @code{--enable-opencl}, the options for the
-global OpenCL context are set via @option{-opencl_options}. See the
-"OpenCL Options" section in the ffmpeg-utils manual for the complete list of
-supported options. Amongst others, these options include the ability to select
-a specific platform and device to run the OpenCL code on. By default, FFmpeg
-will run on the first device of the first platform. While the options for the
-global OpenCL context provide flexibility to the user in selecting the OpenCL
-device of their choice, most users would probably want to select the fastest
-OpenCL device for their system.
-
-This option assists the selection of the most efficient configuration by
-identifying the appropriate device for the user's system. The built-in
-benchmark is run on all the OpenCL devices and the performance is measured for
-each device. The devices in the results list are sorted based on their
-performance with the fastest device listed first. The user can subsequently
-invoke @command{ffmpeg} using the device deemed most appropriate via
-@option{-opencl_options} to obtain the best performance for the OpenCL
-accelerated code.
-
-Typical usage to use the fastest OpenCL device involve the following steps.
-
-Run the command:
-@example
-ffmpeg -opencl_bench
-@end example
-Note down the platform ID (@var{pidx}) and device ID (@var{didx}) of the first
-i.e. fastest device in the list.
-Select the platform and device using the command:
-@example
-ffmpeg -opencl_options platform_idx=@var{pidx}:device_idx=@var{didx} ...
-@end example
-
-@item -opencl_options options (@emph{global})
-Set OpenCL environment options. This option is only available when
-FFmpeg has been compiled with @code{--enable-opencl}.
-
-@var{options} must be a list of @var{key}=@var{value} option pairs
-separated by ':'. See the ``OpenCL Options'' section in the
-ffmpeg-utils manual for the list of supported options.
 @end table
 
 @section AVOptions

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


[FFmpeg-cvslog] vorbisenc: Check the return value of av_frame_clone

2017-11-26 Thread Derek Buitenhuis
ffmpeg | branch: master | Derek Buitenhuis  | Fri 
Nov 24 19:24:41 2017 +| [e7af1394ecd0e7c237db34ee9c149afff37641dd] | 
committer: Derek Buitenhuis

vorbisenc: Check the return value of av_frame_clone

Prevents a segfault when alloc fails.

Signed-off-by: Derek Buitenhuis 

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

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

diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c
index a4ecd8f754..18a679f2dc 100644
--- a/libavcodec/vorbisenc.c
+++ b/libavcodec/vorbisenc.c
@@ -1093,9 +1093,13 @@ static int vorbis_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 PutBitContext pb;
 
 if (frame) {
+AVFrame *clone;
 if ((ret = ff_af_queue_add(&venc->afq, frame)) < 0)
 return ret;
-ff_bufqueue_add(avctx, &venc->bufqueue, av_frame_clone(frame));
+clone = av_frame_clone(frame);
+if (!clone)
+return AVERROR(ENOMEM);
+ff_bufqueue_add(avctx, &venc->bufqueue, clone);
 } else
 if (!venc->afq.remaining_samples)
 return 0;

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


[FFmpeg-cvslog] avcodec/dirac_dwt: Fix integer overflow in COMPOSE_FIDELITYi*

2017-11-26 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Nov 25 03:15:16 2017 +0100| [2b6964f764382742bb052a1ee3b7167cac35332f] | 
committer: Michael Niedermayer

avcodec/dirac_dwt: Fix integer overflow in COMPOSE_FIDELITYi*

Fixes: runtime error: signed integer overflow: -2143827186 - 7404944 cannot be 
represented in type 'int'
Fixes: 4354/clusterfuzz-testcase-minimized-4671122764201984

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=2b6964f764382742bb052a1ee3b7167cac35332f
---

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

diff --git a/libavcodec/dirac_dwt.h b/libavcodec/dirac_dwt.h
index f9a9e9e1b3..eb5aebc878 100644
--- a/libavcodec/dirac_dwt.h
+++ b/libavcodec/dirac_dwt.h
@@ -111,10 +111,10 @@ void ff_spatial_idwt_slice2(DWTContext *d, int y);
 (b0 + b1)
 
 #define COMPOSE_FIDELITYiL0(b0, b1, b2, b3, b4, b5, b6, b7, b8)\
-(b4 - ((int)(-8*(b0+(unsigned)b8) + 21*(b1+(unsigned)b7) - 
46*(b2+(unsigned)b6) + 161*(b3+(unsigned)b5) + 128) >> 8))
+((unsigned)b4 - ((int)(-8*(b0+(unsigned)b8) + 21*(b1+(unsigned)b7) - 
46*(b2+(unsigned)b6) + 161*(b3+(unsigned)b5) + 128) >> 8))
 
 #define COMPOSE_FIDELITYiH0(b0, b1, b2, b3, b4, b5, b6, b7, b8)\
-(b4 + ((int)(-2*(b0+(unsigned)b8) + 10*(b1+(unsigned)b7) - 
25*(b2+(unsigned)b6) +  81*(b3+(unsigned)b5) + 128) >> 8))
+((unsigned)b4 + ((int)(-2*(b0+(unsigned)b8) + 10*(b1+(unsigned)b7) - 
25*(b2+(unsigned)b6) +  81*(b3+(unsigned)b5) + 128) >> 8))
 
 #define COMPOSE_DAUB97iL1(b0, b1, b2)\
 (b1 - ((int)(1817*(b0 + (unsigned)b2) + 2048) >> 12))

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


[FFmpeg-cvslog] avformat/aacdec: Fix leak in adts_aac_read_packet()

2017-11-26 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Nov 25 19:22:51 2017 +0100| [2779d33ed99898675e0b3884fabe1ce6839f36d1] | 
committer: Michael Niedermayer

avformat/aacdec: Fix leak in adts_aac_read_packet()

Fixes: chromium-773637/clusterfuzz-testcase-minimized-6418078673141760

Found-by: ossfuzz/chromium
Reviewed-by: James Almer 
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c
index 364b33404f..36d558ff54 100644
--- a/libavformat/aacdec.c
+++ b/libavformat/aacdec.c
@@ -139,7 +139,11 @@ static int adts_aac_read_packet(AVFormatContext *s, 
AVPacket *pkt)
 return AVERROR_INVALIDDATA;
 }
 
-return av_append_packet(s->pb, pkt, fsize - ADTS_HEADER_SIZE);
+ret = av_append_packet(s->pb, pkt, fsize - ADTS_HEADER_SIZE);
+if (ret < 0)
+av_packet_unref(pkt);
+
+return ret;
 }
 
 AVInputFormat ff_aac_demuxer = {

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


[FFmpeg-cvslog] lavc: Add codec metadata to indicate hardware support

2017-11-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Thu Oct 26 00:18:39 
2017 +0100| [24cc0a53e99e281b0ff502e82e7cf857111eca3f] | committer: Mark 
Thompson

lavc: Add codec metadata to indicate hardware support

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

 doc/APIchanges   |  3 +++
 libavcodec/avcodec.h | 74 
 libavcodec/hwaccel.h | 18 +
 libavcodec/utils.c   | 12 +
 libavcodec/version.h |  4 +--
 5 files changed, 109 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index fecd57387a..a0c8e709de 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
+2017-11-xx - xxx - lavc 58.4.100 - avcodec.h
+  Add AVCodecHWConfig and avcodec_get_hw_config().
+
 2017-11-22 - 3650cb2dfa - lavu 55.3.100 - opencl.h
   Remove experimental OpenCL API (av_opencl_*).
 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 4cd72b5961..e2dc97d62f 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -36,6 +36,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/dict.h"
 #include "libavutil/frame.h"
+#include "libavutil/hwcontext.h"
 #include "libavutil/log.h"
 #include "libavutil/pixfmt.h"
 #include "libavutil/rational.h"
@@ -3279,6 +3280,61 @@ typedef struct AVProfile {
 const char *name; ///< short name for the profile
 } AVProfile;
 
+enum {
+/**
+ * The codec supports this format via the hw_device_ctx interface.
+ *
+ * When selecting this format, AVCodecContext.hw_device_ctx should
+ * have been set to a device of the specified type before calling
+ * avcodec_open2().
+ */
+AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX = 0x01,
+/**
+ * The codec supports this format via the hw_frames_ctx interface.
+ *
+ * When selecting this format for a decoder,
+ * AVCodecContext.hw_frames_ctx should be set to a suitable frames
+ * context inside the get_format() callback.  The frames context
+ * must have been created on a device of the specified type.
+ */
+AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX = 0x02,
+/**
+ * The codec supports this format by some internal method.
+ *
+ * This format can be selected without any additional configuration -
+ * no device or frames context is required.
+ */
+AV_CODEC_HW_CONFIG_METHOD_INTERNAL  = 0x04,
+/**
+ * The codec supports this format by some ad-hoc method.
+ *
+ * Additional settings and/or function calls are required.  See the
+ * codec-specific documentation for details.  (Methods requiring
+ * this sort of configuration are deprecated and others should be
+ * used in preference.)
+ */
+AV_CODEC_HW_CONFIG_METHOD_AD_HOC= 0x08,
+};
+
+typedef struct AVCodecHWConfig {
+/**
+ * A hardware pixel format which the codec can use.
+ */
+enum AVPixelFormat pix_fmt;
+/**
+ * Bit set of AV_CODEC_HW_CONFIG_METHOD_* flags, describing the possible
+ * setup methods which can be used with this configuration.
+ */
+int methods;
+/**
+ * The device type associated with the configuration.
+ *
+ * Must be set for AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX and
+ * AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX, otherwise unused.
+ */
+enum AVHWDeviceType device_type;
+} AVCodecHWConfig;
+
 typedef struct AVCodecDefault AVCodecDefault;
 
 struct AVSubtitle;
@@ -3404,6 +3460,15 @@ typedef struct AVCodec {
  * packets before decoding.
  */
 const char *bsfs;
+
+/**
+ * Array of pointers to hardware configurations supported by the codec,
+ * or NULL if no hardware supported.  The array is terminated by a NULL
+ * pointer.
+ *
+ * The user can only access this field via avcodec_get_hw_config().
+ */
+const struct AVCodecHWConfigInternal **hw_configs;
 } AVCodec;
 
 #if FF_API_CODEC_GET_SET
@@ -3414,6 +3479,15 @@ int av_codec_get_max_lowres(const AVCodec *codec);
 struct MpegEncContext;
 
 /**
+ * Retrieve supported hardware configurations for a codec.
+ *
+ * Values of index from zero to some maximum return the indexed configuration
+ * descriptor; all other values return NULL.  If the codec does not support
+ * any hardware configurations then it will always return NULL.
+ */
+const AVCodecHWConfig *avcodec_get_hw_config(const AVCodec *codec, int index);
+
+/**
  * @defgroup lavc_hwaccel AVHWAccel
  * @{
  */
diff --git a/libavcodec/hwaccel.h b/libavcodec/hwaccel.h
index 124fbbf1fd..0198c7f858 100644
--- a/libavcodec/hwaccel.h
+++ b/libavcodec/hwaccel.h
@@ -19,6 +19,24 @@
 #ifndef AVCODEC_HWACCEL_H
 #define AVCODEC_HWACCEL_H
 
+#include "avcodec.h"
+
+
 #define HWACCEL_CAP_ASYNC_SAFE  (1 << 0)
 
+
+typedef struct AVCodecHWConfigInternal {
+/**
+ * This is the structure which will be returned to the user by
+   

[FFmpeg-cvslog] vaapi: Add VP8 decode hwaccel

2017-11-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Sat Nov 18 17:55:24 
2017 +| [40b75a943bcb6a4af00c44ef6e52cbfc3e6580d8] | committer: Mark 
Thompson

vaapi: Add VP8 decode hwaccel

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

 configure  |   3 +
 libavcodec/Makefile|   1 +
 libavcodec/hwaccels.h  |   1 +
 libavcodec/vaapi_vp8.c | 237 +
 libavcodec/vp8.c   |   6 ++
 5 files changed, 248 insertions(+)

diff --git a/configure b/configure
index d6cb61fb4c..fbff9c 100755
--- a/configure
+++ b/configure
@@ -2746,6 +2746,8 @@ vc1_vaapi_hwaccel_deps="vaapi"
 vc1_vaapi_hwaccel_select="vc1_decoder"
 vc1_vdpau_hwaccel_deps="vdpau"
 vc1_vdpau_hwaccel_select="vc1_decoder"
+vp8_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferVP8"
+vp8_vaapi_hwaccel_select="vp8_decoder"
 vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
 vp9_d3d11va_hwaccel_select="vp9_decoder"
 vp9_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
@@ -5719,6 +5721,7 @@ check_type "windows.h d3d11.h" "ID3D11VideoContext"
 check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
 
 check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"
+check_type "va/va.h va/va_dec_vp8.h" "VAPictureParameterBufferVP8"
 check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth
 check_type "va/va.h va/va_vpp.h" "VAProcPipelineParameterBuffer"
 check_type "va/va.h va/va_enc_h264.h" "VAEncPictureParameterBufferH264"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 2af957ab72..0ebd2820eb 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -871,6 +871,7 @@ OBJS-$(CONFIG_VC1_NVDEC_HWACCEL)  += nvdec_vc1.o
 OBJS-$(CONFIG_VC1_QSV_HWACCEL)+= qsvdec_other.o
 OBJS-$(CONFIG_VC1_VAAPI_HWACCEL)  += vaapi_vc1.o
 OBJS-$(CONFIG_VC1_VDPAU_HWACCEL)  += vdpau_vc1.o
+OBJS-$(CONFIG_VP8_VAAPI_HWACCEL)  += vaapi_vp8.o
 OBJS-$(CONFIG_VP9_D3D11VA_HWACCEL)+= dxva2_vp9.o
 OBJS-$(CONFIG_VP9_DXVA2_HWACCEL)  += dxva2_vp9.o
 OBJS-$(CONFIG_VP9_NVDEC_HWACCEL)  += nvdec_vp9.o
diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h
index 8a3c29e435..afe7289341 100644
--- a/libavcodec/hwaccels.h
+++ b/libavcodec/hwaccels.h
@@ -59,6 +59,7 @@ extern const AVHWAccel ff_vc1_dxva2_hwaccel;
 extern const AVHWAccel ff_vc1_nvdec_hwaccel;
 extern const AVHWAccel ff_vc1_vaapi_hwaccel;
 extern const AVHWAccel ff_vc1_vdpau_hwaccel;
+extern const AVHWAccel ff_vp8_vaapi_hwaccel;
 extern const AVHWAccel ff_vp9_d3d11va_hwaccel;
 extern const AVHWAccel ff_vp9_d3d11va2_hwaccel;
 extern const AVHWAccel ff_vp9_dxva2_hwaccel;
diff --git a/libavcodec/vaapi_vp8.c b/libavcodec/vaapi_vp8.c
new file mode 100644
index 00..2426b30f13
--- /dev/null
+++ b/libavcodec/vaapi_vp8.c
@@ -0,0 +1,237 @@
+/*
+ * 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 "hwaccel.h"
+#include "vaapi_decode.h"
+#include "vp8.h"
+
+static VASurfaceID vaapi_vp8_surface_id(VP8Frame *vf)
+{
+if (vf)
+return ff_vaapi_get_surface_id(vf->tf.f);
+else
+return VA_INVALID_SURFACE;
+}
+
+static int vaapi_vp8_start_frame(AVCodecContext  *avctx,
+ av_unused const uint8_t *buffer,
+ av_unused uint32_t   size)
+{
+const VP8Context *s = avctx->priv_data;
+VAAPIDecodePicture *pic = 
s->framep[VP56_FRAME_CURRENT]->hwaccel_picture_private;
+VAPictureParameterBufferVP8 pp;
+VAProbabilityDataBufferVP8 prob;
+VAIQMatrixBufferVP8 quant;
+int err, i, j, k;
+
+pic->output_surface = vaapi_vp8_surface_id(s->framep[VP56_FRAME_CURRENT]);
+
+pp = (VAPictureParameterBufferVP8) {
+.frame_width = avctx->width,
+.frame_height= avctx->height,
+
+.last_ref_frame  = 
vaapi_vp8_surface_id(s->framep[VP56_FRAME_PREVIOUS]),
+.golden_ref_frame= 
vaapi_vp8_surface_id(s->framep[VP56_FRAME_GOLDEN]),
+.alt_ref_frame   = 
vaapi_vp8_surface_id(s->framep[VP56_FRAME_GOLDEN2]),
+.out_of_loop_frame   = VA_INVALID

[FFmpeg-cvslog] lavc: Add hardware config metadata for decoders supporting hardware output

2017-11-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Thu Oct 26 00:18:40 
2017 +0100| [758fbc54fef2f31957b5c5f22e05e5fd9b04f631] | committer: Mark 
Thompson

lavc: Add hardware config metadata for decoders supporting hardware output

This includes a pointer to the associated hwaccel for decoders using
hwaccels - these will be used later to implement the hwaccel setup
without needing a global list.

Also added is a new file listing all hwaccels as external declarations -
this will be used later to generate the hwaccel list at configure time.

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

 libavcodec/cuviddec.c  | 15 ++
 libavcodec/h263dec.c   | 13 
 libavcodec/h264dec.c   | 25 
 libavcodec/hevcdec.c   | 25 
 libavcodec/hwaccel.h   | 52 
 libavcodec/hwaccels.h  | 74 ++
 libavcodec/mediacodecdec.c | 18 +++
 libavcodec/mmaldec.c   |  7 +
 libavcodec/mpeg12dec.c | 45 +++-
 libavcodec/mpeg4videodec.c | 16 ++
 libavcodec/qsvdec.c| 13 
 libavcodec/qsvdec.h|  3 ++
 libavcodec/qsvdec_h2645.c  |  2 ++
 libavcodec/qsvdec_other.c  |  3 ++
 libavcodec/vc1dec.c| 43 +++
 libavcodec/vp9.c   | 19 
 16 files changed, 372 insertions(+), 1 deletion(-)

diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
index 806dab2074..3bd2409ea2 100644
--- a/libavcodec/cuviddec.c
+++ b/libavcodec/cuviddec.c
@@ -32,6 +32,7 @@
 
 #include "avcodec.h"
 #include "decode.h"
+#include "hwaccel.h"
 #include "internal.h"
 
 typedef struct CuvidContext
@@ -1094,6 +1095,19 @@ static const AVOption options[] = {
 { NULL }
 };
 
+static const AVCodecHWConfigInternal *cuvid_hw_configs[] = {
+&(const AVCodecHWConfigInternal) {
+.public = {
+.pix_fmt = AV_PIX_FMT_CUDA,
+.methods = AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX |
+   AV_CODEC_HW_CONFIG_METHOD_INTERNAL,
+.device_type = AV_HWDEVICE_TYPE_CUDA
+},
+.hwaccel = NULL,
+},
+NULL
+};
+
 #define DEFINE_CUVID_CODEC(x, X) \
 static const AVClass x##_cuvid_class = { \
 .class_name = #x "_cuvid", \
@@ -1127,6 +1141,7 @@ static const AVOption options[] = {
 AV_PIX_FMT_P010, \
 AV_PIX_FMT_P016, \
 AV_PIX_FMT_NONE }, \
+.hw_configs = cuvid_hw_configs, \
 };
 
 #if CONFIG_HEVC_CUVID_DECODER
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index b222de793b..5608b63245 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -33,6 +33,7 @@
 #include "flv.h"
 #include "h263.h"
 #include "h263_parser.h"
+#include "hwaccel.h"
 #include "internal.h"
 #include "mpeg_er.h"
 #include "mpeg4video.h"
@@ -759,4 +760,16 @@ AVCodec ff_h263p_decoder = {
 .flush  = ff_mpeg_flush,
 .max_lowres = 3,
 .pix_fmts   = ff_h263_hwaccel_pixfmt_list_420,
+.hw_configs = (const AVCodecHWConfigInternal*[]) {
+#if CONFIG_H263_VAAPI_HWACCEL
+HWACCEL_VAAPI(h263),
+#endif
+#if CONFIG_MPEG4_VDPAU_HWACCEL
+HWACCEL_VDPAU(mpeg4),
+#endif
+#if CONFIG_H263_VIDEOTOOLBOX_HWACCEL
+HWACCEL_VIDEOTOOLBOX(h263),
+#endif
+NULL
+},
 };
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index be187eb5f4..b03024d4a3 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -47,6 +47,7 @@
 #include "h264_mvpred.h"
 #include "h264_ps.h"
 #include "golomb.h"
+#include "hwaccel.h"
 #include "mathops.h"
 #include "me_cmp.h"
 #include "mpegutils.h"
@@ -1059,6 +1060,30 @@ AVCodec ff_h264_decoder = {
 .capabilities  = /*AV_CODEC_CAP_DRAW_HORIZ_BAND |*/ 
AV_CODEC_CAP_DR1 |
  AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS |
  AV_CODEC_CAP_FRAME_THREADS,
+.hw_configs= (const AVCodecHWConfigInternal*[]) {
+#if CONFIG_H264_DXVA2_HWACCEL
+   HWACCEL_DXVA2(h264),
+#endif
+#if CONFIG_H264_D3D11VA_HWACCEL
+   HWACCEL_D3D11VA(h264),
+#endif
+#if CONFIG_H264_D3D11VA2_HWACCEL
+   HWACCEL_D3D11VA2(h264),
+#endif
+#if CONFIG_H264_NVDEC_HWACCEL
+   HWACCEL_NVDEC(h264),
+#endif
+#if CONFIG_H264_VAAPI_HWACCEL
+   HWACCEL_VAAPI(h264),
+#endif
+#if CONFIG_H264_VDPAU_HWACCEL
+   HWACCEL_VDPAU(h264),
+#endif
+#if CONFIG_H264_VIDEOTOOLBOX_HWACCEL
+   HWACCEL_VIDEOTOOLBOX(h264),
+#endif
+  

[FFmpeg-cvslog] vaapi: Make the decode profile matching more explicit

2017-11-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Thu Nov  9 01:04:44 
2017 +| [efd0612fdcb7490ed371899f532d73ef8bb7cba0] | committer: Mark 
Thompson

vaapi: Make the decode profile matching more explicit

Also fixes a bug where it could attempt to decode with an unsupported
codec if allow-profile-mismatch was set.

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

 libavcodec/vaapi_decode.c | 20 +---
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
index d467bed874..d36ef906a2 100644
--- a/libavcodec/vaapi_decode.c
+++ b/libavcodec/vaapi_decode.c
@@ -287,8 +287,8 @@ static int vaapi_decode_make_config(AVCodecContext *avctx,
 VAStatus vas;
 int err, i, j;
 const AVCodecDescriptor *codec_desc;
-VAProfile profile, va_profile, *profile_list = NULL;
-int profile_count, exact_match, alt_profile;
+VAProfile *profile_list = NULL, matched_va_profile;
+int profile_count, exact_match, matched_ff_profile;
 const AVPixFmtDescriptor *sw_desc, *desc;
 
 AVHWDeviceContext*device = (AVHWDeviceContext*)device_ref->data;
@@ -317,7 +317,7 @@ static int vaapi_decode_make_config(AVCodecContext *avctx,
 goto fail;
 }
 
-profile = VAProfileNone;
+matched_va_profile = VAProfileNone;
 exact_match = 0;
 
 for (i = 0; i < FF_ARRAY_ELEMS(vaapi_profile_map); i++) {
@@ -326,23 +326,22 @@ static int vaapi_decode_make_config(AVCodecContext *avctx,
 continue;
 if (avctx->profile == vaapi_profile_map[i].codec_profile)
 profile_match = 1;
-profile = vaapi_profile_map[i].va_profile;
 for (j = 0; j < profile_count; j++) {
-if (profile == profile_list[j]) {
+if (vaapi_profile_map[i].va_profile == profile_list[j]) {
 exact_match = profile_match;
 break;
 }
 }
 if (j < profile_count) {
+matched_va_profile = vaapi_profile_map[i].va_profile;
+matched_ff_profile = vaapi_profile_map[i].codec_profile;
 if (exact_match)
 break;
-alt_profile = vaapi_profile_map[i].codec_profile;
-va_profile = vaapi_profile_map[i].va_profile;
 }
 }
 av_freep(&profile_list);
 
-if (profile == VAProfileNone) {
+if (matched_va_profile == VAProfileNone) {
 av_log(avctx, AV_LOG_ERROR, "No support for codec %s "
"profile %d.\n", codec_desc->name, avctx->profile);
 err = AVERROR(ENOSYS);
@@ -356,8 +355,7 @@ static int vaapi_decode_make_config(AVCodecContext *avctx,
codec_desc->name, avctx->profile);
 av_log(avctx, AV_LOG_WARNING, "Using possibly-"
"incompatible profile %d instead.\n",
-   alt_profile);
-profile = va_profile;
+   matched_ff_profile);
 } else {
 av_log(avctx, AV_LOG_VERBOSE, "Codec %s profile %d not "
"supported for hardware decode.\n",
@@ -367,7 +365,7 @@ static int vaapi_decode_make_config(AVCodecContext *avctx,
 }
 }
 
-vas = vaCreateConfig(hwctx->display, profile,
+vas = vaCreateConfig(hwctx->display, matched_va_profile,
  VAEntrypointVLD, NULL, 0,
  va_config);
 if (vas != VA_STATUS_SUCCESS) {

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


[FFmpeg-cvslog] lavc: Deprecate av_hwaccel_next() and av_register_hwaccel()

2017-11-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Thu Oct 26 00:18:44 
2017 +0100| [3536a3efb9fde88d34d526a51b1080247326cd6e] | committer: Mark 
Thompson

lavc: Deprecate av_hwaccel_next() and av_register_hwaccel()

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

 doc/APIchanges   |  4 
 libavcodec/avcodec.h | 14 +-
 libavcodec/utils.c   | 16 +---
 libavcodec/version.h |  5 -
 4 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index a0c8e709de..457a76971b 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
+2017-11-xx - xxx - lavc 58.5.100 - avcodec.h
+  Deprecate user visibility of the AVHWAccel structure and the functions
+  av_register_hwaccel() and av_hwaccel_next().
+
 2017-11-xx - xxx - lavc 58.4.100 - avcodec.h
   Add AVCodecHWConfig and avcodec_get_hw_config().
 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index a78c69a708..1ae0344bb2 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3489,6 +3489,10 @@ const AVCodecHWConfig *avcodec_get_hw_config(const 
AVCodec *codec, int index);
 
 /**
  * @defgroup lavc_hwaccel AVHWAccel
+ *
+ * @note  Nothing in this structure should be accessed by the user.  At some
+ *point in future it will not be externally visible at all.
+ *
  * @{
  */
 typedef struct AVHWAccel {
@@ -3533,7 +3537,6 @@ typedef struct AVHWAccel {
  * New public fields should be added right above.
  *
  */
-struct AVHWAccel *next;
 
 /**
  * Allocate a custom buffer
@@ -5874,17 +5877,26 @@ void av_fast_padded_mallocz(void *ptr, unsigned int 
*size, size_t min_size);
  */
 unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
 
+#if FF_API_USER_VISIBLE_AVHWACCEL
 /**
  * Register the hardware accelerator hwaccel.
+ *
+ * @deprecated  This function doesn't do anything.
  */
+attribute_deprecated
 void av_register_hwaccel(AVHWAccel *hwaccel);
 
 /**
  * If hwaccel is NULL, returns the first registered hardware accelerator,
  * if hwaccel is non-NULL, returns the next registered hardware accelerator
  * after hwaccel, or NULL if hwaccel is the last one.
+ *
+ * @deprecated  AVHWaccel structures contain no user-serviceable parts, so
+ *  this function should not be used.
  */
+attribute_deprecated
 AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel);
+#endif
 
 
 /**
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 2a09ed4930..baf09119fe 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1898,22 +1898,16 @@ const AVCodecHWConfig *avcodec_get_hw_config(const 
AVCodec *codec, int index)
 return &codec->hw_configs[index]->public;
 }
 
-static AVHWAccel *first_hwaccel = NULL;
-static AVHWAccel **last_hwaccel = &first_hwaccel;
-
-void av_register_hwaccel(AVHWAccel *hwaccel)
+#if FF_API_USER_VISIBLE_AVHWACCEL
+AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel)
 {
-AVHWAccel **p = last_hwaccel;
-hwaccel->next = NULL;
-while(*p || avpriv_atomic_ptr_cas((void * volatile *)p, NULL, hwaccel))
-p = &(*p)->next;
-last_hwaccel = &hwaccel->next;
+return NULL;
 }
 
-AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel)
+void av_register_hwaccel(AVHWAccel *hwaccel)
 {
-return hwaccel ? hwaccel->next : first_hwaccel;
 }
+#endif
 
 int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op))
 {
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 8847737f37..ddab7c47a7 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  58
-#define LIBAVCODEC_VERSION_MINOR   4
+#define LIBAVCODEC_VERSION_MINOR   5
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@@ -123,6 +123,9 @@
 #ifndef FF_API_CODEC_GET_SET
 #define FF_API_CODEC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 59)
 #endif
+#ifndef FF_API_USER_VISIBLE_AVHWACCEL
+#define FF_API_USER_VISIBLE_AVHWACCEL (LIBAVCODEC_VERSION_MAJOR < 59)
+#endif
 
 
 #endif /* AVCODEC_VERSION_H */

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


[FFmpeg-cvslog] lavc: Use hardware config information in ff_get_format()

2017-11-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Thu Oct 26 00:18:43 
2017 +0100| [67e81d79ccfc6713c797ddb19a3b8aea476c947b] | committer: Mark 
Thompson

lavc: Use hardware config information in ff_get_format()

This removes the dependency that hardware pixel formats previously had on
AVHWAccel instances, meaning only those which actually do something need
exist after this patch.

Also updates avcodec_default_get_format() to be able to choose hardware
formats if either a matching device has been supplied or no additional
external configuration is required, and avcodec_get_hw_frames_parameters()
to use the hardware config rather than searching the old hwaccel list.

The FF_CODEC_CAP_HWACCEL_REQUIRE_CLASS mechanism is deleted because it
no longer does anything (the codec already contains the pointers to the
matching hwaccels).

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

 libavcodec/avcodec.h  |   7 --
 libavcodec/cuviddec.c |   2 -
 libavcodec/decode.c   | 285 --
 libavcodec/internal.h |  11 +-
 4 files changed, 211 insertions(+), 94 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index e2dc97d62f..a78c69a708 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3652,13 +3652,6 @@ typedef struct AVHWAccel {
  * that avctx->hwaccel_priv_data is invalid.
  */
 int (*frame_params)(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx);
-
-/**
- * Some hwaccels are ambiguous if only the id and pix_fmt fields are used.
- * If non-NULL, the associated AVCodec must have
- * FF_CODEC_CAP_HWACCEL_REQUIRE_CLASS set.
- */
-const AVClass *decoder_class;
 } AVHWAccel;
 
 /**
diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
index 3bd2409ea2..33e9140f89 100644
--- a/libavcodec/cuviddec.c
+++ b/libavcodec/cuviddec.c
@@ -1120,7 +1120,6 @@ static const AVCodecHWConfigInternal *cuvid_hw_configs[] 
= {
 .type   = AVMEDIA_TYPE_VIDEO, \
 .id = AV_CODEC_ID_##X, \
 .pix_fmt= AV_PIX_FMT_CUDA, \
-.decoder_class  = &x##_cuvid_class, \
 }; \
 AVCodec ff_##x##_cuvid_decoder = { \
 .name   = #x "_cuvid", \
@@ -1135,7 +1134,6 @@ static const AVCodecHWConfigInternal *cuvid_hw_configs[] 
= {
 .receive_frame  = cuvid_output_frame, \
 .flush  = cuvid_flush, \
 .capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING, \
-.caps_internal  = FF_CODEC_CAP_HWACCEL_REQUIRE_CLASS, \
 .pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_CUDA, \
 AV_PIX_FMT_NV12, \
 AV_PIX_FMT_P010, \
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index a7f1e23fc2..f2a23735ac 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -40,6 +40,7 @@
 #include "avcodec.h"
 #include "bytestream.h"
 #include "decode.h"
+#include "hwaccel.h"
 #include "internal.h"
 #include "thread.h"
 
@@ -1077,33 +1078,67 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, 
AVSubtitle *sub,
 return ret;
 }
 
-static int is_hwaccel_pix_fmt(enum AVPixelFormat pix_fmt)
+enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *avctx,
+  const enum AVPixelFormat *fmt)
 {
-const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
-return desc->flags & AV_PIX_FMT_FLAG_HWACCEL;
-}
-
-enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const 
enum AVPixelFormat *fmt)
-{
-while (*fmt != AV_PIX_FMT_NONE && is_hwaccel_pix_fmt(*fmt))
-++fmt;
-return fmt[0];
-}
-
-static AVHWAccel *find_hwaccel(AVCodecContext *avctx,
-   enum AVPixelFormat pix_fmt)
-{
-AVHWAccel *hwaccel = NULL;
-const AVClass *av_class =
-(avctx->codec->caps_internal & FF_CODEC_CAP_HWACCEL_REQUIRE_CLASS)
-? avctx->codec->priv_class : NULL;
-
-while ((hwaccel = av_hwaccel_next(hwaccel))) {
-if (hwaccel->decoder_class == av_class && hwaccel->id == 
avctx->codec_id
-&& hwaccel->pix_fmt == pix_fmt)
-return hwaccel;
+const AVPixFmtDescriptor *desc;
+const AVCodecHWConfig *config;
+int i, n;
+
+// If a device was supplied when the codec was opened, assume that the
+// user wants to use it.
+if (avctx->hw_device_ctx && avctx->codec->hw_configs) {
+AVHWDeviceContext *device_ctx =
+(AVHWDeviceContext*)avctx->hw_device_ctx->data;
+for (i = 0;; i++) {
+config = &avctx->codec->hw_configs[i]->public;
+if (!config)
+break;
+if (!(config->methods &
+  AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX))
+continue;
+if (device_ctx->type != config->device_type)
+

[FFmpeg-cvslog] vp8: Add hwaccel hooks

2017-11-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Sat Nov 18 17:55:18 
2017 +| [9f00fa536938130e3c7ad2640a61795770d419a1] | committer: Mark 
Thompson

vp8: Add hwaccel hooks

Also adds some extra fields to the main context structure that may
be needed by a hwaccel decoder.

The current behaviour of the WebP decoder is maintained by adding an
additional field to the VP8 decoder private context to indicate that
it is actually being used as WebP (no hwaccel is supported for that
case).

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

 libavcodec/vp8.c  | 206 --
 libavcodec/vp8.h  |  33 +
 libavcodec/webp.c |   1 +
 3 files changed, 172 insertions(+), 68 deletions(-)

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 7841a9d964..31cd6a0d81 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -27,6 +27,7 @@
 #include "libavutil/imgutils.h"
 
 #include "avcodec.h"
+#include "hwaccel.h"
 #include "internal.h"
 #include "mathops.h"
 #include "rectangle.h"
@@ -72,16 +73,30 @@ static int vp8_alloc_frame(VP8Context *s, VP8Frame *f, int 
ref)
 if ((ret = ff_thread_get_buffer(s->avctx, &f->tf,
 ref ? AV_GET_BUFFER_FLAG_REF : 0)) < 0)
 return ret;
-if (!(f->seg_map = av_buffer_allocz(s->mb_width * s->mb_height))) {
-ff_thread_release_buffer(s->avctx, &f->tf);
-return AVERROR(ENOMEM);
+if (!(f->seg_map = av_buffer_allocz(s->mb_width * s->mb_height)))
+goto fail;
+if (s->avctx->hwaccel) {
+const AVHWAccel *hwaccel = s->avctx->hwaccel;
+if (hwaccel->frame_priv_data_size) {
+f->hwaccel_priv_buf = 
av_buffer_allocz(hwaccel->frame_priv_data_size);
+if (!f->hwaccel_priv_buf)
+goto fail;
+f->hwaccel_picture_private = f->hwaccel_priv_buf->data;
+}
 }
 return 0;
+
+fail:
+av_buffer_unref(&f->seg_map);
+ff_thread_release_buffer(s->avctx, &f->tf);
+return AVERROR(ENOMEM);
 }
 
 static void vp8_release_frame(VP8Context *s, VP8Frame *f)
 {
 av_buffer_unref(&f->seg_map);
+av_buffer_unref(&f->hwaccel_priv_buf);
+f->hwaccel_picture_private = NULL;
 ff_thread_release_buffer(s->avctx, &f->tf);
 }
 
@@ -99,6 +114,12 @@ static int vp8_ref_frame(VP8Context *s, VP8Frame *dst, 
VP8Frame *src)
 vp8_release_frame(s, dst);
 return AVERROR(ENOMEM);
 }
+if (src->hwaccel_picture_private) {
+dst->hwaccel_priv_buf = av_buffer_ref(src->hwaccel_priv_buf);
+if (!dst->hwaccel_priv_buf)
+return AVERROR(ENOMEM);
+dst->hwaccel_picture_private = dst->hwaccel_priv_buf->data;
+}
 
 return 0;
 }
@@ -140,7 +161,7 @@ static VP8Frame *vp8_find_free_buffer(VP8Context *s)
 av_log(s->avctx, AV_LOG_FATAL, "Ran out of free frames!\n");
 abort();
 }
-if (frame->tf.f->data[0])
+if (frame->tf.f->buf[0])
 vp8_release_frame(s, frame);
 
 return frame;
@@ -218,8 +239,9 @@ static void parse_segment_info(VP8Context *s)
 int i;
 
 s->segmentation.update_map = vp8_rac_get(c);
+s->segmentation.update_feature_data = vp8_rac_get(c);
 
-if (vp8_rac_get(c)) { // update segment feature data
+if (s->segmentation.update_feature_data) {
 s->segmentation.absolute_vals = vp8_rac_get(c);
 
 for (i = 0; i < 4; i++)
@@ -274,6 +296,7 @@ static int setup_partitions(VP8Context *s, const uint8_t 
*buf, int buf_size)
 int size = AV_RL24(sizes + 3 * i);
 if (buf_size - size < 0)
 return -1;
+s->coeff_partition_size[i] = size;
 
 ret = ff_vp56_init_range_decoder(&s->coeff_partition[i], buf, size);
 if (ret < 0)
@@ -281,7 +304,11 @@ static int setup_partitions(VP8Context *s, const uint8_t 
*buf, int buf_size)
 buf  += size;
 buf_size -= size;
 }
-return ff_vp56_init_range_decoder(&s->coeff_partition[i], buf, buf_size);
+
+s->coeff_partition_size[i] = buf_size;
+ff_vp56_init_range_decoder(&s->coeff_partition[i], buf, buf_size);
+
+return 0;
 }
 
 static void vp7_get_quants(VP8Context *s)
@@ -308,28 +335,28 @@ static void vp8_get_quants(VP8Context *s)
 VP56RangeCoder *c = &s->c;
 int i, base_qi;
 
-int yac_qi = vp8_rac_get_uint(c, 7);
-int ydc_delta  = vp8_rac_get_sint(c, 4);
-int y2dc_delta = vp8_rac_get_sint(c, 4);
-int y2ac_delta = vp8_rac_get_sint(c, 4);
-int uvdc_delta = vp8_rac_get_sint(c, 4);
-int uvac_delta = vp8_rac_get_sint(c, 4);
+s->quant.yac_qi = vp8_rac_get_uint(c, 7);
+s->quant.ydc_delta  = vp8_rac_get_sint(c, 4);
+s->quant.y2dc_delta = vp8_rac_get_sint(c, 4);
+s->quant.y2ac_delta = vp8_rac_get_sint(c, 4);
+s->quant.uvdc_delta = vp8_rac_get_sint(c, 4);
+s->quant.uvac_delta = vp8_rac_get_sint(c, 4);
 
 for (i = 0; i < 4; i++) {
 if (s->segmentation.enabled) {
   

[FFmpeg-cvslog] lavc: Remove register mechanism for hwaccels

2017-11-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Thu Oct 26 00:18:45 
2017 +0100| [9bd326ac465db2eee47301a1225d55dffd7bfe93] | committer: Mark 
Thompson

lavc: Remove register mechanism for hwaccels

There is no longer any need for a list of them at runtime, because
decoders now carry the pointers to their associated hwaccels internally.
The file containing external declarations is now used to make the list
of hwaccels for configure.

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

 configure  |  2 +-
 libavcodec/allcodecs.c | 82 --
 2 files changed, 1 insertion(+), 83 deletions(-)

diff --git a/configure b/configure
index 0cc97e..461f2e66aa 100755
--- a/configure
+++ b/configure
@@ -3527,7 +3527,6 @@ find_things(){
 
 ENCODER_LIST=$(find_things  encoder  ENC  libavcodec/allcodecs.c)
 DECODER_LIST=$(find_things  decoder  DEC  libavcodec/allcodecs.c)
-HWACCEL_LIST=$(find_things  hwaccel  HWACCEL  libavcodec/allcodecs.c)
 PARSER_LIST=$(find_things   parser   PARSER   libavcodec/allcodecs.c)
 MUXER_LIST=$(find_thingsmuxer_MUX libavformat/allformats.c)
 DEMUXER_LIST=$(find_things  demuxer  DEMUXlibavformat/allformats.c)
@@ -3543,6 +3542,7 @@ find_things_extern(){
 }
 
 BSF_LIST=$(find_things_extern bsf AVBitStreamFilter 
libavcodec/bitstream_filters.c)
+HWACCEL_LIST=$(find_things_extern hwaccel AVHWAccel libavcodec/hwaccels.h)
 PROTOCOL_LIST=$(find_things_extern protocol URLProtocol 
libavformat/protocols.c)
 
 AVCODEC_COMPONENTS_LIST="
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 85c38c83aa..4a21687b20 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -29,13 +29,6 @@
 #include "avcodec.h"
 #include "version.h"
 
-#define REGISTER_HWACCEL(X, x)  \
-{   \
-extern AVHWAccel ff_##x##_hwaccel;  \
-if (CONFIG_##X##_HWACCEL)   \
-av_register_hwaccel(&ff_##x##_hwaccel); \
-}
-
 #define REGISTER_ENCODER(X, x)  \
 {   \
 extern AVCodec ff_##x##_encoder;\
@@ -61,81 +54,6 @@
 
 static void register_all(void)
 {
-/* hardware accelerators */
-REGISTER_HWACCEL(H263_VAAPI,h263_vaapi);
-REGISTER_HWACCEL(H263_VIDEOTOOLBOX, h263_videotoolbox);
-REGISTER_HWACCEL(H264_CUVID,h264_cuvid);
-REGISTER_HWACCEL(H264_D3D11VA,  h264_d3d11va);
-REGISTER_HWACCEL(H264_D3D11VA2, h264_d3d11va2);
-REGISTER_HWACCEL(H264_DXVA2,h264_dxva2);
-REGISTER_HWACCEL(H264_MEDIACODEC,   h264_mediacodec);
-REGISTER_HWACCEL(H264_MMAL, h264_mmal);
-REGISTER_HWACCEL(H264_NVDEC,h264_nvdec);
-REGISTER_HWACCEL(H264_QSV,  h264_qsv);
-REGISTER_HWACCEL(H264_VAAPI,h264_vaapi);
-REGISTER_HWACCEL(H264_VDPAU,h264_vdpau);
-REGISTER_HWACCEL(H264_VIDEOTOOLBOX, h264_videotoolbox);
-REGISTER_HWACCEL(HEVC_CUVID,hevc_cuvid);
-REGISTER_HWACCEL(HEVC_D3D11VA,  hevc_d3d11va);
-REGISTER_HWACCEL(HEVC_D3D11VA2, hevc_d3d11va2);
-REGISTER_HWACCEL(HEVC_DXVA2,hevc_dxva2);
-REGISTER_HWACCEL(HEVC_NVDEC,hevc_nvdec);
-REGISTER_HWACCEL(HEVC_MEDIACODEC,   hevc_mediacodec);
-REGISTER_HWACCEL(HEVC_QSV,  hevc_qsv);
-REGISTER_HWACCEL(HEVC_VAAPI,hevc_vaapi);
-REGISTER_HWACCEL(HEVC_VDPAU,hevc_vdpau);
-REGISTER_HWACCEL(HEVC_VIDEOTOOLBOX, hevc_videotoolbox);
-REGISTER_HWACCEL(MJPEG_CUVID,   mjpeg_cuvid);
-REGISTER_HWACCEL(MPEG1_CUVID,   mpeg1_cuvid);
-REGISTER_HWACCEL(MPEG1_NVDEC,   mpeg1_nvdec);
-REGISTER_HWACCEL(MPEG1_XVMC,mpeg1_xvmc);
-REGISTER_HWACCEL(MPEG1_VDPAU,   mpeg1_vdpau);
-REGISTER_HWACCEL(MPEG1_VIDEOTOOLBOX, mpeg1_videotoolbox);
-REGISTER_HWACCEL(MPEG2_CUVID,   mpeg2_cuvid);
-REGISTER_HWACCEL(MPEG2_XVMC,mpeg2_xvmc);
-REGISTER_HWACCEL(MPEG2_D3D11VA, mpeg2_d3d11va);
-REGISTER_HWACCEL(MPEG2_D3D11VA2,mpeg2_d3d11va2);
-REGISTER_HWACCEL(MPEG2_DXVA2,   mpeg2_dxva2);
-REGISTER_HWACCEL(MPEG2_MMAL,mpeg2_mmal);
-REGISTER_HWACCEL(MPEG2_NVDEC,   mpeg2_nvdec);
-REGISTER_HWACCEL(MPEG2_QSV, mpeg2_qsv);
-REGISTER_HWACCEL(MPEG2_VAAPI,   mpeg2_vaapi);
-REGISTER_HWACCEL(MPEG2_VDPAU,   mpeg2_vdpau);
-REGISTER_HWACCEL(MPEG2_VIDEOTOOLBOX, mpeg2_videotoolbox);
-REGISTER_HWACCEL(MPEG2_MEDIACODEC,  mpeg2_mediacodec);
-REGISTER_HWACCEL(MPEG4_CUVID,   mpeg4_cuvid);
-REGISTER_HWACCEL(MPEG4_MEDIACODEC,  mpeg4_mediacodec);
-REGISTER_HWACCEL(MPEG4_MMAL,mpeg4_mmal);
-REGISTER_HWACCEL(MPEG

[FFmpeg-cvslog] lavc: Mark all AVHWAccel structures as const

2017-11-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Sat Nov  4 18:53:26 
2017 +| [3a71bcc213f223428622ac3750fe1a923f2f3ab4] | committer: Mark 
Thompson

lavc: Mark all AVHWAccel structures as const

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

 doc/APIchanges  |  3 ++
 libavcodec/avcodec.h|  2 +-
 libavcodec/decode.c |  2 +-
 libavcodec/dxva2_h264.c |  6 +--
 libavcodec/dxva2_hevc.c |  6 +--
 libavcodec/dxva2_mpeg2.c|  6 +--
 libavcodec/dxva2_vc1.c  | 12 +++---
 libavcodec/dxva2_vp9.c  |  6 +--
 libavcodec/hwaccels.h   | 98 ++---
 libavcodec/mpegvideo_xvmc.c |  4 +-
 libavcodec/nvdec_h264.c |  2 +-
 libavcodec/nvdec_hevc.c |  2 +-
 libavcodec/nvdec_mpeg12.c   |  4 +-
 libavcodec/nvdec_mpeg4.c|  2 +-
 libavcodec/nvdec_vc1.c  |  4 +-
 libavcodec/nvdec_vp9.c  |  2 +-
 libavcodec/vaapi_h264.c |  2 +-
 libavcodec/vaapi_hevc.c |  2 +-
 libavcodec/vaapi_mpeg2.c|  2 +-
 libavcodec/vaapi_mpeg4.c|  4 +-
 libavcodec/vaapi_vc1.c  |  4 +-
 libavcodec/vaapi_vp9.c  |  2 +-
 libavcodec/vdpau_h264.c |  2 +-
 libavcodec/vdpau_hevc.c |  2 +-
 libavcodec/vdpau_mpeg12.c   |  4 +-
 libavcodec/vdpau_mpeg4.c|  2 +-
 libavcodec/vdpau_vc1.c  |  4 +-
 libavcodec/version.h|  2 +-
 libavcodec/videotoolbox.c   | 12 +++---
 29 files changed, 104 insertions(+), 101 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 457a76971b..44a740e51f 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
+2017-xx-xx - xxx - lavc 58.6.100 - avcodec.h
+  Add const to AVCodecContext.hwaccel.
+
 2017-11-xx - xxx - lavc 58.5.100 - avcodec.h
   Deprecate user visibility of the AVHWAccel structure and the functions
   av_register_hwaccel() and av_hwaccel_next().
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 1ae0344bb2..0972df0bde 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2635,7 +2635,7 @@ typedef struct AVCodecContext {
  * - encoding: unused.
  * - decoding: Set by libavcodec
  */
-struct AVHWAccel *hwaccel;
+const struct AVHWAccel *hwaccel;
 
 /**
  * Hardware accelerator context.
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index f2a23735ac..3f5b086f7e 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1252,7 +1252,7 @@ static int hwaccel_init(AVCodecContext *avctx,
 return AVERROR(ENOMEM);
 }
 
-avctx->hwaccel = (AVHWAccel*)hwaccel;
+avctx->hwaccel = hwaccel;
 if (hwaccel->init) {
 err = hwaccel->init(avctx);
 if (err < 0) {
diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
index ee35b20e82..a4278c80b5 100644
--- a/libavcodec/dxva2_h264.c
+++ b/libavcodec/dxva2_h264.c
@@ -518,7 +518,7 @@ static int dxva2_h264_end_frame(AVCodecContext *avctx)
 }
 
 #if CONFIG_H264_DXVA2_HWACCEL
-AVHWAccel ff_h264_dxva2_hwaccel = {
+const AVHWAccel ff_h264_dxva2_hwaccel = {
 .name   = "h264_dxva2",
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_H264,
@@ -535,7 +535,7 @@ AVHWAccel ff_h264_dxva2_hwaccel = {
 #endif
 
 #if CONFIG_H264_D3D11VA_HWACCEL
-AVHWAccel ff_h264_d3d11va_hwaccel = {
+const AVHWAccel ff_h264_d3d11va_hwaccel = {
 .name   = "h264_d3d11va",
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_H264,
@@ -552,7 +552,7 @@ AVHWAccel ff_h264_d3d11va_hwaccel = {
 #endif
 
 #if CONFIG_H264_D3D11VA2_HWACCEL
-AVHWAccel ff_h264_d3d11va2_hwaccel = {
+const AVHWAccel ff_h264_d3d11va2_hwaccel = {
 .name   = "h264_d3d11va2",
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_H264,
diff --git a/libavcodec/dxva2_hevc.c b/libavcodec/dxva2_hevc.c
index 542afc383a..0ae07d304f 100644
--- a/libavcodec/dxva2_hevc.c
+++ b/libavcodec/dxva2_hevc.c
@@ -422,7 +422,7 @@ static int dxva2_hevc_end_frame(AVCodecContext *avctx)
 }
 
 #if CONFIG_HEVC_DXVA2_HWACCEL
-AVHWAccel ff_hevc_dxva2_hwaccel = {
+const AVHWAccel ff_hevc_dxva2_hwaccel = {
 .name   = "hevc_dxva2",
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_HEVC,
@@ -439,7 +439,7 @@ AVHWAccel ff_hevc_dxva2_hwaccel = {
 #endif
 
 #if CONFIG_HEVC_D3D11VA_HWACCEL
-AVHWAccel ff_hevc_d3d11va_hwaccel = {
+const AVHWAccel ff_hevc_d3d11va_hwaccel = {
 .name   = "hevc_d3d11va",
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_HEVC,
@@ -456,7 +456,7 @@ AVHWAccel ff_hevc_d3d11va_hwaccel = {
 #endif
 
 #if CONFIG_HEVC_D3D11VA2_HWACCEL
-AVHWAccel ff_hevc_d3d11va2_hwaccel = {
+const AVHWAccel ff_hevc_d3d11va2_hwaccel = {
 .name   = "hevc_d3d11va2",
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_HEVC,
diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva

[FFmpeg-cvslog] ffmpeg: Use codec hardware config to configure hwaccels

2017-11-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Thu Oct 26 00:18:47 
2017 +0100| [b0cd14fb1dab4b044f7fe6b53ac635409849de77] | committer: Mark 
Thompson

ffmpeg: Use codec hardware config to configure hwaccels

Removes specific support for all hwaccels supported by the generic code
(DXVA2, D3D11VA, NVDEC, VAAPI and VDPAU).

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

 fftools/ffmpeg.c |  77 +++-
 fftools/ffmpeg.h |   9 +-
 fftools/ffmpeg_hw.c  | 244 +++
 fftools/ffmpeg_opt.c |  54 ++--
 4 files changed, 251 insertions(+), 133 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 0c16e75ab0..6aff3366c5 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2792,45 +2792,77 @@ fail:
 av_freep(&avc);
 }
 
-static const HWAccel *get_hwaccel(enum AVPixelFormat pix_fmt, enum HWAccelID 
selected_hwaccel_id)
-{
-int i;
-for (i = 0; hwaccels[i].name; i++)
-if (hwaccels[i].pix_fmt == pix_fmt &&
-(!selected_hwaccel_id || selected_hwaccel_id == HWACCEL_AUTO || 
hwaccels[i].id == selected_hwaccel_id))
-return &hwaccels[i];
-return NULL;
-}
-
 static enum AVPixelFormat get_format(AVCodecContext *s, const enum 
AVPixelFormat *pix_fmts)
 {
 InputStream *ist = s->opaque;
 const enum AVPixelFormat *p;
 int ret;
 
-for (p = pix_fmts; *p != -1; p++) {
+for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) {
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);
-const HWAccel *hwaccel;
+const AVCodecHWConfig  *config = NULL;
+int i;
 
 if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
 break;
 
-hwaccel = get_hwaccel(*p, ist->hwaccel_id);
-if (!hwaccel ||
-(ist->active_hwaccel_id && ist->active_hwaccel_id != hwaccel->id) 
||
-(ist->hwaccel_id != HWACCEL_AUTO && ist->hwaccel_id != 
hwaccel->id))
-continue;
+if (ist->hwaccel_id == HWACCEL_GENERIC ||
+ist->hwaccel_id == HWACCEL_AUTO) {
+for (i = 0;; i++) {
+config = avcodec_get_hw_config(s->codec, i);
+if (!config)
+break;
+if (!(config->methods &
+  AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX))
+continue;
+if (config->pix_fmt == *p)
+break;
+}
+}
+if (config) {
+if (config->device_type != ist->hwaccel_device_type) {
+// Different hwaccel offered, ignore.
+continue;
+}
 
-ret = hwaccel->init(s);
-if (ret < 0) {
-if (ist->hwaccel_id == hwaccel->id) {
+ret = hwaccel_decode_init(s);
+if (ret < 0) {
+if (ist->hwaccel_id == HWACCEL_GENERIC) {
+av_log(NULL, AV_LOG_FATAL,
+   "%s hwaccel requested for input stream #%d:%d, "
+   "but cannot be initialized.\n",
+   av_hwdevice_get_type_name(config->device_type),
+   ist->file_index, ist->st->index);
+return AV_PIX_FMT_NONE;
+}
+continue;
+}
+} else {
+const HWAccel *hwaccel = NULL;
+int i;
+for (i = 0; hwaccels[i].name; i++) {
+if (hwaccels[i].pix_fmt == *p) {
+hwaccel = &hwaccels[i];
+break;
+}
+}
+if (!hwaccel) {
+// No hwaccel supporting this pixfmt.
+continue;
+}
+if (hwaccel->id != ist->hwaccel_id) {
+// Does not match requested hwaccel.
+continue;
+}
+
+ret = hwaccel->init(s);
+if (ret < 0) {
 av_log(NULL, AV_LOG_FATAL,
"%s hwaccel requested for input stream #%d:%d, "
"but cannot be initialized.\n", hwaccel->name,
ist->file_index, ist->st->index);
 return AV_PIX_FMT_NONE;
 }
-continue;
 }
 
 if (ist->hw_frames_ctx) {
@@ -2839,8 +2871,7 @@ static enum AVPixelFormat get_format(AVCodecContext *s, 
const enum AVPixelFormat
 return AV_PIX_FMT_NONE;
 }
 
-ist->active_hwaccel_id = hwaccel->id;
-ist->hwaccel_pix_fmt   = *p;
+ist->hwaccel_pix_fmt = *p;
 break;
 }
 
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index e0977e1bf1..4e73d59082 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -61,14 +61,10 @@
 enum HWAccelID {
 HWACCEL_NONE = 0,
 HWACCEL_AUTO,
-HWACCEL_VDPAU,
-HWACCEL_DXVA2,
+HWACCEL_GENERIC,
 HWACCEL_VIDEOTOOLBOX,
 HWACCEL_QSV,
- 

[FFmpeg-cvslog] vaapi_decode: Ignore the profile when not useful

2017-11-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Sat Nov 18 17:52:27 
2017 +| [f69e9365f6e0c43ac78bc0b2358591c54f0448b3] | committer: Mark 
Thompson

vaapi_decode: Ignore the profile when not useful

Enables VP8 decoding - the decoder places the the bitstream version
in the profile field, which we want to ignore.

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

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

diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
index d36ef906a2..572b3a40ac 100644
--- a/libavcodec/vaapi_decode.c
+++ b/libavcodec/vaapi_decode.c
@@ -324,7 +324,8 @@ static int vaapi_decode_make_config(AVCodecContext *avctx,
 int profile_match = 0;
 if (avctx->codec_id != vaapi_profile_map[i].codec_id)
 continue;
-if (avctx->profile == vaapi_profile_map[i].codec_profile)
+if (avctx->profile == vaapi_profile_map[i].codec_profile ||
+vaapi_profile_map[i].codec_profile == FF_PROFILE_UNKNOWN)
 profile_match = 1;
 for (j = 0; j < profile_count; j++) {
 if (vaapi_profile_map[i].va_profile == profile_list[j]) {

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


[FFmpeg-cvslog] lavc: Delete all fake hwaccels

2017-11-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Thu Oct 26 00:18:46 
2017 +0100| [da4e02b1961572c15d7cd6a701d153155f196477] | committer: Mark 
Thompson

lavc: Delete all fake hwaccels

They are now unused.

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

 configure | 34 +--
 libavcodec/cuviddec.c |  6 --
 libavcodec/mediacodec.c   |  2 +-
 libavcodec/mediacodecdec_common.c | 42 ---
 libavcodec/mmaldec.c  | 28 --
 libavcodec/qsvdec_h2645.c | 18 -
 libavcodec/qsvdec_other.c | 27 -
 7 files changed, 6 insertions(+), 151 deletions(-)

diff --git a/configure b/configure
index 461f2e66aa..d6cb61fb4c 100755
--- a/configure
+++ b/configure
@@ -2672,45 +2672,36 @@ h263_vaapi_hwaccel_deps="vaapi"
 h263_vaapi_hwaccel_select="h263_decoder"
 h263_videotoolbox_hwaccel_deps="videotoolbox"
 h263_videotoolbox_hwaccel_select="h263_decoder"
-h264_cuvid_hwaccel_select="h264_cuvid_decoder"
 h264_d3d11va_hwaccel_deps="d3d11va"
 h264_d3d11va_hwaccel_select="h264_decoder"
 h264_d3d11va2_hwaccel_deps="d3d11va"
 h264_d3d11va2_hwaccel_select="h264_decoder"
 h264_dxva2_hwaccel_deps="dxva2"
 h264_dxva2_hwaccel_select="h264_decoder"
-h264_mediacodec_hwaccel_deps="mediacodec"
-h264_mmal_hwaccel_deps="mmal"
 h264_nvdec_hwaccel_deps="nvdec"
 h264_nvdec_hwaccel_select="h264_decoder"
-h264_qsv_hwaccel_deps="libmfx"
 h264_vaapi_hwaccel_deps="vaapi"
 h264_vaapi_hwaccel_select="h264_decoder"
 h264_vdpau_hwaccel_deps="vdpau"
 h264_vdpau_hwaccel_select="h264_decoder"
 h264_videotoolbox_hwaccel_deps="videotoolbox"
 h264_videotoolbox_hwaccel_select="h264_decoder"
-hevc_cuvid_hwaccel_select="hevc_cuvid_decoder"
 hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
 hevc_d3d11va_hwaccel_select="hevc_decoder"
-hevc_mediacodec_hwaccel_deps="mediacodec"
 hevc_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
 hevc_d3d11va2_hwaccel_select="hevc_decoder"
 hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
 hevc_dxva2_hwaccel_select="hevc_decoder"
 hevc_nvdec_hwaccel_deps="nvdec"
 hevc_nvdec_hwaccel_select="hevc_decoder"
-hevc_qsv_hwaccel_deps="libmfx"
 hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
 hevc_vaapi_hwaccel_select="hevc_decoder"
 hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
 hevc_vdpau_hwaccel_select="hevc_decoder"
 hevc_videotoolbox_hwaccel_deps="videotoolbox"
 hevc_videotoolbox_hwaccel_select="hevc_decoder"
-mjpeg_cuvid_hwaccel_select="mjpeg_cuvid_decoder"
 mpeg_xvmc_hwaccel_deps="xvmc"
 mpeg_xvmc_hwaccel_select="mpeg2video_decoder"
-mpeg1_cuvid_hwaccel_select="mpeg1_cuvid_decoder"
 mpeg1_nvdec_hwaccel_deps="nvdec"
 mpeg1_nvdec_hwaccel_select="mpeg1video_decoder"
 mpeg1_vdpau_hwaccel_deps="vdpau"
@@ -2719,18 +2710,14 @@ mpeg1_videotoolbox_hwaccel_deps="videotoolbox"
 mpeg1_videotoolbox_hwaccel_select="mpeg1video_decoder"
 mpeg1_xvmc_hwaccel_deps="xvmc"
 mpeg1_xvmc_hwaccel_select="mpeg1video_decoder"
-mpeg2_cuvid_hwaccel_select="mpeg2_cuvid_decoder"
 mpeg2_d3d11va_hwaccel_deps="d3d11va"
 mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
 mpeg2_d3d11va2_hwaccel_deps="d3d11va"
 mpeg2_d3d11va2_hwaccel_select="mpeg2video_decoder"
 mpeg2_dxva2_hwaccel_deps="dxva2"
 mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
-mpeg2_mediacodec_hwaccel_deps="mediacodec"
-mpeg2_mmal_hwaccel_deps="mmal"
 mpeg2_nvdec_hwaccel_deps="nvdec"
 mpeg2_nvdec_hwaccel_select="mpeg2video_decoder"
-mpeg2_qsv_hwaccel_deps="libmfx"
 mpeg2_vaapi_hwaccel_deps="vaapi"
 mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
 mpeg2_vdpau_hwaccel_deps="vdpau"
@@ -2739,9 +2726,6 @@ mpeg2_videotoolbox_hwaccel_deps="videotoolbox"
 mpeg2_videotoolbox_hwaccel_select="mpeg2video_decoder"
 mpeg2_xvmc_hwaccel_deps="xvmc"
 mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
-mpeg4_cuvid_hwaccel_select="mpeg4_cuvid_decoder"
-mpeg4_mediacodec_hwaccel_deps="mediacodec"
-mpeg4_mmal_hwaccel_deps="mmal"
 mpeg4_nvdec_hwaccel_deps="nvdec"
 mpeg4_nvdec_hwaccel_select="mpeg4_decoder"
 mpeg4_vaapi_hwaccel_deps="vaapi"
@@ -2750,32 +2734,24 @@ mpeg4_vdpau_hwaccel_deps="vdpau"
 mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
 mpeg4_videotoolbox_hwaccel_deps="videotoolbox"
 mpeg4_videotoolbox_hwaccel_select="mpeg4_decoder"
-vc1_cuvid_hwaccel_select="vc1_cuvid_decoder"
 vc1_d3d11va_hwaccel_deps="d3d11va"
 vc1_d3d11va_hwaccel_select="vc1_decoder"
 vc1_d3d11va2_hwaccel_deps="d3d11va"
 vc1_d3d11va2_hwaccel_select="vc1_decoder"
 vc1_dxva2_hwaccel_deps="dxva2"
 vc1_dxva2_hwaccel_select="vc1_decoder"
-vc1_mmal_hwaccel_deps="mmal"
 vc1_nvdec_hwaccel_deps="nvdec"
 vc1_nvdec_hwaccel_select="vc1_decoder"
-vc1_qsv_hwaccel_deps="libmfx"
 vc1_vaapi_hwaccel_deps="vaapi"
 vc1_vaapi_hwaccel_select="vc1_decoder"
 vc1_vdpau_hwaccel_deps="vdpau"
 vc1_vdpau_hwaccel_select="vc1_decoder"
-vp8_cuvid_hwaccel_select="vp8_cuvid_decoder"
-vp9_cuvid_hwaccel_select="vp9_cuvid_

[FFmpeg-cvslog] avcodec/nvdec: Implement vp8 hwaccel

2017-11-26 Thread Philip Langdale
ffmpeg | branch: master | Philip Langdale  | Sun Nov 19 
08:42:39 2017 -0800| [1da9851e3470a019a35793c913a1de07f75dc3fc] | committer: 
Philip Langdale

avcodec/nvdec: Implement vp8 hwaccel

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

 Changelog  |  2 +-
 configure  |  2 ++
 libavcodec/Makefile|  1 +
 libavcodec/hwaccels.h  |  1 +
 libavcodec/nvdec.c |  1 +
 libavcodec/nvdec_vp8.c | 97 ++
 libavcodec/version.h   |  2 +-
 libavcodec/vp8.c   |  6 
 8 files changed, 110 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index e3092e211f..afead72f14 100644
--- a/Changelog
+++ b/Changelog
@@ -13,7 +13,7 @@ version :
 - PCE support for extended channel layouts in the AAC encoder
 - native aptX encoder and decoder
 - Raw aptX muxer and demuxer
-- NVIDIA NVDEC-accelerated H.264, HEVC, MPEG-1/2/4, VC1 and VP9 hwaccel 
decoding
+- NVIDIA NVDEC-accelerated H.264, HEVC, MPEG-1/2/4, VC1, VP8/9 hwaccel decoding
 - Intel QSV-accelerated overlay filter
 - mcompand audio filter
 - acontrast audio filter
diff --git a/configure b/configure
index fbff9c..6748ef8bc9 100755
--- a/configure
+++ b/configure
@@ -2746,6 +2746,8 @@ vc1_vaapi_hwaccel_deps="vaapi"
 vc1_vaapi_hwaccel_select="vc1_decoder"
 vc1_vdpau_hwaccel_deps="vdpau"
 vc1_vdpau_hwaccel_select="vc1_decoder"
+vp8_nvdec_hwaccel_deps="nvdec"
+vp8_nvdec_hwaccel_select="vp8_decoder"
 vp8_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferVP8"
 vp8_vaapi_hwaccel_select="vp8_decoder"
 vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 0ebd2820eb..a6203d424b 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -871,6 +871,7 @@ OBJS-$(CONFIG_VC1_NVDEC_HWACCEL)  += nvdec_vc1.o
 OBJS-$(CONFIG_VC1_QSV_HWACCEL)+= qsvdec_other.o
 OBJS-$(CONFIG_VC1_VAAPI_HWACCEL)  += vaapi_vc1.o
 OBJS-$(CONFIG_VC1_VDPAU_HWACCEL)  += vdpau_vc1.o
+OBJS-$(CONFIG_VP8_NVDEC_HWACCEL)  += nvdec_vp8.o
 OBJS-$(CONFIG_VP8_VAAPI_HWACCEL)  += vaapi_vp8.o
 OBJS-$(CONFIG_VP9_D3D11VA_HWACCEL)+= dxva2_vp9.o
 OBJS-$(CONFIG_VP9_DXVA2_HWACCEL)  += dxva2_vp9.o
diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h
index afe7289341..fcfe4e088e 100644
--- a/libavcodec/hwaccels.h
+++ b/libavcodec/hwaccels.h
@@ -59,6 +59,7 @@ extern const AVHWAccel ff_vc1_dxva2_hwaccel;
 extern const AVHWAccel ff_vc1_nvdec_hwaccel;
 extern const AVHWAccel ff_vc1_vaapi_hwaccel;
 extern const AVHWAccel ff_vc1_vdpau_hwaccel;
+extern const AVHWAccel ff_vp8_nvdec_hwaccel;
 extern const AVHWAccel ff_vp8_vaapi_hwaccel;
 extern const AVHWAccel ff_vp9_d3d11va_hwaccel;
 extern const AVHWAccel ff_vp9_d3d11va2_hwaccel;
diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
index da4451a739..c7a02ff40f 100644
--- a/libavcodec/nvdec.c
+++ b/libavcodec/nvdec.c
@@ -58,6 +58,7 @@ static int map_avcodec_id(enum AVCodecID id)
 case AV_CODEC_ID_MPEG2VIDEO: return cudaVideoCodec_MPEG2;
 case AV_CODEC_ID_MPEG4:  return cudaVideoCodec_MPEG4;
 case AV_CODEC_ID_VC1:return cudaVideoCodec_VC1;
+case AV_CODEC_ID_VP8:return cudaVideoCodec_VP8;
 case AV_CODEC_ID_VP9:return cudaVideoCodec_VP9;
 case AV_CODEC_ID_WMV3:   return cudaVideoCodec_VC1;
 }
diff --git a/libavcodec/nvdec_vp8.c b/libavcodec/nvdec_vp8.c
new file mode 100644
index 00..ceb3de2c3a
--- /dev/null
+++ b/libavcodec/nvdec_vp8.c
@@ -0,0 +1,97 @@
+/*
+ * VP8 HW decode acceleration through NVDEC
+ *
+ * Copyright (c) 2017 Philip Langdale
+ *
+ * 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 "avcodec.h"
+#include "nvdec.h"
+#include "decode.h"
+#include "internal.h"
+#include "vp8.h"
+
+static unsigned char safe_get_ref_idx(VP8Frame *frame)
+{
+return frame ? ff_nvdec_get_ref_idx(frame->tf.f) : 255;
+}
+
+static int nvdec_vp8_start_frame(AVCodecContext *avctx, const uint8_t *buffer, 
uint32_t size)
+{
+VP8Context *h = avctx->priv_data;
+
+NVDECContext  *ctx = avctx->internal->hwaccel_priv_data;
+CUVIDPICPARAMS *pp = &ctx->pic_params;
+FrameDecodeData *fdd;
+NVDECFrame *cf;
+AVFram

[FFmpeg-cvslog] avcodec/vc1dec: fix preprocessor checks and hw_configs lists for the hwaccels

2017-11-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Sun Nov 26 22:22:17 
2017 -0300| [1eee394c7c84c3b755bc856a49607214de206ded] | committer: James Almer

avcodec/vc1dec: fix preprocessor checks and hw_configs lists for the hwaccels

Signed-off-by: James Almer 

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

 libavcodec/vc1dec.c | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index ac4cfed2c8..cbef89f254 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1146,23 +1146,23 @@ AVCodec ff_vc1_decoder = {
 .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
 .pix_fmts   = vc1_hwaccel_pixfmt_list_420,
 .hw_configs = (const AVCodecHWConfigInternal*[]) {
-#if CONFIG_WMV3_DXVA2_HWACCEL
-HWACCEL_DXVA2(wmv3),
+#if CONFIG_VC1_DXVA2_HWACCEL
+HWACCEL_DXVA2(vc1),
 #endif
-#if CONFIG_WMV3_D3D11VA_HWACCEL
-HWACCEL_D3D11VA(wmv3),
+#if CONFIG_VC1_D3D11VA_HWACCEL
+HWACCEL_D3D11VA(vc1),
 #endif
-#if CONFIG_WMV3_D3D11VA2_HWACCEL
-HWACCEL_D3D11VA2(wmv3),
+#if CONFIG_VC1_D3D11VA2_HWACCEL
+HWACCEL_D3D11VA2(vc1),
 #endif
-#if CONFIG_WMV3_NVDEC_HWACCEL
-HWACCEL_NVDEC(wmv3),
+#if CONFIG_VC1_NVDEC_HWACCEL
+HWACCEL_NVDEC(vc1),
 #endif
-#if CONFIG_WMV3_VAAPI_HWACCEL
-HWACCEL_VAAPI(wmv3),
+#if CONFIG_VC1_VAAPI_HWACCEL
+HWACCEL_VAAPI(vc1),
 #endif
-#if CONFIG_WMV3_VDPAU_HWACCEL
-HWACCEL_VDPAU(wmv3),
+#if CONFIG_VC1_VDPAU_HWACCEL
+HWACCEL_VDPAU(vc1),
 #endif
 NULL
 },
@@ -1183,22 +1183,22 @@ AVCodec ff_wmv3_decoder = {
 .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
 .pix_fmts   = vc1_hwaccel_pixfmt_list_420,
 .hw_configs = (const AVCodecHWConfigInternal*[]) {
-#if CONFIG_VC1_DXVA2_HWACCEL
+#if CONFIG_WMV3_DXVA2_HWACCEL
 HWACCEL_DXVA2(wmv3),
 #endif
-#if CONFIG_VC1_D3D11VA_HWACCEL
+#if CONFIG_WMV3_D3D11VA_HWACCEL
 HWACCEL_D3D11VA(wmv3),
 #endif
-#if CONFIG_VC1_D3D11VA2_HWACCEL
+#if CONFIG_WMV3_D3D11VA2_HWACCEL
 HWACCEL_D3D11VA2(wmv3),
 #endif
-#if CONFIG_VC1_NVDEC_HWACCEL
+#if CONFIG_WMV3_NVDEC_HWACCEL
 HWACCEL_NVDEC(wmv3),
 #endif
-#if CONFIG_VC1_VAAPI_HWACCEL
+#if CONFIG_WMV3_VAAPI_HWACCEL
 HWACCEL_VAAPI(wmv3),
 #endif
-#if CONFIG_VC1_VDPAU_HWACCEL
+#if CONFIG_WMV3_VDPAU_HWACCEL
 HWACCEL_VDPAU(wmv3),
 #endif
 NULL

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


[FFmpeg-cvslog] avcodec/mpeg4videodec: fix preprocessor check for the nvdec hwaccel

2017-11-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Sun Nov 26 22:19:45 
2017 -0300| [921d7af6e9e65fabade00e35a7d40a6b80b0a58b] | committer: James Almer

avcodec/mpeg4videodec: fix preprocessor check for the nvdec hwaccel

Signed-off-by: James Almer 

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

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

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 19fcc1bc8f..cdd7077f01 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -2857,7 +2857,7 @@ AVCodec ff_mpeg4_decoder = {
 .update_thread_context = 
ONLY_IF_THREADS_ENABLED(mpeg4_update_thread_context),
 .priv_class = &mpeg4_class,
 .hw_configs= (const AVCodecHWConfigInternal*[]) {
-#if CONFIG_MPEG2_NVDEC_HWACCEL
+#if CONFIG_MPEG4_NVDEC_HWACCEL
HWACCEL_NVDEC(mpeg4),
 #endif
 #if CONFIG_MPEG4_VAAPI_HWACCEL

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


[FFmpeg-cvslog] avcodec/h264idct_template: Fix integer overflow in ff_h264_idct8_add

2017-11-26 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Mon 
Nov 20 03:08:20 2017 +0100| [9cc926da7d9920d17b76584e7212309ab5c02387] | 
committer: Michael Niedermayer

avcodec/h264idct_template: Fix integer overflow in ff_h264_idct8_add

Fixes: signed integer overflow: 452986184 - -2113885312 cannot be represented 
in type 'int'
Fixes: 4196/clusterfuzz-testcase-minimized-5580648594014208

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=9cc926da7d9920d17b76584e7212309ab5c02387
---

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

diff --git a/libavcodec/h264idct_template.c b/libavcodec/h264idct_template.c
index 7526bdd812..5993ae2e6e 100644
--- a/libavcodec/h264idct_template.c
+++ b/libavcodec/h264idct_template.c
@@ -76,10 +76,10 @@ void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t 
*_block, int stride){
 
 for( i = 0; i < 8; i++ )
 {
-const unsigned int a0 =  block[i+0*8] + block[i+4*8];
-const unsigned int a2 =  block[i+0*8] - block[i+4*8];
-const unsigned int a4 = (block[i+2*8]>>1) - block[i+6*8];
-const unsigned int a6 = (block[i+6*8]>>1) + block[i+2*8];
+const unsigned int a0 =  block[i+0*8] + (unsigned)block[i+4*8];
+const unsigned int a2 =  block[i+0*8] - (unsigned)block[i+4*8];
+const unsigned int a4 = (block[i+2*8]>>1) - (unsigned)block[i+6*8];
+const unsigned int a6 = (block[i+6*8]>>1) + (unsigned)block[i+2*8];
 
 const unsigned int b0 = a0 + a6;
 const unsigned int b2 = a2 + a4;

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


[FFmpeg-cvslog] libavformat/mov: Replace duplicate stream_nb check by assert

2017-11-26 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Nov 22 12:16:57 2017 +0100| [883de7e8b4fee252464b15e0351c6e5733e36e54] | 
committer: Michael Niedermayer

libavformat/mov: Replace duplicate stream_nb check by assert

Reviewed-by: Derek Buitenhuis 
Signed-off-by: Michael Niedermayer 

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

 libavformat/mov.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index ddb1e59b85..f6c86635b1 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2438,8 +2438,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext 
*pb, int entries)
 MOVStreamContext *sc;
 int pseudo_stream_id;
 
-if (c->fc->nb_streams < 1)
-return 0;
+av_assert0 (c->fc->nb_streams >= 1);
 st = c->fc->streams[c->fc->nb_streams-1];
 sc = st->priv_data;
 

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


[FFmpeg-cvslog] tests/checkasm/float_dsp: Increase allowed difference for float_dsp.vector_dmul

2017-11-26 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
Oct 29 15:26:50 2017 +0100| [38f966bdb4bfeeaca4642a63049253536c46] | 
committer: Michael Niedermayer

tests/checkasm/float_dsp: Increase allowed difference for float_dsp.vector_dmul

Tested for 1 iterations on x86-32

Fixes: Ticket6848

Signed-off-by: Michael Niedermayer 

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

 tests/checkasm/float_dsp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/checkasm/float_dsp.c b/tests/checkasm/float_dsp.c
index 9b0a221c25..2f999a3162 100644
--- a/tests/checkasm/float_dsp.c
+++ b/tests/checkasm/float_dsp.c
@@ -165,7 +165,8 @@ static void test_vector_dmul_scalar(const double *src0, 
const double *src1)
 call_ref(cdst, src0, src1[0], LEN);
 call_new(odst, src0, src1[0], LEN);
 for (i = 0; i < LEN; i++) {
-if (!double_near_abs_eps(cdst[i], odst[i], DBL_EPSILON)) {
+double t = fabs(src1[0]) + fabs(src0[i]) + fabs(src1[0] * src0[i]) + 
1.0;
+if (!double_near_abs_eps(cdst[i], odst[i], t * 2 * DBL_EPSILON)) {
 fprintf(stderr, "%d: %- .12f - %- .12f = % .12g\n", i,
 cdst[i], odst[i], cdst[i] - odst[i]);
 fail();

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


[FFmpeg-cvslog] tests/fate-run: Use -bitexact

2017-11-26 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
Oct 22 01:19:59 2017 +0200| [8e7ac4f04903464e78b2cf374e0eacd1b531be18] | 
committer: Michael Niedermayer

tests/fate-run: Use -bitexact

Signed-off-by: Michael Niedermayer 

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

 tests/fate-run.sh | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index e8d2e67709..05f4ca5e20 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -127,15 +127,15 @@ ffmpeg(){
 }
 
 framecrc(){
-ffmpeg "$@" -flags +bitexact -fflags +bitexact -f framecrc -
+ffmpeg "$@" -bitexact -f framecrc -
 }
 
 ffmetadata(){
-ffmpeg "$@" -flags +bitexact -fflags +bitexact -f ffmetadata -
+ffmpeg "$@" -bitexact -f ffmetadata -
 }
 
 framemd5(){
-ffmpeg "$@" -flags +bitexact -fflags +bitexact -f framemd5 -
+ffmpeg "$@" -bitexact -f framemd5 -
 }
 
 crc(){
@@ -160,7 +160,7 @@ pcm(){
 fmtstdout(){
 fmt=$1
 shift 1
-ffmpeg -flags +bitexact -fflags +bitexact "$@" -f $fmt -
+ffmpeg -bitexact "$@" -f $fmt -
 }
 
 enc_dec_pcm(){
@@ -173,7 +173,7 @@ enc_dec_pcm(){
 cleanfiles=$encfile
 encfile=$(target_path ${encfile})
 ffmpeg -i $src_file "$@" -f $out_fmt -y ${encfile} || return
-ffmpeg -flags +bitexact -fflags +bitexact -i ${encfile} -c:a 
pcm_${pcm_fmt} -fflags +bitexact -f ${dec_fmt} -
+ffmpeg -bitexact -i ${encfile} -c:a pcm_${pcm_fmt} -fflags +bitexact -f 
${dec_fmt} -
 }
 
 FLAGS="-flags +bitexact -sws_flags +accurate_rnd+bitexact -fflags +bitexact"
@@ -294,16 +294,16 @@ gapless(){
 cleanfiles="$cleanfiles $decfile1 $decfile2 $decfile3"
 
 # test packet data
-ffmpeg $extra_args -i "$sample" -flags +bitexact -fflags +bitexact -c:a 
copy -f framecrc -y $decfile1
+ffmpeg $extra_args -i "$sample" -bitexact -c:a copy -f framecrc -y 
$decfile1
 do_md5sum $decfile1
 # test decoded (and cut) data
-ffmpeg $extra_args -i "$sample" -flags +bitexact -fflags +bitexact -f wav 
md5:
+ffmpeg $extra_args -i "$sample" -bitexact -f wav md5:
 # the same as above again, with seeking to the start
-ffmpeg $extra_args -ss 0 -seek_timestamp 1 -i "$sample" -flags +bitexact 
-fflags +bitexact -c:a copy -f framecrc -y $decfile2
+ffmpeg $extra_args -ss 0 -seek_timestamp 1 -i "$sample" -bitexact -c:a 
copy -f framecrc -y $decfile2
 do_md5sum $decfile2
-ffmpeg $extra_args -ss 0 -seek_timestamp 1 -i "$sample" -flags +bitexact 
-fflags +bitexact -f wav md5:
+ffmpeg $extra_args -ss 0 -seek_timestamp 1 -i "$sample" -bitexact -f wav 
md5:
 # test packet data, with seeking to a specific position
-ffmpeg $extra_args -ss 5 -seek_timestamp 1 -i "$sample" -flags +bitexact 
-fflags +bitexact -c:a copy -f framecrc -y $decfile3
+ffmpeg $extra_args -ss 5 -seek_timestamp 1 -i "$sample" -bitexact -c:a 
copy -f framecrc -y $decfile3
 do_md5sum $decfile3
 }
 
@@ -316,7 +316,7 @@ gaplessenc(){
 cleanfiles="$cleanfiles $file1"
 
 # test data after reencoding
-ffmpeg -i "$sample" -flags +bitexact -fflags +bitexact -map 0:a -c:a 
$codec -f $format -y "$file1"
+ffmpeg -i "$sample" -bitexact -map 0:a -c:a $codec -f $format -y "$file1"
 probegaplessinfo "$file1"
 }
 
@@ -328,7 +328,7 @@ audio_match(){
 decfile="${outdir}/${test}.wav"
 cleanfiles="$cleanfiles $decfile"
 
-ffmpeg -i "$sample" -flags +bitexact -fflags +bitexact $extra_args -y 
$decfile
+ffmpeg -i "$sample" -bitexact $extra_args -y $decfile
 tests/audiomatch $decfile $trefile
 }
 

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


[FFmpeg-cvslog] avcodec/kgv1dec: Check that there is enough input for maximum RLE compression

2017-11-26 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Nov 22 20:14:54 2017 +0100| [3aad94bf2b140cfba8ae69d018da05d4948ef37f] | 
committer: Michael Niedermayer

avcodec/kgv1dec: Check that there is enough input for maximum RLE compression

Fixes: Timeout
Fixes: 4271/clusterfuzz-testcase-4676667768307712

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=3aad94bf2b140cfba8ae69d018da05d4948ef37f
---

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

diff --git a/libavcodec/kgv1dec.c b/libavcodec/kgv1dec.c
index 5359411c76..a6bd9400ac 100644
--- a/libavcodec/kgv1dec.c
+++ b/libavcodec/kgv1dec.c
@@ -62,6 +62,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 h = (buf[1] + 1) * 8;
 buf += 2;
 
+if (avpkt->size < 2 + w*h / 513)
+return AVERROR_INVALIDDATA;
+
 if (w != avctx->width || h != avctx->height) {
 av_freep(&c->frame_buffer);
 av_freep(&c->last_frame_buffer);

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


[FFmpeg-cvslog] avcodec/mlpdsp: Fix signed integer overflow, 2nd try

2017-11-26 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Mon 
Nov 20 18:45:45 2017 +0100| [97c00edaa043043c29d985653e7e1687b56dfa23] | 
committer: Michael Niedermayer

avcodec/mlpdsp: Fix signed integer overflow, 2nd try

The outputted bits should match what is used in the lossless check

Fixes: runtime error: signed integer overflow: -538697856 * 256 cannot be 
represented in type 'int'
Fixes: 4326/clusterfuzz-testcase-minimized-5689449645080576

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=97c00edaa043043c29d985653e7e1687b56dfa23
---

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

diff --git a/libavcodec/mlpdsp.c b/libavcodec/mlpdsp.c
index 4e3a16c781..32a4503b64 100644
--- a/libavcodec/mlpdsp.c
+++ b/libavcodec/mlpdsp.c
@@ -117,7 +117,7 @@ int32_t ff_mlp_pack_output(int32_t lossless_check_data,
   (1U << output_shift[mat_ch]);
 lossless_check_data ^= (sample & 0xff) << mat_ch;
 if (is32)
-*data_32++ = sample * 256;
+*data_32++ = sample * 256U;
 else
 *data_16++ = sample >> 8;
 }

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


[FFmpeg-cvslog] avcodec/nvdec: Make vp8 initialisation more 'compatible'

2017-11-26 Thread Philip Langdale
ffmpeg | branch: master | Philip Langdale  | Sun Nov 26 
20:40:32 2017 -0800| [b93d96a07be40f8e5d267d55fe961285586c0fd7] | committer: 
Philip Langdale

avcodec/nvdec: Make vp8 initialisation more 'compatible'

Ancient versions of gcc (pre 4.6) can't directly initialise
members of anonymous inner unions/structs by name.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676

Unfortunately, RHEL 6 shipped with one of these ancient
versions and so we're stuck with it until approximately the
heat death of the universe.

Putting explicit braces into the initialisation is possibly a
work-around but the behaviour there was never fully understood
before direct initialisation was made to work.

So, this may or may not work.

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

 libavcodec/nvdec_vp8.c | 19 ++-
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/libavcodec/nvdec_vp8.c b/libavcodec/nvdec_vp8.c
index ceb3de2c3a..f29a66ac72 100644
--- a/libavcodec/nvdec_vp8.c
+++ b/libavcodec/nvdec_vp8.c
@@ -64,11 +64,20 @@ static int nvdec_vp8_start_frame(AVCodecContext *avctx, 
const uint8_t *buffer, u
 .LastRefIdx  = 
safe_get_ref_idx(h->framep[VP56_FRAME_PREVIOUS]),
 .GoldenRefIdx= 
safe_get_ref_idx(h->framep[VP56_FRAME_GOLDEN]),
 .AltRefIdx   = 
safe_get_ref_idx(h->framep[VP56_FRAME_GOLDEN2]),
-
-.frame_type  = !h->keyframe,
-.version = h->profile,
-.show_frame  = !h->invisible,
-.update_mb_segmentation_data = h->segmentation.enabled ? 
h->segmentation.update_feature_data : 0,
+/*
+ * Explicit braces for anonymous inners to work around limitations
+ * in ancient versions of gcc.
+ */
+{
+{
+.frame_type  = !h->keyframe,
+.version = h->profile,
+.show_frame  = !h->invisible,
+.update_mb_segmentation_data = h->segmentation.enabled ?
+   
h->segmentation.update_feature_data :
+   0,
+}
+}
}
 };
 

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


[FFmpeg-cvslog] avcodec/nvdec: More effort to make vp8 compile with gcc < 4.6

2017-11-26 Thread Philip Langdale
ffmpeg | branch: master | Philip Langdale  | Sun Nov 26 
22:18:22 2017 -0800| [0e93694e64cdc72f7ccb8a986171593e672b8dba] | committer: 
Philip Langdale

avcodec/nvdec: More effort to make vp8 compile with gcc < 4.6

I'm told my prefix work-around wasn't enough to make it compile,
although I'm not sure why; I did some basic testing and that
approach appeared to work, but I'm not in a position to do a
full compile on CentOS 6 so I can't be sure of anything.

I have had it confirmed that the additional change to not use
named initialisers is enough to make it compile, so let's
throw that into the mix too.

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

 libavcodec/nvdec_vp8.c | 21 ++---
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/libavcodec/nvdec_vp8.c b/libavcodec/nvdec_vp8.c
index f29a66ac72..7b37445613 100644
--- a/libavcodec/nvdec_vp8.c
+++ b/libavcodec/nvdec_vp8.c
@@ -65,20 +65,19 @@ static int nvdec_vp8_start_frame(AVCodecContext *avctx, 
const uint8_t *buffer, u
 .GoldenRefIdx= 
safe_get_ref_idx(h->framep[VP56_FRAME_GOLDEN]),
 .AltRefIdx   = 
safe_get_ref_idx(h->framep[VP56_FRAME_GOLDEN2]),
 /*
- * Explicit braces for anonymous inners to work around limitations
- * in ancient versions of gcc.
+ * Explicit braces for anonymous inners and unnamed fields
+ * to work around limitations in ancient versions of gcc.
  */
-{
-{
-.frame_type  = !h->keyframe,
-.version = h->profile,
-.show_frame  = !h->invisible,
-.update_mb_segmentation_data = h->segmentation.enabled ?
-   
h->segmentation.update_feature_data :
-   0,
+{ // union
+{ // struct
+!h->keyframe, // frame_type
+h->profile,   // version
+!h->invisible,// show_frame
+h->segmentation.enabled ? // update_mb_segmentation_data
+h->segmentation.update_feature_data : 0,
 }
 }
-   }
+}
 };
 
 return 0;

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