os/linux-2.6-tag--devboard-R2_10-4/arch/cris/arch-v32/drivers/elphel/histograms.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void init_histograms (void)
 wait queue for all the other (R,G2,B) histograms (color)
int set_histograms (unsigned long frame, int needed, unsigned long *gammaHash)
 Get histograms from the FPGA (called as tasklet?).
int get_histograms (unsigned long frame, int needed)
 Get histograms from the FPGA (called as tasklet?) and/or calculate derivatives (if needed).

Variables

wait_queue_head_t hist_y_wait_queue
wait_queue_head_t hist_c_wait_queue
 wait queue for the G1 histogram (used as Y)


Function Documentation

int get_histograms ( unsigned long  frame,
int  needed 
)

Get histograms from the FPGA (called as tasklet?) and/or calculate derivatives (if needed).

Parameters:
frame absolute frame number (Caller should match it to the hardware frame). TODO: should it be one frame behind current? - yes, exactly
needed bits specify what histograms (color, type) are requested TODO: Add P_* parameter - what to read from tasklet, turn colors it off for high FPS/small window each group of 4 bits cover 4 colors of the same type:
  • bits 0..3 - ignored here (used for raw FPGA tables)
  • bits 4..7 - calculate cumulative histograms (sum of raw ones) - normally called from applications
  • bits 8..11 - calculate percentiles (reverse cumulative histograms) - normally called from applications "needed" for raw histograms should be specified explicitely (can not be read from FPGA later), "needed" for cumul_hist will be added automatically if percentiles are requested
Returns:
index of the histogram (>=0) if OK, otherwise:
  • -1 not reading FPGA and frame number stored is different from the requested (too late - histogram buffer overrun?)

if Y - never calculated, if C - maybe all the cache is used by Y

mask out FPGA read requests -= they are not handled here anymore (use set_histograms())

cumulative histograms are needed for percentile calculations

if ((needed >> 4) & (~histograms[index].valid) & 0x0f) return -2 ; /// some needed raw histograms are not available NOTE: now never comes here

Calculating cumulative histograms

Calculating percentiles

Definition at line 231 of file histograms.c.

References ELP_KERR, G_HIST_LAST_INDEX, GLOBALPARS, hist, HISTOGRAM_CACHE_NUMBER, histogram_calc_cumul(), histogram_calc_percentiles(), MDF21, MDF22, printk, and histogram_stuct_t::valid.

Referenced by histograms_lseek().

void init_histograms ( void   ) 

wait queue for all the other (R,G2,B) histograms (color)

Definition at line 169 of file histograms.c.

References flags, frame, HISTOGRAM_CACHE_NUMBER, histograms_p, local_irq_restore, local_irq_save, MDF21, printk, and histogram_stuct_t::valid.

Referenced by histograms_init().

int set_histograms ( unsigned long  frame,
int  needed,
unsigned long *  gammaHash 
)

Get histograms from the FPGA (called as tasklet?).

Parameters:
frame absolute frame number (Caller should match it to the hardware frame) TODO: should it be one frame behind current?
needed bits specify what histograms (color, type) are requested
gammaHash array of 4 hash32 values to be saved with the histograms each group of 4 bits cover 4 colors of the same type:
  • bits 0..3 - read raw histograms from the FPGA - normally called from IRQ/tasklet (use just 1 color for autoexposure to speed up?)
Returns:
0 for now

overwrite all

add to existent

remove those that are already available from the request

Definition at line 193 of file histograms.c.

References fpga_hist_read_nice(), histogram_stuct_t::frame, G_HIST_LAST_INDEX, GLOBALPARS, hist, HISTOGRAM_CACHE_NUMBER, memcpy(), and histogram_stuct_t::valid.

Referenced by tasklet_fpga_function().


Variable Documentation

wait_queue_head_t hist_c_wait_queue

wait queue for the G1 histogram (used as Y)

Definition at line 131 of file histograms.c.

Referenced by histograms_init(), and histograms_lseek().

wait_queue_head_t hist_y_wait_queue

These wait queues will be advanced each frame after the histogram data is transferred to the FPGA. It will happen even if the corresponding task is disabled, with the only exception: hist_c_wait_queue will not be awaken in the current frame if it is too late (frame counter incremented while serving tasklet)

Definition at line 130 of file histograms.c.

Referenced by histograms_init(), histograms_lseek(), and tasklet_fpga_function().


Generated on Fri Nov 28 00:08:04 2008 for elphel by  doxygen 1.5.1