def apply(self, fb, gprof, params, dim, tc, stream=None): vib = f32(params.vibrance(tc)) hipow = f32(params.highlight_power(tc)) gam, lin, lingam = calc_lingam(params, tc) launch2('colorclip', self.mod, stream, dim, fb.d_front, vib, hipow, gam, lin, lingam)
def apply(self, fb, gprof, params, dim, tc, stream=None): """Log-scale in place.""" k1 = f32(params.brightness(tc) * 268 / 256) # Old definition of area is (w*h/(s*s)). Since new scale 'ns' is now # s/w, new definition is (w*h/(s*s*w*w)) = (h/(s*s*w)) area = dim.h / (params.scale(tc) ** 2 * dim.w) k2 = f32(1.0 / (area * gprof.spp(tc))) launch2("logscale", self.mod, stream, dim, fb.d_front, fb.d_front, k1, k2)
def apply(self, fb, gprof, params, dim, tc, stream=None): """Log-scale in place.""" k1 = f32(params.brightness(tc) * 268 / 256) # Old definition of area is (w*h/(s*s)). Since new scale 'ns' is now # s/w, new definition is (w*h/(s*s*w*w)) = (h/(s*s*w)) area = dim.h / (params.scale(tc)**2 * dim.w) k2 = f32(1.0 / (area * gprof.spp(tc))) launch2('logscale', self.mod, stream, dim, fb.d_front, fb.d_front, k1, k2)
def apply(self, fb, gprof, params, dim, tc, stream=None): gam = f32(1 / gprof.filters.colorclip.gamma(tc) - 1) dsc = mkdsc(dim, 1) tref = mktref(self.mod, 'chan1_src') set_blur_width(self.mod, fb.pool, stream=stream) launch2('apply_gamma', self.mod, stream, dim, fb.d_left, fb.d_front, f32(0.1)) tref.set_address_2d(fb.d_left, dsc, 4 * dim.astride) launch2('den_blur_1c', self.mod, stream, dim, fb.d_back, i32(2), i32(0), texrefs=[tref]) tref.set_address_2d(fb.d_back, dsc, 4 * dim.astride) launch2('den_blur_1c', self.mod, stream, dim, fb.d_left, i32(3), i32(0), texrefs=[tref]) launch2('haloclip', self.mod, stream, dim, fb.d_front, fb.d_left, gam)
def apply(self, fb, gprof, params, dim, tc, stream=None): gam = f32(1 / gprof.filters.colorclip.gamma(tc) - 1) dsc = mkdsc(dim, 1) tref = mktref(self.mod, "chan1_src") set_blur_width(self.mod, fb.pool, stream=stream) launch2("apply_gamma", self.mod, stream, dim, fb.d_side, fb.d_front, f32(0.1)) tref.set_address_2d(fb.d_side, dsc, 4 * dim.astride) launch2("den_blur_1c", self.mod, stream, dim, fb.d_back, i32(2), i32(0), texrefs=[tref]) tref.set_address_2d(fb.d_back, dsc, 4 * dim.astride) launch2("den_blur_1c", self.mod, stream, dim, fb.d_side, i32(3), i32(0), texrefs=[tref]) launch2("haloclip", self.mod, stream, dim, fb.d_front, fb.d_side, gam)
def apply(self, fb, gprof, params, dim, tc, stream=None): # Helper variables and functions to keep it clean sb = 16 * dim.astride bs = sb * dim.ah dsc = mkdsc(dim, 4) tref = mktref(self.mod, 'chan4_src') grad_dsc = mkdsc(dim, 1) grad_tref = mktref(self.mod, 'chan1_src') set_blur_width(self.mod, fb.pool, stream=stream) for pattern in range(self.directions): # Scale spatial parameter so that a "pixel" is equivalent to an # actual pixel at 1080p sstd = params.spatial_std(tc) * dim.w / 1920. tref.set_address_2d(fb.d_front, dsc, sb) # Blur density two octaves along sampling vector, ultimately # storing in the side buffer launch2('den_blur', self.mod, stream, dim, fb.d_back, i32(pattern), i32(0), texrefs=[tref]) grad_tref.set_address_2d(fb.d_back, grad_dsc, sb / 4) launch2('den_blur_1c', self.mod, stream, dim, fb.d_left, i32(pattern), i32(1), texrefs=[grad_tref]) grad_tref.set_address_2d(fb.d_left, grad_dsc, sb / 4) launch2('bilateral', self.mod, stream, dim, fb.d_back, i32(pattern), i32(self.radius), f32(sstd), f32(params.color_std(tc)), f32(params.density_std(tc)), f32(params.density_pow(tc)), f32(params.gradient(tc)), texrefs=[tref, grad_tref]) fb.flip()
def apply(self, fb, gprof, params, dim, tc, stream=None): launch2('yuv_to_rgb', self.mod, stream, dim, fb.d_back, fb.d_front) fb.flip()
def apply(self, fb, gprof, params, dim, tc, stream=None): degamma = f32(params.degamma(tc)) launch2('logencode', self.mod, stream, dim, fb.d_back, fb.d_front, degamma) fb.flip()
def apply(self, fb, gprof, params, dim, tc, stream=None): gam, lin, lingam = calc_lingam(gprof.filters.colorclip, tc) launch2('plainclip', self.mod, stream, dim, fb.d_front, f32(gam - 1), lin, lingam, f32(gprof.filters.plainclip.brightness(tc)))
def apply(self, fb, gprof, params, dim, tc, stream=None): gam, lin, lingam = calc_lingam(gprof.filters.colorclip, tc) dsc = mkdsc(dim, 4) tref = mktref(self.mod, 'chan4_src') set_blur_width(self.mod, fb.pool, params.width(tc), stream) launch2('apply_gamma_full_hi', self.mod, stream, dim, fb.d_left, fb.d_front, f32(gam - 1)) tref.set_address_2d(fb.d_left, dsc, 16 * dim.astride) launch2('full_blur', self.mod, stream, dim, fb.d_back, i32(2), i32(0), texrefs=[tref]) tref.set_address_2d(fb.d_back, dsc, 16 * dim.astride) launch2('full_blur', self.mod, stream, dim, fb.d_left, i32(3), i32(0), texrefs=[tref]) tref.set_address_2d(fb.d_left, dsc, 16 * dim.astride) launch2('full_blur', self.mod, stream, dim, fb.d_back, i32(0), i32(0), texrefs=[tref]) tref.set_address_2d(fb.d_back, dsc, 16 * dim.astride) launch2('full_blur', self.mod, stream, dim, fb.d_left, i32(1), i32(0), texrefs=[tref]) launch2('smearclip', self.mod, stream, dim, fb.d_front, fb.d_left, f32(gam - 1), lin, lingam)
def apply(self, fb, gprof, params, dim, tc, stream=None): gam, lin, lingam = calc_lingam(gprof.filters.colorclip, tc) dsc = mkdsc(dim, 4) tref = mktref(self.mod, "chan4_src") set_blur_width(self.mod, fb.pool, params.width(tc), stream) launch2("apply_gamma_full_hi", self.mod, stream, dim, fb.d_side, fb.d_front, f32(gam - 1)) tref.set_address_2d(fb.d_side, dsc, 16 * dim.astride) launch2("full_blur", self.mod, stream, dim, fb.d_back, i32(2), i32(0), texrefs=[tref]) tref.set_address_2d(fb.d_back, dsc, 16 * dim.astride) launch2("full_blur", self.mod, stream, dim, fb.d_side, i32(3), i32(0), texrefs=[tref]) tref.set_address_2d(fb.d_side, dsc, 16 * dim.astride) launch2("full_blur", self.mod, stream, dim, fb.d_back, i32(0), i32(0), texrefs=[tref]) tref.set_address_2d(fb.d_back, dsc, 16 * dim.astride) launch2("full_blur", self.mod, stream, dim, fb.d_side, i32(1), i32(0), texrefs=[tref]) launch2("smearclip", self.mod, stream, dim, fb.d_front, fb.d_side, f32(gam - 1), lin, lingam)
def apply(self, fb, gprof, params, dim, tc, stream=None): gam, lin, lingam = calc_lingam(gprof.filters.colorclip, tc) launch2('plainclip', self.mod, stream, dim, fb.d_front, f32(gam-1), lin, lingam, f32(gprof.filters.plainclip.brightness(tc)))