Skip to content

Instantly share code, notes, and snippets.

@barrbrain
Created November 6, 2015 08:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barrbrain/b074567f35222e925831 to your computer and use it in GitHub Desktop.
Save barrbrain/b074567f35222e925831 to your computer and use it in GitHub Desktop.
Chroma quantization curve table generation for Daala
import math
P = 2.25
def quant(cq): return math.trunc(math.exp((cq-6.235)*.10989525)*16.0)
def curve(cq): return quant(cq-math.pow(cq-1,P)/(2.0*P*math.pow(62.0,P-1)))
print(', '.join(['0x%04X' % n for n in [0] + [curve(cq) for cq in range(1,64)]]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment