Log in

View Full Version : FineSharp converted to shaders, for MPC-HC + madVR, or MPDN - V1.11


Pages : 1 [2] 3

BetA13
20th November 2014, 08:59
The first post also contains this link (http://www.mediafire.com/download/7g82h7kisz8o6ou/finesharp_shaders_1.11.zip), just below the caption "installation".

:thanks: i didnt saw it as link, haha...

much apprechiated..

RainyDog
19th December 2014, 08:06
Thanks very much for this -Vit-.

I've been happily using lumasharpen from the CeeJay's SweetFX shaders for the past few months. Can any of you technical fellows explain the main difference between that and FineSharp please?

:thanks:

TheElix
23rd December 2014, 09:50
Did anyone try combining this shader with ffdshow's unsharp mask (or with Darbee)?

kasper93
6th February 2015, 23:17
It was written for madVR (need the 16-bit accuracy in the shader chain), but also works in MPDN.

We can also enable full/half floating point processing in EVR-CP. And it works just fine with this package.

feelingblue
7th February 2015, 11:57
Did anyone try combining this shader with ffdshow's unsharp mask (or with Darbee)?

I have HTPC and darbee as external video preocessor.
I also have the DVD iscan mini.

I have done a lot of test but.. finesharp is is made to be used alone, without other PP.
Best PQ is with FS alone, the only other PP that is acceptable is Unsharp mask used after fine sharp.

The worst of all group is Darbee.
I don't like it. the immage become unnatural, overprocessed and to countered

shaolin95
7th February 2015, 22:51
I have HTPC and darbee as external video preocessor.
I also have the DVD iscan mini.

I have done a lot of test but.. finesharp is is made to be used alone, without other PP.
Best PQ is with FS alone, the only other PP that is acceptable is Unsharp mask used after fine sharp.

The worst of all group is Darbee.
I don't like it. the immage become unnatural, overprocessed and to countered
Thanks for the beedback on Darbee. Some people at avsforum swear by it but I had my doubts though I never have seen it :)

kasper93
30th March 2015, 13:50
New madVR v0.87.15 added option, which is enabled by default: * new trade option "lose BTB and WTW if it improves performance" You need to disable this option in order to make this shader pack work. I figured I tell you now to avoid questions later :)

madshi
30th March 2015, 16:12
Thanks for the heads-up, kasper93, that's good to know.

madshi
31st March 2015, 23:15
FWIW, I'd suggest to modify the ToYUV und ToRGB shaders slightly like this:

ToYUV:
float3 yuv = mul( height<576 ? RGBtoYUV_601 : RGBtoYUV_709, Src(0,0).rgb ) + float3(0.0, 0.5, 0.5);

ToRGB:
float4 o = Src(0,0) - float4(0.0, 0.5, 0.5, 0.0);
These changes simply move the chroma channels from the [-0.5..+0.5] range to the [0..1] range, which means that we don't have to use floating point textures, anymore.

Zachs
31st March 2015, 23:42
Yes this change would be necessary for MPDN's UNORM (which is the default now) texture too.

Kirk Lazarus
9th April 2015, 14:14
I guys,
I'm very new about this HTPC area so please have patience if I ask stupid stuff.

I use MPC HC with MadVR (AMD r9 280X card) to go in UHD to my tv.

I've installed the shaders.
I played my favourite Blu ray and go to still frame.

I've activated the shaders like you can see in this image:

https://dl.dropboxusercontent.com/u/261382755/finesharp.jpg

I activated the shaders and with my face near Tv I can't see any difference!!

Is it normal? Maybe the still frame is not good to see differences?

I also tried FinesharpB and C but my eyes can't see the difference?!

Where I'm wrong?

I've to say that when I activate the shaders the average rendering time increase and when I deactivate them the rendering time goes down but ... I can't see any improvement in the image quality.

Another question:
I'm worried about the double color space conversions (toYUV + toRGB) ... May those two conversions lower the quality bringed into MadVR processing?

thank you so much.

toniash
9th April 2015, 19:08
I guys,
I'm very new about this HTPC area so please have patience if I ask stupid stuff.

I use MPC HC with MadVR (AMD r9 280X card) to go in UHD to my tv.

I've installed the shaders.
I played my favourite Blu ray and go to still frame.

I've activated the shaders like you can see in this image:

https://dl.dropboxusercontent.com/u/261382755/finesharp.jpg

I activated the shaders and with my face near Tv I can't see any difference!!

Is it normal? Maybe the still frame is not good to see differences?

I also tried FinesharpB and C but my eyes can't see the difference?!

Where I'm wrong?

I've to say that when I activate the shaders the average rendering time increase and when I deactivate them the rendering time goes down but ... I can't see any improvement in the image quality.

Another question:
I'm worried about the double color space conversions (toYUV + toRGB) ... May those two conversions lower the quality bringed into MadVR processing?

thank you so much.

When you have imported the shaders they must be selected in the correct order (again check the web for details if you don't know how):

ToYUV
RemoveGrain11
RemoveGrain4
FineSharpA
FineSharpB
FineSharpC
ToRGB

You can select them as "pre-resize shaders" or "post-resize shaders", or both if you wish. In newer versions of MPC-HC, when you have selected your shaders type a preset name (e.g. "FineSharp - Pre-Resize") in the "Shader Presets" box and press "Save".

Pre-resize shaders have a stronger effect when upscaling (e.g. showing 720p on 1080p monitor), post-resize shaders are stronger when downscaling. Sharpening in both stages is too strong for my liking, but you could do this if you find the sharpening too delicate - this works best when NNEDI3 luma doubling is enabled.

Your rendering times are too high so you have dropped frames!

Kirk Lazarus
10th April 2015, 13:59
When you have imported the shaders they must be selected in the correct order (again check the web for details if you don't know how):

ToYUV
RemoveGrain11
RemoveGrain4
FineSharpA
FineSharpB
FineSharpC
ToRGB

....

Thank you so much for the feedback!
Now It's clear; all shaders must to be actived and in the same order you listed.

So, Yesterday I've tried Finesharp...

I remember that I use my HTPC on a UHDTV so my output res. is 2160p@23hz.

If I use the Finesharp chain in the PRE section of the shader I can see an evident work of the filter ...but the result do not like me so much!
Infact I can see too much halos and ringhing in the image.

If I put the shaders in the "POST" section I can't see any change in the image!!!

I've the rendering time near 48 (if I remember well) so I've massive frame-drop but .... I can't see any difference!!

It's normal for you?

Is there anybody that use Finesharp (shader) on a UHD TV?

Maybe those shaders do not work when the output is 2160?

thank you all.

Carpo
11th April 2015, 23:03
Has anyone tried these using an Intel HD4000? I seem to get strange colour issues if I use ToYUV, ToRBG, or any of the FineSharp filters, yet no issues if I use just the RemoveGrain filters, seems all the colours are wash out, with mainly blue and red being the main colours

Elconite
25th April 2015, 16:57
FWIW, I'd suggest to modify the ToYUV und ToRGB shaders slightly like this:

ToYUV:
float3 yuv = mul( height<576 ? RGBtoYUV_601 : RGBtoYUV_709, Src(0,0).rgb ) + float3(0.0, 0.5, 0.5);

ToRGB:
float4 o = Src(0,0) - float4(0.0, 0.5, 0.5, 0.0);
These changes simply move the chroma channels from the [-0.5..+0.5] range to the [0..1] range, which means that we don't have to use floating point textures, anymore.

This fix destroys color. Without it on the new versions of MadVR there are no red and green or they're screwed up but with the fix the reds are all crushed down . Any ideas how to fix the problem? The last version of MadVR that works with finesharp properly is 87.14

Before
http://i.imgur.com/nnSy5qG.jpg

After
http://i.imgur.com/03DPpLh.jpg

kasper93
30th April 2015, 19:42
See here http://forum.doom9.org/showpost.php?p=1715342&postcount=57

Shiandow
30th April 2015, 20:53
This fix destroys color. Without it on the new versions of MadVR there are no red and green or they're screwed up but with the fix the reds are all crushed down . Any ideas how to fix the problem? The last version of MadVR that works with finesharp properly is 87.14

Before
[...]

After
[...]

I had a quick look, and it seems that the type of YUV it uses has a slightly wider range than the one madshi was thinking of. Normally you'd have chroma values between -0.5 and 0.5, but the matrices used by finesharp has values between -0.436 and 0.436 for the U channel and -0.615 and 0.615 for the V channel. I think those values were useful for analog transmissions for some reason. Anyway, it should be possible to fix that by replacing those matrices with the following:


#define RGBtoYUV(Kb,Kr) float3x3(float3(Kr, 1 - Kr - Kb, Kb), float3(-Kr, Kr + Kb - 1, 1 - Kb) / (2*(1 - Kb)), float3(1 - Kr, Kr + Kb - 1, -Kb) / (2*(1 - Kr)))
#define YUVtoRGB(Kb,Kr) float3x3(float3(1, 0, 2*(1 - Kr)), float3(Kb + Kr - 1, 2*(1 - Kb)*Kb, 2*Kr*(1 - Kr)) / (Kb + Kr - 1), float3(1, 2*(1 - Kb),0))

static const float3x3 RGBtoYUV_601 = RGBtoYUV(0.114,0.299)
static const float3x3 RGBtoYUV_709 = RGBtoYUV(0.0722,0.2126)

static const float3x3 YUVtoRGB_601 = YUVtoRGB(0.114,0.299)
static const float3x3 YUVtoRGB_709 = YUVtoRGB(0.0722,0.2126)

madshi
4th May 2015, 19:27
Yep, Shiandow got it right, of course.

burfadel
4th May 2015, 20:45
Thank you so much for the feedback!
Now It's clear; all shaders must to be actived and in the same order you listed.

So, Yesterday I've tried Finesharp...

I remember that I use my HTPC on a UHDTV so my output res. is 2160p@23hz.

If I use the Finesharp chain in the PRE section of the shader I can see an evident work of the filter ...but the result do not like me so much!
Infact I can see too much halos and ringhing in the image.

If I put the shaders in the "POST" section I can't see any change in the image!!!

I've the rendering time near 48 (if I remember well) so I've massive frame-drop but .... I can't see any difference!!

It's normal for you?

Is there anybody that use Finesharp (shader) on a UHD TV?

Maybe those shaders do not work when the output is 2160?

thank you all.

If you do it before the resize, you are resizing the sharpened image. At 1080P, the artifacts may not be visible, but if you resize it to 2160P you are also resizing the artifacts...

You probably aren't seeing much sharpening at 2160P because the sharpen shader is optimised for a lower resolution (1080P or whatever). Basically, the relevant shader files need to be edited and the sharpen strength values upped.

However, at 2160P this shader is probably a bit taxing, you may be better off using the lumasharpen filter that has been ported from SweetFX. Again, you may need to up the strength (these shader files are text files, and they are laid out in the manner where it 'tells' you what to change). Lumasharpen produces a nice sharpen and is very fast.

kasper93
4th May 2015, 21:17
About YUV<->RGB conversion, we could save one operation by doing


#define RGBtoYUV(Kb,Kr) float3x3(float3(Kr, 1 - Kr - Kb, Kb), float3(-Kr, Kr + Kb - 1, 1 - Kb) / (2*(1 - Kb)), float3(1 - Kr, Kr + Kb - 1, -Kb) / (2*(1 - Kr)))
#define YUVtoRGB(Kb,Kr) float3x3(float3(1, 0, 2*(1 - Kr)), float3(Kb + Kr - 1, 2*(1 - Kb)*Kb, 2*Kr*(1 - Kr)) / (Kb + Kr - 1), float3(1, 2*(1 - Kb),0))

static const float3x3 YUVtoRGB = height <= 576 ? YUVtoRGB(0.114, 0.299) : YUVtoRGB(0.0722, 0.2126);
static const float3x3 RGBtoYUV = height <= 576 ? RGBtoYUV(0.114, 0.299) : RGBtoYUV(0.0722, 0.2126);

Shiandow
4th May 2015, 21:21
Aboit YUV<->RGB conversion, we could save one operation by doing


#define YUVtoRGB(Kb,Kr) float3x3(float3(1, 0, 2*(1 - Kr)), float3(Kb + Kr - 1, 2*(1 - Kb)*Kb, 2*Kr*(1 - Kr)) / (Kb + Kr - 1), float3(1, 2*(1 - Kb),0))

static const float3x3 YUVtoRGB = height < 576 ? YUVtoRGB(0.114,0.299) : YUVtoRGB(0.0722,0.2126);


I'm pretty sure it that one operation you save would have gotten optimized away anyway. In fact, the entire matrix is probably calculated up front.

kasper93
4th May 2015, 21:31
Sure it is calculated up front. I'm talking about `height < 576` comparison. It doesn't have to be done every time. And it is not optimized, 14 vs 13 operations for ToRGB.

EDIT:

And the check should be height <= 576

Shiandow
5th May 2015, 00:25
Sure it is calculated up front. I'm talking about `height < 576` comparison. It doesn't have to be done every time. And it is not optimized, 14 vs 13 operations for ToRGB.



Hmm, it does use less operations for some reason, although the height<576 operation is still there (twice even). Not sure why it decided to do something different.

MCDamo
7th May 2015, 06:41
About YUV<->RGB conversion, we could save one operation by doing


#define RGBtoYUV(Kb,Kr) float3x3(float3(Kr, 1 - Kr - Kb, Kb), float3(-Kr, Kr + Kb - 1, 1 - Kb) / (2*(1 - Kb)), float3(1 - Kr, Kr + Kb - 1, -Kb) / (2*(1 - Kr)))
#define YUVtoRGB(Kb,Kr) float3x3(float3(1, 0, 2*(1 - Kr)), float3(Kb + Kr - 1, 2*(1 - Kb)*Kb, 2*Kr*(1 - Kr)) / (Kb + Kr - 1), float3(1, 2*(1 - Kb),0))

static const float3x3 YUVtoRGB = height <= 576 ? YUVtoRGB(0.114, 0.299) : YUVtoRGB(0.0722, 0.2126);
static const float3x3 RGBtoYUV = height <= 576 ? RGBtoYUV(0.114, 0.299) : RGBtoYUV(0.0722, 0.2126);


Sorry for the entry level question, but where do i enter this in relation to the shader file?
Ive attempted every which way that seems logical to my very limited understanding!

Shiandow
7th May 2015, 11:07
Sorry for the entry level question, but where do i enter this in relation to the shader file?
Ive attempted every which way that seems logical to my very limited understanding!

Like this (http://www.mediafire.com/download/yi9tla70y8sts47/ToYuv_ToRGB.zip).

source code:

ToYUV

// $MinimumShaderProfile: ps_2_0
// Converts source rgb into yuv. A copy of the y value is put in the output alpha. By -Vit-
//----

sampler s0 : register(s0);
float4 c0 : register(c0);
float2 c1 : register(c1);
#define width (c0[0])
#define height (c0[1])

#define Src(a,b) tex2D(s0, uv+c1*float2(a,b))

#define RGBtoYUV(Kb,Kr) float3x3(float3(Kr, 1 - Kr - Kb, Kb), float3(-Kr, Kr + Kb - 1, 1 - Kb) / (2*(1 - Kb)), float3(1 - Kr, Kr + Kb - 1, -Kb) / (2*(1 - Kr)))
#define YUVtoRGB(Kb,Kr) float3x3(float3(1, 0, 2*(1 - Kr)), float3(Kb + Kr - 1, 2*(1 - Kb)*Kb, 2*Kr*(1 - Kr)) / (Kb + Kr - 1), float3(1, 2*(1 - Kb),0))

static const float3x3 YUVtoRGB = height <= 576 ? YUVtoRGB(0.114,0.299) : YUVtoRGB(0.0722,0.2126);
static const float3x3 RGBtoYUV = height <= 576 ? RGBtoYUV(0.114,0.299) : RGBtoYUV(0.0722,0.2126);

float4 main(float2 uv : TEXCOORD0) : COLOR
{
float3 yuv = mul( RGBtoYUV, Src(0,0).rgb ) + float3(0.0, 0.5, 0.5);
return float4(yuv,yuv.x);
}


ToRGB

// $MinimumShaderProfile: ps_2_0
// Assumes source rgb is in fact yuv, and converts it to real rgb. Source alpha is copied as is. By -Vit-
//----

sampler s0 : register(s0);
float4 c0 : register(c0);
float2 c1 : register(c1);
#define width (c0[0])
#define height (c0[1])

#define Src(a,b) tex2D(s0, uv+c1*float2(a,b))

#define RGBtoYUV(Kb,Kr) float3x3(float3(Kr, 1 - Kr - Kb, Kb), float3(-Kr, Kr + Kb - 1, 1 - Kb) / (2*(1 - Kb)), float3(1 - Kr, Kr + Kb - 1, -Kb) / (2*(1 - Kr)))
#define YUVtoRGB(Kb,Kr) float3x3(float3(1, 0, 2*(1 - Kr)), float3(Kb + Kr - 1, 2*(1 - Kb)*Kb, 2*Kr*(1 - Kr)) / (Kb + Kr - 1), float3(1, 2*(1 - Kb),0))

static const float3x3 YUVtoRGB = height <= 576 ? YUVtoRGB(0.114,0.299) : YUVtoRGB(0.0722,0.2126);
static const float3x3 RGBtoYUV = height <= 576 ? RGBtoYUV(0.114,0.299) : RGBtoYUV(0.0722,0.2126);

float4 main(float2 uv : TEXCOORD0) : COLOR
{
float4 o = Src(0,0);
o.rgb = mul( YUVtoRGB, o.xyz - float3(0.0, 0.5, 0.5));
return o;
}

Zachs
7th May 2015, 11:09
Shiandow, perhaps it would be a good idea to upload the fixed version so everyone could just download and use it?

Shiandow
7th May 2015, 12:14
If possible I'd rather avoid having both an official version and an unofficial "fixed" version of the finesharp shaders. I could upload the "fixed" ToYUV and ToRGB shaders though, I'll add a link to my previous comment.

MCDamo
7th May 2015, 20:14
Thank you Shiandow, very much appreciated!

foxyshadis
11th May 2015, 08:02
-Vit- sadly hasn't been around in a long time, so I went ahead and uploaded a new version of the zip with the fixed shaders (and the originals in a subfolder).

madshi
11th May 2015, 10:14
JFWIW, the latest madVR build now has -Vit-'s FineSharp() included. I've also added a "linear light" option. Not sure yet if I like that option, though. It looks a bit different, but I'm not sure if it's better.

kasper93
15th May 2015, 15:57
-Vit- sadly hasn't been around in a long time, so I went ahead and uploaded a new version of the zip with the fixed shaders (and the originals in a subfolder).

Seems like my post hasn't been noticed about height < 576 it should be less or equal for BT.601. PAL have 576px height.

Shiandow
15th May 2015, 16:17
Seems like my post hasn't been noticed about height < 576 it should be less or equal for BT.601. PAL have 576px height.

I think you're correct. I've edited my post. Could take a while before the zip files in the first post are updated. Especially since it's not that important to use the original YUV space.

foxyshadis
15th May 2015, 23:11
I think you're correct. I've edited my post. Could take a while before the zip files in the first post are updated. Especially since it's not that important to use the original YUV space.

Done as well. Thinking about it, I agree that it really makes little or no difference what YUV space it's done in, but at least it's consistent with the thread. Maybe if it was wide-gamut BT.2020.

Music Fan
22nd July 2015, 14:14
Hi,
I'd like to understand what means "converted to shader" for an avs script. Does it mean Avisynth is used in background when your shaders are used ?
How to convert avs to hlsl ?
My idea was to create a script that I could use easily with MPC-HC as a shader to avoid to modify the script each time I play a video to change the path of this video in the script.
This trick works with Virtual Dub Mod which allow templates based on avs script (with avst extension placed in the template sub-folder of Virtual Dub Mod).

huhn
22nd July 2015, 15:09
Hi,
I'd like to understand what means "converted to shader" for an avs script. Does it mean Avisynth is used in background when your shaders are used ?
How to convert avs to hlsl ?
My idea was to create a script that I could use easily with MPC-HC as a shader to avoid to modify the script each time I play a video to change the path of this video in the script.
This trick works with Virtual Dub Mod which allow templates based on avs script (with avst extension placed in the template sub-folder of Virtual Dub Mod).


by taking the AVS scripting code and/or the code from the plugin and transform it to HLSL code if possible.


it's like translation from english to japanese. kind of ...

Music Fan
22nd July 2015, 15:50
by taking the AVS scripting code and/or the code from the plugin and transform it to HLSL code
Ok but how ?
I looked into a hlsl file, it's quite different from an avs.

if possible.
How to know when it possible or not ?

huhn
22nd July 2015, 19:44
Ok but how ?
I looked into a hlsl file, it's quite different from an avs.[quote]
like i said "translation". you need to "speak" both languages and trans late it than.

[quote]How to know when it possible or not ?

HLSL is a shader language it is pretty limited unlike the code used in AVS plugins.

Bloax
22nd July 2015, 20:28
"Converting" an AVS file to HLSL would imply reimplementing all the filters you use in the avisynth script in HLSL and then using them in the same manner you use them in the avisynth script.
You might notice that the "reimplement the filters in HLSL" is probably the part where it gets difficult.

Music Fan
23rd July 2015, 07:42
Ok, thus it's not that easy.
Is there another way to use easily an avs script for all videos with MPC-HC, as the avst templates for Virtual Dub Mod ?

huhn
23rd July 2015, 12:55
try ffdshow.

AVS usually uses the CPU which is terrible slow for picture processing and has not optimal multi threading performance. so realtime processing is maybe out of question for a lot of filter.

Music Fan
23rd July 2015, 14:26
Right, but I didn't wan't to make complex scripts, it's mainly to de-interlace AVI files which are not de-interlaced by MPC-HC while other formats are :confused:

It works with VLC but I prefer MPC-HC.

Anyway, how to use ffdshow filters with MPC-HC ?

huhn
23rd July 2015, 14:45
just use madVR and press control+shift+alt+d to force deinterlacing.

there should a lot of ffdshow mpc-hc guides on the internet

lavfilter can deinterlace too.

Music Fan
23rd July 2015, 15:40
I'd like to avoid to install another tool (madVR), I won't use it a lot.
LAV is included in MPC-HC but whatever the settings (auto, force, with and without Yadif), AVI's are not de-interlaced.:confused:
The only solution I found with MPC-HC is to use the de-interlacer (blend) in shader's list (and I add it as pre-size shader). But I'm not sure this is a very good de-interlacer and I don't know how does LAV's de-interlacer work in this case : are there 2 successive de-interlacers ?

huhn
23rd July 2015, 15:45
are you even sure the avi are interlanced?

Music Fan
24th July 2015, 12:55
Of course.

Music Fan
24th July 2015, 14:22
But it seems to concern only Lagarith avi (and Xvid encoded as progressive, I mean without checking "interlaced" in encoding options). But as I said, even when I check "force" in LAV's de-interlacing options, these avi's are not de-interlaced. The source of these avi's is DV (dvsd).

huhn
24th July 2015, 16:16
sample?

Music Fan
24th July 2015, 17:06
Just open an interlaced video in Virtual Dub and export a sample in Lagarith in YV12, that's very fast.

huhn
24th July 2015, 18:19
every normal file if interlaced or not that is forced to be deinterlaced with lavfilter is deinterlaced so this doesn't help.

Music Fan
24th July 2015, 18:40
every normal file if interlaced or not that is forced to be deinterlaced with lavfilter is deinterlaced so this doesn't help.
But it's not de-interlaced ! While it should be when forced to.
Thus I wonder what this force mode is supposed to do.
MPC-HC probably needs a header that specify the video as interlaced, which is not possible with Lagarith.
Anyway, VLC does the job with these files.