mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-18 14:59:48 +02:00
Add predictive filtering option for Alpha.
Add predictive filtering option for Alpha plane. Valid range for filter option is [0, 5] corresponding to prediction methods none, horizontal, vertical, gradient & paeth filter. The prediction method 5 will try all the prediction methods (0 to 4) and pick the prediction method that gives best compression. Change-Id: I9244d4a9c5017501a9696c7cec5045f04c16d49b
This commit is contained in:
50
src/utils/filters.h
Normal file
50
src/utils/filters.h
Normal file
@ -0,0 +1,50 @@
|
||||
// Copyright 2011 Google Inc.
|
||||
//
|
||||
// This code is licensed under the same terms as WebM:
|
||||
// Software License Agreement: http://www.webmproject.org/license/software/
|
||||
// Additional IP Rights Grant: http://www.webmproject.org/license/additional/
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// Spatial prediction using various filters
|
||||
//
|
||||
// Author: Urvang (urvang@google.com)
|
||||
|
||||
#ifndef WEBP_UTILS_FILTERS_H_
|
||||
#define WEBP_UTILS_FILTERS_H_
|
||||
|
||||
#include "../webp/types.h"
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Filters.
|
||||
typedef enum {
|
||||
WEBP_FILTER_NONE = 0,
|
||||
WEBP_FILTER_HORIZONTAL,
|
||||
WEBP_FILTER_VERTICAL,
|
||||
WEBP_FILTER_GRADIENT,
|
||||
WEBP_FILTER_PAETH,
|
||||
WEBP_FILTER_BEST,
|
||||
WEBP_FILTER_LAST,
|
||||
} WEBP_FILTER_TYPE;
|
||||
|
||||
typedef void (*WebPFilterFunc)(const uint8_t* in, int width, int height,
|
||||
int bpp, int stride, uint8_t* out);
|
||||
|
||||
// Filter the given data using the given predictor.
|
||||
// 'in' corresponds to a 2-dimensional pixel array of size (stride * height)
|
||||
// in raster order.
|
||||
// 'bpp' is number of bytes per pixel, and
|
||||
// 'stride' is number of bytes per scan line (with possible padding).
|
||||
// 'out' should be pre-allocated.
|
||||
extern const WebPFilterFunc WebPFilters[/*WEBP_FILTER_LAST*/];
|
||||
|
||||
// Reconstruct the original data from the given filtered data.
|
||||
extern const WebPFilterFunc WebPUnfilters[/*WEBP_FILTER_LAST*/];
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* WEBP_UTILS_FILTERS_H_ */
|
Reference in New Issue
Block a user