/src/mozilla-central/media/libpng/intel/intel_init.c
Line | Count | Source (jump to first uncovered line) |
1 | | |
2 | | /* intel_init.c - SSE2 optimized filter functions |
3 | | * |
4 | | * Copyright (c) 2016-2017 Glenn Randers-Pehrson |
5 | | * Written by Mike Klein and Matt Sarett, Google, Inc. |
6 | | * Derived from arm/arm_init.c |
7 | | * |
8 | | * Last changed in libpng 1.6.29 [March 16, 2017] |
9 | | * |
10 | | * This code is released under the libpng license. |
11 | | * For conditions of distribution and use, see the disclaimer |
12 | | * and license in png.h |
13 | | */ |
14 | | |
15 | | #include "../pngpriv.h" |
16 | | |
17 | | #ifdef PNG_READ_SUPPORTED |
18 | | #if PNG_INTEL_SSE_IMPLEMENTATION > 0 |
19 | | |
20 | | void |
21 | | png_init_filter_functions_sse2(png_structp pp, unsigned int bpp) |
22 | 0 | { |
23 | 0 | /* The techniques used to implement each of these filters in SSE operate on |
24 | 0 | * one pixel at a time. |
25 | 0 | * So they generally speed up 3bpp images about 3x, 4bpp images about 4x. |
26 | 0 | * They can scale up to 6 and 8 bpp images and down to 2 bpp images, |
27 | 0 | * but they'd not likely have any benefit for 1bpp images. |
28 | 0 | * Most of these can be implemented using only MMX and 64-bit registers, |
29 | 0 | * but they end up a bit slower than using the equally-ubiquitous SSE2. |
30 | 0 | */ |
31 | 0 | png_debug(1, "in png_init_filter_functions_sse2"); |
32 | 0 | if (bpp == 3) |
33 | 0 | { |
34 | 0 | pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_sse2; |
35 | 0 | pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_sse2; |
36 | 0 | pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = |
37 | 0 | png_read_filter_row_paeth3_sse2; |
38 | 0 | } |
39 | 0 | else if (bpp == 4) |
40 | 0 | { |
41 | 0 | pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_sse2; |
42 | 0 | pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_sse2; |
43 | 0 | pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = |
44 | 0 | png_read_filter_row_paeth4_sse2; |
45 | 0 | } |
46 | 0 |
|
47 | 0 | /* No need optimize PNG_FILTER_VALUE_UP. The compiler should |
48 | 0 | * autovectorize. |
49 | 0 | */ |
50 | 0 | } |
51 | | |
52 | | #endif /* PNG_INTEL_SSE_IMPLEMENTATION > 0 */ |
53 | | #endif /* PNG_READ_SUPPORTED */ |