BlinkenArea - GitList
Repositories
Blog
Wiki
libetherpix
Code
Commits
Branches
Tags
Search
Tree:
73d1d1b
Branches
Tags
master
libetherpix
include
intern
types.h
v1.0.4
Stefan Schuermans
commited
73d1d1b
at 2011-09-11 17:16:57
types.h
Blame
History
Raw
/* * FlexiPix library * !version: 1.0.4! !date: 2010-09-19! * * Copyright 2010 Stefan Schuermans <stefan schuermans info> * * 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, version 3 of the License. * * * 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 Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FLP_TYPES_H #define FLP_TYPES_H #include <pthread.h> #include <flexipix/types.h> #include <intern/constants.h> #include <intern/net.h> /** mapping information * * values of channels are mapped according to following formula: * <display value> := <base> + <factor> * <original value> ^ (1 / <gamma>) */ typedef struct flp_mapping_s { double base; /**< base constant for brightness correction */ double factor; /**< factor for contrast modification */ double gamma; /**< gamma correction factor, must be > 0.0 */ flp_u8_t table[256]; /**< precalculated mapping table, * index: source image value * value: display value */ } flp_mapping_t; /** information about a pixel */ typedef struct flp_pixel_s { int x, y; /**< coordinates of pixel in movie (-1 if unknown yet) */ } flp_pixel_t; /** information about a distributor */ typedef struct flp_distri_s { unsigned int distri; /**< number of this distributor */ unsigned int output_cnt; /**< number of outputs of this distributor */ unsigned int pixel_cnt; /**< number of pixels connected to every output */ flp_mapping_t mapping[3]; /**< mapping information for red, green * and blue channel */ flp_pixel_t *p_pixels; /**< array with information about pixels * of this distributor, * index = output * pixel_cnt + pixel, * malloc-ed */ unsigned int msg_len; /**< size of a message to send to distributor */ flp_u8_t *p_msg_buf; /**< buffer for current message to send * to distributor, * malloc-ed */ } flp_distri_t; /** information about a display */ struct flp_display_s { struct sockaddr_in bind_addr; /**< local network address to bind to */ flp_pixel_t size; /**< size of display */ flp_distri_t *distri_ptrs [FLP_DISTRI_MAX_CNT]; /**< information about distributors, * distributors are malloc-ed */ unsigned int distri_cnt; /**< total number of distris */ unsigned int output_cnt; /**< total number of outputs */ unsigned long pixel_cnt; /**< total number of pixels */ int sock; /**< socket to send UDP packets */ }; /** a displayer * * sends pictures to a display whenever the maximum interval expired */ struct flp_displayer_s { flp_display_t *p_display; /**< display managed by this displayer */ pthread_mutex_t mtx; /**< mutex to lock msg_buf of distris */ pthread_cond_t cond; /**< condition to wake up thread on new frame */ pthread_t tid; /**< id of output thread */ volatile int active; /**< if to output to distris */ volatile int send; /**< set to force immediate sending to distris */ volatile int end; /**< set to signal end to thread */ }; #endif /* #ifndef FLP_TYPES_H */