Add BGR color conversion

This commit is contained in:
Mr-Dave
2022-06-12 16:10:34 -06:00
parent fe40e0eaff
commit f6499d7a84
2 changed files with 24 additions and 4 deletions

View File

@@ -364,15 +364,22 @@ void vid_uyvyto420p(unsigned char *img_dst, unsigned char *img_src, int width, i
}
}
void vid_rgb24toyuv420p(unsigned char *img_dst, unsigned char *img_src, int width, int height)
static void vid_rgb_bgr(unsigned char *img_dst, unsigned char *img_src
, int width, int height, int rgb)
{
unsigned char *y, *u, *v;
unsigned char *r, *g, *b;
int i, loop;
r = img_src;
g = r + 1;
b = g + 1;
if (rgb == 1) {
r = img_src;
g = r + 1;
b = g + 1;
} else {
b = img_src;
g = b + 1;
r = g + 1;
}
y = img_dst;
u = y + width * height;
@@ -405,6 +412,18 @@ void vid_rgb24toyuv420p(unsigned char *img_dst, unsigned char *img_src, int widt
}
}
void vid_rgb24toyuv420p(unsigned char *img_dst, unsigned char *img_src
, int width, int height)
{
vid_rgb_bgr(img_dst, img_src, width, height, 1);
}
void vid_bgr24toyuv420p(unsigned char *img_dst, unsigned char *img_src
, int width, int height)
{
vid_rgb_bgr(img_dst, img_src, width, height, 0);
}
/**
* mjpegtoyuv420p
*

View File

@@ -24,6 +24,7 @@ void vid_yuv422to420p(unsigned char *img_dest, unsigned char *img_src, int width
void vid_yuv422pto420p(unsigned char *img_dest, unsigned char *img_src, int width, int height);
void vid_uyvyto420p(unsigned char *img_dest, unsigned char *img_src, int width, int height);
void vid_rgb24toyuv420p(unsigned char *img_dest, unsigned char *img_src, int width, int height);
void vid_bgr24toyuv420p(unsigned char *img_dest, unsigned char *img_src, int width, int height);
void vid_bayer2rgb24(unsigned char *img_dst, unsigned char *img_src, long int width, long int height);
void vid_y10torgb24(unsigned char *img_dest, unsigned char *img_src, int width, int height, int shift);
void vid_greytoyuv420p(unsigned char *img_dest, unsigned char *img_src, int width, int height);