Creative YUV: Difference between revisions
(Add to video codecs category.) |
(import the technical description) |
||
Line 1: | Line 1: | ||
''This page is based on the document 'Simple YUV Coding Formats' by Mike Melanson found at [http://multimedia.cx/simple-yuv.txt http://multimedia.cx/simple-yuv.txt''. | |||
* FOURCCs: CYUV | * FOURCCs: CYUV | ||
* Company: [[Creative]] | * Company: [[Creative]] | ||
* Technical Description: [http://www.csse.monash.edu.au/~timf/videocodec/cyuv.txt http://www.csse.monash.edu.au/~timf/videocodec/cyuv.txt], | * Alternate Technical Description: [http://www.csse.monash.edu.au/~timf/videocodec/cyuv.txt http://www.csse.monash.edu.au/~timf/videocodec/cyuv.txt] | ||
Creative YUV is a constant-rate, differentially coded, packed YUV compression method. The codec essentially codes each Y, U, and V sample as 4 bits with some overhead at the start of each line. The codec operates on a YUV 4:1:1 colorspace which means that each group of 4 pixels on a line has 1 Y sample per pixel, but only 1 of each C sample for the entire group. | |||
== Data Format == | |||
A chunk of CYUV-encoded data is laid out as: | |||
bytes 0-15 signed Y predictor byte values | |||
bytes 16-31 signed U predictor byte values | |||
bytes 32-47 signed V predictor byte values | |||
bytes 48.. lines of CYUV-encoded data | |||
The format of each line is as follows: | |||
byte 0 | |||
bits 7-4 initial U sample and predictor for line | |||
bits 3-0 initial Y sample and predictor for line | |||
byte 1 | |||
bits 7-4 initial V sample and predictor for line | |||
bits 3-0 next Y predictor index | |||
byte 2 | |||
bits 7-4 next Y predictor index | |||
bits 3-0 next Y predictor index | |||
bytes 3.. remaining predictor indices for line | |||
The first 3 bytes contain the setup information for the line. Each initial sample (Y, U, and V) actually represents the top 4 bits of the initial 8-bit sample. The initial sample also serves as the initial predictor. For each of the 3 Y predictor indices, use the 4-bit value to index into the table of 16 Y predictors, encoded at the start of the frame. Apply each predictor to the previous Y value. | |||
At this point, the first group of 4 pixels will be decoded. For each group of 4 pixels remaining on the line: | |||
byte 0 | |||
bits 7-4 next U predictor index | |||
bits 3-0 next Y predictor index | |||
byte 1 | |||
bits 7-4 next V predictor index | |||
bits 3-0 next Y predictor index | |||
byte 2 | |||
bits 7-4 next Y predictor index | |||
bits 3-0 next Y predictor index | |||
For each predictor index, use the 4 bits to index into the appropriate predictor table and apply the predictor to the previous sample of the same type (Y, U, or V) and output the sample. | |||
[[Category:Video Codecs]] | [[Category:Video Codecs]] |
Revision as of 18:42, 29 January 2006
This page is based on the document 'Simple YUV Coding Formats' by Mike Melanson found at [http://multimedia.cx/simple-yuv.txt http://multimedia.cx/simple-yuv.txt.
- FOURCCs: CYUV
- Company: Creative
- Alternate Technical Description: http://www.csse.monash.edu.au/~timf/videocodec/cyuv.txt
Creative YUV is a constant-rate, differentially coded, packed YUV compression method. The codec essentially codes each Y, U, and V sample as 4 bits with some overhead at the start of each line. The codec operates on a YUV 4:1:1 colorspace which means that each group of 4 pixels on a line has 1 Y sample per pixel, but only 1 of each C sample for the entire group.
Data Format
A chunk of CYUV-encoded data is laid out as:
bytes 0-15 signed Y predictor byte values bytes 16-31 signed U predictor byte values bytes 32-47 signed V predictor byte values bytes 48.. lines of CYUV-encoded data
The format of each line is as follows:
byte 0 bits 7-4 initial U sample and predictor for line bits 3-0 initial Y sample and predictor for line byte 1 bits 7-4 initial V sample and predictor for line bits 3-0 next Y predictor index byte 2 bits 7-4 next Y predictor index bits 3-0 next Y predictor index bytes 3.. remaining predictor indices for line
The first 3 bytes contain the setup information for the line. Each initial sample (Y, U, and V) actually represents the top 4 bits of the initial 8-bit sample. The initial sample also serves as the initial predictor. For each of the 3 Y predictor indices, use the 4-bit value to index into the table of 16 Y predictors, encoded at the start of the frame. Apply each predictor to the previous Y value.
At this point, the first group of 4 pixels will be decoded. For each group of 4 pixels remaining on the line:
byte 0 bits 7-4 next U predictor index bits 3-0 next Y predictor index byte 1 bits 7-4 next V predictor index bits 3-0 next Y predictor index byte 2 bits 7-4 next Y predictor index bits 3-0 next Y predictor index
For each predictor index, use the 4 bits to index into the appropriate predictor table and apply the predictor to the previous sample of the same type (Y, U, or V) and output the sample.