BlinkenArea - GitList
Repositories
Blog
Wiki
libetherpix
Code
Commits
Branches
Tags
Search
Tree:
a3a92ab
Branches
Tags
master
libetherpix
include
intern
types.h
rename "FlexiPix" to "EtherPix"
Stefan Schuermans
commited
a3a92ab
at 2017-05-20 16:55:59
types.h
Blame
History
Raw
/* * EtherPix 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 ETP_TYPES_H #define ETP_TYPES_H #include <etherpix/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 etp_mapping_s { double base; /**< base constant for brightness correction */ double factor; /**< factor for contrast modification */ double gamma; /**< gamma correction factor, must be > 0.0 */ etp_u8_t table[256]; /**< precalculated mapping table, * index: source image value * value: display value */ } etp_mapping_t; /** information about a pixel */ typedef struct etp_pixel_s { int x, y; /**< coordinates of pixel in movie (-1 if unknown yet) */ } etp_pixel_t; /** information about a distributor */ typedef struct etp_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 */ etp_mapping_t mapping[3]; /**< mapping information for red, green * and blue channel */ etp_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 */ etp_u8_t *p_msg_buf; /**< buffer for current message to send * to distributor, * malloc-ed */ } etp_distri_t; /** information about a display */ struct etp_display_s { struct sockaddr_in bind_addr; /**< local network address to bind to */ etp_pixel_t size; /**< size of display */ etp_distri_t *distri_ptrs [ETP_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 */ etp_sock_t sock; /**< socket to send UDP packets */ }; /** a displayer * * sends pictures to a display whenever the maximum interval expired */ struct etp_displayer_s { etp_display_t *p_display; /**< display managed by this displayer */ etp_thread_mutex_t mtx; /**< mutex to lock msg_buf of distris */ etp_thread_cond_t cond; /**< condition to wake up thread on new frame */ etp_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 ETP_TYPES_H */