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 > Hardware & Software > Software players

Reply
 
Thread Tools Search this Thread Display Modes
Old 6th June 2014, 00:27   #21  |  Link
turbojet
Registered User
 
Join Date: May 2008
Posts: 1,840
Are these shaders recommend as all pre-resize? I'm getting some pretty nasty artifacts at times if that's the case.

Can these be consolidated into less shaders?
__________________
PC: FX-8320 GTS250 HTPC: G1610 GTX650
PotPlayer/MPC-BE LAVFilters MadVR-Bicubic75AR/Lanczos4AR/Lanczos4AR LumaSharpen -Strength0.9-Pattern3-Clamp0.1-OffsetBias2.0
turbojet is offline   Reply With Quote
Old 6th June 2014, 01:47   #22  |  Link
Shiandow
Registered User
 
Join Date: Dec 2013
Posts: 753
Quote:
Originally Posted by turbojet View Post
Are these shaders recommend as all pre-resize? I'm getting some pretty nasty artifacts at times if that's the case.

Can these be consolidated into less shaders?
They should be post resize, it basically throws away 3/4 of the pixels and then tries to interpolate them. To simulate actually upscaling an image you need to tell MadVr to either use nearest or nnedi3, in both cases it will keep the pixels of the original image and try to interpolate the rest.

You could probably avoid using the "pre" and "post" shaders. You can get a similar result by changing:
Code:
#define Value(xy) (tex2D(s0,tex+float2(px,py)*(xy))[0])
to
Code:
#define Value(xy) (dot(tex2D(s0,tex+float2(px,py)*(xy)).rgb,1/3.0))
and
Code:
return float4(c,c0.gba);
to
Code:
return c0-Value(0)+c;
Shiandow is offline   Reply With Quote
Old 6th June 2014, 06:01   #23  |  Link
turbojet
Registered User
 
Join Date: May 2008
Posts: 1,840
Thanks and both 1 and 2 should be enabled at the same time? They look pretty similar, are these passes?
__________________
PC: FX-8320 GTS250 HTPC: G1610 GTX650
PotPlayer/MPC-BE LAVFilters MadVR-Bicubic75AR/Lanczos4AR/Lanczos4AR LumaSharpen -Strength0.9-Pattern3-Clamp0.1-OffsetBias2.0
turbojet is offline   Reply With Quote
Old 6th June 2014, 09:10   #24  |  Link
Shiandow
Registered User
 
Join Date: Dec 2013
Posts: 753
Yes, it will basically fill in the pixels in the following pattern:
Code:
o . o . o
. x . x .
o . o . o
. x . x .
o . o . o
Where the "o" are known pixels, the "x" are calculated from the surrounding "o" by NEDI-1 and then NEDI-2 will fill in the remaining "."s.
Shiandow is offline   Reply With Quote
Old 6th June 2014, 13:30   #25  |  Link
madshi
Registered Developer
 
Join Date: Sep 2006
Posts: 9,140
One thing this might be good for is chroma upsampling. Instead of using the neighbor pixels to create the interpolation weights, the algorithm could use the luma channel (or both the luma and chroma channels). This way the luma channel would guide the chroma upsampling. This makes a lot of sense because in most cases both luma and chroma change at the same time, and the luma channel already has 4 times the resolution. Of course the algorithm would have to do some safety checks to make sure that nothing bad happens if luma and chroma channels happen to be not related in some rare situations. But I think this could be a *really* good algorithm. I've had this idea for a long time, but never actually got around trying/implementing it yet. @Shiandow, maybe you'd have fun trying your luck with that? FWIW, one big problem with my idea is that sometimes the chroma channel was created with incorrect filtering (e.g. nearest neighbor) or sometimes the chroma channel is offset slightly. One additional thing a good chroma upsampling algorithm could do is to downscale the luma channel to chroma resolution and then check whether the chroma channel likely has a wrong offset or not.

(I had asked tritical at one point whether he'd consider making a special NNEDI3 version for chroma upsampling which takes the luma channel into account, but he was busy with other things, sadly.)
madshi is offline   Reply With Quote
Old 6th June 2014, 20:21   #26  |  Link
leeperry
Kid for Today
 
Join Date: Aug 2004
Posts: 3,477
Quote:
Originally Posted by madshi View Post
please post all the 4x upscaled NEDI images of all those test images from the linked thread here, and maybe I'll reconsider.
Quote:
Originally Posted by Shiandow View Post
I would like to mention that most artefacts only become problematic when you use NEDI twice, when you only use NEDI once they aren't that much of a problem.
Quote:
Originally Posted by madshi View Post
IMHO, put your resources into luma doubling (maybe a little into chroma upscaling).
Guys, I might be missing something here but the kangaroo test pattern looks fantastic with NEDI and as madshi doesn't really advise using quad from what I understand, then when why comparing 4x upscales at all? We could use NEDI for luma doubling and either NNEDI3/J3AR or that new NEDI idea from madshi for chroma?

Most of the time, I personally find NNEDI3 too sharp for chroma and if we could get off the hiccupy OpenCL train then far more GPU's could be useful to mVR than just the GCN and Maxwell architectures.

Last edited by leeperry; 6th June 2014 at 20:23.
leeperry is offline   Reply With Quote
Old 6th June 2014, 20:27   #27  |  Link
madshi
Registered Developer
 
Join Date: Sep 2006
Posts: 9,140
Maybe the artifacts are worse with 4x upscales, but they're still there with 2x upscaling, too. IMHO NEDI in its current form is not suitable for a general purpose video upscaling algorithm, as I said before. Of course that's only my personal opinion, but unless I see evidence that suggests that I'm wrong, I won't add NEDI image/luma upscaling to madVR.
madshi is offline   Reply With Quote
Old 6th June 2014, 22:37   #28  |  Link
Shiandow
Registered User
 
Join Date: Dec 2013
Posts: 753
Quote:
Originally Posted by madshi View Post
One thing this might be good for is chroma upsampling.
Well, it seems that using NEDI for chroma doubling indeed does work quite well. I did have some trouble with aligning the luma and chroma grid, but I sort of succeeded with the following result:

NEDI chroma doubling.
Jinc3AR chroma doubling.

The NEDI method could probably be made a bit sharper since I'm currently using a simple box filter to shift it 1/2 a pixel, which could be replaced by something better (in fact you could just use NEDI again). I'm also completely ignoring the chroma channel which may backfire on some images, but does seem to produce the best results. Even better, doing so seems to hide some source artifacts when these don't occur in the luma channel.

Edit: I've just confirmed that only processing the chroma channel indeed does backfire sometimes, I've simultaneously confirmed that using NEDI to interpolate the chroma channel is capable of actually reconstructing the original values, which I find quite impressive, unfortunately it does get it wrong sometimes. Hopefully it's possible to prevent this by checking if the chroma and luma channels actually correlate.

Last edited by Shiandow; 6th June 2014 at 23:51.
Shiandow is offline   Reply With Quote
Old 7th June 2014, 01:30   #29  |  Link
pie1394
Registered User
 
Join Date: May 2009
Posts: 212
Quote:
Originally Posted by Shiandow View Post
Well, it seems that using NEDI for chroma doubling indeed does work quite well. I did have some trouble with aligning the luma and chroma grid, but I sort of succeeded with the following result:

NEDI chroma doubling.
Jinc3AR chroma doubling.

The NEDI method could probably be made a bit sharper since I'm currently using a simple box filter to shift it 1/2 a pixel, which could be replaced by something better (in fact you could just use NEDI again). I'm also completely ignoring the chroma channel which may backfire on some images, but does seem to produce the best results. Even better, doing so seems to hide some source artifacts when these don't occur in the luma channel.
To me the above sample's NEDI version has better edge smoothness, but at the cost of losing some higher freqeuency details (i.e. too soft) than the Jinc3AR version. It can be even noticed on the text body and the tree's texture at a normal viewing distance with the so so Dell U2412M. I guess the difference will be even higher on a TV with super-resolution engine's high-frequency signal restoration enhancement.
pie1394 is offline   Reply With Quote
Old 7th June 2014, 01:44   #30  |  Link
Shiandow
Registered User
 
Join Date: Dec 2013
Posts: 753
Using NEDI to shift the image, instead of a box filter, improves it quite a bit: http://i.imgur.com/DhbOS34.png.
Shiandow is offline   Reply With Quote
Old 7th June 2014, 03:19   #31  |  Link
pie1394
Registered User
 
Join Date: May 2009
Posts: 212
Quote:
Originally Posted by Shiandow View Post
Using NEDI to shift the image, instead of a box filter, improves it quite a bit: http://i.imgur.com/DhbOS34.png.
The version's sharpness on the tree's texture indeed improves, but it is still somwhat softer than Jinc3AR verison. Yet it creates more noticeable ring effects on the leaf's edge and "T" and "P" characters.

Here is my subjective visual experience opinions:

[High-frequency signal preservation]
NEDI v2 > Jinc3AR >> NEDI v1

[Low-frequency signal preservation]
Jinc3AR > NEDI v2 >> NEDI v1

[Angled Object edge smoothness]
NEDI v1 >= NEDI v2 > Jinc3AR

[Ring-effect artifact issue]
NEDI v2 > Jinc3 AR >> NEDI v1

[Shaded? Text clarity]
Jinc3AR > NEDI v1 > NEDI v2
pie1394 is offline   Reply With Quote
Old 7th June 2014, 07:56   #32  |  Link
madshi
Registered Developer
 
Join Date: Sep 2006
Posts: 9,140
Quote:
Originally Posted by Shiandow View Post
Edit: I've just confirmed that only processing the chroma channel indeed does backfire sometimes, I've simultaneously confirmed that using NEDI to interpolate the chroma channel is capable of actually reconstructing the original values, which I find quite impressive, unfortunately it does get it wrong sometimes. Hopefully it's possible to prevent this by checking if the chroma and luma channels actually correlate.
Fine tuning this could be difficult. But I think there's some potential there. FWIW, I think this would be more beneficial for chroma upscaling than chroma doubling.

FWIW, here are two samples which are good candidates for chroma tests:

red fonts
chroma test

Btw, if you create an empty file named "YCbCr" in the madVR folder, madVR will output YCbCr instead of RGB. This might allow you to test better because color conversion to RGB is simply skipped completely.
madshi is offline   Reply With Quote
Old 7th June 2014, 21:35   #33  |  Link
Bloax
The speed of stupid
 
Bloax's Avatar
 
Join Date: Sep 2011
Posts: 317
madshi: Any ideas as for why your domain redirects to 92.242.144.160/http://madshi.net(..)?
Bloax is offline   Reply With Quote
Old 7th June 2014, 21:47   #34  |  Link
Shiandow
Registered User
 
Join Date: Dec 2013
Posts: 753
Quote:
Originally Posted by madshi View Post
Fine tuning this could be difficult. But I think there's some potential there. FWIW, I think this would be more beneficial for chroma upscaling than chroma doubling.
Just to be sure, by "chroma upscaling" you mean scaling the chroma to the same resolution as luma? Otherwise I would have to disagree.

Anyway, I've more or less finished with implementing the NEDI (4:2:0) chroma upscaling algorithm. For some images it noticeably improves the picture quality. There are some cases where it behaves differently from bicubic, but it's usually hard to tell whether the result is worse or better. In any case these situation could probably be avoided by downscaling the chroma again and comparing it to the original.

Here is an example, taken from the Sintel film, where it is not only different but clearly better:

Bicubic75AR
chromaNEDI

In both cases it was followed by a single NNEDI3 (16 neurons) pass, to make the differences more obvious. Incidentally this is also one of the cases where NEDI image doubling looks better than NNEDI3:

chroma+luma NEDI

In fact I think you might want to try watching Sintel using NEDI, if that doesn't convince you that using NEDI is worth the amount of artefacts it causes then I don't know what will. I'll update the first post to include both the chroma NEDI code and a version of NEDI which is suitable for video playback.
Shiandow is offline   Reply With Quote
Old 7th June 2014, 22:54   #35  |  Link
nevcairiel
Registered Developer
 
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 10,346
Quote:
Originally Posted by Shiandow View Post
Just to be sure, by "chroma upscaling" you mean scaling the chroma to the same resolution as luma?
Thats what "chroma upscaling" always refers to in the madVR context, so thats safe to assume.
__________________
LAV Filters - open source ffmpeg based media splitter and decoders
nevcairiel is offline   Reply With Quote
Old 7th June 2014, 23:03   #36  |  Link
Shiandow
Registered User
 
Join Date: Dec 2013
Posts: 753
Ok thanks, I wasn't really sure since chroma upscaling is done by doubling the resolution.
Shiandow is offline   Reply With Quote
Old 7th June 2014, 23:20   #37  |  Link
madshi
Registered Developer
 
Join Date: Sep 2006
Posts: 9,140
Quote:
Originally Posted by Shiandow View Post
Anyway, I've more or less finished with implementing the NEDI (4:2:0) chroma upscaling algorithm. For some images it noticeably improves the picture quality. There are some cases where it behaves differently from bicubic, but it's usually hard to tell whether the result is worse or better. In any case these situation could probably be avoided by downscaling the chroma again and comparing it to the original.

Here is an example, taken from the Sintel film, where it is not only different but clearly better:

Bicubic75AR
chromaNEDI
Looks nice!

Quote:
Originally Posted by Shiandow View Post
In both cases it was followed by a single NNEDI3 (16 neurons) pass, to make the differences more obvious. Incidentally this is also one of the cases where NEDI image doubling looks better than NNEDI3:

chroma+luma NEDI
The NEDI+NEDI image looks better than NEDI+NNEDI3 in some image areas, but worse in others. Some edges look cleaner (less aliased) with NEDI, but NNEDI3 is overall sharper and more detailed in some areas. Which neuron count did you use for NNEDI3? Maybe only 16?

Quote:
Originally Posted by Shiandow View Post
In fact I think you might want to try watching Sintel using NEDI, if that doesn't convince you that using NEDI is worth the amount of artefacts it causes then I don't know what will. I'll update the first post to include both the chroma NEDI code and a version of NEDI which is suitable for video playback.
I just don't think it's an algorithm a user could "set and forget", one which works for any kind of video content. All the other algorithms qualify for that, but NEDI doesn't, IMHO.

May I use your chroma upscaling shaders for madVR? Maybe I'll find a way to improve them further. If so, I'd post my changes here.
madshi is offline   Reply With Quote
Old 7th June 2014, 23:21   #38  |  Link
madshi
Registered Developer
 
Join Date: Sep 2006
Posts: 9,140
Quote:
Originally Posted by Bloax View Post
madshi: Any ideas as for why your domain redirects to 92.242.144.160/http://madshi.net(..)?
I don't see that on my PC. If I type in "http://madshi.net" the browser seems to show that without any redirection. At least no redirection that I can see?
madshi is offline   Reply With Quote
Old 7th June 2014, 23:50   #39  |  Link
Bloax
The speed of stupid
 
Bloax's Avatar
 
Join Date: Sep 2011
Posts: 317
Apparently it's just my AV pulling dirty, dirty tricks because it thinks your site is suspicious - carry on.
Bloax is offline   Reply With Quote
Old 8th June 2014, 00:45   #40  |  Link
Shiandow
Registered User
 
Join Date: Dec 2013
Posts: 753
Quote:
Originally Posted by madshi View Post
The NEDI+NEDI image looks better than NEDI+NNEDI3 in some image areas, but worse in others. Some edges look cleaner (less aliased) with NEDI, but NNEDI3 is overall sharper and more detailed in some areas. Which neuron count did you use for NNEDI3? Maybe only 16?
I used 16 neurons although using 128 neurons doesn't result in a noticeable difference. In this particular image I might actually prefer the way NEDI is a bit softer, it looks somewhat more natural. The extra sharpness of NNEDI3 looks nice at first glance but when fine tuning the NEDI algorithm I've encountered (admittedly rare) cases when what I thought was an artefact of NEDI turned out to be some detail that NNEDI3 decided to erase.

Quote:
Originally Posted by madshi View Post
I just don't think it's an algorithm a user could "set and forget", one which works for any kind of video content. All the other algorithms qualify for that, but NEDI doesn't, IMHO.
What I find somewhat frustrating is that, so far, NEDI has looked good on all video content I've tried. But I'll admit that it has some quirks, I'll try to see if I can iron these out.

Quote:
Originally Posted by madshi View Post
May I use your chroma upscaling shaders for madVR? Maybe I'll find a way to improve them further. If so, I'd post my changes here.
Feel free to use them. I'd appreciate it if you'd keep me updated on possible improvements you've made.

Here are some possible improvements that I couldn't implement because I was restricted to using a simple shader:
  • You should be able to increase the speed by about 1.7 (1.75/3) times just by preventing it from unnecessarily calculating pixels that weren't even supposed to change.
  • You could calculate some of the values upfront, preventing some texture calls. This will probably work best for the values of "Get4".
  • As I mentioned before you could probably detect some unwanted behaviour by comparing the original chroma values with a downscaled version of the upscaled chroma.
Shiandow is offline   Reply With Quote
Reply

Tags
chromanedi, nedi, shader, superres, upscaling

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 19:39.


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