Repository navigation
Replies: 2 comments
|
It's not quite enough to be runnable and modifiable, but for study, you primarily want two sections, code common to all decoders, and the jpeg decoder code. Those sections happen to be adjacent in the source file, so most of the JPEG decoder is just lines 1585-4081 of the current version: https://github.com/nothings/stb/blob/master/stb_image.h#L1585-L4081 |
All reactions
0 replies
|
Also, that's quite a lot of code because of optimizations and other improvements in the 16 years since it was first released. You will have an easier time with oldest version in github from 10 years ago, which is only 1250 lines instead of 2500: Lines 729 to 1971 in 236004f
|
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I want to study and modify the JPEG decoder in stb_image.h. However, currently stb_image.h contains 9 decoders so it is a bit hard to find and study the JPEG decoder only. So how to extract the JPEG decoder source code only from stb_image.h?
There is a macro STBI_ONLY_JPEG to only include the JPEG decoder, so I try to use the following preprocessor:
cl /P /EP /C /DSTBI_ONLY_JPEG stb_image.h
But that will produce a file with all macros applied, not just STBI_ONLY_JPEG.
All reactions