[MPlayer-cvslog] r32460 - trunk/libvo/mga_template.c

reimar subversion at mplayerhq.hu
Sat Oct 9 13:41:11 CEST 2010


Author: reimar
Date: Sat Oct  9 13:41:10 2010
New Revision: 32460

Log:
Use FFALIGN macro.

Modified:
   trunk/libvo/mga_template.c

Modified: trunk/libvo/mga_template.c
==============================================================================
--- trunk/libvo/mga_template.c	Sat Oct  9 13:33:50 2010	(r32459)
+++ trunk/libvo/mga_template.c	Sat Oct  9 13:41:10 2010	(r32460)
@@ -42,7 +42,7 @@ static uint32_t               drwcX,drwc
 static struct SwsContext *sws_ctx;
 
 static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
-    uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31;
+    uint32_t bespitch = FFALIGN(mga_vid_config.src_width, 32);
     x0+=mga_vid_config.src_width*(vo_panscan_x>>1)/(vo_dwidth+vo_panscan_x);
     switch(mga_vid_config.format){
     case MGA_VID_FORMAT_YV12:
@@ -69,7 +69,7 @@ static void draw_osd(void)
 static void
 draw_slice_g200(uint8_t *image[], int stride[], int width,int height,int x,int y)
 {
-	uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31;
+	uint32_t bespitch = FFALIGN(mga_vid_config.src_width, 32);
 	int dst_stride[4] = { bespitch, bespitch };
 	uint8_t *dst[4];
 
@@ -86,7 +86,7 @@ draw_slice_g400(uint8_t *image[], int st
     uint8_t *dest2;
     uint32_t bespitch,bespitch2;
 
-    bespitch = (mga_vid_config.src_width + 31) & ~31;
+    bespitch = FFALIGN(mga_vid_config.src_width, 32);
     bespitch2 = bespitch/2;
 
     dest = vid_data + bespitch * y + x;
@@ -147,7 +147,7 @@ draw_frame(uint8_t *src[])
 }
 
 static uint32_t get_image(mp_image_t *mpi){
-    uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31;
+    uint32_t bespitch = FFALIGN(mga_vid_config.src_width, 32);
     uint32_t bespitch2 = bespitch/2;
 //    printf("mga: get_image() called\n");
     if(mpi->type==MP_IMGTYPE_STATIC && mga_vid_config.num_frames>1) return VO_FALSE; // it is not static
@@ -182,7 +182,7 @@ static uint32_t get_image(mp_image_t *mp
 
 static uint32_t
 draw_image(mp_image_t *mpi){
-    uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31;
+    uint32_t bespitch = FFALIGN(mga_vid_config.src_width, 32);
 
     // if -dr or -slices then do nothing:
     if(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK)) return VO_TRUE;
@@ -363,21 +363,24 @@ static int control(uint32_t request, voi
 
 static int mga_init(int width,int height,unsigned int format){
 
+        uint32_t bespitch = FFALIGN(width, 32);
         switch(format){
         case IMGFMT_YV12:
-	    width+=width&1;height+=height&1;
-	    mga_vid_config.frame_size = ((width + 31) & ~31) * height + (((width + 31) & ~31) * height) / 2;
+            width  = FFALIGN(width,  2);
+            height = FFALIGN(height, 2);
+            mga_vid_config.frame_size = bespitch * height + (bespitch * height) / 2;
             mga_vid_config.format=MGA_VID_FORMAT_I420; break;
         case IMGFMT_I420:
         case IMGFMT_IYUV:
-	    width+=width&1;height+=height&1;
-	    mga_vid_config.frame_size = ((width + 31) & ~31) * height + (((width + 31) & ~31) * height) / 2;
+            width  = FFALIGN(width,  2);
+            height = FFALIGN(height, 2);
+            mga_vid_config.frame_size = bespitch * height + (bespitch * height) / 2;
             mga_vid_config.format=MGA_VID_FORMAT_YV12; break;
         case IMGFMT_YUY2:
-	    mga_vid_config.frame_size = ((width + 31) & ~31) * height * 2;
+            mga_vid_config.frame_size = bespitch * height * 2;
             mga_vid_config.format=MGA_VID_FORMAT_YUY2; break;
         case IMGFMT_UYVY:
-	    mga_vid_config.frame_size = ((width + 31) & ~31) * height * 2;
+            mga_vid_config.frame_size = bespitch * height * 2;
             mga_vid_config.format=MGA_VID_FORMAT_UYVY; break;
         default:
             mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_InvalidOutputFormat,format);


More information about the MPlayer-cvslog mailing list