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

Side by Side Diff: source/planar_functions.cc

Issue 2393393006: YUY2ToI422 coalesce rows for small images (Closed)
Patch Set: fix for YUY2ToY any Created 4 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 | « no previous file | source/row_any.cc » ('j') | 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 // Negative height means invert the image. 440 // Negative height means invert the image.
441 if (height < 0) { 441 if (height < 0) {
442 height = -height; 442 height = -height;
443 src_yuy2 = src_yuy2 + (height - 1) * src_stride_yuy2; 443 src_yuy2 = src_yuy2 + (height - 1) * src_stride_yuy2;
444 src_stride_yuy2 = -src_stride_yuy2; 444 src_stride_yuy2 = -src_stride_yuy2;
445 } 445 }
446 // Coalesce rows. 446 // Coalesce rows.
447 if (src_stride_yuy2 == width * 2 && 447 if (src_stride_yuy2 == width * 2 &&
448 dst_stride_y == width && 448 dst_stride_y == width &&
449 dst_stride_u * 2 == width && 449 dst_stride_u * 2 == width &&
450 dst_stride_v * 2 == width) { 450 dst_stride_v * 2 == width &&
451 width * height <= 32768) {
451 width *= height; 452 width *= height;
452 height = 1; 453 height = 1;
453 src_stride_yuy2 = dst_stride_y = dst_stride_u = dst_stride_v = 0; 454 src_stride_yuy2 = dst_stride_y = dst_stride_u = dst_stride_v = 0;
454 } 455 }
455 #if defined(HAS_YUY2TOYROW_SSE2) 456 #if defined(HAS_YUY2TOYROW_SSE2)
456 if (TestCpuFlag(kCpuHasSSE2)) { 457 if (TestCpuFlag(kCpuHasSSE2)) {
457 YUY2ToUV422Row = YUY2ToUV422Row_Any_SSE2; 458 YUY2ToUV422Row = YUY2ToUV422Row_Any_SSE2;
458 YUY2ToYRow = YUY2ToYRow_Any_SSE2; 459 YUY2ToYRow = YUY2ToYRow_Any_SSE2;
459 if (IS_ALIGNED(width, 16)) { 460 if (IS_ALIGNED(width, 16)) {
460 YUY2ToUV422Row = YUY2ToUV422Row_SSE2; 461 YUY2ToUV422Row = YUY2ToUV422Row_SSE2;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 // Negative height means invert the image. 525 // Negative height means invert the image.
525 if (height < 0) { 526 if (height < 0) {
526 height = -height; 527 height = -height;
527 src_uyvy = src_uyvy + (height - 1) * src_stride_uyvy; 528 src_uyvy = src_uyvy + (height - 1) * src_stride_uyvy;
528 src_stride_uyvy = -src_stride_uyvy; 529 src_stride_uyvy = -src_stride_uyvy;
529 } 530 }
530 // Coalesce rows. 531 // Coalesce rows.
531 if (src_stride_uyvy == width * 2 && 532 if (src_stride_uyvy == width * 2 &&
532 dst_stride_y == width && 533 dst_stride_y == width &&
533 dst_stride_u * 2 == width && 534 dst_stride_u * 2 == width &&
534 dst_stride_v * 2 == width) { 535 dst_stride_v * 2 == width &&
536 width * height <= 32768) {
535 width *= height; 537 width *= height;
536 height = 1; 538 height = 1;
537 src_stride_uyvy = dst_stride_y = dst_stride_u = dst_stride_v = 0; 539 src_stride_uyvy = dst_stride_y = dst_stride_u = dst_stride_v = 0;
538 } 540 }
539 #if defined(HAS_UYVYTOYROW_SSE2) 541 #if defined(HAS_UYVYTOYROW_SSE2)
540 if (TestCpuFlag(kCpuHasSSE2)) { 542 if (TestCpuFlag(kCpuHasSSE2)) {
541 UYVYToUV422Row = UYVYToUV422Row_Any_SSE2; 543 UYVYToUV422Row = UYVYToUV422Row_Any_SSE2;
542 UYVYToYRow = UYVYToYRow_Any_SSE2; 544 UYVYToYRow = UYVYToYRow_Any_SSE2;
543 if (IS_ALIGNED(width, 16)) { 545 if (IS_ALIGNED(width, 16)) {
544 UYVYToUV422Row = UYVYToUV422Row_SSE2; 546 UYVYToUV422Row = UYVYToUV422Row_SSE2;
(...skipping 2416 matching lines...) Expand 10 before | Expand all | Expand 10 after
2961 } 2963 }
2962 free_aligned_buffer_64(rows); 2964 free_aligned_buffer_64(rows);
2963 } 2965 }
2964 return 0; 2966 return 0;
2965 } 2967 }
2966 2968
2967 #ifdef __cplusplus 2969 #ifdef __cplusplus
2968 } // extern "C" 2970 } // extern "C"
2969 } // namespace libyuv 2971 } // namespace libyuv
2970 #endif 2972 #endif
OLDNEW
« no previous file with comments | « no previous file | source/row_any.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698