diff options
author | Garrick Meeker <gmeeker@theoryllc.com> | 2003-07-09 23:10:59 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2003-07-09 23:10:59 +0000 |
commit | d4f5d74a54183a0198053b0ceb0faa21ad686551 (patch) | |
tree | 69655576785813053b765c0ab095e191c86c0f30 /libavcodec/imgconvert.c | |
parent | b64dcbe3254337952627098756a454f572c55480 (diff) | |
download | ffmpeg-d4f5d74a54183a0198053b0ceb0faa21ad686551.tar.gz |
flash video (flv) support patch by (Garrick Meeker <gmeeker at theoryllc dot com>)
Originally committed as revision 2024 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/imgconvert.c')
-rw-r--r-- | libavcodec/imgconvert.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 6a36c85589..4050ae7f3f 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -593,19 +593,19 @@ static void yuv422_to_yuv420p(AVPicture *dst, AVPicture *src, { const uint8_t *p, *p1; uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1; - int x; + int w; p1 = src->data[0]; lum1 = dst->data[0]; cb1 = dst->data[1]; cr1 = dst->data[2]; - for(;height >= 2; height -= 2) { + for(;height >= 1; height -= 2) { p = p1; lum = lum1; cb = cb1; cr = cr1; - for(x=0;x<width;x+=2) { + for(w = width; w >= 2; w -= 2) { lum[0] = p[0]; cb[0] = p[1]; lum[1] = p[2]; @@ -615,18 +615,30 @@ static void yuv422_to_yuv420p(AVPicture *dst, AVPicture *src, cb++; cr++; } - p1 += src->linesize[0]; - lum1 += dst->linesize[0]; - p = p1; - lum = lum1; - for(x=0;x<width;x+=2) { + if (w) { lum[0] = p[0]; - lum[1] = p[2]; - p += 4; - lum += 2; + cb[0] = p[1]; + cr[0] = p[3]; + cb++; + cr++; } p1 += src->linesize[0]; lum1 += dst->linesize[0]; + if (height>1) { + p = p1; + lum = lum1; + for(w = width; w >= 2; w -= 2) { + lum[0] = p[0]; + lum[1] = p[2]; + p += 4; + lum += 2; + } + if (w) { + lum[0] = p[0]; + } + p1 += src->linesize[0]; + lum1 += dst->linesize[0]; + } cb1 += dst->linesize[1]; cr1 += dst->linesize[2]; } |