blob: 41c56e0cca73459dbe1b8d19fc590ff6162c0243 [file] [log] [blame]
Sjoerd Mullenderc8718c31995-05-17 11:18:22 +00001#
2# cl.h - Compression Library typedefs and prototypes
3#
4# 01/07/92 Cleanup by Brian Knittel
5# 02/18/92 Original Version by Brian Knittel
6#
7
8#
9# originalFormat parameter values
10#
11MAX_NUMBER_OF_ORIGINAL_FORMATS = 32
12
13# Audio
14MONO = 0
15STEREO_INTERLEAVED = 1
16
17# Video
18# YUV is defined to be the same thing as YCrCb (luma and two chroma components).
19# 422 is appended to YUV (or YCrCb) if the chroma is sub-sampled by 2
20# horizontally, packed as U Y1 V Y2 (byte order).
21# 422HC is appended to YUV (or YCrCb) if the chroma is sub-sampled by 2
22# vertically in addition to horizontally, and is packed the same as
23# 422 except that U & V are not valid on the second line.
24#
25RGB = 0
26RGBX = 1
27RGBA = 2
28RGB332 = 3
29
30GRAYSCALE = 4
31Y = 4
32YUV = 5
33YCbCr = 5
34YUV422 = 6 # 4:2:2 sampling
35YCbCr422 = 6 # 4:2:2 sampling
36YUV422HC = 7 # 4:1:1 sampling
37YCbCr422HC = 7 # 4:1:1 sampling
38YUV422DC = 7 # 4:1:1 sampling
39YCbCr422DC = 7 # 4:1:1 sampling
40
41BEST_FIT = -1
42
43def BytesPerSample(s):
44 if s in (MONO, YUV):
45 return 2
46 elif s == STEREO_INTERLEAVED:
47 return 4
48 else:
49 return 0
50
51def BytesPerPixel(f):
52 if f in (RGB, YUV):
53 return 3
54 elif f in (RGBX, RGBA):
55 return 4
56 elif f in (RGB332, GRAYSCALE):
57 return 1
58 else:
59 return 2
60
61def AudioFormatName(f):
62 if f == MONO:
63 return 'MONO'
64 elif f == STEREO_INTERLEAVED:
65 return 'STEREO_INTERLEAVED'
66 else:
67 return 'Not a valid format'
68
69def VideoFormatName(f):
70 if f == RGB:
71 return 'RGB'
72 elif f == RGBX:
73 return 'RGBX'
74 elif f == RGBA:
75 return 'RGBA'
76 elif f == RGB332:
77 return 'RGB332'
78 elif f == GRAYSCALE:
79 return 'GRAYSCALE'
80 elif f == YUV:
81 return 'YUV'
82 elif f == YUV422:
83 return 'YUV422'
84 elif f == YUV422DC:
85 return 'YUV422DC'
86 else:
87 return 'Not a valid format'
88
89MAX_NUMBER_OF_AUDIO_ALGORITHMS = 32
90MAX_NUMBER_OF_VIDEO_ALGORITHMS = 32
91
92#
93# Algorithm types
94#
95AUDIO = 0
96VIDEO = 1
97
98def AlgorithmNumber(scheme):
99 return scheme & 0x7fff
100def AlgorithmType(scheme):
101 return (scheme >> 15) & 1
102def Algorithm(type, n):
103 return n | ((type & 1) << 15)
104
105#
106# "compressionScheme" argument values
107#
108UNKNOWN_SCHEME = -1
109
110UNCOMPRESSED_AUDIO = Algorithm(AUDIO, 0)
111G711_ULAW = Algorithm(AUDIO, 1)
112ULAW = Algorithm(AUDIO, 1)
113G711_ALAW = Algorithm(AUDIO, 2)
114ALAW = Algorithm(AUDIO, 2)
115AWARE_MPEG_AUDIO = Algorithm(AUDIO, 3)
116AWARE_MULTIRATE = Algorithm(AUDIO, 4)
117
118UNCOMPRESSED = Algorithm(VIDEO, 0)
119UNCOMPRESSED_VIDEO = Algorithm(VIDEO, 0)
120RLE = Algorithm(VIDEO, 1)
121JPEG = Algorithm(VIDEO, 2)
122MPEG_VIDEO = Algorithm(VIDEO, 3)
123MVC1 = Algorithm(VIDEO, 4)
124RTR = Algorithm(VIDEO, 5)
125RTR1 = Algorithm(VIDEO, 5)
126
127#
128# Parameters
129#
130MAX_NUMBER_OF_PARAMS = 256
131# Default Parameters
132IMAGE_WIDTH = 0
133IMAGE_HEIGHT = 1
134ORIGINAL_FORMAT = 2
135INTERNAL_FORMAT = 3
136COMPONENTS = 4
137BITS_PER_COMPONENT = 5
138FRAME_RATE = 6
139COMPRESSION_RATIO = 7
140EXACT_COMPRESSION_RATIO = 8
141FRAME_BUFFER_SIZE = 9
142COMPRESSED_BUFFER_SIZE = 10
143BLOCK_SIZE = 11
144PREROLL = 12
145FRAME_TYPE = 13
146ALGORITHM_ID = 14
147ALGORITHM_VERSION = 15
148ORIENTATION = 16
149NUMBER_OF_FRAMES = 17
150SPEED = 18
151LAST_FRAME_INDEX = 19
152NUMBER_OF_PARAMS = 20
153
154# JPEG Specific Parameters
155QUALITY_FACTOR = NUMBER_OF_PARAMS + 0
156
157# MPEG Specific Parameters
158END_OF_SEQUENCE = NUMBER_OF_PARAMS + 0
159
160# RTR Specific Parameters
161QUALITY_LEVEL = NUMBER_OF_PARAMS + 0
162ZOOM_X = NUMBER_OF_PARAMS + 1
163ZOOM_Y = NUMBER_OF_PARAMS + 2
164
165#
166# Parameter value types
167#
168ENUM_VALUE = 0 # only certain constant values are valid
169RANGE_VALUE = 1 # any value in a given range is valid
170FLOATING_ENUM_VALUE = 2 # only certain constant floating point values are valid
171FLOATING_RANGE_VALUE = 3 # any value in a given floating point range is valid
172
173#
174# Algorithm Functionality
175#
176DECOMPRESSOR = 1
177COMPRESSOR = 2
178CODEC = 3
179
180#
181# Buffer types
182#
183NONE = 0
184FRAME = 1
185DATA = 2
186
187#
188# Frame types
189#
190NONE = 0
191KEYFRAME = 1
192INTRA = 1
193PREDICTED = 2
194BIDIRECTIONAL = 3
195
196#
197# Orientations
198#
199TOP_DOWN = 0
200BOTTOM_UP = 1
201
202#
203# SGI Proprietaty Algorithm Header Start Code
204#
205HEADER_START_CODE = 0xc1C0DEC
206
207#
208# error codes
209#
210
211BAD_NO_BUFFERSPACE = -2 # no space for internal buffers
212BAD_PVBUFFER = -3 # param/val buffer doesn't make sense
213BAD_BUFFERLENGTH_NEG = -4 # negative buffer length
214BAD_BUFFERLENGTH_ODD = -5 # odd length parameter/value buffer
215BAD_PARAM = -6 # invalid parameter
216BAD_COMPRESSION_SCHEME = -7 # compression scheme parameter invalid
217BAD_COMPRESSOR_HANDLE = -8 # compression handle parameter invalid
218BAD_COMPRESSOR_HANDLE_POINTER = -9 # compression handle pointer invalid
219BAD_BUFFER_HANDLE = -10 # buffer handle invalid
220BAD_BUFFER_QUERY_SIZE = -11 # buffer query size too large
221JPEG_ERROR = -12 # error from libjpeg
222BAD_FRAME_SIZE = -13 # frame size invalid
223PARAM_OUT_OF_RANGE = -14 # parameter out of range
224ADDED_ALGORITHM_ERROR = -15 # added algorithm had a unique error
225BAD_ALGORITHM_TYPE = -16 # bad algorithm type
226BAD_ALGORITHM_NAME = -17 # bad algorithm name
227BAD_BUFFERING = -18 # bad buffering calls
228BUFFER_NOT_CREATED = -19 # buffer not created
229BAD_BUFFER_EXISTS = -20 # buffer already created
230BAD_INTERNAL_FORMAT = -21 # invalid internal format
231BAD_BUFFER_POINTER = -22 # invalid buffer pointer
232FRAME_BUFFER_SIZE_ZERO = -23 # frame buffer has zero size
233BAD_STREAM_HEADER = -24 # invalid stream header
234
235BAD_LICENSE = -25 # netls license not valid
236AWARE_ERROR = -26 # error from libawcmp