1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

109001 Commits

Author SHA1 Message Date
Andreas Rheinhardt
1d9aac9c4b avcodec/mpegvideo_dec: Don't use MotionEstContext as scratch space
Decoders that might use quarter pixel motion estimation
(namely MPEG-4 as well as the VC-1 family) currently
use MpegEncContext.me.qpel_(put|avg) as scratch space
for pointers to arrays of function pointers.
(MotionEstContext contains such pointers as it supports
quarter pixel motion estimation.) The MotionEstContext
is unused apart from this for the decoding part of
mpegvideo.

Using the context at all is for decoding is actually
unnecessary and easily avoided: All codecs with
quarter pixels set me.qpel_avg to qdsp.avg_qpel_pixels_tab,
so one can just unconditionally use this in ff_mpv_reconstruct_mb().
MPEG-4 sets qpel_put to qdsp.put_qpel_pixels_tab
or to qdsp.put_no_rnd_qpel_pixels_tab based upon
whether the current frame is a b-frame with no_rounding
or not, while the VC-1-based decoders set it to
qdsp.put_qpel_pixels_tab unconditionally. Given
that no_rounding is always zero for VC-1, using
the same check for VC-1 as well as for MPEG-4 would work.
Since ff_mpv_reconstruct_mb() already has exactly
the right check (for hpeldsp), it can simply be reused.

(This change will result in ff_mpv_motion() receiving
a pointer to an array of NULL function pointers instead
of a NULL pointer for codecs without qpeldsp (like MPEG-1/2).
It doesn't matter.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
5739fa8be2 avcodec/vc1_block: Remove redundant write
vc1_decode_skip_blocks() is only called if the current picture
is a P frame. So setting pict_type to AV_PICTURE_TYPE_P
is redundant; removing it makes pict_type read-only in vc1_block.c
(as it should be).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
cbe6ef1031 avcodec/vc1dec: Split VC-1 decoders from msmpeg4
The only msmpeg4 code that is ever executed by the VC-1 based
decoders is ff_msmpeg4_decode_init() and what is directly
reachable from it. This is:
a) A call to av_image_check_size(), then ff_h263_decode_init(),
b) followed by setting [yc]_dc_scale_table and initializing
scantable/permutations.
c) Afterwards, some static tables are initialized.
d) Finally, slice_height is set.

The replacement for ff_msmpeg4_decode_init() performs a)
just like now; it also sets [yc]_dc_scale_table,
but it only initializes inter_scantable and intra_scantable
and not permutated_intra_[hv]_scantable: The latter are only
used inside decode_mb callbacks which are only called
in ff_h263_decode_frame() which is unused for VC-1.*

The static tables initialized in c) are not used at all by
VC-1 (the ones that are used have been factored out in
previous commits); this avoids touching 327KiB of .bss.

slice_height is also not used by the VC-1 decoder (setting
it in ff_msmpeg4_decode_init() is probably redundant after
b34397b4cd).

*: It follows from this that the VC-1 decoder is not really
based upon the H.263 decoder either; changing this will
be done in a future commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
d1d30edf42 avcodec/msmpeg4data: Move data shared between msmpeg4 and VC-1 out
This is in preparation for splitting VC-1 from msmpeg4.
(msmpeg4data.c was originally intended to be just this;
9488b966c7 changed it).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
44600da535 avcodec/vc1dec: Return early upon error
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
835be33ee3 avcodec/vc1dec: Factor (re)initializing code out
This is in preparation for removing the msmpeg4 dependency
from VC-1.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
5a157313b3 avcodec/vc1dec: Don't open and close decoder during init
This is done since 16af29a7a6
(and is actually unnecessary, because the tables initialized
in ff_msmpeg4_decode_init() are only ever used in vc1_block.c
which is only entered after a call to ff_msmpeg4_decode_init())
in a very ugly manner; said manner had the byproduct of
involving lots of unnecessary allocations and even opening
and closing a hwaccel in case one is used.

This commit achieves the aim of 16af29a7a6
by initializing the VLCs used by VC-1 in ff_vc1_init_common().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
83dfc21a21 avcodec/msmpeg4dec: Factor initializing VLCs shared with VC-1 out
It will be useful in the following commits.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
8f7bf45895 avcodec/vc1_block: Don't duplicate #defines
VC1 shares some VLCs with MSMPEG-4, but vc1_block.c
simply duplicates the defines instead of including
the appropriate headers; furthermore, use a proper
prefix for these defines: DC_VLC_BITS is also used
by other codecs.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
1669fe8631 avcodec/vc1: Move ff_vc1_init_common() to vc1dec.c
This is possible given that it is no longer used
by the parser.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt
a79399adfa avcodec/vc1data: Move VLC codes/lengths tables to a header
and include said header at the place where the VLCs are created.
This allows to make said tables static.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:25 +01:00
Andreas Rheinhardt
3179fe97e7 avcodec/vc1data: Remove declarations of inexistent arrays
ff_vc1_norm6_spec has been removed in commit
356be9307c (and it seems that it
has never been used); the declarations of the 8x8_zz arrays meanwhile
have been added in f0c02e1cbc
without having ever been defined.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:25 +01:00
Andreas Rheinhardt
6f1403712d avcodec/vc1data: Remove duplicate defines
The defines in vc1data.c are duplicates of the ones in vc1data.h;
they are also pointless, because they are not used anywhere.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:25 +01:00
Andreas Rheinhardt
777a8c2d50 avcodec/vc1: Move setting res_fasttx-IDCT functions to vc1dec.c
It allows to avoid compiling simple_idct.o for the VC-1 parser.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:25 +01:00
Andreas Rheinhardt
e4df54851a avcodec/vc1_parser: Don't call ff_vc1_init_common()
It is unnecessary to initialize the VLCs: The only VLC
that was only ever used by the code reachable from the parser
was ff_vc1_bfraction_vlc; and this VLC has been removed.

Yet vc1dsp is still needed for startcode_find_candidate.
Maybe this should be factored out of vc1dsp in a later
commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:25 +01:00
Andreas Rheinhardt
2b0f73321d avcodec/vc1_parser: Set parse_only only once
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:25 +01:00
Andreas Rheinhardt
eb28ddf8fc avcodec/vc1: Don't use VLC to read bfraction
The VLC here is very simple, so that it can just be read
by two get_bits().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:25 +01:00
Andreas Rheinhardt
2e2b404a2d avcodec/vc1: Don't check for errors for complete VLC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:25 +01:00
Andreas Rheinhardt
e7288a7e02 avcodec/vc1: Remove always-false check
Added in b50be4e38dc83389925dc14f24fa11e660d32197;
this check was racy back then (as the VLC could be initialized
concurrently) and it is redundant (always-false)
since commit c742ab4e81.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:25 +01:00
Andreas Rheinhardt
fdcd3dcf2e avcodec/vc1: Don't check for AVCodecContext.codec
This check has been added in c617bed34f,
merging ee769c6a7c to fix
a possible segfault if AVCodecContext.codec is not set
as it may be during parsing. While this fixes the segfault,
it has the unfortunate side effect that it makes the output
of the parser dependent on whether a decoder is set (and
ultimately available). The fix later applied in
5d2be71b9e does not have this
downside and makes checking AVCodecContext.codec superfluous.
So remove this check.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:25 +01:00
Lynne
a07c8781ce
mips/aacsbr: port to lavu/tx
Fixes compilation after the recent commit which ported the C code to lavu/tx.
2022-11-06 17:37:21 +01:00
James Almer
26cb36f357 Revert "lavc: deprecate avcodec_dct, av_fft, av_dct, av_rdft and av_mdct"
There are sill many users of these APIs within libav*, so this commit
introduced too many deprecation warnings, making compilation too noisy and
potentially hiding legit warnings.
Once the remaining users are ported, this can be reapplied.

This reverts commit 76d0038579.
2022-11-06 12:15:56 -03:00
Lynne
76d0038579
lavc: deprecate avcodec_dct, av_fft, av_dct, av_rdft and av_mdct
Replaced by lavu/tx. Dedicated code soon to be removed, replaced with
a simple wrapper code.
2022-11-06 14:39:42 +01:00
Lynne
1aeedd277a
qdm2: convert to lavu/tx 2022-11-06 14:39:42 +01:00
Lynne
e6afa61be9
imc: convert to lavu/tx, remove NIH iMDCT and replace with a standard one 2022-11-06 14:39:42 +01:00
Lynne
b85e106d5f
libavcodec: remove mdct15
It's not needed nor used by anything anymore, lavu/tx is faster,
and better in every way. RIP.
2022-11-06 14:39:41 +01:00
Lynne
774ea6a00b
vorbisenc: convert to lavu/tx 2022-11-06 14:39:41 +01:00
Lynne
34330adb29
atrac3plus: convert to lavu/tx 2022-11-06 14:39:40 +01:00
Lynne
b59e6b5d99
atrac3: convert to lavu/tx 2022-11-06 14:39:40 +01:00
Lynne
5f52094f3d
atrac1: convert to lavu/tx 2022-11-06 14:39:39 +01:00
Lynne
978963a77b
wma: convert to lavu/tx
Converts both the decoder and encoders.
2022-11-06 14:39:39 +01:00
Lynne
6ba0aa1770
on2avc: convert to lavu/tx 2022-11-06 14:39:38 +01:00
Lynne
8cd46c48ac
nellymoserenc: convert to lavu/tx 2022-11-06 14:39:38 +01:00
Lynne
61e1a7d958
nellymoserdec: convert to lavu/tx 2022-11-06 14:39:38 +01:00
Lynne
b428003c1c
dcaenc: convert to lavu/tx
The encoder is fixed point, and uses an MDCT only for analysis. Due
to the slightly different rounding, the encoder makes a different
decision, so the tests have to be adjusted as well.
2022-11-06 14:39:37 +01:00
Lynne
055413788f
dca_lbr: convert to lavu/tx
Fully converts the DCA decoder to lavu/tx.
2022-11-06 14:39:37 +01:00
Lynne
e0661fc805
dca_core: convert to lavu/tx
Thanks to Martin Storsjö <martin@martin.st> for fixing and testing the
arm32 and aarch64 changes.
2022-11-06 14:39:36 +01:00
Lynne
2689038f08
dolby_e: convert to lavu/tx 2022-11-06 14:39:36 +01:00
Lynne
1d810b650c
cookdec: convert to lavu/tx 2022-11-06 14:39:36 +01:00
Lynne
8f3e062314
aacenc: convert to lavu/tx 2022-11-06 14:39:35 +01:00
Lynne
fbe6a51b11
aacsbr: convert to lavu/tx 2022-11-06 14:39:35 +01:00
Lynne
5f1111e42e
wmaprodec: convert to lavu/tx 2022-11-06 14:39:34 +01:00
Lynne
eb0e25f078
atrac9dec: convert to lavu/tx 2022-11-06 14:39:34 +01:00
Lynne
7af43a46d9
twinvq: convert to lavu/tx 2022-11-06 14:39:33 +01:00
Lynne
60c704677a
vorbisdec: convert to lavu/tx
This also fixes not checking the return values on transform init.

Total decoder speedup on Zen 3: 9%
2022-11-06 14:39:33 +01:00
Lynne
469cd8d7fa
aacdec: convert to lavu/tx and support fixed-point 960-sample decoding
This patch replaces the transform used in AAC with lavu/tx and removes
the limitation on only being able to decode 960-sample files
with the float decoder.
This commit also removes a whole bunch of unnecessary and slow
lifting steps the decoder did to compensate for the poor accuracy
of the old integer transformation code.

Overall float decoder speedup on Zen 3 for 64kbps: 32%
2022-11-06 14:39:33 +01:00
Lynne
4cee7ebd75
ac3: convert to lavu/tx 2022-11-06 14:39:27 +01:00
Marvin Scholz
2508e846a8 avutil/dict: Improve documentation
Mostly consistent formatting and consistently ordering of
warnings/notes to be next to the description.

Additionally group the AV_DICT_* macros.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-11-06 08:26:50 +01:00
Marvin Scholz
3101b8afb3 avutil/dict: Use av_dict_iterate in av_dict_get_string
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-11-06 08:26:50 +01:00
Marvin Scholz
3c2050b749 avutil/dict: Use av_dict_iterate in av_dict_copy
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-11-06 08:26:50 +01:00