Commit 8527d895 authored by Pavel Rojtberg's avatar Pavel Rojtberg

replace rgb24_to_rgb24 by tested cvtColor

internally using ipp this conversion is now roughly 2x faster.
also add RGB/ BGR formats to allowed zero copy access.
parent f5081712
...@@ -558,6 +558,9 @@ static int v4l2_num_channels(__u32 palette) { ...@@ -558,6 +558,9 @@ static int v4l2_num_channels(__u32 palette) {
case V4L2_PIX_FMT_YUYV: case V4L2_PIX_FMT_YUYV:
case V4L2_PIX_FMT_UYVY: case V4L2_PIX_FMT_UYVY:
return 2; return 2;
case V4L2_PIX_FMT_BGR24:
case V4L2_PIX_FMT_RGB24:
return 3;
default: default:
return 0; return 0;
} }
...@@ -1366,16 +1369,10 @@ static void sgbrg2rgb24(long int WIDTH, long int HEIGHT, unsigned char *src, uns ...@@ -1366,16 +1369,10 @@ static void sgbrg2rgb24(long int WIDTH, long int HEIGHT, unsigned char *src, uns
} }
} }
static void static inline void
rgb24_to_rgb24 (int width, int height, unsigned char *src, unsigned char *dst) rgb24_to_rgb24 (int width, int height, unsigned char *src, unsigned char *dst)
{ {
const int size = width * height; cvtColor(Mat(height, width, CV_8UC3, src), Mat(height, width, CV_8UC3, dst), COLOR_RGB2BGR);
for(int i = 0; i < size; ++i, src += 3, dst += 3)
{
*(dst + 0) = *(src + 2);
*(dst + 1) = *(src + 1);
*(dst + 2) = *(src + 0);
}
} }
#define CLAMP(x) ((x)<0?0:((x)>255)?255:(x)) #define CLAMP(x) ((x)<0?0:((x)>255)?255:(x))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment