e2a21a2a7d8bad7a082a53134837a15c1bea740d
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

1) /*
2)  * FlexiPix library
Stefan Schuermans v1.0.6

Stefan Schuermans authored 13 years ago

3)  * !version: 1.0.6! !date: 2010-12-30!
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

4)  *
5)  * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6)  *
7)  * This program is free software: you can redistribute it and/or modify
8)  * it under the terms of the GNU General Public License as published by
9)  * the Free Software Foundation, version 3 of the License.
10)  *
11)  *
12)  * This program is distributed in the hope that it will be useful,
13)  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14)  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15)  * GNU General Public License for more details.
16)  *
17)  * You should have received a copy of the GNU Lesser General Public License
18)  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19)  */
20) 
21) #ifndef FLP_TYPES_H
22) #define FLP_TYPES_H
23) 
24) #include <flexipix/types.h>
25) #include <intern/constants.h>
26) #include <intern/net.h>
Stefan Schuermans v1.0.6

Stefan Schuermans authored 13 years ago

27) #include <intern/thread.h>
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

28) 
29) /** mapping information
30)  *
31)  *  values of channels are mapped according to following formula:
32)  *  <display value> := <base> + <factor> * <original value> ^ (1 / <gamma>)
33)  */
34) typedef struct flp_mapping_s {
35)   double base;         /**< base constant for brightness correction */
36)   double factor;       /**< factor for contrast modification */
37)   double gamma;        /**< gamma correction factor, must be > 0.0 */
38)   flp_u8_t table[256]; /**< precalculated mapping table,
39)                         *   index: source image value
40)                         *   value: display value */
41) } flp_mapping_t;
42) 
43) /** information about a pixel */
44) typedef struct flp_pixel_s {
45)   int x, y; /**< coordinates of pixel in movie (-1 if unknown yet) */
46) } flp_pixel_t;
47) 
48) /** information about a distributor */
49) typedef struct flp_distri_s {
50)   unsigned int distri;      /**< number of this distributor */
51)   unsigned int output_cnt;  /**< number of outputs of this distributor */
52)   unsigned int pixel_cnt;   /**< number of pixels connected to every output */
53)   flp_mapping_t mapping[3]; /**< mapping information for red, green
54)                              *   and blue channel */
55)   flp_pixel_t *p_pixels;    /**< array with information about pixels
56)                              *   of this distributor,
57)                              *   index = output * pixel_cnt + pixel,
58)                              *   malloc-ed */
59)   unsigned int msg_len;     /**< size of a message to send to distributor */
60)   flp_u8_t *p_msg_buf;      /**< buffer for current message to send
61)                              *   to distributor,
62)                              *   malloc-ed */
63) } flp_distri_t;
64) 
65) /** information about a display */
66) struct flp_display_s {
67)   struct sockaddr_in bind_addr;       /**< local network address to bind to */
68)   flp_pixel_t size;                   /**< size of display */
69)   flp_distri_t *distri_ptrs
70)                 [FLP_DISTRI_MAX_CNT]; /**< information about distributors,
71)                                        *   distributors are malloc-ed */
72)   unsigned int distri_cnt;            /**< total number of distris */
73)   unsigned int output_cnt;            /**< total number of outputs */
74)   unsigned long pixel_cnt;            /**< total number of pixels */
Stefan Schuermans v1.0.6

Stefan Schuermans authored 13 years ago

75)   flp_sock_t sock;                    /**< socket to send UDP packets */
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

76) };
77) 
78) /** a displayer
79)  *
80)  * sends pictures to a display whenever the maximum interval expired
81)  */
82) struct flp_displayer_s {
83)   flp_display_t *p_display; /**< display managed by this displayer */
Stefan Schuermans v1.0.6

Stefan Schuermans authored 13 years ago

84)   flp_thread_mutex_t mtx;   /**< mutex to lock msg_buf of distris */
85)   flp_thread_cond_t cond;   /**< condition to wake up thread on new frame */
86)   flp_thread_id_t tid;      /**< id of output thread */