apps/ccam/ccam.c File Reference

#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
#include <sys/time.h>
#include <time.h>
#include <syslog.h>
#include <sys/mman.h>
#include <string.h>
#include <errno.h>
#include <math.h>
#include "imageaccess.h"
#include "dma2jpeg.h"
#include "dma2bmp.h"
#include "lasercalc.h"
#include "vrml303.h"
#include "qtime.h"
#include <asm/elphel/autoexp.h>
#include <asm/elphel/hist.h>
#include <asm/elphel/fpgaconfa.h>
#include <asm/elphel/c313a.h>
#include <asm/elphel/ext353.h>
#include <netinet/ip.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <poll.h>
#include <pthread.h>
#include <asm/atomic.h>

Include dependency graph for ccam.c:

Go to the source code of this file.

Data Structures

struct  exif_desc_t
struct  trig_desc_t
struct  prof_t
struct  key_value

Defines

#define SLOG   "ccam.cgi"
#define USE_MMAP
#define SOCKETBUF_SIZE   4096
#define D(x)
#define DD(x)
#define D5(x)
#define D6(x)
#define QRY_MAXPARAMS   64
#define MAX_TIMEOUT   5
#define SENSOR_W   1280
#define SENSOR_H   1024
#define HTML_SENSOR_JS   1
#define HTML_SENSOR_HTML   2
#define HTML_BEAM_JS   3
#define HTML_BEAM_HTML   4
#define HTML_STATE_JS   5
#define HTML_STATE_HTML   6
#define HTML_ACQUIRE   7
#define HTML_RESET   8
#define XML_SENSOR   10
#define XML_BEAM   11
#define XML_STATE   12
#define XML_ACQUIRE   13
#define XML_RESET   14
#define HIST_SIZE   256 * 4 * 4
#define GAMMA_SIZE   256 * 4 * 2
#define MAP_OPTIONS   MAP_SHARED
#define USEHTTP10(x)
#define MAXIMAGEWIDTH   2048
#define USEBUFFERSIZE   1024
#define MAXIMAGEWIDTH   2048
#define CCAM_SPARE_MEM   100000
#define CCAM_MAX_NUM_FRAMES   16384
#define STREAMER_CONF_RUN   "/var/state/streamer.conf";
#define STREAMER_CONF_STOP   "/etc/streamer.conf";
#define GAMMA_START   0x400
#define HIST_LEN   256 * 4 * 4
#define GAMMA_LEN   256 * 4 * 2

Functions

void * bcast_trigger_f (void *ptr)
void prof_start (void)
void prof_time (const char *m)
void prof_next (const char *m)
void bcast_trigger (void)
int process_get (int data_fd, unsigned long filesize, char *data_mem, long *filepos)
int hexdigit (char c)
int unescape (char *s, int l)
int accumData (int ifd, const char *bufFileName)
int frameShr (const char *fn, int shft)
int frameSub (const char *sfn, const char *dfn)
int processCal (const char *wfn, const char *bfn, const char *cfn)
int imageCorr (int ImageWidth, const char *dfn, const char *bfn, const char *cfn, const char *ImgFileName)
int send_buf_image (int ImageWidth, int ImageHeight, int Quality, int Contrast, int Color, int bayerOrient, int Depth, const char *pseudo, const char *ImgFileName, const char *bufFileName)
int send_immed_image (int ImageWidth, int ImageHeight, int Quality, int Contrast, int Color, int bayerOrient, int Depth, const char *pseudo, const char *ImgFileName)
int parseQuery (struct key_value *params, char *qry)
char * paramValue (struct key_value *params, char *skey)
int optionPresent (struct key_value *params, char *skey, char c)
void printDocumentLine (const char *name, const char *value, int format)
int send_html_data (const char *devfn, const char *dmafn, int mode, int refreshPeriod, const char *onLoad, const char *javaScript)
int set_fpga_time (int seconds, int useconds)
int processImage (struct key_value *params, const char *ImgFileName, const char *bufFileName, const char *pc_par, int iq_par, int gd_par, int html_par, int htmlr_par, const char *htmll_par, const char *htmlj_par, int vrml_par, int vrmlm_par, int vrmld_par, int vrmlb_par, int vrmli_par, int vrmlf_par, int vrmll_par, int vrmlo_par, int vrmlz_par)
int calcWhiteBalance (int thrsh, int min_pixels, float diffGains[3])
int programFPN (const char *backgroundFileName, const char *calibrationFileName, const char *FPNFileName, int fpns, int fpnm, int fat_zero)
int send_jpegfile_image (const char *ImgFileName)
int send_hardware_image (const char *ImgFileName, int cache)
int send_quicktime (const char *ImgFileName, const char *qtSourceFileName, const char *headerFileName, int nrep, int safe, int sample_dur)
int send_quicktime_clip (const char *ImgFileName, const char *qtSourceFileName, const char *headerFileName, int qcmd, int tscale)
void printStreamerParameters (int fmode)
int setCamPars (int devfd, int n_bf, char *cp, char *vp)
int sendLastFrame (int cache)
void debug_write (char *filename, int linenum, const char *dbgstr)
int main (int argc, char *argv[])

Variables

char ** environ
exif_desc_t exif_desc
trig_desc_t trig_desc
atomic_t accept_trigger
prof_t prof
key_value gparams [QRY_MAXPARAMS+1]
autoexp_t autoexp
static char * error304


Define Documentation

#define CCAM_MAX_NUM_FRAMES   16384

Definition at line 1255 of file ccam.c.

Referenced by main(), and send_quicktime_clip().

#define CCAM_SPARE_MEM   100000

Definition at line 1254 of file ccam.c.

#define D ( x   ) 

Definition at line 272 of file ccam.c.

#define D5 ( x   ) 

Definition at line 276 of file ccam.c.

#define D6 ( x   ) 

Definition at line 278 of file ccam.c.

#define DD ( x   ) 

Definition at line 273 of file ccam.c.

#define GAMMA_LEN   256 * 4 * 2

Definition at line 2082 of file ccam.c.

Referenced by calcWhiteBalance(), and PHP_FUNCTION().

#define GAMMA_SIZE   256 * 4 * 2

Definition at line 302 of file ccam.c.

#define GAMMA_START   0x400

Definition at line 1806 of file ccam.c.

#define HIST_LEN   256 * 4 * 4

Definition at line 2081 of file ccam.c.

Referenced by calcWhiteBalance(), and PHP_FUNCTION().

#define HIST_SIZE   256 * 4 * 4

Definition at line 301 of file ccam.c.

#define HTML_ACQUIRE   7

Definition at line 294 of file ccam.c.

Referenced by main(), and send_html_data().

#define HTML_BEAM_HTML   4

Definition at line 291 of file ccam.c.

Referenced by send_html_data().

#define HTML_BEAM_JS   3

Definition at line 290 of file ccam.c.

Referenced by send_html_data().

#define HTML_RESET   8

Definition at line 295 of file ccam.c.

Referenced by main(), and send_html_data().

#define HTML_SENSOR_HTML   2

Definition at line 289 of file ccam.c.

Referenced by send_html_data().

#define HTML_SENSOR_JS   1

Definition at line 288 of file ccam.c.

Referenced by send_html_data().

#define HTML_STATE_HTML   6

Definition at line 293 of file ccam.c.

Referenced by send_html_data().

#define HTML_STATE_JS   5

Definition at line 292 of file ccam.c.

Referenced by send_html_data().

#define MAP_OPTIONS   MAP_SHARED

Definition at line 305 of file ccam.c.

#define MAX_TIMEOUT   5

Definition at line 282 of file ccam.c.

Referenced by send_buf_image(), and send_jpegfile_image().

#define MAXIMAGEWIDTH   2048

Definition at line 702 of file ccam.c.

#define MAXIMAGEWIDTH   2048

Definition at line 702 of file ccam.c.

Referenced by imageCorr().

#define QRY_MAXPARAMS   64

Definition at line 281 of file ccam.c.

#define SENSOR_H   1024

Definition at line 284 of file ccam.c.

#define SENSOR_W   1280

Definition at line 283 of file ccam.c.

#define SLOG   "ccam.cgi"

*************************************************************************** ! File: ccam.c ! Copyright (C) 2002-2007 Elphel, Inc ! -----------------------------------------------------------------------------** ! ! This program is free software: you can redistribute it and/or modifyF ! 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
ccam.c,v
! Revision 1.5 2008/04/20 06:51:28 elphel ! comment-question ! ! Revision 1.4 2008/04/16 07:01:56 elphel ! replaced MAP_OPTIONS to fight "Eeeks!" ! ! Revision 1.3 2008/03/20 22:23:54 elphel ! added "opt="a" - async mode (external triggering) ! ! Revision 1.2 2008/01/09 10:22:47 elphel ! fixed uninitialized variable in white balance function ! ! Revision 1.1.1.1 2007/10/02 21:09:15 elphel ! This is a fresh tree based on elphel353-2.10 ! ! Revision 1.17 2007/09/30 03:22:47 elphel ! edited comments. Needs support of acquiring into circbuf w/o pointer reset (was disabled because of the broken driver) ! ! Revision 1.16 2007/09/29 16:19:15 elphel ! removed IOCTL access to /dev/circbuf ! ! Revision 1.15 2007/09/23 06:41:43 elphel ! added more optional (compile-time) debug information ! ! Revision 1.14 2007/09/19 00:34:59 elphel ! Support for new parameters for fps control ! ! Revision 1.13 2007/09/18 06:07:10 elphel ! modified to support combined P_FLIP (instead of P_FLIPH, P_FLIPV), support for P_FPSLM (fps limit mode) ! ! Revision 1.12 2007/09/03 08:14:52 spectr_rain ! *** empty log message *** ! ! Revision 1.11 2007/08/31 21:46:16 spectr_rain ! *** empty log message *** ! ! Revision 1.9 2007/08/28 21:26:45 spectr_rain ! mmap for JPEG files ! ! Revision 1.8 2007/08/27 04:46:16 elphel ! Restoring JP4 format (option "j" in ccam.cgi "opt=" parameter). FPGA code for this mode is not fixed yet (but it does something different than in modes color & mono). ! ! Revision 1.7 2007/08/17 12:09:28 spectr_rain ! switch to GPL3 license ! ! Revision 1.6 2007/08/15 16:37:51 spectr_rain ! test for option 'o' ! ! Revision 1.5 2007/08/03 15:15:22 spectr_rain ! *** empty log message *** ! ! Revision 1.4 2007/08/01 15:10:36 spectr_rain ! ccam.c ! ! Revision 1.2 2007/06/25 18:20:19 spectr_rain ! *** empty log message *** ! ! Revision 1.2 2007/04/16 17:27:53 spectr_rain ! *** empty log message *** ! ! Revision 1.1.1.1 2007/02/23 10:11:49 elphel ! initial import into CVS ! ! Revision 1.6 2007/01/08 17:18:36 spectr_rain ! *** empty log message *** ! ! Revision 1.5 2006/12/01 00:17:48 spectr_rain ! *** empty log message *** ! ! Revision 1.4 2006/09/15 17:17:48 spectr_rain ! add parameter ve ! ! Revision 1.3 2006/07/17 12:23:43 spectr_rain ! comment zoran gain parameters ! ! Revision 1.2 2006/07/12 07:13:59 elphel ! fixed "resetsensor" for new addresses for 333 ! ! Revision 1.1.1.1 2006/07/11 19:15:05 spectr_rain ! unwork with less than 5MPx Micron sensor, initial branch ! ! Revision 1.33 2006/04/16 00:18:08 elphel ! added timestamps to frame data in circbuf (streamers are not yet updated) ! ! Revision 1.32 2006/03/26 01:55:30 elphel ! made ccamftp.sh script support ED=, EN=,SD=,SN= parameters, modified default date/night gain and exposure thresholds ! ! Revision 1.31 2006/03/01 16:58:04 elphel ! no "camera in use" for images with "-" in "opt=" ! ! Revision 1.30 2006/02/22 19:34:53 elphel ! bug fix in calculating start of frame in circular buffer (video) ! ! Revision 1.29 2006/02/22 17:29:25 elphel ! added day/night sensitivity automation. just use sens=auto, or add (shown defaults) &de=1000&ne=10000&sd=2&sn=16 parameters ! ! Revision 1.28 2006/02/22 09:06:45 elphel ! Made ccam.cgi return last image from the buffer when streamer is running. Same as acquireing image, with "-" in the options, i.e. "admin-bin/ccam.cgi?opt=vhcxy-" (all parameters will be ignored) ! ! Revision 1.27 2006/02/21 08:30:32 elphel ! fixed wrong reporting of binning parameters ! ! Revision 1.26 2006/02/19 19:56:12 khlut ! bug fixed: possibility of infinite loop when fwrite returns 0 ! ! Revision 1.25 2006/02/16 19:25:44 khlut ! skip too long lines in streamer.conf ! ! Revision 1.24 2006/02/16 14:20:15 khlut ! Streamer parameters are printed with S_ prefix ! ! Revision 1.23 2006/02/09 21:15:12 alexlp ! Check what is the current API ! ! Revision 1.22 2006/02/06 19:05:08 elphel ! added modifier that makes ccam.cgi wait till the compressor is actually stopped after stop command ! ! Revision 1.21 2006/02/03 13:09:26 spectr_rain ! *** empty log message *** ! ! Revision 1.20 2006/02/03 12:30:43 spectr_rain ! *** empty log message *** ! ! Revision 1.19 2006/02/01 21:11:55 spectr_rain ! *** empty log message *** ! ! Revision 1.18 2006/01/22 09:24:00 elphel ! added "rscale=auto" and "bscale=auto", ! "wbth=" (white balance threshold - default=250), ! "wbpc=" (white balance percent - default=1.0), ! and "wbstat=1" - return xml file with recommended rscale, bscale values and possible error code ! ! Revision 1.9 2006/01/09 05:49:45 elphel ! removed extra HTTP/1.0 line from the image headers that prevented internal wget from getting images from 127.0.0.1 ! ! Revision 1.8 2006/01/05 05:07:02 spectr_rain ! new sensitivity/scale iface ! ! Revision 1.7 2005/12/27 01:40:16 elphel ! Added option (opt=.) to supress "pragma no-cache" ! ! Revision 1.6 2005/11/29 20:41:45 elphel ! *** empty log message *** ! ! Revision 1.12 2005/11/29 09:15:31 spectr_rain ! remove histogram window control ! ! Revision 1.5 2005/10/27 12:02:54 alexlp ! Move html from /etc/httpd to /usr ! ! Revision 1.4 2005/09/10 23:33:21 elphel ! Support of realtime clock and timestamps in the images ! ! Revision 1.9 2005/09/06 03:37:14 elphel ! support for "photo-finish" mode, programmable vertical sync interrupt delay ! ! Revision 1.8 2005/08/28 19:02:49 elphel ! now histogram window width and height should be provided as needed, not decremented by 2 ! ! Revision 1.7 2005/08/28 15:47:54 elphel ! added histogram window control in the URL ! ! Revision 1.6 2005/08/27 05:16:27 elphel ! binning ! ! Revision 1.5 2005/08/27 00:46:08 elphel ! continue on histograms ! ! Revision 1.4 2005/08/26 02:59:06 elphel ! working on histogram ! ! Revision 1.2 2005/05/10 23:55:55 elphel ! *** empty log message *** ! ! Revision 1.7 2004/06/19 05:52:06 elphel ! made separate "Stop" and "Acquire" command instead of "Stop/Acquire" ! ! Revision 1.6 2004/06/03 07:16:57 elphel ! improved clip per-frame viewing (now from clip start too, not just from the end) ! ! Revision 1.3 2004/05/07 03:05:36 elphel ! support for P_SENSOR_WIDTH, P_SENSOR_HEIGHT ! ! Revision 1.2 2004/04/29 06:46:01 elphel ! support for the FPS setting ! ! ! Modified for model 313 ! 11/07/2002 ! modified states, removed "still mode" (always video), ! added 2 image pages for interleaved access

Definition at line 229 of file ccam.c.

Referenced by main().

#define SOCKETBUF_SIZE   4096

Definition at line 237 of file ccam.c.

Referenced by process_get(), send_hardware_image(), send_quicktime(), send_quicktime_clip(), and sendLastFrame().

#define STREAMER_CONF_RUN   "/var/state/streamer.conf";

Referenced by printStreamerParameters().

#define STREAMER_CONF_STOP   "/etc/streamer.conf";

Referenced by printStreamerParameters().

#define USE_MMAP

Definition at line 235 of file ccam.c.

#define USEBUFFERSIZE   1024

Definition at line 582 of file ccam.c.

Referenced by accumData(), frameShr(), frameSub(), processCal(), and programFPN().

#define USEHTTP10 ( x   ) 

Definition at line 475 of file ccam.c.

Referenced by send_buf_image(), send_hardware_image(), send_immed_image(), send_jpegfile_image(), send_quicktime(), send_quicktime_clip(), and sendLastFrame().

#define XML_ACQUIRE   13

Definition at line 299 of file ccam.c.

Referenced by main(), and send_html_data().

#define XML_BEAM   11

Definition at line 297 of file ccam.c.

Referenced by send_html_data().

#define XML_RESET   14

Definition at line 300 of file ccam.c.

Referenced by main(), and send_html_data().

#define XML_SENSOR   10

Definition at line 296 of file ccam.c.

Referenced by send_html_data().

#define XML_STATE   12

Definition at line 298 of file ccam.c.

Referenced by send_html_data().


Function Documentation

int accumData ( int  ifd,
const char *  bufFileName 
)

Definition at line 614 of file ccam.c.

References memset(), ofd, read, USEBUFFERSIZE, and write.

Referenced by main().

void bcast_trigger ( void   ) 

Definition at line 410 of file ccam.c.

References accept_trigger, bcast_trigger_f(), trig_desc_t::enable_ping, trig_desc_t::id, memset(), trig_desc_t::number, trig_desc_t::port_in, trig_desc_t::timeout, and trig_desc.

Referenced by main().

void* bcast_trigger_f ( void *  ptr  ) 

Definition at line 337 of file ccam.c.

References accept_trigger, exif_desc, exif_desc_t::image_id, memset(), trig_desc_t::port_out, and trig_desc.

Referenced by bcast_trigger().

int calcWhiteBalance ( int  thrsh,
int  min_pixels,
float  diffGains[3] 
)

Definition at line 2083 of file ccam.c.

References autoexp, AUTOEXP_DEV_NAME, autoexp_t::exp, GAMMA_LEN, HIST_LEN, IOC_AUTOEXP_GET, memcpy(), and TABLES_LEN.

Referenced by main(), PHP_FUNCTION(), and setCamPars().

void debug_write ( char *  filename,
int  linenum,
const char *  dbgstr 
)

******************************************************************************************************************** ! _time=t (ms) will try to set current system time (if it was not set already. _stime - will always set) ! if any of html, htmlr, htmll or htmlj are present will genmerate html page instead of an image ! html= not present)- picture as before (or vrml) ! 0 - nothing ! 1 - all sensor parameters as javaScript ! 2 - all sensor parameters as html ! 3 - beam data as javaScript ! 4 - beam data as html ! 5 - state (5 -picture ready) as javaScript ! 6 - state (5 -picture ready) as html ! 7 - start image acquisition (option "s" or "t" should be present) ! 8 - reset waiting for trigger ! 10 - all sensor parameters as XML ! 11 - beam data as XML ! 12 - state (5 -picture ready) as XML ! 13 - start image acquisition (option "s" or "t" should be present), return XML ! 14 - reset waiting for trigger, return XML

! htmlr=n - Refresh each n seconds ! htmll=(escape) - command executed onLoad in <body> tag ! htmlj=(escape) - include *.js javaScript file

! vrmld - decimation to make a grid (>=8 for full frame) (default = 16) ! vrmlb - number of individual blocks in each x/y (default=2) ! vrmlm - maximal pixel. 1023 - full scale, less - increase contrast, 0 - automatic (default =1023)

! vrmli - indentation (default=1) ! vrmlf - format - 0 - integer, 1 - one digit after "." (default 0) ! vrmll - number of countours to build (default = 32) ! vrmlo - options for isolines - e - elevated, f - flat (default=ef) ! vrmlz - 0..9 output (gzip) compression level (0 - none, 1 - fastest, default - 6, best -9) ! fpns - 0..3 fpga background subtraction: ! 0 - none, ! 1 (fine) - subtract 8-bit FPN from 10-bit pixel ! 2 - multiply FPN by 2 before subtracting ! 3 - multiply FPN by 4 before subtracting (full scale) ! note: negative result is replaced by 0, decrease FPN data before applying for "fat 0" ! fpnm - muliply by inverse sensitivity (sensitivity correction) mode: ! 0 - no correction ! 1 - fine (+/- 12.5%) ! 2 - medium (+/- 25%) ! 3 - maximal (+/- 50%) ! pc - pseudo color string. Applies to monochrome images and vrml

! any of vrml* specified - vrml instead of a picture/html ! ! background measurement/subtraction will (now) work only with 10-bit images ! gd = "digital gain" 0..5 (software) ! iq = 0..100 - jpeg quality, "-1" - BMP non-compressed, "-2" - BMP RLE compressed ! byr =0..3 Overwite Bayer phase shift, =4 - use calculated by driver.

! vw - virtual frame width

! vh - virtual frame height

! wl = 0..1288 - left ! wt = 0..1032 - top ! ww = 1..1288 - width ! wh = 1..1032 - height ! pfh - photofinish mode strip height (0 - normal mode, not photofinish). In this mode each frame will consist of multiple pfh-high horizontal (camera should be oriented 90 deg. to make vertical) strips, and no extra lines will be added to the frames for demosaic for now: +65536 - timestamp for normal frames, +131072 - timestamps for photo-finish mode ! ts - time stamp mode: 0 - none, 1 - in upper-left corner, 2 - added to the right of the image (photo-finish mode)

! fsd - frame sync delay (in lines) from the beginning of a frame (needed in photofinish mode - 3 lines?)

! dh = 1 2 4 - decimation horizontal (both) MT9T001 dh= 1,2,3,4,5,6,7,8 ! dv - decimation vertical MT9T001 dv= 1,2,3,4,5,6,7,8 ! bh - binning horizontal or both (MT9T001 - 1<bh<=dh<=8, has some on-chip problems) ! bv - binning vertical (MT9T001 - 1<bh<=dh<=8, has some on-chip problems) ! bit - pixel depth (10/4/8) ! shl - shift left (FPGA in 8 and 4-bit modes) - obsolete ! clk - MCLK divisor - 80MHz/(2..129) - obsolete?

! fclk - 0-127 - fpga (compressor) clock (MHz) ! sclk - 0-127 - sensor clock (MHz) - will be limited by sensor driver ! xtra - number of pixel-cycles needed for compressor between frames - debugging only

! gr = 0..63 - analog gain red (or mono) ! gg = 0..63 - analog gain green (or green-"red" line) ! gb = 0..63 - analog gain blue ! ggb = 0..63 - analog gain green ("blue" line - ZR32212 only) ! bg = n - calculate background 1-2-4..16 times (does not need option s/t/v) ! parameters for "instant on" quicktime ! qfr = n - number of frames to send in a quicktime clip ! qpad = % to leave for the frame size to grow (initial size 1-st frame * (100- 1.5*qpad)/100 ! qdur = frame duration in 1/600 of a second ! parameters for quicktime clips (send after shooting) ! qsz = n - clip size in KB (w/o headers) (<=0 will use "instant on") - will be obsolete ! qcmd= (mandatory for videoclip) 1 - start constant compression of all acquired frames 2 - stop constant compression. 3 - acquire the whole buffer and stop 4 - read movie from buffer 6 (and 5?) - stop, then read 7 - acquire buffer, then read

! qts = t - playback time/real time

! gam=gamma - gamma correction (gamma value 0.13..10) ! pxl=00 lowest pixel value (on 8-bit scale) before table to be mapped to zero output value ! pxh=255 hioghest pixel value (on 8-bit scale) before table to be mapped to 255 output value

! fps= xx.xx - desired fps (will truncate to 0.01 fps) See fpsm below ! fpslm = 0..3 - fps limit mode: 0 - do not control fps 1 - limit fps (not higher than) 2 - limit fps - not lower than (not used) 3 - maintain fps (both limits at once) ! hist=n - read frame from "history" applies only to rereading from memory after acquisition of a clip n<=0 - from the end of clip (0 - last), n>0 - from the start (1 - first)

! e = 0..60000 - exposure (1 msec step) ! csb= 0..710 - color saturation blue (%) ! csr= 0..562 - color saturation red (%)

hl - histogram top (all histogram parameters will be made even by truncating, all written derectly to FPGA - no shadows yet) ht - histogram left hw - histogram width hh - histogram height if ((vp=paramValue(gparams, "csb"))) ioctl(devfd, _CCCMD(CCAM_WPARS , P_COLOR_SATURATION_BLUE ), strtol (vp,&cp,10)); if ((vp=paramValue(gparams, "csr"))) ioctl(devfd, _CCCMD(CCAM_WPARS , P_COLOR_SATURATION_RED ), strtol (vp,&cp,10));

! opt = string of 1-character options: ! h - use hardware compression ! c - color mode ! j - (overwrites color mode) - jp4/google mode ! x - flip x ! y - flip y ! p - test pattern (ramp) ! f - test pattern (ramp) fpga ! b - buffer file ! m - restart exposure after sending ! if none of "st" is present - "reload mode" (all but iq and gd ignored) ! s - software trigger ! t - external trigger ! v - video mode - will be obsolete soon (for now will only tell it is not "reload") ! g - use background image - will be obsolete ! q - sent quicktime movie ! u - updates (some) parameters "on the fly", returns 1x1 pix dummy image ! * - unlock "in use" ! +,-,!,@ - will explain later ! ! - if "u!" do everything as real image, just send xml ! w - wait for stop done (now only with qcmd=2) !=============================================================================================================================

Definition at line 2447 of file ccam.c.

Referenced by main().

int frameShr ( const char *  fn,
int  shft 
)

Definition at line 635 of file ccam.c.

References fd, read, USEBUFFERSIZE, and write.

Referenced by main().

int frameSub ( const char *  sfn,
const char *  dfn 
)

Definition at line 653 of file ccam.c.

References dfd, memset(), read, USEBUFFERSIZE, and write.

Referenced by processCal().

int hexdigit ( char  c  ) 

Definition at line 25 of file unescape.c.

int imageCorr ( int  ImageWidth,
const char *  dfn,
const char *  bfn,
const char *  cfn,
const char *  ImgFileName 
)

Definition at line 703 of file ccam.c.

References dfd, MAXIMAGEWIDTH, read, and write.

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

Definition at line 2456 of file ccam.c.

References _CCCMD, accumData(), bcast_trigger(), calcWhiteBalance(), CAMSEQ_DONE, CAMSEQ_OFF, CAMSEQ_READY, CAMSEQ_RUN, CAMSEQ_SINGLE, CAMSEQ_STOP, CCAM_MAX_NUM_FRAMES, CCAM_RPARS, CCAM_WPARS, CMOSCAM_IOCTYPE, copyQuery, D5, debug_write(), trig_desc_t::enable, trig_desc_t::enable_ping, error304, FPGACONF_WRITEREG, frameShr(), gparams, HTML_ACQUIRE, HTML_RESET, int, IO_CCAM_JPEG, IO_CCAM_JPEG_QUALITY, IO_CCAM_MONITOR_SEQ, IO_CCAM_SET_EXT_EXPOSURE, JPEG_CMD_ACQUIRE, JPEG_CMD_CATCHUP, JPEG_CMD_FORGET, JPEG_CMD_GET, JPEG_CMD_RESET, JPEG_CMD_RESTORE_RP, JPEG_CMD_SAVE_RP, method, optionPresent(), P_ACTUAL_HEIGHT, P_ACTUAL_WIDTH, P_BGFRAME, P_BITS, P_DONTCARE, P_FPNM, P_FPNS, P_UPDATE, paramValue(), parseQuery(), trig_desc_t::port_in, trig_desc_t::port_out, processImage(), prof_next(), prof_start(), programFPN(), qtSourceFileName, query, read, send_hardware_image(), send_jpegfile_image(), send_quicktime(), send_quicktime_clip(), sendLastFrame(), set_fpga_time(), setCamPars(), SLOG, stderr, time, trig_desc, unescape(), uri, XML_ACQUIRE, and XML_RESET.

int optionPresent ( struct key_value params,
char *  skey,
char  c 
)

Definition at line 1734 of file ccam.c.

References paramValue().

Referenced by main(), processImage(), and setCamPars().

char* paramValue ( struct key_value params,
char *  skey 
)

int parseQuery ( struct key_value params,
char *  qry 
)

void printDocumentLine ( const char *  name,
const char *  value,
int  format 
)

Definition at line 1396 of file ccam.c.

Referenced by printStreamerParameters(), and send_html_data().

void printStreamerParameters ( int  fmode  ) 

Definition at line 1405 of file ccam.c.

References buf, e, fd, printDocumentLine(), STREAMER_CONF_RUN, and STREAMER_CONF_STOP.

Referenced by send_html_data().

int process_get ( int  data_fd,
unsigned long  filesize,
char *  data_mem,
long *  filepos 
)

Definition at line 534 of file ccam.c.

References SOCKETBUF_SIZE, and stdout.

Referenced by send_buf_image(), and send_jpegfile_image().

int processCal ( const char *  wfn,
const char *  bfn,
const char *  cfn 
)

Definition at line 674 of file ccam.c.

References fd, frameSub(), read, USEBUFFERSIZE, and write.

int processImage ( struct key_value params,
const char *  ImgFileName,
const char *  bufFileName,
const char *  pc_par,
int  iq_par,
int  gd_par,
int  html_par,
int  htmlr_par,
const char *  htmll_par,
const char *  htmlj_par,
int  vrml_par,
int  vrmlm_par,
int  vrmld_par,
int  vrmlb_par,
int  vrmli_par,
int  vrmlf_par,
int  vrmll_par,
int  vrmlo_par,
int  vrmlz_par 
)

Definition at line 1739 of file ccam.c.

References _CCCMD, CCAM_RPARS, error304, export_vrml(), optionPresent(), P_ACTUAL_HEIGHT, P_ACTUAL_WIDTH, P_BAYER, P_BITS, P_COLOR, send_buf_image(), send_html_data(), and send_immed_image().

Referenced by main().

void prof_next ( const char *  m  ) 

Definition at line 392 of file ccam.c.

References prof_t::count, prof, and prof_t::tv.

Referenced by main().

void prof_start ( void   ) 

Definition at line 378 of file ccam.c.

References prof_t::count, prof, and prof_t::tv.

Referenced by main().

void prof_time ( const char *  m  ) 

Definition at line 384 of file ccam.c.

References prof_t::count, and prof.

int programFPN ( const char *  backgroundFileName,
const char *  calibrationFileName,
const char *  FPNFileName,
int  fpns,
int  fpnm,
int  fat_zero 
)

Definition at line 584 of file ccam.c.

References read, USEBUFFERSIZE, and write.

Referenced by main().

int send_buf_image ( int  ImageWidth,
int  ImageHeight,
int  Quality,
int  Contrast,
int  Color,
int  bayerOrient,
int  Depth,
const char *  pseudo,
const char *  ImgFileName,
const char *  bufFileName 
)

Definition at line 751 of file ccam.c.

References dma2bmp(), dma2jpeg(), MAP_OPTIONS, MAX_TIMEOUT, process_get(), stderr, time, and USEHTTP10.

Referenced by processImage().

int send_hardware_image ( const char *  ImgFileName,
int  cache 
)

Definition at line 1042 of file ccam.c.

References D6, e, exif, EXIF_IOC_SUBSEC_OR_SET, EXIF_IOC_TIME_GET, EXIF_IOC_TIME_OR_SET, EXIF_IOC_TIME_SET, EXT_JPEG_MMAP_DESC, read, SOCKETBUF_SIZE, stderr, stdout, trailer, and USEHTTP10.

Referenced by main().

int send_html_data ( const char *  devfn,
const char *  dmafn,
int  mode,
int  refreshPeriod,
const char *  onLoad,
const char *  javaScript 
)

Definition at line 1461 of file ccam.c.

References _CCCMD, beam_params::ar, beam_params::az, calculateBeamParams(), CCAM_RPARS, CMOSCAM_IOCTYPE, beam_params::d, beam_params::dx, beam_params::dxe, beam_params::dy, beam_params::dye, HTML_ACQUIRE, HTML_BEAM_HTML, HTML_BEAM_JS, HTML_RESET, HTML_SENSOR_HTML, HTML_SENSOR_JS, HTML_STATE_HTML, HTML_STATE_JS, IO_CCAM_MONITOR_SEQ, P_ACTUAL_HEIGHT, P_ACTUAL_WIDTH, P_AUXCM, P_BAYER, P_BGFRAME, P_BIN_HOR, P_BIN_VERT, P_BITS, P_BSCALE, P_CLK_FPGA, P_CLK_SENSOR, P_COLOR, P_COLOR_SATURATION_BLUE, P_COLOR_SATURATION_RED, P_DCM_HOR, P_DCM_VERT, P_EXPOS, P_FATZERO, P_FLIP, P_FP100S, P_FPGA_XTRA, P_FPNM, P_FPNS, P_FPSLM, P_FRAME, P_FRAMESYNC_DLY, P_GAINB, P_GAING, P_GAINGB, P_GAINR, P_GAMMA, P_IMAGE_SIZE, P_JPEG_WP, P_LPR, P_MCLK, P_OVERLAP, P_PAGE_ACQ, P_PAGE_READ, P_PERIOD, P_PF_HEIGHT, P_PIXEL_HIGH, P_PIXEL_LOW, P_QUALITY, P_RSCALE, P_SENSOR, P_SENSOR_HEIGHT, P_SENSOR_WIDTH, P_SHIFTL, P_TRIG, P_TRIGGERED, P_VEXPOS, P_VIDEO, P_VIRT_HEIGHT, P_VIRT_WIDTH, P_VIRTTRIG, P_WOI_HEIGHT, P_WOI_LEFT, P_WOI_TOP, P_WOI_WIDTH, printDocumentLine(), printStreamerParameters(), beam_params::s2x, beam_params::s2y, SENSOR_KAC1310, SENSOR_MASK, SENSOR_ZR32112, SENSOR_ZR32212, beam_params::SQ, stderr, beam_params::SxQ, beam_params::SxxQ, beam_params::sxy, beam_params::SxyQ, beam_params::SyQ, beam_params::SyyQ, beam_params::xc, XML_ACQUIRE, XML_BEAM, XML_RESET, XML_SENSOR, XML_STATE, and beam_params::yc.

Referenced by processImage().

int send_immed_image ( int  ImageWidth,
int  ImageHeight,
int  Quality,
int  Contrast,
int  Color,
int  bayerOrient,
int  Depth,
const char *  pseudo,
const char *  ImgFileName 
)

Definition at line 923 of file ccam.c.

References dma2bmp(), dma2jpeg(), stderr, and USEHTTP10.

Referenced by processImage().

int send_jpegfile_image ( const char *  ImgFileName  ) 

Definition at line 845 of file ccam.c.

References MAP_OPTIONS, MAX_TIMEOUT, process_get(), stderr, time, and USEHTTP10.

Referenced by main().

int send_quicktime ( const char *  ImgFileName,
const char *  qtSourceFileName,
const char *  headerFileName,
int  nrep,
int  safe,
int  sample_dur 
)

Definition at line 1122 of file ccam.c.

References _CCCMD, CCAM_RPARS, CMOSCAM_IOCTYPE, framesize, IO_CCAM_JPEG, IO_CCAM_JPEG_QUALITY, JPEG_CMD_ACQUIRE, JPEG_CMD_CATCHUP, JPEG_CMD_FORGET, memset(), P_ACTUAL_HEIGHT, P_ACTUAL_WIDTH, P_QUALITY, qtime(), read, samplesPerChunk, SOCKETBUF_SIZE, stderr, stdout, timescale, and USEHTTP10.

Referenced by main().

int send_quicktime_clip ( const char *  ImgFileName,
const char *  qtSourceFileName,
const char *  headerFileName,
int  qcmd,
int  tscale 
)

Definition at line 1266 of file ccam.c.

References _CCCMD, CAMSEQ_JPEG, CAMSEQ_RUN, CAMSEQ_SINGLE, CAMSEQ_STOP, CCAM_DMA_CMD_STOP, CCAM_MAX_NUM_FRAMES, CCAM_RPARS, CMOSCAM_IOCTYPE, IO_CCAM_DMA, IO_CCAM_JPEG, IO_CCAM_MONITOR_SEQ, IO_CCAM_SET_EXT_EXPOSURE, JPEG_CMD_FORGET, JPEG_CMD_FRAMES, JPEG_CMD_JUST_STOP, JPEG_CMD_RESTORE_RP, JPEG_CMD_SAVE_RP, JPEG_CMD_START, JPEG_CMD_STOP, P_ACTUAL_HEIGHT, P_ACTUAL_WIDTH, P_CLK_SENSOR, P_PERIOD, qtime(), read, sample_dur, samplesPerChunk, SOCKETBUF_SIZE, stderr, stdout, timescale, and USEHTTP10.

Referenced by main().

int sendLastFrame ( int  cache  ) 

Definition at line 2202 of file ccam.c.

References _CCCMD, buff_size, ccam_dma_buf, CCAM_MMAP_META, CCAM_RPARS, CMOSCAM_IOCTYPE, free(), HeadFileName, IO_CCAM_MONITOR_SEQ, ioctl_fd, malloc(), MAP_OPTIONS, memcpy(), P_JPEG_WP, read, SOCKETBUF_SIZE, stdout, trailer, and USEHTTP10.

Referenced by main().

int set_fpga_time ( int  seconds,
int  useconds 
)

Definition at line 2066 of file ccam.c.

References FPGACONF_WRITEREG.

Referenced by main().

int setCamPars ( int  devfd,
int  n_bf,
char *  cp,
char *  vp 
)

Definition at line 1807 of file ccam.c.

References _CCCMD, bscale, calcWhiteBalance(), CCAM_RPARS, CCAM_WPARS, gb, gg, ggb, gparams, gr, optionPresent(), P_ACTUAL_HEIGHT, P_ACTUAL_WIDTH, P_BAYER, P_BGFRAME, P_BIN_HOR, P_BIN_VERT, P_BITS, P_BSCALE, P_CLK_FPGA, P_CLK_SENSOR, P_COLOR, P_COLOR_SATURATION_BLUE, P_COLOR_SATURATION_RED, P_DCM_HOR, P_DCM_VERT, P_EXPOS, P_FLIP, P_FP100S, P_FPGA_XTRA, P_FPNM, P_FPNS, P_FPSLM, P_FRAMESYNC_DLY, P_GAINB, P_GAING, P_GAINGB, P_GAINR, P_GAMMA, P_MCLK, P_OVERLAP, P_PAGE_ACQ, P_PF_HEIGHT, P_PIXEL_HIGH, P_PIXEL_LOW, P_QUALITY, P_RSCALE, P_SHIFTL, P_TRIG, P_UPDATE, P_VEXPOS, P_VIRT_HEIGHT, P_VIRT_WIDTH, P_VIRTTRIG, P_WOI_HEIGHT, P_WOI_LEFT, P_WOI_TOP, P_WOI_WIDTH, paramValue(), rscale, and sens.

Referenced by main().

int unescape ( char *  s,
int  l 
)


Variable Documentation

atomic_t accept_trigger

Definition at line 331 of file ccam.c.

Referenced by bcast_trigger(), and bcast_trigger_f().

struct autoexp_t autoexp

Definition at line 494 of file ccam.c.

char** environ

char* error304 [static]

Initial value:

        "HTTP/1.0 304 Not Modified\n"
                        "Content-Length: 0\n"
                        "Content-Type: image/jpeg\n"
                        "Pragma: no-cache\n\n"

Definition at line 529 of file ccam.c.

Referenced by main(), and processImage().

struct exif_desc_t exif_desc

Referenced by bcast_trigger_f(), ext353__ioctl(), and ext_make_jpeg_header().

struct key_value gparams[QRY_MAXPARAMS+1]

Definition at line 492 of file ccam.c.

struct prof_t prof

Referenced by prof_next(), prof_start(), and prof_time().

struct trig_desc_t trig_desc

Referenced by bcast_trigger(), bcast_trigger_f(), and main().


Generated on Thu Aug 7 16:19:35 2008 for elphel by  doxygen 1.5.1