63 for (y = 0; y < out->
h; y++) {
64 for (x = 0; x < out->
w; x += 2) {
69 int i = 2 * (out->
h - y) + RedX;
71 if ((i < in->
w) && (j < in->
h)) {
74 uint16_t B1 = ii[i + (j + 1) * in->
w] / 2;
78 uint16_t B2 = ii[i + (j + 1) * in->
w] / 2;
82 my1 = (0.256788 * R1 + 0.504129 * G1 + 0.097906 * B1) / 128 + 16;
83 my2 = (0.256788 * R2 + 0.504129 * G2 + 0.097906 * B2) / 128 + 16;
84 u = (-0.148223 * (R1 + R2) - 0.290993 * (G1 + G2) + 0.439216 * (B1 + B2)) / 256 + 128;
85 v = (0.439216 * (R1 + R2) - 0.367788 * (G1 + G2) - 0.071427 * (B1 + B2)) / 256 + 128;
88 oi[(x + y * out->
w) * 2] =
clip(u);
89 oi[(x + y * out->
w) * 2 + 1] =
clip(my1);
90 oi[(x + y * out->
w) * 2 + 2] =
clip(v);
91 oi[(x + y * out->
w) * 2 + 3] =
clip(my2);
93 oi[(x + y * out->
w) * 2] = 0;
94 oi[(x + y * out->
w) * 2 + 1] = 0;
95 oi[(x + y * out->
w) * 2 + 2] = 0;
96 oi[(x + y * out->
w) * 2 + 3] = 0;
static uint8_t clip(uint16_t x)
Image helper functions like resizing, color filter, converters...
void BayerToYUV(struct image_t *Input, struct image_t *out, int RedX, int RedY)
Decode Bayer Pattern.
void * buf
Image buffer (depending on the image_type)
uint16_t w
The width of the image.