Thread: Avisynth+
View Single Post
Old 25th June 2016, 19:53   #1834  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,314
O.K.

Still smdegrain.avsi, Dither_Luma_Rebuild

Replaced the line with 56064 (219*256) with 61184 (239*256)
(and the 219 with 239 but it does not play now).
The artifact disappeared.

There is another thing that may not be intentional:
Code:
String(lsb?65536:255)
For me 65535 would be more logical, but I'm far from fluently reading the avisynth expression syntax

Code:
function Dither_Luma_Rebuild (clip src, float "s0", float "c",int "uv", bool "lsb", bool "lsb_in", bool "lsb_out", int "mode", float "ampn", bool "slice"){
lsb_in  = Default( lsb_in  ,false)
lsb_out = Default( lsb_out ,false)
lsb     = Default( lsb     ,lsb_in || lsb_out)
mode    = Default( mode ,6)
uv      = Default(uv,    3)
s0      = Default(s0,  2.0)
c       = Default(c,  1.0/16)
ampn    = Default(ampn, 0.0)
slice   = Default(slice, true)

    k = (s0 - 1) * c
    t = lsb_in ? "x 4096 - 61184 / 0 1 clip" : "x 16 - 239 / 0 1 clip"
#    t = lsb_in ? "x 4096 - 56064 / 0 1 clip" : "x 16 - 219 / 0 1 clip"
    e = String(k)+" "+String(1+c)+" "+String((1+c)*c)+" "+t+" "+String(c)
\       +" + / - * "+t+" 1 "+String(k)+" - * + "+String(lsb?65536:255)+" *"
src
lsb ? (lsb_in ? Dither_lut16 (yexpr=e,expr="x 32768 - 32768 * 28672 / 32768 +",y=3, u=uv, v=uv)   : \
                Dither_lut8  (yexpr=e,expr="x 128 - 32768 * 112 / 32768 +"    ,y=3, u=uv, v=uv))  : \
                mt_lut       (yexpr=e,expr="x 128 - 128 * 112 / 128 +"        ,y=3, u=uv, v=uv)
lsb_out ? last : (lsb ? Ditherpost(mode=mode,ampn=ampn,slice=slice,staticnoise=ampn!=0.0?true:false,u=uv,v=uv) : last)}
I don't know what is the right constant there, the creators of this script can correct it for the right value.

Last edited by pinterf; 25th June 2016 at 19:54. Reason: correction
pinterf is offline