Commit Graph

94047 Commits

Author SHA1 Message Date
Michael Niedermayer
a99ffb5bb4 avcodec/diracdec: Fix integer overflow in global_mv()
Fixes: signed integer overflow: 16384 * 196607 cannot be represented in type 'int'
Fixes: 14810/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5091232683917312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-06-05 13:19:59 +02:00
Michael Niedermayer
0a2b768d3e tools/target_dec_fuzzer: Limit error concealment on pixels instead of just frames
This should reduce the amount of timeout issues overall

Fixes: Timeout (34->10sec)
Fixes: 14682/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV2_fuzzer-5728608414334976

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-06-05 13:19:59 +02:00
Andreas Rheinhardt
d81913e680 bitstream_filters: Correct dump_extradata description
The default is to dump extradata to keyframes, not all frames.
Also improve the description of the relevant AVOption.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-06-04 20:04:05 +05:30
Michael Niedermayer
279d9a84af avcodec/vmnc: Check available space against chunks before reget_buffer()
Fixes: Timeout (16sec -> 60ms)
Fixes: 14673/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMNC_fuzzer-5640217517621248

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-06-04 13:06:41 +02:00
Michael Niedermayer
89836ad5a7 avcodec/pafvideo: Clear frame buffer later
This way the clearing can be skipped in case of some errors.

Fixes: Timeout (11sec -> 344ms)
Fixes: 14670/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PAF_VIDEO_fuzzer-5769534503387136

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-06-04 13:06:41 +02:00
Michael Niedermayer
cf3156e762 avcodec/aacdec_template: skip apply_tns() if max_sfb is 0 (from previous header decode failure)
Fixes: NULL pointer dereference
Fixes: 14723/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-5654612436058112
Fixes: 14724/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-5712607111020544

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-06-04 13:06:41 +02:00
Michael Niedermayer
cdd886a286 avcodec/arbc: Skip tiles in fill_tileX() which are completely outside
Fixes: signed integer overflow: 2052526848 + 147237888 cannot be represented in type 'int'
Fixes: 14441/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ARBC_fuzzer-5717632944177152
Fixes: 14453/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ARBC_fuzzer-5739679254577152

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-06-04 13:06:41 +02:00
Michael Niedermayer
3d14663f83 avcodec/aacdec_fixed: Handle more extreem cases in noise_scale()
Its unclear if these cases have any relevance in real files

Fixes: shift exponent -2 is negative
Fixes: 14489/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5681941631729664

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-06-04 13:06:41 +02:00
Michael Niedermayer
bc33c99d56 avcodec/aacdec_template: Merge 3 #ifs related to noise handling
Fewer #if and fewer lines

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-06-04 13:06:41 +02:00
Michael Niedermayer
3d5863d739 avcodec/aacdec_fixed: ssign seems always -1 in noise_scale(), simplify 2019-06-04 13:06:41 +02:00
Paul B Mahol
d3f236b300 avilter/avf_showwaves: switch to activate in showwaves filter 2019-06-04 09:28:07 +02:00
James Almer
ff2a638c83 avcodec/cbs_h264: add support for Alternative Transfer Characteristics SEI message
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-06-03 19:21:38 -03:00
Mark Thompson
2880a32c66 vaapi_encode: Refactor encode misc parameter buffer creation
This removes the use of the nonstandard combined structures, which
generated some warnings with clang and will cause alignment problems
with some parameter buffer types.
2019-06-03 21:16:22 +01:00
Mark Thompson
7056002796 vaapi_encode: Remove unused function 2019-06-03 21:16:22 +01:00
Paul B Mahol
97ddc5d1f7 avfilter/af_anlmdn: add support for commands 2019-06-03 14:20:19 +02:00
Jun Zhao
0b7bfa8ad7 lavf/sr: Refine the coding style for init
We perfer the coding style like:

/* some stuff */
if (error) {
    /* error handling */
    return -(errorcode);
}
/* normal actions */
do_something()

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-06-03 13:04:23 +08:00
Jun Zhao
5c1fbc4239 lavf/sr: Don't need to check NULL before sws_freeContext
sws_freeContext have check the NULL pointer, so don't need to check
NULL before sws_freeContext.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-06-03 13:04:23 +08:00
Jun Zhao
51b0e81216 lavf/sr: Dump input pixel format in error message
Dump input pixel format in error message, it's will help to debugging

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-06-03 13:04:23 +08:00
Zhong Li
165eabf19b lavf/qsv: use av_cold for init/uninit
Signed-off-by: Zhong Li <zhong.li@intel.com>
2019-06-03 05:39:06 +08:00
Ruiling Song
94ceeba9f9 avfilter/vf_unsharp: enable slice threading
benchmarking with a simple command:
ffmpeg -i 1080p.mp4 -vf unsharp=la=3:ca=3 -an -f null /dev/null
with the patch, the fps increase from 50 to 120 on my local machine (i7-6770HQ).

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
2019-06-03 10:49:57 +08:00
Jun Zhao
bbad0bc5ff lavfi/lut: Add slice threading support
Used the command for 1080p h264 clip as follow:

a). ffmpeg -i input -vf lutyuv="u=128:v=128" -f null /dev/null
b). ffmpeg -i input -vf lutrgb="g=0:b=0" -f null /dev/null

after enabled the slice threading, the fps change from:

a). 144fps to 258fps (lutyuv)
b). 94fps  to 153fps (lutrgb)

in Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-06-03 09:38:28 +08:00
Jun Zhao
360bee8ca4 lavfi/colorlevels: Add slice threading support
Add slice threading support, use the command like:

./ffmpeg -i input -vf colorlevels -f null /dev/null

with 1080p h264 clip, the fps from 39 fps to 79 fps
in the local(Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz)

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-06-03 09:36:14 +08:00
Mark Thompson
468f003843 hwcontext_qsv: Try to select a matching VAAPI device by default
Tries to find a device backed by the i915 kernel driver and loads the iHD
VAAPI driver to use with it.  This reduces confusion on machines with
multiple DRM devices and removes the surprising requirement to set the
LIBVA_DRIVER_NAME environment variable to use libmfx at all.
2019-06-02 23:03:27 +01:00
Mark Thompson
0b4696fbe8 hwcontext_vaapi: Try to create devices via DRM before X11
Opening the device via X11 (DRI2/DRI3) rather than opening a DRM render
node directly is only useful if you intend to use the legacy X11 interop
functions.  That's never true for the ffmpeg utility, and a library user
who does want this will likely provide their own display instance rather
than making a new one here.
2019-06-02 23:03:27 +01:00
Mark Thompson
7f3f5a24a1 hwcontext_vaapi: Add option to set driver name
For example: -init_hw_device vaapi:/dev/dri/renderD128,driver=foo

This may be more convenient that using the environment variable, and allows
loading different drivers for different devices in the same process.
2019-06-02 23:03:27 +01:00
Mark Thompson
6b6b8a6371 hwcontext_vaapi: Make default DRM device selection more helpful
Iterate over available render devices and pick the first one which looks
usable.  Adds an option to specify the name of the kernel driver associated
with the desired device, so that it is possible to select a specific type
of device in a multiple-device system without knowing the card numbering.

For example: -init_hw_device vaapi:,kernel_driver=amdgpu will select only
devices using the "amdgpu" driver (as used with recent AMD graphics cards).

Kernel driver selection requires libdrm to work.
2019-06-02 23:03:10 +01:00
Mark Thompson
d2141a9b65 hwcontext_vaapi: Add option to specify connection type
Can be set to "drm" or "x11" to force a specific connection type.
2019-06-02 22:58:22 +01:00
Mark Thompson
a444863738 ffmpeg_hw: Treat empty device string as no device setting
The implementation will use some default in this case.  The empty string
is not a meaningful device for any existing hardware type, and indeed
OpenCL treats it identically to no device already to work around the lack
of this setting on the command line.
2019-06-02 22:58:22 +01:00
Mark Thompson
1f8b36329f ffmpeg_hw: Mark some strings as const 2019-06-02 22:58:22 +01:00
Mark Thompson
909bcedc58 vaapi_encode: Warn if input has cropping information
Cropping is not supported by VAAPI encode.
2019-06-02 17:30:41 +01:00
Mark Thompson
ef2f89bbcc vf_scale_vaapi: Add options to configure output colour properties
The "out_color_matrix" and "out_range" properties match the same options
in vf_scale; the others attempt to follow the same pattern.
2019-06-02 17:30:41 +01:00
Mark Thompson
5051b7f898 lavfi/vaapi: Improve support for colour properties
Attempts to pick the set of supported colour properties best matching the
input.  Output is then set with the same values, except for the colour
matrix which may change when converting between RGB and YUV.
2019-06-02 17:30:41 +01:00
Mark Thompson
5fb9eb9ed2 vf_misc_vaapi: Add missing return value checks
Parameter buffer creation can fail.
2019-06-02 17:30:41 +01:00
Mark Thompson
6ed34a4379 lavfi/vaapi: Factorise out common code for parameter buffer setup
Also enables cropping on all VAAPI filters, inherited from the existing
support in scale_vaapi.
2019-06-02 17:30:41 +01:00
Mark Thompson
963c4f85fe doc/indevs: Add example using cropping to capture part of a plane 2019-06-02 17:30:41 +01:00
Mark Thompson
f1b359aaf5 vf_crop: Add support for cropping hardware frames
Set the cropping fields in the AVFrame.
2019-06-02 17:30:41 +01:00
Steven Liu
4ef0bea292 doc/muxers: fix typo of the hls var_stream_map example
And fix typo of the 1833 of hlsenc.c

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Steven Liu <lq@onvideo.cn>
2019-06-02 21:53:11 +08:00
Paul B Mahol
fcfe85220d avfilter/af_anlmdn: avoid creating frames with zero samples 2019-06-02 13:00:35 +02:00
Paul B Mahol
1a266a1ef9 avfilter/af_anlmdn: try to recover when cache becomes negative 2019-06-02 12:59:57 +02:00
Paul B Mahol
b535577465 avfilter/af_anlmdn: add smooth factor option 2019-06-02 11:58:49 +02:00
Paul B Mahol
cbaa60329a avfilter/vf_xmedian: remove limitation of only odd number of inputs 2019-06-02 11:07:46 +02:00
Marton Balint
415886588f doc/filters: move reference to framesync options from lut3d to haldclut
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-06-01 19:06:05 +02:00
Steven Liu
76ef18fd39 avutil/dynarry.h: fix comment grammar mistakes of FF_DYNARRAY_ADD
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-06-01 17:43:48 +08:00
Michael Niedermayer
5a6fc87443 avcodec/gdv: Check remaining output after decode 5/6/8/
Improves: Timeout (355sec -> 97sec)
Improves: 14709/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GDV_fuzzer-5704215281795072

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
2019-05-31 22:44:30 +02:00
Michael Niedermayer
710b7ec071 tools: Add fuzzer for demuxers
This is based on target_dec_fuzzer

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-05-31 22:44:30 +02:00
Carl Eugen Hoyos
d1b4ea2f61 lavfi/showspatial: Remove two write-only variables.
Fixes two warnings:
libavfilter/avf_showspatial.c:157:26: warning: variable ‘w’ set but not used
libavfilter/avf_showspatial.c:157:23: warning: variable ‘h’ set but not used
2019-05-31 22:30:46 +02:00
Paul B Mahol
b19550367f avfilter: add showspatial multimedia filter 2019-05-31 12:53:20 +02:00
Nick Renieris
9c35285aea avcodec/tiff: Recognize DNG/CinemaDNG images
Additionally:
- Renamed TIFF_WHITE_LEVEL to DNG_WHITE_LEVEL since it is specified
  in the DNG spec.
- Added/changed some comments to be more precise in differentiating
  between TIFF, TIFF/EP and DNG values.

Related to ticket: https://trac.ffmpeg.org/ticket/4364

Signed-off-by: Nick Renieris <velocityra@gmail.com>
2019-05-30 19:27:05 +02:00
Nick Renieris
661facb8a8 libavcodec/tiff: Process SubIFDs tag with multiple entries
SubIFDs that were part of more than single-sized "SubIFDs" tags were
being ignored due to existing code ignoring that case.

This patch makes is so the first entry is read, which is not ideal
but enough for some DNG images present in the wild to be decodeable
More specifically, the first SubIFD which we would process with this
patch is the main image and the second one is a second thumbnail,
which is not as important to decode.

In DNG images with the .tiff extension, it solves the issue where
the TIFF thumbnail in IFD 0 was incorrectly parsed (related
confusion: [1]).

Embedded thumbnails for DNG images can still be decoded with the
"-thumbnail" option.

Related to ticket: https://trac.ffmpeg.org/ticket/4364

[1]: https://superuser.com/questions/546879/creating-video-from-dng-images-with-ffmpeg

Signed-off-by: Nick Renieris <velocityra@gmail.com>
2019-05-30 19:27:05 +02:00
Nick Renieris
a7e018b05e avcodec/tiff: Option to decode embedded thumbnail
Adds the "-thumbnail" option, that works like the current "-subifd"
option, but only for non-full-sized images.

This is particularly useful for DNG images (see next commit) that
have SubIFDs that are not necessarily thumbnails.

Signed-off-by: Nick Renieris <velocityra@gmail.com>
2019-05-30 19:27:05 +02:00