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

Side by Side Diff: Source/platform/graphics/cpu/arm/WebGLImageConversionNEON.h

Issue 1181283005: Remove unnecessary image packing code. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/platform/graphics/gpu/WebGLImageConversion.cpp » ('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 (C) 2012 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sz eged 2 * Copyright (C) 2012 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sz eged
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 RGBA5551.val[1] = vorr_u8(componentR, componentG3bit); 227 RGBA5551.val[1] = vorr_u8(componentR, componentG3bit);
228 vst2_u8(dst, RGBA5551); 228 vst2_u8(dst, RGBA5551);
229 dst += 16; 229 dst += 16;
230 } 230 }
231 231
232 source += componentsSize; 232 source += componentsSize;
233 destination += componentsSize / 4; 233 destination += componentsSize / 4;
234 pixelsPerRow = tailComponents / 4; 234 pixelsPerRow = tailComponents / 4;
235 } 235 }
236 236
237 ALWAYS_INLINE void unpackOneRowOfRGB565ToRGBA8(const uint16_t*& source, uint8_t* & destination, unsigned& pixelsPerRow)
238 {
239 unsigned tailPixels = pixelsPerRow % 8;
240 unsigned pixelSize = pixelsPerRow - tailPixels;
241
242 uint16x8_t immediate0x3f = vdupq_n_u16(0x3F);
243 uint16x8_t immediate0x1f = vdupq_n_u16(0x1F);
244 uint8x8_t immediate0x3 = vdup_n_u8(0x3);
245 uint8x8_t immediate0x7 = vdup_n_u8(0x7);
246
247 uint8x8_t componentA = vdup_n_u8(0xFF);
248
249 for (unsigned i = 0; i < pixelSize; i += 8) {
250 uint16x8_t eightPixels = vld1q_u16(source + i);
251
252 uint8x8_t componentR = vqmovn_u16(vshrq_n_u16(eightPixels, 11));
253 uint8x8_t componentG = vqmovn_u16(vandq_u16(vshrq_n_u16(eightPixels, 5), immediate0x3f));
254 uint8x8_t componentB = vqmovn_u16(vandq_u16(eightPixels, immediate0x1f)) ;
255
256 componentR = vorr_u8(vshl_n_u8(componentR, 3), vand_u8(componentR, immed iate0x7));
257 componentG = vorr_u8(vshl_n_u8(componentG, 2), vand_u8(componentG, immed iate0x3));
258 componentB = vorr_u8(vshl_n_u8(componentB, 3), vand_u8(componentB, immed iate0x7));
259
260 uint8x8x4_t destComponents = {{componentR, componentG, componentB, compo nentA}};
261 vst4_u8(destination, destComponents);
262 destination += 32;
263 }
264
265 source += pixelSize;
266 pixelsPerRow = tailPixels;
267 }
268
269 ALWAYS_INLINE void packOneRowOfRGBA8ToUnsignedShort565(const uint8_t*& source, u int16_t*& destination, unsigned& pixelsPerRow) 237 ALWAYS_INLINE void packOneRowOfRGBA8ToUnsignedShort565(const uint8_t*& source, u int16_t*& destination, unsigned& pixelsPerRow)
270 { 238 {
271 unsigned componentsPerRow = pixelsPerRow * 4; 239 unsigned componentsPerRow = pixelsPerRow * 4;
272 unsigned tailComponents = componentsPerRow % 32; 240 unsigned tailComponents = componentsPerRow % 32;
273 unsigned componentsSize = componentsPerRow - tailComponents; 241 unsigned componentsSize = componentsPerRow - tailComponents;
274 uint8_t* dst = reinterpret_cast<uint8_t*>(destination); 242 uint8_t* dst = reinterpret_cast<uint8_t*>(destination);
275 243
276 uint8x8_t immediate0xf8 = vdup_n_u8(0xF8); 244 uint8x8_t immediate0xf8 = vdup_n_u8(0xF8);
277 uint8x8_t immediate0x1c = vdup_n_u8(0x1C); 245 uint8x8_t immediate0x1c = vdup_n_u8(0x1C);
278 for (unsigned i = 0; i < componentsSize; i += 32) { 246 for (unsigned i = 0; i < componentsSize; i += 32) {
(...skipping 16 matching lines...) Expand all
295 pixelsPerRow = tailComponents / 4; 263 pixelsPerRow = tailComponents / 4;
296 } 264 }
297 265
298 } // namespace SIMD 266 } // namespace SIMD
299 267
300 } // namespace blink 268 } // namespace blink
301 269
302 #endif // HAVE(ARM_NEON_INTRINSICS) 270 #endif // HAVE(ARM_NEON_INTRINSICS)
303 271
304 #endif // WebGLImageConversionNEON_h 272 #endif // WebGLImageConversionNEON_h
OLDNEW
« no previous file with comments | « no previous file | Source/platform/graphics/gpu/WebGLImageConversion.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698