ffmpeg.git
3 years agolibvpxenc,vp9: add corpus-complexity option
James Zern [Tue, 21 Nov 2017 01:32:23 +0000 (17:32 -0800)]
libvpxenc,vp9: add corpus-complexity option

Corpus VBR mode is a variant of standard VBR where the complexity
distribution midpoint is passed in rather than calculated for a specific
clip or chunk.

The valid range is [0, 10000]. 0 (default) uses standard VBR.

Signed-off-by: James Zern <jzern@google.com>
3 years agoffmpeg_opt: Constify hwaccel pointer.
Carl Eugen Hoyos [Mon, 27 Nov 2017 22:54:33 +0000 (23:54 +0100)]
ffmpeg_opt: Constify hwaccel pointer.

Fixes a warning:
fftools/ffmpeg_opt.c:804:29: warning: assignment discards ‘const’ qualifier from pointer target type

3 years agoAdd HW H.264 and HEVC encoding for AMD GPUs based on AMF SDK
Mikhail Mironov [Mon, 27 Nov 2017 02:36:06 +0000 (21:36 -0500)]
Add HW H.264 and HEVC encoding for AMD GPUs based on AMF SDK

Requires AMF headers for at least version 1.4.4.1.

Signed-off-by: Mikhail Mironov <mikhail.mironov@amd.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
3 years agoexamples: Add a VA-API encode example.
Jun Zhao [Mon, 6 Nov 2017 06:45:27 +0000 (14:45 +0800)]
examples: Add a VA-API encode example.

Supports only raw NV12 input.

Example use:
./vaapi_encode 1920 1080 test.yuv test.h264

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
3 years agoChangelog: add VAAPI VP8 decoder
Mark Thompson [Tue, 28 Nov 2017 21:37:38 +0000 (21:37 +0000)]
Changelog: add VAAPI VP8 decoder

3 years agoavformat/mov: return correct value in mov_read_cmov
Pan Bian [Mon, 27 Nov 2017 03:13:05 +0000 (11:13 +0800)]
avformat/mov: return correct value in mov_read_cmov

On some failure paths, the error code is not correctly set.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mov: set correct error code in mov_read_custom
Pan Bian [Mon, 27 Nov 2017 03:12:56 +0000 (11:12 +0800)]
avformat/mov: set correct error code in mov_read_custom

In function mov_read_custom(), it returns 0 on the path that av_malloc()
returns a NULL pointer. 0 indicates success. An error code should be
assigned to ret.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mxfenc: pass MXFPackage around instead of type
Mark Reid [Mon, 27 Nov 2017 05:42:16 +0000 (21:42 -0800)]
avformat/mxfenc: pass MXFPackage around instead of type

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec: set correct return value in ff_mpeg_ref_picture
Pan Bian [Mon, 27 Nov 2017 12:41:10 +0000 (20:41 +0800)]
avcodec: set correct return value in ff_mpeg_ref_picture

In function ff_mpeg_ref_picture(), it returns 0 on the error path that
the return value of av_buffer_ref() is NULL. 0 indicates success, which
seems to deviate from the fact. Set ret to AVERROR(ENOMEM) to propagate
the error status to the callers.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoFree extradata before reallocating.
Dale Curtis [Tue, 21 Nov 2017 23:10:08 +0000 (15:10 -0800)]
Free extradata before reallocating.

Otherwise ff_alloc_extradata() just leaks any existing allocated
memory.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavfilter/drawbox: rename variable for maximum thickness
Gyan Doshi [Mon, 20 Nov 2017 10:06:39 +0000 (15:36 +0530)]
avfilter/drawbox: rename variable for maximum thickness

The present value name for maximum thickness is 'max' which results in a
parse error of any thickness expression containing 'max(val1,val2)'.

Value renamed to 'fill'. Tested locally and documented.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agovf_zscale: Add more supported input properties
Vittorio Giovara [Tue, 28 Nov 2017 18:56:06 +0000 (13:56 -0500)]
vf_zscale: Add more supported input properties

Bump the minimum version necessary in the configure file.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
3 years agovf_zscale: Relax color properties maximum bounds
Vittorio Giovara [Tue, 28 Nov 2017 18:55:47 +0000 (13:55 -0500)]
vf_zscale: Relax color properties maximum bounds

This simplifies adding new values, which are already validated elsewhere.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
3 years agomov: Support mdcv and clli boxes for mastering display an color light level
Vittorio Giovara [Wed, 4 Oct 2017 18:47:54 +0000 (14:47 -0400)]
mov: Support mdcv and clli boxes for mastering display an color light level

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
3 years agoprores: Always assume limited range
Vittorio Giovara [Wed, 27 Sep 2017 19:52:52 +0000 (15:52 -0400)]
prores: Always assume limited range

As defined by the specification.

3 years agoavcodec/videotoolbox: fix SEGV when hwaccel decoding h264 with ffmpeg.c
Aman Gupta [Tue, 28 Nov 2017 16:49:21 +0000 (08:49 -0800)]
avcodec/videotoolbox: fix SEGV when hwaccel decoding h264 with ffmpeg.c

Signed-off-by: Aman Gupta <aman@tmm1.net>
3 years agoavformat/hlsenc: Fixed initial setting for end_pts
Karthick J [Tue, 28 Nov 2017 12:03:15 +0000 (20:03 +0800)]
avformat/hlsenc: Fixed initial setting for end_pts

This patch fixes Bug #6868
Sometimes end_pts is getting initialized to audio stream's
first pts, while the duration is calculated based on video stream's pts.
In this patch the end_pts is initialized with the correct stream's first pts.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Tested-by: beloko
3 years agoavformat/hls: Obey AVProgram discard flags
Anssi Hannula [Sun, 19 Nov 2017 18:11:49 +0000 (20:11 +0200)]
avformat/hls: Obey AVProgram discard flags

Currently HLS demuxer only obeys AVStream discard flags but not
AVProgram (which bandwidth variants appear as) discard flags.

Fix that.

3 years agoavformat/hls: Factor playlist need check to a common function
Anssi Hannula [Sun, 19 Nov 2017 17:30:02 +0000 (19:30 +0200)]
avformat/hls: Factor playlist need check to a common function

3 years agolavu/hwcontext_opencl.h: fix build on macOS
Rodger Combs [Tue, 28 Nov 2017 05:38:46 +0000 (23:38 -0600)]
lavu/hwcontext_opencl.h: fix build on macOS

3 years agoavformat/matroskaenc: add missing allocation failure checks for stream durations
James Almer [Tue, 28 Nov 2017 04:23:23 +0000 (01:23 -0300)]
avformat/matroskaenc: add missing allocation failure checks for stream durations

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/matroskaenc: move some initialization checks to mkv_init
James Almer [Mon, 27 Nov 2017 17:11:21 +0000 (14:11 -0300)]
avformat/matroskaenc: move some initialization checks to mkv_init

It's the correct place for them.

Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoffmpeg: Check read_ffserver_streams() return value
Pan Bian [Mon, 27 Nov 2017 01:12:54 +0000 (09:12 +0800)]
ffmpeg: Check read_ffserver_streams() return value

The function avformat_alloc_context() will return a NULL pointer on
failure. However, in function read_ffserver_streams(), its return value
is not validated and the subsequent dereference may result in a bad
memory access bug. Check its return value against NULL and avoid
potential NULL dereference.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolibavformat/rtpenc_mpegts: check avformat_new_stream() return value
Pan Bian [Mon, 27 Nov 2017 01:30:53 +0000 (09:30 +0800)]
libavformat/rtpenc_mpegts: check avformat_new_stream() return value

The function avformat_new_stream() returns a NULL pointer on failure.
However, in function rtp_mpegts_write_header(), its return value is not
validated before it is dereferenced. Check the return value against NULL
to avoid potential NULL dereference.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavfilter/vf_threshold: use correct linesize
Paul B Mahol [Mon, 27 Nov 2017 17:04:39 +0000 (18:04 +0100)]
avfilter/vf_threshold: use correct linesize

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavformat/matroskaenc: actually enforce the stream limit
James Almer [Mon, 27 Nov 2017 16:39:42 +0000 (13:39 -0300)]
avformat/matroskaenc: actually enforce the stream limit

Prevents out of array accesses. Adressess ticket #6873

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavfilter/af_silenceremove: fix possible crash if supplied duration is negative
Paul B Mahol [Mon, 27 Nov 2017 15:32:54 +0000 (16:32 +0100)]
avfilter/af_silenceremove: fix possible crash if supplied duration is negative

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agolavd/alsa: Double maximum alsa buffer size.
Carl Eugen Hoyos [Mon, 27 Nov 2017 13:05:28 +0000 (14:05 +0100)]
lavd/alsa: Double maximum alsa buffer size.

Fixes recording from ATI Wonder 600 USB adapter, regression since e35c674d.

Reported and analyzed by: Marco Paolieri, paolieri at gmail

3 years agoavfilter/af_silenceremove: fix logic error in EOF case
Paul B Mahol [Mon, 27 Nov 2017 12:38:33 +0000 (13:38 +0100)]
avfilter/af_silenceremove: fix logic error in EOF case

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavformat/avienc: fix fields-per-frame value for interlaced video streams
Tobias Rapp [Mon, 27 Nov 2017 08:13:05 +0000 (09:13 +0100)]
avformat/avienc: fix fields-per-frame value for interlaced video streams

Writes one set of field framing information for progressive streams and
two sets for interlaced streams. Fixes ticket #6383.

Unfortunately the OpenDML v1.02 document is not very specific on what
value to use for start_line when frame data is not coming from a
capturing device, so this is just using 0/1 depending on the field order
as a best-effort guess.

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
3 years agoavcodec/nvdec: More effort to make vp8 compile with gcc < 4.6
Philip Langdale [Mon, 27 Nov 2017 06:18:22 +0000 (22:18 -0800)]
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.

3 years agoavcodec/nvdec: Make vp8 initialisation more 'compatible'
Philip Langdale [Mon, 27 Nov 2017 04:40:32 +0000 (20:40 -0800)]
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.

3 years agotests/fate-run: Use -bitexact
Michael Niedermayer [Sat, 21 Oct 2017 23:19:59 +0000 (01:19 +0200)]
tests/fate-run: Use -bitexact

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/mlpdsp: Fix signed integer overflow, 2nd try
Michael Niedermayer [Mon, 20 Nov 2017 17:45:45 +0000 (18:45 +0100)]
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 <michael@niedermayer.cc>
3 years agolibavformat/mov: Replace duplicate stream_nb check by assert
Michael Niedermayer [Wed, 22 Nov 2017 11:16:57 +0000 (12:16 +0100)]
libavformat/mov: Replace duplicate stream_nb check by assert

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/h264idct_template: Fix integer overflow in ff_h264_idct8_add
Michael Niedermayer [Mon, 20 Nov 2017 02:08:20 +0000 (03:08 +0100)]
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 <michael@niedermayer.cc>
3 years agoavcodec/kgv1dec: Check that there is enough input for maximum RLE compression
Michael Niedermayer [Wed, 22 Nov 2017 19:14:54 +0000 (20:14 +0100)]
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 <michael@niedermayer.cc>
3 years agotests/checkasm/float_dsp: Increase allowed difference for float_dsp.vector_dmul
Michael Niedermayer [Sun, 29 Oct 2017 14:26:50 +0000 (15:26 +0100)]
tests/checkasm/float_dsp: Increase allowed difference for float_dsp.vector_dmul

Tested for 10000 iterations on x86-32

Fixes: Ticket6848

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/vc1dec: fix preprocessor checks and hw_configs lists for the hwaccels
James Almer [Mon, 27 Nov 2017 01:22:17 +0000 (22:22 -0300)]
avcodec/vc1dec: fix preprocessor checks and hw_configs lists for the hwaccels

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/mpeg4videodec: fix preprocessor check for the nvdec hwaccel
James Almer [Mon, 27 Nov 2017 01:19:45 +0000 (22:19 -0300)]
avcodec/mpeg4videodec: fix preprocessor check for the nvdec hwaccel

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/nvdec: Implement vp8 hwaccel
Philip Langdale [Sun, 19 Nov 2017 16:42:39 +0000 (08:42 -0800)]
avcodec/nvdec: Implement vp8 hwaccel

3 years agovaapi_decode: Ignore the profile when not useful
Mark Thompson [Sat, 18 Nov 2017 17:52:27 +0000 (17:52 +0000)]
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.

3 years agovaapi: Add VP8 decode hwaccel
Mark Thompson [Sat, 18 Nov 2017 17:55:24 +0000 (17:55 +0000)]
vaapi: Add VP8 decode hwaccel

3 years agovp8: Add hwaccel hooks
Mark Thompson [Sat, 18 Nov 2017 17:55:18 +0000 (17:55 +0000)]
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).

3 years agovaapi: Make the decode profile matching more explicit
Mark Thompson [Thu, 9 Nov 2017 01:04:44 +0000 (01:04 +0000)]
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.

3 years agoffmpeg: Use codec hardware config to configure hwaccels
Mark Thompson [Wed, 25 Oct 2017 23:18:47 +0000 (00:18 +0100)]
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).

3 years agolavc: Mark all AVHWAccel structures as const
Mark Thompson [Sat, 4 Nov 2017 18:53:26 +0000 (18:53 +0000)]
lavc: Mark all AVHWAccel structures as const

3 years agolavc: Delete all fake hwaccels
Mark Thompson [Wed, 25 Oct 2017 23:18:46 +0000 (00:18 +0100)]
lavc: Delete all fake hwaccels

They are now unused.

3 years agolavc: Remove register mechanism for hwaccels
Mark Thompson [Wed, 25 Oct 2017 23:18:45 +0000 (00:18 +0100)]
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.

3 years agolavc: Deprecate av_hwaccel_next() and av_register_hwaccel()
Mark Thompson [Wed, 25 Oct 2017 23:18:44 +0000 (00:18 +0100)]
lavc: Deprecate av_hwaccel_next() and av_register_hwaccel()

3 years agolavc: Use hardware config information in ff_get_format()
Mark Thompson [Wed, 25 Oct 2017 23:18:43 +0000 (00:18 +0100)]
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).

3 years agolavc: Add hardware config metadata for decoders supporting hardware output
Mark Thompson [Wed, 25 Oct 2017 23:18:40 +0000 (00:18 +0100)]
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.

3 years agolavc: Add codec metadata to indicate hardware support
Mark Thompson [Wed, 25 Oct 2017 23:18:39 +0000 (00:18 +0100)]
lavc: Add codec metadata to indicate hardware support

3 years agoavformat/aacdec: Fix leak in adts_aac_read_packet()
Michael Niedermayer [Sat, 25 Nov 2017 18:22:51 +0000 (19:22 +0100)]
avformat/aacdec: Fix leak in adts_aac_read_packet()

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

Found-by: ossfuzz/chromium
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/dirac_dwt: Fix integer overflow in COMPOSE_FIDELITYi*
Michael Niedermayer [Sat, 25 Nov 2017 02:15:16 +0000 (03:15 +0100)]
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 <michael@niedermayer.cc>
3 years agovorbisenc: Check the return value of av_frame_clone
Derek Buitenhuis [Fri, 24 Nov 2017 19:24:41 +0000 (19:24 +0000)]
vorbisenc: Check the return value of av_frame_clone

Prevents a segfault when alloc fails.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
3 years agodoc/ffmpeg: Document opencl for -init_hw_device
Mark Thompson [Sun, 26 Nov 2017 15:35:27 +0000 (15:35 +0000)]
doc/ffmpeg: Document opencl for -init_hw_device

3 years agodoc/fftools: Remove documentation for old -opencl_bench option
Mark Thompson [Sun, 26 Nov 2017 10:29:24 +0000 (10:29 +0000)]
doc/fftools: Remove documentation for old -opencl_bench option

3 years agonvenc: Include config.h before checking for D3D11 support
Mark Thompson [Sat, 25 Nov 2017 23:05:24 +0000 (23:05 +0000)]
nvenc: Include config.h before checking for D3D11 support

Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
3 years agohwcontext_vaapi: Do not assume that sw_format is transferable
Mark Thompson [Fri, 24 Nov 2017 00:21:26 +0000 (00:21 +0000)]
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.

3 years agoh264_picture: Actually return error during alloc failure
Derek Buitenhuis [Fri, 24 Nov 2017 18:21:57 +0000 (18:21 +0000)]
h264_picture: Actually return error during alloc failure

Fixes NULL dereference during alloc failure.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
3 years agoavfilter: add lv2 wrapper filter
Paul B Mahol [Thu, 23 Nov 2017 15:08:42 +0000 (16:08 +0100)]
avfilter: add lv2 wrapper filter

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoerror_resilience: remove avpriv_atomic usage
Rostislav Pehlivanov [Fri, 24 Nov 2017 23:34:16 +0000 (23:34 +0000)]
error_resilience: remove avpriv_atomic usage

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
3 years agolibavcodec/utils.c: simplify avcodec locking with atomics
Rostislav Pehlivanov [Sat, 25 Nov 2017 16:55:44 +0000 (16:55 +0000)]
libavcodec/utils.c: simplify avcodec locking with atomics

Also makes it more robust than using volatiles.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
3 years agolavc/utils.c: use C11 atomics for entangled thread handling
Rostislav Pehlivanov [Fri, 24 Nov 2017 23:38:44 +0000 (23:38 +0000)]
lavc/utils.c: use C11 atomics for entangled thread handling

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
3 years agoavformat/mov_esds: check return value of ff_mp4_read_dec_config_descr
James Almer [Fri, 24 Nov 2017 20:55:19 +0000 (17:55 -0300)]
avformat/mov_esds: check return value of ff_mp4_read_dec_config_descr

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/isom: return proper error values in ff_mp4_read_dec_config_descr
James Almer [Fri, 24 Nov 2017 20:55:05 +0000 (17:55 -0300)]
avformat/isom: return proper error values in ff_mp4_read_dec_config_descr

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agofate/hapAlphaOnly : add test for hap alpha only decoding
Martin Vignali [Sat, 25 Nov 2017 18:47:06 +0000 (19:47 +0100)]
fate/hapAlphaOnly : add test for hap alpha only decoding

3 years agoavcodec/hapdec : use gray8 for HapAlphaOnly decoding instead of RGB0
Martin Vignali [Sat, 25 Nov 2017 18:46:48 +0000 (19:46 +0100)]
avcodec/hapdec : use gray8 for HapAlphaOnly decoding instead of RGB0

3 years agoavcodec/texturedsp : add rgtc1u gray decoding
Martin Vignali [Sat, 25 Nov 2017 18:41:50 +0000 (19:41 +0100)]
avcodec/texturedsp : add rgtc1u gray decoding

decode rgtc1 block in gray8 picture

3 years agohwcontext_d3d11va: properly reset values after release/close
Jan Ekström [Fri, 24 Nov 2017 00:44:44 +0000 (02:44 +0200)]
hwcontext_d3d11va: properly reset values after release/close

Makes the uninit function re-entrable, which can be a common case
when an API user first tries to initialize its context, fails, and
then finally unrefs the AVHWDevice.

Fixes a crash reported by sm2345 on IRC.

3 years agoavcodec/fft: fix INTERL macro on 3dnow
Mikulas Patocka [Thu, 23 Nov 2017 19:12:55 +0000 (20:12 +0100)]
avcodec/fft: fix INTERL macro on 3dnow

The commit b7c16a3f2c4921f613319938b8ee0e3d6fa83e8d ("x86: fft: Port to
cpuflags") breaks the opus decoder in ffmpeg when compiling for 3dnow. The
output is audible, but there's a lot of noise.

The reason for the breakage is that the commit unintentionally changed the
INTERL macro so that it is empty when compiling for 3dnow. This patch
fixes it.

Signed-off-by: Mikulas Patocka <mikulas@twibright.com>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agohwcontext_opencl: Reset internal command queue on device_uninit
Mark Thompson [Sat, 25 Nov 2017 15:34:43 +0000 (15:34 +0000)]
hwcontext_opencl: Reset internal command queue on device_uninit

device_uninit can be called twice if device_init fails.

3 years agohwcontext_d3d11: Log adapter details on device creation
Mark Thompson [Tue, 14 Nov 2017 13:02:26 +0000 (13:02 +0000)]
hwcontext_d3d11: Log adapter details on device creation

This is helpful to know what device has actually been used.

3 years agoconfigure: remove superfluous cuvid and nvdec checks
James Almer [Sat, 25 Nov 2017 01:48:24 +0000 (22:48 -0300)]
configure: remove superfluous cuvid and nvdec checks

Both are autodetected, and their dependency on cuda is checked
elsewhere.

Fixes ticket #6849.

Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agodoc/APIchanges: Fix lavu versions for OpenCL changes
Mark Thompson [Sat, 25 Nov 2017 14:51:55 +0000 (14:51 +0000)]
doc/APIchanges: Fix lavu versions for OpenCL changes

Also fix a typo and fill hashes and dates.

3 years agolavu/pixfmt: Remove gap in the middle of enum AVPixelFormat
Mark Thompson [Fri, 24 Nov 2017 12:36:09 +0000 (12:36 +0000)]
lavu/pixfmt: Remove gap in the middle of enum AVPixelFormat

This was added for compatibility with libav, by leaving a space for
formats added in libav to be merged.  Since that feature has been
removed, we don't need a gap here.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoMerge commit '136e7cf64ce9e78de7158d6720539d51cb96b743'
Mark Thompson [Sat, 25 Nov 2017 14:38:03 +0000 (14:38 +0000)]
Merge commit '136e7cf64ce9e78de7158d6720539d51cb96b743'

* commit '136e7cf64ce9e78de7158d6720539d51cb96b743':
  qsv/hevcdec: Load hw plugin by default on non-windows os

Merged-by: Mark Thompson <sw@jkqxz.net>
3 years agoavfilter: add normalize filter
Richard Ling [Tue, 21 Nov 2017 10:32:06 +0000 (21:32 +1100)]
avfilter: add normalize filter

3 years agoffmpeg libopusdec: fix missing include file in libopusdec.c
Mikulas Patocka [Thu, 23 Nov 2017 19:22:56 +0000 (20:22 +0100)]
ffmpeg libopusdec: fix missing include file in libopusdec.c

This patch fixes the following error when compiling mplayer with libopus.

libavcodec/libopusdec.c: In function 'libopus_decode_init':
libavcodec/libopusdec.c:130:27: error: implicit declaration of function 'ff_exp10'; did you mean 'ff_exp2fi'? [-Werror=implicit-function-declaration]
         double gain_lin = ff_exp10(gain_db / (20.0 * 256));
                           ^~~~~~~~
                           ff_exp2fi

Signed-off-by: Mikulas Patocka <mikulas@twibright.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolavf/mov: fix crash in mov_read_sidx
John Stebbins [Fri, 24 Nov 2017 16:18:16 +0000 (08:18 -0800)]
lavf/mov: fix crash in mov_read_sidx

Use correct index into streams

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/dashenc: Associate mpd extension with dash muxer
Karthick J [Wed, 22 Nov 2017 08:20:03 +0000 (13:50 +0530)]
avformat/dashenc: Associate mpd extension with dash muxer

Reviewed-by: 刘歧 <lq@chinaffmpeg.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/sbrdsp_fixed: Fix integer overflow
Michael Niedermayer [Wed, 22 Nov 2017 19:18:40 +0000 (20:18 +0100)]
avcodec/sbrdsp_fixed: Fix integer overflow

Fixes: signed integer overflow: 2147483598 + 64 cannot be represented in type 'int'
Fixes: 4337/clusterfuzz-testcase-minimized-6192658616680448

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/utils: fix mixed declarations and code
James Almer [Fri, 24 Nov 2017 20:46:16 +0000 (17:46 -0300)]
avformat/utils: fix mixed declarations and code

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/nvdec: Round up odd width/height values
Philip Langdale [Fri, 24 Nov 2017 18:05:49 +0000 (10:05 -0800)]
avcodec/nvdec: Round up odd width/height values

nvdec will not produce odd width/height output, and while this is
basically never an issue with most codecs, due to internal alignment
requirements, you can get odd sized jpegs.

If an odd-sized jpeg is encountered, nvdec will actually round down
internally and produce output that is slightly smaller. This isn't
the end of the world, as long as you know the output size doesn't
match the original image resolution.

However, with an hwaccel, we don't know. The decoder controls
the reported output size and the hwaccel cannot change it. I was
able to trigger an error in mpv where it tries to copy the output
surface as part of rendering and triggers a cuda error because
cuda knows the output frame is smaller than expected.

To fix this, we can round up the configured width/height passed
to nvdec so that the frames are always at least as large as the
decoder's reported size, and data can be copied out safely.

In this particular jpeg case, you end up with a blank (green) line
at the bottom due to nvdec refusing to decode the last line, but
the behaviour matches cuviddec, so it's as good as you're going to
get.

3 years agoavformat/ttaenc: add tta_init()
James Almer [Mon, 20 Nov 2017 20:43:23 +0000 (17:43 -0300)]
avformat/ttaenc: add tta_init()

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/ttaenc: buffer packets directly
James Almer [Mon, 20 Nov 2017 19:16:11 +0000 (16:16 -0300)]
avformat/ttaenc: buffer packets directly

This is a bit more robust in case of OOM.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/vorbis: 1 << 31 > int32_t::max(), so use 1u << 31 instead.
Dale Curtis [Wed, 22 Nov 2017 18:58:39 +0000 (10:58 -0800)]
avcodec/vorbis: 1 << 31 > int32_t::max(), so use 1u << 31 instead.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/utils: Prevent undefined shift with wrap_bits > 64.
Dale Curtis [Fri, 17 Nov 2017 21:35:56 +0000 (13:35 -0800)]
avformat/utils: Prevent undefined shift with wrap_bits > 64.

2LL << (wrap_bits=64 - 1) does not fit in int64_t; change the
code to use a uint64_t (2ULL) and add an av_assert2() to
ensure wrap_bits <= 64.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavfilter/af_amix: make use of av_asprintf()
Paul B Mahol [Fri, 24 Nov 2017 16:09:48 +0000 (17:09 +0100)]
avfilter/af_amix: make use of av_asprintf()

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavfilter: add mix filter
Paul B Mahol [Mon, 20 Nov 2017 18:58:44 +0000 (19:58 +0100)]
avfilter: add mix filter

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavfilter/af_ladspa: remove duplicate code lines
Paul B Mahol [Fri, 24 Nov 2017 12:36:26 +0000 (13:36 +0100)]
avfilter/af_ladspa: remove duplicate code lines

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavcodec/j2kenc: Only allocate cblk.data once
Michael Niedermayer [Fri, 24 Nov 2017 02:49:55 +0000 (03:49 +0100)]
avcodec/j2kenc: Only allocate cblk.data once

Fixes: memleak
Found-by: <jamrial>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/hlsenc: Added option to add EXT-X-INDEPENDENT-SEGMENTS tag
Karthick J [Thu, 23 Nov 2017 22:57:36 +0000 (06:57 +0800)]
avformat/hlsenc: Added option to add EXT-X-INDEPENDENT-SEGMENTS tag

3 years agoavformat/hlsenc: Refactor an inconsistent variable name
Karthick J [Thu, 23 Nov 2017 22:42:35 +0000 (06:42 +0800)]
avformat/hlsenc: Refactor an inconsistent variable name

3 years agoavformat/hlsenc: Minor fix in setting http options for master playlist
Karthick J [Thu, 23 Nov 2017 22:41:25 +0000 (06:41 +0800)]
avformat/hlsenc: Minor fix in setting http options for master playlist

3 years agoavfilter/Makefile: skip building opencl.h when opencl is disabled
James Almer [Thu, 23 Nov 2017 22:11:17 +0000 (19:11 -0300)]
avfilter/Makefile: skip building opencl.h when opencl is disabled

Fixes make checkheaders.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agodoc/filters: mention (a)loop defaults
Lou Logan [Thu, 23 Nov 2017 20:54:26 +0000 (11:54 -0900)]
doc/filters: mention (a)loop defaults

Signed-off-by: Lou Logan <lou@lrcd.com>
3 years agodoc/filters.texi: explain infinite looping
Werner Robitza [Thu, 23 Nov 2017 12:16:53 +0000 (13:16 +0100)]
doc/filters.texi: explain infinite looping

Explain how to achieve infinite looping with the loop / aloop filters.

Signed-off-by: Werner Robitza <werner.robitza@gmail.com>
3 years agoavcodec/x86/exrdsp : use ymm constant for pb_80
Martin Vignali [Tue, 21 Nov 2017 21:02:07 +0000 (22:02 +0100)]
avcodec/x86/exrdsp : use ymm constant for pb_80

speed seems to be similar, but simplify code