0

Hiya !

I want to see how the following types of files’ Interpreters are built into a browser :

1. Un-compressed Image files
2. Compressed Image files
3. Un-compressed Animation files
4. Compressed Animation files
5. Un-compressed Audio files
6. Compressed Audio files

Question 1 :
So, can anyone tell me please, how do I check all this out ?
I mean, which file in a browser or which part of the browser’s source code should I check to read the source codes of the above 6 file types’ Interpreters ?
A browser has millions of lines of codes. I don’t want to go through each and everyone of these lines of codes and so I need your help to direct me to the right direction so I can easily spot the above 6 types of file’s source codes.

Why do I want to check the source codes of these 6 file types ?
Because :

1. so I can learn how the “Compressing Algorithms were written
and
2. learn how a “Built-In Interpreter to translate Compression Files are written
and
3. learn which part of the browser these 6 types of file’s “Built-In Interpreters are residing.

You may have a question :
Why do I want to learn and gain experience in all these ?
Answer :
So if I ever come-up with a better “compressing algorithm for an “Image or Audio or “Animation or “Video file and create my own “compression file type then I can write the “Interpreter for my compression file type and simply “include it in the “appropriate place in the browser (build the Interpreter in the browser) so whenever a website has a compressed “audio or “image or “animation or “video file with my invented “file extension on it then the browser will be capable to understand it with the help of my “built-In Interpreter (which I insert in it) and translate or “decompress the “compressing codes.

Question 2 :
How many colours does a browser show ?
I understand that there are millions of similar colours but how many colours actually are our browsers capable of exactly showing to us when translating an image, animation, video from an uncompressed file to provide good quality images, animations and videos ?
The same question goes for compressed files.


Cheers !

3
Contributors
4
Replies
6
Views
12 Years
Discussion Span
Last Post by onauc
0

1) get some good books on compiler design and algorithms.
2) as many as your operating system will support OR as many as the image file has encoded into it, whichever is smaller. The display functions are handled by the operating system, the browser just tells the OS what to show where on screen.

0

1) get some good books on compiler design and algorithms.
2) as many as your operating system will support OR as many as the image file has encoded into it, whichever is smaller. The display functions are handled by the operating system, the browser just tells the OS what to show where on screen.

Cheers but how do I find-out how many colours my OS handles ?
How do I know which colour represents which machine code "1"s and "0"s or should I have said that the other way round ?
eg.
11111110 = sky blue
11111100 = navy blue
11111000 = dark blue

and so on.
I will tell you what I am really looking for in a browser's source code......
I am looking for something (C Codes) like this in a browser's source-code...
(Imagine the CAPITAL LETTERS are C codes).

IF FILE HAS "sky blue" FOR A PIXEL THEN DISPLAY THAT AS 11111110 TO THAT PIXEL.
IF FILE HAS "navy blue" FOR A PIXEL THEN DISPLAY THAT AS 11111100 TO THAT PIXEL.

Now, if I switch the colours then the browser will display different colour.
eg. If I switch on the source code the colour code like this...

IF FILE HAS "sky blue" FOR A PIXEL THEN DISPLAY THAT AS 0000000 TO THAT PIXEL.
IF FILE HAS "navy blue" FOR A PIXEL THEN DISPLAY THAT AS 0000001 TO THAT PIXEL.

Imagine that 00000000 = black
and
00000001 = white.

Now, an image that is sky-blue will display white in my updated browser because I changed the colour codes from it's source code.
I want to do this to experiment.
I want to change like this not only the colours but the html and javascript too. So, my updated browser will translate html and javascript differently.
It will translate according to "my instructions".
And to do this, I must find the appropriate C instructions in a browser so I can experiment like this.
I am getting into programming and so I just want to experiment this and that. That's all.

Oh by the way, why did you ask me to get a book on how to build a compiler ? What has that got to do with any of this ?
Frankly, one day, God willing, I will do just that but not just yet.
Must start on small things first.
One day I will do the same to C compiler.

I will be looking for something (C Codes) like this in the C compiler's source-code...
(Imagine the CAPITAL LETTERS are C codes that instruct the compiler what do if a certain function is in the programmer's software's source-code).

IF SOURCE CODE HAS "printf " THEN PRINT ON SCREEN.

Now, what I will do is replace that with :

IF SOURCE CODE HAS "print " THEN PRINT ON SCREEN.

so now, in my updated C compiler you a programmer won't have to type the silly "printf" to command the program to spit some-thing on the screen.
You will simply type the english word "print".
I will do this with the other functions too.
So now you know, what I want to do to a compiler.
Frankly, what I want to do to a browser is the same.
And that is why, I must find-out where on the C compiler's source code the instructions are for each function.
I must find-out where it says that "printf" means "print on screen" so that I can replace the "printf" with "print".
I must know likewise for the other functions so I can change them too.
And the same goes for the browser to change how it should translate colours and html tags and Javascript codes.
I must be pointed to the right specific lines of codes inside a browser and the C compiler because I don't have time to read through billions of lines of codes.
Get it ?

0

There are a few different encoding schemes in play now, RGB is one, CMYK is another; different file encodings use different schemes.

Most OS's use either straight RGB when you tell it how to light up a pixel, or a 'pallette' of 256 colors. The RGB might be 8/8/8 or 5/5/5 or some other combination of bits.

And generally you can ignore that unless you are dealing with specific needs; generally you can specify a pixel as 3 bytes; one for red, one for green, one for blue. Each byte is the intensity of that color, 0 (none) to 255 (full on). The OS is happy to turn that into the nearest representation it can manage.

So, there isn't really any code anywhere in a browser that says that 'navy blue is 00100010'. It's more like the camera said it was (12, 15, 200), the jpeg encoder lost a little accuracy, the decoder decodes it as, say, (16, 8, 212), the browser hands that to the OS, the OS displays it as pallette entry 27 which is (20,20,180).

0

There are a few different encoding schemes in play now, RGB is one, CMYK is another; different file encodings use different schemes.

Most OS's use either straight RGB when you tell it how to light up a pixel, or a 'pallette' of 256 colors. The RGB might be 8/8/8 or 5/5/5 or some other combination of bits.

And generally you can ignore that unless you are dealing with specific needs; generally you can specify a pixel as 3 bytes; one for red, one for green, one for blue. Each byte is the intensity of that color, 0 (none) to 255 (full on). The OS is happy to turn that into the nearest representation it can manage.

So, there isn't really any code anywhere in a browser that says that 'navy blue is 00100010'. It's more like the camera said it was (12, 15, 200), the jpeg encoder lost a little accuracy, the decoder decodes it as, say, (16, 8, 212), the browser hands that to the OS, the OS displays it as pallette entry 27 which is (20,20,180).

Mmmm. Then how do you suggest I do what I intend to do then ?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.