diff mjpeg.c @ 2266:514949de5d15 libavcodec

set AVCodecContext.width/height to the picture width/height instead of the one stored in the bitstream (that only matters if lowres!=0)
author michael
date Mon, 27 Sep 2004 02:39:55 +0000
parents 7096bf7c3434
children 143c17950b55
line wrap: on
line diff
--- a/mjpeg.c	Sun Sep 26 23:01:42 2004 +0000
+++ b/mjpeg.c	Mon Sep 27 02:39:55 2004 +0000
@@ -859,6 +859,8 @@
     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 @@
 	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 @@
             
         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 @@
     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 @@
 #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;