diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-09-27 02:39:55 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-09-27 02:39:55 +0000 |
commit | 4f8a831994889f2a90669dc230c14d203d52083d (patch) | |
tree | bda1bf3ac88ece871b88a36ff6a4d95eb4ef81a3 /libavcodec/mjpeg.c | |
parent | 718455951c74269a95117b117a2790c4edeef979 (diff) | |
download | ffmpeg-4f8a831994889f2a90669dc230c14d203d52083d.tar.gz |
set AVCodecContext.width/height to the picture width/height instead of the one stored in the bitstream (that only matters if lowres!=0)
Originally committed as revision 3518 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mjpeg.c')
-rw-r--r-- | libavcodec/mjpeg.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libavcodec/mjpeg.c b/libavcodec/mjpeg.c index cb90b410f5..ba056184db 100644 --- a/libavcodec/mjpeg.c +++ b/libavcodec/mjpeg.c @@ -859,6 +859,8 @@ static int mjpeg_decode_init(AVCodecContext *avctx) MpegEncContext s2; s->avctx = avctx; + avctx->width = -((-avctx->width )) >> avctx->lowres; + avctx->height= -((-avctx->height)) >> avctx->lowres; /* ugly way to get the idct & scantable FIXME */ memset(&s2, 0, sizeof(MpegEncContext)); @@ -878,7 +880,7 @@ static int mjpeg_decode_init(AVCodecContext *avctx) return -1; s->start_code = -1; s->first_picture = 1; - s->org_height = avctx->height; + s->org_height = avctx->height << avctx->lowres; build_vlc(&s->vlcs[0][0], bits_dc_luminance, val_dc_luminance, 12); build_vlc(&s->vlcs[0][1], bits_dc_chrominance, val_dc_chrominance, 12); @@ -1030,8 +1032,8 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s) s->width = width; s->height = height; - s->avctx->width = s->width; - s->avctx->height = s->height; + s->avctx->width = -((-s->width )>>s->avctx->lowres); + s->avctx->height = -((-s->height)>>s->avctx->lowres); /* test interlaced mode */ if (s->first_picture && @@ -2041,7 +2043,7 @@ static int sp5x_decode_frame(AVCodecContext *avctx, j += sizeof(sp5x_data_dht); memcpy(recoded+j, &sp5x_data_sof[0], sizeof(sp5x_data_sof)); - recoded[j+5] = (avctx->height >> 8) & 0xFF; + recoded[j+5] = (avctx->height >> 8) & 0xFF; //FIXME lowres recoded[j+6] = avctx->height & 0xFF; recoded[j+7] = (avctx->width >> 8) & 0xFF; recoded[j+8] = avctx->width & 0xFF; @@ -2068,8 +2070,8 @@ static int sp5x_decode_frame(AVCodecContext *avctx, #else /* SOF */ s->bits = 8; - s->width = avctx->width; - s->height = avctx->height; + s->width = avctx->width << avctx->lowres; + s->height = avctx->height<< avctx->lowres; s->nb_components = 3; s->component_id[0] = 0; s->h_count[0] = 2; |