BC3X420 - cr88192/bgbtech_misc GitHub Wiki

Idea: Extended form of DXT5/BC3, with added 4:2:0 subsampled-chroma mode.

  • IIRC, Tested: actually worked pretty ok.
  • Drawback: this would need hardware support to be usable.
AlphaSubBlock:
  • AlphaA:BYTE
  • AlphaB:BYTE
  • AlphaPixels:WORD48
  • AlphaA>AlphaB
    • 0=AlphaA, 1=AlphaB, 2=6/7*AlphaA+1/7*AlphaB, ..., 7=1/7*AlphaA+6/7*AlphaB
  • AlphaA<=AlphaB
    • 0=AlphaA, 1=AlphaB, 2=4/5*AlphaA+1/5*AlphaB, ..., 5=1/5*AlphaA+4/5*AlphaB, 6=0, 7=255
ColorSubBlock:
  • ColorA:WORD
  • ColorB:WORD
  • ColorPixels:DWORD
UVSubBlock:
  • UA:BYTE
  • VA:BYTE
  • UB:BYTE
  • VB:BYTE
  • AT:BYTE
  • UVPixels:WORD24
AT:
  • Low 2 bits=00: Interpreted as 6-bit Alpha
  • Low 2 bits=01: Interpreted as 2-bit endpoint selection and 4 alpha bits.
    • Endpoints: 00=0,255; 01=0,64; 10=192,255; 11=64,192
  • Low 2 bits=10: Reserved
  • Low 2 bits=11: Reserved
UVPixels:
  • 2x2 pixels at 3 bits/pixel U channel (12 bits)
  • 2x2 pixels at 3 bits/pixel V channel (12 bits)
  • Interpolation is the same as AlphaSubBlock with AlphaA>AlphaB
NormalBlock (ColorA > ColorB):
  • ChanA:AlphaSubBlock
  • ChanRGB:ColorSubBlock
YuvBlock (VA < VB) && (UA < UB):
  • ChanY:AlphaSubBlock
  • ChanUV:UVSubBlock
In the case of YUV blocks, the YUV endpoints would be converted to RGBA when the block is decoded.

Probable Colorspace (Option A):

  • Forward:
    • Y=(R+2*G+B)/4
    • U=(B-Y)/2+128
    • V=(R-Y)/2+128
  • Inverse:
    • B'=Y+(U-128)*2
    • R'=Y+(V-128)*2
    • G'=(4*Y-R-G)/2
Probable Colorspace (Option B):
  • Forward:
    • Y=(R+2*G+B)/4
    • U=(B-G)/2+128
    • V=(R-G)/2+128
  • Inverse:
    • G'=Y-(U+V-256)/2;
    • B'=G+(U-128)*2
    • R'=G+(V-128)*2
⚠️ **GitHub.com Fallback** ⚠️