Mercurial > mplayer.hg
comparison postproc/yuv2rgb_altivec.c @ 12836:9a310b31359f
some fixes
author | alex |
---|---|
date | Sat, 17 Jul 2004 07:01:15 +0000 |
parents | d2aef091743c |
children | ec86a77cb6f4 |
comparison
equal
deleted
inserted
replaced
12835:4235ae5a2d60 | 12836:9a310b31359f |
---|---|
62 Integrated luma prescaling adjustment for saturation/contrast/brightness adjustment. | 62 Integrated luma prescaling adjustment for saturation/contrast/brightness adjustment. |
63 | 63 |
64 */ | 64 */ |
65 #include <stdio.h> | 65 #include <stdio.h> |
66 #include <stdlib.h> | 66 #include <stdlib.h> |
67 #include <string.h> | |
67 #include <inttypes.h> | 68 #include <inttypes.h> |
68 #include <assert.h> | 69 #include <assert.h> |
69 #include "config.h" | 70 #include "config.h" |
70 #include "rgb2rgb.h" | 71 #include "rgb2rgb.h" |
71 #include "swscale.h" | 72 #include "swscale.h" |
218 (vector unsigned short)vec_max (y,(vector signed short) (0))) | 219 (vector unsigned short)vec_max (y,(vector signed short) (0))) |
219 | 220 |
220 //#define out_pixels(a,b,c,ptr) vec_mstrgb32(typeof(a),((typeof (a))(0)),a,a,a,ptr) | 221 //#define out_pixels(a,b,c,ptr) vec_mstrgb32(typeof(a),((typeof (a))(0)),a,a,a,ptr) |
221 | 222 |
222 | 223 |
223 static inline cvtyuvtoRGB (SwsContext *c, | 224 static inline void cvtyuvtoRGB (SwsContext *c, |
224 vector signed short Y, vector signed short U, vector signed short V, | 225 vector signed short Y, vector signed short U, vector signed short V, |
225 vector signed short *R, vector signed short *G, vector signed short *B) | 226 vector signed short *R, vector signed short *G, vector signed short *B) |
226 { | 227 { |
227 vector signed short vx,ux,uvx; | 228 vector signed short vx,ux,uvx; |
228 | 229 |
490 out_rgba (R,G,B,out); | 491 out_rgba (R,G,B,out); |
491 | 492 |
492 img += 32; | 493 img += 32; |
493 } | 494 } |
494 } | 495 } |
496 return srcSliceH; | |
495 } | 497 } |
496 | 498 |
497 | 499 |
498 | 500 |
499 /* Ok currently the acceleration routine only supports | 501 /* Ok currently the acceleration routine only supports |
552 case IMGFMT_UYVY: | 554 case IMGFMT_UYVY: |
553 switch(c->dstFormat){ | 555 switch(c->dstFormat){ |
554 case IMGFMT_RGB32: | 556 case IMGFMT_RGB32: |
555 MSG_WARN("ALTIVEC: Color Space UYVY -> RGB32\n"); | 557 MSG_WARN("ALTIVEC: Color Space UYVY -> RGB32\n"); |
556 return altivec_uyvy_rgb32; | 558 return altivec_uyvy_rgb32; |
557 case IMGFMT_RGB24: | |
558 case IMGFMT_BGR32: | |
559 | |
560 default: return NULL; | 559 default: return NULL; |
561 } | 560 } |
562 break; | 561 break; |
563 | 562 |
564 } | 563 } |
565 return NULL; | 564 return NULL; |
566 } | 565 } |
567 | 566 |
568 | 567 |
569 int yuv2rgb_altivec_init_tables (SwsContext *c, const int inv_table[4]) | 568 void yuv2rgb_altivec_init_tables (SwsContext *c, const int inv_table[4]) |
570 { | 569 { |
571 | |
572 vector signed short | 570 vector signed short |
573 CY = (vector signed short)(0x7fff), | 571 CY = (vector signed short)(0x7fff), |
574 CRV = (vector signed short)(22972), | 572 CRV = (vector signed short)(22972), |
575 CBU = (vector signed short)(29029), | 573 CBU = (vector signed short)(29029), |
576 CGU = (vector signed short)(-11276), | 574 CGU = (vector signed short)(-11276), |
577 CGV = (vector signed short)(-23400), | 575 CGV = (vector signed short)(-23400), |
578 OY; | 576 OY; |
579 | 577 |
580 vector unsigned short CSHIFT = (vector unsigned short)(1); | |
581 | |
582 vector signed short Y0; | 578 vector signed short Y0; |
583 int brightness = c->brightness, contrast = c->contrast, saturation = c->saturation; | 579 int brightness = c->brightness, contrast = c->contrast, saturation = c->saturation; |
584 int64_t crv __attribute__ ((aligned(16))); | 580 int64_t crv __attribute__ ((aligned(16))); |
585 int64_t cbu __attribute__ ((aligned(16))); | 581 int64_t cbu __attribute__ ((aligned(16))); |
586 int64_t cgu __attribute__ ((aligned(16))); | 582 int64_t cgu __attribute__ ((aligned(16))); |
615 cgu= (cgu*contrast * saturation)>>32; | 611 cgu= (cgu*contrast * saturation)>>32; |
616 cgv= (cgv*contrast * saturation)>>32; | 612 cgv= (cgv*contrast * saturation)>>32; |
617 | 613 |
618 oy -= 256*brightness; | 614 oy -= 256*brightness; |
619 | 615 |
620 | |
621 //printf("%llx %llx %llx %llx %llx\n", cy, crv, cbu, cgu, cgv); | 616 //printf("%llx %llx %llx %llx %llx\n", cy, crv, cbu, cgu, cgv); |
622 | 617 |
623 // vector signed short CBU,CRV,CGU,CGY,CY; | 618 // vector signed short CBU,CRV,CGU,CGY,CY; |
624 tmp = cy; | 619 tmp = cy; |
625 CY = vec_lde (0, &tmp); | 620 CY = vec_lde (0, &tmp); |
641 CGU = vec_splat (CGU, 0); | 636 CGU = vec_splat (CGU, 0); |
642 tmp = -(cgv>>1); | 637 tmp = -(cgv>>1); |
643 CGV = vec_lde (0, &tmp); | 638 CGV = vec_lde (0, &tmp); |
644 CGV = vec_splat (CGV, 0); | 639 CGV = vec_splat (CGV, 0); |
645 | 640 |
646 CSHIFT = (vector unsigned short)(2); | 641 c->CSHIFT = (vector unsigned short)(2); |
647 #if 1 | |
648 c->CSHIFT = CSHIFT; | |
649 c->CY = CY; | 642 c->CY = CY; |
650 c->OY = OY; | 643 c->OY = OY; |
651 c->CRV = CRV; | 644 c->CRV = CRV; |
652 c->CBU = CBU; | 645 c->CBU = CBU; |
653 c->CGU = CGU; | 646 c->CGU = CGU; |
654 c->CGV = CGV; | 647 c->CGV = CGV; |
655 #endif | 648 |
656 #if 1 | 649 #if 0 |
657 printf ("cy: %hvx\n", CY); | 650 printf ("cy: %hvx\n", CY); |
658 printf ("oy: %hvx\n", OY); | 651 printf ("oy: %hvx\n", OY); |
659 printf ("crv: %hvx\n", CRV); | 652 printf ("crv: %hvx\n", CRV); |
660 printf ("cbu: %hvx\n", CBU); | 653 printf ("cbu: %hvx\n", CBU); |
661 printf ("cgv: %hvx\n", CGV); | 654 printf ("cgv: %hvx\n", CGV); |
662 printf ("cgu: %hvx\n", CGU); | 655 printf ("cgu: %hvx\n", CGU); |
663 #endif | 656 #endif |
657 | |
658 return; | |
664 } | 659 } |
665 | 660 |
666 | 661 |
667 void | 662 void |
668 altivec_yuv2packedX (SwsContext *c, | 663 altivec_yuv2packedX (SwsContext *c, |