1 // Copyright 2011 Google Inc. All Rights Reserved. 2 // 3 // This code is licensed under the same terms as WebM: 4 // Software License Agreement: http://www.webmproject.org/license/software/ 5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ 6 // ----------------------------------------------------------------------------- 7 // 8 // Spatial prediction using various filters 9 // 10 // Author: Urvang (urvang (at) google.com) 11 12 #ifndef WEBP_UTILS_FILTERS_H_ 13 #define WEBP_UTILS_FILTERS_H_ 14 15 #include "webp/types.h" 16 17 #if defined(__cplusplus) || defined(c_plusplus) 18 extern "C" { 19 #endif 20 21 // Filters. 22 typedef enum { 23 WEBP_FILTER_NONE = 0, 24 WEBP_FILTER_HORIZONTAL, 25 WEBP_FILTER_VERTICAL, 26 WEBP_FILTER_GRADIENT, 27 WEBP_FILTER_LAST = WEBP_FILTER_GRADIENT + 1, // end marker 28 WEBP_FILTER_BEST, 29 WEBP_FILTER_FAST 30 } WEBP_FILTER_TYPE; 31 32 typedef void (*WebPFilterFunc)(const uint8_t* in, int width, int height, 33 int bpp, int stride, uint8_t* out); 34 35 // Filter the given data using the given predictor. 36 // 'in' corresponds to a 2-dimensional pixel array of size (stride * height) 37 // in raster order. 38 // 'bpp' is number of bytes per pixel, and 39 // 'stride' is number of bytes per scan line (with possible padding). 40 // 'out' should be pre-allocated. 41 extern const WebPFilterFunc WebPFilters[WEBP_FILTER_LAST]; 42 43 // Reconstruct the original data from the given filtered data. 44 extern const WebPFilterFunc WebPUnfilters[WEBP_FILTER_LAST]; 45 46 // Fast estimate of a potentially good filter. 47 extern WEBP_FILTER_TYPE EstimateBestFilter(const uint8_t* data, 48 int width, int height, int stride); 49 50 #if defined(__cplusplus) || defined(c_plusplus) 51 } // extern "C" 52 #endif 53 54 #endif /* WEBP_UTILS_FILTERS_H_ */ 55