LOG
Feb 9,2020 - Started this with SCALING section
Mar 8, 2020 - Added PRFILING section and corrected some spelling (also added my current setting.bin)
July 18, 2080 - Cancel HDR for this post ... will create separate one just for HDRThis guide will try to simply explain MadVR following settings:
*scaling
*profiling
*HDRFor other MadVR options refer to
https://wiki.jriver.com/index.php/MadVR_Expert_Guide.
SCALINGMost of us are used to images being described in RGB colorspace. RGB has 3 channels - Red Green Blue. Together they define each pixel color and brightness.
Video is encoded in YCbCr colorspace. This also has 3 channels - Y (luma) Cb (blue difference) Cr (red difference). Basically Y defines brightness of pixel and it looks like greyscale image. Cb and Cr together define the color/hue of pixel and are referred to as chroma channels. See the attached picture from Wikipedia on how YCbCr channels look and how they are combined to make a whole picture. For more details on YCbCr see
https://en.wikipedia.org/wiki/Chroma_subsampling. The point of this is -
video to consumers are in formats that have separate channel for brightness and colors.
Video that arrives to us is not "full" resolution, but subsampled. Basically the Luma channel arrives to you at full resolution while Chroma channels arrive at lower resolution. Subsampling is usually described with 3 numbers. 4:4:4 means no subsampling (all YCbCr channels are at full resolution). For more details on chroma subsampling see
https://en.wikipedia.org/wiki/Chroma_subsampling. Video that arrives to us is usually 4:2:0 (see attached picture from Wikipedia for what 4:2:0 look like) - meaning
video to consumers has Luma/brightness at full resolution and Chroma/color at half resolution.
So scaling is a 2-step process:
1. upscale Chroma to original full resolution
2. now that you have both Luma and Chroma at original full resolution - scale them to the required resolution if needed (for example if your TV is 1080p and your video is 1080p ... only chroma upscaling is required)
MadVR scaling options are grouped under [scaling algorithms] which further groups options under 4 subcategories
[chroma upscaling] - lets you choose the algorithm for scaling the chroma channel to original full resolution
[image downscaling] - lets you choose the algorithm for downscaling chroma and luma to the required resolution (eg you downsacale 4K for your HD TV)
[image upscaling] - lets you choose the algorithm for upscaling chroma and luma to the required resolution (eg you upscale HD for your 4K TV)
[upscaling refinement] - various options for refining scaling results (I will not explain this here ... options there are self explanatory ... if you are interested, just try them one by one and see if you like the results)
Scaling algorithms for [chroma upscaling], [image downscaling], [image upscaling] are presented in a column. The simplest algorithms are on top and as you go down the list - complexity/quality of algorithm will increase (there is also a drop box at bottom of the algorithm list that lets you choose settings for your algorithm). There are bars on the right of algorithm list that indicate the quality of each algorithm:
sharpness - how sharp is chosen algorithm (the more green the better)
hide source artifact - how well chosen algorithm hides artifacts that came with video (the more green the better)
aliasing - how much aliasing chosen algorithm produce (the less red the better)
ringing - how much ringing chosen algorithm produce (the less red the better)
other artifacts - how many artifacts the chosen algorithm produces (the less red the better)
for [image upscaling] the list of algorithms are presented in two columns
(1) upscaling - the algorithm here scales your video directly to the desired resolution ... for example if 720p needs to be scaled to 1080p ... the algorithm will straight away scale by x1.5
(2) doubling - this algorithm doubles or quadruples the video first (as it'ss very cheap to do in terms of processing power) then downscales the result to the desired resolution ... for example if 720p needs to be scaled to 1080p ... the algorithm here will scale by x2 first then downsale by x0.75
for doubling process you can specify the quality of your luma and chroma doubling/quadrupling
TIP: always choose better algorithms for luma upscaling as it is more noticable.
Your GPU will dictate which algorithms you can use. The following will describe tuning process. During movie playback, you will need to press CTR+J to bring MadVR OSD info up onto screen (press CTR+R to reset its statistics)
(1) determine how fast your GPU needs to render each frame. Look at OSD [movie] it will tell you frames per second (fps) of your movie. Divide one by that and you get max limit. For example if movie is 60fps, then limit is 1/60=0.016s=16ms.
(2) look at OSD [average stats -> rendering] if times there exceed the limit determined in step 1, then your scaling algorithms are too complex for your GPU to handle in real time. Choose a simpler algorithm. Your aim is to reduce the rendering time to be within the time limit determined in step 1 (give yourself margin ... so if the limit is 16ms ... then aim for around 12ms rendering times)
(3) if the GPU cannot render a frame in the given time, it will drop that frame, resulting in stuttering ... look at your [dropped frames] ... press CTR+R to reset it ... there should be zero dropped frames while the movie is playing (this number can increase when starting movie or fast forwarding ... but during normal playback - there should be no dropped frames)
If you want one setting to "rule them all" ... choose the most complex movie for tuning:
1. Choose a movie with the highest fps
2. Choose a movie without any black bars (madVR is clever and doesn't scale blackbars ... hence your fine tuning on movie with 2.39:1 movie will not work on 16:9 movie)
3. Choose an actual movie, not a cartoon
4. For chroma upsampling choose 4K resolution
5. Once you determine the chroma algorithm ... pick a 1080p movie to determine the luma algorithm ... remember to always choose better algorithms for luma upscaling. So if necessary reduce chroma algorithm determined in step 4 to pick better one for luma
Now if you say ... but I dont want general setting to "rule them all" ... I want the best possible algorithm for different content I have ... thats where PROFILING comes in ... which I will write about next time
PROFILINGProfiling allows you to apply different MadVR settings to different situations. For example chroma upscaling for HD video to 4K can be set much better quality than for 4K videos. With profiling you can use one setting for HD video and another setting for 4K video.
It is very hard to explain this in general terms … so I will walk you through profiling [scaling algorithm] for HD and 4K video and you can apply same principle for your custom profiles
(1) click on [scaling algorithm] … on right there will be button [create profile group] … click on that
(2) choose all four settings [chroma upscaling] [image downscaling] [image upscaling] [upscaling refinement] to be profiled and click OK
(3) [Profile Group 1] will be created with [Profile 1] under it … rename this sensibly so you can make sense of it later …. lets rename [Profile Group 1] to [Video Source] and rename [Profile 1] to [2160p]
(4) click to newly renamed [Video Source] and click [add profile] … [Profile 2] will be created
(5) rename [Profile 2] to [1080p]
(6) repeat step (4) and rename new profile as [Other]
(7) click on [Video Source] and under [profile auto select rules] copy paste following
if ((srcWidth = 3840) or (srcHeight =2160)) "2160p"
else if ((srcWidth = 1920) or (srcHeight =1080)) "1080p"
else "Other"
this tests for conditions and choose appropriate profile … make sure your profile names match exactly what you write in "if, else if, else" statement (in my case its "2160p" and "1080p")
note that I test for both height and width of video … and if any of those match select appropriate profile (in case I choose to "handbrake" my video and remove black bars)
All you have to do now is tweak settings under each profile to maximize the potential of your GPU
Following are things that can be included in condition
srcWidth … eg srcWidth < 1920 (video height less than 1920)
srcHeight … eg srcHeight = 1080 (video width equal to 1080)
deintFps … eg deintFps > 30 (frame rate higher than 30fps)
fileName … eg fileName = "*anime*" (file name contain 'anime')
fileExt … eg fileExt = "mk*" (file extension starts with 'mk')
filePath … eg filePath = "*UHD*" (file path contains 'UHD')
you can form complex conditions with AND and OR operators
Here is what I have for my scaling profile (its work in progress)
if (fileExt = "mk3d") "3D"
else if (((srcWidth = 3840) or (srcHeight =2160)) and (deintFps > 30)) "2D_UHD_HFR"
else if ((srcWidth = 3840) or (srcHeight =2160)) "2D_UHD"
else if (((srcWidth = 1920) or (srcHeight =1080))and (filePath = "*Film*")) "2D_HDiF"
else if (((srcWidth = 1920) or (srcHeight =1080)) and (filePath = "*Video*")) "2D_HDiV"
else if ((srcWidth = 1920) or (srcHeight =1080)) "2D_HD"
else if (((srcWidth < 1920) and (srcHeight < 1080)) and (deintFps < 25)) "2D_SD"
else "2D_SDi"
you can apply above principles to any MadVR settings to profile them … I also attached my MadVR settings (this pushes my 1070 to the limit … so if you have lesser GPU, you will need to use less aggressive settings)