BTAC2B - cr88192/bgbtech_misc GitHub Wiki
BTAC2B:
- More advanced design than BTAC1C.
- Will be VBR, rather than CBR, but retain the use of a fixed power-of-2 number of samples per block.
- Will use a limited form of entropy coding.
- Will consist of a ramp-table selection and selecting a set of initial symbol indices.
- The ramp tables will be prebuilt and reused for each block.
- The ramp will basically be the M factor for Golomb Codes.
- The symbols will be encoded as a fixed-size table index, and will logically contain a series of Golomb codes.
- The values will not directly encode a symbol, rather its position in the index table.
- If bits remain (unable to hold a coded symbol), they are interpreted as either no value (0), or a literal table index.
- Symbol indices may be adapted via STF.
- Samples may be predicted using a fixed predictor or via a FIR filter.
- Will consist of an SVLI encoding the difference from a predicted value.
- Prediction is typically either the last value, or a running average.
- length:PTSVLI //size of the coded block in bytes.
- ripr:BYTE //ramp and index preset
- pred:BYTE //mono or center/side predictors.
- indx:BYTE //starting index (exponent) and sample mode.
- bits 0..3: Exponent Index (Eix)
- bits 4..7: Mode
- 0=Mono (single mono or center channel)
- 1=Split (independent left/right channel)
- 2=L/R Offset (center channel with left/right offset)
- 3=Joint (center channel with 4x downsampled side channel)
- pred:WORD //initial predictor (mono/center/left)
- (indx2:BYTE) //starting (right/side index, present if block is stereo)
- (pred2:WORD) //initial predictor (side/right/offset, present if block is stereo)
- Logical exponent for minifloats mapped to integer deltas.
- 0: 0..15 (Denormal)
- 1: 16..31
- 2: 32..63
- ...
- Will be coded as nominally S.E3.F4 bit differential minifloats.
- E=0: Denormal, Eix-=3
- E=1: Normal (Rel: 0.125 .. 0.25), Eix-=2
- E=2: Normal (Rel: 0.25 .. 0.5), Eix-=1
- E=3: Normal (Rel: 0.5 .. 1.0), Eix-=0
- E=4: Normal (Rel: 1.0 .. 2.0), Eix+=0
- E=5: Normal (Rel: 2.0 .. 4.0), Eix+=1
- E=6: Normal (Rel: 4.0 .. 8.0), Eix+=2
- E=7: Normal (Rel: 8.0 .. 16.0), Eix+=3