Commit Graph

105155 Commits

Author SHA1 Message Date
Limin Wang
46f43f222e avcodec/videotoolbox: Fix undefined symbol with minimal configuration
Please reproduced with the following minimal configure command:
./configure --enable-shared --disable-all --enable-avcodec --enable-decoder=h264 --enable-hwaccel=h264_videotoolbox

You'll get below error:

Undefined symbols for architecture x86_64:
  "_ff_videotoolbox_vpcc_extradata_create", referenced from:
      _videotoolbox_start in videotoolbox.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Reported-by: Cameron Gutman <aicommander@gmail.com>
Tested-by: Cameron Gutman <aicommander@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2022-01-05 09:26:52 +08:00
Andreas Rheinhardt
8abc192236 avcodec/mpeg12enc: Inline constants
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:56 +01:00
Andreas Rheinhardt
c037f3fc7d avcodec/mpeg12enc: Partially inline whether codec is MPEG-1
MPEG-1 only supports 4:2:0, so one can optimize away the checks
for whether one encodes MPEG-1 in codepaths that encode 4:2:2.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
d91b5020ec avcodec/mpeg12enc: Also inline chroma subsampling
ff_mpeg1_encode_mb() contains two inlined calls to
mpeg1_encode_mb_internal(); these calls are supposed
to inline the properties depending upon the color space
used. Yet inlining vertical chroma subsampling (which
allows to remove complete branches and blocks depending
upon them) has been forgotten.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
58f6d1e758 avcodec/mpegvideo_enc: Remove dead code at compile time
There are no encoders for interlaced dct that support 4:4:4.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
bf2c34a01a avcodec/mpegvideo_enc: Improve inlining of chroma_format
encode_mb() calls encode_mb_internal() three times, once
for each supported chroma format. The reason for this is
that some chroma format dependent parameters can then be
inlined as encode_mb_internal() is marked as av_always_inline.
Yet the most basic parameters based upon chroma format have
not been inlined: The chroma format itself and the chroma
subsampling parameters. This commit does so.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
519c2c1a86 configure: Remove mpegvideo dependency on me_cmp
Forgotten in cf1e0786ed.
(Both mpegvideodec as well as mpegvideoenc use me_cmp,
so this doesn't affect them.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
ab54956edd configure: Add new mpegvideodec CONFIG_EXTRA
This allows to remove the spurious dependencies of mpegvideo encoders
on error_resilience; some other components that do not use mpegvideo
to its fullest turned out to not need it either.

Adding a new CONFIG_EXTRA needs a reconfigure to take effect.
In order to force this a few unnecessary headers from lavfi/allfilters.c
have been removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
d83479bec1 avcodec/mpegvideo: Move decoding-only code into a new file
This will allow to disable this code altogether when
all decoders are disabled.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
ee41c60373 avcodec/mpegvideo: Remove always-false check
An AVCodecContext's private data is always allocated
in avcodec_open2() and calling avcodec_flush_buffers()
on an unopened AVCodecContext (or an already closed one)
is not allowed (and will crash before the decoder's flush
function is even called).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
5de7bce12e avcodec/mpegvideo: Don't initialize error resilience context for encoder
It is only used for decoders.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
4a9b460a09 avcodec/mpegvideo: Check for no_rounding at compile-time if possible
It is partially possible if it is inlined whether
we deal with MPEG-1/2, because no_rounding is never set
for MPEG-1/2.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
7d4f200dfa avcodec/mpegvideo: Remove always-true branch
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
bf70c34b11 avcodec/mpegvideo: Try to perform check for MPEG-1/2 at compile-time
This is possible if CONFIG_SMALL is not true.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
7c0c73bca0 avcodec/mpegvideo: Partially check for being encoder at compile-time
Whether lowres is in use or not is inlined in
mpv_reconstruct_mb_internal(), so one can use the fact
that lowres is always zero during encoding to evaluate
the checks for whether one is encoding or not at compile-time
when one is in lowres mode.
Also reorder the main check to check for whether it is an encoder
first to shortcircuit it in the common case of a decoder.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
854e3d4734 avcodec/mpegvideo: Don't check for > 8 bit MPEG-1/2
It doesn't exist.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
f5ddf0ab19 avcodec/mpegvideo_motion: Don't duplicate identical code
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
b821a58741 avcodec/wmv2: Move ff_wmv2_add_mb() to the wmv2dec
Only the decoder ever used it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
22ef01f5e1 avcodec/mpegvideo: Avoid needlessly calling function
The very first check in this if-else if-else if construct is
"if (s->encoding ||", i.e. in case of the WMV2 encoder the else
branches are never executed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
5d856ef476 avcodec/mpegvideo: Don't duplicate identical code
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
ec5c188b21 avcodec/mpeg12dec: Use %c to write single char
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
2d2aa5c384 avcodec/mpegvideo_enc: Don't merge decoder-only fields
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
f899e3b51b avcodec/mpeg12enc: Move options-related fields to MPEG12EncContext
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
4989ad4c76 avcodec/mpeg12enc: Add custom context, move mpeg2_frame_rate_ext to it
It is only used here.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
ac49439e77 avcodec/mpeg12enc: Simplify check for A53 closed captions
The a53_cc option is only useful and meaningful for MPEG-2,
yet it was accidentally added for all mpegvideo-based encoders.
This means that it is possible for a53_cc to be set for other
encoders as well.
This commit changes this and reroutes a53_cc to the dummy field
in MpegEncContext for all codecs for which it is not supported.
This allows to avoid a check for the current codec in mpeg12enc.c.

Also add a compile-time check for whether the MPEG-2 encoder is
available while at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
7a2f728302 avcodec/mpegvideo_enc: Move updating mb_info to its only user
It is a H.263 option.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
3ff94f88c2 avcodec/speedhqenc: Inline constants
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
8a431a2bb6 avcodec/mpegvideo_enc: Remove impossible branch
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:54 +01:00
Andreas Rheinhardt
4707023a95 avcodec/mpegvideo: Remove unnecessary headers
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:54 +01:00
Andreas Rheinhardt
cbbd5e063d avcodec/mjpegenc_common: Use AVCodecContext.codec_id directly
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:54 +01:00
Andreas Rheinhardt
3867b18120 avcodec/mjpegenc_common: Don't call function unnecessarily
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:54 +01:00
Andreas Rheinhardt
8a0981d013 avcodec/mjpegenc_common: Pass MJpegContext for writing picture header
It is the structure that is actually used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:54 +01:00
Andreas Rheinhardt
7aee9e326f avcodec/mjpegenc: Deprecate unused prediction type
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:54 +01:00
Andreas Rheinhardt
bd2ec3d345 avcodec/mpegvideo: Move MJPEG/AMV-only fields to MJpegContext
This is possible now that MJpegContext is allocated jointly
with MpegEncContext as part of the AVCodecContext's private data.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:54 +01:00
Andreas Rheinhardt
506758357e avcodec/mjpegenc_common: Fix intendation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:54 +01:00
Andreas Rheinhardt
8edb2c638c avcodec/mjpegenc_common: Move code for MJPEG/AMV to mjpegenc
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:54 +01:00
Andreas Rheinhardt
410af1caa3 avcodec/mjpegenc: Add wrapper for ff_mjpeg_encode_picture_header()
This factors the translation from MpegEncContext out
and will enable further optimizations in the next commits.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:54 +01:00
Andreas Rheinhardt
be736e4237 avcodec/mpegvideo_enc: Remove redundant checks for multithreading
The generic code ensures that only codecs with
the FF_CODEC_CAP_AUTO_THREADS internal cap ever have to
handle the case avctx->thread_count == 0 themselves;
moreover, it is also ensured generically that only codecs
that support some form of threading have thread_count set
to something else than one. So these checks are unnecessary.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:54 +01:00
Andreas Rheinhardt
4d39a4db68 avcodec/mpegvideo_enc: Move MJPEG init checks to mjpegenc.c
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:54 +01:00
Andreas Rheinhardt
26e117a14d avcodec/mjpegenc: Avoid allocation of MJpegContext
This is possible by allocating it together with the MpegEncContext.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:54 +01:00
Andreas Rheinhardt
0b670a7f91 avcodec/mjpegenc: Use custom close function directly
Currently, ff_mpv_encode_end() is the close function of
the two MJPEG-based encoders; it calls ff_mjpeg_encode_close()
for them which adds a check to the generic code.
This commit reverses the order of this relationship:
The MJPEG encoders directly use a custom close function
which in turn calls ff_mpv_encode_end(). This avoids the branch
in ff_mpv_encode_end() and makes the generic code more generic.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:54 +01:00
gxw
8ca7d474c1 avcodec: [loongarch] Optimize prefetch with loongarch.
./ffmpeg -i ../1_h264_1080p_30fps_3Mbps.mp4 -f rawvideo -y /dev/null -an
before:296
after :308

Reviewed-by: 殷时友 <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-01-04 15:55:05 +01:00
Hao Chen
555b850bd5 avcodec: [loongarch] Optimize idctdstp with LASX.
./ffmpeg -i 8_mpeg4_1080p_24fps_12Mbps.avi -f rawvideo -y /dev/null -an
before:433fps
after :552fps

Reviewed-by: 殷时友 <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-01-04 15:55:05 +01:00
Shiyou Yin
5d58355bf1 avcodec: [loongarch] Optimize hpeldsp with LASX.
./ffmpeg -i 8_mpeg4_1080p_24fps_12Mbps.avi -f rawvideo -y /dev/null -an
before:376fps
after :433fps

Reviewed-by: 殷时友 <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-01-04 15:55:05 +01:00
Niklas Haas
10e4b2b1d2 lavfi/showinfo: fix printf precision for dovi metadata
Fix warning caused by this field changing from uint64_t to uint16_t.

Signed-off-by: Niklas Haas <git@haasn.dev>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 14:42:51 +01:00
J. Dekker
f63f9be37c lavc/aarch64: add hevc sao band 8x8 tiling
bench on AWS Graviton:

hevc_sao_band_8x8_8_c: 317.5
hevc_sao_band_8x8_8_neon: 97.5
hevc_sao_band_16x16_8_c: 1115.0
hevc_sao_band_16x16_8_neon: 322.7
hevc_sao_band_32x32_8_c: 4599.2
hevc_sao_band_32x32_8_neon: 1246.2
hevc_sao_band_48x48_8_c: 10021.7
hevc_sao_band_48x48_8_neon: 2740.5
hevc_sao_band_64x64_8_c: 17635.0
hevc_sao_band_64x64_8_neon: 4875.7

Signed-off-by: J. Dekker <jdek@itanimul.li>
2022-01-04 14:32:26 +01:00
J. Dekker
89a2ed4a8b lavc/aarch64: clean-up sao band 8x8 function formatting
Signed-off-by: J. Dekker <jdek@itanimul.li>
2022-01-04 14:31:56 +01:00
J. Dekker
c97ffc1a77 lavc/aarch64: add hevc sao edge 8x8
bench on AWS Graviton:

hevc_sao_edge_8x8_8_c: 516.0
hevc_sao_edge_8x8_8_neon: 81.0

Signed-off-by: J. Dekker <jdek@itanimul.li>
2022-01-04 14:31:56 +01:00
J. Dekker
a9214a2ca3 lavc/aarch64: add hevc sao edge 16x16
bench on AWS Graviton:

hevc_sao_edge_16x16_8_c: 1857.0
hevc_sao_edge_16x16_8_neon: 211.0
hevc_sao_edge_32x32_8_c: 7802.2
hevc_sao_edge_32x32_8_neon: 808.2
hevc_sao_edge_48x48_8_c: 16764.2
hevc_sao_edge_48x48_8_neon: 1796.5
hevc_sao_edge_64x64_8_c: 32647.5
hevc_sao_edge_64x64_8_neon: 3118.5

Signed-off-by: J. Dekker <jdek@itanimul.li>
2022-01-04 14:31:56 +01:00
J. Dekker
7fc6015de9 Revert "arm: hevc_qpel: Fix the assembly to work with non-multiple of 8 widths"
This reverts commit 2589060b92 which was
originally to fix the FATE test. The real cause of the test breakage was
fixed in 22b7c37275.

Signed-off-by: J. Dekker <jdek@itanimul.li>
2022-01-04 14:31:48 +01:00