Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

NEED HELP URGENTLY!

Hi!
To all who can give me suggestion or flow of algorithm,
I am using gcc arm compiler.
I m writting C program which can display jpeg image on LCD screen of my phone.
The problem is I have to display any jpeg image with any dimension on 480*272 LCD(this is width and height of my phone's LCD).
Now I have below code:
int XJPG_SizeCheckAndScale(struct jpeg_decompress_struct* cinfo, int LCD width, int LCDheight)
{
JDIMENSION height = cinfo->image_height, width = cinfo->image_width;
unsigned int scale_num = 1, scale_denom = 1;
unsigned int scaling = 1;
while((height>LCDwidth || width>LCDheight) && scaling<8)
{
scaling++;
height=(JDIMENSION)(cinfo->image_height/scaling);
width=(JDIMENSION)(cinfo->image_width/scaling);
}
if(scaling>1)
{
switch(scaling)
{
//TODO: a proper scaling needed
case 2:
case 4:
case 8:
cinfo->scale_num=1; cinfo->scale_denom=scaling;
break;
}
}
return 0;
this code can scale
Sign In or Register to comment.