50 #include <visp3/core/vpCPUFeatures.h> 51 #include <visp3/core/vpImageConvert.h> 53 #if defined __SSE2__ || defined _M_X64 || (defined _M_IX86_FP && _M_IX86_FP >= 2) 54 #include <emmintrin.h> 55 #define VISP_HAVE_SSE2 1 57 #if defined __SSE3__ || (defined _MSC_VER && _MSC_VER >= 1500) 58 #include <pmmintrin.h> 59 #define VISP_HAVE_SSE3 1 61 #if defined __SSSE3__ || (defined _MSC_VER && _MSC_VER >= 1500) 62 #include <tmmintrin.h> 63 #define VISP_HAVE_SSSE3 1 67 bool vpImageConvert::YCbCrLUTcomputed =
false;
68 int vpImageConvert::vpCrr[256];
69 int vpImageConvert::vpCgb[256];
70 int vpImageConvert::vpCgr[256];
71 int vpImageConvert::vpCbb[256];
110 for (
unsigned int i = 0; i < max_xy; i++) {
111 float val = 255.f * (src.
bitmap[i] - min) / (max - min);
117 dest.
bitmap[i] = (
unsigned char)val;
145 for (
unsigned int i = 0; i < max_xy; i++) {
146 double val = 255. * (src.
bitmap[i] - min) / (max - min);
152 dest.
bitmap[i] = (
unsigned char)val;
165 for (
unsigned int i = 0; i < src.
getSize(); i++)
178 for (
unsigned int i = 0; i < src.
getSize(); i++)
204 static uint32_t histogram[0x10000];
205 memset(histogram, 0,
sizeof(histogram));
207 for (
unsigned int i = 0; i < src_depth.
getSize(); ++i)
208 ++histogram[src_depth.
bitmap[i]];
209 for (
int i = 2; i < 0x10000; ++i)
210 histogram[i] += histogram[i - 1];
213 for (
unsigned int i = 0; i < src_depth.
getSize(); ++i) {
214 uint16_t d = src_depth.
bitmap[i];
216 int f = (int)(histogram[d] * 255 / histogram[0xFFFF]);
217 dest_rgba.
bitmap[i].
R = 255 - f;
239 static uint32_t histogram2[0x10000];
240 memset(histogram2, 0,
sizeof(histogram2));
242 for (
unsigned int i = 0; i < src_depth.
getSize(); ++i)
243 ++histogram2[src_depth.
bitmap[i]];
244 for (
int i = 2; i < 0x10000; ++i)
245 histogram2[i] += histogram2[i - 1];
248 for (
unsigned int i = 0; i < src_depth.
getSize(); ++i) {
249 uint16_t d = src_depth.
bitmap[i];
251 int f = (int)(histogram2[d] * 255 / histogram2[0xFFFF]);
259 #ifdef VISP_HAVE_OPENCV 309 int nChannel = src->nChannels;
310 int depth = src->depth;
311 int height = src->height;
312 int width = src->width;
313 int widthStep = src->widthStep;
314 int lineStep = (flip) ? 1 : 0;
316 if (nChannel == 3 && depth == 8) {
317 dest.
resize((
unsigned int)height, (
unsigned int)width);
320 unsigned char *input = (
unsigned char *)src->imageData;
321 unsigned char *beginOutput = (
unsigned char *)dest.
bitmap;
323 for (
int i = 0; i < height; i++) {
324 unsigned char *line = input;
325 unsigned char *output = beginOutput + lineStep * (4 * width * (height - 1 - i)) + (1 - lineStep) * 4 * width * i;
326 for (
int j = 0; j < width; j++) {
327 *(output++) = *(line + 2);
328 *(output++) = *(line + 1);
329 *(output++) = *(line);
337 }
else if (nChannel == 1 && depth == 8) {
338 dest.
resize((
unsigned int)height, (
unsigned int)width);
340 unsigned char *input = (
unsigned char *)src->imageData;
341 unsigned char *beginOutput = (
unsigned char *)dest.
bitmap;
343 for (
int i = 0; i < height; i++) {
344 unsigned char *line = input;
345 unsigned char *output = beginOutput + lineStep * (4 * width * (height - 1 - i)) + (1 - lineStep) * 4 * width * i;
346 for (
int j = 0; j < width; j++) {
405 int nChannel = src->nChannels;
406 int depth = src->depth;
407 int height = src->height;
408 int width = src->width;
409 int widthStep = src->widthStep;
410 int lineStep = (flip) ? 1 : 0;
413 if (widthStep == width) {
414 if (nChannel == 1 && depth == 8) {
415 dest.
resize((
unsigned int)height, (
unsigned int)width);
416 memcpy(dest.
bitmap, src->imageData, (
size_t)(height * width));
418 if (nChannel == 3 && depth == 8) {
419 dest.
resize((
unsigned int)height, (
unsigned int)width);
420 BGRToGrey((
unsigned char *)src->imageData, dest.
bitmap, (
unsigned int)width, (
unsigned int)height,
false);
423 if (nChannel == 1 && depth == 8) {
424 dest.
resize((
unsigned int)height, (
unsigned int)width);
425 for (
int i = 0; i < height; i++) {
426 memcpy(dest.
bitmap + i * width, src->imageData + i * widthStep, (
size_t)width);
429 if (nChannel == 3 && depth == 8) {
430 dest.
resize((
unsigned int)height, (
unsigned int)width);
431 for (
int i = 0; i < height; i++) {
432 BGRToGrey((
unsigned char *)src->imageData + i * widthStep, dest.
bitmap + i * width, (
unsigned int)width, 1,
438 if (nChannel == 1 && depth == 8) {
439 dest.
resize((
unsigned int)height, (
unsigned int)width);
440 unsigned char *beginOutput = (
unsigned char *)dest.
bitmap;
441 for (
int i = 0; i < height; i++) {
442 memcpy(beginOutput + lineStep * (4 * width * (height - 1 - i)), src->imageData + i * widthStep, (
size_t)width);
445 if (nChannel == 3 && depth == 8) {
446 dest.
resize((
unsigned int)height, (
unsigned int)width);
448 BGRToGrey((
unsigned char *)src->imageData , dest.
bitmap , (
unsigned int)width,
449 (
unsigned int)height ,
true);
503 CvSize size = cvSize(width, height);
507 if (dest->nChannels != channels || dest->depth != depth || dest->height != height || dest->width != width) {
508 if (dest->nChannels != 0)
509 cvReleaseImage(&dest);
510 dest = cvCreateImage(size, depth, channels);
513 dest = cvCreateImage(size, depth, channels);
516 unsigned char *input = (
unsigned char *)src.
bitmap;
517 unsigned char *output = (
unsigned char *)dest->imageData;
521 int widthStep = dest->widthStep;
523 for (i = 0; i < height; i++) {
524 output = (
unsigned char *)dest->imageData + i * widthStep;
525 unsigned char *line = input;
526 for (j = 0; j < width; j++) {
527 *output++ = *(line + 2);
528 *output++ = *(line + 1);
585 unsigned int width = src.
getWidth();
586 CvSize size = cvSize((
int)width, (
int)height);
590 if (dest->nChannels != channels || dest->depth != depth || dest->height != (
int)height ||
591 dest->width != (
int)width) {
592 if (dest->nChannels != 0)
593 cvReleaseImage(&dest);
594 dest = cvCreateImage(size, depth, channels);
597 dest = cvCreateImage(size, depth, channels);
599 unsigned int widthStep = (
unsigned int)dest->widthStep;
601 if (width == widthStep) {
602 memcpy(dest->imageData, src.
bitmap, width * height);
605 for (
unsigned int i = 0; i < height; i++) {
606 memcpy(dest->imageData + i * widthStep, src.
bitmap + i * width, width);
611 #if VISP_HAVE_OPENCV_VERSION >= 0x020100 662 if (src.type() == CV_8UC4) {
663 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
665 for (
unsigned int i = 0; i < dest.
getRows(); ++i)
666 for (
unsigned int j = 0; j < dest.
getCols(); ++j) {
667 cv::Vec4b tmp = src.at<cv::Vec4b>((int)i, (
int)j);
673 dest[dest.
getRows() - i - 1][j] = rgbaVal;
675 dest[i][j] = rgbaVal;
677 }
else if (src.type() == CV_8UC3) {
678 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
685 if (checkSSSE3 && src.isContinuous() && !flip) {
688 int size = src.rows*src.cols;
689 const uchar* bgr = src.ptr<uchar>();
690 unsigned char* rgba = (
unsigned char*) dest.
bitmap;
694 const __m128i mask_1 = _mm_set_epi8(-1, 9, 10, 11, -1, 6, 7, 8, -1, 3, 4, 5, -1, 0, 1, 2);
695 const __m128i mask_2 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, -1, -1, -1, 15, -1, -1, -1, 12, 13, 14);
696 const __m128i mask_3 = _mm_set_epi8(-1, 5, 6, 7, -1, 2, 3, 4, -1, -1, 0, 1, -1, -1, -1, -1);
697 const __m128i mask_4 = _mm_set_epi8(-1, -1, -1, -1, -1, 14, 15, -1, -1, 11, 12, 13, -1, 8, 9, 10);
698 const __m128i mask_5 = _mm_set_epi8(-1, 1, 2, 3, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1);
699 const __m128i mask_6 = _mm_set_epi8(-1, 13, 14, 15, -1, 10, 11, 12, -1, 7, 8, 9, -1, 4, 5, 6);
702 int size_vec = size - 16;
705 for (; i <= size_vec; i += 16) {
707 const __m128i data1 = _mm_loadu_si128((
const __m128i *)bgr);
708 const __m128i data2 = _mm_loadu_si128((
const __m128i *)(bgr + 16));
709 const __m128i data3 = _mm_loadu_si128((
const __m128i *)(bgr + 32));
711 res[0] = _mm_shuffle_epi8(data1, mask_1);
712 res[1] = _mm_or_si128(_mm_shuffle_epi8(data1, mask_2), _mm_shuffle_epi8(data2, mask_3));
713 res[2] = _mm_or_si128(_mm_shuffle_epi8(data2, mask_4), _mm_shuffle_epi8(data3, mask_5));
714 res[3] = _mm_shuffle_epi8(data3, mask_6);
716 _mm_storeu_si128((__m128i *)rgba, res[0]);
717 _mm_storeu_si128((__m128i *)(rgba+16), res[1]);
718 _mm_storeu_si128((__m128i *)(rgba+32), res[2]);
719 _mm_storeu_si128((__m128i *)(rgba+48), res[3]);
726 for (; i < size; i++) {
727 *rgba = *(bgr+2); rgba++;
728 *rgba = *(bgr+1); rgba++;
729 *rgba = *(bgr); rgba++;
738 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
739 for (
unsigned int j = 0; j < dest.
getCols(); ++j) {
740 cv::Vec3b tmp = src.at<cv::Vec3b>((int)i, (
int)j);
745 dest[dest.
getRows() - i - 1][j] = rgbaVal;
747 dest[i][j] = rgbaVal;
752 }
else if (src.type() == CV_8UC1) {
753 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
755 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
756 for (
unsigned int j = 0; j < dest.
getCols(); ++j) {
757 rgbaVal = src.at<
unsigned char>((int)i, (
int)j);
759 dest[dest.
getRows() - i - 1][j] = rgbaVal;
761 dest[i][j] = rgbaVal;
812 if (src.type() == CV_8UC1) {
813 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
814 if (src.isContinuous() && !flip) {
815 memcpy(dest.
bitmap, src.data, (
size_t)(src.rows * src.cols));
818 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
819 memcpy(dest.
bitmap + i * dest.
getCols(), src.data + (dest.
getRows() - i - 1) * src.step1(), (size_t)src.step);
822 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
823 memcpy(dest.
bitmap + i * dest.
getCols(), src.data + i * src.step1(), (size_t)src.step);
827 }
else if (src.type() == CV_8UC3) {
828 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
829 if (src.isContinuous() ) {
830 BGRToGrey((
unsigned char *)src.data, (
unsigned char *)dest.
bitmap, (
unsigned int)src.cols, (
unsigned int)src.rows,
834 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
835 BGRToGrey((
unsigned char *)src.data + i * src.step1(),
837 (
unsigned int)dest.
getCols(), 1,
false);
840 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
842 (
unsigned int)dest.
getCols(), 1,
false);
891 cv::cvtColor(vpToMat, dest, cv::COLOR_RGBA2BGR);
939 dest = tmpMap.clone();
948 #ifdef VISP_HAVE_YARP 1034 const bool copyData)
1036 dest.
resize(src->height(), src->width());
1038 memcpy(dest.
bitmap, src->getRawImage(), src->height() * src->width() *
sizeof(yarp::sig::PixelMono));
1040 dest.
bitmap = src->getRawImage();
1079 const bool copyData)
1128 const bool copyData)
1130 dest.
resize(src->height(), src->width());
1132 memcpy(dest.
bitmap, src->getRawImage(), src->height() * src->width() *
sizeof(yarp::sig::PixelRgba));
1134 dest.
bitmap =
static_cast<vpRGBa *
>(src->getRawImage());
1173 for (
unsigned int i = 0; i < src.
getRows(); i++) {
1174 for (
unsigned int j = 0; j < src.
getWidth(); j++) {
1175 dest->pixel(j, i).r = src[i][j].R;
1176 dest->pixel(j, i).g = src[i][j].G;
1177 dest->pixel(j, i).b = src[i][j].B;
1223 dest.
resize(src->height(), src->width());
1224 for (
int i = 0; i < src->height(); i++) {
1225 for (
int j = 0; j < src->width(); j++) {
1226 dest[i][j].R = src->pixel(j, i).r;
1227 dest[i][j].G = src->pixel(j, i).g;
1228 dest[i][j].B = src->pixel(j, i).b;
1256 int r, g, b, cr, cg, cb, y1, y2;
1266 cb = ((*s - 128) * 454) >> 8;
1267 cg = (*s++ - 128) * 88;
1269 cr = ((*s - 128) * 359) >> 8;
1270 cg = (cg + (*s++ - 128) * 183) >> 8;
1279 *d++ =
static_cast<unsigned char>(r);
1280 *d++ =
static_cast<unsigned char>(g);
1281 *d++ =
static_cast<unsigned char>(b);
1291 *d++ =
static_cast<unsigned char>(r);
1292 *d++ =
static_cast<unsigned char>(g);
1293 *d++ =
static_cast<unsigned char>(b);
1311 int r, g, b, cr, cg, cb, y1, y2;
1321 cb = ((*s - 128) * 454) >> 8;
1322 cg = (*s++ - 128) * 88;
1324 cr = ((*s - 128) * 359) >> 8;
1325 cg = (cg + (*s++ - 128) * 183) >> 8;
1334 *d++ =
static_cast<unsigned char>(r);
1335 *d++ =
static_cast<unsigned char>(g);
1336 *d++ =
static_cast<unsigned char>(b);
1345 *d++ =
static_cast<unsigned char>(r);
1346 *d++ =
static_cast<unsigned char>(g);
1347 *d++ =
static_cast<unsigned char>(b);
1360 unsigned int i = 0, j = 0;
1362 while (j < size * 2) {
1363 grey[i++] = yuyv[j];
1364 grey[i++] = yuyv[j + 2];
1379 for (
unsigned int i = size / 4; i; i--) {
1380 int U = (int)((*yuv++ - 128) * 0.354);
1384 int V = (int)((*yuv++ - 128) * 0.707);
1412 *rgba++ = (
unsigned char)R;
1413 *rgba++ = (
unsigned char)G;
1414 *rgba++ = (
unsigned char)B;
1436 *rgba++ = (
unsigned char)R;
1437 *rgba++ = (
unsigned char)G;
1438 *rgba++ = (
unsigned char)B;
1460 *rgba++ = (
unsigned char)R;
1461 *rgba++ = (
unsigned char)G;
1462 *rgba++ = (
unsigned char)B;
1484 *rgba++ = (
unsigned char)R;
1485 *rgba++ = (
unsigned char)G;
1486 *rgba++ = (
unsigned char)B;
1491 unsigned int i = 0, j = 0;
1492 unsigned char r, g, b;
1493 while (j < numpixels * 3 / 2) {
1495 YUVToRGB(yuv[j + 1], yuv[j], yuv[j + 3], r, g, b);
1502 YUVToRGB(yuv[j + 2], yuv[j], yuv[j + 3], r, g, b);
1509 YUVToRGB(yuv[j + 4], yuv[j], yuv[j + 3], r, g, b);
1516 YUVToRGB(yuv[j + 5], yuv[j], yuv[j + 3], r, g, b);
1541 for (
unsigned int i = size / 2; i; i--) {
1542 int U = (int)((*yuv++ - 128) * 0.354);
1545 int V = (int)((*yuv++ - 128) * 0.707);
1569 *rgba++ = (
unsigned char)R;
1570 *rgba++ = (
unsigned char)G;
1571 *rgba++ = (
unsigned char)B;
1593 *rgba++ = (
unsigned char)R;
1594 *rgba++ = (
unsigned char)G;
1595 *rgba++ = (
unsigned char)B;
1601 unsigned int i = 0, j = 0;
1602 unsigned char r, g, b;
1604 while (j < size * 2) {
1606 YUVToRGB(yuv[j + 1], yuv[j], yuv[j + 2], r, g, b);
1613 YUVToRGB(yuv[j + 3], yuv[j], yuv[j + 2], r, g, b);
1632 unsigned int i = 0, j = 0;
1633 while (j < size * 3 / 2) {
1634 grey[i] = yuv[j + 1];
1635 grey[i + 1] = yuv[j + 2];
1636 grey[i + 2] = yuv[j + 4];
1637 grey[i + 3] = yuv[j + 5];
1657 for (
unsigned int i = size / 2; i; i--) {
1658 int U = (int)((*yuv++ - 128) * 0.354);
1661 int V = (int)((*yuv++ - 128) * 0.707);
1685 *rgb++ = (
unsigned char)R;
1686 *rgb++ = (
unsigned char)G;
1687 *rgb++ = (
unsigned char)B;
1708 *rgb++ = (
unsigned char)R;
1709 *rgb++ = (
unsigned char)G;
1710 *rgb++ = (
unsigned char)B;
1715 unsigned int i = 0, j = 0;
1716 unsigned char r, g, b;
1718 while (j < size * 2) {
1720 YUVToRGB(yuv[j + 1], yuv[j], yuv[j + 2], r, g, b);
1726 YUVToRGB(yuv[j + 3], yuv[j], yuv[j + 2], r, g, b);
1746 unsigned int i = 0, j = 0;
1748 while (j < size * 2) {
1749 grey[i++] = yuv[j + 1];
1750 grey[i++] = yuv[j + 3];
1765 for (
unsigned int i = size / 4; i; i--) {
1766 int U = (int)((*yuv++ - 128) * 0.354);
1770 int V = (int)((*yuv++ - 128) * 0.707);
1798 *rgb++ = (
unsigned char)R;
1799 *rgb++ = (
unsigned char)G;
1800 *rgb++ = (
unsigned char)B;
1821 *rgb++ = (
unsigned char)R;
1822 *rgb++ = (
unsigned char)G;
1823 *rgb++ = (
unsigned char)B;
1844 *rgb++ = (
unsigned char)R;
1845 *rgb++ = (
unsigned char)G;
1846 *rgb++ = (
unsigned char)B;
1867 *rgb++ = (
unsigned char)R;
1868 *rgb++ = (
unsigned char)G;
1869 *rgb++ = (
unsigned char)B;
1874 unsigned int i = 0, j = 0;
1875 unsigned char r, g, b;
1877 while (j < size * 3 / 2) {
1878 YUVToRGB(yuv[j + 1], yuv[j], yuv[j + 3], r, g, b);
1884 YUVToRGB(yuv[j + 2], yuv[j], yuv[j + 3], r, g, b);
1890 YUVToRGB(yuv[j + 4], yuv[j], yuv[j + 3], r, g, b);
1896 YUVToRGB(yuv[j + 5], yuv[j], yuv[j + 3], r, g, b);
1918 int U, V, R, G, B, V2, U5, UV;
1920 unsigned int size = width * height;
1921 unsigned char *iU = yuv + size;
1922 unsigned char *iV = yuv + 5 * size / 4;
1923 for (
unsigned int i = 0; i < height / 2; i++) {
1924 for (
unsigned int j = 0; j < width / 2; j++) {
1925 U = (int)((*iU++ - 128) * 0.354);
1927 V = (int)((*iV++ - 128) * 0.707);
1932 yuv = yuv + width - 1;
1935 yuv = yuv - width + 1;
1959 *rgba++ = (
unsigned char)R;
1960 *rgba++ = (
unsigned char)G;
1961 *rgba++ = (
unsigned char)B;
1983 *rgba++ = (
unsigned char)R;
1984 *rgba++ = (
unsigned char)G;
1985 *rgba++ = (
unsigned char)B;
1987 rgba = rgba + 4 * width - 7;
2008 *rgba++ = (
unsigned char)R;
2009 *rgba++ = (
unsigned char)G;
2010 *rgba++ = (
unsigned char)B;
2032 *rgba++ = (
unsigned char)R;
2033 *rgba++ = (
unsigned char)G;
2034 *rgba++ = (
unsigned char)B;
2036 rgba = rgba - 4 * width + 1;
2050 int U, V, R, G, B, V2, U5, UV;
2052 unsigned int size = width * height;
2053 unsigned char *iU = yuv + size;
2054 unsigned char *iV = yuv + 5 * size / 4;
2055 for (
unsigned int i = 0; i < height / 2; i++) {
2056 for (
unsigned int j = 0; j < width / 2; j++) {
2057 U = (int)((*iU++ - 128) * 0.354);
2059 V = (int)((*iV++ - 128) * 0.707);
2064 yuv = yuv + width - 1;
2067 yuv = yuv - width + 1;
2091 *rgb++ = (
unsigned char)R;
2092 *rgb++ = (
unsigned char)G;
2093 *rgb++ = (
unsigned char)B;
2114 *rgb++ = (
unsigned char)R;
2115 *rgb++ = (
unsigned char)G;
2116 *rgb = (
unsigned char)B;
2117 rgb = rgb + 3 * width - 5;
2138 *rgb++ = (
unsigned char)R;
2139 *rgb++ = (
unsigned char)G;
2140 *rgb++ = (
unsigned char)B;
2161 *rgb++ = (
unsigned char)R;
2162 *rgb++ = (
unsigned char)G;
2163 *rgb = (
unsigned char)B;
2164 rgb = rgb - 3 * width + 1;
2178 for (
unsigned int i = 0; i < size; i++) {
2191 for (
unsigned int i = 0; i < size; i++) {
2192 int U = (int)((*yuv++ - 128) * 0.354);
2195 int V = (int)((*yuv++ - 128) * 0.707);
2221 *rgba++ = (
unsigned char)R;
2222 *rgba++ = (
unsigned char)G;
2223 *rgba++ = (
unsigned char)B;
2234 for (
unsigned int i = 0; i < size; i++) {
2235 int U = (int)((*yuv++ - 128) * 0.354);
2238 int V = (int)((*yuv++ - 128) * 0.707);
2264 *rgb++ = (
unsigned char)R;
2265 *rgb++ = (
unsigned char)G;
2266 *rgb++ = (
unsigned char)B;
2278 for (
unsigned int i = 0; i < size; i++) {
2294 int U, V, R, G, B, V2, U5, UV;
2296 unsigned int size = width * height;
2297 unsigned char *iV = yuv + size;
2298 unsigned char *iU = yuv + 5 * size / 4;
2299 for (
unsigned int i = 0; i < height / 2; i++) {
2300 for (
unsigned int j = 0; j < width / 2; j++) {
2301 U = (int)((*iU++ - 128) * 0.354);
2303 V = (int)((*iV++ - 128) * 0.707);
2308 yuv = yuv + width - 1;
2311 yuv = yuv - width + 1;
2335 *rgba++ = (
unsigned char)R;
2336 *rgba++ = (
unsigned char)G;
2337 *rgba++ = (
unsigned char)B;
2359 *rgba++ = (
unsigned char)R;
2360 *rgba++ = (
unsigned char)G;
2361 *rgba++ = (
unsigned char)B;
2363 rgba = rgba + 4 * width - 7;
2384 *rgba++ = (
unsigned char)R;
2385 *rgba++ = (
unsigned char)G;
2386 *rgba++ = (
unsigned char)B;
2408 *rgba++ = (
unsigned char)R;
2409 *rgba++ = (
unsigned char)G;
2410 *rgba++ = (
unsigned char)B;
2412 rgba = rgba - 4 * width + 1;
2426 int U, V, R, G, B, V2, U5, UV;
2428 unsigned int size = width * height;
2429 unsigned char *iV = yuv + size;
2430 unsigned char *iU = yuv + 5 * size / 4;
2431 for (
unsigned int i = 0; i < height / 2; i++) {
2432 for (
unsigned int j = 0; j < width / 2; j++) {
2433 U = (int)((*iU++ - 128) * 0.354);
2435 V = (int)((*iV++ - 128) * 0.707);
2440 yuv = yuv + width - 1;
2443 yuv = yuv - width + 1;
2467 *rgb++ = (
unsigned char)R;
2468 *rgb++ = (
unsigned char)G;
2469 *rgb++ = (
unsigned char)B;
2490 *rgb++ = (
unsigned char)R;
2491 *rgb++ = (
unsigned char)G;
2492 *rgb = (
unsigned char)B;
2493 rgb = rgb + 3 * width - 5;
2514 *rgb++ = (
unsigned char)R;
2515 *rgb++ = (
unsigned char)G;
2516 *rgb++ = (
unsigned char)B;
2537 *rgb++ = (
unsigned char)R;
2538 *rgb++ = (
unsigned char)G;
2539 *rgb = (
unsigned char)B;
2540 rgb = rgb - 3 * width + 1;
2557 int U, V, R, G, B, V2, U5, UV;
2558 int Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7, Y8, Y9, Y10, Y11, Y12, Y13, Y14, Y15;
2559 unsigned int size = width * height;
2560 unsigned char *iV = yuv + size;
2561 unsigned char *iU = yuv + 17 * size / 16;
2562 for (
unsigned int i = 0; i < height / 4; i++) {
2563 for (
unsigned int j = 0; j < width / 4; j++) {
2564 U = (int)((*iU++ - 128) * 0.354);
2566 V = (int)((*iV++ - 128) * 0.707);
2573 yuv = yuv + width - 3;
2578 yuv = yuv + width - 3;
2583 yuv = yuv + width - 3;
2588 yuv = yuv - 3 * width + 1;
2612 *rgba++ = (
unsigned char)R;
2613 *rgba++ = (
unsigned char)G;
2614 *rgba++ = (
unsigned char)B;
2636 *rgba++ = (
unsigned char)R;
2637 *rgba++ = (
unsigned char)G;
2638 *rgba++ = (
unsigned char)B;
2660 *rgba++ = (
unsigned char)R;
2661 *rgba++ = (
unsigned char)G;
2662 *rgba++ = (
unsigned char)B;
2684 *rgba++ = (
unsigned char)R;
2685 *rgba++ = (
unsigned char)G;
2686 *rgba++ = (
unsigned char)B;
2688 rgba = rgba + 4 * width - 15;
2708 *rgba++ = (
unsigned char)R;
2709 *rgba++ = (
unsigned char)G;
2710 *rgba++ = (
unsigned char)B;
2732 *rgba++ = (
unsigned char)R;
2733 *rgba++ = (
unsigned char)G;
2734 *rgba++ = (
unsigned char)B;
2756 *rgba++ = (
unsigned char)R;
2757 *rgba++ = (
unsigned char)G;
2758 *rgba++ = (
unsigned char)B;
2780 *rgba++ = (
unsigned char)R;
2781 *rgba++ = (
unsigned char)G;
2782 *rgba++ = (
unsigned char)B;
2784 rgba = rgba + 4 * width - 15;
2804 *rgba++ = (
unsigned char)R;
2805 *rgba++ = (
unsigned char)G;
2806 *rgba++ = (
unsigned char)B;
2828 *rgba++ = (
unsigned char)R;
2829 *rgba++ = (
unsigned char)G;
2830 *rgba++ = (
unsigned char)B;
2852 *rgba++ = (
unsigned char)R;
2853 *rgba++ = (
unsigned char)G;
2854 *rgba++ = (
unsigned char)B;
2876 *rgba++ = (
unsigned char)R;
2877 *rgba++ = (
unsigned char)G;
2878 *rgba++ = (
unsigned char)B;
2880 rgba = rgba + 4 * width - 15;
2900 *rgba++ = (
unsigned char)R;
2901 *rgba++ = (
unsigned char)G;
2902 *rgba++ = (
unsigned char)B;
2924 *rgba++ = (
unsigned char)R;
2925 *rgba++ = (
unsigned char)G;
2926 *rgba++ = (
unsigned char)B;
2948 *rgba++ = (
unsigned char)R;
2949 *rgba++ = (
unsigned char)G;
2950 *rgba++ = (
unsigned char)B;
2972 *rgba++ = (
unsigned char)R;
2973 *rgba++ = (
unsigned char)G;
2974 *rgba++ = (
unsigned char)B;
2976 rgba = rgba - 12 * width + 1;
2990 int U, V, R, G, B, V2, U5, UV;
2991 int Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7, Y8, Y9, Y10, Y11, Y12, Y13, Y14, Y15;
2992 unsigned int size = width * height;
2993 unsigned char *iV = yuv + size;
2994 unsigned char *iU = yuv + 17 * size / 16;
2995 for (
unsigned int i = 0; i < height / 4; i++) {
2996 for (
unsigned int j = 0; j < width / 4; j++) {
2997 U = (int)((*iU++ - 128) * 0.354);
2999 V = (int)((*iV++ - 128) * 0.707);
3006 yuv = yuv + width - 3;
3011 yuv = yuv + width - 3;
3016 yuv = yuv + width - 3;
3021 yuv = yuv - 3 * width + 1;
3045 *rgb++ = (
unsigned char)R;
3046 *rgb++ = (
unsigned char)G;
3047 *rgb++ = (
unsigned char)B;
3068 *rgb++ = (
unsigned char)R;
3069 *rgb++ = (
unsigned char)G;
3070 *rgb++ = (
unsigned char)B;
3091 *rgb++ = (
unsigned char)R;
3092 *rgb++ = (
unsigned char)G;
3093 *rgb++ = (
unsigned char)B;
3114 *rgb++ = (
unsigned char)R;
3115 *rgb++ = (
unsigned char)G;
3116 *rgb = (
unsigned char)B;
3117 rgb = rgb + 3 * width - 11;
3137 *rgb++ = (
unsigned char)R;
3138 *rgb++ = (
unsigned char)G;
3139 *rgb++ = (
unsigned char)B;
3160 *rgb++ = (
unsigned char)R;
3161 *rgb++ = (
unsigned char)G;
3162 *rgb++ = (
unsigned char)B;
3183 *rgb++ = (
unsigned char)R;
3184 *rgb++ = (
unsigned char)G;
3185 *rgb++ = (
unsigned char)B;
3206 *rgb++ = (
unsigned char)R;
3207 *rgb++ = (
unsigned char)G;
3208 *rgb = (
unsigned char)B;
3209 rgb = rgb + 3 * width - 11;
3229 *rgb++ = (
unsigned char)R;
3230 *rgb++ = (
unsigned char)G;
3231 *rgb++ = (
unsigned char)B;
3252 *rgb++ = (
unsigned char)R;
3253 *rgb++ = (
unsigned char)G;
3254 *rgb++ = (
unsigned char)B;
3275 *rgb++ = (
unsigned char)R;
3276 *rgb++ = (
unsigned char)G;
3277 *rgb++ = (
unsigned char)B;
3298 *rgb++ = (
unsigned char)R;
3299 *rgb++ = (
unsigned char)G;
3300 *rgb = (
unsigned char)B;
3301 rgb = rgb + 3 * width - 11;
3321 *rgb++ = (
unsigned char)R;
3322 *rgb++ = (
unsigned char)G;
3323 *rgb++ = (
unsigned char)B;
3344 *rgb++ = (
unsigned char)R;
3345 *rgb++ = (
unsigned char)G;
3346 *rgb++ = (
unsigned char)B;
3367 *rgb++ = (
unsigned char)R;
3368 *rgb++ = (
unsigned char)G;
3369 *rgb++ = (
unsigned char)B;
3390 *rgb++ = (
unsigned char)R;
3391 *rgb++ = (
unsigned char)G;
3392 *rgb++ = (
unsigned char)B;
3393 rgb = rgb - 9 * width + 1;
3409 unsigned char *pt_input = rgb;
3410 unsigned char *pt_end = rgb + 3 * size;
3411 unsigned char *pt_output = rgba;
3413 while (pt_input != pt_end) {
3414 *(pt_output++) = *(pt_input++);
3415 *(pt_output++) = *(pt_input++);
3416 *(pt_output++) = *(pt_input++);
3430 unsigned char *pt_input = rgba;
3431 unsigned char *pt_end = rgba + 4 * size;
3432 unsigned char *pt_output = rgb;
3434 while (pt_input != pt_end) {
3435 *(pt_output++) = *(pt_input++);
3436 *(pt_output++) = *(pt_input++);
3437 *(pt_output++) = *(pt_input++);
3450 #if !VISP_HAVE_SSSE3 3460 const __m128i mask_R1 = _mm_set_epi8(-1, -1, -1, -1, 15, -1, 12, -1, 9, -1, 6, -1, 3, -1, 0, -1);
3461 const __m128i mask_R2 = _mm_set_epi8(5, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
3462 const __m128i mask_R3 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 14, -1, 11, -1, 8, -1);
3463 const __m128i mask_R4 = _mm_set_epi8(13, -1, 10, -1, 7, -1, 4, -1, 1, -1, -1, -1, -1, -1, -1, -1);
3466 const __m128i mask_G1 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, 13, -1, 10, -1, 7, -1, 4, -1, 1, -1);
3467 const __m128i mask_G2 = _mm_set_epi8(6, -1, 3, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
3468 const __m128i mask_G3 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 15, -1, 12, -1, 9, -1);
3469 const __m128i mask_G4 = _mm_set_epi8(14, -1, 11, -1, 8, -1, 5, -1, 2, -1, -1, -1, -1, -1, -1, -1);
3472 const __m128i mask_B1 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, 14, -1, 11, -1, 8, -1, 5, -1, 2, -1);
3473 const __m128i mask_B2 = _mm_set_epi8(7, -1, 4, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
3474 const __m128i mask_B3 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 13, -1, 10, -1);
3475 const __m128i mask_B4 = _mm_set_epi8(15, -1, 12, -1, 9, -1, 6, -1, 3, -1, 0, -1, -1, -1, -1, -1);
3478 const __m128i mask_low1 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, -1, -1, 15, 13, 11, 9, 7, 5, 3, 1);
3479 const __m128i mask_low2 = _mm_set_epi8(15, 13, 11, 9, 7, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1);
3482 const __m128i coeff_R = _mm_set_epi16(13933, 13933, 13933, 13933, 13933, 13933, 13933, 13933);
3483 const __m128i coeff_G = _mm_set_epi16((
short int)46871, (
short int)46871, (
short int)46871, (
short int)46871,
3484 (
short int)46871, (
short int)46871, (
short int)46871, (
short int)46871);
3485 const __m128i coeff_B = _mm_set_epi16(4732, 4732, 4732, 4732, 4732, 4732, 4732, 4732);
3487 for (; i <= size - 16; i += 16) {
3489 const __m128i data1 = _mm_loadu_si128((
const __m128i *)rgb);
3490 const __m128i data2 = _mm_loadu_si128((
const __m128i *)(rgb + 16));
3491 const __m128i data3 = _mm_loadu_si128((
const __m128i *)(rgb + 32));
3493 const __m128i red_0_7 = _mm_or_si128(_mm_shuffle_epi8(data1, mask_R1), _mm_shuffle_epi8(data2, mask_R2));
3494 const __m128i green_0_7 = _mm_or_si128(_mm_shuffle_epi8(data1, mask_G1), _mm_shuffle_epi8(data2, mask_G2));
3495 const __m128i blue_0_7 = _mm_or_si128(_mm_shuffle_epi8(data1, mask_B1), _mm_shuffle_epi8(data2, mask_B2));
3497 const __m128i grays_0_7 =
3498 _mm_adds_epu16(_mm_mulhi_epu16(red_0_7, coeff_R),
3499 _mm_adds_epu16(_mm_mulhi_epu16(green_0_7, coeff_G), _mm_mulhi_epu16(blue_0_7, coeff_B)));
3501 const __m128i red_8_15 = _mm_or_si128(_mm_shuffle_epi8(data2, mask_R3), _mm_shuffle_epi8(data3, mask_R4));
3502 const __m128i green_8_15 = _mm_or_si128(_mm_shuffle_epi8(data2, mask_G3), _mm_shuffle_epi8(data3, mask_G4));
3503 const __m128i blue_8_15 = _mm_or_si128(_mm_shuffle_epi8(data2, mask_B3), _mm_shuffle_epi8(data3, mask_B4));
3505 const __m128i grays_8_15 =
3506 _mm_adds_epu16(_mm_mulhi_epu16(red_8_15, coeff_R),
3507 _mm_adds_epu16(_mm_mulhi_epu16(green_8_15, coeff_G), _mm_mulhi_epu16(blue_8_15, coeff_B)));
3509 _mm_storeu_si128((__m128i *)grey,
3510 _mm_or_si128(_mm_shuffle_epi8(grays_0_7, mask_low1), _mm_shuffle_epi8(grays_8_15, mask_low2)));
3517 for (; i < size; i++) {
3518 *grey = (
unsigned char)(0.2126 * (*rgb) + 0.7152 * (*(rgb + 1)) + 0.0722 * (*(rgb + 2)));
3525 unsigned char *pt_input = rgb;
3526 unsigned char *pt_end = rgb + size * 3;
3527 unsigned char *pt_output = grey;
3529 while (pt_input != pt_end) {
3530 *pt_output = (
unsigned char)(0.2126 * (*pt_input) + 0.7152 * (*(pt_input + 1)) + 0.0722 * (*(pt_input + 2)));
3546 #if !VISP_HAVE_SSSE3 3556 const __m128i mask_R1 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, -1, -1, 12, -1, 8, -1, 4, -1, 0, -1);
3557 const __m128i mask_R2 = _mm_set_epi8(12, -1, 8, -1, 4, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1);
3560 const __m128i mask_G1 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, -1, -1, 13, -1, 9, -1, 5, -1, 1, -1);
3561 const __m128i mask_G2 = _mm_set_epi8(13, -1, 9, -1, 5, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
3564 const __m128i mask_B1 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, -1, -1, 14, -1, 10, -1, 6, -1, 2, -1);
3565 const __m128i mask_B2 = _mm_set_epi8(14, -1, 10, -1, 6, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1);
3568 const __m128i mask_low1 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, -1, -1, 15, 13, 11, 9, 7, 5, 3, 1);
3569 const __m128i mask_low2 = _mm_set_epi8(15, 13, 11, 9, 7, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1);
3572 const __m128i coeff_R = _mm_set_epi16(13933, 13933, 13933, 13933, 13933, 13933, 13933, 13933);
3573 const __m128i coeff_G = _mm_set_epi16((
short int)46871, (
short int)46871, (
short int)46871, (
short int)46871,
3574 (
short int)46871, (
short int)46871, (
short int)46871, (
short int)46871);
3575 const __m128i coeff_B = _mm_set_epi16(4732, 4732, 4732, 4732, 4732, 4732, 4732, 4732);
3577 for (; i <= size - 16; i += 16) {
3579 const __m128i data1 = _mm_loadu_si128((
const __m128i *)rgba);
3580 const __m128i data2 = _mm_loadu_si128((
const __m128i *)(rgba + 16));
3582 const __m128i red_0_7 = _mm_or_si128(_mm_shuffle_epi8(data1, mask_R1), _mm_shuffle_epi8(data2, mask_R2));
3583 const __m128i green_0_7 = _mm_or_si128(_mm_shuffle_epi8(data1, mask_G1), _mm_shuffle_epi8(data2, mask_G2));
3584 const __m128i blue_0_7 = _mm_or_si128(_mm_shuffle_epi8(data1, mask_B1), _mm_shuffle_epi8(data2, mask_B2));
3586 const __m128i grays_0_7 =
3587 _mm_adds_epu16(_mm_mulhi_epu16(red_0_7, coeff_R),
3588 _mm_adds_epu16(_mm_mulhi_epu16(green_0_7, coeff_G), _mm_mulhi_epu16(blue_0_7, coeff_B)));
3591 const __m128i data3 = _mm_loadu_si128((
const __m128i *)(rgba + 32));
3592 const __m128i data4 = _mm_loadu_si128((
const __m128i *)(rgba + 48));
3594 const __m128i red_8_15 = _mm_or_si128(_mm_shuffle_epi8(data3, mask_R1), _mm_shuffle_epi8(data4, mask_R2));
3595 const __m128i green_8_15 = _mm_or_si128(_mm_shuffle_epi8(data3, mask_G1), _mm_shuffle_epi8(data4, mask_G2));
3596 const __m128i blue_8_15 = _mm_or_si128(_mm_shuffle_epi8(data3, mask_B1), _mm_shuffle_epi8(data4, mask_B2));
3598 const __m128i grays_8_15 =
3599 _mm_adds_epu16(_mm_mulhi_epu16(red_8_15, coeff_R),
3600 _mm_adds_epu16(_mm_mulhi_epu16(green_8_15, coeff_G), _mm_mulhi_epu16(blue_8_15, coeff_B)));
3602 _mm_storeu_si128((__m128i *)grey,
3603 _mm_or_si128(_mm_shuffle_epi8(grays_0_7, mask_low1), _mm_shuffle_epi8(grays_8_15, mask_low2)));
3610 for (; i < size; i++) {
3611 *grey = (
unsigned char)(0.2126 * (*rgba) + 0.7152 * (*(rgba + 1)) + 0.0722 * (*(rgba + 2)));
3618 unsigned char *pt_input = rgba;
3619 unsigned char *pt_end = rgba + size * 4;
3620 unsigned char *pt_output = grey;
3622 while (pt_input != pt_end) {
3623 *pt_output = (
unsigned char)(0.2126 * (*pt_input) + 0.7152 * (*(pt_input + 1)) + 0.0722 * (*(pt_input + 2)));
3637 unsigned char *pt_input = grey;
3638 unsigned char *pt_end = grey + size;
3639 unsigned char *pt_output = rgba;
3641 while (pt_input != pt_end) {
3642 unsigned char p = *pt_input;
3644 *(pt_output + 1) = p;
3645 *(pt_output + 2) = p;
3659 unsigned char *pt_input = grey;
3660 unsigned char *pt_end = grey + size;
3661 unsigned char *pt_output = rgb;
3663 while (pt_input != pt_end) {
3664 unsigned char p = *pt_input;
3666 *(pt_output + 1) = p;
3667 *(pt_output + 2) = p;
3686 int lineStep = (flip) ? -(
int)(width * 3) : (
int)(width * 3);
3689 unsigned char *src = (flip) ? (bgr + (width * height * 3) + lineStep) : bgr;
3691 for (
unsigned int i = 0; i < height; i++) {
3692 unsigned char *line = src;
3693 for (
unsigned int j = 0; j < width; j++) {
3694 *rgba++ = *(line + 2);
3695 *rgba++ = *(line + 1);
3696 *rgba++ = *(line + 0);
3715 #if !VISP_HAVE_SSSE3 3722 const __m128i mask_B1 = _mm_set_epi8(-1, -1, -1, -1, 15, -1, 12, -1, 9, -1, 6, -1, 3, -1, 0, -1);
3723 const __m128i mask_B2 = _mm_set_epi8(5, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
3724 const __m128i mask_B3 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 14, -1, 11, -1, 8, -1);
3725 const __m128i mask_B4 = _mm_set_epi8(13, -1, 10, -1, 7, -1, 4, -1, 1, -1, -1, -1, -1, -1, -1, -1);
3728 const __m128i mask_G1 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, 13, -1, 10, -1, 7, -1, 4, -1, 1, -1);
3729 const __m128i mask_G2 = _mm_set_epi8(6, -1, 3, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
3730 const __m128i mask_G3 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 15, -1, 12, -1, 9, -1);
3731 const __m128i mask_G4 = _mm_set_epi8(14, -1, 11, -1, 8, -1, 5, -1, 2, -1, -1, -1, -1, -1, -1, -1);
3734 const __m128i mask_R1 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, 14, -1, 11, -1, 8, -1, 5, -1, 2, -1);
3735 const __m128i mask_R2 = _mm_set_epi8(7, -1, 4, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
3736 const __m128i mask_R3 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 13, -1, 10, -1);
3737 const __m128i mask_R4 = _mm_set_epi8(15, -1, 12, -1, 9, -1, 6, -1, 3, -1, 0, -1, -1, -1, -1, -1);
3740 const __m128i mask_low1 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, -1, -1, 15, 13, 11, 9, 7, 5, 3, 1);
3741 const __m128i mask_low2 = _mm_set_epi8(15, 13, 11, 9, 7, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1);
3764 const __m128i coeff_R = _mm_set_epi16(13933, 13933, 13933, 13933, 13933, 13933, 13933, 13933);
3765 const __m128i coeff_G = _mm_set_epi16((
short int)46871, (
short int)46871, (
short int)46871, (
short int)46871,
3766 (
short int)46871, (
short int)46871, (
short int)46871, (
short int)46871);
3767 const __m128i coeff_B = _mm_set_epi16(4732, 4732, 4732, 4732, 4732, 4732, 4732, 4732);
3770 int i = ((int)height) - 1;
3771 int lineStep = -(int)(width * 3);
3772 bgr = bgr + (width * (height - 1) * 3);
3774 unsigned char *linePtr = bgr;
3775 unsigned char r, g, b;
3778 for (; i >= 0; i--) {
3781 for (; j <= width - 16; j += 16) {
3783 const __m128i data1 = _mm_loadu_si128((
const __m128i *)bgr);
3784 const __m128i data2 = _mm_loadu_si128((
const __m128i *)(bgr + 16));
3785 const __m128i data3 = _mm_loadu_si128((
const __m128i *)(bgr + 32));
3787 const __m128i red_0_7 = _mm_or_si128(_mm_shuffle_epi8(data1, mask_R1), _mm_shuffle_epi8(data2, mask_R2));
3788 const __m128i green_0_7 = _mm_or_si128(_mm_shuffle_epi8(data1, mask_G1), _mm_shuffle_epi8(data2, mask_G2));
3789 const __m128i blue_0_7 = _mm_or_si128(_mm_shuffle_epi8(data1, mask_B1), _mm_shuffle_epi8(data2, mask_B2));
3791 const __m128i grays_0_7 =
3792 _mm_adds_epu16(_mm_mulhi_epu16(red_0_7, coeff_R),
3793 _mm_adds_epu16(_mm_mulhi_epu16(green_0_7, coeff_G), _mm_mulhi_epu16(blue_0_7, coeff_B)));
3795 const __m128i red_8_15 = _mm_or_si128(_mm_shuffle_epi8(data2, mask_R3), _mm_shuffle_epi8(data3, mask_R4));
3796 const __m128i green_8_15 = _mm_or_si128(_mm_shuffle_epi8(data2, mask_G3), _mm_shuffle_epi8(data3, mask_G4));
3797 const __m128i blue_8_15 = _mm_or_si128(_mm_shuffle_epi8(data2, mask_B3), _mm_shuffle_epi8(data3, mask_B4));
3799 const __m128i grays_8_15 =
3800 _mm_adds_epu16(_mm_mulhi_epu16(red_8_15, coeff_R), _mm_adds_epu16(_mm_mulhi_epu16(green_8_15, coeff_G),
3801 _mm_mulhi_epu16(blue_8_15, coeff_B)));
3803 _mm_storeu_si128((__m128i *)grey, _mm_or_si128(_mm_shuffle_epi8(grays_0_7, mask_low1),
3804 _mm_shuffle_epi8(grays_8_15, mask_low2)));
3810 for (; j < width; j++) {
3814 *grey++ = (
unsigned char)(0.2126 * r + 0.7152 * g + 0.0722 * b);
3817 linePtr += lineStep;
3822 for (; i >= 0; i--) {
3823 for (
unsigned int j = 0; j < width; j++) {
3827 *grey++ = (
unsigned char)(0.2126 * r + 0.7152 * g + 0.0722 * b);
3830 linePtr += lineStep;
3835 unsigned int size = width * height;
3838 for (; i <= size - 16; i += 16) {
3840 const __m128i data1 = _mm_loadu_si128((
const __m128i *)bgr);
3841 const __m128i data2 = _mm_loadu_si128((
const __m128i *)(bgr + 16));
3842 const __m128i data3 = _mm_loadu_si128((
const __m128i *)(bgr + 32));
3844 const __m128i red_0_7 = _mm_or_si128(_mm_shuffle_epi8(data1, mask_R1), _mm_shuffle_epi8(data2, mask_R2));
3845 const __m128i green_0_7 = _mm_or_si128(_mm_shuffle_epi8(data1, mask_G1), _mm_shuffle_epi8(data2, mask_G2));
3846 const __m128i blue_0_7 = _mm_or_si128(_mm_shuffle_epi8(data1, mask_B1), _mm_shuffle_epi8(data2, mask_B2));
3848 const __m128i grays_0_7 =
3849 _mm_adds_epu16(_mm_mulhi_epu16(red_0_7, coeff_R),
3850 _mm_adds_epu16(_mm_mulhi_epu16(green_0_7, coeff_G), _mm_mulhi_epu16(blue_0_7, coeff_B)));
3852 const __m128i red_8_15 = _mm_or_si128(_mm_shuffle_epi8(data2, mask_R3), _mm_shuffle_epi8(data3, mask_R4));
3853 const __m128i green_8_15 = _mm_or_si128(_mm_shuffle_epi8(data2, mask_G3), _mm_shuffle_epi8(data3, mask_G4));
3854 const __m128i blue_8_15 = _mm_or_si128(_mm_shuffle_epi8(data2, mask_B3), _mm_shuffle_epi8(data3, mask_B4));
3856 const __m128i grays_8_15 =
3857 _mm_adds_epu16(_mm_mulhi_epu16(red_8_15, coeff_R),
3858 _mm_adds_epu16(_mm_mulhi_epu16(green_8_15, coeff_G), _mm_mulhi_epu16(blue_8_15, coeff_B)));
3860 _mm_storeu_si128((__m128i *)grey, _mm_or_si128(_mm_shuffle_epi8(grays_0_7, mask_low1),
3861 _mm_shuffle_epi8(grays_8_15, mask_low2)));
3868 for (; i < size; i++) {
3869 *grey = (
unsigned char)(0.2126 * (*(bgr + 2)) + 0.7152 * (*(bgr + 1)) + 0.0722 * (*bgr));
3879 int lineStep = (flip) ? -(
int)(width * 3) : (
int)(width * 3);
3882 unsigned char *src = (flip) ? bgr + (width * height * 3) + lineStep : bgr;
3884 for (
unsigned int i = 0; i < height; i++) {
3885 unsigned char *line = src;
3886 for (
unsigned int j = 0; j < width; j++) {
3887 *grey++ = (
unsigned char)(0.2126 * *(line + 2) + 0.7152 * *(line + 1) + 0.0722 * *(line + 0));
3909 int lineStep = (flip) ? -(
int)(width * 3) : (
int)(width * 3);
3912 unsigned char *src = (flip) ? (rgb + (width * height * 3) + lineStep) : rgb;
3917 for (i = 0; i < height; i++) {
3918 unsigned char *line = src;
3919 for (j = 0; j < width; j++) {
3920 *rgba++ = *(line++);
3921 *rgba++ = *(line++);
3922 *rgba++ = *(line++);
3940 #if !VISP_HAVE_SSSE3 3946 int i = ((int)height) - 1;
3947 int lineStep = -(int)(width * 3);
3948 rgb = rgb + (width * (height - 1) * 3);
3950 unsigned char *linePtr = rgb;
3951 unsigned char r, g, b;
3955 const __m128i mask_R1 = _mm_set_epi8(-1, -1, -1, -1, 15, -1, 12, -1, 9, -1, 6, -1, 3, -1, 0, -1);
3956 const __m128i mask_R2 = _mm_set_epi8(5, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
3957 const __m128i mask_R3 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 14, -1, 11, -1, 8, -1);
3958 const __m128i mask_R4 = _mm_set_epi8(13, -1, 10, -1, 7, -1, 4, -1, 1, -1, -1, -1, -1, -1, -1, -1);
3961 const __m128i mask_G1 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, 13, -1, 10, -1, 7, -1, 4, -1, 1, -1);
3962 const __m128i mask_G2 = _mm_set_epi8(6, -1, 3, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
3963 const __m128i mask_G3 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 15, -1, 12, -1, 9, -1);
3964 const __m128i mask_G4 = _mm_set_epi8(14, -1, 11, -1, 8, -1, 5, -1, 2, -1, -1, -1, -1, -1, -1, -1);
3967 const __m128i mask_B1 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, 14, -1, 11, -1, 8, -1, 5, -1, 2, -1);
3968 const __m128i mask_B2 = _mm_set_epi8(7, -1, 4, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
3969 const __m128i mask_B3 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 13, -1, 10, -1);
3970 const __m128i mask_B4 = _mm_set_epi8(15, -1, 12, -1, 9, -1, 6, -1, 3, -1, 0, -1, -1, -1, -1, -1);
3973 const __m128i mask_low1 = _mm_set_epi8(-1, -1, -1, -1, -1, -1, -1, -1, 15, 13, 11, 9, 7, 5, 3, 1);
3974 const __m128i mask_low2 = _mm_set_epi8(15, 13, 11, 9, 7, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1);
3977 const __m128i coeff_R = _mm_set_epi16(13933, 13933, 13933, 13933, 13933, 13933, 13933, 13933);
3978 const __m128i coeff_G = _mm_set_epi16((
short int)46871, (
short int)46871, (
short int)46871, (
short int)46871,
3979 (
short int)46871, (
short int)46871, (
short int)46871, (
short int)46871);
3980 const __m128i coeff_B = _mm_set_epi16(4732, 4732, 4732, 4732, 4732, 4732, 4732, 4732);
3982 for (; i >= 0; i--) {
3985 for (; j <= width - 16; j += 16) {
3987 const __m128i data1 = _mm_loadu_si128((
const __m128i *)rgb);
3988 const __m128i data2 = _mm_loadu_si128((
const __m128i *)(rgb + 16));
3989 const __m128i data3 = _mm_loadu_si128((
const __m128i *)(rgb + 32));
3991 const __m128i red_0_7 = _mm_or_si128(_mm_shuffle_epi8(data1, mask_R1), _mm_shuffle_epi8(data2, mask_R2));
3992 const __m128i green_0_7 = _mm_or_si128(_mm_shuffle_epi8(data1, mask_G1), _mm_shuffle_epi8(data2, mask_G2));
3993 const __m128i blue_0_7 = _mm_or_si128(_mm_shuffle_epi8(data1, mask_B1), _mm_shuffle_epi8(data2, mask_B2));
3995 const __m128i grays_0_7 =
3996 _mm_adds_epu16(_mm_mulhi_epu16(red_0_7, coeff_R),
3997 _mm_adds_epu16(_mm_mulhi_epu16(green_0_7, coeff_G), _mm_mulhi_epu16(blue_0_7, coeff_B)));
3999 const __m128i red_8_15 = _mm_or_si128(_mm_shuffle_epi8(data2, mask_R3), _mm_shuffle_epi8(data3, mask_R4));
4000 const __m128i green_8_15 = _mm_or_si128(_mm_shuffle_epi8(data2, mask_G3), _mm_shuffle_epi8(data3, mask_G4));
4001 const __m128i blue_8_15 = _mm_or_si128(_mm_shuffle_epi8(data2, mask_B3), _mm_shuffle_epi8(data3, mask_B4));
4003 const __m128i grays_8_15 =
4004 _mm_adds_epu16(_mm_mulhi_epu16(red_8_15, coeff_R), _mm_adds_epu16(_mm_mulhi_epu16(green_8_15, coeff_G),
4005 _mm_mulhi_epu16(blue_8_15, coeff_B)));
4007 _mm_storeu_si128((__m128i *)grey, _mm_or_si128(_mm_shuffle_epi8(grays_0_7, mask_low1),
4008 _mm_shuffle_epi8(grays_8_15, mask_low2)));
4014 for (; j < width; j++) {
4018 *grey++ = (
unsigned char)(0.2126 * r + 0.7152 * g + 0.0722 * b);
4021 linePtr += lineStep;
4026 for (; i >= 0; i--) {
4027 for (
unsigned int j = 0; j < width; j++) {
4031 *grey++ = (
unsigned char)(0.2126 * r + 0.7152 * g + 0.0722 * b);
4034 linePtr += lineStep;
4041 int lineStep = (flip) ? -(
int)(width * 3) : (
int)(width * 3);
4044 unsigned char *src = (flip) ? rgb + (width * height * 3) + lineStep : rgb;
4051 for (i = 0; i < height; i++) {
4052 unsigned char *line = src;
4053 for (j = 0; j < width; j++) {
4057 *grey++ = (
unsigned char)(0.2126 * r + 0.7152 * g + 0.0722 * b);
4072 void vpImageConvert::computeYCbCrLUT()
4074 if (YCbCrLUTcomputed ==
false) {
4079 int aux = index - 128;
4080 vpImageConvert::vpCrr[index] = (int)(364.6610 * aux) >> 8;
4081 vpImageConvert::vpCgb[index] = (int)(-89.8779 * aux) >> 8;
4082 vpImageConvert::vpCgr[index] = (int)(-185.8154 * aux) >> 8;
4083 vpImageConvert::vpCbb[index] = (int)(460.5724 * aux) >> 8;
4086 YCbCrLUTcomputed =
true;
4113 unsigned char *pt_ycbcr = ycbcr;
4114 unsigned char *pt_rgb = rgb;
4118 vpImageConvert::computeYCbCrLUT();
4123 int val_r, val_g, val_b;
4129 val_r = *pt_ycbcr + vpImageConvert::vpCrr[*crv];
4130 val_g = *pt_ycbcr + vpImageConvert::vpCgb[*cbv] + vpImageConvert::vpCgr[*crv];
4131 val_b = *pt_ycbcr + vpImageConvert::vpCbb[*cbv];
4133 vpDEBUG_TRACE(5,
"[%d] R: %d G: %d B: %d\n", size, val_r, val_g, val_b);
4135 *pt_rgb++ = (val_r < 0) ? 0u : ((val_r > 255) ? 255u : (
unsigned char)val_r);
4136 *pt_rgb++ = (val_g < 0) ? 0u : ((val_g > 255) ? 255u : (
unsigned char)val_g);
4137 *pt_rgb++ = (val_b < 0) ? 0u : ((val_b > 255) ? 255u : (
unsigned char)val_b);
4170 unsigned char *pt_ycbcr = ycbcr;
4171 unsigned char *pt_rgba = rgba;
4175 vpImageConvert::computeYCbCrLUT();
4180 int val_r, val_g, val_b;
4186 val_r = *pt_ycbcr + vpImageConvert::vpCrr[*crv];
4187 val_g = *pt_ycbcr + vpImageConvert::vpCgb[*cbv] + vpImageConvert::vpCgr[*crv];
4188 val_b = *pt_ycbcr + vpImageConvert::vpCbb[*cbv];
4190 vpDEBUG_TRACE(5,
"[%d] R: %d G: %d B: %d\n", size, val_r, val_g, val_b);
4192 *pt_rgba++ = (val_r < 0) ? 0u : ((val_r > 255) ? 255u : (
unsigned char)val_r);
4193 *pt_rgba++ = (val_g < 0) ? 0u : ((val_g > 255) ? 255u : (
unsigned char)val_g);
4194 *pt_rgba++ = (val_b < 0) ? 0u : ((val_b > 255) ? 255u : (
unsigned char)val_b);
4219 unsigned int i = 0, j = 0;
4221 while (j < size * 2) {
4223 grey[i++] = yuv[j + 2];
4250 unsigned char *pt_ycbcr = ycrcb;
4251 unsigned char *pt_rgb = rgb;
4255 vpImageConvert::computeYCbCrLUT();
4260 int val_r, val_g, val_b;
4266 val_r = *pt_ycbcr + vpImageConvert::vpCrr[*crv];
4267 val_g = *pt_ycbcr + vpImageConvert::vpCgb[*cbv] + vpImageConvert::vpCgr[*crv];
4268 val_b = *pt_ycbcr + vpImageConvert::vpCbb[*cbv];
4270 vpDEBUG_TRACE(5,
"[%d] R: %d G: %d B: %d\n", size, val_r, val_g, val_b);
4272 *pt_rgb++ = (val_r < 0) ? 0u : ((val_r > 255) ? 255u : (
unsigned char)val_r);
4273 *pt_rgb++ = (val_g < 0) ? 0u : ((val_g > 255) ? 255u : (
unsigned char)val_g);
4274 *pt_rgb++ = (val_b < 0) ? 0u : ((val_b > 255) ? 255u : (
unsigned char)val_b);
4305 unsigned char *pt_ycbcr = ycrcb;
4306 unsigned char *pt_rgba = rgba;
4310 vpImageConvert::computeYCbCrLUT();
4315 int val_r, val_g, val_b;
4321 val_r = *pt_ycbcr + vpImageConvert::vpCrr[*crv];
4322 val_g = *pt_ycbcr + vpImageConvert::vpCgb[*cbv] + vpImageConvert::vpCgr[*crv];
4323 val_b = *pt_ycbcr + vpImageConvert::vpCbb[*cbv];
4325 vpDEBUG_TRACE(5,
"[%d] R: %d G: %d B: %d\n", size, val_r, val_g, val_b);
4327 *pt_rgba++ = (val_r < 0) ? 0u : ((val_r > 255) ? 255u : (
unsigned char)val_r);
4328 *pt_rgba++ = (val_g < 0) ? 0u : ((val_g > 255) ? 255u : (
unsigned char)val_g);
4329 *pt_rgba++ = (val_b < 0) ? 0u : ((val_b > 255) ? 255u : (
unsigned char)val_b);
4376 unsigned int width = src.
getWidth();
4377 unsigned char *input;
4394 for (
unsigned int j = 0; j < 4; j++) {
4395 if (tabChannel[j] != NULL) {
4396 if (tabChannel[j]->getHeight() != height || tabChannel[j]->getWidth() != width) {
4397 tabChannel[j]->
resize(height, width);
4399 dst = (
unsigned char *)tabChannel[j]->bitmap;
4401 input = (
unsigned char *)src.
bitmap + j;
4406 for (; i < n; i += 4) {
4423 for (; i < n; i++) {
4444 std::map<unsigned int, unsigned int> mapOfWidths, mapOfHeights;
4465 if (mapOfWidths.size() == 1 && mapOfHeights.size() == 1) {
4466 unsigned int width = mapOfWidths.begin()->first;
4467 unsigned int height = mapOfHeights.begin()->first;
4469 RGBa.
resize(height, width);
4471 unsigned int size = width * height;
4472 for (
unsigned int i = 0; i < size; i++) {
4506 int i = (((int)size) << 1) - 1;
4507 int j = (int)size - 1;
4510 int y = grey16[i--];
4511 grey[j--] =
static_cast<unsigned char>((y + (grey16[i--] << 8)) >> 8);
4529 int i = (((int)size) << 1) - 1;
4530 int j = (int)(size * 4 - 1);
4533 int y = grey16[i--];
4534 unsigned char v =
static_cast<unsigned char>((y + (grey16[i--] << 8)) >> 8);
4542 void vpImageConvert::HSV2RGB(
const double *hue_,
const double *saturation_,
const double *value_,
unsigned char *rgb,
4543 const unsigned int size,
const unsigned int step)
4545 for (
unsigned int i = 0; i < size; i++) {
4546 double hue = hue_[i], saturation = saturation_[i], value = value_[i];
4548 if (
vpMath::equal(saturation, 0.0, std::numeric_limits<double>::epsilon())) {
4552 double h = hue * 6.0;
4553 double s = saturation;
4556 if (
vpMath::equal(h, 6.0, std::numeric_limits<double>::epsilon())) {
4560 double f = h - (int)h;
4561 double p = v * (1.0 - s);
4562 double q = v * (1.0 - s * f);
4563 double t = v * (1.0 - s * (1.0 - f));
4605 rgb[i * step + 1] = (
unsigned char)
vpMath::round(saturation * 255.0);
4606 rgb[i * step + 2] = (
unsigned char)
vpMath::round(value * 255.0);
4612 void vpImageConvert::RGB2HSV(
const unsigned char *rgb,
double *hue,
double *saturation,
double *value,
4613 const unsigned int size,
const unsigned int step)
4615 for (
unsigned int i = 0; i < size; i++) {
4616 double red, green, blue;
4620 red = rgb[i * step] / 255.0;
4621 green = rgb[i * step + 1] / 255.0;
4622 blue = rgb[i * step + 2] / 255.0;
4625 max = ((std::max))(red, blue);
4626 min = ((std::min))(green, blue);
4628 max = ((std::max))(green, blue);
4629 min = ((std::min))(red, blue);
4634 if (!
vpMath::equal(max, 0.0, std::numeric_limits<double>::epsilon())) {
4635 s = (max - min) / max;
4640 if (
vpMath::equal(s, 0.0, std::numeric_limits<double>::epsilon())) {
4643 double delta = max - min;
4644 if (
vpMath::equal(delta, 0.0, std::numeric_limits<double>::epsilon())) {
4648 if (
vpMath::equal(red, max, std::numeric_limits<double>::epsilon())) {
4649 h = (green - blue) / delta;
4650 }
else if (
vpMath::equal(green, max, std::numeric_limits<double>::epsilon())) {
4651 h = 2 + (blue - red) / delta;
4653 h = 4 + (red - green) / delta;
4659 }
else if (h > 1.0) {
4683 const unsigned int size)
4685 vpImageConvert::HSV2RGB(hue, saturation, value, rgba, size, 4);
4701 unsigned char *rgba,
const unsigned int size)
4703 for (
unsigned int i = 0; i < size; i++) {
4704 double h = hue[i] / 255.0, s = saturation[i] / 255.0, v = value[i] / 255.0;
4722 const unsigned int size)
4724 vpImageConvert::RGB2HSV(rgba, hue, saturation, value, size, 4);
4739 unsigned char *value,
const unsigned int size)
4741 for (
unsigned int i = 0; i < size; i++) {
4745 hue[i] = (
unsigned char)(255.0 * h);
4746 saturation[i] = (
unsigned char)(255.0 * s);
4747 value[i] = (
unsigned char)(255.0 * v);
4761 const unsigned int size)
4763 vpImageConvert::HSV2RGB(hue, saturation, value, rgb, size, 3);
4776 unsigned char *rgb,
const unsigned int size)
4778 for (
unsigned int i = 0; i < size; i++) {
4779 double h = hue[i] / 255.0, s = saturation[i] / 255.0, v = value[i] / 255.0;
4796 const unsigned int size)
4798 vpImageConvert::RGB2HSV(rgb, hue, saturation, value, size, 3);
4812 unsigned char *value,
const unsigned int size)
4814 for (
unsigned int i = 0; i < size; i++) {
4819 hue[i] = (
unsigned char)(255.0 * h);
4820 saturation[i] = (
unsigned char)(255.0 * s);
4821 value[i] = (
unsigned char)(255.0 * v);
unsigned int getCols() const
static void BGRToRGBa(unsigned char *bgr, unsigned char *rgba, unsigned int width, unsigned int height, bool flip=false)
static void YUYVToRGBa(unsigned char *yuyv, unsigned char *rgba, unsigned int width, unsigned int height)
static void RGBToGrey(unsigned char *rgb, unsigned char *grey, unsigned int size)
unsigned int getWidth() const
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
void getMinMaxValue(Type &min, Type &max) const
Look for the minimum and the maximum value within the bitmap.
static void RGBToHSV(const unsigned char *rgb, double *hue, double *saturation, double *value, const unsigned int size)
unsigned char B
Blue component.
static void RGBToRGBa(unsigned char *rgb, unsigned char *rgba, unsigned int size)
static void BGRToGrey(unsigned char *bgr, unsigned char *grey, unsigned int width, unsigned int height, bool flip=false)
Type * bitmap
points toward the bitmap
static void MONO16ToGrey(unsigned char *grey16, unsigned char *grey, unsigned int size)
static bool equal(double x, double y, double s=0.001)
static void YUV422ToRGB(unsigned char *yuv, unsigned char *rgb, unsigned int size)
static void YUV420ToGrey(unsigned char *yuv, unsigned char *grey, unsigned int size)
static void GreyToRGBa(unsigned char *grey, unsigned char *rgba, unsigned int size)
error that can be emited by ViSP classes.
static void YUV422ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int size)
static void YCbCrToRGB(unsigned char *ycbcr, unsigned char *rgb, unsigned int size)
static void YUV411ToRGB(unsigned char *yuv, unsigned char *rgb, unsigned int size)
static void split(const vpImage< vpRGBa > &src, vpImage< unsigned char > *pR, vpImage< unsigned char > *pG, vpImage< unsigned char > *pB, vpImage< unsigned char > *pa=NULL)
static void YUVToRGB(unsigned char y, unsigned char u, unsigned char v, unsigned char &r, unsigned char &g, unsigned char &b)
unsigned char G
Green component.
static void GreyToRGB(unsigned char *grey, unsigned char *rgb, unsigned int size)
static int round(const double x)
static void YUV444ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int size)
static void YUV420ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int width, unsigned int height)
static void YVU9ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int width, unsigned int height)
static void YUV422ToGrey(unsigned char *yuv, unsigned char *grey, unsigned int size)
unsigned int getRows() const
static void YVU9ToRGB(unsigned char *yuv, unsigned char *rgb, unsigned int width, unsigned int height)
static void YV12ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int width, unsigned int height)
unsigned int getSize() const
static void YCbCrToGrey(unsigned char *ycbcr, unsigned char *grey, unsigned int size)
unsigned char A
Additionnal component.
static void YUYVToGrey(unsigned char *yuyv, unsigned char *grey, unsigned int size)
static void MONO16ToRGBa(unsigned char *grey16, unsigned char *rgba, unsigned int size)
unsigned int getNumberOfPixel() const
void resize(const unsigned int h, const unsigned int w)
resize the image : Image initialization
VISP_EXPORT bool checkSSSE3()
static void merge(const vpImage< unsigned char > *R, const vpImage< unsigned char > *G, const vpImage< unsigned char > *B, const vpImage< unsigned char > *a, vpImage< vpRGBa > &RGBa)
static void RGBaToHSV(const unsigned char *rgba, double *hue, double *saturation, double *value, const unsigned int size)
static void YUYVToRGB(unsigned char *yuyv, unsigned char *rgb, unsigned int width, unsigned int height)
static void YUV444ToRGB(unsigned char *yuv, unsigned char *rgb, unsigned int size)
static void YUV444ToGrey(unsigned char *yuv, unsigned char *grey, unsigned int size)
static void YUV411ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int size)
unsigned char R
Red component.
static void HSVToRGBa(const double *hue, const double *saturation, const double *value, unsigned char *rgba, const unsigned int size)
unsigned int getHeight() const
static void YCbCrToRGBa(unsigned char *ycbcr, unsigned char *rgb, unsigned int size)
static void YUV411ToGrey(unsigned char *yuv, unsigned char *grey, unsigned int size)
static void RGBaToRGB(unsigned char *rgba, unsigned char *rgb, unsigned int size)
static void YCrCbToRGB(unsigned char *ycbcr, unsigned char *rgb, unsigned int size)
static void HSVToRGB(const double *hue, const double *saturation, const double *value, unsigned char *rgb, const unsigned int size)
static void YCrCbToRGBa(unsigned char *ycbcr, unsigned char *rgb, unsigned int size)
static void RGBaToGrey(unsigned char *rgba, unsigned char *grey, unsigned int size)
static void createDepthHistogram(const vpImage< uint16_t > &src_depth, vpImage< vpRGBa > &dest_rgba)
static void YV12ToRGB(unsigned char *yuv, unsigned char *rgb, unsigned int width, unsigned int height)
static void YUV420ToRGB(unsigned char *yuv, unsigned char *rgb, unsigned int width, unsigned int height)