Commit ab6fc4dc authored by Andrey Filippov's avatar Andrey Filippov

added support for the variable quality quantization tables

parent 4b80a882
...@@ -62,42 +62,42 @@ ...@@ -62,42 +62,42 @@
<link> <link>
<name>vivado_logs/VivadoBitstream.log</name> <name>vivado_logs/VivadoBitstream.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoBitstream-20150916155306201.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoBitstream-20150919172017385.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoOpt.log</name> <name>vivado_logs/VivadoOpt.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoOpt-20150916155306201.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoOpt-20150919172017385.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoOptPhys.log</name> <name>vivado_logs/VivadoOptPhys.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoOptPhys-20150916155306201.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoOptPhys-20150919172017385.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoOptPower.log</name> <name>vivado_logs/VivadoOptPower.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoOptPower-20150916155306201.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoOptPower-20150919172017385.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoPlace.log</name> <name>vivado_logs/VivadoPlace.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoPlace-20150916155306201.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoPlace-20150919172017385.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoRoute.log</name> <name>vivado_logs/VivadoRoute.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoRoute-20150916155306201.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoRoute-20150919172017385.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoSynthesis.log</name> <name>vivado_logs/VivadoSynthesis.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoSynthesis-20150916153820807.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoSynthesis-20150919164827543.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoTimimgSummaryReportImplemented.log</name> <name>vivado_logs/VivadoTimimgSummaryReportImplemented.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoTimimgSummaryReportImplemented-20150916155306201.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoTimimgSummaryReportImplemented-20150919172017385.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoTimimgSummaryReportSynthesis.log</name> <name>vivado_logs/VivadoTimimgSummaryReportSynthesis.log</name>
......
...@@ -42,7 +42,10 @@ module compressor393 # ( ...@@ -42,7 +42,10 @@ module compressor393 # (
parameter CMPRS_COLOR_SATURATION= 3, parameter CMPRS_COLOR_SATURATION= 3,
parameter CMPRS_CORING_MODE= 4, parameter CMPRS_CORING_MODE= 4,
parameter CMPRS_TABLES= 6, // 6..7 parameter CMPRS_TABLES= 6, // 6..7
parameter TABLE_QUANTIZATION_INDEX = 0,
parameter TABLE_CORING_INDEX = 1,
parameter TABLE_FOCUS_INDEX = 2,
parameter TABLE_HUFFMAN_INDEX = 3,
parameter FRAME_HEIGHT_BITS= 16, // Maximal frame height parameter FRAME_HEIGHT_BITS= 16, // Maximal frame height
parameter LAST_FRAME_BITS= 16, // number of bits in frame counter (before rolls over) parameter LAST_FRAME_BITS= 16, // number of bits in frame counter (before rolls over)
// Bit-fields in compressor control word // Bit-fields in compressor control word
...@@ -323,6 +326,10 @@ module compressor393 # ( ...@@ -323,6 +326,10 @@ module compressor393 # (
.CMPRS_COLOR_SATURATION (CMPRS_COLOR_SATURATION), .CMPRS_COLOR_SATURATION (CMPRS_COLOR_SATURATION),
.CMPRS_CORING_MODE (CMPRS_CORING_MODE), .CMPRS_CORING_MODE (CMPRS_CORING_MODE),
.CMPRS_TABLES (CMPRS_TABLES), .CMPRS_TABLES (CMPRS_TABLES),
.TABLE_QUANTIZATION_INDEX (TABLE_QUANTIZATION_INDEX),
.TABLE_CORING_INDEX (TABLE_CORING_INDEX),
.TABLE_FOCUS_INDEX (TABLE_FOCUS_INDEX),
.TABLE_HUFFMAN_INDEX (TABLE_HUFFMAN_INDEX),
.FRAME_HEIGHT_BITS (FRAME_HEIGHT_BITS), .FRAME_HEIGHT_BITS (FRAME_HEIGHT_BITS),
.LAST_FRAME_BITS (LAST_FRAME_BITS), .LAST_FRAME_BITS (LAST_FRAME_BITS),
.CMPRS_CBIT_RUN (CMPRS_CBIT_RUN), .CMPRS_CBIT_RUN (CMPRS_CBIT_RUN),
......
...@@ -52,7 +52,7 @@ module huffman393 ( ...@@ -52,7 +52,7 @@ module huffman393 (
); );
`ifdef INFER_LATCHES `ifdef INFER_LATCHES
reg [15:0] hcode_latch; // table output huffman code (1..16 bits) reg [15:0] hcode_latch; // table output huffman code (1..16 bits)
reg [ 3:0] hlen_latch; // table - code length only 4 LSBs are used reg [ 3:0] hlen_latch; // table - code length only 4 LSBs are used, so 0 means 16
reg [ 7:0] haddr70_latch; reg [ 7:0] haddr70_latch;
reg haddr8_latch; reg haddr8_latch;
reg tables_re_latch; reg tables_re_latch;
......
...@@ -35,6 +35,10 @@ module jp_channel#( ...@@ -35,6 +35,10 @@ module jp_channel#(
parameter CMPRS_COLOR_SATURATION= 3, parameter CMPRS_COLOR_SATURATION= 3,
parameter CMPRS_CORING_MODE= 4, parameter CMPRS_CORING_MODE= 4,
parameter CMPRS_TABLES= 6, // 6(data)..7(address) parameter CMPRS_TABLES= 6, // 6(data)..7(address)
parameter TABLE_QUANTIZATION_INDEX = 0,
parameter TABLE_CORING_INDEX = 1,
parameter TABLE_FOCUS_INDEX = 2,
parameter TABLE_HUFFMAN_INDEX = 3,
parameter FRAME_HEIGHT_BITS= 16, // Maximal frame height parameter FRAME_HEIGHT_BITS= 16, // Maximal frame height
parameter LAST_FRAME_BITS= 16, // number of bits in frame counter (before rolls over) parameter LAST_FRAME_BITS= 16, // number of bits in frame counter (before rolls over)
...@@ -889,22 +893,26 @@ module jp_channel#( ...@@ -889,22 +893,26 @@ module jp_channel#(
// wire table_we; // writing to tables (decoded stb from cmd_deser) // wire table_we; // writing to tables (decoded stb from cmd_deser)
wire tser_a_not_d; // address/not data distributed to submodules wire tser_a_not_d; // address/not data distributed to submodules
wire [ 7:0] tser_d; // byte-wide serialized tables address/data to submodules wire [ 7:0] tser_d; // byte-wide serialized tables address/data to submodules
wire tser_qe; // write serialized table data to quantizer wire [ 3:0] tser_sel; // vector of individual table selects (decoded from the 8 MSBs of the table address)
wire tser_ce; // write serialized table data to coring wire tser_qe = tser_sel[TABLE_QUANTIZATION_INDEX]; // write serialized table data to quantizer
wire tser_fe; // write serialized table data to focusing wire tser_ce = tser_sel[TABLE_CORING_INDEX]; // write serialized table data to coring
wire tser_he; // write serialized table data to Huffman wire tser_fe = tser_sel[TABLE_FOCUS_INDEX]; // write serialized table data to focusing
wire tser_he = tser_sel[TABLE_HUFFMAN_INDEX]; // write serialized table data to Huffman
//{tser_he,tser_fe,tser_ce,tser_qe}
// As all commands are 32-bit data, all 4 bytes will be written to a designated table (usually 2 of 16-bit writes)
table_ad_transmit #( table_ad_transmit #(
.NUM_CHANNELS(4), .NUM_CHANNELS(4),
.ADDR_BITS(3) .ADDR_BITS(3)
) table_ad_transmit_i ( ) table_ad_transmit_i (
.clk (mclk), // input @posedge .clk (mclk), // input @posedge
.srst (mrst), // @posedge mclk
.a_not_d_in (cmd_a[0]), // input writing table address /not data (a[0] from cmd_deser) .a_not_d_in (cmd_a[0]), // input writing table address /not data (a[0] from cmd_deser)
.we (set_tables_w), // input writing to tables (decoded stb from cmd_deser) .we (set_tables_w), // input writing to tables (decoded stb from cmd_deser)
.din (cmd_data), // input[31:0] 32-bit data to serialize/write to tables (LSB first) - from cmd_deser .din (cmd_data), // input[31:0] 32-bit data to serialize/write to tables (LSB first) - from cmd_deser
.ser_d (tser_d), // output[7:0] byte-wide serialized tables address/data to submodules .ser_d (tser_d), // output[7:0] byte-wide serialized tables address/data to submodules
.a_not_d (tser_a_not_d), // output reg address/not data distributed to submodules .a_not_d (tser_a_not_d), // output reg address/not data distributed to submodules
.chn_en ({tser_he,tser_fe,tser_ce,tser_qe}) // output[0:0] reg - table 1-hot select outputs // .chn_en ({tser_he,tser_fe,tser_ce,tser_qe}) // output[0:0] reg - table 1-hot select outputs
.chn_en (tser_sel) // output[0:0] reg - table 1-hot select outputs
); );
...@@ -950,7 +958,7 @@ module jp_channel#( ...@@ -950,7 +958,7 @@ module jp_channel#(
.en (frame_en), // input .en (frame_en), // input
.mclk (mclk), // input system clock to write tables .mclk (mclk), // input system clock to write tables
.tser_we (tser_fe), // input - write to a quantization table .tser_we (tser_fe), // input - write to a focus sharpness table
.tser_a_not_d (tser_a_not_d), // input - address/not data to tables .tser_a_not_d (tser_a_not_d), // input - address/not data to tables
.tser_d (tser_d), // input[7:0] - byte-wide data to tables .tser_d (tser_d), // input[7:0] - byte-wide data to tables
......
parameter FPGA_VERSION = 32'h03930034; parameter FPGA_VERSION = 32'h03930035;
\ No newline at end of file \ No newline at end of file
/* This is a generated file with the current DDR3 memory timing parameters */
localparam DLY_LANE0_ODELAY = 80'hd8e8181c1c221c201b20;
localparam DLY_LANE0_IDELAY = 72'h2078807c88797c7884;
localparam DLY_LANE1_ODELAY = 80'hd8e31a181b1a1c1c1c1a;
localparam DLY_LANE1_IDELAY = 72'h247b747b7882787c7c;
localparam DLY_CMDA = 256'hd4d4d4dadcd3dbd0484848484848484848d4d4ccd4d4dcd9ccd8d4d4d3d3dbd0;
localparam DLY_PHASE = 8'h32;
// localparam DFLT_WBUF_DELAY = 4'h8;
/home/andrey/git/x393/includes/x393_cur_params_target_00.vh
\ No newline at end of file
...@@ -545,6 +545,11 @@ ...@@ -545,6 +545,11 @@
parameter CMPRS_COLOR_SATURATION= 3, parameter CMPRS_COLOR_SATURATION= 3,
parameter CMPRS_CORING_MODE= 4, parameter CMPRS_CORING_MODE= 4,
parameter CMPRS_TABLES= 6, // 6..7 parameter CMPRS_TABLES= 6, // 6..7
parameter TABLE_QUANTIZATION_INDEX = 0,
parameter TABLE_CORING_INDEX = 1,
parameter TABLE_FOCUS_INDEX = 2,
parameter TABLE_HUFFMAN_INDEX = 3,
// Bit-fields in compressor control word // Bit-fields in compressor control word
parameter CMPRS_CBIT_RUN = 2, // bit # to control compressor run modes parameter CMPRS_CBIT_RUN = 2, // bit # to control compressor run modes
...@@ -725,17 +730,18 @@ ...@@ -725,17 +730,18 @@
parameter CLK_CNTRL = 0, parameter CLK_CNTRL = 0,
parameter CLK_STATUS = 1, parameter CLK_STATUS = 1,
`ifdef DEBUG_RING // These are needed for Python:
//`ifdef DEBUG_RING
// Debug module (read/write serial ring) // Debug module (read/write serial ring)
parameter DEBUG_ADDR = 'h710, //..'h713 parameter DEBUG_ADDR = 'h710, //..'h713 // SuppressThisWarning VEditor
parameter DEBUG_MASK = 'h7fc, parameter DEBUG_MASK = 'h7fc,
parameter DEBUG_STATUS_REG_ADDR = 'hfc, // address where status can be read out parameter DEBUG_STATUS_REG_ADDR = 'hfc, // address where status can be read out // SuppressThisWarning VEditor
parameter DEBUG_READ_REG_ADDR = 'hfd, // read 32-bit received shifted data parameter DEBUG_READ_REG_ADDR = 'hfd, // read 32-bit received shifted data// SuppressThisWarning VEditor
parameter DEBUG_SHIFT_DATA = 'h0, // shift i/o data by 32 bits parameter DEBUG_SHIFT_DATA = 'h0, // shift i/o data by 32 bits// SuppressThisWarning VEditor
parameter DEBUG_LOAD = 'h1, // parallel load of the distributed shift registe (both ways) parameter DEBUG_LOAD = 'h1, // parallel load of the distributed shift registe (both ways)// SuppressThisWarning VEditor
parameter DEBUG_SET_STATUS = 'h2, // program status (mode 3?) parameter DEBUG_SET_STATUS = 'h2, // program status (mode 3?)// SuppressThisWarning VEditor
parameter DEBUG_CMD_LATENCY = 2, // >0 extra registers in the debug_sl (distriburted in parallel) parameter DEBUG_CMD_LATENCY = 2, // >0 extra registers in the debug_sl (distriburted in parallel)// SuppressThisWarning VEditor
`endif //`endif
parameter CLKIN_PERIOD_AXIHP = 20, //ns >1.25, 600<Fvco<1200 parameter CLKIN_PERIOD_AXIHP = 20, //ns >1.25, 600<Fvco<1200
parameter DIVCLK_DIVIDE_AXIHP = 1, parameter DIVCLK_DIVIDE_AXIHP = 1,
......
This diff is collapsed.
...@@ -153,12 +153,14 @@ MCNTRL_SCANLINE_MASK__TYPE = str ...@@ -153,12 +153,14 @@ MCNTRL_SCANLINE_MASK__TYPE = str
MCONTR_PHY_0BIT_SDRST_ACT = int MCONTR_PHY_0BIT_SDRST_ACT = int
SENSI2C_IBUF_LOW_PWR = str SENSI2C_IBUF_LOW_PWR = str
CLKOUT_DIV_PCLK2X__RAW = str CLKOUT_DIV_PCLK2X__RAW = str
TILED_EXTRA_PAGES__TYPE = str CMPRS_JP4__TYPE = str
TABLE_CORING_INDEX = int
DQSTRI_LAST = int DQSTRI_LAST = int
MCNTRL_TEST01_CHN2_STATUS_CNTRL__TYPE = str MCNTRL_TEST01_CHN2_STATUS_CNTRL__TYPE = str
STATUS_2LSB_SHFT__TYPE = str STATUS_2LSB_SHFT__TYPE = str
SENS_SS_EN__TYPE = str SENS_SS_EN__TYPE = str
MEMBRIDGE_LEN64__TYPE = str MEMBRIDGE_LEN64__TYPE = str
TABLE_QUANTIZATION_INDEX__TYPE = str
LOGGER_CONF_EN__RAW = str LOGGER_CONF_EN__RAW = str
HIST_CONFIRM_WRITE = int HIST_CONFIRM_WRITE = int
CMPRS_GROUP_ADDR__TYPE = str CMPRS_GROUP_ADDR__TYPE = str
...@@ -313,7 +315,7 @@ CMPRS_JP4DIFF = int ...@@ -313,7 +315,7 @@ CMPRS_JP4DIFF = int
RTC_STATUS_REG_ADDR = int RTC_STATUS_REG_ADDR = int
SENS_LENS_BY_MASK__TYPE = str SENS_LENS_BY_MASK__TYPE = str
CMPRS_CBIT_CMODE__RAW = str CMPRS_CBIT_CMODE__RAW = str
CMPRS_JP4__TYPE = str TILED_EXTRA_PAGES__TYPE = str
AFI_MUX_BUF_LATENCY = int AFI_MUX_BUF_LATENCY = int
WINDOW_WIDTH = int WINDOW_WIDTH = int
CLK_CNTRL__RAW = str CLK_CNTRL__RAW = str
...@@ -336,6 +338,7 @@ LOGGER_CONF_MSG__RAW = str ...@@ -336,6 +338,7 @@ LOGGER_CONF_MSG__RAW = str
MCNTRL_TILED_STATUS_REG_CHN2_ADDR__RAW = str MCNTRL_TILED_STATUS_REG_CHN2_ADDR__RAW = str
LAST_FRAME_BITS__RAW = str LAST_FRAME_BITS__RAW = str
SENS_DIVCLK_DIVIDE = int SENS_DIVCLK_DIVIDE = int
NEWPAR = int
SENS_LENS_COEFF__RAW = str SENS_LENS_COEFF__RAW = str
CMPRS_CONTROL_REG = int CMPRS_CONTROL_REG = int
GPIO_STATUS_REG_ADDR = int GPIO_STATUS_REG_ADDR = int
...@@ -455,6 +458,7 @@ MCONTR_ARBIT_ADDR_MASK = int ...@@ -455,6 +458,7 @@ MCONTR_ARBIT_ADDR_MASK = int
MCNTRL_SCANLINE_STATUS_REG_CHN3_ADDR = int MCNTRL_SCANLINE_STATUS_REG_CHN3_ADDR = int
MCNTRL_SCANLINE_WINDOW_WH = int MCNTRL_SCANLINE_WINDOW_WH = int
WBUF_DLY_WLV__RAW = str WBUF_DLY_WLV__RAW = str
TABLE_HUFFMAN_INDEX = int
MCNTRL_TILED_FRAME_LAST = int MCNTRL_TILED_FRAME_LAST = int
MCNTRL_TEST01_CHN2_MODE__RAW = str MCNTRL_TEST01_CHN2_MODE__RAW = str
CMPRS_AFIMUX_REG_ADDR0__TYPE = str CMPRS_AFIMUX_REG_ADDR0__TYPE = str
...@@ -694,7 +698,7 @@ SENS_CTRL_QUADRANTS_WIDTH = int ...@@ -694,7 +698,7 @@ SENS_CTRL_QUADRANTS_WIDTH = int
STATUS_PSHIFTER_RDY_MASK__RAW = str STATUS_PSHIFTER_RDY_MASK__RAW = str
TILE_WIDTH__TYPE = str TILE_WIDTH__TYPE = str
MCNTRL_TILED_FRAME_LAST__RAW = str MCNTRL_TILED_FRAME_LAST__RAW = str
MCONTR_TOP_0BIT_REFRESH_EN__RAW = str SENSI2C_CMD_RESET__RAW = str
REFRESH_OFFSET = int REFRESH_OFFSET = int
MCNTRL_PS_EN_RST = int MCNTRL_PS_EN_RST = int
MCNTRL_TILED_TILE_WHS = int MCNTRL_TILED_TILE_WHS = int
...@@ -765,6 +769,7 @@ MULT_SAXI_ADV_WR = int ...@@ -765,6 +769,7 @@ MULT_SAXI_ADV_WR = int
NUM_CYCLES_10__TYPE = str NUM_CYCLES_10__TYPE = str
MCONTR_LINTILE_EXTRAPG__RAW = str MCONTR_LINTILE_EXTRAPG__RAW = str
SENS_LENS_FAT0_IN__RAW = str SENS_LENS_FAT0_IN__RAW = str
NEWPAR__TYPE = str
CMPRS_AFIMUX_STATUS_CNTRL__TYPE = str CMPRS_AFIMUX_STATUS_CNTRL__TYPE = str
LOGGER_CONFIG__RAW = str LOGGER_CONFIG__RAW = str
LD_DLY_LANE0_ODELAY__RAW = str LD_DLY_LANE0_ODELAY__RAW = str
...@@ -919,11 +924,12 @@ MCONTR_SENS_STATUS_INC__TYPE = str ...@@ -919,11 +924,12 @@ MCONTR_SENS_STATUS_INC__TYPE = str
CAMSYNC_TRIG_DELAY0__TYPE = str CAMSYNC_TRIG_DELAY0__TYPE = str
SENSI2C_STATUS_REG_INC = int SENSI2C_STATUS_REG_INC = int
CLKFBOUT_PHASE__TYPE = str CLKFBOUT_PHASE__TYPE = str
TABLE_QUANTIZATION_INDEX__RAW = str
MCNTRL_TILED_WINDOW_WH = int MCNTRL_TILED_WINDOW_WH = int
CMDFRAMESEQ_MASK = int CMDFRAMESEQ_MASK = int
CLK_ADDR = int CLK_ADDR = int
MCNTRL_TILED_WINDOW_X0Y0__TYPE = str MCNTRL_TILED_WINDOW_X0Y0__TYPE = str
NUM_XFER_BITS__RAW = str SENS_CTRL_EXT_CLK__TYPE = str
MCNTRL_TILED_WINDOW_STARTXY__RAW = str MCNTRL_TILED_WINDOW_STARTXY__RAW = str
CMPRS_CSAT_CB_BITS__RAW = str CMPRS_CSAT_CB_BITS__RAW = str
CMPRS_CBIT_RUN__RAW = str CMPRS_CBIT_RUN__RAW = str
...@@ -943,7 +949,7 @@ CMPRS_FRMT_MBRM1_BITS__TYPE = str ...@@ -943,7 +949,7 @@ CMPRS_FRMT_MBRM1_BITS__TYPE = str
MCNTRL_TILED_TILE_WHS__RAW = str MCNTRL_TILED_TILE_WHS__RAW = str
SENS_REFCLK_FREQUENCY = float SENS_REFCLK_FREQUENCY = float
CMD_PAUSE_BITS__TYPE = str CMD_PAUSE_BITS__TYPE = str
SENS_CTRL_EXT_CLK__TYPE = str NUM_XFER_BITS__RAW = str
SENS_LENS_BY = int SENS_LENS_BY = int
SENS_LENS_BX = int SENS_LENS_BX = int
NUM_CYCLES_02__TYPE = str NUM_CYCLES_02__TYPE = str
...@@ -968,6 +974,7 @@ CLKFBOUT_MULT_SENSOR = int ...@@ -968,6 +974,7 @@ CLKFBOUT_MULT_SENSOR = int
CMPRS_AFIMUX_EN = int CMPRS_AFIMUX_EN = int
COLADDR_NUMBER = int COLADDR_NUMBER = int
MCNTRL_TILED_STARTADDR__RAW = str MCNTRL_TILED_STARTADDR__RAW = str
TABLE_FOCUS_INDEX__TYPE = str
CAMSYNC_DELAY = int CAMSYNC_DELAY = int
BUF_IPCLK2X_SENS2__TYPE = str BUF_IPCLK2X_SENS2__TYPE = str
MCNTRL_TEST01_CHN1_MODE__RAW = str MCNTRL_TEST01_CHN1_MODE__RAW = str
...@@ -1043,6 +1050,7 @@ CMPRS_STATUS_CNTRL__TYPE = str ...@@ -1043,6 +1050,7 @@ CMPRS_STATUS_CNTRL__TYPE = str
MCONTR_RD_MASK = int MCONTR_RD_MASK = int
CMPRS_COLOR_SATURATION = int CMPRS_COLOR_SATURATION = int
NUM_CYCLES_21__RAW = str NUM_CYCLES_21__RAW = str
NEWPAR__RAW = str
SENSIO_DELAYS__RAW = str SENSIO_DELAYS__RAW = str
CMDFRAMESEQ_RUN_BIT = int CMDFRAMESEQ_RUN_BIT = int
SENS_SYNC_MINPER = int SENS_SYNC_MINPER = int
...@@ -1295,6 +1303,7 @@ CMPRS_HIFREQ_REG_BASE = int ...@@ -1295,6 +1303,7 @@ CMPRS_HIFREQ_REG_BASE = int
MCONTR_ARBIT_ADDR = int MCONTR_ARBIT_ADDR = int
MEMBRIDGE_CTRL__RAW = str MEMBRIDGE_CTRL__RAW = str
CMPRS_CBIT_RUN_RST__RAW = str CMPRS_CBIT_RUN_RST__RAW = str
TABLE_QUANTIZATION_INDEX = int
NUM_CYCLES_04__TYPE = str NUM_CYCLES_04__TYPE = str
WSEL__RAW = str WSEL__RAW = str
CLKOUT_DIV_XCLK__TYPE = str CLKOUT_DIV_XCLK__TYPE = str
...@@ -1372,6 +1381,7 @@ IDELAY_VALUE__TYPE = str ...@@ -1372,6 +1381,7 @@ IDELAY_VALUE__TYPE = str
CMPRS_CBIT_CMODE_JP4DC__TYPE = str CMPRS_CBIT_CMODE_JP4DC__TYPE = str
SENSI2C_CMD_SDA = int SENSI2C_CMD_SDA = int
PICKLE__TYPE = str PICKLE__TYPE = str
TABLE_FOCUS_INDEX__RAW = str
SENSOR_MODE_WIDTH__TYPE = str SENSOR_MODE_WIDTH__TYPE = str
MCONTR_LINTILE_WRITE__RAW = str MCONTR_LINTILE_WRITE__RAW = str
MCNTRL_TILED_CHN2_ADDR__RAW = str MCNTRL_TILED_CHN2_ADDR__RAW = str
...@@ -1409,6 +1419,7 @@ MCONTR_LINTILE_DIS_NEED = int ...@@ -1409,6 +1419,7 @@ MCONTR_LINTILE_DIS_NEED = int
MCONTR_CMPRS_STATUS_INC__RAW = str MCONTR_CMPRS_STATUS_INC__RAW = str
CMPRS_CBIT_CMODE_JP4DIFFHDR = int CMPRS_CBIT_CMODE_JP4DIFFHDR = int
BUF_CLK1X_SYNC = str BUF_CLK1X_SYNC = str
TABLE_CORING_INDEX__RAW = str
SENSI2C_CMD_RESET__TYPE = str SENSI2C_CMD_RESET__TYPE = str
CMPRS_CBIT_CMODE_JP4DIFFDIV2__RAW = str CMPRS_CBIT_CMODE_JP4DIFFDIV2__RAW = str
MCONTR_ARBIT_ADDR__TYPE = str MCONTR_ARBIT_ADDR__TYPE = str
...@@ -1474,6 +1485,7 @@ WBUF_DLY_WLV = int ...@@ -1474,6 +1485,7 @@ WBUF_DLY_WLV = int
MCONTR_BUF3_WR_ADDR__RAW = str MCONTR_BUF3_WR_ADDR__RAW = str
MEMBRIDGE_WIDTH64 = int MEMBRIDGE_WIDTH64 = int
MCNTRL_TEST01_CHN3_MODE = int MCNTRL_TEST01_CHN3_MODE = int
TABLE_HUFFMAN_INDEX__RAW = str
LD_DLY_PHASE__RAW = str LD_DLY_PHASE__RAW = str
TEST_INITIAL_BURST__RAW = str TEST_INITIAL_BURST__RAW = str
CMPRS_CBIT_FRAMES_BITS__TYPE = str CMPRS_CBIT_FRAMES_BITS__TYPE = str
...@@ -1571,6 +1583,7 @@ BUF_CLK1X_PCLK2X = str ...@@ -1571,6 +1583,7 @@ BUF_CLK1X_PCLK2X = str
MCNTRL_TEST01_CHN4_MODE = int MCNTRL_TEST01_CHN4_MODE = int
MCNTRL_PS_STATUS_REG_ADDR__RAW = str MCNTRL_PS_STATUS_REG_ADDR__RAW = str
MAX_TILE_WIDTH = int MAX_TILE_WIDTH = int
TABLE_FOCUS_INDEX = int
CMPRS_CBIT_RUN_STANDALONE__RAW = str CMPRS_CBIT_RUN_STANDALONE__RAW = str
CMPRS_CBIT_CMODE_JP4DIFFHDRDIV2 = int CMPRS_CBIT_CMODE_JP4DIFFHDRDIV2 = int
DFLT_DQ_TRI_OFF_PATTERN__RAW = str DFLT_DQ_TRI_OFF_PATTERN__RAW = str
...@@ -1779,6 +1792,7 @@ MULT_SAXI_MASK = int ...@@ -1779,6 +1792,7 @@ MULT_SAXI_MASK = int
MCNTRL_SCANLINE_WINDOW_STARTXY__TYPE = str MCNTRL_SCANLINE_WINDOW_STARTXY__TYPE = str
CMDFRAMESEQ_DEPTH__TYPE = str CMDFRAMESEQ_DEPTH__TYPE = str
DLY_LANE0_IDELAY__RAW = str DLY_LANE0_IDELAY__RAW = str
TABLE_CORING_INDEX__TYPE = str
HISTOGRAM_RADDR1__RAW = str HISTOGRAM_RADDR1__RAW = str
CLKFBOUT_DIV_REF__TYPE = str CLKFBOUT_DIV_REF__TYPE = str
MCONTR_LINTILE_EXTRAPG_BITS__RAW = str MCONTR_LINTILE_EXTRAPG_BITS__RAW = str
...@@ -1850,7 +1864,7 @@ BUF_CLK1X_AXIHP = str ...@@ -1850,7 +1864,7 @@ BUF_CLK1X_AXIHP = str
SENSIO_WIDTH = int SENSIO_WIDTH = int
MCONTR_PHY_0BIT_DLY_RST__RAW = str MCONTR_PHY_0BIT_DLY_RST__RAW = str
BUF_CLK1X_PCLK2X__RAW = str BUF_CLK1X_PCLK2X__RAW = str
SENSI2C_CMD_RESET__RAW = str MCONTR_TOP_0BIT_REFRESH_EN__RAW = str
SENSI2C_ADDR_MASK__RAW = str SENSI2C_ADDR_MASK__RAW = str
SENS_HIGH_PERFORMANCE_MODE__TYPE = str SENS_HIGH_PERFORMANCE_MODE__TYPE = str
MCONTR_LINTILE_KEEP_OPEN__TYPE = str MCONTR_LINTILE_KEEP_OPEN__TYPE = str
...@@ -1976,6 +1990,7 @@ SENS_PCLK_PERIOD__RAW = str ...@@ -1976,6 +1990,7 @@ SENS_PCLK_PERIOD__RAW = str
NUM_CYCLES_23__TYPE = str NUM_CYCLES_23__TYPE = str
MCNTRL_TILED_MODE__TYPE = str MCNTRL_TILED_MODE__TYPE = str
MCONTR_TOP_0BIT_MCONTR_EN__RAW = str MCONTR_TOP_0BIT_MCONTR_EN__RAW = str
TABLE_HUFFMAN_INDEX__TYPE = str
RTC_SET_STATUS__RAW = str RTC_SET_STATUS__RAW = str
SENS_CTRL_QUADRANTS = int SENS_CTRL_QUADRANTS = int
LD_DLY_PHASE__TYPE = str LD_DLY_PHASE__TYPE = str
......
...@@ -221,7 +221,7 @@ class X393Cmprs(object): ...@@ -221,7 +221,7 @@ class X393Cmprs(object):
focus_mode = None): focus_mode = None):
""" """
Combine compressor control parameters into a single word. None value preserves old setting for the parameter Combine compressor control parameters into a single word. None value preserves old setting for the parameter
@param chn - compressor channel number @param chn - compressor channel number, "a" or "all" - same for all 4 channels
@param run_mode - 0 - reset, 2 - run single from memory, 3 - run repetitive @param run_mode - 0 - reset, 2 - run single from memory, 3 - run repetitive
@param qbank - quantization table page (0..15) @param qbank - quantization table page (0..15)
@param dc_sub - True - subtract DC before running DCT, False - no subtraction, convert as is, @param dc_sub - True - subtract DC before running DCT, False - no subtraction, convert as is,
...@@ -243,6 +243,20 @@ class X393Cmprs(object): ...@@ -243,6 +243,20 @@ class X393Cmprs(object):
@param bayer - Bayer shift (0..3) @param bayer - Bayer shift (0..3)
@param focus_mode - focus mode - how to combine image with "focus quality" in the result image @param focus_mode - focus mode - how to combine image with "focus quality" in the result image
""" """
try:
if (chn == all) or (chn[0].upper() == "A"): #all is a built-in function
for chn in range(4):
self.compressor_control (chn = chn,
run_mode = run_mode,
qbank = qbank,
dc_sub = dc_sub,
cmode = cmode,
multi_frame = multi_frame,
bayer = bayer,
focus_mode = focus_mode)
return
except:
pass
data = self.func_compressor_control( data = self.func_compressor_control(
run_mode = run_mode, run_mode = run_mode,
qbank = qbank, qbank = qbank,
......
...@@ -161,6 +161,7 @@ class X393Jpeg(object): ...@@ -161,6 +161,7 @@ class X393Jpeg(object):
x393_axi_tasks=None #x393X393AxiControlStatus x393_axi_tasks=None #x393X393AxiControlStatus
x393_utils=None x393_utils=None
x393_cmprs_afi = None x393_cmprs_afi = None
x393_sens_cmprs = None
verbose=1 verbose=1
def __init__(self, debug_mode=1,dry_mode=True, saveFileName=None): def __init__(self, debug_mode=1,dry_mode=True, saveFileName=None):
...@@ -171,11 +172,66 @@ class X393Jpeg(object): ...@@ -171,11 +172,66 @@ class X393Jpeg(object):
self.x393_axi_tasks= x393_axi_control_status.X393AxiControlStatus(debug_mode,dry_mode) self.x393_axi_tasks= x393_axi_control_status.X393AxiControlStatus(debug_mode,dry_mode)
self.x393_cmprs_afi = x393_cmprs_afi.X393CmprsAfi(debug_mode,dry_mode) self.x393_cmprs_afi = x393_cmprs_afi.X393CmprsAfi(debug_mode,dry_mode)
self.x393_utils= x393_utils.X393Utils(debug_mode,dry_mode, saveFileName) # should not overwrite save file path self.x393_utils= x393_utils.X393Utils(debug_mode,dry_mode, saveFileName) # should not overwrite save file path
self.x393_sens_cmprs = x393_sens_cmprs.X393SensCmprs(debug_mode,dry_mode, saveFileName)
try: try:
self.verbose=vrlg.VERBOSE self.verbose=vrlg.VERBOSE
except: except:
pass pass
self.huff_tables=None self.huff_tables=None
def set_qtables(self,
chn,
index = 0, # index of a table pair
y_quality = 80,
c_quality = None,
portrait = False,
verbose = 1
):
"""
Set a pair of quantization tables to FPGA
@param chn - compressor channel number, "a" or "all" - same for all 4 channels
@param y_quality - 1..100 - quantization quality for Y component
@param c_quality - 1..100 - quantization quality for color components (None - use y_quality)
@param portrait - False - use normal order, True - transpose for portrait mode images
@param verbose - verbose level
@return dictionary{"header","fpga"} each with a list of 2 lists of the 64 quantization
table values [[y-table],[c-table]]
'header' points to a pair of tables for the file header, 'fpga' - tables to be
sent to the fpga
"""
try:
if (chn == all) or (chn[0].upper() == "A"): #all is a built-in function
for chn in range(4):
self.set_qtables (chn = chn,
index = index,
y_quality = y_quality,
c_quality = c_quality,
portrait = portrait,
verbose = verbose)
return
except:
pass
quantization_data = self.get_qtables(y_quality = y_quality,
c_quality = c_quality,
portrait = portrait,
verbose = verbose - 1)
quantization_data = quantization_data['fpga'][0] + quantization_data['fpga'][1]
if verbose > 1:
items_per_line = 8
print("quantization_data:")
for i, qd in enumerate(quantization_data):
if (i % items_per_line) == 0:
print("%04x: "%(i), end = "")
print ("%04x"%(qd), end = (", ","\n")[((i+1) % items_per_line) == 0])
self.x393_sens_cmprs.program_quantization (chn = chn,
index = index,
quantization_data = quantization_data,
verbose = verbose)
def get_qtables(self, def get_qtables(self,
y_quality = 80, y_quality = 80,
c_quality = None, c_quality = None,
...@@ -209,7 +265,8 @@ class X393Jpeg(object): ...@@ -209,7 +265,8 @@ class X393Jpeg(object):
for i,t in enumerate(STD_QUANT_TBLS[t_name]): for i,t in enumerate(STD_QUANT_TBLS[t_name]):
d = max(1,min((t * q + 50) // 100, 255)) d = max(1,min((t * q + 50) // 100, 255))
tbl[ZIG_ZAG[i]] = d tbl[ZIG_ZAG[i]] = d
fpga_tbl[i] = min(((0x20000 // d) + 1) >> 1, 0xffff) # fpga_tbl[i] = min(((0x20000 // d) + 1) >> 1, 0xffff)
fpga_tbl[ZIG_ZAG[i]] = min(((0x20000 // d) + 1) >> 1, 0xffff)
rslt.append(tbl) rslt.append(tbl)
fpga.append(fpga_tbl) fpga.append(fpga_tbl)
if verbose > 0: if verbose > 0:
...@@ -570,7 +627,6 @@ class X393Jpeg(object): ...@@ -570,7 +627,6 @@ class X393Jpeg(object):
return {"header":buf, return {"header":buf,
"quantization":qtables["fpga"], "quantization":qtables["fpga"],
"huffman": self.huff_tables[FPGA_HUFFMAN_TABLE]} "huffman": self.huff_tables[FPGA_HUFFMAN_TABLE]}
def jpeg_write(self, def jpeg_write(self,
file_path = "/www/pages/img.jpeg", file_path = "/www/pages/img.jpeg",
channel = 0, channel = 0,
...@@ -591,6 +647,21 @@ class X393Jpeg(object): ...@@ -591,6 +647,21 @@ class X393Jpeg(object):
@param byrshift - Bayer shift @param byrshift - Bayer shift
@param verbose - verbose level @param verbose - verbose level
""" """
try:
if (channel == all) or (channel[0].upper() == "A"): #all is a built-in function
for channel in range(4):
self.jpeg_write (file_path = file_path.replace(".","_%d."%channel),
channel = channel,
y_quality = y_quality, #80,
c_quality = c_quality,
portrait = portrait,
color_mode = color_mode,
byrshift = byrshift,
verbose = verbose)
return
except:
pass
jpeg_data = self.jpegheader_create ( jpeg_data = self.jpegheader_create (
y_quality = y_quality, y_quality = y_quality,
c_quality = c_quality, c_quality = c_quality,
...@@ -719,20 +790,27 @@ measure_all "*DI" ...@@ -719,20 +790,27 @@ measure_all "*DI"
setup_all_sensors True None 0xf setup_all_sensors True None 0xf
#reset all compressors #reset all compressors
compressor_control 0 0 #compressor_control 0 0
compressor_control 1 0 #compressor_control 1 0
compressor_control 2 0 #compressor_control 2 0
compressor_control 3 0 #compressor_control 3 0
compressor_control all 0
#next line to make compressor aways use the same input video frame buffer (default - 2 ping-pong frame buffers) #next line to make compressor aways use the same input video frame buffer (default - 2 ping-pong frame buffers)
#axi_write_single_w 0x6c4 0 #axi_write_single_w 0x6c4 0
#set quadrants
set_sensor_io_ctl 0 None None None None None 0 0x4
set_sensor_io_ctl 1 None None None None None 0 0xe
set_sensor_io_ctl 2 None None None None None 0 0x4
set_sensor_io_ctl 3 None None None None None 0 0xe
# Set Bayer = 3 (probably #1 and #3 need different hact/pxd delays to use the same compressor bayer for all channels) # Set Bayer = 3 (probably #1 and #3 need different hact/pxd delays to use the same compressor bayer for all channels)
compressor_control 0 None None None None None 3 #compressor_control 0 None None None None None 3
compressor_control 1 None None None None None 2 #compressor_control 1 None None None None None 3
compressor_control 2 None None None None None 3 #compressor_control 2 None None None None None 3
compressor_control 3 None None None None None 2 #compressor_control 3 None None None None None 3
compressor_control all None None None None None 3
#Gamma 0.57 #Gamma 0.57
...@@ -795,16 +873,66 @@ axi_write_single_w 0x6a6 0x079800a3 ...@@ -795,16 +873,66 @@ axi_write_single_w 0x6a6 0x079800a3
axi_write_single_w 0x6b6 0x079800a3 axi_write_single_w 0x6b6 0x079800a3
#run copmpressors once (#1 - stop gracefully, 0 - reset, 2 - single, 3 - repetitive with sync to sensors) #run copmpressors once (#1 - stop gracefully, 0 - reset, 2 - single, 3 - repetitive with sync to sensors)
compressor_control 0 2 #compressor_control 0 2
compressor_control 1 2 #compressor_control 1 2
compressor_control 2 2 #compressor_control 2 2
compressor_control 3 2 #compressor_control 3 2
compressor_control all 2
#jpeg_write "/www/pages/img0.jpeg" 0
#jpeg_write "/www/pages/img1.jpeg" 1
#jpeg_write "/www/pages/img2.jpeg" 2