Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 21st October 2019, 09:30   #501  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 2,139
Quote:
Originally Posted by ChaosKing View Post
And if it helps. The problem is produced somewhere in contrahsrapening and not smdegrain: https://github.com/HomeOfVapourSynth...sfunc.py#L5406
It's a short script and the pink border still happens if you remove miniblur.

When I remove the only Expr line, the stripes disappear but the pink border is still there. Border could be Repair or MakeDiff. Will test later more.


EDIT
should this produce a pink image?
Code:
clip = core.std.BlankClip(width=200,height=100, format=vs.YUV420P8)
matrix1 = [1, 2, 1, 2, 4, 2, 1, 2, 1]
con = core.std.Convolution(clip, matrix=matrix1)

clip=core.std.MakeDiff(clip, con)
I've narrowed down the green lines. They happen with expr and 16 bit formats in the sse2 code path.

The script you posted definitely shouldn't be pink. For some odd reason it's not pink on my computer which should use exactly the same code path (threadripper 1950x).
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 21st October 2019, 12:36   #502  |  Link
Are_
Registered User
 
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 308
AMD Ryzen 7 1700 here and no pink image, only the green strips bug.
Are_ is offline   Reply With Quote
Old 21st October 2019, 13:02   #503  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,194
I tested now with the portable version and it only shows the green stripes. It seems I had still 48-test2 installed,.. I was sure it was the RC edition, sry
Installing the RC removed the pink border

At least my incompetence has found another bug
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database || https://github.com/avisynth-repository

Last edited by ChaosKing; 21st October 2019 at 13:06.
ChaosKing is offline   Reply With Quote
Old 22nd October 2019, 21:37   #504  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,194
Is it possible to port also FineDehalo_contrasharp? It returns a nice sharp image.


Code:
avs+ version
# level == 1.0 : normal contrasharp
Function FineDehalo_contrasharp (clip dehaloed, clip src, float level)
{
	bb  = dehaloed.RemoveGrain (11, -1)
	bb2 = bb.Repair (bb.Repair (bb.Medianblur (2, -256, -256), 1), 1)
	xd  = mt_makediff (bb, bb2)
	xd  = VersionNumber() < 2.6 ? xd.mt_lut ("x 128 - 2.49 * "+String(level)+" * 128 +")
              \                     : xd.mt_lut ("x range_half - 2.49 * "+String(level)+" * range_half +")
	xdd = mt_lutxy (
\		xd,
\		mt_makediff (src, dehaloed),
\		VersionNumber() < 2.6 ? "x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?"
\		                      : "x range_half - y range_half - * 0 < range_half x range_half - abs y range_half - abs < x y ? ?"
\	)

	dehaloed.mt_adddiff (xdd, y=3, u=2, v=2)
}
Code:
Function FineDehalo_contrasharp (clip dehaloed, clip src, float level)
{
	bb  = dehaloed.RemoveGrain (11, -1)
	bb2 = bb.Repair (bb.Repair (bb.Medianblur (2, -256, -256), 1), 1)
	xd  = mt_makediff (bb, bb2)
	xd  = xd.mt_lut ("x 128 - 2.49 * "+String(level)+" * 128 +")
	xdd = mt_lutxy (
\		xd,
\		mt_makediff (src, dehaloed),
\		"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?"
\	)

	dehaloed.mt_adddiff (xdd, y=3, u=2, v=2)
}
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database || https://github.com/avisynth-repository

Last edited by ChaosKing; 22nd October 2019 at 22:03.
ChaosKing is offline   Reply With Quote
Old 23rd October 2019, 03:40   #505  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 723
Quote:
Originally Posted by ChaosKing View Post
Is it possible to port also FineDehalo_contrasharp? It returns a nice sharp image.
Doesn't FineDehalo already have a contra parameter for contrasharpening?
HolyWu is offline   Reply With Quote
Old 23rd October 2019, 09:28   #506  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,194
lol I never noticed xD
But an external "dehalo contrasharp" is still usefull. It can be used with other dehalo functions.
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database || https://github.com/avisynth-repository
ChaosKing is offline   Reply With Quote
Old 23rd October 2019, 09:45   #507  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 723
Quote:
Originally Posted by ChaosKing View Post
But an external "dehalo contrasharp" is still usefull. It can be used with other dehalo functions.
I'd like to know how is the result compared to Didée's ContraSharpening function. Is it only suitable for denoising but not the others?
HolyWu is offline   Reply With Quote
Old 23rd October 2019, 10:08   #508  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,194
ContraSharpening adds halos back. It seems it is only usefull for denoised clips.
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database || https://github.com/avisynth-repository
ChaosKing is offline   Reply With Quote
Old 6th March 2020, 03:10   #509  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 4,190
Does the overlay function work for RGBS ? It seems values are incorrect, but correct with maskedmerge

Code:
a = core.std.BlankClip(format=vs.RGBS, color=[1, 1, 1])
b = core.std.BlankClip(format=vs.RGBS, color=[2, 2, 2])
c = core.std.BlankClip(format=vs.RGBS, color=[0.5, 0.5, 0.5])

opacity = 0.5

msk = core.std.BlankClip(a, color=[opacity, opacity, opacity])

ov = haf.Overlay(a,b,opacity=0.5)

mm = core.std.MaskedMerge(a,b,mask=msk)

ov.set_output()
#mm.set_output()

For example, a,b with opacity 0.5 correctly gives RGB [1.5,1.5,1.5] with maskedmerge, but some error value for overlay
poisondeathray is offline   Reply With Quote
Old 6th March 2020, 04:38   #510  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 723
Quote:
Originally Posted by poisondeathray View Post
Does the overlay function work for RGBS ? It seems values are incorrect, but correct with maskedmerge
Fixed.
HolyWu is offline   Reply With Quote
Old 6th March 2020, 21:50   #511  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 4,190
Quote:
Originally Posted by HolyWu View Post
Fixed.
Thanks!

Would it be possible to add overlay blend modes? Such as "add", "multiply", "screen", etc..
poisondeathray is offline   Reply With Quote
Old 12th March 2020, 13:41   #512  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 723
Quote:
Originally Posted by poisondeathray View Post
Would it be possible to add overlay blend modes? Such as "add", "multiply", "screen", etc..
Added. But I don't see "screen" as one of the modes in http://avisynth.nl/index.php/Overlay
HolyWu is offline   Reply With Quote
Old 12th March 2020, 15:50   #513  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 4,190
Quote:
Originally Posted by HolyWu View Post
Added. But I don't see "screen" as one of the modes in http://avisynth.nl/index.php/Overlay
Thanks!

"screen" is not in the overlay avs version, but it's one of the more common compositing/photoshop blend modes used

rr42 translated some here for uu_mt_blend based on maskttools, and there are some links to the math behind them in the 1st post. I don't think that version supports different bit depths

https://forum.doom9.org/showthread.php?t=170490
https://photoblogstop.com/photoshop/...odes-explained

Code:
Screen 	
1−(1−A)×(1−B) 	
A inverted multiplied by B inverted, and the product is inverted
poisondeathray is offline   Reply With Quote
Old 25th March 2020, 05:50   #514  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 4,190
YUV overlay mask transparency issue

YUV overlay mask transparency issue. Partial transparency issue on 100% white areas

-affects YUV overlay operations in 10bit, different subsamplings.

-RGB overlay operations seem ok

-does not matter if you mark YUV versions as "limited" range or "full"

-Works ok if you use Gray8 for the mask, and base clip / overlay clip are matching 8bit YUV ; or Gray16 and base/overlay are matching 16bit YUV . But there is no Gray10 format, so 10bit YUV overlay with mask is out of luck, or 12bit YUV

-works as expected if you go back to older havsfunc version a few months ago, with matching pixel format YUVxxxPx mask instead of using GRAYx mask. Not sure where the exact commit altered it, possibly the recent ones

eg.
Code:
import vapoursynth as vs
import havsfunc as haf
core = vs.get_core()

orig = core.imwri.Read(r'testchart.png')
logo = core.imwri.Read(r'logo.png', alpha=True)

orig2 = core.resize.Bicubic(orig, format=vs.YUV420P10, matrix_s="709")

logobase2 = core.resize.Bicubic(logo[0], format=vs.YUV420P10, matrix_s="709", range_s="full")

logoalpha2 = core.resize.Bicubic(logo[1], format=vs.YUV420P10, matrix_s="709", range_s="full")
#logoalpha2 = core.std.SetFrameProp(logoalpha2, prop="_ColorRange", intval=1)  #    Mark video as limited range.
#logoalpha2 = core.resize.Bicubic(logo[1], format=vs.GRAY8, matrix_s="709", range_s="full")

#RGB24, RGB30, RGB48 work ok
#orig2 = core.resize.Bicubic(orig, format=vs.RGB30)
#logobase2 = core.resize.Bicubic(logo[0], format=vs.RGB30)
#logoalpha2 = core.resize.Bicubic(logo[1], format=vs.RGB30)


overl = haf.Overlay(orig2, logobase2, mask=logoalpha2)

overl.set_output()

Test images
https://www.mediafire.com/file/vy6k8...mages.zip/file
poisondeathray is offline   Reply With Quote
Old 25th March 2020, 08:06   #515  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 723
Quote:
Originally Posted by poisondeathray View Post
YUV overlay mask transparency issue. Partial transparency issue on 100% white areas
Thanks. Should be fixed now (rebased into the last commit).


Quote:
Originally Posted by poisondeathray View Post
But there is no Gray10 format, so 10bit YUV overlay with mask is out of luck, or 12bit YUV
You can use core.register_format for formats without constants predefined.
Code:
logoalpha2 = core.resize.Bicubic(logo[1], format=core.register_format(vs.GRAY, vs.INTEGER, 10, 0, 0).id, matrix_s="709", range_s="full")
HolyWu is offline   Reply With Quote
Old 25th March 2020, 16:46   #516  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 4,190
Thanks for the fix and the info HolyWu . Didn't know about core.register_format
poisondeathray is offline   Reply With Quote
Old 25th March 2020, 17:11   #517  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 4,190
Sorry, it doesn't seem "fixed" . Same script as above

Or are you saying you should always use GRAY, and with core.register_format if it's not a predefined format ?
poisondeathray is offline   Reply With Quote
Old 25th March 2020, 18:08   #518  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 723
Quote:
Originally Posted by poisondeathray View Post
Sorry, it doesn't seem "fixed" . Same script as above
These are my results.


Code:
orig = core.imwri.Read(r'testchart.png')
logo = core.imwri.Read(r'logo.png', alpha=True)

orig2 = core.resize.Bicubic(orig, format=vs.YUV420P10, matrix_s="709")
logobase2 = core.resize.Bicubic(logo[0], format=vs.YUV420P10, matrix_s="709")
logoalpha2 = core.resize.Bicubic(logo[1], format=vs.YUV420P10, matrix_s="709", range_s="full")

overl = haf.Overlay(orig2, logobase2, mask=logoalpha2)
overl.set_output()



Code:
orig = core.imwri.Read(r'testchart.png')
logo = core.imwri.Read(r'logo.png', alpha=True)

orig2 = core.resize.Bicubic(orig, format=vs.RGB30)
logobase2 = core.resize.Bicubic(logo[0], format=vs.RGB30)
logoalpha2 = core.resize.Bicubic(logo[1], format=vs.RGB30)

overl = haf.Overlay(orig2, logobase2, mask=logoalpha2)
overl.set_output()
HolyWu is offline   Reply With Quote
Old 25th March 2020, 18:22   #519  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 4,190
It's correct. Sorry for false alarm

It turns out wrong havsfunc.py version was loading

Thanks again
poisondeathray is offline   Reply With Quote
Old 25th March 2020, 21:30   #520  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 474
offtopic

dat logo. where?

greetings

EDIT: done! http://forum.doom9.net/showthread.ph...72#post1847472
__________________
[AUR] Vapoursynth Stuff
[AUR] Avisynth Stuff

Last edited by sl1pkn07; 25th March 2020 at 21:34.
sl1pkn07 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 13:51.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.