-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(win/video): don't offload chroma subsampling math to texture sampler when downscaling #3014
Conversation
5f86e5e
to
9329e90
Compare
Codecov 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.
|
The code in this pull request is Not a Contribution under LizardByte Individual Contributor License Agreement. |
Reopening now that the CLA has been revoked and this can now be accepted under the GPLv3 terms alone. |
return -1; \ | ||
} | ||
|
||
const bool downscaling = display->width != width || display->height != height; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const bool downscaling = display->width != width || display->height != height; | |
const bool 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Also fixed portrait rotation bug that's been there since that feature got first introduced ns6089@f41242f |
…20_packed_uv_ps_base.hlsl
…20_packed_uv_ps_base.hlsl
f41242f
to
bc2bd06
Compare
Quality Gate failedFailed conditions See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
…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