-
-
Notifications
You must be signed in to change notification settings - Fork 0
BTIC4A
Brendan G Bohannon edited this page Feb 8, 2016
·
24 revisions
Premise:
- CBR Fixed-Block Image Codec
- Bitrate is 4 bpp with 1024 bit blocks.
- Bitrate is 6 bpp with 1536 bit blocks.
- Consider 8 bpp mode with Alpha channel.
- Logical block is 16x16 pixels.
- Each block is composed of 4x4 sub-blocks.
- Use a 2-stage interpolation strategy.
- Values are given explicitly for the main block, but are interpolated for the sub-blocks.
- Cx: Center X
- Dx: Used with Cx to indicate the range.
- Mx: Explicit minimum.
- Nx: Explicit maximum.
YUV:
- Y=G
- U=B-G
- V=R-G
Block Layout
- Organized in terms of 32-bit DWORDS
- Words 0- 3: Common Header
- Words 4- 7: ~ 8 bits/block
- Words 8-31: 48 bits/block
Block Type 0:
- Word 0:
- 0- 3: Master Tag (0)
- 4- 7: Master Subformat
- 8-31: Reserved
- Word 1:
- 0-15: Center Y
- 16-31: Center U
- Word 2:
- 0-15: Center V
- 16-31: Diff Y
- Word 3:
- 0-15: Diff U
- 16-31: Diff V
- Word 4-15:
- 24 bits per sub-block (Cd2).
- Word 16-31:
- 32 bits per sub-block (Cd3).
- Cd2( 0- 5): My
- Cd2( 6-11): Ny
- Cd2(12-17): Cu
- Cd2(18-23): Cv
- Cd3( 0-31): PixY (4x4x2)
- Cd2( 0- 3): My
- Cd2( 4- 7): Ny
- Cd2( 8- 9): Mu
- Cd2(10-11): Nu
- Cd2(12-13): Mv
- Cd2(14-15): Nv
- Cd2(16-19): PixU (2x2x1)
- Cd2(20-23): PixV (2x2x1)
- Cd3( 0-31): PixY (4x4x2)
- Cd2( 0- 7): PixY (2x2x2)
- Cd2( 8-15): PixU (2x2x2)
- Cd2(16-31): PixV (2x2x2)
- Cd3( 0- 5): My
- Cd3( 5-11): Ny
- Cd3(12-16): Mu
- Cd3(17-21): Nu
- Cd3(22-26): Mv
- Cd3(27-31): Nv
Block Layout
- Organized in terms of 32-bit DWORDS
- Words 0-3: Common Header
- Words 4-15: ~ 24 bits/block
- Words 16-47: 64 bits/block
Block Type 0:
- Word 0:
- 0- 3: Master Tag (0)
- 4- 7: Master Subformat
- 8-31: Reserved
- Word 1:
- 0-15: Center Y
- 16-31: Center U
- Word 2:
- 0-15: Center V
- 16-31: Diff Y
- Word 3:
- 0-15: Diff U
- 16-31: Diff V
- Word 4-15:
- 24 bits per sub-block (Cd2).
- Word 16-47:
- 64 bits per sub-block (Cd3).
- Cd2( 0- 4): Cy
- Cd2( 5- 9): Dy
- Cd2(10-12): Mu
- Cd2(13-15): Nu
- Cd2(16-19): Mv
- Cd2(20-23): Nv
- Cd3( 0-47): PixY (4x4x3)
- Cd3(48-55): PixU (2x2x2)
- Cd3(56-63): PixV (2x2x2)
- Cd2( 0- 4): Cy
- Cd2( 5- 9): Dy
- Cd2(10-12): Mu
- Cd2(13-15): Nu
- Cd2(16-19): Mv
- Cd2(20-23): Nv
- Cd3( 0-31): PixY (4x4x2)
- Cd3(32-47): PixU (2x4x2)
- Cd3(48-63): PixV (2x4x2)
- Cd2( 0- 4): Cy
- Cd2( 5- 9): Dy
- Cd2(10-12): Mu
- Cd2(13-15): Nu
- Cd2(16-19): Mv
- Cd2(20-23): Nv
- Cd3( 0-31): PixY (4x4x2)
- Cd3(32-47): PixU (4x4x1)
- Cd3(48-63): PixV (4x4x1)
Word 0:
- Word 0:
- 0- 3: Master Tag (0)
- 4- 7: Master Subformat
- 8-31: Reserved
- Word 1:
- 0-15: Center Alpha
- 16-31: Diff Alpha
- Alpha Data, 24 bits/block
- 0-3: Ma
- 4-7: Na
- 8-23: Pixel Bits (4x4x1).
- 0-3: Ma
- 4-7: Na
- 8-23: Pixel Bits (2x4x2 By).
A b C d e F g H I j K l m N o P
Only capital pixels are encoded. Lower case pixels are predicted based on the adjacent pixels. This will be done per 2 lines based on the averages of the 2-bit values of said adjacent pixels. This may be done via lookup tables.
Blocks are fixed-size, but are accessed as a bitstream. An external header is used to define the layout of the various block-types.
Header Info, Global:
- Block Size, defined as the number of bytes for each block of 16x16 pixels.
- Colorspace and bit-depth.
- Number of sub-block Y range bits.
- Number of sub-block U range bits.
- Number of sub-block V range bits.
- 0-15 bits
- Number of sub-block Y pixel bits.
- Number of sub-block U/V pixel bits.
- 0=Flat (0 bits)
- 1=2x2x1 (3 bits)
- 2=2x2x2 (7 bits)
- 3=4x2x2 (15 bits)
- 4=2x4x2 (15 bits)
- 5=4x4x1 (15 bits)
- 6=4x4x2 (31 bits)
- 7=4x4x3 (47 bits)