Uh oh!
There was an error while loading. Please reload this page.
fix(win/video): don't offload chroma subsampling math to texture sampler when downscaling - #3014
Conversation
5f86e5e to
9329e90CompareCodecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## master #3014 +/- ##
=========================================
+ Coverage 9.70% 9.83% +0.12%
=========================================
Files 77 101 +24 Lines 14055 17988 +3933 Branches 6443 8410 +1967 =========================================
+ Hits 1364 1769 +405 - Misses 10071 13337 +3266 - Partials 2620 2882 +262
Flags with carried forward coverage won't be shown. Click here to find out more.
|
ns6089
commented
Aug 25, 2024
The code in this pull request is Not a Contribution under LizardByte Individual Contributor License Agreement. |
cgutman
commented
Aug 28, 2024
Reopening now that the CLA has been revoked and this can now be accepted under the GPLv3 terms alone. |
Uh oh!
There was an error while loading. Please reload this page.
| return -1; \ | ||
| } | ||
| const bool downscaling = display->width != width || display->height != height; |
There was a problem hiding this comment.
| constbool downscaling = display->width != width || display->height != height; | |
| constbool downscaling = display->width > width || display->height > height; |
| float3 rgb = image.Sample(def_sampler, input.tex_right_center_left_top.xw).rgb; // top-right | ||
| rgb += image.Sample(def_sampler, input.tex_right_center_left_top.yw).rgb; // top-center | ||
| rgb += image.Sample(def_sampler, input.tex_right_center_left_top.zw).rgb; // top-left | ||
| rgb += image.Sample(def_sampler, input.tex_right_center_left_bottom.xw).rgb; // bottom-right | ||
| rgb += image.Sample(def_sampler, input.tex_right_center_left_bottom.yw).rgb; // bottom-center | ||
| rgb += image.Sample(def_sampler, input.tex_right_center_left_bottom.zw).rgb; // bottom-left | ||
| rgb = CONVERT_FUNCTION(rgb * (1./6)); |
There was a problem hiding this comment.
| float3 rgb = image.Sample(def_sampler, input.tex_right_center_left_top.xw).rgb; // top-right | |
| rgb += image.Sample(def_sampler, input.tex_right_center_left_top.yw).rgb; // top-center | |
| rgb += image.Sample(def_sampler, input.tex_right_center_left_top.zw).rgb; // top-left | |
| rgb += image.Sample(def_sampler, input.tex_right_center_left_bottom.xw).rgb; // bottom-right | |
| rgb += image.Sample(def_sampler, input.tex_right_center_left_bottom.yw).rgb; // bottom-center | |
| rgb += image.Sample(def_sampler, input.tex_right_center_left_bottom.zw).rgb; // bottom-left | |
| rgb = CONVERT_FUNCTION(rgb * (1./6)); | |
| float3 rgb = image.Sample(def_sampler, input.tex_right_center_left_top.yw).rgb; // top-center | |
| rgb += image.Sample(def_sampler, input.tex_right_center_left_bottom.yw).rgb; // bottom-center | |
| rgb *= 2; | |
| rgb += image.Sample(def_sampler, input.tex_right_center_left_top.xw).rgb; // top-right | |
| rgb += image.Sample(def_sampler, input.tex_right_center_left_top.zw).rgb; // top-left | |
| rgb += image.Sample(def_sampler, input.tex_right_center_left_bottom.xw).rgb; // bottom-right | |
| rgb += image.Sample(def_sampler, input.tex_right_center_left_bottom.zw).rgb; // bottom-left | |
| rgb = CONVERT_FUNCTION(rgb * (1./8)); |
Also just realized we can sightly improve the quality and be consistent with what we do in no scaling path (#1621 (comment)) at pretty much no additional cost.
ns6089
commented
Aug 31, 2024
Also fixed portrait rotation bug that's been there since that feature got first introduced https://github.com/ns6089/Sunshine/pull/3014/commits/f41242f819c0c1fc1372bf8a3c605e059c8f8073 |
…20_packed_uv_ps_base.hlsl
…20_packed_uv_ps_base.hlsl
f41242f to
bc2bd06Compare
|
…ler when downscaling (LizardByte#3014) * Don't use sampler math for chroma if downscaling * Correct portrait rotation offsets
…ler when downscaling (#3014) * Don't use sampler math for chroma if downscaling * Correct portrait rotation offsets
…ler when downscaling (LizardByte#3014) * Don't use sampler math for chroma if downscaling * Correct portrait rotation offsets
…ler when downscaling (LizardByte#3014) * Don't use sampler math for chroma if downscaling * Correct portrait rotation offsets




Description
Don't offload math to texture sampler when subsampling chroma together with downscaling.
Fixes broken chroma when downscaling.
This makes chroma consistent with luma when downscaling, but luma itself is broken if the factor is >2x and half-broken with lesser factors (inconsistent filter radius, linear texture sampler alone can't be used for proper downscaling).
I'm hesitant to touch upscaling because of the potential performance hit.
Screenshot
Before


After
Issues Fixed or Closed
Type of Change
.github/...)Checklist