Commit Graph

111019 Commits

Author SHA1 Message Date
Martin Storsjö 397cb623c8 aarch64: Add cpu flags for the dotprod and i8mm extensions
Set these available if they are available unconditionally for
the compiler.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-06-06 12:40:42 +03:00
Martin Storsjö fb1b88af77 configure: aarch64: Support assembling the dotprod and i8mm arch extensions
These are available since ARMv8.4-a and ARMv8.6-a respectively,
but can also be available optionally since ARMv8.2-a.

Check if ".arch armv8.2-a" and ".arch_extension {dotprod,i8mm}" are
supported, and check if the instructions can be assembled.

Current clang versions fail to support the dotprod and i8mm
features in the .arch_extension directive, but do support them
if enabled with -march=armv8.4-a on the command line. (Curiously,
lowering the arch level with ".arch armv8.2-a" doesn't make the
extensions unavailable if they were enabled with -march; if that
changes, Clang should also learn to support these extensions via
.arch_extension for them to remain usable here.)

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-06-06 12:40:26 +03:00
Leo Izen fa11c4c7fa
avformat/jpegxl_anim_dec: add animated JPEG XL demuxer
Animated JPEG XL files requires a separate demuxer than image2, because
the timebase information is set by the demuxer. Should the timebase of
an animated JPEG XL file be incompatible with the timebase set by the
image2pipe demuxer (usually 1/25 unless set otherwise), rescaling will
fail. Adding a separate demuxer for animated JPEG XL files allows the
timebase to be set correctly.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-06-05 12:15:05 -04: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
Anton Khirnov 141d11cb3c fftools/ffmpeg_mux: make OutputStream.pkt private
It is no longer used outside of muxing code.
2023-06-05 16:16:13 +02:00
Anton Khirnov 730a2221af fftools/ffmpeg_enc: use a private AVPacket instance for encoding
The code currently uses OutputStream.pkt, which complicates its
ownership semantics.
2023-06-05 16:16:12 +02:00
Anton Khirnov f94957e8f4 fftools/ffmpeg_mux: simplify calling of_output_packet()
Use NULL packets to signal EOF instead of a separate variable. This is
made possible by the previous commit.
2023-06-05 16:16:12 +02:00
Anton Khirnov 96e1325d91 fftools/ffmpeg_mux: use a dedicated packet for BSF output
Currently of_output_packet() reuses the input packet, which requires its
callers to submit blank packets even on EOF, which makes the code more
complex.
2023-06-05 16:16:12 +02:00
Anton Khirnov c803b36b8f fftools/ffmpeg_enc: stop using OutputStream.initialized
It is set by the muxing code, which will not be synchronized with
encoding code after upcoming threading changes. Use an encoder-private
variable instead.
2023-06-05 16:15:04 +02:00
Anton Khirnov 568d414074 fftools/ffmpeg: attach filter framerate to frames
This way the encoder does not need to reach backward into the filter.
2023-06-05 16:15:04 +02:00
Anton Khirnov 9630341073 fftools/ffmpeg: factor out attaching FrameData to a frame
Will be useful in following commits.
2023-06-05 16:15:04 +02:00
Anton Khirnov d7781cfb95 fftools/ffmpeg: convert timestamps inside the muxer
Packets submitted to the muxer now have their timebase attached to them,
so the muxer can do conversion to muxing timebase and avoid exposing it
to callers.
2023-06-05 16:15:04 +02:00
Anton Khirnov cf121592c5 fftools/ffmpeg_mux_init: do not overwrite OutputStream.frame_rate for encoding
The values currently written into it are not used after
enc_open(), so it is better to confine them to that function.
2023-06-05 16:15:04 +02:00
Anton Khirnov 5bea8daa78 fftools/ffmpeg_enc: do not guess frame durations from output framerate
There is no reason to expect input frame durations to match output
framerate.
2023-06-05 16:15:04 +02:00
Anton Khirnov 2f92650c5d fftools/ffmpeg_enc: inline init_encoder_time_base() into its callers
The function now reduces to a ternary operator, so it is shorter and
clearer to eliminate it.
2023-06-05 16:15:04 +02:00
Anton Khirnov 93e26a4db7 fftools/ffmpeg: handle -enc_time_base -1 during stream creation
There is no reason to postpone it until opening the encoder. Also, abort
when the input stream is unknown, rather than disregard an explicit
request from the user.
2023-06-05 16:15:04 +02:00
Anton Khirnov 58a64e3d54 fftools/ffmpeg_mux_init: only process -enc_time_base if the stream is encoded
It has no effect otherwise.
2023-06-05 16:15:04 +02:00
Anton Khirnov 2baae6434b fftools/ffmpeg_enc: merge two adjacent video-specific blocks
There is no meaningful reason for them to be separated.
2023-06-05 16:15:04 +02:00
Anton Khirnov c8a85d1b2f fftools/ffmpeg_mux_init: do not overwrite OutputStream.frame_rate for streamcopy
The values currently written into it are not used after
streamcopy_init(), so it is better to confine them to that function.
2023-06-05 16:15:04 +02:00
Anton Khirnov ccf219e361 fftools/ffmpeg_enc: avoid breaking exactly integer timestamps in vsync code
The code will currently add a small offset to avoid exact midpoints, but
this can cause inexact results when a float timestamp is exactly
representable as an integer.

Fixes off-by-one in the first frame duration in multiple FATE tests.
2023-06-05 16:15:04 +02:00
Anton Khirnov c7a05ac117 fftools/ffmpeg_demux: do not set AVCodecContext.framerate
For decoding, this field is used by the decoder to export information
to the caller; it does not make sense for the caller to set it.
2023-06-05 16:15:04 +02:00
Anton Khirnov d8c61ba723 fftools/ffmpeg_filter: drop a block disabled since 2012 2023-06-05 16:15:04 +02:00
Anton Khirnov ad14bdbcfd fftools/ffmpeg_filter: drop a write-only variable 2023-06-05 16:15:04 +02:00
Anton Khirnov 57021a68d9 fftools/ffmpeg_mux: set stream duration after the timebase is certainly known
Stop assuming the encoder knows the muxing timebase, which does not
always have to hold (e.g. due to bitstream filters).
2023-06-05 16:15:04 +02:00
Anton Khirnov ba1141d8a9 fftools/ffmpeg_enc: move nb_frames{dup,drop} globals into OutputStream 2023-06-05 16:15:04 +02:00
Anton Khirnov 09af34dc91 tests/fate/ffmpeg: add tests for -max_error_rate 2023-06-05 16:15:04 +02:00
Michael Niedermayer b1c3d81e71
avformat/oggparsetheora: clip duration within 64bit
Fixes: signed integer overflow: 9079256848778919936 - -288230376151711746 cannot be represented in type 'long'
Fixes: 58248/clusterfuzz-testcase-minimized-ffmpeg_dem_OGG_fuzzer-6326851353313280

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:25 +02: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
Philip Langdale 378fb40282 avutil/hwcontext_vulkan: disable multiplane when deriving from cuda
Today, cuda is not able to import multiplane images, and cuda requires
images to be imported whether you trying to import to cuda or export
from cuda (in the later case, the image is imported and then copied
into on the cuda side). So any interop between cuda and vulkan requires
that multiplane be disabled.

The existing option for this is not sufficient, because when deriving
devices it is not possible to specify any options.

And, it is necessary to derive the Vulkan device, because any pipeline
that involves uploading from cuda to vulkan and then back to cuda must
use the same cuda context on both sides, and the only way to propagate
the cuda context all the way through is to derive the device at each
stage.

ie:

-vf hwupload=derive_device=vulkan,<filters>,hwupload=derive_device=cuda
2023-06-03 16:29:38 -07: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
Anton Khirnov ba32f28498 doc/examples/transcode: convert timestamps between filtering and encoding
The timebases do not have to match.
2023-06-03 11:27:42 +02:00
Anton Khirnov 811b0e02be doc/examples/transcode: stop using decoder's AVCodecContext.time_base
The contents of this field are not defined for decoding. Use
pkt_timebase, which is the timebase of demuxed packets.

Drop a tautological av_packet_rescale_ts() call, as the stream and
decoder timebases are the same.
2023-06-03 11:27:23 +02:00
Anton Khirnov 828d3b4432 doc/examples/transcode: set packet timebase for decoding
It is recommended for callers to set it, though not required.
2023-06-03 11:27:11 +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
Paul B Mahol 9a9b56c870 avfilter/vf_mix: add fast filtering in case all tmix weights are same 2023-06-02 18:54:32 +02:00
James Almer da23151eaf avformat/oggparseflac: use the GetByteContext API
All but one read are byte aligned, so there's no point in using the
GetBitContext API.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-01 19:51:06 -03:00
Timo Rothenpieler d2b46c1ef7 avcodec/nvenc: stop using deprecated rc modes with SDK 12.1 2023-06-01 23:47:14 +02:00
Timo Rothenpieler 03823ac0c6 configure: use non-deprecated nvenc GUID for conftest 2023-06-01 23:24:43 +02:00
Paul B Mahol 3cfd85ec20 avfilter/avf_showcqt: switch to activate
And make output frame durations always same.
2023-06-01 20:27:33 +02:00
Paul B Mahol baa9fccf8d avfilter/vf_mergeplanes: remove hack for linesize calculation 2023-05-31 19:24:03 +02:00
Pierre-Anthony Lemieux 0f2f0dd5b4
avformat/imf: clean-up logging
* remove logging to NULL
 * remove extraneous logging
2023-05-31 09:03:58 -07:00
Anton Khirnov ba2c791627 fftools/ffmpeg_filter: do not flush encoders on parameter change
It makes no sense to do so.
2023-05-31 16:20:19 +02:00
Anton Khirnov 106167374c fftools/ffmpeg_mux: flush bsfs immediately on exceeding recoding time
Current code marks the output stream as finished and waits for a flush
packet, but that is both unnecessary and suspect, as in theory nothing
should be sent to a finished stream - not even flush packets.
2023-05-31 16:20:19 +02:00