Log in

View Full Version : MPC-HC: How to edit Sharpen Complex filter to process 2x ?


SpikeBit
14th November 2009, 16:10
Hi,

Does anybody know how to change the Sharpen Complex filter
to process two times the amount of sharpness?

I've changed the values a bit, I know it uses a Matrix to work
on each pixel, but dont quite get it how to change the filter
to do what I want!

Also, using the filter twice on MPC, doesn't work for me
because it is to slow for my computer. What I need is to be
able to change the amount of sharpness of the Sharpen Complex
Filter.


Thanks for any info.

SpikeBit

73ChargerFan
14th November 2009, 19:56
Try "Combine Shaders..." and add Sharpen Complex twice.

SpikeBit
15th November 2009, 00:47
Hi, Thanks for your reply.

But, using the filter twice on MPHC is to much for my computer!
I can only use one filter, but if I can change the filter to add more sharpness that would work!

My Computer Config is:

Toshiba Notebook
Intel Core Duo T7250 @ 2.0ghz
ATI HD2400 - 128Mb (at 1920x1080)

I'm Playing mkv 720p movies Strech to 1080p with only shapen complex filter enabled.
I'm Using MPHC with CoreAVC on a Win7 system.

SpikeBit

Casshern
15th November 2009, 03:00
Complex Sharpen 2 works like this:
1) First it does a plain unsharpen mask. This means it is subtracting a low pass filtered image from the original. The instruction
#define CoefFlou 2
sets a factor that determines the "weight" of the low frequency and high frequency components. Set it higher and more low pass information is subtracted and the image gets sharper (e.g. set it to 2.5 or 3). I find the default 2 a pretty good compromise

2) Because the unsharpen mask may introduces some ringing to high contrast edges in the image, complex sharpen 2 has an additional step to reduce this effect. It does an edge detection with a sobel filter on the original image. Whenever the threshold given by:
#define SharpenEdge 0.15
is exceeded the algorithm does NOT use the sharpened pixel from the unsharp mask used in step 1 (see above) but uses sharpening with the parameter defined here:
#define Sharpen_val0 1.5
Raising this parameter will sharpen all edges more, if and only if they exceed the edge-treshold in the original image (sharpenedge)

Summary:
Complex sharpen uses an unsharp mask which might lead to ringing. To ease the ringing it detects all edges in the original image and if they exceed the threshold, it uses another sharpening parameter. Naturally this step should apply less sharpening than the unsharpen mask, so that the edges exhibit less ringing. If you want to reduce ringing, you can lower the threshold (more edges are processed by the second sharpening algo) and/or reduce the sharpen_val0 so that the detected edges above the threshold are less sharpened.
To lessen the overall sharpening effect reduce CoefFlou.
You could also "misuse" the algo and sharpen the edges more than the rest of the image e.g. raise sharpen_val0 to insane levels and reduce the edge detection threshhold.
Finally if you only want to increase the overall sharpening effect just increase Coeflou. There is no need to change any of the matrices.

I hope this helps,
Casshern

P.S.: The above values are my favourites for BD viewing. Just play around, the shaders are also active on paused video and all changes are visible almost immedeatly as they are compiled by mpc in the background

Hi, Thanks for your reply.

But, using the filter twice on MPHC is to much for my computer!
I can only use one filter, but if I can change the filter to add more sharpness that would work!

My Computer Config is:

Toshiba Notebook
Intel Core Duo T7250 @ 2.0ghz
ATI HD2400 - 128Mb (at 1920x1080)

I'm Playing mkv 720p movies Strech to 1080p with only shapen complex filter enabled.
I'm Using MPHC with CoreAVC on a Win7 system.

SpikeBit

SpikeBit
15th November 2009, 18:12
Hi, thanks for your sugestion!

Yes, you are absolutely right about the way that Sharpen Complex V2 works!
I did look into that particular filter before I switch over to the Sharpen Complex V1.
The reason I did that was because Version 2 was to much for my computer to handle.
It has to many steps and the result was always Audio/Video sync problems.

But, if I use the Sharpen complex V1, not Version 2, It's 100% perfect.
No problems what so ever. So I'm stuck on using that version!
And yes, I know my system really sucks. But for now it's the only I Got!

Do you know how to change the Sharpen Complex V1 filter?

Thank's for your time on this subject!


SpikeBit

Casshern
15th November 2009, 23:54
Complex sharpen v2 is just a tidy version of complex sharpen v1. Both do exactly the same, and should be equally fast. But the v2 has the advantage that you can influence all parameters with the defines at the beginning. They added one thing. the support is different for the two sharpening method:

c1 = tex2D(s0, tex + float2(-px,-py));
c2 = tex2D(s0, tex + float2(0,-py));
c3 = tex2D(s0, tex + float2(px,-py));
c4 = tex2D(s0, tex + float2(-px,0));
c5 = tex2D(s0, tex + float2(px,0));
c6 = tex2D(s0, tex + float2(-px,py));
c7 = tex2D(s0, tex + float2(0,py));
c8 = tex2D(s0, tex + float2(px,py));

you can delete this block in v2 (its the second of the "cx = tex2d..." blocks) and set moyenne to 1 to get the same support for both methods just like in v1. Maybe this fixes your speed issues. Also check whether you compiled it with the same shader model (2.x or 3.0) as this can make a speed difference.

But you can also just change the code of v1:
#define Sharpen_val0 2.0
is the same as in v2 - larger is sharper. But do not forget to adjust sharpen_val1 - just use the formula from v2

cori = 2*ori - flou
this can be changed to:
cori = (1+CoefFlou) - CoefFlou * flou
The default of CeoFflou is 1 in v1 and 2 in v2 - larger is sharper, try 3 to see the effect clearly

and
if( value >.3 ) {
the ".3" can be corresponds to sharpenedge in v2

Just reread my original post for explanation of the parameters....




Hi, thanks for your sugestion!

Yes, you are absolutely right about the way that Sharpen Complex V2 works!
I did look into that particular filter before I switch over to the Sharpen Complex V1.
The reason I did that was because Version 2 was to much for my computer to handle.
It has to many steps and the result was always Audio/Video sync problems.

But, if I use the Sharpen complex V1, not Version 2, It's 100% perfect.
No problems what so ever. So I'm stuck on using that version!
And yes, I know my system really sucks. But for now it's the only I Got!

Do you know how to change the Sharpen Complex V1 filter?

Thank's for your time on this subject!


SpikeBit

SpikeBit
16th November 2009, 16:29
Yes, you did it again!!!

The sugestion about removing that block of code on V2 did the trick!
I can now run the Sharpen Complex V2 with no slowdowns what so ever and with the
amount of sharpness that I want. It's Perfect!!!

I also compiled the filter using 3.0 shaders instead of the 2a that I was using.

Thanks for all your help on this subject!
You have saved my Home-Theater experience.

Again, Thanks!!!


SpikeBit

Casshern
17th November 2009, 02:35
No Problem, you are welcome.

regards,
Casshern
Yes, you did it again!!!

The sugestion about removing that block of code on V2 did the trick!
I can now run the Sharpen Complex V2 with no slowdowns what so ever and with the
amount of sharpness that I want. It's Perfect!!!

I also compiled the filter using 3.0 shaders instead of the 2a that I was using.

Thanks for all your help on this subject!
You have saved my Home-Theater experience.

Again, Thanks!!!


SpikeBit

nonob
26th May 2011, 14:58
Hi,

Can you explain me what are difference between sharpen, sharpen complex 1, sharpen complex 2 and edge sharpen and which one should i use to have the better quality?

Thanks