Everything You Need to Know About JPEG - Episode 2 Part 1: JPEG Markers

In this series you will learn all of the in-depth details of the complex and sophisticated JPEG image compression format
In this episode, we begin learning about JPEG markers and start building the decoder
Jump into the playlist here: • Everything You Need to...
The code for this series can be found here: github.com/dannye/jed
The example jpeg files used throughout this series can be downloaded here: www.mediafire.com/file/x3o1ic...

Пікірлер: 23

  • @singha360
    @singha3604 жыл бұрын

    @34:40 Just to let anyone know that it might not work when testing at that point. This might not work for all JPEG files if anyone gets to that point of the tutorial. the reason being is it is not guaranteed that the Quantization Table Marker bytes will follow after all the APPN bytes. In my case, with a picture I took to test, after traversing through all the APPN bytes, doing inFile.get() goes to FF C4 (Huffman Table). I made a temporary while loop inside the marker loop to get the Quantization Table printing on the console: while (last != 0xFF && current != 0xDB) { last = inFile.get(); current = inFile.get(); } This of course won't be necessary in the future when all markers will have all of the function to handle each of them for which the tutorial series provide later on but just as a heads up for anyone following this and not getting anything printed.

  • @gukaitian9120

    @gukaitian9120

    Жыл бұрын

    thanks😃

  • @267praveen
    @267praveen3 жыл бұрын

    What a brilliant video. Thoroughly enjoyed. One query - Can you please make a video on jpeg2000 structure and writing code for that too? I know it's high ask but you have set high expectations already.

  • @user-cf5uf9sw1u
    @user-cf5uf9sw1u3 жыл бұрын

    Can you make this code available somewhere? It would be easier to reference it later :)

  • @danielharding3688

    @danielharding3688

    2 жыл бұрын

    Yes! The code is available here: github.com/dannye/jed Sorry for taking so long to reply

  • @singha360
    @singha3604 жыл бұрын

    @18:30 Could you elaborate on what you mean by bit shifting the first byte to the left with an example of what's happening? I am not understanding that part.

  • @danielharding3688

    @danielharding3688

    4 жыл бұрын

    We need to read a 16-bit unsigned integer. Since we are traversing the file byte by byte, we need to read two individual bytes. Each of these bytes is 8 bits. Let's say the first byte is XXXXXXXX and the second byte is YYYYYYYY. We bit-shift the first byte to the left eight times so its value becomes the 16-bit number XXXXXXXX00000000. Then we add the second byte to get the desired value of XXXXXXXXYYYYYYYY.

  • @singha360

    @singha360

    4 жыл бұрын

    @@danielharding3688 Ah I see. Thx!

  • @urbansan
    @urbansan3 жыл бұрын

    I can refactor this in Python in a OOP way if you would like. Just plowing ahead through each byte is fine but implementing additional features for and outside coder looks like a nightmare:)

  • @bonbonpony

    @bonbonpony

    2 жыл бұрын

    Is there some API in Python similar to how the I/O streams work in C++? Something that would allow me to access a stream of bytes in a file on disk, as well as a stream of bytes in a memory buffer, with the same API? Because from what I see, the file interface in Python is kinda like just a wrapper on those old file APIs from C. There are also byte strings, but one needs to read them from a file first into memory before being able to process them (and at that point, they're not exactly a stream anymore, just a random-access buffer, like an array of bytes). The good thing about the streaming approach is that one doesn't need to read the entire file into memory in order to be able to process its bytes - one can just read them from the stream, byte by byte, occasionally doing a jump to some other location in the stream, and the streaming API handles all the buffering itself, underneath. Is there an equivalent API in Python?

  • @maxwellmbugua6146
    @maxwellmbugua61462 жыл бұрын

    Hi, can you please provide the original image you are using. Thanks

  • @danielharding3688

    @danielharding3688

    2 жыл бұрын

    cattime.com/assets/uploads/gallery/persian-cats-and-kittens/persian-cats-and-kittens-1.jpg I downloaded the image years ago so I do not remember the original source and I do not want to re-upload because I do not know the copyright of the image, but I found an identical copy of the jpeg file here. In hindsight, I should have found some jpeg files that can be freely redistributed. Oh well.

  • @maxwellmbugua6146

    @maxwellmbugua6146

    2 жыл бұрын

    @@danielharding3688 Thanks. Just that I had a problem with the file I was using, but I found another which works

  • @danielharding3688

    @danielharding3688

    2 жыл бұрын

    @@maxwellmbugua6146 Cool. I'm curious if your first file will work by the end of episode 2 part 2

  • @maxwellmbugua6146

    @maxwellmbugua6146

    2 жыл бұрын

    @@danielharding3688 I think it will. I think the problem was that the Quantization Marker bytes did not follow the APPN bytes, which I think has been pointed out in the comments already by @Singha360

  • @maxwellmbugua6146

    @maxwellmbugua6146

    2 жыл бұрын

    @@danielharding3688 Hi,, 👋,, I encountered a problem when using the given image,, turns out its a progressive jpeg and hence I could not follow with Episode 2 Part 1. Also do you have any simple recommendations for written sources that outline the specification for jpeg markers. Thank you.

  • @bhanuprakashreddy
    @bhanuprakashreddy3 жыл бұрын

    Can use codeblocks ide for writing the code I am using windows 10

  • @danielharding3688

    @danielharding3688

    3 жыл бұрын

    You can use any text editor you wish. Even Notepad. It makes no difference :)

  • @267praveen

    @267praveen

    3 жыл бұрын

    You can use any editor but try Using Visual Studio as it will help you to debug code also. You can find videos on how to use visual studio