| #### A.1 Uncompressed Data Chunk {#h-0a-01} | |
| | Frame Tag | Type | | |
| |-------------------------------------------------------|-------| | |
| | `frame_tag` | f(24) | | |
| | `if (key_frame) {` | | | |
| | ` start_code` | f(24) | | |
| | ` horizontal_size_code` | f(16) | | |
| | ` vertical_size_code` | f(16) | | |
| | `}` | | | |
| {:.col1-pre} | |
| The 3-byte frame tag can be parsed as follows: | |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| unsigned char *c = pbi->Source; | |
| unsigned int tmp; | |
| tmp = (c[2] << 16) | (c[1] << 8) | c[0]; | |
| key_frame = tmp & 0x1; | |
| version = (tmp >> 1) & 0x7; | |
| show_frame = (tmp >> 4) & 0x1; | |
| first_part_size = (tmp >> 5) & 0x7FFFF; | |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| {:lang="c"} | |
| Where: | |
| * `key_frame` indicates if the current frame is a key frame or not. | |
| * `version` determines the bitstream version. | |
| * `show_frame` indicates if the current frame is meant to be displayed | |
| or not. | |
| * `first_part_size` determines the size of the first partition | |
| (control partition), excluding the uncompressed data chunk. | |
| The `start_code` is a constant 3-byte pattern having value 0x9d012a. The | |
| latter part of the uncompressed chunk (after the `start_code`) can be | |
| parsed as follows: | |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| unsigned char *c = pbi->Source + 6; | |
| unsigned int tmp; | |
| tmp = (c[1] << 8) | c[0]; | |
| width = tmp & 0x3FFF; | |
| horizontal_scale = tmp >> 14; | |
| tmp = (c[3] << 8) | c[2]; | |
| height = tmp & 0x3FFF; | |
| vertical_scale = tmp >> 14; | |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| {:lang="c"} | |