diff options
| author | Mattias Andrée <maandree@kth.se> | 2017-04-09 17:33:31 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2017-04-09 17:57:27 +0200 |
| commit | deec79ce61b8661d3ad76f3ecc10a80d1ce19cdd (patch) | |
| tree | 34a8863335a8eee38ec28419812e99a3c27cef64 /src/blind-to-video.c | |
| parent | Add blind-skip-pattern (diff) | |
| download | blind-deec79ce61b8661d3ad76f3ecc10a80d1ce19cdd.tar.gz blind-deec79ce61b8661d3ad76f3ecc10a80d1ce19cdd.tar.bz2 blind-deec79ce61b8661d3ad76f3ecc10a80d1ce19cdd.tar.xz | |
Clean up
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/blind-to-video.c')
| -rw-r--r-- | src/blind-to-video.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/blind-to-video.c b/src/blind-to-video.c index 04cfd91..4da9306 100644 --- a/src/blind-to-video.c +++ b/src/blind-to-video.c @@ -34,9 +34,9 @@ process_xyza(char *buf, size_t n, int fd, const char *fname) u = (long int)g + 128L * 256L; v = (long int)b + 128L * 256L; *pixels++ = 0xFFFFU; - *pixels++ = htole16((uint16_t)(y < 0 ? 0 : y > 0xFFFFL ? 0xFFFFL : y)); - *pixels++ = htole16((uint16_t)(u < 0 ? 0 : u > 0xFFFFL ? 0xFFFFL : u)); - *pixels++ = htole16((uint16_t)(v < 0 ? 0 : v > 0xFFFFL ? 0xFFFFL : v)); + *pixels++ = htole16((uint16_t)CLIP(0, y, 0xFFFFL)); + *pixels++ = htole16((uint16_t)CLIP(0, u, 0xFFFFL)); + *pixels++ = htole16((uint16_t)CLIP(0, v, 0xFFFFL)); if (pixels == end) ewriteall(fd, pixels = pixbuf, sizeof(pixbuf), fname); } @@ -52,10 +52,10 @@ process_xyza(char *buf, size_t n, int fd, const char *fname) y = (long int)(pixel[0] * 0xFFFFL) + 16L * 256L; u = (long int)(pixel[1] * 0xFFFFL) + 128L * 256L; v = (long int)(pixel[2] * 0xFFFFL) + 128L * 256L; - *pixels++ = htole16((uint16_t)(a < 0 ? 0 : a > 0xFFFFL ? 0xFFFFL : a)); - *pixels++ = htole16((uint16_t)(y < 0 ? 0 : y > 0xFFFFL ? 0xFFFFL : y)); - *pixels++ = htole16((uint16_t)(u < 0 ? 0 : u > 0xFFFFL ? 0xFFFFL : u)); - *pixels++ = htole16((uint16_t)(v < 0 ? 0 : v > 0xFFFFL ? 0xFFFFL : v)); + *pixels++ = htole16((uint16_t)CLIP(0, a, 0xFFFFL)); + *pixels++ = htole16((uint16_t)CLIP(0, y, 0xFFFFL)); + *pixels++ = htole16((uint16_t)CLIP(0, u, 0xFFFFL)); + *pixels++ = htole16((uint16_t)CLIP(0, v, 0xFFFFL)); if (pixels == end) ewriteall(fd, pixels = pixbuf, sizeof(pixbuf), fname); } |
