gifanalyzer: decode more bytes of Image descriptor

This commit is contained in:
Thomas Bernard 2018-01-30 13:50:14 +01:00
parent a4b80c75e1
commit 8c029c5993

View File

@ -29,7 +29,7 @@ int main(int argc, char* argv[])
FILE* theFile; FILE* theFile;
uint8_t buffer[256]; uint8_t buffer[256];
uint16_t w,h; uint16_t w,h;
uint16_t x,y;
if(argc < 2) if(argc < 2)
{ {
@ -91,15 +91,18 @@ int main(int argc, char* argv[])
if (i > 1) if (i > 1)
printf("Skipped %d meaningless bytes before image descriptor\n",i); printf("Skipped %d meaningless bytes before image descriptor\n",i);
uint16_t x,y; fread(&x,2,1,theFile);
fread(&y,2,1,theFile);
fread(&x,2,1,theFile); fread(&w,2,1,theFile);
fread(&y,2,1,theFile); fread(&h,2,1,theFile);
fread(&w,2,1,theFile); fread(buffer,1,1,theFile);
fread(&h,2,1,theFile);
printf("Image descriptor\n"); printf("Image descriptor\n");
printf("\tx=%d y=%d w=%d h=%d\n",x,y,w,h); printf("\tx=%d y=%d w=%d h=%d\n",x,y,w,h);
printf("\t%sLocal Color Table (%d colors) %sSorted, %s\n",
(buffer[0]&0x80)?"":"No ", 1 << ((buffer[0]&0x07)+1),
(buffer[0]&0x20)?"":"Not ",
(buffer[0]&0x40)?"Interlaced":"Progressive");
fclose(theFile); fclose(theFile);
} }