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

111260 Commits

Author SHA1 Message Date
Michael Niedermayer
4aa1a42a91
avutil/softfloat: Basic documentation for av_sincos_sf()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-23 02:06:46 +02:00
Michael Niedermayer
d84677abd8
avutil/softfloat: fix av_sincos_sf()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-23 02:06:46 +02:00
Michael Niedermayer
fe167bae96
tools/target_dec_fuzzer: Adjust threshold for speex
Fixes: Timeout
Fixes: 59731/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEX_fuzzer-4809436670328832

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-23 02:06:46 +02:00
caleb
043a9d09cb
avcodec/jpeg2000htdec: Check for invalid magref length.
Fixes: shift exponent -8 is negative
Fixes: 58328/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-6007789196804096

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-23 02:06:45 +02:00
Michael Niedermayer
a4bf559683
avcodec/utils: fix 2 integer overflows in get_audio_frame_duration()
Fixes: signed integer overflow: 256 * 668003712 cannot be represented in type 'int'
Fixes: 59819/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-4674636538052608

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-23 02:06:45 +02:00
James Almer
25ce1c8333 avformat/id3v2: check the return value of avio_close_dyn_buf()
Fixes ticket #10424.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-22 21:00:15 -03:00
James Almer
9834660601 avcodec/evc_frame_merge: copy input packet props to output
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-22 16:08:14 -03:00
James Almer
daf61a706a avcodec/evc_frame_merge: reindent after previous commit
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-22 16:08:14 -03:00
James Almer
e6359b0cc1 avcodec/evc_frame_merge: properly support packets with more than one NALU
Parse through all NALUs in a packet, pull new ones when a complete AU could not
be assembled, or keep them around if an AU was assembled while data remained in
them.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-22 16:08:14 -03:00
Ricardo Monteiro
99dfdb45a8 avcodec/nvenc: let preset decide default gop size
Default GOP size is now set by preset and tuning info. This GOP size is only overwriten if -g value is provided.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2023-06-22 19:33:09 +02:00
Lynne
997d8a7e73
vulkan_decode: reject decoding of frames with no slices
As per the spec:
VUID-VkVideoDecodeH264PictureInfoKHR-sliceCount-arraylength
sliceCount must be greater than 0

VUID-VkVideoDecodeH265PictureInfoKHR-sliceSegmentCount-arraylength
sliceSegmentCount must be greater than 0

This particularly happens with seeking in field-coded H264.
2023-06-22 18:18:53 +02:00
Lynne
4ff303a7b8
vulkan_decode: simplify and make session parameter generation more robust
This commit scraps a bool to signal to recreate the session parameters,
but instead destroys them, forcing them to be recreated.

As this can happen between start_frame and end_frame, do this
at both places.
2023-06-22 18:17:54 +02:00
Dave Airlie
343716bd74
vulkan/av1: fix tile upload offsets.
This fixes decoding av1-1-b8-22-svc-L2T1.ivf
while not breaking other videos.
2023-06-22 18:17:54 +02:00
Lynne
ba8a803236
vulkan_decode: clean up slice handling
Move the slice offsets buffer to the thread decode context.
It isn't part of the resources for frame decoding, the driver
has to process and finish with it at submission time.
That way, it doesn't need to be alloc'd + freed on every frame.
2023-06-22 18:17:54 +02:00
Lynne
237c400727
vulkan_decode: remove unused fields 2023-06-22 18:17:53 +02:00
Lynne
d9af84426b
vulkan_decode: fix small memory leak
This requires using the new AVHWFramesContext.opaque field, as
otherwise, the profile attached to the decoder will be freed
before the frames context, rendering the frames context useless.
2023-06-22 18:17:53 +02:00
Lynne
13ff3aa9e7
vulkan_decode: use the hwfc->user_opaque field to store the profile 2023-06-22 18:17:47 +02:00
James Almer
1bcb8a7338 avcodec/evc_parser: use a GetBitContext to parse entire NALUs
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-21 13:31:14 -03:00
James Almer
7fc6c7633e avcodec/evc_frame_merge: use a GetBitContext to parse entire NALUs
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-21 13:31:14 -03:00
James Almer
c7183a22db avformat/evc: move NALU length and type parsing functions to a header
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-21 13:31:14 -03:00
James Almer
e5da2ec456 avcodec/evc_parse: pass a GetBitContext to the slice header parsing function
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-21 13:31:14 -03:00
James Almer
2212808a72 avcodec/evc_ps: pass a GetBitContext to the SPS and PPS parsing functions
This is in preparation for the following patch.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-21 13:31:14 -03:00
James Almer
d0d20f16ce avformat/evcdec: use an unsigned type for nalu_size
But ensure the value returned by evc_read_nal_unit_length() fits in an int.
Should prevent integer overflows later in the code.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-21 13:31:14 -03:00
James Almer
a6a5e53595 avformat/evcdec: flush the bsf on EOF
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-21 13:31:14 -03:00
James Almer
43ace56c7e avformat/evcdec: remove unnecessary av_packet_unref() calls
And return proper error codes.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-21 13:31:14 -03:00
James Almer
2276bcc52a avformat/evcdec: ensure there are enough bytes to seekback
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-21 13:31:14 -03:00
Anton Khirnov
83b3ff741b tests/fate/ffmpeg: silence the audio for fate-ffmpeg-streamloop-transcode-av
Fixed-point AAC decoder currently does not produce the same output on
all platforms. Until that is fixed, silence the audio stream using the
volume filter.

Also, actually use the aac_fixed decoder as was the original intent.
2023-06-21 10:07:41 +02:00
Romain Beauxis
468615f204 libavformat/mpegts.c: fix hardcoded 5-bytes skip for metadata streams.
Before the introduction of AV_CODEC_ID_TIMED_ID3 for timed_id3 metadata streams
in mpegts (commit 4a4437c0fb), AV_CODEC_ID_SMPTE_KLV
was the only existing codec for metadata.

It seems that this codec has a 5-bytes metadata header[1] that, for some reason,
was always skipped when decoding data packets.

However, when working with a AV_CODEC_ID_TIMED_ID3 streams, this results in the
5 first bytes of the payload being cut-off, which includes essential informations
such as the ID3 tag version.

This patch fixes the issue by keeping the 5-bytes skip only for AV_CODEC_ID_SMPTE_KLV
streams.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-20 21:08:06 -03:00
James Almer
98cae37e23 Changelog: mention the recent AC-4 additions
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-20 14:54:11 -03:00
Michael Niedermayer
6a9d13acc2
avformat/jpegxl_anim_dec: fix out of array read using buffer padding
Fixes: out of array read
Fixes: 59828/clusterfuzz-testcase-minimized-ffmpeg_dem_JPEGXL_ANIM_fuzzer-5029813220671488

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-20 12:47:31 -04:00
Leo Izen
33c9972808
MAINTAINERS: change Leo Izen IRC nickname
I use a different nick on IRC now, Traneptora, instead of what I
formerly used, thebombzen.

Signed-off-by: <leo.izen@gmail.com>
2023-06-20 12:46:47 -04:00
Niklas Haas
e998d0a4f7 lavfi/vf_libplacebo: allow pos_w to depend on pos_h
Ditto for crop_w/crop_h. Requires simply repeating the evaluation of the
first variable to be evaluated.
2023-06-20 17:09:58 +02:00
Niklas Haas
f998a618ba lavfi/vf_libplacebo: add nb_inputs option
To control the number of inputs.
2023-06-20 17:09:58 +02:00
Niklas Haas
9049ea6763 lavfi/vf_libplacebo: set time_base/frame_rate dynamically
Use the gcd of all input timebases to ensure PTS accuracy. For the
framerate, just pick the highest of all the inputs, under the assumption
that we will render frames with approximately this frequency. Of course,
this is not 100% accurate, in particular if the input frames are badly
misaligned. But this field is informational to begin with.

Importantly, it covers the "common" case of combining high FPS and low
FPS streams with aligned frames.
2023-06-20 17:09:58 +02:00
Niklas Haas
1b2c6c9a03 lavfi/vf_libplacebo: also skip cache if in FPS == out FPS
Fixes an oversight in the previous code which should have been >=, not >.
2023-06-20 17:09:58 +02:00
Niklas Haas
618b72d4b4 lavfi/vf_libplacebo: skip cache selectively per-input
It may be the case that we want to skip the single frame cache for some
inputs but not others.
2023-06-20 17:09:58 +02:00
Niklas Haas
015c3b659e lavfi/vf_libplacebo: set format list for all inputs 2023-06-20 17:09:58 +02:00
Niklas Haas
5989719e87 lavfi/vf_libplacebo: add in_idx variable
To allow placing an input dynamically, as a function of the input index.
2023-06-20 17:09:58 +02:00
Niklas Haas
7645c8df66 lavfi/vf_libplacebo: make input-dependent vars dynamic
Because these can differ based on the input, for multiple inputs.
2023-06-20 17:09:58 +02:00
Niklas Haas
d625010acd lavfi/vf_libplacebo: generalize frame update to multiple inputs
In the event that some frame mixes are OK while others are not, the
priority goes:

1. Errors in updating any frame -> return error
2. Any input incomplete -> request frames and return
3. Any inputs OK -> ignore EOF streams and render remaining inputs
4. No inputs OK -> set output to most recent status

This logic ensures that we can continue rendering the remaining streams,
no matter which streams reach their end of life, until we have no
streams left at which point we forward the last EOF.
2023-06-20 17:09:58 +02:00
Niklas Haas
6c41c3f928 lavfi/vf_libplacebo: only drain actually used PTS
When combining multiple inputs, the output PTS may be less than the PTS
of the input. In this case, the current's code assumption of always
draining one value from the FIFO is incorrect. Replace by a smarter
function which drains only those PTS values that were actually consumed.
2023-06-20 17:09:58 +02:00
Niklas Haas
502b699a50 lavfi/vf_libplacebo: determine PTS of next frame from any input
When combining multiple inputs with different PTS and durations, in
input-timed mode, we emit one output frame for every input frame PTS,
from *any* input. So when combining a low FPS stream with a high FPS
stream, the output framerate would match the higher FPS, independent of
which order they are specified in.
2023-06-20 17:09:58 +02:00
Niklas Haas
0eb37c2419 lavfi/vf_libplacebo: handle multiple inputs
This commit still relies on a single input for PTS determination, to be
changed in the next commit.
2023-06-20 17:09:58 +02:00
Niklas Haas
56e550b264 lavfi/vf_libplacebo: support blending multiple inputs
Subsequent inputs require frame blending to be enabled, in order to not
overwrite the existing frame contents.

For output metadata, we implicitly copy the metadata of the *first*
available stream (falling back to the second stream if the first has
already reached EOF, and so on). This is done to resolve any conflicts
between inputs with differing metadata. So when e.g. input 1 is HDR and
output 2 is SDR, the output will be HDR, and vice versa. This logic
could probablly be improved by dynamically determining some "superior"
set of metadata, but I don't want to handle that complexity in this
series.
2023-06-20 17:09:58 +02:00
Niklas Haas
0c66d912ba lavfi/vf_libplacebo: keep track of latest status globally
This field will effectively hold the most recent status set by any
input. Currently functionally equivalent to input->status, but will
change soon.
2023-06-20 17:09:57 +02:00
Niklas Haas
4e4a66b8c4 lavfi/vf_libplacebo: replace s->input by dynamic array
For now, hard-coded to 1 element.
2023-06-20 17:09:57 +02:00
Niklas Haas
a7775bd32c lavfi/vf_libplacebo: use correct link in update_crops()
Instead of hard-coding input 0, pass the per-input structure and use the
link contained inside it.
2023-06-20 17:09:57 +02:00
Niklas Haas
93c7e8c0ae lavfi/vf_libplacebo: factor out ref frame logic
Instead of finding the ref frame in output_frame() and then passing its
signature to update_crops(), pull out the logic and invoke it a second
time inside update_crops().

This may seem wasteful at present, but will actually become required in
the future, since update_crops() runs on *every* input, and needs values
specific to that input (which the signature isn't), while output_frame()
is only interested in a single input. It's much easier to just split the
logic cleanly.
2023-06-20 17:09:57 +02:00
Niklas Haas
666c8aa4d7 lavif/vf_libplacebo: remove pl_frame_mix from output_frame_mix
Instead, rename this function to `output_frame` and make it pull the
`pl_frame_mix` from the input structure. Step towards handling multiple
inputs.
2023-06-20 17:09:57 +02:00
Niklas Haas
ad445a7030 lavfi/vf_libplacebo: move temporary vars into per-input struct
Including the queue status, because these will need to be re-queried
inside output_frame_mix when that function is refactored to handle
multiple inputs.
2023-06-20 17:09:57 +02:00