OLD | NEW |
---|---|
1 // Copyright 2010 Google Inc. All Rights Reserved. | 1 // Copyright 2010 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // This code is licensed under the same terms as WebM: | 3 // This code is licensed under the same terms as WebM: |
4 // Software License Agreement: http://www.webmproject.org/license/software/ | 4 // Software License Agreement: http://www.webmproject.org/license/software/ |
5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ | 5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ |
6 // ----------------------------------------------------------------------------- | 6 // ----------------------------------------------------------------------------- |
7 // | 7 // |
8 // Speed-critical decoding functions. | 8 // Speed-critical decoding functions. |
9 // | 9 // |
10 // Author: Skal (pascal.massimino@gmail.com) | 10 // Author: Skal (pascal.massimino@gmail.com) |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
419 | 419 |
420 static void HE8uv(uint8_t *dst) { // horizontal | 420 static void HE8uv(uint8_t *dst) { // horizontal |
421 int j; | 421 int j; |
422 for (j = 0; j < 8; ++j) { | 422 for (j = 0; j < 8; ++j) { |
423 memset(dst, dst[-1], 8); | 423 memset(dst, dst[-1], 8); |
424 dst += BPS; | 424 dst += BPS; |
425 } | 425 } |
426 } | 426 } |
427 | 427 |
428 // helper for chroma-DC predictions | 428 // helper for chroma-DC predictions |
429 static WEBP_INLINE void Put8x8uv(uint64_t v, uint8_t* dst) { | 429 static WEBP_INLINE void Put8x8uv(uint8_t value, uint8_t* dst) { |
430 int j; | 430 int j; |
431 #ifndef WEBP_REFERENCE_IMPLEMENTATION | |
432 const uint64_t v = (uint64_t)value * 0x0101010101010101ULL; | |
fbarchard
2013/03/22 19:08:27
ULL is not guaranteed to be 64 bit. May want to u
| |
431 for (j = 0; j < 8; ++j) { | 433 for (j = 0; j < 8; ++j) { |
432 *(uint64_t*)(dst + j * BPS) = v; | 434 *(uint64_t*)(dst + j * BPS) = v; |
433 } | 435 } |
436 #else | |
437 for (j = 0; j < 8; ++j) memset(dst + j * BPS, value, 8); | |
438 #endif | |
434 } | 439 } |
435 | 440 |
436 static void DC8uv(uint8_t *dst) { // DC | 441 static void DC8uv(uint8_t *dst) { // DC |
437 int dc0 = 8; | 442 int dc0 = 8; |
438 int i; | 443 int i; |
439 for (i = 0; i < 8; ++i) { | 444 for (i = 0; i < 8; ++i) { |
440 dc0 += dst[i - BPS] + dst[-1 + i * BPS]; | 445 dc0 += dst[i - BPS] + dst[-1 + i * BPS]; |
441 } | 446 } |
442 Put8x8uv((uint64_t)((dc0 >> 4) * 0x0101010101010101ULL), dst); | 447 Put8x8uv(dc0 >> 4, dst); |
443 } | 448 } |
444 | 449 |
445 static void DC8uvNoLeft(uint8_t *dst) { // DC with no left samples | 450 static void DC8uvNoLeft(uint8_t *dst) { // DC with no left samples |
446 int dc0 = 4; | 451 int dc0 = 4; |
447 int i; | 452 int i; |
448 for (i = 0; i < 8; ++i) { | 453 for (i = 0; i < 8; ++i) { |
449 dc0 += dst[i - BPS]; | 454 dc0 += dst[i - BPS]; |
450 } | 455 } |
451 Put8x8uv((uint64_t)((dc0 >> 3) * 0x0101010101010101ULL), dst); | 456 Put8x8uv(dc0 >> 3, dst); |
452 } | 457 } |
453 | 458 |
454 static void DC8uvNoTop(uint8_t *dst) { // DC with no top samples | 459 static void DC8uvNoTop(uint8_t *dst) { // DC with no top samples |
455 int dc0 = 4; | 460 int dc0 = 4; |
456 int i; | 461 int i; |
457 for (i = 0; i < 8; ++i) { | 462 for (i = 0; i < 8; ++i) { |
458 dc0 += dst[-1 + i * BPS]; | 463 dc0 += dst[-1 + i * BPS]; |
459 } | 464 } |
460 Put8x8uv((uint64_t)((dc0 >> 3) * 0x0101010101010101ULL), dst); | 465 Put8x8uv(dc0 >> 3, dst); |
461 } | 466 } |
462 | 467 |
463 static void DC8uvNoTopLeft(uint8_t *dst) { // DC with nothing | 468 static void DC8uvNoTopLeft(uint8_t *dst) { // DC with nothing |
464 Put8x8uv(0x8080808080808080ULL, dst); | 469 Put8x8uv(0x80, dst); |
465 } | 470 } |
466 | 471 |
467 //------------------------------------------------------------------------------ | 472 //------------------------------------------------------------------------------ |
468 // default C implementations | 473 // default C implementations |
469 | 474 |
470 const VP8PredFunc VP8PredLuma4[NUM_BMODES] = { | 475 const VP8PredFunc VP8PredLuma4[NUM_BMODES] = { |
471 DC4, TM4, VE4, HE4, RD4, VR4, LD4, VL4, HD4, HU4 | 476 DC4, TM4, VE4, HE4, RD4, VR4, LD4, VL4, HD4, HU4 |
472 }; | 477 }; |
473 | 478 |
474 const VP8PredFunc VP8PredLuma16[NUM_B_DC_MODES] = { | 479 const VP8PredFunc VP8PredLuma16[NUM_B_DC_MODES] = { |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
723 if (VP8GetCPUInfo(kNEON)) { | 728 if (VP8GetCPUInfo(kNEON)) { |
724 VP8DspInitNEON(); | 729 VP8DspInitNEON(); |
725 } | 730 } |
726 #endif | 731 #endif |
727 } | 732 } |
728 } | 733 } |
729 | 734 |
730 #if defined(__cplusplus) || defined(c_plusplus) | 735 #if defined(__cplusplus) || defined(c_plusplus) |
731 } // extern "C" | 736 } // extern "C" |
732 #endif | 737 #endif |
OLD | NEW |