$xml->addChild('elphel_set_P_value',elphel_set_P_value($GLOBALS['sensor_port'],ELPHEL_SENSOR,0x00,0,ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC));// / will start detection
elphel_set_P_value(ELPHEL_MAXAHEAD,2,0,8);/// When servicing interrupts, try programming up to 2 frames ahead of due time)
elphel_set_P_value($GLOBALS['sensor_port'],ELPHEL_MAXAHEAD,2,0,8);// / When servicing interrupts, try programming up to 2 frames ahead of due time)
elphel_set_P_value(ELPHEL_FPGA_XTRA,1000,$frame+3,ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC);///compressor needs extra 1000 cycles to compress a frame (estimate)
elphel_set_P_value(ELPHEL_EXTERN_TIMESTAMP,1,$frame+3,ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC);/// only used with async trigger
elphel_set_P_value($GLOBALS['sensor_port'],ELPHEL_FPGA_XTRA,1000,$frame+3,ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC);// /compressor needs extra 1000 cycles to compress a frame (estimate)
elphel_set_P_value($GLOBALS['sensor_port'],ELPHEL_EXTERN_TIMESTAMP,1,$frame+3,ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC);// / only used with async trigger
/// good (latency should be changed, but for now that will make a correct initialization - maybe obsolete)
// / good (latency should be changed, but for now that will make a correct initialization - maybe obsolete)
case"na":/// flags defined in upper half of 32-bit word and can be OR-ed with address. When provided as "flags=" 0x3 is the same as 0x30000 ( internally flags = (flags | (flags <<16)) & 0xffff0000)
case"na":// / flags defined in upper half of 32-bit word and can be OR-ed with address. When provided as "flags=" 0x3 is the same as 0x30000 ( internally flags = (flags | (flags <<16)) & 0xffff0000)
$address|=ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC;
;
break;
case"sa":
case"sa":
$address|=ELPHEL_CONST_FRAMEPAIR_FRAME_ZERO;
break;
}
if(($address&0xffff)==0){/// wrong address - probably mistyped constant name
<li><b>framepars.php?a[dr]=<i>register_address</i>&d[ata]=<i>register_data</i>[&f[rame]=<i>frame_number</i>][&flag[s]=<i>flags</i>]</b> - write frame parameter <i>register_address</i> with data <i>register_data</i> to frame <i>frame_number</i>, optionally use <i>flags</i></li>
printf("<p><a href=\"%s/prev/prev/prev/prev/prev/prev/prev/prev/meta/next/meta/next/meta/next/meta/next/meta/next/meta/next/meta/next/meta/next/meta\">meta data for the last 9 frames</a></p>\n",$imgsrv);
printf("<p><a href=\"%s/prev/prev/prev/prev/prev/prev/prev/prev/meta/next/meta/next/meta/next/meta/next/meta/next/meta/next/meta/next/meta/next/meta\">meta data for the last 9 frames</a></p>\n",$imgsrv);
unsigned long frame; /// frame number correspoding to the current histogram
unsigned long valid; /// bit mask of valid arrays (0 - hist_r, ... ,4-cumul_hist_r, ..., 11 - percentile_b)
/// Direct histograms, loaded from the FPGA
union {
unsigned long hist[1024] ; /// All 4 histograms
struct {
unsigned long hist_r [256] ; /// Histogram for the red component
unsigned long hist_g [256] ; /// Histogram for the first green component (in the "red" line)
unsigned long hist_gb[256] ; /// Histogram for the second green component (in the "blue" line)
unsigned long hist_b [256] ; /// Histogram for blue component
};
};
/// Direct cumulative histograms, calculated from the loaded from the FPGA
union {
unsigned long cumul_hist[1024] ; /// All 4 cumulative histograms
struct {
unsigned long cumul_hist_r [256] ; /// Cumulative histogram for the red component
unsigned long cumul_hist_g [256] ; /// Cumulative histogram for the first green component (in the "red" line)
unsigned long cumul_hist_gb[256] ; /// Cumulative histogram for the second green component (in the "blue" line)
unsigned long cumul_hist_b [256] ; /// Cumulative histogram for blue component
};
};
/// Calculated reverse cumulative histograms (~percentiles) - for the given 1 byte input X (0 - 1/256 of all pixels, ..., 255 - all pixels)
/// returns threshold value P (0..255), so that number of pixels with value less than x is less or equal to (P/256)*total_number_of_pixels,
/// and number of pixels with value less than (x+1) is greater than (P/256)*total_number_of_pixels,
/// P(0)=0, P(256)=256 /not included in the table/
/// percentiles arrays are calculated without division for each element, interpolation (with division) will be done only for the value of interest
/// on demand, in the user space.
/// NOTE: - argument is _output_ value (after gamma-correction), reverse gamma table is needed to relate percentiles to amount of light (proportional to exposure)
union {
unsigned char percentile[1024] ; /// All 4 percentiles
struct {
unsigned char percentile_r [256] ; /// percentile for the red component
unsigned char percentile_g [256] ; /// percentile for the first green component (in the "red" line)
unsigned char percentile_gb[256] ; /// percentile for the second green component (in the "blue" line)
unsigned char percentile_b [256] ; /// percentile for the blue component
};
};
};
*/
* struct histogram_stuct_t {
* unsigned long frame; /// frame number correspoding to the current histogram
* unsigned long valid; /// bit mask of valid arrays (0 - hist_r, ... ,4-cumul_hist_r, ..., 11 - percentile_b)
* /// Direct histograms, loaded from the FPGA
* union {
* unsigned long hist[1024] ; /// All 4 histograms
* struct {
* unsigned long hist_r [256] ; /// Histogram for the red component
* unsigned long hist_g [256] ; /// Histogram for the first green component (in the "red" line)
* unsigned long hist_gb[256] ; /// Histogram for the second green component (in the "blue" line)
* unsigned long hist_b [256] ; /// Histogram for blue component
* };
* };
* /// Direct cumulative histograms, calculated from the loaded from the FPGA
* union {
* unsigned long cumul_hist[1024] ; /// All 4 cumulative histograms
* struct {
* unsigned long cumul_hist_r [256] ; /// Cumulative histogram for the red component
* unsigned long cumul_hist_g [256] ; /// Cumulative histogram for the first green component (in the "red" line)
* unsigned long cumul_hist_gb[256] ; /// Cumulative histogram for the second green component (in the "blue" line)
* unsigned long cumul_hist_b [256] ; /// Cumulative histogram for blue component
* };
* };
* /// Calculated reverse cumulative histograms (~percentiles) - for the given 1 byte input X (0 - 1/256 of all pixels, ..., 255 - all pixels)
* /// returns threshold value P (0..255), so that number of pixels with value less than x is less or equal to (P/256)*total_number_of_pixels,
* /// and number of pixels with value less than (x+1) is greater than (P/256)*total_number_of_pixels,
* /// P(0)=0, P(256)=256 /not included in the table/
* /// percentiles arrays are calculated without division for each element, interpolation (with division) will be done only for the value of interest
* /// on demand, in the user space.
* /// NOTE: - argument is _output_ value (after gamma-correction), reverse gamma table is needed to relate percentiles to amount of light (proportional to exposure)
* union {
* unsigned char percentile[1024] ; /// All 4 percentiles
* struct {
* unsigned char percentile_r [256] ; /// percentile for the red component
* unsigned char percentile_g [256] ; /// percentile for the first green component (in the "red" line)
* unsigned char percentile_gb[256] ; /// percentile for the second green component (in the "blue" line)
* unsigned char percentile_b [256] ; /// percentile for the blue component
* };
* };
* };
*
*/
functionprintHistogram($frame){
$colors=array(0=>"R",1=>"G",2=>"GB",3=>"B");
$h_arr=elphel_histogram_get(0xfff,$frame);
$a=0;
$offset2sum=1024+255;/// last in cumulative histogram for the same color
struct framepars_t func2call; ///< func2call.pars[] - each parameter has a 32-bit mask of what pgm_function to call - other fields not used
unsigned long globalPars[NUM_GPAR=2048]; ///< parameters that are not frame-related, their changes do not initiate any actions so they can be mmaped for both R/W
unsigned long multiSensIndex[P_MAX_PAR_ROUNDUP = 1024]; ///< indexes of individual sensor register shadows (first of 3) - now for all parameters, not just sensor ones
unsigned long multiSensRvrsIndex[P_MAX_PAR_ROUNDUP = 1024]; ///< reverse index (to parent) for the multiSensIndex in lower 16 bits, high 16 bits - sensor number
};
struct framepars_t { 1024
unsigned long pars[927]; ///< parameter values (indexed by P_* constants)
unsigned long functions; ///< each bit specifies function to be executed (triggered by some parameters change)
unsigned long modsince[31]; ///< parameters modified after this frame - each bit corresponds to one element in in par[960] (bit 31 is not used)
unsigned long modsince32; ///< parameters modified after this frame super index - non-zero elements in in mod[31] (bit 31 is not used)
unsigned long mod[31]; ///< modified parameters - each bit corresponds to one element in in par[960] (bit 31 is not used)
unsigned long mod32; ///< super index - non-zero elements in in mod[31] (bit 31 is not used)
unsigned long needproc[31]; ///< FIXME: REMOVE parameters "modified and not yet processed" (some do not need any processing)
unsigned long needproc32; ///< FIXME: REMOVE parameters "modified and not yet processed" frame super index - non-zero elements in in mod[31] (bit 31 is not used)
0x04000 1024 struct framepars_t func2call; ///< func2call.pars[] - each parameter has a 32-bit mask of what pgm_function to call - other fields not used
0x04400 2048 unsigned long globalPars[NUM_GPAR=2048]; ///< parameters that are not frame-related, their changes do not initiate any actions so they can be mmaped for both R/W
0x14c00 1024 unsigned long multiSensIndex[P_MAX_PAR_ROUNDUP = 1024]; ///< indexes of individual sensor register shadows (first of 3) - now for all parameters, not just sensor ones
0x15000 1024 unsigned long multiSensRvrsIndex[P_MAX_PAR_ROUNDUP = 1024]; ///< reverse index (to parent) for the multiSensIndex in lower 16 bits, high 16 bits - sensor number