Advertisement
cr88192

Small Block Audio Codec

May 29th, 2021
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. Small Block Audio Compression
  2. * Goal is for a simple hardware-decodable audio codec.
  3. * Should allow random access to compressed audio samples.
  4. ** Random access disallows any dependency on prior sample values.
  5.  
  6.  
  7. Small Block 1:
  8. * Encodes 16 PCM samples into 32 bits (2 bits/sample).
  9. * ( 5: 0): Line Start (S.E3.F2)
  10. * (11: 6): Line End (S.E3.F2)
  11. * (15:12): Line Sigma ( E3.F1)
  12. * (31:16): Sample Selector Bits
  13.  
  14. To decode a sample, linearly interpolate between the start and end value. The start and end values represent a line segment.
  15.  
  16. The Sigma will represent a distance above or below this line segment, which will be either added or subtracted from the interpolated value (based on the selector bit) to get the result.
  17.  
  18. For each selector Bit:
  19. * 0: V=Pred-Sigma
  20. * 1: V=Pred+Sigma
  21.  
  22.  
  23. Small Block 2:
  24. * Encodes 16 PCM samples into 64 bits (4 bits/sample).
  25. * ( 7: 0): Line Start (S.E3.F4)
  26. * (15: 8): Line End (S.E3.F4)
  27. * (23:16): Line Sigma (Z.E3.F4)
  28. * (31:24): Reserved (Zero)
  29. * (63:32): Sample Selector Bits
  30.  
  31. This is based on a similar premise for Format 1, just with higher endpoint fidelity.
  32.  
  33. While one "could" make the endpoint values bigger here, this doesn't actually gain much in terms of quality.
  34.  
  35. The interpolation values will also be 2-bits / sample:
  36. * 00: Small Negative (-0.333 * Sigma)
  37. * 01: Large Negative (-1.000 * Sigma)
  38. * 10: Small Positive (+0.333 * Sigma)
  39. * 11: Large Positive (+1.000 * Sigma)
  40.  
  41.  
  42. Endpoints are encoded as a microfloat value which expands into a 12-bit integer format (PCM):
  43. 0: 00000000xxxx
  44. 1: 00000001xxxx
  45. 2: 0000001xxxx0
  46. 3: 000001xxxx00
  47. 4: 00001xxxx000
  48. 5: 0001xxxx0000
  49. 6: 001xxxx00000
  50. 7: 01xxxx000000
  51.  
  52. Negative values will invert the value of the decoded sample.
  53. The smaller variants are similar, just with fewer fractional bits.
  54.  
  55. Interpolation and other calculations will be performed in terms of PCM values.
  56. An encoder should ensure that decoded values will not go out of range.
  57.  
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement