mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-07 01:06:46 +08:00
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
This commit is contained in:
parent
6eaee58589
commit
693e0217c8
@ -1,6 +1,6 @@
|
|||||||
Name: libyuv
|
Name: libyuv
|
||||||
URL: http://code.google.com/p/libyuv/
|
URL: http://code.google.com/p/libyuv/
|
||||||
Version: 1305
|
Version: 1306
|
||||||
License: BSD
|
License: BSD
|
||||||
License File: LICENSE
|
License File: LICENSE
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,6 @@
|
|||||||
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
||||||
#define INCLUDE_LIBYUV_VERSION_H_
|
#define INCLUDE_LIBYUV_VERSION_H_
|
||||||
|
|
||||||
#define LIBYUV_VERSION 1305
|
#define LIBYUV_VERSION 1306
|
||||||
|
|
||||||
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
#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) {
|
const uint8* dither8x8, int width) {
|
||||||
int x;
|
int x;
|
||||||
for (x = 0; x < width - 1; x += 2) {
|
for (x = 0; x < width - 1; x += 2) {
|
||||||
int dither0 = dither8x8[x & 7] - 128;
|
int dither0 = dither8x8[x & 7];
|
||||||
int dither1 = dither8x8[(x & 7) + 1] - 128;
|
int dither1 = dither8x8[(x + 1) & 7];
|
||||||
uint8 b0 = Clamp(src_argb[0] + dither0) >> 3;
|
uint8 b0 = clamp255(src_argb[0] + dither0) >> 3;
|
||||||
uint8 g0 = Clamp(src_argb[1] + dither0) >> 2;
|
uint8 g0 = clamp255(src_argb[1] + dither0) >> 2;
|
||||||
uint8 r0 = Clamp(src_argb[2] + dither0) >> 3;
|
uint8 r0 = clamp255(src_argb[2] + dither0) >> 3;
|
||||||
uint8 b1 = Clamp(src_argb[4] + dither1) >> 3;
|
uint8 b1 = clamp255(src_argb[4] + dither1) >> 3;
|
||||||
uint8 g1 = Clamp(src_argb[5] + dither1) >> 2;
|
uint8 g1 = clamp255(src_argb[5] + dither1) >> 2;
|
||||||
uint8 r1 = Clamp(src_argb[6] + dither1) >> 3;
|
uint8 r1 = clamp255(src_argb[6] + dither1) >> 3;
|
||||||
WRITEWORD(dst_rgb, b0 | (g0 << 5) | (r0 << 11) |
|
WRITEWORD(dst_rgb, b0 | (g0 << 5) | (r0 << 11) |
|
||||||
(b1 << 16) | (g1 << 21) | (r1 << 27));
|
(b1 << 16) | (g1 << 21) | (r1 << 27));
|
||||||
dst_rgb += 4;
|
dst_rgb += 4;
|
||||||
src_argb += 8;
|
src_argb += 8;
|
||||||
}
|
}
|
||||||
if (width & 1) {
|
if (width & 1) {
|
||||||
int dither0 = dither8x8[(width - 1) & 7] - 128;
|
int dither0 = dither8x8[(width - 1) & 7];
|
||||||
uint8 b0 = Clamp(src_argb[0] + dither0) >> 3;
|
uint8 b0 = clamp255(src_argb[0] + dither0) >> 3;
|
||||||
uint8 g0 = Clamp(src_argb[1] + dither0) >> 2;
|
uint8 g0 = clamp255(src_argb[1] + dither0) >> 2;
|
||||||
uint8 r0 = Clamp(src_argb[2] + dither0) >> 3;
|
uint8 r0 = clamp255(src_argb[2] + dither0) >> 3;
|
||||||
*(uint16*)(dst_rgb) = b0 | (g0 << 5) | (r0 << 11);
|
*(uint16*)(dst_rgb) = b0 | (g0 << 5) | (r0 << 11);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user