Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(758)

Side by Side Diff: source/row_common.cc

Issue 1411733004: Fix ARGBToI411 odd width bug. (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/row_any.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 for (x = 0; x < width - 3; x += 4) { 672 for (x = 0; x < width - 3; x += 4) {
673 uint8 ab = (src_argb[0] + src_argb[4] + src_argb[8] + src_argb[12]) >> 2; 673 uint8 ab = (src_argb[0] + src_argb[4] + src_argb[8] + src_argb[12]) >> 2;
674 uint8 ag = (src_argb[1] + src_argb[5] + src_argb[9] + src_argb[13]) >> 2; 674 uint8 ag = (src_argb[1] + src_argb[5] + src_argb[9] + src_argb[13]) >> 2;
675 uint8 ar = (src_argb[2] + src_argb[6] + src_argb[10] + src_argb[14]) >> 2; 675 uint8 ar = (src_argb[2] + src_argb[6] + src_argb[10] + src_argb[14]) >> 2;
676 dst_u[0] = RGBToU(ar, ag, ab); 676 dst_u[0] = RGBToU(ar, ag, ab);
677 dst_v[0] = RGBToV(ar, ag, ab); 677 dst_v[0] = RGBToV(ar, ag, ab);
678 src_argb += 16; 678 src_argb += 16;
679 dst_u += 1; 679 dst_u += 1;
680 dst_v += 1; 680 dst_v += 1;
681 } 681 }
682 // Odd width handling mimics 'any' function which replicates last pixel.
682 if ((width & 3) == 3) { 683 if ((width & 3) == 3) {
683 uint8 ab = (src_argb[0] + src_argb[4] + src_argb[8]) / 3; 684 uint8 ab = (src_argb[0] + src_argb[4] + src_argb[8] + src_argb[8]) >> 2;
684 uint8 ag = (src_argb[1] + src_argb[5] + src_argb[9]) / 3; 685 uint8 ag = (src_argb[1] + src_argb[5] + src_argb[9] + src_argb[9]) >> 2;
685 uint8 ar = (src_argb[2] + src_argb[6] + src_argb[10]) / 3; 686 uint8 ar = (src_argb[2] + src_argb[6] + src_argb[10] + src_argb[10]) >> 2;
686 dst_u[0] = RGBToU(ar, ag, ab); 687 dst_u[0] = RGBToU(ar, ag, ab);
687 dst_v[0] = RGBToV(ar, ag, ab); 688 dst_v[0] = RGBToV(ar, ag, ab);
688 } else if ((width & 3) == 2) { 689 } else if ((width & 3) == 2) {
689 uint8 ab = (src_argb[0] + src_argb[4]) >> 1; 690 uint8 ab = (src_argb[0] + src_argb[4]) >> 1;
690 uint8 ag = (src_argb[1] + src_argb[5]) >> 1; 691 uint8 ag = (src_argb[1] + src_argb[5]) >> 1;
691 uint8 ar = (src_argb[2] + src_argb[6]) >> 1; 692 uint8 ar = (src_argb[2] + src_argb[6]) >> 1;
692 dst_u[0] = RGBToU(ar, ag, ab); 693 dst_u[0] = RGBToU(ar, ag, ab);
693 dst_v[0] = RGBToV(ar, ag, ab); 694 dst_v[0] = RGBToV(ar, ag, ab);
694 } else if ((width & 3) == 1) { 695 } else if ((width & 3) == 1) {
695 uint8 ab = src_argb[0]; 696 uint8 ab = src_argb[0];
(...skipping 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after
2700 dst_rgb565 += twidth * 2; 2701 dst_rgb565 += twidth * 2;
2701 width -= twidth; 2702 width -= twidth;
2702 } 2703 }
2703 } 2704 }
2704 #endif 2705 #endif
2705 2706
2706 #ifdef __cplusplus 2707 #ifdef __cplusplus
2707 } // extern "C" 2708 } // extern "C"
2708 } // namespace libyuv 2709 } // namespace libyuv
2709 #endif 2710 #endif
OLDNEW
« no previous file with comments | « source/row_any.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698