1
$\begingroup$

I did some quick math on how much data is contained on a screen at any given instant and I ended up with a number well beyond what I thought was possible. 256 colors for Red, Green, and Blue each define a pixel and there are currently 1920x1080 pixels on my screen so..

256 x 256 x 256 x 1920 x 1080 bits = 4.35 Terabytes of data

Obviously that would require more space than is on my desktop, let alone some Raspberry pi. So how do they do it? Any other resources anyone has for learning how displays work in general I'd love to have a look.

$\endgroup$
  • 3
    $\begingroup$ When a calculation like this gives an implausibly huge (or implausibly small) answer, the first thing to ask yourself is, "Did I get the calculation right?" $\endgroup$ – David Richerby May 6 '16 at 4:44
  • $\begingroup$ This question seems to be offtopic since it asks about how real computers do stuff, nor about principles of CS. Community votes, please: is this ontopic? $\endgroup$ – Raphael May 6 '16 at 6:15
  • $\begingroup$ @Raphael I researched before posting and according to this post meta.stackexchange.com/a/216253 this seems to be the approriate community for this topic. $\endgroup$ – Nathan May 6 '16 at 21:19
6
$\begingroup$

You're confusing the number of possible values that a pixel can display with the amount of data being shown at any given instance. The number you give is the number of possible pixel states that your display can be in, multiplied by the number of pixels, which isn't really a meaningful number.

(EDIT: As Mehrdad and phihag point out, I'd incorrectly assumed you'd given the number of possible images. That number is actually $(256 \times 256 \times 256) ^ {1920 \times 1080}$, which is much larger than your number.)

The important detail is, at any time, a pixel is only in one state.

There are 256 possible values for each pixel, but we only are in one of them at any given time.

Any number between 0 and 255 can be encoded using 8-bits, just the same way you can write any number between 0 and 999999 using only 6 decimal digits. So there are 24 bits per pixel, or 3 bytes per pixel.

So 3*1920*1080=6220800 bytes, or just over 6MB.

Think of it like this, you as a person can verbally list all the digits in some 20-digit number, but you can't possibly list every 20-digit number. Your monitor could never in its lifetime display all possible images, but it certainly display one of those images.

$\endgroup$
  • 1
    $\begingroup$ Plus, the image is probably not really stored anywhere but rather pipelined through ... everything ... right to the display. $\endgroup$ – Raphael May 6 '16 at 6:16
  • 1
    $\begingroup$ Actually, I believe 256³ is the number of monochromatic images (or values of a single pixel). At a reasonable 100fps, you could should that in just under 2 days. The number of possible images, on the other hand, would be (256³)^(1920*1080). $\endgroup$ – phihag May 6 '16 at 8:30
  • $\begingroup$ "but at any time, it is only in one state." isn't really relevant here; the issue is that the size of an encoding of a state (which you correctly calculated) is logarithmic in the number of possible states. $\endgroup$ – G. Bach May 6 '16 at 8:59
  • $\begingroup$ @Raphael That's not true, it's stored in a frame buffer, and more likely in two or three copies. And on top of that, if it's your desktop, each window is probably stored separately from the final image as well. This decouples all the different components so they don't have to work in lockstep. $\endgroup$ – Dan Hulme May 6 '16 at 9:11
  • 2
    $\begingroup$ Uh, -1, this answer is definitely wrong... the number of possible images that can be displayed is more like 256^(3 * 1920 * 1080) which is astronomically more than astronomically huge. $\endgroup$ – Mehrdad May 6 '16 at 9:45
1
$\begingroup$

By doing the math correctly. :-) Try keeping track of the units:

1 byte/color × 3 colors/pixel × 1920 pixels/row × 1080 rows/frame = 6,220,800 bytes/frame

The more impressive part, I might note, is that at 60 frames per second, this is 0.35 GiB/second, which is pretty fast.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.