Commit c6342926 authored by Andrey Filippov's avatar Andrey Filippov

fixing multi-sensor operation

parent 0a534fc8
...@@ -13,3 +13,4 @@ bitbake-logs ...@@ -13,3 +13,4 @@ bitbake-logs
*.o *.o
*.cgi *.cgi
bitbake-logs bitbake-logs
.depend
...@@ -36,3 +36,10 @@ clean: ...@@ -36,3 +36,10 @@ clean:
# REMOTE_USER=${REMOTE_USER} # REMOTE_USER=${REMOTE_USER}
# REMOTE_IP=${REMOTE_IP} # REMOTE_IP=${REMOTE_IP}
depend: .depend
.depend: $(SRCS)
rm -f ./.depend
$(CC) $(CFLAGS) -MM $^ > ./.depend;
include .depend
...@@ -67,13 +67,17 @@ int initFilesMmap(int sensor_port, int sensor_subchannel) { ...@@ -67,13 +67,17 @@ int initFilesMmap(int sensor_port, int sensor_subchannel) {
const char *framepars_driver_name=framepars_dev_names[sensor_port]; const char *framepars_driver_name=framepars_dev_names[sensor_port];
const char histogram_driver_name[]=DEV393_PATH(DEV393_HISTOGRAM); const char histogram_driver_name[]=DEV393_PATH(DEV393_HISTOGRAM);
const char gamma_driver_name[]= DEV393_PATH(DEV393_GAMMA); const char gamma_driver_name[]= DEV393_PATH(DEV393_GAMMA);
int total_hist_entries; // =8*4 for 4 sensors
///Frame parameters file open/mmap (read/write) ///Frame parameters file open/mmap (read/write)
fd_fparmsall= open(framepars_driver_name, O_RDWR); fd_fparmsall= open(framepars_driver_name, O_RDWR);
if (fd_fparmsall <0) { if (fd_fparmsall <0) {
ELP_FERR(fprintf(stderr, "Open failed: (%s)\r\n", framepars_driver_name)); ELP_FERR(fprintf(stderr, "Open failed: (%s)\r\n", framepars_driver_name));
return -1; return -1;
} }
frameParsAll = (struct framepars_all_t *) mmap(0, sizeof (struct framepars_all_t) * HISTOGRAM_CACHE_NUMBER , PROT_READ | PROT_WRITE, MAP_SHARED, fd_fparmsall, 0); // frameParsAll = (struct framepars_all_t *) mmap(0, sizeof (struct framepars_all_t) * HISTOGRAM_CACHE_NUMBER , PROT_READ | PROT_WRITE, MAP_SHARED, fd_fparmsall, 0);
frameParsAll = (struct framepars_all_t *) mmap(0, sizeof (struct framepars_all_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd_fparmsall, 0);
if((int) frameParsAll == -1) { if((int) frameParsAll == -1) {
ELP_FERR(fprintf(stderr, "problems with mmap: %s\n", framepars_driver_name)); ELP_FERR(fprintf(stderr, "problems with mmap: %s\n", framepars_driver_name));
close (fd_fparmsall); close (fd_fparmsall);
...@@ -90,10 +94,10 @@ int initFilesMmap(int sensor_port, int sensor_subchannel) { ...@@ -90,10 +94,10 @@ int initFilesMmap(int sensor_port, int sensor_subchannel) {
close (fd_fparmsall); close (fd_fparmsall);
return -1; return -1;
} }
// Select port and subchannel for histograms // Select port and subchannel for histograms (result is the total number of histograms entries)
lseek(fd_histogram_cache, LSEEK_HIST_SET_CHN + (4 * sensor_port) + sensor_subchannel, SEEK_END); /// specify port/sub-channel is needed total_hist_entries = lseek(fd_histogram_cache, LSEEK_HIST_SET_CHN + (4 * sensor_port) + sensor_subchannel, SEEK_END); /// specify port/sub-channel is needed
histogram_cache = (struct histogram_stuct_t *) mmap(0, sizeof (struct histogram_stuct_t) * HISTOGRAM_CACHE_NUMBER , PROT_READ, MAP_SHARED, fd_histogram_cache, 0); histogram_cache = (struct histogram_stuct_t *) mmap(0, sizeof (struct histogram_stuct_t) * total_hist_entries , PROT_READ, MAP_SHARED, fd_histogram_cache, 0);
if((int) histogram_cache == -1) { if((int) histogram_cache == -1) {
ELP_FERR(fprintf(stderr, "problems with mmap: %s\n", histogram_driver_name)); ELP_FERR(fprintf(stderr, "problems with mmap: %s\n", histogram_driver_name));
close (fd_fparmsall); close (fd_fparmsall);
......
...@@ -161,8 +161,10 @@ int whiteBalanceCorr(int frame, int target_frame, int ae_rslt) { ...@@ -161,8 +161,10 @@ int whiteBalanceCorr(int frame, int target_frame, int ae_rslt) {
/// Find the "brightest" color (maximal number of pixels above wb_whitelev ). wb_whitelev is currently rounded to 8 bits /// Find the "brightest" color (maximal number of pixels above wb_whitelev ). wb_whitelev is currently rounded to 8 bits
max_white_pixels=0; max_white_pixels=0;
num_pixels=histogram_cache[hist_index].cumul_hist[255+ (COLOR_Y_NUMBER<<8)]; /// this one is definitely calculated num_pixels=histogram_cache[hist_index].cumul_hist[255+ (COLOR_Y_NUMBER<<8)]; /// this one is definitely calculated
// Because it is used for autoexposure? Check it is valid
if (num_pixels < MIN_PIXELS_TO_ADJUST) { if (num_pixels < MIN_PIXELS_TO_ADJUST) {
ELP_FERR(fprintf(stderr, "Few pixels to process, giving up. num_pixels=%d, frame=%d (0x%x)\n", num_pixels, frame,frame)); ELP_FERR(fprintf(stderr, "Few pixels to process, giving up. num_pixels=%d, frame=%d (0x%x) valid=0x%lx\n",
num_pixels, frame,frame,histogram_cache[hist_index].valid));
return -1; return -1;
} }
min_white_pixels=num_pixels; min_white_pixels=num_pixels;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment