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 20th September 2015, 23:41   #1  |  Link
De-M-oN
Registered User
 
Join Date: Apr 2012
Location: Germany
Posts: 147
Possible to Apply Chroma Interpolation afterwards?

hello,
my capture card has no chroma interpolation.

If I record in YUY2 - every 2nd pixel is without color, because of no interpolation.

Is there a way to have an interpolation applied afterwards? Even if the quality is worse than having the interpolation from a RGB source it would be better than nothing.

I can record in RGB, but at RGB the card can only do 2560x1600 @ 51fps, while YUY2 would work with 60fps.

thank you
De-M-oN is offline   Reply With Quote
Old 21st September 2015, 01:42   #2  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: Los Angeles, California
Posts: 2,119
Converttorgb24()
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated
feisty2 is offline   Reply With Quote
Old 21st September 2015, 03:02   #3  |  Link
vivan
/人 ◕ ‿‿ ◕ 人\
 
Join Date: May 2011
Location: Russia
Posts: 649
Quote:
Originally Posted by De-M-oN View Post
If I record in YUY2 - every 2nd pixel is without color, because of no interpolation.
This is not how subsampling works. Chroma (color) is shared between 2/4 pixels (4:2:2/4:2:0).

Quote:
Originally Posted by De-M-oN View Post
Is there a way to have an interpolation applied afterwards? Even if the quality is worse than having the interpolation from a RGB source it would be better than nothing.
There's no nothing. Interpolation will always happen at playback, you can't convert video to rgb to display it without doing it.
vivan is offline   Reply With Quote
Old 21st September 2015, 03:11   #4  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,306
You could do something like
MergeChroma(YToUV(UtoY.Blur(1,0), VtoY.Blur(1,0)))
but this is very crude. We would need a video sample to give a more precise answer.
raffriff42 is offline   Reply With Quote
Old 24th September 2015, 00:56   #5  |  Link
De-M-oN
Registered User
 
Join Date: Apr 2012
Location: Germany
Posts: 147
Quote:
Originally Posted by feisty2 View Post
Converttorgb24()
In which way this would help?

Quote:
Originally Posted by raffriff42 View Post
You could do something like
MergeChroma(YToUV(UtoY.Blur(1,0), VtoY.Blur(1,0)))
but this is very crude. We would need a video sample to give a more precise answer.
RGB:
http://killerinstinct.ath.cx:2000/files/Card-RGB.avi

YUY2 by Capture Card (missing chroma interpolation - every 2nd pixel colorless:
http://killerinstinct.ath.cx:2000/files/Card-YUY2.avi

YUY2 recorded with MSI Afterburner & UTVideo 4:2:2 Interpolation is now in effect:
http://killerinstinct.ath.cx:2000/files/YUY2-interp.avi


The videos are each only 4 frames short to save filesizes. This means you may need to pause the video and seek to one of the four frames to see something more than just a stopped video.
Look at the winamp playlist. The non-interpolated chroma YUY2 has lost lots of color within the winamp playlist font (and so the whole video).


The codec MagicYUV had the same problem of missing interpolation, so I had requested it:

http://forum.doom9.org/showpost.php?...&postcount=352

And he added it now : http://forum.doom9.org/showpost.php?...&postcount=401


And since my capture card sends only non-interpolated YUY2 (and so the UTVideo Codec can only use what it gets of course) my question is if its maybe possible to add this interpolation afterwards?

Last edited by De-M-oN; 24th September 2015 at 01:55.
De-M-oN is offline   Reply With Quote
Old 24th September 2015, 01:57   #6  |  Link
Desbreko
Registered User
 
Desbreko's Avatar
 
Join Date: Feb 2015
Posts: 55
It looks like the problem is that your capture card is using nearest neighbor scaling for subsampling the chroma when it captures in YUY2. Using ConvertToYV16(chromaresample="Point") on the RGB sample produces the same effect.
__________________
Twitter, AviSynth scripts
Desbreko is offline   Reply With Quote
Old 24th September 2015, 06:38   #7  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,306
This is not a simple loss of every other sample. There is a beat pattern (aka rainbow) between the chroma and luma samples for some reason. I have no idea what to do with this.

Last edited by raffriff42; 24th September 2015 at 17:59. Reason: brevity
raffriff42 is offline   Reply With Quote
Old 24th September 2015, 10:05   #8  |  Link
vivan
/人 ◕ ‿‿ ◕ 人\
 
Join Date: May 2011
Location: Russia
Posts: 649
I agree that chroma was pointresized.

FFVideoSource("Card-RGB.avi").ConvertToYV16().UToY() (how it should be)
FFVideoSource("Card-RGB.avi").ConvertToYV16(chromaresample="Point").UToY() (pointresized chroma)
FFVideoSource("Card-YUY2.avi").UToY() (how it is)

What you want is to turn 2 into 1, but I don't think anything close is possible.

And the reason for rainbows on text is ClearType.
vivan is offline   Reply With Quote
Old 24th September 2015, 19:25   #9  |  Link
Ignus2
Registered User
 
Join Date: Dec 2005
Posts: 248
Your card indeed seems to do point-resize, and so color is lost, you cannot recover that.
Blurring what raffriff42 mentioned might help a little, but there really is nothing you can do, apart from looking around in your capture card settings to change YUY2 conversion mode (if there is any).

Greets,
I.
__________________
http://magicyuv.com - MagicYUV: a new fast lossless video codec for the 4K and multi-core era...
Ignus2 is offline   Reply With Quote
Old 16th November 2015, 22:45   #10  |  Link
De-M-oN
Registered User
 
Join Date: Apr 2012
Location: Germany
Posts: 147
http://abload.de/img/unbenannt2993ou06.png

Can someone explain me this answer by the support? o.O
De-M-oN is offline   Reply With Quote
Old 18th January 2016, 01:33   #11  |  Link
De-M-oN
Registered User
 
Join Date: Apr 2012
Location: Germany
Posts: 147
Wouldnt it be possible with this method?:

Use the average color of the 2 neighbor pixel around the colorless one and place that color on the colorless one? If upsampling it to 4:4:4 / RGB could even get more out of it I dont mind. I just want to give the colorless pixel color.

So: Would that be possible? Sounds at least realistic to me. So would this work? And if so: Is there a plugin for this?
De-M-oN is offline   Reply With Quote
Old 20th January 2016, 18:38   #12  |  Link
geometer
Registered User
 
Join Date: Dec 2015
Posts: 62
I suppose there should be a masking function available on px level?
idea:
copy the video to another variable, do a chroma shift on that, so a grey and a colored px would later overlay.
get the chroma values of both (e.g. plane wise to Y if no other trick), overlay them, and use always the pixel with the non-zero value, or the higher value.
then, upsample (resize) to double or triple resolution. do a px shift there, it's value needs to be iterated, by checking final result.
do some brickwall filtering (band limiting at top frequency of original resolution, but maybe also sharpening at that frequency).
get the original luma, and upsample to the same.
merge luma and px-shifted/filtered chroma to produce YV16 or something.
downsample (optionally with dithering) to original resolution, check color quality, for erraneous shifts. bad shift => iterate
fast guess..

Last edited by geometer; 20th January 2016 at 18:45.
geometer is offline   Reply With Quote
Old 20th January 2016, 20:03   #13  |  Link
vivan
/人 ◕ ‿‿ ◕ 人\
 
Join Date: May 2011
Location: Russia
Posts: 649
Quote:
Originally Posted by De-M-oN View Post
Wouldnt it be possible with this method?:

Use the average color of the 2 neighbor pixel around the colorless one and place that color on the colorless one?
That's basically how bilinear upsampling works.
vivan is offline   Reply With Quote
Old 20th January 2016, 23:38   #14  |  Link
De-M-oN
Registered User
 
Join Date: Apr 2012
Location: Germany
Posts: 147
So this is possible? What can I do? Is there a plugin for this?

It would be so awesome if there is a solution.
De-M-oN is offline   Reply With Quote
Old 21st January 2016, 02:43   #15  |  Link
geometer
Registered User
 
Join Date: Dec 2015
Posts: 62
you can construct a script that materializes my step by step suggestions, and see what comes about.
there is probably no one-button solution.
geometer is offline   Reply With Quote
Old 14th April 2016, 02:03   #16  |  Link
De-M-oN
Registered User
 
Join Date: Apr 2012
Location: Germany
Posts: 147
Sagaras helped me to do your suggestion, because it overwhelmed me.

Here an example without rainbow, just the fact that every 2nd vertical row has no color like I told you:

http://killerinstinct.ath.cx:2000/files/YUY2-Doom.avi (MagicYUV instead UTVideo this time. Forgot to change codec to UTVideo. I hope you dont mind. Otherwise I will convert)

The 1 pixel thin red lines of the map should be red, but as you can see every 2nd pixel is without color (like we know already)

We got this script now:

http://pastebin.com/XFYnge3g

You can load it into avspMod, then you have the sliders for shifting chroma.

This way I can indeed move all the chroma.


But we dont find a way to work with it. We just move it around, but what to do to colorize the colorless pixels?

My imagination still is it should be doable by calculating the average of the neighbor pixels and apply that color on the colorless one.

But we have still no clue how we could do that.

Please help.

Last edited by De-M-oN; 14th April 2016 at 02:05.
De-M-oN 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 05:36.


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