diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2005-12-15 07:26:47 +0000 |
---|---|---|
committer | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2005-12-15 07:26:47 +0000 |
commit | 37b6643df2df7d784a31ca73f7bb90dc109c2401 (patch) | |
tree | a8664e5adcfcb60cae136063d627549ecb76619b /include | |
parent | c50ce0e0217ea07e2d450add2ab29cecea66fa96 (diff) |
removing PDP source (except debian files) before import of PDP 0.12.4
svn path=/trunk/externals/pdp/; revision=4217
Diffstat (limited to 'include')
38 files changed, 0 insertions, 3790 deletions
diff --git a/include/Makefile b/include/Makefile deleted file mode 100644 index 1aba02c..0000000 --- a/include/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -current: - - -clean: - rm -f *~ - diff --git a/include/pdp.h b/include/pdp.h deleted file mode 100644 index 243e18b..0000000 --- a/include/pdp.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Pure Data Packet header file. - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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 and subheader size in bytes */ -#define PDP_HEADER_SIZE 256 - -#include <string.h> -#include <stdlib.h> - -#include "m_pd.h" - -/* some typedefs */ -#include "pdp_types.h" - -/* the list object */ -#include "pdp_list.h" - - - -/* PDP_IMAGE COMPONENTS */ - -/* header and methods for the built in image packet type */ -#include "pdp_image.h" - -/* low level image processing and high level dispatching routines */ -#include "pdp_imageproc.h" - -/* low level image conversion routines */ -#include "pdp_llconv.h" - -/* low level image resampling routines */ -#include "pdp_resample.h" - - - -/* PDP_BITMAP COMPONENTS */ - -/* header and methods for the built in bitmap packet type */ -#include "pdp_bitmap.h" - - - -/* PDP_MATRIX COMPONENTS */ -#include "pdp_matrix.h" - - - - -/* PDP SYSTEM COMPONENTS */ - -/* packet pool stuff */ -#include "pdp_packet.h" - -/* processing queue object */ -#include "pdp_queue.h" - -/* several communication helper methods (pd specific) */ -#include "pdp_comm.h" - -/* type handling subsystem */ -#include "pdp_type.h" - -/* dpd command stuff */ -#include "pdp_dpd_command.h" - - -/* BACKWARDS COMPAT STUFF */ -#include "pdp_compat.h" - - - - -#endif - -/* - - PDP CORE API OVERVIEW - - pdp_packet_* : packet methods, first argument is packet id - - new: construct a raw packet (depreciated) - new_*: construct packet of specific type/subtype/... - mark_unused: release - mark_passing: conditional release (release on first copy ro/rw) - copy_ro: readonly (shared) copy - copy_rw: private copy - clone_rw: private copy (copies only meta data, not the content) - header: get the raw header (t_pdp *) - data: get the raw data (void *) - pass_if_valid: send a packet to pd outlet, if it is valid - replace_if_valid delete packet and replace with new one, if new is valid - copy_ro_or_drop: copy readonly, or don't copy if dest slot is full + send drop notify - copy_rw_or_drop: same, but private copy - get_description: retrieve type info - convert_ro: same as copy_ro, but with an automatic conversion matching a type template - convert_rw: same as convert_ro, but producing a private copy - - pdp_pool_* : packet pool methods - - collect_garbage: manually free all unused resources in packet pool - - pdp_queue_* : processing queue methods - - add: add a process method + callback - finish: wait until a specific task is done - wait: wait until processing queue is done - - pdp_control_* : central pdp control hub methods - - notify_drop: notify that a packet has been dropped - - pdp_type_* : packet type mediator methods - - description_match: check if two type templates match - register_conversion: register a type conversion program - - - - NOTE: it is advised to derive your module from the pdp base class defined in pdp_base.h - instead of communicating directly with the pdp core - -*/ diff --git a/include/pdp_ascii.h b/include/pdp_ascii.h deleted file mode 100644 index 1fde9b4..0000000 --- a/include/pdp_ascii.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Pure Data Packet header file. ascii packet type. - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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 - -/* ascii 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 */ -} t_ascii; - - -/* ascii encodings */ -#define PDP_ASCII_BW 1 /* 8 bit per character black and white.*/ -#define PDP_ASCII_IBM 2 /* 16 bit per character colour (8 bit character, 8 bit colour, like good old text framebuffers.*/ -#define PDP_ASCII_RGB 3 /* 64 bit per character colour (8 bit character, 3x8 bit RGB */ - -#endif diff --git a/include/pdp_base.h b/include/pdp_base.h deleted file mode 100644 index 2412e6d..0000000 --- a/include/pdp_base.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Pure Data Packet base class header file. - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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 the specification of the pdp base class. It is derived - from t_object, the basic pd object (like any other pd extern). Have a look - at pdp_add, pdp_gain and pdp_noise to see how to use this. - -*/ - -#include "pdp.h" - -#define MAX_NB_PDP_BASE_INLETS 4 -#define MAX_NB_PDP_BASE_OUTLETS 4 - - - -typedef void (*t_pdp_method)(void *); -typedef void* (*t_pdp_newmethod)(void *); - - -typedef struct -{ - t_object x_obj; - - int b_inlets; // the number of pdp inlets - int b_outlets; // the number of pdp outlets - - // registers to store incoming packets - int b_packet[MAX_NB_PDP_BASE_INLETS]; - int b_packet_next[MAX_NB_PDP_BASE_INLETS]; - t_pdp_symbol *b_type_template[MAX_NB_PDP_BASE_INLETS]; - - int b_queue_id; // task id in process queue (for callback cancelling) - //int b_dropped; // indicate if a packet was dropped during register_rw cycle - - // wil the default (left) active inlet accept pdp messages ? - int b_active_inlet_enabled; - int b_active_inlet_readonly; - - // the process callbacks - t_pdp_method b_process_method; // called in pdp thread - t_pdp_method b_preproc_method; // called before thread (for packet alloc and checking) - t_pdp_method b_postproc_method; // called after thread (for outlet stuff other than default active packet->out0) - - // packet outlets - t_outlet *b_outlet[MAX_NB_PDP_BASE_OUTLETS]; - - u32 b_channel_mask; // channel mask - - int b_thread_enabled; // thread enable switch - - t_pdp_procqueue *b_q; // queue object - -} t_pdp_base; - - - -/* setup base class. call this in your derived class setup method */ -void pdp_base_setup(t_class *c); - - -/* base class constructor/destructor. call this in your base class constructor/destructor */ -void pdp_base_init(void *x); -void pdp_base_free(void *x); - - -/* register processing callbacks */ -void pdp_base_set_process_method(void *x, t_pdp_method m); //process callback (called from pdp thread) -void pdp_base_set_preproc_method(void *x, t_pdp_method m); //pre-process callback (called before process from pd thread) -void pdp_base_set_postproc_method(void *x, t_pdp_method m); //post-process callback (called after process from pd thread) - - -/* configure inlets/outlets */ -void pdp_base_add_pdp_inlet(void *x); -t_outlet *pdp_base_add_pdp_outlet(void *x); -void pdp_base_disable_active_inlet(void *x); //use this for pdp generators -void pdp_base_readonly_active_inlet(void *x); //use this for pdp converters ("out of place" processing) -void pdp_base_add_gen_inlet(void *x, t_symbol *from, t_symbol *to); // generic inlet - - -/* bang method */ -void pdp_base_bang(void *x); - - -/* move delayed passive packets in place */ -void pdp_base_movepassive(void *x); - - - -/* packet manipulation methods - 0 active inlet (left) if enabled - >0 additional pdp inlets created with pdp_base_add_pdp_inlet */ -int pdp_base_get_packet(void *x, int inlet); // get the packet from an inlet -int pdp_base_move_packet(void *x, int inlet); // same as get, but it removes the reference in the base class -void pdp_base_set_packet(void *x, int inlet, int packet); // set (replace) the active packet (will be sent to outlet) - - -/* getters for base class data */ -u32 pdp_base_get_chanmask(void *x); -t_object *pdp_base_get_object(void *x); - - -/* thread control */ -void pdp_base_disable_thread(void *x); - -/* type control */ -void pdp_base_set_type_template(void *x, int inlet, t_pdp_symbol *type_template); - -/* queue control */ -void pdp_base_queue_wait(void *x); -void pdp_base_set_queue(void *x, t_pdp_procqueue *q); -t_pdp_procqueue *pdp_base_get_queue(void *x); diff --git a/include/pdp_bitmap.h b/include/pdp_bitmap.h deleted file mode 100644 index 3fddc25..0000000 --- a/include/pdp_bitmap.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Pure Data Packet system implementation. 8 bit image packet interface - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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 methods for the image packets - pdp_packet_new_* methods are several image packet constructors - - It also contains some pdp_type_ methods, for type checking - and conversion. - -*/ - -#ifndef PDP_BITMAP_H -#define PDP_BITMAP_H - - - -/* bitmap data packet */ -typedef struct _bitmap -{ - /* standard images */ - unsigned int encoding; /* image encoding (fourcc data format) */ - unsigned int width; /* image width in pixels */ - unsigned int height; /* image height in pixels */ - unsigned int bpp; /* bits per pixel (0 == standard) */ - -} t_bitmap; - - - -/* supported encodings (fourcc) */ - -/* special */ -#define PDP_BITMAP_RGB 0x32424752 -#define PDP_BITMAP_RGBA 0x41424752 -#define PDP_BITMAP_GREY 0x59455247 - -/* packet yuv */ -#define PDP_BITMAP_YUY2 0x32595559 -#define PDP_BITMAP_UYVY 0x59565955 - -/* planar yuv */ -#define PDP_BITMAP_I420 0x30323449 -#define PDP_BITMAP_YV12 0x32315659 - - -/* all symbols are C style */ -#ifdef __cplusplus -extern "C" -{ -#endif - - - -/* bitmap constructors*/ -int pdp_packet_new_bitmap_yv12(u32 width, u32 height); -int pdp_packet_new_bitmap_grey(u32 width, u32 height); -int pdp_packet_new_bitmap_rgb(u32 width, u32 height); -int pdp_packet_new_bitmap_rgba(u32 width, u32 height); -int pdp_packet_new_bitmap(int type, u32 width, u32 height); - -/* utility methids */ -void pdp_packet_bitmap_flip_top_bottom(int packet); - - -/* get description */ -t_pdp_symbol *pdp_packet_bitmap_get_description(int packet); - -/* get subheader */ -t_bitmap *pdp_packet_bitmap_info(int packet); - -bool pdp_packet_bitmap_isvalid(int packet); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/pdp_comm.h b/include/pdp_comm.h deleted file mode 100644 index 3b7b7f9..0000000 --- a/include/pdp_comm.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Pure Data Packet system implementation. - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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 misc communication methods */ - -#ifndef PDP_COMM_H -#define PDP_COMM_H - - -/* all symbols are C style */ -#ifdef __cplusplus -extern "C" -{ -#endif - -/* pdp symbols */ -t_symbol *pdp_sym_pdp(void); -t_symbol *pdp_sym_rro(void); -t_symbol *pdp_sym_rrw(void); -t_symbol *pdp_sym_prc(void); -t_symbol *pdp_sym_dpd(void); -t_symbol *pdp_sym_ins(void); -t_symbol *pdp_sym_acc(void); - - -/* utility methods */ - - - -/* if packet is valid, mark it unused and send it to an outlet */ -void pdp_packet_pass_if_valid(t_outlet *outlet, int *packet); - -/* if source packet is valid, release dest packet and move src->dest */ -void pdp_packet_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); -int pdp_packet_convert_ro_or_drop(int *dpacket, int spacket, t_pdp_symbol *type_template); - -/* 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); -int pdp_packet_convert_rw_or_drop(int *dpacket, int spacket, t_pdp_symbol *type_template); - - - - -#ifdef __cplusplus -} -#endif - - - -#endif diff --git a/include/pdp_compat.h b/include/pdp_compat.h deleted file mode 100644 index 2bc948f..0000000 --- a/include/pdp_compat.h +++ /dev/null @@ -1,17 +0,0 @@ - -/* - please don't use any of these. for backwards compatibility only -*/ - - -#ifndef PDP_COMPAT_H -#define PDP_COMPAT_H - - - - -void pdp_pass_if_valid(t_outlet *outlet, int *packet); -void pdp_replace_if_valid(int *dpacket, int *spacket); - - -#endif diff --git a/include/pdp_config.h b/include/pdp_config.h deleted file mode 100644 index f5f3451..0000000 --- a/include/pdp_config.h +++ /dev/null @@ -1,77 +0,0 @@ -/* include/pdp_config.h. Generated by configure. */ -/* include/pdp_config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the <inttypes.h> header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `gsl' library (-lgsl). */ -#define HAVE_LIBGSL 1 - -/* Define to 1 if you have the `gslcblas' library (-lgslcblas). */ -#define HAVE_LIBGSLCBLAS 1 - -/* Define to 1 if you have the `m' library (-lm). */ -#define HAVE_LIBM 1 - -/* Define to 1 if you have the <memory.h> header file. */ -#define HAVE_MEMORY_H 1 - -/* build pdp_glx */ -#define HAVE_PDP_GLX 1 - -/* build png support */ -#define HAVE_PDP_PNG 1 - -/* build pdp_qt */ -#define HAVE_PDP_QT 1 - -/* build pdp_sdl */ -/* #undef HAVE_PDP_SDL */ - -/* build pdp_v4l */ -#define HAVE_PDP_V4L 1 - -/* build pdp_xv */ -#define HAVE_PDP_XV 1 - -/* enable pwc v4l support */ -/* #undef HAVE_PWCV4L */ - -/* Define to 1 if you have the <stdint.h> header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the <stdlib.h> header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the <strings.h> header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the <string.h> header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the <sys/types.h> header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 diff --git a/include/pdp_config.h.in b/include/pdp_config.h.in deleted file mode 100644 index 1fd0ff6..0000000 --- a/include/pdp_config.h.in +++ /dev/null @@ -1,76 +0,0 @@ -/* include/pdp_config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the <inttypes.h> header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `gsl' library (-lgsl). */ -#undef HAVE_LIBGSL - -/* Define to 1 if you have the `gslcblas' library (-lgslcblas). */ -#undef HAVE_LIBGSLCBLAS - -/* Define to 1 if you have the `m' library (-lm). */ -#undef HAVE_LIBM - -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* build pdp_glx */ -#undef HAVE_PDP_GLX - -/* build png support */ -#undef HAVE_PDP_PNG - -/* build pdp_qt */ -#undef HAVE_PDP_QT - -/* build pdp_sdl */ -#undef HAVE_PDP_SDL - -/* build pdp_v4l */ -#undef HAVE_PDP_V4L - -/* build pdp_xv */ -#undef HAVE_PDP_XV - -/* enable pwc v4l support */ -#undef HAVE_PWCV4L - -/* Define to 1 if you have the <stdint.h> header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the <stdlib.h> header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the <strings.h> header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the <string.h> header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the <sys/types.h> header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS diff --git a/include/pdp_control.h b/include/pdp_control.h deleted file mode 100644 index 88c9eb4..0000000 --- a/include/pdp_control.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __PDP_CONTROL_H__ -#define __PDP_CONTROL_H__ - -struct _pdp_control; -typedef void (t_pdp_control_method_notify)(struct _pdp_control *x); - -void pdp_control_notify_broadcast(t_pdp_control_method_notify *notify); -void pdp_control_addmethod(t_method m, t_symbol *s); - -#endif diff --git a/include/pdp_debug.h b/include/pdp_debug.h deleted file mode 100644 index a5e48fc..0000000 --- a/include/pdp_debug.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __PDP_DEBUG_H_ -#define __PDP_DEBUG_H_ - -#include "pdp_config.h" // needed for PDP_DEBUG define - -void pdp_assert_hook (char *condition, char *file, int line); - - - -#if PDP_DEBUG -#define PDP_ASSERT(x) if (!(x)) {pdp_assert_hook(#x, __FILE__, __LINE__);} -#else -#define PDP_ASSERT(x) -#endif - -#endif //__PDP_DEBUG_H_ diff --git a/include/pdp_dpd_base.h b/include/pdp_dpd_base.h deleted file mode 100644 index 233bc63..0000000 --- a/include/pdp_dpd_base.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Pure Data Packet header file. DPD base class - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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. - * - */ - - -/* dpd base class for context based processors (for pd-fying standard stack based serial languages) - not all of pdp is used here, but the class is derived from the pdp base class to enable mixing - standard pdp (data flow packet processing) and dpd (context based serial languages) - - dpd is short for "upside down pdp". the name stems from the observation - of opengl code in pd (like in gem) having an upside down feel when looking - through dataflow eyes. i.e.: the target (window context) is on top, while - the objects (geos) are at the bottom connected by a chain of geometric transforms - - the principles of dpd are simple: - - * there is only one main packet, received on the left inlet. - * this packet is called the "context" and is produced by and returned to a top context source/sink - * additional pd messages and pdp packets can be received on the cold inlets - * as opposed to pdp, no copies are made of this context packet, all operations on it are accumulative. - * the protocol is different because fanout is prohibited (so no ro/rw registering) - * the only exception for fanout are inspectors, which have precedence over normal processors - * all processors and inspectors for a single context type must use the pdp thread, to preserve execution order - - -*/ - - - -#include "pdp.h" -#include "pdp_base.h" - -#define PDP_DPD_MAX_CONTEXT_OUTLETS 4 - -typedef struct pdp_dpd_base_struct -{ - t_pdp_base b_base; /* pdp base class */ - - int b_nb_context_outlets; - t_outlet *b_context_outlet[PDP_DPD_MAX_CONTEXT_OUTLETS]; /* dpd outlets */ - int b_outlet_enable[PDP_DPD_MAX_CONTEXT_OUTLETS]; /* dpd outlets */ - t_pdp_method b_accum_method[PDP_DPD_MAX_CONTEXT_OUTLETS]; /* accumulation methods for each outlet */ - t_pdp_method b_accum_callback[PDP_DPD_MAX_CONTEXT_OUTLETS]; /* pd callback methods for each outlet */ - //int b_accum_queue_id[PDP_DPD_MAX_CONTEXT_OUTLETS]; /* accumulator queue id's */ - - t_pdp_method b_inspector_method; /* pdp thread inspector callback */ - t_pdp_method b_inspector_callback; /* main thread inspector callback */ - //int b_inspector_queue_id; - - t_pdp_method b_cleanup_method; /* queued after propagation is done */ - t_pdp_method b_cleanup_callback; /* queued after propagation is done */ - //int b_cleanup_queue_id; - - t_pdp_method b_complete_notify; /* method called after packet output is done */ - t_pdp_newmethod b_command_factory_method; /* command factory method */ - - - int b_context_packet; /* the current context packet */ - - int b_dpd_active_inlet_disabled; - - -} t_pdp_dpd_base; - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* bang method (propagate context to outlets & register callbacks) - mainly for context source/sinks - it is not registered as a pd message by default ! */ -void pdp_dpd_base_bang(void *x); - -/* get/set the context packet */ -int pdp_dpd_base_get_context_packet(void *x); -void pdp_dpd_base_set_context_packet(void *x, int p); -int pdp_dpd_base_move_context_packet(void *x); - -/* add a context outlet and it's corresponding accumulation (process) and callback method */ -t_outlet *pdp_dpd_base_add_outlet(void *x, t_pdp_method accum_method, t_pdp_method accum_callback); - -/* add a cleanup callback (called after all propagation is finished) for sources/sinks */ -void pdp_dpd_base_add_cleanup(void *x, t_pdp_method cleanup_method, t_pdp_method accum_callback); - -/* add an inspector callback */ -void pdp_dpd_base_add_inspector(void *x, t_pdp_method inspector_method); - - -/* destructor */ -void pdp_dpd_base_free(void *x); - -/* init method */ -void pdp_dpd_base_init(void *x); - -/* disable dpd active inlet */ -void pdp_dpd_base_disable_active_inlet(void *x); - -/* enable/disable outlet */ -void pdp_dpd_base_enable_outlet(void *x, int outlet, int toggle); - -/* register notify method (called from the end of pdp_dpd_base_bang) */ -void pdp_dpd_base_register_complete_notify(void *x, t_pdp_method method); - -/* register a command init (factory) method - this method should return a command object to place in the queue */ -void pdp_dpd_base_register_command_factory_method(void *x, t_pdp_newmethod command_factory_method); - -/* class setup method */ -void pdp_dpd_base_setup(t_class *class); - -/* add a command to the process queue */ -void pdp_dpd_base_queue_command(void *x, void *c, t_pdp_method process, - t_pdp_method callback, int *id); - - -/* get/set the queue instance (thread) used for scheduling */ -#define pdp_dpd_base_set_queue pdp_base_set_queue -#define pdp_dpd_base_get_queue pdp_base_get_queue -#define pdp_dpd_base_queue_wait pdp_base_queue_wait - - - -#ifdef __cplusplus -} -#endif diff --git a/include/pdp_dpd_command.h b/include/pdp_dpd_command.h deleted file mode 100644 index d1e2824..0000000 --- a/include/pdp_dpd_command.h +++ /dev/null @@ -1,77 +0,0 @@ - -/* - * Pure Data Packet header file. DPD command class - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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 object implements a dpd command 'factory and recycling center' */ - -/* a small note on commands & dpd - - dpd uses a different synchronization model than pdp. - - in pdp, objects only pass once the process method in the process thread - has finished. - - in dpd a context packet propagates a context trough an tree of objects, - depth first, following the pd messages. it is possible to send a list of - contexts trough a tree before the actual processing starts. therefore, - each time a context passes trough an object, a new command object (or memento) - needs to be created that saves the state of the rendering context. the command - factory class can be used to create these commands. - - the dpd base class queues a command object and calls the registered method - on the object instead of the dpd object. so a command object is in fact - a delegate of the dpd object in question. - -*/ - - -#ifndef PDP_DPD_COMMAND -#define PDP_DPD_COMMAND - - -/* COMMAND BASE CLASS */ -typedef struct _pdp_dpd_command -{ - struct _pdp_dpd_command *next; - u32 used; - -} t_pdp_dpd_command; - - -/* COMMAND LIST (COMMAND FACTORY) CLASS */ -typedef struct _pdp_dpd_commandfactory -{ - u32 nb_commands; - u32 command_size; - t_pdp_dpd_command *command; -} t_pdp_dpd_commandfactory; - - -/* COMMAND LIST METHODS */ -void pdp_dpd_commandfactory_init(t_pdp_dpd_commandfactory *x, u32 size); -void pdp_dpd_commandfactory_free(t_pdp_dpd_commandfactory *x); -t_pdp_dpd_command *pdp_dpd_commandfactory_get_new_command(t_pdp_dpd_commandfactory *x); - - -/* COMMAND METHODS */ -void pdp_dpd_command_suicide(void *); - - -#endif diff --git a/include/pdp_forth.h b/include/pdp_forth.h deleted file mode 100644 index a53291f..0000000 --- a/include/pdp_forth.h +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Pure Data Packet header file. Packet processor system - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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_PROCESSOR__ -#define __PDP_PROCESSOR__ - -#include "pdp_list.h" - -/* - -*/ - - -/* - PDP Processor Model - - The model consists of two parts. - - One being the forth system to provide a lowish level description of packet operations, - with a form of polymorphy that enables the system to call the right routines or - provide automatic conversion of packet types. - - Two being the object description language. It describes processors in terms of packet - operations. In fact it is a forth process that sets up the input and output of the - processors, and organizes the local storage into registers. - -*/ - - -/* PDP FORTH (low level stack processors) */ - -/* the error codes for a processor word */ -typedef enum { - e_ok = 0, - e_type, // a recoverable type error (stack untouched) - e_garbled, // a non recoverable error (stack messed up) - e_underflow, // a stack underflow error - e_undef, // an undefined word error - e_internal // an internal error (abort) -} t_pdp_word_error; - -typedef struct _pdp_list t_pdp_stack; - -/* a pdp word operates on a stack containing atoms (floats, ints, symbols, packets) - it should return zero on success and an error value on failure. - whenever a (type) error occurs, the stack should be left untouched (this ensures the system - can try another implementation of the same word. - - the type of the first packet on the stack determines the 'type' of the processor method. - this poses a problem for generating words (i.e pdp_noise or pdp_plasma). in that case - the first word should be a symbol, indicating the type. if the first item is neither - a symbol or a packet, the first word in the word list for the respective word symbol - is called. - - words cannot be removed from the symbol table. (because compiled scripts will have - their addresses stored) however, they can be redefined, since new definitions are - appended to the start of a word list, and upon execution, the first (type) matching word - is called. - - words can be accessed in two ways: - * the central dispatching system, which chooses a word based on it's symbol and - the first item on the stack (a packet's class (or unique type description) or - a symbol describing a type) - * by calling it's code directly. this can be used to optimize (compile) scripts. - - a word may place invalid packets (-1) on the stack and must be robust at receiving - them. this is a way to silently recover from non fatal errors. - - a stack error is always fatal and should abort execution. (e_garbled) - -*/ - -typedef int (*t_pdp_forthword)(t_pdp_stack *); - - -/* a dictionary item is the definition of a word. - if a word is type oblivious, it is a high level word, which means it can operate on any type */ - - -/* a struct describing a forth word implementation */ -typedef struct _pdp_forthword_imp -{ - struct _pdp_symbol *name; // the name of this word - struct _pdp_list *def; // the word definition with symbols (word or immediate symbol), - // pointer (primitive word) or int, float and packet immediates. - struct _pdp_symbol *type; // the type template this low level word operates on (0 == high level word) -} t_pdp_forthword_imp; - -/* a struct describing a forth word specification - one specification can have multiple implementations (for type multiplexing) */ -typedef struct _pdp_forthword_spec -{ - /* name of this forth word */ - struct _pdp_symbol *name; - - /* stack effect */ - int input_size; - int output_size; - - /* index of the stack element to be used for implementation - multiplexing based on the implementation type template */ - int type_index; - - /* a list of implementations for this word */ - t_pdp_list *implementations; - -} t_pdp_forthword_spec; - - - -/* compile a string definition to a list definition */ -t_pdp_list *pdp_forth_compile_def(char *chardef); - - -/* add words to the forth dictionary - if the word is type oblivious, the type index should be -1 and the type symbol NULL */ -void pdp_forthdict_add_word(t_pdp_symbol *name, t_pdp_list *def, int input_size, int output_size, - int type_index, t_pdp_symbol *type); -void pdp_forthdict_add_primitive(t_pdp_symbol *name, t_pdp_forthword w,int input_size, int output_size, - int type_index, t_pdp_symbol *type); -void pdp_forthdict_compile_word(t_pdp_symbol *name, char *chardef, int input_size, int output_size, - int type_index, t_pdp_symbol *type); - - - -/* execute a word definition (a program) or a single symbolic word */ -t_pdp_word_error pdp_forth_execute_def(t_pdp_stack *stack, t_pdp_list *def); -t_pdp_word_error pdp_forth_execute_word(t_pdp_stack *stack, t_pdp_symbol *word); - - -/* PDP PDL (high level processor description language) */ - -/* this uses the forth words to describe a processor: defining inputs and outputs, - preparing the stack, storing intermediates, .. */ - -/* TODO */ - - -void pdp_forth_word_print_debug(t_pdp_symbol *s); - - - - - -/* STACK OPERATIONS */ - - -/* connecting the stack to the world */ -t_pdp_word_error pdp_stack_push_float(t_pdp_stack *, float f); // push thing to tos -t_pdp_word_error pdp_stack_push_int(t_pdp_stack *s, int i); -t_pdp_word_error pdp_stack_push_symbol(t_pdp_stack *s, t_pdp_symbol *x); -t_pdp_word_error pdp_stack_push_packet(t_pdp_stack *s, int p); - -t_pdp_word_error pdp_stack_pop_float(t_pdp_stack *, float *f); // pop thing from tos -t_pdp_word_error pdp_stack_pop_int(t_pdp_stack *, int *i); -t_pdp_word_error pdp_stack_pop_symbol(t_pdp_stack *, t_pdp_symbol **s); -t_pdp_word_error pdp_stack_pop_packet(t_pdp_stack *, int *p); - - -/* stack operations */ - -// DUP SWAP DROP OVER ... -t_pdp_word_error pdp_stack_dup(t_pdp_stack *s); -t_pdp_word_error pdp_stack_swap(t_pdp_stack *s); -t_pdp_word_error pdp_stack_drop(t_pdp_stack *s); -t_pdp_word_error pdp_stack_over(t_pdp_stack *s); - - -/* some util stuff */ -t_pdp_stack *pdp_stack_new(void); -void pdp_stack_free(t_pdp_stack *s); - - - -#endif diff --git a/include/pdp_image.h b/include/pdp_image.h deleted file mode 100644 index f9689d7..0000000 --- a/include/pdp_image.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Pure Data Packet system implementation. Image packet interface - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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 methods for the image packets - pdp_packet_new_* methods are several image packet constructors - - It also contains some pdp_type_ methods, for type checking - and conversion. - -*/ - -#ifndef PDP_IMAGE_H -#define PDP_IMAGE_H - - - -/* image subheader */ -typedef struct _image -{ - /* standard images */ - unsigned int encoding; /* image encoding (data format) */ - unsigned int width; /* image width in pixels */ - unsigned int height; /* image height in pixels */ - unsigned int depth; /* number of colour planes if PDP_IMAGE_MCHP */ - unsigned int chanmask; /* channel bitmask to mask out inactive channels (0 == not used) */ - - /* sliced image extensions */ /* THIS IS EXPERIMENTAL, DON'T DEPEND ON IT */ - unsigned int slice_sync; /* slice synchro information */ - unsigned int slice_yoff; /* y offset of the slice in original image */ - unsigned int orig_height; /* height of original image (this is zero for ordinary images) */ - -} 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_MCHP 4 /* generic 16bit multi channel planar (16 bit 3D tensor) */ - -/* slice synchro information */ -#define PDP_IMAGE_SLICE_FIRST (1<<0) -#define PDP_IMAGE_SLICE_LAST (1<<1) -#define PDP_IMAGE_SLICE_BODY (1<<2) - - - -/* all symbols are C style */ -#ifdef __cplusplus -extern "C" -{ -#endif - - - - -/* validate and compat check */ -bool pdp_packet_image_isvalid(int packet); -bool pdp_packet_image_compat(int packet0, int packet1); - -/* short cuts to create specific packets */ -int pdp_packet_new_image(u32 encoding, u32 width, u32 height); -int pdp_packet_new_image_YCrCb(u32 width, u32 height); -int pdp_packet_new_image_grey(u32 width, u32 height); -int pdp_packet_new_image_mchp(u32 width, u32 height, u32 depth); - -#define pdp_packet_new_image_multi pdp_packet_new_image_mchp - -/* get info */ -t_pdp_symbol *pdp_packet_image_get_description(int packet); -t_image *pdp_packet_image_info(int packet); - -/* set props */ -void pdp_packet_image_set_chanmask(int packet, unsigned int chanmask); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/pdp_imagebase.h b/include/pdp_imagebase.h deleted file mode 100644 index 563b685..0000000 --- a/include/pdp_imagebase.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Pure Data Packet image processor base class header file. - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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 the specification of the pdp base class. It is derived - from t_object, the basic pd object (like any other pd extern). Have a look - at pdp_add, pdp_gain and pdp_noise to see how to use this. - -*/ - -#include "pdp.h" -#include "pdp_base.h" - - -typedef struct -{ - t_pdp_base x_obj; - u32 b_channel_mask; // channel mask - -} t_pdp_imagebase; - - - -/* setup base class. call this in your derived class setup method */ -void pdp_imagebase_setup(t_class *c); - - -/* base class constructor/destructor. call this in your base class constructor/destructor */ -void pdp_imagebase_init(void *x); -void pdp_imagebase_free(void *x); - -/* getters for image base class data */ -u32 pdp_imagebase_get_chanmask(void *x); diff --git a/include/pdp_imageproc.h b/include/pdp_imageproc.h deleted file mode 100644 index a1b9de3..0000000 --- a/include/pdp_imageproc.h +++ /dev/null @@ -1,219 +0,0 @@ - -/* - * Pure Data Packet. Header file for image processing routines (used in modules). - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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 */ - -#include "pdp_types.h" - -#ifndef PDP_IMAGEPROC_H -#define PDP_IMAGEPROC_H - - -#ifdef __cplusplus -extern "C" -{ -#endif - - - -/* the packet types should be the same for the dispatchers. packet0 is the dominant packet */ - -/* image processing dispatchers */ -void pdp_imageproc_dispatch_1buf(void (*process_routine)(void*, u32, u32, s16*), void *x, u32 chanmask, int packet0); -void pdp_imageproc_dispatch_2buf(void (*process_routine)(void*, u32, u32, s16*, s16 *), void *x, u32 chanmask, int packet0, int packet1); -void pdp_imageproc_dispatch_3buf(void (*process_routine)(void*, u32, u32, s16*, s16 *, s16*), void *x, u32 chanmask, int packet0, int packet1, int packet2); - - - - -/* get legal image dimensions */ -/* this is a fix for the dimension problem */ -/* some imageproc implementations require the dims to be a multiple of some square */ -u32 pdp_imageproc_legalwidth(int i); -u32 pdp_imageproc_legalheight(int i); -u32 pdp_imageproc_legalwidth_round_down(int i); -u32 pdp_imageproc_legalheight_round_down(int i); - - - -/****************************** 16 bit signed (pixel) routines ***************************************/ - - -// 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, u32 width, u32 height, s16 *image, s16 *image2); - -// 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, u32 width, u32 height, s16 *image, s16 *image2); - - -// 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, u32 width, u32 height, s16 *image); - - -// produce a plasma image -// note: random number generator can be platform specific -// however, it should be seeded. (same seed produces the same result) -void *pdp_imageproc_plasma_new(void); -void pdp_imageproc_plasma_delete(void *x); -void pdp_imageproc_plasma_setseed(void *x, float seed); -void pdp_imageproc_plasma_setturbulence(void *x, float seed); -void pdp_imageproc_plasma_process(void *x, u32 width, u32 height, s16 *image); - - -// 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, u32 width, u32 height, s16 *image); - - - -// add two images -void pdp_imageproc_add_process(void *x, u32 width, u32 height, s16 *image, s16 *image2); - -// mul two images -void pdp_imageproc_mul_process(void *x, u32 width, u32 height, s16 *image, s16 *image2); - - -// 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_setorientation(void *x, u32 val); -void pdp_imageproc_conv_setnbpasses(void *x, u32 val); -void pdp_imageproc_conv_process(void *x, u32 width, u32 height, s16 *image); - - -// colour rotation for 2 colour planes ($$$TODO: change interface) -// 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 ($$$TODO: change interface) -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_setnbpasses(void *x, u32 nbpasses); -void pdp_imageproc_bq_setdirection(void *x, u32 direction); -void pdp_imageproc_bq_process(void *x, u32 width, u32 height, s16* image); - - -// 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, u32 width, u32 height, s16 *image, s16 *state0, s16 *state1); - - - -// zoom object -void *pdp_imageproc_resample_affinemap_new(void); -void pdp_imageproc_resample_affinemap_delete(void *x); -void pdp_imageproc_resample_affinemap_setcenterx(void *x, float f); -void pdp_imageproc_resample_affinemap_setcentery(void *x, float f); -void pdp_imageproc_resample_affinemap_setzoomx(void *x, float f); -void pdp_imageproc_resample_affinemap_setzoomy(void *x, float f); -void pdp_imageproc_resample_affinemap_setangle(void *x, float f); -void pdp_imageproc_resample_affinemap_process(void *x, u32 width, u32 height, s16 *srcimage, s16 *dstimage); - - - -//chebyshev poly -void *pdp_imageproc_cheby_new(int order); -void pdp_imageproc_cheby_delete(void *x); -void pdp_imageproc_cheby_setcoef(void *x, u32 n, float f); -void pdp_imageproc_cheby_setnbpasses(void *x, u32 n); -void pdp_imageproc_cheby_process(void *x, u32 width, u32 height, s16 *image); - - -//logic ops -void pdp_imageproc_xor_process(void *x, u32 width, u32 height, s16 *image, s16 *image2); -void pdp_imageproc_or_process(void *x, u32 width, u32 height, s16 *image, s16 *image2); -void pdp_imageproc_and_process(void *x, u32 width, u32 height, s16 *image, s16 *image2); -void pdp_imageproc_mask_process(void *x, u32 width, u32 height, s16 *image); -void pdp_imageproc_not_process(void *x, u32 width, u32 height, s16 *image); -void pdp_imageproc_hardthresh_process(void *x, u32 width, u32 height, s16 *image); -void pdp_imageproc_softthresh_process(void *x, u32 width, u32 height, s16 *image); - - -//other stateles operators -void pdp_imageproc_abs_process(void *x, u32 width, u32 height, s16 *image); -void pdp_imageproc_zthresh_process(void *x, u32 width, u32 height, s16 *image); -void pdp_imageproc_plasma_process(void *x, u32 width, u32 height, s16 *image); -void pdp_imageproc_ispositive_process(void *x, u32 width, u32 height, s16 *image); -void pdp_imageproc_sign_process(void *x, u32 width, u32 height, s16 *image); -void pdp_imageproc_flip_lr_process(void *dummy, u32 width, u32 height, s16 *image); -void pdp_imageproc_flip_tb_process(void *dummy, u32 width, u32 height, s16 *image); - -//set to zero -void pdp_imageproc_zero_process(void *x, u32 width, u32 height, s16 *image); -void pdp_imageproc_constant_process(void *x, u32 width, u32 height, s16 *image); - - - -#ifdef __cplusplus -} -#endif - - - -#endif //PDP_IMAGEPROC_H diff --git a/include/pdp_internals.h b/include/pdp_internals.h deleted file mode 100644 index fbd7173..0000000 --- a/include/pdp_internals.h +++ /dev/null @@ -1,79 +0,0 @@ - -/* - * Pure Data Packet internal header file. - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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. - DON'T CALL THESE FROM OUTSIDE OF PDP! unless you really - know what you are doing. - */ - - -/* 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 <pthread.h> -//#include <unistd.h> -//#include <stdio.h> - -/* set/unset main pdp thread usage */ -void pdp_queue_use_thread(int t); - -/* create a new packet, reuse if possible. - ONLY USE THIS IN A TYPE SPECIFIC CONSTRUCTOR! */ -int pdp_packet_new(unsigned int datatype, unsigned int datasize); - - -/* send a packet to an outlet: it is only legal to call this on a "passing packet" - or a "read only packet". - this means it is illegal to change a packet after you have passed it to others, - since this would mess up all read only references to the packet. -*/ - -/* this seems like a nice place to hide a comment on the notion of read/write in pdp - which packets are writable? all packets with exactly 1 user. this includes all packets - aquired with pdp_packet_*_rw or a constructor, and all packets that are not registered - after being sent out by outlet_pdp. - which packets are readable? all packets */ - -void outlet_pdp(t_outlet *out, int packetid); - -/* send an accumulation (context) packet to an outlet. this is for usage in the dpd - base class. */ -void outlet_dpd(t_outlet *out, int packetid); - - - -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/include/pdp_list.h b/include/pdp_list.h deleted file mode 100644 index ffcf871..0000000 --- a/include/pdp_list.h +++ /dev/null @@ -1,187 +0,0 @@ - -/* - * Pure Data Packet header file. List class - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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. - * - */ - -/* the pdp list is composed of atoms. - the default atom is a pointer. - lists can be recursed into trees. - - note: all functions that return t_pdp_word and don't take a type argument - obviously don't perform any type checking. if you have heterogenous lists, - you should use atom iterators or direct access. - -*/ - - - -#ifndef PDP_LIST_H -#define PDP_LIST_H - -struct _pdp_list; -struct _pdp_atom; -typedef struct _pdp_list t_pdp_list; -typedef struct _pdp_atom t_pdp_atom; - - - -/* THE LIST OBJECT */ - -typedef enum { - a_undef = 0, - a_pointer, - a_float, - a_int, - a_symbol, - a_packet, - a_list -} t_pdp_word_type; - -typedef union _pdp_word -{ - void* w_pointer; - float w_float; - int w_int; - struct _pdp_symbol* w_symbol; - int w_packet; - struct _pdp_list* w_list; - -} t_pdp_word; - -/* a list element */ -struct _pdp_atom -{ - struct _pdp_atom *next; - t_pdp_word w; - t_pdp_word_type t; -}; - -/* a list container */ -struct _pdp_list -{ - int elements; - t_pdp_atom *first; - t_pdp_atom *last; - -}; - - -/* CONVENTION: trees stacks and lists. - - * all operations with "list" in them operate on flat lists. all the - items contained in the list are either pure atoms (floats, ints, or symbols) - or references (packets, pointers, lists) - - * all operations with "tree" in them, operate on recursive lists (trees) - all sublists of the list (tree) are owned by the parent list, so you can't - build trees from references to other lists. - - * stacks are by definition flat lists, so they can not contains sublists - -*/ - -typedef void (*t_pdp_atom_method)(t_pdp_atom *); -typedef void (*t_pdp_word_method)(t_pdp_word); -typedef void (*t_pdp_pword_method)(t_pdp_word *); -typedef void (*t_pdp_free_method)(void *); - -/* creation / destruction */ -t_pdp_list* pdp_list_new (int elements); -void pdp_list_free (t_pdp_list *l); -void pdp_list_clear (t_pdp_list *l); -void pdp_tree_free (t_pdp_list *l); -void pdp_tree_clear (t_pdp_list *l); - -void pdp_tree_strip_pointers (t_pdp_list *l, t_pdp_free_method f); -void pdp_tree_strip_packets (t_pdp_list *l); - -t_pdp_list* pdp_list_from_cstring (char *chardef, char **nextchar); - - - -/* traversal routines */ -void pdp_list_apply (t_pdp_list *l, t_pdp_atom_method am); -void pdp_tree_apply (t_pdp_list *l, t_pdp_atom_method am); -void pdp_list_apply_word_method (t_pdp_list *l, t_pdp_word_type t, t_pdp_word_method wm); -void pdp_tree_apply_word_method (t_pdp_list *l, t_pdp_word_type t, t_pdp_word_method wm); -void pdp_list_apply_pword_method (t_pdp_list *l, t_pdp_word_type t, t_pdp_pword_method pwm); -void pdp_tree_apply_pword_method (t_pdp_list *l, t_pdp_word_type t, t_pdp_pword_method pwm); - - -/* copy: (reverse) copies a list. */ - -t_pdp_list* pdp_list_copy (t_pdp_list *l); -t_pdp_list* pdp_list_copy_reverse (t_pdp_list *l); -t_pdp_list* pdp_tree_copy (t_pdp_list *l); -t_pdp_list* pdp_tree_copy_reverse (t_pdp_list *l); - - -/* cat: this makes a copy of the second list and adds it at the end of the first one */ -void pdp_list_cat (t_pdp_list *l, t_pdp_list *tail); - -/* information */ -int pdp_list_contains (t_pdp_list *l, t_pdp_word_type t, t_pdp_word w); -int pdp_list_size (t_pdp_list *l); -void pdp_list_print (t_pdp_list *l); - -/* access */ -void pdp_list_add (t_pdp_list *l, t_pdp_word_type t, t_pdp_word w); -void pdp_list_add_back (t_pdp_list *l, t_pdp_word_type t, t_pdp_word w); -void pdp_list_add_to_set (t_pdp_list *l, t_pdp_word_type t, t_pdp_word w); -void pdp_list_remove (t_pdp_list *l, t_pdp_word_type t, t_pdp_word w); - -/* these don't do error checking. out of bound == error */ -t_pdp_word pdp_list_pop (t_pdp_list *l); -t_pdp_word pdp_list_index (t_pdp_list *l, int index); - -/* some aliases */ -#define pdp_list_add_front pdp_list_add -#define pdp_list_push pdp_list_add -#define pdp_list_queue pdp_list_add_end -#define pdp_list_unqueue pdp_list_pop - -/* generic atom iterator */ -#define PDP_ATOM_IN(list,atom) for (atom = list->first ; atom ; atom = atom->next) - -/* fast single type iterators */ - -/* generic */ -#define PDP_WORD_IN(list, atom, word, type) for (atom=list->first ;atom && ((word = atom -> w . type) || 1); atom=atom->next) - -/* type specific */ -#define PDP_POINTER_IN(list, atom, x) PDP_WORD_IN(list, atom, x, w_pointer) -#define PDP_INT_IN(list, atom, x) PDP_WORD_IN(list, atom, x, w_int) -#define PDP_FLOAT_IN(list, atom, x) PDP_WORD_IN(list, atom, x, w_float) -#define PDP_SYMBOL_IN(list, atom, x) PDP_WORD_IN(list, atom, x, w_symbol) -#define PDP_PACKET_IN(list, atom, x) PDP_WORD_IN(list, atom, x, w_packet) -#define PDP_LIST_IN(list, atom, x) PDP_WORD_IN(list, atom, x, w_list) - - -/* some macros for the pointer type */ - -#define pdp_list_add_pointer(l,p) pdp_list_add(l, a_pointer, ((t_pdp_word)((void *)(p)))) -#define pdp_list_add_back_pointer(l,p) pdp_list_add_back(l, a_pointer, ((t_pdp_word)((void *)(p)))) -#define pdp_list_add_pointer_to_set(l,p) pdp_list_add_to_set(l, a_pointer, ((t_pdp_word)((void *)(p)))) -#define pdp_list_remove_pointer(l,p) pdp_list_remove(l, a_pointer, ((t_pdp_word)((void *)(p)))) -#define pdp_list_contains_pointer(l,p) pdp_list_contains(l, a_pointer, ((t_pdp_word)((void *)(p)))) - - - - -#endif diff --git a/include/pdp_list_macros.h b/include/pdp_list_macros.h deleted file mode 100644 index cb1f49f..0000000 --- a/include/pdp_list_macros.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __PDP_LIST_MACROS__ -#define __PDP_LIST_MACROS__ - -/* some additional (short named) list macros mainly for manipulationg - argument lists. needs to be included locally. */ - -/* reading a list */ -#define FIRST(l) ((l)->first) -#define SIZE(l) ((l)->elements) - -#define NEXT(a) ((a)->next) -#define N(a) (a = a->next) - -#define FLOAT(a) ((a)->t == a_float ? (a)->w.w_float : 0.0f) -#define PACKET(a) ((a)->t == a_packet ? (a)->w.w_packet : -1) -#define INT(a) ((a)->t == a_int ? (a)->w.w_packet : 0) - - -/* creating a list, and adding stuff to the end (queueing) */ -#define LIST(n) pdp_list_new(n) -#define LFREE(l) pdp_list_free(l) -#define QFLOAT(l, x) pdp_list_add_back(l, a_float, ((t_pdp_word)(float)(x))) -#define QINT(l, x) pdp_list_add_back(l, a_int, ((t_pdp_word)(int)(x))) -#define QPACKET(l, x) pdp_list_add_back(l, a_packet,((t_pdp_word)(int)(x))) - - -#endif diff --git a/include/pdp_llconv.h b/include/pdp_llconv.h deleted file mode 100644 index 15deda7..0000000 --- a/include/pdp_llconv.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Pure Data Packet system implementation. : low level format conversion code - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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 */ - -#ifndef PDP_LLCONV_H -#define PDP_LLCONV_H - -#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, - RIF_BGR__P____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 - - -#endif diff --git a/include/pdp_matrix.h b/include/pdp_matrix.h deleted file mode 100644 index 22a33bb..0000000 --- a/include/pdp_matrix.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Pure Data Packet system implementation. matrix packet interface - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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_MATRIX_H -#define PDP_MATRIX_H - -#include <stdio.h> -#include <gsl/gsl_block.h> -#include <gsl/gsl_vector.h> -#include <gsl/gsl_matrix.h> -#include <gsl/gsl_blas.h> -#include <gsl/gsl_linalg.h> - -#include "pdp_types.h" - -#define gsl_rows size1 -#define gsl_columns size2 - -typedef struct _matrix -{ - /* meta data */ - u32 type; /* float/double real/complex */ - u32 rows; - u32 columns; - - /* gsl structures: these will be cast to the correct type on use */ - gsl_block block; /* gsl block meta data */ - gsl_vector vector; /* gsl vector meta data */ - gsl_matrix matrix; /* gsl matrix meta data */ - gsl_permutation perm; /* permutation data for storing an LU decomposition */ - int signum; /* sign of permutation matrix */ - - -} t_matrix; - -#define PDP_MATRIX 7 - -#define PDP_MATRIX_TYPE_RFLOAT 1 -#define PDP_MATRIX_TYPE_CFLOAT 2 -#define PDP_MATRIX_TYPE_RDOUBLE 3 -#define PDP_MATRIX_TYPE_CDOUBLE 4 - -int pdp_packet_matrix_isvalid(int p); -int pdp_packet_matrix_isvector(int p); -int pdp_packet_matrix_ismatrix(int p); - -int pdp_packet_new_matrix(u32 rows, u32 columns, u32 type); -int pdp_packet_new_matrix_product_result(CBLAS_TRANSPOSE_t TransA, CBLAS_TRANSPOSE_t TransB, int pA, int pB); -void pdp_packet_matrix_setzero(int p); - - -/* getters: returns 0 if type is incorrect */ -void *pdp_packet_matrix_get_gsl_matrix(int p, u32 type); -void *pdp_packet_matrix_get_gsl_vector(int p, u32 type); -int pdp_packet_matrix_get_type(int p); - - -/* type transparent matrix operations */ - -/* blas wrappers */ - -/* C += scale op(A) op(B) */ -int pdp_packet_matrix_blas_mm(CBLAS_TRANSPOSE_t TransA, CBLAS_TRANSPOSE_t TransB, - int pA, int pB, int pC, - float scale_r, float scale_i); -/* c += scale op(A) b */ -int pdp_packet_matrix_blas_mv(CBLAS_TRANSPOSE_t TransA, - int pA, int pb, int pc, - float scale_r, float scale_i); - -/* other gsl wrappers */ -int pdp_packet_matrix_LU(int p_matrix); -int pdp_packet_matrix_LU_to_inverse(int p_matrix); -int pdp_packet_matrix_LU_solve(int p_matrix, int p_vector); - - -#endif diff --git a/include/pdp_mem.h b/include/pdp_mem.h deleted file mode 100644 index 3301655..0000000 --- a/include/pdp_mem.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Pure Data Packet header file: memory allocation - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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_MEM_H_ -#define _PDP_MEM_H_ - -#include <pthread.h> - -/* a wrapper around malloc and free to keep track of pdp's memory usage */ -void *pdp_alloc(int size); -void pdp_dealloc(void *stuff); - - -/* fast allocator object (for lists and atoms) */ -#define PDP_FASTALLOC_BLOCK_ELEMENTS 4096 -typedef struct _pdp_fastalloc -{ - unsigned int atom_size; - unsigned int block_elements; - pthread_mutex_t mut; - struct _fastalloc *freelist; - -} t_pdp_fastalloc; - -void *pdp_fastalloc_new_atom(t_pdp_fastalloc *x); -void pdp_fastalloc_save_atom(t_pdp_fastalloc *x, void *atom); -t_pdp_fastalloc *pdp_fastalloc_new(unsigned int size); - -#endif diff --git a/include/pdp_mmx.h b/include/pdp_mmx.h deleted file mode 100644 index 8181ff0..0000000 --- a/include/pdp_mmx.h +++ /dev/null @@ -1,171 +0,0 @@ - -/* - * Pure Data Packet. Header file for mmx routines. - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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); - - -/********************************** RESAMPLE OPERATIONS *******************************************/ - -// affine transformation (called linear map, but that's flou terminology) -void pixel_resample_linmap_s16(void *x); - - - -/********************************** POLYNOMIAL OPERATIONS *****************************************/ -// chebychev polynomial -void pixel_cheby_s16_3plus(short int *buf, int nb_8pixel_vectors, int orderplusone, short int *coefs); - - - -#ifdef __cplusplus -} -#endif - - -#endif //PDP_MMX_H diff --git a/include/pdp_net.h b/include/pdp_net.h deleted file mode 100644 index ddc3f7f..0000000 --- a/include/pdp_net.h +++ /dev/null @@ -1,197 +0,0 @@ -#ifndef __PDP_UDP_H_ -#define __PDP_UDP_H_ - -/* - * Pure Data Packet header: UDP protocol for raw packets - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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 the specification of the pdp UDP transport protocol. - It is a very basic binary protocol, not very fool proof. - - The protocol: - - A header packet is transmitted first. This contains mime type information, - and the size of and number of packets to be received. - - The connection id: - - Currently it is just a random number from the libc rand() function - this should be accurate enough. - - -*/ - -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <unistd.h> -#include <pthread.h> -#include <netdb.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> - -/* some defs */ -#define MAX_UDP_PACKET 1472 -#define RESEND_MAX_CHUNKS ((MAX_UDP_PACKET - sizeof(t_pdp_udp_header))/sizeof(unsigned int)) - -#define PDP_UDP_VERSION 1 - -/* a pdp udp packet is prepended with this header */ - -typedef struct _pdp_udp_header -{ - char signature[4]; /* must be "PDP" */; - unsigned int version; /* protocol version */ - unsigned int connection_id; /* the 'connection' id */ - unsigned int sequence_number; /* sequence number. negative: control packet: body contains meta info */ - -} t_pdp_udp_header; - -/* the data part for a new connection */ - -#define PDP_UDP_NEW -1 /* start a new transmission */ -typedef struct _pdp_udp_new -{ - unsigned int data_size; /* the size of the packets */ - unsigned int nb_chunks; /* number of chunks in pdp to be transmitted */ - unsigned int chunk_size; /* the maximum chunk size */ - char type[0]; /* the packet type */ - - // the tail part is the mime type, for creation and reassembly -} t_pdp_udp_newpacket; - -#define PDP_UDP_DONE -2 /* transmission is done */ - -#define PDP_UDP_RESEND -3 /* request retransmission of certain chunks. empty: transmission ok */ -#define PDP_UDP_ACKNEW -4 /* acknowledge reception of new packet header */ - - -/* receiver and sender classes (transport layer) */ - -#define PDP_UDP_BUFSIZE 0xF000 - -/* RECEIVER */ -typedef struct _pdp_udp_receiver -{ - - // buffer for receiving - t_pdp_udp_header x_header; //pdp over udp header - char x_buf[PDP_UDP_BUFSIZE]; //send buffer - unsigned int x_zero_terminator; // to prevent runaway strings - unsigned int x_buf_size; //size of the received data in the buffer (excluding the header) - - // buffer for sending - t_pdp_udp_header x_resend_header; // header of the resend packet - unsigned int x_resend_chunks[RESEND_MAX_CHUNKS]; // body contains the chunks to resend - unsigned int x_resend_udp_packet_size; - - // transmission info - unsigned int x_connection_id; - unsigned int x_nb_chunks; - unsigned int x_chunk_size; - unsigned int *x_chunk_list; - char *x_data_type; - unsigned int x_data_size; - void *x_data; - struct sockaddr_in x_source_socket; - int x_sslen; - int x_receive_finished; - int x_packet_transferred; - - int x_socket; //socket used for sending - struct sockaddr_in x_sa; //address struct - -} t_pdp_udp_receiver; - -/* setup */ -t_pdp_udp_receiver *pdp_udp_receiver_new(int port); -void pdp_udp_receiver_free(t_pdp_udp_receiver *x); - -/* reset connection (wait for new packet) */ -void pdp_udp_receiver_reset(t_pdp_udp_receiver *x); - -/* receive, returns 1 on success, 0 on timeout, -1 on error */ -int pdp_udp_receiver_receive(t_pdp_udp_receiver *x, unsigned int timeout_ms); - -/* get meta & data */ -char *pdp_udp_receiver_type(t_pdp_udp_receiver *x); -unsigned int pdp_udp_receiver_size(t_pdp_udp_receiver *x); -void *pdp_udp_receiver_data(t_pdp_udp_receiver *x); - - - -/* SENDER */ -typedef struct _pdp_udp_sender -{ - // desired udp packet size - unsigned int x_udp_payload_size; - - // current packet && communication info - unsigned int x_connection_id; - char *x_data_type; - void *x_data; - unsigned int x_data_size; - unsigned int x_chunk_size; - unsigned int *x_chunk_list; - unsigned int x_nb_chunks; - unsigned int x_chunk_list_size; - - // connection data - int x_socket; //socket used for sending - struct sockaddr_in x_sa; //address struct - unsigned int x_sleepgrain_us; //pause between sends (the poor man's flow control) (0 == no sleep) - unsigned int x_sleep_count; - unsigned int x_sleep_period; - unsigned int x_timeout_us; - - // temp buffer for sending - t_pdp_udp_header x_header; - char x_buf[PDP_UDP_BUFSIZE]; - unsigned int x_buf_size; - - // temp buffer for receiving - t_pdp_udp_header x_resend_header; - unsigned int x_resend_chunks[RESEND_MAX_CHUNKS]; - unsigned int x_resend_items; - - -} t_pdp_udp_sender; - -/* some flow control variables */ -void pdp_udp_sender_timeout_us(t_pdp_udp_sender *x, unsigned int timeout_us); -void pdp_udp_sender_sleepgrain_us(t_pdp_udp_sender *x, unsigned int sleepgrain_us); -void pdp_udp_sender_sleepperiod(t_pdp_udp_sender *x, unsigned int sleepperiod); -void pdp_udp_sender_udp_packet_size(t_pdp_udp_sender *x, unsigned int udp_packet_size); - -/* setup */ -t_pdp_udp_sender *pdp_udp_sender_new(void); -void pdp_udp_sender_free(t_pdp_udp_sender *x); - -/* connect */ -void pdp_udp_sender_connect(t_pdp_udp_sender *x, char *host, unsigned int port); - -/* send, returns 1 on success, 0 on error */ -int pdp_udp_sender_send(t_pdp_udp_sender *x, char* type, unsigned int size, void *data); - - - -#endif diff --git a/include/pdp_packet.h b/include/pdp_packet.h deleted file mode 100644 index 6a98c8c..0000000 --- a/include/pdp_packet.h +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Pure Data Packet system implementation: Packet Manager Interface - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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 the pdp packet manager interface specification. - - It is an implementation of the "Object Pool" pattern with lazy instantiation - and lazy destruction. - - The pool is a growable array. It can only grow larger. Packets are represented - by an integer, which is an index in this array. - - The standard "pure" packets (the ones which use a flat memory buffer) have recovery - for resource depletion (main memory). If an out of memory condition is met - on allocation of a new package, the garbage collector kicks in and frees unused - packets until the out of memory condition is solved. Since an out of memory - condition can be fatal for other parts of the program, pdp also supports a - memory limit, to ensure some kind of safety margin. - - The "not so pure" packets should resolve resource conflicts in their own factory method, - since the constructor is responsible for allocating external resources. The standard - way to do this is to allocate a packet, free it's resources and allocate a new packet - until the resource allocation succeeds. Especially for these kinds of packets, the - pdp pool supports an explicit reuse method. This returns a valid packet if it can reuse - one (based on the high level type description). - - Packets that don't have memory managing methods defined in the packet class - (Standard packets) are treated as a header concatenated with a flat memory buffer, and - can be copied and cloned without problems. So, if a packet contains pointers to other - data or code, it can't be a pure packet. - - The interface to the packet manager contains the following managing methods: - - * pdp_packet_new: create a new packet or reuse a previous one - * pdp_packet_mark_passing: conditionally release a packet (for passing to other objects) - * pdp_packet_unmark_passing: turn a conditionally released packet back to normal (i.e. before deletion) - * pdp_packet_mark_unused: release a packet - * pdp_packet_copy_ro: register a packet for read only use - * pdp_packet_copy_rw: register a packet for read/write use (this creates a copy if necessary) - * pdp_packet_clone_rw: create a new packet using a template, but don't copy the data - - And two methods for raw data access - - * pdp_packet_header: retreive the header of the packet - * pdp_packet_data: retreive the data buffer of the packet (only for static packets) - - All the methods declared in this header are supposed to be thread safe, so you - can call them from the pd and pdp thread. - -*/ - -#ifndef PDP_PACKET_H -#define PDP_PACKET_H - -/* all symbols are C-style */ -#ifdef __cplusplus -extern "C" -{ -#endif - - - - //typedef int (*t_pdp_attribute_method)(struct _pdp_list *); -typedef int (*t_pdp_factory_method)(t_pdp_symbol *); - - -#if 0 - -/* packet class attribute (method) */ -typedef struct _pdp_attribute -{ - t_pdp_symbol *name; - t_pdp_attribute_method method; - - /* problem: do we support argument type checking ?? - this seems to be better solved in a "spec doc" or a central place - where "reserved" methods can be defined. */ - - /* if null this means the input or output list can be anything */ - struct _pdp_list *in_spec; // template for the input list (including default arguments) - struct _pdp_list *out_spec; // template for the output list -} t_pdp_attribute; - -#endif - -/* packet class header */ -typedef struct _pdp_class -{ - /* packet manips: non-pure data packets (using external resources) must define these */ - t_pdp_packet_method1 reinit; /* reuse method for pdp_packet_new() */ - t_pdp_packet_method2 clone; /* init from template for pdp_packet_clone_rw() */ - t_pdp_packet_method2 copy; /* init & copy from template for pdp_packet_copy_rw() */ - t_pdp_packet_method1 cleanup; /* free packet's resources (to be used by the garbage collector) */ - - t_pdp_symbol *type; /* type template for packet class */ - t_pdp_factory_method create; /* the constructor */ - //struct _pdp_list *attributes; /* list of attributes (packet methods) */ -}t_pdp_class; - - -/* packet object header */ -struct _pdp -{ - /* meta info */ - unsigned int type; /* main datatype of this object */ - t_pdp_symbol *desc; /* high level type description (sort of a mime type) */ - unsigned int size; /* datasize including header */ - unsigned int flags; /* packet flags */ - - /* reference count */ - unsigned int users; /* nb users of this object, readonly if > 1 */ - unsigned int *refloc; /* location of reference to packet for passing packets */ - - /* class object */ - t_pdp_class *theclass; /* if zero, the packet is a pure packet (just data, no member functions) */ - - u32 pad[9]; /* reserved to provide binary compatibility for future extensions */ - - union /* each packet type has a unique subheader */ - { - t_raw raw; /* raw subheader (for extensions unkown to pdp core system) */ - t_image image; /* (nonstandard internal) 16 bit signed planar bitmap image format */ - t_bitmap bitmap; /* (standard) bitmap image (fourcc coded) */ - //t_ca ca; /* cellular automaton state data */ - //t_ascii ascii; /* ascii packet */ - } info; - -}; - - -/* pdp data packet type id */ -#define PDP_IMAGE 1 /* 16bit signed planar scanline encoded image packet */ -//RESERVED: #define PDP_CA 2 /* 1bit toroidial shifted scanline encoded cellular automaton */ -//RESERVED: #define PDP_ASCII 3 /* ascii packet */ -//RESERVED: #define PDP_TEXTURE 4 /* opengl texture object */ -//RESERVED: #define PDP_3DCONTEXT 5 /* opengl render context */ -#define PDP_BITMAP 6 /* 8bit image packet (fourcc coded??) */ -//RESERVED: #define PDP_MATRIX 7 /* floating point/double matrix/vector packet (from gsl) */ - -/* PACKET FLAGS */ - -#define PDP_FLAG_DONOTCOPY (1<<0) /* don't copy the packet on register_rw, instead return an invalid packet */ - - -/* class methods */ -t_pdp_class *pdp_class_new(t_pdp_symbol *type, t_pdp_factory_method create); - -#if 0 -void pdp_class_addmethod(t_pdp_class *c, t_pdp_symbol *name, t_pdp_attribute_method method, - struct _pdp_list *in_spec, struct _pdp_list *out_spec); -#endif - -/* packet factory method + registration */ -int pdp_factory_newpacket(t_pdp_symbol *type); - -#if 0 -/* send a message to a packet (packet polymorphy) - this returns NULL on failure, or a return list - the return list should be freed by the caller */ - -int pdp_packet_op(t_pdp_symbol *operation, struct _pdp_list *stack); -#endif - -/* debug */ -void pdp_packet_print_debug(int packet); - - -/* hard coded packet methods */ -int pdp_packet_copy_ro(int handle); /* get a read only copy */ -int pdp_packet_copy_rw(int handle); /* get a read/write copy */ -int pdp_packet_clone_rw(int handle); /* get an empty read/write packet of the same type (only copy header) */ -void pdp_packet_mark_unused(int handle); /* indicate that you're done with the packet */ -void pdp_packet_mark_passing(int *phandle); /* mark a packet as passing */ -void pdp_packet_unmark_passing(int packet); /* unmark a packet as passing (i.e. before marking unused) */ -void pdp_packet_delete(int packet); /* like mark_unused, but really delete when refcount == 0 */ - -t_pdp* pdp_packet_header(int handle); /* get packet header */ -void* pdp_packet_subheader(int handle); /* get packet subheader */ -void* pdp_packet_data(int handle); /* get packet raw data */ - -int pdp_packet_compat(int packet0, int packet1); -int pdp_packet_reuse(t_pdp_symbol *description); -int pdp_packet_brandnew(unsigned int datatype, unsigned int datasize); /* create a new packet, don't reuse */ - -int pdp_packet_writable(int packet); /* returns true if packet is writable */ -void pdp_packet_replace_with_writable(int *packet); /* replaces a packet with a writable copy */ -void pdp_packet_mark_unused_atomic(int *handle); /* mark unused + set reference to -1 (for thread synchro) */ - - -/* pool stuff */ -int pdp_pool_collect_garbage(void); /* free all unused packets */ -void pdp_pool_set_max_mem_usage(int max); /* set max mem usage */ - -/* a wrapper around malloc and free to keep track of pdp's memory usage */ -void *pdp_alloc(int size); -void pdp_dealloc(void *stuff); - - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/pdp_pd.h b/include/pdp_pd.h deleted file mode 100644 index e200c1e..0000000 --- a/include/pdp_pd.h +++ /dev/null @@ -1,7 +0,0 @@ -/* pdp_pd.h wrapper */ - -#ifndef _M_PD_H_ -#define _M_PD_H_ -#include "m_pd.h" -#endif - diff --git a/include/pdp_png.h b/include/pdp_png.h deleted file mode 100644 index 5aae4c7..0000000 --- a/include/pdp_png.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Pure Data Packet header file. png glue code. - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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_PNG_H__ -#define __PDP_PNG_H__ - -int pdp_packet_bitmap_save_png_file(int packet, char *filename); -int pdp_packet_bitmap_from_png_file(char *filename); - - -#endif diff --git a/include/pdp_post.h b/include/pdp_post.h deleted file mode 100644 index 05b5143..0000000 --- a/include/pdp_post.h +++ /dev/null @@ -1,29 +0,0 @@ - -/* - * Pure Data Packet header file. pdp logging. - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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_POST_H_ -#define _PDP_POST_H_ - -/* write a message to log (console) */ -void pdp_post_n(char *fmt, ...); -void pdp_post(char *fmt, ...); - -#endif diff --git a/include/pdp_queue.h b/include/pdp_queue.h deleted file mode 100644 index 81a6b7e..0000000 --- a/include/pdp_queue.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Pure Data Packet - processor queue interface - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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_QUEUE_H -#define PDP_QUEUE_H - -/********************* general purpose pd process queue class *********************/ - -typedef void (*t_pdpmethod)(void *client); - -/* the process queue data record */ -typedef struct process_queue_struct -{ - void *x_owner; /* the object we are dealing with */ - t_pdpmethod x_process; /* the process method */ - t_pdpmethod x_callback; /* the function to be called when finished */ - int *x_queue_id; /* place to store the queue id for task */ -} t_process_queue_item; - - -/* a pd process queue object */ -typedef struct _pd_queue -{ - /* clock members */ - t_clock *pdp_clock; - double deltime; - - /* some bookkeeping vars */ - long long ticks; - long long packets; - - /* queue members */ - t_process_queue_item *q; /* queue */ - int mask; - int head; /* last entry in queue + 1 */ - int tail; /* first entry in queque */ - int curr; /* the object currently processed in other thread */ - - /* pthread vars */ - pthread_mutex_t mut; - pthread_cond_t cond_dataready; - pthread_cond_t cond_processingdone; - pthread_t thread_id; - - /* toggle for thread usage */ - int use_thread; - -} t_pdp_procqueue; - - -/* all symbols are C-style */ -#ifdef __cplusplus -extern "C" -{ -#endif - - -void pdp_procqueue_wait(t_pdp_procqueue *q); -void pdp_procqueue_finish(t_pdp_procqueue *q, int index); -void pdp_procqueue_add(t_pdp_procqueue *q, void *owner, void *process, void *callback, int *queue_id); -void pdp_procqueue_use_thread(t_pdp_procqueue* q, int t); -void pdp_procqueue_init(t_pdp_procqueue *q, double milliseconds, int logsize); - -/********************* interface to pdp process queue singleton *********************/ - -/* processor queue methods, callable from main pd thread */ - -/* get the default queue */ -t_pdp_procqueue *pdp_queue_get_queue(void); - - - -#if 1 - -/* 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); - -#endif - - -/* misc signals to pdp */ -void pdp_control_notify_drop(int packet); - - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/pdp_resample.h b/include/pdp_resample.h deleted file mode 100644 index 8876bfa..0000000 --- a/include/pdp_resample.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Pure Data Packet header file. - image resampling prototypes - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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); - -/* USE pdp_imageproc_resample_affinemap -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); - - - -/* power of 2 resamplers */ -void pdp_resample_halve(s16 *src_image, s16 *dst_image, s32 src_w, s32 src_h); -void pdp_resample_double(s16 *src_image, s16 *dst_image, s32 src_w, s32 src_h); - - - -/* core routines */ -//s32 pdp_resample_bilin(s16 *image, s32 width, s32 height, s32 virt_x, s32 virt_y); - - -#endif diff --git a/include/pdp_symbol.h b/include/pdp_symbol.h deleted file mode 100644 index fe3137a..0000000 --- a/include/pdp_symbol.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Pure Data Packet system implementation. : symbol and namespace stuff - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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_SYMBOL_ -#define _PDP_SYMBOL_ - - -/* pdp's symbols are derived from pd's symbols - there is one symbol hash. each symbol has - a meaning in several name spaces. - - * forth words - * type description lists (for accelerating type matching) - - -*/ - -#include "pdp_list.h" - - - - -/* the pdp symbol type */ -typedef struct _pdp_symbol -{ - /* next */ - struct _pdp_symbol *s_next; - - /* the symbol name */ - char *s_name; - - /* forth symbol->atom */ - struct _pdp_atom s_forth; - - /* packet handling cache */ - struct _pdp_list *s_type; // a parsed type description: a/b/c -> (a,b,c) - struct _pdp_list *s_reusefifo; // packet pool fifo for this type - - -} t_pdp_symbol; - - - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* namespace stuff */ -int pdp_symbol_set_typelist(t_pdp_symbol *s, struct _pdp_list *typelist); - -/* get symbol from char */ -t_pdp_symbol *pdp_gensym(char *s); - -/* iterate over all symbols */ -typedef void (*t_pdp_symbol_iterator)(t_pdp_symbol *s); -void pdp_symbol_apply_all(t_pdp_symbol_iterator ir); - -// don't use these directly, use the macros -extern t_pdp_symbol _pdp_sym_wildcard; -extern t_pdp_symbol _pdp_sym_float; -extern t_pdp_symbol _pdp_sym_int; -extern t_pdp_symbol _pdp_sym_symbol; -extern t_pdp_symbol _pdp_sym_packet; -extern t_pdp_symbol _pdp_sym_pointer; -extern t_pdp_symbol _pdp_sym_list; -extern t_pdp_symbol _pdp_sym_invalid; -extern t_pdp_symbol _pdp_sym_question_mark; -extern t_pdp_symbol _pdp_sym_atom; -extern t_pdp_symbol _pdp_sym_null; -extern t_pdp_symbol _pdp_sym_quote_start; -extern t_pdp_symbol _pdp_sym_quote_end; -extern t_pdp_symbol _pdp_sym_return; -extern t_pdp_symbol _pdp_sym_nreturn; -extern t_pdp_symbol _pdp_sym_defstart; -extern t_pdp_symbol _pdp_sym_defend; -extern t_pdp_symbol _pdp_sym_if; -extern t_pdp_symbol _pdp_sym_then; -extern t_pdp_symbol _pdp_sym_local; -extern t_pdp_symbol _pdp_sym_forth; -extern t_pdp_symbol _pdp_sym_call; -extern t_pdp_symbol _pdp_sym_push; -extern t_pdp_symbol _pdp_sym_pop; - - -#ifdef __cplusplus -} -#endif - -// these symbols are used a lot in critical parts -// optimize later - -#define PDP_SYM_WILDCARD &_pdp_sym_wildcard -#define PDP_SYM_FLOAT &_pdp_sym_float -#define PDP_SYM_INT &_pdp_sym_int -#define PDP_SYM_SYMBOL &_pdp_sym_symbol -#define PDP_SYM_PACKET &_pdp_sym_packet -#define PDP_SYM_POINTER &_pdp_sym_pointer -#define PDP_SYM_LIST &_pdp_sym_list -#define PDP_SYM_INVALID &_pdp_sym_invalid -#define PDP_SYM_QUESTION_MARK &_pdp_sym_question_mark -#define PDP_SYM_ATOM &_pdp_sym_atom -#define PDP_SYM_NULL &_pdp_sym_null -#define PDP_SYM_QUOTE_START &_pdp_sym_quote_start -#define PDP_SYM_QUOTE_END &_pdp_sym_quote_end -#define PDP_SYM_RETURN &_pdp_sym_return -#define PDP_SYM_NRETURN &_pdp_sym_nreturn -#define PDP_SYM_DEF_START &_pdp_sym_defstart -#define PDP_SYM_DEF_END &_pdp_sym_defend -#define PDP_SYM_IF &_pdp_sym_if -#define PDP_SYM_THEN &_pdp_sym_then -#define PDP_SYM_LOCAL &_pdp_sym_local -#define PDP_SYM_FORTH &_pdp_sym_forth -#define PDP_SYM_CALL &_pdp_sym_call -#define PDP_SYM_PUSH &_pdp_sym_push -#define PDP_SYM_POP &_pdp_sym_pop - -#endif - diff --git a/include/pdp_type.h b/include/pdp_type.h deleted file mode 100644 index ea8da47..0000000 --- a/include/pdp_type.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Pure Data Packet system implementation. Type handling interface - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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. - * - */ - - -/* COMMENTS - -Since version 0.11 all packets have an (optional) high level type description. -This can be thought of as their mime type. It has several uses: - -* automatic type conversion -* better reuse strategy for non pure packets -* debugging - -The description is text-encoded, in the following form: - -type/subtype/subsubtype/.. - -This is implemented using t_pdp_symbol. - -Type descriptors can have wildcards. This is to give some freedom to a desired -type conversion. The following are all compatible: - -*/ - -// image/grey/320x240 -// image/*/320x240 -// image/*/* - -/* - -From a user pov, the type conversion is centralized. A single object (pdp_convert) -can do most of the conversions. - -Type conversion implementation has to be done decentralized. It is subdivided into -two steps: inter-type and intra-type conversions. - -Intra-type is the full responsability of each type implementation and can be handled -in a decentralized way (at linkage the type central intra-converter is registered -at the pdp framework. - -Inter-type conversion is harder to do decentralized, therefore each new type should -provide some conversions to the basic built in types. (internal image, bitmap or matrix -types. - -The point of this whole business is to - -* enable automatic conversion from anything to a desired type for operators that combine objects. - i.e. pdp_add but receive incompatible objects. -* enable manual anything to anything conversion using a pdp_convert object, i.e. have a consistent - packet conversion api for users. - - -The solution is type conversion programs. A program's behaviour is specified as follows: - -* the program is registered with a source and destination (result) template -* it is passed a packet and a destination template -* it can assume the source packet complies to the program's registerd source template -* it should convert the packet to a packet that will comply to it's registered destination template -* if for some reason a conversion fails, an invalid packet (handle == -1) should be returned - -about type templates: - -* they are hierarchical, with subtypes separated by a '/' character -* they can contain a wildcard '*', meaning that a certain level in the type hierarchy is: - - a don't care value, when the wildcard is used - -> as a destination template in a requested conversion - -> as a source template in a conversion program's specification - - uspecified, when the wildcard is used - -> as a destination template in a conversion program's specification - - - -NOTE: - - a wildcard can't be used in a source template for a conversion request - this assymetry requires there be 2 kinds of template matching mechanisms: - - - source type description (without wildcards) to conversion program source template matching - - destination type description (with wildcards) to conversion program destination template matching - - since a packet's type description cannot have wildcards, a symmetric matching (both sides have - wildcards) can be used for matching. - -*/ - - - -/* - -implementation: - -there are 2 lists with conversion progams: -* the global list, containing all registered programs. -* the cached list, containing all recently used registered programs, or combinations thereof - -if there is no cached, perfectly matching rule, a new one will be created, and added to -the head of the conversion list. - -all conversion methods should keep their hands off the source packet. it is treated as readonly. -this is to ensure a more flexible operation (i.e. be able to put the conversion at the register_ro -level) - - -TODO: add a breadth first search algorithm to do multiple stage conversion. - -*/ - -#ifndef PDP_TYPE_H -#define PDP_TYPE_H - -/* the conversion method accepts a packet (which is freed) and a destination wildcard - and produces a new packet, or the invalid packet if the conversion failed */ -typedef int (*t_pdp_conversion_method)(int, t_pdp_symbol *); - -/* a conversion program is alist of conversion methods */ -typedef t_pdp_list t_pdp_conversion_program; - -/* a conversion has source and dest wildcards, and a conversion program */ -typedef struct _pdp_conversion -{ - t_pdp_symbol *src_pattern; // source type pattern - t_pdp_symbol *dst_pattern; // destination type pattern - t_pdp_conversion_program *program; // the conversion program for this conversion -} t_pdp_conversion; - -/* all symbols are C style */ -#ifdef __cplusplus -extern "C" -{ -#endif - -/* pdp_packet methods */ -t_pdp_symbol *pdp_packet_get_description(int packet); -int pdp_packet_convert_ro(int packet, t_pdp_symbol *dest_pattern); -int pdp_packet_convert_rw(int packet, t_pdp_symbol *dest_pattern); - - -/* pdp_conversion_program methods */ -void pdp_conversion_program_free(t_pdp_conversion_program *program); -t_pdp_conversion_program *pdp_conversion_program_new(t_pdp_conversion_method method, ...); -t_pdp_conversion_program *pdp_conversion_program_copy(t_pdp_conversion_program *program); -void pdp_conversion_program_add(t_pdp_conversion_program *program, t_pdp_conversion_program *tail); - -/* pdp_type (central type object) methods */ -int pdp_type_description_match(t_pdp_symbol *description, t_pdp_symbol *pattern); -void pdp_type_register_conversion (t_pdp_symbol *src_pattern, t_pdp_symbol *dst_pattern, t_pdp_conversion_program *program); -void pdp_type_register_cached_conversion (t_pdp_symbol *src_pattern, t_pdp_symbol *dst_pattern, t_pdp_conversion_program *program); - - //t_pdp_symbol *pdp_type_gendesc(char *desc); //generate a type description (with description list attached) -t_pdp_list *pdp_type_to_list(t_pdp_symbol *type); - -/* pdp's (threadsafe) symbol */ -t_pdp_symbol *pdp_gensym(char *s); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/pdp_type.h_old b/include/pdp_type.h_old deleted file mode 100644 index d588e7f..0000000 --- a/include/pdp_type.h_old +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Pure Data Packet system implementation. Type handling interface - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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. - * - */ - - -/* COMMENTS - -Since version 0.11 all packets have an (optional) high level type description. -This can be thought of as their mime type. It has several uses: - -* automatic type conversion -* better reuse strategy for non pure packets -* debugging - -The description is text-encoded, in the following form: - -type/subtype/subsubtype/.. - -This is implemented using t_pdp_symbol. - -Type descriptors can have wildcards. This is to give some freedom to a desired -type conversion. The following are all compatible: - -*/ - -// image/grey/320x240 -// image/*/320x240 -// image/*/* - -/* - -From a user pov, the type conversion is centralized. A single object (pdp_convert) -can do most of the conversions. - -Type conversion implementation has to be done decentralized. It is subdivided into -two steps: inter-type and intra-type conversions. - -Intra-type is the full responsability of each type implementation and can be handled -in a decentralized way (at linkage the type central intra-converter is registered -at the pdp framework. - -Inter-type conversion is harder to do decentralized, therefore each new type should -provide some conversions to the basic built in types. (internal image, bitmap or matrix -types. - -The point of this whole business is to - -* enable automatic conversion from anything to a desired type for operators that combine objects. - i.e. pdp_add but receive incompatible objects. -* enable manual anything to anything conversion using a pdp_convert object, i.e. have a consistent - package conversion api for users. - - -The solution is type conversion programs. A program's behaviour is specified as follows: - -* the program is registered with a source and destination (result) template -* it is passed a packet and a destination template -* it can assume the source packet complies to the program's registerd source template -* it should convert the packet to a packet that will comply to it's registered destination template -* if for some reason a conversion fails, an invalid packet (handle == -1) should be returned - -about type templates: - -* they are hierarchical, with subtypes separated by a '/' character -* they can contain a wildcard '*', meaning that a certain level in the type hierarchy is: - - a don't care value, when the wildcard is used - -> as a destination template in a requested conversion - -> as a source template in a conversion program's specification - - uspecified, when the wildcard is used - -> as a destination template in a conversion program's specification - - - -NOTE: - - a wildcard can't be used in a source template for a conversion request - this assymetry requires there be 2 kinds of template matching mechanisms: - - - source type description (without wildcards) to conversion program source template matching - - destination type description (with wildcards) to conversion program destination template matching - - since a packet's type description cannot have wildcards, a symmetric matching (both sides have - wildcards) can be used for matching. - -*/ - - - -/* - -implementation: - -there are 2 lists with conversion progams: -* the global list, containing all registered programs. -* the cached list, containing all recently used registered programs, or combinations thereof - -if there is no cached, perfectly matching rule, a new one will be created, and added to -the head of the conversion list. - -all conversion methods should keep their hand's off the source packet. it is treated as readonly. -this is to ensure a more flexible operation (i.e. be able to put the conversion at the register_ro -level) this will need a bit more logic in running the conversion program though.. - - -*/ - -#ifndef PDP_TYPE_H -#define PDP_TYPE_H - -/* the conversion method accepts a packet (which is freed) and a destination wildcard - and produces a new packet, or the invalid packet if the conversion failed */ -typedef int (*t_pdp_conversion_method)(int, t_pdp_symbol *); - -/* a conversion program is alist of conversion methods */ -typedef struct _pdp_conversion_program -{ - t_pdp_conversion_method method; // conversion method - struct _pdp_conversion_program *next; // next method in program -} t_pdp_conversion_program; - -/* a conversion has source and dest wildcards, and a conversion program */ -typedef struct _pdp_conversion -{ - t_pdp_symbol *src_pattern; // source type pattern - t_pdp_symbol *dst_pattern; // destination type pattern - t_pdp_conversion_program *program; // the conversion program for this conversion - struct _pdp_conversion *next; // next conversion program record -} t_pdp_conversion; - -/* all symbols are C style */ -#ifdef __cplusplus -extern "C" -{ -#endif - -/* pdp_packet methods */ -t_pdp_symbol *pdp_packet_get_description(int packet); -int pdp_packet_convert_ro(int packet, t_pdp_symbol *dest_pattern); -int pdp_packet_convert_rw(int packet, t_pdp_symbol *dest_pattern); - - -/* pdp_conversion_program methods */ -void pdp_conversion_program_free(t_pdp_conversion_program *program); -t_pdp_conversion_program *pdp_conversion_program_new(t_pdp_conversion_method method, ...); -t_pdp_conversion_program *pdp_conversion_program_copy(t_pdp_conversion_program *program); -void pdp_conversion_program_add(t_pdp_conversion_program *program, t_pdp_conversion_program *tail); - -/* pdp_type (central type object) methods */ -int pdp_type_description_match(t_pdp_symbol *description, t_pdp_symbol *pattern); -void pdp_type_register_conversion (t_pdp_symbol *src_pattern, t_pdp_symbol *dst_pattern, t_pdp_conversion_program *program); -void pdp_type_register_cached_conversion (t_pdp_symbol *src_pattern, t_pdp_symbol *dst_pattern, t_pdp_conversion_program *program); - - //t_pdp_symbol *pdp_type_gendesc(char *desc); //generate a type description (with description list attached) -t_pdp_list *pdp_type_to_list(t_pdp_symbol *type); - -/* pdp's (threadsafe) symbol */ -t_pdp_symbol *pdp_gensym(char *s); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/pdp_types.h b/include/pdp_types.h deleted file mode 100644 index 59fc0d2..0000000 --- a/include/pdp_types.h +++ /dev/null @@ -1,95 +0,0 @@ - -/* - * Pure Data Packet header file. Scalar type definitions. - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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. - * - */ - -/* some typedefs and utility classes */ - -#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; - - -#ifndef __cplusplus -typedef int bool; -#define true 1; -#define false 0; -#endif - - -typedef struct _pdp t_pdp; -typedef void (*t_pdp_packet_method1)(t_pdp *); /* dst */ -typedef void (*t_pdp_packet_method2)(t_pdp *, t_pdp *); /* dst, src */ - - -/* - The pdp symbol type manages the pdp name space. It maps - gives a symbol to something in a certain name space: - - * packet classes - * forth words - * processor instances - * type description lists (for accelerating type matching) - - symbols have an infinite lifespan, so this is also true - for things attached to it. - -*/ - -/* the pdp symbol type */ -typedef struct _pdp_symbol -{ - /* the symbol name */ - char *s_name; - - /* the items this symbol is associated to in different namespaces */ - struct _pdp_forthword_spec *s_word_spec; // a forth word - struct _pdp_list *s_processor; // an atom processor object - struct _pdp_class *s_class; // packet class - struct _pdp_list *s_type; // a type description - - struct _pdp_symbol *s_next; - -} t_pdp_symbol; - -static inline void _pdp_symbol_clear_namespaces(t_pdp_symbol *s) -{ - s->s_word_spec = 0; - s->s_processor = 0; - s->s_class = 0; - s->s_type = 0; -} - - - -/* generic packet subheader */ -//typedef unsigned char t_raw[PDP_SUBHEADER_SIZE]; -typedef unsigned int t_raw; - - -#endif diff --git a/include/pdp_xvideo.h b/include/pdp_xvideo.h deleted file mode 100644 index c395605..0000000 --- a/include/pdp_xvideo.h +++ /dev/null @@ -1,78 +0,0 @@ - -/* - * Pure Data Packet header file: xwindow glue code - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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. - * - */ - - -// x stuff -#include <X11/Xlib.h> -#include <X11/Xatom.h> -#include <X11/extensions/Xv.h> -#include <X11/extensions/Xvlib.h> - -// image formats for communication with the X Server -#define FOURCC_YV12 0x32315659 /* YV12 YUV420P */ -#define FOURCC_YUV2 0x32595559 /* YUV2 YUV422 */ -#define FOURCC_I420 0x30323449 /* I420 Intel Indeo 4 */ - - - -/* xvideo class */ -typedef struct _pdp_xvideo -{ - - t_pdp_xdisplay *xdpy; - t_pdp_xwindow *xwin; - //Display *dpy; - //int screen; - //Window win; - - - - int xv_format; - int xv_port; - - XvImage *xvi; - unsigned char *data; - unsigned int width; - unsigned int height; - int last_encoding; - - int initialized; - -} t_pdp_xvideo; - - -/* cons */ -void pdp_xvideo_init(t_pdp_xvideo *x); -t_pdp_xvideo *pdp_xvideo_new(void); - -/* des */ -void pdp_xvideo_cleanup(t_pdp_xvideo* x); -void pdp_xvideo_free(t_pdp_xvideo* x); - - -/* open an xv port (and create XvImage) */ -int pdp_xvideo_open_on_display(t_pdp_xvideo *x, t_pdp_xdisplay *d); - -/* close xv port (and delete XvImage */ -void pdp_xvideo_close(t_pdp_xvideo* x); - -/* display a packet */ -void pdp_xvideo_display_packet(t_pdp_xvideo *x, t_pdp_xwindow *w, int packet); diff --git a/include/pdp_xwindow.h b/include/pdp_xwindow.h deleted file mode 100644 index f578daf..0000000 --- a/include/pdp_xwindow.h +++ /dev/null @@ -1,147 +0,0 @@ - -/* - * Pure Data Packet header file: xwindow glue code - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * 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. - * - */ - - -// x stuff -#include <X11/Xlib.h> -#include <X11/Xatom.h> -#include <X11/extensions/Xv.h> -#include <X11/extensions/Xvlib.h> -#include "pdp.h" - -// image formats for communication with the X Server -#define FOURCC_YV12 0x32315659 /* YV12 YUV420P */ -#define FOURCC_YUV2 0x32595559 /* YUV2 YUV422 */ -#define FOURCC_I420 0x30323449 /* I420 Intel Indeo 4 */ - -/* TODO: finish this */ - -/* remarks: - this class does not own the display connection */ - - - - -/* x window class */ -typedef struct _pdp_xwindow -{ - Display *dpy; - int screen; - Window win; - GC gc; - Atom WM_DELETE_WINDOW; - - - int winwidth; - int winheight; - int winxoffset; - int winyoffset; - - int initialized; - int autocreate; - t_symbol *dragbutton; - - float cursor; - -} t_pdp_xwindow; - -/* cons */ -void pdp_xwindow_init(t_pdp_xwindow *b); - -/* des */ -void pdp_xwindow_free(t_pdp_xwindow *b); - -/* fullscreen message */ -void pdp_xwindow_fullscreen(t_pdp_xwindow *xwin); - -/* resize window */ -void pdp_xwindow_resize(t_pdp_xwindow *b, int width, int height); - -/* resize window */ -void pdp_xwindow_moveresize(t_pdp_xwindow *b, int xoffset, int yoffset, int width, int height); - -/* fill a tile of the screen */ -void pdp_xwindow_tile(t_pdp_xwindow *xwin, int x_tiles, int y_tiles, int i, int j); - -/* move window */ -void pdp_xwindow_move(t_pdp_xwindow *xwin, int xoffset, int yoffset); - -/* receive events */ -void pdp_xwindow_send_events(t_pdp_xwindow *b, t_outlet *outlet); - -/* enable/disable cursor */ -void pdp_xwindow_cursor(t_pdp_xwindow *b, t_floatarg f); - -/* create xwindow. return code != NULL on succes */ -int pdp_xwindow_create_on_display(t_pdp_xwindow *b, Display *dpy); - -/* close window */ -void pdp_xwindow_close(t_pdp_xwindow *b); - - - -/* xvideo class */ -typedef struct _pdp_xvideo -{ - - Display *dpy; - int screen; - Window win; - - int xv_format; - int xv_port; - - XvImage *xvi; - unsigned char *data; - unsigned int width; - unsigned int height; - int last_encoding; - - int initialized; - -} t_pdp_xvideo; - - -/* cons */ -void pdp_xvideo_init(t_pdp_xvideo *x); - -/* des */ -void pdp_xvideo_free(t_pdp_xvideo* x); - - -/* open an xv port (and create XvImage) */ -int pdp_xvideo_open_on_display(t_pdp_xvideo *x, Display *dpy); - -/* close xv port (and delete XvImage */ -void pdp_xvideo_close(t_pdp_xvideo* x); - -/* display a packet */ -void pdp_xvideo_display_packet(t_pdp_xvideo *x, t_pdp_xwindow *w, int packet); - - -#if 0 -/* xwindow event handler */ -typedef struct _pdp_xwin_handler -{ - t_pdp_xwindow *win; - t_outlet *outlet; -} -#endif diff --git a/include/pwc-ioctl.h b/include/pwc-ioctl.h deleted file mode 100644 index 4977036..0000000 --- a/include/pwc-ioctl.h +++ /dev/null @@ -1,176 +0,0 @@ -#ifndef PWC_IOCTL_H -#define PWC_IOCTL_H - -/* (C) 2001-2002 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 -*/ - -/* This is pwc-ioctl.h belonging to PWC 8.6 */ - -/* - 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 - - - -struct pwc_probe -{ - char name[32]; - int type; -}; - - -/* 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 */ -}; - -/* - 'control_speed' and 'control_delay' are used in automatic whitebalance mode, - and tell the camera how fast it should react to changes in lighting, and - with how much delay. Valid values are 0..65535. -*/ -struct pwc_wb_speed -{ - int control_speed; - int control_delay; - -}; - -/* Used with VIDIOCPWC[SG]LED */ -struct pwc_leds -{ - int led_on; /* Led on-time; range = 0..25000 */ - int led_off; /* Led off-time; range = 0..25000 */ -}; - - - - /* 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) - - - /* This is a probe function; since so many devices are supported, it - becomes difficult to include all the names in programs that want to - check for the enhanced Philips stuff. So in stead, try this PROBE; - it returns a structure with the original name, and the corresponding - Philips type. - To use, fill the structure with zeroes, call PROBE and if that succeeds, - compare the name with that returned from VIDIOCGCAP; they should be the - same. If so, you can be assured it is a Philips (OEM) cam and the type - is valid. - */ -#define VIDIOCPWCPROBE _IOR('v', 199, struct pwc_probe) - - /* 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) - - /* Auto WB speed */ -#define VIDIOCPWCSAWBSPEED _IOW('v', 203, struct pwc_wb_speed) -#define VIDIOCPWCGAWBSPEED _IOR('v', 203, struct pwc_wb_speed) - - /* LEDs on/off/blink; int range 0..65535 */ -#define VIDIOCPWCSLED _IOW('v', 205, struct pwc_leds) -#define VIDIOCPWCGLED _IOR('v', 205, struct pwc_leds) - - /* Contour (sharpness); int < 0 = auto, 0..65536 = fixed */ -#define VIDIOCPWCSCONTOUR _IOW('v', 206, int) -#define VIDIOCPWCGCONTOUR _IOR('v', 206, int) - - /* Backlight compensation; 0 = off, otherwise on */ -#define VIDIOCPWCSBACKLIGHT _IOW('v', 207, int) -#define VIDIOCPWCGBACKLIGHT _IOR('v', 207, int) - - /* Flickerless mode; = 0 off, otherwise on */ -#define VIDIOCPWCSFLICKER _IOW('v', 208, int) -#define VIDIOCPWCGFLICKER _IOR('v', 208, int) - - /* Dynamic noise reduction; 0 off, 3 = high noise reduction */ -#define VIDIOCPWCSDYNNOISE _IOW('v', 209, int) -#define VIDIOCPWCGDYNNOISE _IOR('v', 209, int) - -#endif |