Add SSSE3 and SSE2 optimized png filter functions

This commit is contained in:
Matt Sarett
2016-02-15 14:41:27 -05:00
parent 08bd7654bc
commit 9c946e22fc
3 changed files with 326 additions and 0 deletions

38
intel/intel_init.c Normal file
View File

@@ -0,0 +1,38 @@
/* 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_SSE2_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_SSE2_OPT > 0 */
#endif /* PNG_READ_SUPPORTED */