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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp

Issue 2289693002: Add MIPS SIMD Arch (MSA) optimized WebGL image conversion function (Closed)
Patch Set: Fixed merge conflicts Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "platform/graphics/gpu/WebGLImageConversion.h" 5 #include "platform/graphics/gpu/WebGLImageConversion.h"
6 6
7 #include "platform/CheckedInt.h" 7 #include "platform/CheckedInt.h"
8 #include "platform/graphics/ImageObserver.h" 8 #include "platform/graphics/ImageObserver.h"
9 #include "platform/graphics/cpu/arm/WebGLImageConversionNEON.h" 9 #include "platform/graphics/cpu/arm/WebGLImageConversionNEON.h"
10 #include "platform/graphics/cpu/mips/WebGLImageConversionMSA.h"
10 #include "platform/graphics/cpu/x86/WebGLImageConversionSSE.h" 11 #include "platform/graphics/cpu/x86/WebGLImageConversionSSE.h"
11 #include "platform/graphics/skia/SkiaUtils.h" 12 #include "platform/graphics/skia/SkiaUtils.h"
12 #include "platform/image-decoders/ImageDecoder.h" 13 #include "platform/image-decoders/ImageDecoder.h"
13 #include "third_party/skia/include/core/SkImage.h" 14 #include "third_party/skia/include/core/SkImage.h"
14 #include "wtf/PtrUtil.h" 15 #include "wtf/PtrUtil.h"
15 #include <memory> 16 #include <memory>
16 17
17 namespace blink { 18 namespace blink {
18 19
19 namespace { 20 namespace {
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 } 442 }
442 443
443 template<> void unpack<WebGLImageConversion::DataFormatRGBA5551, uint16_t, uint8 _t>(const uint16_t* source, uint8_t* destination, unsigned pixelsPerRow) 444 template<> void unpack<WebGLImageConversion::DataFormatRGBA5551, uint16_t, uint8 _t>(const uint16_t* source, uint8_t* destination, unsigned pixelsPerRow)
444 { 445 {
445 #if CPU(X86) || CPU(X86_64) 446 #if CPU(X86) || CPU(X86_64)
446 SIMD::unpackOneRowOfRGBA5551LittleToRGBA8(source, destination, pixelsPerRow) ; 447 SIMD::unpackOneRowOfRGBA5551LittleToRGBA8(source, destination, pixelsPerRow) ;
447 #endif 448 #endif
448 #if HAVE(ARM_NEON_INTRINSICS) 449 #if HAVE(ARM_NEON_INTRINSICS)
449 SIMD::unpackOneRowOfRGBA5551ToRGBA8(source, destination, pixelsPerRow); 450 SIMD::unpackOneRowOfRGBA5551ToRGBA8(source, destination, pixelsPerRow);
450 #endif 451 #endif
452 #if HAVE(MIPS_MSA_INTRINSICS)
453 SIMD::unpackOneRowOfRGBA5551ToRGBA8MSA(source, destination, pixelsPerRow);
454 #endif
455
451 for (unsigned i = 0; i < pixelsPerRow; ++i) { 456 for (unsigned i = 0; i < pixelsPerRow; ++i) {
452 uint16_t packedValue = source[0]; 457 uint16_t packedValue = source[0];
453 uint8_t r = packedValue >> 11; 458 uint8_t r = packedValue >> 11;
454 uint8_t g = (packedValue >> 6) & 0x1F; 459 uint8_t g = (packedValue >> 6) & 0x1F;
455 uint8_t b = (packedValue >> 1) & 0x1F; 460 uint8_t b = (packedValue >> 1) & 0x1F;
456 destination[0] = (r << 3) | (r & 0x7); 461 destination[0] = (r << 3) | (r & 0x7);
457 destination[1] = (g << 3) | (g & 0x7); 462 destination[1] = (g << 3) | (g & 0x7);
458 destination[2] = (b << 3) | (b & 0x7); 463 destination[2] = (b << 3) | (b & 0x7);
459 destination[3] = (packedValue & 0x1) ? 0xFF : 0x0; 464 destination[3] = (packedValue & 0x1) ? 0xFF : 0x0;
460 source += 1; 465 source += 1;
(...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after
2402 } 2407 }
2403 2408
2404 FormatConverter converter(width, height, sourceData, destinationData, srcStr ide, dstStride); 2409 FormatConverter converter(width, height, sourceData, destinationData, srcStr ide, dstStride);
2405 converter.convert(sourceDataFormat, dstDataFormat, alphaOp); 2410 converter.convert(sourceDataFormat, dstDataFormat, alphaOp);
2406 if (!converter.Success()) 2411 if (!converter.Success())
2407 return false; 2412 return false;
2408 return true; 2413 return true;
2409 } 2414 }
2410 2415
2411 } // namespace blink 2416 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/cpu/mips/WebGLImageConversionMSA.h ('k') | third_party/WebKit/Source/wtf/CPU.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698