visopsys.org

Visopsys Forums
It is currently Sat Apr 21, 2018 6:16 pm

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: kernel errors related to JPG images
PostPosted: Wed Sep 25, 2013 9:00 am 
Offline

Joined: Thu Aug 15, 2013 4:23 pm
Posts: 22
Hi Andy,

I have been playing with Visopsys for a while today, trying to modify some images and icons, but an error appears when I modify them.
It happens with the JPG images, and I think it has something to do with my version of GIMP (2.8). I guess that (1) your version of GIMP is different and that (2) the JPG format that is created in my linux (I don't know how to know it exactly) when I save the images with my version of GIMP is different than yours :think: . Can I ask you what's the version of your GIMP? Or what format should the JPG images have?
I have been trying different options, different RBG colors (16 bits, 24 bits, 32 bits), etc but by the moment I can't find out how to solve it.
I attach an image of the Console Window with the related errors :geek:

Thank you and have a nice day! ;)

Oscar


Attachments:
Visopsys_jpg-error.png
Visopsys_jpg-error.png [ 3.78 KiB | Viewed 11635 times ]
Top
 Profile  
 
 Post subject: Re: kernel errors related to JPG images
PostPosted: Wed Sep 25, 2013 7:17 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 7:20 pm
Posts: 462
Hi Oscar,

These error messages are related to unsupported JPEG compression types. At the moment, my JPEG code (in kernelImageJpg.c) only supports "Baseline DCT". Your images are using "Progressive DCT" (0xC2). You can see a list of the different ones in kernelImageJpg.h:
Code:
// SOF (Start Of Frame) markers.
#define JPG_SOF                 0xC0  // Baseline DCT
// The rest are unused except to recognise unsupported formats.
#define JPG_SOF1                0xC1  // Etended sequential DCT
#define JPG_SOF2                0xC2  // Progressive DCT
#define JPG_SOF3                0xC3  // Lossless (sequential)
#define JPG_SOF5                0xC5  // Diff. sequential DCT
#define JPG_SOF6                0xC6  // Diff. progressive DCT
#define JPG_SOF7                0xC7  // Diff. lossless (sequential)
#define JPG_SOF8                0xC8  // Reserved
#define JPG_SOF9                0xC9  // Extended sequential DCT (arith)
#define JPG_SOF10               0xCA  // Progressive DCT (arith)
#define JPG_SOF11               0xCB  // Lossless (sequential arith)
#define JPG_SOF13               0xCD  // Diff. sequential DCT (arith)
#define JPG_SOF14               0xCE  // Diff. progressive DCT (arith)
#define JPG_SOF15               0xCF  // Diff. lossless (sequential arith)

You can probably pick the baseline compression method in the 'save as' options of your GIMP. Hope this helps!
Andy


Top
 Profile  
 
 Post subject: Re: kernel errors related to JPG images
PostPosted: Thu Sep 26, 2013 11:37 am 
Offline

Joined: Thu Aug 15, 2013 4:23 pm
Posts: 22
Hi Andy,

Actually I looked at kernelImageJpg.c before posting, trying to understand what exactly those numbers ('0xC2') mean, but I couldn't know it because in the c source code those commentaries are not written, and I didn't see them in the header file :doh: hehe. Anyway, honestly speaking, I didn't know about the formats of the JPG images before hehe :roll: . So this time, thanks to your help, I found what to do and the error didn't appear anymore :dance: .

I attach an image with the parameters that need to be adjusted so that the error related to JPEG images doesn't appear again :geek: . In a few words, don't forget to put the extension 'JPEG' and then, in Advanced Options, unselect 'Optimize' and 'Progressive'.

Have a nice day! :D

Oscar


Attachments:
unsel_opts_JPG_compat.png
unsel_opts_JPG_compat.png [ 122.46 KiB | Viewed 11625 times ]
Top
 Profile  
 
 Post subject: Re: kernel errors related to JPG images
PostPosted: Sat Dec 21, 2013 12:53 pm 
Offline
User avatar

Joined: Fri Jul 22, 2011 3:53 pm
Posts: 45
andymc wrote:
Hi Oscar,

These error messages are related to unsupported JPEG compression types. At the moment, my JPEG code (in kernelImageJpg.c) only supports "Baseline DCT". Your images are using "Progressive DCT" (0xC2). You can see a list of the different ones in kernelImageJpg.h:
Code:
// SOF (Start Of Frame) markers.
#define JPG_SOF                 0xC0  // Baseline DCT
// The rest are unused except to recognise unsupported formats.
#define JPG_SOF1                0xC1  // Etended sequential DCT
#define JPG_SOF2                0xC2  // Progressive DCT
#define JPG_SOF3                0xC3  // Lossless (sequential)
#define JPG_SOF5                0xC5  // Diff. sequential DCT
#define JPG_SOF6                0xC6  // Diff. progressive DCT
#define JPG_SOF7                0xC7  // Diff. lossless (sequential)
#define JPG_SOF8                0xC8  // Reserved
#define JPG_SOF9                0xC9  // Extended sequential DCT (arith)
#define JPG_SOF10               0xCA  // Progressive DCT (arith)
#define JPG_SOF11               0xCB  // Lossless (sequential arith)
#define JPG_SOF13               0xCD  // Diff. sequential DCT (arith)
#define JPG_SOF14               0xCE  // Diff. progressive DCT (arith)
#define JPG_SOF15               0xCF  // Diff. lossless (sequential arith)

You can probably pick the baseline compression method in the 'save as' options of your GIMP. Hope this helps!
Andy


How can we add these formats ? what codes needs to be written ?


Top
 Profile  
 
 Post subject: Re: kernel errors related to JPG images
PostPosted: Mon Dec 23, 2013 10:47 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 7:20 pm
Posts: 462
The place to add code would be in kernelImageJpg.[c|h].

They're different compression methods. If you want to add others, then I would start by looking at the most commonly encountered ones, and googling and studying the algorithms.

Compression tends to be quite complex. I only had the stomach for doing that one method, but perhaps it wouldn't be too difficult to extend the existing code?


Top
 Profile  
 
 Post subject: Re: kernel errors related to JPG images
PostPosted: Tue Dec 24, 2013 6:47 pm 
Offline
User avatar

Joined: Fri Jul 22, 2011 3:53 pm
Posts: 45
andymc wrote:
The place to add code would be in kernelImageJpg.[c|h].

They're different compression methods. If you want to add others, then I would start by looking at the most commonly encountered ones, and googling and studying the algorithms.

Compression tends to be quite complex. I only had the stomach for doing that one method, but perhaps it wouldn't be too difficult to extend the existing code?


Yeah im googling everything too lol :)

i will try adding "Progressive DCT" compression :) so main problem will be fixed.. Because JPG's are saving with Progressive DCT everytime in other systems. :)

Yeah your codes pretty cool :) im starting understand structure of many things :) I bought lots of C books and practicing with codes on linux and visopsys right now LOL :) I Hope i can do contributions to that system. Because i really liked structure and base. Its simple and secured.
I'm also Recognized Developer(doga.ozkaraca) in XDA-Developers.. But i always want to do improve base and make better instead of using base and making apps on it like a programming for android.. I can try to change and make better something in android.But lots of people working on that already and it has HUGE code stuff .So if i do something for it. no one will realize in these whole codes.. and changes will affect Java codes... Not C..
But C is base of system.. So i want to do something with C :D also i want to learn C with all stuff (Java is similar of C but it has libraries and everything ready for doing something. its easy instead of C lol)


Top
 Profile  
 
 Post subject: Re: kernel errors related to JPG images
PostPosted: Sun Dec 29, 2013 1:51 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 7:20 pm
Posts: 462
Any luck with this JPEG code?

I wonder whether a lot of the code that you'll need, like the DCT, isn't already there, and maybe it just needs to process the stream in a slightly different way?


Top
 Profile  
 
 Post subject: Re: kernel errors related to JPG images
PostPosted: Sat Mar 08, 2014 12:19 pm 
Offline
User avatar

Joined: Fri Jul 22, 2011 3:53 pm
Posts: 45
andymc wrote:
Any luck with this JPEG code?

I wonder whether a lot of the code that you'll need, like the DCT, isn't already there, and maybe it just needs to process the stream in a slightly different way?



I think we need to process stream in a slightly different way.

i activated SOF2 decoding by doing

Code:
case JPG_SOF2:
  // A frame header is here
         jpg->frameHeader =
      (jpgFrameHeader *)(imageFileData + count1 + 1);
         jpg->frameHeader->length =
      kernelProcessorSwap16(jpg->frameHeader->length);
         if (jpg->frameHeader->precision != 8)
      {
        kernelError(kernel_error, "Only 8bpp JPEGs are supported "
               "(this is %d)", jpg->frameHeader->precision);
        return (status = ERR_NOTIMPLEMENTED);
      }
         jpg->frameHeader->height =
      kernelProcessorSwap16(jpg->frameHeader->height);
         jpg->frameHeader->width =
      kernelProcessorSwap16(jpg->frameHeader->width);
         if (jpg->frameHeader->numComps != 3)
      {
        kernelError(kernel_error, "Only 3-component JPEGs are "
               "supported");
        return (status = ERR_NOTIMPLEMENTED);
      }
         count1 += jpg->frameHeader->length;
break;


that..

and it decodes the image in decode() function probably.. isn't it ?
and maybe a little explanation of how Baseline JPGs works with these codes? i mean what makes it working..
I searched about Huffman table etc.
But i couldn't find anything useful for decoding different SOFs..

If you can explain me about Which route the codes are following from getting image file to showing image,i can try making it working..

and as i understand all JPGs following same route for getting width and height of image..
and some images with SOF2 are showing glitches on View program instead of black empty screen :p :ugeek: :D


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group