summaryrefslogtreecommitdiff
path: root/libcamera/webcam-tools.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcamera/webcam-tools.c')
-rw-r--r--libcamera/webcam-tools.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libcamera/webcam-tools.c b/libcamera/webcam-tools.c
index 01a3501..2054ba9 100644
--- a/libcamera/webcam-tools.c
+++ b/libcamera/webcam-tools.c
@@ -729,7 +729,8 @@ static inline int minmax(int min, int v, int max) {
return (v < min) ? min : (max < v) ? max : v;
}
static inline uint8_t yuv2r(int y, int u, int v) {
- int c = y-16, d = u - 128, e = v - 128;
+ (void)(u);
+ int c = y-16, /*d = u - 128,*/ e = v - 128;
// https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/1071301e-74a2-4de4-be72-81c34604cde9/program-to-translate-yuyv-to-rgbrgb?forum=windowsdirectshowdevelopment
int r = (298 * c + 409 * e + 128) >> 8;
// linaro webcam
@@ -745,7 +746,8 @@ static inline uint8_t yuv2g(int y, int u, int v) {
return minmax(0, g, 255);
}
static inline uint8_t yuv2b(int y, int u, int v) {
- int c = y - 16, d = u - 128, e = v - 128;
+ (void)(v);
+ int c = y - 16, d = u - 128 /* , e = v - 128*/;
int b = (298 * c + 516 * d + 128) >> 8;
//int b = (1.164 * c + 2.018 * d );
//int b = (y + 454 * u) >> 8;
@@ -754,8 +756,8 @@ static inline uint8_t yuv2b(int y, int u, int v) {
unsigned char* yuyv2rgb(const unsigned char* yuyv, uint32_t width, uint32_t height) {
unsigned char* rgb = calloc(width * height * 3, sizeof (unsigned char));
- for (long i = 0; i < height; i++) {
- for ( long j = 0; j < width; j += 2) {
+ for (uint32_t i = 0; i < height; i++) {
+ for ( uint32_t j = 0; j < width; j += 2) {
long indexPixel = i * width + j;
long indexYUYV = indexPixel * 2, indexRGB = indexPixel * 3;
unsigned char y0 = yuyv[indexYUYV + 0] ;