x393  1.0
FPGAcodeforElphelNC393camera
cmprs_tile_mode_decode.v
Go to the documentation of this file.
1 
39 `timescale 1ns/1ps
40 
42  parameter CMPRS_COLOR18 = 0, // JPEG 4:2:0 with 18x18 overlapping tiles for de-bayer
43  parameter CMPRS_COLOR20 = 1, // JPEG 4:2:0 with 18x18 overlapping tiles for de-bayer (not implemented)
44  parameter CMPRS_MONO16 = 2, // JPEG 4:2:0 with 16x16 non-overlapping tiles, color components zeroed
45  parameter CMPRS_JP4 = 3, // JP4 mode with 16x16 macroblocks
46  parameter CMPRS_JP4DIFF = 4, // JP4DIFF mode TODO: see if correct
47  parameter CMPRS_MONO8 = 7 // Regular JPEG monochrome with 8x8 macroblocks (not yet implemented)
48 )(
49  input [2:0] converter_type,
50  output reg [ 5:0] mb_w_m1, // macroblock width minus 1
51  output reg [ 5:0] mb_h_m1, // macroblock height minus 1
52  output reg [ 4:0] mb_hper, // macroblock horizontal period (8/16) // 3 LSB not used
53  output reg [ 1:0] tile_width, // memory tile width (can be 128 for monochrome JPEG) Can be 32/64/128: 0 - 16, 1 - 32, 2 - 64, 3 - 128
54  output reg tile_col_width // 0 - 16 pixels, 1 -32 pixels
55 );
56 
57 // wire [ 2:0] converter_type; // 0 - color18, 1 - color20, 2 - mono, 3 - jp4, 4 - jp4-diff, 7 - mono8 (not yet implemented)
58  always @(converter_type) begin
59  case (converter_type)
60  CMPRS_COLOR18: begin
61  mb_w_m1 <= 17; // macroblock width minus 1
62  mb_h_m1 <= 17; // macroblock height minus 1
63  mb_hper <= 16; // macroblock horizontal period (8/16) // 3 LSB not used
64  tile_width <= 1; // memory tile width (can be 128 for monochrome JPEG) Can be 32/64/128: 0 - 16, 1 - 32, 2 - 64, 3 - 128
65  tile_col_width <= 1; // 0 - 16 pixels, 1 -32 pixels
66  end
67  CMPRS_COLOR20: begin
68  mb_w_m1 <= 19; // macroblock width minus 1
69  mb_h_m1 <= 19; // macroblock height minus 1
70  mb_hper <= 16; // macroblock horizontal period (8/16) // 3 LSB not used
71  tile_width <= 1; // memory tile width (can be 128 for monochrome JPEG) Can be 32/64/128: 0 - 16, 1 - 32, 2 - 64, 3 - 128
72  tile_col_width <= 1; // 0 - 16 pixels, 1 -32 pixels
73  end
74  CMPRS_MONO16: begin
75  mb_w_m1 <= 15; // macroblock width minus 1
76  mb_h_m1 <= 15; // macroblock height minus 1
77  mb_hper <= 16; // macroblock horizontal period (8/16) // 3 LSB not used
78  tile_width <= 2; // memory tile width (can be 128 for monochrome JPEG) Can be 32/64/128: 0 - 16, 1 - 32, 2 - 64, 3 - 128
79  tile_col_width <= 1; // 0 - 16 pixels, 1 -32 pixels
80  end
81  CMPRS_JP4: begin
82  mb_w_m1 <= 15; // macroblock width minus 1
83  mb_h_m1 <= 15; // macroblock height minus 1
84  mb_hper <= 16; // macroblock horizontal period (8/16) // 3 LSB not used
85  tile_width <= 2; // memory tile width (can be 128 for monochrome JPEG) Can be 32/64/128: 0 - 16, 1 - 32, 2 - 64, 3 - 128
86  tile_col_width <= 1; // 0 - 16 pixels, 1 -32 pixels
87  end
88  CMPRS_JP4DIFF: begin
89  mb_w_m1 <= 15; // macroblock width minus 1
90  mb_h_m1 <= 15; // macroblock height minus 1
91  mb_hper <= 16; // macroblock horizontal period (8/16) // 3 LSB not used
92  tile_width <= 2; // memory tile width (can be 128 for monochrome JPEG) Can be 32/64/128: 0 - 16, 1 - 32, 2 - 64, 3 - 128
93  tile_col_width <= 1; // 0 - 16 pixels, 1 -32 pixels
94  end
95  CMPRS_MONO8: begin
96  mb_w_m1 <= 7; // macroblock width minus 1
97  mb_h_m1 <= 7; // macroblock height minus 1
98  mb_hper <= 8; // macroblock horizontal period (8/16) // 3 LSB not used
99  tile_width <= 3; // memory tile width (can be 128 for monochrome JPEG) Can be 32/64/128: 0 - 16, 1 - 32, 2 - 64, 3 - 128
100  tile_col_width <= 1; // 0 - 16 pixels, 1 -32 pixels
101  end
102  default: begin
103  mb_w_m1 <= 'bx; // macroblock width minus 1
104  mb_h_m1 <= 'bx; // macroblock height minus 1
105  mb_hper <= 'bx; // macroblock horizontal period (8/16) // 3 LSB not used
106  tile_width <= 'bx; // memory tile width (can be 128 for monochrome JPEG) Can be 32/64/128: 0 - 16, 1 - 32, 2 - 64, 3 - 128
107  tile_col_width <= 'bx; // 0 - 16 pixels, 1 -32 pixels
108  end
109  endcase
110  end
111 
112 endmodule
113