[FFmpeg-cvslog] img2enc: Fix yuva with yuv split planes.
Michael Niedermayer
git at videolan.org
Tue Nov 6 01:32:34 CET 2012
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Nov 6 01:27:09 2012 +0100| [db012e161e86fb530477fde44a6a1701c64527b5] | committer: Michael Niedermayer
img2enc: Fix yuva with yuv split planes.
Previously the chroma planes where corrupted in this case.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=db012e161e86fb530477fde44a6a1701c64527b5
---
libavformat/img2enc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index 0ab7c65..65e53bb 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{
More information about the ffmpeg-cvslog
mailing list