summaryrefslogtreecommitdiff
path: root/kms++util/src
diff options
context:
space:
mode:
Diffstat (limited to 'kms++util/src')
-rw-r--r--kms++util/src/color.cpp3
-rw-r--r--kms++util/src/drawing.cpp14
2 files changed, 9 insertions, 8 deletions
diff --git a/kms++util/src/color.cpp b/kms++util/src/color.cpp
index 74ff8c9..c761e40 100644
--- a/kms++util/src/color.cpp
+++ b/kms++util/src/color.cpp
@@ -114,7 +114,8 @@ YUV RGB::yuv(YUVType type) const
{ \
((int)((a)*CF_ONE)), ((int)((b)*CF_ONE)), ((int)((c)*CF_ONE)) \
}
-#define CLAMP(a) ((a) > (CF_ONE - 1) ? (CF_ONE - 1) : (a) < 0 ? 0 : (a))
+#define CLAMP(a) ((a) > (CF_ONE - 1) ? (CF_ONE - 1) : (a) < 0 ? 0 \
+ : (a))
const int YUVcoef[static_cast<unsigned>(YUVType::MAX)][3][3] = {
[static_cast<unsigned>(YUVType::BT601_Lim)] = {
diff --git a/kms++util/src/drawing.cpp b/kms++util/src/drawing.cpp
index 2631f14..862638b 100644
--- a/kms++util/src/drawing.cpp
+++ b/kms++util/src/drawing.cpp
@@ -181,7 +181,7 @@ static void draw_yuv422_packed_macropixel(IFramebuffer& buf, unsigned x, unsigne
}
static void draw_y2xx_packed_macropixel(IFramebuffer& buf, unsigned x, unsigned y,
- YUV yuv1, YUV yuv2)
+ YUV yuv1, YUV yuv2)
{
const uint32_t macro_size = 4;
uint16_t* p = (uint16_t*)(buf.map(0) + buf.stride(0) * y + x * macro_size);
@@ -191,8 +191,8 @@ static void draw_y2xx_packed_macropixel(IFramebuffer& buf, unsigned x, unsigned
// XXX naive expansion to 10 bits, similar to 10-bit funcs in class RGB
uint16_t y0 = yuv1.y << 2;
uint16_t y1 = yuv2.y << 2;
- uint16_t cb = ((yuv1.u << 2) + (yuv2.u << 2)) / 2;
- uint16_t cr = ((yuv1.v << 2) + (yuv2.v << 2)) / 2;
+ uint16_t cb = ((yuv1.u << 2) + (yuv2.u << 2)) / 2;
+ uint16_t cr = ((yuv1.v << 2) + (yuv2.v << 2)) / 2;
// The 10 bits occupy the msb, so we shift left by 16-10 = 6
write16le(&p[0], y0 << 6);
@@ -206,8 +206,8 @@ static void draw_y2xx_packed_macropixel(IFramebuffer& buf, unsigned x, unsigned
// XXX naive expansion to 12 bits
uint16_t y0 = yuv1.y << 4;
uint16_t y1 = yuv2.y << 4;
- uint16_t cb = ((yuv1.u << 4) + (yuv2.u << 4)) / 2;
- uint16_t cr = ((yuv1.v << 4) + (yuv2.v << 4)) / 2;
+ uint16_t cb = ((yuv1.u << 4) + (yuv2.u << 4)) / 2;
+ uint16_t cr = ((yuv1.v << 4) + (yuv2.v << 4)) / 2;
// The 10 bits occupy the msb, so we shift left by 16-12 = 4
write16le(&p[0], y0 << 4);
@@ -221,8 +221,8 @@ static void draw_y2xx_packed_macropixel(IFramebuffer& buf, unsigned x, unsigned
// XXX naive expansion to 16 bits
uint16_t y0 = yuv1.y << 8;
uint16_t y1 = yuv2.y << 8;
- uint16_t cb = ((yuv1.u << 8) + (yuv2.u << 8)) / 2;
- uint16_t cr = ((yuv1.v << 8) + (yuv2.v << 8)) / 2;
+ uint16_t cb = ((yuv1.u << 8) + (yuv2.u << 8)) / 2;
+ uint16_t cr = ((yuv1.v << 8) + (yuv2.v << 8)) / 2;
write16le(&p[0], y0);
write16le(&p[1], cb);