1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-10-04 09:37:53 +02:00
Commit Graph

40089 Commits

Author SHA1 Message Date
Michael Niedermayer
64c9ce0abc avcodec/wmalosslessdec: Reset num_saved_bits on error path
Fixes: NULL pointer dereference
Fixes: poc-201803.wav
Found-by: GwanYeong Kim <gy741.kim@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-12 01:32:42 +01:00
James Almer
c266049191 avcodec/trace_headers: move the reference in the bsf internal buffer
There's no need to allocate a new packet for it.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-11 15:42:01 -03:00
James Almer
a1a0859ad5 avcodec/remove_extradata: move the reference in the bsf internal buffer
There's no need to allocate a new packet for it.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-11 15:41:15 -03:00
James Almer
11bef2fe72 avcodec/mov2textsub: move the reference in the bsf internal buffer
There's no need to allocate a new packet for it.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-11 15:40:37 -03:00
James Almer
9c6dd9d624 avcodec/extract_extradata: move the reference in the bsf internal buffer
There's no need to allocate a new packet for it.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-11 15:39:47 -03:00
James Almer
aba437a6d0 avcodec/dca_core: move the reference in the bsf internal buffer
There's no need to allocate a new packet for it.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-11 15:38:58 -03:00
James Almer
27d4249fad avcodec/chomp: move the reference in the bsf internal buffer
There's no need to allocate a new packet for it.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-11 15:38:24 -03:00
James Almer
2536bd8632 avcodec/extract_extradata: don't allocate more space than needed when removing NALUs in h264/hevc
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-10 19:29:54 -03:00
Jérôme Martinez
b6fc09cdb4 avcodec/ffv1: support of more pix_fmt
Without direct support of such pix_fmt, content is padded to 16-bit
and it is not possible to know that the source file was with a smaller bit depth
so framemd5 is different

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-10 17:55:50 +01:00
Rostislav Pehlivanov
ea6973a573 vc2enc: replace quantization LUT with a smaller division LUT
This commit replaces the huge and impractical LUT which converted coeffs
and a quantizer to bits to encode and instead uses a standard multiplication
and a shift to replace the division and then codes the values using the
regular golomb coding functions.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2018-03-10 14:40:29 +00:00
James Almer
d168e78eff avcodec/extract_extradata: zero initalize the padding bytes in all allocated buffers
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-09 13:00:58 -03:00
Jérôme Martinez
00035a6b4a avcodec/ffv1enc: remove warning about transparency
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-09 02:39:21 +01:00
Rodger Combs
63d875772d lavc/videotoolbox: fix threaded decoding
AVHWAccel.end_frame can run on a worker thread. The assumption of the
frame threading code is that the worker thread will change the AVFrame
image data, not the AVFrame fields. So the AVFrame fields are not synced
back to the main thread. But this breaks videotoolbox due to its special
requirements (everything else is fine). It actually wants to update
AVFrame fields.

The actual videotoolbox frame is now stored in the dummy AVBufferRef, so
it mimics what happens in non-videotoolbox cases. (Changing the
AVBufferRef contents is a bit like changing the image data.) The
post_process callback copies that reference to the proper AVFrame field.

Based on a patch by wm4.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-03-08 14:04:25 -08:00
Haihao Xiang
00ae5c1d3d lavc/vaapi_encode: Don't return error if the underlying driver doesn't support B frames
The underlying driver need not support B frames - since they are enabled
by default for some codecs, it is better to disable them rather than
returning an error in this case.  This makes the default settings usable
for low-power encoding on Intel platforms.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2018-03-08 00:30:23 +00:00
Aman Gupta
823a758543 avcodec/mediacodecdec: add more trace logging of input/output buffers
Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
2018-03-07 16:22:50 -08:00
Aman Gupta
2a0eb86857 avcodec/mediacodecdec: add delay_flush option
The default behavior of the mediacodec decoder before this commit
was to delay flushes until all pending hardware frames were
returned to the decoder. This was useful for certain types of
applications, but was unexpected behavior for others.

The new default behavior with this commit is now to execute
flushes immediately to invalidate all pending frames. The old
behavior can be enabled by setting delay_flush=1.

With the new behavior, video players implementing seek can simply
call flush on the decoder without having to worry about whether
they have one or more mediacodec frames still buffered in their
rendering pipeline. Previously, all these frames had to be
explictly freed (or rendered) before the seek/flush would execute.

The new behavior matches the behavior of all other lavc decoders,
reducing the amount of special casing required when using the
mediacodec decoder.

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
2018-03-07 16:22:47 -08:00
Aurelien Jacobs
f677718bc8 sbcenc: add armv6 and neon asm optimizations
This was originally based on libsbc, and was fully integrated into ffmpeg.
2018-03-07 22:26:53 +01:00
Aurelien Jacobs
f1e490b1ad sbcenc: add MMX optimizations
This was originally based on libsbc, and was fully integrated into ffmpeg.

Rough speed test:
C version:    speed= 592x
MMX version:  speed= 785x
2018-03-07 22:26:53 +01:00
Aurelien Jacobs
ff4600d954 sbc: implement SBC encoder (low-complexity subband codec)
This was originally based on libsbc, and was fully integrated into ffmpeg.
2018-03-07 22:26:53 +01:00
Aurelien Jacobs
2505ebc632 sbc: add parser for SBC 2018-03-07 22:26:53 +01:00
Aurelien Jacobs
4439887198 sbc: implement SBC decoder (low-complexity subband codec)
This was originally based on libsbc, and was fully integrated into ffmpeg.
2018-03-07 22:26:53 +01:00
Matt Wolenetz
b59b599446 lavc/vorbisdec: Allow avcodec_open2 to call .close
If there is a decoder initialization failure detected in avcodec_open2
after .init is called, allow graceful decoder .close to prevent leaking
vorbis decoder allocations such as those from vorbis_parse_setup_*.

BUG=772699

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-07 20:37:33 +01:00
Aman Gupta
23c91abe4f avcodec/aacdec: log configuration change details
Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-07 11:32:50 -08:00
Stefan _
5ab0ecf283 avcodec/mediacodec_wrapper: fix false positives in swdec blacklist
'OMX.SEC.avc.dec' is a valid hardware decoder, while the decoders
we seek to blacklist all match 'OMX.SEC.*.sw.dec'.
2018-03-07 13:52:02 +01:00
Masaki Tanaka
8b0a9f79c8 mpegvideo_parser: fix indentation of an if statement 2018-03-07 02:11:10 +02:00
Mark Thompson
56912555bc h264_metadata: Actually fail when sei_user_data option is invalid 2018-03-06 23:44:07 +00:00
Aman Gupta
c22e7b00e4 avcodec/mediacodec: reduce loglevel for per-frame logging
Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
2018-03-06 13:54:16 -08:00
Stefan _
313b6057fb avcodec/mediacodec_wrapper: blacklist more software decoders
Additionally blacklist ffmpeg, Samsung and Qualcomm
software implementations offered through MediaCodec.

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
2018-03-06 13:52:24 -08:00
Zhong Li
0645698ecc lavc/qsvenc: disable h264 look_ahead by default
Look_ahead can provide quality improvements, but would better disable it by default due to some reasons:
1. It is only available for some codecs (e.g. HEVC is not supported) on Intel
   Haswell and plus platforms. Thus means it will be failed on some platforms.
2. It significantly increases encoding latency and memory consumption.
3. It may overwrite some other options such as CBR and CAVLC.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2018-03-06 00:23:16 +00:00
Mark Thompson
0cf9fa9924 Merge commit '2d6b3f3a9dce409ca51d70ef4b85c0593bb4b109'
* commit '2d6b3f3a9dce409ca51d70ef4b85c0593bb4b109':
  qsvenc: Provide a detailed error message if the parameters are invalid

Merged-by: Mark Thompson <sw@jkqxz.net>
2018-03-05 23:16:29 +00:00
James Almer
df3a2ff767 avcodec/cbs: use a reference to the assembled CodedBitstreamFragment buffer when writing packets
This saves one malloc + memcpy per packet

The CodedBitstreamFragment buffer is padded to follow the requirements
of AVPacket.

Reviewed-by: jkqxz
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-05 11:44:51 -03:00
Zhong Li
2d6b3f3a9d qsvenc: Provide a detailed error message if the parameters are invalid
Currently it always shows "Selected ratecontrol mode is not supported
by the QSV runtime. Choose a different mode", but sometimes it is not
accurate.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2018-03-05 10:39:17 +01:00
Jerome Borsboom
0ec7eb9305 avcodec/vaapi: mask unused bits in bitplane_present.value
Due to the union construct, unused bits in bitplane_present.value might
be uninitialized even when the used bits are all set to a value.
Masking the unused bits prevents spurious true values when all used
bits are unset, e.g. skipped pictures.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-03-04 22:17:33 +00:00
Jerome Borsboom
883bdc5fb7 avcodec/vaapi: add fields for VAAPI VC-1 interlaced decoding
Pass necessary bitstream elements to the VAAPI VC-1 decoder in order
to start doing interlaced decoding in hardware.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-03-04 22:17:26 +00:00
Jerome Borsboom
1160d1d478 avcodec/vc1: add bitstream elements for VAAPI VC-1 interlaced decoding
We need to pass more bitstream elements to the VAAPI VC-1 decoder in
order to start doing interlaced decoding in hardware.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-03-04 22:16:58 +00:00
Matthieu Bouron
2238e54ef0 avcodec/mediacodecdec: factorize codec declarations 2018-03-03 21:18:39 +01:00
Matthieu Bouron
af167d970b avcodec/mediacodecdec: factorize common extradata functions 2018-03-03 21:18:39 +01:00
Matthieu Bouron
535e020225 avcodec/mediacodecdec: add missing "libavutil/internal.h" include
libavutil/internal.h defines NULL_IF_CONFIG_SMALL.
2018-03-03 21:18:39 +01:00
Matthieu Bouron
c55ba52a6a avcodec/mediacodec_wrapper: load and use MediaFormat.constainsKey()
Avoids triggering an exception in MediaFormat getter functions if the
key does not exist.
2018-03-03 21:18:35 +01:00
Matthieu Bouron
cc9875dc29 avcodec/mediacodecdec_common: remove unused field from MediaCodecDecContext 2018-03-03 21:17:21 +01:00
Matthieu Bouron
5d69e249c8 avcodec/mediacodecdec_common: remove spurious space 2018-03-03 21:17:21 +01:00
Matthieu Bouron
a079eaba8e avcodec/mediacodecdec_common: refactor mediacodec_dec_parse_format() 2018-03-03 21:17:21 +01:00
Philip Langdale
6a89cdc474 avcodec/nvenc: Declare support for P016
nvenc doesn't support P016, but we have two problems today:

1) We declare support for YUV444P16 which nvenc also doesn't support.
   We do this because it's the only pix_fmt we have that can
   approximate nvenc's internal format that is YUV444P10 with data in
   MSBs instead of LSBs. Because the declared format is a 16bit one,
   it will be preferrentially chosen when encoding >10bit content,
   but that content will normally be YUV420P12 or P016 which should
   get mapped to P010 and not YUV444P10.

2) Transcoding P016 content with nvenc should be possible in a pure
   hardware pipeline, and that can't be done if nvenc doesn't say it
   accepts P016. By mapping it to P010, we can use it, albeit with
   truncation. I have established that swscale doesn't know how to
   dither to 10bits so we'd get truncation anyway, even if we tried
   to do this 'properly'.
2018-03-02 14:52:48 -08:00
Philip Langdale
e990713ff9 avcodec/hevcdec: Declare that nvdec supports 12bit decoding 2018-03-02 14:28:13 -08:00
Maxton
1be4c85790 avcodec/wmaprodec: support decoding up to 16 channels of xma
Signed-off by: Maxton <maxton@maxton.xyz>
2018-03-01 20:01:53 +01:00
James Almer
40102a2137 avcodec/Makefile: skip nvdec.h header when nvdec is not enabled
Fixes make checkheaders now that the cuda headers are no longer in-tree

Signed-off-by: James Almer <jamrial@gmail.com>
2018-02-27 17:51:02 -03:00
Michael Niedermayer
f9cb17f988 avcodec/msmpeg4dec: Check for input end in msmpeg4v34_decode_mb()
Fixes: Timeout
Fixes: 6276/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV1_fuzzer-5881196690014208

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-27 19:37:06 +01:00
Michael Niedermayer
8b5c29b6c2 avcodec/truemotion2rt: Check input buffer size
Fixes: Timeout
Fixes: 6250/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2RT_fuzzer-5479814011027456

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-27 19:37:06 +01:00
Michael Niedermayer
3981fb8d2a avcodec/g2meet: Check tile dimensions with av_image_check_size2()
Fixes: OOM
Fixes: 6216/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G2M_fuzzer-4983807968018432

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-27 19:37:06 +01:00
Michael Niedermayer
49062a9017 avcodec/exr: fix invalid shift in unpack_14()
Fixes: 6154/clusterfuzz-testcase-minimized-5762231061970944
Fixes: runtime error: shift exponent 63 is too large for 32-bit type 'int'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-27 19:37:06 +01:00