Commit Graph

111702 Commits

Author SHA1 Message Date
Rémi Denis-Courmont d8ea5f50e2 checkasm: print usage on invalid arguments
This checks that arguments are handled. If not, then this prints a
short usage notice and returns an error.
2023-07-17 18:48:42 +03:00
Rémi Denis-Courmont 97c3c9974c lavc/audiodsp: fix aliasing violation
Even though they have the same size, and typically the same alignment,
uint32_t and float are under no circumstances compatible types in C.

The casts from float * to uint32_t * are invalid here. Insofar as the
resulting pointers are dereferenced, this is undefined behaviour.
This patch uses av_float2int() / av_int2float() instead.
2023-07-17 18:48:42 +03:00
Rémi Denis-Courmont 51945d5ace lavc/aacpsdsp: use restrict qualifier
Except for add_squares, telling the compiler that the output vector(s)
cannot alias helps quite a bit (cycles on SiFive U74-MC):

ps_add_squares_c: 98277.7
ps_add_squares_r: 98320.2

ps_hybrid_analysis_c: 3731.2
ps_hybrid_analysis_r: 2495.7

ps_hybrid_analysis_ileave_c: 20478.0
ps_hybrid_analysis_ileave_r: 16092.2

ps_hybrid_synthesis_deint_c: 19051.5
ps_hybrid_synthesis_deint_r: 15420.0

ps_mul_pair_single_c: 122941.2
ps_mul_pair_single_r: 91035.0
2023-07-17 18:48:42 +03:00
Andreas Rheinhardt 9c471c76cb avcodec/msrleenc: Constify pointers for frame->data
Encoders (usually) have no business modifying frame->data
(which need not be writable), so they should use the appropriate
pointers.

Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-17 16:23:26 +02:00
Andreas Rheinhardt 3cb0bd06a8 avcodec/msrleenc: Check frame allocations/references
Also allocate the AVFrame during init and use av_frame_replace()
to replace it later.

Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-17 16:23:18 +02:00
Andreas Rheinhardt 66449f8c6b avcodec/msrleenc: Remove useless private class
A private class for an encoder without options is useless.

Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-17 16:23:12 +02:00
Andreas Rheinhardt 3c642af8e0 avcodec/msrleenc: Check allocation
Fixes Coverity issue #1538297.

Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-17 16:23:07 +02:00
Andreas Rheinhardt a054ceb4e2 avcodec/msrleenc: Replace stray \r by \n
Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-17 16:18:18 +02:00
Andreas Rheinhardt 463a472426 fftools/ffmpeg_enc: Reindentate after the last commit
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-17 16:18:12 +02:00
Andreas Rheinhardt bfe15b81b3 fftools/ffmpeg_enc: Remove always-true checks
frame is always != NULL for audio and video here
(this is checked by an assert and the frame is already dereferenced
before it reaches this code here).
Fixes Coverity issue #1538858.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-17 16:14:41 +02:00
James Almer 31979127f8 avcodec/decode: factor out filling frame props
Signed-off-by: James Almer <jamrial@gmail.com>
2023-07-17 08:43:33 -03:00
Rémi Denis-Courmont c541ecf0dc lavc/alacdsp: unroll RISC-V V loops
This increases the group multiplier as per T-Head C910 benchmarks:

alac_append_extra_bits_mono_c: 803.0
alac_append_extra_bits_stereo_c: 1604.2
alac_decorrelate_stereo_c: 1077.5

LMUL=1
alac_append_extra_bits_mono_rvv_i32: 418.2
alac_append_extra_bits_stereo_rvv_i32: 693.2
alac_decorrelate_stereo_rvv_i32: 673.5

LMUL=2
alac_append_extra_bits_mono_rvv_i32: 382.2
alac_append_extra_bits_stereo_rvv_i32: 648.2
alac_decorrelate_stereo_rvv_i32: 542.7

LMUL=4
alac_append_extra_bits_mono_rvv_i32: 241.5
alac_append_extra_bits_stereo_rvv_i32: 512.7
alac_decorrelate_stereo_rvv_i32: 364.2

LMUL=8
alac_append_extra_bits_mono_rvv_i32: 239.7
alac_append_extra_bits_stereo_rvv_i32: 497.2
alac_decorrelate_stereo_rvv_i32: 426.7
2023-07-16 23:24:00 +03:00
Rémi Denis-Courmont a28aa0475d lavc/vorbisdsp: unroll RISC-V V inverse_coupling
This increases the group multiplier as per T-Head C910 benchmarks:

inverse_coupling_c: 4597.0
inverse_coupling_rvv_i32: 1312.7 (m1)
inverse_coupling_rvv_i32: 1116.7 (m2)
inverse_coupling_rvv_i32: 732.2  (m4)
inverse_coupling_rvv_i32: 898.0  (m8)
2023-07-16 23:24:00 +03:00
Andreas Rheinhardt b6305a7873 avcodec/evc_ps: Fix size of tile_(row|column) arrays
Prevents out-of-bound writes when parsing tile row heights.
Fixes Coverity issue #1538300.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-16 17:06:50 +02:00
Marton Balint 36f4e6f8f4 avformat/hlsenc: use av_random_bytes() for generating AES128 key
av_random_bytes() can use OS provided strong random functions and does not
depend soley on openssl/gcrypt external libraries.

Fixes ticket #10441.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-07-16 11:48:31 +02:00
Marton Balint 9a7f060c32 avutil/random_seed: turn off buffering when reading from random
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-07-16 11:48:31 +02:00
Anton Khirnov 153cf85b24 fftools/ffmpeg_mux_init: fix an array declaration
map_func is supposed to be an array of const pointer to function
returning int, not an array of pointer to function returning const int.

Reported-By: Martin Storsjö
2023-07-16 11:10:00 +02:00
Pavel Koshevoy 35342dc390 lavc/audiotoolbox: fix build failure on osx 10.5 (v3)
Reviewed-by: Marvin Scholz <epirat07@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-07-15 19:57:47 -03:00
James Almer e047d9c62b avcodec/mpegvideo_dec: properly set output frames as keyframes
Should fix ticket #10426.

Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-07-15 19:47:40 -03:00
Paul B Mahol c183f840fa avfilter/af_axcorrelate: add another algorithm for calculation
Rewrite EOF logic while here.
2023-07-15 23:41:09 +02:00
Rémi Denis-Courmont f032234953 aarch64: remove VFP feature check
This is not actually used for anything. The configure check causes the
CPU feature flag to be set, but nothing consumes it at all.

While AArch64 does have VFP, it is only used for the scalar C code.
Conversely, it is still possible to disable VFP, by changing the
C compiler flags as before (though that only makes sense for an
hypothetical non-standard Armv8 platform without VFP).

Note that this retains the "vfp" option flag, for backward
compatibility and on the very remote but theoretically possible chance
that FFmpeg actually makes use of it in the future.

AV_CPU_FLAG_VFP is retained as it is actually used by AArch32.
2023-07-15 22:56:30 +03:00
Rémi Denis-Courmont 82cb4b1c05 lavc/aarch64: remove bogus HAVE_VFP guard
The IMDCT offset is only relevant for NEON optimisations. There are no
VFP optimisations here that would justify the HAVE_VFP flag. In
practice, this makes no difference because HAVE_NEON is practically
always true for standard Armv8 platforms.
2023-07-15 22:56:30 +03:00
Timo Rothenpieler 3c73200be2 avfilter/vsrc_ddagrab: calculate pointer position on rotated screens 2023-07-15 18:48:49 +02:00
Timo Rothenpieler da94c6a00c avfilter/vsrc_ddagrab: account for mouse-only frames during probing 2023-07-15 17:06:58 +02:00
Niklas Haas 138d3ac15d lavfi/vf_libplacebo: test for renderable pixel formats
Requires a new upstream function to test not for *import* support on a
given output pixel format, but also whether we can render to it.

Fixes: https://github.com/haasn/libplacebo/issues/173
2023-07-15 13:37:54 +02:00
Anton Khirnov 891167dee5 lavc/gifdec: unify get_buffer() calls I/P frames
Always call ff_reget_buffer(), which ensures that get_buffer2() is
called with AV_GET_BUFFER_FLAG_REF.

Fixes #10460.
2023-07-15 11:35:59 +02:00
Anton Khirnov acde0ae6c7 doc/ffmpeg: fix -enc_time_base documentation
Stop claiming the argument is always a floating point number, which
* confuses floating point and decimal numbers
* is not always true even accounting for the above point
2023-07-15 11:02:11 +02:00
Anton Khirnov dff3a283cd fftools/ffmpeg: rework -enc_time_base handling
Read the timebase from FrameData rather than the input stream. This
should fix #10393 and generally be more reliable.

Replace the use of '-1' to indicate demuxing timebase with the string
'demux'. Also allow to request filter timebase with
'-enc_time_base filter'.
2023-07-15 11:02:11 +02:00
Anton Khirnov 4d06742b93 fftools/ffmpeg: add more structure to FrameData
It now contains data from multiple sources, so group those items that
always come from the decoder. Also, initialize them to invalid values,
so that frames that did not originate from a decoder can be
distinguished.
2023-07-15 11:02:11 +02:00
Anton Khirnov 75d0af388f fftools/ffmpeg_filter: make OutputFilter.filter private
It should not be accessed from outside of filtering code.
2023-07-15 11:02:11 +02:00
Anton Khirnov 9a97f9cf3a fftools/ffmpeg_enc: initialize audio/video encoders from frame parameters
This is possible now that enc_open() is always called with a non-NULL
frame for audio/video.

Previously the code would directly reach into the buffersink, which is a
layering violation.
2023-07-15 11:02:11 +02:00
Anton Khirnov b295ec31f3 fftools/ffmpeg_filter: only flush vsync code if encoding actually started
Otherwise this has no effect.

Will be useful in following commits.
2023-07-15 11:02:11 +02:00
Anton Khirnov 0a6751a78a fftools/ffmpeg: rework initializing encoders with no frames
When no frames were passed from a filtergraph to an encoder, but the
filtergraph is configured (i.e. has output parameters), encoder flush
code will use those parameters to initialize the encoder in a last-ditch
effort to produce some useful output.

Rework this process so that it is triggered by the filtergraph, which
now sends a dummy frame with parameters, but no data, to the encoder,
rather than the encoder reaching backwards into the filter.

This approach is more in line with the natural data flow from filters to
encoders and will allow to reduce encoder-filter interactions in
following commits.

This code is tested by fate-adpcm-ima-cunning-trunc-t2-track1, which (as
confirmed by Zane) is supposed to produce empty output.
2023-07-15 11:02:11 +02:00
Anton Khirnov 20c42213ea fftools/ffmpeg_mux_init: drop an obsolete assignment
This line was added in c30a4489b4 along with
AVStream.sample_aspect_ratio. However, configuring SAR for video
encoding is now done after this code (specifically in enc_open(), which
is called when the first video frame to be encoded is obtained), so this
line cannot have any meaningful effect.
2023-07-15 11:02:11 +02:00
Anton Khirnov c328bff4da fftools/ffmpeg_enc: return errors from enc_subtitle() instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov 2e742a2c3c fftools/ffmpeg_mux: return errors from of_streamcopy() instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov 464a5e8e76 fftools/ffmpeg: handle error codes from process_input_packet()
None are returned for now, but that will change in future commits.
2023-07-15 11:02:11 +02:00
Anton Khirnov 5fe3914c39 fftools/ffmpeg: return an error instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov 858b635613 fftools/ffmpeg_mux_init: replace all remaining aborts with returning error codes
Mainly concerns new_stream_*() and their callees.
2023-07-15 11:02:11 +02:00
Anton Khirnov 45473258ff fftools/ffmpeg_mux_init: return error codes from metadata processing instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov dd44871eb9 fftools/ffmpeg_mux_init: improve of_add_programs()
Replace duplicated(!) and broken* custom string parsing with
av_dict_parse_string(). Return error codes instead of aborting.

* e.g. it treats NULL returned from av_get_token() as "separator not
  found", when in fact av_get_token() only returns NULL on memory
  allocation failure
2023-07-15 11:02:11 +02:00
Anton Khirnov fd40197170 fftools/ffmpeg_mux_init: return error codes from validate_enc_avopt() instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov 4e3557aadb fftools/ffmpeg_mux_init: return error codes from parse_forced_key_frames() instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov 6691d131d8 fftools/ffmpeg_mux_init: return error codes from copy_meta() instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov 54cbe6f57d fftools/ffmpeg_mux_init: return error codes from ost_add() instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov 38a2fc2c29 fftools/ffmpeg_mux_init: move allocation out of prologue
ost_add() has a very large variable declaration prologue, performing
"active" actions that can fail in there is confusing.
2023-07-15 11:02:11 +02:00
Anton Khirnov 4e366100e9 fftools/ffmpeg_mux_init: return error codes from map_*() instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov eee09cdf39 fftools/ffmpeg_mux_init: improve error handling in of_add_attachments()
* return error codes instead of aborting
* avoid leaking the AVIOContext on failure
* check the return code of avio_read()
2023-07-15 11:02:11 +02:00
Anton Khirnov b3eedca5e5 fftools/ffmpeg_mux_init: return errors from create_streams() instead of aborting 2023-07-15 11:02:11 +02:00
Anton Khirnov c23cff5a8a fftools/ffmpeg_demux: return errors from ist_add() instead of aborting 2023-07-15 11:02:11 +02:00