mirror of
https://github.com/stevenrobertson/cuburn.git
synced 2025-02-05 11:40:04 -05:00
Convert YUV to RGB before filtering
This commit is contained in:
parent
abcb3fa50f
commit
0ce1b51d16
@ -67,6 +67,16 @@ fma_buf(float4 *dst, const float4 *src, float scale) {
|
|||||||
}
|
}
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
yuvfilterlib = devlib(deps=[yuvlib], defs=r'''
|
||||||
|
__global__ void
|
||||||
|
yuv_to_rgb(float4 *dst, const float4 *src) {
|
||||||
|
GET_IDX(i);
|
||||||
|
float4 pix = src[i];
|
||||||
|
yuvo2rgb(pix);
|
||||||
|
dst[i] = pix;
|
||||||
|
}
|
||||||
|
''')
|
||||||
|
|
||||||
denblurlib = devlib(deps=[texshearlib], decls='''
|
denblurlib = devlib(deps=[texshearlib], decls='''
|
||||||
texture<float4, cudaTextureType2D> chan4_src;
|
texture<float4, cudaTextureType2D> chan4_src;
|
||||||
texture<float, cudaTextureType2D> chan1_src;
|
texture<float, cudaTextureType2D> chan1_src;
|
||||||
@ -261,7 +271,6 @@ haloclip(float4 *pixbuf, const float *denbuf, float gamma_m_1) {
|
|||||||
|
|
||||||
float ls = powf(pix.w, gamma_m_1) / fmaxf(1.0f, areaval);
|
float ls = powf(pix.w, gamma_m_1) / fmaxf(1.0f, areaval);
|
||||||
scale_float4(pix, ls);
|
scale_float4(pix, ls);
|
||||||
yuvo2rgb(pix);
|
|
||||||
pixbuf[i] = pix;
|
pixbuf[i] = pix;
|
||||||
}
|
}
|
||||||
''')
|
''')
|
||||||
@ -302,7 +311,6 @@ smearclip(float4 *pixbuf, const float4 *smearbuf,
|
|||||||
ls = (1.0f - frac) * lingam + frac * ls;
|
ls = (1.0f - frac) * lingam + frac * ls;
|
||||||
}
|
}
|
||||||
scale_float4(pix, ls);
|
scale_float4(pix, ls);
|
||||||
yuvo2rgb(pix);
|
|
||||||
pixbuf[i] = pix;
|
pixbuf[i] = pix;
|
||||||
}
|
}
|
||||||
''')
|
''')
|
||||||
@ -319,7 +327,6 @@ colorclip(float4 *pixbuf, float vibrance, float highpow,
|
|||||||
pixbuf[i] = make_float4(0, 0, 0, 0);
|
pixbuf[i] = make_float4(0, 0, 0, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
yuvo2rgb(pix);
|
|
||||||
float4 opix = pix;
|
float4 opix = pix;
|
||||||
|
|
||||||
float alpha = powf(pix.w, gamma);
|
float alpha = powf(pix.w, gamma);
|
||||||
|
@ -50,6 +50,16 @@ class Filter(object):
|
|||||||
return register_
|
return register_
|
||||||
|
|
||||||
|
|
||||||
|
@Filter.register('yuv')
|
||||||
|
class YuvFilterLib(Filter, ClsMod):
|
||||||
|
lib = code.filters.yuvfilterlib
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
|
|
||||||
@Filter.register('bilateral')
|
@Filter.register('bilateral')
|
||||||
class Bilateral(Filter, ClsMod):
|
class Bilateral(Filter, ClsMod):
|
||||||
lib = code.filters.bilaterallib
|
lib = code.filters.bilaterallib
|
||||||
@ -171,4 +181,5 @@ class ColorClip(Filter, ClsMod):
|
|||||||
fb.d_front, vib, hipow, gam, lin, lingam)
|
fb.d_front, vib, hipow, gam, lin, lingam)
|
||||||
|
|
||||||
def create(gprof):
|
def create(gprof):
|
||||||
return [Filter.filter_map[f]() for f in gprof.filter_order]
|
order = ['yuv'] + gprof.filter_order
|
||||||
|
return [Filter.filter_map[f]() for f in order]
|
||||||
|
@ -54,6 +54,7 @@ filters = (
|
|||||||
, 'haloclip': {}
|
, 'haloclip': {}
|
||||||
, 'smearclip': {'width': scalespline(0.7, d='Spatial stdev of filter')}
|
, 'smearclip': {'width': scalespline(0.7, d='Spatial stdev of filter')}
|
||||||
, 'logscale': {'brightness': scalespline(4, d='Log-scale brightness')}
|
, 'logscale': {'brightness': scalespline(4, d='Log-scale brightness')}
|
||||||
|
, 'yuv': {}
|
||||||
})
|
})
|
||||||
|
|
||||||
camera = (
|
camera = (
|
||||||
|
Loading…
Reference in New Issue
Block a user