mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-18 23:09:52 +02:00
MIPS: MIPS32r1: Add optimization for GetResidualCost
+ reorganize the cost-evaluation code by moving some functions to cost.h/cost.c and exposing VP8Residual Change-Id: Id976299b5d4484e65da8bed31b3d2eb9cb4c1f7d
This commit is contained in:
@ -14,12 +14,32 @@
|
||||
#ifndef WEBP_ENC_COST_H_
|
||||
#define WEBP_ENC_COST_H_
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include "./vp8enci.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// On-the-fly info about the current set of residuals. Handy to avoid
|
||||
// passing zillions of params.
|
||||
typedef struct {
|
||||
int first;
|
||||
int last;
|
||||
const int16_t* coeffs;
|
||||
|
||||
int coeff_type;
|
||||
ProbaArray* prob;
|
||||
StatsArray* stats;
|
||||
CostArray* cost;
|
||||
} VP8Residual;
|
||||
|
||||
void VP8InitResidual(int first, int coeff_type,
|
||||
VP8Encoder* const enc, VP8Residual* const res);
|
||||
void VP8SetResidualCoeffs(const int16_t* const coeffs, VP8Residual* const res);
|
||||
int VP8RecordCoeffs(int ctx, const VP8Residual* const res);
|
||||
|
||||
// approximate cost per level:
|
||||
extern const uint16_t VP8LevelFixedCosts[MAX_LEVEL + 1];
|
||||
extern const uint16_t VP8EntropyCost[256]; // 8bit fixed-point log(p)
|
||||
@ -29,6 +49,12 @@ static WEBP_INLINE int VP8BitCost(int bit, uint8_t proba) {
|
||||
return !bit ? VP8EntropyCost[proba] : VP8EntropyCost[255 - proba];
|
||||
}
|
||||
|
||||
// Cost calculation function.
|
||||
typedef int (*VP8GetResidualCostFunc)(int ctx0, const VP8Residual* const res);
|
||||
extern VP8GetResidualCostFunc VP8GetResidualCost;
|
||||
|
||||
extern void VP8GetResidualCostInit(void); // must be called first
|
||||
|
||||
// Level cost calculations
|
||||
extern const uint16_t VP8LevelCodes[MAX_VARIABLE_LEVEL][2];
|
||||
void VP8CalculateLevelCosts(VP8Proba* const proba);
|
||||
|
Reference in New Issue
Block a user