[FFmpeg-devel] [PATCH v2 1/3] swscale: use 16-bit intermediate precision for RGB/XYZ conversion

Michael Niedermayer michael at niedermayer.cc
Wed Dec 25 01:33:45 EET 2024


On Mon, Dec 23, 2024 at 01:26:33PM +0100, Niklas Haas wrote:
> From: Niklas Haas <git at haasn.dev>
> 
> The current logic uses 12-bit linear light math, which is woefully insufficient
> and leads to nasty postarization artifacts. This patch simply switches the
> internal logic to 16-bit precision.
> 
> This raises the memory requirement of these tables from 32 kB to 272 kB.
> 
> All relevant FATE tests updated for improved accuracy.
> 
> Fixes: ticket 4829
> Signed-off-by: Niklas Haas <git at haasn.dev>
> Sponsored-by: Sovereign Tech Fund
> ---
>  libswscale/swscale.c                     | 16 ++++++++--------
>  libswscale/swscale_internal.h            |  8 ++++----
>  libswscale/utils.c                       | 19 ++++++++++++-------
>  tests/ref/fate/filter-pixdesc-xyz12be    |  2 +-
>  tests/ref/fate/filter-pixdesc-xyz12le    |  2 +-
>  tests/ref/fate/filter-pixfmts-copy       |  4 ++--
>  tests/ref/fate/filter-pixfmts-crop       |  4 ++--
>  tests/ref/fate/filter-pixfmts-field      |  4 ++--
>  tests/ref/fate/filter-pixfmts-fieldorder |  4 ++--
>  tests/ref/fate/filter-pixfmts-hflip      |  4 ++--
>  tests/ref/fate/filter-pixfmts-il         |  4 ++--
>  tests/ref/fate/filter-pixfmts-null       |  4 ++--
>  tests/ref/fate/filter-pixfmts-scale      |  4 ++--
>  tests/ref/fate/filter-pixfmts-transpose  |  4 ++--
>  tests/ref/fate/filter-pixfmts-vflip      |  4 ++--
>  tests/ref/pixfmt/gbrp-xyz12le            |  2 +-
>  tests/ref/pixfmt/gbrp10-xyz12le          |  2 +-
>  tests/ref/pixfmt/gbrp12-xyz12le          |  2 +-
>  tests/ref/pixfmt/rgb24-xyz12le           |  2 +-
>  tests/ref/pixfmt/rgb48-xyz12le           |  2 +-
>  tests/ref/pixfmt/xyz12le                 |  2 +-
>  tests/ref/pixfmt/yuv444p-xyz12le         |  2 +-
>  tests/ref/pixfmt/yuv444p10-xyz12le       |  2 +-
>  tests/ref/pixfmt/yuv444p12-xyz12le       |  2 +-
>  24 files changed, 55 insertions(+), 50 deletions(-)

better quality ++
LGTM

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"You are 36 times more likely to die in a bathtub than at the hands of a
terrorist. Also, you are 2.5 times more likely to become a president and
2 times more likely to become an astronaut, than to die in a terrorist
attack." -- Thoughty2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20241225/c2cc56d7/attachment.sig>


More information about the ffmpeg-devel mailing list