1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

43889 Commits

Author SHA1 Message Date
Andreas Rheinhardt
63f5f01226 avcodec/sonic: Don't hardcode sizeof(int) == 4
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-04 21:30:56 +01:00
Andreas Rheinhardt
cba55c3353 avcodec/sonic: Allocate several buffers together
It simplifies freeing them and reduces the amount of allocations.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-04 21:09:58 +01:00
Mark Thompson
755203c2d2 vaapi_encode_mpeg2: Fix setting colour properties
Follow the same pattern as the previous commits for H.264 and H.265.

Reviewed-By: Jan Ekström <jeebjp@gmail.com>
Tested-By: Xu, Yefeng <yefengx.xu@intel.com>
2020-11-03 20:36:44 +00:00
Mark Thompson
486817e1ae vaapi_encode_h265: Fix setting colour properties
Matching the previous commit for H.264.

Reviewed-By: Jan Ekström <jeebjp@gmail.com>
Tested-By: Xu, Yefeng <yefengx.xu@intel.com>
2020-11-03 20:36:14 +00:00
Mark Thompson
9faf4dcf23 vaapi_encode_h264: Fix setting colour properties
The properties should always be set; only the presence flags want to be
conditional.

Fixes #8959.

Reviewed-By: Jan Ekström <jeebjp@gmail.com>
Tested-By: Xu, Yefeng <yefengx.xu@intel.com>
2020-11-03 20:35:39 +00:00
Andreas Rheinhardt
1c430f6045 avcodec/mpc8: Unobfuscate sign-extension
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-03 16:21:10 +01:00
Andreas Rheinhardt
33fbc90735 avcodec/mimic: Inline constants
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-03 16:21:10 +01:00
Andreas Rheinhardt
7781aa85bc avcodec/tscc2: Don't check for errors for complete VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-03 16:21:10 +01:00
Zane van Iperen
2433b62f79
avcodec/utils: add adpcm_ima_alp to av_get_exact_bits_per_sample()
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-11-03 12:25:01 +10:00
Michael Niedermayer
bbba41704b avcodec/magicyuv: Free previous VLC table
Fixes: memleak
Fixes: 26788/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MAGICYUV_fuzzer-5184116808744960

Regression since: 1bf30a1beb

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-11-03 00:46:59 +01:00
Fei Wang
3308bbf776 avcodec: add av1 VAAPI decoder
Example cmdline:
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -v verbose \
-c:v av1 -i input.ivf -pix_fmt yuv420p -vsync passthrough -f md5     \
-y out.md5

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2020-11-02 22:57:23 +00:00
Timo Rothenpieler
45e3131c44 avcodec/nvenc: fix build with older SDKs 2020-10-30 20:44:49 +01:00
Timo Rothenpieler
91b8e00538 avcodec/nvenc: only enforce explicitly set twopass mode 2020-10-30 17:27:03 +01:00
Timo Rothenpieler
d5b0a8e503 avcodec/nvenc: only auto-pick vbr rc in cq mode 2020-10-30 17:27:03 +01:00
Timo Rothenpieler
bb6edf618a avcodec/nvenc: all presets are SDK10 presets now 2020-10-29 21:59:37 +01:00
Michael Niedermayer
ec7e0d4288 avcodec/utils: Check sample rate before use for AV_CODEC_ID_BINKAUDIO_DCT in get_audio_frame_duration()
Fixes: shift exponent 95 is too large for 32-bit type 'int'
Fixes: 26590/clusterfuzz-testcase-minimized-ffmpeg_dem_SMACKER_fuzzer-5120609937522688

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-29 20:42:48 +01:00
Andreas Rheinhardt
9b45c6d74b avcodec/vp3: Don't check for errors for complete VLC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-29 11:22:35 +01:00
Andreas Rheinhardt
c72a29df6b avcodec/cllc: Don't unnecessarily free VLC
The Canopus Lossless decoder uses several VLCs and if initializing the
ith VLC fails, all the VLCs 0..i have been freed; the ith VLC's table is
initialized to NULL for this purpose. Yet it is totally unnecessary to
free the ith VLC table at all: ff_init_vlc_sparse() cleans up after
itself on error and if an error happens before ff_init_vlc_sparse(),
the ith VLC hasn't been touched yet and doesn't need freeing.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-29 11:22:35 +01:00
Andreas Rheinhardt
1d658e65ab avcodec/clearvideo: Don't check for errors for complete VLC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-29 11:22:35 +01:00
James Almer
37d742b607 avcodec/codec2utils: move the remaining avpriv functions to lavf
They are only used by the codec2 demuxers.

The symbols are kept around until the next major bump.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-28 11:59:35 -03:00
James Almer
7f76974e7d libavcodec/codec2utils: remove codec2_version_from_extradata()
It's only used in the codec2 demuxers, and can be simplified with an AV_RB16()
call instead.

Suggested-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-28 11:59:16 -03:00
James Almer
3916af4d95 avcodec/codec2utils: remove avpriv prefix from inline functions
Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-28 11:55:53 -03:00
James Almer
fec1b4738f avcodec/av1dec: fix loading PrevGmParams for frames with primary_ref_frame none
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-28 11:26:25 -03:00
James Almer
7dac8ddb20 avcodec/av1dec: don't derive loop filter delta parameters
This is now handled by CBS.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-28 11:26:25 -03:00
James Almer
5ed9f8c66c avcodec/cbs_av1: infer segmentation parameters from reference frames
Partially implements setup_past_independence() and load_previous().
These ensures they are always set, even if the values were not coded
in the input bitstream and will not be coded in the output bitstream.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-28 11:26:25 -03:00
James Almer
5d1238f77f avcodec/cbs_av1: infer loop filter delta parameters from reference frames
Partially implements setup_past_independence() and load_previous().
These ensures they are always set, even if the values were not coded
in the input bitstream and will not be coded in the output bitstream.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-28 11:26:25 -03:00
Anton Khirnov
0438521888 lavc: un-avpriv avpriv_bprint_to_extradata()
It has not been used outside of lavc since 6f69f7a8bf.

Also, move it to the only place where it is used.
2020-10-28 13:53:23 +01:00
Anton Khirnov
dc1099442e put_bits: make avpriv_copy_bits() lavc-local
It is not used outside of lavc anymore. Keep the avpriv exported symbol
around until the next bump to preserve ABI compatibility.
2020-10-28 13:53:23 +01:00
Anton Khirnov
944ba30db0 put_bits: make avpriv_put_string() lavc-local
It has not been used outside of libavcodec since
20f325f320
2020-10-28 13:53:23 +01:00
Anton Khirnov
717503f716 put_bits: make avpriv_align_put_bits() inline
This function is so extremely simple that it is preferable to make it
inline rather than deal with all the complications arising from it being
an exported symbol.

Keep avpriv_align_put_bits() around until the next major bump to
preserve ABI compatibility.
2020-10-28 13:53:23 +01:00
Andreas Rheinhardt
81d4b8fb3c avcodec/bitstream: Stop allocating one VLCcode more than needed
Allocating one temporary entry more than needed was made necessary by
the COPY loop below writing an element before having checked that it
should be written at all. But given that this behaviour changed, the
need for overallocating is gone.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-28 11:28:24 +01:00
Andreas Rheinhardt
e75b6ec43b avcodec/bitstream: Check code length before truncating to uint8_t
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-28 11:23:33 +01:00
Xu Guangxin
e5be4c5a88 avcodec/hevcdec: constrained intra predict, do not check top left IS_INTRA if it's not available
fix ticket: 8932

For poc 2, we have tile boundary at x = 640.
When we predict cu(640,912),the top left pixel is not avaliable to the cu.
So, we can not check it's intra or not. We need set top[-1] = top[0] directly.
see 8.4.4.2.1 for details

Signed-off-by: Xu Guangxin <oddstone@gmail.com>
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
2020-10-28 11:29:09 +08:00
Andreas Rheinhardt
8b1bb4f38e avcodec/webp: Replace never-true check by assert
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-27 11:51:01 +01:00
Andreas Rheinhardt
548f1a3fa4 avcodec/webp: Return directly when creating Huff table fails
Neither the auxiliary VLC table nor the code_lengths array need to be
freed if creating the auxiliary VLC table fails.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-27 11:51:01 +01:00
Andreas Rheinhardt
d4cce1514e avcodec/webp: Use uint8_t for code lengths
They are always in the range 0..15, so using an int is not necessary.
Furthermore, using an int would not work if sizeof(int) != 4 as
ff_init_vlc_sparse() can only handle uint8_t, uint16_t and uint32_t
lengths.

Reviewed-by: zhilizhao(赵志立) <quinkblack@foxmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-27 11:51:01 +01:00
Andreas Rheinhardt
df6ec7f83b avcodec/bitstream: Consistently treat symbol as VLC_TYPE
If a static VLC table gets initialized a second time (or concurrently by
two threads) and if said VLC table uses symbols that have the sign bit
of VLC_TYPE (a typedef for int16_t) set, initializing the VLC fails. The
reason is that the type of the symbol in the temporary array is an
uint16_t and so comparing it to the symbol read from the VLC table will
fail, because only the lower 16bits coincide. Said failure triggers an
assert.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-27 10:34:23 +01:00
Andreas Rheinhardt
0da310d7be avcodec/mpeg4videodec: Don't check for errors for complete VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-27 10:33:11 +01:00
Andreas Rheinhardt
5f8de7b741 avcodec/atrac3plus: Perform reusing of VLCs during init
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-27 10:32:16 +01:00
Andreas Rheinhardt
38afc6858c avcodec/atrac3: Use least max_depth for get_vlc2()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-27 10:31:16 +01:00
Andreas Rheinhardt
2d4f878626 avcodec/atrac3: Inline constants
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-27 10:30:28 +01:00
Andreas Rheinhardt
e4eeb851fd avcodec/atrac3: Don't use too big VLC tables
The longest code of any of the VLC tables used is eight bits long, so
using nine bits long VLC tables is wasteful. Furthermore, there are only
seven VLC tables used, yet the code up until now made it look like there
should be eight. This has been corrected, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-27 10:19:38 +01:00
Michael Niedermayer
718e862da3 avcodec/av1dec: Check for unset obu instead of crashing
Fixes: NULL pointer dereference
Fixes: 26550/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-5417762807349248

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-26 19:27:53 +01:00
Michael Niedermayer
343c3149ab avcodec/dirac_parser: do not offset AV_NOPTS_OFFSET
Fixes: signed integer overflow: -9223372036854775807 - 48000 cannot be represented in type 'long long'
Fixes: 26521/clusterfuzz-testcase-minimized-ffmpeg_dem_DIRAC_fuzzer-5635536506847232

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-26 09:10:49 +01:00
Andreas Rheinhardt
307a1b8e54 avcodec/mobiclip: Use smaller type for codes
Even though the length of these codes is > 8, only the lowest seven bits
are ever set (because the long codes are on the left of the tree), so
one can use an uint8_t for them, saving space.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-26 07:56:51 +01:00
Andreas Rheinhardt
77e8c959aa avcodec/mobiclip: Use static VLC tables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-26 07:48:19 +01:00
Andreas Rheinhardt
924bc6d860 avcodec/mobiclip: Don't use too big max_depth, inline constants
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-26 07:46:05 +01:00
Andreas Rheinhardt
10106b5d54 avcodec/mobiclip: Don't check for errors for complete VLCs
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-26 07:43:32 +01:00
Andreas Rheinhardt
c4229ad074 avcodec/mobiclip: Reduce size of VLCs, inline constants
The longest motion vector VLC for mobiclip is six bits long, so using
eight bits for the VLC table is wasteful. Furthermore, the length can be
inlined.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-26 07:25:09 +01:00
Andreas Rheinhardt
3a836f38f6 avcodec/rv34: Simplify getting right VLC
For both RealVideo 3.0 as well as RealVideo 4.0 the VLC table to use
depends upon the slice's quantization parameter; these are coded on five
bits in the bitstream and are therefore in the range of 0..31; yet the
last element here is not valid and therefore the quantizer is clipped to
the range 0..30 to get the index. But this is unnecessary: One can just
add one element more to the relevant array to avoid the clipping.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-26 07:16:10 +01:00