Mercurial > libavcodec.hg
diff 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 |
line wrap: on
line diff
--- a/dsputil.c Wed Jan 13 16:46:39 2010 +0000 +++ b/dsputil.c Thu Jan 14 01:32:49 2010 +0000 @@ -3632,35 +3632,42 @@ #define B 3 #define G 2 #define R 1 +#define A 0 #else #define B 0 #define G 1 #define R 2 +#define A 3 #endif -static void add_hfyu_left_prediction_bgr32_c(uint8_t *dst, const uint8_t *src, int w, int *red, int *green, int *blue){ +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){ int i; - int r,g,b; + int r,g,b,a; r= *red; g= *green; b= *blue; + a= *alpha; for(i=0; i<w; i++){ b+= src[4*i+B]; g+= src[4*i+G]; r+= src[4*i+R]; + a+= src[4*i+A]; dst[4*i+B]= b; dst[4*i+G]= g; dst[4*i+R]= r; + dst[4*i+A]= a; } *red= r; *green= g; *blue= b; + *alpha= a; } #undef B #undef G #undef R +#undef A #define BUTTERFLY2(o1,o2,i1,i2) \ o1= (i1)+(i2);\