ffmpeg.git
2 months agoavcodec/exr: handle case when |im - IM| == 1 for huff compression
Paul B Mahol [Sun, 28 Feb 2021 01:03:11 +0000 (02:03 +0100)]
avcodec/exr: handle case when |im - IM| == 1 for huff compression

2 months agoavformat/movenccenc: Fix memory leak for muxing CENC-encrypted files
Vadym Bezdushnyi [Sun, 31 Jan 2021 14:52:45 +0000 (16:52 +0200)]
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>
2 months agoavdevice: use av_gettime_relative() for elapsed time calculations
Marton Balint [Sat, 6 Feb 2021 23:55:25 +0000 (00:55 +0100)]
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>
2 months agoavdevice/timefilter: remove obsolete comments from the docs
Marton Balint [Sat, 6 Feb 2021 10:16:57 +0000 (11:16 +0100)]
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>
2 months agoavfilter/avf_showcqt: use av_gettime_relative() instead of av_gettime()
Marton Balint [Sat, 6 Feb 2021 09:17:30 +0000 (10:17 +0100)]
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>
2 months agoavcodec/x86: add cfhdenc SIMD
Paul B Mahol [Tue, 9 Feb 2021 18:46:59 +0000 (19:46 +0100)]
avcodec/x86: add cfhdenc SIMD

2 months agoavcodec/options: deprecate avcodec_get_frame_class()
James Almer [Thu, 25 Feb 2021 20:30:28 +0000 (17:30 -0300)]
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>
2 months agoavcodec/avrndec: remove max_lowres value
James Almer [Sat, 27 Feb 2021 03:12:18 +0000 (00:12 -0300)]
avcodec/avrndec: remove max_lowres value

The decoder does not support lowres since 9e4225cf7f.

Signed-off-by: James Almer <jamrial@gmail.com>
2 months agoavformat/matroskadec: Add webm file extension
Andreas Rheinhardt [Sat, 28 Dec 2019 03:05:44 +0000 (04:05 +0100)]
avformat/matroskadec: Add webm file extension

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agolavu/tx: do not invert permutes on MDCTs
Lynne [Sat, 27 Feb 2021 03:59:21 +0000 (04:59 +0100)]
lavu/tx: do not invert permutes on MDCTs

2 months agoavformat/concat: Remove unnecessary check
Andreas Rheinhardt [Mon, 22 Feb 2021 08:54:23 +0000 (09:54 +0100)]
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>
2 months agoavformat/spdifenc: Fix leak upon error
Andreas Rheinhardt [Mon, 22 Feb 2021 08:10:40 +0000 (09:10 +0100)]
avformat/spdifenc: Fix leak upon error

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/wavenc: Fix leak and segfault on reallocation error
Andreas Rheinhardt [Mon, 22 Feb 2021 07:31:50 +0000 (08:31 +0100)]
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>
2 months agolavu/tx: invert permutation lookups
Lynne [Sat, 27 Feb 2021 03:11:04 +0000 (04:11 +0100)]
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.

2 months agolavu/tx: simplify in-place permute search function
Lynne [Sat, 27 Feb 2021 03:19:55 +0000 (04:19 +0100)]
lavu/tx: simplify in-place permute search function

2 months agoavcodec/exrenc: add half-float support
Paul B Mahol [Fri, 26 Feb 2021 23:28:54 +0000 (00:28 +0100)]
avcodec/exrenc: add half-float support

2 months agoavcodec: add missing FF_API_OLD_ENCDEC wrappers to xmm clobber functions
James Almer [Fri, 26 Feb 2021 22:22:42 +0000 (19:22 -0300)]
avcodec: add missing FF_API_OLD_ENCDEC wrappers to xmm clobber functions

Signed-off-by: James Almer <jamrial@gmail.com>
2 months agoavcodec: Add missing FF_API define for libavcodec pix fmt API
Andreas Rheinhardt [Fri, 26 Feb 2021 06:38:33 +0000 (07:38 +0100)]
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 2a54ae9df8cbc1717b3929222ac75f384e2ff240.
avcodec_find_best_pix_fmt_of_2 and avcodec_get_pix_fmt_loss meanwhile
were deprecated in 617e866e25b72fa5d9f9d6bbcbd7e4bd69e63a54 when these
functions were de facto moved to libavutil; this has been mentioned in
APIchanges in f7a1c5e4d2294a8970ede7f6deb2fe0a64e202a5. 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>
2 months agofftools/ffmpeg_filter: Don't use deprecated function
Andreas Rheinhardt [Fri, 26 Feb 2021 07:38:26 +0000 (08:38 +0100)]
fftools/ffmpeg_filter: Don't use deprecated function

avcodec_find_best_pix_fmt_of_2 has been moved to libavutil in
617e866e25b72fa5d9f9d6bbcbd7e4bd69e63a54.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agolavu/tx: require output argument to match input for inplace transforms
Lynne [Fri, 26 Feb 2021 04:40:07 +0000 (05:40 +0100)]
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.

2 months agoavformat/imx: set video stream duration
Paul B Mahol [Thu, 25 Feb 2021 22:04:55 +0000 (23:04 +0100)]
avformat/imx: set video stream duration

2 months agoavcodec/imx: use ff_reget_buffer()
Paul B Mahol [Thu, 25 Feb 2021 20:42:02 +0000 (21:42 +0100)]
avcodec/imx: use ff_reget_buffer()

Also flush internal stuff upon seeking.
This codec is not intra only.

2 months agoavformat/avlanguage: Remove long disabled av_convert_lang_to
Andreas Rheinhardt [Thu, 25 Feb 2021 17:27:50 +0000 (18:27 +0100)]
avformat/avlanguage: Remove long disabled av_convert_lang_to

1582e306a47977b09fddb029b999f99eb03cd485 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>
2 months agoavfilter/lavfutils.h: Don't include avformat.h
Andreas Rheinhardt [Thu, 25 Feb 2021 15:30:01 +0000 (16:30 +0100)]
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>
2 months agoavcodec/avcodec: Add missing deprecation to AVCodecParser.next
Andreas Rheinhardt [Thu, 25 Feb 2021 00:45:11 +0000 (01:45 +0100)]
avcodec/avcodec: Add missing deprecation to AVCodecParser.next

The whole old next API has been deprecated in commit
7e8eba2d8755962d9dca5eade57bf8f591a73c0c, 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>
2 months agoavcodec: unschedule removing some functions with FF_API_COPY_CONTEXT
James Almer [Thu, 25 Feb 2021 20:17:33 +0000 (17:17 -0300)]
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>
2 months agoRevert "avcodec/options: add missing FF_API_COPY_CONTEXT checks"
James Almer [Thu, 25 Feb 2021 20:15:21 +0000 (17:15 -0300)]
Revert "avcodec/options: add missing FF_API_COPY_CONTEXT checks"

This reverts commit 0191f2d29c2a62b8699ac75f09708187e943814c.

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>
2 months agodoc/encoders: Add documentation for the GIF encoder
Derek Buitenhuis [Sun, 21 Feb 2021 13:11:37 +0000 (13:11 +0000)]
doc/encoders: Add documentation for the GIF encoder

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2 months agoavcodec/gifenc: Only write frame palette entries that actually used
Derek Buitenhuis [Thu, 4 Feb 2021 16:44:44 +0000 (16:44 +0000)]
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>
2 months agoavcodec/gifenc: Add global_palette option
Derek Buitenhuis [Sat, 20 Feb 2021 17:22:51 +0000 (17:22 +0000)]
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>
2 months agoavformat/wavenc: Improve unsupported codec error messages
Andreas Rheinhardt [Thu, 25 Feb 2021 06:37:54 +0000 (07:37 +0100)]
avformat/wavenc: Improve unsupported codec error messages

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavfilter/vf_vif: add support for more formats
Paul B Mahol [Thu, 25 Feb 2021 15:36:08 +0000 (16:36 +0100)]
avfilter/vf_vif: add support for more formats

2 months agoavfilter/vf_vif: simplify case comparing same inputs
Paul B Mahol [Thu, 25 Feb 2021 14:52:33 +0000 (15:52 +0100)]
avfilter/vf_vif: simplify case comparing same inputs

2 months agotests/api-band-test: simplify code
Anton Khirnov [Wed, 27 Jan 2021 10:08:29 +0000 (11:08 +0100)]
tests/api-band-test: simplify code

2 months agoHandle AVID MJPEG streams directly in the MJPEG decoder.
Anton Khirnov [Sat, 12 Dec 2020 14:09:10 +0000 (15:09 +0100)]
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.

2 months agoavfilter/vf_vif.c: fix build warning for [-Wmain]
Guo, Yejun [Thu, 25 Feb 2021 06:38:12 +0000 (14:38 +0800)]
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>
2 months agoavfilter/vf_ssim.c: fix build warning for [-Wmain]
Guo, Yejun [Thu, 25 Feb 2021 06:38:11 +0000 (14:38 +0800)]
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>
2 months agolavc/lscrdec: use ff_reget_buffer()
Anton Khirnov [Wed, 24 Feb 2021 08:38:22 +0000 (09:38 +0100)]
lavc/lscrdec: use ff_reget_buffer()

It is simpler and more efficient.

Suggested-by: James Almer <jamrial@gmail.com>
2 months agotests/fate/apng: add a test for APNG_DISPOSE_OP_PREVIOUS
Anton Khirnov [Tue, 16 Feb 2021 20:19:38 +0000 (21:19 +0100)]
tests/fate/apng: add a test for APNG_DISPOSE_OP_PREVIOUS

2 months agopngdec: fix and simplify apng reference handling
Anton Khirnov [Sun, 14 Feb 2021 15:37:33 +0000 (16:37 +0100)]
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.

2 months agolavc/lscrdec: drop unapplicable private capabilities
Anton Khirnov [Sun, 14 Feb 2021 15:12:39 +0000 (16:12 +0100)]
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.

2 months agolavc: split LSCR decoder out of PNG decoder
Anton Khirnov [Sun, 14 Feb 2021 14:50:10 +0000 (15:50 +0100)]
lavc: split LSCR decoder out of PNG decoder

It shares very little code with pngdec, so keeping them together only
makes the code harder to read.

2 months agotests: add a test for LSCR
Anton Khirnov [Sun, 14 Feb 2021 14:55:57 +0000 (15:55 +0100)]
tests: add a test for LSCR

2 months agoavcodec/cfhdenc: do not try to encode junk
Paul B Mahol [Thu, 18 Feb 2021 22:42:01 +0000 (23:42 +0100)]
avcodec/cfhdenc: do not try to encode junk

2 months agoavcodec/cfhdenc: add padding to each decomposition
Paul B Mahol [Sat, 13 Feb 2021 20:49:14 +0000 (21:49 +0100)]
avcodec/cfhdenc: add padding to each decomposition

2 months agoavcodec/cfhdenc: refactor DSP code for CFHD encoder
Paul B Mahol [Tue, 9 Feb 2021 18:17:27 +0000 (19:17 +0100)]
avcodec/cfhdenc: refactor DSP code for CFHD encoder

This is needed to implement x86 SIMD.

2 months agoavcodec/exr: simplify piz decompression
Paul B Mahol [Sat, 20 Feb 2021 01:35:06 +0000 (02:35 +0100)]
avcodec/exr: simplify piz decompression

Note that >32 codes are no longer supported, give
proper error code if such scenario ever happens.

2 months agoavformat/vpk: check that samples_per_block is > 0
Paul B Mahol [Wed, 24 Feb 2021 16:03:11 +0000 (17:03 +0100)]
avformat/vpk: check that samples_per_block is > 0

Fixes floating point exception.

2 months agoavutil/buffer: free all pooled buffers immediately after uninitializing the pool
James Almer [Sat, 20 Feb 2021 13:21:47 +0000 (10:21 -0300)]
avutil/buffer: free all pooled buffers immediately after uninitializing the pool

No buffer will be fetched from the pool after it's uninitialized, so there's
no benefit from waiting until every single buffer has been returned to it
before freeing them all.
This should free some memory in certain scenarios, which can be beneficial in
low memory systems.

Based on a patch by Jonas Karlman.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2 months agoavcodec/rv34data: Remove rv34_dquant_tab
Andreas Rheinhardt [Sat, 20 Feb 2021 14:22:38 +0000 (15:22 +0100)]
avcodec/rv34data: Remove rv34_dquant_tab

It is unused and coincides with ff_modified_quant_tab.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/x86/constants: Remove unused ff_pw_17
Andreas Rheinhardt [Fri, 19 Feb 2021 06:41:36 +0000 (07:41 +0100)]
avcodec/x86/constants: Remove unused ff_pw_17

Unused since 80944df720da98d6e5ee0e355db5814735914ec9.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoswscale/x86/swscale: Remove unused ASM constants
Andreas Rheinhardt [Fri, 19 Feb 2021 05:50:43 +0000 (06:50 +0100)]
swscale/x86/swscale: Remove unused ASM constants

The last user of g15Mask, r15Mask, g16Mask and r16Mask was disabled
in 77a416e8aab77058b542030870fd7178b62d2a62 and finally removed in
36e8de07ed62609df45d064b56501e3084d25723; b15Mask and b16Mask were
apparently always unused (except for in_asm_used_var_warning_killer,
a function that only existed to make the compiler not optimize ASM
constants away).
w10 is unused since d604bab901f6dfaaad672ef2164e42b1f350474c, w02
since ef423a661818f3c0d8206a2abbc65ff555cc0c67.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoswscale/x86/rgb2rgb: Remove unused ASM constants
Andreas Rheinhardt [Fri, 19 Feb 2021 03:49:04 +0000 (04:49 +0100)]
swscale/x86/rgb2rgb: Remove unused ASM constants

mask24hh etc. are unused since f099fbf5f3ac1d6b3753fc8dfda6558572111fbd,
mask32b and mask32r since 296609f859a587575b91fe9e9691f2707d6e8136,
mask32g since b38d487466e68bd6baf2889017d2a751831560f0 and mask32 since
f8a138be5257f751ef7d3c6b7ab534c0434e90e7.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoswscale/x86/yuv2rgb: Remove unused ASM constants
Andreas Rheinhardt [Fri, 19 Feb 2021 03:31:02 +0000 (04:31 +0100)]
swscale/x86/yuv2rgb: Remove unused ASM constants

mmx_grnmask is unused since 531f97b0c32d1d421f3ac614e002c53951658115,
the other constants since e934194b6a4159b7960cabefb0dd8b998c1961e8.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/celp_math: Disable unused function
Andreas Rheinhardt [Fri, 19 Feb 2021 01:22:36 +0000 (02:22 +0100)]
avcodec/celp_math: Disable unused function

The code using ff_exp2 (namely ff_acelp_decode_gain_code) use it only if
G729_BITEXACT is defined. So disable it if not.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/x86/diracdsp_init: Reuse macro
Andreas Rheinhardt [Fri, 19 Feb 2021 00:50:40 +0000 (01:50 +0100)]
avcodec/x86/diracdsp_init: Reuse macro

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/x86/diracdsp_init: Simplify macro
Andreas Rheinhardt [Fri, 19 Feb 2021 00:50:01 +0000 (01:50 +0100)]
avcodec/x86/diracdsp_init: Simplify macro

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/x86/diracdsp_init: Make functions only used here static
Andreas Rheinhardt [Fri, 19 Feb 2021 00:32:25 +0000 (01:32 +0100)]
avcodec/x86/diracdsp_init: Make functions only used here static

This allowed to remove forward declarations. Because compilers expect
declarations for all functions they encounter even when it is within
blocks disabled via "if (0 && foo)", one has to use a real #if in
ff_diracdsp_init_x86.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/x86/diracdsp_init: Remove unused MMX functions
Andreas Rheinhardt [Thu, 18 Feb 2021 23:43:45 +0000 (00:43 +0100)]
avcodec/x86/diracdsp_init: Remove unused MMX functions

Unused since a1f3b18bf55f106c974eacb1dc831be4d2bd5277, yet as nonstatic
functions the compiler can't detect this, so that these functions aren't
stripped and no warning is emitted.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/acelp_vectors: Remove unused ff_fc_2pulses_9bits_track1
Andreas Rheinhardt [Thu, 18 Feb 2021 22:14:11 +0000 (23:14 +0100)]
avcodec/acelp_vectors: Remove unused ff_fc_2pulses_9bits_track1

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/acelp_pitch_delay: Inline small functions only used once
Andreas Rheinhardt [Thu, 18 Feb 2021 20:24:51 +0000 (21:24 +0100)]
avcodec/acelp_pitch_delay: Inline small functions only used once

ff_acelp_decode_8bit_to_1st_delay3, ff_acelp_decode_4bit_to_2nd_delay3
and ff_acelp_decode_5_6_bit_to_2nd_delay3 are all only used once (by
g729dec) whereas ff_acelp_decode_9bit_to_1st_delay6 and
ff_acelp_decode_6bit_to_2nd_delay6 are completely unused; with the
possible exception of ff_acelp_decode_4bit_to_2nd_delay3, these
functions are so small that inlining them is appropriate; and as long as
ff_acelp_decode_4bit_to_2nd_delay3 is only called once, this is also
true for it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/rangecoder: Move ff_rac_check_termination to tests/rangecoder.c
Andreas Rheinhardt [Thu, 18 Feb 2021 18:54:24 +0000 (19:54 +0100)]
avcodec/rangecoder: Move ff_rac_check_termination to tests/rangecoder.c

It is only used there.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/mqcenc: Remove unused ff_mqc_length
Andreas Rheinhardt [Thu, 18 Feb 2021 18:50:06 +0000 (19:50 +0100)]
avcodec/mqcenc: Remove unused ff_mqc_length

Unused since 4624656797b667eb6405186682eb04e74dfd90fd.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/ac3tab: Remove unused ff_eac3_default_chmap
Andreas Rheinhardt [Thu, 18 Feb 2021 18:46:25 +0000 (19:46 +0100)]
avcodec/ac3tab: Remove unused ff_eac3_default_chmap

Added in 0c79b1402a48a99f32435a0f5ad2364c58c6fcf3 to use it
in a function that was never used and was itself removed in
676f1f533e2c2960d81784188592a066b9ff1c3d.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/asf: Move ff_asf_audio_conceal_none to its only user
Andreas Rheinhardt [Thu, 18 Feb 2021 18:39:21 +0000 (19:39 +0100)]
avformat/asf: Move ff_asf_audio_conceal_none to its only user

It is only used inside code guarded by #ifdef DEBUG, i.e. it is normally
unused.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/bitstream: Rewrite code to avoid triggering compiler warning
Andreas Rheinhardt [Sun, 21 Feb 2021 00:44:18 +0000 (01:44 +0100)]
avcodec/bitstream: Rewrite code to avoid triggering compiler warning

Clang infers from the existence of a default case that said case can be
taken. In case of libavcodec/bitstream.c said default case consisted of
an av_assert1 that evaluates to nothing in case of the ordinary assert
level. In this case (that doesn't happen) a variable wouldn't be
initialized, so Clang emitted Wsometimes-uninitialized warnings.
Solve this by making sure that the default path also initializes
the aforementioned variable.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/movtextenc: Check for too many styles
Andreas Rheinhardt [Sat, 20 Feb 2021 22:42:04 +0000 (23:42 +0100)]
avcodec/movtextenc: Check for too many styles

The counter for the number of styles is written on two bytes, ergo
anything > UINT16_MAX is invalid. This also fixes a compiler warning
because of a tautologically true check on 64bit systems.

Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/Makefile: Remove unnecessary dependencies on vocdec
Andreas Rheinhardt [Tue, 23 Feb 2021 10:56:12 +0000 (11:56 +0100)]
avformat/Makefile: Remove unnecessary dependencies on vocdec

Commit 0d1229f1d2b8f26dd50c6be7917bb8ed8cb95364 factored the main part
of the voc demuxer's read_packet function out; yet when this Libav
commit was merged in f99195d56f4aab266926724ca1cfae822df4df16, the
dependency of the other users of this function on vocdec.o was
unnecessarily kept. This commit fixes this.

While just at it, also disable the data only used by the voc demuxer
and muxer in voc.c if both of them are disabled.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/exrenc: use correct type for actual_size as argument for zlib
Paul B Mahol [Tue, 23 Feb 2021 11:30:55 +0000 (12:30 +0100)]
avcodec/exrenc: use correct type for actual_size as argument for zlib

2 months agoavformat/imx: remove unused header
Paul B Mahol [Tue, 23 Feb 2021 10:57:07 +0000 (11:57 +0100)]
avformat/imx: remove unused header

2 months agoavcodec/tiff_data: Move data to its only user
Andreas Rheinhardt [Sat, 20 Feb 2021 03:20:14 +0000 (04:20 +0100)]
avcodec/tiff_data: Move data to its only user

tiff.c is the only user of the data from tiff_data.c (the dependency of
the tiff encoder of it is spurious). Therefore this commit moves all the
data from tiff_data.c to tiff_data.h (which is only included by tiff.c)
and makes the objects declared therein static.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/wavdec: Share wav and w64 options
Andreas Rheinhardt [Thu, 18 Feb 2021 03:06:53 +0000 (04:06 +0100)]
avformat/wavdec: Share wav and w64 options

The options of the w64 demuxer are a proper subset of the options for
the wav demuxer, making it possible to reuse a part of the options for
the wav demuxer for the w64 demuxer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/wav: Deduplicate codec tags lists
Andreas Rheinhardt [Thu, 18 Feb 2021 02:43:13 +0000 (03:43 +0100)]
avformat/wav: Deduplicate codec tags lists

Also saves relocations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/avienc, wtvenc: Deduplicate codec tags list
Andreas Rheinhardt [Thu, 18 Feb 2021 02:26:57 +0000 (03:26 +0100)]
avformat/avienc, wtvenc: Deduplicate codec tags list

Also saves relocations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/aiff: Deduplicate codec tags and codec tags list
Andreas Rheinhardt [Thu, 18 Feb 2021 01:39:34 +0000 (02:39 +0100)]
avformat/aiff: Deduplicate codec tags and codec tags list

Also saves a relocation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/ast: Deduplicate codec tags lists
Andreas Rheinhardt [Thu, 18 Feb 2021 01:26:03 +0000 (02:26 +0100)]
avformat/ast: Deduplicate codec tags lists

Also saves a relocation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/movenc: Deduplicate codec tags lists
Andreas Rheinhardt [Thu, 18 Feb 2021 01:15:06 +0000 (02:15 +0100)]
avformat/movenc: Deduplicate codec tags lists

Also saves relocations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/oma: Move stuff only used by demuxer to demuxer
Andreas Rheinhardt [Thu, 18 Feb 2021 01:01:09 +0000 (02:01 +0100)]
avformat/oma: Move stuff only used by demuxer to demuxer

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/oma: Deduplicate codec tags list
Andreas Rheinhardt [Thu, 18 Feb 2021 00:51:41 +0000 (01:51 +0100)]
avformat/oma: Deduplicate codec tags list

Also saves a relocation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/rso: Deduplicate codec tags list
Andreas Rheinhardt [Thu, 18 Feb 2021 00:46:05 +0000 (01:46 +0100)]
avformat/rso: Deduplicate codec tags list

Also saves a relocation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/voc: Deduplicate codec tags list
Andreas Rheinhardt [Thu, 18 Feb 2021 00:42:14 +0000 (01:42 +0100)]
avformat/voc: Deduplicate codec tags list

Also saves a relocation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/caf: Deduplicate codec tags list
Andreas Rheinhardt [Thu, 18 Feb 2021 00:31:18 +0000 (01:31 +0100)]
avformat/caf: Deduplicate codec tags list

Also saves a relocation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/asfenc: Deduplicate codec tags lists
Andreas Rheinhardt [Thu, 18 Feb 2021 00:24:24 +0000 (01:24 +0100)]
avformat/asfenc: Deduplicate codec tags lists

Also saves relocations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/au: Deduplicate codec_tag lists
Andreas Rheinhardt [Thu, 18 Feb 2021 00:16:26 +0000 (01:16 +0100)]
avformat/au: Deduplicate codec_tag lists

Also saves a relocation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/isom: Remove outcommented function
Andreas Rheinhardt [Wed, 10 Feb 2021 14:42:10 +0000 (15:42 +0100)]
avformat/isom: Remove outcommented function

There is another ff_mov_read_chan in mov_chan.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/isom: Split movaudio/movvideo tags off into a separate file
Andreas Rheinhardt [Wed, 10 Feb 2021 13:27:09 +0000 (14:27 +0100)]
avformat/isom: Split movaudio/movvideo tags off into a separate file

The NUT and avi demuxers only need ff_codec_movvideo_tags and so this
removes a dependency on the rest of isom.c as well as on mpeg4audio.c
(which isom depends on); it is similar for the Matroska demuxer and
muxers, except that the mpeg4audio.c dependency can't be avoided.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/Makefile: Remove outdated AIFF demuxer dependency on iso_media
Andreas Rheinhardt [Wed, 10 Feb 2021 12:44:58 +0000 (13:44 +0100)]
avformat/Makefile: Remove outdated AIFF demuxer dependency on iso_media

This is a result of the mov channel parsing stuff being factored out
of mov.c twice: Once in 91b782720fd0df5571775b6591bc41797d6ecf78
to isom.c and later in 3bab7cd12802dc5abf2c5cc6dec49e9e249ce204.

Also remove the isom.h header; and while just at it, remove an unused
mathematics.h inclusion.

(isom.c actually depends upon mpeg4audio from libavcodec for
avpriv_mpeg4audio_get_config2 and avpriv_mpa_freq_tab; yet there is
no configure dependency for iso_media which leads to failure of shared
builds.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/Makefile: Remove outdated dependency of FLV demuxer on mpeg4audio
Andreas Rheinhardt [Wed, 10 Feb 2021 11:51:06 +0000 (12:51 +0100)]
avcodec/Makefile: Remove outdated dependency of FLV demuxer on mpeg4audio

Unneeded since f96a653184e63cea91e08ea75ae60d309e431f40 and
b2bb09bcc330156e9d79d7ddfa59f9c5d05ca149.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/mpeg4audio: Use proper logcontext for logging
Andreas Rheinhardt [Wed, 10 Feb 2021 11:12:55 +0000 (12:12 +0100)]
avcodec/mpeg4audio: Use proper logcontext for logging

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/scpr3: Avoid code duplication when updating models
Andreas Rheinhardt [Sat, 13 Feb 2021 10:39:12 +0000 (11:39 +0100)]
avcodec/scpr3: Avoid code duplication when updating models

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoconfigure: Remove mpegvideo_enc dependency from ljpeg encoder
Andreas Rheinhardt [Wed, 17 Feb 2021 23:05:00 +0000 (00:05 +0100)]
configure: Remove mpegvideo_enc dependency from ljpeg encoder

It only existed because some code in mjpegenc_common.c relied on it;
yet said code was actually only used by mjpegenc.c and has been moved
there.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/Makefile: Don't build mjpegenc_huffman unconditionally
Andreas Rheinhardt [Wed, 17 Feb 2021 22:41:58 +0000 (23:41 +0100)]
avcodec/Makefile: Don't build mjpegenc_huffman unconditionally

Only the mjpeg and amv encoders as well as its testprogram actually need
it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/mjpegenc_common: Move stuff only used by mjpegenc.c to it
Andreas Rheinhardt [Wed, 17 Feb 2021 22:16:58 +0000 (23:16 +0100)]
avcodec/mjpegenc_common: Move stuff only used by mjpegenc.c to it

This allows to make ff_init_uni_ac_vlc static;
ff_mjpeg_encode_picture_frame has also been made static, but it could
always have been made static.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/jpegtables: Move ff_mjpeg_build_huffman_codes to mjpegenc_common
Andreas Rheinhardt [Tue, 9 Feb 2021 23:31:46 +0000 (00:31 +0100)]
avcodec/jpegtables: Move ff_mjpeg_build_huffman_codes to mjpegenc_common

Since g2meet.c doesn't use it any more, only encoders use it and
the place for their common code is mjpegenc_common.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/g2meet, mjpegdec: Factor out common VLC initialization code
Andreas Rheinhardt [Tue, 9 Feb 2021 23:20:26 +0000 (00:20 +0100)]
avcodec/g2meet, mjpegdec: Factor out common VLC initialization code

While just at it, remove the nb_codes parameter: It is redundant
(the number of codes is implicitly contained in the array containing how
many entries of a specific size there are) and for this reason it might
even be wrong, so it is better to check what is actually used instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/Makefile: Remove redundant mjpegdec dependency from tiff decoder
Andreas Rheinhardt [Tue, 9 Feb 2021 23:05:36 +0000 (00:05 +0100)]
avcodec/Makefile: Remove redundant mjpegdec dependency from tiff decoder

The MJPEG decoder is already activated by configure whenever the tiff
decoder is selected; ergo it is unnecessary to add a dependency in the
Makefile.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoconfigure, libavcodec/Makefile: Fix avrn dependencies
Andreas Rheinhardt [Tue, 9 Feb 2021 21:13:13 +0000 (22:13 +0100)]
configure, libavcodec/Makefile: Fix avrn dependencies

The avrn decoder actually only needs one thing: The MJPEG decoder.
Instead the Makefile made it compile mjpegdec and configure required
some of the prerequisites of the MJPEG decoder (exif and jpegtables).
Even if all the prerequisites of the MJPEG decoder were required, it
would still not make the MJPEG decoder usable, because for that
the MJPEG decoder needs to be in the list of codecs in codec_list.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/avrndec: Remove unnecessary headers
Andreas Rheinhardt [Tue, 9 Feb 2021 21:09:12 +0000 (22:09 +0100)]
avcodec/avrndec: Remove unnecessary headers

The avrn decoder does not use any internals of the MJPEG decoder since
e0031ca29a471c4a540ba2e01b3f81af03ef757b.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/Makefile: Remove spurios dcaenc dependency
Andreas Rheinhardt [Tue, 9 Feb 2021 19:57:10 +0000 (20:57 +0100)]
avcodec/Makefile: Remove spurios dcaenc dependency

It does not need dca.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoconfigure, libavcodec/Makefile: Remove spurious CAF demuxer dependencies
Andreas Rheinhardt [Tue, 9 Feb 2021 13:41:53 +0000 (14:41 +0100)]
configure, libavcodec/Makefile: Remove spurious CAF demuxer dependencies

Forgotten in 604fbb3132e88727e496c96c92cfe02748c25a1a.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>