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

Side by Side Diff: media/base/yuv_convert.cc

Issue 10952006: [MIPS] Add support in media.gyp for building on MIPS architecture. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Minor update. Created 8 years, 3 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 | media/media.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This webpage shows layout of YV12 and other YUV formats 5 // This webpage shows layout of YV12 and other YUV formats
6 // http://www.fourcc.org/yuv.php 6 // http://www.fourcc.org/yuv.php
7 // The actual conversion is best described here 7 // The actual conversion is best described here
8 // http://en.wikipedia.org/wiki/YUV 8 // http://en.wikipedia.org/wiki/YUV
9 // An article on optimizing YUV conversion using tables instead of multiplies 9 // An article on optimizing YUV conversion using tables instead of multiplies
10 // http://lestourtereaux.free.fr/papers/data/yuvrgb.pdf 10 // http://lestourtereaux.free.fr/papers/data/yuvrgb.pdf
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 uint8* uplane, 436 uint8* uplane,
437 uint8* vplane, 437 uint8* vplane,
438 int width, 438 int width,
439 int height, 439 int height,
440 int rgbstride, 440 int rgbstride,
441 int ystride, 441 int ystride,
442 int uvstride) { 442 int uvstride) {
443 static void (*convert_proc)(const uint8*, uint8*, uint8*, uint8*, 443 static void (*convert_proc)(const uint8*, uint8*, uint8*, uint8*,
444 int, int, int, int, int) = NULL; 444 int, int, int, int, int) = NULL;
445 if (!convert_proc) { 445 if (!convert_proc) {
446 #if defined(ARCH_CPU_ARM_FAMILY) 446 #if defined(ARCH_CPU_ARM_FAMILY) || defined(ARCH_CPU_MIPS_FAMILY)
447 // For ARM processors, always use C version. 447 // For ARM and MIPS processors, always use C version.
448 // TODO(hclam): Implement a NEON version. 448 // TODO(hclam): Implement a NEON version.
449 convert_proc = &ConvertRGB32ToYUV_C; 449 convert_proc = &ConvertRGB32ToYUV_C;
450 #else 450 #else
451 // TODO(hclam): Switch to SSSE3 version when the cyan problem is solved. 451 // TODO(hclam): Switch to SSSE3 version when the cyan problem is solved.
452 // See: crbug.com/100462 452 // See: crbug.com/100462
453 base::CPU cpu; 453 base::CPU cpu;
454 if (cpu.has_sse2()) 454 if (cpu.has_sse2())
455 convert_proc = &ConvertRGB32ToYUV_SSE2; 455 convert_proc = &ConvertRGB32ToYUV_SSE2;
456 else 456 else
457 convert_proc = &ConvertRGB32ToYUV_C; 457 convert_proc = &ConvertRGB32ToYUV_C;
458 #endif 458 #endif
459 } 459 }
460 460
461 convert_proc(rgbframe, yplane, uplane, vplane, width, height, 461 convert_proc(rgbframe, yplane, uplane, vplane, width, height,
462 rgbstride, ystride, uvstride); 462 rgbstride, ystride, uvstride);
463 } 463 }
464 464
465 void ConvertRGB24ToYUV(const uint8* rgbframe, 465 void ConvertRGB24ToYUV(const uint8* rgbframe,
466 uint8* yplane, 466 uint8* yplane,
467 uint8* uplane, 467 uint8* uplane,
468 uint8* vplane, 468 uint8* vplane,
469 int width, 469 int width,
470 int height, 470 int height,
471 int rgbstride, 471 int rgbstride,
472 int ystride, 472 int ystride,
473 int uvstride) { 473 int uvstride) {
474 #if defined(ARCH_CPU_ARM_FAMILY) 474 #if defined(ARCH_CPU_ARM_FAMILY) || defined(ARCH_CPU_MIPS_FAMILY)
475 ConvertRGB24ToYUV_C(rgbframe, yplane, uplane, vplane, width, height, 475 ConvertRGB24ToYUV_C(rgbframe, yplane, uplane, vplane, width, height,
476 rgbstride, ystride, uvstride); 476 rgbstride, ystride, uvstride);
477 #else 477 #else
478 static void (*convert_proc)(const uint8*, uint8*, uint8*, uint8*, 478 static void (*convert_proc)(const uint8*, uint8*, uint8*, uint8*,
479 int, int, int, int, int) = NULL; 479 int, int, int, int, int) = NULL;
480 if (!convert_proc) { 480 if (!convert_proc) {
481 base::CPU cpu; 481 base::CPU cpu;
482 if (cpu.has_ssse3()) 482 if (cpu.has_ssse3())
483 convert_proc = &ConvertRGB24ToYUV_SSSE3; 483 convert_proc = &ConvertRGB24ToYUV_SSSE3;
484 else 484 else
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 void ConvertYUVToRGB32(const uint8* yplane, 535 void ConvertYUVToRGB32(const uint8* yplane,
536 const uint8* uplane, 536 const uint8* uplane,
537 const uint8* vplane, 537 const uint8* vplane,
538 uint8* rgbframe, 538 uint8* rgbframe,
539 int width, 539 int width,
540 int height, 540 int height,
541 int ystride, 541 int ystride,
542 int uvstride, 542 int uvstride,
543 int rgbstride, 543 int rgbstride,
544 YUVType yuv_type) { 544 YUVType yuv_type) {
545 #if defined(ARCH_CPU_ARM_FAMILY) 545 #if defined(ARCH_CPU_ARM_FAMILY) || defined(ARCH_CPU_MIPS_FAMILY)
546 ConvertYUVToRGB32_C(yplane, uplane, vplane, rgbframe, 546 ConvertYUVToRGB32_C(yplane, uplane, vplane, rgbframe,
547 width, height, ystride, uvstride, rgbstride, yuv_type); 547 width, height, ystride, uvstride, rgbstride, yuv_type);
548 #else 548 #else
549 static ConvertYUVToRGB32Proc convert_proc = NULL; 549 static ConvertYUVToRGB32Proc convert_proc = NULL;
550 if (!convert_proc) { 550 if (!convert_proc) {
551 base::CPU cpu; 551 base::CPU cpu;
552 if (cpu.has_sse()) 552 if (cpu.has_sse())
553 convert_proc = &ConvertYUVToRGB32_SSE; 553 convert_proc = &ConvertYUVToRGB32_SSE;
554 else if (cpu.has_mmx()) 554 else if (cpu.has_mmx())
555 convert_proc = &ConvertYUVToRGB32_MMX; 555 convert_proc = &ConvertYUVToRGB32_MMX;
556 else 556 else
557 convert_proc = &ConvertYUVToRGB32_C; 557 convert_proc = &ConvertYUVToRGB32_C;
558 } 558 }
559 559
560 convert_proc(yplane, uplane, vplane, rgbframe, 560 convert_proc(yplane, uplane, vplane, rgbframe,
561 width, height, ystride, uvstride, rgbstride, yuv_type); 561 width, height, ystride, uvstride, rgbstride, yuv_type);
562 #endif 562 #endif
563 } 563 }
564 564
565 } // namespace media 565 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698