New comit of SDL2
[supertux.git] / src / SDL2 / external / libwebp-0.3.0 / src / utils / filters.h
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@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 stride, uint8_t* out);
34 typedef void (*WebPUnfilterFunc)(int width, int height, int stride,
35                                  uint8_t* data);
36
37 // Filter the given data using the given predictor.
38 // 'in' corresponds to a 2-dimensional pixel array of size (stride * height)
39 // in raster order.
40 // 'stride' is number of bytes per scan line (with possible padding).
41 // 'out' should be pre-allocated.
42 extern const WebPFilterFunc WebPFilters[WEBP_FILTER_LAST];
43
44 // In-place reconstruct the original data from the given filtered data.
45 extern const WebPUnfilterFunc WebPUnfilters[WEBP_FILTER_LAST];
46
47 // Fast estimate of a potentially good filter.
48 extern WEBP_FILTER_TYPE EstimateBestFilter(const uint8_t* data,
49                                            int width, int height, int stride);
50
51 #if defined(__cplusplus) || defined(c_plusplus)
52 }    // extern "C"
53 #endif
54
55 #endif  /* WEBP_UTILS_FILTERS_H_ */