#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include <algorithm>
#include <cmath>
#include <vector>
#include "base/check_op.h"
#include "base/notreached.h"
#include "skia/ext/recursive_gaussian_convolution.h"
namespace skia {
namespace {
template<bool take_absolute>
inline unsigned char FloatTo8(float f) { … }
template<RecursiveFilter::Order order>
inline float ForwardFilter(float in_n_1,
float in_n,
float in_n1,
const std::vector<float>& w,
int n,
const float* b) { … }
template<RecursiveFilter::Order order>
inline float BackwardFilter(const std::vector<float>& out,
int n,
float w_n,
float w_n1,
const float* b) { … }
template<RecursiveFilter::Order order, bool absolute_values>
unsigned char SingleChannelRecursiveFilter(
const unsigned char* const source_data,
int source_pixel_stride,
int source_row_stride,
int row_width,
int row_count,
unsigned char* const output,
int output_pixel_stride,
int output_row_stride,
const float* b) { … }
unsigned char SingleChannelRecursiveFilter(
const unsigned char* const source_data,
int source_pixel_stride,
int source_row_stride,
int row_width,
int row_count,
unsigned char* const output,
int output_pixel_stride,
int output_row_stride,
const float* b,
RecursiveFilter::Order order,
bool absolute_values) { … }
}
float RecursiveFilter::qFromSigma(float sigma) { … }
void RecursiveFilter::computeCoefficients(float q, float b[4]) { … }
RecursiveFilter::RecursiveFilter(float sigma, Order order)
: … { … }
unsigned char SingleChannelRecursiveGaussianX(const unsigned char* source_data,
int source_byte_row_stride,
int input_channel_index,
int input_channel_count,
const RecursiveFilter& filter,
const SkISize& image_size,
unsigned char* output,
int output_byte_row_stride,
int output_channel_index,
int output_channel_count,
bool absolute_values) { … }
unsigned char SingleChannelRecursiveGaussianY(const unsigned char* source_data,
int source_byte_row_stride,
int input_channel_index,
int input_channel_count,
const RecursiveFilter& filter,
const SkISize& image_size,
unsigned char* output,
int output_byte_row_stride,
int output_channel_index,
int output_channel_count,
bool absolute_values) { … }
}