From: Kenichi Kurimoto Date: Tue, 15 Feb 2011 07:19:43 +0000 (+0900) Subject: check image size is multiple of 16 -- dmjpeg.c X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;ds=sidebyside;h=5acfbddfcdf39a175ecb1b6ea8ca2fde0abd3787;p=fpga-leon-mjpeg%2Fleon-mjpeg.git check image size is multiple of 16 -- dmjpeg.c --- diff --git a/snapgear-2.6-p42/user/jpeg-6b/dmjpeg.c b/snapgear-2.6-p42/user/jpeg-6b/dmjpeg.c index 4621f1fe..62de9385 100644 --- a/snapgear-2.6-p42/user/jpeg-6b/dmjpeg.c +++ b/snapgear-2.6-p42/user/jpeg-6b/dmjpeg.c @@ -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);