diff mjpeg.c @ 2270:21f450be6cb5 libavcodec

lowres width/height cleanup 3rd try
author michael
date Mon, 27 Sep 2004 11:50:56 +0000
parents 143c17950b55
children f9f257b41ec2
line wrap: on
line diff
--- a/mjpeg.c	Mon Sep 27 10:06:10 2004 +0000
+++ b/mjpeg.c	Mon Sep 27 11:50:56 2004 +0000
@@ -859,8 +859,6 @@
     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));
@@ -880,7 +878,7 @@
 	return -1;
     s->start_code = -1;
     s->first_picture = 1;
-    s->org_height = avctx->height << avctx->lowres;
+    s->org_height = avctx->coded_height;
     
     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);
@@ -1032,8 +1030,7 @@
             
         s->width = width;
         s->height = height;
-        s->avctx->width  = -((-s->width )>>s->avctx->lowres);
-        s->avctx->height = -((-s->height)>>s->avctx->lowres);
+        avcodec_set_dimensions(s->avctx, width, height);
 
         /* test interlaced mode */
         if (s->first_picture &&
@@ -2043,10 +2040,10 @@
     j += sizeof(sp5x_data_dht);
 
     memcpy(recoded+j, &sp5x_data_sof[0], sizeof(sp5x_data_sof));
-    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;
+    recoded[j+5] = (avctx->coded_height >> 8) & 0xFF;
+    recoded[j+6] = avctx->coded_height & 0xFF;
+    recoded[j+7] = (avctx->coded_width >> 8) & 0xFF;
+    recoded[j+8] = avctx->coded_width & 0xFF;
     j += sizeof(sp5x_data_sof);
 
     memcpy(recoded+j, &sp5x_data_sos[0], sizeof(sp5x_data_sos));
@@ -2070,10 +2067,8 @@
 #else
     /* SOF */
     s->bits = 8;
-    s->width  = avctx->width;
-    s->height = avctx->height;
-    avctx->width  = -((-avctx->width )>>avctx->lowres);
-    avctx->height = -((-avctx->height)>>avctx->lowres);
+    s->width  = avctx->coded_width;
+    s->height = avctx->coded_height;
     s->nb_components = 3;
     s->component_id[0] = 0;
     s->h_count[0] = 2;