Hi, I know this is a very specific question, however it's been troubling me for a while now.
I'm at the stage in my OS development where I can begin porting libraries, and so far I'm trying to port zlib & libpng.
I have a very annoying problem when trying to load *.png files through my port of libpng, is that while small to medium png files
gets loaded, they all throw a warning, however they get loaded and produce no visible error when rendering the png files.
The warning they give me is something like "gAMA: Bad gamma value", however it seems like that warning hardly matters (since they look like they should).
Now, when trying to load larger png files, like in the size of 1024x768, I get errors every time, and they are in the style of "bad adaptive filter value"
and "CRC: BAD DATA". And I've checked the png files with pngcheck.exe, and it clears them to be fine, so the fault must be in my port of libpng.
So, Im just wondering if anyone has any trouble that is just a little bit like this, and if so, they had any solution to this? Or is it just my
c library that is full of errors.
Thanks in advance
Libpng troubles
Re: Libpng troubles
If you have written your own libc - Yes, it's full of errors. Your stdio is probably entirely all wrong, your ungetc routine probably too. Your heap isn't consistent and memory is corrupting all over. It's time to debug! I had lots of this kind of errors when I originally began porting software to my OS and in most cases, my libc was full of errors.
If you have ported an existent libc, it probably has errors, but I'd watch the kernel closely too. You should be wary of register corruptions/stack corruptions too if these errors are sporadic and unpredictable.
If you have ported an existent libc, it probably has errors, but I'd watch the kernel closely too. You should be wary of register corruptions/stack corruptions too if these errors are sporadic and unpredictable.
Re: Libpng troubles
I suspect there is over sensitive warnings of newer version of libpng.
I upgrade libpng in one of my project and see warnings like color profile etc, while no visual defeats on the image.
And hey my image is created with photoshop, I can't blame photoshop generates bad file, huh.
There are few choice:
1. live with the warnings, although it output junks to stdout
2. disable the warnings
3. use tools such as imagemagick to process the images so that it looks good to libpng.
I upgrade libpng in one of my project and see warnings like color profile etc, while no visual defeats on the image.
And hey my image is created with photoshop, I can't blame photoshop generates bad file, huh.
There are few choice:
1. live with the warnings, although it output junks to stdout
2. disable the warnings
3. use tools such as imagemagick to process the images so that it looks good to libpng.
Re: Libpng troubles
Yes, I know my LibC is very very far from good, but the memory routines are well tested, as well as large portions of the stdio part, and I have no problem loading large BMP pictures (> 3 mb) (which is my current solution, using *.bmp instead of *.png on large pictures, and libpng for rest).
It just annoys me that there does not seem to be an obvious cause to the problem (But yes, i suspect memory corruption or some function in libc that doesn't work as it should). Im considering trying an older version of libpng (everybody seems to use 1.5.13 anyway) to see if that makes a difference. Atm im using 1.6.6.
It just annoys me that there does not seem to be an obvious cause to the problem (But yes, i suspect memory corruption or some function in libc that doesn't work as it should). Im considering trying an older version of libpng (everybody seems to use 1.5.13 anyway) to see if that makes a difference. Atm im using 1.6.6.
Re: Libpng troubles
It is probably worth noting I'm building using VS2010 (Which, I know, VS is an inferior build-chain compared to GCC when it comes to osdev, I've just gotten way too far to make the switch).
Re: Libpng troubles
Don't confuse yourself. Visual Studio is a dead end. It's a blind alley. You can't port visual studio to your OS (unless you made a deal with Microsoft). You are forced to use another compiler sooner or later or to never go self-hosting - it's a horrible mistake to prevent yourself from going self-hosting even if you are not interested in it now.
Really, if you are that far with your OS, you will benefit doubly from setting up an OS-specific toolchain that targets your OS. You can customize gcc in any way you like.
Really, if you are that far with your OS, you will benefit doubly from setting up an OS-specific toolchain that targets your OS. You can customize gcc in any way you like.