Commit Graph

107253 Commits

Author SHA1 Message Date
Zhao Zhili
07bcedc232 avcodec/cuviddec: fix null pointer dereference
It can happened on error path of cuvid_decode_init().

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2022-06-26 21:44:12 +02:00
Zhao Zhili
ffc91940a4 avcodec/cuviddec: fix AV1 decoding error
cuvidParseVideoData only supports pure OBUs, it reports an unknown
error with AV1CodecConfigurationRecord. Check whether extradata
is AV1CodecConfigurationRecord and skip the first 4 bytes to fix
the issue.

The bug is revealed in ffmpeg cmd since 45e3b6a68 and ffd1316e.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2022-06-26 21:41:31 +02:00
Jack Bruienne
75638fe940 avcodec: fix time reporting for DFPWM streams
This adds the exact bits per sample for DFPWM to
av_get_exact_bits_per_sample.
Previously, the DTS and PTS were set to 0 because the codec never
reported them, but adding this allows libavformat to automatically
set DTS and PTS from the byte position of the stream.

Signed-off-by: Jack Bruienne <jackbruienne@gmail.com>
2022-06-26 17:04:42 +02:00
Andreas Rheinhardt
9dfec90253 avcodec/x86/h264_qpel: Remove unused functions
Forgotten in 4011a76494.
The reason for this is that these functtions are marked
as av_always_inline and GCC does not emit warnings
if such functions are unused, so this went unnoticed.
Yet Clang does, so this commit removes them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-26 07:09:16 +02:00
Andreas Rheinhardt
2cce1d8528 avformat/matroskaenc: Fix use of uninitialized value
Regression since 67eea6cf02.
Affects only WebVTT when muxing WebM. (This is covered
by the webm-webvtt-remux FATE test which fails for several
FATE boxes on fate-ffmpeg.org.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-26 06:12:32 +02:00
Michael Niedermayer
e6cad01122 avformat/matroskadec: avoid integer overflows in SAR computation
This ignores >64bit
Alternatively we could support that if it occurs in reality

Fixes: negation of -9223372036854775808
Fixes: integer overflows
Fixes: 46072/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-5029840966778880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-06-25 21:36:32 +02:00
Leo Izen
59a58d1a85 avcodec/libjxlenc: properly read input colorspace
Whether an ICC profile is present or not, the libjxl
encoder wrapper should now properly read colorspace tags
and forward them to libjxl appropriately, rather than just
assume sRGB as before. It will also print warnings when
colorimetric assumptions are made about the input data.

Reviewed-by: Niklas Haas <git@haasn.dev>
Signed-off-by: Leo Izen <leo.izen@gmail.com>
2022-06-25 17:07:35 +02:00
Leo Izen
ef43767911 avcodec/libjxldec: properly tag output colorspace
Whether an ICC profile is present or not, the decoder
should now properly tag the colorspace of pixel data
received by the decoder.

Reviewed-by: Niklas Haas <git@haasn.dev>
Signed-off-by: Leo Izen <leo.izen@gmail.com>
2022-06-25 17:07:09 +02:00
Gyan Doshi
0744c84792 avfilter/Makefile: always make colorspace.o
Unbreaks libavfilter builds when configured with a subset of filters.

drawutils added ff_draw_init2 in 6c3a82f043 which calls functions defined in
colorspace.c. So the latter needs to be built alongside the former.
2022-06-25 17:55:53 +05:30
Brad Smith
beaf172d75 avutil/ppc/cpu: Use proper header for OpenBSD PPC CPU detection
Use the proper header for PPC CPU detection code. sys/param.h includes
sys/types, but sys/types.h is the more appropriate header to be used
here.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-06-25 12:16:51 +02:00
James Almer
c7ce03d826 avformat/http: include version.h
This is needed to get LIBAVFORMAT_VERSION, used as part of the user agent.
Fixes a recent regression.

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-06-24 23:07:33 -03:00
ManojGuptaBonda
a44fba0b5b AV1 VDPAU hwaccel Decode support
Support for VDPAU accelerated AV1 decoding was added with libvdpau-1.5.
Support for the same in ffmpeg is added with this patch. Profiles
related to VDPAU AV1 can be found in latest vdpau.h present in
libvdpau-1.5.

Add AV1 VDPAU to list of hwaccels and supported formats
Added file vdpau_av1.c and Modified configure to add VDPAU AV1 support.
Mapped AV1 profiles to VDPAU AV1 profiles. Populated the codec specific
params that need to be passed to VDPAU.

Signed-off-by: Philip Langdale <philipl@overt.org>
2022-06-25 09:05:58 +08:00
Andreas Rheinhardt
cf30b538e5 avformat/matroskaenc: Reuse dynamic buffer
Avoids some allocations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:33:18 +02:00
Andreas Rheinhardt
745966ab81 avformat/matroskaenc: Fix outdated comment
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:33:18 +02:00
Andreas Rheinhardt
e689a1171d avformat/matroskaenc: Improve handling of AV1 extradata
Up until now, only the first four bytes (the ones preceding
the OBU) were written because not enough space has been reserved
for the complete CodecPrivate. This commit changes this
by increasing the space reserved for the CodecPrivate (it is big
enough for every sane sequence header plus something extra);
the code falls back to writing four bytes in case the increased
space turns out to be insufficient.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:33:18 +02:00
Andreas Rheinhardt
a367e435d8 avcodec/av1: Add upper bound for the size of a sane sequence header
It will be used by the Matroska muxer to reserve a certain number
of bytes for the CodecPrivate in case no extradata is initially
available (as it is for the libaom-av1 encoder).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:33:18 +02:00
Andreas Rheinhardt
67eea6cf02 avformat/matroskaenc: Split updating CodecPrivate from writing it
Up until now, updating extradata was very ad-hoc: The amount of
space reserved for extradata was not recorded when writing the
header; instead the AAC code simply presumed that it was enough.
This commit changes this by recording how much space is available.

This brings with it that the code for writing of and reserving space
for the CodecPrivate and for updating it diverges. They are therefore
split; this allows to put other common tasks like seeking to
right offset as well as writing padding (in case the new extradata did
not fill the whole reserved space) to this common function.

The code for filling up the reserved space is smarter than the code
it replaces; therefore it is no longer necessary to reserve more
than necessary just to be sure that one can add an EBML Void element
(whose minimum size is two) lateron. This is the reason for the change
to the aac-autobsf-adtstoasc test.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:33:18 +02:00
Andreas Rheinhardt
3a00a1a800 avformat/matroskaenc: Avoid swapping codecpar->extradata temporarily
Instead pass extradata and extradata_size explicitly.

(It is not perfect, as ff_put_(wav|bmp)_header() still uses
the extradata embedded in codecpar, but this is not an issue
as long as their CodecPrivate isn't updated.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:33:18 +02:00
Andreas Rheinhardt
1056f9a21e avformat/matroskaenc: Split assembling CodecPrivate from writing it
This is in preparation for splitting writing and updating
extradata more thoroughly later.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:33:18 +02:00
Andreas Rheinhardt
70dc5fc658 avcodec/hevc_sei: Fix check for SEI end
The intention behind the current check seems to be to check for
the rbsp_trailing_bits() syntax structure which is always 0x80
for valid SEI messages. Yet this is wrong: These trailing bits
are not part of the GetBitContext -- they have already been
stripped in ff_h2645_packet_split(). And it is harmful, as
0x80 is a legal SEI message payload type (namely for
Structure of pictures information SEI messages). We ignore this
type of SEI, but because of this bug we also ignored every
SEI message in the same NALU following it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:32:03 +02:00
Andreas Rheinhardt
a217c1472d avcodec/h2645_parse: Only trim RBSP trailing padding if it exists
It does not exist for NALUs for which the SODB is empty;
it also does not exist for NALUs for which not even
the complete header is present. The former category contains
end of sequence and end of bitstream units. The latter category
consists of one-byte HEVC units (the ordinary H.264 header is only
one byte long).
This commit therefore stops stripping RBSP trailing padding
from the former type of unit and discards the latter type of unit
altogether.

This also fixes an assertion failure: Before this commit, a one-byte
HEVC NALU from an ISOBMFF packet could pass all the checks in
hevc_parse_nal_header() (because the first byte of the size field
of the next unit is mistaken as containing the temporal_id);
yet because the trailing padding bits were stripped, its actually
had a size of less than eight bits; because h2645_parse.c uses
the checked bitstream reader, the get_bits_count() of the GetBitContext
is not 16 in this case; it is not even a multiple of eight
and this can trigger an assert in ff_hevc_decode_nal_sei().

Fixes: Assertion failure
Fixes: 46662/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-4947860854013952

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:31:03 +02:00
Andreas Rheinhardt
48a0cd06e3 avcodec/hevc_ps: Don't use show_bits_long() unnecessarily
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:28:36 +02:00
Andreas Rheinhardt
0bcca1cb40 avcodec/hcadec: Move transient GetBitContext to stack
This avoids keeping pointers to no longer valid data
in the context.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:28:36 +02:00
Andreas Rheinhardt
7a832f11d9 avcodec/hcadec: Don't use GetBit-API for byte-aligned reads
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:28:36 +02:00
Zhao Zhili
9fdfc74877 avcodec/proresdec2: fix description of known fourcc
'acpo' should be 'apco', and add missing 'ap4x'.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-06-24 15:49:41 +08:00
Zhao Zhili
2c2e9d3844 avcodec/libuavs3d: fix potential index out of range
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-06-24 15:49:11 +08:00
Zhao Zhili
a5931f58f7 avcodec/libdavs2: use frame rate code table
It's more natural than the floating to fraction conversion.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-06-24 15:37:23 +08:00
Zhao Zhili
58d6463296 configure: select avs2 parser for libdavs2 decoder
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-06-24 15:37:23 +08:00
Zhao Zhili
e0cddee277 avcodec/avs2_parser: parse more info
Including video resolution, framerate and picture type, etc.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-06-24 15:37:23 +08:00
Zhao Zhili
b7eee211bc avcodec/avs2_parser: split data into frames
Before the patch, the parser split data into units, not frames.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-06-24 15:37:23 +08:00
Zhao Zhili
592a9e57d9 avcodec/avs2: add AVS2 related definitions
Replace magic numbers by enum values.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-06-24 15:37:23 +08:00
Zhao Zhili
2e6e28ebc1 avformat/movenc: enable compressorname for mp4 mode
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-06-24 15:37:23 +08:00
Steven Liu
7c05b7951c avcodec/audiotoolboxenc: return external error if encode failed
because the AudioConverterFillComplexBuffer can return 0 or 1 if
success.
so set the ret to 0 it AudioConverterFillComplexBuffer success and
return ret value for success or return AVERROR_EXTERNAL when
AudioConverterFillComplexBuffer failed.
BTW change the error message log level from warning to error.

Reviewed-by: Zhao Zhili <zhilizhao@tencent.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2022-06-24 15:03:37 +08:00
Xu Guangxin
ebefca7b0e lavc/vaapi_hevc: fill rext luma/chroma offset in the right way
For range extension, the luma/chroma offset is larger than 8 bits, we
need fill the 16 bits version.

Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2022-06-24 13:09:15 +08:00
Michael Niedermayer
6a82412bf3 avcodec/jpeglsdec: fix end check for xfrm
Fixes: out of array access
Fixes: 47871/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AMV_fuzzer-5646305956855808

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-06-23 22:03:02 +02:00
Michael Niedermayer
b7e30a13d4 avcodec/cdgraphics: limit scrolling to the line
Fixes: out of array access
Fixes: 47877/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CDGRAPHICS_fuzzer-5690504626438144

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-06-23 22:03:02 +02:00
Michael Niedermayer
d8ee014254 avformat/hls: Limit start_seq_no to one bit less
This avoids overflow checks on additions with 32bit numbers

Fixes: signed integer overflow: 9223372036854775806 + 2 cannot be represented in type 'long'
Fixes: 44012/clusterfuzz-testcase-minimized-ffmpeg_dem_HLS_fuzzer-4747770734444544
Fixes: 48065/clusterfuzz-testcase-minimized-ffmpeg_dem_HLS_fuzzer-5372410355908608

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-06-23 22:03:02 +02:00
Wan-Teh Chang
38bc24be8d avcodec/libaomenc: Get number of operating points
Use the new codec control AV1E_GET_NUM_OPERATING_POINTS to get the
number of operating points. This is the size of the output arrays of
AV1E_GET_SEQ_LEVEL_IDX and AV1E_GET_TARGET_SEQ_LEVEL_IDX.

Signed-off-by: Wan-Teh Chang <wtc@google.com>
Signed-off-by: James Zern <jzern@google.com>
2022-06-23 12:44:23 -07:00
Paul B Mahol
5a4ffb4f5e avfilter/vf_gblur: properly round output 2022-06-23 18:50:54 +02:00
Andreas Rheinhardt
fed07efcde avcodec/x86/lossless_videodsp: Remove obsolete MMX(EXT) functions
The only systems which benefit from these are truely
ancient 32bit x86s as all other systems use at least the SSE2 versions
(this includes all x64 cpus (which is why this code is restricted
to x86-32)).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-22 13:41:02 +02:00
Andreas Rheinhardt
230ea38de1 avcodec/x86/lossless_videoencdsp: Remove obsolete MMX function
The only systems which benefit from ff_diff_bytes_mmx are truely
ancient 32bit x86s as all other systems use at least the SSE2 versions
(this includes all x64 cpus (which is why this code is restricted
to x86-32)).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-22 13:40:49 +02:00
Andreas Rheinhardt
839fbe0e98 avcodec/x86/huffyuvencdsp: Remove obsolete MMX function
The only systems which benefit from ff_diff_int16_mmx are truely
ancient 32bit x86s as all other systems use at least the SSE2 versions
(this includes all x64 cpus (which is why this code is restricted
to x86-32)).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-22 13:40:36 +02:00
Andreas Rheinhardt
5e332fe35c avcodec/x86/dirac_dwt: Remove obsolete MMX functions
The only systems which benefit from these are truely
ancient 32bit x86s as all other systems use at least the SSE2 versions
(this includes all x64 cpus (which is why this code is restricted
to x86-32)).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-22 13:40:23 +02:00
Andreas Rheinhardt
4b6ffc2880 avcodec/x86/huffyuvdsp: Remove obsolete MMX functions
The only systems which benefit from these are truely
ancient 32bit x86s as all other systems use at least the SSE2 versions
(this includes all x64 cpus (which is why this code is restricted
to x86-32)).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-22 13:40:10 +02:00
Andreas Rheinhardt
6a551f1405 avcodec/x86/vp8dsp: Remove obsolete MMX(EXT) functions
The only systems which benefit from these are truely
ancient 32bit x86s as all other systems use at least the SSE2 versions
(this includes all x64 cpus (which is why this code is restricted
to x86-32)).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-22 13:39:57 +02:00
Andreas Rheinhardt
61e3cccd36 avcodec/x86/dcadsp: Remove obsolete SSE function
The only systems which benefit from ff_lfe_fir0_float_sse are truely
ancient 32bit x86s as all other systems use at least the SSE2 versions
(this includes all x64 cpus (which is why this code is restricted
to x86-32)).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-22 13:39:44 +02:00
Andreas Rheinhardt
8360354ae8 avcodec/x86/rv34dsp: Remove obsolete MMX function
The only systems which benefit from ff_rv34_idct_dc_add_mmx are truely
ancient 32bit x86s as all other systems use at least the SSE2 versions
(this includes all x64 cpus (which is why this code is restricted
to x86-32)).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-22 13:39:31 +02:00
Andreas Rheinhardt
eb33fd384e avcodec/x86/synth_filter: Remove obsolete SSE function
The only systems which benefit from synth_filter_sse are truely
ancient 32bit x86s as all other systems use at least the SSE2 versions
(this includes all x64 cpus (which is why this code is restricted
to x86-32)).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-22 13:39:18 +02:00
Andreas Rheinhardt
54784ffac5 avcodec/x86/dct32: Remove obsolete SSE function
The only systems which benefit from ff_dct32_float_sse are truely
ancient 32bit x86s as all other systems use at least the SSE2 versions
(this includes all x64 cpus (which is why this code is restricted
to x86-32)).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-22 13:39:06 +02:00
Andreas Rheinhardt
25e39f8c72 avcodec/x86/mpegaudiodsp: Remove obsolete SSE function
The only systems which benefit from imdct36_blocks_sse are truely
ancient 32bit x86s as all other systems use at least the SSE2 versions
(this includes all x64 cpus (which is why this code is restricted
to x86-32)).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-22 13:38:52 +02:00