Give more flexibility to the predictor generating macro.

Change-Id: Ia651afa8322cb5c5ae87128340d05245c0f6a900
This commit is contained in:
Vincent Rabaud
2016-12-02 18:51:47 +01:00
committed by James Zern
parent 28e0bb7088
commit 2e6cb6f34e
4 changed files with 60 additions and 60 deletions

View File

@ -181,27 +181,27 @@ uint32_t VP8LSubPixels(uint32_t a, uint32_t b) {
// The predictor is added to the output pixel (which
// is therefore considered as a residual) to get the final prediction.
#define GENERATE_PREDICTOR_ADD(X) \
static void PredictorAdd##X(const uint32_t* in, const uint32_t* upper, \
int num_pixels, uint32_t* out) { \
int x; \
for (x = 0; x < num_pixels; ++x) { \
const uint32_t pred = VP8LPredictors[(X)](out[x - 1], upper + x); \
out[x] = VP8LAddPixels(in[x], pred); \
} \
}
#define GENERATE_PREDICTOR_ADD(PREDICTOR, PREDICTOR_ADD) \
static void PREDICTOR_ADD(const uint32_t* in, const uint32_t* upper, \
int num_pixels, uint32_t* out) { \
int x; \
for (x = 0; x < num_pixels; ++x) { \
const uint32_t pred = (PREDICTOR)(out[x - 1], upper + x); \
out[x] = VP8LAddPixels(in[x], pred); \
} \
}
// It subtracts the prediction from the input pixel and stores the residual
// in the output pixel.
#define GENERATE_PREDICTOR_SUB(X) \
static void PredictorSub##X(const uint32_t* in, const uint32_t* upper, \
int num_pixels, uint32_t* out) { \
int x; \
for (x = 0; x < num_pixels; ++x) { \
const uint32_t pred = VP8LPredictors[(X)](in[x - 1], upper + x); \
out[x] = VP8LSubPixels(in[x], pred); \
} \
}
#define GENERATE_PREDICTOR_SUB(PREDICTOR, PREDICTOR_SUB) \
static void PREDICTOR_SUB(const uint32_t* in, const uint32_t* upper, \
int num_pixels, uint32_t* out) { \
int x; \
for (x = 0; x < num_pixels; ++x) { \
const uint32_t pred = (PREDICTOR)(in[x - 1], upper + x); \
out[x] = VP8LSubPixels(in[x], pred); \
} \
}
#ifdef __cplusplus
} // extern "C"