diff options
author | Fabrice Bellard <fabrice@bellard.org> | 2003-04-21 21:20:46 +0000 |
---|---|---|
committer | Fabrice Bellard <fabrice@bellard.org> | 2003-04-21 21:20:46 +0000 |
commit | 0469baf14f0bb7aecd75474fc47aef47f723b4e3 (patch) | |
tree | 9708d0ac5147cce172fda6b07f26cec5a6e93da8 /libavcodec/imgconvert_template.h | |
parent | a059da1227aa2ae12e2d417469243629b9edd01c (diff) | |
download | ffmpeg-0469baf14f0bb7aecd75474fc47aef47f723b4e3.tar.gz |
added img_get_alpha_info()
Originally committed as revision 1809 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/imgconvert_template.h')
-rw-r--r-- | libavcodec/imgconvert_template.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libavcodec/imgconvert_template.h b/libavcodec/imgconvert_template.h index b2573b2623..015b74f1e3 100644 --- a/libavcodec/imgconvert_template.h +++ b/libavcodec/imgconvert_template.h @@ -814,6 +814,34 @@ static void glue(RGB_NAME, _to_pal8)(AVPicture *dst, AVPicture *src, #endif /* defined(FMT_RGB24) || defined(FMT_RGBA32) */ +#ifdef RGBA_IN + +static int glue(get_alpha_info_, RGB_NAME)(AVPicture *src, int width, int height) +{ + const unsigned char *p; + int src_wrap, ret, x, y; + unsigned int r, g, b, a; + + p = src->data[0]; + src_wrap = src->linesize[0] - BPP * width; + ret = 0; + for(y=0;y<height;y++) { + for(x=0;x<width;x++) { + RGBA_IN(r, g, b, a, p); + if (a == 0x00) { + ret |= FF_ALPHA_TRANSP; + } else if (a != 0xff) { + ret |= FF_ALPHA_SEMI_TRANSP; + } + p += BPP; + } + p += src_wrap; + } + return ret; +} + +#endif /* RGBA_IN */ + #undef RGB_IN #undef RGBA_IN #undef RGB_OUT |