#19817 - sgeos - Mon Apr 26, 2004 2:15 am
I'm still confused as to why the color format the GBA uses is considered BGR. The LSB is red. Doesn't that make it RGB?
-Brendan
#19821 - poslundc - Mon Apr 26, 2004 4:04 am
The colour is represented as a 15-bit number. The digits of those numbers, from left to right, correspond to BGR.
In other words, the fields of the colour match up to the bitfields in the 15-bit number.
(The least significant bit is the furthest to the right when a number is written out in binary.)
Dan.
#19822 - ScottLininger - Mon Apr 26, 2004 5:47 am
Each pixel on an LCD is actually made up of 3 "subpixels" that are physically side-by-side, and each subpixel handles one of the three primary colors. If you look *really* close you can see these subpixels on the screen.
Most PC LCD screens have the subpixels ordered RED-GREEN-BLUE, while the GBA has them ordered BLUE-GREEN-RED. How those colors are represented in code or in memory is beside the point. The GameboyAdvance is a BGR console because of how the screen is oriented.
I guess if you played your gameboy upside down, you could call it an RGB console.
:)
Now why some hardware manufacturers do it one way why others do it another is beyond my simple brain.
#19823 - sgeos - Mon Apr 26, 2004 6:51 am
poslundc wrote: |
The colour is represented as a 15-bit number. The digits of those numbers, from left to right, correspond to BGR. |
It maked more sense, to me at least, to read the digits from LSB to MSB.
ScottLininger wrote: |
Most PC LCD screens have the subpixels ordered RED-GREEN-BLUE, while the GBA has them ordered BLUE-GREEN-RED. How those colors are represented in code or in memory is beside the point. |
All is clear.
ScottLininger wrote: |
Now why some hardware manufacturers do it one way why others do it another is beyond my simple brain. |
Perhaps they just want to be different? Nintendo in particular really seems to like the custom hardware. I was looking at a page on the sound chip in the SNES and it seemed that every component was manufactured by a different company!
-Brendan
#19841 - Cyberman - Mon Apr 26, 2004 5:13 pm
sgeos wrote: |
It maked more sense, to me at least, to read the digits from LSB to MSB.
|
You would have to elaborate what you think is 'sense' this is because the direction of the data can be RGB BGR GRB GBR RBG BRG (ANY of those formats). and reading from LSB to MSB is a non standard anywhere. It's neither little endian correct nor big endian correct because MSB is always the left and LSB is always the right. Most things are read left to right (namely because of english and ocidental influence). SO BGR would be read BGR MSB to LSB (left to right) both in little and big endian format the data visually represented is left to right MSB to LSB. Why? Endianess only has to do with how it's stored in memory not how it's visually represented.
sgeos wrote: |
Perhaps they just want to be different? Nintendo in particular really seems to like the custom hardware. I was looking at a page on the sound chip in the SNES and it seemed that every component was manufactured by a different company!
-Brendan |
Err NO.. Microsoft really is partially to blame with how they arranged the GDI in Windows using BGR format. Sony borrowed a number of microsoft isms when they made the Sony playstation (Shift JIS encoding for example in there Memory card data, and BGR format for all there color data presentations). I'm not sure the rational other than it is different. Many companys make things there way, which is neither bad nor good it's just there way. Fortunately it has to follow some sense so they got there way from someone elses IDEA. Thus RGB BGR makes no difference. That's just the way it is :)
Cyb
_________________
If at first you don't succeed parachuting is NOT for you.
#19847 - sajiimori - Mon Apr 26, 2004 6:49 pm
Hey Scott, are you sure it has nothing to do with color representation? I've never heard that perspective before.
Say I have 2 bitmap files that both used 24 bit color. The first orders the colors R-G-B-R-G-B... and the second orders them B-G-R-B-G-R... Would you not call the first an RGB image and the second a BGR image?
It's a little fuzzier when whole colors are packed into words, because nothing defines which bit is the "first" one. You could go with the ones place, or with the leftmost in written representation. Memory addresses, OTOH, are clearly defined as going from low to high, because that's the order that instructions are fetched.
#19849 - poslundc - Mon Apr 26, 2004 7:05 pm
Cyberman wrote: |
sgeos wrote: |
It maked more sense, to me at least, to read the digits from LSB to MSB.
|
You would have to elaborate what you think is 'sense' this is because the direction of the data can be RGB BGR GRB GBR RBG BRG (ANY of those formats). and reading from LSB to MSB is a non standard anywhere. It's neither little endian correct nor big endian correct because MSB is always the left and LSB is always the right. Most things are read left to right (namely because of english and ocidental influence). SO BGR would be read BGR MSB to LSB (left to right) both in little and big endian format the data visually represented is left to right MSB to LSB. Why? Endianess only has to do with how it's stored in memory not how it's visually represented. |
More to the point: there's nothing wrong with reading the colour value right-to-left (and therefore LSB to MSB) so long as you also read "BGR" right-to-left.
Dan.
#19855 - dagamer34 - Mon Apr 26, 2004 11:09 pm
The weirdest thing I've seen is that .avi files not only have their color format in BGR, the entire image is flipped upside down!
_________________
Little kids and Playstation 2's don't mix. :(
#19870 - sgeos - Tue Apr 27, 2004 2:06 am
Cyberman wrote: |
You would have to elaborate what you think is 'sense' this is because the direction of the data can be RGB BGR GRB GBR RBG BRG (ANY of those formats). and reading from LSB to MSB is a non standard anywhere. It's neither little endian correct nor big endian correct because MSB is always the left and LSB is always the right. |
The color is essentially stored in an array of 16 bits. I'm not concerned with how this array of bits is stored physically- it can be engraved on the inside of a magic lamp in mystic endian for all I care.
poslundc wrote: |
More to the point: there's nothing wrong with reading the colour value right-to-left (and therefore LSB to MSB) so long as you also read "BGR" right-to-left. |
Cute. =) I think its most important that some type of non-random logic exists. I read "data" in a FIFO or LILO like fashion depending on my mood. I regard an array of glyphs something like this:
Code: |
int i;
i = 0;
while (string[i] != NULL) {
deal_with_character(string[i]);
i++;
} |
I look at an array of bits more like this:
Code: |
int i;
unsigned int bit;
i = 0;
while (i < MAX_BITS) {
bit = (original_value >> i) & 0x1;
deal_with_bit(bit);
i++;
} |
Evidently everybody else here counts down to zero instead, if any of this makes any sense at all.
-Brendan
#19874 - sajiimori - Tue Apr 27, 2004 2:46 am
Quote: |
Evidently everybody else here counts down to zero instead, if any of this makes any sense at all.
|
I could claim that you must write your binary numbers backwards if any of what you say makes sense -- but I won't because it's roughly equivalent to arguing about which shoe you should put on first.