+void CriKey::draw_edge(VFrame *edg)
+{
+ uint8_t **src_rows = src->get_rows();
+ float **edg_rows = (float**) edg->get_rows(), gain = 10;
+ switch( color_model ) {
+ case BC_RGB_FLOAT:
+ for( int y=0; y<h; ++y ) {
+ uint8_t *sp = src_rows[y];
+ float *ap = edg_rows[y];
+ for( int x=0; x<w; ++x,++ap,sp+=bpp ) {
+ float *px = (float *)sp, v = *ap * gain;
+ px[0] = px[1] = px[2] = v<1 ? v : 1;
+ }
+ }
+ break;
+ case BC_RGBA_FLOAT:
+ for( int y=0; y<h; ++y ) {
+ uint8_t *sp = src_rows[y];
+ float *ap = edg_rows[y];
+ for( int x=0; x<w; ++x,++ap,sp+=bpp ) {
+ float *px = (float *)sp, v = *ap * gain;
+ px[0] = px[1] = px[2] = v<1 ? v : 1;
+ px[3] = 1.0f;
+ }
+ }
+ break;
+ case BC_RGB888:
+ for( int y=0; y<h; ++y ) {
+ uint8_t *sp = src_rows[y];
+ float *ap = edg_rows[y];
+ for( int x=0; x<w; ++x,++ap,sp+=bpp ) {
+ uint8_t *px = sp; float v = *ap * gain;
+ px[0] = px[1] = px[2] = v<1 ? v*256 : 255;
+ }
+ }
+ break;
+ case BC_RGBA8888:
+ for( int y=0; y<h; ++y ) {
+ uint8_t *sp = src_rows[y];
+ float *ap = edg_rows[y];
+ for( int x=0; x<w; ++x,++ap,sp+=bpp ) {
+ uint8_t *px = sp; float v = *ap * gain;
+ px[0] = px[1] = px[2] = v<1 ? v*256 : 255;
+ px[3] = 0xff;
+ }
+ }
+ break;
+ case BC_YUV888:
+ for( int y=0; y<h; ++y ) {
+ uint8_t *sp = src_rows[y];
+ float *ap = edg_rows[y];
+ for( int x=0; x<w; ++x,++ap,sp+=bpp ) {
+ uint8_t *px = sp; float v = *ap * gain;
+ px[0] = *ap<1 ? v*256 : 255;
+ px[1] = px[2] = 0x80;
+ }
+ }
+ break;
+ case BC_YUVA8888:
+ for( int y=0; y<h; ++y ) {
+ uint8_t *sp = src_rows[y];
+ float *ap = edg_rows[y];
+ for( int x=0; x<w; ++x,++ap,sp+=bpp ) {
+ uint8_t *px = sp; float v = *ap * gain;
+ px[0] = *ap<1 ? v*256 : 255;
+ px[1] = px[2] = 0x80;
+ px[3] = 0xff;
+ }
+ }
+ break;
+ }
+}
+