diff options
author | Aurelien Jacobs <aurel@gnuage.org> | 2007-09-24 13:21:41 +0000 |
---|---|---|
committer | Aurelien Jacobs <aurel@gnuage.org> | 2007-09-24 13:21:41 +0000 |
commit | b70335a28d88068cf0dea8789308d6670cb0162e (patch) | |
tree | 004ba5c06541cd45a9b61f320b5c0d0d09594956 /libavcodec/utils.c | |
parent | 1136d34a44bba555601dda248b2d09f6c35394d3 (diff) | |
download | ffmpeg-b70335a28d88068cf0dea8789308d6670cb0162e.tar.gz |
add support for yuva420p colorspace (yuv420p + alpha)
Originally committed as revision 10565 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 9ca8a2d38e..f2c77b75bc 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -171,6 +171,7 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){ case PIX_FMT_YUVJ420P: case PIX_FMT_YUVJ422P: case PIX_FMT_YUVJ444P: + case PIX_FMT_YUVA420P: w_align= 16; //FIXME check for non mpeg style codecs and use less alignment h_align= 16; break; @@ -265,7 +266,7 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){ buf->last_pic_num= *picture_number; }else{ int h_chroma_shift, v_chroma_shift; - int pixel_size, size[3]; + int pixel_size, size[4]; AVPicture picture; avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift); @@ -290,16 +291,17 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){ size[1] = avpicture_fill(&picture, NULL, s->pix_fmt, w, h); size[0] = picture.linesize[0] * h; size[1] -= size[0]; + size[2] = size[3] = 0; if(picture.data[2]) size[1]= size[2]= size[1]/2; - else - size[2]= 0; + if(picture.data[3]) + size[3] = picture.linesize[3] * h; buf->last_pic_num= -256*256*256*64; memset(buf->base, 0, sizeof(buf->base)); memset(buf->data, 0, sizeof(buf->data)); - for(i=0; i<3 && size[i]; i++){ + for(i=0; i<4 && size[i]; i++){ const int h_shift= i==0 ? 0 : h_chroma_shift; const int v_shift= i==0 ? 0 : v_chroma_shift; @@ -351,7 +353,7 @@ void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){ FFSWAP(InternalBuffer, *buf, *last); - for(i=0; i<3; i++){ + for(i=0; i<4; i++){ pic->data[i]=NULL; // pic->base[i]=NULL; } |