changeset 935:c9bbd35064b6 libavcodec

disabled aspect code due to it is extra buggy
author al3x
date Sun, 22 Dec 2002 22:34:42 +0000
parents 159333d9297e
children caa77cd960c0
files mjpeg.c
diffstat 1 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mjpeg.c	Sat Dec 21 15:54:21 2002 +0000
+++ b/mjpeg.c	Sun Dec 22 22:34:42 2002 +0000
@@ -720,6 +720,8 @@
     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 @@
 	    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 @@
 		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 @@
                         }
                         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;