aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mjpeg.c
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2002-12-22 22:34:42 +0000
committerAlex Beregszaszi <alex@rtfs.hu>2002-12-22 22:34:42 +0000
commita46a7052bc20b630dae19148584941ced5ae78d6 (patch)
tree61edc7cf442d4bea3b00807dcb95146c58788733 /libavcodec/mjpeg.c
parent6bf40f396108995dea6768ec3df64cdabf7c2de2 (diff)
downloadffmpeg-a46a7052bc20b630dae19148584941ced5ae78d6.tar.gz
disabled aspect code due to it is extra buggy
Originally committed as revision 1359 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mjpeg.c')
-rw-r--r--libavcodec/mjpeg.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/libavcodec/mjpeg.c b/libavcodec/mjpeg.c
index 2e6dd8f0be..47ace7bc38 100644
--- a/libavcodec/mjpeg.c
+++ b/libavcodec/mjpeg.c
@@ -720,6 +720,8 @@ static int mjpeg_decode_init(AVCodecContext *avctx)
s->buffer_size = 102400; /* smaller buffer should be enough,
but photojpg files could ahive bigger sizes */
s->buffer = av_malloc(s->buffer_size);
+ if (!s->buffer)
+ return -1;
s->start_code = -1;
s->first_picture = 1;
s->org_width = avctx->width;
@@ -1183,17 +1185,24 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
int x_density = get_bits(&s->gb, 16);
int y_density = get_bits(&s->gb, 16);
+ dprintf("x/y density: %d (%f), %d (%f)\n", x_density,
+ (float)x_density, y_density, (float)y_density);
+#if 0
//MN: needs to be checked
if(x_density)
- s->avctx->aspect_ratio= s->width*y_density/((float)s->height*x_density);
+// s->avctx->aspect_ratio= s->width*y_density/((float)s->height*x_density);
+ s->avctx->aspect_ratio = (float)x_density/y_density;
+ /* it's better, but every JFIF I have seen stores 1:1 */
else
s->avctx->aspect_ratio= 0.0;
+#endif
}
else
{
skip_bits(&s->gb, 16);
skip_bits(&s->gb, 16);
}
+
t_w = get_bits(&s->gb, 8);
t_h = get_bits(&s->gb, 8);
if (t_w && t_h)
@@ -1434,7 +1443,6 @@ static int mjpeg_decode_frame(AVCodecContext *avctx,
case EOI:
eoi_parser:
{
- int l;
if (s->interlaced) {
s->bottom_field ^= 1;
/* if not bottom field, do not output image yet */
@@ -1443,15 +1451,8 @@ eoi_parser:
}
for(i=0;i<3;i++) {
picture->data[i] = s->current_picture[i];
-#if 1
- l = s->linesize[i];
- if (s->interlaced)
- l >>= 1;
- picture->linesize[i] = l;
-#else
picture->linesize[i] = (s->interlaced) ?
s->linesize[i] >> 1 : s->linesize[i];
-#endif
}
*data_size = sizeof(AVPicture);
avctx->height = s->height;