No description
Find a file
Niklas Haas f6a2d41fe2 swscale/ops: keep track of correct dither min/max
Mostly, this just affects the metadata in benign ways, e.g.:

 rgb24 -> yuv444p:
   [ u8 +++X] SWS_OP_READ         : 3 elem(s) packed >> 0
     min: {0, 0, 0, _}, max: {255, 255, 255, _}
   [ u8 +++X] SWS_OP_CONVERT      : u8 -> f32
     min: {0, 0, 0, _}, max: {255, 255, 255, _}
   [f32 ...X] SWS_OP_LINEAR       : matrix3+off3 [...]
     min: {16, 16, 16, _}, max: {235, 240, 240, _}
   [f32 ...X] SWS_OP_DITHER       : 16x16 matrix + {0 3 2 -1}
-    min: {33/2, 33/2, 33/2, _}, max: {471/2, 481/2, 481/2, _}
+    min: {16.001953, 16.001953, 16.001953, _}, max: {235.998047, 240.998047, 240.998047, _}
   [f32 +++X] SWS_OP_CONVERT      : f32 -> u8
     min: {16, 16, 16, _}, max: {235, 240, 240, _}
   [ u8 XXXX] SWS_OP_WRITE        : 3 elem(s) planar >> 0
     (X = unused, z = byteswapped, + = exact, 0 = zero)

However, it surprisingly actually includes a semantic change, whenever
converting from limited range to monob or monow:

 yuv444p -> monow:
   [ u8 +XXX] SWS_OP_READ         : 1 elem(s) planar >> 0
     min: {0, _, _, _}, max: {255, _, _, _}
   [ u8 +XXX] SWS_OP_CONVERT      : u8 -> f32
     min: {0, _, _, _}, max: {255, _, _, _}
   [f32 .XXX] SWS_OP_LINEAR       : luma [...]
     min: {-20/219, _, _, _}, max: {235/219, _, _, _}
   [f32 .XXX] SWS_OP_DITHER       : 16x16 matrix + {0 -1 -1 -1}
-    min: {179/438, _, _, _}, max: {689/438, _, _, _}
+    min: {-0.089371, _, _, _}, max: {2.071106, _, _, _}
+  [f32 .XXX] SWS_OP_MAX          : {0 0 0 0} <= x
+    min: {0, _, _, _}, max: {2.071106, _, _, _}
   [f32 .XXX] SWS_OP_MIN          : x <= {1 _ _ _}
-    min: {179/438, _, _, _}, max: {1, _, _, _}
+    min: {0, _, _, _}, max: {1, _, _, _}
   [f32 +XXX] SWS_OP_CONVERT      : f32 -> u8
     min: {0, _, _, _}, max: {1, _, _, _}
   [ u8 XXXX] SWS_OP_WRITE        : 1 elem(s) planar >> 3
     (X = unused, z = byteswapped, + = exact, 0 = zero)

Note the presence of an extra SWS_OP_MAX, to correctly clamp sub-blacks
(values below 16) to 0.0, rather than underflowing. This was previously
undetected because the dither was modelled as adding 0.5 to every pixel value,
but that's only true on average - not always.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-03-29 12:13:11 +02:00
.forgejo forgejo/pre-commit/ignored-words: add re-use 2026-03-18 23:32:35 +00:00
compat compat: Fix .def file generation for ARM64EC builds on Windows 2025-12-19 10:01:16 +00:00
doc avfilter/af_whisper.c: Set split_on_word 2026-03-29 09:37:41 +00:00
ffbuild configure: add detection of assembler support for SME2 2026-03-04 23:52:36 +02:00
fftools fftools/ffmpeg_filter: fix the incomplete printing of reason for video filter graph reconfiguration 2026-03-29 09:34:23 +00:00
libavcodec avcodec/libdav1d: call ff_attach_decode_data() on output frames 2026-03-28 22:07:54 -03:00
libavdevice Bump versions for master after release/8.1 2026-03-08 02:31:23 +01:00
libavfilter avfilter/buffersrc: use 1 << n for flags (cosmetic) 2026-03-29 09:38:01 +00:00
libavformat avformat/matroskadec: remove unnecessary log 2026-03-29 00:08:26 -03:00
libavutil avutil/x86/aes: Only assemble iff HAVE_AESNI_EXTERNAL 2026-03-28 23:25:54 +01:00
libswresample Bump versions for master after release/8.1 2026-03-08 02:31:23 +01:00
libswscale swscale/ops: keep track of correct dither min/max 2026-03-29 12:13:11 +02:00
presets
tests swscale/ops: keep track of correct dither min/max 2026-03-29 12:13:11 +02:00
tools fuzzer: improve documentation 2026-03-14 21:36:58 +00:00
.gitattributes gitattributes: End merge conflicts in Changelog 2025-03-17 15:26:10 +01:00
.gitignore vulkan: support shader compression 2026-01-12 17:28:41 +01:00
.mailmap mailmap: add entry for myself 2025-08-08 21:51:15 +00:00
Changelog avformat/movenc: add support for LCEVC track muxing 2026-03-14 20:50:21 -03:00
configure configure: enable nasm debug information also for non-ELF targets 2026-03-26 00:25:29 +00:00
CONTRIBUTING.md CONTRIBUTING.md: Add Forgejo 2026-02-22 04:39:22 +00:00
COPYING.GPLv2
COPYING.GPLv3
COPYING.LGPLv2.1 all: fix whitespace/new-line issues 2025-08-03 13:48:47 +02:00
COPYING.LGPLv3
CREDITS Use https for repository links 2023-03-01 21:59:10 +01:00
FUNDING.json Add FUNDING.json 2025-06-23 14:48:40 +02:00
INSTALL.md all: fix typos found by codespell 2025-08-03 13:48:47 +02:00
LICENSE.md Remove libpostproc 2025-05-07 15:35:47 +02:00
MAINTAINERS MAINTAINERS: add myself to maintained modules and update CODEOWNERS 2026-03-14 15:18:22 +00:00
Makefile configure: add detection of assembler support for SME2 2026-03-04 23:52:36 +02:00
README.md
RELEASE RELEASE: update to 8.0 2025-08-14 08:42:29 -04:00

FFmpeg README

FFmpeg is a collection of libraries and tools to process multimedia content such as audio, video, subtitles and related metadata.

Libraries

  • libavcodec provides implementation of a wider range of codecs.
  • libavformat implements streaming protocols, container formats and basic I/O access.
  • libavutil includes hashers, decompressors and miscellaneous utility functions.
  • libavfilter provides means to alter decoded audio and video through a directed graph of connected filters.
  • libavdevice provides an abstraction to access capture and playback devices.
  • libswresample implements audio mixing and resampling routines.
  • libswscale implements color conversion and scaling routines.

Tools

  • ffmpeg is a command line toolbox to manipulate, convert and stream multimedia content.
  • ffplay is a minimalistic multimedia player.
  • ffprobe is a simple analysis tool to inspect multimedia content.
  • Additional small tools such as aviocat, ismindex and qt-faststart.

Documentation

The offline documentation is available in the doc/ directory.

The online documentation is available in the main website and in the wiki.

Examples

Coding examples are available in the doc/examples directory.

License

FFmpeg codebase is mainly LGPL-licensed with optional components licensed under GPL. Please refer to the LICENSE file for detailed information.

Contributing

Patches should be submitted to the ffmpeg-devel mailing list using git format-patch or git send-email. Github pull requests should be avoided because they are not part of our review process and will be ignored.