Path: blob/master/thirdparty/libpng/intel/intel_init.c
9896 views
/* intel_init.c - SSE2 optimized filter functions1*2* Copyright (c) 2018 Cosmin Truta3* Copyright (c) 2016-2017 Glenn Randers-Pehrson4* Written by Mike Klein and Matt Sarett, Google, Inc.5* Derived from arm/arm_init.c6*7* This code is released under the libpng license.8* For conditions of distribution and use, see the disclaimer9* and license in png.h10*/1112#include "../pngpriv.h"1314#ifdef PNG_READ_SUPPORTED15#if PNG_INTEL_SSE_IMPLEMENTATION > 01617void18png_init_filter_functions_sse2(png_structp pp, unsigned int bpp)19{20/* The techniques used to implement each of these filters in SSE operate on21* one pixel at a time.22* So they generally speed up 3bpp images about 3x, 4bpp images about 4x.23* They can scale up to 6 and 8 bpp images and down to 2 bpp images,24* but they'd not likely have any benefit for 1bpp images.25* Most of these can be implemented using only MMX and 64-bit registers,26* but they end up a bit slower than using the equally-ubiquitous SSE2.27*/28png_debug(1, "in png_init_filter_functions_sse2");29if (bpp == 3)30{31pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_sse2;32pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_sse2;33pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =34png_read_filter_row_paeth3_sse2;35}36else if (bpp == 4)37{38pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_sse2;39pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_sse2;40pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =41png_read_filter_row_paeth4_sse2;42}4344/* No need optimize PNG_FILTER_VALUE_UP. The compiler should45* autovectorize.46*/47}4849#endif /* PNG_INTEL_SSE_IMPLEMENTATION > 0 */50#endif /* PNG_READ_SUPPORTED */515253