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

112895 Commits

Author SHA1 Message Date
Lynne
658b01b5ee
nlmeans_vulkan: reduce dispatches by parallelizing the planes 2023-10-11 16:53:04 +02:00
Lynne
6bc8ff7d93
nlmeans_vulkan: fix width/height for chroma plane weights calculation 2023-10-11 16:53:00 +02:00
Kyle Swanson
6028728bb8 avfilter/libvmaf: remove deprecated options 2023-10-10 11:00:20 -07:00
Andreas Rheinhardt
c06d3d2404 fftools/ffmpeg_demux: Fix leak on error
An AVFormatContext leaks on errors that happen before it is attached
to its permanent place (an InputFile). Fix this by attaching
it earlier.

Given that it is not documented that avformat_close_input() is usable
with an AVFormatContext that has only been allocated with
avformat_alloc_context() and not opened with avformat_open_input(),
one error path before avformat_open_input() had to be treated
specially: It uses avformat_free_context().

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 14:30:07 +02:00
Andreas Rheinhardt
d98dfcecad fftools/ffmpeg_demux: Don't use fake object with av_opt_eval
The av_opt_eval family of functions emits errors messages on error
and can therefore not be used with fake objects when the AVClass
has a custom item_name callback. The AVClass for AVCodecContext
has such a custom callback (it searches whether an AVCodec is set
to use its name). In practice it means that whatever is directly
after the "cc" pointer to the AVClass for AVCodec in the stack frame
of ist_add() will be treated as a pointer to an AVCodec with
unpredictable consequences.

Fix this by using an actual AVCodecContext instead of a fake object.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 14:29:54 +02:00
Paul B Mahol
44dc42e4ac avcodec/mlpenc: export lpc_coeff_precision option
Change default precision from 11 to 15, improves compression.
2023-10-10 13:53:11 +02:00
Anton Khirnov
33f058f2ec fftools/ffmpeg_enc: constify the frame passed to enc_open() 2023-10-10 12:41:31 +02:00
Anton Khirnov
2ef50c17ab fftools/ffmpeg_filter: fail on filtering errors
These should be considered serious errors - don't just print a log
message and continue as if nothing happened.
2023-10-10 12:41:31 +02:00
Anton Khirnov
9196be2fb1 fftools/ffmpeg_enc: move fps conversion code to ffmpeg_filter
Its function is analogous to that of the fps filter, so filtering is a
more appropriate place for this.

The main practical reason for this move is that it places the encoding
sync queue right at the boundary between filters and encoders. This will
be important when switching to threaded scheduling, as the sync queue
involves multiple streams and will thus need to do nontrivial
inter-thread synchronization.

In addition to framerate conversion, the closely-related
* encoder timebase selection
* applying the start_time offset
are also moved to filtering.
2023-10-10 12:41:31 +02:00
Anton Khirnov
f0f6d6d0e1 fftools/ffmpeg_enc: move framerate conversion state into a separate struct
Makes it more clear what state is specific to framerate conversion,
which will be useful in the following commit.
2023-10-10 12:41:31 +02:00
Anton Khirnov
61777c62d7 fftools/ffmpeg: stop accessing OutputStream.last_dropped in print_report()
That field is used by the framerate code to track whether any output has
been generated for the last input frame(*). Its use in the last
invocation of print_report() is meant to account for the very last
filtered frame being dropped in the number of dropped frames printed in
the log. However, that is a highly inappropriate place to do so, as it
makes assumptions about vsync logic in completely unrelated code. Move
the increment to encoder flush instead.

(*) the name is misleading, as the input frame has not yet been dropped
    and may still be output in the future
2023-10-10 12:41:31 +02:00
Anton Khirnov
d2c416fdf1 fftools/ffmpeg_enc: merge -force_key_frames source/source_no_drop
Always use the functionality of the latter, which makes more sense as it
avoids losing keyframes due to vsync code dropping frames.

Deprecate the 'source_no_drop' value, as it is now redundant.
2023-10-10 12:41:31 +02:00
Anton Khirnov
735b082231 fftools/ffmpeg_enc: unbreak -force_key_frames source_no_drop
Unlike the 'source' mode, which preserves source keyframe-marking as-is,
the 'source_no_drop' mode attempts to keep track of keyframes dropped by
framerate conversion and mark the next output frame as key in such
cases. However,
* c75be06148 broke this functionality entirely, and made it equivalent
  to 'source'
* even before it would only work when the frame immediately following
  the dropped keyframe is preserved and not dropped as well

Also, drop a redundant check for 'frame' in setting dropped_keyframe, as
it is redundant with the check on the above line.
2023-10-10 12:41:31 +02:00
Anton Khirnov
a07b2f5f11 tests/fate/ffmpeg: add tests for -force_key_frames source 2023-10-10 12:41:31 +02:00
Anton Khirnov
e35d36eb72 ffools/ffmpeg_filter: stop trying to handle an unreachable state
ifilter_send_eof() will fail if the input has no real or fallback
parameters, so there is no need to handle the case of some inputs being
in EOF state yet having no parameters.
2023-10-10 12:41:31 +02:00
Anton Khirnov
99567ee870 fftools/ffmpeg_enc: simplify adjust_frame_pts_to_encoder_tb() signature
It does not need an OutputFile and an OutputStream, only the target
timebase and the timestamp offset.
2023-10-10 12:41:31 +02:00
Anton Khirnov
096d88dcc6 fftools/ffmpeg_enc: move remaining vsync-related code to video_sync_process() 2023-10-10 12:41:31 +02:00
Anton Khirnov
a9b9e771b3 fftools/ffmpeg_enc: move handling video frame duration to video_sync_process()
That is a more appropriate place for this.
2023-10-10 12:41:31 +02:00
Paul B Mahol
394106a138 avcodec/mlpenc: fix regression in encoding only zeroes
Previously it would use more bits than neccessary.
2023-10-10 10:31:37 +02:00
Andreas Rheinhardt
9c1294eadd avcodec/vdpau_vc1: Fix indentation
Forgotten after af6e232ccf.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:22:55 +02:00
Andreas Rheinhardt
c77aee61b8 avcodec/mpeg(picture|video_dec): Move comment to more appropriate place
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:22:35 +02:00
Andreas Rheinhardt
52509f63ce avcodec/mpegpicture: Move caller-specific parts of function to callers
Since at least commit c954cf1e1b
(adding ff_encode_alloc_frame()), a large part of ff_alloc_picture()
is completely separate for the two callers. Move the caller-specific
parts out to the callers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:22:19 +02:00
Andreas Rheinhardt
2a8ac5a780 avcodec/mpegvideo_enc: Don't call av_frame_copy_props() unnecessarily
It is unnecessary in case of user-supplied frames, because
it happens directly after a av_frame_ref() with the same
src and dst.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:22:15 +02:00
Andreas Rheinhardt
22b0141d87 avcodec/mpegvideo_enc: Don't allocate buffers unnecessarily
ff_alloc_picture() performs two tasks: a) In most instances,
it allocates frame buffers and b) it allocates certain
auxiliary buffers.

The exception to a) is the case when the encoder can reuse
user-supplied frames. And for these frames the auxiliary buffers
are unused, because this frame will never be used as current_picture
(and therefore also not as next_picture or last_picture);
see select_input_picture().

This means that we can simply avoid calling ff_alloc_picture()
with user-supplied frames at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:21:48 +02:00
Andreas Rheinhardt
d87c358ee6 avcodec/mpegvideo_enc: Remove dead block
None of the mpegvideo encoders support anything but coded frames;
and if this were to change, it is unclear whether they would need
the adjustment here. So remove it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:21:46 +02:00
Andreas Rheinhardt
070bc4d2c5 avcodec/mpegvideo_enc: Don't set write-only properties
The frame is immediately reset in the ff_mpeg_unref_picture()
call below.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:21:40 +02:00
Andreas Rheinhardt
3937a21f21 avcodec/mpegvideo_enc: Don't overallocate arrays
Only entries 0..max_b_frames are ever used.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:21:20 +02:00
Andreas Rheinhardt
0524b4ec3e avcodec/mpegvideo_enc: Don't reget known values
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:20:57 +02:00
Andreas Rheinhardt
18f7d8d880 avcodec/mpegvideo_enc: Don't pretend input to be non-refcounted
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:20:44 +02:00
Andreas Rheinhardt
f5220475de avcodec/mpegvideo_enc: Reindentation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:20:39 +02:00
Andreas Rheinhardt
5aaaa7dbee avcodec/mpegvideo_enc: Remove always-false checks
In case "!direct" we are not reusing the input buffers
(due to e.g. insufficient alignment), but allocating
new ones. These of course do not alias with the ones
provided by the user, so these checks are always-false.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:20:09 +02:00
Andreas Rheinhardt
b96ba62bdd avcodec/mpegvideo_enc: Fix abort on allocation errors
mpegvideo_enc uses a fixed-size array of Pictures; a slot is
considered taken if the Picture's AVFrame is set.
When an error happens after a slot has been taken, this Picture
has typically not been reset and is therefore not usable for
future requests. The code aborts when one runs out of slots
and this can happen in case of allocation failures.
Fix this by always unreferencing a Picture in case of errors.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:19:52 +02:00
Paul B Mahol
78fa1cff70 avcodec/mlpenc: export max_interval option 2023-10-09 23:48:00 +02:00
Paul B Mahol
ee9fb28429 avcodec/mlpenc: export codebook_search option too 2023-10-09 23:47:58 +02:00
Paul B Mahol
1703bfa133 avcodec/hcadec: implement proper .flush callback 2023-10-09 21:23:25 +02:00
Timo Rothenpieler
8b6ee74d50 avfilter/ddagrab: create secondary xor mouse texture 2023-10-09 20:17:50 +02:00
Timo Rothenpieler
0e7ae95cc2 avfilter/ddagrab: actually use provided texture pointer 2023-10-09 20:17:49 +02:00
Timo Rothenpieler
e006680d8e avcodec/nvenc: add option to control subsampling of packed rgb input 2023-10-09 20:17:44 +02:00
Timo Rothenpieler
3914abf76e configure: fix --custom-allocator
The custom-allocator logic has been completely defunct since a while,
since nothing depends on those targets, they never get used.
This updates jemalloc to pkg-config, adds the fallback option for
potential arbitrary allocators, and finally actually adds the libraries
to LDFLAGS.
2023-10-09 20:14:07 +02:00
Rémi Denis-Courmont
3c6516330f lavc/exrdsp: R-V V reoder_pixels 2023-10-09 19:52:51 +03:00
Rémi Denis-Courmont
f39a8790e1 lavu/fixed_dsp: R-V V vector_fmul_window 2023-10-09 19:52:28 +03:00
Rémi Denis-Courmont
10eb3b9c9f lavu/fixed_dsp: R-V V vector_fmul
vector_fmul_fixed_c: 4.0
vector_fmul_fixed_rvv_i64: 0.5
2023-10-09 19:52:28 +03:00
Rémi Denis-Courmont
da7a77fb0a lavu/fixed_dsp: R-V V vector_fmul_reverse 2023-10-09 19:52:28 +03:00
Rémi Denis-Courmont
bf911cc1bf lavu/fixed_dsp: R-V V vector_fmul_add
vector_fmul_add_fixed_c: 2.2
vector_fmul_add_fixed_rvv_i64: 0.5
2023-10-09 19:52:28 +03:00
Rémi Denis-Courmont
9091ffb006 lavu/float_dsp: adjust multipler in R-V V fmul_window
The gather index vector is only used as double-length (due to register
pressure), so no need to initialise it for quad-length. Basically this
matches the multiplier in the prologue to the the multipler in the loop.
2023-10-09 19:52:28 +03:00
Paul B Mahol
8786b91607 avcodec/mlpenc: change flag for shorten_by in THD case 2023-10-09 18:42:43 +02:00
Paul B Mahol
27c623b3d5 avcodec/mlpenc: fix stereo decorrelation 2023-10-09 18:42:42 +02:00
Andreas Rheinhardt
12c4cf9f72 avcodec/refstruct: Inline ff_refstruct_allocz()
Suggested by James Almer.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-09 15:54:09 +02:00
Andreas Rheinhardt
fc880c7032 avcodec/h261dec: Remove pointless goto
There is no need to parse the header twice; doing so does nothing.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-09 15:53:06 +02:00
Andreas Rheinhardt
cae30c5ed2 avcodec/wmv2dec: Parse extradata during init
And stop setting picture_number which was only done to not parse
extradata multiple times.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-09 15:52:23 +02:00