46 for (y = 0; y < out->
h; y++) {
47 for (x = 0; x < out->
w; x += 2) {
52 int i = 2 * (out->
h - y) + RedX;
54 if ((i < in->w) && (j < in->
h)) {
57 uint16_t B1 = ii[i + (j + 1) * in->
w] / 2;
61 uint16_t B2 = ii[i + (j + 1) * in->
w] / 2;
65 my1 = (0.256788 * R1 + 0.504129 * G1 + 0.097906 * B1) / 128 + 16;
66 my2 = (0.256788 * R2 + 0.504129 * G2 + 0.097906 * B2) / 128 + 16;
67 u = (-0.148223 * (R1 + R2) - 0.290993 * (G1 + G2) + 0.439216 * (B1 + B2)) / 256 + 128;
68 v = (0.439216 * (R1 + R2) - 0.367788 * (G1 + G2) - 0.071427 * (B1 + B2)) / 256 + 128;
70 oi[(x + y * out->
w) * 2] = Clip(u, 0, 255);
71 oi[(x + y * out->
w) * 2 + 1] = Clip(my1, 0, 255);
72 oi[(x + y * out->
w) * 2 + 2] = Clip(v, 0, 255);
73 oi[(x + y * out->
w) * 2 + 3] = Clip(my2, 0, 255);
75 oi[(x + y * out->
w) * 2] = 0;
76 oi[(x + y * out->
w) * 2 + 1] = 0;
77 oi[(x + y * out->
w) * 2 + 2] = 0;
78 oi[(x + y * out->
w) * 2 + 3] = 0;
void BayerToYUV(struct image_t *in, struct image_t *out, int RedX, int RedY)
Decode Bayer Pattern.
Image helper functions like resizing, color filter, converters...
void * buf
Image buffer (depending on the image_type)
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.