finish reconstruction
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
module ColorBlender #(
|
||||
parameter reg [ 4:0] IN_DEPTH = 12, // 输入图像的色深
|
||||
parameter reg [ 4:0] OUT_DEPTH = 8, // 输出图像的色深
|
||||
parameter reg [12:0] GAIN_RED = 120, // 红色增益系数(除以10^小数位数)
|
||||
parameter reg [12:0] GAIN_GREEN = 50, // 绿色增益系数
|
||||
parameter reg [12:0] GAIN_BLUE = 95, // 蓝色增益系数
|
||||
parameter reg [16:0] GAIN_RED = 120, // 红色增益系数
|
||||
parameter reg [16:0] GAIN_GREEN = 50, // 绿色增益系数
|
||||
parameter reg [16:0] GAIN_BLUE = 95, // 蓝色增益系数
|
||||
parameter reg [ 4:0] GAIN_OFFSET = 7
|
||||
) (
|
||||
input clk,
|
||||
@@ -21,7 +21,7 @@ module ColorBlender #(
|
||||
input in_ready,
|
||||
input in_receive,
|
||||
output out_en,
|
||||
output [3 * OUT_DEPTH - 1:0] data_out,
|
||||
output [3 * OUT_DEPTH - 1:0] out_data,
|
||||
|
||||
// 颜色校正
|
||||
input wire color_correction
|
||||
@@ -45,7 +45,7 @@ module ColorBlender #(
|
||||
case (state)
|
||||
READ_DATA: nextState = (in_en) ? (color_correction ? CALC_DATA : SEND_DATA) : READ_DATA;
|
||||
CALC_DATA: nextState = SEND_DATA;
|
||||
SEND_DATA: nextState = READ_DATA;
|
||||
SEND_DATA: nextState = (in_receive) ? READ_DATA : SEND_DATA;
|
||||
default: nextState = READ_DATA;
|
||||
endcase
|
||||
end
|
||||
@@ -63,19 +63,25 @@ module ColorBlender #(
|
||||
end else begin
|
||||
case (state)
|
||||
READ_DATA: begin
|
||||
|
||||
if (in_en) begin
|
||||
data_cal[0] <= ({{(32 - IN_DEPTH){1'b0}}, data_in[0]} >> (IN_DEPTH - OUT_DEPTH));
|
||||
data_cal[1] <= ({{(32 - IN_DEPTH){1'b0}}, data_in[1]} >> (IN_DEPTH - OUT_DEPTH));
|
||||
data_cal[2] <= ({{(32 - IN_DEPTH){1'b0}}, data_in[2]} >> (IN_DEPTH - OUT_DEPTH));
|
||||
data_cal[0] <= ({16'b0, data_in[0]} << 8;
|
||||
data_cal[1] <= ({16'b0, data_in[1]} << 8;
|
||||
data_cal[2] <= ({16'b0, data_in[2]} << 8;
|
||||
end
|
||||
end
|
||||
|
||||
CALC_DATA: begin
|
||||
data_cal[0] <= data_cal[0] * (GAIN_RED << 8)
|
||||
data_cal[1] <= data_cal[1] * (GAIN_GREEN << 8)
|
||||
data_cal[2] <= data_cal[2] * (GAIN_BLUE << 8)
|
||||
end
|
||||
|
||||
SEND_DATA: begin
|
||||
|
||||
if (in_ready) begin
|
||||
out_data[0] <= data_cal[0] >> (8 + IN_DEPTH - OUT_DEPTH)
|
||||
out_data[1] <= data_cal[1] >> (8 + IN_DEPTH - OUT_DEPTH)
|
||||
out_data[2] <= data_cal[2] >> (8 + IN_DEPTH - OUT_DEPTH)
|
||||
end
|
||||
end
|
||||
|
||||
default: ;
|
||||
|
||||
Reference in New Issue
Block a user