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. |
26th October 2010, 05:58 | #1 | Link |
Registered User
Join Date: Oct 2010
Location: The Netherlands
Posts: 1,083
|
Video pixel shader pack
Video pixel shader pack v1.4
Direct download link: http://www.mediafire.com/?025vsef8ads6t5x YCbCr-type sharpen complex test 2 Direct download link: http://www.mediafire.com/?7vec9jyc8y861s9 For quite some time now, I've been developing pixel shaders for usage as image filters in video players. Pixel shaders are basically small programs for the video card to transform images. These pixel shaders are currently known to be compatible with KMPlayer, PotPlayer and MPC-HC. If there are any flaws in the comments or code of the pixel shaders, please tell me. I'll happily correct items. I intend to add new functions over time, so please suggest new filter types. To make a pixel shader work in MPC-HC: Depending on your OS and synchronization needs, select "VMR-9", "EVR Custom Pres." or "EVR Sync" in the "View">"Options">"Playback">"Output" menu. You can hover the mouse pointer over the different renderer options to get a description. Make sure that D3D fullscreen is disabled for the time being, you can activate it later on, when you've successfully enabled a shader. Next, to enable a shader, right-click somewhere near the middle of a playing video, select "Shaders" and click on "invert" or some other shader that is really easy to test. You might need to switch "Toggle Pixel Shaders" before a shader will work. You can use multiple shaders in the "Combine Shaders..." or "Combine Screen Space Shaders..." menu. Not all shaders can be used in screen space mode. Some shaders can't be used if your video card is old. View the comment about the pixel shader revisions in my shader to see wich video cards can use that shader. Some shaders benefit greatly from enabling the the three "10-bit color" and "full floating point processing" options in "View">"Rendering Settings">"Presentation". To add a new shader: Tick "View">"Shader Editor". Type in the name of a new shader in the long top left bar of the Shader Editor, to make the compiler write out a small, but useless script. Next, set the highest version pixel shader that your graphics card supports in the drop-down menu of the top right bar, avoid the software (sw) modes. Remove all text from the main text box. Copy the full text of a new shader and paste the text in the main text box. If there's an error, the compiler will output an error code inside of the bottom message box. If all went well you will get a success message, the calculation chain will be displayed and the number of instructions used will be at the end of the text. You can also use the drop-down menu from the top left bar to select and edit an already existing shader. Tip: because I like to switch between shaders, but don't want to disable D3D Fullscreen I made a basic text batch file (.bat) to enable a certain shader. An example for activating "invert": REG ADD "HKCU\Software\Gabest\Media Player Classic\Settings" /V "Shaders List" /D "invert|" /F REG ADD "HKCU\Software\Gabest\Media Player Classic\Settings" /V "ShaderListScreenSpace" /D "" /F To disable all active shaders: REG ADD "HKCU\Software\Gabest\Media Player Classic\Settings" /V "Shaders List" /D "" /F REG ADD "HKCU\Software\Gabest\Media Player Classic\Settings" /V "ShaderListScreenSpace" /D "" /F To activate multiple shaders, separate the names by "|" (pipe), but also keep the one on the end. Note: MPC-HC can't save larger shaders to the .INI settings files. Saving settings to the registry solves that problem. If you want to make a copy of your settings from the registry: - run regedit - expand the tree to "HKEY_CURRENT_USER\Software\Gabest\Media Player Classic" - right-click the "Media Player Classic" key - click the export option It produces an executable .REG file that you can use as a back-up or to transfer settings to another PC. Directory listing: Code:
chroma interpolation color controls COPYING.txt development effect gamma conversion for linear RGB readme - how to properly chain shaders.txt releaselog Video pixel shader pack v1.3.txt resizer sharpen sharpen complex, deband and denoise chroma interpolation\4÷2÷0 bilinear chroma filter and color controls for SD&HD video input.txt chroma interpolation\4÷2÷2 bilinear chroma filter and color controls for SD&HD video input.txt chroma interpolation\multi-pass chroma interpolation\multi-pass\~4÷2÷0 content is up-sampled by a sequence of 1, 2 and 3 chroma interpolation\multi-pass\~4÷2÷2 content is up-sampled by a sequence of 1 and 3 chroma interpolation\multi-pass\1. RGB to Y'CbCr for SD&HD video input for floating point surfaces.txt chroma interpolation\multi-pass\1. RGB to Y'CbCr for SD&HD video input for integer surfaces.txt chroma interpolation\multi-pass\2. special 4÷2÷0 to 4÷2÷2 intermediate Catmull-Rom spline5 chroma up-sampling.txt chroma interpolation\multi-pass\2. special 4÷2÷0 to 4÷2÷2 intermediate cubic B-spline5 chroma up-sampling.txt chroma interpolation\multi-pass\2. special 4÷2÷0 to 4÷2÷2 intermediate Mitchell-Netravali cubic5 chroma up-sampling.txt chroma interpolation\multi-pass\3. special 4÷2÷2 Catmull-Rom spline5 chroma up-sampling and color controls for floating point surfaces.txt chroma interpolation\multi-pass\3. special 4÷2÷2 Catmull-Rom spline5 chroma up-sampling and color controls for integer surfaces.txt chroma interpolation\multi-pass\3. special 4÷2÷2 cubic B-spline5 chroma up-sampling and color controls for floating point surfaces.txt chroma interpolation\multi-pass\3. special 4÷2÷2 cubic B-spline5 chroma up-sampling and color controls for integer surfaces.txt chroma interpolation\multi-pass\3. special 4÷2÷2 Mitchell-Netravali cubic5 chroma up-sampling and color controls for floating point surfaces.txt chroma interpolation\multi-pass\3. special 4÷2÷2 Mitchell-Netravali cubic5 chroma up-sampling and color controls for integer surfaces.txt color controls\[16, 235], [16, 240], [16, 240] to full range for SD&HD video input.txt color controls\brightness, contrast and gamma controls for RGB.txt color controls\brightness, contrast, grayscale gamma, colorfulness gamma, hue and saturation controls for SD&HD video input.txt color controls\full range to [16, 235], [16, 240], [16, 240] for SD&HD video output.txt development\~interpolation methods, Catmull-Rom spline.txt development\~interpolation methods, cubic B-spline.txt development\~interpolation methods, Mitchell-Netravali cubic.txt development\~standard Y'CbCr and RGB conversion codes.txt development\3LCD panel horizontal software alignment, Catmull-Rom spline6 interpolated.txt development\3LCD panel vertical software alignment, Catmull-Rom spline6 interpolated.txt development\Catmull-Rom spline4×4 resizer (inefficient one-pass).txt development\color gradients.txt development\correct video colorspace BT.601 [SD] to BT.709 [HD] for HD video input.txt development\correct video colorspace BT.709 [HD] to BT.601 [SD] for SD video input.txt development\cubic B-spline4×4 resizer (inefficient one-pass).txt development\deinterlace (blend).txt development\detect BT.601 [SD] or BT.709 [HD].txt development\detect even or odd coordinates, alternative.txt development\detect even or odd coordinates.txt development\draw grid coordinates.txt development\flash every frame.txt development\flash every second.txt development\letterbox.txt development\Mitchell-Netravali cubic4×4 resizer (inefficient one-pass).txt development\pillarbox.txt development\RGB to Y'CbCr for SD&HD video input for floating point surfaces.txt development\RGB to Y'CbCr for SD&HD video input for integer surfaces.txt development\Y'CbCr to HD&SD video RGB output for floating point surfaces.txt development\Y'CbCr to HD&SD video RGB output for integer surfaces.txt effect\chroma for SD&HD video input.txt effect\color gate for RGB.txt effect\color gate for SD&HD video input.txt effect\color gate inverse for RGB.txt effect\color gate inverse for SD&HD video input.txt effect\contour color expose banding.txt effect\contour color.txt effect\contour monochrome.txt effect\emboss.txt effect\flip and rotate sampling direction for RGB.txt effect\grayscale for RGB.txt effect\grayscale for SD&HD video input.txt effect\invert.txt effect\nightvision.txt effect\projector film drive scratches.txt effect\projector film dust.txt effect\projector film lamp vignette.txt effect\projector film sepia toning for SD&HD video input.txt effect\projector film shaking.txt effect\semi-random colored surface noise.txt effect\semi-random grayscale noise.txt effect\sphere, Catmull-Rom spline4×4 interpolated.txt effect\spotlight.txt effect\wave, Catmull-Rom spline4×4 interpolated.txt gamma conversion for linear RGB\gamma conversion of linear RGB to video RGB for floating point surfaces.txt gamma conversion for linear RGB\gamma conversion of linear RGB to video RGB for integer surfaces.txt gamma conversion for linear RGB\gamma conversion of linear RGB to wide gamut RGB for floating point surfaces.txt gamma conversion for linear RGB\gamma conversion of linear RGB to wide gamut RGB for integer surfaces.txt gamma conversion for linear RGB\gamma conversion of video RGB to linear RGB for floating point surfaces.txt gamma conversion for linear RGB\gamma conversion of video RGB to linear RGB for integer surfaces.txt resizer\Catmull-Rom spline4 height resizer.txt resizer\Catmull-Rom spline4 width resizer.txt resizer\Catmull-Rom spline5 height doubler.txt resizer\Catmull-Rom spline5 width doubler.txt resizer\Catmull-Rom spline6 height resizer.txt resizer\Catmull-Rom spline6 width resizer.txt resizer\cubic B-spline4 height resizer.txt resizer\cubic B-spline4 width resizer.txt resizer\cubic B-spline5 height doubler.txt resizer\cubic B-spline5 width doubler.txt resizer\cubic B-spline6 height resizer.txt resizer\cubic B-spline6 width resizer.txt resizer\Mitchell-Netravali cubic4 height resizer.txt resizer\Mitchell-Netravali cubic4 width resizer.txt resizer\Mitchell-Netravali cubic5 height doubler.txt resizer\Mitchell-Netravali cubic5 width doubler.txt resizer\Mitchell-Netravali cubic6 height resizer.txt resizer\Mitchell-Netravali cubic6 width resizer.txt resizer\Perlin Smootherstep2×2 resizer.txt sharpen\sharpen.txt sharpen\unsharp luma mask for SD&HD video.txt sharpen complex, deband and denoise\~the r=6 types are the most complex, the r=1 types the least sharpen complex, deband and denoise\r=1 blur.txt sharpen complex, deband and denoise\r=1, sharpen complex, deband and extreme denoise.txt sharpen complex, deband and denoise\r=1, sharpen complex, deband and heavy denoise.txt sharpen complex, deband and denoise\r=1, sharpen complex, deband and medium denoise.txt sharpen complex, deband and denoise\r=1, sharpen complex, deband and mild denoise.txt sharpen complex, deband and denoise\r=1, sharpen complex, deband and minimal denoise.txt sharpen complex, deband and denoise\r=1, sharpen edge complex, deband and extreme denoise.txt sharpen complex, deband and denoise\r=1, sharpen edge complex, deband and heavy denoise.txt sharpen complex, deband and denoise\r=1, sharpen edge complex, deband and medium denoise.txt sharpen complex, deband and denoise\r=1, sharpen edge complex, deband and mild denoise.txt sharpen complex, deband and denoise\r=1, sharpen edge complex, deband and minimal denoise.txt sharpen complex, deband and denoise\r=2 blur.txt sharpen complex, deband and denoise\r=2, sharpen complex, deband and extreme denoise.txt sharpen complex, deband and denoise\r=2, sharpen complex, deband and heavy denoise.txt sharpen complex, deband and denoise\r=2, sharpen complex, deband and medium denoise.txt sharpen complex, deband and denoise\r=2, sharpen complex, deband and mild denoise.txt sharpen complex, deband and denoise\r=2, sharpen complex, deband and minimal denoise.txt sharpen complex, deband and denoise\r=3 blur.txt sharpen complex, deband and denoise\r=3, sharpen complex, deband and extreme denoise.txt sharpen complex, deband and denoise\r=3, sharpen complex, deband and heavy denoise.txt sharpen complex, deband and denoise\r=3, sharpen complex, deband and medium denoise.txt sharpen complex, deband and denoise\r=3, sharpen complex, deband and mild denoise.txt sharpen complex, deband and denoise\r=3, sharpen complex, deband and minimal denoise.txt sharpen complex, deband and denoise\r=4 blur.txt sharpen complex, deband and denoise\r=4, sharpen complex, deband and extreme denoise.txt sharpen complex, deband and denoise\r=4, sharpen complex, deband and heavy denoise.txt sharpen complex, deband and denoise\r=4, sharpen complex, deband and medium denoise.txt sharpen complex, deband and denoise\r=4, sharpen complex, deband and mild denoise.txt sharpen complex, deband and denoise\r=4, sharpen complex, deband and minimal denoise.txt sharpen complex, deband and denoise\r=5 blur.txt sharpen complex, deband and denoise\r=5, sharpen complex, deband and extreme denoise.txt sharpen complex, deband and denoise\r=5, sharpen complex, deband and heavy denoise.txt sharpen complex, deband and denoise\r=5, sharpen complex, deband and medium denoise.txt sharpen complex, deband and denoise\r=5, sharpen complex, deband and mild denoise.txt sharpen complex, deband and denoise\r=5, sharpen complex, deband and minimal denoise.txt sharpen complex, deband and denoise\r=6 blur.txt sharpen complex, deband and denoise\r=6, sharpen complex, deband and extreme denoise.txt sharpen complex, deband and denoise\r=6, sharpen complex, deband and heavy denoise.txt sharpen complex, deband and denoise\r=6, sharpen complex, deband and medium denoise.txt sharpen complex, deband and denoise\r=6, sharpen complex, deband and mild denoise.txt sharpen complex, deband and denoise\r=6, sharpen complex, deband and minimal denoise.txt Last edited by JanWillem32; 14th September 2011 at 09:28. Reason: released a new version |
2nd November 2010, 19:19 | #3 | Link |
Registered User
Join Date: Aug 2006
Posts: 2,229
|
I'd be interested in having a look at them too. The upsampling shaders demonstrated in the attached images look interesting, I'd like to see how they'd look on a more detailed scene. I think when combined with a nice sharpening effect like 'sharpen complex 2' they'd look especially good...
Here's a question though... How is the work distributed on the shaders? Does it use few shaders but intensely, or divide up the image into areas and distribute the work to the shaders that way (and hence use them lightly)? |
3rd November 2010, 11:57 | #4 | Link |
MPC-HC Project Manager
Join Date: Mar 2007
Posts: 2,317
|
Hello and thanks for sharing this.
I will try to answer your questions: 1. All the code and comments should be in english, since most of our stuff is hosted in the US their english probably works best. 2. The Shaders should use GPU as efficiently as possible, but those that are very heavy might be marked as such. Don't compromise quality over speed unless you have to.
__________________
MPC-HC, an open source project everyone can improve. Want to help? Test Nightly Builds, submit patches or bugs and chat on IRC |
4th November 2010, 01:05 | #6 | Link |
Registered User
Join Date: Oct 2010
Location: The Netherlands
Posts: 1,083
|
Thank you for your input, I've been busy improving my shaders (including procamp). It took a lot of effort to get the two "4÷2÷0 Chroma Up-sampling&16-235 To 0-255" shaders to work with the 64 instructions limit for ps_2_0.
@toniash; Very well, I attached almost everything I currently have. @burfadel; Pixel shaders work by taking one pixel of a new, empty frame and construct it pixel-by-pixel by sampling and processing pixels from an original frame. An output frame size of 1920×1080 pixels will execute the same pixel shader 1920×1080 = 2,073,600 times. It is even more times if your pixel shader samples multiple pixels per execution, when stacked with another pixel shader, see my little test at the end of this post. Secondly, I added chroma sharpen to the pixel shader and I made a hybrid that combines chroma 4:2:0 up-sampling, chroma sharpen, sharpen complex and deband. The attached screenshot is not the best representation of what the hybrid shader usually does, but indeed, sharpening does work. I will search for a better example. @tetsuo55; I commented everything in US English and increased efficiency quite a bit for a few shaders. @leeperry; Nice to know that other programs can use this type of shaders too, I will see to it that the comments will not be program-specific. These shaders should really be deleted. 0-255 -> 16-235; The chroma values are not compressed properly and it can not be used with input bitdepths higher than 8-bit. 16-235 -> 0-255; [SD] Applying expansion only to BT.601 [SD] material is wrong, as BT.709 [HD] is limited to "16-235" as well, the only full range YUV colorspaces are: JPEG (most variants), Digital Cinema (JPEG2000 variant), FRAPS video and many studio formats. 16-235 -> 0-255 [SD][HD]; The chroma values are not expanded properly and it can not be used with input bitdepths higher than 8-bit. BT.601 -> BT.709; The colorspaces are calculated with truncated decimal fractions, the SD/HD detection rule is wrong for video with a resolution of 1280×533, aspect ratio 1/2.40. grayscale; Uses a BT.601 [SD] colorspace, so the name is wrong. procamp; Uses a BT.601 [SD] colorspace with truncated decimal fractions. YV12 Chroma Upsampling; Uses a BT.601 [SD] colorspace with truncated decimal fractions, even worse, the method is wrong, see images for reference. Note: ">" can not be used for filenames in NTFS, FAT32 or exFAT filesystems. When saving a shader in a text file, it is often preferred to name the file the same way as the title of the shader, so avoid using the "forbidden" characters in the titles for shaders. I measured the GPU usage for video playback with two of my shaders and compared it to other modes. Video card: ATi Radeon HD4890 at 600 MHz GPU clock and 975 MHz memory clock (forced clockspeeds in ATi Tray Tools) Display: Compaq P1220 CRT, D-Sub analog, 2048×1536, 80Hz Software: Windows 7 Home Premium x64, ATi Catalyst 10.5a (the last version capable of 10-bit RGB output from DXVA, the driver does not up-sample down-sampled chroma in 10-bit RGB mode), ATi Tray Tools v1.6.9.1486 (for measuring), MPC-HC x64 v1.4.2667.0 Rendering: Aero enabled, internal H264/AVC DXVA decoder, EVR-CP, no advanced features of ATi Catalyst (they do not work in 10-bit RGB mode anyway, exept for Denoise) EVR-CP rendering options: Output Range 0-255, 10-bit RGB Output, Force 10-bit RGB Input, Full Floating Point Processsing, Enable Frame Time Correction, color Management Enabled (with a recently made system-wide color profile), VSync disabled, Flush GPU after Present. Video source: Blu-ray of the movie "Avatar" (without subtitles), H.264/AVC/MPEG 4 part 10 codec, 4:2:0 chroma subsampling, 8-bit per component YUV. (Quite a shame, the main feature file almost fills up the entire 50 GB of the disk, but it does not use 4:4:4 (no subsampling of chroma) with at least 10-bit per component YUV, like the Digital Cinema version.) Measurement of peak GPU usage after 5 seconds of video (when the frame rate remains stable) 87.65%; render with "4÷2÷0 Chroma Up-sampling BT.709 [HD]" and "Sharpen Complex v3 + Deband" 54.08%; render with "Sharpen Complex v3 + Deband" 10.04%; render with "4÷2÷0 Chroma Up-sampling BT.709 [HD]" 08.71%; render without shaders 02.20%; MPC-HC not loaded, system almost idle 86.03%; render with "4÷2÷0 Chroma Up-sampling BT.709 [HD]" and "Sharpen Complex v3 + Deband" in D3D Fullscreen Mode 67.86%; render with an experimental hybrid shader of "4÷2÷0 Chroma Up-sampling BT.709 [HD]" and "Sharpen Complex v3 + Deband" in D3D Fullscreen Mode Processing pixel shaders in ps_3_sw or ps_2_sw (CPU software mode) failed. I could not detect any changes in peak or average GPU usage between rendering in ps_2_0 and in ps_3_0 modes for the "4÷2÷0 Chroma Up-sampling BT.709 [HD]" shader. When stacking any pixel before "Sharpen Complex v3 + Deband", that pixel shader is used on all 177 input pixels, for every pixel the "Sharpen Complex v3 + Deband" shader is used on. This method is rather inefficient when combining heavy shaders. Does anyone know a solution to this problem? (Like using a buffer frame in-between shaders or something, if possible.) The experimental hybrid shader does not output the same thing as the two shaders combined. It only up-samples the current pixel it is working on, not the surrounding pixels, unfortunately. Last edited by JanWillem32; 15th February 2011 at 04:59. |
4th November 2010, 01:22 | #7 | Link | |
*****
Join Date: Feb 2005
Posts: 5,647
|
Quote:
__________________
MPC-HC 2.2.1 |
|
4th November 2010, 14:20 | #9 | Link |
Registered User
Join Date: Oct 2010
Location: The Netherlands
Posts: 1,083
|
@clsid How old are the drivers that only mess up luma/chroma expansion of SD content (without messing up de-blocking, de-ringing, chroma up-sampling, colorspace, etcetera)? I Know that 10.4, 10.5 and 10.5a totally mess up SD playback, but I never noticed wrong output levels on SD content even with older drivers. Enabling "16-235 To 0-255 BT.601 [SD]" will provide proper expansion by the way, but I did not include an auto-detect function for SD/HD. If there are more problems than only luma/chroma expansion, I can make a hybrid of a few shaders to correct all of those problems.
@leeperry I certainly hope so. |
4th November 2010, 20:43 | #10 | Link |
*****
Join Date: Feb 2005
Posts: 5,647
|
The problem only occurs with some of the video renderers. Most notably with VMR-9 (renderless).
__________________
MPC-HC 2.2.1 |
6th November 2010, 19:21 | #13 | Link |
Registered User
Join Date: Aug 2006
Posts: 2,229
|
Particularly 'Sharpen Complex v3 + Deband' and 4÷2÷2 Chroma Up-sampling BT.601 [SD]
What difference would using the shader editor and setting them as PS 3.0 instead of PS 2.0? If they fairly intensive and require a non-ancient GPU, then PS 3.0 should be fine... Even PS 3.0 is ancient by todays standards. |
6th November 2010, 22:19 | #14 | Link |
Registered User
Join Date: Oct 2010
Location: The Netherlands
Posts: 1,083
|
@clsid I could not find a more recent entry than 2008, when a few driver versions had the "UseBT601CSC" registry entry on "0", instead of "1". The correct solution is to install a recent driver (even the legacy hardware driver is at 10.2), or switch "UseBT601CSC" on (with DXVA checker or regedit). Unless a new driver comes out with this problem, it would be best to get rid of the "16-235 -> 0-255 [SD]" shader. It is inaccurate too by the way: The chroma values are not expanded properly, it can not be used with input bitdepths higher than 8-bit and the SD/HD detection rule is wrong for video with a resolution of 1280×533, aspect ratio 1/2.40.
@burfadel compiler message at the end of compiling: 4÷2÷2 Chroma Up-sampling&16-235 To 0-255 BT.601 [SD]: ps_2_0: error X5608: Compiled shader code uses too many arithmetic instruction slots (86). Max. allowed by the target (ps_2_0) is 64. ps_2_a: // approximately 62 instruction slots used (6 texture, 56 arithmetic) ps_3_0: // approximately 55 instruction slots used (6 texture, 49 arithmetic) For some reason PS 2.0 is really inefficient when dealing with this code (it's about the same with all other shaders, too). Sharpen Complex v3 + Deband is very demanding (the hybrid shader is even more complex): ps_2_0: error X5426: Shader uses texture addressing operations in a dependency chain that is too complex for the target shader model (ps_2_0) to handle. & error X4505: maximum temp register index exceeded ps_2_a: error X4505: maximum temp register index exceeded ps_3_0: // approximately 917 instruction slots used (177 texture, 740 arithmetic) I'm not even going to try to fit that into a PS 2.0a version. I did make the "4÷2÷0 Chroma Up-sampling&16-235 To 0-255" shaders simple enough to be run by PS 2.0 (for ancient hardware). To answer your question: shader code is handled more more efficiently by newer versions because the compiler can use more kinds of instructions to feed to the processor. Secondly, PS 2.0 has an arithmetic instruction limit of only 64. As you can see with my first example, a simple shader like this only needs 49, if compiled with reasonably modern processing code. I can look up what a DX11 compiler does with the code, by the way. It will probably use even less instructions. I wonder if picture scaling with PS 3.0 could be implemented besides the PS 2.0 versions, it would probably be more efficient. I added a newer version of Sharpen Complex v3 + Deband that doesn't produce as much staircase artifacts as my first test version. It looks okay on 1080p scenes even with extremely sharp contrasts, but artifacts are still too visible on lower input video resolutions. The power factor to balance the sharpening on extremely sharp contrasts is not perfect yet, maybe someone can think of something to balance it a bit better. Running the shader in screen space isn't possible for my setup, my GPU can't execute this shader at 80 Hz (and it would be inefficient to do that with 24 fps input video). I would like to know if it's possible to execute a shader on textures that are scaled to the display resolution, but are not locked to the screen refresh rate. @CiNcH This topic really needs to draw a bit more attention, indeed. It has been days since I posted those shaders and a picture. What kind of vulgar ASCII art do members of this forum put inside textfiles to demand that a mod has to approve attached textfiles of 13 KB or less? Last edited by JanWillem32; 21st November 2010 at 13:42. Reason: removed old scripts |
7th November 2010, 04:54 | #17 | Link |
Registered User
Join Date: Oct 2010
Location: The Netherlands
Posts: 1,083
|
@nurbs I wanted a shader that can deband. The approach was easy: analyze if the surrounding areas are nearly the same and then blur the pixel with the surrounding areas. Because that analysis also tells you if the pixel is on a contour or in a detailed area, it is very easy to implement sharpen too. I re-used a lot of code from sharpen complex v2 for the sharpen part. They were easy to combine, and the sharpen part can be disabled by setting the amount of sharpen coefficients to 0. That doesn't lower the processing requirements a lot however.
The complex part is that it first analyses the surrounding pixels, and then uses a mechanism that increases (or decreases) the contrast of the pixel that the shader is working on. My shader uses 6 different methods to either blur or sharpen, depending on the contrast with the surrounding zones. I know that this shader is a bit "future orientated", but with the very fast increase in GPU power over the years, I don't mind making a heavy shader. The shader is still beta, it could use some more blur and sharpen methods and it really needs some fine-tuning of the sharpening adaptation to the relative contrast. At the moment it is okay for 1080p, but only so-so for 720p, unless I upscale it to the display resolution first. @CiNcH "UseBT601CSC" tells the GPU driver to convert limited range YUV <16,235> for Y (luma), <16,240> for U and V (chroma), to full-range YUV when enabled (<0,255> in 8-bit or normalized <0,256> for higher bitdepths), or to do no conversion when disabled. When luma is not expanded, a converted full-range RGB picture will have a dark gray tint instead of black, and a light gray tint instead of white. When Chroma is not expanded, colors can not become saturated, and the whole picture will be dull. |
7th November 2010, 19:31 | #19 | Link |
MPC-HC Project Manager
Join Date: Mar 2007
Posts: 2,317
|
hey JanWillem32 could you explain why we need all the different, nearly the same name shaders?
don't we all just want to: Chroma upscale, luma upscale, expand(or compress), deband, denoise and sharpen?
__________________
MPC-HC, an open source project everyone can improve. Want to help? Test Nightly Builds, submit patches or bugs and chat on IRC Last edited by tetsuo55; 7th November 2010 at 19:35. |
7th November 2010, 22:11 | #20 | Link |
Registered User
Join Date: Aug 2006
Posts: 2,229
|
I add noise through ffdshow, not remove it! lol. Not on default settings though, no chroma and reduce the luma noise down, deprending on resolution. Since the noise is fine and non-chroma, it actually seems to improve picture quality when you're not too close to the screen
I'm guessing you mean encoded noise though, which is different as noise doesn't encode (and hence decode) too well and there's a lot more of it! |
|
|