@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 Жыл бұрын
thanks😃
@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.
@danielharding36884 жыл бұрын
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.
@singha3604 жыл бұрын
@@danielharding3688 Ah I see. Thx!
@267praveen4 жыл бұрын
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.
@しげお-i1l3 жыл бұрын
Can you make this code available somewhere? It would be easier to reference it later :)
@danielharding36883 жыл бұрын
Yes! The code is available here: github.com/dannye/jed Sorry for taking so long to reply
@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:)
@bonbonpony2 жыл бұрын
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?
@maxwellmbugua61463 жыл бұрын
Hi, can you please provide the original image you are using. Thanks
@danielharding36883 жыл бұрын
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.
@maxwellmbugua61463 жыл бұрын
@@danielharding3688 Thanks. Just that I had a problem with the file I was using, but I found another which works
@danielharding36883 жыл бұрын
@@maxwellmbugua6146 Cool. I'm curious if your first file will work by the end of episode 2 part 2
@maxwellmbugua61463 жыл бұрын
@@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
@maxwellmbugua61463 жыл бұрын
@@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.
@bhanuprakashreddy4 жыл бұрын
Can use codeblocks ide for writing the code I am using windows 10
@danielharding36884 жыл бұрын
You can use any text editor you wish. Even Notepad. It makes no difference :)
@267praveen4 жыл бұрын
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