Commit Graph

42932 Commits

Author SHA1 Message Date
Limin Wang
607b85f07e avcodec/zmbv: remove the unnecessary type conversion
Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-08 09:11:56 +08:00
Limin Wang
1b3d5090c5 avcodec/tiff: remove the unnecessary type conversion
Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-08 09:11:56 +08:00
Limin Wang
4cea39ad9b avcodec/pngdec: remove the unnecessary type conversion
Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-08 09:11:56 +08:00
Limin Wang
9d442102b9 avcodec/lcldec: remove the unnecessary type conversion
Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-08 09:11:56 +08:00
Limin Wang
8b07751123 avcodec/libx264: return error if unknown picture type encountered
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-08 06:42:25 +08:00
Limin Wang
f5e33514e7 avcodec/libx264: return immediately if encode_nals return 0
x264_encoder_encode can return 0 with nnal 0. As a result, encode_nals will
return 0. In this condition, it's better to return 0 immediately to avoid
the following unneeded pict_type and flags setting.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-08 06:42:25 +08:00
Limin Wang
d8e98d9348 avcodec/libx265: Fix Uninitialized scalar variable
return error if unknown picture type encountered

Fixes CID 1457234
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-08 06:42:25 +08:00
Marton Balint
2035620b7c avcodec/pcm_rechunk_bsf: add bitstream filter to rechunk pcm audio
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-05-07 23:12:24 +02:00
Limin Wang
a8d7393804 avcodec/profiles: remove duplicate FF_PROFILE_RESERVED entry
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-07 21:10:34 +08:00
Lynne
bdd57e2a37
lavc/bsf: add an Opus metadata bitstream filter
The only adjustable field is the gain. Some ripping/transcoding programs
have started to use it.
2020-05-05 22:25:33 +01:00
Michael Niedermayer
30f5d67510 avcodec/wavpack: Check rate_x and sample rate for overflow
Fixes: shift exponent 32 is too large for 32-bit type 'int'
Fixes: 21647/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5686168323883008

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: David Bryant <david@wavpack.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-05 20:07:19 +02:00
James Almer
f90a48b72e avcodec/avpacket: add missing entry for prft to av_packet_side_data_name()
Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-05 11:54:58 -03:00
Linjie Fu
9473268cfb lavc/vp9: fix reference frame dimensions check for SINGLE_REFERENCE mode
With the description in frame size with refs semantics (SPEC 7.2.5),
it is a requirement of bitstream conformance that for at least one
reference frame has the valid dimensions.

Modify the check to make sure the decoder works well in SINGLE_REFERENCE
mode that not all reference frames have valid dimensions.

Check and error out if invalid reference frame is used in inter_recon.

One of the failure case is a 480x272 inter frame (SINGLE_REFERENCE mode)
with following reference pool:

0.  960x544    LAST    valid
1. 1920x1088 GOLDEN  invalid, but not used in single reference mode
2. 1920x1088 ALTREF  invalid, but not used in single reference mode
3~7  ...     Unused

Identical logic in libvpx:
<https://github.com/webmproject/libvpx/blob/master/vp9/decoder/vp9_decodeframe.c#L736>

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2020-05-05 08:22:28 -04:00
Andriy Gelman
486ed509bc avcodec/v4l2_m2m_enc: Support changing qmin/qmax
Hard coded parameters for qmin and qmax are currently used to initialize
v4l2_m2m device. This commit uses values from avctx->{qmin,qmax} if they
are set.

Reviewed-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-05-05 00:49:42 -04:00
Limin Wang
79e3c4dd74 avcodec/utils: simplify, remove duplicate code
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-05 08:20:45 +08:00
Limin Wang
e468106269 avcodec/v4l2_m2m_enc: reindent code
Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-05 08:20:45 +08:00
Limin Wang
6d720b1aef avcodec/prores_metadata_bsf: Use AVCOL_TRC_NB - 1 for the valid max range
Report by Marton after commit.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-05 08:20:45 +08:00
Linjie Fu
2b32068916 lavc/vaapi_encode: add FF_CODEC_CAP_INIT_CLEANUP caps for encoders
ff_vaapi_encode_close() is not enough to free the resources like cbs
if initialization failure happens after codec->configure (except for
vp8/vp9).

We need to call avctx->codec->close() to deallocate, otherwise memory
leak happens.

Add FF_CODEC_CAP_INIT_CLEANUP for vaapi encoders and deallocate the
resources at free_and_end inside avcodec_open2().

Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
2020-05-04 12:33:30 -03:00
James Almer
3d51d3b42d avcodec/cbs_h265: add missing support for reserved_payload_extension_data SEI bits
Fixes ticket #8622

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-03 19:53:01 -03:00
James Almer
3a41bac4e2 avcodec/cbs_h265: move the payload_extension_present check into its own function
Will be reused in the following patch.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-03 19:53:01 -03:00
James Almer
bdfc1d3cd3 avcodec/cbs_h265: rename H265RawPSExtensionData to H265RawExtensionData
So that NAL types other than Parameter Set ones may use it.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-03 19:53:00 -03:00
Limin Wang
aa6d32ae43 Revert "avcodec/proresenc_anatoliy: support for more color matrix for proresenc"
This reverts commit e0eed1fd52.
2020-05-04 05:22:51 +08:00
Derek Buitenhuis
422f1e32ea avcodec/librav1e: Require a bitrate to be set when using 2-pass mode
Not requiring this leads to unexpected result, since Rav1e's current
two pass API has no way to fail in such a case.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2020-05-03 17:04:07 +01:00
James Almer
1a9684c08a avcodec/h265_metadata: filter parameter sets in packet side data
Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-03 11:40:39 -03:00
James Almer
502dacdc50 avcodec/h264_metadata: filter parameter sets in packet side data
Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-03 11:39:00 -03:00
James Almer
3921eed398 avcodec/av1_metadata: filter parameter sets in packet side data
Extradata included in packet side data is meant to replace the codec context
extradata. So when muxing for example to MP4 without this change and if
extradata is present in a packet side data, the result will be that the
parameter sets present in keyframes will be filtered, but the parameter sets
ultimately included in the av1C box will not.

This is especially important for AV1 as both currently supported encoders don't
export the Sequence Header in the codec context extradata, but as packet side
data instead.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-03 11:38:03 -03:00
Limin Wang
e0eed1fd52 avcodec/proresenc_anatoliy: support for more color matrix for proresenc
Please tested with below command:
./ffmpeg -i ../fate-suite/mpeg2/t.mpg  -c:v prores_aw -color_primaries bt2020 -colorspace bt2020_ncl -color_trc smpte2084 -an output.mov

mediainfo outout.mov
...
Color primaries                          : BT.2020
Transfer characteristics                 : PQ
Matrix coefficients                      : BT.2020 non-constant

./ffmpeg -i ../fate-suite/mpeg2/t.mpg  -c:v prores_aw -color_primaries bt2020 -colorspace bt2020_ncl -color_trc arib-std-b67 -an output.mov
mediainfo outout.mov
...
Color primaries                          : BT.2020
Transfer characteristics                 : HLG
Matrix coefficients                      : BT.2020 non-constant

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-03 05:28:33 +08:00
Limin Wang
d8bc4d23e3 avcodec/prores_metadata_bsf: add arib-std-b67 format support
It's based on the following specs:
RDD 45:2017 - SMPTE Registered Disclosure Doc - Interoperable Master Format - Application ProRes

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-03 05:28:33 +08:00
Limin Wang
2d17f43fe1 avcodec/prores_metadata_bsf: add smpte2084 format support
It's based on the following specs:
RDD 36:2015 - SMPTE Registered Disclosure Doc - Apple ProRes Bitstream Syntax and Decoding Process

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-03 05:28:33 +08:00
Limin Wang
f88a7aa49a avcodec/nvenc_hevc: add spatial-aq and temporal-aq option to consistent with nvenc_h264
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-03 05:28:33 +08:00
Limin Wang
4897ebb6ea avcodec/nvenc_h264: add spatial_aq and temporal_aq option to consistent with nvenc_hevc
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-03 05:28:33 +08:00
Marton Balint
425e08d571 avcodec/bsf: support shorthand options for av_bsf_list_parse_str
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-05-02 19:14:08 +02:00
Marton Balint
c96904f525 avcodec/decode: use a single list bsf for codec decode bsfs
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-05-02 19:14:08 +02:00
Michael Niedermayer
e16e3e63f0 avcodec/vp9dsp_template: Fix integer overflows in idct32_1d()
Fixes: signed integer overflow: -193177 * 11585 cannot be represented in type 'int'
Fixes: 20557/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP9_fuzzer-5704852816789504

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-02 17:31:04 +02:00
Michael Niedermayer
49ae034b42 avcodec/alacdsp: Fix invalid shift in append_extra_bits()
Fixes: left shift of negative value -1
Fixes: 21390/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-6242539519868928

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-02 17:30:02 +02:00
Michael Niedermayer
62e4003780 libavcodec/wmalosslessdec: prevent sum of positive numbers from becoming negative
Fixes: left shift of negative value -8321365
Fixes: 20506/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-4798062906310656

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-02 17:29:23 +02:00
Michael Niedermayer
2d465a401d avcodec/dstdec: Fix integer overflow in read_table()
Fixes: signed integer overflow: -16 * 134217879 cannot be represented in type 'int'
Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5639509530378240

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-02 17:28:06 +02:00
Carl Eugen Hoyos
0d81edcbba lavc/opus: Reset alloc_trim when doing decoder bit-allocation.
Fixes ticket #8649.
Reported-by: irc user Xogium
2020-05-02 10:51:55 +02:00
Timo Rothenpieler
9ce7de9038 avcodec/nvenc: refactor dts calculation logic
The old approach used some highly complex delta computation math and
output-delaying.
I do not remember what the initial reasoning behind that was, but given
that we can just offset the dts by the amount of bframes, it seems wholy
unnecessary.

This leaves open an issue with VFR content, for which some more complex
logic might be needed.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-05-02 01:33:49 +02:00
Piotr Oleszczyk
b9746fcbee ac3enc: fix AC3 downmix metadata issue
Due to a typo, it was impossible to write 0.595 / -4.5 dB
of ltrt_cmixlev, ltrt_surmixlev, loro_cmixlev, loro_surmixlev.
Without any error 0.841 / -1.5 dB was written to file.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-01 23:30:35 +02:00
Derek Buitenhuis
3c740f2d9f avcodec/librav1e: Use the framerate when available for ratecontrol
Rav1e currently uses the time base given to it only for ratecontrol... where
the inverse is taken and used as a framerate. So, do what we do in other wrappers
and use the framerate if we can.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2020-05-01 20:00:42 +01:00
Timo Rothenpieler
aaadf0dce8 avcodec/nvenc: offset dts to account for b-frame reordering
Fixes ticket #7303

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-05-01 20:52:36 +02:00
Limin Wang
1726eefec6 avcodec/mpeg12enc: Use FF_PROFILE_MPEG2_xxx macros
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-01 22:57:29 +08:00
James Almer
38d1815cc6 avcodec/cbs_h265: fix writing extension_data bits
We only care about the right most bit.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-04-30 16:28:01 -03:00
Andriy Gelman
2a9d623561 avcodec/v4l2_context: Log warning when all capture buffers are in userspace
v4l2_m2m uses device memory mapped buffers to store dequeued
frames/packets (reference counted by AVBufferRef). When the reference
count drops to zero, the buffer ownership is returned back to the
device, so that they can re-filled with frames/packets.

There are some cases when all the capture buffers are in userspace
(i.e. due to internal buffering in ffmpeg). On the s5p-mfc this causes
an infinite wait when polling to dequeue the buffers, which can be
prevented by increasing the total number of buffers. This commit adds a
warning when all the capture buffers are dequeued.

Reviewed-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-04-30 11:00:15 -04:00
Andreas Rheinhardt
8f51a89d66 avcodec/avpacket: Don't write into non-writable buffer
The data of an AVPacket may be a part of the data of an AVBufferRef;
Therefore av_grow_packet() doesn't reallocate if the available space in
the actual buffer is sufficient for the enlargement. But given that it
also zeroes the padding it also needs to make sure that the buffer is
actually writable; this commit implements this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-30 09:02:27 +02:00
Ming Qian
7afd34050c avcodec/v4l2_buffers: don't prevent enqueue capture buffer to driver
Enqueue/dequeue of the capture buffers should continue while draining.

Reference: linux/Documentation/media/uapi/v4l/dev-decoder.rst

    "The client must continue to handle both queues independently,
     similarly to normal decode operation. This includes:
     ...
     - queuing and dequeuing CAPTURE buffers, until a buffer marked with
       the V4L2_BUF_FLAG_LAST flag is dequeued"

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-04-29 21:55:35 -04:00
Michael Niedermayer
e444e5bb1a avcodec/tiff: assert that raw tiff dng blit does not write over the end of a line
Found-by: 黄宁 <tsukimurarin@163.com>
Reviewed-by: Nick Renieris <velocityra@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-29 23:42:37 +02:00
Michael Niedermayer
61e6eddc57 avcodec/tiff: Check for planar DNG images
The DNG code hardcodes plane 0 at some places, so its better to disallow cases
that have more planes.

Fixes: eg_crash
Found-by: 黄宁 <tsukimurarin@163.com>
Reviewed-by: Nick Renieris <velocityra@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-29 23:42:37 +02:00
Michael Niedermayer
f1ab6962ca avcodec/tiff: Replace width overriding for bayer by assert
This is less confusing

Reviewed-by: Nick Renieris <velocityra@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-29 23:42:36 +02:00