mirror of
https://github.com/webmproject/libwebp.git
synced 2025-04-11 11:26:47 +02:00
make VP8PredLuma4[] non-const and initialize array in VP8DspInit()
also convert 'type *dst' to 'type* dst' Change-Id: I41ab66ad15b548cc45d1cb8b10bbca4fe1528cae
This commit is contained in:
parent
0ea8c6c219
commit
97c76f1f30
@ -104,7 +104,7 @@ static void TransformUV(const int16_t* in, uint8_t* dst) {
|
|||||||
VP8Transform(in + 2 * 16, dst + 4 * BPS, 1);
|
VP8Transform(in + 2 * 16, dst + 4 * BPS, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TransformDC(const int16_t *in, uint8_t* dst) {
|
static void TransformDC(const int16_t* in, uint8_t* dst) {
|
||||||
const int DC = in[0] + 4;
|
const int DC = in[0] + 4;
|
||||||
int i, j;
|
int i, j;
|
||||||
for (j = 0; j < 4; ++j) {
|
for (j = 0; j < 4; ++j) {
|
||||||
@ -160,7 +160,7 @@ void (*VP8TransformWHT)(const int16_t* in, int16_t* out);
|
|||||||
|
|
||||||
#define DST(x, y) dst[(x) + (y) * BPS]
|
#define DST(x, y) dst[(x) + (y) * BPS]
|
||||||
|
|
||||||
static WEBP_INLINE void TrueMotion(uint8_t *dst, int size) {
|
static WEBP_INLINE void TrueMotion(uint8_t* dst, int size) {
|
||||||
const uint8_t* top = dst - BPS;
|
const uint8_t* top = dst - BPS;
|
||||||
const uint8_t* const clip0 = VP8kclip1 - top[-1];
|
const uint8_t* const clip0 = VP8kclip1 - top[-1];
|
||||||
int y;
|
int y;
|
||||||
@ -173,21 +173,21 @@ static WEBP_INLINE void TrueMotion(uint8_t *dst, int size) {
|
|||||||
dst += BPS;
|
dst += BPS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void TM4(uint8_t *dst) { TrueMotion(dst, 4); }
|
static void TM4(uint8_t* dst) { TrueMotion(dst, 4); }
|
||||||
static void TM8uv(uint8_t *dst) { TrueMotion(dst, 8); }
|
static void TM8uv(uint8_t* dst) { TrueMotion(dst, 8); }
|
||||||
static void TM16(uint8_t *dst) { TrueMotion(dst, 16); }
|
static void TM16(uint8_t* dst) { TrueMotion(dst, 16); }
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// 16x16
|
// 16x16
|
||||||
|
|
||||||
static void VE16(uint8_t *dst) { // vertical
|
static void VE16(uint8_t* dst) { // vertical
|
||||||
int j;
|
int j;
|
||||||
for (j = 0; j < 16; ++j) {
|
for (j = 0; j < 16; ++j) {
|
||||||
memcpy(dst + j * BPS, dst - BPS, 16);
|
memcpy(dst + j * BPS, dst - BPS, 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HE16(uint8_t *dst) { // horizontal
|
static void HE16(uint8_t* dst) { // horizontal
|
||||||
int j;
|
int j;
|
||||||
for (j = 16; j > 0; --j) {
|
for (j = 16; j > 0; --j) {
|
||||||
memset(dst, dst[-1], 16);
|
memset(dst, dst[-1], 16);
|
||||||
@ -202,7 +202,7 @@ static WEBP_INLINE void Put16(int v, uint8_t* dst) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DC16(uint8_t *dst) { // DC
|
static void DC16(uint8_t* dst) { // DC
|
||||||
int DC = 16;
|
int DC = 16;
|
||||||
int j;
|
int j;
|
||||||
for (j = 0; j < 16; ++j) {
|
for (j = 0; j < 16; ++j) {
|
||||||
@ -211,7 +211,7 @@ static void DC16(uint8_t *dst) { // DC
|
|||||||
Put16(DC >> 5, dst);
|
Put16(DC >> 5, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DC16NoTop(uint8_t *dst) { // DC with top samples not available
|
static void DC16NoTop(uint8_t* dst) { // DC with top samples not available
|
||||||
int DC = 8;
|
int DC = 8;
|
||||||
int j;
|
int j;
|
||||||
for (j = 0; j < 16; ++j) {
|
for (j = 0; j < 16; ++j) {
|
||||||
@ -220,7 +220,7 @@ static void DC16NoTop(uint8_t *dst) { // DC with top samples not available
|
|||||||
Put16(DC >> 4, dst);
|
Put16(DC >> 4, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DC16NoLeft(uint8_t *dst) { // DC with left samples not available
|
static void DC16NoLeft(uint8_t* dst) { // DC with left samples not available
|
||||||
int DC = 8;
|
int DC = 8;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 16; ++i) {
|
for (i = 0; i < 16; ++i) {
|
||||||
@ -229,7 +229,7 @@ static void DC16NoLeft(uint8_t *dst) { // DC with left samples not available
|
|||||||
Put16(DC >> 4, dst);
|
Put16(DC >> 4, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DC16NoTopLeft(uint8_t *dst) { // DC with no top and left samples
|
static void DC16NoTopLeft(uint8_t* dst) { // DC with no top and left samples
|
||||||
Put16(0x80, dst);
|
Put16(0x80, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ static void DC16NoTopLeft(uint8_t *dst) { // DC with no top and left samples
|
|||||||
#define AVG3(a, b, c) (((a) + 2 * (b) + (c) + 2) >> 2)
|
#define AVG3(a, b, c) (((a) + 2 * (b) + (c) + 2) >> 2)
|
||||||
#define AVG2(a, b) (((a) + (b) + 1) >> 1)
|
#define AVG2(a, b) (((a) + (b) + 1) >> 1)
|
||||||
|
|
||||||
static void VE4(uint8_t *dst) { // vertical
|
static void VE4(uint8_t* dst) { // vertical
|
||||||
const uint8_t* top = dst - BPS;
|
const uint8_t* top = dst - BPS;
|
||||||
const uint8_t vals[4] = {
|
const uint8_t vals[4] = {
|
||||||
AVG3(top[-1], top[0], top[1]),
|
AVG3(top[-1], top[0], top[1]),
|
||||||
@ -253,7 +253,7 @@ static void VE4(uint8_t *dst) { // vertical
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HE4(uint8_t *dst) { // horizontal
|
static void HE4(uint8_t* dst) { // horizontal
|
||||||
const int A = dst[-1 - BPS];
|
const int A = dst[-1 - BPS];
|
||||||
const int B = dst[-1];
|
const int B = dst[-1];
|
||||||
const int C = dst[-1 + BPS];
|
const int C = dst[-1 + BPS];
|
||||||
@ -265,7 +265,7 @@ static void HE4(uint8_t *dst) { // horizontal
|
|||||||
*(uint32_t*)(dst + 3 * BPS) = 0x01010101U * AVG3(D, E, E);
|
*(uint32_t*)(dst + 3 * BPS) = 0x01010101U * AVG3(D, E, E);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DC4(uint8_t *dst) { // DC
|
static void DC4(uint8_t* dst) { // DC
|
||||||
uint32_t dc = 4;
|
uint32_t dc = 4;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 4; ++i) dc += dst[i - BPS] + dst[-1 + i * BPS];
|
for (i = 0; i < 4; ++i) dc += dst[i - BPS] + dst[-1 + i * BPS];
|
||||||
@ -273,7 +273,7 @@ static void DC4(uint8_t *dst) { // DC
|
|||||||
for (i = 0; i < 4; ++i) memset(dst + i * BPS, dc, 4);
|
for (i = 0; i < 4; ++i) memset(dst + i * BPS, dc, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RD4(uint8_t *dst) { // Down-right
|
static void RD4(uint8_t* dst) { // Down-right
|
||||||
const int I = dst[-1 + 0 * BPS];
|
const int I = dst[-1 + 0 * BPS];
|
||||||
const int J = dst[-1 + 1 * BPS];
|
const int J = dst[-1 + 1 * BPS];
|
||||||
const int K = dst[-1 + 2 * BPS];
|
const int K = dst[-1 + 2 * BPS];
|
||||||
@ -284,15 +284,15 @@ static void RD4(uint8_t *dst) { // Down-right
|
|||||||
const int C = dst[2 - BPS];
|
const int C = dst[2 - BPS];
|
||||||
const int D = dst[3 - BPS];
|
const int D = dst[3 - BPS];
|
||||||
DST(0, 3) = AVG3(J, K, L);
|
DST(0, 3) = AVG3(J, K, L);
|
||||||
DST(0, 2) = DST(1, 3) = AVG3(I, J, K);
|
DST(1, 3) = DST(0, 2) = AVG3(I, J, K);
|
||||||
DST(0, 1) = DST(1, 2) = DST(2, 3) = AVG3(X, I, J);
|
DST(2, 3) = DST(1, 2) = DST(0, 1) = AVG3(X, I, J);
|
||||||
DST(0, 0) = DST(1, 1) = DST(2, 2) = DST(3, 3) = AVG3(A, X, I);
|
DST(3, 3) = DST(2, 2) = DST(1, 1) = DST(0, 0) = AVG3(A, X, I);
|
||||||
DST(1, 0) = DST(2, 1) = DST(3, 2) = AVG3(B, A, X);
|
DST(3, 2) = DST(2, 1) = DST(1, 0) = AVG3(B, A, X);
|
||||||
DST(2, 0) = DST(3, 1) = AVG3(C, B, A);
|
DST(3, 1) = DST(2, 0) = AVG3(C, B, A);
|
||||||
DST(3, 0) = AVG3(D, C, B);
|
DST(3, 0) = AVG3(D, C, B);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LD4(uint8_t *dst) { // Down-Left
|
static void LD4(uint8_t* dst) { // Down-Left
|
||||||
const int A = dst[0 - BPS];
|
const int A = dst[0 - BPS];
|
||||||
const int B = dst[1 - BPS];
|
const int B = dst[1 - BPS];
|
||||||
const int C = dst[2 - BPS];
|
const int C = dst[2 - BPS];
|
||||||
@ -305,12 +305,12 @@ static void LD4(uint8_t *dst) { // Down-Left
|
|||||||
DST(1, 0) = DST(0, 1) = AVG3(B, C, D);
|
DST(1, 0) = DST(0, 1) = AVG3(B, C, D);
|
||||||
DST(2, 0) = DST(1, 1) = DST(0, 2) = AVG3(C, D, E);
|
DST(2, 0) = DST(1, 1) = DST(0, 2) = AVG3(C, D, E);
|
||||||
DST(3, 0) = DST(2, 1) = DST(1, 2) = DST(0, 3) = AVG3(D, E, F);
|
DST(3, 0) = DST(2, 1) = DST(1, 2) = DST(0, 3) = AVG3(D, E, F);
|
||||||
DST(3, 1) = DST(2, 2) = DST(1, 3) = AVG3(E, F, G);
|
DST(3, 1) = DST(2, 2) = DST(1, 3) = AVG3(E, F, G);
|
||||||
DST(3, 2) = DST(2, 3) = AVG3(F, G, H);
|
DST(3, 2) = DST(2, 3) = AVG3(F, G, H);
|
||||||
DST(3, 3) = AVG3(G, H, H);
|
DST(3, 3) = AVG3(G, H, H);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VR4(uint8_t *dst) { // Vertical-Right
|
static void VR4(uint8_t* dst) { // Vertical-Right
|
||||||
const int I = dst[-1 + 0 * BPS];
|
const int I = dst[-1 + 0 * BPS];
|
||||||
const int J = dst[-1 + 1 * BPS];
|
const int J = dst[-1 + 1 * BPS];
|
||||||
const int K = dst[-1 + 2 * BPS];
|
const int K = dst[-1 + 2 * BPS];
|
||||||
@ -332,7 +332,7 @@ static void VR4(uint8_t *dst) { // Vertical-Right
|
|||||||
DST(3, 1) = AVG3(B, C, D);
|
DST(3, 1) = AVG3(B, C, D);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VL4(uint8_t *dst) { // Vertical-Left
|
static void VL4(uint8_t* dst) { // Vertical-Left
|
||||||
const int A = dst[0 - BPS];
|
const int A = dst[0 - BPS];
|
||||||
const int B = dst[1 - BPS];
|
const int B = dst[1 - BPS];
|
||||||
const int C = dst[2 - BPS];
|
const int C = dst[2 - BPS];
|
||||||
@ -354,7 +354,7 @@ static void VL4(uint8_t *dst) { // Vertical-Left
|
|||||||
DST(3, 3) = AVG3(F, G, H);
|
DST(3, 3) = AVG3(F, G, H);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HU4(uint8_t *dst) { // Horizontal-Up
|
static void HU4(uint8_t* dst) { // Horizontal-Up
|
||||||
const int I = dst[-1 + 0 * BPS];
|
const int I = dst[-1 + 0 * BPS];
|
||||||
const int J = dst[-1 + 1 * BPS];
|
const int J = dst[-1 + 1 * BPS];
|
||||||
const int K = dst[-1 + 2 * BPS];
|
const int K = dst[-1 + 2 * BPS];
|
||||||
@ -369,7 +369,7 @@ static void HU4(uint8_t *dst) { // Horizontal-Up
|
|||||||
DST(0, 3) = DST(1, 3) = DST(2, 3) = DST(3, 3) = L;
|
DST(0, 3) = DST(1, 3) = DST(2, 3) = DST(3, 3) = L;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HD4(uint8_t *dst) { // Horizontal-Down
|
static void HD4(uint8_t* dst) { // Horizontal-Down
|
||||||
const int I = dst[-1 + 0 * BPS];
|
const int I = dst[-1 + 0 * BPS];
|
||||||
const int J = dst[-1 + 1 * BPS];
|
const int J = dst[-1 + 1 * BPS];
|
||||||
const int K = dst[-1 + 2 * BPS];
|
const int K = dst[-1 + 2 * BPS];
|
||||||
@ -399,14 +399,14 @@ static void HD4(uint8_t *dst) { // Horizontal-Down
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Chroma
|
// Chroma
|
||||||
|
|
||||||
static void VE8uv(uint8_t *dst) { // vertical
|
static void VE8uv(uint8_t* dst) { // vertical
|
||||||
int j;
|
int j;
|
||||||
for (j = 0; j < 8; ++j) {
|
for (j = 0; j < 8; ++j) {
|
||||||
memcpy(dst + j * BPS, dst - BPS, 8);
|
memcpy(dst + j * BPS, dst - BPS, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HE8uv(uint8_t *dst) { // horizontal
|
static void HE8uv(uint8_t* dst) { // horizontal
|
||||||
int j;
|
int j;
|
||||||
for (j = 0; j < 8; ++j) {
|
for (j = 0; j < 8; ++j) {
|
||||||
memset(dst, dst[-1], 8);
|
memset(dst, dst[-1], 8);
|
||||||
@ -422,7 +422,7 @@ static WEBP_INLINE void Put8x8uv(uint8_t value, uint8_t* dst) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DC8uv(uint8_t *dst) { // DC
|
static void DC8uv(uint8_t* dst) { // DC
|
||||||
int dc0 = 8;
|
int dc0 = 8;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 8; ++i) {
|
for (i = 0; i < 8; ++i) {
|
||||||
@ -431,7 +431,7 @@ static void DC8uv(uint8_t *dst) { // DC
|
|||||||
Put8x8uv(dc0 >> 4, dst);
|
Put8x8uv(dc0 >> 4, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DC8uvNoLeft(uint8_t *dst) { // DC with no left samples
|
static void DC8uvNoLeft(uint8_t* dst) { // DC with no left samples
|
||||||
int dc0 = 4;
|
int dc0 = 4;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 8; ++i) {
|
for (i = 0; i < 8; ++i) {
|
||||||
@ -440,7 +440,7 @@ static void DC8uvNoLeft(uint8_t *dst) { // DC with no left samples
|
|||||||
Put8x8uv(dc0 >> 3, dst);
|
Put8x8uv(dc0 >> 3, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DC8uvNoTop(uint8_t *dst) { // DC with no top samples
|
static void DC8uvNoTop(uint8_t* dst) { // DC with no top samples
|
||||||
int dc0 = 4;
|
int dc0 = 4;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 8; ++i) {
|
for (i = 0; i < 8; ++i) {
|
||||||
@ -449,16 +449,14 @@ static void DC8uvNoTop(uint8_t *dst) { // DC with no top samples
|
|||||||
Put8x8uv(dc0 >> 3, dst);
|
Put8x8uv(dc0 >> 3, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DC8uvNoTopLeft(uint8_t *dst) { // DC with nothing
|
static void DC8uvNoTopLeft(uint8_t* dst) { // DC with nothing
|
||||||
Put8x8uv(0x80, dst);
|
Put8x8uv(0x80, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// default C implementations
|
// default C implementations
|
||||||
|
|
||||||
const VP8PredFunc VP8PredLuma4[NUM_BMODES] = {
|
VP8PredFunc VP8PredLuma4[NUM_BMODES];
|
||||||
DC4, TM4, VE4, HE4, RD4, VR4, LD4, VL4, HD4, HU4
|
|
||||||
};
|
|
||||||
|
|
||||||
const VP8PredFunc VP8PredLuma16[NUM_B_DC_MODES] = {
|
const VP8PredFunc VP8PredLuma16[NUM_B_DC_MODES] = {
|
||||||
DC16, TM16, VE16, HE16,
|
DC16, TM16, VE16, HE16,
|
||||||
@ -712,6 +710,17 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8DspInit(void) {
|
|||||||
VP8SimpleVFilter16i = SimpleVFilter16i;
|
VP8SimpleVFilter16i = SimpleVFilter16i;
|
||||||
VP8SimpleHFilter16i = SimpleHFilter16i;
|
VP8SimpleHFilter16i = SimpleHFilter16i;
|
||||||
|
|
||||||
|
VP8PredLuma4[0] = DC4;
|
||||||
|
VP8PredLuma4[1] = TM4;
|
||||||
|
VP8PredLuma4[2] = VE4;
|
||||||
|
VP8PredLuma4[3] = HE4;
|
||||||
|
VP8PredLuma4[4] = RD4;
|
||||||
|
VP8PredLuma4[5] = VR4;
|
||||||
|
VP8PredLuma4[6] = LD4;
|
||||||
|
VP8PredLuma4[7] = VL4;
|
||||||
|
VP8PredLuma4[8] = HD4;
|
||||||
|
VP8PredLuma4[9] = HU4;
|
||||||
|
|
||||||
// If defined, use CPUInfo() to overwrite some pointers with faster versions.
|
// If defined, use CPUInfo() to overwrite some pointers with faster versions.
|
||||||
if (VP8GetCPUInfo != NULL) {
|
if (VP8GetCPUInfo != NULL) {
|
||||||
#if defined(WEBP_USE_SSE2)
|
#if defined(WEBP_USE_SSE2)
|
||||||
|
@ -177,7 +177,7 @@ extern VP8WHT VP8TransformWHT;
|
|||||||
typedef void (*VP8PredFunc)(uint8_t* dst);
|
typedef void (*VP8PredFunc)(uint8_t* dst);
|
||||||
extern const VP8PredFunc VP8PredLuma16[/* NUM_B_DC_MODES */];
|
extern const VP8PredFunc VP8PredLuma16[/* NUM_B_DC_MODES */];
|
||||||
extern const VP8PredFunc VP8PredChroma8[/* NUM_B_DC_MODES */];
|
extern const VP8PredFunc VP8PredChroma8[/* NUM_B_DC_MODES */];
|
||||||
extern const VP8PredFunc VP8PredLuma4[/* NUM_BMODES */];
|
extern VP8PredFunc VP8PredLuma4[/* NUM_BMODES */];
|
||||||
|
|
||||||
// clipping tables (for filtering)
|
// clipping tables (for filtering)
|
||||||
extern const int8_t* const VP8ksclip1; // clips [-1020, 1020] to [-128, 127]
|
extern const int8_t* const VP8ksclip1; // clips [-1020, 1020] to [-128, 127]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user