Commit b0232c4a authored by Andrey Filippov's avatar Andrey Filippov

modified for raw, depends on x393 branch 'lwir'

parent 7abbacd9
...@@ -2073,6 +2073,9 @@ int pgm_memsensor (int sensor_port, ///< sensor port number ( ...@@ -2073,6 +2073,9 @@ int pgm_memsensor (int sensor_port, ///< sensor port number (
break; break;
} }
width_bursts = (width_marg >> 4) + ((width_marg & 0xf) ? 1 : 0); width_bursts = (width_marg >> 4) + ((width_marg & 0xf) ? 1 : 0);
if ((thispars->pars[P_COLOR] == COLORMODE_RAW) && (thispars->pars[P_BITS] > 8)){
width_bursts *= 2;
}
dev_dbg(g_dev_ptr,"PGM_MEMSENSOR: sport=%d width_burts=%d width_marg=%d height_marg=%d left_margin=%d top_margin=%d\n", dev_dbg(g_dev_ptr,"PGM_MEMSENSOR: sport=%d width_burts=%d width_marg=%d height_marg=%d left_margin=%d top_margin=%d\n",
sensor_port, sensor_port,
...@@ -2218,6 +2221,9 @@ int pgm_memcompressor (int sensor_port, ///< sensor port number ( ...@@ -2218,6 +2221,9 @@ int pgm_memcompressor (int sensor_port, ///< sensor port number (
} }
width_bursts = (width_marg >> 4) + ((width_marg & 0xf) ? 1 : 0); width_bursts = (width_marg >> 4) + ((width_marg & 0xf) ? 1 : 0);
if ((thispars->pars[P_COLOR] == COLORMODE_RAW) && (thispars->pars[P_BITS] > 8)){
width_bursts *= 2;
}
// Adjusting for tile width. TODO: probably not needed, handled in FPGA - verify (and remove 2 next lines) // Adjusting for tile width. TODO: probably not needed, handled in FPGA - verify (and remove 2 next lines)
if (width_bursts & 1) width_bursts++; if (width_bursts & 1) width_bursts++;
if ((tile_width>2) && (width_bursts & 2)) width_bursts += 2; if ((tile_width>2) && (width_bursts & 2)) width_bursts += 2;
...@@ -2314,7 +2320,7 @@ int pgm_compmode (int sensor_port, ///< sensor port number (0..3 ...@@ -2314,7 +2320,7 @@ int pgm_compmode (int sensor_port, ///< sensor port number (0..3
if (!jpeg_htable_is_programmed(sensor_port)) jpeg_htable_fpga_pgm (sensor_port); if (!jpeg_htable_is_programmed(sensor_port)) jpeg_htable_fpga_pgm (sensor_port);
if (frame16 >= PARS_FRAMES) return -1; // wrong frame if (frame16 >= PARS_FRAMES) return -1; // wrong frame
// x393cmd = (frame16<0)? ASAP: ABSOLUTE; // x393cmd = (frame16<0)? ASAP: ABSOLUTE;
if (FRAMEPAR_MODIFIED(P_COLOR)) { if (FRAMEPAR_MODIFIED(P_COLOR) || FRAMEPAR_MODIFIED(P_BITS)) {
switch (thispars->pars[P_COLOR] & 0x0f){ switch (thispars->pars[P_COLOR] & 0x0f){
case COLORMODE_MONO6: cmprs_mode.cmode = X393_CMPRS_CBIT_CMODE_MONO6; break; case COLORMODE_MONO6: cmprs_mode.cmode = X393_CMPRS_CBIT_CMODE_MONO6; break;
case COLORMODE_COLOR: cmprs_mode.cmode = X393_CMPRS_CBIT_CMODE_JPEG18; break; case COLORMODE_COLOR: cmprs_mode.cmode = X393_CMPRS_CBIT_CMODE_JPEG18; break;
...@@ -2328,6 +2334,10 @@ int pgm_compmode (int sensor_port, ///< sensor port number (0..3 ...@@ -2328,6 +2334,10 @@ int pgm_compmode (int sensor_port, ///< sensor port number (0..3
case COLORMODE_JP4DIFF2: cmprs_mode.cmode = X393_CMPRS_CBIT_CMODE_JP4DIFFDIV2; break; case COLORMODE_JP4DIFF2: cmprs_mode.cmode = X393_CMPRS_CBIT_CMODE_JP4DIFFDIV2; break;
case COLORMODE_JP4HDR2: cmprs_mode.cmode = X393_CMPRS_CBIT_CMODE_JP4DIFFHDRDIV2; break; case COLORMODE_JP4HDR2: cmprs_mode.cmode = X393_CMPRS_CBIT_CMODE_JP4DIFFHDRDIV2; break;
case COLORMODE_MONO4: cmprs_mode.cmode = X393_CMPRS_CBIT_CMODE_MONO4; break; case COLORMODE_MONO4: cmprs_mode.cmode = X393_CMPRS_CBIT_CMODE_MONO4; break;
case COLORMODE_RAW: cmprs_mode.cmode = X393_CMPRS_CBIT_CMODE_RAW;
cmprs_mode.raw_be16 = (thispars->pars[P_BITS] > 8);
cmprs_mode.raw_be16_set = 1;
break;
} }
cmprs_mode.cmode_set = 1; cmprs_mode.cmode_set = 1;
// TODO: Modify left margin by 1 for COLORMODE_COLOR ! // TODO: Modify left margin by 1 for COLORMODE_COLOR !
...@@ -2871,6 +2881,7 @@ int pgm_comprestart(int sensor_port, ///< sensor port number (0..3 ...@@ -2871,6 +2881,7 @@ int pgm_comprestart(int sensor_port, ///< sensor port number (0..3
int extra_pages; int extra_pages;
int disable_need = 1; // TODO: Use some G_* parameter int disable_need = 1; // TODO: Use some G_* parameter
int reset_frame; int reset_frame;
int raw_mode;
x393_cmprs_mode_t cmprs_mode = {.d32=0}; x393_cmprs_mode_t cmprs_mode = {.d32=0};
dev_dbg(g_dev_ptr,"{%d} frame16=%d\n",sensor_port,frame16); dev_dbg(g_dev_ptr,"{%d} frame16=%d\n",sensor_port,frame16);
MDP(DBGB_PSFN, sensor_port,"frame16=%d\n",frame16) MDP(DBGB_PSFN, sensor_port,"frame16=%d\n",frame16)
...@@ -2887,9 +2898,15 @@ int pgm_comprestart(int sensor_port, ///< sensor port number (0..3 ...@@ -2887,9 +2898,15 @@ int pgm_comprestart(int sensor_port, ///< sensor port number (0..3
case COLORMODE_COLOR: case COLORMODE_COLOR:
case COLORMODE_COLOR20: case COLORMODE_COLOR20:
extra_pages = 1; extra_pages = 1;
raw_mode = 0;
break; break;
default: case COLORMODE_RAW:
extra_pages = 0; extra_pages = 0;
raw_mode = 1;
break;
default:
extra_pages = 0; // including raw mode
raw_mode = 0;
} }
// Compressor memory can be stopped, run single (next frame) or run continuously // Compressor memory can be stopped, run single (next frame) or run continuously
// Compressor itself can run in standalone mode 2 (when sensor is stopped/single) or normal mode "3" (X393_CMPRS_CBIT_RUN_ENABLE) // Compressor itself can run in standalone mode 2 (when sensor is stopped/single) or normal mode "3" (X393_CMPRS_CBIT_RUN_ENABLE)
...@@ -2913,6 +2930,7 @@ int pgm_comprestart(int sensor_port, ///< sensor port number (0..3 ...@@ -2913,6 +2930,7 @@ int pgm_comprestart(int sensor_port, ///< sensor port number (0..3
control_compressor_memory (sensor_port, control_compressor_memory (sensor_port,
thispars->pars[P_COMPRESSOR_RUN] & 3, // stop/single/run(/reset) thispars->pars[P_COMPRESSOR_RUN] & 3, // stop/single/run(/reset)
reset_frame, reset_frame,
raw_mode,
extra_pages, extra_pages,
disable_need, disable_need,
(frame16<0)? ASAP: ABSOLUTE, // how to apply commands - directly or through channel sequencer (frame16<0)? ASAP: ABSOLUTE, // how to apply commands - directly or through channel sequencer
...@@ -2976,6 +2994,7 @@ int pgm_compstop (int sensor_port, ///< sensor port number (0..3 ...@@ -2976,6 +2994,7 @@ int pgm_compstop (int sensor_port, ///< sensor port number (0..3
{ {
#ifndef NC353 #ifndef NC353
int extra_pages; int extra_pages;
int raw_mode;
int disable_need = 1; // TODO: Use some G_* parameter int disable_need = 1; // TODO: Use some G_* parameter
x393_cmprs_mode_t cmprs_mode = {.d32=0}; x393_cmprs_mode_t cmprs_mode = {.d32=0};
dev_dbg(g_dev_ptr,"{%d} frame16=%d\n",sensor_port,frame16); dev_dbg(g_dev_ptr,"{%d} frame16=%d\n",sensor_port,frame16);
...@@ -2985,9 +3004,15 @@ int pgm_compstop (int sensor_port, ///< sensor port number (0..3 ...@@ -2985,9 +3004,15 @@ int pgm_compstop (int sensor_port, ///< sensor port number (0..3
case COLORMODE_COLOR: case COLORMODE_COLOR:
case COLORMODE_COLOR20: case COLORMODE_COLOR20:
extra_pages = 1; extra_pages = 1;
raw_mode = 0;
break;
case COLORMODE_RAW:
extra_pages = 0;
raw_mode = 1;
break; break;
default: default:
extra_pages = 0; extra_pages = 0;
raw_mode = 0;
} }
// Stop compressor (do not propagate frame sync late, finish current frame) // Stop compressor (do not propagate frame sync late, finish current frame)
cmprs_mode.run = X393_CMPRS_CBIT_RUN_DISABLE; cmprs_mode.run = X393_CMPRS_CBIT_RUN_DISABLE;
...@@ -2999,6 +3024,7 @@ int pgm_compstop (int sensor_port, ///< sensor port number (0..3 ...@@ -2999,6 +3024,7 @@ int pgm_compstop (int sensor_port, ///< sensor port number (0..3
control_compressor_memory (sensor_port, // compressor memory off control_compressor_memory (sensor_port, // compressor memory off
COMPRESSOR_RUN_STOP, COMPRESSOR_RUN_STOP,
0, // reset_frame 0, // reset_frame
raw_mode,
extra_pages, extra_pages,
disable_need, disable_need,
(frame16<0)? ASAP: ABSOLUTE, // how to apply commands - directly or through channel sequencer (frame16<0)? ASAP: ABSOLUTE, // how to apply commands - directly or through channel sequencer
...@@ -3042,6 +3068,7 @@ int pgm_compctl (int sensor_port, ///< sensor port number (0..3 ...@@ -3042,6 +3068,7 @@ int pgm_compctl (int sensor_port, ///< sensor port number (0..3
int disable_need = 1; // TODO: Use some G_* parameter int disable_need = 1; // TODO: Use some G_* parameter
x393_cmprs_mode_t cmprs_mode = {.d32=0}; x393_cmprs_mode_t cmprs_mode = {.d32=0};
int reset_frame = 0; int reset_frame = 0;
int raw_mode;
// int just_started = 0; // int just_started = 0;
dev_dbg(g_dev_ptr,"{%d} frame16=%d, prevpars->pars[P_COMPRESSOR_RUN]=%d, thispars->pars[P_COMPRESSOR_RUN]=%d \n", dev_dbg(g_dev_ptr,"{%d} frame16=%d, prevpars->pars[P_COMPRESSOR_RUN]=%d, thispars->pars[P_COMPRESSOR_RUN]=%d \n",
sensor_port,frame16, (int) prevpars->pars[P_COMPRESSOR_RUN], (int) thispars->pars[P_COMPRESSOR_RUN]); sensor_port,frame16, (int) prevpars->pars[P_COMPRESSOR_RUN], (int) thispars->pars[P_COMPRESSOR_RUN]);
...@@ -3054,9 +3081,15 @@ int pgm_compctl (int sensor_port, ///< sensor port number (0..3 ...@@ -3054,9 +3081,15 @@ int pgm_compctl (int sensor_port, ///< sensor port number (0..3
case COLORMODE_COLOR: case COLORMODE_COLOR:
case COLORMODE_COLOR20: case COLORMODE_COLOR20:
extra_pages = 1; extra_pages = 1;
raw_mode = 0;
break;
case COLORMODE_RAW:
extra_pages = 0;
raw_mode = 1;
break; break;
default: default:
extra_pages = 0; extra_pages = 0;
raw_mode = 0;
} }
// Compressor memory can be stopped, run single (next frame) or run continuously // Compressor memory can be stopped, run single (next frame) or run continuously
// Compressor itself can run in standalone mode 2 (when sensor is stopped/single) or normal mode "3" (X393_CMPRS_CBIT_RUN_ENABLE) // Compressor itself can run in standalone mode 2 (when sensor is stopped/single) or normal mode "3" (X393_CMPRS_CBIT_RUN_ENABLE)
...@@ -3079,6 +3112,7 @@ int pgm_compctl (int sensor_port, ///< sensor port number (0..3 ...@@ -3079,6 +3112,7 @@ int pgm_compctl (int sensor_port, ///< sensor port number (0..3
control_compressor_memory (sensor_port, control_compressor_memory (sensor_port,
thispars->pars[P_COMPRESSOR_RUN] & 3, // stop/single/run(/reset) thispars->pars[P_COMPRESSOR_RUN] & 3, // stop/single/run(/reset)
reset_frame, reset_frame,
raw_mode,
extra_pages, extra_pages,
disable_need, disable_need,
(frame16<0)? ASAP: ABSOLUTE, // how to apply commands - directly or through channel sequencer (frame16<0)? ASAP: ABSOLUTE, // how to apply commands - directly or through channel sequencer
......
...@@ -572,6 +572,7 @@ int control_compressor_memory (int num_sensor, ///< sensor port number (0. ...@@ -572,6 +572,7 @@ int control_compressor_memory (int num_sensor, ///< sensor port number (0.
int cmd, ///< command: 0 stop, 1 - single, 2 - repetitive, 3 - reset int cmd, ///< command: 0 stop, 1 - single, 2 - repetitive, 3 - reset
int reset_frame, ///< reset addresses to the start of frame, reset buffer (1 of 4) pointer. int reset_frame, ///< reset addresses to the start of frame, reset buffer (1 of 4) pointer.
///< Should only be used if the channel controller was stopped before ///< Should only be used if the channel controller was stopped before
int linear, ///< 0 tiled, 1 - linescan (for raw images)
int extra_pages, ///< extra pages needed (1) - number of previous pages to keep in a 4-page buffer int extra_pages, ///< extra pages needed (1) - number of previous pages to keep in a 4-page buffer
int disable_need, ///< disable "need" (yield to sensor channels - they can not wait) int disable_need, ///< disable "need" (yield to sensor channels - they can not wait)
x393cmd_t x393cmd, ///< how to apply commands - directly or through channel sequencer x393cmd_t x393cmd, ///< how to apply commands - directly or through channel sequencer
...@@ -584,6 +585,7 @@ int control_compressor_memory (int num_sensor, ///< sensor port number (0. ...@@ -584,6 +585,7 @@ int control_compressor_memory (int num_sensor, ///< sensor port number (0.
.extra_pages = 1, // [ 4: 3] (0) 2-bit number of extra pages that need to stay (not to be overwritten) in the buffer .extra_pages = 1, // [ 4: 3] (0) 2-bit number of extra pages that need to stay (not to be overwritten) in the buffer
.keep_open = 0, // [ 5] (0) (NA in linescan) for 8 or less rows - do not close page between accesses (not used in scanline mode) .keep_open = 0, // [ 5] (0) (NA in linescan) for 8 or less rows - do not close page between accesses (not used in scanline mode)
.byte32 = 1, // [ 6] (1) (NA in linescan) 32-byte columns (0 - 16-byte), not used in scanline mode .byte32 = 1, // [ 6] (1) (NA in linescan) 32-byte columns (0 - 16-byte), not used in scanline mode
.linear = linear, // [ 7] (1) Use linear mode instead of tiled (for raw image files): extra_pages=0, keep_open=x, byte32=x
.reset_frame = 1, // [ 8] (0) reset frame number .reset_frame = 1, // [ 8] (0) reset frame number
.single = 0, // [ 9] (0) run single frame .single = 0, // [ 9] (0) run single frame
.repetitive = 1, // [ 10] (1) run repetitive frames .repetitive = 1, // [ 10] (1) run repetitive frames
......
...@@ -32,7 +32,7 @@ int control_sensor_memory (int num_sensor, int cmd, int reset_frame, x393cmd_t ...@@ -32,7 +32,7 @@ int control_sensor_memory (int num_sensor, int cmd, int reset_frame, x393cmd_t
int setup_compressor_memory (int num_sensor, int window_width, int window_height, int window_left, int setup_compressor_memory (int num_sensor, int window_width, int window_height, int window_left,
int window_top, int tile_width, int tile_height, int tile_vstep, int window_top, int tile_width, int tile_height, int tile_vstep,
x393cmd_t x393cmd, int frame16); x393cmd_t x393cmd, int frame16);
int control_compressor_memory (int num_sensor, int cmd, int reset_frame, int extra_pages, int disable_need, x393cmd_t x393cmd, int frame16); int control_compressor_memory (int num_sensor, int cmd, int reset_frame, int linear, int extra_pages, int disable_need, x393cmd_t x393cmd, int frame16);
int frames_in_buffer_minus_one (int num_sensor); int frames_in_buffer_minus_one (int num_sensor);
void memchan_enable (int chn, int enable); void memchan_enable (int chn, int enable);
......
...@@ -509,6 +509,7 @@ ...@@ -509,6 +509,7 @@
#define COLORMODE_JP4DIFF2 9 ///< jp4, 4 blocks, differential, divide differences by 2: red := (R-G1)/2, blue:=(B-G1)/2, green=G1, green2 (G2-G1)/2 #define COLORMODE_JP4DIFF2 9 ///< jp4, 4 blocks, differential, divide differences by 2: red := (R-G1)/2, blue:=(B-G1)/2, green=G1, green2 (G2-G1)/2
#define COLORMODE_JP4HDR2 10 ///< jp4, 4 blocks, differential HDR: red := (R-G1)/2, blue:=(B-G1)/2, green=G1, green2 (high gain)=G2), #define COLORMODE_JP4HDR2 10 ///< jp4, 4 blocks, differential HDR: red := (R-G1)/2, blue:=(B-G1)/2, green=G1, green2 (high gain)=G2),
#define COLORMODE_MONO4 14 ///< monochrome, 4 blocks (but still with 2x2 macroblocks) #define COLORMODE_MONO4 14 ///< monochrome, 4 blocks (but still with 2x2 macroblocks)
#define COLORMODE_RAW 15 ///< raw 8/16-bit data in scanline order, bypassing compressor
// the following 8 values should go in the same sequence as fields in the histogram page // the following 8 values should go in the same sequence as fields in the histogram page
// 393: per sub-channel // 393: per sub-channel
//// Will need to have them per-subchannel (4x) //// Will need to have them per-subchannel (4x)
......
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