diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-12-01 00:50:16 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-12-01 00:50:16 +0300 |
commit | 9d2a06951928d6fd35cc5effaa702a0e91b17744 (patch) | |
tree | ce6fa834fdfbaa523f3e44e50f8719f1308ea0a0 /libavcodec/raw.c | |
parent | 1b307febc4d44f094ae9ebe83a34d8810263b286 (diff) |
raw rgb flip fix
Originally committed as revision 3724 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/raw.c')
-rw-r--r-- | libavcodec/raw.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/raw.c b/libavcodec/raw.c index 9128b1d548..957a809d8b 100644 --- a/libavcodec/raw.c +++ b/libavcodec/raw.c @@ -106,6 +106,13 @@ static int raw_init_decoder(AVCodecContext *avctx) return 0; } +static void flip(AVCodecContext *avctx, AVPicture * picture){ + if(!avctx->codec_tag && avctx->bits_per_sample && picture->linesize[1]==0){ + picture->data[0] += picture->linesize[0] * (avctx->height-1); + picture->linesize[0] *= -1; + } +} + static int raw_decode(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) @@ -118,6 +125,7 @@ static int raw_decode(AVCodecContext *avctx, /* Early out without copy if packet size == frame size */ if (buf_size == context->length && context->p == context->buffer) { avpicture_fill(picture, buf, avctx->pix_fmt, avctx->width, avctx->height); + flip(avctx, picture); *data_size = sizeof(AVPicture); return buf_size; } @@ -132,6 +140,7 @@ static int raw_decode(AVCodecContext *avctx, memcpy(context->p, buf, bytesNeeded); context->p = context->buffer; avpicture_fill(picture, context->buffer, avctx->pix_fmt, avctx->width, avctx->height); + flip(avctx, picture); *data_size = sizeof(AVPicture); return bytesNeeded; } |