From 9b8745d5250c9d0b60c9aa5a77f58a3fcddf1076 Mon Sep 17 00:00:00 2001 From: Tom Schouten Date: Tue, 21 Jan 2003 10:27:33 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r352, which included commits to RCS files with non-trunk default branches. svn path=/trunk/externals/pdp/; revision=353 --- include/Makefile | 6 ++ include/pdp.h | 223 ++++++++++++++++++++++++++++++++++++++++++++++++ include/pdp_imageproc.h | 150 ++++++++++++++++++++++++++++++++ include/pdp_internals.h | 50 +++++++++++ include/pdp_llconv.h | 78 +++++++++++++++++ include/pdp_mmx.h | 158 ++++++++++++++++++++++++++++++++++ include/pdp_resample.h | 42 +++++++++ include/pdp_types.h | 36 ++++++++ include/pwc-ioctl.h | 123 ++++++++++++++++++++++++++ 9 files changed, 866 insertions(+) create mode 100644 include/Makefile create mode 100644 include/pdp.h create mode 100644 include/pdp_imageproc.h create mode 100644 include/pdp_internals.h create mode 100644 include/pdp_llconv.h create mode 100644 include/pdp_mmx.h create mode 100644 include/pdp_resample.h create mode 100644 include/pdp_types.h create mode 100644 include/pwc-ioctl.h (limited to 'include') diff --git a/include/Makefile b/include/Makefile new file mode 100644 index 0000000..1aba02c --- /dev/null +++ b/include/Makefile @@ -0,0 +1,6 @@ +current: + + +clean: + rm -f *~ + diff --git a/include/pdp.h b/include/pdp.h new file mode 100644 index 0000000..4cfd789 --- /dev/null +++ b/include/pdp.h @@ -0,0 +1,223 @@ +/* + * Pure Data Packet header file. + * Copyright (c) by Tom Schouten + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + + +#ifndef PDP_H +#define PDP_H + + +/* header size in bytes */ +#define PDP_HEADER_SIZE 64 + +/* subheader size in bytes */ +#define PDP_SUBHEADER_SIZE 48 + +#include +#include +#include "m_pd.h" + +#include "pdp_mmx.h" +#include "pdp_imageproc.h" +#include "pdp_types.h" + +/* hope this won't conflict with other types */ +#ifndef __cplusplus +typedef int bool; +#define true 1; +#define false 0; +#endif + +/* remark: planar processing ensures (vector assembler) code reusability + for grayscale / rgb(a) / yuv processing. so it's best + to keep away from interleaved formats: deinterleaving + and interleaving can be done in the source/sink modules + (it will probably be very hard to eliminate extra copying + anyway, and this enables the possibility to ensure alignment + and correct (i.e. multiple of 8 or 16) image dimensions) + + all image data is short int (16 bit) + +*/ + + + + +/* image data packet */ +typedef struct +{ + unsigned int encoding; /* image encoding (data format ) */ + unsigned int width; /* image width in pixels */ + unsigned int height; /* image height in pixels */ + unsigned int channels; /* number of colour planes if PDP_IMAGE_MCHP */ +} t_image; + + +/* image encodings */ +#define PDP_IMAGE_YV12 1 /* 24bbp: 16 bit Y plane followed by 16 bit 2x2 subsampled V and U planes.*/ +#define PDP_IMAGE_GREY 2 /* 16bbp: 16 bit Y plane */ +#define PDP_IMAGE_RGBP 3 /* 48bpp: 16 bit planar RGB */ +#define PDP_IMAGE_MCHP 4 /* generic 16bit multi channel planar */ + +/* +PDP_IMAGE_GREY = PDP_IMAGE_MCHP, channels = 1 +PDP_IMAGE_RGBP = PDP_IMAGE_MCHP, channels = 3 + +remark: only 1 and 2 are implemented at this moment + +*/ + + +/* generic packet subheader */ +//typedef unsigned char t_raw[PDP_SUBHEADER_SIZE]; +typedef unsigned int t_raw; + +/* general pdp header struct */ +typedef struct +{ + unsigned int type; /* datatype of this object */ + unsigned int size; /* datasize including header */ + unsigned int users; /* nb users of this object, readonly if > 1 */ + unsigned int __pad__; + union + { + t_raw raw; /* raw subheader (for extensions unkown to pdp core system) */ + t_image image; /* bitmap image */ + //t_ca ca; /* cellular automaton state data */ + } info; + +} t_pdp; + +/* pdp data packet types */ +#define PDP_IMAGE 1 /* 16bit signed planar scanline encoded image packet */ +//RESERVED: #define PDP_CA 2 /* 1bit toroidial shifted scanline encoded cellular automaton */ + + + + +/* pdp specific constants */ +#define PDP_ALIGN 8 + + +/* this needs to be able to grow dynamically, think about it later */ +#define PDP_OBJECT_ARRAY_SIZE 1024 + + +/* all symbols are C-style */ +#ifdef __cplusplus +extern "C" +{ +#endif + + //extern t_pdp* pdp_stack[]; + //extern t_symbol* pdp_sym_register_rw; + //extern t_symbol* pdp_sym_register_ro; + //extern t_symbol* pdp_sym_process; + +/* setup methods */ + +void pdp_init(void); +void pdp_destroy(void); + + +/* object manips */ + +extern int pdp_packet_new(unsigned int datatype, unsigned int datasize); /* create a new packet */ +extern t_pdp* pdp_packet_header(int handle); /* get packet header */ +extern void* pdp_packet_data(int handle); /* get packet raw data */ +extern int pdp_packet_copy_ro(int handle); /* get a read only copy */ +extern int pdp_packet_copy_rw(int handle); /* get a read/write copy */ +extern int pdp_packet_clone_rw(int handle); /* get an empty read/write packet of the same type (only copy header) */ +extern void pdp_packet_mark_unused(int handle); /* indicate that you're done with the packet */ + +/* + +If an owner unregisters a packet, he can still pass it along to clients. More +specificly this is the desired behaviour. It is a simple way to have in place +data processing (if there is only one client) and garbage collection. The first +register call revives the object. + +WARNING: it is an error to call pdp_packet_new inside a pdp packet handler BEFORE +a packet is registered. + +packet id -1 is the id of an invalid packet. it is not an error to unregister it. +packet id -2 can be used as a bogus id. it is an error to unregister it though. + +*/ + + +/* processor queue methods, callable from main pd thread */ +/* warning: only pdp_packet_header and pdp_packet_data are legal inside process routine!! */ + +/* add a method to the processing queue */ +void pdp_queue_add(void *owner, void *process, void *callback, int *queue_id); + +/* halt main tread until processing is done */ +void pdp_queue_wait(void); + +/* halt main tread until processing is done and remove + callback from queue(for destructors) */ +void pdp_queue_finish(int queue_id); + + +/* misc signals to pdp */ +void pdp_control_notify_drop(int packet); + + +/* helper methods */ + +/* send a packet to an outlet */ +void outlet_pdp(t_outlet *out, int packetid); + + +/* if packet is valid, mark it unused and send it to an outlet */ +void pdp_pass_if_valid(t_outlet *outlet, int *packet); + +/* if source packet is valid, release dest packet and move src->dest */ +void pdp_replace_if_valid(int *dpacket, int *spacket); + +/* copy_ro if dest packet if invalid, else drop source + (don't copy) + send drop notif to pdp system + returns 1 if dropped, 0 if copied */ +int pdp_packet_copy_ro_or_drop(int *dpacket, int spacket); + +/* copy_rw if dest packit is invalid, else drop source + (don't copy) + send drop notif to pdp system + returns 1 if dropped, zero if copied */ +int pdp_packet_copy_rw_or_drop(int *dpacket, int spacket); + + +/* check if packets are compatible */ +int pdp_type_compat(int packet0, int packet1); +int pdp_type_compat_image(int packet0, int packet1); + +int pdp_type_isvalid_image(int packet); + + +/* short cuts to create specific packets */ +int pdp_packet_new_image_yv12(u32 width, u32 height); +int pdp_packet_new_image_grey(u32 width, u32 height); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/pdp_imageproc.h b/include/pdp_imageproc.h new file mode 100644 index 0000000..4921612 --- /dev/null +++ b/include/pdp_imageproc.h @@ -0,0 +1,150 @@ + +/* + * Pure Data Packet. Header file for image processing routines (used in modules). + * Copyright (c) by Tom Schouten + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/* this is a c wrapper around platform specific (mmx) code */ + + +#ifndef PDP_IMAGEPROC_H +#define PDP_IMAGEPROC_H + +/* +#ifdef __cplusplus +extern "C" +{ +#endif +*/ + +/****************************** 16 bit signed (pixel) routines ***************************************/ + +#include "pdp_types.h" +//typedef unsigned long u32; +//typedef unsigned long long u64; +//typedef short s16; +//typedef long s32; + +// mix 2 images +void *pdp_imageproc_mix_new(void); +void pdp_imageproc_mix_delete(void *x); +void pdp_imageproc_mix_setleftgain(void *x, float gain); +void pdp_imageproc_mix_setrightgain(void *x, float gain); +void pdp_imageproc_mix_process(void *x, s16 *image, s16 *image2, u32 width, u32 height); + +// random mix 2 images +// note: random number generator can be platform specific +// however, it should be seeded. (same seed produces the same result) +// threshold = 0 -> left image +// threshold = 1 -> right image + +void *pdp_imageproc_randmix_new(void); +void pdp_imageproc_randmix_delete(void *x); +void pdp_imageproc_randmix_setthreshold(void *x, float threshold); +void pdp_imageproc_randmix_setseed(void *x, float seed); +void pdp_imageproc_randmix_process(void *x, s16 *image, s16 *image2, u32 width, u32 height); + + +// produce a random image +// note: random number generator can be platform specific +// however, it should be seeded. (same seed produces the same result) +void *pdp_imageproc_random_new(void); +void pdp_imageproc_random_delete(void *x); +void pdp_imageproc_random_setseed(void *x, float seed); +void pdp_imageproc_random_process(void *x, s16 *image, u32 width, u32 height); + + +// apply a gain to an image +void *pdp_imageproc_gain_new(void); +void pdp_imageproc_gain_delete(void *x); +void pdp_imageproc_gain_setgain(void *x, float gain); +void pdp_imageproc_gain_process(void *x, s16 *image, u32 width, u32 height); + + + +// add two images +void pdp_imageproc_add_process(s16 *image, s16 *image2, u32 width, u32 height); + +// mul two images +void pdp_imageproc_mul_process(s16 *image, s16 *image2, u32 width, u32 height); + + +// affine transformation (applies gain + adds offset) +void *pdp_imageproc_affine_new(void); +void pdp_imageproc_affine_delete(void *x); +void pdp_imageproc_affine_setgain(void *x, float gain); +void pdp_imageproc_affine_setoffset(void *x, float offset); +void pdp_imageproc_affine_process(void *x, s16 *image, u32 width, u32 height); + +// 3x1 or 1x3 in place convolution +// orientation +#define PDP_IMAGEPROC_CONV_HORIZONTAL 0 +#define PDP_IMAGEPROC_CONV_VERTICAL 1 +void *pdp_imageproc_conv_new(void); +void pdp_imageproc_conv_delete(void *x); +void pdp_imageproc_conv_setmin1(void *x, float val); +void pdp_imageproc_conv_setzero(void *x, float val); +void pdp_imageproc_conv_setplus1(void *x, float val); +void pdp_imageproc_conv_setbordercolor(void *x, float intensity); +void pdp_imageproc_conv_process(void *x, s16 *image, u32 width, u32 height, u32 orientation, u32 nbpasses); + + +// colour rotation for 2 colour planes +// matrix is column encoded +void *pdp_imageproc_crot2d_new(void); +void pdp_imageproc_crot2d_delete(void *x); +void pdp_imageproc_crot2d_setmatrix(void *x, float *matrix); +void pdp_imageproc_crot2d_process(void *x, s16 *image, u32 width, u32 height); + +// colour rotation for 3 colour planes +void *pdp_imageproc_crot3d_new(void); +void pdp_imageproc_crot3d_delete(void *x); +void pdp_imageproc_crot3d_setmatrix(void *x, float *matrix); +void pdp_imageproc_crot3d_process(void *x, s16 *image, u32 width, u32 height); + + + + +// biquad space + +// directions +#define PDP_IMAGEPROC_BIQUAD_TOP2BOTTOM (1<<0) +#define PDP_IMAGEPROC_BIQUAD_BOTTOM2TOP (1<<1) +#define PDP_IMAGEPROC_BIQUAD_LEFT2RIGHT (1<<2) +#define PDP_IMAGEPROC_BIQUAD_RIGHT2LEFT (1<<3) +void *pdp_imageproc_bq_new(void); +void pdp_imageproc_bq_delete(void *x); +void pdp_imageproc_bq_setcoef(void *x, float *coef); // a0,a1,a2,b0,b1,b2 +void pdp_imageproc_bq_process(void *x, s16 *image, u32 width, u32 height, u32 direction, u32 nbpasses); + + +// biquad time +void *pdp_imageproc_bqt_new(void); +void pdp_imageproc_bqt_delete(void *x); +void pdp_imageproc_bqt_setcoef(void *x, float *coef); // a0,a1,a2,b0,b1,b2 +void pdp_imageproc_bqt_process(void *x, s16 *image, s16 *state0, s16 *state1, u32 width, u32 height); + + + +/* +#ifdef __cplusplus +} +#endif +*/ + +#endif //PDP_IMAGEPROC_H diff --git a/include/pdp_internals.h b/include/pdp_internals.h new file mode 100644 index 0000000..0c580fb --- /dev/null +++ b/include/pdp_internals.h @@ -0,0 +1,50 @@ + +/* + * Pure Data Packet internal header file. + * Copyright (c) by Tom Schouten + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + +/* this file contains prototypes for "private" pdp methods */ + + +/* pdp system code is not very well organized, this is an + attempt to do better. */ + + +#ifndef PDP_INTERNALS_H +#define PDP_INTERNALS_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +//#include "pdp.h" +//#include +//#include +//#include + +void pdp_queue_use_thread(int t); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/include/pdp_llconv.h b/include/pdp_llconv.h new file mode 100644 index 0000000..7b31882 --- /dev/null +++ b/include/pdp_llconv.h @@ -0,0 +1,78 @@ +/* + * Pure Data Packet system implementation. : low level format conversion code + * Copyright (c) by Tom Schouten + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/* this file contains low level conversion code + it is a wrapper around some machine code routines padded + with some extra c code */ + +/* don't rely too much on the calling conventions here + this is mainly to tuck away "ugly" parts of the code + that come up in several places */ + + + +#include "pdp.h" + +/* all symbols are C style */ +#ifdef __cplusplus +extern "C" +{ +#endif + + + +/* raw image formats (RIF) descriptions used for low level conversion routines + format: RIF_[component names and order]_[data arganization]_[data type] + + component names: R(red), G(green), B(blue), Y(chroma), V(chroma red), U(chroma blue) + component type: [S/U][nb bits] ex: S16, U8 + data organization: [P/P[samplefrequency]] ex: P(packed) P411(planar, 2nd and 3rd 2x2 subsampled) + + +*/ + +enum RIF { + RIF_YVU__P411_U8, + RIF_YUV__P411_U8, + RIF_YVU__P411_S16, + RIF_YVU__P444_S16, + RIF_YUYV_P____U8, + RIF_RGB__P____U8, + RIF_RGBA_P____U8, + RIF_RGB__P444_S16, + RIF_GREY______S16, + RIF_GREY______U8 + +}; + +/* pdp_llconv is NOT thread safe !*/ +/* gain = 1.0 means maximal */ +/* low level convert 2 images */ +void pdp_llconv(void *src, int stype, void *dest, int dtype, int w, int h); + + + + + + + +#ifdef __cplusplus +} +#endif diff --git a/include/pdp_mmx.h b/include/pdp_mmx.h new file mode 100644 index 0000000..8e70779 --- /dev/null +++ b/include/pdp_mmx.h @@ -0,0 +1,158 @@ + +/* + * Pure Data Packet. Header file for mmx routines. + * Copyright (c) by Tom Schouten + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + +#ifndef PDP_MMX_H +#define PDP_MMX_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +/****************************** 16 bit signed (pixel) routines ***************************************/ + +/* pack: gain is 8.8 fixed point */ +void pixel_pack_s16u8_y(short int *input_pixels, + unsigned char *output_pixels, + int nb_pixels_div_8); + +void pixel_pack_s16u8_uv(short int *input_pixels, + unsigned char *output_pixels, + int nb_pixels_div_8); + + +/* unpack: gain is not used -> full scale unpack */ +void pixel_unpack_u8s16_y(unsigned char *input_pixels, + short int *output_pixels, + int nb_pixels_div_8); + +void pixel_unpack_u8s16_uv(unsigned char *input_pixels, + short int *output_pixels, + int nb_pixels_div_8); + + +/* gain */ +/* gain = integer */ +/* shift is down shift count */ +void pixel_gain_s16(short int *image, + int nb_4pixel_vectors, + short int gain[4], + unsigned long long *shift); + + +/* mix: left = gain_left * left + gain_right * right / gains are s.15 fixed point */ +void pixel_mix_s16(short int *left, + short int *right, + int nb_4pixel_vectors, + short int gain_left[4], + short int gain_right[4]); + +void pixel_randmix_s16(short int *left, + short int *right, + int nb_4pixel_vectors, + short int random_seed[4], + short int threshold[4]); + +void pixel_rand_s16(short int *image, + int nb_4pixel_vectors, + short int random_seed[4]); + +void pixel_add_s16(short int *left, + short int *right, + int nb_4pixel_vectors); + +void pixel_mul_s16(short int *left, + short int *right, + int nb_4pixel_vectors); + + +/* affine transfo */ +void pixel_affine_s16(short int *buf, + int nb_4pixel_vectors, + short int gain[4], + short int offset[4]); + +/* conv */ +void pixel_conv_hor_s16(short int *pixel_array, + int nb_4_pixel_vectors, + short int border[4], + short int mask[12]); + +void pixel_conv_ver_s16(short int *pixel_array, + int nb_4_pixel_vectors, + int row_byte_size, + short int border[4], + short int mask[12]); + +/* biquad */ + +void pixel_biquad_vertb_s16(short int *pixel_array, + int nb_4x4_pixblocks, + int linewidth, + short int coef[20], + short int state[8]); + +void pixel_biquad_verbt_s16(short int *pixel_array, + int nb_4x4_pixblocks, + int linewidth, + short int coef[20], + short int state[8]); + + +void pixel_biquad_horlr_s16(short int *pixel_array, + int nb_4x4_pixblocks, + int linewidth, + short int coef[20], + short int state[8]); + +void pixel_biquad_horrl_s16(short int *pixel_array, + int nb_4x4_pixblocks, + int linewidth, + short int coef[20], + short int state[8]); + +void pixel_biquad_time_s16(short int *pixel_array, + short int *state_array1, + short int *state_array2, + short int *coefs, + int nb_4_pix_vectors); + +/********************************** PLANAR COLOUR OPERATIONS ***************************************/ + +/* color rotation for 3 colour planes */ +void pixel_crot3d_s16(short int *pixel_array, + int nb_4pixel_vectors_per_plane, + short int *row_encoded_vector_matrix); + + +/* color rotation for 2 colour planes */ +void pixel_crot2d_s16(short int *pixel_array, + int nb_4pixel_vectors_per_plane, + short int *row_encoded_vector_matrix); + + +#ifdef __cplusplus +} +#endif + + +#endif //PDP_MMX_H diff --git a/include/pdp_resample.h b/include/pdp_resample.h new file mode 100644 index 0000000..773c12c --- /dev/null +++ b/include/pdp_resample.h @@ -0,0 +1,42 @@ +/* + * Pure Data Packet header file. - image resampling prototypes + * Copyright (c) by Tom Schouten + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef PDP_RESAMPLE_H +#define PDP_RESAMPLE_H + +#include "pdp_types.h" + + +/* image resampling methods */ +void pdp_resample_scale_bilin(s16 *src_image, s16 *dst_image, s32 src_w, s32 src_h, s32 dst_w, s32 dst_h); +void pdp_resample_scale_nn(s16 *src_image, s16 *dst_image, s32 src_w, s32 src_h, s32 dst_w, s32 dst_h); + +void pdp_resample_zoom_tiled_bilin(s16 *src_image, s16 *dst_image, s32 w, s32 h, + float zoom_x, float zoom_y, float center_x_relative, float center_y_relative); + +//void pdp_resample_zoom_tiled_nn(s16 *src_image, s16 *dst_image, s32 w, s32 h, float zoom_x, float zoom_y); + + + +/* core routines */ +s32 pdp_resample_bilin(s16 *image, s32 width, s32 height, s32 virt_x, s32 virt_y); + + +#endif diff --git a/include/pdp_types.h b/include/pdp_types.h new file mode 100644 index 0000000..32ab03f --- /dev/null +++ b/include/pdp_types.h @@ -0,0 +1,36 @@ + +/* + * Pure Data Packet header file. Scalar type definitions. + * Copyright (c) by Tom Schouten + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + +#ifndef PDP_TYPES_H +#define PDP_TYPES_H + +typedef signed char s8; +typedef signed short s16; +typedef signed long s32; +typedef signed long long s64; + +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned long u32; +typedef unsigned long long u64; + +#endif diff --git a/include/pwc-ioctl.h b/include/pwc-ioctl.h new file mode 100644 index 0000000..19b267a --- /dev/null +++ b/include/pwc-ioctl.h @@ -0,0 +1,123 @@ +#ifndef PWC_IOCTL_H +#define PWC_IOCTL_H + +/* (C) 2001 Nemosoft Unv. webcam@smcc.demon.nl + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/* + Changes + 2001/08/03 Alvarado Added ioctl constants to access methods for + changing white balance and red/blue gains + */ + +/* These are private ioctl() commands, specific for the Philips webcams. + They contain functions not found in other webcams, and settings not + specified in the Video4Linux API. + + The #define names are built up like follows: + VIDIOC VIDeo IOCtl prefix + PWC Philps WebCam + G optional: Get + S optional: Set + ... the function + */ + + + + +/* The frame rate is encoded in the video_window.flags parameter using + the upper 16 bits, since some flags are defined nowadays. The following + defines provide a mask and shift to filter out this value. + + In 'Snapshot' mode the camera freezes its automatic exposure and colour + balance controls. + */ +#define PWC_FPS_SHIFT 16 +#define PWC_FPS_MASK 0x00FF0000 +#define PWC_FPS_FRMASK 0x003F0000 +#define PWC_FPS_SNAPSHOT 0x00400000 + + +/* pwc_whitebalance.mode values */ +#define PWC_WB_INDOOR 0 +#define PWC_WB_OUTDOOR 1 +#define PWC_WB_FL 2 +#define PWC_WB_MANUAL 3 +#define PWC_WB_AUTO 4 + +/* Used with VIDIOCPWC[SG]AWB (Auto White Balance). + Set mode to one of the PWC_WB_* values above. + *red and *blue are the respective gains of these colour components inside + the camera; range 0..65535 + When mode == PWC_WB_MANUAL, manual_red and manual_blue are set or read; + otherwise undefined. + read_red and read_blue are read-only. +*/ + +struct pwc_whitebalance +{ + int mode; + int manual_red, manual_blue; /* R/W */ + int read_red, read_blue; /* R/O */ +}; + + +/* Used with VIDIOCPWC[SG]LED */ +struct pwc_leds +{ + int led_on; /* Led on-time; range = 0..255 */ + int led_off; /* */ +}; + + + + /* Restore user settings */ +#define VIDIOCPWCRUSER _IO('v', 192) + /* Save user settings */ +#define VIDIOCPWCSUSER _IO('v', 193) + /* Restore factory settings */ +#define VIDIOCPWCFACTORY _IO('v', 194) + + /* You can manipulate the compression factor. A compression preference of 0 + means use uncompressed modes when available; 1 is low compression, 2 is + medium and 3 is high compression preferred. Of course, the higher the + compression, the lower the bandwidth used but more chance of artefacts + in the image. The driver automatically chooses a higher compression when + the preferred mode is not available. + */ + /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */ +#define VIDIOCPWCSCQUAL _IOW('v', 195, int) + /* Get preferred compression quality */ +#define VIDIOCPWCGCQUAL _IOR('v', 195, int) + + /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */ +#define VIDIOCPWCSAGC _IOW('v', 200, int) + /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */ +#define VIDIOCPWCGAGC _IOR('v', 200, int) + /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */ +#define VIDIOCPWCSSHUTTER _IOW('v', 201, int) + + /* Color compensation (Auto White Balance) */ +#define VIDIOCPWCSAWB _IOW('v', 202, struct pwc_whitebalance) +#define VIDIOCPWCGAWB _IOR('v', 202, struct pwc_whitebalance) + + /* Turn LED on/off ; int range 0..65535 */ +#define VIDIOCPWCSLED _IOW('v', 205, struct pwc_leds) + /* Get state of LED; int range 0..65535 */ +#define VIDIOCPWCGLED _IOR('v', 205, struct pwc_leds) + +#endif -- cgit v1.2.1