1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

48458 Commits

Author SHA1 Message Date
Zhao Zhili
4a00cd4fe3 avcodec/filter_units_bsf: reindent after previous commit 2023-06-19 11:52:18 +08:00
Zhao Zhili
dfa0e24e98 avcodec/filter_units_bsf: add skip frame support 2023-06-19 11:52:18 +08:00
Zhao Zhili
4144584010 avcodec/cbs_h2645: add discard_unit implementation for H.265 2023-06-19 11:52:18 +08:00
Zhao Zhili
e7cde0cbd5 avcodec/cbs_h2645: add discarded_unit implementation for H.264 2023-06-19 11:52:18 +08:00
Zhao Zhili
a8aeab107e avcodec/cbs: add API to discard units by AVDiscard 2023-06-19 11:52:18 +08:00
Michael Niedermayer
6f2cf88771
avcodec/hevc_refs: Check that nb_refs stays <= HEVC_MAX_REFS
Fixes: 58528/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5834725318328320
Fixes: index 16 out of bounds for type 'int [16]'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-18 14:29:13 +02:00
Michael Niedermayer
a0f4d4e650
avcodec/hevcdec: Avoid null pointer dereferences in MC
Fixes: runtime error: pointer index expression with base 0x000000000000 overflowed to 0xfffffffffffffff8
Fixes: 58440/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5956015530311680

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-18 14:29:13 +02:00
Michael Niedermayer
ff8a496d41
avcodec/takdsp: Fix integer overflows
Fixes: avcodec/takdsp.c:44:23: runtime error: signed integer overflow: -2097158 - 2147012608 cannot be represented in type 'int'
Fixes: 58417/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-5268919664640000

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-18 14:29:12 +02:00
Michael Niedermayer
adfe003f51
avcodec/mpegvideo_dec: Add NULL pointer checks to MPV_motion_lowres()
This makes the null pointer checks match mpv_motion_internal()

Fixes: NULL pointer dereference
Fixes: 59671/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG1VIDEO_fuzzer-4993004566609920
Fixes: 59678/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEGVIDEO_fuzzer-4893168991338496

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-18 14:29:12 +02:00
Michael Niedermayer
d7d3f1af2a
avcodec/mpegvideo_dec: consider interlaced lowres 4:2:0 chroma in edge emulation check better
Fixes: out of array read
Fixes: 59673/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG1VIDEO_fuzzer-5194311374077952

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-18 14:29:12 +02:00
Michael Niedermayer
e736238b35
avcodec/rka: use unsigned for buf0 additions
Fixes: signed integer overflow: -38912000 + -2109276160 cannot be represented in type 'int'
Fixes: 59670/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RKA_fuzzer-4987563245699072

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-18 14:29:11 +02:00
Michael Niedermayer
1ee303f1e1
avcodec/rka: Avoid undefined left shift
Fixes: left shift of 34136248 by 6 places cannot be represented in type 'int'
Fixes: 58429/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RKA_fuzzer-5692211592560640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-18 14:29:11 +02:00
Michael Niedermayer
fead656a7b
avcodec: Ignoring errors is only possible before the input end
Fixes: out of array read
Fixes: Ticket 10308

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-18 14:29:11 +02:00
Anton Khirnov
593e8c2c6a lavc/binkaudio: reset input packet on errors
Make sure we don't repeatedly try to decode the same packet, making no
progress and possibly causing an infinite loop.
2023-06-17 18:06:33 +02:00
James Almer
dbc4c22890 avcodec/evc_parse: add missing includes
Fixes make checkheaders.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-17 12:43:15 -03:00
James Almer
f24064e627 avcodec/evc_frame_merge_bsf: free EVCFMergeContext on flush and close
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-17 10:08:54 -03:00
James Almer
b1d0b59d81 avcodec/evc_frame_merge_bsf: check for av_memdup() failure
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-17 10:08:54 -03:00
James Almer
9fc1d9adc8 avcodec/evc_parse: make freeing EVCParserContext buffers a shared function
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-17 10:08:54 -03:00
James Almer
46a9be01b8 avcodec/evc_parse: free pps struct on parsing failure
Prevents future checks for their presence from succeeding.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-17 10:08:54 -03:00
James Almer
811460f5c2 avcodec/evc_parse: use the correct sps when parsing slice headers
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-17 10:08:54 -03:00
James Almer
44f26315c8 avcodec/evc_parse: use a local EVCParserSliceHeader when parsing slices
There's no need to store EVC_MAX_PPS_COUNT amount of slice headers in EVCParserContext.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-17 10:08:54 -03:00
James Almer
57879b23bc avcodec/evc_parse: zero sps, pps and sh structs
Otherwise stale values may remain in place.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-17 10:08:54 -03:00
James Almer
da2af70ffa avcodec/evc_parser: export framerate to the AVCodecContext
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-17 10:08:53 -03:00
Timo Rothenpieler
16fdb48e0d avcodec/nvenc: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE 2023-06-16 22:10:42 +02:00
Timo Rothenpieler
6c418ae25e Revert "lavc/nvenc: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE"
The implementation is flawed in that the frame opaque data is not in
fact correctly reordered along with the packets, but is being output in
packet input order, just like the dts are.

This reverts commit 3553809703.
2023-06-16 22:10:42 +02:00
Philip Langdale
73a2252f1d avfilter/vf_bwdif_cuda: CUDA accelerated bwdif deinterlacer
I've been sitting on this for 3 1/2 years now(!), and I finally got
around to fixing the loose ends and convincing myself that it was
correct. It follows the same basic structure as yadif_cuda, including
leaving out the edge handling, to avoid expensive branching.
2023-06-16 12:52:32 -07:00
James Almer
f42df8384a avcodec/evc_parse: use the correct struct size when allocating pps
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-16 10:08:32 -03:00
James Almer
d00f0eebbd avcodec/evc_parser: remove superfluous memset calls
The entire EVCParserContext will be zeroed during allocation.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-16 09:57:35 -03:00
Lynne
ca818ab51c
vulkan_h264: filter out constrained/inter flags from the profile index
As the comment says, Vulkan signals all the constrant_set flags,
and does not want them OR'd onto the profile IDC.
So just unset them.
2023-06-15 22:00:42 +02:00
Dave Airlie
6964a97f91
vulkan/av1: fix filling out global motion params. 2023-06-15 22:00:41 +02:00
Lynne
f30b979ca2
pthread_frame: uninit the hwaccel of each frame thread
The issue is that with a threadsafe hwaccel and multiple enabled
frame threads, hwaccel->uninit() is never called.
Previously, the function was guaranteed to never have any threads
with hwaccel contexts, so it never bothered to uninit any.
2023-06-15 22:00:40 +02:00
Paul B Mahol
21f6496cce avcodec/bink: make two tables use uint8_t type 2023-06-15 18:14:12 +02:00
James Almer
77c5c74375 avcodec/version: bump minor after evc parser and frame_merge bsf additions
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-15 11:44:04 -03:00
Dawid Kozinski
ab2671c5f2 avformat/evc_demuxer: Added demuxer to handle reading EVC video files
- Provided AVInputFormat struct describing EVC input format (ff_evc_demuxer)

Signed-off-by: Dawid Kozinski <d.kozinski@samsung.com>
2023-06-15 09:57:35 -03:00
Dawid Kozinski
34e4f18360 avcodec/evc_parser: Added parser implementation for EVC format
- Added constants definitions for EVC parser
- Provided NAL units parsing following ISO_IEC_23094-1
- EVC parser registration

Signed-off-by: Dawid Kozinski <d.kozinski@samsung.com>
2023-06-15 09:51:04 -03:00
Timo Rothenpieler
ac7c265b33 Revert "avcodec/nvenc: fix b-frame DTS behavior with fractional framerates"
This reverts commit 9a245bdf5d.

This commit basically broke all samples with fractional framerates,
rather than fixing them.
I at this point do not understand the original issue anymore, and I'm
not sure how this slipped my initial testing.
All my test samples must have happened to have a simple timebase.

The actual dts values pretty much always are just a simple chain of
1,2,3,4,5,... Or maybe slightly bigger steps. Each increase by one means
an advance in time by one unit of the timebase.
So a fractional framerate/timebase is already not an issue.

So with this patch applied, the calculation might end up substracting
huge values (1001 is a common one) from the dts, which would be an
offset of that many frames, not of that many fractions of a second.
This broke at least muxing into mp4, if the sample happened to have a
fractional framerate.

I do not thing the original issue this patch tried to fix existed in the
first place, so it can be reverted without further consequences.
2023-06-15 00:59:02 +02:00
Paul B Mahol
cfcd6e2108 avcodec/proresdec2: remove duplicated function 2023-06-14 12:04:15 +02:00
Paul B Mahol
2d59ca0a66 avcodec: add VMX1 decoder 2023-06-12 23:43:05 +02:00
Dave Airlie
3b0ed2365c vulkan/h264: set non-existing flag for invalid gaps
This flag is used to indicate to the hw frames in the gaps,
vaapi constructs it from a bunch of implicit API information
around surface ids. vulkan should just send it explicitly.

Reviewed-by: Lynne <dev@lynne.ee>
2023-06-12 22:13:45 +02:00
Paul B Mahol
18b2ecc247 avcodec/wavarc: add 5elp mode support 2023-06-09 17:05:26 +02:00
Paul B Mahol
024c30aa3b avcodec/exr: remove wrong scaling for 32bit DWA compression 2023-06-08 12:08:01 +02:00
Dave Airlie
2c4b6976d5 vulkan/hevc: fix 32x32 scaling list indexing
This fixes another problem in the hevc scaling lists and aligns
the code with what other hwaccels do.
2023-06-08 02:42:02 +02:00
Paul B Mahol
1d7a6eaee6 avcodec/proresenc_kostya: set avctx->profile from ctx
Otherwise muxers may not be able to guess it.
Option is still set by user, but via private codec option.
2023-06-08 00:48:21 +02:00
Lynne
24c4307b80
vulkan_decode: halve execution pool size
Determined experimentally, on various videos and hardware.
On Intel, using less resources in-flight is around 15% faster,
with similar results on Nvidia hardware.
2023-06-07 23:59:17 +02:00
Lynne
697382168d
hevcdec: remove redundant bits_used_for_short_term_rps field
It was introduced for Vulkan, but it is equivalent to
short_term_ref_pic_set_size when !short_term_ref_pic_set_sps_flag,
and when !!short_term_ref_pic_set_sps_flag, Vulkan hardcodes a zero
anyway.
2023-06-07 23:59:12 +02:00
Paul B Mahol
f11515c77f avcodec: add RTV1 decoder 2023-06-07 09:00:18 +02:00
Michael Niedermayer
0889ebc577
avcodec/noise_bsf: Check for wrapped frames
Wrapped frames contain pointers so they need specific code to
noise them, the generic code would lead to segfaults

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-06 21:38:02 +02:00
Roman Arzumanyan
402d98c9d4 libavcodec/cuviddec: determine amount of decoded surfaces from within cuvid parser
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2023-06-06 15:32:41 +02:00
Dave Airlie
65a1e8ee2c vulkan/hevc: fix scaling lists sizes. 2023-06-06 12:27:02 +02:00
Logan Lyu
e79686be96 lavc/aarch64: new optimization for 8-bit hevc_qpel_h hevc_qpel_uni_w_hv
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-06-06 12:50:18 +03:00
Logan Lyu
15972cce8c lavc/aarch64: new optimization for 8-bit hevc_qpel_uni_w_h
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-06-06 12:50:18 +03:00
Logan Lyu
0b7356c1b4 lavc/aarch64: new optimization for 8-bit hevc_pel_uni_w_pixels and qpel_uni_w_v
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-06-06 12:50:18 +03:00
Leo Izen
99da411322
avcodec/libjxldec: add animated decode support
Migrate the libjxl decoder wrapper from the decode_frame method to the
receive_frame method, which allows sending more than one frame from a
single packet. This allows the libjxl decoder to decode JPEG XL files
that are animated, and emit every frame of the animation. Now, clients
that feed the libjxl decoder with an animated JPEG XL file will be able
to receieve the full animation.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-06-05 12:14:43 -04:00
Michael Niedermayer
b168aeb734
avcodec/rka: avoid undefined multiply in cmode==0
Fixes: signed integer overflow: -182838 * 32768 cannot be represented in type 'int'
Fixes: 58179/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RKA_fuzzer-5333265899978752

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-04 18:21:24 +02:00
Michael Niedermayer
cbe5e480aa
avcodec/rka: use 64bit for srate_pad computation
Fixes: left shift of 538976288 by 13 places cannot be represented in type 'int'
Fixes: 56148/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RKA_fuzzer-6257370708967424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-04 18:21:24 +02:00
Jeremy Wu
b92af7b64e avcodec/aacenc: add strict bit rate control option
In certain use cases, controlling the maximum frame size is critical. An
example is when transmitting AAC packets over Bluetooth A2DP.

While the spec allows the packets to be fragmented (but UNRECOMMENDED),
in practice most headsets do not recognize nor reassemble such packets.

In this patch, we allow setting `bit_rate_tolerance` to 0 to indicate
that the specified bit rate should be treated as an upper bound up to
frame level.

Signed-off-by: Jeremy Wu <jrwu@chromium.org>
2023-06-04 03:36:10 +02:00
Rick Kern
4ef5e7d472 lavc/videotoolboxenc: support additional options
Added support for more VideoToolbox encoder options:
- qmin and qmax options are now used
- max_slice_bytes: Max number of bytes per H.264 slice
- max_ref_frames: Limit the number of reference frames
- Disable open GOP when the cgop flag is set
- power_efficient: Enable power-efficient mode

Signed-off-by: Rick Kern <kernrj@gmail.com>
2023-06-03 17:29:07 -04:00
xufuji456
decc776f88 avcodec/videotoolboxenc: add CBP/CHP profile
The CBP/CHP profile has available with H264 in iOS 15.0.
Official Doc: https://developer.apple.com/documentation/videotoolbox/kvtprofilelevel_h264_constrainedbaseline_autolevel

Signed-off-by: Rick Kern <kernrj@gmail.com>
2023-06-03 17:29:07 -04:00
Rick Kern
cab6d7bd71 lavc/videotoolboxenc: use ffmpeg profile constants
Signed-off-by: Rick Kern <kernrj@gmail.com>
2023-06-03 17:29:06 -04:00
Paul B Mahol
2342c05e43 avcodec/magicyuvenc: put some slice work under parallel execution
Speeds up slice threaded encoding.
2023-06-03 11:34:47 +02:00
Paul B Mahol
6b8d53f728 avcodec/magicyuvenc: add slice encoding support 2023-06-03 00:11:48 +02:00
James Almer
4da14c302f avcodec/av1dec: reset the fragment on extradata reading failure
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-02 14:07:20 -03:00
James Almer
8c6b931f4c avcodec/av1dec: reset the fragment on reading failure
Fixes: NULL pointer dereference
Fixes: 59359/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-6726080594313216

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-02 14:01:10 -03:00
Timo Rothenpieler
d2b46c1ef7 avcodec/nvenc: stop using deprecated rc modes with SDK 12.1 2023-06-01 23:47:14 +02:00
Arnie Chang
c5508f60c2 lavc/h264chroma: RISC-V V add motion compensation for 8x8 chroma blocks
Optimize the put and avg filtering for 8x8 chroma blocks

Signed-off-by: Arnie Chang <arnie.chang@sifive.com>
2023-05-30 17:15:05 +02:00
Lynne
9f9534f5b6
vulkan_decode: fix typo when setting AV1 capabilities
All pNext chained structs in Vulkan are defined as void *, so it doesn't
help catch this.
2023-05-29 23:26:10 +02:00
Dawid Kozinski
637afea88e avcodec: MPEG-5 EVC codec registration
Added prerequisites that must be met before providing support for the MPEG-5 EVC codec
- Added new entry to codec IDs list
- Added new entry to the codec descriptor list
- Bumped libavcodec minor version
- Added profiles for EVC codec

Signed-off-by: Dawid Kozinski <d.kozinski@samsung.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-29 11:38:21 -03:00
Lynne
e71cd18049
vulkan_decode: do not align the image dimensions
According to Dave Airlie:

> <airlied> but I think ignoring it should be fine, I can't see any
> other way to get the imaeg extents correct for other usage
> <Lynne> what width/height should be used for the images?
> the final presentable dimensions, or the coded dimensions?
> <airlied> if you don't want noise I think the presentable dims
> <airlied> the driver should round up the allocations internally,
> but if you are going to sample from the images then w/h have to be
> the bounds of the image you want
> <airlied> since otherwise there's no way to stop the sampler from
> going outside the edges

Apparently, the alignment values are informative, rather than mandatory,
but the spec's wording makes it sound as if they're mandatory.
2023-05-29 05:12:27 +02:00
James Almer
246bec23a9 avcodec/hevc_ps: remove a unused variable
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-28 23:24:51 -03:00
James Almer
fe103ee61f avcodec/vulkan_dec: use PRId64 specifier for an int64_t
Fixes warnings on x86-32 and Windows.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-28 23:18:53 -03:00
Lynne
bae92361ed
vulkan_decode: check if yuv_sampler exists before freeing it
This prevents multiple NULL accesses - if yuv_sampler exists, then
everything required for it to be destroyed also exists.
2023-05-29 03:23:06 +02:00
Lynne
58f82fc26a
vulkan: replace usage of %lu with %"SIZE_SPECIFIER" 2023-05-29 03:22:58 +02:00
Michael Niedermayer
988fd5743d
avcodec/kbdwin: Remove low precision intermediate in ff_kbd_window_init_fixed()
Previously floats where scaled up to 32bit int, but floats do not
have 32bits in their mantisse so a quarter of the bits where nonsense.

It seems no fate test is affected by this change, which is interresting

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-29 00:55:52 +02:00
Michael Niedermayer
17ecb224e9
avcodec/kbdwin: Avoid computing bessel values twice
Also reduce neeeded temporary storage by half

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-29 00:55:52 +02:00
Michael Niedermayer
4ea87c0f73
avcodec/kbdwin: Use av_bessel_i0()
Old code used about 7 times as many cpu cycles as new

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-29 00:55:52 +02:00
Lynne
f3795e1857
APIchanges: add AVHWAccel changes and bump lavc minor 2023-05-29 00:42:03 +02:00
Lynne
f701f088f4
vulkan_h264: reject end_frame being called without valid session parameters
When seeking through MBAFF-coded H264, this can happen. Decoding calls end_frame
without calling start_frame. We are unable to decode this, as no frame
state has been set.

Happens for both VAAPI and Vulkan. Could be an issue elsewhere, hence
the individual commit.
2023-05-29 00:42:01 +02:00
Lynne
77478f6793
av1dec: add Vulkan hwaccel 2023-05-29 00:42:00 +02:00
Lynne
6ec58ff820
cbs_av1: expose tile col/row starts in SBs 2023-05-29 00:41:59 +02:00
Dave Airlie
e49b8b48cd
av1: set skip mode frames properly
There are circumstances where the flag isn't set but the skip mode
frames are. So don't use the inferred bit which has other inputs
when deciding to pass the skip mode frames to the device.

This fixes some decoding bugs on intel av1
2023-05-29 00:41:58 +02:00
Lynne
36c16a06b2
hevcdec: add Vulkan hwaccel
Thanks to Dave Airlie for figuring out a lot of the parameters.
2023-05-29 00:41:58 +02:00
Lynne
a9fbe8b472
h264dec: add Vulkan hwaccel
Thanks to Dave Airlie for figuring out a lot of the parameters.
2023-05-29 00:41:58 +02:00
Lynne
1e8fefff93
libavcodec: add Vulkan common video decoding code 2023-05-29 00:41:57 +02:00
Lynne
023ae6103f
libavcodec: add Vulkan common video code 2023-05-29 00:41:57 +02:00
Lynne
6733a1a456
avcodec: add AVHWAccel.flush callback 2023-05-29 00:41:57 +02:00
Lynne
be07145109
avcodec: add AVHWAccel.free_frame_priv callback 2023-05-29 00:41:56 +02:00
Lynne
21719c29a2
hevc_ps: expose sps_extension_present_flag 2023-05-29 00:41:35 +02:00
Lynne
8b2d46ee3d
hevc_ps: expose conformance_window_flag 2023-05-29 00:41:34 +02:00
Lynne
cc5fab5c48
hevc_ps: expose sublayer_ordering_info_flag 2023-05-29 00:41:34 +02:00
Lynne
32fcb17e42
hevc_ps: expose vui_present flag 2023-05-29 00:41:33 +02:00
Lynne
f58db8e534
hevc_ps: expose rps fields 2023-05-29 00:41:33 +02:00
Lynne
abdd87d44e
hevc_ps: expose log2_diff_max_min_transform_block_size 2023-05-29 00:41:33 +02:00
Lynne
6eaca2abd8
hevcdec: expose bits_used_for_short_term_rps 2023-05-29 00:41:32 +02:00
Lynne
4e1f3ab184
hevc_ps: expose pps_extension_present_flag 2023-05-29 00:41:32 +02:00
Lynne
d0b02c3aff
hevc_ps: expose vps_id 2023-05-29 00:41:31 +02:00
Lynne
3bc866159c
hevc_ps: expose pps_id 2023-05-29 00:41:31 +02:00
Lynne
fc429d785e
hevc_ps: expose SPS and VPS headers 2023-05-29 00:41:31 +02:00
Lynne
20de09a6de
h264_ps: expose scaling_matrix_present_mask
Vulkan requires it.
It technically also requires use_default_scaling_matrix_mask,
but we can just be explicit and give it the matrix we fill in as-non
default.
2023-05-29 00:41:30 +02:00
Lynne
d13b1c42f6
h264_ps: expose bit rate and CPB size fields 2023-05-29 00:41:30 +02:00
Lynne
de6fce727c
h264_ps: expose max_dec_frame_buffering 2023-05-29 00:41:30 +02:00
Lynne
1f66e3347d
h264_ps: comment pic_order_present better
The official name which CBS uses is bottom_field_pic_order_in_frame_present_flag.
2023-05-29 00:41:29 +02:00
Lynne
6718b37e5d
h264_ps: set pic_scaling_matrix_present_flag 2023-05-29 00:41:29 +02:00
Lynne
02f38af2dd
h264_ps: expose pps_id 2023-05-29 00:41:29 +02:00
Lynne
317fa3bd1d
h2645_vui: expose aspect_ratio_info_present_flag 2023-05-29 00:41:28 +02:00
Lynne
dc2694557d
h2645_vui: expose aspect_ratio_idc 2023-05-29 00:41:28 +02:00
Lynne
b6a6e2b19d
lavc/decode: allow to allocate hwaccel_priv_data early 2023-05-29 00:41:27 +02:00
Anton Khirnov
8b23644408
lavc/pthread_frame: add support for thread-safe hwaccels 2023-05-29 00:41:27 +02:00
Anton Khirnov
3d2e1aa324
lavc/decode: stop duplicating code from hwaccel_uninit() 2023-05-29 00:41:27 +02:00
Anton Khirnov
a4611e3170
lavc/decode: pass AVHWAccel instead of AVCodecHWConfigInternal to hwaccel_init()
The only thing besides the hwaccel that this function uses from
AVCodecHWConfigInternal is the pixel format, which should always match
the hwaccel one.

Will be useful in following commits.
2023-05-29 00:41:25 +02:00
yuanhecai
f6077cc666
avcodec/la: Add LSX optimization for h264 qpel.
./configure --disable-lasx
ffmpeg -i 1_h264_1080p_30fps_3Mbps.mp4 -f rawvideo -y /dev/null -an
before: 214fps
after:  274fps

Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-25 21:05:01 +02:00
Lu Wang
8815a7719e
avcodec/la: Add LSX optimization for h264 chroma and intrapred.
./configure --disable-lasx
ffmpeg -i 1_h264_1080p_30fps_3Mbps.mp4 -f rawvideo -y /dev/null -an
before: 199fps
after:  214fps

Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-25 21:04:56 +02:00
Hao Chen
7845b5ecd6
avcodec/la: Add LSX optimization for loop filter.
Replaced function(LSX is sufficient for these functions):
ff_h264_v_lpf_chroma_8_lasx
ff_h264_h_lpf_chroma_8_lasx
ff_h264_v_lpf_chroma_intra_8_lasx
ff_h264_h_lpf_chroma_intra_8_lasx
ff_weight_h264_pixels4_8_lasx
ff_biweight_h264_pixels4_8_lasx

./configure --disable-lasx
ffmpeg -i 1_h264_1080p_30fps_3Mbps.mp4 -f rawvideo -y /dev/null -an
before: 161fps
after:  199fps

Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-25 21:04:43 +02:00
Shiyou Yin
e1b6ecd20a
avcodec/la: add LSX optimization for h264 idct.
loongson_asm.S is LoongArch asm optimization helper.
Add functions:
  ff_h264_idct_add_8_lsx
  ff_h264_idct8_add_8_lsx
  ff_h264_idct_dc_add_8_lsx
  ff_h264_idct8_dc_add_8_lsx
  ff_h264_idct_add16_8_lsx
  ff_h264_idct8_add4_8_lsx
  ff_h264_idct_add8_8_lsx
  ff_h264_idct_add8_422_8_lsx
  ff_h264_idct_add16_intra_8_lsx
  ff_h264_luma_dc_dequant_idct_8_lsx
Replaced function(LSX is sufficient for these functions):
  ff_h264_idct_add_lasx
  ff_h264_idct4x4_addblk_dc_lasx
  ff_h264_idct_add16_lasx
  ff_h264_idct8_add4_lasx
  ff_h264_idct_add8_lasx
  ff_h264_idct_add8_422_lasx
  ff_h264_idct_add16_intra_lasx
  ff_h264_deq_idct_luma_dc_lasx
Renamed functions:
  ff_h264_idct8_addblk_lasx ==> ff_h264_idct8_add_8_lasx
  ff_h264_idct8_dc_addblk_lasx ==> ff_h264_idct8_dc_add_8_lasx

./configure --disable-lasx
ffmpeg -i 1_h264_1080p_30fps_3Mbps.mp4 -f rawvideo -y /dev/null -an
before: 155fps
after:  161fps

Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-25 21:04:25 +02:00
Paul B Mahol
c6b6356635 avformat/gifdec: switch to using gif parser
Update fate test, more correct as last packet is not truncated.
2023-05-25 19:51:56 +02:00
James Almer
97f4263457 avcodec/av1dec: convert to receive_frame()
This removes the overhead of inserting the av1_frame_split bsf as part of the
decoding process.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-25 11:21:35 -03:00
Haihao Xiang
8e2547ebb2 lavc/qsvenc: the height is aligned to 32 for AV1
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-05-25 09:04:13 +08:00
Haihao Xiang
943a42fc54 lavc/qsvenc: make sure continuous allocation
Intel MediaSDK and oneVPL expect continuous allocation for data[i],
however there are mandatory padding bytes between data[i] and data[i+1].
when calling av_frame_get_buffer. This patch removes all extra padding
bytes.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-05-25 09:04:13 +08:00
Haihao Xiang
cf79dab8df lavc/qsvenc: avoid data copy if possible
The data copy is unnecessary for packed formats when frame width and
height are aligned

For example:
$ ffmpeg -f lavfi -i testsrc=size=1920x1088 -vf "format=yuyv422" -c:v hevc_qsv -f null -

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-05-25 09:04:13 +08:00
Haihao Xiang
cfdfd6aa72 lavc/qsvenc: use the right alignment instead of hard coded value
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-05-25 09:04:13 +08:00
Haihao Xiang
2b0fe52967 lavc/qsv: fallback to the default mfx implementation for internal session on Windows
The mfx implementation based on D3D11 is expected for an internal
session on Windows, however sometimes this implemntation is not
supported [1]. A fallback to the default mfx implementation is added in
this patch.

[1] https://github.com/intel/cartwheel-ffmpeg/issues/246

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-05-25 09:04:13 +08:00
James Almer
f209614290 avcodec/libdav1d: only return EAGAIN when there are no buffered packets
Fixes decoding packets containing split temporal units, as generated for example
by the av1_frame_split bsf.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-22 16:19:10 -03:00
Michael Niedermayer
43e5e2e423
avcodec/bonk: Avoid undefined integer overflow in predictor_calc_error()
Fixes: signed integer overflow: -159584 * 5105950 cannot be represented in type 'int'
Fixes: 55165/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-5796023719297024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-22 02:49:59 +02:00
Paul B Mahol
d912ff19c5 avcodec/fitsenc: mark output packets as keyframes 2023-05-21 20:51:55 +02:00
Paul B Mahol
4d4aed2815 avcodec/fitsdec: fix decoder class category 2023-05-21 20:31:46 +02:00
Paul B Mahol
fcabfcbf6f avcodec/wavpackenc: unbreak encoding 8bit pcm
Otherwise the reference decoder reports crc errors.
2023-05-21 11:30:12 +02:00
Paul B Mahol
ddc176d0ee avcodec/elbg: fix integer overflows
Fixes #9977
2023-05-21 10:50:59 +02:00
Paul B Mahol
d81b6cbd42 avcodec/gif_parser: fix possible wrong splitting of frames
And properly signal keyframes.
2023-05-21 10:48:14 +02:00
Rick Kern
247e977953 lavc/videotoolboxenc: warn when alpha quality not set
Added a warn log when alpha quality cannot be set, but continue encoding.

Signed-off-by: Rick Kern <kernrj@gmail.com>
2023-05-20 11:42:12 -04:00
Rick Kern
902c949d30 lavc/videotoolboxenc: better compat_keys docs
Added more specific docs about when to use compat_keys, and how to
add new constants.

Signed-off-by: Rick Kern <kernrj@gmail.com>
2023-05-20 11:42:12 -04:00
Paul B Mahol
8980c1313b avcodec/ccaption_dec: simplify init function 2023-05-20 13:06:40 +02:00
James Almer
1b05d27346 avcodec/libdav1d: export decoder frame delay
As this is an AV_CODEC_CAP_OTHER_THREADS decoder, threading is handled by the
underlying library. In this case, the frame delay is calculated by libdav1d
based on the values from avctx->thread_count and the private max_frame_delay
option.
Export said delay reported by the library in AVCodecContext.delay

Reviewed-by: Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-19 15:29:31 -03:00
Rick Kern
c789a2324a lavc/videotoolboxenc: better compat_keys documentation
Added documentation that describes when compat_keys should be used,
and why it exists.

Signed-off-by: Rick Kern <kernrj@gmail.com>
2023-05-19 09:48:26 -04:00
xufuji456
5cd304298e avcodec/videotoolboxenc: add low-latency encoding
When using low-latency mode, it eliminates frame reordering
and follows a one-in-one-out encoding mode

Signed-off-by: xufuji456 <839789740@qq.com>
Signed-off-by: Rick Kern <kernrj@gmail.com>
2023-05-19 09:40:28 -04:00
Zhao Zhili
47430a3cb1 avcodec/cavs_parser: fix finding the end of a frame
Use the next I/P/B or start code as the end of current frame.

Before the patch, extension start code, user data start code,
sequence end code and so on are treated as the start of next
frame.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-05-20 04:03:44 +08:00
James Almer
4f9799bd88 avcodec/h264_picture: use ff_thread_replace_frame()
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-18 10:52:30 -03:00
James Almer
3fe74c9017 avcodec/utils: add ff_thread_replace_frame()
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-18 10:16:03 -03:00
James Almer
63767b79a5 avutil/frame: deprecate palette_has_changed
Not only this is information that relies on the concept of a sequence of
frames, which is completely out of place as a field in AVFrame, but there are
no known or intended uses of this field.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-18 08:45:23 -03:00
Paul B Mahol
c48eff209c avcodec/ccaptions_dec: correct flushing output on EOF
Prevents infinite flushing same last output.
2023-05-18 11:59:34 +02:00
Clement Lecigne
96c30affba avcodec/hevc_ps: add proper bound checks around cm_ref_layer_id in colour_mapping_table.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-17 17:51:36 -03:00
Mark Thompson
8450531059 av1_parse: Don't reject zero-size padding OBUs
Padding OBUs are not required to be nonempty.
2023-05-17 19:38:45 +00:00
Mark Thompson
9c830f4f65 av1_parse: Remove unused getbits instance 2023-05-17 19:38:45 +00:00
Mark Thompson
dce6cf2c36 cbs_av1: Don't reject unknown metadata
Accept it and pass it through unchanged.

The standard requires that decoders ignore unknown metadata, and indeed
this is tested by some of the Argon coverage streams.
2023-05-17 19:38:45 +00:00
Mark Thompson
bee912cb63 cbs_av1: Add tracing headers for metadata types
Make it a little easier to interpret metadata in trace output.
2023-05-17 19:38:45 +00:00
Samuel Mira
416fd1b43b avcodec/mediacodec: Add VP8 encoder
Connected FFmpeg to Mediacodec VP8 encoder.

Signed-off-by: Samuel Mira <samuel.mira@qt.io>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-05-17 19:20:57 +08:00
Samuel Mira
acd37fd566 avcodec/mediacodec: Add AV1 encoder
Connected FFmpeg to Mediacodec AV1 encoder

Signed-off-by: Samuel Mira <samuel.mira@qt.io>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-05-17 19:19:51 +08:00
Hendrik Leppkes
6b2ae90411
avcodec/vdpau_mpeg4: fix order of quant matrix coefficients
The matrix coefficients are stored permutated for the IDCT,
rather then in plain raster order, and need to be un-permutated
for the hardware.
2023-05-15 18:30:54 +02:00
Hendrik Leppkes
308e4ae8e3
avcodec/vdpau_mpeg12: fix order of quant matrix coefficients
The matrix coefficients are stored permutated for the IDCT,
rather then in plain raster order, and need to be un-permutated
for the hardware.
2023-05-15 18:30:49 +02:00
Hendrik Leppkes
b3e938ef80
avcodec/nvdec_mpeg4: fix order of quant matrix coefficients
The matrix coefficients are stored permutated for the IDCT,
rather then in plain raster order, and need to be un-permutated
for the hardware.
2023-05-15 18:30:43 +02:00
Hendrik Leppkes
af8affb77e
avcodec/nvdec_mpeg2: fix order of quant matrix coefficients
The matrix coefficients are stored permutated for the IDCT,
rather then in plain raster order, and need to be un-permutated
for the hardware.
2023-05-15 18:30:38 +02:00
Anton Khirnov
9d70e74d25 lavc/libdav1d: fix exporting framerate
Same issues as in the previous commit.
2023-05-15 14:45:46 +02:00
Anton Khirnov
e10a5b91bc lavc/av1*: fix exporting framerate
* take num_ticks_per_picture_minus_1 into account, since that is a part
  of the framerate computation
* stop exporting num_ticks_per_picture_minus_1 into
  AVCodecContext.ticks_per_frame, as that field is used for other
  purposes (in conjunction with repeat_pict, which is not used at all by
  av1)
2023-05-15 14:17:49 +02:00
Anton Khirnov
7d1d61cc5f lavc: deprecate AVCodecContext.ticks_per_frame
For encoding, this field is entirely redundant with
AVCodecContext.framerate.

For decoding, this field is entirely redundant with
AV_CODEC_PROP_FIELDS.
2023-05-15 10:56:18 +02:00
Anton Khirnov
f618004bc1 lavc/libvpxenc: send frame durations to the encoder
Adapt similar code from libaomenc - stop using ticks_per_frame except as
a last resort.
2023-05-15 10:32:05 +02:00
Anton Khirnov
2ad468ed1f lavc/libkvazaar,libopenh264enc: drop redundant checks
The same check is present in encode_preinit_video().
2023-05-15 10:32:05 +02:00
Anton Khirnov
aa3b0f4376 libaomenc: use AVCodecContext.framerate when available 2023-05-15 10:32:05 +02:00
Anton Khirnov
3fabf71207 lavc/msmpeg4enc: use AVCodecContext.framerate when available 2023-05-15 10:32:05 +02:00
Anton Khirnov
dc20baa049 lavc/ratecontrol: use AVCodecContext.framerate when available 2023-05-15 10:32:05 +02:00
Anton Khirnov
e930b834a9 lavf: use AV_CODEC_PROP_FIELDS where appropriate
H.264 and mpeg12 parsers need to be adjusted at the same time to stop
using the value of AVCodecContext.ticks_per_frame, because it is not set
correctly unless the codec has been opened. Previously this would result
in both the parser and lavf seeing the same incorrect value, which would
cancel out.
Updating lavf and not the parsers would result in correct value in lavf,
but the wrong one in parsers, which would break some tests.
2023-05-15 10:31:55 +02:00
Anton Khirnov
70433abf7f lavc/codec_desc: add a property for codecs that support field coding
Multiple places currently use AVCodecContext.ticks_per_frame > 1 to
identify such codecs, which
* requires a codec context
* requires it to be open
2023-05-15 10:31:55 +02:00
Anton Khirnov
8b20d0dcb5 lavc: deprecate AV_CODEC_CAP_SUBFRAMES
There is nothing meaningful the caller can do with it.
2023-05-15 10:24:54 +02:00
Anton Khirnov
51d6ae099f lavc/decode: drop a useless warning
Decoders will currently warn if an audio decoder not marked with
AV_CODEC_CAP_SUBFRAMES consumes less than the whole packet, but
* this happens for regular files
* this has no negative consequences
* there is no meeaningful action that can or should be taken in response

The warning is thus useless noise.
2023-05-15 10:24:54 +02:00
James Almer
6759983bdc avcodec/cbs_av1: add valid range of values for num_units_in_decoding_tick
The spec states "num_units_in_decoding_tick shall be greater than 0".

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-14 17:09:38 -03:00
Christopher Degawa
7958325a83 libavcodec/libsvtav1: Allow -1 for preset option
Currently, the -1 (MR) preset is disallowed as it's taken as the preset
option not set, and the only way to access it was through svtav1-params.

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-11 10:59:33 -03:00
Dai, Jianhui J
a4abe37fb5 vcodec/vp8data: Move ff_vp8_dct_cat_prob to vp8data.c
Avoid compiling error if included by multiple sources.

Signed-off-by: Jianhui Dai <jianhui.j.dai@intel.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2023-05-10 07:11:40 -04:00
Lukáš Lalinský
b5af451901 avcodec/libmp3lame: make it possible to set copyright/original flags 2023-05-10 09:42:35 +02:00
Anton Khirnov
c2ae8e30b7 lavc/codec_par: add AVCodecParameters.framerate
This corresponds to AVCodecContext.framerate.
2023-05-07 15:47:25 +02:00
Michael Niedermayer
722ff74055
avcodec/adpcm: Fix integer overflow in intermediate in ADPCM_XMD
Fixes: runtime error: signed integer overflow: 2140143616 + 254665816 cannot be represented in type 'int'
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_XMD_fuzzer-6690181676924928

As a sideeffect this simplifies the equation, the high bits are different after this but only
the low 16bits are stored and used in later steps.

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:32:29 +02:00
Michael Niedermayer
8f0e200a12
avcodec/dpcm: fix undefined interger overflow in wady
Fixes: signed integer overflow: -2147375930 + -133875 cannot be represented in type 'int'
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WADY_DPCM_fuzzer-6703727013920768

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:27 +02:00
Michael Niedermayer
6e98cf0280
avcodec/tiff: add a zero DNG_LINEARIZATION_TABLE check
Fixes: index 4294967295 out of bounds for type 'uint16_t [65536]'
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5950405086674944
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-6666195176914944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:26 +02:00
Michael Niedermayer
19b66b89da
avcodec/tak: Check remaining bits in ff_tak_decode_frame_header()
Fixes: out of array access
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-6682195323650048

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:26 +02:00
Michael Niedermayer
2632e90493
avcodec/sonic: Fix two undefined integer overflows
Fixes: signed integer overflow: 2147483372 - -148624 cannot be represented in type 'int'
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-5477177805373440
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-6681622236233728

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:26 +02:00
Michael Niedermayer
34056a94ea
avcodec/utils: the IFF_ILBM implementation assumes that there are a multiple of 16 allocated
Fixes: out of array access
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5124452659888128
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-6362836707442688

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:25 +02:00
Michael Niedermayer
fd7352660b
avcodec/flacdec: Fix signed integre overflow
Fixes: signed integer overflow: 3011809745540902265 + 6323452730883571725 cannot be represented in type 'long'
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-6687553022722048

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:25 +02:00
Michael Niedermayer
885ff3b879
avcodec/exr: Cleanup befor return
Fixes: leaks
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-6703454090559488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:25 +02:00
Michael Niedermayer
d31d4f3228
avcodec/pngdec: Do not pass AVFrame into global header decode
The global header should not contain a frame, and decoding it
would result in leaks

Fixes: memleak
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APNG_fuzzer-6603443149340672

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:24 +02:00
Michael Niedermayer
7117b380a7
avcodec/pngdec: remove AVFrame argument from decode_iccp_chunk()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:24 +02:00
Michael Niedermayer
5cc378cc46
avcodec/pdvdec: Check previous frame before using it
Fixes: load of null pointer of type 'uint8_t' (aka 'unsigned char')
Fixes: 58256/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PDV_fuzzer-4776436325285888

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:23 +02:00
James Almer
09b2ca93b4 avcodec/libdav1d: support parsing multiple ITU-T T.35 entries in a picture
This requires the newest libdav1d release.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-05 14:26:52 -03:00
Anton Khirnov
a59b4ac713 lavc/tak: do not store invalid values in stream info
When tak_get_nb_samples() fails, it will currently write
AVERROR_INVALIDDATA as TAKStreamInfo.frame_samples. The parser will then
use this negative value as a frame duration, which leads to various
breakage.

Avoid this by returning the error code from tak_parse_streaminfo()
directly; never store negative values in the parsed header.
2023-05-05 10:36:08 +02:00
Anton Khirnov
ecdf1ac267 lavc/tak: make ff_tak_parse_streaminfo static
It is not used outside of tak.c
2023-05-05 10:35:08 +02:00
James Almer
3e06f6f040 avutil/frame: deprecate key_frame
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 19:20:03 -03:00
James Almer
dc7bd7c5a5 avcodec: use the new AVFrame key_frame flag in all decoders and encoders
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 18:48:22 -03:00
James Almer
599abc0f3a avutil/frame: deprecate interlaced_frame and top_field_first
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 18:15:00 -03:00
James Almer
2f561ba953 avcodec: use the new AVFrame interlace flags in all decoders and encoders
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 18:14:02 -03:00
Zhao Zhili
4006c71d19 avcodec/options_table: reorder nokey after nointra
So the values are in ascending order.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-05-04 12:13:07 +08:00
Zhao Zhili
0d40711f59 avcodec/hevcdec: remove unused variables from hls_slice_data
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-05-04 12:10:23 +08:00
Zhao Zhili
36a56d3cc8 avcodec/avcodec: fix UB NULL+0
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-05-04 12:10:11 +08:00
Anton Khirnov
0ed1eeb744 lavf/dv: use a more granular timebase for audio
One that is fine enough to represent all DV audio sample rates. Audio
packet durations are now sample-accurate.

This largely undoes commit 76fbb0052d. To
avoid breaking the issue fixed by that commit, resync audio timestamps
against video if they get more than one frame apart. The sample from
issue #8762 still works correctly after this commit.

Slightly changes the results of the lavf-dv seektest, due to the audio
timebase being more granular.
2023-05-02 10:57:21 +02:00
Anton Khirnov
c7a852b638 lavf/dv: do not set video timebase more than once
Current code will call avpriv_set_pts_info() for each video frame,
possibly setting a different timebase if the stream framerate changes.
This violates API conventions, as the timebase is supposed to stay
constant after stream creation.

Change the demuxer to set a single timebase that is fine enough to
handle all supported DV framerates.

The seek tests change slightly because the new timebase is more
granular.
2023-05-02 10:57:21 +02:00
James Almer
e7c690a046 avcodec/hevc_ps: check for out of range bitdepth in SPS
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-30 20:41:55 -03:00
Michael Niedermayer
bf3f91c425
avcodec/hevc_ps: Avoid signed overflow before check on QP
Fixes: signed integer overflow: -2147483648 - 5 cannot be represented in type 'int'
Fixes: 58066/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5312995835379712

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-01 00:48:32 +02:00
Michael Niedermayer
cb8180aa66
avcodec/hevc_ps: Check depth to be within 8 to 16
Fixes: assertion failure in bitreader
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-627318668066816

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-01 00:48:32 +02:00
Michael Niedermayer
e2e34c7731
avcodec/wavarc: Check order before using it to write the list
Fixes: out of array access
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-6247711015043072
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-6487578428964864
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-6651587794960384
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-6686265824378880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-01 00:48:32 +02:00
Michael Niedermayer
957106a24d
avcodec/bonk: decode multiple passes in intlist_read() at once
This makes the worst case much faster

Fixes: Timeout
Fixes: 51363/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-5660734784143360
Fixes: 57957/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-5874095467397120

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-01 00:48:32 +02:00
Michael Niedermayer
e734e16544
avcodec/cavsdec: Check bits left before picture allocation
Fixes: Timeout
Fixes: 57893/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CAVS_fuzzer-5091726540013568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-01 00:48:32 +02:00
Michael Niedermayer
b2a3279dbe
avcodec/apedec: Factor constant sign out of loop in long_filter_high_3800()
930 -> 850 cycles

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-01 00:48:32 +02:00
Michael Niedermayer
eb768a75f8
avcodec/apedec: Move pointer instead of copying each element in delay in long_filter_high_3800()
~1000 -> 930 cycles

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-01 00:48:32 +02:00
James Almer
45fc89bb14 avcodec/hevc_ps: use get_ue_golomb() for some SPS Screen Content Coding extension fields
Also remove the _minus1 part of the name to be in line with the rest of the
decoder.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-30 18:29:34 -03:00
James Almer
0275d99427 avcodec/parser: fill avctx dimensions if unset
This allows the usage of codecs in builds that have a parser but no decoders
for remuxing scenarios with raw sources.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-30 18:25:24 -03:00
James Almer
41dd50ad0d avcodec/hevc_ps: use get_{ue,se}_golomb() for some PPS Range extension fields
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-28 20:15:57 -03:00