Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#8971 closed defect (invalid)

Contrast Adaptive Sharpening (CAS) is broken

Reported by: lextra2 Owned by:
Priority: normal Component: avfilter
Version: unspecified Keywords: CAS
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

The Contrast Adaptive Sharpening filter is broken. It causes chroma artefacts.

I used the following command:

ffmpeg.exe -i input.png -vf cas=1 outputFFMPEG.png

The build version was this:

ffmpeg version 4.3.1-2020-11-08-full_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10.2.0 (Rev3, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100

When used on this image
I get this output

Meanwhile, when using the following command with CasCmdLine.exe

CasCmdLine.exe -Sharpness 1 -FP16 input.png outputCAS.png

I get the correct output.

Please note, the artifacts (with FFMPEG) are even worse when used on a video file, instead of an image.

Change History (5)

comment:1 by Carl Eugen Hoyos, 3 years ago

Component: ffmpegavfilter
Keywords: Contrast Adaptive Sharpening removed

Is the issue you see reproducible with current FFmpeg git head?

in reply to:  1 comment:2 by lextra2, 3 years ago

Replying to cehoyos:

Is the issue you see reproducible with current FFmpeg git head?

I have no setup to build from git myself.
So on Windows I'm stuck with using builds from the following two sources:

Windows builds from gyan.dev
Tested:
https://www.gyan.dev/ffmpeg/builds/
4.3.1-2020-11-08
2020-11-11-git-89429cf2f2

Windows builds by BtbN
Tested:
https://github.com/BtbN/FFmpeg-Builds/releases/tag/autobuild-2020-11-11-13-23
ffmpeg-N-99900-g89429cf2f2-win64-gpl.zip
ffmpeg-N-99900-g89429cf2f2-win64-gpl-vulkan.zip

Since 3 of these builds are from today, I'd assume the issue is still present in the most current git.

Last edited 3 years ago by lextra2 (previous) (diff)

comment:3 by Elon Musk, 3 years ago

Resolution: invalid
Status: newclosed

You are not supposed to ever use exact 1. value.

in reply to:  3 comment:4 by lextra2, 3 years ago

Replying to richardpl:

You are not supposed to ever use exact 1. value.

Well, then maybe it should be limited to 0.8? And I don't really get why the default strength is "0", effectively doing nothing.

comment:5 by Elon Musk, 3 years ago

I think it does something, last time I tried it. The ffmpeg variant interpolate between 16 and 4.01 while your linked code interpolates between 8 and 5.

Note: See TracTickets for help on using tickets.