1 /* 2 # (C) 2008-2009 Elmar Kleijn <elmar_kleijn@hotmail.com> 3 # (C) 2008-2009 Sjoerd Piepenbrink <need4weed@gmail.com> 4 # (C) 2008-2009 Hans de Goede <hdegoede@redhat.com> 5 6 # This program is free software; you can redistribute it and/or modify 7 # it under the terms of the GNU Lesser General Public License as published by 8 # the Free Software Foundation; either version 2.1 of the License, or 9 # (at your option) any later version. 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 Lesser 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, write to the Free Software 18 # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA 19 */ 20 21 #ifndef __LIBV4LPROCESSING_PRIV_H 22 #define __LIBV4LPROCESSING_PRIV_H 23 24 #include "../control/libv4lcontrol.h" 25 #include "../libv4lsyscall-priv.h" 26 27 #define V4L2PROCESSING_UPDATE_RATE 10 28 29 struct v4lprocessing_data { 30 struct v4lcontrol_data *control; 31 int fd; 32 int do_process; 33 int controls_changed; 34 /* True if any of the lookup tables does not contain 35 linear 0-255 */ 36 int lookup_table_active; 37 /* Counts the number of processed frames until a 38 V4L2PROCESSING_UPDATE_RATE overflow happens */ 39 int lookup_table_update_counter; 40 /* RGB/BGR lookup tables */ 41 unsigned char comp1[256]; 42 unsigned char green[256]; 43 unsigned char comp2[256]; 44 /* Filter private data for filters which need it */ 45 /* whitebalance.c data */ 46 int green_avg; 47 int comp1_avg; 48 int comp2_avg; 49 /* gamma.c data */ 50 int last_gamma; 51 unsigned char gamma_table[256]; 52 /* autogain.c data */ 53 int last_gain_correction; 54 }; 55 56 struct v4lprocessing_filter { 57 /* Returns 1 if the filter is active */ 58 int (*active)(struct v4lprocessing_data *data); 59 /* Returns 1 if any of the lookup tables was changed */ 60 int (*calculate_lookup_tables)(struct v4lprocessing_data *data, 61 unsigned char *buf, const struct v4l2_format *fmt); 62 }; 63 64 extern const struct v4lprocessing_filter whitebalance_filter; 65 extern const struct v4lprocessing_filter autogain_filter; 66 extern const struct v4lprocessing_filter gamma_filter; 67 68 #endif 69