diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-11-06 01:27:09 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-11-06 01:31:41 +0100 |
commit | db012e161e86fb530477fde44a6a1701c64527b5 (patch) | |
tree | 0520adacfa8ff712e6e31a24cc97c7701ab649ff | |
parent | 67ee2d2f6d89b46b1ee045ce4ae8764086e620b6 (diff) | |
download | ffmpeg-db012e161e86fb530477fde44a6a1701c64527b5.tar.gz |
img2enc: Fix yuva with yuv split planes.
Previously the chroma planes where corrupted in this case.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/img2enc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c index 0ab7c65760..65e53bb5a7 100644 --- a/libavformat/img2enc.c +++ b/libavformat/img2enc.c @@ -97,10 +97,12 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) } if(img->split_planes){ + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(codec->pix_fmt); int ysize = codec->width * codec->height; + int usize = ((-codec->width)>>desc->log2_chroma_w) * ((-codec->height)>>desc->log2_chroma_h); avio_write(pb[0], pkt->data , ysize); - avio_write(pb[1], pkt->data + ysize, (pkt->size - ysize)/2); - avio_write(pb[2], pkt->data + ysize +(pkt->size - ysize)/2, (pkt->size - ysize)/2); + avio_write(pb[1], pkt->data + ysize , usize); + avio_write(pb[2], pkt->data + ysize + usize, usize); avio_close(pb[1]); avio_close(pb[2]); }else{ |