1992-09-23 11:53:00 -03:00
|
|
|
/***********************************************************
|
1995-01-04 15:10:35 -04:00
|
|
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
|
|
|
The Netherlands.
|
1992-09-23 11:53:00 -03:00
|
|
|
|
|
|
|
All Rights Reserved
|
|
|
|
|
1996-10-25 11:44:06 -03:00
|
|
|
Permission to use, copy, modify, and distribute this software and its
|
|
|
|
documentation for any purpose and without fee is hereby granted,
|
1992-09-23 11:53:00 -03:00
|
|
|
provided that the above copyright notice appear in all copies and that
|
1996-10-25 11:44:06 -03:00
|
|
|
both that copyright notice and this permission notice appear in
|
1992-09-23 11:53:00 -03:00
|
|
|
supporting documentation, and that the names of Stichting Mathematisch
|
1996-10-25 11:44:06 -03:00
|
|
|
Centrum or CWI or Corporation for National Research Initiatives or
|
|
|
|
CNRI not be used in advertising or publicity pertaining to
|
|
|
|
distribution of the software without specific, written prior
|
|
|
|
permission.
|
|
|
|
|
|
|
|
While CWI is the initial source for this software, a modified version
|
|
|
|
is made available by the Corporation for National Research Initiatives
|
|
|
|
(CNRI) at the Internet address ftp://ftp.python.org.
|
|
|
|
|
|
|
|
STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
|
|
|
|
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
|
|
|
|
CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
|
|
|
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
|
|
|
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
|
|
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
PERFORMANCE OF THIS SOFTWARE.
|
1992-09-23 11:53:00 -03:00
|
|
|
|
|
|
|
******************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/* Cl objects */
|
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
#define CLDEBUG
|
|
|
|
|
1992-09-24 07:37:39 -03:00
|
|
|
#include <stdarg.h>
|
1992-09-23 11:53:00 -03:00
|
|
|
#include <cl.h>
|
1997-01-17 12:00:02 -04:00
|
|
|
#include "Python.h"
|
1992-09-23 11:53:00 -03:00
|
|
|
|
|
|
|
typedef struct {
|
1997-01-17 12:00:02 -04:00
|
|
|
PyObject_HEAD
|
1992-09-23 11:53:00 -03:00
|
|
|
int ob_isCompressor; /* Compressor or Decompressor */
|
1992-12-14 09:17:29 -04:00
|
|
|
CL_Handle ob_compressorHdl;
|
1993-02-16 07:55:17 -04:00
|
|
|
int *ob_paramtypes;
|
|
|
|
int ob_nparams;
|
1992-09-23 11:53:00 -03:00
|
|
|
} clobject;
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *ClError; /* exception cl.error */
|
1992-09-24 07:37:39 -03:00
|
|
|
|
|
|
|
static int error_handler_called = 0;
|
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
/*
|
|
|
|
* We want to use the function prototypes that are available in the C
|
|
|
|
* compiler on the SGI. Because of that, we need to declare the first
|
|
|
|
* argument of the compressor and decompressor methods as "object *",
|
|
|
|
* even though they are really "clobject *". Therefore we cast the
|
|
|
|
* argument to the proper type using this macro.
|
|
|
|
*/
|
|
|
|
#define SELF ((clobject *) self)
|
|
|
|
|
1992-12-14 09:17:29 -04:00
|
|
|
/********************************************************************
|
|
|
|
Utility routines.
|
|
|
|
********************************************************************/
|
1992-09-24 07:37:39 -03:00
|
|
|
static void
|
1993-02-04 12:43:28 -04:00
|
|
|
cl_ErrorHandler(CL_Handle handle, int code, const char *fmt, ...)
|
1992-09-24 07:37:39 -03:00
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
char errbuf[BUFSIZ]; /* hopefully big enough */
|
1992-09-29 13:43:43 -03:00
|
|
|
char *p;
|
1992-09-24 07:37:39 -03:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (PyErr_Occurred()) /* don't change existing error */
|
1992-09-29 13:43:43 -03:00
|
|
|
return;
|
1992-09-24 07:37:39 -03:00
|
|
|
error_handler_called = 1;
|
|
|
|
va_start(ap, fmt);
|
|
|
|
vsprintf(errbuf, fmt, ap);
|
|
|
|
va_end(ap);
|
1992-09-29 13:43:43 -03:00
|
|
|
p = &errbuf[strlen(errbuf) - 1]; /* swat the line feed */
|
|
|
|
if (*p == '\n')
|
|
|
|
*p = 0;
|
1997-01-17 12:00:02 -04:00
|
|
|
PyErr_SetString(ClError, errbuf);
|
1992-09-24 07:37:39 -03:00
|
|
|
}
|
|
|
|
|
1992-12-14 09:17:29 -04:00
|
|
|
/*
|
|
|
|
* This assumes that params are always in the range 0 to some maximum.
|
|
|
|
*/
|
|
|
|
static int
|
1993-02-16 07:55:17 -04:00
|
|
|
param_type_is_float(clobject *self, int param)
|
1992-09-25 07:28:20 -03:00
|
|
|
{
|
1993-02-04 12:43:28 -04:00
|
|
|
int bufferlength;
|
1992-09-25 07:28:20 -03:00
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
if (self->ob_paramtypes == NULL) {
|
|
|
|
error_handler_called = 0;
|
|
|
|
bufferlength = clQueryParams(self->ob_compressorHdl, 0, 0);
|
|
|
|
if (error_handler_called)
|
|
|
|
return -1;
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
self->ob_paramtypes = PyMem_NEW(int, bufferlength);
|
1993-02-16 07:55:17 -04:00
|
|
|
if (self->ob_paramtypes == NULL)
|
|
|
|
return -1;
|
|
|
|
self->ob_nparams = bufferlength / 2;
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
(void) clQueryParams(self->ob_compressorHdl,
|
|
|
|
self->ob_paramtypes, bufferlength);
|
1993-02-16 07:55:17 -04:00
|
|
|
if (error_handler_called) {
|
1997-01-17 12:00:02 -04:00
|
|
|
PyMem_DEL(self->ob_paramtypes);
|
1993-02-16 07:55:17 -04:00
|
|
|
self->ob_paramtypes = NULL;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
1992-09-25 07:28:20 -03:00
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
if (param < 0 || param >= self->ob_nparams)
|
1992-12-14 09:17:29 -04:00
|
|
|
return -1;
|
1992-09-25 07:28:20 -03:00
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
if (self->ob_paramtypes[param*2 + 1] == CL_FLOATING_ENUM_VALUE ||
|
|
|
|
self->ob_paramtypes[param*2 + 1] == CL_FLOATING_RANGE_VALUE)
|
|
|
|
return 1;
|
1992-12-14 09:17:29 -04:00
|
|
|
else
|
1993-02-16 07:55:17 -04:00
|
|
|
return 0;
|
1992-09-25 07:28:20 -03:00
|
|
|
}
|
|
|
|
|
1992-12-14 09:17:29 -04:00
|
|
|
/********************************************************************
|
|
|
|
Single image compression/decompression.
|
|
|
|
********************************************************************/
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
cl_CompressImage(PyObject *self, PyObject *args)
|
1992-09-23 11:53:00 -03:00
|
|
|
{
|
1993-02-04 12:43:28 -04:00
|
|
|
int compressionScheme, width, height, originalFormat;
|
1992-12-14 09:17:29 -04:00
|
|
|
float compressionRatio;
|
1993-02-04 12:43:28 -04:00
|
|
|
int frameBufferSize, compressedBufferSize;
|
1992-12-14 09:17:29 -04:00
|
|
|
char *frameBuffer;
|
1997-01-17 12:00:02 -04:00
|
|
|
PyObject *compressedBuffer;
|
1992-09-23 11:53:00 -03:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_Parse(args, "(iiiifs#)", &compressionScheme,
|
|
|
|
&width, &height,
|
|
|
|
&originalFormat, &compressionRatio, &frameBuffer,
|
|
|
|
&frameBufferSize))
|
1992-09-23 11:53:00 -03:00
|
|
|
return NULL;
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
retry:
|
|
|
|
compressedBuffer = PyString_FromStringAndSize(NULL, frameBufferSize);
|
1992-12-14 09:17:29 -04:00
|
|
|
if (compressedBuffer == NULL)
|
1992-09-23 11:53:00 -03:00
|
|
|
return NULL;
|
|
|
|
|
1992-12-14 09:17:29 -04:00
|
|
|
compressedBufferSize = frameBufferSize;
|
1992-09-24 07:37:39 -03:00
|
|
|
error_handler_called = 0;
|
1992-12-14 09:17:29 -04:00
|
|
|
if (clCompressImage(compressionScheme, width, height, originalFormat,
|
|
|
|
compressionRatio, (void *) frameBuffer,
|
|
|
|
&compressedBufferSize,
|
1997-01-17 12:00:02 -04:00
|
|
|
(void *) PyString_AsString(compressedBuffer))
|
1992-12-14 09:17:29 -04:00
|
|
|
== FAILURE) {
|
1997-01-17 12:00:02 -04:00
|
|
|
Py_DECREF(compressedBuffer);
|
1992-12-14 09:17:29 -04:00
|
|
|
if (!error_handler_called)
|
1997-01-17 12:00:02 -04:00
|
|
|
PyErr_SetString(ClError, "clCompressImage failed");
|
1992-09-24 07:37:39 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
1992-09-23 11:53:00 -03:00
|
|
|
|
1992-12-14 09:17:29 -04:00
|
|
|
if (compressedBufferSize > frameBufferSize) {
|
|
|
|
frameBufferSize = compressedBufferSize;
|
1997-01-17 12:00:02 -04:00
|
|
|
Py_DECREF(compressedBuffer);
|
1992-12-14 09:17:29 -04:00
|
|
|
goto retry;
|
1992-09-29 13:43:43 -03:00
|
|
|
}
|
|
|
|
|
1992-12-14 09:17:29 -04:00
|
|
|
if (compressedBufferSize < frameBufferSize)
|
1997-01-17 12:00:02 -04:00
|
|
|
if (_PyString_Resize(&compressedBuffer, compressedBufferSize))
|
1992-12-14 09:17:29 -04:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return compressedBuffer;
|
|
|
|
}
|
1992-09-23 11:53:00 -03:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
cl_DecompressImage(PyObject *self, PyObject *args)
|
1992-09-23 11:53:00 -03:00
|
|
|
{
|
1993-02-04 12:43:28 -04:00
|
|
|
int compressionScheme, width, height, originalFormat;
|
1992-12-14 09:17:29 -04:00
|
|
|
char *compressedBuffer;
|
1993-02-04 12:43:28 -04:00
|
|
|
int compressedBufferSize, frameBufferSize;
|
1997-01-17 12:00:02 -04:00
|
|
|
PyObject *frameBuffer;
|
1992-09-25 07:28:20 -03:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_Parse(args, "(iiiis#)", &compressionScheme, &width, &height,
|
|
|
|
&originalFormat, &compressedBuffer,
|
|
|
|
&compressedBufferSize))
|
1992-09-23 11:53:00 -03:00
|
|
|
return NULL;
|
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
frameBufferSize = width * height * CL_BytesPerPixel(originalFormat);
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
frameBuffer = PyString_FromStringAndSize(NULL, frameBufferSize);
|
1992-12-14 09:17:29 -04:00
|
|
|
if (frameBuffer == NULL)
|
1992-09-23 11:53:00 -03:00
|
|
|
return NULL;
|
|
|
|
|
1992-09-24 07:37:39 -03:00
|
|
|
error_handler_called = 0;
|
1992-12-14 09:17:29 -04:00
|
|
|
if (clDecompressImage(compressionScheme, width, height, originalFormat,
|
|
|
|
compressedBufferSize, compressedBuffer,
|
1997-01-17 12:00:02 -04:00
|
|
|
(void *) PyString_AsString(frameBuffer))
|
|
|
|
== FAILURE) {
|
|
|
|
Py_DECREF(frameBuffer);
|
1992-12-14 09:17:29 -04:00
|
|
|
if (!error_handler_called)
|
1997-01-17 12:00:02 -04:00
|
|
|
PyErr_SetString(ClError, "clDecompressImage failed");
|
1992-09-24 07:37:39 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
1992-09-23 11:53:00 -03:00
|
|
|
|
1992-12-14 09:17:29 -04:00
|
|
|
return frameBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
Sequential compression/decompression.
|
|
|
|
********************************************************************/
|
|
|
|
#define CheckCompressor(self) if ((self)->ob_compressorHdl == NULL) { \
|
1997-01-17 12:00:02 -04:00
|
|
|
PyErr_SetString(PyExc_RuntimeError, "(de)compressor not active"); \
|
|
|
|
return NULL; \
|
|
|
|
}
|
1992-09-23 11:53:00 -03:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
doClose(clobject *self, PyObject *args, int (*close_func)(CL_Handle))
|
1992-09-23 11:53:00 -03:00
|
|
|
{
|
1992-09-25 07:28:20 -03:00
|
|
|
CheckCompressor(self);
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_NoArgs(args))
|
1992-09-23 11:53:00 -03:00
|
|
|
return NULL;
|
|
|
|
|
1992-09-24 07:37:39 -03:00
|
|
|
error_handler_called = 0;
|
1992-12-14 09:17:29 -04:00
|
|
|
if ((*close_func)(self->ob_compressorHdl) == FAILURE) {
|
1992-09-24 07:37:39 -03:00
|
|
|
if (!error_handler_called)
|
1997-01-17 12:00:02 -04:00
|
|
|
PyErr_SetString(ClError, "close failed");
|
1992-09-24 07:37:39 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
1992-09-23 11:53:00 -03:00
|
|
|
|
1992-12-14 09:17:29 -04:00
|
|
|
self->ob_compressorHdl = NULL;
|
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
if (self->ob_paramtypes)
|
1997-01-17 12:00:02 -04:00
|
|
|
PyMem_DEL(self->ob_paramtypes);
|
1993-02-16 07:55:17 -04:00
|
|
|
self->ob_paramtypes = NULL;
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1992-09-23 11:53:00 -03:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
clm_CloseCompressor(PyObject *self, PyObject *args)
|
1992-09-23 11:53:00 -03:00
|
|
|
{
|
1993-02-16 07:55:17 -04:00
|
|
|
return doClose(SELF, args, clCloseCompressor);
|
1992-12-14 09:17:29 -04:00
|
|
|
}
|
1992-09-23 11:53:00 -03:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
clm_CloseDecompressor(PyObject *self, PyObject *args)
|
1992-12-14 09:17:29 -04:00
|
|
|
{
|
1993-02-16 07:55:17 -04:00
|
|
|
return doClose(SELF, args, clCloseDecompressor);
|
1992-09-23 11:53:00 -03:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
clm_Compress(PyObject *self, PyObject *args)
|
1992-09-23 11:53:00 -03:00
|
|
|
{
|
1993-02-04 12:43:28 -04:00
|
|
|
int numberOfFrames;
|
1993-02-16 07:55:17 -04:00
|
|
|
int frameBufferSize, compressedBufferSize, size;
|
1992-12-14 09:17:29 -04:00
|
|
|
char *frameBuffer;
|
1997-01-17 12:00:02 -04:00
|
|
|
PyObject *data;
|
1992-09-23 11:53:00 -03:00
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
CheckCompressor(SELF);
|
1992-09-25 07:28:20 -03:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_Parse(args, "(is#)", &numberOfFrames,
|
|
|
|
&frameBuffer, &frameBufferSize))
|
1992-09-23 11:53:00 -03:00
|
|
|
return NULL;
|
|
|
|
|
1992-09-24 07:37:39 -03:00
|
|
|
error_handler_called = 0;
|
1993-02-16 07:55:17 -04:00
|
|
|
size = clGetParam(SELF->ob_compressorHdl, CL_COMPRESSED_BUFFER_SIZE);
|
|
|
|
compressedBufferSize = size;
|
1992-09-24 07:37:39 -03:00
|
|
|
if (error_handler_called)
|
|
|
|
return NULL;
|
1992-09-23 11:53:00 -03:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
data = PyString_FromStringAndSize(NULL, size);
|
1992-12-14 09:17:29 -04:00
|
|
|
if (data == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
error_handler_called = 0;
|
1993-02-16 07:55:17 -04:00
|
|
|
if (clCompress(SELF->ob_compressorHdl, numberOfFrames,
|
1992-12-14 09:17:29 -04:00
|
|
|
(void *) frameBuffer, &compressedBufferSize,
|
1997-01-17 12:00:02 -04:00
|
|
|
(void *) PyString_AsString(data)) == FAILURE) {
|
|
|
|
Py_DECREF(data);
|
1992-12-14 09:17:29 -04:00
|
|
|
if (!error_handler_called)
|
1997-01-17 12:00:02 -04:00
|
|
|
PyErr_SetString(ClError, "compress failed");
|
1992-12-14 09:17:29 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
if (compressedBufferSize < size)
|
1997-01-17 12:00:02 -04:00
|
|
|
if (_PyString_Resize(&data, compressedBufferSize))
|
1992-12-14 09:17:29 -04:00
|
|
|
return NULL;
|
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
if (compressedBufferSize > size) {
|
1992-12-14 09:17:29 -04:00
|
|
|
/* we didn't get all "compressed" data */
|
1997-01-17 12:00:02 -04:00
|
|
|
Py_DECREF(data);
|
|
|
|
PyErr_SetString(ClError,
|
|
|
|
"compressed data is more than fitted");
|
1992-12-14 09:17:29 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return data;
|
1992-09-23 11:53:00 -03:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
clm_Decompress(PyObject *self, PyObject *args)
|
1992-09-23 11:53:00 -03:00
|
|
|
{
|
1997-01-17 12:00:02 -04:00
|
|
|
PyObject *data;
|
1993-02-04 12:43:28 -04:00
|
|
|
int numberOfFrames;
|
1992-12-14 09:17:29 -04:00
|
|
|
char *compressedData;
|
1993-02-16 07:55:17 -04:00
|
|
|
int compressedDataSize, dataSize;
|
1992-09-23 11:53:00 -03:00
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
CheckCompressor(SELF);
|
1992-09-25 07:28:20 -03:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_Parse(args, "(is#)", &numberOfFrames, &compressedData,
|
|
|
|
&compressedDataSize))
|
1992-09-23 11:53:00 -03:00
|
|
|
return NULL;
|
|
|
|
|
1992-09-24 07:37:39 -03:00
|
|
|
error_handler_called = 0;
|
1993-02-16 07:55:17 -04:00
|
|
|
dataSize = clGetParam(SELF->ob_compressorHdl, CL_FRAME_BUFFER_SIZE);
|
1992-09-24 07:37:39 -03:00
|
|
|
if (error_handler_called)
|
|
|
|
return NULL;
|
1992-12-14 09:17:29 -04:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
data = PyString_FromStringAndSize(NULL, dataSize);
|
1992-12-14 09:17:29 -04:00
|
|
|
if (data == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
error_handler_called = 0;
|
1993-02-16 07:55:17 -04:00
|
|
|
if (clDecompress(SELF->ob_compressorHdl, numberOfFrames,
|
1992-12-14 09:17:29 -04:00
|
|
|
compressedDataSize, (void *) compressedData,
|
1997-01-17 12:00:02 -04:00
|
|
|
(void *) PyString_AsString(data)) == FAILURE) {
|
|
|
|
Py_DECREF(data);
|
1992-12-14 09:17:29 -04:00
|
|
|
if (!error_handler_called)
|
1997-01-17 12:00:02 -04:00
|
|
|
PyErr_SetString(ClError, "decompress failed");
|
1992-09-24 07:37:39 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
1992-09-23 11:53:00 -03:00
|
|
|
|
1992-12-14 09:17:29 -04:00
|
|
|
return data;
|
1992-09-23 11:53:00 -03:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
doParams(clobject *self, PyObject *args, int (*func)(CL_Handle, int *, int),
|
1993-02-16 07:55:17 -04:00
|
|
|
int modified)
|
1992-09-23 11:53:00 -03:00
|
|
|
{
|
1997-01-17 12:00:02 -04:00
|
|
|
PyObject *list, *v;
|
1993-02-04 12:43:28 -04:00
|
|
|
int *PVbuffer;
|
|
|
|
int length;
|
1992-09-23 11:53:00 -03:00
|
|
|
int i;
|
1993-02-04 12:43:28 -04:00
|
|
|
float number;
|
1992-09-23 11:53:00 -03:00
|
|
|
|
1992-09-25 07:28:20 -03:00
|
|
|
CheckCompressor(self);
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_Parse(args, "O", &list))
|
1992-09-23 11:53:00 -03:00
|
|
|
return NULL;
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyList_Check(list)) {
|
|
|
|
PyErr_BadArgument();
|
1992-09-23 11:53:00 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-01-17 12:00:02 -04:00
|
|
|
length = PyList_Size(list);
|
|
|
|
PVbuffer = PyMem_NEW(int, length);
|
1992-09-23 11:53:00 -03:00
|
|
|
if (PVbuffer == NULL)
|
1997-01-17 12:00:02 -04:00
|
|
|
return PyErr_NoMemory();
|
1992-09-23 11:53:00 -03:00
|
|
|
for (i = 0; i < length; i++) {
|
1997-01-17 12:00:02 -04:00
|
|
|
v = PyList_GetItem(list, i);
|
|
|
|
if (PyFloat_Check(v)) {
|
|
|
|
number = PyFloat_AsDouble(v);
|
1993-02-04 12:43:28 -04:00
|
|
|
PVbuffer[i] = CL_TypeIsInt(number);
|
1997-01-17 12:00:02 -04:00
|
|
|
} else if (PyInt_Check(v)) {
|
|
|
|
PVbuffer[i] = PyInt_AsLong(v);
|
1993-02-16 07:55:17 -04:00
|
|
|
if ((i & 1) &&
|
|
|
|
param_type_is_float(self, PVbuffer[i-1]) > 0) {
|
|
|
|
number = PVbuffer[i];
|
|
|
|
PVbuffer[i] = CL_TypeIsInt(number);
|
|
|
|
}
|
|
|
|
} else {
|
1997-01-17 12:00:02 -04:00
|
|
|
PyMem_DEL(PVbuffer);
|
|
|
|
PyErr_BadArgument();
|
1992-09-23 11:53:00 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1992-09-24 07:37:39 -03:00
|
|
|
error_handler_called = 0;
|
1992-09-23 11:53:00 -03:00
|
|
|
(*func)(self->ob_compressorHdl, PVbuffer, length);
|
1993-08-03 12:11:36 -03:00
|
|
|
if (error_handler_called) {
|
1997-01-17 12:00:02 -04:00
|
|
|
PyMem_DEL(PVbuffer);
|
1992-09-24 07:37:39 -03:00
|
|
|
return NULL;
|
1993-08-03 12:11:36 -03:00
|
|
|
}
|
1992-09-23 11:53:00 -03:00
|
|
|
|
|
|
|
if (modified) {
|
1992-12-14 09:17:29 -04:00
|
|
|
for (i = 0; i < length; i++) {
|
1993-02-04 12:43:28 -04:00
|
|
|
if ((i & 1) &&
|
1993-02-16 07:55:17 -04:00
|
|
|
param_type_is_float(self, PVbuffer[i-1]) > 0) {
|
1993-02-04 12:43:28 -04:00
|
|
|
number = CL_TypeIsFloat(PVbuffer[i]);
|
1997-01-17 12:00:02 -04:00
|
|
|
v = PyFloat_FromDouble(number);
|
1993-02-04 12:43:28 -04:00
|
|
|
} else
|
1997-01-17 12:00:02 -04:00
|
|
|
v = PyInt_FromLong(PVbuffer[i]);
|
|
|
|
PyList_SetItem(list, i, v);
|
1992-12-14 09:17:29 -04:00
|
|
|
}
|
1992-09-23 11:53:00 -03:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
PyMem_DEL(PVbuffer);
|
1992-09-23 11:53:00 -03:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1992-09-23 11:53:00 -03:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
clm_GetParams(PyObject *self, PyObject *args)
|
1992-09-23 11:53:00 -03:00
|
|
|
{
|
1993-02-16 07:55:17 -04:00
|
|
|
return doParams(SELF, args, clGetParams, 1);
|
1992-09-23 11:53:00 -03:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
clm_SetParams(PyObject *self, PyObject *args)
|
1992-09-23 11:53:00 -03:00
|
|
|
{
|
1993-02-16 07:55:17 -04:00
|
|
|
return doParams(SELF, args, clSetParams, 0);
|
1993-02-04 12:43:28 -04:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
do_get(clobject *self, PyObject *args, int (*func)(CL_Handle, int))
|
1993-02-04 12:43:28 -04:00
|
|
|
{
|
|
|
|
int paramID, value;
|
|
|
|
float fvalue;
|
|
|
|
|
|
|
|
CheckCompressor(self);
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_Parse(args, "i", ¶mID))
|
1993-02-04 12:43:28 -04:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
error_handler_called = 0;
|
|
|
|
value = (*func)(self->ob_compressorHdl, paramID);
|
|
|
|
if (error_handler_called)
|
|
|
|
return NULL;
|
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
if (param_type_is_float(self, paramID) > 0) {
|
1993-02-04 12:43:28 -04:00
|
|
|
fvalue = CL_TypeIsFloat(value);
|
1997-01-17 12:00:02 -04:00
|
|
|
return PyFloat_FromDouble(fvalue);
|
1993-02-04 12:43:28 -04:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
return PyInt_FromLong(value);
|
1993-02-04 12:43:28 -04:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
clm_GetParam(PyObject *self, PyObject *args)
|
1993-02-04 12:43:28 -04:00
|
|
|
{
|
1993-02-16 07:55:17 -04:00
|
|
|
return do_get(SELF, args, clGetParam);
|
1993-02-04 12:43:28 -04:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
clm_GetDefault(PyObject *self, PyObject *args)
|
1993-02-04 12:43:28 -04:00
|
|
|
{
|
1993-02-16 07:55:17 -04:00
|
|
|
return do_get(SELF, args, clGetDefault);
|
1993-02-04 12:43:28 -04:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
clm_SetParam(PyObject *self, PyObject *args)
|
1993-02-04 12:43:28 -04:00
|
|
|
{
|
|
|
|
int paramID, value;
|
|
|
|
float fvalue;
|
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
CheckCompressor(SELF);
|
1993-02-04 12:43:28 -04:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_Parse(args, "(ii)", ¶mID, &value)) {
|
|
|
|
PyErr_Clear();
|
|
|
|
if (!PyArg_Parse(args, "(if)", ¶mID, &fvalue)) {
|
|
|
|
PyErr_Clear();
|
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
"bad argument list (format '(ii)' or '(if)')");
|
1993-02-04 12:43:28 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
value = CL_TypeIsInt(fvalue);
|
1993-02-16 07:55:17 -04:00
|
|
|
} else {
|
|
|
|
if (param_type_is_float(SELF, paramID) > 0) {
|
|
|
|
fvalue = value;
|
|
|
|
value = CL_TypeIsInt(fvalue);
|
|
|
|
}
|
1993-02-04 12:43:28 -04:00
|
|
|
}
|
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
error_handler_called = 0;
|
|
|
|
value = clSetParam(SELF->ob_compressorHdl, paramID, value);
|
1993-02-04 12:43:28 -04:00
|
|
|
if (error_handler_called)
|
|
|
|
return NULL;
|
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
if (param_type_is_float(SELF, paramID) > 0)
|
1997-01-17 12:00:02 -04:00
|
|
|
return PyFloat_FromDouble(CL_TypeIsFloat(value));
|
1993-02-04 12:43:28 -04:00
|
|
|
else
|
1997-01-17 12:00:02 -04:00
|
|
|
return PyInt_FromLong(value);
|
1993-02-04 12:43:28 -04:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
clm_GetParamID(PyObject *self, PyObject *args)
|
1992-12-14 09:17:29 -04:00
|
|
|
{
|
|
|
|
char *name;
|
1993-02-04 12:43:28 -04:00
|
|
|
int value;
|
1992-12-14 09:17:29 -04:00
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
CheckCompressor(SELF);
|
1992-12-14 09:17:29 -04:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_Parse(args, "s", &name))
|
1992-12-14 09:17:29 -04:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
error_handler_called = 0;
|
1993-02-16 07:55:17 -04:00
|
|
|
value = clGetParamID(SELF->ob_compressorHdl, name);
|
1992-12-14 09:17:29 -04:00
|
|
|
if (value == FAILURE) {
|
|
|
|
if (!error_handler_called)
|
1997-01-17 12:00:02 -04:00
|
|
|
PyErr_SetString(ClError, "getparamid failed");
|
1992-12-14 09:17:29 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
return PyInt_FromLong(value);
|
1992-09-23 11:53:00 -03:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
clm_QueryParams(PyObject *self, PyObject *args)
|
1992-09-23 11:53:00 -03:00
|
|
|
{
|
1993-02-04 12:43:28 -04:00
|
|
|
int bufferlength;
|
|
|
|
int *PVbuffer;
|
1997-01-17 12:00:02 -04:00
|
|
|
PyObject *list;
|
1992-09-23 11:53:00 -03:00
|
|
|
int i;
|
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
CheckCompressor(SELF);
|
1992-09-25 07:28:20 -03:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_NoArgs(args))
|
1992-09-23 11:53:00 -03:00
|
|
|
return NULL;
|
|
|
|
|
1992-09-24 07:37:39 -03:00
|
|
|
error_handler_called = 0;
|
1993-02-16 07:55:17 -04:00
|
|
|
bufferlength = clQueryParams(SELF->ob_compressorHdl, 0, 0);
|
1992-09-24 07:37:39 -03:00
|
|
|
if (error_handler_called)
|
|
|
|
return NULL;
|
1992-09-23 11:53:00 -03:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
PVbuffer = PyMem_NEW(int, bufferlength);
|
1992-09-23 11:53:00 -03:00
|
|
|
if (PVbuffer == NULL)
|
1997-01-17 12:00:02 -04:00
|
|
|
return PyErr_NoMemory();
|
1992-09-23 11:53:00 -03:00
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
bufferlength = clQueryParams(SELF->ob_compressorHdl, PVbuffer,
|
1992-09-23 11:53:00 -03:00
|
|
|
bufferlength);
|
1992-09-24 07:37:39 -03:00
|
|
|
if (error_handler_called) {
|
1997-01-17 12:00:02 -04:00
|
|
|
PyMem_DEL(PVbuffer);
|
1992-09-24 07:37:39 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
1992-09-23 11:53:00 -03:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
list = PyList_New(bufferlength);
|
1992-09-23 11:53:00 -03:00
|
|
|
if (list == NULL) {
|
1997-01-17 12:00:02 -04:00
|
|
|
PyMem_DEL(PVbuffer);
|
1992-09-23 11:53:00 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1992-09-24 07:37:39 -03:00
|
|
|
for (i = 0; i < bufferlength; i++) {
|
|
|
|
if (i & 1)
|
1997-01-17 12:00:02 -04:00
|
|
|
PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i]));
|
1992-12-14 09:17:29 -04:00
|
|
|
else if (PVbuffer[i] == 0) {
|
1997-01-17 12:00:02 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
PyList_SetItem(list, i, Py_None);
|
1992-12-14 09:17:29 -04:00
|
|
|
} else
|
1997-01-17 12:00:02 -04:00
|
|
|
PyList_SetItem(list, i,
|
|
|
|
PyString_FromString((char *) PVbuffer[i]));
|
1992-09-24 07:37:39 -03:00
|
|
|
}
|
1992-09-23 11:53:00 -03:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
PyMem_DEL(PVbuffer);
|
1992-09-23 11:53:00 -03:00
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
clm_GetMinMax(PyObject *self, PyObject *args)
|
1992-12-14 09:17:29 -04:00
|
|
|
{
|
1993-02-04 12:43:28 -04:00
|
|
|
int param, min, max;
|
|
|
|
float fmin, fmax;
|
1992-12-14 09:17:29 -04:00
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
CheckCompressor(SELF);
|
1992-12-14 09:17:29 -04:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_Parse(args, "i", ¶m))
|
1992-12-14 09:17:29 -04:00
|
|
|
return NULL;
|
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
clGetMinMax(SELF->ob_compressorHdl, param, &min, &max);
|
1992-12-14 09:17:29 -04:00
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
if (param_type_is_float(SELF, param) > 0) {
|
1993-02-04 12:43:28 -04:00
|
|
|
fmin = CL_TypeIsFloat(min);
|
|
|
|
fmax = CL_TypeIsFloat(max);
|
1997-01-17 12:00:02 -04:00
|
|
|
return Py_BuildValue("(ff)", fmin, fmax);
|
1992-12-14 09:17:29 -04:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
return Py_BuildValue("(ii)", min, max);
|
1992-12-14 09:17:29 -04:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
clm_GetName(PyObject *self, PyObject *args)
|
1992-12-14 09:17:29 -04:00
|
|
|
{
|
1993-02-04 12:43:28 -04:00
|
|
|
int param;
|
1992-12-14 09:17:29 -04:00
|
|
|
char *name;
|
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
CheckCompressor(SELF);
|
1992-12-14 09:17:29 -04:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_Parse(args, "i", ¶m))
|
1992-12-14 09:17:29 -04:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
error_handler_called = 0;
|
1993-02-16 07:55:17 -04:00
|
|
|
name = clGetName(SELF->ob_compressorHdl, param);
|
1992-12-14 09:17:29 -04:00
|
|
|
if (name == NULL || error_handler_called) {
|
|
|
|
if (!error_handler_called)
|
1997-01-17 12:00:02 -04:00
|
|
|
PyErr_SetString(ClError, "getname failed");
|
1992-12-14 09:17:29 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
return PyString_FromString(name);
|
1992-12-14 09:17:29 -04:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
clm_QuerySchemeFromHandle(PyObject *self, PyObject *args)
|
1993-02-16 07:55:17 -04:00
|
|
|
{
|
|
|
|
CheckCompressor(SELF);
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_NoArgs(args))
|
1993-02-16 07:55:17 -04:00
|
|
|
return NULL;
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
return PyInt_FromLong(clQuerySchemeFromHandle(SELF->ob_compressorHdl));
|
1993-02-16 07:55:17 -04:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
clm_ReadHeader(PyObject *self, PyObject *args)
|
1992-12-14 09:17:29 -04:00
|
|
|
{
|
1993-02-04 12:43:28 -04:00
|
|
|
char *header;
|
|
|
|
int headerSize;
|
1992-12-14 09:17:29 -04:00
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
CheckCompressor(SELF);
|
1992-12-14 09:17:29 -04:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_Parse(args, "s#", &header, &headerSize))
|
1992-12-14 09:17:29 -04:00
|
|
|
return NULL;
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
return PyInt_FromLong(clReadHeader(SELF->ob_compressorHdl,
|
|
|
|
headerSize, header));
|
1992-12-14 09:17:29 -04:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyMethodDef compressor_methods[] = {
|
1992-12-14 09:17:29 -04:00
|
|
|
{"close", clm_CloseCompressor}, /* alias */
|
1992-09-29 13:43:43 -03:00
|
|
|
{"CloseCompressor", clm_CloseCompressor},
|
|
|
|
{"Compress", clm_Compress},
|
|
|
|
{"GetDefault", clm_GetDefault},
|
|
|
|
{"GetMinMax", clm_GetMinMax},
|
|
|
|
{"GetName", clm_GetName},
|
1993-02-04 12:43:28 -04:00
|
|
|
{"GetParam", clm_GetParam},
|
1992-12-14 09:17:29 -04:00
|
|
|
{"GetParamID", clm_GetParamID},
|
1992-09-29 13:43:43 -03:00
|
|
|
{"GetParams", clm_GetParams},
|
|
|
|
{"QueryParams", clm_QueryParams},
|
1993-02-16 07:55:17 -04:00
|
|
|
{"QuerySchemeFromHandle",clm_QuerySchemeFromHandle},
|
1993-02-04 12:43:28 -04:00
|
|
|
{"SetParam", clm_SetParam},
|
1992-09-29 13:43:43 -03:00
|
|
|
{"SetParams", clm_SetParams},
|
1992-09-23 11:53:00 -03:00
|
|
|
{NULL, NULL} /* sentinel */
|
|
|
|
};
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyMethodDef decompressor_methods[] = {
|
1992-12-14 09:17:29 -04:00
|
|
|
{"close", clm_CloseDecompressor}, /* alias */
|
1992-09-29 13:43:43 -03:00
|
|
|
{"CloseDecompressor", clm_CloseDecompressor},
|
|
|
|
{"Decompress", clm_Decompress},
|
|
|
|
{"GetDefault", clm_GetDefault},
|
|
|
|
{"GetMinMax", clm_GetMinMax},
|
|
|
|
{"GetName", clm_GetName},
|
1993-02-04 12:43:28 -04:00
|
|
|
{"GetParam", clm_GetParam},
|
1992-12-14 09:17:29 -04:00
|
|
|
{"GetParamID", clm_GetParamID},
|
1992-09-29 13:43:43 -03:00
|
|
|
{"GetParams", clm_GetParams},
|
1993-02-04 12:43:28 -04:00
|
|
|
{"ReadHeader", clm_ReadHeader},
|
1992-09-29 13:43:43 -03:00
|
|
|
{"QueryParams", clm_QueryParams},
|
1993-02-16 07:55:17 -04:00
|
|
|
{"QuerySchemeFromHandle",clm_QuerySchemeFromHandle},
|
1993-02-04 12:43:28 -04:00
|
|
|
{"SetParam", clm_SetParam},
|
1992-09-29 13:43:43 -03:00
|
|
|
{"SetParams", clm_SetParams},
|
1992-09-23 11:53:00 -03:00
|
|
|
{NULL, NULL} /* sentinel */
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
1997-01-17 12:00:02 -04:00
|
|
|
cl_dealloc(PyObject *self)
|
1992-09-23 11:53:00 -03:00
|
|
|
{
|
1993-02-16 07:55:17 -04:00
|
|
|
if (SELF->ob_compressorHdl) {
|
|
|
|
if (SELF->ob_isCompressor)
|
|
|
|
clCloseCompressor(SELF->ob_compressorHdl);
|
1992-09-23 11:53:00 -03:00
|
|
|
else
|
1993-02-16 07:55:17 -04:00
|
|
|
clCloseDecompressor(SELF->ob_compressorHdl);
|
1992-09-23 11:53:00 -03:00
|
|
|
}
|
1997-01-17 12:00:02 -04:00
|
|
|
PyMem_DEL(self);
|
1992-09-23 11:53:00 -03:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
cl_getattr(PyObject *self, char *name)
|
1992-09-23 11:53:00 -03:00
|
|
|
{
|
1993-02-16 07:55:17 -04:00
|
|
|
if (SELF->ob_isCompressor)
|
1997-01-17 12:00:02 -04:00
|
|
|
return Py_FindMethod(compressor_methods, self, name);
|
1992-09-23 11:53:00 -03:00
|
|
|
else
|
1997-01-17 12:00:02 -04:00
|
|
|
return Py_FindMethod(decompressor_methods, self, name);
|
1992-09-23 11:53:00 -03:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyTypeObject Cltype = {
|
|
|
|
PyObject_HEAD_INIT(&PyType_Type)
|
1992-09-23 11:53:00 -03:00
|
|
|
0, /*ob_size*/
|
|
|
|
"cl", /*tp_name*/
|
|
|
|
sizeof(clobject), /*tp_size*/
|
|
|
|
0, /*tp_itemsize*/
|
|
|
|
/* methods */
|
1994-08-01 08:34:53 -03:00
|
|
|
(destructor)cl_dealloc, /*tp_dealloc*/
|
1992-09-23 11:53:00 -03:00
|
|
|
0, /*tp_print*/
|
1994-08-01 08:34:53 -03:00
|
|
|
(getattrfunc)cl_getattr, /*tp_getattr*/
|
1992-09-23 11:53:00 -03:00
|
|
|
0, /*tp_setattr*/
|
|
|
|
0, /*tp_compare*/
|
|
|
|
0, /*tp_repr*/
|
|
|
|
0, /*tp_as_number*/
|
|
|
|
0, /*tp_as_sequence*/
|
|
|
|
0, /*tp_as_mapping*/
|
|
|
|
};
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
doOpen(PyObject *self, PyObject *args, int (*open_func)(int, CL_Handle *),
|
1993-02-16 07:55:17 -04:00
|
|
|
int iscompressor)
|
1992-09-23 11:53:00 -03:00
|
|
|
{
|
1993-02-04 12:43:28 -04:00
|
|
|
int scheme;
|
1992-09-23 11:53:00 -03:00
|
|
|
clobject *new;
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_Parse(args, "i", &scheme))
|
1992-09-23 11:53:00 -03:00
|
|
|
return NULL;
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
new = PyObject_NEW(clobject, &Cltype);
|
1992-12-14 09:17:29 -04:00
|
|
|
if (new == NULL)
|
1992-09-23 11:53:00 -03:00
|
|
|
return NULL;
|
|
|
|
|
1992-09-24 07:37:39 -03:00
|
|
|
new->ob_compressorHdl = NULL;
|
1992-12-14 09:17:29 -04:00
|
|
|
new->ob_isCompressor = iscompressor;
|
1993-02-16 07:55:17 -04:00
|
|
|
new->ob_paramtypes = NULL;
|
1992-09-24 07:37:39 -03:00
|
|
|
|
|
|
|
error_handler_called = 0;
|
1992-12-14 09:17:29 -04:00
|
|
|
if ((*open_func)(scheme, &new->ob_compressorHdl) == FAILURE) {
|
1997-01-17 12:00:02 -04:00
|
|
|
Py_DECREF(new);
|
1992-09-24 07:37:39 -03:00
|
|
|
if (!error_handler_called)
|
1997-01-17 12:00:02 -04:00
|
|
|
PyErr_SetString(ClError, "Open(De)Compressor failed");
|
1992-09-24 07:37:39 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-01-17 12:00:02 -04:00
|
|
|
return (PyObject *)new;
|
1992-09-23 11:53:00 -03:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
cl_OpenCompressor(PyObject *self, PyObject *args)
|
1992-09-23 11:53:00 -03:00
|
|
|
{
|
1992-12-14 09:17:29 -04:00
|
|
|
return doOpen(self, args, clOpenCompressor, 1);
|
1992-09-23 11:53:00 -03:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
cl_OpenDecompressor(PyObject *self, PyObject *args)
|
1992-09-29 13:43:43 -03:00
|
|
|
{
|
1992-12-14 09:17:29 -04:00
|
|
|
return doOpen(self, args, clOpenDecompressor, 0);
|
1992-09-29 13:43:43 -03:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
cl_QueryScheme(PyObject *self, PyObject *args)
|
1993-02-04 12:43:28 -04:00
|
|
|
{
|
|
|
|
char *header;
|
|
|
|
int headerlen;
|
|
|
|
int scheme;
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_Parse(args, "s#", &header, &headerlen))
|
1993-02-04 12:43:28 -04:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
scheme = clQueryScheme(header);
|
|
|
|
if (scheme < 0) {
|
1997-01-17 12:00:02 -04:00
|
|
|
PyErr_SetString(ClError, "unknown compression scheme");
|
1993-02-04 12:43:28 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
return PyInt_FromLong(scheme);
|
1993-02-04 12:43:28 -04:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
cl_QueryMaxHeaderSize(PyObject *self, PyObject *args)
|
1993-02-04 12:43:28 -04:00
|
|
|
{
|
|
|
|
int scheme;
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_Parse(args, "i", &scheme))
|
1993-02-04 12:43:28 -04:00
|
|
|
return NULL;
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
return PyInt_FromLong(clQueryMaxHeaderSize(scheme));
|
1993-02-04 12:43:28 -04:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
cl_QueryAlgorithms(PyObject *self, PyObject *args)
|
1993-02-04 12:43:28 -04:00
|
|
|
{
|
|
|
|
int algorithmMediaType;
|
|
|
|
int bufferlength;
|
|
|
|
int *PVbuffer;
|
1997-01-17 12:00:02 -04:00
|
|
|
PyObject *list;
|
1993-02-04 12:43:28 -04:00
|
|
|
int i;
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_Parse(args, "i", &algorithmMediaType))
|
1993-02-04 12:43:28 -04:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
error_handler_called = 0;
|
|
|
|
bufferlength = clQueryAlgorithms(algorithmMediaType, 0, 0);
|
|
|
|
if (error_handler_called)
|
|
|
|
return NULL;
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
PVbuffer = PyMem_NEW(int, bufferlength);
|
1993-02-04 12:43:28 -04:00
|
|
|
if (PVbuffer == NULL)
|
1997-01-17 12:00:02 -04:00
|
|
|
return PyErr_NoMemory();
|
1993-02-04 12:43:28 -04:00
|
|
|
|
|
|
|
bufferlength = clQueryAlgorithms(algorithmMediaType, PVbuffer,
|
1997-01-17 12:00:02 -04:00
|
|
|
bufferlength);
|
1993-02-04 12:43:28 -04:00
|
|
|
if (error_handler_called) {
|
1997-01-17 12:00:02 -04:00
|
|
|
PyMem_DEL(PVbuffer);
|
1993-02-04 12:43:28 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
list = PyList_New(bufferlength);
|
1993-02-04 12:43:28 -04:00
|
|
|
if (list == NULL) {
|
1997-01-17 12:00:02 -04:00
|
|
|
PyMem_DEL(PVbuffer);
|
1993-02-04 12:43:28 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < bufferlength; i++) {
|
|
|
|
if (i & 1)
|
1997-01-17 12:00:02 -04:00
|
|
|
PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i]));
|
1993-02-04 12:43:28 -04:00
|
|
|
else if (PVbuffer[i] == 0) {
|
1997-01-17 12:00:02 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
PyList_SetItem(list, i, Py_None);
|
1993-02-04 12:43:28 -04:00
|
|
|
} else
|
1997-01-17 12:00:02 -04:00
|
|
|
PyList_SetItem(list, i,
|
|
|
|
PyString_FromString((char *) PVbuffer[i]));
|
1993-02-04 12:43:28 -04:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
PyMem_DEL(PVbuffer);
|
1993-02-04 12:43:28 -04:00
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
cl_QuerySchemeFromName(PyObject *self, PyObject *args)
|
1993-02-04 12:43:28 -04:00
|
|
|
{
|
|
|
|
int algorithmMediaType;
|
|
|
|
char *name;
|
|
|
|
int scheme;
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_Parse(args, "(is)", &algorithmMediaType, &name))
|
1993-02-04 12:43:28 -04:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
error_handler_called = 0;
|
|
|
|
scheme = clQuerySchemeFromName(algorithmMediaType, name);
|
|
|
|
if (error_handler_called) {
|
1997-01-17 12:00:02 -04:00
|
|
|
PyErr_SetString(ClError, "unknown compression scheme");
|
1993-02-04 12:43:28 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
return PyInt_FromLong(scheme);
|
1993-02-04 12:43:28 -04:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
cl_GetAlgorithmName(PyObject *self, PyObject *args)
|
1993-02-04 12:43:28 -04:00
|
|
|
{
|
|
|
|
int scheme;
|
|
|
|
char *name;
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_Parse(args, "i", &scheme))
|
1993-02-04 12:43:28 -04:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
name = clGetAlgorithmName(scheme);
|
|
|
|
if (name == 0) {
|
1997-01-17 12:00:02 -04:00
|
|
|
PyErr_SetString(ClError, "unknown compression scheme");
|
1993-02-04 12:43:28 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
return PyString_FromString(name);
|
1993-02-04 12:43:28 -04:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
do_set(PyObject *self, PyObject *args, int (*func)(int, int, int))
|
1993-02-17 05:11:14 -04:00
|
|
|
{
|
|
|
|
int scheme, paramID, value;
|
|
|
|
float fvalue;
|
|
|
|
int is_float = 0;
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (!PyArg_Parse(args, "(iii)", &scheme, ¶mID, &value)) {
|
|
|
|
PyErr_Clear();
|
|
|
|
if (!PyArg_Parse(args, "(iif)", &scheme, ¶mID, &fvalue)) {
|
|
|
|
PyErr_Clear();
|
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
"bad argument list (format '(iii)' or '(iif)')");
|
1993-02-17 05:11:14 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
value = CL_TypeIsInt(fvalue);
|
|
|
|
is_float = 1;
|
|
|
|
} else {
|
|
|
|
/* check some parameters which we know to be floats */
|
|
|
|
switch (scheme) {
|
|
|
|
case CL_COMPRESSION_RATIO:
|
|
|
|
case CL_SPEED:
|
|
|
|
fvalue = value;
|
|
|
|
value = CL_TypeIsInt(fvalue);
|
|
|
|
is_float = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
error_handler_called = 0;
|
|
|
|
value = (*func)(scheme, paramID, value);
|
|
|
|
if (error_handler_called)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (is_float)
|
1997-01-17 12:00:02 -04:00
|
|
|
return PyFloat_FromDouble(CL_TypeIsFloat(value));
|
1993-02-17 05:11:14 -04:00
|
|
|
else
|
1997-01-17 12:00:02 -04:00
|
|
|
return PyInt_FromLong(value);
|
1993-02-17 05:11:14 -04:00
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
cl_SetDefault(PyObject *self, PyObject *args)
|
1993-02-17 05:11:14 -04:00
|
|
|
{
|
|
|
|
return do_set(self, args, clSetDefault);
|
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
cl_SetMin(PyObject *self, PyObject *args)
|
1993-02-17 05:11:14 -04:00
|
|
|
{
|
|
|
|
return do_set(self, args, clSetMin);
|
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
cl_SetMax(PyObject *self, PyObject *args)
|
1993-02-17 05:11:14 -04:00
|
|
|
{
|
|
|
|
return do_set(self, args, clSetMax);
|
|
|
|
}
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
#define func(name, handler) \
|
|
|
|
static PyObject *cl_##name(PyObject *self, PyObject *args) \
|
|
|
|
{ \
|
|
|
|
int x; \
|
|
|
|
if (!PyArg_Parse(args, "i", &x)) return NULL; \
|
|
|
|
return Py##handler(CL_##name(x)); \
|
|
|
|
}
|
1995-05-17 08:16:52 -03:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
#define func2(name, handler) \
|
|
|
|
static PyObject *cl_##name(PyObject *self, PyObject *args) \
|
|
|
|
{ \
|
|
|
|
int a1, a2; \
|
|
|
|
if (!PyArg_Parse(args, "(ii)", &a1, &a2)) return NULL; \
|
|
|
|
return Py##handler(CL_##name(a1, a2)); \
|
|
|
|
}
|
1995-05-17 08:16:52 -03:00
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
func(BytesPerSample, Int_FromLong)
|
|
|
|
func(BytesPerPixel, Int_FromLong)
|
|
|
|
func(AudioFormatName, String_FromString)
|
|
|
|
func(VideoFormatName, String_FromString)
|
|
|
|
func(AlgorithmNumber, Int_FromLong)
|
|
|
|
func(AlgorithmType, Int_FromLong)
|
|
|
|
func2(Algorithm, Int_FromLong)
|
|
|
|
func(ParamNumber, Int_FromLong)
|
|
|
|
func(ParamType, Int_FromLong)
|
|
|
|
func2(ParamID, Int_FromLong)
|
1995-05-17 08:16:52 -03:00
|
|
|
|
1993-02-16 07:55:17 -04:00
|
|
|
#ifdef CLDEBUG
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyObject *
|
|
|
|
cvt_type(PyObject *self, PyObject *args)
|
1993-02-16 07:55:17 -04:00
|
|
|
{
|
|
|
|
int number;
|
|
|
|
float fnumber;
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (PyArg_Parse(args, "i", &number))
|
|
|
|
return PyFloat_FromDouble(CL_TypeIsFloat(number));
|
1993-02-16 07:55:17 -04:00
|
|
|
else {
|
1997-01-17 12:00:02 -04:00
|
|
|
PyErr_Clear();
|
|
|
|
if (PyArg_Parse(args, "f", &fnumber))
|
|
|
|
return PyInt_FromLong(CL_TypeIsInt(fnumber));
|
1993-02-16 07:55:17 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
static PyMethodDef cl_methods[] = {
|
1992-12-14 09:17:29 -04:00
|
|
|
{"CompressImage", cl_CompressImage},
|
|
|
|
{"DecompressImage", cl_DecompressImage},
|
1993-02-04 12:43:28 -04:00
|
|
|
{"GetAlgorithmName", cl_GetAlgorithmName},
|
1992-09-23 11:53:00 -03:00
|
|
|
{"OpenCompressor", cl_OpenCompressor},
|
|
|
|
{"OpenDecompressor", cl_OpenDecompressor},
|
1993-02-04 12:43:28 -04:00
|
|
|
{"QueryAlgorithms", cl_QueryAlgorithms},
|
|
|
|
{"QueryMaxHeaderSize", cl_QueryMaxHeaderSize},
|
|
|
|
{"QueryScheme", cl_QueryScheme},
|
|
|
|
{"QuerySchemeFromName", cl_QuerySchemeFromName},
|
1993-02-17 05:11:14 -04:00
|
|
|
{"SetDefault", cl_SetDefault},
|
|
|
|
{"SetMax", cl_SetMax},
|
|
|
|
{"SetMin", cl_SetMin},
|
1995-05-17 08:16:52 -03:00
|
|
|
{"BytesPerSample", cl_BytesPerSample},
|
|
|
|
{"BytesPerPixel", cl_BytesPerPixel},
|
|
|
|
{"AudioFormatName", cl_AudioFormatName},
|
|
|
|
{"VideoFormatName", cl_VideoFormatName},
|
|
|
|
{"AlgorithmNumber", cl_AlgorithmNumber},
|
|
|
|
{"AlgorithmType", cl_AlgorithmType},
|
|
|
|
{"Algorithm", cl_Algorithm},
|
|
|
|
{"ParamNumber", cl_ParamNumber},
|
|
|
|
{"ParamType", cl_ParamType},
|
|
|
|
{"ParamID", cl_ParamID},
|
1993-02-16 07:55:17 -04:00
|
|
|
#ifdef CLDEBUG
|
|
|
|
{"cvt_type", cvt_type},
|
|
|
|
#endif
|
1992-09-23 11:53:00 -03:00
|
|
|
{NULL, NULL} /* Sentinel */
|
|
|
|
};
|
|
|
|
|
1995-05-17 08:16:52 -03:00
|
|
|
#ifdef CL_JPEG_SOFTWARE
|
|
|
|
#define IRIX_5_3_LIBRARY
|
|
|
|
#endif
|
|
|
|
|
1992-09-23 11:53:00 -03:00
|
|
|
void
|
|
|
|
initcl()
|
|
|
|
{
|
1997-01-17 12:00:02 -04:00
|
|
|
PyObject *m, *d;
|
|
|
|
|
|
|
|
m = Py_InitModule("cl", cl_methods);
|
|
|
|
d = PyModule_GetDict(m);
|
|
|
|
|
|
|
|
ClError = PyString_FromString("cl.error");
|
|
|
|
(void) PyDict_SetItemString(d, "error", ClError);
|
|
|
|
|
|
|
|
(void) PyDict_SetItemString(d, "MAX_NUMBER_OF_ORIGINAL_FORMATS",
|
|
|
|
PyInt_FromLong(CL_MAX_NUMBER_OF_ORIGINAL_FORMATS));
|
|
|
|
(void) PyDict_SetItemString(d, "MONO", PyInt_FromLong(CL_MONO));
|
|
|
|
(void) PyDict_SetItemString(d, "STEREO_INTERLEAVED",
|
|
|
|
PyInt_FromLong(CL_STEREO_INTERLEAVED));
|
|
|
|
(void) PyDict_SetItemString(d, "RGB", PyInt_FromLong(CL_RGB));
|
|
|
|
(void) PyDict_SetItemString(d, "RGBX", PyInt_FromLong(CL_RGBX));
|
|
|
|
(void) PyDict_SetItemString(d, "RGBA", PyInt_FromLong(CL_RGBA));
|
|
|
|
(void) PyDict_SetItemString(d, "RGB332", PyInt_FromLong(CL_RGB332));
|
|
|
|
(void) PyDict_SetItemString(d, "GRAYSCALE",
|
|
|
|
PyInt_FromLong(CL_GRAYSCALE));
|
|
|
|
(void) PyDict_SetItemString(d, "Y", PyInt_FromLong(CL_Y));
|
|
|
|
(void) PyDict_SetItemString(d, "YUV", PyInt_FromLong(CL_YUV));
|
|
|
|
(void) PyDict_SetItemString(d, "YCbCr", PyInt_FromLong(CL_YCbCr));
|
|
|
|
(void) PyDict_SetItemString(d, "YUV422", PyInt_FromLong(CL_YUV422));
|
|
|
|
(void) PyDict_SetItemString(d, "YCbCr422",
|
|
|
|
PyInt_FromLong(CL_YCbCr422));
|
|
|
|
(void) PyDict_SetItemString(d, "YUV422HC",
|
|
|
|
PyInt_FromLong(CL_YUV422HC));
|
|
|
|
(void) PyDict_SetItemString(d, "YCbCr422HC",
|
|
|
|
PyInt_FromLong(CL_YCbCr422HC));
|
|
|
|
(void) PyDict_SetItemString(d, "YUV422DC",
|
|
|
|
PyInt_FromLong(CL_YUV422DC));
|
|
|
|
(void) PyDict_SetItemString(d, "YCbCr422DC",
|
|
|
|
PyInt_FromLong(CL_YCbCr422DC));
|
|
|
|
(void) PyDict_SetItemString(d, "RGB8", PyInt_FromLong(CL_RGB8));
|
|
|
|
(void) PyDict_SetItemString(d, "BEST_FIT",
|
|
|
|
PyInt_FromLong(CL_BEST_FIT));
|
|
|
|
(void) PyDict_SetItemString(d, "MAX_NUMBER_OF_AUDIO_ALGORITHMS",
|
|
|
|
PyInt_FromLong(CL_MAX_NUMBER_OF_AUDIO_ALGORITHMS));
|
|
|
|
(void) PyDict_SetItemString(d, "MAX_NUMBER_OF_VIDEO_ALGORITHMS",
|
|
|
|
PyInt_FromLong(CL_MAX_NUMBER_OF_VIDEO_ALGORITHMS));
|
|
|
|
(void) PyDict_SetItemString(d, "AUDIO", PyInt_FromLong(CL_AUDIO));
|
|
|
|
(void) PyDict_SetItemString(d, "VIDEO", PyInt_FromLong(CL_VIDEO));
|
|
|
|
(void) PyDict_SetItemString(d, "UNKNOWN_SCHEME",
|
|
|
|
PyInt_FromLong(CL_UNKNOWN_SCHEME));
|
|
|
|
(void) PyDict_SetItemString(d, "UNCOMPRESSED_AUDIO",
|
|
|
|
PyInt_FromLong(CL_UNCOMPRESSED_AUDIO));
|
|
|
|
(void) PyDict_SetItemString(d, "G711_ULAW",
|
|
|
|
PyInt_FromLong(CL_G711_ULAW));
|
|
|
|
(void) PyDict_SetItemString(d, "ULAW", PyInt_FromLong(CL_ULAW));
|
|
|
|
(void) PyDict_SetItemString(d, "G711_ALAW",
|
|
|
|
PyInt_FromLong(CL_G711_ALAW));
|
|
|
|
(void) PyDict_SetItemString(d, "ALAW", PyInt_FromLong(CL_ALAW));
|
|
|
|
(void) PyDict_SetItemString(d, "AWARE_MPEG_AUDIO",
|
|
|
|
PyInt_FromLong(CL_AWARE_MPEG_AUDIO));
|
|
|
|
(void) PyDict_SetItemString(d, "AWARE_MULTIRATE",
|
|
|
|
PyInt_FromLong(CL_AWARE_MULTIRATE));
|
|
|
|
(void) PyDict_SetItemString(d, "UNCOMPRESSED",
|
|
|
|
PyInt_FromLong(CL_UNCOMPRESSED));
|
|
|
|
(void) PyDict_SetItemString(d, "UNCOMPRESSED_VIDEO",
|
|
|
|
PyInt_FromLong(CL_UNCOMPRESSED_VIDEO));
|
|
|
|
(void) PyDict_SetItemString(d, "RLE", PyInt_FromLong(CL_RLE));
|
|
|
|
(void) PyDict_SetItemString(d, "JPEG", PyInt_FromLong(CL_JPEG));
|
1995-05-17 08:16:52 -03:00
|
|
|
#ifdef IRIX_5_3_LIBRARY
|
1997-01-17 12:00:02 -04:00
|
|
|
(void) PyDict_SetItemString(d, "JPEG_SOFTWARE",
|
|
|
|
PyInt_FromLong(CL_JPEG_SOFTWARE));
|
1995-05-17 08:16:52 -03:00
|
|
|
#endif
|
1997-01-17 12:00:02 -04:00
|
|
|
(void) PyDict_SetItemString(d, "MPEG_VIDEO",
|
|
|
|
PyInt_FromLong(CL_MPEG_VIDEO));
|
|
|
|
(void) PyDict_SetItemString(d, "MVC1", PyInt_FromLong(CL_MVC1));
|
|
|
|
(void) PyDict_SetItemString(d, "RTR", PyInt_FromLong(CL_RTR));
|
|
|
|
(void) PyDict_SetItemString(d, "RTR1", PyInt_FromLong(CL_RTR1));
|
|
|
|
(void) PyDict_SetItemString(d, "HDCC", PyInt_FromLong(CL_HDCC));
|
|
|
|
(void) PyDict_SetItemString(d, "MVC2", PyInt_FromLong(CL_MVC2));
|
|
|
|
(void) PyDict_SetItemString(d, "RLE24", PyInt_FromLong(CL_RLE24));
|
|
|
|
(void) PyDict_SetItemString(d, "MAX_NUMBER_OF_PARAMS",
|
|
|
|
PyInt_FromLong(CL_MAX_NUMBER_OF_PARAMS));
|
|
|
|
(void) PyDict_SetItemString(d, "IMAGE_WIDTH",
|
|
|
|
PyInt_FromLong(CL_IMAGE_WIDTH));
|
|
|
|
(void) PyDict_SetItemString(d, "IMAGE_HEIGHT",
|
|
|
|
PyInt_FromLong(CL_IMAGE_HEIGHT));
|
|
|
|
(void) PyDict_SetItemString(d, "ORIGINAL_FORMAT",
|
|
|
|
PyInt_FromLong(CL_ORIGINAL_FORMAT));
|
|
|
|
(void) PyDict_SetItemString(d, "INTERNAL_FORMAT",
|
|
|
|
PyInt_FromLong(CL_INTERNAL_FORMAT));
|
|
|
|
(void) PyDict_SetItemString(d, "COMPONENTS",
|
|
|
|
PyInt_FromLong(CL_COMPONENTS));
|
|
|
|
(void) PyDict_SetItemString(d, "BITS_PER_COMPONENT",
|
|
|
|
PyInt_FromLong(CL_BITS_PER_COMPONENT));
|
|
|
|
(void) PyDict_SetItemString(d, "FRAME_RATE",
|
|
|
|
PyInt_FromLong(CL_FRAME_RATE));
|
|
|
|
(void) PyDict_SetItemString(d, "COMPRESSION_RATIO",
|
|
|
|
PyInt_FromLong(CL_COMPRESSION_RATIO));
|
|
|
|
(void) PyDict_SetItemString(d, "EXACT_COMPRESSION_RATIO",
|
|
|
|
PyInt_FromLong(CL_EXACT_COMPRESSION_RATIO));
|
|
|
|
(void) PyDict_SetItemString(d, "FRAME_BUFFER_SIZE",
|
|
|
|
PyInt_FromLong(CL_FRAME_BUFFER_SIZE));
|
|
|
|
(void) PyDict_SetItemString(d, "COMPRESSED_BUFFER_SIZE",
|
|
|
|
PyInt_FromLong(CL_COMPRESSED_BUFFER_SIZE));
|
|
|
|
(void) PyDict_SetItemString(d, "BLOCK_SIZE",
|
|
|
|
PyInt_FromLong(CL_BLOCK_SIZE));
|
|
|
|
(void) PyDict_SetItemString(d, "PREROLL", PyInt_FromLong(CL_PREROLL));
|
|
|
|
(void) PyDict_SetItemString(d, "FRAME_TYPE",
|
|
|
|
PyInt_FromLong(CL_FRAME_TYPE));
|
|
|
|
(void) PyDict_SetItemString(d, "ALGORITHM_ID",
|
|
|
|
PyInt_FromLong(CL_ALGORITHM_ID));
|
|
|
|
(void) PyDict_SetItemString(d, "ALGORITHM_VERSION",
|
|
|
|
PyInt_FromLong(CL_ALGORITHM_VERSION));
|
|
|
|
(void) PyDict_SetItemString(d, "ORIENTATION",
|
|
|
|
PyInt_FromLong(CL_ORIENTATION));
|
|
|
|
(void) PyDict_SetItemString(d, "NUMBER_OF_FRAMES",
|
|
|
|
PyInt_FromLong(CL_NUMBER_OF_FRAMES));
|
|
|
|
(void) PyDict_SetItemString(d, "SPEED", PyInt_FromLong(CL_SPEED));
|
|
|
|
(void) PyDict_SetItemString(d, "LAST_FRAME_INDEX",
|
|
|
|
PyInt_FromLong(CL_LAST_FRAME_INDEX));
|
1995-05-17 08:16:52 -03:00
|
|
|
#ifdef IRIX_5_3_LIBRARY
|
1997-01-17 12:00:02 -04:00
|
|
|
(void) PyDict_SetItemString(d, "ENABLE_IMAGEINFO",
|
|
|
|
PyInt_FromLong(CL_ENABLE_IMAGEINFO));
|
|
|
|
(void) PyDict_SetItemString(d, "INTERNAL_IMAGE_WIDTH",
|
|
|
|
PyInt_FromLong(CL_INTERNAL_IMAGE_WIDTH));
|
|
|
|
(void) PyDict_SetItemString(d, "INTERNAL_IMAGE_HEIGHT",
|
|
|
|
PyInt_FromLong(CL_INTERNAL_IMAGE_HEIGHT));
|
1995-05-17 08:16:52 -03:00
|
|
|
#endif
|
1997-01-17 12:00:02 -04:00
|
|
|
(void) PyDict_SetItemString(d, "NUMBER_OF_PARAMS",
|
|
|
|
PyInt_FromLong(CL_NUMBER_OF_PARAMS));
|
1995-05-17 08:16:52 -03:00
|
|
|
#ifdef IRIX_5_3_LIBRARY
|
1997-01-17 12:00:02 -04:00
|
|
|
(void) PyDict_SetItemString(d, "MVC2_LUMA_THRESHOLD",
|
|
|
|
PyInt_FromLong(CL_MVC2_LUMA_THRESHOLD));
|
|
|
|
(void) PyDict_SetItemString(d, "MVC2_CHROMA_THRESHOLD",
|
|
|
|
PyInt_FromLong(CL_MVC2_CHROMA_THRESHOLD));
|
|
|
|
(void) PyDict_SetItemString(d, "MVC2_EDGE_THRESHOLD",
|
|
|
|
PyInt_FromLong(CL_MVC2_EDGE_THRESHOLD));
|
|
|
|
(void) PyDict_SetItemString(d, "MVC2_BLENDING",
|
|
|
|
PyInt_FromLong(CL_MVC2_BLENDING));
|
|
|
|
(void) PyDict_SetItemString(d, "MVC2_BLENDING_OFF",
|
|
|
|
PyInt_FromLong(CL_MVC2_BLENDING_OFF));
|
|
|
|
(void) PyDict_SetItemString(d, "MVC2_BLENDING_ON",
|
|
|
|
PyInt_FromLong(CL_MVC2_BLENDING_ON));
|
|
|
|
(void) PyDict_SetItemString(d, "JPEG_QUALITY_FACTOR",
|
|
|
|
PyInt_FromLong(CL_JPEG_QUALITY_FACTOR));
|
|
|
|
(void) PyDict_SetItemString(d, "JPEG_STREAM_HEADERS",
|
|
|
|
PyInt_FromLong(CL_JPEG_STREAM_HEADERS));
|
|
|
|
(void) PyDict_SetItemString(d, "JPEG_QUANTIZATION_TABLES",
|
|
|
|
PyInt_FromLong(CL_JPEG_QUANTIZATION_TABLES));
|
|
|
|
(void) PyDict_SetItemString(d, "JPEG_NUM_PARAMS",
|
|
|
|
PyInt_FromLong(CL_JPEG_NUM_PARAMS));
|
|
|
|
(void) PyDict_SetItemString(d, "RTR_QUALITY_LEVEL",
|
|
|
|
PyInt_FromLong(CL_RTR_QUALITY_LEVEL));
|
|
|
|
(void) PyDict_SetItemString(d, "HDCC_TILE_THRESHOLD",
|
|
|
|
PyInt_FromLong(CL_HDCC_TILE_THRESHOLD));
|
|
|
|
(void) PyDict_SetItemString(d, "HDCC_SAMPLES_PER_TILE",
|
|
|
|
PyInt_FromLong(CL_HDCC_SAMPLES_PER_TILE));
|
1995-05-17 08:16:52 -03:00
|
|
|
#endif
|
1997-01-17 12:00:02 -04:00
|
|
|
(void) PyDict_SetItemString(d, "END_OF_SEQUENCE",
|
|
|
|
PyInt_FromLong(CL_END_OF_SEQUENCE));
|
|
|
|
(void) PyDict_SetItemString(d, "CHANNEL_POLICY",
|
|
|
|
PyInt_FromLong(CL_CHANNEL_POLICY));
|
|
|
|
(void) PyDict_SetItemString(d, "NOISE_MARGIN",
|
|
|
|
PyInt_FromLong(CL_NOISE_MARGIN));
|
|
|
|
(void) PyDict_SetItemString(d, "BITRATE_POLICY",
|
|
|
|
PyInt_FromLong(CL_BITRATE_POLICY));
|
|
|
|
(void) PyDict_SetItemString(d, "BITRATE_TARGET",
|
|
|
|
PyInt_FromLong(CL_BITRATE_TARGET));
|
|
|
|
(void) PyDict_SetItemString(d, "LAYER", PyInt_FromLong(CL_LAYER));
|
|
|
|
(void) PyDict_SetItemString(d, "ENUM_VALUE",
|
|
|
|
PyInt_FromLong(CL_ENUM_VALUE));
|
|
|
|
(void) PyDict_SetItemString(d, "RANGE_VALUE",
|
|
|
|
PyInt_FromLong(CL_RANGE_VALUE));
|
|
|
|
(void) PyDict_SetItemString(d, "FLOATING_ENUM_VALUE",
|
|
|
|
PyInt_FromLong(CL_FLOATING_ENUM_VALUE));
|
|
|
|
(void) PyDict_SetItemString(d, "FLOATING_RANGE_VALUE",
|
|
|
|
PyInt_FromLong(CL_FLOATING_RANGE_VALUE));
|
|
|
|
(void) PyDict_SetItemString(d, "DECOMPRESSOR",
|
|
|
|
PyInt_FromLong(CL_DECOMPRESSOR));
|
|
|
|
(void) PyDict_SetItemString(d, "COMPRESSOR",
|
|
|
|
PyInt_FromLong(CL_COMPRESSOR));
|
|
|
|
(void) PyDict_SetItemString(d, "CODEC", PyInt_FromLong(CL_CODEC));
|
|
|
|
(void) PyDict_SetItemString(d, "NONE", PyInt_FromLong(CL_NONE));
|
1995-05-17 08:16:52 -03:00
|
|
|
#ifdef IRIX_5_3_LIBRARY
|
1997-01-17 12:00:02 -04:00
|
|
|
(void) PyDict_SetItemString(d, "BUF_FRAME",
|
|
|
|
PyInt_FromLong(CL_BUF_FRAME));
|
|
|
|
(void) PyDict_SetItemString(d, "BUF_DATA",
|
|
|
|
PyInt_FromLong(CL_BUF_DATA));
|
1995-05-17 08:16:52 -03:00
|
|
|
#endif
|
|
|
|
#ifdef CL_FRAME
|
1997-01-17 12:00:02 -04:00
|
|
|
(void) PyDict_SetItemString(d, "FRAME", PyInt_FromLong(CL_FRAME));
|
|
|
|
(void) PyDict_SetItemString(d, "DATA", PyInt_FromLong(CL_DATA));
|
1995-05-17 08:16:52 -03:00
|
|
|
#endif
|
1997-01-17 12:00:02 -04:00
|
|
|
(void) PyDict_SetItemString(d, "NONE", PyInt_FromLong(CL_NONE));
|
|
|
|
(void) PyDict_SetItemString(d, "KEYFRAME",
|
|
|
|
PyInt_FromLong(CL_KEYFRAME));
|
|
|
|
(void) PyDict_SetItemString(d, "INTRA", PyInt_FromLong(CL_INTRA));
|
|
|
|
(void) PyDict_SetItemString(d, "PREDICTED",
|
|
|
|
PyInt_FromLong(CL_PREDICTED));
|
|
|
|
(void) PyDict_SetItemString(d, "BIDIRECTIONAL",
|
|
|
|
PyInt_FromLong(CL_BIDIRECTIONAL));
|
|
|
|
(void) PyDict_SetItemString(d, "TOP_DOWN",
|
|
|
|
PyInt_FromLong(CL_TOP_DOWN));
|
|
|
|
(void) PyDict_SetItemString(d, "BOTTOM_UP",
|
|
|
|
PyInt_FromLong(CL_BOTTOM_UP));
|
1995-05-17 08:16:52 -03:00
|
|
|
#ifdef IRIX_5_3_LIBRARY
|
1997-01-17 12:00:02 -04:00
|
|
|
(void) PyDict_SetItemString(d, "CONTINUOUS_BLOCK",
|
|
|
|
PyInt_FromLong(CL_CONTINUOUS_BLOCK));
|
|
|
|
(void) PyDict_SetItemString(d, "CONTINUOUS_NONBLOCK",
|
|
|
|
PyInt_FromLong(CL_CONTINUOUS_NONBLOCK));
|
|
|
|
(void) PyDict_SetItemString(d, "EXTERNAL_DEVICE",
|
|
|
|
PyInt_FromLong((long)CL_EXTERNAL_DEVICE));
|
1995-05-17 08:16:52 -03:00
|
|
|
#endif
|
1997-01-17 12:00:02 -04:00
|
|
|
(void) PyDict_SetItemString(d, "AWCMP_STEREO",
|
|
|
|
PyInt_FromLong(AWCMP_STEREO));
|
|
|
|
(void) PyDict_SetItemString(d, "AWCMP_JOINT_STEREO",
|
|
|
|
PyInt_FromLong(AWCMP_JOINT_STEREO));
|
|
|
|
(void) PyDict_SetItemString(d, "AWCMP_INDEPENDENT",
|
|
|
|
PyInt_FromLong(AWCMP_INDEPENDENT));
|
|
|
|
(void) PyDict_SetItemString(d, "AWCMP_FIXED_RATE",
|
|
|
|
PyInt_FromLong(AWCMP_FIXED_RATE));
|
|
|
|
(void) PyDict_SetItemString(d, "AWCMP_CONST_QUAL",
|
|
|
|
PyInt_FromLong(AWCMP_CONST_QUAL));
|
|
|
|
(void) PyDict_SetItemString(d, "AWCMP_LOSSLESS",
|
|
|
|
PyInt_FromLong(AWCMP_LOSSLESS));
|
|
|
|
(void) PyDict_SetItemString(d, "AWCMP_MPEG_LAYER_I",
|
|
|
|
PyInt_FromLong(AWCMP_MPEG_LAYER_I));
|
|
|
|
(void) PyDict_SetItemString(d, "AWCMP_MPEG_LAYER_II",
|
|
|
|
PyInt_FromLong(AWCMP_MPEG_LAYER_II));
|
|
|
|
(void) PyDict_SetItemString(d, "HEADER_START_CODE",
|
|
|
|
PyInt_FromLong(CL_HEADER_START_CODE));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_NO_BUFFERSPACE",
|
|
|
|
PyInt_FromLong(CL_BAD_NO_BUFFERSPACE));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_PVBUFFER",
|
|
|
|
PyInt_FromLong(CL_BAD_PVBUFFER));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_BUFFERLENGTH_NEG",
|
|
|
|
PyInt_FromLong(CL_BAD_BUFFERLENGTH_NEG));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_BUFFERLENGTH_ODD",
|
|
|
|
PyInt_FromLong(CL_BAD_BUFFERLENGTH_ODD));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_PARAM",
|
|
|
|
PyInt_FromLong(CL_BAD_PARAM));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_COMPRESSION_SCHEME",
|
|
|
|
PyInt_FromLong(CL_BAD_COMPRESSION_SCHEME));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_COMPRESSOR_HANDLE",
|
|
|
|
PyInt_FromLong(CL_BAD_COMPRESSOR_HANDLE));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_COMPRESSOR_HANDLE_POINTER",
|
|
|
|
PyInt_FromLong(CL_BAD_COMPRESSOR_HANDLE_POINTER));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_BUFFER_HANDLE",
|
|
|
|
PyInt_FromLong(CL_BAD_BUFFER_HANDLE));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_BUFFER_QUERY_SIZE",
|
|
|
|
PyInt_FromLong(CL_BAD_BUFFER_QUERY_SIZE));
|
|
|
|
(void) PyDict_SetItemString(d, "JPEG_ERROR",
|
|
|
|
PyInt_FromLong(CL_JPEG_ERROR));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_FRAME_SIZE",
|
|
|
|
PyInt_FromLong(CL_BAD_FRAME_SIZE));
|
|
|
|
(void) PyDict_SetItemString(d, "PARAM_OUT_OF_RANGE",
|
|
|
|
PyInt_FromLong(CL_PARAM_OUT_OF_RANGE));
|
|
|
|
(void) PyDict_SetItemString(d, "ADDED_ALGORITHM_ERROR",
|
|
|
|
PyInt_FromLong(CL_ADDED_ALGORITHM_ERROR));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_ALGORITHM_TYPE",
|
|
|
|
PyInt_FromLong(CL_BAD_ALGORITHM_TYPE));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_ALGORITHM_NAME",
|
|
|
|
PyInt_FromLong(CL_BAD_ALGORITHM_NAME));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_BUFFERING",
|
|
|
|
PyInt_FromLong(CL_BAD_BUFFERING));
|
|
|
|
(void) PyDict_SetItemString(d, "BUFFER_NOT_CREATED",
|
|
|
|
PyInt_FromLong(CL_BUFFER_NOT_CREATED));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_BUFFER_EXISTS",
|
|
|
|
PyInt_FromLong(CL_BAD_BUFFER_EXISTS));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_INTERNAL_FORMAT",
|
|
|
|
PyInt_FromLong(CL_BAD_INTERNAL_FORMAT));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_BUFFER_POINTER",
|
|
|
|
PyInt_FromLong(CL_BAD_BUFFER_POINTER));
|
|
|
|
(void) PyDict_SetItemString(d, "FRAME_BUFFER_SIZE_ZERO",
|
|
|
|
PyInt_FromLong(CL_FRAME_BUFFER_SIZE_ZERO));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_STREAM_HEADER",
|
|
|
|
PyInt_FromLong(CL_BAD_STREAM_HEADER));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_LICENSE",
|
|
|
|
PyInt_FromLong(CL_BAD_LICENSE));
|
|
|
|
(void) PyDict_SetItemString(d, "AWARE_ERROR",
|
|
|
|
PyInt_FromLong(CL_AWARE_ERROR));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_BUFFER_SIZE_POINTER",
|
|
|
|
PyInt_FromLong(CL_BAD_BUFFER_SIZE_POINTER));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_BUFFER_SIZE",
|
|
|
|
PyInt_FromLong(CL_BAD_BUFFER_SIZE));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_BUFFER_TYPE",
|
|
|
|
PyInt_FromLong(CL_BAD_BUFFER_TYPE));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_HEADER_SIZE",
|
|
|
|
PyInt_FromLong(CL_BAD_HEADER_SIZE));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_FUNCTION_POINTER",
|
|
|
|
PyInt_FromLong(CL_BAD_FUNCTION_POINTER));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_SCHEME_POINTER",
|
|
|
|
PyInt_FromLong(CL_BAD_SCHEME_POINTER));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_STRING_POINTER",
|
|
|
|
PyInt_FromLong(CL_BAD_STRING_POINTER));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_MIN_GT_MAX",
|
|
|
|
PyInt_FromLong(CL_BAD_MIN_GT_MAX));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_INITIAL_VALUE",
|
|
|
|
PyInt_FromLong(CL_BAD_INITIAL_VALUE));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_PARAM_ID_POINTER",
|
|
|
|
PyInt_FromLong(CL_BAD_PARAM_ID_POINTER));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_PARAM_TYPE",
|
|
|
|
PyInt_FromLong(CL_BAD_PARAM_TYPE));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_TEXT_STRING_PTR",
|
|
|
|
PyInt_FromLong(CL_BAD_TEXT_STRING_PTR));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_FUNCTIONALITY",
|
|
|
|
PyInt_FromLong(CL_BAD_FUNCTIONALITY));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_NUMBER_OF_BLOCKS",
|
|
|
|
PyInt_FromLong(CL_BAD_NUMBER_OF_BLOCKS));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_BLOCK_SIZE",
|
|
|
|
PyInt_FromLong(CL_BAD_BLOCK_SIZE));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_POINTER",
|
|
|
|
PyInt_FromLong(CL_BAD_POINTER));
|
|
|
|
(void) PyDict_SetItemString(d, "BAD_BOARD",
|
|
|
|
PyInt_FromLong(CL_BAD_BOARD));
|
|
|
|
(void) PyDict_SetItemString(d, "MVC2_ERROR",
|
|
|
|
PyInt_FromLong(CL_MVC2_ERROR));
|
1995-05-17 08:16:52 -03:00
|
|
|
#ifdef IRIX_5_3_LIBRARY
|
1997-01-17 12:00:02 -04:00
|
|
|
(void) PyDict_SetItemString(d, "NEXT_NOT_AVAILABLE",
|
|
|
|
PyInt_FromLong(CL_NEXT_NOT_AVAILABLE));
|
|
|
|
(void) PyDict_SetItemString(d, "SCHEME_BUSY",
|
|
|
|
PyInt_FromLong(CL_SCHEME_BUSY));
|
|
|
|
(void) PyDict_SetItemString(d, "SCHEME_NOT_AVAILABLE",
|
|
|
|
PyInt_FromLong(CL_SCHEME_NOT_AVAILABLE));
|
1995-05-17 08:16:52 -03:00
|
|
|
#endif
|
|
|
|
#ifdef CL_LUMA_THRESHOLD
|
|
|
|
/* backward compatibility */
|
1997-01-17 12:00:02 -04:00
|
|
|
(void) PyDict_SetItemString(d, "LUMA_THRESHOLD",
|
|
|
|
PyInt_FromLong(CL_LUMA_THRESHOLD));
|
|
|
|
(void) PyDict_SetItemString(d, "CHROMA_THRESHOLD",
|
|
|
|
PyInt_FromLong(CL_CHROMA_THRESHOLD));
|
|
|
|
(void) PyDict_SetItemString(d, "EDGE_THRESHOLD",
|
|
|
|
PyInt_FromLong(CL_EDGE_THRESHOLD));
|
|
|
|
(void) PyDict_SetItemString(d, "BLENDING",
|
|
|
|
PyInt_FromLong(CL_BLENDING));
|
|
|
|
(void) PyDict_SetItemString(d, "QUALITY_FACTOR",
|
|
|
|
PyInt_FromLong(CL_QUALITY_FACTOR));
|
|
|
|
(void) PyDict_SetItemString(d, "STREAM_HEADERS",
|
|
|
|
PyInt_FromLong(CL_STREAM_HEADERS));
|
|
|
|
(void) PyDict_SetItemString(d, "QUALITY_LEVEL",
|
|
|
|
PyInt_FromLong(CL_QUALITY_LEVEL));
|
|
|
|
(void) PyDict_SetItemString(d, "TILE_THRESHOLD",
|
|
|
|
PyInt_FromLong(CL_TILE_THRESHOLD));
|
|
|
|
(void) PyDict_SetItemString(d, "SAMPLES_PER_TILE",
|
|
|
|
PyInt_FromLong(CL_SAMPLES_PER_TILE));
|
1995-05-17 08:16:52 -03:00
|
|
|
#endif
|
|
|
|
|
1997-01-17 12:00:02 -04:00
|
|
|
if (PyErr_Occurred())
|
|
|
|
Py_FatalError("can't initialize module cl");
|
1992-09-24 07:37:39 -03:00
|
|
|
|
|
|
|
(void) clSetErrorHandler(cl_ErrorHandler);
|
1992-09-23 11:53:00 -03:00
|
|
|
}
|