Commit Graph

101352 Commits

Author SHA1 Message Date
Andreas Rheinhardt 590f491b0a avcodec/roqvideoenc: Avoid allocating buffers separately
This is possible because their size is known at compile-time; so they
can be put directly into the context and don't need to be allocated for
every frame.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-01 06:07:48 +01:00
Andreas Rheinhardt ed89ebb12e avcodec/roqvideoenc: Avoid intermediate buffer
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-01 06:07:35 +01:00
Andreas Rheinhardt 9b776cd542 avcodec/roqvideoenc: Reuse buffers instead of alloc+free for each frame
In case of the cel evaluators it even allows to perform the
initialization of the source coordinates only once instead of for each
frame.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-01 06:07:28 +01:00
Andreas Rheinhardt 1a4a5fb640 avcodec/roqvideo: Use dedicated context for encoder
Up until now, the RoQ video decoder and encoder used the same context;
and said context contained several fields that are only used by the
encoder. This commit changes this and uses a dedicated context for the
encoder; it contains the common context as first element in order to use
functions common to the de- and encoder.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-01 06:04:46 +01:00
Paul B Mahol 4cb989e836 avcodec/exr: add fast path for case when powf() isn't needed 2021-02-28 23:19:01 +01:00
Michael Niedermayer f01d522cf3 avcodec/dxtory: Fix undefined shift with negative linesize
Fixes: left shift of negative value -128
Fixes: 30746/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXTORY_fuzzer-5906271469436928

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>
2021-02-28 20:11:03 +01:00
Andreas Rheinhardt 3072438429 doc/codecs.texi: Remove removed or ineffective options
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:55:39 +01:00
Andreas Rheinhardt f9b5cef1d3 avcodec/libx264: Don't use init_static_data for newer versions
x264 versions >= 153 can support multiple bitdepths; they also don't
export x264_bit_depth any more. The actual check whether a bitdepth
is supported is therefore performed at runtime in x264_encoder_open.
Ergo it is unnecessary to use init_static_data for these versions:
One can already set ff_libx264_encoder.pix_fmts to the value that
X264_init_static always sets it to.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:52:12 +01:00
Andreas Rheinhardt 546e3964dd avformat/webmdashenc: Use av_strstart instead of strncmp
It makes the intent clearer and avoids calculating the length
separately.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:14:22 +01:00
Andreas Rheinhardt 0f906be430 avformat/matroskadec: Use av_strstart instead of strncmp
It makes the intent clearer and avoids calculating the length
separately.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:14:22 +01:00
Andreas Rheinhardt ea5bf12a9a avformat/avio: Use av_strstart instead of strncmp
It makes the intent clearer and avoids calculating the length
in advance.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:14:21 +01:00
Andreas Rheinhardt bd85c63d1d fftools/cmdutils: Use av_strstart instead of strncmp
It makes the intent clearer and avoids searching for a delimiter
in advance.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:14:21 +01:00
Andreas Rheinhardt 514ee8770d avutil/spherical: Use av_strstart instead of strncmp
It makes the intent clearer and avoids calculating the length
separately.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:14:21 +01:00
Andreas Rheinhardt 13e98f1daf avutil/stereo3d: Use av_strstart instead of strncmp
It makes the intent clearer and avoids calculating the length
separately.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:14:21 +01:00
Andreas Rheinhardt 114603d0b9 avutil/pixdesc: Use av_strstart where appropriate
It makes the intent clearer and allows to avoid calculating the strlen
separately.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:14:21 +01:00
Andreas Rheinhardt 3d79ce0c29 avformat/pcmdec: Beautify pcm_read_header
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:14:21 +01:00
Andreas Rheinhardt 5f8e015225 avformat/pcmdec: Simplify parsing MIME type
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:14:21 +01:00
Andreas Rheinhardt b9b0c96db7 avformat/pcmdec: Fix NULL + 1
It is undefined behaviour.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:14:21 +01:00
Andreas Rheinhardt 301ae25e99 avformat/pcm(dec|enc): Don't include disabled (de)muxers
Also make the macro used for the demuxers spec-compliant. The earlier
macro was not, because the ... argument of a variadic macro must not be
left out. GCC and Clang warn about this when using -pedantic.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:14:21 +01:00
Andreas Rheinhardt 90723d1721 avformat/movenc: Only check for timecodes if they are used
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:14:21 +01:00
Andreas Rheinhardt cb5a223a7e fftools/ffmpeg, ffplay: Don't set refcounted_frames
It only affects the old and deprecated avcodec_decode_(video2|audio4)
API which is no longer used here.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:14:21 +01:00
Andreas Rheinhardt 13101f916f avformat/movenc: Don't check for disabled muxers
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:14:21 +01:00
Andreas Rheinhardt f87b33b5bf avformat/movenc: Remove always true check
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:14:21 +01:00
Paul B Mahol 85ab9deb98 avcodec/exr: handle case when |im - IM| == 1 for huff compression 2021-02-28 02:06:02 +01:00
Vadym Bezdushnyi bc04ea39a5 avformat/movenccenc: Fix memory leak for muxing CENC-encrypted files
Memory for auxillary_info was not freed after usage.

Leak can be reproduced with following commands:

Optionally, generate input video:
ffmpeg -f lavfi -i testsrc=duration=10:size=1280x720:rate=30 input.mp4

Run ffmpeg with valgrind:
valgrind --leak-check=full --show-leak-kinds=all \
ffmpeg -y -i input.mp4 -vcodec copy -acodec copy \
-encryption_scheme cenc-aes-ctr \
-encryption_key 00000000000000000000000000000000 \
-encryption_kid 00000000000000000000000000000000 \
ffmpeg_encrypted.mp4

For test video which has duration of 10 sec, leak is 4 Kb.
For 100 sec video, leak will be 33 Kb. Most likely,
leaked memory will grow linearly to the number of input frames.

Signed-off-by: Vadym Bezdushnyi <vadim.bezdush@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-02-27 22:09:51 +01:00
Marton Balint 2d32aed85c avdevice: use av_gettime_relative() for elapsed time calculations
av_gettime_relative() is using the monotonic clock therefore more suitable for
elapsed time calculations. Packet timestamps are still kept absolute, although
that should be configurable in the future.

Related to ticket #9089.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-02-27 21:41:50 +01:00
Marton Balint 529bf5daf2 avdevice/timefilter: remove obsolete comments from the docs
Also rename the parameters of the function to match with the implementation.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-02-27 21:30:41 +01:00
Marton Balint 84094f017e avfilter/avf_showcqt: use av_gettime_relative() instead of av_gettime()
av_gettime_relative() is using the monotonic clock therefore more suitable for
relative time calculations.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-02-27 21:30:41 +01:00
Paul B Mahol b69c91bbee avcodec/x86: add cfhdenc SIMD 2021-02-27 17:09:44 +01:00
James Almer dd9227e48f avcodec/options: deprecate avcodec_get_frame_class()
AVFrame hasn't been a struct defined in libavcodec for a decade now, when
it was moved to libavutil.

Found-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-02-27 11:23:42 -03:00
James Almer 0c902a6147 avcodec/avrndec: remove max_lowres value
The decoder does not support lowres since 9e4225cf7f.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-02-27 11:21:40 -03:00
Andreas Rheinhardt 173d902cd1 avformat/matroskadec: Add webm file extension
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-27 08:17:42 +01:00
Lynne e20a39a375
lavu/tx: do not invert permutes on MDCTs 2021-02-27 05:01:17 +01:00
Andreas Rheinhardt 963d4b76de avformat/concat: Remove unnecessary check
This code was written when the allocation functions used parameters of
type unsigned. This is no longer true today and therefore we only need
to check whether the multiplication of the array's size stays within
a size_t -- and this can be offloaded to av_realloc_array.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-27 04:27:09 +01:00
Andreas Rheinhardt e38cbb8d19 avformat/spdifenc: Fix leak upon error
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-27 04:27:09 +01:00
Andreas Rheinhardt 19ae873252 avformat/wavenc: Fix leak and segfault on reallocation error
Up until now, the wav muxer used a reallocation of the form ptr =
av_realloc(ptr, size); that leaks upon error. Furthermore, if a
failed reallocation happened when writing the trailer, a segfault
would occur due to avio_write(NULL, size) because the muxer only
prints an error message upon allocation error, but does not return
the error.

Moreover setting the pointer to the buffer to NULL on error seems to
be done on purpose in order to record that an error has occured so that
outputting the peak values is no longer attempted. This behaviour has
been retained by simply disabling whether peak data should be written
if an error occurs.

Finally, the reallocation is now done once per peak block and not once
per peak block per channel; it is also done with av_fast_realloc and not
with a linear size increase.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-27 04:27:09 +01:00
Lynne 8e94b7cff0
lavu/tx: invert permutation lookups
out[lut[i]] = in[i] lookups were 4.04 times(!) slower than
out[i] = in[lut[i]] lookups for an out-of-place FFT of length 4096.

The permutes remain unchanged for anything but out-of-place monolithic
FFT, as those benefit quite a lot from the current order (it means
there's only 1 lookup necessary to add to an offset, rather than
a full gather).

The code was based around non-power-of-two FFTs, so this wasn't
benchmarked early on.
2021-02-27 04:21:05 +01:00
Lynne 9ddaf0c9f0
lavu/tx: simplify in-place permute search function 2021-02-27 04:21:03 +01:00
Paul B Mahol f9cb557d66 avcodec/exrenc: add half-float support 2021-02-27 00:44:45 +01:00
James Almer f1a894f9d3 avcodec: add missing FF_API_OLD_ENCDEC wrappers to xmm clobber functions
Signed-off-by: James Almer <jamrial@gmail.com>
2021-02-26 19:26:31 -03:00
Andreas Rheinhardt 169259d9a3 avcodec: Add missing FF_API define for libavcodec pix fmt API
avcodec_find_best_pix_fmt2 has been deprecated and replaced by
avcodec_find_best_pix_fmt_of_2 in 2a54ae9df8.
avcodec_find_best_pix_fmt_of_2 and avcodec_get_pix_fmt_loss meanwhile
were deprecated in 617e866e25 when these
functions were de facto moved to libavutil; this has been mentioned in
APIchanges in f7a1c5e4d2. Yet the
attribute_deprecated was never set for the latter two functions and they
were not wrapped in an FF_API define. This commit does this.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-26 18:29:45 +01:00
Andreas Rheinhardt 5ad0eb936c fftools/ffmpeg_filter: Don't use deprecated function
avcodec_find_best_pix_fmt_of_2 has been moved to libavutil in
617e866e25.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-26 18:28:26 +01:00
Lynne 10341743d2
lavu/tx: require output argument to match input for inplace transforms
This simplifies some assembly code by a lot, by either saving a branch
or saving an entire duplicated function.
2021-02-26 05:42:24 +01:00
Paul B Mahol e937457b7b avformat/imx: set video stream duration 2021-02-25 23:10:14 +01:00
Paul B Mahol 34c805c0fe avcodec/imx: use ff_reget_buffer()
Also flush internal stuff upon seeking.
This codec is not intra only.
2021-02-25 23:10:14 +01:00
Andreas Rheinhardt ab8d2d97a1 avformat/avlanguage: Remove long disabled av_convert_lang_to
1582e306a4 scheduled it for removal with
libavformat major version 58, but it was never removed.

Reviewed-by: Paul B Mahol <onemda@gmail.com
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-25 22:05:09 +01:00
Andreas Rheinhardt 2869d71493 avfilter/lavfutils.h: Don't include avformat.h
Only lavfutils.c needs avformat.h, not lavfutils.h.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-25 22:03:32 +01:00
Andreas Rheinhardt e4524270f4 avcodec/avcodec: Add missing deprecation to AVCodecParser.next
The whole old next API has been deprecated in commit
7e8eba2d87, yet deprecating the next
pointer has been forgotten (the next pointers of other structures are
below the public API delimiter, but such a delimiter doesn't exist for
AVCodecParser).

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-25 21:51:11 +01:00
James Almer e96ea80e85 avcodec: unschedule removing some functions with FF_API_COPY_CONTEXT
These functions were never deprecated. The merge from commit 6988cf2969
included them by mistake.

Found-by: mkver
Signed-off-by: James Almer <jamrial@gmail.com>
2021-02-25 17:35:13 -03:00
James Almer 7addddd49e Revert "avcodec/options: add missing FF_API_COPY_CONTEXT checks"
This reverts commit 0191f2d29c.

These functions were never deprecated. The merge from commit 6988cf2969
included them by mistake.

Found-by: mkver
Signed-off-by: James Almer <jamrial@gmail.com>
2021-02-25 17:34:44 -03:00