Changeset 5633 for pjproject/trunk/third_party/yuv/source/row_common.cc
- Timestamp:
- Jul 28, 2017 2:51:44 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/third_party/yuv/source/row_common.cc
r5358 r5633 41 41 return (v + m) ^ m; 42 42 } 43 #else // USE_BRANCHLESS43 #else // USE_BRANCHLESS 44 44 static __inline int32 clamp0(int32 v) { 45 45 return (v < 0) ? 0 : v; … … 130 130 } 131 131 132 void ARGB1555ToARGBRow_C(const uint8* src_argb1555, uint8* dst_argb, 132 void ARGB1555ToARGBRow_C(const uint8* src_argb1555, 133 uint8* dst_argb, 133 134 int width) { 134 135 int x; … … 147 148 } 148 149 149 void ARGB4444ToARGBRow_C(const uint8* src_argb4444, uint8* dst_argb, 150 void ARGB4444ToARGBRow_C(const uint8* src_argb4444, 151 uint8* dst_argb, 150 152 int width) { 151 153 int x; … … 201 203 uint8 g1 = src_argb[5] >> 2; 202 204 uint8 r1 = src_argb[6] >> 3; 203 WRITEWORD(dst_rgb, b0 | (g0 << 5) | (r0 << 11) | 204 (b1 << 16) | (g1 << 21) |(r1 << 27));205 WRITEWORD(dst_rgb, b0 | (g0 << 5) | (r0 << 11) | (b1 << 16) | (g1 << 21) | 206 (r1 << 27)); 205 207 dst_rgb += 4; 206 208 src_argb += 8; … … 222 224 // will containing the first pixel in the lower byte for little endian 223 225 // or the upper byte for big endian. 224 void ARGBToRGB565DitherRow_C(const uint8* src_argb, uint8* dst_rgb, 225 const uint32 dither4, int width) { 226 void ARGBToRGB565DitherRow_C(const uint8* src_argb, 227 uint8* dst_rgb, 228 const uint32 dither4, 229 int width) { 226 230 int x; 227 231 for (x = 0; x < width - 1; x += 2) { … … 234 238 uint8 g1 = clamp255(src_argb[5] + dither1) >> 2; 235 239 uint8 r1 = clamp255(src_argb[6] + dither1) >> 3; 236 WRITEWORD(dst_rgb, b0 | (g0 << 5) | (r0 << 11) | 237 (b1 << 16) | (g1 << 21) |(r1 << 27));240 WRITEWORD(dst_rgb, b0 | (g0 << 5) | (r0 << 11) | (b1 << 16) | (g1 << 21) | 241 (r1 << 27)); 238 242 dst_rgb += 4; 239 243 src_argb += 8; … … 259 263 uint8 r1 = src_argb[6] >> 3; 260 264 uint8 a1 = src_argb[7] >> 7; 261 *(uint32*)(dst_rgb) = 262 b0 | (g0 << 5) | (r0 << 10) | (a0 << 15) | 263 (b1 << 16) | (g1 << 21) | (r1 << 26) | (a1 << 31); 265 *(uint32*)(dst_rgb) = b0 | (g0 << 5) | (r0 << 10) | (a0 << 15) | 266 (b1 << 16) | (g1 << 21) | (r1 << 26) | (a1 << 31); 264 267 dst_rgb += 4; 265 268 src_argb += 8; … … 270 273 uint8 r0 = src_argb[2] >> 3; 271 274 uint8 a0 = src_argb[3] >> 7; 272 *(uint16*)(dst_rgb) = 273 b0 | (g0 << 5) | (r0 << 10) | (a0 << 15); 275 *(uint16*)(dst_rgb) = b0 | (g0 << 5) | (r0 << 10) | (a0 << 15); 274 276 } 275 277 } … … 286 288 uint8 r1 = src_argb[6] >> 4; 287 289 uint8 a1 = src_argb[7] >> 4; 288 *(uint32*)(dst_rgb) = 289 b0 | (g0 << 4) | (r0 << 8) | (a0 << 12) | 290 (b1 << 16) | (g1 << 20) | (r1 << 24) | (a1 << 28); 290 *(uint32*)(dst_rgb) = b0 | (g0 << 4) | (r0 << 8) | (a0 << 12) | (b1 << 16) | 291 (g1 << 20) | (r1 << 24) | (a1 << 28); 291 292 dst_rgb += 4; 292 293 src_argb += 8; … … 297 298 uint8 r0 = src_argb[2] >> 4; 298 299 uint8 a0 = src_argb[3] >> 4; 299 *(uint16*)(dst_rgb) = 300 b0 | (g0 << 4) | (r0 << 8) | (a0 << 12); 300 *(uint16*)(dst_rgb) = b0 | (g0 << 4) | (r0 << 8) | (a0 << 12); 301 301 } 302 302 } 303 303 304 304 static __inline int RGBToY(uint8 r, uint8 g, uint8 b) { 305 return (66 * r + 129 * g + 305 return (66 * r + 129 * g + 25 * b + 0x1080) >> 8; 306 306 } 307 307 … … 313 313 } 314 314 315 #define MAKEROWY(NAME, R, G, B, BPP) \ 316 void NAME ## ToYRow_C(const uint8* src_argb0, uint8* dst_y, int width) { \ 317 int x; \ 318 for (x = 0; x < width; ++x) { \ 319 dst_y[0] = RGBToY(src_argb0[R], src_argb0[G], src_argb0[B]); \ 320 src_argb0 += BPP; \ 321 dst_y += 1; \ 322 } \ 323 } \ 324 void NAME ## ToUVRow_C(const uint8* src_rgb0, int src_stride_rgb, \ 325 uint8* dst_u, uint8* dst_v, int width) { \ 326 const uint8* src_rgb1 = src_rgb0 + src_stride_rgb; \ 327 int x; \ 328 for (x = 0; x < width - 1; x += 2) { \ 329 uint8 ab = (src_rgb0[B] + src_rgb0[B + BPP] + \ 330 src_rgb1[B] + src_rgb1[B + BPP]) >> 2; \ 331 uint8 ag = (src_rgb0[G] + src_rgb0[G + BPP] + \ 332 src_rgb1[G] + src_rgb1[G + BPP]) >> 2; \ 333 uint8 ar = (src_rgb0[R] + src_rgb0[R + BPP] + \ 334 src_rgb1[R] + src_rgb1[R + BPP]) >> 2; \ 335 dst_u[0] = RGBToU(ar, ag, ab); \ 336 dst_v[0] = RGBToV(ar, ag, ab); \ 337 src_rgb0 += BPP * 2; \ 338 src_rgb1 += BPP * 2; \ 339 dst_u += 1; \ 340 dst_v += 1; \ 341 } \ 342 if (width & 1) { \ 343 uint8 ab = (src_rgb0[B] + src_rgb1[B]) >> 1; \ 344 uint8 ag = (src_rgb0[G] + src_rgb1[G]) >> 1; \ 345 uint8 ar = (src_rgb0[R] + src_rgb1[R]) >> 1; \ 346 dst_u[0] = RGBToU(ar, ag, ab); \ 347 dst_v[0] = RGBToV(ar, ag, ab); \ 348 } \ 349 } 315 // ARGBToY_C and ARGBToUV_C 316 #define MAKEROWY(NAME, R, G, B, BPP) \ 317 void NAME##ToYRow_C(const uint8* src_argb0, uint8* dst_y, int width) { \ 318 int x; \ 319 for (x = 0; x < width; ++x) { \ 320 dst_y[0] = RGBToY(src_argb0[R], src_argb0[G], src_argb0[B]); \ 321 src_argb0 += BPP; \ 322 dst_y += 1; \ 323 } \ 324 } \ 325 void NAME##ToUVRow_C(const uint8* src_rgb0, int src_stride_rgb, \ 326 uint8* dst_u, uint8* dst_v, int width) { \ 327 const uint8* src_rgb1 = src_rgb0 + src_stride_rgb; \ 328 int x; \ 329 for (x = 0; x < width - 1; x += 2) { \ 330 uint8 ab = (src_rgb0[B] + src_rgb0[B + BPP] + src_rgb1[B] + \ 331 src_rgb1[B + BPP]) >> \ 332 2; \ 333 uint8 ag = (src_rgb0[G] + src_rgb0[G + BPP] + src_rgb1[G] + \ 334 src_rgb1[G + BPP]) >> \ 335 2; \ 336 uint8 ar = (src_rgb0[R] + src_rgb0[R + BPP] + src_rgb1[R] + \ 337 src_rgb1[R + BPP]) >> \ 338 2; \ 339 dst_u[0] = RGBToU(ar, ag, ab); \ 340 dst_v[0] = RGBToV(ar, ag, ab); \ 341 src_rgb0 += BPP * 2; \ 342 src_rgb1 += BPP * 2; \ 343 dst_u += 1; \ 344 dst_v += 1; \ 345 } \ 346 if (width & 1) { \ 347 uint8 ab = (src_rgb0[B] + src_rgb1[B]) >> 1; \ 348 uint8 ag = (src_rgb0[G] + src_rgb1[G]) >> 1; \ 349 uint8 ar = (src_rgb0[R] + src_rgb1[R]) >> 1; \ 350 dst_u[0] = RGBToU(ar, ag, ab); \ 351 dst_v[0] = RGBToV(ar, ag, ab); \ 352 } \ 353 } 350 354 351 355 MAKEROWY(ARGB, 2, 1, 0, 4) … … 383 387 384 388 static __inline int RGBToYJ(uint8 r, uint8 g, uint8 b) { 385 return (38 * r + 75 * g + 389 return (38 * r + 75 * g + 15 * b + 64) >> 7; 386 390 } 387 391 … … 395 399 #define AVGB(a, b) (((a) + (b) + 1) >> 1) 396 400 397 #define MAKEROWYJ(NAME, R, G, B, BPP) \ 398 void NAME ## ToYJRow_C(const uint8* src_argb0, uint8* dst_y, int width) { \ 399 int x; \ 400 for (x = 0; x < width; ++x) { \ 401 dst_y[0] = RGBToYJ(src_argb0[R], src_argb0[G], src_argb0[B]); \ 402 src_argb0 += BPP; \ 403 dst_y += 1; \ 404 } \ 405 } \ 406 void NAME ## ToUVJRow_C(const uint8* src_rgb0, int src_stride_rgb, \ 407 uint8* dst_u, uint8* dst_v, int width) { \ 408 const uint8* src_rgb1 = src_rgb0 + src_stride_rgb; \ 409 int x; \ 410 for (x = 0; x < width - 1; x += 2) { \ 411 uint8 ab = AVGB(AVGB(src_rgb0[B], src_rgb1[B]), \ 412 AVGB(src_rgb0[B + BPP], src_rgb1[B + BPP])); \ 413 uint8 ag = AVGB(AVGB(src_rgb0[G], src_rgb1[G]), \ 414 AVGB(src_rgb0[G + BPP], src_rgb1[G + BPP])); \ 415 uint8 ar = AVGB(AVGB(src_rgb0[R], src_rgb1[R]), \ 416 AVGB(src_rgb0[R + BPP], src_rgb1[R + BPP])); \ 417 dst_u[0] = RGBToUJ(ar, ag, ab); \ 418 dst_v[0] = RGBToVJ(ar, ag, ab); \ 419 src_rgb0 += BPP * 2; \ 420 src_rgb1 += BPP * 2; \ 421 dst_u += 1; \ 422 dst_v += 1; \ 423 } \ 424 if (width & 1) { \ 425 uint8 ab = AVGB(src_rgb0[B], src_rgb1[B]); \ 426 uint8 ag = AVGB(src_rgb0[G], src_rgb1[G]); \ 427 uint8 ar = AVGB(src_rgb0[R], src_rgb1[R]); \ 428 dst_u[0] = RGBToUJ(ar, ag, ab); \ 429 dst_v[0] = RGBToVJ(ar, ag, ab); \ 430 } \ 431 } 401 // ARGBToYJ_C and ARGBToUVJ_C 402 #define MAKEROWYJ(NAME, R, G, B, BPP) \ 403 void NAME##ToYJRow_C(const uint8* src_argb0, uint8* dst_y, int width) { \ 404 int x; \ 405 for (x = 0; x < width; ++x) { \ 406 dst_y[0] = RGBToYJ(src_argb0[R], src_argb0[G], src_argb0[B]); \ 407 src_argb0 += BPP; \ 408 dst_y += 1; \ 409 } \ 410 } \ 411 void NAME##ToUVJRow_C(const uint8* src_rgb0, int src_stride_rgb, \ 412 uint8* dst_u, uint8* dst_v, int width) { \ 413 const uint8* src_rgb1 = src_rgb0 + src_stride_rgb; \ 414 int x; \ 415 for (x = 0; x < width - 1; x += 2) { \ 416 uint8 ab = AVGB(AVGB(src_rgb0[B], src_rgb1[B]), \ 417 AVGB(src_rgb0[B + BPP], src_rgb1[B + BPP])); \ 418 uint8 ag = AVGB(AVGB(src_rgb0[G], src_rgb1[G]), \ 419 AVGB(src_rgb0[G + BPP], src_rgb1[G + BPP])); \ 420 uint8 ar = AVGB(AVGB(src_rgb0[R], src_rgb1[R]), \ 421 AVGB(src_rgb0[R + BPP], src_rgb1[R + BPP])); \ 422 dst_u[0] = RGBToUJ(ar, ag, ab); \ 423 dst_v[0] = RGBToVJ(ar, ag, ab); \ 424 src_rgb0 += BPP * 2; \ 425 src_rgb1 += BPP * 2; \ 426 dst_u += 1; \ 427 dst_v += 1; \ 428 } \ 429 if (width & 1) { \ 430 uint8 ab = AVGB(src_rgb0[B], src_rgb1[B]); \ 431 uint8 ag = AVGB(src_rgb0[G], src_rgb1[G]); \ 432 uint8 ar = AVGB(src_rgb0[R], src_rgb1[R]); \ 433 dst_u[0] = RGBToUJ(ar, ag, ab); \ 434 dst_v[0] = RGBToVJ(ar, ag, ab); \ 435 } \ 436 } 432 437 433 438 MAKEROWYJ(ARGB, 2, 1, 0, 4) … … 479 484 } 480 485 481 void RGB565ToUVRow_C(const uint8* src_rgb565, int src_stride_rgb565, 482 uint8* dst_u, uint8* dst_v, int width) { 486 void RGB565ToUVRow_C(const uint8* src_rgb565, 487 int src_stride_rgb565, 488 uint8* dst_u, 489 uint8* dst_v, 490 int width) { 483 491 const uint8* next_rgb565 = src_rgb565 + src_stride_rgb565; 484 492 int x; … … 526 534 } 527 535 528 void ARGB1555ToUVRow_C(const uint8* src_argb1555, int src_stride_argb1555, 529 uint8* dst_u, uint8* dst_v, int width) { 536 void ARGB1555ToUVRow_C(const uint8* src_argb1555, 537 int src_stride_argb1555, 538 uint8* dst_u, 539 uint8* dst_v, 540 int width) { 530 541 const uint8* next_argb1555 = src_argb1555 + src_stride_argb1555; 531 542 int x; … … 574 585 } 575 586 576 void ARGB4444ToUVRow_C(const uint8* src_argb4444, int src_stride_argb4444, 577 uint8* dst_u, uint8* dst_v, int width) { 587 void ARGB4444ToUVRow_C(const uint8* src_argb4444, 588 int src_stride_argb4444, 589 uint8* dst_u, 590 uint8* dst_v, 591 int width) { 578 592 const uint8* next_argb4444 = src_argb4444 + src_stride_argb4444; 579 593 int x; … … 623 637 624 638 void ARGBToUV444Row_C(const uint8* src_argb, 625 uint8* dst_u, uint8* dst_v, int width) { 639 uint8* dst_u, 640 uint8* dst_v, 641 int width) { 626 642 int x; 627 643 for (x = 0; x < width; ++x) { … … 634 650 dst_u += 1; 635 651 dst_v += 1; 636 }637 }638 639 void ARGBToUV411Row_C(const uint8* src_argb,640 uint8* dst_u, uint8* dst_v, int width) {641 int x;642 for (x = 0; x < width - 3; x += 4) {643 uint8 ab = (src_argb[0] + src_argb[4] + src_argb[8] + src_argb[12]) >> 2;644 uint8 ag = (src_argb[1] + src_argb[5] + src_argb[9] + src_argb[13]) >> 2;645 uint8 ar = (src_argb[2] + src_argb[6] + src_argb[10] + src_argb[14]) >> 2;646 dst_u[0] = RGBToU(ar, ag, ab);647 dst_v[0] = RGBToV(ar, ag, ab);648 src_argb += 16;649 dst_u += 1;650 dst_v += 1;651 }652 // Odd width handling mimics 'any' function which replicates last pixel.653 if ((width & 3) == 3) {654 uint8 ab = (src_argb[0] + src_argb[4] + src_argb[8] + src_argb[8]) >> 2;655 uint8 ag = (src_argb[1] + src_argb[5] + src_argb[9] + src_argb[9]) >> 2;656 uint8 ar = (src_argb[2] + src_argb[6] + src_argb[10] + src_argb[10]) >> 2;657 dst_u[0] = RGBToU(ar, ag, ab);658 dst_v[0] = RGBToV(ar, ag, ab);659 } else if ((width & 3) == 2) {660 uint8 ab = (src_argb[0] + src_argb[4]) >> 1;661 uint8 ag = (src_argb[1] + src_argb[5]) >> 1;662 uint8 ar = (src_argb[2] + src_argb[6]) >> 1;663 dst_u[0] = RGBToU(ar, ag, ab);664 dst_v[0] = RGBToV(ar, ag, ab);665 } else if ((width & 3) == 1) {666 uint8 ab = src_argb[0];667 uint8 ag = src_argb[1];668 uint8 ar = src_argb[2];669 dst_u[0] = RGBToU(ar, ag, ab);670 dst_v[0] = RGBToV(ar, ag, ab);671 652 } 672 653 } … … 703 684 // Apply color matrix to a row of image. Matrix is signed. 704 685 // TODO(fbarchard): Consider adding rounding (+32). 705 void ARGBColorMatrixRow_C(const uint8* src_argb, uint8* dst_argb, 706 const int8* matrix_argb, int width) { 686 void ARGBColorMatrixRow_C(const uint8* src_argb, 687 uint8* dst_argb, 688 const int8* matrix_argb, 689 int width) { 707 690 int x; 708 691 for (x = 0; x < width; ++x) { … … 711 694 int r = src_argb[2]; 712 695 int a = src_argb[3]; 713 int sb = (b * matrix_argb[0] + g * matrix_argb[1] + 714 r * matrix_argb[2] + a * matrix_argb[3]) >> 6; 715 int sg = (b * matrix_argb[4] + g * matrix_argb[5] + 716 r * matrix_argb[6] + a * matrix_argb[7]) >> 6; 717 int sr = (b * matrix_argb[8] + g * matrix_argb[9] + 718 r * matrix_argb[10] + a * matrix_argb[11]) >> 6; 719 int sa = (b * matrix_argb[12] + g * matrix_argb[13] + 720 r * matrix_argb[14] + a * matrix_argb[15]) >> 6; 696 int sb = (b * matrix_argb[0] + g * matrix_argb[1] + r * matrix_argb[2] + 697 a * matrix_argb[3]) >> 698 6; 699 int sg = (b * matrix_argb[4] + g * matrix_argb[5] + r * matrix_argb[6] + 700 a * matrix_argb[7]) >> 701 6; 702 int sr = (b * matrix_argb[8] + g * matrix_argb[9] + r * matrix_argb[10] + 703 a * matrix_argb[11]) >> 704 6; 705 int sa = (b * matrix_argb[12] + g * matrix_argb[13] + r * matrix_argb[14] + 706 a * matrix_argb[15]) >> 707 6; 721 708 dst_argb[0] = Clamp(sb); 722 709 dst_argb[1] = Clamp(sg); … … 758 745 } 759 746 760 void ARGBQuantizeRow_C(uint8* dst_argb, int scale, int interval_size, 761 int interval_offset, int width) { 747 void ARGBQuantizeRow_C(uint8* dst_argb, 748 int scale, 749 int interval_size, 750 int interval_offset, 751 int width) { 762 752 int x; 763 753 for (x = 0; x < width; ++x) { … … 773 763 774 764 #define REPEAT8(v) (v) | ((v) << 8) 775 #define SHADE(f, v) v * f >> 24 776 777 void ARGBShadeRow_C(const uint8* src_argb, uint8* dst_argb, int width, 765 #define SHADE(f, v) v* f >> 24 766 767 void ARGBShadeRow_C(const uint8* src_argb, 768 uint8* dst_argb, 769 int width, 778 770 uint32 value) { 779 771 const uint32 b_scale = REPEAT8(value & 0xff); … … 800 792 801 793 #define REPEAT8(v) (v) | ((v) << 8) 802 #define SHADE(f, v) v * f >> 16 803 804 void ARGBMultiplyRow_C(const uint8* src_argb0, const uint8* src_argb1, 805 uint8* dst_argb, int width) { 794 #define SHADE(f, v) v* f >> 16 795 796 void ARGBMultiplyRow_C(const uint8* src_argb0, 797 const uint8* src_argb1, 798 uint8* dst_argb, 799 int width) { 806 800 int i; 807 801 for (i = 0; i < width; ++i) { … … 828 822 #define SHADE(f, v) clamp255(v + f) 829 823 830 void ARGBAddRow_C(const uint8* src_argb0, const uint8* src_argb1, 831 uint8* dst_argb, int width) { 824 void ARGBAddRow_C(const uint8* src_argb0, 825 const uint8* src_argb1, 826 uint8* dst_argb, 827 int width) { 832 828 int i; 833 829 for (i = 0; i < width; ++i) { … … 853 849 #define SHADE(f, v) clamp0(f - v) 854 850 855 void ARGBSubtractRow_C(const uint8* src_argb0, const uint8* src_argb1, 856 uint8* dst_argb, int width) { 851 void ARGBSubtractRow_C(const uint8* src_argb0, 852 const uint8* src_argb1, 853 uint8* dst_argb, 854 int width) { 857 855 int i; 858 856 for (i = 0; i < width; ++i) { … … 877 875 878 876 // Sobel functions which mimics SSSE3. 879 void SobelXRow_C(const uint8* src_y0, const uint8* src_y1, const uint8* src_y2, 880 uint8* dst_sobelx, int width) { 877 void SobelXRow_C(const uint8* src_y0, 878 const uint8* src_y1, 879 const uint8* src_y2, 880 uint8* dst_sobelx, 881 int width) { 881 882 int i; 882 883 for (i = 0; i < width; ++i) { … … 895 896 } 896 897 897 void SobelYRow_C(const uint8* src_y0, const uint8* src_y1, 898 uint8* dst_sobely, int width) { 898 void SobelYRow_C(const uint8* src_y0, 899 const uint8* src_y1, 900 uint8* dst_sobely, 901 int width) { 899 902 int i; 900 903 for (i = 0; i < width; ++i) { … … 913 916 } 914 917 915 void SobelRow_C(const uint8* src_sobelx, const uint8* src_sobely, 916 uint8* dst_argb, int width) { 918 void SobelRow_C(const uint8* src_sobelx, 919 const uint8* src_sobely, 920 uint8* dst_argb, 921 int width) { 917 922 int i; 918 923 for (i = 0; i < width; ++i) { … … 928 933 } 929 934 930 void SobelToPlaneRow_C(const uint8* src_sobelx, const uint8* src_sobely, 931 uint8* dst_y, int width) { 935 void SobelToPlaneRow_C(const uint8* src_sobelx, 936 const uint8* src_sobely, 937 uint8* dst_y, 938 int width) { 932 939 int i; 933 940 for (i = 0; i < width; ++i) { … … 939 946 } 940 947 941 void SobelXYRow_C(const uint8* src_sobelx, const uint8* src_sobely, 942 uint8* dst_argb, int width) { 948 void SobelXYRow_C(const uint8* src_sobelx, 949 const uint8* src_sobely, 950 uint8* dst_argb, 951 int width) { 943 952 int i; 944 953 for (i = 0; i < width; ++i) { … … 975 984 976 985 // Y contribution to R,G,B. Scale and bias. 977 #define YG 18997 /* round(1.164 * 64 * 256 * 256 / 257) */986 #define YG 18997 /* round(1.164 * 64 * 256 * 256 / 257) */ 978 987 #define YGB -1160 /* 1.164 * 64 * -16 + 64 / 2 */ 979 988 980 989 // U and V contributions to R,G,B. 981 990 #define UB -128 /* max(-128, round(-2.018 * 64)) */ 982 #define UG 25 /* round(0.391 * 64) */983 #define VG 52 /* round(0.813 * 64) */991 #define UG 25 /* round(0.391 * 64) */ 992 #define VG 52 /* round(0.813 * 64) */ 984 993 #define VR -102 /* round(-1.596 * 64) */ 985 994 986 995 // Bias values to subtract 16 from Y and 128 from U and V. 987 #define BB (UB * 128 996 #define BB (UB * 128 + YGB) 988 997 #define BG (UG * 128 + VG * 128 + YGB) 989 #define BR (VR * 128 + YGB) 990 991 #if defined(__aarch64__) 992 const YuvConstants SIMD_ALIGNED(kYuvI601Constants) = { 993 { -UB, -VR, -UB, -VR, -UB, -VR, -UB, -VR }, 994 { -UB, -VR, -UB, -VR, -UB, -VR, -UB, -VR }, 995 { UG, VG, UG, VG, UG, VG, UG, VG }, 996 { UG, VG, UG, VG, UG, VG, UG, VG }, 997 { BB, BG, BR, 0, 0, 0, 0, 0 }, 998 { 0x0101 * YG, 0, 0, 0 } 999 }; 1000 const YuvConstants SIMD_ALIGNED(kYvuI601Constants) = { 1001 { -VR, -UB, -VR, -UB, -VR, -UB, -VR, -UB }, 1002 { -VR, -UB, -VR, -UB, -VR, -UB, -VR, -UB }, 1003 { VG, UG, VG, UG, VG, UG, VG, UG }, 1004 { VG, UG, VG, UG, VG, UG, VG, UG }, 1005 { BR, BG, BB, 0, 0, 0, 0, 0 }, 1006 { 0x0101 * YG, 0, 0, 0 } 1007 }; 1008 #elif defined(__arm__) 1009 const YuvConstants SIMD_ALIGNED(kYuvI601Constants) = { 1010 { -UB, -UB, -UB, -UB, -VR, -VR, -VR, -VR, 0, 0, 0, 0, 0, 0, 0, 0 }, 1011 { UG, UG, UG, UG, VG, VG, VG, VG, 0, 0, 0, 0, 0, 0, 0, 0 }, 1012 { BB, BG, BR, 0, 0, 0, 0, 0 }, 1013 { 0x0101 * YG, 0, 0, 0 } 1014 }; 1015 const YuvConstants SIMD_ALIGNED(kYvuI601Constants) = { 1016 { -VR, -VR, -VR, -VR, -UB, -UB, -UB, -UB, 0, 0, 0, 0, 0, 0, 0, 0 }, 1017 { VG, VG, VG, VG, UG, UG, UG, UG, 0, 0, 0, 0, 0, 0, 0, 0 }, 1018 { BR, BG, BB, 0, 0, 0, 0, 0 }, 1019 { 0x0101 * YG, 0, 0, 0 } 1020 }; 998 #define BR (VR * 128 + YGB) 999 1000 #if defined(__aarch64__) // 64 bit arm 1001 const struct YuvConstants SIMD_ALIGNED(kYuvI601Constants) = { 1002 {-UB, -VR, -UB, -VR, -UB, -VR, -UB, -VR}, 1003 {-UB, -VR, -UB, -VR, -UB, -VR, -UB, -VR}, 1004 {UG, VG, UG, VG, UG, VG, UG, VG}, 1005 {UG, VG, UG, VG, UG, VG, UG, VG}, 1006 {BB, BG, BR, 0, 0, 0, 0, 0}, 1007 {0x0101 * YG, 0, 0, 0}}; 1008 const struct YuvConstants SIMD_ALIGNED(kYvuI601Constants) = { 1009 {-VR, -UB, -VR, -UB, -VR, -UB, -VR, -UB}, 1010 {-VR, -UB, -VR, -UB, -VR, -UB, -VR, -UB}, 1011 {VG, UG, VG, UG, VG, UG, VG, UG}, 1012 {VG, UG, VG, UG, VG, UG, VG, UG}, 1013 {BR, BG, BB, 0, 0, 0, 0, 0}, 1014 {0x0101 * YG, 0, 0, 0}}; 1015 #elif defined(__arm__) // 32 bit arm 1016 const struct YuvConstants SIMD_ALIGNED(kYuvI601Constants) = { 1017 {-UB, -UB, -UB, -UB, -VR, -VR, -VR, -VR, 0, 0, 0, 0, 0, 0, 0, 0}, 1018 {UG, UG, UG, UG, VG, VG, VG, VG, 0, 0, 0, 0, 0, 0, 0, 0}, 1019 {BB, BG, BR, 0, 0, 0, 0, 0}, 1020 {0x0101 * YG, 0, 0, 0}}; 1021 const struct YuvConstants SIMD_ALIGNED(kYvuI601Constants) = { 1022 {-VR, -VR, -VR, -VR, -UB, -UB, -UB, -UB, 0, 0, 0, 0, 0, 0, 0, 0}, 1023 {VG, VG, VG, VG, UG, UG, UG, UG, 0, 0, 0, 0, 0, 0, 0, 0}, 1024 {BR, BG, BB, 0, 0, 0, 0, 0}, 1025 {0x0101 * YG, 0, 0, 0}}; 1021 1026 #else 1022 const YuvConstants SIMD_ALIGNED(kYuvI601Constants) = { 1023 { UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, 1024 UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0 }, 1025 { UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, 1026 UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG }, 1027 { 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 1028 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR }, 1029 { BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB }, 1030 { BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG }, 1031 { BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR }, 1032 { YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG } 1033 }; 1034 const YuvConstants SIMD_ALIGNED(kYvuI601Constants) = { 1035 { VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, 1036 VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0 }, 1037 { VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, 1038 VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG }, 1039 { 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 1040 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB }, 1041 { BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR }, 1042 { BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG }, 1043 { BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB }, 1044 { YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG } 1045 }; 1027 const struct YuvConstants SIMD_ALIGNED(kYuvI601Constants) = { 1028 {UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, 1029 UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0}, 1030 {UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, 1031 UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG}, 1032 {0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 1033 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR}, 1034 {BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB}, 1035 {BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG}, 1036 {BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR}, 1037 {YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG}}; 1038 const struct YuvConstants SIMD_ALIGNED(kYvuI601Constants) = { 1039 {VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, 1040 VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0}, 1041 {VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, 1042 VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG}, 1043 {0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 1044 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB}, 1045 {BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR}, 1046 {BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG}, 1047 {BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB}, 1048 {YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG}}; 1046 1049 #endif 1047 1050 … … 1063 1066 // Y contribution to R,G,B. Scale and bias. 1064 1067 #define YG 16320 /* round(1.000 * 64 * 256 * 256 / 257) */ 1065 #define YGB 32 /* 64 / 2 */1068 #define YGB 32 /* 64 / 2 */ 1066 1069 1067 1070 // U and V contributions to R,G,B. 1068 1071 #define UB -113 /* round(-1.77200 * 64) */ 1069 #define UG 22 /* round(0.34414 * 64) */1070 #define VG 46 /* round(0.71414 * 64) */1071 #define VR -90 /* round(-1.40200 * 64) */1072 #define UG 22 /* round(0.34414 * 64) */ 1073 #define VG 46 /* round(0.71414 * 64) */ 1074 #define VR -90 /* round(-1.40200 * 64) */ 1072 1075 1073 1076 // Bias values to round, and subtract 128 from U and V. 1074 #define BB (UB * 128 1077 #define BB (UB * 128 + YGB) 1075 1078 #define BG (UG * 128 + VG * 128 + YGB) 1076 #define BR 1079 #define BR (VR * 128 + YGB) 1077 1080 1078 1081 #if defined(__aarch64__) 1079 const YuvConstants SIMD_ALIGNED(kYuvJPEGConstants) = { 1080 { -UB, -VR, -UB, -VR, -UB, -VR, -UB, -VR }, 1081 { -UB, -VR, -UB, -VR, -UB, -VR, -UB, -VR }, 1082 { UG, VG, UG, VG, UG, VG, UG, VG }, 1083 { UG, VG, UG, VG, UG, VG, UG, VG }, 1084 { BB, BG, BR, 0, 0, 0, 0, 0 }, 1085 { 0x0101 * YG, 0, 0, 0 } 1086 }; 1087 const YuvConstants SIMD_ALIGNED(kYvuJPEGConstants) = { 1088 { -VR, -UB, -VR, -UB, -VR, -UB, -VR, -UB }, 1089 { -VR, -UB, -VR, -UB, -VR, -UB, -VR, -UB }, 1090 { VG, UG, VG, UG, VG, UG, VG, UG }, 1091 { VG, UG, VG, UG, VG, UG, VG, UG }, 1092 { BR, BG, BB, 0, 0, 0, 0, 0 }, 1093 { 0x0101 * YG, 0, 0, 0 } 1094 }; 1082 const struct YuvConstants SIMD_ALIGNED(kYuvJPEGConstants) = { 1083 {-UB, -VR, -UB, -VR, -UB, -VR, -UB, -VR}, 1084 {-UB, -VR, -UB, -VR, -UB, -VR, -UB, -VR}, 1085 {UG, VG, UG, VG, UG, VG, UG, VG}, 1086 {UG, VG, UG, VG, UG, VG, UG, VG}, 1087 {BB, BG, BR, 0, 0, 0, 0, 0}, 1088 {0x0101 * YG, 0, 0, 0}}; 1089 const struct YuvConstants SIMD_ALIGNED(kYvuJPEGConstants) = { 1090 {-VR, -UB, -VR, -UB, -VR, -UB, -VR, -UB}, 1091 {-VR, -UB, -VR, -UB, -VR, -UB, -VR, -UB}, 1092 {VG, UG, VG, UG, VG, UG, VG, UG}, 1093 {VG, UG, VG, UG, VG, UG, VG, UG}, 1094 {BR, BG, BB, 0, 0, 0, 0, 0}, 1095 {0x0101 * YG, 0, 0, 0}}; 1095 1096 #elif defined(__arm__) 1096 const YuvConstants SIMD_ALIGNED(kYuvJPEGConstants) = { 1097 { -UB, -UB, -UB, -UB, -VR, -VR, -VR, -VR, 0, 0, 0, 0, 0, 0, 0, 0 }, 1098 { UG, UG, UG, UG, VG, VG, VG, VG, 0, 0, 0, 0, 0, 0, 0, 0 }, 1099 { BB, BG, BR, 0, 0, 0, 0, 0 }, 1100 { 0x0101 * YG, 0, 0, 0 } 1101 }; 1102 const YuvConstants SIMD_ALIGNED(kYvuJPEGConstants) = { 1103 { -VR, -VR, -VR, -VR, -UB, -UB, -UB, -UB, 0, 0, 0, 0, 0, 0, 0, 0 }, 1104 { VG, VG, VG, VG, UG, UG, UG, UG, 0, 0, 0, 0, 0, 0, 0, 0 }, 1105 { BR, BG, BB, 0, 0, 0, 0, 0 }, 1106 { 0x0101 * YG, 0, 0, 0 } 1107 }; 1097 const struct YuvConstants SIMD_ALIGNED(kYuvJPEGConstants) = { 1098 {-UB, -UB, -UB, -UB, -VR, -VR, -VR, -VR, 0, 0, 0, 0, 0, 0, 0, 0}, 1099 {UG, UG, UG, UG, VG, VG, VG, VG, 0, 0, 0, 0, 0, 0, 0, 0}, 1100 {BB, BG, BR, 0, 0, 0, 0, 0}, 1101 {0x0101 * YG, 0, 0, 0}}; 1102 const struct YuvConstants SIMD_ALIGNED(kYvuJPEGConstants) = { 1103 {-VR, -VR, -VR, -VR, -UB, -UB, -UB, -UB, 0, 0, 0, 0, 0, 0, 0, 0}, 1104 {VG, VG, VG, VG, UG, UG, UG, UG, 0, 0, 0, 0, 0, 0, 0, 0}, 1105 {BR, BG, BB, 0, 0, 0, 0, 0}, 1106 {0x0101 * YG, 0, 0, 0}}; 1108 1107 #else 1109 const YuvConstants SIMD_ALIGNED(kYuvJPEGConstants) = { 1110 { UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, 1111 UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0 }, 1112 { UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, 1113 UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG }, 1114 { 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 1115 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR }, 1116 { BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB }, 1117 { BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG }, 1118 { BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR }, 1119 { YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG } 1120 }; 1121 const YuvConstants SIMD_ALIGNED(kYvuJPEGConstants) = { 1122 { VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, 1123 VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0 }, 1124 { VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, 1125 VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG }, 1126 { 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 1127 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB }, 1128 { BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR }, 1129 { BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG }, 1130 { BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB }, 1131 { YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG } 1132 }; 1108 const struct YuvConstants SIMD_ALIGNED(kYuvJPEGConstants) = { 1109 {UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, 1110 UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0}, 1111 {UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, 1112 UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG}, 1113 {0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 1114 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR}, 1115 {BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB}, 1116 {BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG}, 1117 {BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR}, 1118 {YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG}}; 1119 const struct YuvConstants SIMD_ALIGNED(kYvuJPEGConstants) = { 1120 {VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, 1121 VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0}, 1122 {VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, 1123 VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG}, 1124 {0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 1125 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB}, 1126 {BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR}, 1127 {BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG}, 1128 {BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB}, 1129 {YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG}}; 1133 1130 #endif 1134 1131 … … 1144 1141 1145 1142 // BT.709 YUV to RGB reference 1146 // * R = Y - V * -1.28033 1147 // * G = Y - U * 0.21482 - V * 0.38059 1148 // * B = Y - U * -2.12798 1143 // R = (Y - 16) * 1.164 - V * -1.793 1144 // G = (Y - 16) * 1.164 - U * 0.213 - V * 0.533 1145 // B = (Y - 16) * 1.164 - U * -2.112 1146 // See also http://www.equasys.de/colorconversion.html 1149 1147 1150 1148 // Y contribution to R,G,B. Scale and bias. 1151 #define YG 1 6320 /* round(1.000* 64 * 256 * 256 / 257) */1152 #define YGB 32 /*64 / 2 */1153 1154 // TODO(fbarchard): Find way to express 2.1 2 instead of 2.0.1149 #define YG 18997 /* round(1.164 * 64 * 256 * 256 / 257) */ 1150 #define YGB -1160 /* 1.164 * 64 * -16 + 64 / 2 */ 1151 1152 // TODO(fbarchard): Find way to express 2.112 instead of 2.0. 1155 1153 // U and V contributions to R,G,B. 1156 #define UB -128 /* max(-128, round(-2.1 2798* 64)) */1157 #define UG 14 /* round(0.21482* 64) */1158 #define VG 24 /* round(0.38059* 64) */1159 #define VR - 82 /* round(-1.28033 * 64) */1154 #define UB -128 /* max(-128, round(-2.112 * 64)) */ 1155 #define UG 14 /* round(0.213 * 64) */ 1156 #define VG 34 /* round(0.533 * 64) */ 1157 #define VR -115 /* round(-1.793 * 64) */ 1160 1158 1161 1159 // Bias values to round, and subtract 128 from U and V. 1162 #define BB (UB * 128 1160 #define BB (UB * 128 + YGB) 1163 1161 #define BG (UG * 128 + VG * 128 + YGB) 1164 #define BR 1162 #define BR (VR * 128 + YGB) 1165 1163 1166 1164 #if defined(__aarch64__) 1167 const YuvConstants SIMD_ALIGNED(kYuvH709Constants) = { 1168 { -UB, -VR, -UB, -VR, -UB, -VR, -UB, -VR }, 1169 { -UB, -VR, -UB, -VR, -UB, -VR, -UB, -VR }, 1170 { UG, VG, UG, VG, UG, VG, UG, VG }, 1171 { UG, VG, UG, VG, UG, VG, UG, VG }, 1172 { BB, BG, BR, 0, 0, 0, 0, 0 }, 1173 { 0x0101 * YG, 0, 0, 0 } 1174 }; 1175 const YuvConstants SIMD_ALIGNED(kYvuH709Constants) = { 1176 { -VR, -UB, -VR, -UB, -VR, -UB, -VR, -UB }, 1177 { -VR, -UB, -VR, -UB, -VR, -UB, -VR, -UB }, 1178 { VG, UG, VG, UG, VG, UG, VG, UG }, 1179 { VG, UG, VG, UG, VG, UG, VG, UG }, 1180 { BR, BG, BB, 0, 0, 0, 0, 0 }, 1181 { 0x0101 * YG, 0, 0, 0 } 1182 }; 1165 const struct YuvConstants SIMD_ALIGNED(kYuvH709Constants) = { 1166 {-UB, -VR, -UB, -VR, -UB, -VR, -UB, -VR}, 1167 {-UB, -VR, -UB, -VR, -UB, -VR, -UB, -VR}, 1168 {UG, VG, UG, VG, UG, VG, UG, VG}, 1169 {UG, VG, UG, VG, UG, VG, UG, VG}, 1170 {BB, BG, BR, 0, 0, 0, 0, 0}, 1171 {0x0101 * YG, 0, 0, 0}}; 1172 const struct YuvConstants SIMD_ALIGNED(kYvuH709Constants) = { 1173 {-VR, -UB, -VR, -UB, -VR, -UB, -VR, -UB}, 1174 {-VR, -UB, -VR, -UB, -VR, -UB, -VR, -UB}, 1175 {VG, UG, VG, UG, VG, UG, VG, UG}, 1176 {VG, UG, VG, UG, VG, UG, VG, UG}, 1177 {BR, BG, BB, 0, 0, 0, 0, 0}, 1178 {0x0101 * YG, 0, 0, 0}}; 1183 1179 #elif defined(__arm__) 1184 const YuvConstants SIMD_ALIGNED(kYuvH709Constants) = { 1185 { -UB, -UB, -UB, -UB, -VR, -VR, -VR, -VR, 0, 0, 0, 0, 0, 0, 0, 0 }, 1186 { UG, UG, UG, UG, VG, VG, VG, VG, 0, 0, 0, 0, 0, 0, 0, 0 }, 1187 { BB, BG, BR, 0, 0, 0, 0, 0 }, 1188 { 0x0101 * YG, 0, 0, 0 } 1189 }; 1190 const YuvConstants SIMD_ALIGNED(kYvuH709Constants) = { 1191 { -VR, -VR, -VR, -VR, -UB, -UB, -UB, -UB, 0, 0, 0, 0, 0, 0, 0, 0 }, 1192 { VG, VG, VG, VG, UG, UG, UG, UG, 0, 0, 0, 0, 0, 0, 0, 0 }, 1193 { BR, BG, BB, 0, 0, 0, 0, 0 }, 1194 { 0x0101 * YG, 0, 0, 0 } 1195 }; 1180 const struct YuvConstants SIMD_ALIGNED(kYuvH709Constants) = { 1181 {-UB, -UB, -UB, -UB, -VR, -VR, -VR, -VR, 0, 0, 0, 0, 0, 0, 0, 0}, 1182 {UG, UG, UG, UG, VG, VG, VG, VG, 0, 0, 0, 0, 0, 0, 0, 0}, 1183 {BB, BG, BR, 0, 0, 0, 0, 0}, 1184 {0x0101 * YG, 0, 0, 0}}; 1185 const struct YuvConstants SIMD_ALIGNED(kYvuH709Constants) = { 1186 {-VR, -VR, -VR, -VR, -UB, -UB, -UB, -UB, 0, 0, 0, 0, 0, 0, 0, 0}, 1187 {VG, VG, VG, VG, UG, UG, UG, UG, 0, 0, 0, 0, 0, 0, 0, 0}, 1188 {BR, BG, BB, 0, 0, 0, 0, 0}, 1189 {0x0101 * YG, 0, 0, 0}}; 1196 1190 #else 1197 const YuvConstants SIMD_ALIGNED(kYuvH709Constants) = { 1198 { UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, 1199 UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0 }, 1200 { UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, 1201 UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG }, 1202 { 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 1203 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR }, 1204 { BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB }, 1205 { BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG }, 1206 { BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR }, 1207 { YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG } 1208 }; 1209 const YuvConstants SIMD_ALIGNED(kYvuH709Constants) = { 1210 { VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, 1211 VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0 }, 1212 { VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, 1213 VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG }, 1214 { 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 1215 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB }, 1216 { BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR }, 1217 { BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG }, 1218 { BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB }, 1219 { YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG } 1220 }; 1191 const struct YuvConstants SIMD_ALIGNED(kYuvH709Constants) = { 1192 {UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, 1193 UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0}, 1194 {UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, 1195 UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG}, 1196 {0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 1197 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR}, 1198 {BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB}, 1199 {BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG}, 1200 {BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR}, 1201 {YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG}}; 1202 const struct YuvConstants SIMD_ALIGNED(kYvuH709Constants) = { 1203 {VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, 1204 VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0}, 1205 {VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, 1206 VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG}, 1207 {0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 1208 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB}, 1209 {BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR}, 1210 {BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG}, 1211 {BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB}, 1212 {YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG}}; 1221 1213 #endif 1222 1214 … … 1232 1224 1233 1225 // C reference code that mimics the YUV assembly. 1234 static __inline void YuvPixel(uint8 y, uint8 u, uint8 v, 1235 uint8* b, uint8* g, uint8* r, 1226 static __inline void YuvPixel(uint8 y, 1227 uint8 u, 1228 uint8 v, 1229 uint8* b, 1230 uint8* g, 1231 uint8* r, 1236 1232 const struct YuvConstants* yuvconstants) { 1237 1233 #if defined(__aarch64__) … … 1265 1261 1266 1262 uint32 y1 = (uint32)(y * 0x0101 * yg) >> 16; 1267 *b = Clamp((int32)(-(u * ub 1263 *b = Clamp((int32)(-(u * ub) + y1 + bb) >> 6); 1268 1264 *g = Clamp((int32)(-(u * ug + v * vg) + y1 + bg) >> 6); 1269 *r = Clamp((int32)(-( 1265 *r = Clamp((int32)(-(v * vr) + y1 + br) >> 6); 1270 1266 } 1271 1267 1272 1268 // Y contribution to R,G,B. Scale and bias. 1273 #define YG 18997 /* round(1.164 * 64 * 256 * 256 / 257) */1269 #define YG 18997 /* round(1.164 * 64 * 256 * 256 / 257) */ 1274 1270 #define YGB -1160 /* 1.164 * 64 * -16 + 64 / 2 */ 1275 1271 … … 1311 1307 } 1312 1308 if (width & 1) { 1313 YuvPixel(src_y[0], src_u[0], src_v[0], 1314 rgb_buf + 0, rgb_buf + 1, rgb_buf +2, yuvconstants);1309 YuvPixel(src_y[0], src_u[0], src_v[0], rgb_buf + 0, rgb_buf + 1, 1310 rgb_buf + 2, yuvconstants); 1315 1311 rgb_buf[3] = 255; 1316 1312 } … … 1325 1321 int x; 1326 1322 for (x = 0; x < width; ++x) { 1327 YuvPixel(src_y[0], src_u[0], src_v[0], 1328 rgb_buf + 0, rgb_buf + 1, rgb_buf +2, yuvconstants);1323 YuvPixel(src_y[0], src_u[0], src_v[0], rgb_buf + 0, rgb_buf + 1, 1324 rgb_buf + 2, yuvconstants); 1329 1325 rgb_buf[3] = 255; 1330 1326 src_y += 1; … … 1345 1341 int x; 1346 1342 for (x = 0; x < width - 1; x += 2) { 1347 YuvPixel(src_y[0], src_u[0], src_v[0], 1348 rgb_buf + 0, rgb_buf + 1, rgb_buf +2, yuvconstants);1343 YuvPixel(src_y[0], src_u[0], src_v[0], rgb_buf + 0, rgb_buf + 1, 1344 rgb_buf + 2, yuvconstants); 1349 1345 rgb_buf[3] = 255; 1350 YuvPixel(src_y[1], src_u[0], src_v[0], 1351 rgb_buf + 4, rgb_buf + 5, rgb_buf +6, yuvconstants);1346 YuvPixel(src_y[1], src_u[0], src_v[0], rgb_buf + 4, rgb_buf + 5, 1347 rgb_buf + 6, yuvconstants); 1352 1348 rgb_buf[7] = 255; 1353 1349 src_y += 2; … … 1357 1353 } 1358 1354 if (width & 1) { 1359 YuvPixel(src_y[0], src_u[0], src_v[0], 1360 rgb_buf + 0, rgb_buf + 1, rgb_buf +2, yuvconstants);1355 YuvPixel(src_y[0], src_u[0], src_v[0], rgb_buf + 0, rgb_buf + 1, 1356 rgb_buf + 2, yuvconstants); 1361 1357 rgb_buf[3] = 255; 1362 1358 } … … 1372 1368 int x; 1373 1369 for (x = 0; x < width - 1; x += 2) { 1374 YuvPixel(src_y[0], src_u[0], src_v[0], 1375 rgb_buf + 0, rgb_buf + 1, rgb_buf +2, yuvconstants);1370 YuvPixel(src_y[0], src_u[0], src_v[0], rgb_buf + 0, rgb_buf + 1, 1371 rgb_buf + 2, yuvconstants); 1376 1372 rgb_buf[3] = src_a[0]; 1377 YuvPixel(src_y[1], src_u[0], src_v[0], 1378 rgb_buf + 4, rgb_buf + 5, rgb_buf +6, yuvconstants);1373 YuvPixel(src_y[1], src_u[0], src_v[0], rgb_buf + 4, rgb_buf + 5, 1374 rgb_buf + 6, yuvconstants); 1379 1375 rgb_buf[7] = src_a[1]; 1380 1376 src_y += 2; … … 1385 1381 } 1386 1382 if (width & 1) { 1387 YuvPixel(src_y[0], src_u[0], src_v[0], 1388 rgb_buf + 0, rgb_buf + 1, rgb_buf +2, yuvconstants);1383 YuvPixel(src_y[0], src_u[0], src_v[0], rgb_buf + 0, rgb_buf + 1, 1384 rgb_buf + 2, yuvconstants); 1389 1385 rgb_buf[3] = src_a[0]; 1390 1386 } … … 1399 1395 int x; 1400 1396 for (x = 0; x < width - 1; x += 2) { 1401 YuvPixel(src_y[0], src_u[0], src_v[0], 1402 rgb_buf + 0, rgb_buf + 1, rgb_buf +2, yuvconstants);1403 YuvPixel(src_y[1], src_u[0], src_v[0], 1404 rgb_buf + 3, rgb_buf + 4, rgb_buf +5, yuvconstants);1397 YuvPixel(src_y[0], src_u[0], src_v[0], rgb_buf + 0, rgb_buf + 1, 1398 rgb_buf + 2, yuvconstants); 1399 YuvPixel(src_y[1], src_u[0], src_v[0], rgb_buf + 3, rgb_buf + 4, 1400 rgb_buf + 5, yuvconstants); 1405 1401 src_y += 2; 1406 1402 src_u += 1; … … 1409 1405 } 1410 1406 if (width & 1) { 1411 YuvPixel(src_y[0], src_u[0], src_v[0], 1412 rgb_buf + 0, rgb_buf + 1, rgb_buf +2, yuvconstants);1407 YuvPixel(src_y[0], src_u[0], src_v[0], rgb_buf + 0, rgb_buf + 1, 1408 rgb_buf + 2, yuvconstants); 1413 1409 } 1414 1410 } … … 1436 1432 g1 = g1 >> 4; 1437 1433 r1 = r1 >> 4; 1438 *(uint32*)(dst_argb4444) = b0 | (g0 << 4) | (r0 << 8) | 1439 (b1 << 16) |(g1 << 20) | (r1 << 24) | 0xf000f000;1434 *(uint32*)(dst_argb4444) = b0 | (g0 << 4) | (r0 << 8) | (b1 << 16) | 1435 (g1 << 20) | (r1 << 24) | 0xf000f000; 1440 1436 src_y += 2; 1441 1437 src_u += 1; … … 1448 1444 g0 = g0 >> 4; 1449 1445 r0 = r0 >> 4; 1450 *(uint16*)(dst_argb4444) = b0 | (g0 << 4) | (r0 << 8) | 1451 0xf000; 1446 *(uint16*)(dst_argb4444) = b0 | (g0 << 4) | (r0 << 8) | 0xf000; 1452 1447 } 1453 1448 } … … 1475 1470 g1 = g1 >> 3; 1476 1471 r1 = r1 >> 3; 1477 *(uint32*)(dst_argb1555) = b0 | (g0 << 5) | (r0 << 10) | 1478 (b1 << 16) |(g1 << 21) | (r1 << 26) | 0x80008000;1472 *(uint32*)(dst_argb1555) = b0 | (g0 << 5) | (r0 << 10) | (b1 << 16) | 1473 (g1 << 21) | (r1 << 26) | 0x80008000; 1479 1474 src_y += 2; 1480 1475 src_u += 1; … … 1487 1482 g0 = g0 >> 3; 1488 1483 r0 = r0 >> 3; 1489 *(uint16*)(dst_argb1555) = b0 | (g0 << 5) | (r0 << 10) | 1490 0x8000; 1484 *(uint16*)(dst_argb1555) = b0 | (g0 << 5) | (r0 << 10) | 0x8000; 1491 1485 } 1492 1486 } … … 1514 1508 g1 = g1 >> 2; 1515 1509 r1 = r1 >> 3; 1516 *(uint32*)(dst_rgb565) = b0 | (g0 << 5) | (r0 << 11) |1517 (b1 << 16) | (g1 << 21) | (r1 << 27);1510 *(uint32*)(dst_rgb565) = 1511 b0 | (g0 << 5) | (r0 << 11) | (b1 << 16) | (g1 << 21) | (r1 << 27); 1518 1512 src_y += 2; 1519 1513 src_u += 1; … … 1530 1524 } 1531 1525 1532 void I411ToARGBRow_C(const uint8* src_y,1533 const uint8* src_u,1534 const uint8* src_v,1535 uint8* rgb_buf,1536 const struct YuvConstants* yuvconstants,1537 int width) {1538 int x;1539 for (x = 0; x < width - 3; x += 4) {1540 YuvPixel(src_y[0], src_u[0], src_v[0],1541 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants);1542 rgb_buf[3] = 255;1543 YuvPixel(src_y[1], src_u[0], src_v[0],1544 rgb_buf + 4, rgb_buf + 5, rgb_buf + 6, yuvconstants);1545 rgb_buf[7] = 255;1546 YuvPixel(src_y[2], src_u[0], src_v[0],1547 rgb_buf + 8, rgb_buf + 9, rgb_buf + 10, yuvconstants);1548 rgb_buf[11] = 255;1549 YuvPixel(src_y[3], src_u[0], src_v[0],1550 rgb_buf + 12, rgb_buf + 13, rgb_buf + 14, yuvconstants);1551 rgb_buf[15] = 255;1552 src_y += 4;1553 src_u += 1;1554 src_v += 1;1555 rgb_buf += 16; // Advance 4 pixels.1556 }1557 if (width & 2) {1558 YuvPixel(src_y[0], src_u[0], src_v[0],1559 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants);1560 rgb_buf[3] = 255;1561 YuvPixel(src_y[1], src_u[0], src_v[0],1562 rgb_buf + 4, rgb_buf + 5, rgb_buf + 6, yuvconstants);1563 rgb_buf[7] = 255;1564 src_y += 2;1565 rgb_buf += 8; // Advance 2 pixels.1566 }1567 if (width & 1) {1568 YuvPixel(src_y[0], src_u[0], src_v[0],1569 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants);1570 rgb_buf[3] = 255;1571 }1572 }1573 1574 1526 void NV12ToARGBRow_C(const uint8* src_y, 1575 1527 const uint8* src_uv, … … 1579 1531 int x; 1580 1532 for (x = 0; x < width - 1; x += 2) { 1581 YuvPixel(src_y[0], src_uv[0], src_uv[1], 1582 rgb_buf + 0, rgb_buf + 1, rgb_buf +2, yuvconstants);1533 YuvPixel(src_y[0], src_uv[0], src_uv[1], rgb_buf + 0, rgb_buf + 1, 1534 rgb_buf + 2, yuvconstants); 1583 1535 rgb_buf[3] = 255; 1584 YuvPixel(src_y[1], src_uv[0], src_uv[1], 1585 rgb_buf + 4, rgb_buf + 5, rgb_buf +6, yuvconstants);1536 YuvPixel(src_y[1], src_uv[0], src_uv[1], rgb_buf + 4, rgb_buf + 5, 1537 rgb_buf + 6, yuvconstants); 1586 1538 rgb_buf[7] = 255; 1587 1539 src_y += 2; … … 1590 1542 } 1591 1543 if (width & 1) { 1592 YuvPixel(src_y[0], src_uv[0], src_uv[1], 1593 rgb_buf + 0, rgb_buf + 1, rgb_buf +2, yuvconstants);1544 YuvPixel(src_y[0], src_uv[0], src_uv[1], rgb_buf + 0, rgb_buf + 1, 1545 rgb_buf + 2, yuvconstants); 1594 1546 rgb_buf[3] = 255; 1595 1547 } … … 1603 1555 int x; 1604 1556 for (x = 0; x < width - 1; x += 2) { 1605 YuvPixel(src_y[0], src_vu[1], src_vu[0], 1606 rgb_buf + 0, rgb_buf + 1, rgb_buf +2, yuvconstants);1557 YuvPixel(src_y[0], src_vu[1], src_vu[0], rgb_buf + 0, rgb_buf + 1, 1558 rgb_buf + 2, yuvconstants); 1607 1559 rgb_buf[3] = 255; 1608 YuvPixel(src_y[1], src_vu[1], src_vu[0], 1609 rgb_buf + 4, rgb_buf + 5, rgb_buf +6, yuvconstants);1560 YuvPixel(src_y[1], src_vu[1], src_vu[0], rgb_buf + 4, rgb_buf + 5, 1561 rgb_buf + 6, yuvconstants); 1610 1562 rgb_buf[7] = 255; 1611 1563 src_y += 2; … … 1614 1566 } 1615 1567 if (width & 1) { 1616 YuvPixel(src_y[0], src_vu[1], src_vu[0], 1617 rgb_buf + 0, rgb_buf + 1, rgb_buf +2, yuvconstants);1568 YuvPixel(src_y[0], src_vu[1], src_vu[0], rgb_buf + 0, rgb_buf + 1, 1569 rgb_buf + 2, yuvconstants); 1618 1570 rgb_buf[3] = 255; 1619 1571 } … … 1641 1593 g1 = g1 >> 2; 1642 1594 r1 = r1 >> 3; 1643 *(uint32*)(dst_rgb565) = b0 | (g0 << 5) | (r0 << 11) |1644 (b1 << 16) | (g1 << 21) | (r1 << 27);1595 *(uint32*)(dst_rgb565) = 1596 b0 | (g0 << 5) | (r0 << 11) | (b1 << 16) | (g1 << 21) | (r1 << 27); 1645 1597 src_y += 2; 1646 1598 src_uv += 2; … … 1662 1614 int x; 1663 1615 for (x = 0; x < width - 1; x += 2) { 1664 YuvPixel(src_yuy2[0], src_yuy2[1], src_yuy2[3], 1665 rgb_buf + 0, rgb_buf + 1, rgb_buf +2, yuvconstants);1616 YuvPixel(src_yuy2[0], src_yuy2[1], src_yuy2[3], rgb_buf + 0, rgb_buf + 1, 1617 rgb_buf + 2, yuvconstants); 1666 1618 rgb_buf[3] = 255; 1667 YuvPixel(src_yuy2[2], src_yuy2[1], src_yuy2[3], 1668 rgb_buf + 4, rgb_buf + 5, rgb_buf +6, yuvconstants);1619 YuvPixel(src_yuy2[2], src_yuy2[1], src_yuy2[3], rgb_buf + 4, rgb_buf + 5, 1620 rgb_buf + 6, yuvconstants); 1669 1621 rgb_buf[7] = 255; 1670 1622 src_yuy2 += 4; … … 1672 1624 } 1673 1625 if (width & 1) { 1674 YuvPixel(src_yuy2[0], src_yuy2[1], src_yuy2[3], 1675 rgb_buf + 0, rgb_buf + 1, rgb_buf +2, yuvconstants);1626 YuvPixel(src_yuy2[0], src_yuy2[1], src_yuy2[3], rgb_buf + 0, rgb_buf + 1, 1627 rgb_buf + 2, yuvconstants); 1676 1628 rgb_buf[3] = 255; 1677 1629 } … … 1684 1636 int x; 1685 1637 for (x = 0; x < width - 1; x += 2) { 1686 YuvPixel(src_uyvy[1], src_uyvy[0], src_uyvy[2], 1687 rgb_buf + 0, rgb_buf + 1, rgb_buf +2, yuvconstants);1638 YuvPixel(src_uyvy[1], src_uyvy[0], src_uyvy[2], rgb_buf + 0, rgb_buf + 1, 1639 rgb_buf + 2, yuvconstants); 1688 1640 rgb_buf[3] = 255; 1689 YuvPixel(src_uyvy[3], src_uyvy[0], src_uyvy[2], 1690 rgb_buf + 4, rgb_buf + 5, rgb_buf +6, yuvconstants);1641 YuvPixel(src_uyvy[3], src_uyvy[0], src_uyvy[2], rgb_buf + 4, rgb_buf + 5, 1642 rgb_buf + 6, yuvconstants); 1691 1643 rgb_buf[7] = 255; 1692 1644 src_uyvy += 4; … … 1694 1646 } 1695 1647 if (width & 1) { 1696 YuvPixel(src_uyvy[1], src_uyvy[0], src_uyvy[2], 1697 rgb_buf + 0, rgb_buf + 1, rgb_buf +2, yuvconstants);1648 YuvPixel(src_uyvy[1], src_uyvy[0], src_uyvy[2], rgb_buf + 0, rgb_buf + 1, 1649 rgb_buf + 2, yuvconstants); 1698 1650 rgb_buf[3] = 255; 1699 1651 } … … 1708 1660 int x; 1709 1661 for (x = 0; x < width - 1; x += 2) { 1710 YuvPixel(src_y[0], src_u[0], src_v[0], 1711 rgb_buf + 1, rgb_buf + 2, rgb_buf +3, yuvconstants);1662 YuvPixel(src_y[0], src_u[0], src_v[0], rgb_buf + 1, rgb_buf + 2, 1663 rgb_buf + 3, yuvconstants); 1712 1664 rgb_buf[0] = 255; 1713 YuvPixel(src_y[1], src_u[0], src_v[0], 1714 rgb_buf + 5, rgb_buf + 6, rgb_buf +7, yuvconstants);1665 YuvPixel(src_y[1], src_u[0], src_v[0], rgb_buf + 5, rgb_buf + 6, 1666 rgb_buf + 7, yuvconstants); 1715 1667 rgb_buf[4] = 255; 1716 1668 src_y += 2; … … 1720 1672 } 1721 1673 if (width & 1) { 1722 YuvPixel(src_y[0], src_u[0], src_v[0], 1723 rgb_buf + 1, rgb_buf + 2, rgb_buf +3, yuvconstants);1674 YuvPixel(src_y[0], src_u[0], src_v[0], rgb_buf + 1, rgb_buf + 2, 1675 rgb_buf + 3, yuvconstants); 1724 1676 rgb_buf[0] = 255; 1725 1677 } … … 1801 1753 } 1802 1754 1803 void MergeUVRow_C(const uint8* src_u, const uint8* src_v, uint8* dst_uv, 1755 void MergeUVRow_C(const uint8* src_u, 1756 const uint8* src_v, 1757 uint8* dst_uv, 1804 1758 int width) { 1805 1759 int x; … … 1838 1792 1839 1793 // Filter 2 rows of YUY2 UV's (422) into U and V (420). 1840 void YUY2ToUVRow_C(const uint8* src_yuy2, int src_stride_yuy2, 1841 uint8* dst_u, uint8* dst_v, int width) { 1794 void YUY2ToUVRow_C(const uint8* src_yuy2, 1795 int src_stride_yuy2, 1796 uint8* dst_u, 1797 uint8* dst_v, 1798 int width) { 1842 1799 // Output a row of UV values, filtering 2 rows of YUY2. 1843 1800 int x; … … 1853 1810 // Copy row of YUY2 UV's (422) into U and V (422). 1854 1811 void YUY2ToUV422Row_C(const uint8* src_yuy2, 1855 uint8* dst_u, uint8* dst_v, int width) { 1812 uint8* dst_u, 1813 uint8* dst_v, 1814 int width) { 1856 1815 // Output a row of UV values. 1857 1816 int x; … … 1880 1839 1881 1840 // Filter 2 rows of UYVY UV's (422) into U and V (420). 1882 void UYVYToUVRow_C(const uint8* src_uyvy, int src_stride_uyvy, 1883 uint8* dst_u, uint8* dst_v, int width) { 1841 void UYVYToUVRow_C(const uint8* src_uyvy, 1842 int src_stride_uyvy, 1843 uint8* dst_u, 1844 uint8* dst_v, 1845 int width) { 1884 1846 // Output a row of UV values. 1885 1847 int x; … … 1895 1857 // Copy row of UYVY UV's (422) into U and V (422). 1896 1858 void UYVYToUV422Row_C(const uint8* src_uyvy, 1897 uint8* dst_u, uint8* dst_v, int width) { 1859 uint8* dst_u, 1860 uint8* dst_v, 1861 int width) { 1898 1862 // Output a row of UV values. 1899 1863 int x; … … 1926 1890 // dst_argb may be src_argb0 or src_argb1. 1927 1891 // This code mimics the SSSE3 version for better testability. 1928 void ARGBBlendRow_C(const uint8* src_argb0, const uint8* src_argb1, 1929 uint8* dst_argb, int width) { 1892 void ARGBBlendRow_C(const uint8* src_argb0, 1893 const uint8* src_argb1, 1894 uint8* dst_argb, 1895 int width) { 1930 1896 int x; 1931 1897 for (x = 0; x < width - 1; x += 2) { … … 1974 1940 #undef BLEND 1975 1941 1976 #define UBLEND(f, b, a) (((a) * f) + ((255 - a) * b) + 255) >> 8 1977 void BlendPlaneRow_C(const uint8* src0, const uint8* src1, 1978 const uint8* alpha, uint8* dst, int width) { 1942 #define UBLEND(f, b, a) (((a)*f) + ((255 - a) * b) + 255) >> 8 1943 void BlendPlaneRow_C(const uint8* src0, 1944 const uint8* src1, 1945 const uint8* alpha, 1946 uint8* dst, 1947 int width) { 1979 1948 int x; 1980 1949 for (x = 0; x < width - 1; x += 2) { … … 2040 2009 #define T(a) 0x01000000 + (0x10000 / a) 2041 2010 const uint32 fixed_invtbl8[256] = { 2042 0x01000000, 0x0100ffff, T(0x02), T(0x03), T(0x04), T(0x05), T(0x06), T(0x07), 2043 T(0x08), T(0x09), T(0x0a), T(0x0b), T(0x0c), T(0x0d), T(0x0e), T(0x0f), 2044 T(0x10), T(0x11), T(0x12), T(0x13), T(0x14), T(0x15), T(0x16), T(0x17), 2045 T(0x18), T(0x19), T(0x1a), T(0x1b), T(0x1c), T(0x1d), T(0x1e), T(0x1f), 2046 T(0x20), T(0x21), T(0x22), T(0x23), T(0x24), T(0x25), T(0x26), T(0x27), 2047 T(0x28), T(0x29), T(0x2a), T(0x2b), T(0x2c), T(0x2d), T(0x2e), T(0x2f), 2048 T(0x30), T(0x31), T(0x32), T(0x33), T(0x34), T(0x35), T(0x36), T(0x37), 2049 T(0x38), T(0x39), T(0x3a), T(0x3b), T(0x3c), T(0x3d), T(0x3e), T(0x3f), 2050 T(0x40), T(0x41), T(0x42), T(0x43), T(0x44), T(0x45), T(0x46), T(0x47), 2051 T(0x48), T(0x49), T(0x4a), T(0x4b), T(0x4c), T(0x4d), T(0x4e), T(0x4f), 2052 T(0x50), T(0x51), T(0x52), T(0x53), T(0x54), T(0x55), T(0x56), T(0x57), 2053 T(0x58), T(0x59), T(0x5a), T(0x5b), T(0x5c), T(0x5d), T(0x5e), T(0x5f), 2054 T(0x60), T(0x61), T(0x62), T(0x63), T(0x64), T(0x65), T(0x66), T(0x67), 2055 T(0x68), T(0x69), T(0x6a), T(0x6b), T(0x6c), T(0x6d), T(0x6e), T(0x6f), 2056 T(0x70), T(0x71), T(0x72), T(0x73), T(0x74), T(0x75), T(0x76), T(0x77), 2057 T(0x78), T(0x79), T(0x7a), T(0x7b), T(0x7c), T(0x7d), T(0x7e), T(0x7f), 2058 T(0x80), T(0x81), T(0x82), T(0x83), T(0x84), T(0x85), T(0x86), T(0x87), 2059 T(0x88), T(0x89), T(0x8a), T(0x8b), T(0x8c), T(0x8d), T(0x8e), T(0x8f), 2060 T(0x90), T(0x91), T(0x92), T(0x93), T(0x94), T(0x95), T(0x96), T(0x97), 2061 T(0x98), T(0x99), T(0x9a), T(0x9b), T(0x9c), T(0x9d), T(0x9e), T(0x9f), 2062 T(0xa0), T(0xa1), T(0xa2), T(0xa3), T(0xa4), T(0xa5), T(0xa6), T(0xa7), 2063 T(0xa8), T(0xa9), T(0xaa), T(0xab), T(0xac), T(0xad), T(0xae), T(0xaf), 2064 T(0xb0), T(0xb1), T(0xb2), T(0xb3), T(0xb4), T(0xb5), T(0xb6), T(0xb7), 2065 T(0xb8), T(0xb9), T(0xba), T(0xbb), T(0xbc), T(0xbd), T(0xbe), T(0xbf), 2066 T(0xc0), T(0xc1), T(0xc2), T(0xc3), T(0xc4), T(0xc5), T(0xc6), T(0xc7), 2067 T(0xc8), T(0xc9), T(0xca), T(0xcb), T(0xcc), T(0xcd), T(0xce), T(0xcf), 2068 T(0xd0), T(0xd1), T(0xd2), T(0xd3), T(0xd4), T(0xd5), T(0xd6), T(0xd7), 2069 T(0xd8), T(0xd9), T(0xda), T(0xdb), T(0xdc), T(0xdd), T(0xde), T(0xdf), 2070 T(0xe0), T(0xe1), T(0xe2), T(0xe3), T(0xe4), T(0xe5), T(0xe6), T(0xe7), 2071 T(0xe8), T(0xe9), T(0xea), T(0xeb), T(0xec), T(0xed), T(0xee), T(0xef), 2072 T(0xf0), T(0xf1), T(0xf2), T(0xf3), T(0xf4), T(0xf5), T(0xf6), T(0xf7), 2073 T(0xf8), T(0xf9), T(0xfa), T(0xfb), T(0xfc), T(0xfd), T(0xfe), 0x01000100 }; 2011 0x01000000, 0x0100ffff, T(0x02), T(0x03), T(0x04), T(0x05), T(0x06), 2012 T(0x07), T(0x08), T(0x09), T(0x0a), T(0x0b), T(0x0c), T(0x0d), 2013 T(0x0e), T(0x0f), T(0x10), T(0x11), T(0x12), T(0x13), T(0x14), 2014 T(0x15), T(0x16), T(0x17), T(0x18), T(0x19), T(0x1a), T(0x1b), 2015 T(0x1c), T(0x1d), T(0x1e), T(0x1f), T(0x20), T(0x21), T(0x22), 2016 T(0x23), T(0x24), T(0x25), T(0x26), T(0x27), T(0x28), T(0x29), 2017 T(0x2a), T(0x2b), T(0x2c), T(0x2d), T(0x2e), T(0x2f), T(0x30), 2018 T(0x31), T(0x32), T(0x33), T(0x34), T(0x35), T(0x36), T(0x37), 2019 T(0x38), T(0x39), T(0x3a), T(0x3b), T(0x3c), T(0x3d), T(0x3e), 2020 T(0x3f), T(0x40), T(0x41), T(0x42), T(0x43), T(0x44), T(0x45), 2021 T(0x46), T(0x47), T(0x48), T(0x49), T(0x4a), T(0x4b), T(0x4c), 2022 T(0x4d), T(0x4e), T(0x4f), T(0x50), T(0x51), T(0x52), T(0x53), 2023 T(0x54), T(0x55), T(0x56), T(0x57), T(0x58), T(0x59), T(0x5a), 2024 T(0x5b), T(0x5c), T(0x5d), T(0x5e), T(0x5f), T(0x60), T(0x61), 2025 T(0x62), T(0x63), T(0x64), T(0x65), T(0x66), T(0x67), T(0x68), 2026 T(0x69), T(0x6a), T(0x6b), T(0x6c), T(0x6d), T(0x6e), T(0x6f), 2027 T(0x70), T(0x71), T(0x72), T(0x73), T(0x74), T(0x75), T(0x76), 2028 T(0x77), T(0x78), T(0x79), T(0x7a), T(0x7b), T(0x7c), T(0x7d), 2029 T(0x7e), T(0x7f), T(0x80), T(0x81), T(0x82), T(0x83), T(0x84), 2030 T(0x85), T(0x86), T(0x87), T(0x88), T(0x89), T(0x8a), T(0x8b), 2031 T(0x8c), T(0x8d), T(0x8e), T(0x8f), T(0x90), T(0x91), T(0x92), 2032 T(0x93), T(0x94), T(0x95), T(0x96), T(0x97), T(0x98), T(0x99), 2033 T(0x9a), T(0x9b), T(0x9c), T(0x9d), T(0x9e), T(0x9f), T(0xa0), 2034 T(0xa1), T(0xa2), T(0xa3), T(0xa4), T(0xa5), T(0xa6), T(0xa7), 2035 T(0xa8), T(0xa9), T(0xaa), T(0xab), T(0xac), T(0xad), T(0xae), 2036 T(0xaf), T(0xb0), T(0xb1), T(0xb2), T(0xb3), T(0xb4), T(0xb5), 2037 T(0xb6), T(0xb7), T(0xb8), T(0xb9), T(0xba), T(0xbb), T(0xbc), 2038 T(0xbd), T(0xbe), T(0xbf), T(0xc0), T(0xc1), T(0xc2), T(0xc3), 2039 T(0xc4), T(0xc5), T(0xc6), T(0xc7), T(0xc8), T(0xc9), T(0xca), 2040 T(0xcb), T(0xcc), T(0xcd), T(0xce), T(0xcf), T(0xd0), T(0xd1), 2041 T(0xd2), T(0xd3), T(0xd4), T(0xd5), T(0xd6), T(0xd7), T(0xd8), 2042 T(0xd9), T(0xda), T(0xdb), T(0xdc), T(0xdd), T(0xde), T(0xdf), 2043 T(0xe0), T(0xe1), T(0xe2), T(0xe3), T(0xe4), T(0xe5), T(0xe6), 2044 T(0xe7), T(0xe8), T(0xe9), T(0xea), T(0xeb), T(0xec), T(0xed), 2045 T(0xee), T(0xef), T(0xf0), T(0xf1), T(0xf2), T(0xf3), T(0xf4), 2046 T(0xf5), T(0xf6), T(0xf7), T(0xf8), T(0xf9), T(0xfa), T(0xfb), 2047 T(0xfc), T(0xfd), T(0xfe), 0x01000100}; 2074 2048 #undef T 2075 2049 … … 2095 2069 } 2096 2070 2097 void ComputeCumulativeSumRow_C(const uint8* row, int32* cumsum, 2098 const int32* previous_cumsum, int width) { 2071 void ComputeCumulativeSumRow_C(const uint8* row, 2072 int32* cumsum, 2073 const int32* previous_cumsum, 2074 int width) { 2099 2075 int32 row_sum[4] = {0, 0, 0, 0}; 2100 2076 int x; … … 2104 2080 row_sum[2] += row[x * 4 + 2]; 2105 2081 row_sum[3] += row[x * 4 + 3]; 2106 cumsum[x * 4 + 0] = row_sum[0] + previous_cumsum[x * 4 + 0]; 2107 cumsum[x * 4 + 1] = row_sum[1] + previous_cumsum[x * 4 + 1]; 2108 cumsum[x * 4 + 2] = row_sum[2] + previous_cumsum[x * 4 + 2]; 2109 cumsum[x * 4 + 3] = row_sum[3] + previous_cumsum[x * 4 + 3]; 2110 } 2111 } 2112 2113 void CumulativeSumToAverageRow_C(const int32* tl, const int32* bl, 2114 int w, int area, uint8* dst, int count) { 2082 cumsum[x * 4 + 0] = row_sum[0] + previous_cumsum[x * 4 + 0]; 2083 cumsum[x * 4 + 1] = row_sum[1] + previous_cumsum[x * 4 + 1]; 2084 cumsum[x * 4 + 2] = row_sum[2] + previous_cumsum[x * 4 + 2]; 2085 cumsum[x * 4 + 3] = row_sum[3] + previous_cumsum[x * 4 + 3]; 2086 } 2087 } 2088 2089 void CumulativeSumToAverageRow_C(const int32* tl, 2090 const int32* bl, 2091 int w, 2092 int area, 2093 uint8* dst, 2094 int count) { 2115 2095 float ooa = 1.0f / area; 2116 2096 int i; … … 2128 2108 // Copy pixels from rotated source to destination row with a slope. 2129 2109 LIBYUV_API 2130 void ARGBAffineRow_C(const uint8* src_argb, int src_argb_stride, 2131 uint8* dst_argb, const float* uv_dudv, int width) { 2110 void ARGBAffineRow_C(const uint8* src_argb, 2111 int src_argb_stride, 2112 uint8* dst_argb, 2113 const float* uv_dudv, 2114 int width) { 2132 2115 int i; 2133 2116 // Render a row of pixels from source into a buffer. … … 2139 2122 int y = (int)(uv[1]); 2140 2123 *(uint32*)(dst_argb) = 2141 *(const uint32*)(src_argb + y * src_argb_stride + 2142 x * 4); 2124 *(const uint32*)(src_argb + y * src_argb_stride + x * 4); 2143 2125 dst_argb += 4; 2144 2126 uv[0] += uv_dudv[2]; … … 2148 2130 2149 2131 // Blend 2 rows into 1. 2150 static void HalfRow_C(const uint8* src_uv, ptrdiff_t src_uv_stride, 2151 uint8* dst_uv, int width) { 2132 static void HalfRow_C(const uint8* src_uv, 2133 ptrdiff_t src_uv_stride, 2134 uint8* dst_uv, 2135 int width) { 2152 2136 int x; 2153 2137 for (x = 0; x < width; ++x) { … … 2156 2140 } 2157 2141 2158 static void HalfRow_16_C(const uint16* src_uv, ptrdiff_t src_uv_stride, 2159 uint16* dst_uv, int width) { 2142 static void HalfRow_16_C(const uint16* src_uv, 2143 ptrdiff_t src_uv_stride, 2144 uint16* dst_uv, 2145 int width) { 2160 2146 int x; 2161 2147 for (x = 0; x < width; ++x) { … … 2165 2151 2166 2152 // C version 2x2 -> 2x1. 2167 void InterpolateRow_C(uint8* dst_ptr, const uint8* src_ptr, 2153 void InterpolateRow_C(uint8* dst_ptr, 2154 const uint8* src_ptr, 2168 2155 ptrdiff_t src_stride, 2169 int width, int source_y_fraction) { 2170 int y1_fraction = source_y_fraction ; 2156 int width, 2157 int source_y_fraction) { 2158 int y1_fraction = source_y_fraction; 2171 2159 int y0_fraction = 256 - y1_fraction; 2172 2160 const uint8* src_ptr1 = src_ptr + src_stride; … … 2195 2183 } 2196 2184 2197 void InterpolateRow_16_C(uint16* dst_ptr, const uint16* src_ptr, 2185 void InterpolateRow_16_C(uint16* dst_ptr, 2186 const uint16* src_ptr, 2198 2187 ptrdiff_t src_stride, 2199 int width, int source_y_fraction) { 2188 int width, 2189 int source_y_fraction) { 2200 2190 int y1_fraction = source_y_fraction; 2201 2191 int y0_fraction = 256 - y1_fraction; … … 2223 2213 2224 2214 // Use first 4 shuffler values to reorder ARGB channels. 2225 void ARGBShuffleRow_C(const uint8* src_argb, uint8* dst_argb, 2226 const uint8* shuffler, int width) { 2215 void ARGBShuffleRow_C(const uint8* src_argb, 2216 uint8* dst_argb, 2217 const uint8* shuffler, 2218 int width) { 2227 2219 int index0 = shuffler[0]; 2228 2220 int index1 = shuffler[1]; … … 2249 2241 const uint8* src_u, 2250 2242 const uint8* src_v, 2251 uint8* dst_frame, int width) { 2243 uint8* dst_frame, 2244 int width) { 2252 2245 int x; 2253 2246 for (x = 0; x < width - 1; x += 2) { … … 2272 2265 const uint8* src_u, 2273 2266 const uint8* src_v, 2274 uint8* dst_frame, int width) { 2267 uint8* dst_frame, 2268 int width) { 2275 2269 int x; 2276 2270 for (x = 0; x < width - 1; x += 2) { … … 2291 2285 } 2292 2286 } 2293 2294 2287 2295 2288 void ARGBPolynomialRow_C(const uint8* src_argb, … … 2333 2326 } 2334 2327 2335 void ARGBLumaColorTableRow_C(const uint8* src_argb, uint8* dst_argb, int width, 2336 const uint8* luma, uint32 lumacoeff) { 2328 // Samples assumed to be unsigned in low 9, 10 or 12 bits. Scale factor 2329 // adjust the source integer range to the half float range desired. 2330 2331 // This magic constant is 2^-112. Multiplying by this 2332 // is the same as subtracting 112 from the exponent, which 2333 // is the difference in exponent bias between 32-bit and 2334 // 16-bit floats. Once we've done this subtraction, we can 2335 // simply extract the low bits of the exponent and the high 2336 // bits of the mantissa from our float and we're done. 2337 2338 void HalfFloatRow_C(const uint16* src, uint16* dst, float scale, int width) { 2339 int i; 2340 float mult = 1.9259299444e-34f * scale; 2341 for (i = 0; i < width; ++i) { 2342 float value = src[i] * mult; 2343 dst[i] = (uint16)((*(uint32_t*)&value) >> 13); 2344 } 2345 } 2346 2347 void ARGBLumaColorTableRow_C(const uint8* src_argb, 2348 uint8* dst_argb, 2349 int width, 2350 const uint8* luma, 2351 uint32 lumacoeff) { 2337 2352 uint32 bc = lumacoeff & 0xff; 2338 2353 uint32 gc = (lumacoeff >> 8) & 0xff; … … 2342 2357 for (i = 0; i < width - 1; i += 2) { 2343 2358 // Luminance in rows, color values in columns. 2344 const uint8* luma0 = ((src_argb[0] * bc + src_argb[1] * gc + 2345 src_argb[2] * rc) & 0x7F00u) + luma; 2359 const uint8* luma0 = 2360 ((src_argb[0] * bc + src_argb[1] * gc + src_argb[2] * rc) & 0x7F00u) + 2361 luma; 2346 2362 const uint8* luma1; 2347 2363 dst_argb[0] = luma0[src_argb[0]]; … … 2349 2365 dst_argb[2] = luma0[src_argb[2]]; 2350 2366 dst_argb[3] = src_argb[3]; 2351 luma1 = ((src_argb[4] * bc + src_argb[5] * gc + 2352 src_argb[6] * rc) & 0x7F00u) + luma; 2367 luma1 = 2368 ((src_argb[4] * bc + src_argb[5] * gc + src_argb[6] * rc) & 0x7F00u) + 2369 luma; 2353 2370 dst_argb[4] = luma1[src_argb[4]]; 2354 2371 dst_argb[5] = luma1[src_argb[5]]; … … 2360 2377 if (width & 1) { 2361 2378 // Luminance in rows, color values in columns. 2362 const uint8* luma0 = ((src_argb[0] * bc + src_argb[1] * gc + 2363 src_argb[2] * rc) & 0x7F00u) + luma; 2379 const uint8* luma0 = 2380 ((src_argb[0] * bc + src_argb[1] * gc + src_argb[2] * rc) & 0x7F00u) + 2381 luma; 2364 2382 dst_argb[0] = luma0[src_argb[0]]; 2365 2383 dst_argb[1] = luma0[src_argb[1]]; … … 2505 2523 const struct YuvConstants* yuvconstants, 2506 2524 int width) { 2507 SIMD_ALIGNED 32(uint8 row[MAXTWIDTH * 4]);2525 SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); 2508 2526 while (width > 0) { 2509 2527 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; … … 2531 2549 int width) { 2532 2550 // Row buffer for intermediate ARGB pixels. 2533 SIMD_ALIGNED 32(uint8 row[MAXTWIDTH * 4]);2551 SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); 2534 2552 while (width > 0) { 2535 2553 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; … … 2557 2575 int width) { 2558 2576 // Row buffer for intermediate ARGB pixels. 2559 SIMD_ALIGNED 32(uint8 row[MAXTWIDTH * 4]);2577 SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); 2560 2578 while (width > 0) { 2561 2579 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; … … 2577 2595 #if defined(HAS_I422TORGB24ROW_AVX2) 2578 2596 void I422ToRGB24Row_AVX2(const uint8* src_y, 2579 2580 2581 2582 2583 2597 const uint8* src_u, 2598 const uint8* src_v, 2599 uint8* dst_rgb24, 2600 const struct YuvConstants* yuvconstants, 2601 int width) { 2584 2602 // Row buffer for intermediate ARGB pixels. 2585 SIMD_ALIGNED 32(uint8 row[MAXTWIDTH * 4]);2603 SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); 2586 2604 while (width > 0) { 2587 2605 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; … … 2605 2623 int width) { 2606 2624 // Row buffer for intermediate ARGB pixels. 2607 SIMD_ALIGNED 32(uint8 row[MAXTWIDTH * 4]);2625 SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); 2608 2626 while (width > 0) { 2609 2627 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width;
Note: See TracChangeset
for help on using the changeset viewer.