No description
Find a file
Niklas Haas 603334a043 avfilter/vf_premultiply: use correct premultiplication formula
The previous formula was introduced without justification in 6e713841e8,
and the only thing Paul had to say about it over IRC was that it was copied
from an unspecified source on the internet.

I decided to do some testing and came to the conclusion that this term not
only produces "illegal" files, but also lowers PSNR score, over the naive
implementation without this extra term.

Here are the results of a round-trip test, using allrgb/allyuv (respectively)
as the input, and fade=alpha=yes:n=256 to cycle through every possible alpha
value, comparing the round-trip output against the input:

Before patch:
  PSNR r:26.677431 g:26.677431 b:26.677431 a:inf average:27.926818 min:6.012093 max:55.400791
  PSNR y:26.677431 u:21.101981 v:21.101981 a:inf average:23.548981 min:9.013835 max:53.182303 (full)
  PSNR y:27.348055 u:21.101981 v:21.101981 a:inf average:23.625238 min:9.554991 max:45.652221 (limited)

After patch:
  PSNR r:27.321996 g:27.321996 b:27.321996 a:inf average:28.571384 min:6.012093 max:52.424553
  PSNR y:27.321996 u:23.187879 v:23.187879 a:inf average:25.431773 min:9.013835 max:50.199232 (full)
  PSNR y:27.868544 u:23.187879 v:23.187879 a:inf average:25.515660 min:9.554991 max:45.078298 (limited)

It's worth pointing out that previous version sometimes artificially inflates
PSNR by producing values that are too high (i.e. RGB > A), such as for the
input pair (R = 255, A = 2) which should give R = 2, but actually gives R = 3
under the old logic.

As a second evaluation without this shortcoming, here is a comparison against
the reference value computed with a floating point format:

Before patch:
  PSNR r:53.600599 g:53.957833 b:53.540948 a:inf average:54.945316 min:50.508901 max:inf (premul only)
  PSNR r:30.734183 g:30.734183 b:30.734183 a:inf average:31.983570 min:12.058264 max:inf (round-trip)

After patch:
  PSNR r:61.751104 g:65.239091 b:61.339191 a:inf average:63.710714 min:55.441130 max:inf (premul only)
  PSNR r:32.611851 g:32.611851 b:32.611851 a:inf average:33.861238 min:12.058264 max:inf (round-trip)
2025-07-28 10:56:10 +02:00
.forgejo forgejo/workflows: use explicit token with issue write permission 2025-07-26 19:36:56 +02:00
compat compat/cuda: add device side printf function 2025-05-14 22:08:33 +02:00
doc lavu: add av_scanf_format() and use it on av_sscanf() 2025-07-22 01:35:01 +02:00
ffbuild ffbuild: correctly silence and tag new css/html steps 2025-05-28 01:02:55 +02:00
fftools fftools/cmdutils: Add av_freep() to avoid memory leak 2025-07-20 01:05:22 +02:00
libavcodec avcodec/dovi_rpudec: skip unknown ext blocks instead of erroring out 2025-07-27 12:16:00 +00:00
libavdevice avdevice/android_camera: Set image linesize aligment to 1 2025-07-18 10:37:53 +08:00
libavfilter avfilter/vf_premultiply: use correct premultiplication formula 2025-07-28 10:56:10 +02:00
libavformat avformat/mxfenc: Ensure frame offset in valid range 2025-07-26 21:04:57 +08:00
libavutil avutil/hmac: avoid calling functions through pointer of invalid type 2025-07-22 19:56:34 +02:00
libswresample swresample/rematrix: Constify 2025-07-03 18:17:56 +02:00
libswscale swscale/lut3d: remove unused function 2025-07-22 19:56:34 +02:00
presets
tests tests/checkasm: add check for vf_colordetect 2025-07-21 18:10:26 +02:00
tools tools/pktdumper: dump extradata buffers 2025-07-01 16:45:08 +10:00
.gitattributes gitattributes: End merge conflicts in Changelog 2025-03-17 15:26:10 +01:00
.gitignore forgejo/workflows: add initial rudimentary CI 2025-07-22 20:06:20 +02:00
.mailmap mailmap: add entry for myself 2024-07-15 01:59:37 +02:00
Changelog Changelog: add entry for vf_colorfilter addition 2025-07-21 17:04:45 -03:00
configure configure: suppress Wmicrosoft-enum-forward-reference 2025-07-22 19:56:34 +02:00
CONTRIBUTING.md
COPYING.GPLv2
COPYING.GPLv3
COPYING.LGPLv2.1
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 Add tools/merge-all-source-plugins 2025-05-15 12:17:04 +02:00
LICENSE.md Remove libpostproc 2025-05-07 15:35:47 +02:00
MAINTAINERS MAINTAINERS: add myself 2025-07-15 00:59:46 +02:00
Makefile Makefile: Split ALLFFLIBS 2025-05-26 20:33:10 +02:00
README.md README: fix typo and description of libavfilter 2021-10-08 09:44:34 +05:30
RELEASE RELEASE: update release number after release/7.1 branch 2024-10-09 01:55:50 +02: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.