Commit Graph

101338 Commits

Author SHA1 Message Date
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
Derek Buitenhuis 113a99270d doc/encoders: Add documentation for the GIF encoder
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2021-02-25 16:41:24 +00:00
Derek Buitenhuis 5a343853c0 avcodec/gifenc: Only write frame palette entries that actually used
GIF palette entries are not compressed, and writing 256 entries,
which can be up to every frame, uses a significant amount of
space, especially in extreme cases, where palettes can be very
small.

Example, first six seconds of Tears of Steel, palette generated
with libimagequant, 320x240 resolution, and with transparency
optimization + per frame palette:

    * Before patch: 186765 bytes
    * After patch: 77895 bytes

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2021-02-25 16:41:24 +00:00
Derek Buitenhuis 5f2804aba7 avcodec/gifenc: Add global_palette option
This option will disable the writing of the global palette in global
GIF header if it is set to 0, causing only the frame-level palette
to ever be written.

This will be useful later on when further frame-level palette
optimizations are introduced.

The default is 1, which maintains current default behavior.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2021-02-25 16:41:24 +00:00
Andreas Rheinhardt 6eab25fd13 avformat/wavenc: Improve unsupported codec error messages
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-25 16:52:50 +01:00
Paul B Mahol 95af3b6625 avfilter/vf_vif: add support for more formats 2021-02-25 16:38:27 +01:00
Paul B Mahol 550b7a9929 avfilter/vf_vif: simplify case comparing same inputs 2021-02-25 16:38:27 +01:00
Anton Khirnov a5b737e625 tests/api-band-test: simplify code 2021-02-25 11:46:28 +01:00
Anton Khirnov 9e4225cf7f Handle AVID MJPEG streams directly in the MJPEG decoder.
AVID streams - currently handled by the AVRN decoder - can be (depending
on extradata contents) either MJPEG or raw video. To decode the MJPEG
variant, the AVRN decoder currently instantiates a MJPEG decoder
internally and forwards decoded frames to the caller (possibly after
cropping them).

This is suboptimal, because the AVRN decoder does not forward all the
features of the internal MJPEG decoder, such as direct rendering.
Handling such forwarding in a full and generic manner would be quite
hard, so it is simpler to just handle those streams in the MJPEG decoder
directly.

The AVRN decoder, which now handles only the raw streams, can now be
marked as supporting direct rendering.

This also removes the last remaining internal use of the obsolete
decoding API.
2021-02-25 11:46:28 +01:00
Guo, Yejun ae4f6379d6 avfilter/vf_vif.c: fix build warning for [-Wmain]
src/libavfilter/vf_vif.c: In function ‘process_frame’:
src/libavfilter/vf_vif.c:542:20: warning: ‘main’ is usually a function [-Wmain]
     AVFrame *out, *main = NULL, *ref = NULL;
                    ^~~~

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2021-02-25 11:43:56 +01:00
Guo, Yejun ac6dd87cd1 avfilter/vf_ssim.c: fix build warning for [-Wmain]
The build warning message:
src/libavfilter/vf_ssim.c: In function ‘ssim_plane_16bit’:
src/libavfilter/vf_ssim.c:246:24: warning: ‘main’ is usually a function [-Wmain]
         const uint8_t *main = td->main_data[c];
                        ^~~~
src/libavfilter/vf_ssim.c: In function ‘ssim_plane’:
src/libavfilter/vf_ssim.c:289:24: warning: ‘main’ is usually a function [-Wmain]
         const uint8_t *main = td->main_data[c];
                        ^~~~

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2021-02-25 11:43:56 +01:00
Anton Khirnov d3d99a0a06 lavc/lscrdec: use ff_reget_buffer()
It is simpler and more efficient.

Suggested-by: James Almer <jamrial@gmail.com>
2021-02-24 17:16:46 +01:00
Anton Khirnov eed2125f3f tests/fate/apng: add a test for APNG_DISPOSE_OP_PREVIOUS 2021-02-24 17:16:46 +01:00
Anton Khirnov 5663301560 pngdec: fix and simplify apng reference handling
Current code is very confused and confusing. It uses two different
reference frames - "previous" and "last" - when only one is really
necessary. It also confuses the two, leading to incorrect output with
APNG_DISPOSE_OP_PREVIOUS mode.

Fixes #9017.
2021-02-24 17:16:46 +01:00
Anton Khirnov 087359ad85 lavc/lscrdec: drop unapplicable private capabilities
FF_CODEC_CAP_ALLOCATE_PROGRESS makes no sense because the decoder does
not support frame threading.
FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM makes no sense because the decoder
does not handle skip_frame.
2021-02-24 17:16:46 +01:00