apps/sctl/sctl.cgi.cpp File Reference

#include <iostream>
#include <string>
#include <map>
#include <list>
#include <fstream>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <syslog.h>
#include <sys/socket.h>
#include <sys/param.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <net/if.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <linux/if_ether.h>
#include <sched.h>

Include dependency graph for sctl.cgi.cpp:

Go to the source code of this file.

Defines

#define _KILLALL   "/usr/bin/killall"
#define _FPCF   "/usr/local/bin/fpcf"
#define _STR   "/usr/local/bin/str"
#define _CONF_RUN   "/var/state/streamer.conf"
#define _CONF   "/etc/streamer.conf"
#define _STATUS_XML   "/var/state/streamer.xml"
#define HEADER_TEXT   0x00
#define HEADER_XML   0x01
#define STREAMER_ELF   "str"
#define STREAMER_LOCK   "/dev/stream"
#define DEFAULT_PORT   "20000"
#define DEFAULT_ADDR   "232.0.0.1"
#define CMOSCAM_IOCTYPE   124
#define IO_CCAM_JPEG   0x08

Functions

void header (int type)
bool parse_string (const string &str, char delimiter, string &left, string &right)
bool streamer_start (map< string, string >)
bool streamer_stop (void)
void stream_status (void)
bool conf_save (map< string, string >)
void conf_load (ostream &stream)
string get_self_ip (string)
void stream_status_to_file (map< string, string > opts)
int main (int argc, char *argv[])
bool streamer_is_run (void)
bool run_daemon (string prog, list< string > args)
void stop_compressor (void)


Define Documentation

#define _CONF   "/etc/streamer.conf"

Definition at line 31 of file sctl.cgi.cpp.

Referenced by conf_load().

#define _CONF_RUN   "/var/state/streamer.conf"

Definition at line 30 of file sctl.cgi.cpp.

Referenced by conf_save().

#define _FPCF   "/usr/local/bin/fpcf"

Definition at line 28 of file sctl.cgi.cpp.

#define _KILLALL   "/usr/bin/killall"

Definition at line 27 of file sctl.cgi.cpp.

Referenced by streamer_stop().

#define _STATUS_XML   "/var/state/streamer.xml"

Definition at line 32 of file sctl.cgi.cpp.

Referenced by stream_status(), and stream_status_to_file().

#define _STR   "/usr/local/bin/str"

Definition at line 29 of file sctl.cgi.cpp.

Referenced by streamer_start().

#define CMOSCAM_IOCTYPE   124

Definition at line 239 of file sctl.cgi.cpp.

Referenced by grab_and_send(), i2c_ioctl(), main(), and stop_compressor().

#define DEFAULT_ADDR   "232.0.0.1"

Definition at line 41 of file sctl.cgi.cpp.

Referenced by conf_save().

#define DEFAULT_PORT   "20000"

Definition at line 40 of file sctl.cgi.cpp.

Referenced by conf_save().

#define HEADER_TEXT   0x00

Definition at line 34 of file sctl.cgi.cpp.

Referenced by header(), and main().

#define HEADER_XML   0x01

Definition at line 35 of file sctl.cgi.cpp.

Referenced by header(), and main().

#define IO_CCAM_JPEG   0x08

Definition at line 240 of file sctl.cgi.cpp.

Referenced by grab_and_send(), main(), and stop_compressor().

#define STREAMER_ELF   "str"

Definition at line 37 of file sctl.cgi.cpp.

#define STREAMER_LOCK   "/dev/stream"

Definition at line 38 of file sctl.cgi.cpp.

Referenced by streamer_is_run().


Function Documentation

void conf_load ( ostream &  stream  ) 

Definition at line 319 of file sctl.cgi.cpp.

References _CONF, n, and parse_string().

bool conf_save ( map< string, string >   ) 

Definition at line 280 of file sctl.cgi.cpp.

References _CONF_RUN, DEFAULT_ADDR, DEFAULT_PORT, and t.

Referenced by streamer_start().

string get_self_ip ( string   ) 

Definition at line 399 of file sctl.cgi.cpp.

References fd, and memset().

Referenced by stream_status(), and stream_status_to_file().

void header ( int  type  ) 

Definition at line 43 of file sctl.cgi.cpp.

References HEADER_TEXT, and HEADER_XML.

int main ( int  argc,
char *  argv[] 
)

*************************************************************************** ! FILE NAME : autoexposure.c ! DESCRIPTION: Daemon to adjust camera exposure and white balance ! Copyright (C) 2008 Elphel, Inc. ! -----------------------------------------------------------------------------** ! 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, either version 3 of the License, or ! (at your option) any later version. ! ! 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 General Public License ! along with this program. If not, see <http://www.gnu.org/licenses/>. ! -----------------------------------------------------------------------------** ! !

Log
autoexposure.c,v
! Revision 1.1.1.1 2008/11/27 20:04:01 elphel ! ! ! Revision 1.16 2008/11/18 19:30:16 elphel ! Added initialization of the "next" frame - otherwise it wait _very_ long if the camera frame number is reset ! ! Revision 1.15 2008/11/15 23:08:24 elphel ! 8.0.alpha17 - split autoexposure source file ! ! Revision 1.14 2008/11/15 07:05:38 elphel ! implemented analog gain control (in addition to gammas) while while balancing ! ! Revision 1.13 2008/11/15 03:10:13 elphel ! Some parameters renamed, reassigned. ! ! Revision 1.12 2008/11/14 07:13:32 elphel ! Added gammaReverse() and gammaDirect() functions, TODO lists, bug fixes ! ! Revision 1.11 2008/11/14 01:01:59 elphel ! cleared debug output ! ! Revision 1.10 2008/11/13 05:40:45 elphel ! 8.0.alpha16 - modified histogram storage, profiling ! ! Revision 1.9 2008/11/08 05:52:21 elphel ! debug feature ! ! Revision 1.8 2008/11/04 17:40:34 elphel ! comment typos ! ! Revision 1.7 2008/11/02 00:32:35 elphel ! added TODO ! ! Revision 1.6 2008/10/31 18:26:32 elphel ! Adding support for constants like SENSOR_REGS32 (defined constant plus 32 to simplify referencing sensor registers from PHP ! ! Revision 1.5 2008/10/29 04:18:28 elphel ! v.8.0.alpha10 made a separate structure for global parameters (not related to particular frames in a frame queue) ! ! Revision 1.4 2008/10/28 07:05:12 elphel ! implemented white balance, HDR mode (1/1 and 2/2) ! ! Revision 1.3 2008/10/26 05:55:38 elphel ! snapshot ! ! Revision 1.2 2008/10/25 19:49:15 elphel ! 8.0.alpha8 - added autoexposure to the installation ! ! Revision 1.1 2008/10/24 00:34:12 elphel ! initial release !

array of histogram

colors 1 - r, 2 - g1, 4 - g2, 8 - b, 16 - w, 32 - g1+g2

enable requesting histogram calculation for the specified frame (0 - use/wait what available)

Sample from camvc.html http://192.168.0.9/pnghist.cgi?sqrt=1&scale=5&average=5&height=128&fillz=1&linterpz=0&draw=2&colors=41 FIXME: Some bump on low red - what is it?

instead of autoexp_fd

now try to mmap

Now find the index of the most recently available histogram (maybe will wait a little if it is not yet available for the current frame - use previous?)

wait for all histograms, not just Y (G1)

forward and cumulative histograms are needed

disable requesting histogram for the specified frame, rely on the available ones

request histograms for the previous frame

Ignore missing histograms here

cumul_hist_g[255] - total number of pixels for color G1

linear interpolation - also for high digital gains (near black with low gammas)

apply running average (if any)

calculate white if needed

calculate green if needed

now scale data

Definition at line 77 of file sctl.cgi.cpp.

References cmd, header, HEADER_TEXT, HEADER_XML, method, n, parse_string(), query, stream_status(), stream_status_to_file(), streamer_start(), streamer_stop(), and uri.

bool parse_string ( const string &  str,
char  delimiter,
string &  left,
string &  right 
)

Definition at line 53 of file sctl.cgi.cpp.

Referenced by conf_load(), main(), and parse_arg().

bool run_daemon ( string  prog,
list< string >  args 
)

Definition at line 141 of file sctl.cgi.cpp.

References a, malloc(), stderr, stdout, and streamer_is_run().

Referenced by streamer_start(), and streamer_stop().

void stop_compressor ( void   ) 

Definition at line 241 of file sctl.cgi.cpp.

References CMOSCAM_IOCTYPE, and IO_CCAM_JPEG.

Referenced by streamer_stop().

void stream_status ( void   ) 

Definition at line 370 of file sctl.cgi.cpp.

References _STATUS_XML, get_self_ip(), and streamer_is_run().

Referenced by main().

void stream_status_to_file ( map< string, string >  opts  ) 

Definition at line 343 of file sctl.cgi.cpp.

References _STATUS_XML, get_self_ip(), and t.

Referenced by main().

bool streamer_is_run ( void   ) 

Definition at line 133 of file sctl.cgi.cpp.

References fd, and STREAMER_LOCK.

Referenced by run_daemon(), stream_status(), streamer_start(), and streamer_stop().

bool streamer_start ( map< string, string >   ) 

Definition at line 186 of file sctl.cgi.cpp.

References _STR, conf_save(), run_daemon(), streamer_is_run(), and t.

Referenced by main().

bool streamer_stop ( void   ) 

Definition at line 247 of file sctl.cgi.cpp.

References _KILLALL, run_daemon(), stop_compressor(), and streamer_is_run().

Referenced by main().


Generated on Fri Nov 28 00:07:22 2008 for elphel by  doxygen 1.5.1