apps/autoexposure/autoexposure.h

Go to the documentation of this file.
00001 /*!***************************************************************************
00002 *! FILE NAME  : autoexposure.h
00003 *! DESCRIPTION: 
00004 *! Copyright (C) 2008 Elphel, Inc.
00005 *! -----------------------------------------------------------------------------**
00006 *!  This program is free software: you can redistribute it and/or modify
00007 *!  it under the terms of the GNU General Public License as published by
00008 *!  the Free Software Foundation, either version 3 of the License, or
00009 *!  (at your option) any later version.
00010 *!
00011 *!  This program is distributed in the hope that it will be useful,
00012 *!  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 *!  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 *!  GNU General Public License for more details.
00015 *!
00016 *!  You should have received a copy of the GNU General Public License
00017 *!  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018 *! -----------------------------------------------------------------------------**
00019 *!
00020 *!  $Log: autoexposure.h,v $
00021 *!  Revision 1.1.1.1  2008/11/27 20:04:01  elphel
00022 *!
00023 *!
00024 *!  Revision 1.1  2008/11/15 23:08:24  elphel
00025 *!  8.0.alpha17 - split autoexposure source file
00026 *!
00027 */ 
00028 #ifndef __H_AUTOEXPOSURE__
00029 #define __H_AUTOEXPOSURE__
00030 
00031 #include <unistd.h>
00032 #include <stdio.h>
00033 #include <stdlib.h>
00034 #include <signal.h>
00035 #include <fcntl.h>
00036 #include <errno.h>
00037 #include <sys/types.h>
00038 #include <sys/socket.h>
00039 #include <sys/stat.h>
00040 //#include <ctype.h>
00041 //#include <getopt.h>
00042 #include <time.h>
00043 #include <string.h>
00044 #include <syslog.h>
00045 
00046 #include <netinet/in.h>
00047 #include <sys/mman.h>      /* mmap */
00048 #include <sys/ioctl.h>
00049 
00050 #include <asm/elphel/c313a.h>
00051 #include <asm/elphel/exifa.h>
00052 #include <asm/elphel/ext353.h>
00053 #include <asm/byteorder.h>
00054 
00055 #include "aexp_utils.h"
00056 #include "aexp_corr.h"
00057 #include "white_balance.h"
00058 #include "hdr_control.h"
00059 #include "globalsinit.h"
00060 //#if ELPHEL_DEBUG
00061  #define THIS_DEBUG 1
00062 //#else
00063 // #define THIS_DEBUG 0
00064 //#endif
00065 //#define ELP_FERR(x) printf(stderr,"%s:%d:%s: ERROR ",__FILE__,__LINE__,__FUNCTION__); x
00066 #if THIS_DEBUG
00067   #define MDF0(x) { if (autoexposure_debug & (1 << 0)) {fprintf(stderr,"%s:%d:%s: ",__FILE__,__LINE__,__FUNCTION__);x;} }
00068   #define MDF1(x) { if (autoexposure_debug & (1 << 1)) {fprintf(stderr,"%s:%d:%s: ",__FILE__,__LINE__,__FUNCTION__);x;} }
00069   #define MDF2(x) { if (autoexposure_debug & (1 << 2)) {fprintf(stderr,"%s:%d:%s: ",__FILE__,__LINE__,__FUNCTION__);x;} }
00070 //  #define MDF2(x)
00071   #define MDF3(x) { if (autoexposure_debug & (1 << 3)) {fprintf(stderr,"%s:%d:%s: ",__FILE__,__LINE__,__FUNCTION__);x;} }
00072 //  #define MDF3(x)
00073   #define MDF4(x) { if (autoexposure_debug & (1 << 4)) {fprintf(stderr,"%s:%d:%s: ",__FILE__,__LINE__,__FUNCTION__);x;} }
00074   #define MDF5(x) { if (autoexposure_debug & (1 << 5)) {fprintf(stderr,"%s:%d:%s: ",__FILE__,__LINE__,__FUNCTION__);x;} }
00075   #define MDF6(x) { if (autoexposure_debug & (1 << 6)) {fprintf(stderr,"%s:%d:%s: ",__FILE__,__LINE__,__FUNCTION__);x;} }
00076   #define MDF7(x) { if (autoexposure_debug & (1 << 7)) {fprintf(stderr,"%s:%d:%s: ",__FILE__,__LINE__,__FUNCTION__);x;} }
00077 #else
00078   #define MDF0(x)
00079   #define MDF1(x)
00080   #define MDF2(x)
00081   #define MDF3(x)
00082   #define MDF4(x)
00083   #define MDF5(x)
00084   #define MDF6(x)
00085   #define MDF7(x)
00086 #endif
00087 
00088 #define START_SKIP_FRAMES 8 // don't try autoexposure until this number of frames after startup
00089 #define get_imageParamsThis(x) ( framePars[this_frame & PARS_FRAMES_MASK].pars[x])
00090 #define min(x,y) ((x<y)?x:y)
00091 
00092 //#define get_imageParamsThis(x) ( framePars[this_frame & PARS_FRAMES_MASK].pars[x])
00093 #define RECALIBRATE_AHEAD           3 // Darken frame 3 ahead of current to measure histograms
00094 #define EXPOS_AHEAD                 3 // minimal frames ahead of the current to set VEXPOS
00095 #define DEFAULT_AE_PERIOD_CHANGE    4
00096 #define DEFAULT_AE_PERIOD_NOCHANGE  1
00097 #define DEFAULT_WB_PERIOD_CHANGE   16
00098 #define DEFAULT_WB_PERIOD_NOCHANGE  4
00099 #define RECALIBRATE_AFTER           2 // number of dim frames
00100 #define DEFAULT_BLACK_CALIB     0xa00
00101 #define HDR_PATTERN1_8          0xaa
00102 #define HDR_PATTERN2_8          0x66
00103 #define HDR_PATTERN1  (HDR_PATTERN1_8 | (HDR_PATTERN1_8 << 8) | (HDR_PATTERN1_8 << 16) | (HDR_PATTERN1_8 << 24))
00104 #define HDR_PATTERN2  (HDR_PATTERN2_8 | (HDR_PATTERN2_8 << 8) | (HDR_PATTERN2_8 << 16) | (HDR_PATTERN2_8 << 24))
00105 #define DEFAULT_WB_WHITELEV   0xfae1 // 98%
00106 #define DEFAULT_WB_WHITEFRAC  0x028f // 1%
00107 #define PERCENTILE_SHIFT 16
00108 #define PERCENTILE_1 (1 << PERCENTILE_SHIFT)
00109 
00110 #endif

Generated on Fri Nov 28 00:06:21 2008 for elphel by  doxygen 1.5.1