1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-02 03:06:28 +02:00
Commit Graph

46958 Commits

Author SHA1 Message Date
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
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
Martin Storsjö
48cb2c7a8a videotoolbox_vp9: Add a missing include
This fixes compilation after 0bb0c26799.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-08-24 15:36:03 +03:00
Andreas Rheinhardt
0b3f09689d avcodec/gif: Remove unnecessary headers
The gif encoder uses the bytestream API, not the PutBit-API.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-24 03:43:52 +02:00
Andreas Rheinhardt
0bb0c26799 avutil/mem_internal: Fix headers
Including avassert.h is unnecessary since commit
786be70e28.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-24 03:43:52 +02:00
Andreas Rheinhardt
85655bd9da avcodec/loongarch/cabac, vp9dsp_loongarch: Add missing headers
Fixes checkheaders on loongarch.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-24 03:43:52 +02:00
Andreas Rheinhardt
5bf7187327 avcodec/4xm: Remove unnecessary and redundant emms_c()
It is unnecessary since ee551a21ddcbf81afe183d9489c534ee80f263a0;
but it was redundant even before that, because decode_simple_internal()
calls emms_c().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-24 03:43:47 +02:00
Andreas Rheinhardt
145914524b avcodec/apedec: Remove unnecessary emms_c()
Possible since 6feea076e9.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-24 03:42:38 +02:00
Andreas Rheinhardt
4a699858d5 avcodec/ffv1(dec|enc): Remove unnecessary emms_c()
These codecs do not use MMX at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-24 03:42:38 +02:00
Andreas Rheinhardt
73f024aa58 avcodec/jpeglsenc: Remove unnecessary emms_c()
This encoder does not use any MMX anywhere.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-24 03:42:38 +02:00
Andreas Rheinhardt
da0e7c3b67 avcodec/takdec: Remove unnecessary emms_c()
Possible since 3d716d38ab.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-24 03:42:38 +02:00
Andreas Rheinhardt
505eaf0e37 avcodec/wmalosslessdec: Remove unnecessary emms_c()
Possible since 6feea076e9.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-24 03:42:38 +02:00
James Almer
9c7a8a8546 avcodec/libvpx: fix assembling vp9 packets with alpha channel
There's no warranty that vpx_codec_encode() will generate a list with the same
amount of packets for both the yuv planes encoder and the alpha plane encoder,
so queueing packets based on what the main encoder returns will fail when the
amount of packets in both lists differ.
Queue all data packets for every vpx_codec_encode() call from both encoders
before attempting to assemble output AVPackets out of them.

Fixes ticket #9884

Reviewed-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-08-23 19:40:03 -03:00
Michael Niedermayer
ca4ff9c21c
avcodec/h263dec: Sanity check against minimal I/P frame size
Fixes: Timeout
Fixes: 49718/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-4874987894341632

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-23 20:03:03 +02:00
Michael Niedermayer
3b51e19922
avcodec/hevcdec: Check s->ref in the md5 path similar to hwaccel
This is somewhat redundant with the is_decoded check. Maybe
there is a nicer solution

Fixes: Null pointer dereference
Fixes: 49584/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5297367351427072

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-23 20:03:03 +02:00
Michael Niedermayer
7086491fa0
avcodec/mpegaudiodec_template: use unsigned shift in handle_crc()
Fixes: left shift of 192 by 24 places cannot be represented in type 'int'
Fixes: 49577/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MP1FLOAT_fuzzer-5205996678545408

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-23 20:03:03 +02:00
Michael Niedermayer
8ab944c4c3
avcodec/4xm: treat AV_LOG_ERROR cases as errors
Fixes: Timeout
Fixes: 49504/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FOURXM_fuzzer-570457772222054

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-23 20:03:03 +02:00
Michael Niedermayer
a44f5a5212
avcodec/mjpegdec: bayer and rct are incompatible
Fixes: out of array read
Fixes: 49434/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5208501080686592

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-23 20:03:03 +02:00
James Almer
fb70e0611b avcodec/libsvtav1: properly initialize the flush EbBufferHeaderType struct
Should fix ticket #9834

Signed-off-by: James Almer <jamrial@gmail.com>
2022-08-23 13:03:55 -03:00
Andreas Rheinhardt
72cfc80d7b avcodec/pngdec: Improve decoding text chunks
By checking immediately whether the first allocation was successfull
one can simplify the cleanup code in case of errors.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-23 12:21:00 +02:00
Andreas Rheinhardt
eda3abd1ec avcodec/pngdec: Use char* instead of uint8_t* for text
Also stop casting const away.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-23 12:21:00 +02:00
Andreas Rheinhardt
3d4a5ef5c1 avcodec/pngdec: Use internal AVBPrint string when parsing chunks
One saves an allocation in case the string fits into the buffer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-23 12:21:00 +02:00
Andreas Rheinhardt
a84087eaf8 avcodec/pngdec: Fix APNG_DISPOSE_OP_BACKGROUND
APNG works with a single reference frame and an output frame.
According to the spec, decoding APNG works by decoding
the current IDAT/fdAT chunks (which decodes to a rectangular
subregion of the whole image region), followed by either
overwriting the region of the output frame with the newly
decoded data or by blending the newly decoded data with
the data from the reference frame onto the current subregion
of the output frame. The remainder of the output frame
is just copied from the reference frame.
Then the reference frame might be left untouched
(APNG_DISPOSE_OP_PREVIOUS), it might be replaced by the output
frame (APNG_DISPOSE_OP_NONE) or the rectangular subregion
corresponding to the just decoded frame has to be reset
to black (APNG_DISPOSE_OP_BACKGROUND).

The latter case is not handled correctly by our decoder:
It only performs resetting the rectangle in the reference frame
when decoding the next frame; and since commit
b593abda6c it does not reset
the reference frame permanently, but only temporarily (i.e.
it only affects decoding the frame after the frame with
APNG_DISPOSE_OP_BACKGROUND). This is a problem if the
frame after the APNG_DISPOSE_OP_BACKGROUND frame uses
APNG_DISPOSE_OP_PREVIOUS, because then the frame after
the APNG_DISPOSE_OP_PREVIOUS frame has an incorrect reference
frame. (If it is not followed by an APNG_DISPOSE_OP_PREVIOUS
frame, the decoder only keeps a reference to the output frame,
which is ok.)

This commit fixes this by being much closer to the spec
than the earlier code: Resetting the background is no longer
postponed until the next frame; instead it is applied to
the reference frame.

Fixes ticket #9602.

(For multithreaded decoding it was actually already broken
since commit 5663301560d77486c7f7c03c1aa5f542fab23c24.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-23 12:21:00 +02:00
Haihao Xiang
1adfd28f9e qsvenc_{hevc,h264}: add scenario option
User may get better experience after providing corresponding senario hint
to encoder for the encoding session. See [1] for scenario support in the
SDK

[1]https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#scenarioinfo
2022-08-23 12:42:19 +08:00
Wenbin Chen
ae7d19680b libavcodec/qsvenc: Add adaptive_i/b to hevc_qsv
Add adaptive_i/b feature to hevc_qsv. Adaptive_i allows changing of
frame type from P and B to I. Adaptive_b allows changing of frame type
frome B to P.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-08-23 12:42:19 +08:00
Steven Liu
627543f58a avcodec/audiotoolboxenc: return AVERROR_EXTERNAL immediately when encode error
Just return AVERROR_EXTERNAL immediately when encode error.
The other logic should keep the old behavior before commit 7c05b7951.

Suggested-By: Zhao Zhili <zhilizhao@tencent.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2022-08-22 10:58:13 +08:00
Andreas Rheinhardt
0154fb43e3 avcodec/mpegvideo: Allocate encoder-only tables in mpegvideo_enc.c
This commit moves the encoder-only allocations of the tables
owned solely by the main encoder context to mpegvideo_enc.c.
This avoids checks in mpegvideo.c for whether we are dealing
with an encoder; it also improves modularity (if encoders are
disabled, this code will no longer be included in the binary).
And it also avoids having to reset these pointers at the beginning
of ff_mpv_common_init() (in case the dst context is uninitialized,
ff_mpeg_update_thread_context() simply copies the src context
into dst which therefore may contain pointers not owned by it,
but this does not happen for encoders at all).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-21 04:48:02 +02:00
Andreas Rheinhardt
d0de80ee44 avcodec/mpeg4videodec: Keep data_partitioning in sync between threads
Fixes frame-threaded decoding of samples created by concatting
a video with data partitioning and a video not using it.
(Only the MPEG-4 decoder sets this, so it is synced in
mpeg4_update_thread_context() despite being a MpegEncContext-field.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-21 03:50:53 +02:00
Andreas Rheinhardt
02ad827226 avcodec/mpegvideo_dec: Combine two loops
(I think the check for !reference is unnecessary.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-21 03:50:53 +02:00
James Almer
352799dca8 The vuya pixel format was recently added, so this lavc workaround is no longer
needed.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-08-19 22:48:42 -03:00
Timo Rothenpieler
6dc79f1d04 avutil/half2float: move non-inline init code out of header 2022-08-19 22:09:36 +02:00
Timo Rothenpieler
f3fb528cd5 avutil/half2float: move tables to header-internal structs
Having to put the knowledge of the size of those arrays into a multitude
of places is rather smelly.
2022-08-19 22:09:36 +02:00
Timo Rothenpieler
cb8ad005bb avutil/half2float: adjust conversion of NaN
IEEE-754 differentiates two different kind of NaNs.
Quiet and Signaling ones. They are differentiated by the MSB of the
mantissa.

For whatever reason, actual hardware conversion of half to single always
sets the signaling bit to 1 if the mantissa is != 0, and to 0 if it's 0.
So our code has to follow suite or fate-testing hardware float16 will be
impossible.
2022-08-19 22:09:36 +02:00
Timo Rothenpieler
b42925264a avutil: move half-precision float helper to avutil 2022-08-19 22:09:36 +02:00
Andreas Rheinhardt
afd9da24d9 avcodec/mpegvideo_dec: Don't sync AVCodecContext fields manually
They are already synced generically in update_context_from_thread()
in pthread_frame.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-18 20:20:50 +02:00
Andreas Rheinhardt
22e157c1c6 avcodec/mpegvideo_dec: Remove commented-out cruft
The fields in question were removed in
759001c534.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-18 17:25:10 +02:00
Andreas Rheinhardt
3553b70d6d avcodec/ffv1enc: Remove redundant wrapper
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-18 16:57:47 +02:00
Andreas Rheinhardt
7e9a790441 avcodec/ffv1enc: Don't create and keep unnecessary reference
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-18 16:57:47 +02:00
Andreas Rheinhardt
f76cef5c51 avcodec/get_buffer: Don't get AVPixFmtDescriptor unnecessarily
It is unused since 3575a495f6
(and the error message is dangerous: av_get_pix_fmt_name(format)
returns NULL iff av_pix_fmt_desc_get(format) returns NULL
and using a NULL string for %s would be UB).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-18 16:57:47 +02:00
Andreas Rheinhardt
e506843183 avcodec/mpegpicture: Reset fields explicitly instead of memsetting them
Improves the grepability of the code.
(Furthermore, I hope that no compiler will really call memset
for 28 bytes.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-18 16:57:47 +02:00
Andreas Rheinhardt
f0ea5094af avcodec/h263dec: Don't set frame parameters redundantly
This frame will be reset later in ff_mpv_frame_start()
anyway.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-18 16:57:47 +02:00
Andreas Rheinhardt
74d623914f avcodec/h263dec: Remove redundant code to set cur_pic_ptr
It is done later in ff_mpv_frame_start() (and nobody uses
current_picture_ptr between setting it in ff_mpv_frame_start()).

(The reason the vsynth*-h263-obmc ref files change is because
the call to ff_find_unused_picture() now happens after the older
pictures have been unreferenced in ff_mpv_frame_start(),
so that their slots in the picture array can be immediately
reused; the obmc code is somehow buggy and changes its output
depending on the earlier contents of the motion_val buffer.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-18 16:53:41 +02:00
J. Dekker
ce2f47318b lavc/aarch64: hevc_add_res add 12bit variants
hevc_add_res_4x4_12_c: 46.0
hevc_add_res_4x4_12_neon: 18.7
hevc_add_res_8x8_12_c: 194.7
hevc_add_res_8x8_12_neon: 25.2
hevc_add_res_16x16_12_c: 716.0
hevc_add_res_16x16_12_neon: 69.7
hevc_add_res_32x32_12_c: 3820.7
hevc_add_res_32x32_12_neon: 261.0

Signed-off-by: J. Dekker <jdek@itanimul.li>
2022-08-18 15:04:43 +02:00
Martin Storsjö
48be6616d0 aarch64: me_cmp: Remove a leftover unnecessary instruction
This was missed in a2e45ad407.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-08-18 12:14:53 +03:00
Hubert Mazur
70efa4d011 lavc/aarch64: Add neon implementation for pix_abs8
Provide optimized implementation of pix_abs8 function for arm64.

Performance comparison tests are shown below.
- pix_abs_1_0_c: 101.2
- pix_abs_1_0_neon: 22.5
- sad_1_c: 101.2
- sad_1_neon: 22.5

Benchmarks and tests are run with checkasm tool on AWS Graviton 3.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-08-18 12:07:26 +03:00
Hubert Mazur
74312e80d7 lavc/aarch64: Add neon implementation for sse8
Provide optimized implementation of sse8 function for arm64.

Performance comparison tests are shown below.
- sse_1_c: 130.7
- sse_1_neon: 29.7

Benchmarks and tests run with checkasm tool on AWS Graviton 3.

Signed-off-by: Hubert Mazur <hum@semihalf.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-08-18 12:07:26 +03:00
Hubert Mazur
a2e45ad407 lavc/aarch64: Add neon implementation for pix_abs16_y2
Provide optimized implementation of pix_abs16_y2 function for arm64.

Performance comparison tests are shown below.
pix_abs_0_2_c: 317.2
pix_abs_0_2_neon: 37.5

Benchmarks and tests run with checkasm tool on AWS Graviton 3.

Signed-off-by: Hubert Mazur <hum@semihalf.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-08-18 12:07:26 +03:00
Hubert Mazur
d7abb7d143 lavc/aarch64: Add neon implementation for sse4
Provide neon implementation for sse4 function.

Performance comparison tests are shown below.
- sse_2_c: 80.7
- sse_2_neon: 31.0

Benchmarks and tests are run with checkasm tool on AWS Graviton 3.

Signed-off-by: Hubert Mazur <hum@semihalf.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-08-18 12:07:26 +03:00
Hubert Mazur
ad251fd262 lavc/aarch64: Add neon implementation for sse16
Provide neon implementation for sse16 function.

Performance comparison tests are shown below.
- sse_0_c: 268.2
- sse_0_neon: 43.5

Benchmarks and tests run with checkasm tool on AWS Graviton 3.

Signed-off-by: Hubert Mazur <hum@semihalf.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-08-18 12:07:26 +03:00