Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Issue 321253002: Simple GPU based dithering (Closed)

Created:
6 years, 6 months ago by krajcevski
Modified:
4 years, 8 months ago
CC:
skia-review_googlegroups.com
Base URL:
https://skia.googlesource.com/skia.git@master
Visibility:
Public.

Description

Simple GPU based dithering: If dithering is turned on, apply an effect that filters the pixel through the following pipeline: for each channel c, add a random value between 0 and 1 to the floating point representation (32-bit) of c. This is enough to bump some channels up a notch after quantization and creates a small dithering pattern. Committed: https://skia.googlesource.com/skia/+/f461a8fdf642ba713dcdfb217534652df1eac278

Patch Set 1 #

Total comments: 10

Patch Set 2 : Code reveiw changes #

Patch Set 3 : Sync to head #

Patch Set 4 : Use ordered dithering #

Total comments: 1

Patch Set 5 : Benches + fixes #

Patch Set 6 : Turn off dithering on GM #

Total comments: 1

Patch Set 7 : Random value as threshold #

Patch Set 8 : Erroneous flag updated #

Total comments: 4

Patch Set 9 : Add random offset to alpha, too #

Patch Set 10 : Bugfixes and gm ignores #

Patch Set 11 : Sync to head #

Unified diffs Side-by-side diffs Delta from patch set Stats (+230 lines, -23 lines) Patch
M bench/GradientBench.cpp View 1 2 3 4 5 6 7 8 9 10 5 chunks +42 lines, -6 lines 0 comments Download
M expectations/gm/ignored-tests.txt View 1 2 3 4 5 6 7 8 9 1 chunk +23 lines, -0 lines 0 comments Download
M gyp/gpu.gypi View 1 1 chunk +2 lines, -0 lines 0 comments Download
M gyp/skia_for_chromium_defines.gypi View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
M src/gpu/SkGr.cpp View 1 2 3 4 5 6 7 8 9 3 chunks +42 lines, -11 lines 0 comments Download
A + src/gpu/effects/GrDitherEffect.h View 1 chunk +5 lines, -6 lines 0 comments Download
A src/gpu/effects/GrDitherEffect.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +115 lines, -0 lines 0 comments Download

Messages

Total messages: 24 (0 generated)
krajcevski
6 years, 6 months ago (2014-06-10 21:17:36 UTC) #1
egdaniel
One other thought (and probably todo in a follow up CL), as you showed me ...
6 years, 6 months ago (2014-06-11 14:05:10 UTC) #2
robertphillips
1gtm - but I defer to Brian and Greg https://codereview.chromium.org/321253002/diff/1/src/gpu/effects/GrDitherEffect.cpp File src/gpu/effects/GrDitherEffect.cpp (right): https://codereview.chromium.org/321253002/diff/1/src/gpu/effects/GrDitherEffect.cpp#newcode96 src/gpu/effects/GrDitherEffect.cpp:96: ...
6 years, 6 months ago (2014-06-11 14:14:33 UTC) #3
robertphillips
https://codereview.chromium.org/321253002/diff/1/src/gpu/effects/GrDitherEffect.cpp File src/gpu/effects/GrDitherEffect.cpp (right): https://codereview.chromium.org/321253002/diff/1/src/gpu/effects/GrDitherEffect.cpp#newcode87 src/gpu/effects/GrDitherEffect.cpp:87: // for each channel c: // 1. Compute quantized ...
6 years, 6 months ago (2014-06-11 14:15:50 UTC) #4
bsalomon
Any idea how it affects perf? Might be good to have a bench with dither/non-dithered ...
6 years, 6 months ago (2014-06-11 14:20:16 UTC) #5
egdaniel
https://codereview.chromium.org/321253002/diff/1/src/gpu/effects/GrDitherEffect.cpp File src/gpu/effects/GrDitherEffect.cpp (right): https://codereview.chromium.org/321253002/diff/1/src/gpu/effects/GrDitherEffect.cpp#newcode96 src/gpu/effects/GrDitherEffect.cpp:96: builder->fsCodeAppendf("\t\tfloat r = " On 2014/06/11 14:14:32, robertphillips wrote: ...
6 years, 6 months ago (2014-06-11 14:26:24 UTC) #6
robertphillips
https://codereview.chromium.org/321253002/diff/1/src/gpu/SkGr.cpp File src/gpu/SkGr.cpp (right): https://codereview.chromium.org/321253002/diff/1/src/gpu/SkGr.cpp#newcode469 src/gpu/SkGr.cpp:469: Wrap this in SK_IGNORE_GPU_DITHER and add it to gyp/skia_for_chromium_defines.gypi? ...
6 years, 6 months ago (2014-06-11 17:20:24 UTC) #7
krajcevski
Regarding Brian's issues: 1. We spoke to Mike and it seems like it's OK to ...
6 years, 6 months ago (2014-06-11 22:33:19 UTC) #8
bsalomon
https://codereview.chromium.org/321253002/diff/50001/src/gpu/SkGr.cpp File src/gpu/SkGr.cpp (right): https://codereview.chromium.org/321253002/diff/50001/src/gpu/SkGr.cpp#newcode469 src/gpu/SkGr.cpp:469: if (NULL == target) { I'd like to understand ...
6 years, 6 months ago (2014-06-12 16:24:11 UTC) #9
krajcevski
I think we figured out the thing that was causing context->getRenderTarget() to return null. With ...
6 years, 6 months ago (2014-06-12 18:48:35 UTC) #10
bsalomon
https://codereview.chromium.org/321253002/diff/90001/src/gpu/effects/GrDitherEffect.cpp File src/gpu/effects/GrDitherEffect.cpp (right): https://codereview.chromium.org/321253002/diff/90001/src/gpu/effects/GrDitherEffect.cpp#newcode135 src/gpu/effects/GrDitherEffect.cpp:135: builder->fsCodeAppendf("\t\tint x = int(%s.x + 0.5) & 1;\n", builder->fragmentPosition()); ...
6 years, 6 months ago (2014-06-12 19:59:54 UTC) #11
krajcevski
OK, so after trying to figure out a clever way to generate the matrix, I ...
6 years, 6 months ago (2014-06-18 22:21:50 UTC) #12
bsalomon
Does this make it possible to produce values that aren't valid premul colors (i.e. r, ...
6 years, 6 months ago (2014-06-19 13:33:27 UTC) #13
egdaniel
https://codereview.chromium.org/321253002/diff/130001/bench/GradientBench.cpp File bench/GradientBench.cpp (right): https://codereview.chromium.org/321253002/diff/130001/bench/GradientBench.cpp#newcode251 bench/GradientBench.cpp:251: fDither = true; can we just do fDither = ...
6 years, 6 months ago (2014-06-19 13:41:28 UTC) #14
krajcevski
So, if we add the random offset to the alpha, we maintain valid premul (provided ...
6 years, 6 months ago (2014-06-19 13:51:43 UTC) #15
bsalomon
lgtm
6 years, 6 months ago (2014-06-19 18:08:27 UTC) #16
krajcevski
The CQ bit was checked by krajcevski@google.com
6 years, 6 months ago (2014-06-19 20:37:46 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/krajcevski@google.com/321253002/170001
6 years, 6 months ago (2014-06-19 20:38:24 UTC) #18
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 6 months ago (2014-06-19 20:38:26 UTC) #19
commit-bot: I haz the power
Failed to apply patch for bench/GradientBench.cpp: While running git apply --index -p1; error: patch failed: ...
6 years, 6 months ago (2014-06-19 20:38:27 UTC) #20
krajcevski
The CQ bit was checked by krajcevski@google.com
6 years, 6 months ago (2014-06-19 20:44:18 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/krajcevski@google.com/321253002/170002
6 years, 6 months ago (2014-06-19 20:44:25 UTC) #22
commit-bot: I haz the power
Change committed as f461a8fdf642ba713dcdfb217534652df1eac278
6 years, 6 months ago (2014-06-19 21:14:14 UTC) #23
tomhudson
4 years, 8 months ago (2016-04-22 16:36:01 UTC) #24
Message was sent while issue was closed.
Nearly two years later, this is still disabled in Chrome. Is there something
blocking it from use there?

Powered by Google App Engine
This is Rietveld 408576698