Write ICC profiles as TIFF UNDEFINED data and align all out-of-line IFD values to a word boundary. Account for non-empty ICC side data while allocating the packet and calculate the image size in checked 64-bit arithmetic.
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
The MOV demuxer retains tmcd timecode flags in codec extradata, but copied
tracks never initialize MOVTrack.timecode_flags. mov_write_tmcd_tag()
therefore writes zero when reconstructing the sample description, causing
unchanged frame counters to be interpreted as non-drop-frame.
Initialize the complete flags field from sample-description extradata for
copied tmcd tracks. fate-copy-trac236 covers three drop-frame tmcd tracks.
Fixes issue #20841.
Reported-by: unsword01 <unsword01@noreply.code.ffmpeg.org>
Signed-off-by: Théo Valette <315040668+theovalette@users.noreply.github.com>
A status line carrying no HTTP version parsed as status code 0, which
check_http_code() then accepted as a success: the body of an error reply, or of
a reply from something that is not an HTTP server at all, was handed to the
demuxer. strtol() was equally lenient about the code itself, accepting a sign,
a count of digits other than three, and a value outside the range HTTP defines.
Parse the grammar RFC 9112 actually specifies: a case sensitive "HTTP/"
followed by DIGIT "." DIGIT, then exactly three digits on a whitespace
boundary, and reject a code outside the 100-599 range of RFC 9110 section 15.
A status line with no reason phrase at all, "HTTP/1.1 200", stays accepted; the
separator RFC 9112 requires there is missing often enough in the wild.
reason now points at the phrase itself rather than at the separator before it,
so check_http_code() no longer has to skip that separator on its own.
Worth noting: this invalidates several class of previously accepted
invalid http responses, include the ICY responses class from legacy
shoutcast servers.
ICY responses are planned on being re-introduced as opt-in via the new
libcurl HTTP stack.
Covers well formed status lines, a missing or non numeric status code, lines
that do not start with an HTTP version, and status lines whose version or code
does not respect the grammar of RFC 9112.
The reference output records the current behavior: every one of those malformed
lines is accepted, most of them as a 2xx success.
Test av_frame_side_data_desc and av_frame_side_data_name on
valid and invalid types, av_frame_side_data_get and its _c
variant for present and absent types,
av_frame_side_data_remove (including MULTI types with
duplicates), av_frame_side_data_remove_by_props filtering by
AV_SIDE_DATA_PROP_*, av_frame_side_data_clone with and without
AV_FRAME_SIDE_DATA_FLAG_REPLACE (including the AVERROR(EEXIST)
and AVERROR(EINVAL) paths) and with AV_FRAME_SIDE_DATA_FLAG_UNIQUE,
av_frame_side_data_add in move mode, with
AV_FRAME_SIDE_DATA_FLAG_NEW_REF and with
AV_FRAME_SIDE_DATA_FLAG_REPLACE over an existing entry, and
av_frame_side_data_free.
Coverage for libavutil/side_data.c: 72.14% -> 86.43%
Numbers measured against a full FATE run. Remaining uncovered
lines are internal allocation-failure error paths requiring
injected failures mid-operation.
Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
Test av_dynamic_hdr_plus_alloc, av_dynamic_hdr_plus_create_side_data,
av_dynamic_hdr_plus_to_t35 in all three documented modes (size
query, caller-allocated, existing caller-owned buffer) including
the AVERROR_BUFFER_TOO_SMALL path, and av_dynamic_hdr_plus_from_t35
as a round-trip inverse.
Two HDR10+ fixtures are used. The first is a conforming
ST 2094-40:2020 ApplicationVersion 1 payload: one processing
window, the nine distribution maxrgb percentiles required by
section 8.5.4, and neither actual-peak-luminance item nor
ColorSaturationWeight, both excluded for that version by section
9.4. The second is marked in the source as deliberately
non-conforming and exists only to reach the optional
serializer/parser branches: a second processing window with its
geometry, both actual-peak-luminance matrices, per-window tone
mapping and color saturation. Every field either fixture
populates is decoded and printed, so a serializer or parser that
drops or corrupts a value changes the reference rather than
passing a flag-only check.
Also test that av_dynamic_hdr_plus_to_t35 ignores
application_version and always writes the CTA-861-H value, the
NULL and oversized error paths, and
av_dynamic_hdr_smpte2094_app5_alloc,
av_dynamic_hdr_smpte2094_app5_create_side_data and the App5
to_t35 / from_t35 round trip over four fixtures covering both
early-out paths (no adaptive tone map, reference-white tone
mapping) and both sides of the component mixing and gain curve
selectors: per-image parameters with component mixing type 3 and
explicit control point slopes, and common parameters shared from
alternate 0 with a mixing type other than 3 and the pchip slope.
The App5 to_t35 validation failures and the OOM paths via
av_max_alloc are covered as well.
Coverage for libavutil/hdr_dynamic_metadata.c: 31.02% -> 95.53%
The baseline comes from the HDR10+ sample tests on a full FATE
run (fate-hevc-hdr10-plus-metadata, fate-png-mdcv and the
Matroska/WebM HDR10+ remux tests).
Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
Test av_downmix_info_update_side_data() including first-call
allocation with zero-initialized defaults, field write/read-back,
second-call reuse (same pointer, preserved values), and the OOM
path via av_max_alloc.
Coverage for libavutil/downmix_info.c: 100.00% -> 100.00%
On a full FATE run the file is already covered by the AC-3
decoder tests (fate-ac3-4.0 and friends), which require
FATE_SAMPLES. This test exercises the API directly and keeps the
file covered on builds that run without samples.
Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
Test av_get_pix_fmt / av_get_pix_fmt_name round-trip across all
pixel formats, av_color_{range,primaries,transfer,space}_name,
av_chroma_location_name and av_alpha_mode_name round-trips
through their from_name() counterparts using a name-equivalence
check (two enum values may legitimately share the same name
string), av_chroma_location_enum_to_pos and pos_to_enum
round-trip across all valid chroma locations, and iterate every
pixel format printing av_get_padded_bits_per_pixel and
av_pix_fmt_count_planes.
Coverage for libavutil/pixdesc.c: 83.63% -> 90.03%
Numbers measured against a full FATE run. Remaining uncovered
lines are av_get_pix_fmt_string, the av_get_pix_fmt_loss /
av_find_best_pix_fmt_of_2 public wrappers and a few loss
branches, the palette branches of av_read_image_line and
av_write_image_line, and the *_ext name lookups in
av_color_{primaries,transfer}_from_name.
Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
the encoder always formed the stereo coupling channel as L+R and disabled phsflginu, which could cancel strongly out-of-phase bands before quantization. use an L-R carrier and signal the phase flag only when difference energy dominates in every coupling block, while quiet and ambiguous bands retain the existing L+R path. this reduces the multitone fate stddev from about 1158 to 588.
Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
use the resolved luma scaler for the log. keep the SWS_BICUBLIN description only when chroma is actually bilinear.
add coverage for scaler_sub overrides and the missing FATE dependency. this fixes the incorrect scaler output reported in #23975.
Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
Commit 74705b3970 changed to only
compile some of the checkasm source files when they are expected
to be non-empty, but the condition for when perf/macos_kperf.c
is needed is wrong, breaking building checkasm in default macos
aarch64 configurations.
Checkasm decides whether to enable the macos kperf codepaths on
its own, irrespective of ffmpeg's configure's --enable-macos-kperf
(which defaults to disabled) - see the end of checkasm's
src/perf_internal.h for the condition:
#if defined(__APPLE__) && ARCH_AARCH64
/* This only depends on <dlfcn.h>, and isn't needed on other architectures. */
#define HAVE_MACOS_KPERF 1
#else
#define HAVE_MACOS_KPERF 0
#endif
To approximate this, build macos_kperf.c for any aarch64 target.
For non-macOS cases, perf_internal.h defines inline functions in
most aarch64 build configurations, so we don't end up with an
empty translation unit in any case.
ID3v2 writes the tag size by seeking back to its header. This fails after output has been flushed to a non-seekable AVIO context, leaving a zero-sized tag. Attached pictures expose this reliably; sufficiently large metadata is affected too.
Build the tag in a dynamic buffer for non-seekable MP3 outputs and copy it after finalization. Keep the direct path for seekable outputs.
Fixes: #23917
Signed-off-by: iSold Leo <s@qwqlog.com>
It doesn't use any internals of lavc. Converting it to an API
test tool reduces disk usage for shared builds.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
the ir option may exceed nbirs because its static range is independent
of the configured number of impulse responses. init() only clamps
prev_selir, leaving selir able to index ctx->inputs out of range.
with the default nbirs=1, afir=ir=1 reads ctx->inputs[2] and crashes.
clamp selir like process_command() and add a fate test.
Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
Apple encoders do not write the LAME extension of the Xing tag, so the
files they produce get no gapless handling at all and no exact duration
either, the sample used here carrying no VBR tag whatsoever.
Contrary to the LAME tag, the iTunSMPB priming count already includes the
decoder delay, so apply it as is, the way the mov demuxer already does,
and validate it against the three counts adding up to what the frames
decode to.
The gapless() helper decodes through the wav muxer into the md5 protocol,
neither of which FRAMECRC requires, and ffprobe_demux reads the sample
through the file protocol, against a reference that covers the sample
format the mp3 decoder picked.
The float decoder dequantized spectral coefficients into an int32_t
buffer using mantissa >> exponent. This discarded the fractional part
before conversion to float and substantially raised the dither noise
floor for low-level coefficients.
Store decoded coefficients as INTFLOAT and apply 2^-exponent directly
in the floating-point path. Keep the fixed-point decoder unchanged, and
perform coupling, rematrixing and final scaling in the native type.
This also removes the now-unused fmtconvert dependency. Add a synthetic
FATE test that measures the corrected dither level. Existing PCM
references remain within one sample except fate-ac3-2.0, whose measured
maximum difference is two samples.
Fixes#23684.
ac-3 cores and dependent e-ac-3 substreams may use different
coefficient scales while owning separate delay slots.
the global reset added in 5ba2a2c841 cleared both sets of slots on
every substream switch, corrupting the mdct overlap of valid 7.1
streams.
track the scale per substream and clear only its own delay slots when
it changes. add a fate test using the existing the_great_wall sample.
Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
Clip integer expression results in the double domain before storing them. This keeps high-bit-depth samples within their declared range and gives NaN and infinities defined behavior while preserving float formats.
Fixes issue #24121.
Some parts of it benefit from wider registers:
vp8_luma_dc_wht_c: 22.7
vp8_luma_dc_wht_sse: 14.7 ( 1.55x)
vp8_luma_dc_wht_sse2: 13.2 ( 1.73x)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Add the same features as the framehash muxer.
This makes it much more useful as it prints important information that some
tests may need where framehash is not an option given it prints too many lines
(e.g., samples with tons of frames where timestamps or packet flags are
irrelevant, and just a single hash is enough).
Signed-off-by: James Almer <jamrial@gmail.com>
This is possible because it only uses the public API;
and beneficial when using shared builds (as not all
the internals of lavf are linked statically in the binary).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Empty translation units are actually invalid C that compilers
happen to accept (but warn about when using -pedantic).
In any case, they are unnecessary, so don't build them.
Reviewed-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Convert hevc_add_residual_4_10 to use SSE2 and remove declare_func_emms
in test code.
hevc_add_res_4x4_10_c: 21.7
hevc_add_res_4x4_10_mmxext: 9.4 ( 2.31x)
hevc_add_res_4x4_10_sse2: 9.2 ( 2.35x)
Signed-off-by: Zuxy Meng <zuxy.meng@gmail.com>
custom layouts containing AV_CHAN_UNUSED were rejected by
swr_build_matrix2().
accept unused channels in input and output layouts. preserve their
physical positions, clear input columns, and leave output rows silent.
add fate coverage for both cases. this fixes#24094.
Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
Otherwise, if running both ttadsp and ttaencdsp tests in the same
checkasm run, we get failures as the two functions don't match.
This fixes running the "checkasm" binary without any "--test"
parameter.
A COMM frame carries both a language and a short content descriptor, so its
only unambiguous metadata key is "comment-<descriptor>-<lang>", while the
extra export of the bare descriptor as a key silently overrides a real tag
whenever the descriptor matches a known tag name such as "album".
Restrict that legacy export to the container-level ID3v2 tag of callers that
ask for it through the new AVFMT_FLAG_LEGACY_ID3V2_COMM_KEYS flag (-fflags
+legacy_id3v2_comm_keys), which is deprecated along with
FF_API_OLD_ID3V2_COMMENT and only exists to give those callers a transition
path.