aa3270aa371083e5c3c065a58b1551bfea58b4db
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

1) /*
2)  * FlexiPix library
3)  *
Stefan Schuermans removed version information...

Stefan Schuermans authored 13 years ago

4)  * Copyright 2010-2011 Stefan Schuermans <stefan schuermans info>
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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