Commit Graph

116037 Commits

Author SHA1 Message Date
Rémi Denis-Courmont
0d748eec8d configure: detect 64-bit generic platforms
Currently, any unrecognised platform is treated as 32-bit. This should
detect *most* 64-bit platforms, namely LP64 and LLP64 ones.
Unfortunately this will not work for ILP32 ABIs on 64-bit ISAs, but
still better than nothing.
2024-06-24 20:23:32 +03:00
Cosmin Stejerean
c3814d5409 avcodec/dovi_rpudec: fix reading el_bit_depth_minus8
now that we are reading ext_mapping_idc as the upper 8 bits of
el_bit_depth_minus8 we need to use get_ue_golomb_long rather than
get_ue_golomb_31 for reading it
2024-06-24 18:05:20 +02:00
Pierre-Anthony Lemieux
77ab1c773c
fate/jpeg2000dec: add support for p0_10.j2k
p0_10.j2k is one of the reference codestreams included in Rec. ITU-T T.803 | ISO/IEC 15444-4.
Adding this test was made possible by commit 6f4a95cfb8.
2024-06-24 08:50:59 -07:00
Timo Rothenpieler
76317e22a6 avformat/tls_schannel: forward AVIO_FLAG_NONBLOCK to tcp stream
Fixes for example rtmps streaming over schannel.
2024-06-24 15:00:27 +02:00
Ramiro Polla
e37a93031e swscale/yuv2rgb: reindent after previous commit 2024-06-24 13:35:22 +02:00
Ramiro Polla
0a08c64588 swscale/yuv2rgb: fix yuv422p input in C code
The C code was silently ignoring the second chroma line on yuv422p
input.
2024-06-24 13:34:53 +02:00
Ramiro Polla
fb8fae864f swscale/yuv2rgb: add macros to simplify code generation 2024-06-24 13:34:28 +02:00
Ramiro Polla
88a402df74 swscale/yuv2rgb: fix conversion for widths not aligned to 8
The C code for some pixel formats (rgb555, rgb565, rgb444, and monob)
was not converting the last pixels on widths not aligned to 8.

NOTE: the last pixel for odd widths is still not converted for any of
      the pixel formats in the C code for yuv2rgb except for monob.
2024-06-24 13:33:53 +02:00
Martin Storsjö
6ec22731ae movenc: Add an option for resilient, hybrid fragmented/non-fragmented muxing
This allows ending up with a normal, non-fragmented file when
the file is finished, while keeping the file readable if writing
is aborted abruptly at any point. (Normally when writing a
mov/mp4 file, the unfinished file is completely useless unless it
is finished properly.)

This results in a file where the mdat atom contains (and hides)
all the moof atoms that were part of the fragmented file structure
initially.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-24 11:24:04 +03:00
Martin Storsjö
4b8ddf71dc movenc: Factorize a function for finishing a written fragment
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-24 11:23:55 +03:00
Lynne
0b67c83b2e
aacdec_usac, aacsbr: implement SBR support for USAC
Currently, no eSBR features are supported.
Thankfully, no encoders exist for it yet.
2024-06-23 09:10:15 +02:00
Cosmin Stejerean
0c0e7ec81e avcodec/dovi_rpu: correctly read el_bit_depth_minus8 and ext_mapping_idc
These two fields are coded together into a single 16 bit integer with upper 8
bits for ext_mapping_idc and lower 8 bits for el_bit_depth_minus8.

Furthermore ext_mapping_idc has two components, upper 3 bits and lower 5 bits.

Co-authored-by: Niklas Haas <git@haasn.dev>
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-06-22 15:48:25 +02:00
Cosmin Stejerean
cc587e69c6 avutil/dovi_meta: add fields for ext_mapping_idc
Co-authored-by: Niklas Haas <git@haasn.dev>
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-06-22 15:48:23 +02:00
James Almer
127545350f avformat/mov: use the updated default value for horizontal_disparity_adjustment in the eyes box
Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-21 14:09:25 -03:00
Lynne
d45e20c37b
aacdec_usac: remove custom rate_idx and use standard variable for it
m4ac.sampling_index is what aacdec.c uses.
2024-06-21 10:50:22 +02:00
Lynne
a381cbc7c7
aacdec_usac: rename noise_scale to noise_bands
This was a typo.
2024-06-21 10:50:21 +02:00
Lynne
89de2f0de1
aacdec_ac: fix an overread
Fixes reading state->last[i + 1] in ff_aac_ac_get_context for the
last array member.
2024-06-21 10:50:21 +02:00
Lynne
50e5b78b79
aac: expose ff_aac_sample_rate_idx() in aac.h
The rate index is a value important to both encoders and decoders.
USAC needs it as well, so put it into the shared main header.
2024-06-21 10:50:20 +02:00
Lynne
1c3545f053
aacdec_usac: apply specification fix M55715 2024-06-21 10:50:13 +02:00
James Almer
35df214a72 avformat/mxfdec: don't use sizeof(AVMasteringDisplayMetadata)
It's not part of the libavutil ABI.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-20 17:04:03 -03:00
James Almer
a91f34aad8 avformat/mov: don't use sizeof(AVMasteringDisplayMetadata)
It's not part of the libavutil ABI.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-20 17:04:03 -03:00
James Almer
8a85d3fd39 avformat/matroskadec: don't use sizeof(AVMasteringDisplayMetadata)
It's not part of the libavutil ABI.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-20 17:04:03 -03:00
James Almer
c3606cad9c avutil/stereo3d: set a sane default value for AVRational fields
Prevent potential divisions by 0 when using them immediately after allocation.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-20 17:03:55 -03:00
James Almer
1044c09eca avutil/mastering_display_metadata: set a sane default value for AVRational fields
Prevent potential divisions by 0 when using them immediately after allocation.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-20 17:02:50 -03:00
James Almer
7f1b590480 avutil/ambient_viewing_environment: set a sane default value for AVRational fields
Prevent potential divisions by 0 when using them immediately after allocation.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-20 17:02:50 -03:00
James Almer
5140d8334e ffprobe: always print all Stereo3D fields
ffprobe is meant to generate parseable output, and if a field is present, it
should be printed even if it has a default value.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-20 17:02:44 -03:00
Andreas Rheinhardt
3a5202d026 avcodec/h261enc: Fix ac_vlc_length tables
These tables are supposed to contain the number of bits needed
to encode a given (run, level) pair. Yet the number of bits
for pairs needing the escape code was wrong (it only contained
the escape code and not the bits needed for run and level).

Furthermore, H.261 (a format with explicit end-of-block codes)
does not work well together with the RLTable API from rl.c:
The EOB code is the first one in ff_h261_rl_tcoeff's VLC table
and has a run value of zero. Therefore the result of get_rl_index()
is off by one for run == 0 and level values with explicit
(run, level) pair.

Fixing this necessitated changing the ref files of the
vsynth*-h261-trellis tests. Both filesizes as well as PSNR
decreased. If one used a qscale value of 11 for this test,
one would have received files with about the same size as
before this patch (with qscale 12), but with better PSNR.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
f3829cc72d avcodec/h261enc: Avoid RLTable when writing macroblock
The RLTable API in rl.c is not well designed for codecs with
an explicit end-of-block code. ff_h261_rl_tcoeff's vlc has
the EOB code as first element (presumably so that the decoder
can check for it via "if (level == 0)") and this implies
that the indices returned by get_rl_index() are off by one
for run == 0 which is therefore explicitly checked.

This commit changes this by adding a simple LUT for the
values not requiring escaping. It is easy to directly
include the sign bit into this, so this has also been done.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
3874442db2 avcodec/h261data: Make some tables non-static
This will allow to avoid the indirection via ff_h261_rl_tcoeff
in future commits.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
390dbcb8b8 avcodec/mpegvideo_enc: Constify pointers to static storage
These must not be modified (even when they are initialized at runtime
and therefore modifiable).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
b28bf830cd avcodec/motion_est: Optimize dead code away
H.261 does not have B-frames.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
bbb10f1d83 avcodec/h261enc: Inline constants
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
48cdb7d579 avcodec/mpegvideo_dec: Move setting dct_unquant funcs to h263dec.c
It is a better place for it; no non-h263-based decoder needs
these functions any more (both H.261 and the error resilience
code recently stopped doing so).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
64d2bca452 avcodec/rv10: Avoid indirection
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
594723ec38 avcodec/mpegvideo: Move quant_precision to Mpeg4DecContext
It is an MPEG-4-only value; it is always five for the MPEG-4
encoder, so just hardcode this value and move the MpegEncContext
field to Mpeg4DecContext.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
c735552b0b avcodec/rv10: Use ff_h263_decode_init()
The RV10 and RV20 decoders use ff_h263_decode_mb() and also the
H.263 DSP and VLCs. Despite not calling ff_h263_decode_frame(),
it is nevertheless beneficial to call ff_h263_decode_init()
to reduce code duplication.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
7b539ca3e6 avcodec/mpeg_er: Simplify disabling IDCT
The error resilience code does not make up block coefficients
and therefore zeroes them in order to disable the IDCT.
But this can be done in a simpler manner, namely by setting
block_last_index to a negative value. Doing so also has
the advantage that the dct_unquantize functions are never even
called for those codecs that do not use ff_mpv_reconstruct_mb()
for ordinary decoding (namely RV-30/40 and the VC-1 family).

This approach would not work for intra macroblocks (there is always
at least one coefficient for them and therefore there is no check
for block_last_index for them), but this does not happen at all.
Add an assert for this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
fee9520716 avcodec/rv10: Remove write-only assignments
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
eb0beffcb3 avcodec/h261dec: Don't set framerate multiple times
Just do it once during init.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
9933dfe103 avcodec/h261dec: Simplify decoding motion vectors
Don't use a LUT to negate followed by a conditional ordinary
negation immediately thereafter. Instead fold the two.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
f793074784 avcodec/h261dec: Unquantize coefficients while parsing them
This is beneficial for performance: When concatenating
the file from the vsynth1-h261 fate-test 100 times,
performance (measured by timing the codec's decode callback)
improved by 9.6%.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
1745d12d67 avcodec/h261enc, msmpeg4: Avoid setting dc_scale_tables unnecessarily
It is unnecessary because ff_mpeg1_dc_scale_table is the default
for both dc_scale_tables.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
65d5ccb808 avcodec/mpeg_er: Don't set block_index unnecessarily
ff_init_block_index() sets MpegEncContext.dest and
MpegEncContext.block_index. The latter is unused by
ff_mpv_reconstruct_mb() (which is what this code is
preparatory for) and dest is overwritten a few lines below.
So don't initialize block_index at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
c41818dc5d avcodec/mpeg4videodec: Don't initialize unused inter_scantable
inter_scantable is only used by the dct_unquantize_h263_inter
functions, yet this is not used by the MPEG-4 decoder at all
(in case H.263 quantization is used, the unquantization already
happens in mpeg4_decode_block()).

Also move the common initialization of ff_permute_scantable()
out of the if.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
0f92fecebb avcodec/mpv_reconstruct_mb_template: Optimize WMV2 code away if possible
The WMV2 decoder does not support lowres, so one can optimize
the WMV2 specific code away in the lowres version of this function.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
f694db87ca avcodec/mpegvideo: Join loops when initializing ScanTable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
66709df403 avcodec/mpegvideo_dec: Remove unnecessary FFMIN
No mpegvideo-based decoder supports lowres > 3,
so the FFMIN here are unnecessary.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
2e5287e519 avcodec/mpv_reconstruct_mb_template: Optimize always-true branch away
There are only two mpegvideo decoders that use another
(software) pixel format than YUV420: MPEG-1/2 and
the MPEG-4 studio profile. Neither of these use this part
of the code, so one can optimize the 422 code away when
this code is compiled for the decoder.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
c1097556c7 avcodec/h261dec: Simplify decoding GOB header
h261_resync() can be completely removed, because
h261_decode_gob_header() checks for a GOB header itself if
gob_start_code_skipped is zero.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:39 +02:00
Andreas Rheinhardt
18b059f208 avcodec/h261dec: Fix UB NULL + 0, remove broken resync code
last_resync_gb is never initialized, causing NULL + 0
in align_get_bits(). In addition to that, the loop is never
entered.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-20 18:58:38 +02:00