Commit 693e0217 authored by fbarchard@google.com's avatar fbarchard@google.com

ARGBToRGB565 C version use unsigned dither matrix pattern to bump pixels to next brighter value.

BUG=407
TESTED=unittest passes
R=harryjin@google.com

Review URL: https://webrtc-codereview.appspot.com/43539004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1306 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 6eaee585
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 1305
Version: 1306
License: BSD
License File: LICENSE
......
......@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 1305
#define LIBYUV_VERSION 1306
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
......@@ -203,24 +203,24 @@ void ARGBToRGB565DitherRow_C(const uint8* src_argb, uint8* dst_rgb,
const uint8* dither8x8, int width) {
int x;
for (x = 0; x < width - 1; x += 2) {
int dither0 = dither8x8[x & 7] - 128;
int dither1 = dither8x8[(x & 7) + 1] - 128;
uint8 b0 = Clamp(src_argb[0] + dither0) >> 3;
uint8 g0 = Clamp(src_argb[1] + dither0) >> 2;
uint8 r0 = Clamp(src_argb[2] + dither0) >> 3;
uint8 b1 = Clamp(src_argb[4] + dither1) >> 3;
uint8 g1 = Clamp(src_argb[5] + dither1) >> 2;
uint8 r1 = Clamp(src_argb[6] + dither1) >> 3;
int dither0 = dither8x8[x & 7];
int dither1 = dither8x8[(x + 1) & 7];
uint8 b0 = clamp255(src_argb[0] + dither0) >> 3;
uint8 g0 = clamp255(src_argb[1] + dither0) >> 2;
uint8 r0 = clamp255(src_argb[2] + dither0) >> 3;
uint8 b1 = clamp255(src_argb[4] + dither1) >> 3;
uint8 g1 = clamp255(src_argb[5] + dither1) >> 2;
uint8 r1 = clamp255(src_argb[6] + dither1) >> 3;
WRITEWORD(dst_rgb, b0 | (g0 << 5) | (r0 << 11) |
(b1 << 16) | (g1 << 21) | (r1 << 27));
dst_rgb += 4;
src_argb += 8;
}
if (width & 1) {
int dither0 = dither8x8[(width - 1) & 7] - 128;
uint8 b0 = Clamp(src_argb[0] + dither0) >> 3;
uint8 g0 = Clamp(src_argb[1] + dither0) >> 2;
uint8 r0 = Clamp(src_argb[2] + dither0) >> 3;
int dither0 = dither8x8[(width - 1) & 7];
uint8 b0 = clamp255(src_argb[0] + dither0) >> 3;
uint8 g0 = clamp255(src_argb[1] + dither0) >> 2;
uint8 r0 = clamp255(src_argb[2] + dither0) >> 3;
*(uint16*)(dst_rgb) = b0 | (g0 << 5) | (r0 << 11);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment