File: compress.go

package info (click to toggle)
golang-github-pointlander-compress 1.1.0-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 324 kB
  • sloc: makefile: 7
file content (50 lines) | stat: -rw-r--r-- 930 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package compress

const (
	BUFFER_COUNT = 1 << 3
	BUFFER_SIZE = 1 << 10
	BUFFER_CHAN_SIZE = BUFFER_COUNT - 2
	BUFFER_POOL_SIZE = BUFFER_COUNT * BUFFER_SIZE
	BUFFER_POOL_SIZE_MASK = BUFFER_POOL_SIZE - 1
)

type Coder8 struct {
	Alphabit uint16
	Input <-chan []uint8
	Output func(symbol uint8) bool
}

type Coder16 struct {
	Alphabit uint16
	Input <-chan []uint16
	Output func(symbol uint16) bool
}

const (
	MAX_SCALE16 = (1 << (16 - 2)) - 1
	MAX_SCALE32 = (1 << (32 - 2)) - 1
)

type Symbol struct {
	Scale, Low, High uint16
}

type Symbol32 struct {
	Scale, Low, High uint32
}

type Model struct {
	Scale uint32
	Input <-chan []Symbol
	Output func(code uint16) Symbol
}

type Model32 struct {
	Scale uint64
	Input <-chan []Symbol32
	Output func(code uint32) Symbol32
}