54
54
return export_RGB_buffer(ctx, ACTIVE_BUFFER, flip);
59
export_YUV_buffer(const Context_t *ctx, const u_char screen, const u_char flip)
61
rgba_t *colors = &ctx->cf->cur->colors[0];
62
Buffer8_t *buf = ctx->buffers[screen];
63
const Pixel_t *src = NULL;
71
res = xmalloc(3*BUFFSIZE*sizeof(Pixel_t));
74
* From wikipedia, sorry
76
* Y = 0,299⋅R + 0,587⋅G + 0,114⋅B
77
* U = 0,492⋅(B − Y) = −0,14713⋅R − 0,28886⋅G + 0,436⋅B
78
* V = 0,877⋅(R − Y) = 0,615⋅R − 0,51498⋅G- 0,10001⋅B
80
#define CR (colors[src[c]].col.r)
81
#define CG (colors[src[c]].col.g)
82
#define CB (colors[src[c]].col.b)
84
for (c = 0; c < BUFFSIZE; c++) {
85
res[i++] = 0.299*CR + 0.587*CG + 0.114*CB;;
86
res[i++] = -0.14713*CR - 0.28886*CG + 0.436*CB;
87
res[i++] = 0.615*CR - 0.51498*CG - 0.10001*CB;
98
export_YUV_active_buffer(const Context_t *ctx, const u_char flip)
100
return export_YUV_buffer(ctx, ACTIVE_BUFFER, flip);
105
export_RGBA_buffer(const Context_t *ctx, const u_char screen)
107
rgba_t *colors = &ctx->cf->cur->colors[0];
108
Pixel_t *src = ctx->buffers[screen]->buffer, *start;
109
RGBA_t *dst = ctx->rgba_buffers[screen]->buffer;
114
for ( ; src < start+BUFFSIZE*sizeof(Pixel_t); src++, dst++)
115
*dst = colors[*src].col;
117
return ctx->rgba_buffers[screen]->buffer;
122
export_RGBA_active_buffer(const Context_t *ctx)
124
return export_RGBA_buffer(ctx, ACTIVE_BUFFER);