libpng/intel/intel_init.c

39 lines
1.1 KiB
C

/* intel_init.c - SSE2 optimized filter functions
*
* Copyright (c) 2016 Google, Inc.
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
#include "../pngpriv.h"
#ifdef PNG_READ_SUPPORTED
#if PNG_INTEL_SSE_OPT > 0
void
png_init_filter_functions_sse2(png_structp pp, unsigned int bpp)
{
if (bpp == 3)
{
pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_sse2;
pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_sse2;
pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
png_read_filter_row_paeth3_sse2;
}
else if (bpp == 4)
{
pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_sse2;
pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_sse2;
pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
png_read_filter_row_paeth4_sse2;
}
// No need optimize PNG_FILTER_VALUE_UP. The compiler should autovectorize.
}
#endif /* PNG_INTEL_SSE_OPT > 0 */
#endif /* PNG_READ_SUPPORTED */