1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-18 03:19:31 +02:00
Commit Graph

108926 Commits

Author SHA1 Message Date
Andreas Rheinhardt
566280c3f4 avcodec/huffyuv: Split HYuvContext into decoder and encoder context
While the share of elements used by both is quite big, the amount
of code shared between the decoders and encoders is negligible.
Therefore one can easily split the context if one wants to.
The reasons for doing so are that the non-shared elements
are non-negligible: The stats array which is only used by
the encoder takes 524288B of 868904B (on x64); similarly,
pix_bgr_map which is only used by the decoder takes 16KiB.
Furthermore, using a shared context also entails inclusions
of unneeded headers like put_bits.h for the decoder and get_bits.h
for the encoder (and all of these and much more for huffyuv.c).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-09 09:15:40 +02:00
Andreas Rheinhardt
83a8b9fac7 avcodec/huffyuv: Inline ff_huffyuv_common_init() in its callers
This is in preparation for splitting HYuvContext.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-09 09:15:40 +02:00
Andreas Rheinhardt
2415f5158b avcodec/huffyuv: Use AVCodecContext.(width|height) directly
These parameters are easily accessible whereever they
are accessed, so using copies from HYuvContext is
unnecessary.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-09 09:15:40 +02:00
Andreas Rheinhardt
bfdf3470f7 avcodec/huffyuvenc: Avoid unnecessary function call
av_pix_fmt_get_chroma_sub_sample() is superfluous if one
already has an AVPixFmtDescriptor.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-09 09:15:40 +02:00
Andreas Rheinhardt
f9be667452 avcodec/huffyuvenc: Improve code locality
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-09 09:15:40 +02:00
Andreas Rheinhardt
59535346b1 avocdec/huffyuvdec: Don't use HYuvContext.avctx
It is nearly unused anyway, so stop use the field altogether.
This is in preparation for splitting HYuvContext into
decoder and encoder contexts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-09 09:15:39 +02:00
Andreas Rheinhardt
1741adb1c7 avcodec/huffyuvencdsp: Pass pix_fmt directly when initing dsp
It is the only thing that is actually used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-09 09:15:39 +02:00
Andreas Rheinhardt
9ec50660ad avcodec/huffyuvenc: Don't second-guess error code
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-09 09:15:39 +02:00
Andreas Rheinhardt
75842c35e7 avcodec/huffyuvenc: Remove redundant call
All codecs here have the FF_CODEC_CAP_INIT_CLEANUP set,
so ff_huffyuv_common_end() will be called automatically
in encode_end() on error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-09 09:15:39 +02:00
Andreas Rheinhardt
e766378619 avcodec/huffyuvenc: Remove always-false check
The ffvhuff encoder has AVCodec.pix_fmts set and therefore
encode_preinit_video() checks that the used pixel format
is permissible.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-09 09:15:39 +02:00
Andreas Rheinhardt
be65f24ad6 avcodec/huffyuvenc: Avoid pointless indirections
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-09 09:15:39 +02:00
Andreas Rheinhardt
8f8c0ad291 avcodec/huffyuvenc: Remove redundant casts
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-09 09:15:39 +02:00
Andreas Rheinhardt
d287651c34 avcodec/ylc: Remove inclusion of huffyuvdsp.h
Also improve the other headers a bit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-09 09:15:39 +02:00
Paul B Mahol
5676b7cdcf avfilter/af_adynamicequalizer: rework processing 2022-10-09 09:16:24 +02:00
Zhao Zhili
94644343a6 avformat/mp3dec: remove a call to avio_tell()
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-10-08 22:56:30 +08:00
Zhao Zhili
0d17f5228f avformat/mp3dec: avoid seek back and forth
avio_seek() is called inside check(). Seeking to 'off' then seeking
to 'off + i' is unefficient, and it can loop 64 * 1024 times in the
worst case. When probe a malformed file over HTTP, it looks like
stucked forvever. ffio_ensure_seekback() doesn't solve the issue
when the stream is seekable but slow.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-10-08 22:56:20 +08:00
Zhao Zhili
2205ccd216 avformat/mpegtsenc: add omit_rai flag
Add PCR at keyframe can be undesirable when -pcr_period is
specified. Add an flag to disable this behavior.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-10-08 22:55:31 +08:00
Andreas Rheinhardt
ba30744213 avcodec/opus_pvq: Don't build ppp_pvq_search_c when unused
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-08 10:19:47 +02:00
Andreas Rheinhardt
5e8ea2bbc6 avcodec/opus_rc: Don't duplicate define
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-08 10:19:36 +02:00
Andreas Rheinhardt
e846617b82 avcodec/opus: Use prefix for defines
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-08 10:19:30 +02:00
Andreas Rheinhardt
a4dc60a258 avcodec/opusenc_psy: Remove unused/write-only context members
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-08 10:19:23 +02:00
Andreas Rheinhardt
bebd5b77af avcodec/opusenc_psy: Remove unused function parameter
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-08 10:18:59 +02:00
Andreas Rheinhardt
bcfa427c8f checkasm/vp8dsp: Use declare_func_emms only when needed
There is no MMX code for loop filters since commit
6a551f1405, so use declare_func
instead of declare_func_emms() to also test that we are not
in MMX mode after return.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-08 09:33:36 +02:00
Andreas Rheinhardt
e89b85a5e4 avcodec/asvenc: Remove unnecessary emms_c()
PixblockDSP does not use MMX functions any more since
92b5800277 and FDCTDSP
since d402ec6be9.
BswapDSP never used MMX, so that the emms_c() here
is unnecessary.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-08 00:09:35 +02:00
Andreas Rheinhardt
83ae36287e avcodec/wmv2enc: Inline extradata size
This also enables the compiler to optimize the implicit
checks performed by the PutBit-API away (Clang does so).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-07 22:55:21 +02:00
Andreas Rheinhardt
ddbaf6227b avcodec/msmpeg4enc: Fix indentation
Forgotten after 2b9ab1d54a.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-07 22:54:02 +02:00
Paul B Mahol
3d6d127cd0 avfilter/af_biquads: fix bandpass for zdf 2022-10-07 14:05:31 +02:00
Haihao Xiang
fce8b90851 lavc/cbs_av1: restore CodedBitstreamAV1Context when AVERROR(ENOSPC)
The current pbc might be small for an obu frame, so a new pbc is
required then parse this obu frame again. Because
CodedBitstreamAV1Context has already been updated for this obu frame, we
need to restore CodedBitstreamAV1Context, otherwise
CodedBitstreamAV1Context doesn't match this obu frame when parsing obu
frame again, e.g. CodedBitstreamAV1Context.order_hint.

$ ffmpeg -i input.ivf -c:v copy -f null -
[...]
[av1_frame_merge @ 0x558bc3d6f880] ref_order_hint[i] does not match
inferred value: 20, but should be 22.
[av1_frame_merge @ 0x558bc3d6f880] Failed to write unit 1 (type 6).
[av1_frame_merge @ 0x558bc3d6f880] Failed to write packet.
[obu @ 0x558bc3d6e040] av1_frame_merge filter failed to send output
packet

Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-10-07 10:56:41 +08:00
Andreas Rheinhardt
aaf4109a5f avcodec/mpegvideo_enc: Call ff_mpeg1_encode_init() earlier
It does not require anything that is being set between
the new position where it is called and the old position
where it used to be called; and nothing that it sets
gets overwritten between these two positions.
Doing so allows to remove a check lateron.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-06 15:00:21 +02:00
Andreas Rheinhardt
4e26bd7ad7 avcodec/h261enc: Store the H.261 format value
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-06 15:00:21 +02:00
Andreas Rheinhardt
d74ca6fdb4 avcodec/mpegvideo_enc: Move H.261 size check to h261enc.c
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-06 15:00:21 +02:00
Andreas Rheinhardt
759d216c47 avcodec/mpegvideo_enc: Call ff_h261_encode_init() earlier
It does not require anything that is being set between
the new position where it is called and the old position
where it used to be called; and nothing that it sets
gets overwritten between these two positions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-06 15:00:21 +02:00
Andreas Rheinhardt
40e4ddf619 avcodec/mpegvideo_enc: Move SpeedHQ check to speedhqenc.c
Also set this only once and not for every frame.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-06 15:00:21 +02:00
Andreas Rheinhardt
406c7fceeb fate/vcodec: Add speedhq tests
The vsynth3 tests are disabled, because the encoder produces garbage.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-06 15:00:21 +02:00
Gavin Smith
2c2aaa5bd0 avformat/mxfdec: do not log warning of multiple ANC packets if count is 0
Some NLVEs may insert a KLV packet for EIA-608 data even though
the number of encapsulated ANC packets is zero.
2022-10-06 10:23:39 +02:00
Richard Ayres
b074424bf6 Encrypted SMPTE DC MXF - additional UL needed to unpack EKLV packet
Thanks, Pierre-Anthony. I've updated the patch to remove the unnecessary UL and it's now using mxf_match_uid() to detect the EKLV packet.

Signed-off-by: Richard Ayres <richard.ayres@bydeluxe.com>
2022-10-06 10:04:17 +02:00
Andreas Rheinhardt
451b310d4f avcodec/fraps: Fix segfault with negative linesizes
Using unsigned and negative linesizes doesn't really work.
Use ptrdiff_t instead. This fixes the fraps-v0 and fraps-v1
FATE tests with negative linesizes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 14:39:10 +02:00
Andreas Rheinhardt
fcfa6965e5 avcodec/escape124: Fix segfault with negative linesizes
Use ptrdiff_t instead of unsigned for linesizes.
Fixes the armovie-escape124 FATE test with negative linesizes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 14:38:52 +02:00
Andreas Rheinhardt
fced3a17db avcodec/c93: Fix segfault when using negative linesizes
c93.c used an int for the stride and an unsigned for the current
linenumber. This does not work when using negative linesizes.
So use ptrdiff_t for stride and int for linenumber.

This fixes the cyberia-c93 FATE test when using negative linesizes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 14:38:52 +02:00
Andreas Rheinhardt
ce4713ea73 avcodec/sgidec: Use planar pixel formats
The data in SGI images is stored planar, so exporting
it via planar pixel formats is natural.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 14:38:51 +02:00
Andreas Rheinhardt
e771223ec1 avcodec/sgidec: Avoid redundant private context
SGI is intra-frame only; the decoder therefore does not
maintain any state between frames, so remove
the private context.

Also rename depth to nb_components.

Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 14:38:31 +02:00
Andreas Rheinhardt
54cf0482bd avcodec/sgidec: Support negative linesizes
The earlier code used "p->data[0] + p->linesize[0] * s->height" with
the latter being unsigned, which gives the wrong value for negative
linesizes. There is also a not so obvious problem with this:
In case of negative linesizes, the last line is the start of
the allocated buffer, so using the line after the last line
would involve undefined pointer arithmetic. So don't do it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 14:38:11 +02:00
Andreas Rheinhardt
02c19dfb85 avcodec/sunrast: Use ptrdiff_t for stride
Fixes segfaults with negative linesizes; in particular,
this affected the sunraster-(1|8|24)bit-(raw|rle) and
sunraster-8bit_gray-raw FATE tests.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 14:37:52 +02:00
Andreas Rheinhardt
8a9eac7e42 avcodec/asv: Split ASV1Context into decoder and encoder contexts
A lot of the stuff in ASV1Context is actually only used
by decoders or encoders, but not both: Of the seven contexts
in ASV1Context, only the BswapDSPContext is used by both.
So splitting makes sense.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 14:20:33 +02:00
Lynne
bd3e552549
lavu: bump minor and add APIChanges entry for RISC-V's RVBbasic 2022-10-05 08:31:15 +02:00
Rémi Denis-Courmont
2abafd7307 lavc/bswapdsp: RISC-V V bswap16_buf 2022-10-05 08:26:19 +02:00
Rémi Denis-Courmont
d7528af4df lavc/bswapdsp: RISC-V V bswap_buf 2022-10-05 08:26:19 +02:00
Rémi Denis-Courmont
f0ef11ea83 lavc/bswapdsp: RISC-V B bswap_buf
Simply taking the Zbb REV8 instruction into use in a simple loop gives
some significant savings:

bswap_buf_c: 1081.0
bswap_buf_rvb_b: 771.0

But we can also use the 64-bit REV8 as a pseudo-SIMD instruction with
just one additional shift, and one fewer load, effectively doubling the
bandwidth. Consequently, this patch is useful even if the compile-time
target has Zbb enabled for C code:

bswap_buf_c: 1081.0
bswap_buf_rvb_b: 341.0  (this patch)

On the other hand, this approach fails miserably for bswap16_buf as the
ratio of shifts and stores becomes unfavorable compared to naïve C:

bswap16_buf_c: 1542.0
bswap16_buf_rvb_b: 1803.7

Unrolling to process 128 bits (4 samples) at a time actually worsens
performance ever so slightly:

bswap_buf_c: 1081.0
bswap_buf_rvb_b: 408.5
2022-10-05 08:26:19 +02:00
Rémi Denis-Courmont
37d5ddc317 lavu/riscv: CPU flag for the Zbb extension
Unfortunately, it is common, and will remain so, that the Bit
manipulations are not enabled at compilation time. This is an official
policy for Debian ports in general (though they do not support RISC-V
officially as of yet) to stick to the minimal target baseline, which
does not include the B extension or even its Zbb subset.

For inline helpers (CPOP, REV8), compiler builtins (CTZ, CLZ) or
even plain C code (MIN, MAX, MINU, MAXU), run-time detection seems
impractical. But at least it can work for the byte-swap DSP functions.
2022-10-05 08:26:19 +02:00
Lynne
b25c6a5704
riscv/alacdsp: drop config.h include 2022-10-05 06:59:43 +02:00