Commit Graph

105221 Commits

Author SHA1 Message Date
rcombs f67bd3a825 lavfi/drawutils: ensure we don't support formats with non-pixel-sized offsets 2022-01-04 19:39:22 -06:00
rcombs f320722eb5 lavfi/drawutils: ensure we can't overflow a component 2022-01-04 19:39:22 -06:00
rcombs f00079b25c lavfi/drawutils: ensure we don't allow mixed-byte-depth formats
These could be hazardous because of FFDrawColor's union
2022-01-04 19:39:22 -06:00
rcombs e24b71add5 lavfi/drawutils: reimplement ff_fill_rgba_map without hardcoding the list
Same outputs, but computed instead of statically known, so new formats will be
supported more easily. Asserts in place to ensure we update this if we add
anything incompatible with its logic.
2022-01-04 19:39:22 -06:00
rcombs 5018103fa3 lavfi/drawutils: reject shift-packed formats
Disables x2bgr10/x2rgb10 (which did not behave correctly before).
2022-01-04 19:39:22 -06:00
rcombs 186e931f74 lavfi/drawutils: remove redundant BE format checks
We already explicitly don't support big-endian in general
2022-01-04 19:39:22 -06:00
rcombs 52fe11ef34 lavfi/drawutils: move BE check out of loop 2022-01-04 19:39:22 -06:00
rcombs df9180d8a0 swscale/output: use isSwappedChroma 2022-01-04 19:39:22 -06:00
rcombs cb3a6cc082 swscale/output: use isSemiPlanarYUV for NV12/21/24/42 case 2022-01-04 19:39:22 -06:00
rcombs f8e284be69 swscale: introduce isSwappedChroma 2022-01-04 19:39:22 -06:00
rcombs bb4f19f2a2 swscale/output: use isDataInHighBits for 10-bit case
This code will need fleshing-out (probably templating) if we ever add
e.g. a P012 format.
2022-01-04 19:39:22 -06:00
rcombs cf9e8cb52f swscale/output: use isSemiPlanarYUV for 16-bit case 2022-01-04 19:39:22 -06:00
rcombs e5d83463c8 swscale: introduce isDataInHighBits 2022-01-04 19:39:22 -06:00
rcombs cb87a3b137 swscale/output: template-ize yuv2nv12cX 10-bit and 16-bit cases
Fixes incorrect big-endian output introduced in 88d804b7ff

Avoids making the filter-time BE check more expensive
2022-01-04 19:39:22 -06:00
Limin Wang e35b70ab27 avformat: remove unused v210.c
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2022-01-05 09:38:20 +08:00
Limin Wang 41f213c3bf avformat: reuse the common code for v210/v210x
As suggested by Andreas Rheinhardt, most code of v210 demuxer is common code
which is duplicated from rawvideodec, so it's better to move v210/v210x
demuxer code to rawvideodec.c and reuse the common code.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2022-01-05 09:38:14 +08:00
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