Extract ImageResampler from X11Grabber

Former-commit-id: 63e95fa85fc0ef5a66f6eb8b396cf4b6370cf5dd
This commit is contained in:
poljvd
2014-12-14 14:26:59 +01:00
parent 93de656985
commit e608b11caa
16 changed files with 517 additions and 345 deletions

View File

@@ -9,7 +9,6 @@ SET(V4L2_QT_HEADERS
SET(V4L2_HEADERS
${CURRENT_HEADER_DIR}/VideoStandard.h
${CURRENT_HEADER_DIR}/PixelFormat.h
)
SET(V4L2_SOURCES

View File

@@ -20,19 +20,19 @@
static inline uint8_t clamp(int x)
{
return (x<0) ? 0 : ((x>255) ? 255 : uint8_t(x));
return (x<0) ? 0 : ((x>255) ? 255 : uint8_t(x));
}
static void yuv2rgb(uint8_t y, uint8_t u, uint8_t v, uint8_t & r, uint8_t & g, uint8_t & b)
{
// see: http://en.wikipedia.org/wiki/YUV#Y.27UV444_to_RGB888_conversion
int c = y - 16;
int d = u - 128;
int e = v - 128;
// see: http://en.wikipedia.org/wiki/YUV#Y.27UV444_to_RGB888_conversion
int c = y - 16;
int d = u - 128;
int e = v - 128;
r = clamp((298 * c + 409 * e + 128) >> 8);
g = clamp((298 * c - 100 * d - 208 * e + 128) >> 8);
b = clamp((298 * c + 516 * d + 128) >> 8);
r = clamp((298 * c + 409 * e + 128) >> 8);
g = clamp((298 * c - 100 * d - 208 * e + 128) >> 8);
b = clamp((298 * c + 516 * d + 128) >> 8);
}