View Full Version : Color banding and noise removal
tormento
23rd March 2018, 13:58
Am I wrong or dither is one of the most used plugin and yet with old AVS 2.5 API?
@pinterf and @all
A refresh would be welcome. Last version is AFAIK 1.27.2 from 2015.
DJATOM
6th April 2018, 10:41
Am I wrong or dither is one of the most used plugin and yet with old AVS 2.5 API?
@pinterf and @all
A refresh would be welcome. Last version is AFAIK 1.27.2 from 2015.
https://mega.nz/#!f4sHXYgQ!Hf-5Di0ymJIiMko2XlB8YSsqtkNbedSe9Bn4CkPyRO4 I just made both win32 and x64 versions with AvisynthPluginInit3. If you know valid up-to-date mt modes for dither, I can add them internally.
tormento
6th April 2018, 10:46
I just made both win32 and x64 versions with AvisynthPluginInit3.
:thanks:
If you know valid up-to-date mt modes for dither, I can add them internally.
I use external MT with AVS+ (if I've correctly understood your question).
SetFilterMTMode("DEFAULT_MT_MODE", 2)
…
Prefetch(6)
DJATOM
6th April 2018, 10:53
# Filters from Dither 1.25.0. Tested by Firesledge (not extensively though)
SetFilterMTMode ("DitherPost", MT_NICE_FILTER)
SetFilterMTMode ("SmoothGrad", MT_NICE_FILTER)
SetFilterMTMode ("Dither_box_filter16", MT_NICE_FILTER)
SetFilterMTMode ("Dither_bilateral16", MT_NICE_FILTER)
SetFilterMTMode ("Dither_limit_dif16", MT_NICE_FILTER)
SetFilterMTMode ("Dither_resize16", MT_NICE_FILTER)
SetFilterMTMode ("Dither_out", MT_NICE_FILTER)
SetFilterMTMode ("Dither_removegrain16", MT_NICE_FILTER)
SetFilterMTMode ("Dither_repair16", MT_NICE_FILTER)
SetFilterMTMode ("Dither_median16", MT_NICE_FILTER)
SetFilterMTMode ("Dither_add16", MT_NICE_FILTER)
SetFilterMTMode ("Dither_sub16", MT_NICE_FILTER)
SetFilterMTMode ("Dither_max_dif16", MT_NICE_FILTER)
SetFilterMTMode ("Dither_merge16", MT_NICE_FILTER)
It was in my MtModes.avsi, but Idk if that's up-to-date.
tormento
6th April 2018, 10:57
It was in my MtModes.avsi, but Idk if that's up-to-date.
Never had problems with mode 2.
DJATOM
6th April 2018, 11:07
Mode 2 will eat more RAM, so it's better to stick with mode 1 if possible. Anyway new build (now with sources), with mt mode 1 declared internally: https://mega.nz/#!CtcRVLgZ!qzrTRjvu9IGCoembfyf6oPkjj5-tqfWniOrbuG_lmjY
GMJCZP
6th April 2018, 12:52
Thanks DJATOM for the new paint job!
tormento
11th April 2018, 21:51
@DJATOM
I gave a try to your latest build of dither and it gives me error.
Script:
SetMemoryMax(8000)
SetFilterMTMode("DEFAULT_MT_MODE", 2)
LoadPlugin("D:\eseguibili\media\DGDecNV\x64\DGDecodeNV.dll")
DGSource("E:\in\2_00 Fuga di mezzanotte\fuga.dgi")
#CompTest(1)
SMDegrain (tr=6, thSAD=400, refinemotion=false, lsb=true, mode=0, contrasharp=false, PreFilter=4, truemotion=false, plane=4, chroma=true)
Prefetch(6)
Gives me the error:
[2018-04-11][22:44:18] Simple x264 Launcher (Build #1124), built 2018-02-27
[2018-04-11][22:44:18]
[2018-04-11][22:44:18] Job started at 2018-04-11, 22:44:18.
[2018-04-11][22:44:18]
[2018-04-11][22:44:18] Source file : E:\in\2_00 Fuga di mezzanotte\fuga_6_lsb.avs
[2018-04-11][22:44:18] Output file : E:\in\2_00 Fuga di mezzanotte\fuga_6_lsb.mkv
[2018-04-11][22:44:18]
[2018-04-11][22:44:18] --- SYSTEMINFO ---
[2018-04-11][22:44:18]
[2018-04-11][22:44:18] Binary Path : D:\eseguibili\media\x264 launcher
[2018-04-11][22:44:18] Avisynth : Yes
[2018-04-11][22:44:18] VapourSynth : No
[2018-04-11][22:44:18]
[2018-04-11][22:44:18] --- SETTINGS ---
[2018-04-11][22:44:18]
[2018-04-11][22:44:18] Encoder : x264 (AVC/H.264), 64-Bit (x64), 8-Bit
[2018-04-11][22:44:18] Source : Avisynth (avs)
[2018-04-11][22:44:18] RC Mode : CRF
[2018-04-11][22:44:18] Preset : slow
[2018-04-11][22:44:18] Tuning : <None>
[2018-04-11][22:44:18] Profile : High
[2018-04-11][22:44:18] Custom : --level 4.1 --keyint 240 --aq-mode 2 --sar 1:1
[2018-04-11][22:44:18]
[2018-04-11][22:44:18] --- CHECK VERSION ---
[2018-04-11][22:44:18]
[2018-04-11][22:44:18] Detect video encoder version:
[2018-04-11][22:44:18]
[2018-04-11][22:44:18] Creating process:
[2018-04-11][22:44:18] "D:\eseguibili\media\x264 launcher\toolset\x64\x264_x64.exe" --version
[2018-04-11][22:44:18]
[2018-04-11][22:44:18] x264 0.155.2901 7d0ff22
[2018-04-11][22:44:18] (libswscale 5.0.101)
[2018-04-11][22:44:18] (libavformat 58.10.100)
[2018-04-11][22:44:18] (ffmpegsource 2.30.0.0)
[2018-04-11][22:44:18] built on Feb 26 2018, gcc: 7.3.0
[2018-04-11][22:44:18] x264 configuration: --chroma-format=all
[2018-04-11][22:44:18] libx264 configuration: --chroma-format=all
[2018-04-11][22:44:18] x264 license: GPL version 2 or later
[2018-04-11][22:44:18] libswscale/libavformat/ffmpegsource license: GPL version 2 or later
[2018-04-11][22:44:18]
[2018-04-11][22:44:18] Detect video source version:
[2018-04-11][22:44:18]
[2018-04-11][22:44:18] Creating process:
[2018-04-11][22:44:18] "D:\eseguibili\media\x264 launcher\toolset\x64\avs2yuv_x64.exe"
[2018-04-11][22:44:18]
[2018-04-11][22:44:18] Avs2YUV 0.24bm5
[2018-04-11][22:44:18]
[2018-04-11][22:44:18] > x264 revision: 2901 (core #155)
[2018-04-11][22:44:18] > Avs2YUV version: 0.24.5
[2018-04-11][22:44:18]
[2018-04-11][22:44:18] --- GET SOURCE INFO ---
[2018-04-11][22:44:18]
[2018-04-11][22:44:18] Creating process:
[2018-04-11][22:44:18] "D:\eseguibili\media\x264 launcher\toolset\x64\avs2yuv_x64.exe" -frames 1 "E:\in\2_00 Fuga di mezzanotte\fuga_6_lsb.avs" NUL
[2018-04-11][22:44:18]
[2018-04-11][22:44:20] error: System exception - Access Violation
[2018-04-11][22:44:20] (D:/Programmi/Media/AviSynth+/plugins64/SMDegrain-3.1.2�97.avsi, line 739)
[2018-04-11][22:44:20] (D:/Programmi/Media/AviSynth+/plugins64/SMDegrain-3.1.2�97.avsi, line 200)
[2018-04-11][22:44:20] (E:\in\2_00 Fuga di mezzanotte\fuga_6_lsb.avs, line 16)
[2018-04-11][22:44:20]
[2018-04-11][22:44:20] PROCESS EXITED WITH ERROR CODE: 1
Same script works fine with standard dither.dll
DJATOM
11th April 2018, 22:22
Yes, I forgot to add one line, fixed version (https://mega.nz/#!2wNGQLqD!3ZNAnfwb4HNljE5XE9ZbzrurVWqu1vs_QSMqXTHZzb4).
tormento
12th April 2018, 07:53
Yes, I forgot to add one line
Tested, working.
Dreamject
25th December 2018, 19:04
This topic is not active, I created new, but may be somebody can give me instruction to launch dither tools on PotPlayer https://forum.doom9.org/showthread.php?p=1861062
Sparktank
27th January 2019, 09:22
Now that AVS+ and avsresize are updated nicely, would it take much for someone to update this to accept non-stacked colorspaces or yuv420ps ?
I like the linear/sigmoid functions in this resizer, but find it tedious to keep converting to/from stacked.
I just might jump on VS for this plugin to resize in placebo-likeness.
Natty
4th March 2019, 09:41
can someone suggest me few ways to remove banding occured in few scenes after heavy denoising? i am just using this. but it doesn't remove banding completely.
f3kdb(preset="veryhigh", input_depth=16, output_depth=16)
ChaosKing
4th March 2019, 10:09
Try higher Y/cb/cr values and/or higher grain values.
https://f3kdb.readthedocs.io/en/latest/usage.html#cmdoption-arg-y
https://f3kdb.readthedocs.io/en/latest/presets.html
Natty
16th March 2019, 23:55
thanks. i found a stable setting :thanks:
LouieChuckyMerry
5th May 2019, 18:29
Happy Day!
TheProfosist
24th September 2019, 10:18
So I have been out of the game for some time (early pages of this thread ~2011) and dither is really having me scratch my head once again.
Im looking to output 4:4:4 10bit to x264. I have used dither in the past and do do this exact function however the younger me never took any notes so I am at a loss as to whats needed why and where. Below are two example scripts that I was hoping someone could help me dissect and figure out what was done is these and if that is still the best way to go about things. I would like to do the script a bit better like the second one making it easier to follow but would like to put together better notes and comments than the first one has. Im sure there are some plugins im missing that ill have to round up as well.
Xamd (should be 444): https://pastebin.com/f1c4vkWb
Beck (dither 16bit to 10bit): https://pastebin.com/7dGdpfyf
Ill have to grab some additional plugins as im definitely missing some that are in those scripts. Are the best files to use sill the ones in the beginning of the thread and their special mod16 versions or should I be looking into @DJATOM 's fixed version linked above? Git also has an updated version of dfttest. No idea it its compatible however.
Yes, I forgot to add one line, fixed version (https://mega.nz/#!2wNGQLqD!3ZNAnfwb4HNljE5XE9ZbzrurVWqu1vs_QSMqXTHZzb4).
thanks in advance for the help. Ill have the progress of the AVS script as well as the final one on pastebin once complete
DJATOM
24th September 2019, 17:21
@TheProfosist Applying debilinear onto entire source is bad idea. You will definitely mess up captions (they are applied onto source after upscaling), you must do some masking for them and resize with regular downscaler.
TheProfosist
26th September 2019, 15:02
@TheProfosist Applying debilinear onto entire source is bad idea. You will definitely mess up captions (they are applied onto source after upscaling), you must do some masking for them and resize with regular downscaler.
are you talking about
#TextSub("E:\TEMP\5cmPerSec\02 - Video\5cmPerSec JP RA Subs.ass")
if so its commented out so ignore that. Its just a remnant of modifying a script ive used before
what im wondering is the order of operations of using dither
in beck I used dfttest but I didnt in xamd
notes from the xamd script say "##dfttest (lsb=true) or whatever generating stack16 data"
I think i remember why I had crop in the first 16bit filters area and that was because if I needed to crop I also had to re-pad it to a mod 16 resolution
the other big difference in these scripts is the end.
Beck just has f3kdb
f3kdb(dither_algo=3, input_mode=1, input_depth=16, output_mode=1, output_depth=10)
where as Xamd has
SmoothGrad (radius=16, thr=0.25, elast=2)
ly = debilineary(960,540,lsb_inout=true)
lu = utoy8().dither_resize16(960,540,kernel="blackman",src_left=0.25,u=1,v=1)
lv = vtoy8().dither_resize16(960,540,kernel="blackman",src_left=0.25,u=1,v=1)
ytouv(lu,lv,ly)
## Finally DitherPost() or Dither_convey_yuv4xxp16_on_yvxx()
Dither_quantize(10, reducerange=true, mode=8)
Dither_convey_yuv4xxp16_on_yvxx()
if i recall correctly debilinear is what is up converting to 444
basically trying to figure out what I did and why which should aide me in using dither again. That is unless there is a better way to use this since its likely had updates since those AVS were written
DJATOM
26th September 2019, 20:48
No, I meant XamD source. It's upscaled from 540p and then OP/ED texts was applied onto it. So descaling will introduce artifacts on those captions.
TheProfosist
27th September 2019, 19:49
No, I meant XamD source. It's upscaled from 540p and then OP/ED texts was applied onto it. So descaling will introduce artifacts on those captions.
Ah well I can worry about that when I get the rest of the stuff working. Right now I dont have a specific source ill be using it on. Also back then it wasnt uncommon for me to use ordered chapters (i think thats the correct term) and clean op/ed if the anime allowed for it.
Right now im mostly interested in the flow of using dither. What you would use where are why. In that previous post I gave some examples. No clue if any of that is relevant anymore either since its been so long.
real.finder
12th February 2020, 13:00
in dither.avsi Dither_resize16nr Function I think there are bug in this line
sr_v = Float (height) / Float (src.height ())
the "Float (src.height ())" should be "Float (src.height ()/2)" since it's lsb stacked clip
find it when I was porting/mixing things to support HBD
here what I have for now, will add it later to ResizeX, any suggestions?
# base on Dither_resize16nr
Function sResizeXnr (clip src, int width, int height,
\ float "src_left",
\ float "src_top",
\ float "src_width",
\ float "src_height",
\ string "kernel",
\ int "taps",
\ float "a1",
\ float "a2",
\ string "cplace",
\ bool "luma",
\ bool "chroma",
\ bool "mt",
\ string "mt_params",
\ string "dither_params",
\ bool "desampling",
\ int "dither_mode",
\ bool "noring"
\ )
{
noring = Default (noring, true)
Assert (width > 0 && height > 0, "sResizeXnr: width and height must be > 0.")
sr_h = Float (width ) / Float (src.width () )
sr_v = Float (height) / Float (src.height ())
sr_up = max (sr_h, sr_v)
sr_dw = 1.0 / min (sr_h, sr_v)
sr = max (sr_up, sr_dw)
Assert (sr >= 1.0)
# Depending on the scale ratio, we may blend or totally disable
# the ringing cancellation
thr = 2.5
nrb = (sr > thr)
nrf = (sr < thr + 1.0 && noring)
nrr = (nrb) ? min (sr - thr, 1.0) : 1.0
nrv = (nrb) ? Round ((1.0 - nrr) * 255) * $010101 : 0
main = src.ResizeX (width, height,
\ src_left =src_left,
\ src_top =src_top,
\ src_width =src_width,
\ src_height=src_height,
\ kernel =kernel,
\ taps =taps,
\ a1 =a1,
\ a2 =a2,
\ cplace =cplace,
\ luma =luma,
\ chroma =chroma,
\ mt =mt,
\ mt_params =mt_params,
\ dither_params=dither_params,
\ desampling=desampling,
\ dither_mode=dither_mode
\ )
nrng = (nrf) ? src.ResizeX (width, height,
\ src_left =src_left,
\ src_top =src_top,
\ src_width =src_width,
\ src_height=src_height,
\ kernel ="gauss",
\ a1 =100,
\ cplace =cplace,
\ luma =luma,
\ chroma =chroma
\ ) : main
nrm = (nrb && nrf) ? main.BlankClip (color_yuv=nrv, height=main.Height()) : main
rgm = 1
rgc = (nrb) ? -1 : 0
ild = Defined(luma)
icd = Defined(chroma)
rgl = ild ? (luma ? rgm : rgc) : rgm
rgch = icd ? (chroma ? rgm : rgc) : rgm
y = ild ? luma ? 3 : 2 : 3
u = icd ? chroma ? 3 : 2 : 3
v = u
(nrf ) ? main.repair (nrng, rgl, rgch) : main
(nrf && nrb) ? mt_merge (main, last, nrm, y=y, u=u, v=v, luma=chroma) : last
}
real.finder
12th April 2020, 15:00
can we have port of vs fmtconv (https://forum.doom9.org/showthread.php?t=166504) to avs/avs+ with HBD? I try to update/port/rewrite crt_display to avs+ HBD then I see it use fh, fv in dither_resize16
and its not only for crt_display and "fh, fv", dither_resize16/fmtconv has many other things like kernel inversion mode and additional Kernels
tormento
12th April 2020, 15:33
can we have port of vs fmtconv (https://forum.doom9.org/showthread.php?t=166504) to avs/avs+ with HBD?
AVSResize wouldn't fit?
real.finder
12th April 2020, 15:42
AVSResize wouldn't fit?
it's not https://forum.doom9.org/showthread.php?p=1906754#post1906754
https://i.postimg.cc/hzgKxtwq/Untitled.png (https://postimg.cc/hzgKxtwq)
cretindesalpes
7th October 2020, 14:25
Dither 1.28.0 (http://forum.doom9.org/showthread.php?p=1386559#post1386559):
Added Dither_lutspa8 and Dither_lutspa16.
Fixed height issue in Dither_resize16nr. Thanks to real.finder for the report.
DLL recompiled with Visual C++ 2019.
kedautinh12
7th October 2020, 18:54
Dither 1.28.0 (http://forum.doom9.org/showthread.php?p=1386559#post1386559):
Added Dither_lutspa8 and Dither_lutspa16.
Fixed height issue in Dither_resize16nr. Thanks to real.finder for the report.
DLL recompiled with Visual C++ 2019.
Thanks
real.finder
8th October 2020, 06:33
Dither 1.28.0 (http://forum.doom9.org/showthread.php?p=1386559#post1386559):
Added Dither_lutspa8 and Dither_lutspa16.
Fixed height issue in Dither_resize16nr. Thanks to real.finder for the report.
DLL recompiled with Visual C++ 2019.
thanks, but is there any plan to support HBD in avs+ or port fmtconv to avs? since the HBD filters nowadays are way more than lsb ones and also there are float point in HBD of avs+
cretindesalpes
8th October 2020, 11:05
real.finder: sorry, there is no plan at the moment. I don’t do much video processing these days and have other projects with higher priority.
EDIT—another update:
MVTools 2.6.1.0 (http://forum.doom9.org/showthread.php?p=1386559#post1386559)
MSuper, MDegrain1/2/3/N: YV16 and YV24 colorspaces are supported for filtering. Analysis still requires YV12 or YUY2 clips.
FlowFPS, FlowInter and MMask: fixed a memory intialization bug that could produce slightly different results each run. Thanks to dubhater for the fix.
MAnalyse, MRecaculate: fixed block size parameter check in divide mode. Thanks again to dubhater.
MDepan: parameter zerow is now actually taken into account.
DLL recompiled with VC++ 2019, source files and projects modified accordingly.
EDIT—second update:
Dither was updated to v1.28.1. Fixed a regression in mode 20 of Dither_removegrain16.
tormento
17th February 2021, 19:17
Sorry to resurrect some old stuff but...
Is there any newer version of Dither?
I have checked 1.28.1 version and it's still a 2.5 plugin.
If positive, perhaps I have lost the release. Please address me ;)
real.finder
25th May 2021, 14:30
Regarding Dither modernization for HBD, I think it's impossible to do it as it now, After thinking and talking with people that do encode from long times, it's better to port dither_bilateral16 (it's seems work differently from the rest and as some friend said "it strikes a nice balance between strength and detail loss"), Dither_box_filter16 (same as dither_bilateral16 case), and SmoothGrad to independent plugins and backport fmtconv (https://forum.doom9.org/showthread.php?t=166504) (ported done https://forum.doom9.org/showthread.php?t=183139 thanks to cretindesalpes), if these done then we will not need dithertools anymore in avs+
kedautinh12
25th May 2021, 15:44
True, but no one backport it now
kedautinh12
29th May 2021, 02:40
I seen 299792458m update dfttest 1.9.6 of pinterf with new commits, can anyone compile it?? thanks
https://github.com/299792458m/dfttest_mod/commits/196
kedautinh12
5th June 2021, 15:22
New fork of fmtconv
https://github.com/AkarinVS/fmtconv
cretindesalpes
21st July 2021, 22:45
backport fmtconv (https://forum.doom9.org/showthread.php?t=166504) [...] in avs+
I’m currently working to make fmtconv easier to port to other standards. The bitdepth part requires the most work here. However I’m not sure if I’ll do the final port yet.
StainlessS
22nd July 2021, 00:22
I’m currently working to make fmtconv easier to port to other standards. The bitdepth part requires the most work here. However I’m not sure if I’ll do the final port yet.
The pussycat is still alive, we are all happy to hear that,
live long and prosper CD. [OK you made some recent posts too, I did not miss all of them].
GMJCZP
22nd July 2021, 01:12
The pussycat is still alive, we are all happy to hear that,
live long and prosper CD. [OK you made some recent posts too, I did not miss all of them].
+1, Thanks cretindesalpes for your contributions.
real.finder
22nd July 2021, 05:24
I’m currently working to make fmtconv easier to port to other standards. The bitdepth part requires the most work here. However I’m not sure if I’ll do the final port yet.
good news, thanks! if you have time can you port dither_bilateral16, Dither_box_filter16 and SmoothGrad to independent plugins with new appropriate names and HBD?
kedautinh12
28th October 2021, 23:57
DFTTest latest ver
https://github.com/pinterf/dfttest/releases
kedautinh12
20th April 2023, 13:38
Updated dither - 1.28.1.1 x64 from Asd-g: updated to 2.6 plugin, added support for passthrough frame properties
https://gitlab.com/uvz/AviSynthPlus-Plugins-Scripts/-/blob/master/plugins64%2B/dither.dll
real.finder
17th July 2023, 04:09
if you have time can you port dither_bilateral16, Dither_box_filter16 and SmoothGrad to independent plugins with new appropriate names and HBD?
for now I think we only miss Dither_bilateral16 alternative
Dither_box_filter16 and Dither_bilateral16 https://forum.doom9.org/showthread.php?p=1951312&highlight=dither_bilateral16#post1951312
SmoothGrad https://forum.doom9.org/showthread.php?p=1952859&highlight=Dither_box_filter16#post1952859
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.