#include "src/dsp/lossless.h"
#include "src/dsp/lossless_common.h"
#include "src/enc/vp8i_enc.h"
#include "src/enc/vp8li_enc.h"
#define MAX_DIFF_COST …
static const float kSpatialPredictorBias = …;
static const int kPredLowEffort = …;
static const uint32_t kMaskAlpha = …;
static WEBP_INLINE int GetMin(int a, int b) { … }
static float PredictionCostSpatial(const int counts[256], int weight_0,
float exp_val) { … }
static float PredictionCostSpatialHistogram(const int accumulated[4][256],
const int tile[4][256]) { … }
static WEBP_INLINE void UpdateHisto(int histo_argb[4][256], uint32_t argb) { … }
static WEBP_INLINE void PredictBatch(int mode, int x_start, int y,
int num_pixels, const uint32_t* current,
const uint32_t* upper, uint32_t* out) { … }
#if (WEBP_NEAR_LOSSLESS == 1)
static WEBP_INLINE int GetMax(int a, int b) { … }
static int MaxDiffBetweenPixels(uint32_t p1, uint32_t p2) { … }
static int MaxDiffAroundPixel(uint32_t current, uint32_t up, uint32_t down,
uint32_t left, uint32_t right) { … }
static uint32_t AddGreenToBlueAndRed(uint32_t argb) { … }
static void MaxDiffsForRow(int width, int stride, const uint32_t* const argb,
uint8_t* const max_diffs, int used_subtract_green) { … }
static uint8_t NearLosslessComponent(uint8_t value, uint8_t predict,
uint8_t boundary, int quantization) { … }
static WEBP_INLINE uint8_t NearLosslessDiff(uint8_t a, uint8_t b) { … }
static uint32_t NearLossless(uint32_t value, uint32_t predict,
int max_quantization, int max_diff,
int used_subtract_green) { … }
#endif
static WEBP_INLINE void GetResidual(
int width, int height, uint32_t* const upper_row,
uint32_t* const current_row, const uint8_t* const max_diffs, int mode,
int x_start, int x_end, int y, int max_quantization, int exact,
int used_subtract_green, uint32_t* const out) { … }
static int GetBestPredictorForTile(int width, int height,
int tile_x, int tile_y, int bits,
int accumulated[4][256],
uint32_t* const argb_scratch,
const uint32_t* const argb,
int max_quantization,
int exact, int used_subtract_green,
const uint32_t* const modes) { … }
static void CopyImageWithPrediction(int width, int height,
int bits, uint32_t* const modes,
uint32_t* const argb_scratch,
uint32_t* const argb,
int low_effort, int max_quantization,
int exact, int used_subtract_green) { … }
int VP8LResidualImage(int width, int height, int bits, int low_effort,
uint32_t* const argb, uint32_t* const argb_scratch,
uint32_t* const image, int near_lossless_quality,
int exact, int used_subtract_green,
const WebPPicture* const pic, int percent_range,
int* const percent) { … }
static WEBP_INLINE void MultipliersClear(VP8LMultipliers* const m) { … }
static WEBP_INLINE void ColorCodeToMultipliers(uint32_t color_code,
VP8LMultipliers* const m) { … }
static WEBP_INLINE uint32_t MultipliersToColorCode(
const VP8LMultipliers* const m) { … }
static float PredictionCostCrossColor(const int accumulated[256],
const int counts[256]) { … }
static float GetPredictionCostCrossColorRed(
const uint32_t* argb, int stride, int tile_width, int tile_height,
VP8LMultipliers prev_x, VP8LMultipliers prev_y, int green_to_red,
const int accumulated_red_histo[256]) { … }
static void GetBestGreenToRed(
const uint32_t* argb, int stride, int tile_width, int tile_height,
VP8LMultipliers prev_x, VP8LMultipliers prev_y, int quality,
const int accumulated_red_histo[256], VP8LMultipliers* const best_tx) { … }
static float GetPredictionCostCrossColorBlue(
const uint32_t* argb, int stride, int tile_width, int tile_height,
VP8LMultipliers prev_x, VP8LMultipliers prev_y,
int green_to_blue, int red_to_blue, const int accumulated_blue_histo[256]) { … }
#define kGreenRedToBlueNumAxis …
#define kGreenRedToBlueMaxIters …
static void GetBestGreenRedToBlue(
const uint32_t* argb, int stride, int tile_width, int tile_height,
VP8LMultipliers prev_x, VP8LMultipliers prev_y, int quality,
const int accumulated_blue_histo[256],
VP8LMultipliers* const best_tx) { … }
#undef kGreenRedToBlueMaxIters
#undef kGreenRedToBlueNumAxis
static VP8LMultipliers GetBestColorTransformForTile(
int tile_x, int tile_y, int bits,
VP8LMultipliers prev_x,
VP8LMultipliers prev_y,
int quality, int xsize, int ysize,
const int accumulated_red_histo[256],
const int accumulated_blue_histo[256],
const uint32_t* const argb) { … }
static void CopyTileWithColorTransform(int xsize, int ysize,
int tile_x, int tile_y,
int max_tile_size,
VP8LMultipliers color_transform,
uint32_t* argb) { … }
int VP8LColorSpaceTransform(int width, int height, int bits, int quality,
uint32_t* const argb, uint32_t* image,
const WebPPicture* const pic, int percent_range,
int* const percent) { … }