OSDN Git Service

check image size is multiple of 16 -- dmjpeg.c
authorKenichi Kurimoto <kurimoto12@users.sourceforge.jp>
Tue, 15 Feb 2011 07:19:43 +0000 (16:19 +0900)
committerKenichi Kurimoto <kurimoto12@users.sourceforge.jp>
Tue, 15 Feb 2011 07:19:43 +0000 (16:19 +0900)
snapgear-2.6-p42/user/jpeg-6b/dmjpeg.c

index 4621f1f..62de938 100644 (file)
@@ -179,10 +179,7 @@ void setup_hardware(j_decompress_ptr cinfo)
   fprintf(stderr, "Framebuffer xsize:%d, ysize:%d, vbpp:%d\n", 
           cinfo->fb_vinfo.xres, cinfo->fb_vinfo.yres, cinfo->fb_vinfo.bits_per_pixel);
   //#endif
-  if(cinfo->fb_vinfo.xres % 16 != 0 || cinfo->fb_vinfo.yres % 16 != 0){
-    fprintf(stderr, "This system support only multiple of 16 X,Y size Framebuffer.\n");
-    exit(1);  
-  }
+  
   if(cinfo->fb_vinfo.bits_per_pixel != 16){
     fprintf(stderr, "This system support only 16 bits per pixel Framebuffer\n");
     exit(1);  
@@ -195,6 +192,11 @@ void setup_hardware(j_decompress_ptr cinfo)
   }
   cinfo->fb_yinc = cinfo->fb_vinfo.bits_per_pixel / 8;
 
+  if(cinfo->image_width % 16 != 0 || cinfo->image_width % 16 != 0){
+    fprintf(stderr, "This system support only multiple of 16 X,Y size motion JPEG.\n");
+    exit(1);  
+  }
+
   /* access IP core */
   printf("setting up hardware\n");
   cinfo->dev_fd = open("/dev/kmjpeg", O_RDWR);