BlinkenArea - GitList
Repositories
Blog
Wiki
libflexipix
Code
Commits
Branches
Tags
Search
Tree:
9ce96e7
Branches
Tags
master
v1.0.0
v1.0.1
v1.0.2
v1.0.3
v1.0.4
v1.0.5
v1.0.6
v1.0.7
v1.0.8
libflexipix
include
intern
types.h
add support for configuring distributor addresses
Stefan Schuermans
commited
9ce96e7
at 2016-12-21 09:47:41
types.h
Blame
History
Raw
/* * FlexiPix library * * Copyright 2010-2011 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 <flexipix/types.h> #include <intern/constants.h> #include <intern/net.h> #include <intern/thread.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 */ struct sockaddr_in addr; /**< network address of distributor */ 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 */ flp_sock_t 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 */ flp_thread_mutex_t mtx; /**< mutex to lock msg_buf of distris */ flp_thread_cond_t cond; /**< condition to wake up thread on new frame */ flp_thread_id_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 */