Commit f18a13be authored by Andrey Filippov's avatar Andrey Filippov

debugging color conversion

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