Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (552)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  YUV colour space question  (Read 1454 times)
0 Members and 1 Guest are viewing this topic.
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Posted 2003-12-04 21:25:07 »

Do any of you know the actual bit representation of the different YUV formats?

i.e.

4:4:4
4:2:2
4:1:1
4:2:0

?

I know that RGB is represented by 24 bits, each colour getting 8 bits.

If you could point me to a site that has this information i would be very much appreciative Smiley
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #1 - Posted 2003-12-05 00:49:21 »

The byte order varies a bit depending on the software/device that generates it.  Those numbers only refer to  how the original data is sampled.

The wikipedia is your friend: http://en2.wikipedia.org/wiki/YUV

However, typically 4:2:2 is ordered u1y1v1y2u3y3v3y4u5y5v5y6 ...
Note that the wikipedia has this wrong.  The way the wikipedia describes it here, it would appear as if the U & V samples align with different luma samples.  That is generally NOT the case.

4:2:0  is usually represented in memory in a planar format, one buffer of Y, one of U, one of V, with the U & V buffers being 1/4 the size of the Y buffer.

These formats also don't specify the number of bits per sample.  Typically the sampling is 8-bit for each component, but there may be times when more bits are used to avoid banding, or loss during processing.

4:4:4 would be the YUV equivalent of RGB, One byte for each component per pixel.

4:2:2 has one sample of Y per pixel, and U & V are sampled at half the horizontal bandwidth, so there are half the samples.

4:1:1 is like 4:2:2, but the U & V are sampled at one quarter of the horizontal bandwidth.

4:2:0 has the same amount of samples as 4:1:1, but the U & V are samples at half the bandwidth in both the horizontal and vertical directions, resulting in the same total of 1/4 the numebr of samples as the luma.

There was a really nice diagram on the net that showed all of this, I thought it was in the wikipedia, but I can't find it now.

Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #2 - Posted 2003-12-05 01:39:34 »

Quote

4:2:0  is usually represented in memory in a planar format, one buffer of Y, one of U, one of V, with the U & V buffers being 1/4 the size of the Y buffer.

These formats also don't specify the number of bits per sample.  Typically the sampling is 8-bit for each component, but there may be times when more bits are used to avoid banding, or loss during processing.


Thanks for replying. I understand what each of the formats are and how to implement them, however my progblem what exactly is the stream format.

e.g. as said in wikipedia it could be u1y1v1y2u3y3v3y4u5y5v5y6 or it may be y1y2y3y4u1u2v1v2

or any other combination... i wish to know what the standard is... if there is one.

How can programs understand the different YUV streams unless they are told how to interpret them?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #3 - Posted 2003-12-05 22:26:57 »

There is no standard Sad Or rather there is more than one "standard" for the exact same sampling, so it's just as good as having no standard.

The way programs know what to do is that they have implemented proprietary file formats or written codecs that read someone else's proprietary format.

With AVI files for instance you would look to the FOURCC code and it is enough to know the exact byte order.

Google for FOURCC codes and you can get a table of known codes and what the data format is .. e.g. there are FourCC codes like YUYV, UYVY, YUY2...  the description of the code will tell you the byte order.

Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #4 - Posted 2003-12-05 23:01:10 »

ah, well that is annoying Sad

thanks for the fourcc suggestion. www.fourcc.org as exactly what i was after.

hmm. i guess i will stick with YUV2 as it seems to be the most common...
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #5 - Posted 2003-12-07 18:35:45 »

I assume you meant YUY2.. I didn't see any YUV2 listed at fourcc.org

It is one of the more popular formats.  I think I've encountered it and UYVY which fourcc.org claims may be the most popular
"UYVY (and Y422 and UYNV)


UYVY is probably the most popular of the various YUV 4:2:2 formats. It is output as the format of choice by the Radius Cinepak codec and is often the second choice of software MPEG codecs after YV12."

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (22 views)
2014-08-22 19:31:30

atombrot (34 views)
2014-08-19 09:29:53

Tekkerue (30 views)
2014-08-16 06:45:27

Tekkerue (27 views)
2014-08-16 06:22:17

Tekkerue (18 views)
2014-08-16 06:20:21

Tekkerue (26 views)
2014-08-16 06:12:11

Rayexar (65 views)
2014-08-11 02:49:23

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (41 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!