| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. | 2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 195 |
| 196 void ARGBToRGB565Row_C(const uint8* src_argb, uint8* dst_rgb, int width) { | 196 void ARGBToRGB565Row_C(const uint8* src_argb, uint8* dst_rgb, int width) { |
| 197 int x; | 197 int x; |
| 198 for (x = 0; x < width - 1; x += 2) { | 198 for (x = 0; x < width - 1; x += 2) { |
| 199 uint8 b0 = src_argb[0] >> 3; | 199 uint8 b0 = src_argb[0] >> 3; |
| 200 uint8 g0 = src_argb[1] >> 2; | 200 uint8 g0 = src_argb[1] >> 2; |
| 201 uint8 r0 = src_argb[2] >> 3; | 201 uint8 r0 = src_argb[2] >> 3; |
| 202 uint8 b1 = src_argb[4] >> 3; | 202 uint8 b1 = src_argb[4] >> 3; |
| 203 uint8 g1 = src_argb[5] >> 2; | 203 uint8 g1 = src_argb[5] >> 2; |
| 204 uint8 r1 = src_argb[6] >> 3; | 204 uint8 r1 = src_argb[6] >> 3; |
| 205 WRITEWORD(dst_rgb, b0 | (g0 << 5) | (r0 << 11) | (b1 << 16) | (g1 << 21) | | 205 WRITEWORD( |
| 206 (r1 << 27)); | 206 dst_rgb, |
| 207 b0 | (g0 << 5) | (r0 << 11) | (b1 << 16) | (g1 << 21) | (r1 << 27)); |
| 207 dst_rgb += 4; | 208 dst_rgb += 4; |
| 208 src_argb += 8; | 209 src_argb += 8; |
| 209 } | 210 } |
| 210 if (width & 1) { | 211 if (width & 1) { |
| 211 uint8 b0 = src_argb[0] >> 3; | 212 uint8 b0 = src_argb[0] >> 3; |
| 212 uint8 g0 = src_argb[1] >> 2; | 213 uint8 g0 = src_argb[1] >> 2; |
| 213 uint8 r0 = src_argb[2] >> 3; | 214 uint8 r0 = src_argb[2] >> 3; |
| 214 *(uint16*)(dst_rgb) = b0 | (g0 << 5) | (r0 << 11); | 215 *(uint16*)(dst_rgb) = b0 | (g0 << 5) | (r0 << 11); |
| 215 } | 216 } |
| 216 } | 217 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 230 int x; | 231 int x; |
| 231 for (x = 0; x < width - 1; x += 2) { | 232 for (x = 0; x < width - 1; x += 2) { |
| 232 int dither0 = ((const unsigned char*)(&dither4))[x & 3]; | 233 int dither0 = ((const unsigned char*)(&dither4))[x & 3]; |
| 233 int dither1 = ((const unsigned char*)(&dither4))[(x + 1) & 3]; | 234 int dither1 = ((const unsigned char*)(&dither4))[(x + 1) & 3]; |
| 234 uint8 b0 = clamp255(src_argb[0] + dither0) >> 3; | 235 uint8 b0 = clamp255(src_argb[0] + dither0) >> 3; |
| 235 uint8 g0 = clamp255(src_argb[1] + dither0) >> 2; | 236 uint8 g0 = clamp255(src_argb[1] + dither0) >> 2; |
| 236 uint8 r0 = clamp255(src_argb[2] + dither0) >> 3; | 237 uint8 r0 = clamp255(src_argb[2] + dither0) >> 3; |
| 237 uint8 b1 = clamp255(src_argb[4] + dither1) >> 3; | 238 uint8 b1 = clamp255(src_argb[4] + dither1) >> 3; |
| 238 uint8 g1 = clamp255(src_argb[5] + dither1) >> 2; | 239 uint8 g1 = clamp255(src_argb[5] + dither1) >> 2; |
| 239 uint8 r1 = clamp255(src_argb[6] + dither1) >> 3; | 240 uint8 r1 = clamp255(src_argb[6] + dither1) >> 3; |
| 240 WRITEWORD(dst_rgb, b0 | (g0 << 5) | (r0 << 11) | (b1 << 16) | (g1 << 21) | | 241 WRITEWORD( |
| 241 (r1 << 27)); | 242 dst_rgb, |
| 243 b0 | (g0 << 5) | (r0 << 11) | (b1 << 16) | (g1 << 21) | (r1 << 27)); |
| 242 dst_rgb += 4; | 244 dst_rgb += 4; |
| 243 src_argb += 8; | 245 src_argb += 8; |
| 244 } | 246 } |
| 245 if (width & 1) { | 247 if (width & 1) { |
| 246 int dither0 = ((const unsigned char*)(&dither4))[(width - 1) & 3]; | 248 int dither0 = ((const unsigned char*)(&dither4))[(width - 1) & 3]; |
| 247 uint8 b0 = clamp255(src_argb[0] + dither0) >> 3; | 249 uint8 b0 = clamp255(src_argb[0] + dither0) >> 3; |
| 248 uint8 g0 = clamp255(src_argb[1] + dither0) >> 2; | 250 uint8 g0 = clamp255(src_argb[1] + dither0) >> 2; |
| 249 uint8 r0 = clamp255(src_argb[2] + dither0) >> 3; | 251 uint8 r0 = clamp255(src_argb[2] + dither0) >> 3; |
| 250 *(uint16*)(dst_rgb) = b0 | (g0 << 5) | (r0 << 11); | 252 *(uint16*)(dst_rgb) = b0 | (g0 << 5) | (r0 << 11); |
| 251 } | 253 } |
| (...skipping 2382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2634 dst_rgb565 += twidth * 2; | 2636 dst_rgb565 += twidth * 2; |
| 2635 width -= twidth; | 2637 width -= twidth; |
| 2636 } | 2638 } |
| 2637 } | 2639 } |
| 2638 #endif | 2640 #endif |
| 2639 | 2641 |
| 2640 #ifdef __cplusplus | 2642 #ifdef __cplusplus |
| 2641 } // extern "C" | 2643 } // extern "C" |
| 2642 } // namespace libyuv | 2644 } // namespace libyuv |
| 2643 #endif | 2645 #endif |
| OLD | NEW |