Commit a61e2d2a authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

1. write correct bayer to exif

2. correction for pgm_limitfps
parent 222bb31e
...@@ -134,7 +134,7 @@ struct sensor_t mt9f002 = { ...@@ -134,7 +134,7 @@ struct sensor_t mt9f002 = {
.imageHeight = 3280, ///< nominal image height for final images .imageHeight = 3280, ///< nominal image height for final images
.clearWidth = 4608, ///< maximal clear image width .clearWidth = 4608, ///< maximal clear image width
.clearHeight = 3288, ///< maximal clear image height; .clearHeight = 3288, ///< maximal clear image height;
.clearTop = 32-MT9F002_VACT_DELAY, ///< top margin to the first clear pixel .clearTop = 32, ///< top margin to the first clear pixel
.clearLeft = 144, ///< left margin to the first clear pixel .clearLeft = 144, ///< left margin to the first clear pixel
.arrayWidth = 4640, ///< total image array width (including black and boundary) .arrayWidth = 4640, ///< total image array width (including black and boundary)
.arrayHeight = 3320, ///< total image array height (including black and boundary) .arrayHeight = 3320, ///< total image array height (including black and boundary)
...@@ -739,12 +739,12 @@ int mt9f002_calc_line_length_pck(struct framepars_t * thispars){ ...@@ -739,12 +739,12 @@ int mt9f002_calc_line_length_pck(struct framepars_t * thispars){
//pr_info("x_addr_end=0x%08x x_addr_start=0x%08x x_odd_inc=0x%08x min_line_blanking_pck=0x%08x\n",x_addr_end,x_addr_start,x_odd_inc,min_line_blanking_pck); //pr_info("x_addr_end=0x%08x x_addr_start=0x%08x x_odd_inc=0x%08x min_line_blanking_pck=0x%08x\n",x_addr_end,x_addr_start,x_odd_inc,min_line_blanking_pck);
v2 = MT9F002_VT_PIX_CLK/MT9F002_OP_PIX_CLK*x_output_size/4 + 0x5E; v2 = MT9F002_VT_PIX_CLK/MT9F002_OP_PIX_CLK*x_output_size/4 + 0x5E;
pr_info("v0=0x%08x v1=0x%08x v2=0x%08x\n",v0,v1,v2); //pr_info("v0=0x%08x v1=0x%08x v2=0x%08x\n",v0,v1,v2);
if (v0<v1) v0 = v1; if (v0<v1) v0 = v1;
if (v0<v2) v0 = v2; if (v0<v2) v0 = v2;
pr_info("result = 0x%08x\n",v0); //pr_info("result = 0x%08x\n",v0);
return v0; return v0;
} }
...@@ -813,7 +813,9 @@ int mt9f002_pgm_window_common (int sensor_port, ///< sensor port ...@@ -813,7 +813,9 @@ int mt9f002_pgm_window_common (int sensor_port, ///< sensor port
wh = thispars->pars[P_SENSOR_PIXV] * dv; wh = thispars->pars[P_SENSOR_PIXV] * dv;
//whe = whs + wh + MT9F002_VACT_DELAY * dv - 1; //whe = whs + wh + MT9F002_VACT_DELAY * dv - 1;
compressor_margin = (thispars->pars[P_SENSOR_PIXH] - thispars->pars[P_WOI_WIDTH]) >> 1; // assuming same for H and V // assuming same for horizontal(H) and vertical(V), margins are from both sides
compressor_margin = (thispars->pars[P_SENSOR_PIXH] - thispars->pars[P_WOI_WIDTH]) >> 1;
//pr_info("Compressor margin = %d\n",compressor_margin);
// 10338 is _not_ flipped (as the other boards, but for legacy compatibility....) // 10338 is _not_ flipped (as the other boards, but for legacy compatibility....)
flip=((thispars->pars[P_FLIPH] & 1) | ((thispars->pars[P_FLIPV] & 1) << 1 )) ^ sensor->init_flips; flip=((thispars->pars[P_FLIPH] & 1) | ((thispars->pars[P_FLIPV] & 1) << 1 )) ^ sensor->init_flips;
...@@ -842,6 +844,7 @@ int mt9f002_pgm_window_common (int sensor_port, ///< sensor port ...@@ -842,6 +844,7 @@ int mt9f002_pgm_window_common (int sensor_port, ///< sensor port
// Margins // Margins
wl = thispars->pars[P_WOI_LEFT] - compressor_margin; wl = thispars->pars[P_WOI_LEFT] - compressor_margin;
wt = thispars->pars[P_WOI_TOP] - compressor_margin; wt = thispars->pars[P_WOI_TOP] - compressor_margin;
dev_dbg(g_dev_ptr,"{%d} wl =0x%x, wt=0x%x, ww=0x%x, wh=0x%x, compressor_margin=0x%x\n",sensor_port, wl, wt, ww, wh, compressor_margin); dev_dbg(g_dev_ptr,"{%d} wl =0x%x, wt=0x%x, ww=0x%x, wh=0x%x, compressor_margin=0x%x\n",sensor_port, wl, wt, ww, wh, compressor_margin);
// flip margins for mirrored images (except oversized, not to rely on sensor->clearWidth/sensor->clearHeight // flip margins for mirrored images (except oversized, not to rely on sensor->clearWidth/sensor->clearHeight
...@@ -849,10 +852,12 @@ int mt9f002_pgm_window_common (int sensor_port, ///< sensor port ...@@ -849,10 +852,12 @@ int mt9f002_pgm_window_common (int sensor_port, ///< sensor port
if (!thispars->pars[P_OVERSIZE]) { if (!thispars->pars[P_OVERSIZE]) {
if(flipX) { if(flipX) {
//pr_info("{%d} flipX = %d\n",sensor_port, flipX);
wl = sensor->clearWidth - ww - wl - (2 * COLOR_MARGINS) * dh; wl = sensor->clearWidth - ww - wl - (2 * COLOR_MARGINS) * dh;
if(wl < 0) wl = 0; if(wl < 0) wl = 0;
} }
if(flipY) { if(flipY) {
//pr_info("{%d} flipY = %d\n",sensor_port, flipY);
wt = sensor->clearHeight - wh - wt - (2 * COLOR_MARGINS) * dv; wt = sensor->clearHeight - wh - wt - (2 * COLOR_MARGINS) * dv;
if(wt < 0) wt = 0; if(wt < 0) wt = 0;
} }
...@@ -860,7 +865,9 @@ int mt9f002_pgm_window_common (int sensor_port, ///< sensor port ...@@ -860,7 +865,9 @@ int mt9f002_pgm_window_common (int sensor_port, ///< sensor port
wt = (wt + sensor->clearTop) & 0xfffe; wt = (wt + sensor->clearTop) & 0xfffe;
wl = (wl + sensor->clearLeft) & 0xfffe; wl = (wl + sensor->clearLeft) & 0xfffe;
dev_dbg(g_dev_ptr,"{%d} wl =0x%x, wt=0x%x\n",sensor_port, wl, wt); dev_dbg(g_dev_ptr,"{%d} wl =0x%x, wt=0x%x\n",sensor_port, wl, wt);
pr_info("{%d} wl =0x%x, wt=0x%x\n",sensor_port, wl, wt);
/*
// apply binning restrictions // apply binning restrictions
d = (bh > 1) ? ((bh > 2) ? 16 : 8) : 4; d = (bh > 1) ? ((bh > 2) ? 16 : 8) : 4;
if(flipX) if(flipX)
...@@ -870,12 +877,13 @@ int mt9f002_pgm_window_common (int sensor_port, ///< sensor port ...@@ -870,12 +877,13 @@ int mt9f002_pgm_window_common (int sensor_port, ///< sensor port
if(i < wl) if(i < wl)
i += d; i += d;
wl = i; wl = i;
*/
} }
wws = wl; wws = wl;
wwe = wws + ww - 1; wwe = wws + ww - 1;
whs = wt; // wt already got sensor->clearTop-MT9F002_VACT_DELAY whs = wt - MT9F002_VACT_DELAY; // wt already got sensor->clearTop-MT9F002_VACT_DELAY
whe = whs + wh + MT9F002_VACT_DELAY*(dv+1) - 1; whe = whs + wh + MT9F002_VACT_DELAY*(dv+1) - 1;
// will be different if binning/skipping // will be different if binning/skipping
wh = whe - whs + 1; wh = whe - whs + 1;
...@@ -918,7 +926,7 @@ int mt9f002_pgm_window_common (int sensor_port, ///< sensor port ...@@ -918,7 +926,7 @@ int mt9f002_pgm_window_common (int sensor_port, ///< sensor port
fll = mt9f002_calc_frame_length_lines(thispars); fll = mt9f002_calc_frame_length_lines(thispars);
//fll = mt9f002_calc_frame_length_lines_2(whs,whe,thispars); //fll = mt9f002_calc_frame_length_lines_2(whs,whe,thispars);
if (fll!=thispars->pars[P_SENSOR_REGS+P_MT9F002_FRAME_LENGTH_LINES]){ if (fll!=thispars->pars[P_SENSOR_REGS+P_MT9F002_FRAME_LENGTH_LINES]){
pr_info("old fll=0x%08x, new fll=0x%08x\n",thispars->pars[P_SENSOR_REGS+P_MT9F002_FRAME_LENGTH_LINES],fll); //pr_info("old fll=0x%08x, new fll=0x%08x\n",thispars->pars[P_SENSOR_REGS+P_MT9F002_FRAME_LENGTH_LINES],fll);
SET_SENSOR_MBPAR_LUT(sensor_port, frame16, P_MT9F002_FRAME_LENGTH_LINES, fll); SET_SENSOR_MBPAR_LUT(sensor_port, frame16, P_MT9F002_FRAME_LENGTH_LINES, fll);
} }
...@@ -1176,7 +1184,7 @@ int mt9f002_pgm_limitfps (int sensor_port, ///< sensor port numb ...@@ -1176,7 +1184,7 @@ int mt9f002_pgm_limitfps (int sensor_port, ///< sensor port numb
// schedule updating P_VIRT_HEIGHT if it changed // schedule updating P_VIRT_HEIGHT if it changed
dev_dbg(g_dev_ptr,"{%d} thispars->pars[P_VIRT_HEIGHT] =%d(0x%x), virt_height=%d(0x%x)\n",sensor_port,(int)thispars->pars[P_VIRT_HEIGHT],(int)thispars->pars[P_VIRT_HEIGHT ],virt_height,virt_height); dev_dbg(g_dev_ptr,"{%d} thispars->pars[P_VIRT_HEIGHT] =%d(0x%x), virt_height=%d(0x%x)\n",sensor_port,(int)thispars->pars[P_VIRT_HEIGHT],(int)thispars->pars[P_VIRT_HEIGHT ],virt_height,virt_height);
if (thispars->pars[P_VIRT_HEIGHT ] != virt_height) { if (thispars->pars[P_VIRT_HEIGHT ] != virt_height) {
pr_info("setting virt_height to %d\n",virt_height); //pr_info("setting virt_height to %d\n",virt_height);
SETFRAMEPARS_SET(P_VIRT_HEIGHT, virt_height); SETFRAMEPARS_SET(P_VIRT_HEIGHT, virt_height);
} }
// schedule updating P_PERIOD if it changed // schedule updating P_PERIOD if it changed
...@@ -1186,7 +1194,7 @@ int mt9f002_pgm_limitfps (int sensor_port, ///< sensor port numb ...@@ -1186,7 +1194,7 @@ int mt9f002_pgm_limitfps (int sensor_port, ///< sensor port numb
pix_period = 1000; // just non-zero pix_period = 1000; // just non-zero
} }
pr_info("check 0: pix_period = 0x%08x (0x%08x*0x%08x)\n",pix_period,row_time_in_pixels,virt_height); //pr_info("check 0: pix_period = 0x%08x (0x%08x*0x%08x)\n",pix_period,row_time_in_pixels,virt_height);
// IMPORTANT: this is moved above setting P_PERIOD // IMPORTANT: this is moved above setting P_PERIOD
// Update period from external trigger (assuming internal/self trigger, we do not know real external trigger period) // Update period from external trigger (assuming internal/self trigger, we do not know real external trigger period)
...@@ -1207,7 +1215,7 @@ int mt9f002_pgm_limitfps (int sensor_port, ///< sensor port numb ...@@ -1207,7 +1215,7 @@ int mt9f002_pgm_limitfps (int sensor_port, ///< sensor port numb
__div64_32(&ull_fp1000s,pix_period); __div64_32(&ull_fp1000s,pix_period);
fp1000s= ull_fp1000s; fp1000s= ull_fp1000s;
pr_info("check 1: FP1000S = 0x%08x\n",fp1000s); //pr_info("check 1: FP1000S = 0x%08x\n",fp1000s);
dev_dbg(g_dev_ptr,"{%d} thispars->pars[P_FP1000S] =%d(0x%x), fp1000s=%d(0x%x)\n",sensor_port,(int)thispars->pars[P_FP1000S],(int)thispars->pars[P_FP1000S],fp1000s,fp1000s); dev_dbg(g_dev_ptr,"{%d} thispars->pars[P_FP1000S] =%d(0x%x), fp1000s=%d(0x%x)\n",sensor_port,(int)thispars->pars[P_FP1000S],(int)thispars->pars[P_FP1000S],fp1000s,fp1000s);
if (thispars->pars[P_FP1000S] != fp1000s) { if (thispars->pars[P_FP1000S] != fp1000s) {
...@@ -1216,7 +1224,7 @@ int mt9f002_pgm_limitfps (int sensor_port, ///< sensor port numb ...@@ -1216,7 +1224,7 @@ int mt9f002_pgm_limitfps (int sensor_port, ///< sensor port numb
// this sets the vertical blanking // this sets the vertical blanking
if (virt_height!=thispars->pars[P_SENSOR_REGS+P_MT9F002_FRAME_LENGTH_LINES]){ if (virt_height!=thispars->pars[P_SENSOR_REGS+P_MT9F002_FRAME_LENGTH_LINES]){
pr_info("limit fps, old frame_length_lines=0x%08x, new frame_length_lines=0x%08x\n",thispars->pars[P_SENSOR_REGS+P_MT9F002_FRAME_LENGTH_LINES],virt_height); //pr_info("limit fps, old frame_length_lines=0x%08x, new frame_length_lines=0x%08x\n",thispars->pars[P_SENSOR_REGS+P_MT9F002_FRAME_LENGTH_LINES],virt_height);
SET_SENSOR_MBPAR_LUT(sensor_port, frame16, P_MT9F002_FRAME_LENGTH_LINES, virt_height); SET_SENSOR_MBPAR_LUT(sensor_port, frame16, P_MT9F002_FRAME_LENGTH_LINES, virt_height);
} }
...@@ -1278,14 +1286,14 @@ int mt9f002_pgm_exposure (int sensor_port, ///< sensor port number ...@@ -1278,14 +1286,14 @@ int mt9f002_pgm_exposure (int sensor_port, ///< sensor port number
// wrong frame // wrong frame
if (frame16 >= PARS_FRAMES) return -1; if (frame16 >= PARS_FRAMES) return -1;
pr_info("EXPOS: %d\n",thispars->pars[P_EXPOS]); //pr_info("EXPOS: %d\n",thispars->pars[P_EXPOS]);
exposure = thispars->pars[P_EXPOS]; exposure = thispars->pars[P_EXPOS];
// if yes: use number of lines == use P_VEXPOS for calculations, update P_EXPOS as well // if yes: use number of lines == use P_VEXPOS for calculations, update P_EXPOS as well
// else : use P_EXPOS // else : use P_EXPOS
if ((video_exposure>0)&&(FRAMEPAR_MODIFIED(P_VEXPOS)||!(FRAMEPAR_MODIFIED(P_EXPOS)||FRAMEPAR_MODIFIED(P_VIRT_WIDTH)))) { if ((video_exposure>0)&&(FRAMEPAR_MODIFIED(P_VEXPOS)||!(FRAMEPAR_MODIFIED(P_EXPOS)||FRAMEPAR_MODIFIED(P_VIRT_WIDTH)))) {
pr_info("using P_VEXPOS\n"); //pr_info("using P_VEXPOS\n");
coarse_exposure = video_exposure; coarse_exposure = video_exposure;
...@@ -1295,7 +1303,7 @@ int mt9f002_pgm_exposure (int sensor_port, ///< sensor port number ...@@ -1295,7 +1303,7 @@ int mt9f002_pgm_exposure (int sensor_port, ///< sensor port number
}else{ }else{
pr_info("using P_EXPOS\n"); //pr_info("using P_EXPOS\n");
// exposure is in microseconds // exposure is in microseconds
exposure = thispars->pars[P_EXPOS]; exposure = thispars->pars[P_EXPOS];
...@@ -1303,7 +1311,7 @@ int mt9f002_pgm_exposure (int sensor_port, ///< sensor port number ...@@ -1303,7 +1311,7 @@ int mt9f002_pgm_exposure (int sensor_port, ///< sensor port number
// always start with min line_length_pck for the current window // always start with min line_length_pck for the current window
line_length_pck = mt9f002_calc_line_length_pck(thispars); line_length_pck = mt9f002_calc_line_length_pck(thispars);
pr_info("exposure = 0x%08x, line_length_pck = 0x%08x\n",exposure,line_length_pck); //pr_info("exposure = 0x%08x, line_length_pck = 0x%08x\n",exposure,line_length_pck);
// actual equation is : sclk*(exposure/10^6) - the result is in Hz*s // actual equation is : sclk*(exposure/10^6) - the result is in Hz*s
ull_video_exposure = (long long) (sclk / 1000000) * (long long) exposure; ull_video_exposure = (long long) (sclk / 1000000) * (long long) exposure;
...@@ -1313,10 +1321,10 @@ int mt9f002_pgm_exposure (int sensor_port, ///< sensor port number ...@@ -1313,10 +1321,10 @@ int mt9f002_pgm_exposure (int sensor_port, ///< sensor port number
coarse_exposure = ull_video_exposure; coarse_exposure = ull_video_exposure;
//frame_length_lines = thispars->pars[P_SENSOR_REGS+P_MT9F002_FRAME_LENGTH_LINES]; //frame_length_lines = thispars->pars[P_SENSOR_REGS+P_MT9F002_FRAME_LENGTH_LINES];
pr_info("coarse exposure = 0x%08x vs 0x%08x = frame_length_lines \n",coarse_exposure,frame_length_lines); //pr_info("coarse exposure = 0x%08x vs 0x%08x = frame_length_lines \n",coarse_exposure,frame_length_lines);
if (coarse_exposure>(frame_length_lines-1)){ if (coarse_exposure>(frame_length_lines-1)){
pr_info("COARSE IS GREATER THAN FRAME LENGTH"); pr_info("Coarse exposure is greater than frame_length_lines\n");
// set coarse to max // set coarse to max
coarse_exposure = frame_length_lines-1; coarse_exposure = frame_length_lines-1;
ull_video_exposure = (long long) (sclk / 1000000) * (long long) exposure; ull_video_exposure = (long long) (sclk / 1000000) * (long long) exposure;
...@@ -1330,7 +1338,7 @@ int mt9f002_pgm_exposure (int sensor_port, ///< sensor port number ...@@ -1330,7 +1338,7 @@ int mt9f002_pgm_exposure (int sensor_port, ///< sensor port number
ull_video_exposure = (long long) (sclk / 1000000) * (long long) exposure; ull_video_exposure = (long long) (sclk / 1000000) * (long long) exposure;
fine_exposure = ull_video_exposure - (long long) coarse_exposure * (long long) line_length_pck; fine_exposure = ull_video_exposure - (long long) coarse_exposure * (long long) line_length_pck;
pr_info("fine exposure = %d (0x%08x)\n",fine_exposure,fine_exposure); //pr_info("fine exposure = %d (0x%08x)\n",fine_exposure,fine_exposure);
} }
......
...@@ -1249,12 +1249,18 @@ int pgm_limitfps (int sensor_port, ///< sensor port number (0..3 ...@@ -1249,12 +1249,18 @@ int pgm_limitfps (int sensor_port, ///< sensor port number (0..3
if (frame16 >= PARS_FRAMES) return -1; // wrong frame if (frame16 >= PARS_FRAMES) return -1; // wrong frame
cycles=thispars->pars[P_TILES]; // number of tiles nc393: [P_TILES] == 0! cycles=thispars->pars[P_TILES]; // number of tiles nc393: [P_TILES] == 0!
// dev_dbg(g_dev_ptr,"{%d} tiles=%d(0x%x)\n",sensor_port,cycles,cycles); // dev_dbg(g_dev_ptr,"{%d} tiles=%d(0x%x)\n",sensor_port,cycles,cycles);
switch (thispars->pars[P_COLOR] & 0x0f){ switch (thispars->pars[P_COLOR] & 0x0f){
case COLORMODE_MONO6: case COLORMODE_MONO6:
case COLORMODE_COLOR: case COLORMODE_COLOR:
case COLORMODE_JP46: case COLORMODE_JP46:
case COLORMODE_JP46DC: case COLORMODE_JP46DC:
case COLORMODE_COLOR20: case COLORMODE_COLOR20:
// TEMPORARY FIX FOR JPEG and friends: add extra line of tiles
// compressor uses P_ACTUAL_WIDTH not P_WOI_WIDTH
cycles += (thispars->pars[P_ACTUAL_WIDTH]>>4);
cycles*=6; // now - blocks per frame cycles*=6; // now - blocks per frame
break; break;
default: default:
...@@ -1335,7 +1341,7 @@ int pgm_limitfps (int sensor_port, ///< sensor port number (0..3 ...@@ -1335,7 +1341,7 @@ int pgm_limitfps (int sensor_port, ///< sensor port number (0..3
if (min_period != thispars->pars[P_PERIOD_MIN]) { if (min_period != thispars->pars[P_PERIOD_MIN]) {
SETFRAMEPARS_SET(P_PERIOD_MIN, min_period); // set it (and propagate to the later frames) SETFRAMEPARS_SET(P_PERIOD_MIN, min_period); // set it (and propagate to the later frames)
dev_dbg(g_dev_ptr,"{%d} SETFRAMEPARS_SET(P_PERIOD_MIN, 0x%x)\n", sensor_port, min_period); dev_dbg(g_dev_ptr,"{%d} SETFRAMEPARS_SET(P_PERIOD_MIN, 0x%x)\n", sensor_port, min_period);
pr_info("{%d} min period got updated to 0x%x (clk_sensor=%d, clk_fpga=%d)\n", sensor_port, min_period,clk_sensor,clk_fpga); //pr_info("{%d} min period got updated to 0x%x (clk_sensor=%d, clk_fpga=%d)\n", sensor_port, min_period,clk_sensor,clk_fpga);
MDP(DBGB_PADD, sensor_port,"SETFRAMEPARS_SET(P_PERIOD_MIN, 0x%x)\n", min_period) MDP(DBGB_PADD, sensor_port,"SETFRAMEPARS_SET(P_PERIOD_MIN, 0x%x)\n", min_period)
} }
if (((thispars->pars[P_FPSFLAGS] & 2)==0) || (period < min_period)) period=0x7fffffff; // no upper limit if (((thispars->pars[P_FPSFLAGS] & 2)==0) || (period < min_period)) period=0x7fffffff; // no upper limit
...@@ -1551,6 +1557,7 @@ int pgm_sensorin (int sensor_port, ///< sensor port number (0..3 ...@@ -1551,6 +1557,7 @@ int pgm_sensorin (int sensor_port, ///< sensor port number (0..3
// Change Bayer for gamma/histograms? // Change Bayer for gamma/histograms?
if (bayer_modified) { if (bayer_modified) {
bayer = thispars->pars[P_BAYER] ^ flips ^ sensor->bayer ^ 3; // 3 added for NC393; bayer = thispars->pars[P_BAYER] ^ flips ^ sensor->bayer ^ 3; // 3 added for NC393;
//pr_info("P_BAYER=%d flips=%d sensor->bayer=%d\n",thispars->pars[P_BAYER],flips,sensor->bayer);
setFramePar(sensor_port, thispars, P_COMP_BAYER | FRAMEPAIR_FORCE_PROC, bayer); setFramePar(sensor_port, thispars, P_COMP_BAYER | FRAMEPAIR_FORCE_PROC, bayer);
gamma_ctl.bayer = bayer; // 3 added for NC393 gamma_ctl.bayer = bayer; // 3 added for NC393
gamma_ctl.bayer_set = 1; gamma_ctl.bayer_set = 1;
...@@ -2226,19 +2233,6 @@ int pgm_memcompressor (int sensor_port, ///< sensor port number ( ...@@ -2226,19 +2233,6 @@ int pgm_memcompressor (int sensor_port, ///< sensor port number (
(cmprs_frame_format.num_macro_cols_m1+1)*(cmprs_frame_format.num_macro_rows_m1+1) (cmprs_frame_format.num_macro_cols_m1+1)*(cmprs_frame_format.num_macro_rows_m1+1)
); );
pr_info("PGM_MEMCOMPRESSOR: sport=%d width_bursts=%d width_marg=%d height_marg=%d num_macro_rows_m1=%d tile_width=%d tile_height=%d margin_left=%d margin_top=%d P_TILES=%d\n",
sensor_port,
width_bursts,
width_marg,
height_marg,
(cmprs_frame_format.num_macro_rows_m1 + 1) << 4,
tile_width,
tile_height,
0,
cmprs_top,
(cmprs_frame_format.num_macro_cols_m1+1)*(cmprs_frame_format.num_macro_rows_m1+1)
);
setup_compressor_memory (sensor_port, // sensor port number (0..3) setup_compressor_memory (sensor_port, // sensor port number (0..3)
width_bursts, // 13-bit - in 8*16=128 bit bursts width_bursts, // 13-bit - in 8*16=128 bit bursts
(cmprs_frame_format.num_macro_rows_m1 + 1) << 4, (cmprs_frame_format.num_macro_rows_m1 + 1) << 4,
......
...@@ -498,7 +498,8 @@ inline void updateIRQ_Exif(struct jpeg_ptr_t *jptr, ///< pointer ...@@ -498,7 +498,8 @@ inline void updateIRQ_Exif(struct jpeg_ptr_t *jptr, ///< pointer
int index_time = jptr->jpeg_wp - 11; int index_time = jptr->jpeg_wp - 11;
char time_buff[27]; char time_buff[27];
char * exif_meta_time_string; char * exif_meta_time_string;
int global_flips, extra_flips; // calcualte bayer without flips - extra xor
int global_flips, extra_flips, bayer;
unsigned char orientations[]="1638274545273816"; unsigned char orientations[]="1638274545273816";
unsigned char orientation_short[2]; unsigned char orientation_short[2];
int maker_offset; int maker_offset;
...@@ -522,6 +523,12 @@ inline void updateIRQ_Exif(struct jpeg_ptr_t *jptr, ///< pointer ...@@ -522,6 +523,12 @@ inline void updateIRQ_Exif(struct jpeg_ptr_t *jptr, ///< pointer
global_flips=extra_flips & 3; global_flips=extra_flips & 3;
} }
// calculate bayer without flips
bayer = get_imageParamsFrame(sensor_port, P_COMP_BAYER, frame);
bayer ^= get_imageParamsFrame(sensor_port, P_COMPMOD_BYRSH, frame);
// subtract flips
bayer ^= global_flips;
orientation_short[0]=0; orientation_short[0]=0;
orientation_short[1]=0xf & orientations[(get_imageParamsFrame(sensor_port, P_PORTRAIT, frame)&3) | (global_flips<<2)]; orientation_short[1]=0xf & orientations[(get_imageParamsFrame(sensor_port, P_PORTRAIT, frame)&3) | (global_flips<<2)];
write_meta_irq(sensor_port, orientation_short, &meta_offsets.Image_Orientation, Exif_Image_Orientation, 2); write_meta_irq(sensor_port, orientation_short, &meta_offsets.Image_Orientation, Exif_Image_Orientation, 2);
...@@ -552,7 +559,7 @@ inline void updateIRQ_Exif(struct jpeg_ptr_t *jptr, ///< pointer ...@@ -552,7 +559,7 @@ inline void updateIRQ_Exif(struct jpeg_ptr_t *jptr, ///< pointer
putlong_meta_raw_irq(sensor_port, get_imageParamsFrame(sensor_port, P_WOI_LEFT,frame) | (get_imageParamsFrame(sensor_port, P_WOI_WIDTH,frame)<<16), maker_offset+32); //No Past putlong_meta_raw_irq(sensor_port, get_imageParamsFrame(sensor_port, P_WOI_LEFT,frame) | (get_imageParamsFrame(sensor_port, P_WOI_WIDTH,frame)<<16), maker_offset+32); //No Past
putlong_meta_raw_irq(sensor_port, get_imageParamsFrame(sensor_port, P_WOI_TOP,frame) | (get_imageParamsFrame(sensor_port, P_WOI_HEIGHT,frame)<<16), maker_offset+36); //No Past putlong_meta_raw_irq(sensor_port, get_imageParamsFrame(sensor_port, P_WOI_TOP,frame) | (get_imageParamsFrame(sensor_port, P_WOI_HEIGHT,frame)<<16), maker_offset+36); //No Past
putlong_meta_raw_irq(sensor_port, global_flips | putlong_meta_raw_irq(sensor_port, global_flips |
((get_imageParamsFrame(sensor_port, P_BAYER, frame)<<2) & 0xc) | ((bayer<<2) & 0xc) |
((get_imageParamsFrame(sensor_port, P_COLOR, frame)<<4) & 0xF0) | ((get_imageParamsFrame(sensor_port, P_COLOR, frame)<<4) & 0xF0) |
((get_imageParamsFrame(sensor_port, P_DCM_HOR, frame)<<8) & 0xF00) | ((get_imageParamsFrame(sensor_port, P_DCM_HOR, frame)<<8) & 0xF00) |
((get_imageParamsFrame(sensor_port, P_DCM_VERT, frame)<<12) & 0xF000) | ((get_imageParamsFrame(sensor_port, P_DCM_VERT, frame)<<12) & 0xF000) |
......
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