Commit f18a13be authored by Andrey Filippov's avatar Andrey Filippov

debugging color conversion

parent de641880
...@@ -57,87 +57,91 @@ module cmprs_tile_mode2_decode #( ...@@ -57,87 +57,91 @@ module cmprs_tile_mode2_decode #(
reg jp4_dc_improved_r; reg jp4_dc_improved_r;
reg hdr_r; reg hdr_r;
reg [3:0] bayer_phase_onehot; reg [3:0] bayer_phase_onehot;
reg first_in;
always @ (posedge xclk) if (pre_first_in)begin always @ (posedge xclk) begin
converter_type_r [2:0] <= converter_type[2:0]; first_in <= pre_first_in;
jp4_dc_improved_r <= jp4_dc_improved; if (pre_first_in)begin
hdr_r <= hdr; converter_type_r [2:0] <= converter_type[2:0];
subtract_dc <= subtract_dc_in; jp4_dc_improved_r <= jp4_dc_improved;
first_mb <= first_mb_in; hdr_r <= hdr;
last_mb <= last_mb_in; subtract_dc <= subtract_dc_in;
bayer_phase_onehot[3:0]<={(bayer_phase[1:0]==2'h3)?1'b1:1'b0, first_mb <= first_mb_in;
(bayer_phase[1:0]==2'h2)?1'b1:1'b0, last_mb <= last_mb_in;
(bayer_phase[1:0]==2'h1)?1'b1:1'b0, bayer_phase_onehot[3:0]<={(bayer_phase[1:0]==2'h3)?1'b1:1'b0,
(bayer_phase[1:0]==2'h0)?1'b1:1'b0}; (bayer_phase[1:0]==2'h2)?1'b1:1'b0,
(bayer_phase[1:0]==2'h1)?1'b1:1'b0,
case (converter_type_r) (bayer_phase[1:0]==2'h0)?1'b1:1'b0};
CMPRS_COLOR18: begin end
component_numsL <= 6'h10; // component_num [0] if (first_in) begin
component_numsM <= 6'h20; // component_num [1] case (converter_type_r)
component_numsH <= 6'h00; // component_num [2] CMPRS_COLOR18: begin
component_colors <= 6'h30; // use color quantization table (YCbCR, jp4diff) component_numsL <= 6'h10; // component_num [0]
component_first <= 6'h31; // first_r this component in a frame (DC absolute, otherwise - difference to previous) component_numsM <= 6'h20; // component_num [1]
four_blocks <= 0; // 6 blocks/maceoblock mode component_numsH <= 6'h00; // component_num [2]
color_enable <= 1'b1; component_colors <= 6'h30; // use color quantization table (YCbCR, jp4diff)
end component_first <= 6'h31; // first_r this component in a frame (DC absolute, otherwise - difference to previous)
CMPRS_COLOR20: begin four_blocks <= 0; // 6 blocks/maceoblock mode
component_numsL <= 6'h10; // component_num [0] color_enable <= 1'b1;
component_numsM <= 6'h20; // component_num [1] end
component_numsH <= 6'h3f; // component_num [2] CMPRS_COLOR20: begin
component_colors <= 6'h30; // use color quantization table (YCbCR, jp4diff) component_numsL <= 6'h10; // component_num [0]
component_first <= 6'h31; // first_r this component in a frame (DC absolute, otherwise - difference to previous) component_numsM <= 6'h20; // component_num [1]
four_blocks <= 0; // 6 blocks/maceoblock mode component_numsH <= 6'h3f; // component_num [2]
color_enable <= 1'b1; component_colors <= 6'h30; // use color quantization table (YCbCR, jp4diff)
end component_first <= 6'h31; // first_r this component in a frame (DC absolute, otherwise - difference to previous)
CMPRS_MONO16: begin four_blocks <= 0; // 6 blocks/maceoblock mode
component_numsL <= 6'h10; // component_num [0] color_enable <= 1'b1;
component_numsM <= 6'h20; // component_num [1] end
component_numsH <= 6'h30; // component_num [2] CMPRS_MONO16: begin
component_colors <= 6'h30; // use color quantization table (YCbCR, jp4diff) component_numsL <= 6'h10; // component_num [0]
component_first <= 6'h31; // first_r this component in a frame (DC absolute, otherwise - difference to previous) component_numsM <= 6'h20; // component_num [1]
four_blocks <= 0; // 6 blocks/maceoblock mode component_numsH <= 6'h30; // component_num [2]
color_enable <= 1'b0; component_colors <= 6'h30; // use color quantization table (YCbCR, jp4diff)
end component_first <= 6'h31; // first_r this component in a frame (DC absolute, otherwise - difference to previous)
CMPRS_JP4: begin four_blocks <= 0; // 6 blocks/maceoblock mode
component_numsL <= jp4_dc_improved_r?6'h0a:6'h10; // LSb of component_num color_enable <= 1'b0;
component_numsM <= jp4_dc_improved_r?6'h0c:6'h20; // MSb of component_num end
component_numsH <= 6'h30; // component_num [2] CMPRS_JP4: begin
component_colors <= 6'h30; // use color quantization table (YCbCR, jp4diff) component_numsL <= jp4_dc_improved_r?6'h0a:6'h10; // LSb of component_num
component_first <= jp4_dc_improved_r?6'h3f:6'h31; // first_r this component in a frame (DC absolute, otherwise - difference to previous) component_numsM <= jp4_dc_improved_r?6'h0c:6'h20; // MSb of component_num
four_blocks <= 1; // 4 blocks/maceoblock mode component_numsH <= 6'h30; // component_num [2]
color_enable <= 1'b0; component_colors <= 6'h30; // use color quantization table (YCbCR, jp4diff)
end component_first <= jp4_dc_improved_r?6'h3f:6'h31; // first_r this component in a frame (DC absolute, otherwise - difference to previous)
CMPRS_JP4DIFF: begin four_blocks <= 1; // 4 blocks/maceoblock mode
component_numsL <= 6'h0a; // LSb of component_num color_enable <= 1'b0;
component_numsM <= 6'h0c; // MSb of component_num end
component_numsH <= 6'h30; // component_num [2] CMPRS_JP4DIFF: begin
component_colors <= {2'h3,~bayer_phase_onehot[3:0] | (hdr_r? {~bayer_phase_onehot[1:0],~bayer_phase_onehot[3:2]} : 4'h0)}; // use color quantization table (YCbCR, jp4diff) component_numsL <= 6'h0a; // LSb of component_num
component_first <= 6'h3f; // first_r this component in a frame (DC absolute, otherwise - difference to previous) component_numsM <= 6'h0c; // MSb of component_num
four_blocks <= 1; // 4 blocks/maceoblock mode component_numsH <= 6'h30; // component_num [2]
color_enable <= 1'b0; component_colors <= {2'h3,~bayer_phase_onehot[3:0] | (hdr_r? {~bayer_phase_onehot[1:0],~bayer_phase_onehot[3:2]} : 4'h0)}; // use color quantization table (YCbCR, jp4diff)
end component_first <= 6'h3f; // first_r this component in a frame (DC absolute, otherwise - difference to previous)
four_blocks <= 1; // 4 blocks/maceoblock mode
CMPRS_MONO8: begin color_enable <= 1'b0;
/* end
component_numsL <= 6'h00; // TODO: Implement, put actuqal data in this and other fields
component_numsM <= 6'h00; CMPRS_MONO8: begin
component_numsH <= 6'h30; /*
component_colors <= 6'h30; component_numsL <= 6'h00; // TODO: Implement, put actuqal data in this and other fields
component_first <= 6'h31; component_numsM <= 6'h00;
color_enable <= 1'b0; component_numsH <= 6'h30;
*/ component_colors <= 6'h30;
end component_first <= 6'h31;
color_enable <= 1'b0;
default: begin */
component_numsL <= 'bx; end
component_numsM <= 'bx;
component_numsH <= 'bx; default: begin
component_colors <= 'bx; component_numsL <= 'bx;
component_first <= 'bx; component_numsM <= 'bx;
four_blocks <= 'bx; component_numsH <= 'bx;
color_enable <= 'bx; component_colors <= 'bx;
end component_first <= 'bx;
endcase four_blocks <= 'bx;
color_enable <= 'bx;
end
endcase
end
end end
endmodule endmodule
......
...@@ -1888,8 +1888,8 @@ task setup_sensor_channel; ...@@ -1888,8 +1888,8 @@ task setup_sensor_channel;
3, // num_macro_cols_m1; // number of macroblock colums minus 1 3, // num_macro_cols_m1; // number of macroblock colums minus 1
1, // num_macro_rows_m1; // number of macroblock rows minus 1 1, // num_macro_rows_m1; // number of macroblock rows minus 1
1, // input [31:0] left_margin; // left margin of the first pixel (0..31) for 32-pixel wide colums in memory access 1, // input [31:0] left_margin; // left margin of the first pixel (0..31) for 32-pixel wide colums in memory access
'hc0, // input [31:0] colorsat_blue; //color saturation for blue (10 bits) //'h90 for 100% 'h120, // input [31:0] colorsat_blue; //color saturation for blue (10 bits) //'h90 for 100%
'h90, // colorsat_red; //color saturation for red (10 bits) // 'b6 for 100% 'h16c, // colorsat_red; //color saturation for red (10 bits) // 'b6 for 100%
0); // input [31:0] coring; // coring value 0); // input [31:0] coring; // coring value
// TODO: calculate widths correctly! // TODO: calculate widths correctly!
setup_compressor_memory ( setup_compressor_memory (
......
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