| 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 uint8 ag = AVGB(src_rgb0[G], src_rgb1[G]); \ | 426 uint8 ag = AVGB(src_rgb0[G], src_rgb1[G]); \ |
| 427 uint8 ar = AVGB(src_rgb0[R], src_rgb1[R]); \ | 427 uint8 ar = AVGB(src_rgb0[R], src_rgb1[R]); \ |
| 428 dst_u[0] = RGBToUJ(ar, ag, ab); \ | 428 dst_u[0] = RGBToUJ(ar, ag, ab); \ |
| 429 dst_v[0] = RGBToVJ(ar, ag, ab); \ | 429 dst_v[0] = RGBToVJ(ar, ag, ab); \ |
| 430 } \ | 430 } \ |
| 431 } | 431 } |
| 432 | 432 |
| 433 MAKEROWYJ(ARGB, 2, 1, 0, 4) | 433 MAKEROWYJ(ARGB, 2, 1, 0, 4) |
| 434 #undef MAKEROWYJ | 434 #undef MAKEROWYJ |
| 435 | 435 |
| 436 void ARGBToUVJ422Row_C(const uint8* src_argb, | |
| 437 uint8* dst_u, uint8* dst_v, int width) { | |
| 438 int x; | |
| 439 for (x = 0; x < width - 1; x += 2) { | |
| 440 uint8 ab = (src_argb[0] + src_argb[4]) >> 1; | |
| 441 uint8 ag = (src_argb[1] + src_argb[5]) >> 1; | |
| 442 uint8 ar = (src_argb[2] + src_argb[6]) >> 1; | |
| 443 dst_u[0] = RGBToUJ(ar, ag, ab); | |
| 444 dst_v[0] = RGBToVJ(ar, ag, ab); | |
| 445 src_argb += 8; | |
| 446 dst_u += 1; | |
| 447 dst_v += 1; | |
| 448 } | |
| 449 if (width & 1) { | |
| 450 uint8 ab = src_argb[0]; | |
| 451 uint8 ag = src_argb[1]; | |
| 452 uint8 ar = src_argb[2]; | |
| 453 dst_u[0] = RGBToUJ(ar, ag, ab); | |
| 454 dst_v[0] = RGBToVJ(ar, ag, ab); | |
| 455 } | |
| 456 } | |
| 457 | |
| 458 void RGB565ToYRow_C(const uint8* src_rgb565, uint8* dst_y, int width) { | 436 void RGB565ToYRow_C(const uint8* src_rgb565, uint8* dst_y, int width) { |
| 459 int x; | 437 int x; |
| 460 for (x = 0; x < width; ++x) { | 438 for (x = 0; x < width; ++x) { |
| 461 uint8 b = src_rgb565[0] & 0x1f; | 439 uint8 b = src_rgb565[0] & 0x1f; |
| 462 uint8 g = (src_rgb565[0] >> 5) | ((src_rgb565[1] & 0x07) << 3); | 440 uint8 g = (src_rgb565[0] >> 5) | ((src_rgb565[1] & 0x07) << 3); |
| 463 uint8 r = src_rgb565[1] >> 3; | 441 uint8 r = src_rgb565[1] >> 3; |
| 464 b = (b << 3) | (b >> 2); | 442 b = (b << 3) | (b >> 2); |
| 465 g = (g << 2) | (g >> 4); | 443 g = (g << 2) | (g >> 4); |
| 466 r = (r << 3) | (r >> 2); | 444 r = (r << 3) | (r >> 2); |
| 467 dst_y[0] = RGBToY(r, g, b); | 445 dst_y[0] = RGBToY(r, g, b); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 uint8 ag = src_argb[1]; | 629 uint8 ag = src_argb[1]; |
| 652 uint8 ar = src_argb[2]; | 630 uint8 ar = src_argb[2]; |
| 653 dst_u[0] = RGBToU(ar, ag, ab); | 631 dst_u[0] = RGBToU(ar, ag, ab); |
| 654 dst_v[0] = RGBToV(ar, ag, ab); | 632 dst_v[0] = RGBToV(ar, ag, ab); |
| 655 src_argb += 4; | 633 src_argb += 4; |
| 656 dst_u += 1; | 634 dst_u += 1; |
| 657 dst_v += 1; | 635 dst_v += 1; |
| 658 } | 636 } |
| 659 } | 637 } |
| 660 | 638 |
| 661 void ARGBToUV422Row_C(const uint8* src_argb, | |
| 662 uint8* dst_u, uint8* dst_v, int width) { | |
| 663 int x; | |
| 664 for (x = 0; x < width - 1; x += 2) { | |
| 665 uint8 ab = (src_argb[0] + src_argb[4]) >> 1; | |
| 666 uint8 ag = (src_argb[1] + src_argb[5]) >> 1; | |
| 667 uint8 ar = (src_argb[2] + src_argb[6]) >> 1; | |
| 668 dst_u[0] = RGBToU(ar, ag, ab); | |
| 669 dst_v[0] = RGBToV(ar, ag, ab); | |
| 670 src_argb += 8; | |
| 671 dst_u += 1; | |
| 672 dst_v += 1; | |
| 673 } | |
| 674 if (width & 1) { | |
| 675 uint8 ab = src_argb[0]; | |
| 676 uint8 ag = src_argb[1]; | |
| 677 uint8 ar = src_argb[2]; | |
| 678 dst_u[0] = RGBToU(ar, ag, ab); | |
| 679 dst_v[0] = RGBToV(ar, ag, ab); | |
| 680 } | |
| 681 } | |
| 682 | |
| 683 void ARGBToUV411Row_C(const uint8* src_argb, | 639 void ARGBToUV411Row_C(const uint8* src_argb, |
| 684 uint8* dst_u, uint8* dst_v, int width) { | 640 uint8* dst_u, uint8* dst_v, int width) { |
| 685 int x; | 641 int x; |
| 686 for (x = 0; x < width - 3; x += 4) { | 642 for (x = 0; x < width - 3; x += 4) { |
| 687 uint8 ab = (src_argb[0] + src_argb[4] + src_argb[8] + src_argb[12]) >> 2; | 643 uint8 ab = (src_argb[0] + src_argb[4] + src_argb[8] + src_argb[12]) >> 2; |
| 688 uint8 ag = (src_argb[1] + src_argb[5] + src_argb[9] + src_argb[13]) >> 2; | 644 uint8 ag = (src_argb[1] + src_argb[5] + src_argb[9] + src_argb[13]) >> 2; |
| 689 uint8 ar = (src_argb[2] + src_argb[6] + src_argb[10] + src_argb[14]) >> 2; | 645 uint8 ar = (src_argb[2] + src_argb[6] + src_argb[10] + src_argb[14]) >> 2; |
| 690 dst_u[0] = RGBToU(ar, ag, ab); | 646 dst_u[0] = RGBToU(ar, ag, ab); |
| 691 dst_v[0] = RGBToV(ar, ag, ab); | 647 dst_v[0] = RGBToV(ar, ag, ab); |
| 692 src_argb += 16; | 648 src_argb += 16; |
| (...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2633 dst_rgb565 += twidth * 2; | 2589 dst_rgb565 += twidth * 2; |
| 2634 width -= twidth; | 2590 width -= twidth; |
| 2635 } | 2591 } |
| 2636 } | 2592 } |
| 2637 #endif | 2593 #endif |
| 2638 | 2594 |
| 2639 #ifdef __cplusplus | 2595 #ifdef __cplusplus |
| 2640 } // extern "C" | 2596 } // extern "C" |
| 2641 } // namespace libyuv | 2597 } // namespace libyuv |
| 2642 #endif | 2598 #endif |
| OLD | NEW |