Commit 0ad0b4a8 authored by Andrey Filippov's avatar Andrey Filippov

corrected memsensor/memcompressor line comparison

parent f8db6dd0
[*]
[*] GTKWave Analyzer v3.3.66 (w)1999-2015 BSI
[*] Tue Nov 15 08:28:37 2016
[*] Thu Nov 17 03:52:16 2016
[*]
[dumpfile] "/home/eyesis/git/x393-neon/simulation/x393_dut-20161115004643177.fst"
[dumpfile_mtime] "Tue Nov 15 08:28:05 2016"
[dumpfile_size] 302685090
[dumpfile] "/home/eyesis/git/x393-neon/simulation/x393_dut-20161116200800621.fst"
[dumpfile_mtime] "Thu Nov 17 03:40:28 2016"
[dumpfile_size] 230939121
[savefile] "/home/eyesis/git/x393-neon/cocotb/x393_cocotb_03.sav"
[timestart] 152590000
[timestart] 0
[size] 1814 1171
[pos] 0 0
*-23.275805 166587388 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
*-25.389460 68867388 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
[treeopen] x393_dut.
[treeopen] x393_dut.simul_sensor12bits_2_i.
[treeopen] x393_dut.simul_sensor12bits_3_i.
......@@ -47,7 +47,9 @@
[treeopen] x393_dut.x393_i.mcntrl393_i.sens_comp_block[0].mcntrl_tiled_rd_compressor_i.
[treeopen] x393_dut.x393_i.mcntrl393_i.sens_comp_block[1].
[treeopen] x393_dut.x393_i.mcntrl393_i.sens_comp_block[2].
[treeopen] x393_dut.x393_i.mcntrl393_i.sens_comp_block[2].mcntrl_tiled_rd_compressor_i.
[treeopen] x393_dut.x393_i.mcntrl393_i.sens_comp_block[3].
[treeopen] x393_dut.x393_i.mcntrl393_i.sens_comp_block[3].mcntrl_tiled_rd_compressor_i.
[treeopen] x393_dut.x393_i.mult_saxi_wr_i.mult_saxi_wr_pointers_i.
[treeopen] x393_dut.x393_i.mult_saxi_wr_inbuf_i.
[treeopen] x393_dut.x393_i.sensors393_i.
......@@ -2758,18 +2760,69 @@ x393_dut.x393_i.sof_out_mclk[3:0]
-group_end
@800200
-jpeg3
-memsensor3
@22
x393_dut.x393_i.mcntrl393_i.sens_comp_block[2].mcntrl_linear_wr_sensor_i.window_height[16:0]
x393_dut.x393_i.mcntrl393_i.sens_comp_block[2].mcntrl_linear_wr_sensor_i.window_width[13:0]
@1000200
-memsensor3
@22
x393_dut.x393_i.mcntrl393_i.sens_comp_block[2].mcntrl_tiled_rd_compressor_i.window_height[16:0]
x393_dut.x393_i.mcntrl393_i.sens_comp_block[2].mcntrl_tiled_rd_compressor_i.window_width[13:0]
x393_dut.x393_i.mcntrl393_i.sens_comp_block[2].mcntrl_tiled_rd_compressor_i.tile_rows[6:0]
x393_dut.x393_i.mcntrl393_i.sens_comp_block[2].mcntrl_tiled_rd_compressor_i.tile_vstep[6:0]
@28
x393_dut.x393_i.mcntrl393_i.sens_comp_block[3].mcntrl_tiled_rd_compressor_i.chn_en
x393_dut.x393_i.mcntrl393_i.sens_comp_block[3].mcntrl_tiled_rd_compressor_i.chn_rst
x393_dut.x393_i.mcntrl393_i.sens_comp_block[3].mcntrl_tiled_rd_compressor_i.frame_en
x393_dut.x393_i.mcntrl393_i.sens_comp_block[3].mcntrl_tiled_rd_compressor_i.frame_start
x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.frames_numbers_differ
@23
@22
[color] 6
x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.line_unfinished_src[15:0]
@28
x393_dut.x393_i.mcntrl393_i.sens_comp_block[3].mcntrl_tiled_rd_compressor_i.frame_start_mod
x393_dut.x393_i.mcntrl393_i.sens_comp_block[3].mcntrl_tiled_rd_compressor_i.chn_dis_delayed
(6)x393_dut.x393_i.mcntrl393_i.sens_comp_block[3].mcntrl_tiled_rd_compressor_i.recalc_r[8:0]
@c00022
[color] 6
x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.line_unfinished[15:0]
@28
[color] 6
(0)x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.line_unfinished[15:0]
[color] 6
(1)x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.line_unfinished[15:0]
[color] 6
(2)x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.line_unfinished[15:0]
[color] 6
(3)x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.line_unfinished[15:0]
[color] 6
(4)x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.line_unfinished[15:0]
[color] 6
(5)x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.line_unfinished[15:0]
[color] 6
(6)x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.line_unfinished[15:0]
[color] 6
(7)x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.line_unfinished[15:0]
[color] 6
(8)x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.line_unfinished[15:0]
[color] 6
(9)x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.line_unfinished[15:0]
[color] 6
(10)x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.line_unfinished[15:0]
[color] 6
(11)x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.line_unfinished[15:0]
[color] 6
(12)x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.line_unfinished[15:0]
[color] 6
(13)x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.line_unfinished[15:0]
[color] 6
(14)x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.line_unfinished[15:0]
[color] 6
(15)x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.line_unfinished[15:0]
@1401200
-group_end
@28
x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.cmprs_frame_sync_i.line_numbers_sync
x393_dut.x393_i.mcntrl393_i.sens_comp_block[3].mcntrl_tiled_rd_compressor_i.frames_in_sync
[color] 3
......@@ -2807,6 +2860,11 @@ x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.huffman_stuf
@28
x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.huffman_stuffer_meta_i.stuffer_bytes[1:0]
x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.huffman_stuffer_meta_i.stuffer_dv
x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.huffman_stuffer_meta_i.bit_stuffer_27_32_i.flush_in
x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.flush_hclk
x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.irq
@23
x393_dut.x393_i.compressor393_i.cmprs_channel_block[3].jp_channel_i.frame_num_compressed[3:0]
@c00200
-bit_stuffer_27_32
@28
......
......@@ -188,7 +188,8 @@ module cmprs_frame_sync#(
frames_numbers_differ <= !suspend_end && (frame_number_src != frame_number); // during end of frame, before frame number is incremented
line_numbers_sync <= (line_unfinished_src > line_unfinished);
/// line_numbers_sync <= (line_unfinished_src > line_unfinished);
line_numbers_sync <= (line_unfinished_src >= line_unfinished);
suspend <= bonded_mode && (!frames_in_sync || !((sigle_frame_buf ? frames_differ : frames_numbers_differ) || line_numbers_sync));
......
......@@ -35,7 +35,12 @@
* contains all the components and scripts required to completely simulate it
* with at least one of the Free Software programs.
*/
parameter FPGA_VERSION = 32'h039300cd; //parallel - making stop compression clean -0.048/8, 79.50
parameter FPGA_VERSION = 32'h039300d1; //parallel - removed extra debug -0.042/9 80.34%
// parameter FPGA_VERSION = 32'h039300d1; //parallel - changing line_numbers_sync condition -0.011/3, 80.78 %
// parameter FPGA_VERSION = 32'h039300d0; //parallel - more status data
// parameter FPGA_VERSION = 32'h039300cf; //parallel - more status data for debugging ddr3_clk_div -0.033/2, 80.94%
// parameter FPGA_VERSION = 32'h039300ce; //parallel - frame_number_cntr >= last_frame_number -0.019/6 80.42%
// parameter FPGA_VERSION = 32'h039300cd; //parallel - making stop compression clean -0.048/8, 79.50
// parameter FPGA_VERSION = 32'h039300cc; //parallel - more jpeg tail -0.268/56, 80.24 %
// parameter FPGA_VERSION = 32'h039300cb; //parallel - modifying trigger/timestamps -0.050/13 80.38%
// parameter FPGA_VERSION = 32'h039300ca; //parallel - and more ... fixed -0.267/46, 80.42%
......
......@@ -39,6 +39,7 @@
*/
`timescale 1ns/1ps
// TODO: ADD MCNTRL_SCANLINE_FRAME_PAGE_RESET to caller
`undef DEBUG_MCNTRL_LINEAR_EXTRA_STATUS
module mcntrl_linear_rw #(
parameter ADDRESS_NUMBER= 15,
parameter COLADDR_NUMBER= 10,
......@@ -218,7 +219,11 @@ module mcntrl_linear_rw #(
wire pre_want;
reg pre_want_r1;
`ifdef DEBUG_MCNTRL_LINEAR_EXTRA_STATUS
wire [11:0] status_data;
`else
wire [1:0] status_data;
`endif
wire [3:0] cmd_a;
wire [31:0] cmd_data;
wire cmd_we;
......@@ -318,7 +323,8 @@ module mcntrl_linear_rw #(
else if (set_frame_width_w) frame_full_width <= {lsw13_zero,cmd_data[FRAME_WIDTH_BITS-1:0]};
if (mrst) is_last_frame <= 0;
else is_last_frame <= frame_number_cntr == last_frame_number;
// else is_last_frame <= frame_number_cntr == last_frame_number;
else is_last_frame <= frame_number_cntr >= last_frame_number; // trying to make it safe
// if (mrst) frame_start_r <= 0;
// else frame_start_r <= {frame_start_r[3:0], frame_start_late & frame_en};
......@@ -420,7 +426,11 @@ module mcntrl_linear_rw #(
assign skip_too_late = mode_reg[MCONTR_LINTILE_SKIP_LATE];
assign abort_en = mode_reg[MCONTR_LINTILE_ABORT_LATE];
assign status_data= {frame_finished_r, busy_r}; // TODO: Add second bit?
`ifdef DEBUG_MCNTRL_LINEAR_EXTRA_STATUS
assign status_data= {last_row_w, last_in_row,line_unfinished[7:0], frame_finished_r, busy_r};
`else
assign status_data= {frame_finished_r, busy_r}; // TODO: Add second bit?
`endif
assign pgm_param_w= cmd_we;
localparam [COLADDR_NUMBER-3-NUM_XFER_BITS-1:0] EXTRA_BITS=0;
assign remainder_in_xfer = {EXTRA_BITS, lim_by_xfer}-mem_page_left;
......@@ -698,7 +708,11 @@ wire start_not_partial= xfer_start_r[0] && !xfer_limited_by_mem_page_r;
`ifdef DEBUG_SENS_MEM_PAGES
.PAYLOAD_BITS (2 + 2 +2 + 2 + 2 + 2 +2 + 3 + 3 + MCNTRL_SCANLINE_PENDING_CNTR_BITS)
`else
`ifdef DEBUG_MCNTRL_LINEAR_EXTRA_STATUS
.PAYLOAD_BITS (12)
`else
.PAYLOAD_BITS (2)
`endif
`endif
) status_generate_i (
.rst (1'b0), //rst), // input
......
......@@ -40,7 +40,7 @@
* with at least one of the Free Software programs.
*/
`timescale 1ns/1ps
`undef DEBUG_MCNTRL_TILED_EXTRA_STATUS
module mcntrl_tiled_rw#(
parameter ADDRESS_NUMBER= 15,
parameter COLADDR_NUMBER= 10,
......@@ -213,14 +213,16 @@ module mcntrl_tiled_rw#(
reg last_block;
reg [MCNTRL_TILED_PENDING_CNTR_BITS-1:0] pending_xfers; // number of requested,. but not finished block transfers (to genearate frame done)
reg [NUM_RC_BURST_BITS-1:0] row_col_r;
// reg [FRAME_HEIGHT_BITS-1:0] line_unfinished_r0;
// reg [FRAME_HEIGHT_BITS-1:0] line_unfinished_r1;
// reg [2*FRAME_HEIGHT_BITS-1:0] line_unfinished_r;
reg [FRAME_HEIGHT_BITS-1:0] line_unfinished_relw_r;
reg [FRAME_HEIGHT_BITS-1:0] line_unfinished_r;
wire pre_want;
`ifdef DEBUG_MCNTRL_TILED_EXTRA_STATUS
wire [13:0] status_data;
`else
wire [1:0] status_data;
`endif
wire [3:0] cmd_a;
wire [31:0] cmd_data;
wire cmd_we;
......@@ -335,7 +337,8 @@ module mcntrl_tiled_rw#(
else if (set_frame_width_w) frame_full_width <= {lsw13_zero,cmd_data[FRAME_WIDTH_BITS-1:0]};
if (mrst) is_last_frame <= 0;
else is_last_frame <= frame_number_cntr == last_frame_number;
// else is_last_frame <= frame_number_cntr == last_frame_number;
else is_last_frame <= frame_number_cntr >= last_frame_number; // trying to make it safe
if (mrst) frame_start_r <= 0;
else frame_start_r <= {frame_start_r[3:0], frame_start_mod & frame_en}; // frame_start
......@@ -446,7 +449,13 @@ module mcntrl_tiled_rw#(
assign repeat_frames= mode_reg[MCONTR_LINTILE_REPEAT];
assign disable_need = mode_reg[MCONTR_LINTILE_DIS_NEED];
assign abort_en = mode_reg[MCONTR_LINTILE_ABORT_LATE];
`ifdef DEBUG_MCNTRL_TILED_EXTRA_STATUS
assign status_data= {frames_in_sync, suspend, last_row_w, last_in_row,line_unfinished[7:0], frame_finished_r, busy_r};
`else
assign status_data= {frame_finished_r, busy_r};
`endif
assign pgm_param_w= cmd_we;
assign rowcol_inc= frame_full_width;
assign num_cols_m1_w= num_cols_r-1;
......@@ -644,7 +653,8 @@ wire start_not_partial= xfer_start_r[0] && !xfer_limited_by_mem_page_r;
if (recalc_r[0]) line_unfinished_relw_r <= curr_y + (cmd_wrmem ? 0: tile_rows);
if (mrst || (frame_start_mod || chn_dis_delayed)) line_unfinished_r <= {FRAME_HEIGHT_BITS{~cmd_wrmem}}; // lowest/highest value until valid
else if (recalc_r[2]) line_unfinished_r <= line_unfinished_relw_r + window_y0;
/// else if (recalc_r[2]) line_unfinished_r <= line_unfinished_relw_r + window_y0;
else if (recalc_r[2] && busy_r) line_unfinished_r <= line_unfinished_relw_r + window_y0;
end
always @ (negedge mclk) begin
......@@ -669,7 +679,11 @@ wire start_not_partial= xfer_start_r[0] && !xfer_limited_by_mem_page_r;
status_generate #(
.STATUS_REG_ADDR (MCNTRL_TILED_STATUS_REG_ADDR),
`ifdef DEBUG_MCNTRL_TILED_EXTRA_STATUS
.PAYLOAD_BITS (14)
`else
.PAYLOAD_BITS (2)
`endif
) status_generate_i (
.rst (1'b0), // input
.clk (mclk), // input
......
......@@ -2894,7 +2894,9 @@ jpeg_sim_multi 4
################## Simulate Parallel 17 - free running, aborted frame ####################
./py393/test_mcntrl.py @py393/cocoargs --simulated=localhost:7777
measure_all "*DI"
setup_all_sensors True None 0xf
#setup_all_sensors True None 0xf
setup_all_sensors True None 0xf False None None None None 0 1 5 # JP4
#setup_all_sensors True None 0xf False None None None None 0 1 0 # JPEG
#Setting ARO for free run mode?
set_sensor_io_ctl all None None 1 # Set ARO low - check if it is still needed?
......
......@@ -442,6 +442,7 @@ class X393SensCmprs(object):
# frame_start_address, # calculate through num_sensor, num frames, frame size and start addr?
# frame_start_address_inc,
last_buf_frame = 1, # - just 2-frame buffer
cmode = vrlg.CMPRS_CBIT_CMODE_JPEG18,
colorsat_blue = 0x120, # 0x90 fo 1x
colorsat_red = 0x16c, # 0xb6 for x1
clk_sel = 1, # 1
......@@ -449,7 +450,8 @@ class X393SensCmprs(object):
histogram_top = None, # 0,
histogram_width_m1 = None, # 2559, #0,
histogram_height_m1 = None, # 1935, #0,
verbose = 1):
verbose = 1
):
"""
Setup one sensor+compressor channel (for one sub-channel only)
@param exit_step - exit after executing specified step:
......@@ -469,6 +471,20 @@ class X393SensCmprs(object):
@param window_left - left margin of the window (here - in pixels)
@param window_top - top margin of the window (16 bit)
@param last_buf_frame) - 16-bit number of the last frame in a buffer
@param cmode - color mode:
CMPRS_CBIT_CMODE_JPEG18 = 0 - color 4:2:0
CMPRS_CBIT_CMODE_MONO6 = 1 - mono 4:2:0 (6 blocks)
CMPRS_CBIT_CMODE_JP46 = 2 - jp4, 6 blocks, original
CMPRS_CBIT_CMODE_JP46DC = 3 - jp4, 6 blocks, dc -improved
CMPRS_CBIT_CMODE_JPEG20 = 4 - mono, 4 blocks (but still not actual monochrome JPEG as the blocks are scanned in 2x2 macroblocks)
CMPRS_CBIT_CMODE_JP4 = 5 - jp4, 4 blocks, dc-improved
CMPRS_CBIT_CMODE_JP4DC = 6 - jp4, 4 blocks, dc-improved
CMPRS_CBIT_CMODE_JP4DIFF = 7 - jp4, 4 blocks, differential
CMPRS_CBIT_CMODE_JP4DIFFHDR = 8 - jp4, 4 blocks, differential, hdr
CMPRS_CBIT_CMODE_JP4DIFFDIV2 = 9 - jp4, 4 blocks, differential, divide by 2
CMPRS_CBIT_CMODE_JP4DIFFHDRDIV2 = 10 - jp4, 4 blocks, differential, hdr,divide by 2
CMPRS_CBIT_CMODE_MONO1 = 11 - mono JPEG (not yet implemented)
CMPRS_CBIT_CMODE_MONO4 = 14 - mono 4 blocks
@param colorsat_blue - color saturation for blue (10 bits), 0x90 for 100%
@param colorsat_red - color saturation for red (10 bits), 0xb6 for 100%
@param clk_sel - True - use pixel clock from the sensor, False - use internal clock (provided to the sensor), None - no chnage
......@@ -489,7 +505,8 @@ class X393SensCmprs(object):
window_height = window_height,
window_left = window_left,
window_top = window_top,
cmode = None, # will use 0
# cmode = None, # will use 0
cmode = cmode, # will use 0
verbose = 0)
window_width = window["width"]
window_height = window["height"]
......@@ -580,6 +597,7 @@ class X393SensCmprs(object):
print ("last_buf_frame = ", last_buf_frame)
print ("num_macro_cols_m1 = ", num_macro_cols_m1)
print ("num_macro_rows_m1 = ", num_macro_rows_m1)
print ("cmode = ", cmode)
print ("verbose = ", verbose)
if exit_step == 10: return False
......@@ -602,6 +620,11 @@ class X393SensCmprs(object):
if verbose >0 :
print ("===================== MEMORY_SENSOR =========================")
window_height_memory = window_height
if cmode==vrlg.CMPRS_CBIT_CMODE_JP4:
window_height_memory &= 0xfff0 # do not need extra margins
num_burst_in_line &= 0xfffe # make even (assuming left=0)
self.x393Sensor.setup_sensor_memory (
num_sensor = num_sensor, # input [1:0] num_sensor;
frame_sa = frame_start_address, # input [31:0] frame_sa; # 22-bit frame start address ((3 CA LSBs==0. BA==0)
......@@ -610,7 +633,8 @@ class X393SensCmprs(object):
frame_full_width = frame_full_width, # input [31:0] frame_full_width; # 13-bit Padded line length (8-row increment), in 8-bursts (16 bytes)
# window_width = window_width >> 4, # input [31:0] window_width; # 13 bit - in 8*16=128 bit bursts
window_width = num_burst_in_line, # input [31:0] window_width; # 13 bit - in 8*16=128 bit bursts
window_height = window_height, # input [31:0] window_height; # 16 bit
# window_height = window_height, # input [31:0] window_height; # 16 bit
window_height = window_height_memory, # input [31:0] window_height; # 16 bit
window_left = window_left >> 4, # input [31:0] window_left;
window_top = window_top); # input [31:0] window_top;
# Enable arbitration of sensor-to-memory controller
......@@ -622,11 +646,14 @@ class X393SensCmprs(object):
self.x393Cmprs.compressor_control(chn = num_sensor,
run_mode = 0) # reset compressor
#TODO: Calculate from the image size?
"""
#How it was
self.x393Cmprs.setup_compressor_channel (
chn = num_sensor,
qbank = 0,
dc_sub = True,
cmode = vrlg.CMPRS_CBIT_CMODE_JPEG18,
# cmode = vrlg.CMPRS_CBIT_CMODE_JP4,
multi_frame = True,
bayer = 0,
focus_mode = 0,
......@@ -681,6 +708,25 @@ class X393SensCmprs(object):
extra_pages = 1,
disable_need = 1,
abort_late = False)
"""
# replacing with setup compressor:
self.setup_compressor(chn = num_sensor,
cmode = cmode,
qbank = 0,
dc_sub = True,
multi_frame = True,
bayer = 0,
focus_mode = 0,
coring = 0,
window_width = window_width, # 2592, # 2592
window_height = window_height, # 1944, # 1944
window_left = window_left, # 0, # 0
window_top = window_top, # 0, # 0? 1?
last_buf_frame = last_buf_frame, # - just 2-frame buffer
colorsat_blue = colorsat_blue, #0x120 # 0x90 for 1x
colorsat_red = colorsat_red, #0x16c, # 0xb6 for x1
verbose = verbose)
if exit_step == 15: return False
......@@ -1175,9 +1221,40 @@ class X393SensCmprs(object):
window_left = window["left"]
window_top = window["top"]
cmode = window["cmode"]
COLOR_MARGINS = 2
num_sensor = chn # 1:1 sensor - compressor
align_to_bursts = 64 # align full width to multiple of align_to_bursts. 64 is the size of memory access
"""
overlap = 0 # tile overlap (total - 2 for JPEG18, 4 - for JPEG20, 0 otherwise
cmprs_top = 0 # 1 for JPEG18 only, 0 for others (also is used for compressor left)
if cmode == vrlg.CMPRS_CBIT_CMODE_JPEG18:
overlap = 2
cmprs_top = 1
elif cmode == vrlg.CMPRS_CBIT_CMODE_JPEG20:
overlap = 4
if overlap:
window_width += (2 * COLOR_MARGINS)
window_height += (2 * COLOR_MARGINS)
tile_width = 2
else:
tile_width = 4
# cmprs_frame_format.left_margin = cmprs_top; // same as top - only for 18x18 tiles to keep Bayer shift (0/1)
width_bursts = window_width >> 4
if window_width & 0xf:
width_bursts += 1
# Adjusting for tile width. TODO: probably not needed, handled in FPGA - verify (and remove 2 next lines)
if width_bursts & 1:
width_bursts += 1
if (tile_width > 2) and (width_bursts & 2):
width_bursts += 2
tile_height = 16 + overlap;
"""
width_in_bursts = window_width >> 4
if (window_width & 0xf):
width_in_bursts += 1
......@@ -1231,7 +1308,7 @@ class X393SensCmprs(object):
tile_margin = 0 # 18x18 instead of 16x16
tile_width = 4
# extra_pages = (0,1)[(compressor_left_margin % 16) != 0] # memory access block border does not cut macroblocks
extra_pages = 1 # just testing, 0 should be OK here
extra_pages = 0 # 1 # just testing, 0 should be OK here
tile_vstep = 16
tile_height = tile_vstep + tile_margin
......@@ -1336,6 +1413,7 @@ class X393SensCmprs(object):
window_top = None, # 0, # 0? 1?
compressor_left_margin = 0, #0?`1?
last_buf_frame = 1, # - just 2-frame buffer
cmode = vrlg.CMPRS_CBIT_CMODE_JPEG18,
colorsat_blue = 0x120, # 0x90 fo 1x
colorsat_red = 0x16c, # 0xb6 for x1
clk_sel = 1, # 1
......@@ -1373,6 +1451,20 @@ class X393SensCmprs(object):
@param window_top - top margin of the window (16 bit)
@param compressor_left_margin - 0..31 - left margin for compressor (to the nearest 32-byte column)
@param last_buf_frame) - 16-bit number of the last frame in a buffer
@param cmode - color mode:
CMPRS_CBIT_CMODE_JPEG18 = 0 - color 4:2:0
CMPRS_CBIT_CMODE_MONO6 = 1 - mono 4:2:0 (6 blocks)
CMPRS_CBIT_CMODE_JP46 = 2 - jp4, 6 blocks, original
CMPRS_CBIT_CMODE_JP46DC = 3 - jp4, 6 blocks, dc -improved
CMPRS_CBIT_CMODE_JPEG20 = 4 - mono, 4 blocks (but still not actual monochrome JPEG as the blocks are scanned in 2x2 macroblocks)
CMPRS_CBIT_CMODE_JP4 = 5 - jp4, 4 blocks, dc-improved
CMPRS_CBIT_CMODE_JP4DC = 6 - jp4, 4 blocks, dc-improved
CMPRS_CBIT_CMODE_JP4DIFF = 7 - jp4, 4 blocks, differential
CMPRS_CBIT_CMODE_JP4DIFFHDR = 8 - jp4, 4 blocks, differential, hdr
CMPRS_CBIT_CMODE_JP4DIFFDIV2 = 9 - jp4, 4 blocks, differential, divide by 2
CMPRS_CBIT_CMODE_JP4DIFFHDRDIV2 = 10 - jp4, 4 blocks, differential, hdr,divide by 2
CMPRS_CBIT_CMODE_MONO1 = 11 - mono JPEG (not yet implemented)
CMPRS_CBIT_CMODE_MONO4 = 14 - mono 4 blocks
@param colorsat_blue - color saturation for blue (10 bits), 0x90 for 100%
@param colorsat_red - color saturation for red (10 bits), 0xb6 for 100%
@param clk_sel - True - use pixel clock from the sensor, False - use internal clock (provided to the sensor), None - no change
......@@ -1396,7 +1488,7 @@ class X393SensCmprs(object):
window_height = window_height,
window_left = window_left,
window_top = window_top,
cmode = None, # will use 0
cmode = cmode, # will use 0
verbose = 0)
window_width = window["width"]
window_height = window["height"]
......@@ -1574,6 +1666,7 @@ class X393SensCmprs(object):
window_top = window_top, # 0? 1?
# compressor_left_margin = compressor_left_margin, #0?`1?
last_buf_frame = last_buf_frame, # - just 2-frame buffer
cmode = cmode,
colorsat_blue = colorsat_blue, # 0x90 fo 1x
colorsat_red = colorsat_red, # 0xb6 for x1
clk_sel = clk_sel, # 1
......
No preview for this file type
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