comparison dsputil.c @ 10878:a8620b001ed3 libavcodec

Implement alpha channel decoding for BGR HuffYUV. Since BGR24 is decoded as BGR32, fill its alpha channel with 255 using the appropriate predictors.
author astrange
date Thu, 14 Jan 2010 01:32:49 +0000
parents bf309c7ce615
children 563cb9b1a9b7
comparison
equal deleted inserted replaced
10877:9ad6c1c4455c 10878:a8620b001ed3
3630 3630
3631 #if HAVE_BIGENDIAN 3631 #if HAVE_BIGENDIAN
3632 #define B 3 3632 #define B 3
3633 #define G 2 3633 #define G 2
3634 #define R 1 3634 #define R 1
3635 #define A 0
3635 #else 3636 #else
3636 #define B 0 3637 #define B 0
3637 #define G 1 3638 #define G 1
3638 #define R 2 3639 #define R 2
3640 #define A 3
3639 #endif 3641 #endif
3640 static void add_hfyu_left_prediction_bgr32_c(uint8_t *dst, const uint8_t *src, int w, int *red, int *green, int *blue){ 3642 static void add_hfyu_left_prediction_bgr32_c(uint8_t *dst, const uint8_t *src, int w, int *red, int *green, int *blue, int *alpha){
3641 int i; 3643 int i;
3642 int r,g,b; 3644 int r,g,b,a;
3643 r= *red; 3645 r= *red;
3644 g= *green; 3646 g= *green;
3645 b= *blue; 3647 b= *blue;
3648 a= *alpha;
3646 3649
3647 for(i=0; i<w; i++){ 3650 for(i=0; i<w; i++){
3648 b+= src[4*i+B]; 3651 b+= src[4*i+B];
3649 g+= src[4*i+G]; 3652 g+= src[4*i+G];
3650 r+= src[4*i+R]; 3653 r+= src[4*i+R];
3654 a+= src[4*i+A];
3651 3655
3652 dst[4*i+B]= b; 3656 dst[4*i+B]= b;
3653 dst[4*i+G]= g; 3657 dst[4*i+G]= g;
3654 dst[4*i+R]= r; 3658 dst[4*i+R]= r;
3659 dst[4*i+A]= a;
3655 } 3660 }
3656 3661
3657 *red= r; 3662 *red= r;
3658 *green= g; 3663 *green= g;
3659 *blue= b; 3664 *blue= b;
3665 *alpha= a;
3660 } 3666 }
3661 #undef B 3667 #undef B
3662 #undef G 3668 #undef G
3663 #undef R 3669 #undef R
3670 #undef A
3664 3671
3665 #define BUTTERFLY2(o1,o2,i1,i2) \ 3672 #define BUTTERFLY2(o1,o2,i1,i2) \
3666 o1= (i1)+(i2);\ 3673 o1= (i1)+(i2);\
3667 o2= (i1)-(i2); 3674 o2= (i1)-(i2);
3668 3675