View Single Post
Old 17th September 2019, 03:05   #1  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Uglarm - Logo Interpolator/Blurrer v0.0 - 17 Sept 2019

Uglarm v0.0, logo blurring filter --- by StainlessS @ Doom9.
Req: VS 2008 Runtimes.

Guinea pigs required.

Code:
Uglarm v0.0, logo blurring filter  --- by StainlessS @ Doom9.

  Filter for blurring a logo, using LogoAway style Uglarm Interpolation method.
    Logo pixels interpolated from all non-clipped pixels surrounding the logo area,
    nearer pixels have more effect (governed by BlurPower).


Function Uglarm(clip c,                                             [* Avs v2.58 & v2.60 std supports YV12/YUY2/RGB32/RGB24 : Avs+ r2915+ also YV16, YV12, YV24, Y8 *]
        \ int LogoX,int LogoY,Int LogoW,Int LogoH,                  [* ALL coords can be -ve, where RHS/BOT relative, LogoW & LogoH can additionally be 0 where RHS/BOT relative*]
        \ int "ClipX"=0,int "ClipY"=0,Int "ClipW"=0,Int "ClipH"=0,  [* ClipW, and ClipH coords can be zero or -ve, where RHS/BOT relative (but ClipX:ClipY cannot be -ve) *]
        \ float "SAR"=1.0,                                          [* Sample (Pixel) Aspect Ratio. SAR < 1.0:=Pixels are taller than wide, 1.0 < SAR:- pixels are wider than tall, SAR==1.0:=Pixels are square. *]
        \ float "BlurPower"=3.0,                                    [* 0.0 -> 10.0. 0.0=Single color Average of perimeter pixels, 10.0 Perimeter pixels nearest logo pixel greatest effect. Suggest about 3.0 *]
        \ Int "ShowMode"=2                                          [* 0=Overlay Logo Patch(Clipped Logo), 1=Overlay Logo Patch(Clipped) & Border, 2=DeLogo, 3=KeepChroma(Luma only), 4=KeepLuma(ChromaOnly) *]
        \ Bool "Blank"=false                                        [* Where ShowMode==2 and Blank==True then Blank to Black any border area (border is outside of Clip args) *]
        \ )


        LogoX,LogoY,LogoW,LogoH,            Define Logo area. ALL coords can be -ve, where RHS/BOT relative, LogoW & LogoH can additionally be 0 where RHS/BOT relative*]

        ClipX,ClipY,ClipW,ClipH,            All default 0, being full frame (as crop). Inside Clip area is normal unclipped frame,
                                                outside is border/lettrbox area (avoid using border as source pixels for blurring).
                                                ClipW, and ClipH coords can be 0 or -ve, where RHS/BOT relative.

        SAR,                                Default 1.0. Range 0.0 < SAR <= 10.0. Aspect Ratio of pixel(x/y).
                                                Automatically adjusts SAR for chroma of YV16 and YUY2 (otherwise you would get vertical chroma lines for YUY2 and YV16).

        BlurPower,                          Default 3.0. Range 0.0 <= BlurPower <= 10.0. 0.0=Average of all perimeter pixels (all perimeter pixels given equal weight).
                                                The greater BlurPower, the more the NEAREST perimeter pixels affect logo pixels result during logo interpolation.

        ShowMode,                           Default 2. (Normal Delogo)
                                                0 = Show Overlay Patch (Clipped Logo) Area. # For Setting up Filter.
                                                1 = 1=Overlay Logo Patch(Clipped) & Border. #   Ditto.
                                                2 = Normal Delogo.
                                                3 = KeepChroma, Luma   blur only (No effect if not YUV, as for Showmode=2).
                                                4 = KeepLuma, Chroma blur only (No effect if not YUV, as for Showmode=2).  [EDIT: was LumaChroma ???]

                                                    For ShowMode 0 and 1, we use Layer filter and pre (some version of) Avs+ Avisynth, we need to convert to either YUY2 or RGB32 if not those colorspaces..
                                                        YV12 will be converted to YUY2, and RGB24 to RGB32. Both types are then converted back to original colorspace befre return from filter.
                                                    For Modes 2,3 and 4, Avisynth 2.60 can additionally use YV16, YV12, YV24, Y8.
                                                    Avs+ (after some version) can use all Avs 2.60 standard colorspaces in all ShowModes with exception of YV411 which is not supported ALL ALL. [EDIT: Should be AT ALL]

        Blank,                              Default False. If True, and ShowMode >= 2, then will blank any Clipped border area to black (via Clip args).




UGLARM Code derived from here (ffdshow-tryout) :- https://sourceforge.net/p/ffdshow-tryout/code/HEAD/tree/trunk/src/imgFilters/TimgFilterLogoaway.cpp
Although original source from VirtualDub's LogoAway seems unobtainable.

ffdshow-tryout  (c) 2004-2006 Milan Cutka, Based of Logoaway plugin filter for VirtualDub by Krzysztof Wojdon (c) 2000-2001.

Original VirtualDub LogoAway filter docs by Krzysztof Wojdon :- http://vander.wojdon.net/virtualdub/ladocs301/logoaway.html
See MediaFire in my sig below.
3 Dll's for avs v2.58, avs/+ v2.60 x86/x64.
+ Source + full VS 2008 Project files.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 23rd September 2019 at 10:20.
StainlessS is offline   Reply With Quote