2 # cl.h - Compression Library typedefs and prototypes
4 # 01/07/92 Cleanup by Brian Knittel
5 # 02/18/92 Original Version by Brian Knittel
9 # originalFormat parameter values
11 from warnings
import warnpy3k
12 warnpy3k("the CL_old module has been removed in Python 3.0", stacklevel
=2)
15 MAX_NUMBER_OF_ORIGINAL_FORMATS
= 32
19 STEREO_INTERLEAVED
= 1
22 # YUV is defined to be the same thing as YCrCb (luma and two chroma components).
23 # 422 is appended to YUV (or YCrCb) if the chroma is sub-sampled by 2
24 # horizontally, packed as U Y1 V Y2 (byte order).
25 # 422HC is appended to YUV (or YCrCb) if the chroma is sub-sampled by 2
26 # vertically in addition to horizontally, and is packed the same as
27 # 422 except that U & V are not valid on the second line.
38 YUV422
= 6 # 4:2:2 sampling
39 YCbCr422
= 6 # 4:2:2 sampling
40 YUV422HC
= 7 # 4:1:1 sampling
41 YCbCr422HC
= 7 # 4:1:1 sampling
42 YUV422DC
= 7 # 4:1:1 sampling
43 YCbCr422DC
= 7 # 4:1:1 sampling
47 def BytesPerSample(s
):
50 elif s
== STEREO_INTERLEAVED
:
58 elif f
in (RGBX
, RGBA
):
60 elif f
in (RGB332
, GRAYSCALE
):
65 def AudioFormatName(f
):
68 elif f
== STEREO_INTERLEAVED
:
69 return 'STEREO_INTERLEAVED'
71 return 'Not a valid format'
73 def VideoFormatName(f
):
91 return 'Not a valid format'
93 MAX_NUMBER_OF_AUDIO_ALGORITHMS
= 32
94 MAX_NUMBER_OF_VIDEO_ALGORITHMS
= 32
102 def AlgorithmNumber(scheme
):
103 return scheme
& 0x7fff
104 def AlgorithmType(scheme
):
105 return (scheme
>> 15) & 1
106 def Algorithm(type, n
):
107 return n |
((type & 1) << 15)
110 # "compressionScheme" argument values
114 UNCOMPRESSED_AUDIO
= Algorithm(AUDIO
, 0)
115 G711_ULAW
= Algorithm(AUDIO
, 1)
116 ULAW
= Algorithm(AUDIO
, 1)
117 G711_ALAW
= Algorithm(AUDIO
, 2)
118 ALAW
= Algorithm(AUDIO
, 2)
119 AWARE_MPEG_AUDIO
= Algorithm(AUDIO
, 3)
120 AWARE_MULTIRATE
= Algorithm(AUDIO
, 4)
122 UNCOMPRESSED
= Algorithm(VIDEO
, 0)
123 UNCOMPRESSED_VIDEO
= Algorithm(VIDEO
, 0)
124 RLE
= Algorithm(VIDEO
, 1)
125 JPEG
= Algorithm(VIDEO
, 2)
126 MPEG_VIDEO
= Algorithm(VIDEO
, 3)
127 MVC1
= Algorithm(VIDEO
, 4)
128 RTR
= Algorithm(VIDEO
, 5)
129 RTR1
= Algorithm(VIDEO
, 5)
134 MAX_NUMBER_OF_PARAMS
= 256
141 BITS_PER_COMPONENT
= 5
143 COMPRESSION_RATIO
= 7
144 EXACT_COMPRESSION_RATIO
= 8
145 FRAME_BUFFER_SIZE
= 9
146 COMPRESSED_BUFFER_SIZE
= 10
151 ALGORITHM_VERSION
= 15
153 NUMBER_OF_FRAMES
= 17
155 LAST_FRAME_INDEX
= 19
156 NUMBER_OF_PARAMS
= 20
158 # JPEG Specific Parameters
159 QUALITY_FACTOR
= NUMBER_OF_PARAMS
+ 0
161 # MPEG Specific Parameters
162 END_OF_SEQUENCE
= NUMBER_OF_PARAMS
+ 0
164 # RTR Specific Parameters
165 QUALITY_LEVEL
= NUMBER_OF_PARAMS
+ 0
166 ZOOM_X
= NUMBER_OF_PARAMS
+ 1
167 ZOOM_Y
= NUMBER_OF_PARAMS
+ 2
170 # Parameter value types
172 ENUM_VALUE
= 0 # only certain constant values are valid
173 RANGE_VALUE
= 1 # any value in a given range is valid
174 FLOATING_ENUM_VALUE
= 2 # only certain constant floating point values are valid
175 FLOATING_RANGE_VALUE
= 3 # any value in a given floating point range is valid
178 # Algorithm Functionality
207 # SGI Proprietary Algorithm Header Start Code
209 HEADER_START_CODE
= 0xc1C0DEC
215 BAD_NO_BUFFERSPACE
= -2 # no space for internal buffers
216 BAD_PVBUFFER
= -3 # param/val buffer doesn't make sense
217 BAD_BUFFERLENGTH_NEG
= -4 # negative buffer length
218 BAD_BUFFERLENGTH_ODD
= -5 # odd length parameter/value buffer
219 BAD_PARAM
= -6 # invalid parameter
220 BAD_COMPRESSION_SCHEME
= -7 # compression scheme parameter invalid
221 BAD_COMPRESSOR_HANDLE
= -8 # compression handle parameter invalid
222 BAD_COMPRESSOR_HANDLE_POINTER
= -9 # compression handle pointer invalid
223 BAD_BUFFER_HANDLE
= -10 # buffer handle invalid
224 BAD_BUFFER_QUERY_SIZE
= -11 # buffer query size too large
225 JPEG_ERROR
= -12 # error from libjpeg
226 BAD_FRAME_SIZE
= -13 # frame size invalid
227 PARAM_OUT_OF_RANGE
= -14 # parameter out of range
228 ADDED_ALGORITHM_ERROR
= -15 # added algorithm had a unique error
229 BAD_ALGORITHM_TYPE
= -16 # bad algorithm type
230 BAD_ALGORITHM_NAME
= -17 # bad algorithm name
231 BAD_BUFFERING
= -18 # bad buffering calls
232 BUFFER_NOT_CREATED
= -19 # buffer not created
233 BAD_BUFFER_EXISTS
= -20 # buffer already created
234 BAD_INTERNAL_FORMAT
= -21 # invalid internal format
235 BAD_BUFFER_POINTER
= -22 # invalid buffer pointer
236 FRAME_BUFFER_SIZE_ZERO
= -23 # frame buffer has zero size
237 BAD_STREAM_HEADER
= -24 # invalid stream header
239 BAD_LICENSE
= -25 # netls license not valid
240 AWARE_ERROR
= -26 # error from libawcmp