1 // Copyright 2011 Google Inc. All Rights Reserved.
3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the COPYING file in the root of the source
5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS. All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree.
8 // -----------------------------------------------------------------------------
10 // Speed-critical encoding functions.
12 // Author: Skal (pascal.massimino@gmail.com)
14 #include <stdlib.h> // for abs()
16 #include "../enc/vp8enci.h"
18 #if defined(__cplusplus) || defined(c_plusplus)
22 static WEBP_INLINE uint8_t clip_8b(int v) {
23 return (!(v & ~0xff)) ? v : (v < 0) ? 0 : 255;
26 static WEBP_INLINE int clip_max(int v, int max) {
27 return (v > max) ? max : v;
30 //------------------------------------------------------------------------------
31 // Compute susceptibility based on DCT-coeff histograms:
32 // the higher, the "easier" the macroblock is to compress.
34 const int VP8DspScan[16 + 4 + 4] = {
36 0 + 0 * BPS, 4 + 0 * BPS, 8 + 0 * BPS, 12 + 0 * BPS,
37 0 + 4 * BPS, 4 + 4 * BPS, 8 + 4 * BPS, 12 + 4 * BPS,
38 0 + 8 * BPS, 4 + 8 * BPS, 8 + 8 * BPS, 12 + 8 * BPS,
39 0 + 12 * BPS, 4 + 12 * BPS, 8 + 12 * BPS, 12 + 12 * BPS,
41 0 + 0 * BPS, 4 + 0 * BPS, 0 + 4 * BPS, 4 + 4 * BPS, // U
42 8 + 0 * BPS, 12 + 0 * BPS, 8 + 4 * BPS, 12 + 4 * BPS // V
45 static void CollectHistogram(const uint8_t* ref, const uint8_t* pred,
46 int start_block, int end_block,
47 VP8Histogram* const histo) {
49 for (j = start_block; j < end_block; ++j) {
53 VP8FTransform(ref + VP8DspScan[j], pred + VP8DspScan[j], out);
55 // Convert coefficients to bin.
56 for (k = 0; k < 16; ++k) {
57 const int v = abs(out[k]) >> 3; // TODO(skal): add rounding?
58 const int clipped_value = clip_max(v, MAX_COEFF_THRESH);
59 histo->distribution[clipped_value]++;
64 //------------------------------------------------------------------------------
65 // run-time tables (~4k)
67 static uint8_t clip1[255 + 510 + 1]; // clips [-255,510] to [0,255]
69 // We declare this variable 'volatile' to prevent instruction reordering
70 // and make sure it's set to true _last_ (so as to be thread-safe)
71 static volatile int tables_ok = 0;
73 static void InitTables(void) {
76 for (i = -255; i <= 255 + 255; ++i) {
77 clip1[255 + i] = clip_8b(i);
84 //------------------------------------------------------------------------------
85 // Transforms (Paragraph 14.4)
87 #define STORE(x, y, v) \
88 dst[(x) + (y) * BPS] = clip_8b(ref[(x) + (y) * BPS] + ((v) >> 3))
90 static const int kC1 = 20091 + (1 << 16);
91 static const int kC2 = 35468;
92 #define MUL(a, b) (((a) * (b)) >> 16)
94 static WEBP_INLINE void ITransformOne(const uint8_t* ref, const int16_t* in,
99 for (i = 0; i < 4; ++i) { // vertical pass
100 const int a = in[0] + in[8];
101 const int b = in[0] - in[8];
102 const int c = MUL(in[4], kC2) - MUL(in[12], kC1);
103 const int d = MUL(in[4], kC1) + MUL(in[12], kC2);
113 for (i = 0; i < 4; ++i) { // horizontal pass
114 const int dc = tmp[0] + 4;
115 const int a = dc + tmp[8];
116 const int b = dc - tmp[8];
117 const int c = MUL(tmp[4], kC2) - MUL(tmp[12], kC1);
118 const int d = MUL(tmp[4], kC1) + MUL(tmp[12], kC2);
127 static void ITransform(const uint8_t* ref, const int16_t* in, uint8_t* dst,
129 ITransformOne(ref, in, dst);
131 ITransformOne(ref + 4, in + 16, dst + 4);
135 static void FTransform(const uint8_t* src, const uint8_t* ref, int16_t* out) {
138 for (i = 0; i < 4; ++i, src += BPS, ref += BPS) {
139 const int d0 = src[0] - ref[0]; // 9bit dynamic range ([-255,255])
140 const int d1 = src[1] - ref[1];
141 const int d2 = src[2] - ref[2];
142 const int d3 = src[3] - ref[3];
143 const int a0 = (d0 + d3); // 10b [-510,510]
144 const int a1 = (d1 + d2);
145 const int a2 = (d1 - d2);
146 const int a3 = (d0 - d3);
147 tmp[0 + i * 4] = (a0 + a1) * 8; // 14b [-8160,8160]
148 tmp[1 + i * 4] = (a2 * 2217 + a3 * 5352 + 1812) >> 9; // [-7536,7542]
149 tmp[2 + i * 4] = (a0 - a1) * 8;
150 tmp[3 + i * 4] = (a3 * 2217 - a2 * 5352 + 937) >> 9;
152 for (i = 0; i < 4; ++i) {
153 const int a0 = (tmp[0 + i] + tmp[12 + i]); // 15b
154 const int a1 = (tmp[4 + i] + tmp[ 8 + i]);
155 const int a2 = (tmp[4 + i] - tmp[ 8 + i]);
156 const int a3 = (tmp[0 + i] - tmp[12 + i]);
157 out[0 + i] = (a0 + a1 + 7) >> 4; // 12b
158 out[4 + i] = ((a2 * 2217 + a3 * 5352 + 12000) >> 16) + (a3 != 0);
159 out[8 + i] = (a0 - a1 + 7) >> 4;
160 out[12+ i] = ((a3 * 2217 - a2 * 5352 + 51000) >> 16);
164 static void ITransformWHT(const int16_t* in, int16_t* out) {
167 for (i = 0; i < 4; ++i) {
168 const int a0 = in[0 + i] + in[12 + i];
169 const int a1 = in[4 + i] + in[ 8 + i];
170 const int a2 = in[4 + i] - in[ 8 + i];
171 const int a3 = in[0 + i] - in[12 + i];
172 tmp[0 + i] = a0 + a1;
173 tmp[8 + i] = a0 - a1;
174 tmp[4 + i] = a3 + a2;
175 tmp[12 + i] = a3 - a2;
177 for (i = 0; i < 4; ++i) {
178 const int dc = tmp[0 + i * 4] + 3; // w/ rounder
179 const int a0 = dc + tmp[3 + i * 4];
180 const int a1 = tmp[1 + i * 4] + tmp[2 + i * 4];
181 const int a2 = tmp[1 + i * 4] - tmp[2 + i * 4];
182 const int a3 = dc - tmp[3 + i * 4];
183 out[ 0] = (a0 + a1) >> 3;
184 out[16] = (a3 + a2) >> 3;
185 out[32] = (a0 - a1) >> 3;
186 out[48] = (a3 - a2) >> 3;
191 static void FTransformWHT(const int16_t* in, int16_t* out) {
192 // input is 12b signed
195 for (i = 0; i < 4; ++i, in += 64) {
196 const int a0 = (in[0 * 16] + in[2 * 16]); // 13b
197 const int a1 = (in[1 * 16] + in[3 * 16]);
198 const int a2 = (in[1 * 16] - in[3 * 16]);
199 const int a3 = (in[0 * 16] - in[2 * 16]);
200 tmp[0 + i * 4] = a0 + a1; // 14b
201 tmp[1 + i * 4] = a3 + a2;
202 tmp[2 + i * 4] = a3 - a2;
203 tmp[3 + i * 4] = a0 - a1;
205 for (i = 0; i < 4; ++i) {
206 const int a0 = (tmp[0 + i] + tmp[8 + i]); // 15b
207 const int a1 = (tmp[4 + i] + tmp[12+ i]);
208 const int a2 = (tmp[4 + i] - tmp[12+ i]);
209 const int a3 = (tmp[0 + i] - tmp[8 + i]);
210 const int b0 = a0 + a1; // 16b
211 const int b1 = a3 + a2;
212 const int b2 = a3 - a2;
213 const int b3 = a0 - a1;
214 out[ 0 + i] = b0 >> 1; // 15b
215 out[ 4 + i] = b1 >> 1;
216 out[ 8 + i] = b2 >> 1;
217 out[12 + i] = b3 >> 1;
224 //------------------------------------------------------------------------------
227 #define DST(x, y) dst[(x) + (y) * BPS]
229 static WEBP_INLINE void Fill(uint8_t* dst, int value, int size) {
231 for (j = 0; j < size; ++j) {
232 memset(dst + j * BPS, value, size);
236 static WEBP_INLINE void VerticalPred(uint8_t* dst,
237 const uint8_t* top, int size) {
240 for (j = 0; j < size; ++j) memcpy(dst + j * BPS, top, size);
242 Fill(dst, 127, size);
246 static WEBP_INLINE void HorizontalPred(uint8_t* dst,
247 const uint8_t* left, int size) {
250 for (j = 0; j < size; ++j) {
251 memset(dst + j * BPS, left[j], size);
254 Fill(dst, 129, size);
258 static WEBP_INLINE void TrueMotion(uint8_t* dst, const uint8_t* left,
259 const uint8_t* top, int size) {
263 const uint8_t* const clip = clip1 + 255 - left[-1];
264 for (y = 0; y < size; ++y) {
265 const uint8_t* const clip_table = clip + left[y];
267 for (x = 0; x < size; ++x) {
268 dst[x] = clip_table[top[x]];
273 HorizontalPred(dst, left, size);
276 // true motion without left samples (hence: with default 129 value)
277 // is equivalent to VE prediction where you just copy the top samples.
278 // Note that if top samples are not available, the default value is
279 // then 129, and not 127 as in the VerticalPred case.
281 VerticalPred(dst, top, size);
283 Fill(dst, 129, size);
288 static WEBP_INLINE void DCMode(uint8_t* dst, const uint8_t* left,
290 int size, int round, int shift) {
294 for (j = 0; j < size; ++j) DC += top[j];
295 if (left) { // top and left present
296 for (j = 0; j < size; ++j) DC += left[j];
297 } else { // top, but no left
300 DC = (DC + round) >> shift;
301 } else if (left) { // left but no top
302 for (j = 0; j < size; ++j) DC += left[j];
304 DC = (DC + round) >> shift;
305 } else { // no top, no left, nothing.
311 //------------------------------------------------------------------------------
312 // Chroma 8x8 prediction (paragraph 12.2)
314 static void IntraChromaPreds(uint8_t* dst, const uint8_t* left,
315 const uint8_t* top) {
317 DCMode(C8DC8 + dst, left, top, 8, 8, 4);
318 VerticalPred(C8VE8 + dst, top, 8);
319 HorizontalPred(C8HE8 + dst, left, 8);
320 TrueMotion(C8TM8 + dst, left, top, 8);
324 if (left) left += 16;
325 DCMode(C8DC8 + dst, left, top, 8, 8, 4);
326 VerticalPred(C8VE8 + dst, top, 8);
327 HorizontalPred(C8HE8 + dst, left, 8);
328 TrueMotion(C8TM8 + dst, left, top, 8);
331 //------------------------------------------------------------------------------
332 // luma 16x16 prediction (paragraph 12.3)
334 static void Intra16Preds(uint8_t* dst,
335 const uint8_t* left, const uint8_t* top) {
336 DCMode(I16DC16 + dst, left, top, 16, 16, 5);
337 VerticalPred(I16VE16 + dst, top, 16);
338 HorizontalPred(I16HE16 + dst, left, 16);
339 TrueMotion(I16TM16 + dst, left, top, 16);
342 //------------------------------------------------------------------------------
343 // luma 4x4 prediction
345 #define AVG3(a, b, c) (((a) + 2 * (b) + (c) + 2) >> 2)
346 #define AVG2(a, b) (((a) + (b) + 1) >> 1)
348 static void VE4(uint8_t* dst, const uint8_t* top) { // vertical
349 const uint8_t vals[4] = {
350 AVG3(top[-1], top[0], top[1]),
351 AVG3(top[ 0], top[1], top[2]),
352 AVG3(top[ 1], top[2], top[3]),
353 AVG3(top[ 2], top[3], top[4])
356 for (i = 0; i < 4; ++i) {
357 memcpy(dst + i * BPS, vals, 4);
361 static void HE4(uint8_t* dst, const uint8_t* top) { // horizontal
362 const int X = top[-1];
363 const int I = top[-2];
364 const int J = top[-3];
365 const int K = top[-4];
366 const int L = top[-5];
367 *(uint32_t*)(dst + 0 * BPS) = 0x01010101U * AVG3(X, I, J);
368 *(uint32_t*)(dst + 1 * BPS) = 0x01010101U * AVG3(I, J, K);
369 *(uint32_t*)(dst + 2 * BPS) = 0x01010101U * AVG3(J, K, L);
370 *(uint32_t*)(dst + 3 * BPS) = 0x01010101U * AVG3(K, L, L);
373 static void DC4(uint8_t* dst, const uint8_t* top) {
376 for (i = 0; i < 4; ++i) dc += top[i] + top[-5 + i];
377 Fill(dst, dc >> 3, 4);
380 static void RD4(uint8_t* dst, const uint8_t* top) {
381 const int X = top[-1];
382 const int I = top[-2];
383 const int J = top[-3];
384 const int K = top[-4];
385 const int L = top[-5];
386 const int A = top[0];
387 const int B = top[1];
388 const int C = top[2];
389 const int D = top[3];
390 DST(0, 3) = AVG3(J, K, L);
391 DST(0, 2) = DST(1, 3) = AVG3(I, J, K);
392 DST(0, 1) = DST(1, 2) = DST(2, 3) = AVG3(X, I, J);
393 DST(0, 0) = DST(1, 1) = DST(2, 2) = DST(3, 3) = AVG3(A, X, I);
394 DST(1, 0) = DST(2, 1) = DST(3, 2) = AVG3(B, A, X);
395 DST(2, 0) = DST(3, 1) = AVG3(C, B, A);
396 DST(3, 0) = AVG3(D, C, B);
399 static void LD4(uint8_t* dst, const uint8_t* top) {
400 const int A = top[0];
401 const int B = top[1];
402 const int C = top[2];
403 const int D = top[3];
404 const int E = top[4];
405 const int F = top[5];
406 const int G = top[6];
407 const int H = top[7];
408 DST(0, 0) = AVG3(A, B, C);
409 DST(1, 0) = DST(0, 1) = AVG3(B, C, D);
410 DST(2, 0) = DST(1, 1) = DST(0, 2) = AVG3(C, D, E);
411 DST(3, 0) = DST(2, 1) = DST(1, 2) = DST(0, 3) = AVG3(D, E, F);
412 DST(3, 1) = DST(2, 2) = DST(1, 3) = AVG3(E, F, G);
413 DST(3, 2) = DST(2, 3) = AVG3(F, G, H);
414 DST(3, 3) = AVG3(G, H, H);
417 static void VR4(uint8_t* dst, const uint8_t* top) {
418 const int X = top[-1];
419 const int I = top[-2];
420 const int J = top[-3];
421 const int K = top[-4];
422 const int A = top[0];
423 const int B = top[1];
424 const int C = top[2];
425 const int D = top[3];
426 DST(0, 0) = DST(1, 2) = AVG2(X, A);
427 DST(1, 0) = DST(2, 2) = AVG2(A, B);
428 DST(2, 0) = DST(3, 2) = AVG2(B, C);
429 DST(3, 0) = AVG2(C, D);
431 DST(0, 3) = AVG3(K, J, I);
432 DST(0, 2) = AVG3(J, I, X);
433 DST(0, 1) = DST(1, 3) = AVG3(I, X, A);
434 DST(1, 1) = DST(2, 3) = AVG3(X, A, B);
435 DST(2, 1) = DST(3, 3) = AVG3(A, B, C);
436 DST(3, 1) = AVG3(B, C, D);
439 static void VL4(uint8_t* dst, const uint8_t* top) {
440 const int A = top[0];
441 const int B = top[1];
442 const int C = top[2];
443 const int D = top[3];
444 const int E = top[4];
445 const int F = top[5];
446 const int G = top[6];
447 const int H = top[7];
448 DST(0, 0) = AVG2(A, B);
449 DST(1, 0) = DST(0, 2) = AVG2(B, C);
450 DST(2, 0) = DST(1, 2) = AVG2(C, D);
451 DST(3, 0) = DST(2, 2) = AVG2(D, E);
453 DST(0, 1) = AVG3(A, B, C);
454 DST(1, 1) = DST(0, 3) = AVG3(B, C, D);
455 DST(2, 1) = DST(1, 3) = AVG3(C, D, E);
456 DST(3, 1) = DST(2, 3) = AVG3(D, E, F);
457 DST(3, 2) = AVG3(E, F, G);
458 DST(3, 3) = AVG3(F, G, H);
461 static void HU4(uint8_t* dst, const uint8_t* top) {
462 const int I = top[-2];
463 const int J = top[-3];
464 const int K = top[-4];
465 const int L = top[-5];
466 DST(0, 0) = AVG2(I, J);
467 DST(2, 0) = DST(0, 1) = AVG2(J, K);
468 DST(2, 1) = DST(0, 2) = AVG2(K, L);
469 DST(1, 0) = AVG3(I, J, K);
470 DST(3, 0) = DST(1, 1) = AVG3(J, K, L);
471 DST(3, 1) = DST(1, 2) = AVG3(K, L, L);
472 DST(3, 2) = DST(2, 2) =
473 DST(0, 3) = DST(1, 3) = DST(2, 3) = DST(3, 3) = L;
476 static void HD4(uint8_t* dst, const uint8_t* top) {
477 const int X = top[-1];
478 const int I = top[-2];
479 const int J = top[-3];
480 const int K = top[-4];
481 const int L = top[-5];
482 const int A = top[0];
483 const int B = top[1];
484 const int C = top[2];
486 DST(0, 0) = DST(2, 1) = AVG2(I, X);
487 DST(0, 1) = DST(2, 2) = AVG2(J, I);
488 DST(0, 2) = DST(2, 3) = AVG2(K, J);
489 DST(0, 3) = AVG2(L, K);
491 DST(3, 0) = AVG3(A, B, C);
492 DST(2, 0) = AVG3(X, A, B);
493 DST(1, 0) = DST(3, 1) = AVG3(I, X, A);
494 DST(1, 1) = DST(3, 2) = AVG3(J, I, X);
495 DST(1, 2) = DST(3, 3) = AVG3(K, J, I);
496 DST(1, 3) = AVG3(L, K, J);
499 static void TM4(uint8_t* dst, const uint8_t* top) {
501 const uint8_t* const clip = clip1 + 255 - top[-1];
502 for (y = 0; y < 4; ++y) {
503 const uint8_t* const clip_table = clip + top[-2 - y];
504 for (x = 0; x < 4; ++x) {
505 dst[x] = clip_table[top[x]];
515 // Left samples are top[-5 .. -2], top_left is top[-1], top are
516 // located at top[0..3], and top right is top[4..7]
517 static void Intra4Preds(uint8_t* dst, const uint8_t* top) {
518 DC4(I4DC4 + dst, top);
519 TM4(I4TM4 + dst, top);
520 VE4(I4VE4 + dst, top);
521 HE4(I4HE4 + dst, top);
522 RD4(I4RD4 + dst, top);
523 VR4(I4VR4 + dst, top);
524 LD4(I4LD4 + dst, top);
525 VL4(I4VL4 + dst, top);
526 HD4(I4HD4 + dst, top);
527 HU4(I4HU4 + dst, top);
530 //------------------------------------------------------------------------------
533 static WEBP_INLINE int GetSSE(const uint8_t* a, const uint8_t* b,
537 for (y = 0; y < h; ++y) {
538 for (x = 0; x < w; ++x) {
539 const int diff = (int)a[x] - b[x];
540 count += diff * diff;
548 static int SSE16x16(const uint8_t* a, const uint8_t* b) {
549 return GetSSE(a, b, 16, 16);
551 static int SSE16x8(const uint8_t* a, const uint8_t* b) {
552 return GetSSE(a, b, 16, 8);
554 static int SSE8x8(const uint8_t* a, const uint8_t* b) {
555 return GetSSE(a, b, 8, 8);
557 static int SSE4x4(const uint8_t* a, const uint8_t* b) {
558 return GetSSE(a, b, 4, 4);
561 //------------------------------------------------------------------------------
562 // Texture distortion
564 // We try to match the spectral content (weighted) between source and
565 // reconstructed samples.
567 // Hadamard transform
568 // Returns the weighted sum of the absolute value of transformed coefficients.
569 static int TTransform(const uint8_t* in, const uint16_t* w) {
574 for (i = 0; i < 4; ++i, in += BPS) {
575 const int a0 = in[0] + in[2];
576 const int a1 = in[1] + in[3];
577 const int a2 = in[1] - in[3];
578 const int a3 = in[0] - in[2];
579 tmp[0 + i * 4] = a0 + a1;
580 tmp[1 + i * 4] = a3 + a2;
581 tmp[2 + i * 4] = a3 - a2;
582 tmp[3 + i * 4] = a0 - a1;
585 for (i = 0; i < 4; ++i, ++w) {
586 const int a0 = tmp[0 + i] + tmp[8 + i];
587 const int a1 = tmp[4 + i] + tmp[12+ i];
588 const int a2 = tmp[4 + i] - tmp[12+ i];
589 const int a3 = tmp[0 + i] - tmp[8 + i];
590 const int b0 = a0 + a1;
591 const int b1 = a3 + a2;
592 const int b2 = a3 - a2;
593 const int b3 = a0 - a1;
595 sum += w[ 0] * abs(b0);
596 sum += w[ 4] * abs(b1);
597 sum += w[ 8] * abs(b2);
598 sum += w[12] * abs(b3);
603 static int Disto4x4(const uint8_t* const a, const uint8_t* const b,
604 const uint16_t* const w) {
605 const int sum1 = TTransform(a, w);
606 const int sum2 = TTransform(b, w);
607 return abs(sum2 - sum1) >> 5;
610 static int Disto16x16(const uint8_t* const a, const uint8_t* const b,
611 const uint16_t* const w) {
614 for (y = 0; y < 16 * BPS; y += 4 * BPS) {
615 for (x = 0; x < 16; x += 4) {
616 D += Disto4x4(a + x + y, b + x + y, w);
622 //------------------------------------------------------------------------------
626 static const uint8_t kZigzag[16] = {
627 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
630 // Simple quantization
631 static int QuantizeBlock(int16_t in[16], int16_t out[16],
632 int n, const VP8Matrix* const mtx) {
634 for (; n < 16; ++n) {
635 const int j = kZigzag[n];
636 const int sign = (in[j] < 0);
637 const int coeff = (sign ? -in[j] : in[j]) + mtx->sharpen_[j];
638 if (coeff > mtx->zthresh_[j]) {
639 const int Q = mtx->q_[j];
640 const int iQ = mtx->iq_[j];
641 const int B = mtx->bias_[j];
642 out[n] = QUANTDIV(coeff, iQ, B);
643 if (out[n] > MAX_LEVEL) out[n] = MAX_LEVEL;
644 if (sign) out[n] = -out[n];
646 if (out[n]) last = n;
655 //------------------------------------------------------------------------------
658 static WEBP_INLINE void Copy(const uint8_t* src, uint8_t* dst, int size) {
660 for (y = 0; y < size; ++y) {
661 memcpy(dst, src, size);
667 static void Copy4x4(const uint8_t* src, uint8_t* dst) { Copy(src, dst, 4); }
669 //------------------------------------------------------------------------------
672 // Speed-critical function pointers. We have to initialize them to the default
673 // implementations within VP8EncDspInit().
674 VP8CHisto VP8CollectHistogram;
675 VP8Idct VP8ITransform;
676 VP8Fdct VP8FTransform;
677 VP8WHT VP8ITransformWHT;
678 VP8WHT VP8FTransformWHT;
679 VP8Intra4Preds VP8EncPredLuma4;
680 VP8IntraPreds VP8EncPredLuma16;
681 VP8IntraPreds VP8EncPredChroma8;
682 VP8Metric VP8SSE16x16;
684 VP8Metric VP8SSE16x8;
686 VP8WMetric VP8TDisto4x4;
687 VP8WMetric VP8TDisto16x16;
688 VP8QuantizeBlock VP8EncQuantizeBlock;
689 VP8BlockCopy VP8Copy4x4;
691 extern void VP8EncDspInitSSE2(void);
692 extern void VP8EncDspInitNEON(void);
694 void VP8EncDspInit(void) {
697 // default C implementations
698 VP8CollectHistogram = CollectHistogram;
699 VP8ITransform = ITransform;
700 VP8FTransform = FTransform;
701 VP8ITransformWHT = ITransformWHT;
702 VP8FTransformWHT = FTransformWHT;
703 VP8EncPredLuma4 = Intra4Preds;
704 VP8EncPredLuma16 = Intra16Preds;
705 VP8EncPredChroma8 = IntraChromaPreds;
706 VP8SSE16x16 = SSE16x16;
708 VP8SSE16x8 = SSE16x8;
710 VP8TDisto4x4 = Disto4x4;
711 VP8TDisto16x16 = Disto16x16;
712 VP8EncQuantizeBlock = QuantizeBlock;
713 VP8Copy4x4 = Copy4x4;
715 // If defined, use CPUInfo() to overwrite some pointers with faster versions.
717 #if defined(WEBP_USE_SSE2)
718 if (VP8GetCPUInfo(kSSE2)) {
721 #elif defined(WEBP_USE_NEON)
722 if (VP8GetCPUInfo(kNEON)) {
729 #if defined(__cplusplus) || defined(c_plusplus)