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

Side by Side Diff: third_party/libwebp/dsp/alpha_processing.c

Issue 653803003: libwebp: update to 0.4.2-rc2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | « third_party/libwebp/demux/demux.c ('k') | third_party/libwebp/dsp/alpha_processing_sse2.c » ('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 2013 Google Inc. All Rights Reserved. 1 // Copyright 2013 Google Inc. All Rights Reserved.
2 // 2 //
3 // Use of this source code is governed by a BSD-style license 3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the COPYING file in the root of the source 4 // that can be found in the COPYING file in the root of the source
5 // tree. An additional intellectual property rights grant can be found 5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS. All contributing project authors may 6 // in the file PATENTS. All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree. 7 // be found in the AUTHORS file in the root of the source tree.
8 // ----------------------------------------------------------------------------- 8 // -----------------------------------------------------------------------------
9 // 9 //
10 // Utilities for processing transparent channel. 10 // Utilities for processing transparent channel.
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 277
278 static void ApplyAlphaMultiply_16b(uint8_t* rgba4444, 278 static void ApplyAlphaMultiply_16b(uint8_t* rgba4444,
279 int w, int h, int stride) { 279 int w, int h, int stride) {
280 #ifdef WEBP_SWAP_16BIT_CSP 280 #ifdef WEBP_SWAP_16BIT_CSP
281 ApplyAlphaMultiply4444(rgba4444, w, h, stride, 1); 281 ApplyAlphaMultiply4444(rgba4444, w, h, stride, 1);
282 #else 282 #else
283 ApplyAlphaMultiply4444(rgba4444, w, h, stride, 0); 283 ApplyAlphaMultiply4444(rgba4444, w, h, stride, 0);
284 #endif 284 #endif
285 } 285 }
286 286
287 static int ExtractAlpha(const uint8_t* argb, int argb_stride,
288 int width, int height,
289 uint8_t* alpha, int alpha_stride) {
290 uint8_t alpha_mask = 0xff;
291 int i, j;
292
293 for (j = 0; j < height; ++j) {
294 for (i = 0; i < width; ++i) {
295 const uint8_t alpha_value = argb[4 * i];
296 alpha[i] = alpha_value;
297 alpha_mask &= alpha_value;
298 }
299 argb += argb_stride;
300 alpha += alpha_stride;
301 }
302 return (alpha_mask == 0xff);
303 }
304
287 void (*WebPApplyAlphaMultiply)(uint8_t*, int, int, int, int); 305 void (*WebPApplyAlphaMultiply)(uint8_t*, int, int, int, int);
288 void (*WebPApplyAlphaMultiply4444)(uint8_t*, int, int, int); 306 void (*WebPApplyAlphaMultiply4444)(uint8_t*, int, int, int);
307 int (*WebPExtractAlpha)(const uint8_t*, int, int, int, uint8_t*, int);
289 308
290 //------------------------------------------------------------------------------ 309 //------------------------------------------------------------------------------
291 // Init function 310 // Init function
292 311
312 extern void WebPInitAlphaProcessingSSE2(void);
313
293 void WebPInitAlphaProcessing(void) { 314 void WebPInitAlphaProcessing(void) {
294 WebPMultARGBRow = MultARGBRow; 315 WebPMultARGBRow = MultARGBRow;
295 WebPMultRow = MultRow; 316 WebPMultRow = MultRow;
296 WebPApplyAlphaMultiply = ApplyAlphaMultiply; 317 WebPApplyAlphaMultiply = ApplyAlphaMultiply;
297 WebPApplyAlphaMultiply4444 = ApplyAlphaMultiply_16b; 318 WebPApplyAlphaMultiply4444 = ApplyAlphaMultiply_16b;
319 WebPExtractAlpha = ExtractAlpha;
320
321 // If defined, use CPUInfo() to overwrite some pointers with faster versions.
322 if (VP8GetCPUInfo != NULL) {
323 #if defined(WEBP_USE_SSE2)
324 if (VP8GetCPUInfo(kSSE2)) {
325 WebPInitAlphaProcessingSSE2();
326 }
327 #endif
328 }
298 } 329 }
OLDNEW
« no previous file with comments | « third_party/libwebp/demux/demux.c ('k') | third_party/libwebp/dsp/alpha_processing_sse2.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698