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

  Рет қаралды 7,556

Daniel Harding

Daniel Harding

Күн бұрын

Пікірлер: 23
@singha360
@singha360 4 жыл бұрын
@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😃
@singha360
@singha360 4 жыл бұрын
@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!
@267praveen
@267praveen 4 жыл бұрын
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.
@しげお-i1l
@しげお-i1l 3 жыл бұрын
Can you make this code available somewhere? It would be easier to reference it later :)
@danielharding3688
@danielharding3688 3 жыл бұрын
Yes! The code is available here: github.com/dannye/jed Sorry for taking so long to reply
@urbansan
@urbansan 3 жыл бұрын
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
@maxwellmbugua6146 3 жыл бұрын
Hi, can you please provide the original image you are using. Thanks
@danielharding3688
@danielharding3688 3 жыл бұрын
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 3 жыл бұрын
@@danielharding3688 Thanks. Just that I had a problem with the file I was using, but I found another which works
@danielharding3688
@danielharding3688 3 жыл бұрын
@@maxwellmbugua6146 Cool. I'm curious if your first file will work by the end of episode 2 part 2
@maxwellmbugua6146
@maxwellmbugua6146 3 жыл бұрын
@@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 3 жыл бұрын
@@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
@bhanuprakashreddy 4 жыл бұрын
Can use codeblocks ide for writing the code I am using windows 10
@danielharding3688
@danielharding3688 4 жыл бұрын
You can use any text editor you wish. Even Notepad. It makes no difference :)
@267praveen
@267praveen 4 жыл бұрын
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
She made herself an ear of corn from his marmalade candies🌽🌽🌽
00:38
Valja & Maxim Family
Рет қаралды 18 МЛН
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 81 МЛН
How are Images Compressed?  [46MB ↘↘ 4.07MB] JPEG In Depth
18:47
Branch Education
Рет қаралды 3,7 МЛН
JPEG DCT, Discrete Cosine Transform (JPEG Pt2)- Computerphile
15:12
Computerphile
Рет қаралды 645 М.
Rust Functions Are Weird (But Be Glad)
19:52
Logan Smith
Рет қаралды 149 М.
Everything You Need to Know About JPEG - Episode 1: JPEG Overview
42:13
Colourspaces (JPEG Pt0)- Computerphile
7:31
Computerphile
Рет қаралды 245 М.
Everything You Need to Know About JPEG - Episode 3: Bitmap Output
39:56
Harder Drive: Hard drives we didn't want or need
36:47
suckerpinch
Рет қаралды 1,7 МЛН
JPEG 'files' & Colour (JPEG Pt1)- Computerphile
7:18
Computerphile
Рет қаралды 374 М.
She made herself an ear of corn from his marmalade candies🌽🌽🌽
00:38
Valja & Maxim Family
Рет қаралды 18 МЛН