Commit Graph

108036 Commits

Author SHA1 Message Date
gavin zhang f5c5c04c14 lavc/qsvenc: enlarge the SPS buffer to retrieve larger header
Increase SPS header buffer to support larger header

Signed-off-by: gavin zhang <gavin.zhang@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-08-29 09:37:49 +08:00
Haihao Xiang ea56f7d5e7 lavc/qsvenc: ignore video signal info buffer for VP9
The SDK doesn't support this type of buffer for vp9 encoding

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-08-29 09:37:49 +08:00
Michael Niedermayer c953baa084
avformat/mov: Check count sums in build_open_gop_key_points()
Fixes: ffmpeg.md
Fixes: Out of array access
Fixes: CVE-2022-2566

Found-by: Andy Nguyen <theflow@google.com>
Found-by: 3pvd <3pvd@google.com>
Reviewed-by: Andy Nguyen <theflow@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:45 +02:00
Michael Niedermayer ced0dc807e
doc/git-howto.texi: Document commit signing
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:45 +02:00
Michael Niedermayer 2316d5ec1a
libavcodec/8bps: Check that line lengths fit within the buffer
Fixes: Timeout
Fixes: undefined pointer arithmetic
Fixes: 50330/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EIGHTBPS_fuzzer-5436287485607936

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:45 +02:00
Michael Niedermayer e264a4a76e
tools/target_dec_fuzzer: Adjust threshold for MVDV
Fixes: Timeout
Fixes: 50213/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MVDV_fuzzer-5228284098510848

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:45 +02:00
Michael Niedermayer 628fb97efb
avcodec/midivid: Perform lzss_uncompress() before ff_reget_buffer()
This would avoid regeting the frame on lzss errors

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:44 +02:00
Michael Niedermayer bcb4690304
libavformat/iff: Check for overflow in body_end calculation
Fixes: signed integer overflow: -6322983228386819992 - 5557477266266529857 cannot be represented in type 'long'
Fixes: 50112/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-6329186221948928

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:44 +02:00
Michael Niedermayer 936f2d2634
tools/target_dec_fuzzer: Adjust threshold for MTS2
Fixes: Timeout
Fixes: 50030/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MTS2_fuzzer-5767793731043328

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:44 +02:00
Michael Niedermayer 4d5c0cca94
avcodec/m101: Move checks before ff_get_buffer()
Fixes: Timeout
Fixes: 50109/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_M101_fuzzer-6553193986785280

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:43 +02:00
Michael Niedermayer 049ed1dada
tools/target_dec_fuzzer: Adjust threshold for bethsoftvid
Fixes: Timeout
Fixes: 49791/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BETHSOFTVID_fuzzer-4583956145635328

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:43 +02:00
Michael Niedermayer d93dccdc9f
avcodec/bethsoftvideo: Check block_type before frame alloc
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:43 +02:00
Michael Niedermayer e1c0239d5a
avcodec/bethsoftvideo: Pass GetByteContext into set_palette()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:42 +02:00
Michael Niedermayer f3e823c2aa
avformat/avidec: Prevent entity expansion attacks
Fixes: Timeout
Fixes no testcase, this is the same idea as similar attacks against XML parsers

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:31 +02:00
Andreas Rheinhardt a51bdbb069 avcodec/ac3enc: Add missing header
Needed for code under #ifdef DEBUG; broken in commit
59eadb5060.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-28 12:56:26 +02:00
Andreas Rheinhardt 91ba3f5a8f avcodec/targa: Fix indentation
Forgotten after 1e85a698c0.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 14:14:57 +02:00
Andreas Rheinhardt 5714cf1b5b avcodec/internal: Move ff_dvdsub_parse_palette() to new header dvdsub.h
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 14:14:57 +02:00
Andreas Rheinhardt d1a5ef4069 avcodec/internal: Move ff_side_data_update_matrix_encoding to decode.h
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 14:14:57 +02:00
Andreas Rheinhardt 59eadb5060 avcodec/internal: Move ff_samples_to_time_base() to encode.h
It is only used by encoders; in fact, AVCodecContext.time_base
is only used by encoders, so it is only useful for encoders.

Also constify the AVCodecContext parameter in it.

Also fixup the other headers a bit while removing now unnecessary
internal.h inclusions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 14:14:57 +02:00
Andreas Rheinhardt b9eaf77ed1 avcodec/internal: Move ff_set_dimensions() to decode.h
Decoder-only, as the dimensions are set by the user when encoding.

Also fixup the other headers a bit while removing unnecessary internal.h
inclusions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 14:14:57 +02:00
Andreas Rheinhardt b6a680989c avcodec/internal: Move ff_set_sar() to decode.h
Only used by decoders, as the SAR has to be set by the user
when encoding.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 14:14:56 +02:00
Andreas Rheinhardt 66b691f99f avcodec/internal: Move ff_get_buffer() to decode.h
Only used by decoders (encoders have ff_encode_alloc_frame()).

Also clean up the other headers a bit while removing now redundant
internal.h inclusions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 14:14:56 +02:00
Andreas Rheinhardt e2c24e6a29 avcodec/internal: Move ff_reget_buffer() to decode.h
Only used by decoders.

Also clean up the headers a bit while removing now unnecessary
internal.h inclusions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 14:14:56 +02:00
Andreas Rheinhardt 17e23aed41 avcodec/internal: Move ff_get_format() to decode.h
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 14:14:56 +02:00
Andreas Rheinhardt 6be4b534ce avcodec/roqvideoenc: Remove internal.h inclusion
Possible since c954cf1e1b.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 14:14:56 +02:00
Andreas Rheinhardt 5c217119c8 avcodec/internal: Fix outdated comment
The legacy API is long gone.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 02:23:43 +02:00
Andreas Rheinhardt 3fdfd4b725 avcodec/encode: Fix outdated comment
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 02:23:43 +02:00
Andreas Rheinhardt a499b4345b avcodec: Make ff_alloc_packet() based encoders accept user buffers
Up until now, these encoders received non-refcounted packets
(whose data was owned by the corresponding AVCodecContext)
from ff_alloc_packet(); these packets were made refcounted lateron
by av_packet_make_refcounted() generically.
This commit makes these encoders accept user-supplied buffers by
replacing av_packet_make_refcounted() with an equivalent function
that is based upon get_encode_buffer().

(I am pretty certain that one can also set the flag for mpegvideo-
based encoders, but I want to double-check this later. What is certain
is that it reallocates the buffer owned by the AVCodecContext
which should maybe be moved to encode.c, so that proresenc_kostya.c
and ttaenc.c can make use of it, too.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 02:23:43 +02:00
Andreas Rheinhardt 7360e97e4b avcodec/(dca|tta|pcm-bluray|pcm-dvd|wavpack)enc: Set pts+dur generically
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 02:23:43 +02:00
Andreas Rheinhardt 52dcf0e0f5 avcodec/encode: Remove redundant check
frame is always set at this point for no-delay encoders.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 02:23:43 +02:00
Andreas Rheinhardt 1e6307f46c avcodec/encode, frame_thread_encoder: Unify calling encode callback
The encode-callback (the callback used by the FF_CODEC_CB_TYPE_ENCODE
encoders) is currently called in two places: encode_simple_internal()
and by the worker threads of frame-threaded encoders.

After the call, some packet properties are set based upon
the corresponding AVFrame properties and the packet is made
refcounted if it isn't already. So there is some code duplication.

There was also non-duplicated code in encode_simple_internal()
which is executed even when using frame-threading. This included
an emms_c() (which is needed for frame-threading, too, if it is
needed for the single-threaded case, because there are allocations
(via av_packet_make_refcounted()) immediately after returning
from the encode-callback).

Furthermore, some further properties are only set in
encode_simple_internal(): For audio, pts and duration are derived
from the corresponding fields of the frame if the encoder does not
have the AV_CODEC_CAP_DELAY set. Yet this is wrong for frame-threaded
encoders, because frame-threading always introduces delay regardless
of whether the underlying codec has said cap. This only worked because
there are no frame-threaded audio encoders.

This commit fixes the code duplication and the above issue by factoring
this code out and reusing it in both places. It would work in case
of audio codecs with frame-threading, because now the values are
derived from the correct AVFrame.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 02:23:43 +02:00
Andreas Rheinhardt 4dddcd08c4 avcodec/frame_thread_encoder: Forward got_packet directly
Instead of indicating whether we got a packet by setting
pkt->data and pkt->size to zero.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 02:23:43 +02:00
Andreas Rheinhardt 312d4467f3 avcodec/encode: Simplify check for frame-threaded encoder
AVCodecInternal.frame_thread_encoder is only set iff
active_thread_type is FF_THREAD_FRAME.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 02:23:43 +02:00
Andreas Rheinhardt 18e55de45a avcodec/aptx: Move AudioFrameQueue to aptxenc.c
It is only used by the encoder.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 02:23:43 +02:00
Andreas Rheinhardt 8e56e6b2be avcodec/encode: Apply intra_only_flag for receive_packet-API, too
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 02:23:43 +02:00
Andreas Rheinhardt e405298ebd avcodec/tests/avcodec: Mark frame-thrd encoder incompatible with delay
The API for frame-threaded encoders only works
for one-in-one-out encoders.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 02:23:43 +02:00
Andreas Rheinhardt d27c5bce33 avformat/tests/imf: Test ff_imf_parse_cpl_from_xml_dom cleanup on error
Improves the test; also should fix Coverity issue #1512408.

Reviewed-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 02:16:36 +02:00
Philip Langdale caf26a8a12 lavc/vaapi: Switch preferred 8bit 444 format to VUYX
As vaapi doesn't actually do anything useful with the alpha channel,
and we have an alphaless format available, let's use that instead.

The changes here are mostly 1:1 switching, but do note the explicit
change in the number of declared channels from 4 to 3 to reflect that
the alpha is being ignored.
2022-08-25 19:04:10 -07:00
Philip Langdale 45726aa117 libswscale: add support for VUYX format
As we already have support for VUYA, I figured I should do the small
amount of work to support VUYX as well. That means a little refactoring
to share code.
2022-08-25 19:03:49 -07:00
Philip Langdale cc5a5c9860 lavu/pixfmt: Introduce VUYX format
This is the alphaless version of VUYA that I introduced recently. After
further discussion and noting that the Intel vaapi driver explicitly
lists XYUV as a support format for encoding and decoding 8bit 444
content, we decided to switch our usage and avoid the overhead of
having a declared alpha channel around.

Note that I am not removing VUYA, as this turned out to have another
use, which was to replace the need for v408enc/dec when dealing with
the format.

The vaapi switching will happen in the next change
2022-08-25 19:02:49 -07:00
Andreas Rheinhardt 61fa1e14e4 avformat/imf_cpl: Check the right variable
Fixes Coverity issue #1512407.

Reviewed-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-25 23:19:57 +02:00
James Almer adc38738cb avcodec/libaomenc: fix the check for presence of encoder interface
ctx->encoder is not a pointer.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-08-25 16:25:55 -03:00
James Almer 9f323cb04c avcodec/libaomenc: check return value of queue_frames()
Signed-off-by: James Almer <jamrial@gmail.com>
2022-08-25 14:28:27 -03:00
James Almer 5bab794e4a avcodec/libaomenc: add init cleanup flag
Signed-off-by: James Almer <jamrial@gmail.com>
2022-08-25 14:28:27 -03:00
Lynne f932b89ea3
lavu/tx: implement aarch64 NEON SIMD FFT
The fastest fast Fourier transform in not just the west, but the world,
now for the most popular toy ISA.

On a high level, it follows the design of the AVX2 version closely,
with the exception that the input is slightly less permuted as we don't have
to do lane switching with the input on double 4pt and 8pt.

On a low level, the lack of subadd/addsub instructions REALLY penalizes
any attempt at writing an FFT. That single register matters a lot,
and reloading it simply takes unacceptably long.
In x86 land, vendors would've noticed developers need this.
In ARM land, you get a badly designed complex multiplication instruction
we cannot use, that's not present on 95% of devices. Because only
compilers matter, right?

Future optimization options are very few, perhaps better register
management to use more ld1/st1s.

All timings below are in cycles:
A53:
Length | C           | New (lavu)  | Old (lavc)  | FFTW
------ |-------------|-------------|-------------|-----
4      |         842 | 420         | 1210        | 1460
8      |        1538 | 1020        | 1850        | 2520
16     |        3717 | 1900        | 3700        | 3990
32     |        9156 | 4070        | 8289        | 8860
64     |       21160 | 9931        | 18600       | 19625
128    |       49180 | 23278       | 41922       | 41922
256    |      112073 | 53876       | 93202       | 101092
512    |      252864 | 122884      | 205897      | 207868
1024   |      560512 | 278322      | 458071      | 453053
2048   |     1295402 | 775835      | 1038205     | 1020265
4096   |     3281263 | 2021221     | 2409718     | 2577554
8192   |     8577845 | 4780526     | 5673041     | 6802722

Apple M1
New  - Total for len 512 reps 2097152 = 1.459141 s
Old  - Total for len 512 reps 2097152 = 2.251344 s
FFTW - Total for len 512 reps 2097152 = 1.868429 s

New  - Total for len 1024 reps 4194304 = 6.490080 s
Old  - Total for len 1024 reps 4194304 = 9.604949 s
FFTW - Total for len 1024 reps 4194304 = 7.889281 s

New  - Total for len 16384 reps 262144 = 10.374001 s
Old  - Total for len 16384 reps 262144 = 15.266713 s
FFTW - Total for len 16384 reps 262144 = 12.341745 s

New  - Total for len 65536 reps 8192 = 1.769812 s
Old  - Total for len 65536 reps 8192 = 4.209413 s
FFTW - Total for len 65536 reps 8192 = 3.012365 s

New  - Total for len 131072 reps 4096 = 1.942836 s
Old  - Segfaults
FFTW - Total for len 131072 reps 4096 = 3.713713 s

Thanks to wbs for some simplifications, assembler fixes and a review
and to jannau for giving it a look.
2022-08-25 17:40:28 +02:00
Paul B Mahol 9bf9d42d01 avcodec/wavpack: fix regression in decoding
Regression introduced in c6831e2a70.
Fix it by using bitreader that reads 0-32 bits, instead of
0-25 bits and asserting on anything higher.
2022-08-25 09:12:17 +02:00
Paul B Mahol b347a05f1f avformat/riff: add support for ICMV files 2022-08-25 09:12:07 +02:00
rcombs 9546b3a1cb lswr: take const AVChannelLayout* in swr_alloc_set_opts2()
This is fully backwards-compatible in both ABI and API,
so it's only a minor bump.
2022-08-24 18:31:05 -05:00
James Almer 22514527d3 avcodec/libaomenc: use av_fast_realloc() to resize the stats buffer
Reviewed-by: James Zern <jzern@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-08-24 15:22:15 -03:00
James Almer 57041bb7b5 avcodec/libvpxenc: use av_fast_realloc() to resize the stats buffer
Reviewed-by: James Zern <jzern@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-08-24 15:21:44 -03:00