~/bend-docscommunity

src/mp3_enc.bend checks

raw source on the hub · import 0xd2dab0fbc9db2e9ba3da65dae724eb41/src/mp3_enc.bend as Mp3_enc

MPEG-1 Layer III encoder: analysis filterbank, MDCT, quantiser, Huffman.

2 imports
import Base
import ./mp3_tab.bend as Tab

Types

type Ya source · line 56 · raw

Type

64 partials. Each windowed sample indexes one bin; a list walks from the head.

type Xs source · line 82 · raw

Type

delay sample handed back beside the ring Array.get just read

type Yr source · line 90 · raw

Type

ring delay beside the 64 partial bins while windowing

type Cf source · line 110 · raw

Type

a cosine table handed back beside the coefficient Array.get just read

type As source · line 153 · raw

Type

subband result: ring delay returned beside the cosine table and 32 bands

type An source · line 172 · raw

Type

analysis delay ring (2^9 slots) and finished subband blocks, newest block first

type Aw source · line 206 · raw

Type

the delay line paired with the cosine table, which has one owner

type Ld source · line 259 · raw

Data

ldexp_q2 residual: mantissa and the exponent still to apply

type Bv source · line 397 · raw

Data

big_values scan across the 22 long scalefactor bands

type Hp source · line 434 · raw

Data

Huffman bits for one granule, newest bit first, running length, and whether the table fit

type Wd source · line 510 · raw

Type

a Huffman word handed back beside the Array.get just read

type Hs source · line 550 · raw

Type

the code table beside the bits just produced for one pair

type Best source · line 572 · raw

Data

shortest Huffman table that encoded the granule

type Bs source · line 628 · raw

Type

the code table beside the shortest table so far

type Sr source · line 681 · raw

Data

binary search for the finest global_gain that fits the bit budget

type Gr source · line 829 · raw

Data

one quantized granule: part2_3_length, big_values, global_gain, table, bits

type Rv source · line 833 · raw

Data

reversed bit list and its length

type Bf source · line 871 · raw

Type

a matrix coefficient handed back beside the Array.get just read

type Br source · line 937 · raw

Type

one MDCT row handed back beside the matrix

type Sa source · line 989 · raw

Type

576 MDCT bins. Each butterfly reads and writes two of them; a list walks from the head.

type Bw source · line 1144 · raw

Data

bit packer. completed bytes are newest-first until bw.bytes reverses them.

type Chs source · line 1422 · raw

Data

deinterleaved channels, newest sample first until split.go reverses them

Definitions

def f32.bits source · line 5 · raw

@+w:U32 -> F32

def f32.word source · line 10 · raw

@x:F32 -> U32

def u.nth.m source · line 15 · raw

@m:Maybe<&2, U32> -> U32

def u.nth source · line 22 · raw

@xs:List<&2, U32> -> @+ii:U32 -> U32

def f.nth.m source · line 25 · raw

@m:Maybe<&2, F32> -> F32

def f.nth source · line 32 · raw

@xs:List<&2, F32> -> @+ii:U32 -> F32

def f.put source · line 35 · raw

@xs:List<&2, F32> -> @+ii:U32 -> @+vv:F32 -> List<&2, F32>

def f.of source · line 38 · raw

@xs:List<&2, U32> -> List<&2, F32>

def f.rev source · line 45 · raw

@xs:List<&2, F32> -> List<&2, F32>

def y.wrap source · line 48 · raw

@last:Bool -> @+ii:U32 -> U32

def ya.of source · line 59 · raw

@got:Pair(Array<F32>, F32) -> Ya

def y.store source · line 63 · raw

@got:Ya -> @+ii:U32 -> @+vv:F32 -> Array<F32>

def y.add source · line 68 · raw

@acc:Array<F32> -> @+ii:U32 -> @+vv:F32 -> Array<F32>

def y.pull source · line 71 · raw

@hop:Nat -> @got:Ya -> @+ii:U32 -> @acc:List<&2, F32> -> List<&2, F32>

def y.list source · line 78 · raw

@acc:Array<F32> -> List<&2, F32>

def xs.of source · line 85 · raw

@got:Pair(Array<F32>, F32) -> Xs

def y.step source · line 93 · raw

@got:Xs -> @bins:Array<F32> -> @+w:F32 -> @+ii:U32 -> Yr

def y.ring source · line 99 · raw

@win:List<&2, F32> -> @got:Yr -> @+head:U32 -> @+k:U32 -> @+ii:U32 -> Yr

window the 512-slot ring in place: multiply by win and fold into 64 bins

def cf.of source · line 113 · raw

@got:Pair(Array<F32>, F32) -> Cf

def dot.go source · line 117 · raw

@tl:List<&2, F32> -> @got:Cf -> @+base:U32 -> @+hd:F32 -> @acc:F32 -> Pair(Array<F32>, F32)

def dot.row source · line 126 · raw

@ys:List<&2, F32> -> @tab:Array<F32> -> @+base:U32 -> @acc:F32 -> Pair(Array<F32>, F32)

tab.cos is 2048 F32s. Each tap reads that table with Array.get.

def sb.go source · line 133 · raw

@hop:Nat -> @got:Cf -> @+ys:List<&2, F32> -> @+row:U32 -> @acc:List<&2, F32> -> Pair(Array<F32>, List<&2, F32>)

def sb.rows source · line 143 · raw

@hop:Nat -> @tab:Array<F32> -> @+ys:List<&2, F32> -> @+row:U32 -> @acc:List<&2, F32> -> Pair(Array<F32>, List<&2, F32>)

def as.of source · line 156 · raw

@x:Array<F32> -> @got:Pair(Array<F32>, List<&2, F32>) -> As

def an.sb1 source · line 160 · raw

@got:Yr -> @cos:Array<F32> -> As

def an.sb source · line 166 · raw

@x:Array<F32> -> @+head:U32 -> @+win:List<&2, F32> -> @cos:Array<F32> -> As

subband samples of one ring state. head indexes the oldest of 512 samples.

def an.done source · line 175 · raw

@+head:U32 -> @out:List<&2, List<&2, F32>> -> @got:As -> Pair(An, Array<F32>)

def an.write source · line 181 · raw

@hop:Nat -> @x:Array<F32> -> @+at:U32 -> @blk:List<&2, F32> -> Array<F32>

overwrite the oldest 32 ring slots, then advance head

def an.push source · line 190 · raw

@st:An -> @blk:List<&2, F32> -> @+win:List<&2, F32> -> @cos:Array<F32> -> Pair(An, Array<F32>)

def an.blk source · line 196 · raw

@+s00:F32 -> @+s01:F32 -> @+s02:F32 -> @+s03:F32 -> @+s04:F32 -> @+s05:F32 -> @+s06:F32 -> @+s07:F32 -> @+s08:F32 -> @+s09:F32 -> @+s10:F32 -> @+s11:F32 -> @+s12:F32 -> @+s13:F32 -> @+s14:F32 -> @+s15:F32 -> @+s16:F32 -> @+s17:F32 -> @+s18:F32 -> @+s19:F32 -> @+s20:F32 -> @+s21:F32 -> @+s22:F32 -> @+s23:F32 -> @+s24:F32 -> @+s25:F32 -> @+s26:F32 -> @+s27:F32 -> @+s28:F32 -> @+s29:F32 -> @+s30:F32 -> @+s31:F32 -> List<&2, F32>

def aw.of source · line 209 · raw

@got:Pair(An, Array<F32>) -> Aw

def an.go source · line 213 · raw

@xs:List<&2, F32> -> @got:Aw -> @+win:List<&2, F32> -> Pair(An, Array<F32>)

def an.walk source · line 224 · raw

@xs:List<&2, F32> -> @st:An -> @+win:List<&2, F32> -> @cos:Array<F32> -> Pair(An, Array<F32>)

def an.zero source · line 228 · raw

An

2^9 slots: 512-sample analysis delay, zero-filled, head at the oldest sample.

def f.revs source · line 232 · raw

@xs:List<&2, List<&2, F32>> -> List<&2, List<&2, F32>>

subband frames, newest block first. each block is 32 bands.

def an.out source · line 235 · raw

@st:An -> List<&2, List<&2, F32>>

def cos.put source · line 240 · raw

@xs:List<&2, F32> -> @a:Array<F32> -> @+ii:U32 -> Array<F32>

def cos.of source · line 248 · raw

Array<F32>

2^11 slots: tab.cos is 2048 coefficients, filled in list order.

def an.fin source · line 251 · raw

@got:Pair(An, Array<F32>) -> List<&2, List<&2, F32>>

def an.run source · line 255 · raw

@xs:List<&2, F32> -> List<&2, List<&2, F32>>

def ex.of source · line 262 · raw

@+ee:U32 -> F32

def ld.scale source · line 273 · raw

@+ee:U32 -> F32

def ld.once source · line 276 · raw

@+yy:F32 -> @+ee:U32 -> F32

def ld.minp source · line 279 · raw

@small:Bool -> @+ee:U32 -> U32

def ld.cut source · line 286 · raw

@+yy:F32 -> @+ee:U32 -> @+cut:U32 -> Ld

def ld.step source · line 289 · raw

@st:Ld -> Ld

def ld.go source · line 296 · raw

@hop:Nat -> @st:Ld -> Ld

def ld.y source · line 303 · raw

@st:Ld -> F32

def gain.of source · line 309 · raw

@+gg:U32 -> F32

minimp3 dequant gain for a global_gain. ix = round((|xr| / gain) ^ 0.75).

def q.cp source · line 312 · raw

@ok:Bool -> @+nn:U32 -> U32

def q.clip source · line 319 · raw

@+nn:U32 -> U32

def q.mag source · line 322 · raw

@+xr:F32 -> @+gain:F32 -> U32

def q.sign source · line 325 · raw

@neg:Bool -> @+mag:U32 -> U32

def q.one source · line 332 · raw

@+xr:F32 -> @+gain:F32 -> U32

def q.all source · line 335 · raw

@xs:List<&2, F32> -> @+gain:F32 -> List<&2, U32>

def i.neg source · line 342 · raw

@+vv:U32 -> Bool

def i.ab source · line 345 · raw

@neg:Bool -> @+vv:U32 -> U32

def i.abs source · line 352 · raw

@+vv:U32 -> U32

def scf.row source · line 355 · raw

@+hz:U32 -> U32

def scf.at source · line 364 · raw

@+hz:U32 -> @+band:U32 -> U32

def nz.n source · line 367 · raw

@hop:Nat -> @xs:List<&2, U32> -> Bool

def drop.u source · line 378 · raw

@hop:Nat -> @xs:List<&2, U32> -> List<&2, U32>

def take.u source · line 387 · raw

@hop:Nat -> @xs:List<&2, U32> -> @acc:List<&2, U32> -> List<&2, U32>

def bv.put source · line 400 · raw

@ix:List<&2, U32> -> @+last:U32 -> @+acc:U32 -> @hit:Bool -> Bv

def bv.got source · line 407 · raw

@ix:List<&2, U32> -> @+last:U32 -> @+acc:U32 -> @+width:U32 -> @hit:Bool -> Bv

def bv.band source · line 410 · raw

@+ix:List<&2, U32> -> @+last:U32 -> @+acc:U32 -> @+width:U32 -> Bv

def bv.at source · line 413 · raw

@st:Bv -> @+hz:U32 -> @+band:U32 -> Bv

def bv.go source · line 418 · raw

@hop:Nat -> @st:Bv -> @+hz:U32 -> @+band:U32 -> Bv

def bv.last source · line 425 · raw

@st:Bv -> U32

def bv.of source · line 430 · raw

@ix:List<&2, U32> -> @+hz:U32 -> U32

def hp.bit source · line 437 · raw

@hp:Hp -> @+bit:U32 -> Hp

def hp.field source · line 444 · raw

@hop:Nat -> @hp:Hp -> @+code:U32 -> @+left:U32 -> Hp

def lim.p source · line 452 · raw

@z:Bool -> @+lin:U32 -> U32

def lim.of source · line 459 · raw

@+lin:U32 -> U32

def ca.p source · line 462 · raw

@big:Bool -> @+aa:U32 -> U32

def ca.of source · line 469 · raw

@+lin:U32 -> @+aa:U32 -> U32

def hp.sgn source · line 472 · raw

@neg:Bool -> U32

def hp.sp source · line 479 · raw

@z:Bool -> @hp:Hp -> @+vv:U32 -> Hp

def hp.sign source · line 486 · raw

@hp:Hp -> @+vv:U32 -> @+aa:U32 -> Hp

def hp.lp source · line 489 · raw

@z:Bool -> @hp:Hp -> @+lin:U32 -> @+extra:U32 -> Hp

def hp.lin source · line 496 · raw

@hp:Hp -> @+lin:U32 -> @+aa:U32 -> Hp

def hp.over source · line 499 · raw

@aa:U32 -> @bb:U32 -> @+lin:U32 -> Bool

def hp.bad source · line 502 · raw

@z:Bool -> @hp:Hp -> Hp

def wd.of source · line 513 · raw

@got:Pair(Array<U32>, U32) -> Wd

def word.of source · line 518 · raw

@codes:Array<U32> -> @+tab:U32 -> @+ca:U32 -> @+cb:U32 -> Pair(Array<U32>, U32)

tab.code is 8192 words. Each pair reads that table with Array.get.

def hp.use source · line 521 · raw

@z:Bool -> @hp:Hp -> @+w:U32 -> @+av:U32 -> @+bv:U32 -> @+aa:U32 -> @+bb:U32 -> @+lin:U32 -> Hp

def hp.word source · line 529 · raw

@hp:Hp -> @+av:U32 -> @+bv:U32 -> @+aa:U32 -> @+bb:U32 -> @+lin:U32 -> @+w:U32 -> Hp

def hp.from source · line 532 · raw

@got:Wd -> @hp:Hp -> @+av:U32 -> @+bv:U32 -> @+aa:U32 -> @+bb:U32 -> @+lin:U32 -> Pair(Array<U32>, Hp)

def hp.ready source · line 539 · raw

@hp:Hp -> @+tab:U32 -> @+av:U32 -> @+bv:U32 -> @+aa:U32 -> @+bb:U32 -> @+lin:U32 -> @codes:Array<U32> -> Pair(Array<U32>, Hp)

def hp.pair source · line 544 · raw

@hp:Hp -> @+tab:U32 -> @+av:U32 -> @+bv:U32 -> @codes:Array<U32> -> @+lins:List<&2, U32> -> Pair(Array<U32>, Hp)

def hs.of source · line 553 · raw

@got:Pair(Array<U32>, Hp) -> Hs

def hp.pairs source · line 557 · raw

@xs:List<&2, U32> -> @got:Hs -> @+tab:U32 -> @+lins:List<&2, U32> -> Pair(Array<U32>, Hp)

def hp.cands source · line 568 · raw

List<&2, U32>

def best.or source · line 575 · raw

@a:Bool -> @b:Bool -> Bool

def best.and source · line 582 · raw

@a:Bool -> @b:Bool -> Bool

def best.better source · line 589 · raw

@+bok:U32 -> @+bn:U32 -> @+ok:U32 -> @+nn:U32 -> Bool

def best.keep source · line 592 · raw

@take:Bool -> @+tab:U32 -> @+nn:U32 -> @bits:List<&2, U32> -> @+bt:U32 -> @+bn:U32 -> @bb:List<&2, U32> -> @+bok:U32 -> Best

def best.from source · line 602 · raw

@b:Best -> @+tab:U32 -> @+ok:U32 -> @+nn:U32 -> @bits:List<&2, U32> -> Best

def best.got source · line 607 · raw

@b:Best -> @+tab:U32 -> @hp:Hp -> Best

def best.pull source · line 612 · raw

@b:Best -> @+tab:U32 -> @got:Hs -> Pair(Array<U32>, Best)

def best.one source · line 617 · raw

@b:Best -> @+tab:U32 -> @ix:List<&2, U32> -> @codes:Array<U32> -> @+lins:List<&2, U32> -> Pair(Array<U32>, Best)

def best.step source · line 622 · raw

@b:Best -> @+tab:U32 -> @+ix:List<&2, U32> -> @codes:Array<U32> -> @+lins:List<&2, U32> -> Pair(Array<U32>, Best)

def bs.of source · line 631 · raw

@got:Pair(Array<U32>, Best) -> Bs

def best.go source · line 635 · raw

@cs:List<&2, U32> -> @+ix:List<&2, U32> -> @got:Bs -> @+lins:List<&2, U32> -> Pair(Array<U32>, Best)

def code.put source · line 644 · raw

@xs:List<&2, U32> -> @a:Array<U32> -> @+ii:U32 -> Array<U32>

def code.of source · line 652 · raw

Array<U32>

2^13 slots: tab.code is 8192 words, filled in list order.

def best.fin source · line 655 · raw

@got:Bs -> Best

def best.of source · line 660 · raw

@ix:List<&2, U32> -> Best

def ix.p source · line 663 · raw

@z:Bool -> @+mm:U32 -> @+aa:U32 -> U32

def ix.up source · line 670 · raw

@+mm:U32 -> @+aa:U32 -> U32

def ix.max source · line 673 · raw

@xs:List<&2, U32> -> @+mm:U32 -> U32

def sr.g1 source · line 684 · raw

@z:Bool -> @+mx:U32 -> Bool

def sr.good source · line 691 · raw

@+bk:U32 -> @+nn:U32 -> @+bud:U32 -> @+mx:U32 -> Bool

def sr.fit source · line 694 · raw

@okb:Bool -> @+lo:U32 -> @+hi:U32 -> @+mid:U32 -> @+tt:U32 -> @bits:List<&2, U32> -> @+ogg:U32 -> @+ot:U32 -> @obits:List<&2, U32> -> @+ook:U32 -> Sr

def sr.best source · line 704 · raw

@b:Best -> @+mx:U32 -> @+bud:U32 -> @+lo:U32 -> @+hi:U32 -> @+mid:U32 -> @+ogg:U32 -> @+ot:U32 -> @obits:List<&2, U32> -> @+ook:U32 -> Sr

def sr.zero source · line 712 · raw

@z:Bool -> @+ix:List<&2, U32> -> @+mx:U32 -> @+big:U32 -> @+bud:U32 -> @+lo:U32 -> @+hi:U32 -> @+mid:U32 -> @+ogg:U32 -> @+ot:U32 -> @obits:List<&2, U32> -> @+ook:U32 -> Sr

def sr.ix source · line 723 · raw

@+ix:List<&2, U32> -> @+hz:U32 -> @+bud:U32 -> @+lo:U32 -> @+hi:U32 -> @+mid:U32 -> @+ogg:U32 -> @+ot:U32 -> @obits:List<&2, U32> -> @+ook:U32 -> Sr

def sr.try source · line 730 · raw

@+spec:List<&2, F32> -> @+hz:U32 -> @+bud:U32 -> @+lo:U32 -> @+hi:U32 -> @+mid:U32 -> @+ogg:U32 -> @+ot:U32 -> @obits:List<&2, U32> -> @+ook:U32 -> Sr

def sr.live source · line 736 · raw

@go:Bool -> @+spec:List<&2, F32> -> @+hz:U32 -> @+bud:U32 -> @+lo:U32 -> @+hi:U32 -> @+gg:U32 -> @+tab:U32 -> @bits:List<&2, U32> -> @+ok:U32 -> Sr

def sr.step source · line 746 · raw

@spec:List<&2, F32> -> @+hz:U32 -> @+bud:U32 -> @st:Sr -> Sr

def sr.go source · line 751 · raw

@hop:Nat -> @+spec:List<&2, F32> -> @+hz:U32 -> @+bud:U32 -> @st:Sr -> Sr

def sr.run source · line 758 · raw

@spec:List<&2, F32> -> @+hz:U32 -> @+bud:U32 -> Sr

def pk.p source · line 761 · raw

@z:Bool -> @+mm:F32 -> @+aa:F32 -> F32

def pk.up source · line 768 · raw

@+mm:F32 -> @+aa:F32 -> F32

def pk.go source · line 771 · raw

@xs:List<&2, F32> -> @+mm:F32 -> F32

def dz.one source · line 778 · raw

@z:Bool -> @+vv:F32 -> F32

def dz.apply source · line 785 · raw

@xs:List<&2, F32> -> @+thr:F32 -> List<&2, F32>

def dz.on source · line 792 · raw

@done:Bool -> @st:Sr -> @+spec:List<&2, F32> -> @+pk:F32 -> @+thr:U32 -> @+hz:U32 -> @+bud:U32 -> Sr

def dz.try source · line 801 · raw

@st:Sr -> @+spec:List<&2, F32> -> @+pk:F32 -> @+thr:U32 -> @+hz:U32 -> @+bud:U32 -> Sr

def dz.go source · line 806 · raw

@thrs:List<&2, U32> -> @+spec:List<&2, F32> -> @+pk:F32 -> @+hz:U32 -> @+bud:U32 -> @st:Sr -> Sr

def dz.thrs source · line 815 · raw

List<&2, U32>

def dz.maybe source · line 818 · raw

@tiny:Bool -> @+spec:List<&2, F32> -> @+pk:F32 -> @+hz:U32 -> @+bud:U32 -> Sr

def dz.run source · line 825 · raw

@+spec:List<&2, F32> -> @+hz:U32 -> @+bud:U32 -> Sr

def rv.go source · line 836 · raw

@xs:List<&2, U32> -> @acc:List<&2, U32> -> @+n:U32 -> Rv

def gr.from source · line 843 · raw

@r:Rv -> @+gg:U32 -> @+tab:U32 -> @+big:U32 -> Gr

def gr.u source · line 848 · raw

@z:Bool -> @+gg:U32 -> @+tab:U32 -> @bits:List<&2, U32> -> @+big:U32 -> Gr

def gr.use source · line 855 · raw

@z:Bool -> @+gg:U32 -> @+tab:U32 -> @bits:List<&2, U32> -> @ix:List<&2, U32> -> @+hz:U32 -> Gr

def gr.pack source · line 862 · raw

@st:Sr -> @+spec:List<&2, F32> -> @+hz:U32 -> Gr

def gr.of source · line 867 · raw

@+spec:List<&2, F32> -> @+hz:U32 -> @+bud:U32 -> Gr

def bf.of source · line 874 · raw

@got:Pair(Array<F32>, F32) -> Bf

def bt.go source · line 878 · raw

@tl:List<&2, F32> -> @got:Bf -> @+base:U32 -> @+hd:F32 -> @acc:F32 -> Pair(Array<F32>, F32)

def bt.dot source · line 887 · raw

@vec:List<&2, F32> -> @tab:Array<F32> -> @+base:U32 -> @acc:F32 -> Pair(Array<F32>, F32)

tab.bt is 648 F32s. Each tap reads that table with Array.get.

def col.b source · line 894 · raw

@hop:Nat -> @xs:List<&2, List<&2, F32>> -> @+band:U32 -> @acc:List<&2, F32> -> List<&2, F32>

def band.step source · line 905 · raw

@hop:Nat -> @+vec:List<&2, F32> -> @got:Bf -> @+kk:U32 -> @acc:List<&2, F32> -> Pair(Array<F32>, List<&2, F32>)

def band.k source · line 915 · raw

@hop:Nat -> @+vec:List<&2, F32> -> @tab:Array<F32> -> @+kk:U32 -> @acc:List<&2, F32> -> Pair(Array<F32>, List<&2, F32>)

def band.row source · line 924 · raw

@+aa:List<&2, List<&2, F32>> -> @+cc:List<&2, List<&2, F32>> -> @tab:Array<F32> -> @+band:U32 -> Pair(Array<F32>, List<&2, F32>)

def flat.bands source · line 929 · raw

@xs:List<&2, List<&2, F32>> -> List<&2, F32>

def br.of source · line 940 · raw

@got:Pair(Array<F32>, List<&2, F32>) -> Br

def spec.step source · line 944 · raw

@hop:Nat -> @+aa:List<&2, List<&2, F32>> -> @+cc:List<&2, List<&2, F32>> -> @got:Br -> @+band:U32 -> @acc:List<&2, List<&2, F32>> -> Pair(Array<F32>, List<&2, F32>)

def spec.bands source · line 955 · raw

@hop:Nat -> @+aa:List<&2, List<&2, F32>> -> @+cc:List<&2, List<&2, F32>> -> @tab:Array<F32> -> @+band:U32 -> @acc:List<&2, List<&2, F32>> -> Pair(Array<F32>, List<&2, F32>)

def drop.b source · line 965 · raw

@hop:Nat -> @xs:List<&2, List<&2, F32>> -> List<&2, List<&2, F32>>

def take.b source · line 974 · raw

@hop:Nat -> @xs:List<&2, List<&2, F32>> -> @acc:List<&2, List<&2, F32>> -> List<&2, List<&2, F32>>

def spec.one source · line 985 · raw

@+blocks:List<&2, List<&2, F32>> -> @tab:Array<F32> -> Pair(Array<F32>, List<&2, F32>)

def sa.of source · line 992 · raw

@got:Pair(Array<F32>, F32) -> Sa

def al.fill source · line 996 · raw

@xs:List<&2, F32> -> @a:Array<F32> -> @+ii:U32 -> Array<F32>

def al.arr source · line 1004 · raw

@xs:List<&2, F32> -> Array<F32>

2^10 slots: one granule is 576 coefficients, filled in list order.

def al.pull source · line 1007 · raw

@hop:Nat -> @got:Sa -> @+ii:U32 -> @acc:List<&2, F32> -> List<&2, F32>

def al.list source · line 1014 · raw

@acc:Array<F32> -> List<&2, F32>

def al.write source · line 1017 · raw

@acc:Array<F32> -> @+up:F32 -> @+dp:F32 -> @+c0:F32 -> @+c1:F32 -> @+hi:U32 -> @+lo:U32 -> Array<F32>

def al.use source · line 1023 · raw

@got:Sa -> @+dp:F32 -> @+c0:F32 -> @+c1:F32 -> @+hi:U32 -> @+lo:U32 -> Array<F32>

def al.both source · line 1028 · raw

@got:Sa -> @+c0:F32 -> @+c1:F32 -> @+hi:U32 -> @+lo:U32 -> Array<F32>

def al.one source · line 1033 · raw

@acc:Array<F32> -> @+aa:List<&2, F32> -> @+bb:U32 -> @+ii:U32 -> Array<F32>

def al.i source · line 1038 · raw

@hop:Nat -> @acc:Array<F32> -> @+aa:List<&2, F32> -> @+bb:U32 -> @+ii:U32 -> Array<F32>

def al.band source · line 1045 · raw

@acc:Array<F32> -> @+aa:List<&2, F32> -> @+bb:U32 -> Array<F32>

def al.go source · line 1048 · raw

@hop:Nat -> @acc:Array<F32> -> @+aa:List<&2, F32> -> @+bb:U32 -> Array<F32>

def al.fin source · line 1055 · raw

@acc:Array<F32> -> List<&2, F32>

def al.run source · line 1058 · raw

@xs:List<&2, F32> -> List<&2, F32>

def spec.read source · line 1061 · raw

@got:Br -> Pair(Array<F32>, List<&2, F32>)

def spec.gran source · line 1066 · raw

@+blocks:List<&2, List<&2, F32>> -> @tab:Array<F32> -> Pair(Array<F32>, List<&2, F32>)

def grans.step source · line 1069 · raw

@hop:Nat -> @+blocks:List<&2, List<&2, F32>> -> @got:Br -> @acc:List<&2, List<&2, F32>> -> Pair(Array<F32>, List<&2, List<&2, F32>>)

def grans.go source · line 1078 · raw

@hop:Nat -> @+blocks:List<&2, List<&2, F32>> -> @tab:Array<F32> -> @acc:List<&2, List<&2, F32>> -> Pair(Array<F32>, List<&2, List<&2, F32>>)

def grans.np source · line 1087 · raw

@z:Bool -> @+nb:U32 -> U32

def grans.n source · line 1094 · raw

@+nb:U32 -> U32

def bt.put source · line 1097 · raw

@xs:List<&2, F32> -> @a:Array<F32> -> @+ii:U32 -> Array<F32>

def bt.of source · line 1105 · raw

Array<F32>

2^10 slots: tab.bt is 648 coefficients, filled in list order.

def gran.fin source · line 1108 · raw

@got:Pair(Array<F32>, List<&2, List<&2, F32>>) -> List<&2, List<&2, F32>>

def gran.all source · line 1112 · raw

@+blocks:List<&2, List<&2, F32>> -> List<&2, List<&2, F32>>

def flip.samp source · line 1116 · raw

@z:Bool -> @+vv:F32 -> F32

def flip.go source · line 1123 · raw

@xs:List<&2, F32> -> @+ii:U32 -> @acc:List<&2, F32> -> @+odd:Bool -> List<&2, F32>

def flip.one source · line 1130 · raw

@blk:List<&2, F32> -> @odd:Bool -> List<&2, F32>

def flip.all source · line 1133 · raw

@xs:List<&2, List<&2, F32>> -> @+ii:U32 -> @acc:List<&2, List<&2, F32>> -> List<&2, List<&2, F32>>

def ch.specs source · line 1140 · raw

@xs:List<&2, F32> -> List<&2, List<&2, F32>>

def bw.empty source · line 1147 · raw

Bw

def bw.put source · line 1150 · raw

@full:Bool -> @+acc:U32 -> @+n:U32 -> @out:List<&2, U32> -> Bw

def bw.bit source · line 1157 · raw

@st:Bw -> @+bit:U32 -> Bw

def bw.field source · line 1162 · raw

@hop:Nat -> @st:Bw -> @+val:U32 -> Bw

def bw.tail source · line 1169 · raw

@empty:Bool -> @+acc:U32 -> @+n:U32 -> @out:List<&2, U32> -> List<&2, U32>

def bw.bytes source · line 1176 · raw

@st:Bw -> List<&2, U32>

def pk.sr source · line 1181 · raw

@+hz:U32 -> U32

def pk.mode source · line 1190 · raw

@+ch:U32 -> U32

def pk.hdr source · line 1197 · raw

@+hz:U32 -> @+ch:U32 -> List<&2, U32>

def pk.fsz source · line 1200 · raw

@+hz:U32 -> U32

def pk.sidebits source · line 1203 · raw

@+ch:U32 -> U32

def pk.bud source · line 1210 · raw

@+hz:U32 -> @+ch:U32 -> U32

def blk.up source · line 1213 · raw

@+n:U32 -> U32

def blk.q source · line 1216 · raw

@+b:U32 -> U32

def blk.fix source · line 1219 · raw

@even:Bool -> @+q:U32 -> U32

def blk.odd source · line 1226 · raw

@+q:U32 -> U32

def blk.at source · line 1229 · raw

@small:Bool -> @+b:U32 -> U32

def blk.n source · line 1236 · raw

@+n:U32 -> U32

def enc.need source · line 1239 · raw

@+n:U32 -> U32

def enc.zero source · line 1242 · raw

@short:Bool -> @+have:U32 -> @+need:U32 -> U32

def enc.extra source · line 1249 · raw

@+have:U32 -> @+need:U32 -> U32

def side.priv source · line 1252 · raw

@+ch:U32 -> U32

def side.head source · line 1259 · raw

@st:Bw -> @+ch:U32 -> Bw

def side.mid source · line 1262 · raw

@st:Bw -> @+part:U32 -> @+big:U32 -> @+gain:U32 -> Bw

def side.tabs source · line 1265 · raw

@st:Bw -> @+tab:U32 -> Bw

def side.end source · line 1268 · raw

@st:Bw -> Bw

def side.gr source · line 1271 · raw

@st:Bw -> @g:Gr -> Bw

def side.grs source · line 1276 · raw

@gs:List<&2, Gr> -> @st:Bw -> Bw

def side.bytes source · line 1283 · raw

@gs:List<&2, Gr> -> @+ch:U32 -> List<&2, U32>

def body.bits source · line 1286 · raw

@xs:List<&2, U32> -> @st:Bw -> Bw

def body.one source · line 1293 · raw

@g:Gr -> @st:Bw -> Bw

def body.grs source · line 1298 · raw

@gs:List<&2, Gr> -> @st:Bw -> Bw

def pk.pad source · line 1305 · raw

@+xs:List<&2, U32> -> @+fsz:U32 -> List<&2, U32>

def pk.fit source · line 1309 · raw

@head:List<&2, U32> -> @body:List<&2, U32> -> @+fsz:U32 -> List<&2, U32>

def pk.one source · line 1312 · raw

@+gs:List<&2, Gr> -> @+hz:U32 -> @+ch:U32 -> List<&2, U32>

def pulse.gr source · line 1317 · raw

@b:Best -> Gr

one Huffman pair (mag, 0) in the first granule. global_gain stays 0.

def pulse.clamp source · line 1322 · raw

@small:Bool -> @+w:U32 -> U32

def pulse.mag0 source · line 1329 · raw

@z:Bool -> @+w:U32 -> U32

def pulse.mag source · line 1336 · raw

@+w:U32 -> U32

def pulse.frame source · line 1339 · raw

@+hz:U32 -> @+mag:U32 -> List<&2, U32>

def pk.chan source · line 1342 · raw

@specs:List<&2, List<&2, F32>> -> @+hz:U32 -> @+bud:U32 -> @acc:List<&2, Gr> -> List<&2, Gr>

def pk.buf source · line 1351 · raw

@done:Bool -> @buf:List<&2, Gr> -> @+g:Gr -> List<&2, Gr>

def pk.have source · line 1358 · raw

@done:Bool -> @+have:U32 -> U32

def pk.acc source · line 1365 · raw

@done:Bool -> @buf:List<&2, Gr> -> @+g:Gr -> @+hz:U32 -> @+ch:U32 -> @acc:List<&2, List<&2, U32>> -> List<&2, List<&2, U32>>

def pk.step source · line 1374 · raw

@gs:List<&2, Gr> -> @+buf:List<&2, Gr> -> @+have:U32 -> @+per:U32 -> @+hz:U32 -> @+ch:U32 -> @acc:List<&2, List<&2, U32>> -> List<&2, List<&2, U32>>

def pk.zip source · line 1386 · raw

@ls:List<&2, Gr> -> @rs:List<&2, Gr> -> @acc:List<&2, Gr> -> List<&2, Gr>

def enc.grow source · line 1393 · raw

@+xs:List<&2, F32> -> List<&2, F32>

def enc.chgr source · line 1397 · raw

@xs:List<&2, F32> -> @+hz:U32 -> @+bud:U32 -> List<&2, Gr>

def s16.f source · line 1400 · raw

@neg:Bool -> @+w:U32 -> F32

def samp.of source · line 1407 · raw

@+kind:U32 -> @+w:U32 -> F32

def pcm.go source · line 1414 · raw

@+kind:U32 -> @xs:List<&2, U32> -> @acc:List<&2, F32> -> List<&2, F32>

def split.rev source · line 1425 · raw

@c:Chs -> Chs

def split.on source · line 1430 · raw

@leftb:Bool -> @+v:F32 -> @l:List<&2, F32> -> @r:List<&2, F32> -> Chs

def split.put source · line 1437 · raw

@c:Chs -> @+v:F32 -> @+phase:U32 -> Chs

def split.flip source · line 1442 · raw

@z:Bool -> U32

def split.ph source · line 1449 · raw

@mono:Bool -> @+phase:U32 -> U32

def split.next source · line 1456 · raw

@+ch:U32 -> @+phase:U32 -> U32

def split.go source · line 1459 · raw

@xs:List<&2, F32> -> @+ch:U32 -> @c:Chs -> @+phase:U32 -> Chs

def enc.flat source · line 1466 · raw

@xs:List<&2, List<&2, U32>> -> List<&2, U32>

def enc.mono source · line 1473 · raw

@+hz:U32 -> @left:List<&2, F32> -> List<&2, List<&2, U32>>

def enc.stereo source · line 1476 · raw

@+hz:U32 -> @left:List<&2, F32> -> @right:List<&2, F32> -> List<&2, List<&2, U32>>

def enc.chs source · line 1480 · raw

@mono:Bool -> @+hz:U32 -> @left:List<&2, F32> -> @right:List<&2, F32> -> List<&2, List<&2, U32>>

def enc.some source · line 1489 · raw

@empty:Bool -> @+xs:List<&2, U32> -> Maybe<&2, List<&2, U32>>

def enc.packed source · line 1496 · raw

@+xs:List<&2, U32> -> Maybe<&2, List<&2, U32>>

def enc.out source · line 1499 · raw

@mono:Bool -> @+hz:U32 -> @l:List<&2, F32> -> @r:List<&2, F32> -> Maybe<&2, List<&2, U32>>

def enc.from source · line 1502 · raw

@c:Chs -> @+hz:U32 -> @+ch:U32 -> Maybe<&2, List<&2, U32>>

def enc.kind source · line 1507 · raw

@+k:U32 -> Bool

def enc.go source · line 1516 · raw

@+hz:U32 -> @+ch:U32 -> @+kind:U32 -> @frames:List<&2, U32> -> Maybe<&2, List<&2, U32>>

def enc.finish source · line 1519 · raw

@ok:Bool -> @+hz:U32 -> @+ch:U32 -> @+kind:U32 -> @frames:List<&2, U32> -> Maybe<&2, List<&2, U32>>

def enc.run source · line 1528 · raw

@+hz:U32 -> @+ch:U32 -> @+kind:U32 -> @frames:List<&2, U32> -> Maybe<&2, List<&2, U32>>