rename to bt709_luminance_or_luma_to_alpha
We conflate luminance (dot of linear r,g,b) and luma (dot of gamma-encoded r',g',b') all over the place in Skia. This one is possibly the most confusing of any of them, in that the dot-product coefficients for BT.709 luma were somewhat arbitrarily chosen to be the same as the coefficients for luminance. So, big old ridiculously new long name to make it clear it works for both luma and luminance, but that it's hardcoded to BT.709. My quick reference when I forget things: https://en.wikipedia.org/wiki/Luma_(video) Change-Id: I5a6567de296795f558acc5dd3c39974b8035234e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/226762 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
b5c69a4a46
commit
da69d5929d
@ -244,7 +244,7 @@ void SkRasterPipeline::append_store(SkColorType ct, const SkRasterPipeline_Memor
|
||||
this->append(store_1010102, ctx);
|
||||
break;
|
||||
|
||||
case kGray_8_SkColorType: this->append(luminance_to_alpha);
|
||||
case kGray_8_SkColorType: this->append(bt709_luminance_or_luma_to_alpha);
|
||||
this->append(store_a8, ctx);
|
||||
break;
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
||||
M(load_rg1616) M(store_rg1616) \
|
||||
M(load_16161616) M(store_16161616) \
|
||||
M(load_1010102) M(load_1010102_dst) M(store_1010102) M(gather_1010102) \
|
||||
M(alpha_to_gray) M(alpha_to_gray_dst) M(luminance_to_alpha) \
|
||||
M(alpha_to_gray) M(alpha_to_gray_dst) M(bt709_luminance_or_luma_to_alpha) \
|
||||
M(bilerp_clamp_8888) \
|
||||
M(store_u16_be) \
|
||||
M(load_src) M(store_src) M(load_dst) M(store_dst) \
|
||||
|
@ -19,7 +19,7 @@
|
||||
#endif
|
||||
|
||||
bool SkLumaColorFilter::onAppendStages(const SkStageRec& rec, bool shaderIsOpaque) const {
|
||||
rec.fPipeline->append(SkRasterPipeline::luminance_to_alpha);
|
||||
rec.fPipeline->append(SkRasterPipeline::bt709_luminance_or_luma_to_alpha);
|
||||
rec.fPipeline->append(SkRasterPipeline::clamp_0);
|
||||
rec.fPipeline->append(SkRasterPipeline::clamp_1);
|
||||
return true;
|
||||
|
@ -2224,7 +2224,7 @@ STAGE(alpha_to_gray_dst, Ctx::None) {
|
||||
dr = dg = db = da;
|
||||
da = 1;
|
||||
}
|
||||
STAGE(luminance_to_alpha, Ctx::None) {
|
||||
STAGE(bt709_luminance_or_luma_to_alpha, Ctx::None) {
|
||||
a = r*0.2126f + g*0.7152f + b*0.0722f;
|
||||
r = g = b = 0;
|
||||
}
|
||||
@ -3507,7 +3507,7 @@ STAGE_PP(alpha_to_gray_dst, Ctx::None) {
|
||||
dr = dg = db = da;
|
||||
da = 255;
|
||||
}
|
||||
STAGE_PP(luminance_to_alpha, Ctx::None) {
|
||||
STAGE_PP(bt709_luminance_or_luma_to_alpha, Ctx::None) {
|
||||
a = (r*54 + g*183 + b*19)/256; // 0.2126, 0.7152, 0.0722 with 256 denominator.
|
||||
r = g = b = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user