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 > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 3rd September 2014, 20:22   #1  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 673
Chroma Blending

Hi all, I am trying deinterlace a NTSC source but I get video with this artefact:




My code used is:

Code:
DGDecode_mpeg2source("E:\Dragon Ball\DB_5\026\VideoFile.d2v", info=3)

assumebff()

tfm(order=0,pp=6,mode=4).tdecimate(mode=1)
How could I fix it? Example video (m2v): Example video

Thanks in advance.
__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Radeon RX580 8GB DDR5 + ADATA SX8200 Pro 1 TB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite

Last edited by Overdrive80; 14th September 2014 at 21:45.
Overdrive80 is offline   Reply With Quote
Old 3rd September 2014, 21:17   #2  |  Link
nekosama
Registered User
 
Join Date: Sep 2013
Posts: 16
That's ghosting, there isn't really much you can do about it other than weakening the ghosting using mdegrain2 (or 3).

This is caused by temporal post-procesing done by the studio.

Don't try to force it with something destructive like ghostbusters (also yuy2 only) because that won't end well.

Icould also just be totally wrong and it could just be a simple case of blends (seeing as chroma is affected too.
nekosama is offline   Reply With Quote
Old 3rd September 2014, 21:27   #3  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 673
If I use separatefields, this artefact still is it but all blending frames can be replaced for backward and forward frame.

Is there any filter that do it?? I have trying srestore but dont work.
__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Radeon RX580 8GB DDR5 + ADATA SX8200 Pro 1 TB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite
Overdrive80 is offline   Reply With Quote
Old 3rd September 2014, 21:44   #4  |  Link
nekosama
Registered User
 
Join Date: Sep 2013
Posts: 16
Yes then they're just plain blends, honestly I'm not experienced enough with blends to give proper advice on how to take care of them.
But I can direct you to combmask which (like the name states) makes a mask of the comb based on the isCombed() algo.
Combmask allong with daa3 should do a better job than pp=6 in tfm (so I suggest u set it to 0 and let daa3 do the work).
Also I don't think there's such filter out there that replaces the combed frames with the last or next frame as it could lead to some nasty errors.
nekosama is offline   Reply With Quote
Old 3rd September 2014, 22:44   #5  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 673
had try this:

Code:
DGDecode_mpeg2source("E:\Dragon Ball\DB_5\026\VideoFile.d2v", info=3)

assumebff()

tfm(order=0,pp=0,mode=5).tdecimate(mode=1)

video=last

mask=video.combmask()

last=video.mcdaa3()

mt_merge(last, video, mask)
Chrome blending still is it.

__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Radeon RX580 8GB DDR5 + ADATA SX8200 Pro 1 TB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite

Last edited by Overdrive80; 3rd September 2014 at 22:48.
Overdrive80 is offline   Reply With Quote
Old 3rd September 2014, 22:46   #6  |  Link
asarian
Registered User
 
Join Date: May 2005
Posts: 1,462
Are you sure the ghosting is in the source, and not the result of some temporal frame-inaccuracy or some such? For test, I'd try this too:

Code:
SetMemoryMax(768)

SetMTMode(5,4)

DGDecode_mpeg2source("E:\Dragon Ball\DB_5\026\VideoFile.d2v", info=3)

SetMTMode(3)

assumebff()

tfm(order=0,pp=6,mode=4).tdecimate(mode=1)
P.S. Ppl always tell me to use SetMTMode(2), but honestly, I find SetMTMode(3) to be much more stable (be it somewhat slower).
__________________
Gorgeous, delicious, deculture!
asarian is offline   Reply With Quote
Old 3rd September 2014, 23:19   #7  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 673
With this I get same result that shows here

Code:
DGDecode_mpeg2source("E:\Dragon Ball\DB_5\026\VideoFile.d2v", info=3)

assumebff()

TFM(mode=4).Tdecimate().Vinverse()
@asarian
The code that you post is same than my first post.
__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Radeon RX580 8GB DDR5 + ADATA SX8200 Pro 1 TB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite
Overdrive80 is offline   Reply With Quote
Old 3rd September 2014, 23:56   #8  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
This is what happens when you treat interlaced chroma as progressive. I've tried lots of fixes, and unfortunately, I can't get SRestore's double-blend detection to work on this at all. You can manually fix the chroma, since the framerate is so low, but that's a real pain. The luma is completely untouched by blending, so that's a relief at least.

The combing isn't a problem at all, the fields aren't combed at all, just the chroma in many is blended. It's a bad IVTC on the studio side.
foxyshadis is offline   Reply With Quote
Old 4th September 2014, 00:20   #9  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 673
Honestly, I dont know how manually fix it. I tried minimize the impact of this artifact withi this code:

Code:
DGDecode_mpeg2source("E:\Dragon Ball\DB_5\026\VideoFile.d2v", info=3)

assumebff()

TFM(mode=4).Tdecimate(mode=1).Vinverse()

Mergechroma(awarpsharp2(depth=16,thresh=255,blur=3,chroma=6).aWarpSharp2(depth=-4,chroma=2).MergeLuma(blur(0.1)).aWarpSharp2(depth=16,chroma=6))
fft3dfilter(sigma=2,plane=3,degrid=1)
Even so, remains of chroma blending.
__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Radeon RX580 8GB DDR5 + ADATA SX8200 Pro 1 TB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite
Overdrive80 is offline   Reply With Quote
Old 4th September 2014, 06:00   #10  |  Link
bxyhxyh
Registered User
 
Join Date: Dec 2011
Posts: 354
If you're using TFM(), no need to call AssumeBFF or AssumeTFF. Order argument set it.
Code:
DGDecode_mpeg2source("E:\Dragon Ball\DB_5\026\VideoFile.d2v", info=3)
TFM(chroma=true) # Sample you posted was TFF
srestore(omode=4)
TDecimate(chroma=false,mode=1)
Try this. Can't remove all blends, but better than nothing.

It works good on one blended frame.
Can't fix two consistent blended frames but TDecimate(chroma=false,mode=1) do the trick, which decimates one of two blended frames.

EDIT: If you set chroma=true on TDecimate, those 2 blended frames won't be decimated.
EDIT: You may want to change thresh value of srestore() for more accurate blend detection. I think default value works ok.

Last edited by bxyhxyh; 4th September 2014 at 09:21.
bxyhxyh is offline   Reply With Quote
Old 4th September 2014, 10:30   #11  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
chroma blend
you need to deblend chroma planes
and sync luma to chroma with masktools
feisty2 is offline   Reply With Quote
Old 4th September 2014, 11:09   #12  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
luma = tfm(pp=0, slow=2)
chroma = vinverse().Srestore(omode="PP3", cache=10)

# manual sync: figure out which frame (previous,current aka p,c) of 'chroma' clip is most similar to current frame of 'luma' clip

# 46*log(|x-y|+1) uses the full [0,255]-range and scales little differences better than |x-y|*2
diffp = mt_lutxy(luma,chroma.selectevery(1,-1),"x y - abs 1 + log 46 *")
diffc = mt_lutxy(luma,chroma, "x y - abs 1 + log 46 *")

# average difference between compared frames
mp = mt_lutf(diffp,diffp,"avg",expr="x")
mc = mt_lutf(diffc,diffc,"avg",expr="x")

# build conditional masks based on the caculated comparisons
maskp = mt_lutxy(mp,mc,"x y < 255 0 ?")

# finally merge the luma of the tfm with the chroma of the srestore clip accordingly to the binary mask
MergeChroma(luma,chroma).mt_merge(chroma.selectevery(1,-1),maskp,luma=true,Y=2,U=3,V=3)
feisty2 is offline   Reply With Quote
Old 4th September 2014, 18:14   #13  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 673
@Feisty2 At your feet!!! Your script is great and works nice. I would like to have such insight about avisynth as you for understanding the code. Thank you so much.

EDIT: For Decimate I use decimate(cycle=5,quality=0), and result video is incredible.
__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Radeon RX580 8GB DDR5 + ADATA SX8200 Pro 1 TB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite

Last edited by Overdrive80; 4th September 2014 at 23:24.
Overdrive80 is offline   Reply With Quote
Old 4th September 2014, 22:07   #14  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
Quote:
Originally Posted by feisty2 View Post
luma = tfm(pp=0, slow=2)
chroma = vinverse().Srestore(omode="PP3", cache=10)

# manual sync: figure out which frame (previous,current aka p,c) of 'chroma' clip is most similar to current frame of 'luma' clip

# 46*log(|x-y|+1) uses the full [0,255]-range and scales little differences better than |x-y|*2
diffp = mt_lutxy(luma,chroma.selectevery(1,-1),"x y - abs 1 + log 46 *")
diffc = mt_lutxy(luma,chroma, "x y - abs 1 + log 46 *")

# average difference between compared frames
mp = mt_lutf(diffp,diffp,"avg",expr="x")
mc = mt_lutf(diffc,diffc,"avg",expr="x")

# build conditional masks based on the caculated comparisons
maskp = mt_lutxy(mp,mc,"x y < 255 0 ?")

# finally merge the luma of the tfm with the chroma of the srestore clip accordingly to the binary mask
MergeChroma(luma,chroma).mt_merge(chroma.selectevery(1,-1),maskp,luma=true,Y=2,U=3,V=3)
Wow, nice. I never got srestore to do anything in double-blend mode, it always picked the wrong frames, even when I used dclip=UToY().fft3dfilter(). In normal mode, it always picked one of the two correctly, but that's not enough. Surprised it worked for you!

Comparing the luma and chroma edges to match frames is absolutely brilliant though.
foxyshadis is offline   Reply With Quote
Old 4th September 2014, 22:51   #15  |  Link
asarian
Registered User
 
Join Date: May 2005
Posts: 1,462
Quote:
Originally Posted by foxyshadis View Post
Comparing the luma and chroma edges to match frames is absolutely brilliant though.
Yup, I recently had the privilege of reaping the benefits of his genius too.
__________________
Gorgeous, delicious, deculture!
asarian is offline   Reply With Quote
Old 5th September 2014, 00:18   #16  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
http://forum.doom9.org/showthread.ph...50#post1582950
poisondeathray is offline   Reply With Quote
Old 5th September 2014, 00:25   #17  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
oop, I didn't write these codes, copied from somewhere I forgot, thx for the link poisondeathray
feisty2 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 17:51.


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