OpenCores
URL https://opencores.org/ocsvn/nova/nova/trunk

Subversion Repositories nova

[/] [nova/] [trunk/] [src/] [Inter_pred_sliding_window.v] - Blame information for rev 11

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 10 eexuke
//--------------------------------------------------------------------------------------------------
2
// Design    : nova
3
// Author(s) : Ke Xu
4
// Email           : eexuke@yahoo.com
5
// File      : Inter_pred_sliding_window.v
6
// Generated : Oct 25, 2005
7
// Copyright (C) 2008 Ke Xu                
8
//-------------------------------------------------------------------------------------------------
9
// Description 
10
// Prepare the appropriate registers for Inter prediction (luma & chroma) 
11
// 1)Luma:horizontal window 6x9,vertical window 1x9
12
// 2)Chroma:window 2x2
13
//-------------------------------------------------------------------------------------------------
14
 
15
// synopsys translate_off
16
`include "timescale.v"
17
// synopsys translate_on
18
`include "nova_defines.v"
19
 
20
module Inter_pred_sliding_window (IsInterLuma,IsInterChroma,Is_InterChromaCopy,mv_below8x8_curr,
21
        pos_FracL,blk4x4_rec_counter_1to0,blk4x4_inter_calculate_counter,
22
        Inter_ref_00_00,Inter_ref_01_00,Inter_ref_02_00,Inter_ref_03_00,Inter_ref_04_00,Inter_ref_05_00,
23
        Inter_ref_06_00,Inter_ref_07_00,Inter_ref_08_00,Inter_ref_09_00,Inter_ref_10_00,Inter_ref_11_00,Inter_ref_12_00,
24
        Inter_ref_00_01,Inter_ref_01_01,Inter_ref_02_01,Inter_ref_03_01,Inter_ref_04_01,Inter_ref_05_01,
25
        Inter_ref_06_01,Inter_ref_07_01,Inter_ref_08_01,Inter_ref_09_01,Inter_ref_10_01,Inter_ref_11_01,Inter_ref_12_01,
26
        Inter_ref_00_02,Inter_ref_01_02,Inter_ref_02_02,Inter_ref_03_02,Inter_ref_04_02,Inter_ref_05_02,
27
        Inter_ref_06_02,Inter_ref_07_02,Inter_ref_08_02,Inter_ref_09_02,Inter_ref_10_02,Inter_ref_11_02,Inter_ref_12_02,
28
        Inter_ref_00_03,Inter_ref_01_03,Inter_ref_02_03,Inter_ref_03_03,Inter_ref_04_03,Inter_ref_05_03,
29
        Inter_ref_06_03,Inter_ref_07_03,Inter_ref_08_03,Inter_ref_09_03,Inter_ref_10_03,Inter_ref_11_03,Inter_ref_12_03,
30
        Inter_ref_00_04,Inter_ref_01_04,Inter_ref_02_04,Inter_ref_03_04,Inter_ref_04_04,Inter_ref_05_04,
31
        Inter_ref_06_04,Inter_ref_07_04,Inter_ref_08_04,Inter_ref_09_04,Inter_ref_10_04,Inter_ref_11_04,Inter_ref_12_04,
32
        Inter_ref_00_05,Inter_ref_01_05,Inter_ref_02_05,Inter_ref_03_05,Inter_ref_04_05,Inter_ref_05_05,
33
        Inter_ref_06_05,Inter_ref_07_05,Inter_ref_08_05,Inter_ref_09_05,Inter_ref_10_05,Inter_ref_11_05,Inter_ref_12_05,
34
        Inter_ref_00_06,Inter_ref_01_06,Inter_ref_02_06,Inter_ref_03_06,Inter_ref_04_06,Inter_ref_05_06,
35
        Inter_ref_06_06,Inter_ref_07_06,Inter_ref_08_06,Inter_ref_09_06,Inter_ref_10_06,Inter_ref_11_06,Inter_ref_12_06,
36
        Inter_ref_00_07,Inter_ref_01_07,Inter_ref_02_07,Inter_ref_03_07,Inter_ref_04_07,Inter_ref_05_07,
37
        Inter_ref_06_07,Inter_ref_07_07,Inter_ref_08_07,Inter_ref_09_07,Inter_ref_10_07,Inter_ref_11_07,Inter_ref_12_07,
38
        Inter_ref_00_08,Inter_ref_01_08,Inter_ref_02_08,Inter_ref_03_08,Inter_ref_04_08,Inter_ref_05_08,
39
        Inter_ref_06_08,Inter_ref_07_08,Inter_ref_08_08,Inter_ref_09_08,Inter_ref_10_08,Inter_ref_11_08,Inter_ref_12_08,
40
        Inter_ref_00_09,Inter_ref_01_09,Inter_ref_02_09,Inter_ref_03_09,Inter_ref_04_09,Inter_ref_05_09,
41
        Inter_ref_06_09,Inter_ref_07_09,Inter_ref_08_09,Inter_ref_09_09,Inter_ref_10_09,Inter_ref_11_09,Inter_ref_12_09,
42
        Inter_ref_00_10,Inter_ref_01_10,Inter_ref_02_10,Inter_ref_03_10,Inter_ref_04_10,Inter_ref_05_10,
43
        Inter_ref_06_10,Inter_ref_07_10,Inter_ref_08_10,Inter_ref_09_10,Inter_ref_10_10,Inter_ref_11_10,Inter_ref_12_10,
44
        Inter_ref_00_11,Inter_ref_01_11,Inter_ref_02_11,Inter_ref_03_11,Inter_ref_04_11,Inter_ref_05_11,
45
        Inter_ref_06_11,Inter_ref_07_11,Inter_ref_08_11,Inter_ref_09_11,Inter_ref_10_11,Inter_ref_11_11,Inter_ref_12_11,
46
        Inter_ref_00_12,Inter_ref_01_12,Inter_ref_02_12,Inter_ref_03_12,Inter_ref_04_12,Inter_ref_05_12,
47
        Inter_ref_06_12,Inter_ref_07_12,Inter_ref_08_12,Inter_ref_09_12,Inter_ref_10_12,Inter_ref_11_12,Inter_ref_12_12,
48
 
49
        Inter_pix_copy0,Inter_pix_copy1,Inter_pix_copy2,Inter_pix_copy3,
50
        Inter_H_window_0_0,Inter_H_window_1_0,Inter_H_window_2_0,Inter_H_window_3_0,Inter_H_window_4_0,Inter_H_window_5_0,
51
        Inter_H_window_0_1,Inter_H_window_1_1,Inter_H_window_2_1,Inter_H_window_3_1,Inter_H_window_4_1,Inter_H_window_5_1,
52
        Inter_H_window_0_2,Inter_H_window_1_2,Inter_H_window_2_2,Inter_H_window_3_2,Inter_H_window_4_2,Inter_H_window_5_2,
53
        Inter_H_window_0_3,Inter_H_window_1_3,Inter_H_window_2_3,Inter_H_window_3_3,Inter_H_window_4_3,Inter_H_window_5_3,
54
        Inter_H_window_0_4,Inter_H_window_1_4,Inter_H_window_2_4,Inter_H_window_3_4,Inter_H_window_4_4,Inter_H_window_5_4,
55
        Inter_H_window_0_5,Inter_H_window_1_5,Inter_H_window_2_5,Inter_H_window_3_5,Inter_H_window_4_5,Inter_H_window_5_5,
56
        Inter_H_window_0_6,Inter_H_window_1_6,Inter_H_window_2_6,Inter_H_window_3_6,Inter_H_window_4_6,Inter_H_window_5_6,
57
        Inter_H_window_0_7,Inter_H_window_1_7,Inter_H_window_2_7,Inter_H_window_3_7,Inter_H_window_4_7,Inter_H_window_5_7,
58
        Inter_H_window_0_8,Inter_H_window_1_8,Inter_H_window_2_8,Inter_H_window_3_8,Inter_H_window_4_8,Inter_H_window_5_8,
59
        Inter_V_window_0,Inter_V_window_1,Inter_V_window_2,Inter_V_window_3,Inter_V_window_4,
60
        Inter_V_window_5,Inter_V_window_6,Inter_V_window_7,Inter_V_window_8,
61
        Inter_C_window_0_0,Inter_C_window_1_0,Inter_C_window_2_0,
62
        Inter_C_window_0_1,Inter_C_window_1_1,Inter_C_window_2_1,
63
        Inter_C_window_0_2,Inter_C_window_1_2,Inter_C_window_2_2,
64
        Inter_bi_window_0,Inter_bi_window_1,Inter_bi_window_2,Inter_bi_window_3);
65
        input IsInterLuma;
66
        input IsInterChroma;
67
        input Is_InterChromaCopy;
68
        input mv_below8x8_curr;
69
        input [3:0] pos_FracL;
70
        input [1:0] blk4x4_rec_counter_1to0;
71
        input [3:0] blk4x4_inter_calculate_counter;
72
 
73
        input [7:0] Inter_ref_00_00,Inter_ref_01_00,Inter_ref_02_00,Inter_ref_03_00,Inter_ref_04_00,Inter_ref_05_00;
74
        input [7:0] Inter_ref_06_00,Inter_ref_07_00,Inter_ref_08_00,Inter_ref_09_00,Inter_ref_10_00,Inter_ref_11_00,Inter_ref_12_00;
75
        input [7:0] Inter_ref_00_01,Inter_ref_01_01,Inter_ref_02_01,Inter_ref_03_01,Inter_ref_04_01,Inter_ref_05_01;
76
        input [7:0] Inter_ref_06_01,Inter_ref_07_01,Inter_ref_08_01,Inter_ref_09_01,Inter_ref_10_01,Inter_ref_11_01,Inter_ref_12_01;
77
        input [7:0] Inter_ref_00_02,Inter_ref_01_02,Inter_ref_02_02,Inter_ref_03_02,Inter_ref_04_02,Inter_ref_05_02;
78
        input [7:0] Inter_ref_06_02,Inter_ref_07_02,Inter_ref_08_02,Inter_ref_09_02,Inter_ref_10_02,Inter_ref_11_02,Inter_ref_12_02;
79
        input [7:0] Inter_ref_00_03,Inter_ref_01_03,Inter_ref_02_03,Inter_ref_03_03,Inter_ref_04_03,Inter_ref_05_03;
80
        input [7:0] Inter_ref_06_03,Inter_ref_07_03,Inter_ref_08_03,Inter_ref_09_03,Inter_ref_10_03,Inter_ref_11_03,Inter_ref_12_03;
81
        input [7:0] Inter_ref_00_04,Inter_ref_01_04,Inter_ref_02_04,Inter_ref_03_04,Inter_ref_04_04,Inter_ref_05_04;
82
        input [7:0] Inter_ref_06_04,Inter_ref_07_04,Inter_ref_08_04,Inter_ref_09_04,Inter_ref_10_04,Inter_ref_11_04,Inter_ref_12_04;
83
        input [7:0] Inter_ref_00_05,Inter_ref_01_05,Inter_ref_02_05,Inter_ref_03_05,Inter_ref_04_05,Inter_ref_05_05;
84
        input [7:0] Inter_ref_06_05,Inter_ref_07_05,Inter_ref_08_05,Inter_ref_09_05,Inter_ref_10_05,Inter_ref_11_05,Inter_ref_12_05;
85
        input [7:0] Inter_ref_00_06,Inter_ref_01_06,Inter_ref_02_06,Inter_ref_03_06,Inter_ref_04_06,Inter_ref_05_06;
86
        input [7:0] Inter_ref_06_06,Inter_ref_07_06,Inter_ref_08_06,Inter_ref_09_06,Inter_ref_10_06,Inter_ref_11_06,Inter_ref_12_06;
87
        input [7:0] Inter_ref_00_07,Inter_ref_01_07,Inter_ref_02_07,Inter_ref_03_07,Inter_ref_04_07,Inter_ref_05_07;
88
        input [7:0] Inter_ref_06_07,Inter_ref_07_07,Inter_ref_08_07,Inter_ref_09_07,Inter_ref_10_07,Inter_ref_11_07,Inter_ref_12_07;
89
        input [7:0] Inter_ref_00_08,Inter_ref_01_08,Inter_ref_02_08,Inter_ref_03_08,Inter_ref_04_08,Inter_ref_05_08;
90
        input [7:0] Inter_ref_06_08,Inter_ref_07_08,Inter_ref_08_08,Inter_ref_09_08,Inter_ref_10_08,Inter_ref_11_08,Inter_ref_12_08;
91
        input [7:0] Inter_ref_00_09,Inter_ref_01_09,Inter_ref_02_09,Inter_ref_03_09,Inter_ref_04_09,Inter_ref_05_09;
92
        input [7:0] Inter_ref_06_09,Inter_ref_07_09,Inter_ref_08_09,Inter_ref_09_09,Inter_ref_10_09,Inter_ref_11_09,Inter_ref_12_09;
93
        input [7:0] Inter_ref_00_10,Inter_ref_01_10,Inter_ref_02_10,Inter_ref_03_10,Inter_ref_04_10,Inter_ref_05_10;
94
        input [7:0] Inter_ref_06_10,Inter_ref_07_10,Inter_ref_08_10,Inter_ref_09_10,Inter_ref_10_10,Inter_ref_11_10,Inter_ref_12_10;
95
        input [7:0] Inter_ref_00_11,Inter_ref_01_11,Inter_ref_02_11,Inter_ref_03_11,Inter_ref_04_11,Inter_ref_05_11;
96
        input [7:0] Inter_ref_06_11,Inter_ref_07_11,Inter_ref_08_11,Inter_ref_09_11,Inter_ref_10_11,Inter_ref_11_11,Inter_ref_12_11;
97
        input [7:0] Inter_ref_00_12,Inter_ref_01_12,Inter_ref_02_12,Inter_ref_03_12,Inter_ref_04_12,Inter_ref_05_12;
98
        input [7:0] Inter_ref_06_12,Inter_ref_07_12,Inter_ref_08_12,Inter_ref_09_12,Inter_ref_10_12,Inter_ref_11_12,Inter_ref_12_12;
99
 
100
        output [7:0] Inter_pix_copy0,Inter_pix_copy1,Inter_pix_copy2,Inter_pix_copy3;
101
        output [7:0] Inter_H_window_0_0,Inter_H_window_1_0,Inter_H_window_2_0,Inter_H_window_3_0,Inter_H_window_4_0,Inter_H_window_5_0;
102
        output [7:0] Inter_H_window_0_1,Inter_H_window_1_1,Inter_H_window_2_1,Inter_H_window_3_1,Inter_H_window_4_1,Inter_H_window_5_1;
103
        output [7:0] Inter_H_window_0_2,Inter_H_window_1_2,Inter_H_window_2_2,Inter_H_window_3_2,Inter_H_window_4_2,Inter_H_window_5_2;
104
        output [7:0] Inter_H_window_0_3,Inter_H_window_1_3,Inter_H_window_2_3,Inter_H_window_3_3,Inter_H_window_4_3,Inter_H_window_5_3;
105
        output [7:0] Inter_H_window_0_4,Inter_H_window_1_4,Inter_H_window_2_4,Inter_H_window_3_4,Inter_H_window_4_4,Inter_H_window_5_4;
106
        output [7:0] Inter_H_window_0_5,Inter_H_window_1_5,Inter_H_window_2_5,Inter_H_window_3_5,Inter_H_window_4_5,Inter_H_window_5_5;
107
        output [7:0] Inter_H_window_0_6,Inter_H_window_1_6,Inter_H_window_2_6,Inter_H_window_3_6,Inter_H_window_4_6,Inter_H_window_5_6;
108
        output [7:0] Inter_H_window_0_7,Inter_H_window_1_7,Inter_H_window_2_7,Inter_H_window_3_7,Inter_H_window_4_7,Inter_H_window_5_7;
109
        output [7:0] Inter_H_window_0_8,Inter_H_window_1_8,Inter_H_window_2_8,Inter_H_window_3_8,Inter_H_window_4_8,Inter_H_window_5_8;
110
        output [7:0] Inter_V_window_0,Inter_V_window_1,Inter_V_window_2,Inter_V_window_3,Inter_V_window_4;
111
        output [7:0] Inter_V_window_5,Inter_V_window_6,Inter_V_window_7,Inter_V_window_8;
112
        output [7:0] Inter_C_window_0_0,Inter_C_window_1_0,Inter_C_window_2_0;
113
        output [7:0] Inter_C_window_0_1,Inter_C_window_1_1,Inter_C_window_2_1;
114
        output [7:0] Inter_C_window_0_2,Inter_C_window_1_2,Inter_C_window_2_2;
115
        output [7:0] Inter_bi_window_0,Inter_bi_window_1,Inter_bi_window_2,Inter_bi_window_3;
116
 
117
        reg [7:0] Inter_pix_copy0,Inter_pix_copy1,Inter_pix_copy2,Inter_pix_copy3;
118
        reg [7:0] Inter_H_window_0_0,Inter_H_window_1_0,Inter_H_window_2_0,Inter_H_window_3_0,Inter_H_window_4_0,Inter_H_window_5_0;
119
        reg [7:0] Inter_H_window_0_1,Inter_H_window_1_1,Inter_H_window_2_1,Inter_H_window_3_1,Inter_H_window_4_1,Inter_H_window_5_1;
120
        reg [7:0] Inter_H_window_0_2,Inter_H_window_1_2,Inter_H_window_2_2,Inter_H_window_3_2,Inter_H_window_4_2,Inter_H_window_5_2;
121
        reg [7:0] Inter_H_window_0_3,Inter_H_window_1_3,Inter_H_window_2_3,Inter_H_window_3_3,Inter_H_window_4_3,Inter_H_window_5_3;
122
        reg [7:0] Inter_H_window_0_4,Inter_H_window_1_4,Inter_H_window_2_4,Inter_H_window_3_4,Inter_H_window_4_4,Inter_H_window_5_4;
123
        reg [7:0] Inter_H_window_0_5,Inter_H_window_1_5,Inter_H_window_2_5,Inter_H_window_3_5,Inter_H_window_4_5,Inter_H_window_5_5;
124
        reg [7:0] Inter_H_window_0_6,Inter_H_window_1_6,Inter_H_window_2_6,Inter_H_window_3_6,Inter_H_window_4_6,Inter_H_window_5_6;
125
        reg [7:0] Inter_H_window_0_7,Inter_H_window_1_7,Inter_H_window_2_7,Inter_H_window_3_7,Inter_H_window_4_7,Inter_H_window_5_7;
126
        reg [7:0] Inter_H_window_0_8,Inter_H_window_1_8,Inter_H_window_2_8,Inter_H_window_3_8,Inter_H_window_4_8,Inter_H_window_5_8;
127
        reg [7:0] Inter_V_window_0,Inter_V_window_1,Inter_V_window_2,Inter_V_window_3,Inter_V_window_4;
128
        reg [7:0] Inter_V_window_5,Inter_V_window_6,Inter_V_window_7,Inter_V_window_8;
129
        reg [7:0] Inter_C_window_0_0,Inter_C_window_1_0,Inter_C_window_2_0;
130
        reg [7:0] Inter_C_window_0_1,Inter_C_window_1_1,Inter_C_window_2_1;
131
        reg [7:0] Inter_C_window_0_2,Inter_C_window_1_2,Inter_C_window_2_2;
132
        reg [7:0] Inter_bi_window_0,Inter_bi_window_1,Inter_bi_window_2,Inter_bi_window_3;
133
 
134
        parameter pos_Int = 4'b0000;
135
        parameter pos_a   = 4'b0100;
136
        parameter pos_b   = 4'b1000;
137
        parameter pos_c   = 4'b1100;
138
        parameter pos_d   = 4'b0001;
139
        parameter pos_e   = 4'b0101;
140
        parameter pos_f   = 4'b1001;
141
        parameter pos_g   = 4'b1101;
142
        parameter pos_h   = 4'b0010;
143
        parameter pos_i   = 4'b0110;
144
        parameter pos_j   = 4'b1010;
145
        parameter pos_k   = 4'b1110;
146
        parameter pos_n   = 4'b0011;
147
        parameter pos_p   = 4'b0111;
148
        parameter pos_q   = 4'b1011;
149
        parameter pos_r   = 4'b1111;
150
 
151
        //-------------------------------
152
        //sliding window control                 
153
        //-------------------------------
154
        wire Is_blk4x4_0;//When inter 8x8(or above) predicted: top-left blk4x4
155
                                         //When inter 4x4           predicted: each blk4x4
156
        wire Is_blk4x4_1;
157
        wire Is_blk4x4_2;
158
        wire Is_blk4x4_3;
159
        assign Is_blk4x4_0 = (IsInterLuma && (mv_below8x8_curr || (!mv_below8x8_curr &&
160
                                                        blk4x4_rec_counter_1to0 == 2'b00)));                                                                    //top-left
161
        assign Is_blk4x4_1 = (IsInterLuma && (!mv_below8x8_curr && blk4x4_rec_counter_1to0 == 2'b01));  //top-right
162
        assign Is_blk4x4_2 = (IsInterLuma && (!mv_below8x8_curr && blk4x4_rec_counter_1to0 == 2'b10));  //bottom-left
163
        assign Is_blk4x4_3 = (IsInterLuma && (!mv_below8x8_curr && blk4x4_rec_counter_1to0 == 2'b11));  //bottom-right
164
 
165
        //For both luma & chroma,if current pixel is to be directly copied instead of inter calculated,
166
        //the sliding windows output Inter_pix_copy0 ~ 3 is the inter prediction output
167
        always @ (IsInterLuma or pos_FracL or blk4x4_inter_calculate_counter
168
                or Is_blk4x4_0 or Is_blk4x4_1 or Is_blk4x4_2 or Is_blk4x4_3
169
                or Is_InterChromaCopy or mv_below8x8_curr
170
                or Inter_ref_00_00 or Inter_ref_01_00 or Inter_ref_02_00 or Inter_ref_03_00
171
                or Inter_ref_00_01 or Inter_ref_01_01 or Inter_ref_02_01 or Inter_ref_03_01
172
                or Inter_ref_00_02 or Inter_ref_01_02 or Inter_ref_02_02 or Inter_ref_03_02
173
                or Inter_ref_04_02 or Inter_ref_05_02 or Inter_ref_06_02 or Inter_ref_07_02
174
                or Inter_ref_08_02 or Inter_ref_09_02 or Inter_ref_00_03 or Inter_ref_01_03
175
                or Inter_ref_02_03 or Inter_ref_03_03 or Inter_ref_04_03 or Inter_ref_05_03
176
                or Inter_ref_06_03 or Inter_ref_07_03 or Inter_ref_08_03 or Inter_ref_09_03
177
                or Inter_ref_02_04 or Inter_ref_03_04 or Inter_ref_04_04 or Inter_ref_05_04
178
                or Inter_ref_06_04 or Inter_ref_07_04 or Inter_ref_08_04 or Inter_ref_09_04
179
                or Inter_ref_02_05 or Inter_ref_03_05 or Inter_ref_04_05 or Inter_ref_05_05
180
                or Inter_ref_06_05 or Inter_ref_07_05 or Inter_ref_08_05 or Inter_ref_09_05
181
                or Inter_ref_02_06 or Inter_ref_03_06 or Inter_ref_04_06 or Inter_ref_05_06
182
                or Inter_ref_06_06 or Inter_ref_07_06 or Inter_ref_08_06 or Inter_ref_09_06
183
                or Inter_ref_02_07 or Inter_ref_03_07 or Inter_ref_04_07 or Inter_ref_05_07
184
                or Inter_ref_06_07 or Inter_ref_07_07 or Inter_ref_08_07 or Inter_ref_09_07
185
                or Inter_ref_02_08 or Inter_ref_03_08 or Inter_ref_04_08 or Inter_ref_05_08
186
                or Inter_ref_06_08 or Inter_ref_07_08 or Inter_ref_08_08 or Inter_ref_09_08
187
                or Inter_ref_02_09 or Inter_ref_03_09 or Inter_ref_04_09 or Inter_ref_05_09
188
                or Inter_ref_06_09 or Inter_ref_07_09 or Inter_ref_08_09 or Inter_ref_09_09)
189
                if (IsInterLuma && pos_FracL == `pos_Int)
190
                        case ({Is_blk4x4_0,Is_blk4x4_1,Is_blk4x4_2,Is_blk4x4_3})
191
                                4'b1000:
192
                                case (blk4x4_inter_calculate_counter)
193
                                        4'd4:begin      Inter_pix_copy0 <= Inter_ref_02_02;     Inter_pix_copy1 <= Inter_ref_02_03;
194
                                                                Inter_pix_copy2 <= Inter_ref_02_04;     Inter_pix_copy3 <= Inter_ref_02_05;end
195
                                        4'd3:begin      Inter_pix_copy0 <= Inter_ref_03_02;     Inter_pix_copy1 <= Inter_ref_03_03;
196
                                                                Inter_pix_copy2 <= Inter_ref_03_04;     Inter_pix_copy3 <= Inter_ref_03_05;end
197
                                        4'd2:begin      Inter_pix_copy0 <= Inter_ref_04_02;     Inter_pix_copy1 <= Inter_ref_04_03;
198
                                                                Inter_pix_copy2 <= Inter_ref_04_04;     Inter_pix_copy3 <= Inter_ref_04_05;end
199
                                        4'd1:begin      Inter_pix_copy0 <= Inter_ref_05_02;     Inter_pix_copy1 <= Inter_ref_05_03;
200
                                                                Inter_pix_copy2 <= Inter_ref_05_04;     Inter_pix_copy3 <= Inter_ref_05_05;end
201
                                        default:begin   Inter_pix_copy0 <= 0;    Inter_pix_copy1 <= 0;
202
                                                                        Inter_pix_copy2 <= 0;    Inter_pix_copy3 <= 0;end
203
                                endcase
204
                                4'b0100:
205
                                case (blk4x4_inter_calculate_counter)
206
                                        4'd4:begin      Inter_pix_copy0 <= Inter_ref_06_02;     Inter_pix_copy1 <= Inter_ref_06_03;
207
                                                                Inter_pix_copy2 <= Inter_ref_06_04;     Inter_pix_copy3 <= Inter_ref_06_05;end
208
                                        4'd3:begin      Inter_pix_copy0 <= Inter_ref_07_02;     Inter_pix_copy1 <= Inter_ref_07_03;
209
                                                                Inter_pix_copy2 <= Inter_ref_07_04;     Inter_pix_copy3 <= Inter_ref_07_05;end
210
                                        4'd2:begin      Inter_pix_copy0 <= Inter_ref_08_02;     Inter_pix_copy1 <= Inter_ref_08_03;
211
                                                                Inter_pix_copy2 <= Inter_ref_08_04;     Inter_pix_copy3 <= Inter_ref_08_05;end
212
                                        4'd1:begin      Inter_pix_copy0 <= Inter_ref_09_02;     Inter_pix_copy1 <= Inter_ref_09_03;
213
                                                                Inter_pix_copy2 <= Inter_ref_09_04;     Inter_pix_copy3 <= Inter_ref_09_05;end
214
                                        default:begin   Inter_pix_copy0 <= 0;    Inter_pix_copy1 <= 0;
215
                                                                        Inter_pix_copy2 <= 0;    Inter_pix_copy3 <= 0;end
216
                                endcase
217
                                4'b0010:
218
                                case (blk4x4_inter_calculate_counter)
219
                                        4'd4:begin      Inter_pix_copy0 <= Inter_ref_02_06;     Inter_pix_copy1 <= Inter_ref_02_07;
220
                                                                Inter_pix_copy2 <= Inter_ref_02_08;     Inter_pix_copy3 <= Inter_ref_02_09;end
221
                                        4'd3:begin      Inter_pix_copy0 <= Inter_ref_03_06;     Inter_pix_copy1 <= Inter_ref_03_07;
222
                                                                Inter_pix_copy2 <= Inter_ref_03_08;     Inter_pix_copy3 <= Inter_ref_03_09;end
223
                                        4'd2:begin      Inter_pix_copy0 <= Inter_ref_04_06;     Inter_pix_copy1 <= Inter_ref_04_07;
224
                                                                Inter_pix_copy2 <= Inter_ref_04_08;     Inter_pix_copy3 <= Inter_ref_04_09;end
225
                                        4'd1:begin      Inter_pix_copy0 <= Inter_ref_05_06;     Inter_pix_copy1 <= Inter_ref_05_07;
226
                                                                Inter_pix_copy2 <= Inter_ref_05_08;     Inter_pix_copy3 <= Inter_ref_05_09;end
227
                                        default:begin   Inter_pix_copy0 <= 0;    Inter_pix_copy1 <= 0;
228
                                                                        Inter_pix_copy2 <= 0;    Inter_pix_copy3 <= 0;end
229
                                endcase
230
                                4'b0001:
231
                                case (blk4x4_inter_calculate_counter)
232
                                        4'd4:begin      Inter_pix_copy0 <= Inter_ref_06_06;     Inter_pix_copy1 <= Inter_ref_06_07;
233
                                                                Inter_pix_copy2 <= Inter_ref_06_08;     Inter_pix_copy3 <= Inter_ref_06_09;end
234
                                        4'd3:begin      Inter_pix_copy0 <= Inter_ref_07_06;     Inter_pix_copy1 <= Inter_ref_07_07;
235
                                                                Inter_pix_copy2 <= Inter_ref_07_08;     Inter_pix_copy3 <= Inter_ref_07_09;end
236
                                        4'd2:begin      Inter_pix_copy0 <= Inter_ref_08_06;     Inter_pix_copy1 <= Inter_ref_08_07;
237
                                                                Inter_pix_copy2 <= Inter_ref_08_08;     Inter_pix_copy3 <= Inter_ref_08_09;end
238
                                        4'd1:begin      Inter_pix_copy0 <= Inter_ref_09_06;     Inter_pix_copy1 <= Inter_ref_09_07;
239
                                                                Inter_pix_copy2 <= Inter_ref_09_08;     Inter_pix_copy3 <= Inter_ref_09_09;end
240
                                        default:begin   Inter_pix_copy0 <= 0;    Inter_pix_copy1 <= 0;
241
                                                                        Inter_pix_copy2 <= 0;    Inter_pix_copy3 <= 0;end
242
                                endcase
243
                                default:begin   Inter_pix_copy0 <= 0;    Inter_pix_copy1 <= 0;
244
                                                                Inter_pix_copy2 <= 0;    Inter_pix_copy3 <= 0;end
245
                        endcase
246
                else if (Is_InterChromaCopy)
247
                        case (mv_below8x8_curr)
248
                                1'b1://only one cycle
249
                                begin
250
                                        Inter_pix_copy0 <= (blk4x4_inter_calculate_counter != 0)? Inter_ref_00_00:0;
251
                                        Inter_pix_copy1 <= (blk4x4_inter_calculate_counter != 0)? Inter_ref_01_00:0;
252
                                        Inter_pix_copy2 <= (blk4x4_inter_calculate_counter != 0)? Inter_ref_00_01:0;
253
                                        Inter_pix_copy3 <= (blk4x4_inter_calculate_counter != 0)? Inter_ref_01_01:0;
254
                                end
255
                                1'b0://4 cycles,each cycle for one blk2x2 in blk2x2-zig-zag order
256
                                        case (blk4x4_inter_calculate_counter)
257
                                                4'd4:
258
                                                begin
259
                                                        Inter_pix_copy0 <= Inter_ref_00_00;     Inter_pix_copy1 <= Inter_ref_01_00;
260
                                                        Inter_pix_copy2 <= Inter_ref_00_01; Inter_pix_copy3 <= Inter_ref_01_01;
261
                                                end
262
                                                4'd3:
263
                                                begin
264
                                                        Inter_pix_copy0 <= Inter_ref_02_00; Inter_pix_copy1 <= Inter_ref_03_00;
265
                                                        Inter_pix_copy2 <= Inter_ref_02_01; Inter_pix_copy3 <= Inter_ref_03_01;
266
                                                end
267
                                                4'd2:
268
                                                begin
269
                                                        Inter_pix_copy0 <= Inter_ref_00_02; Inter_pix_copy1 <= Inter_ref_01_02;
270
                                                        Inter_pix_copy2 <= Inter_ref_00_03; Inter_pix_copy3 <= Inter_ref_01_03;
271
                                                end
272
                                                4'd1:
273
                                                begin
274
                                                        Inter_pix_copy0 <= Inter_ref_02_02; Inter_pix_copy1 <= Inter_ref_03_02;
275
                                                        Inter_pix_copy2 <= Inter_ref_02_03; Inter_pix_copy3 <= Inter_ref_03_03;
276
                                                end
277
                                                default:
278
                                                begin
279
                                                        Inter_pix_copy0 <= 0; Inter_pix_copy1 <= 0;       Inter_pix_copy2 <= 0;    Inter_pix_copy3 <= 0;
280
                                                end
281
                                        endcase
282
                        endcase
283
                else
284
                        begin
285
                                Inter_pix_copy0 <= 0; Inter_pix_copy1 <= 0; Inter_pix_copy2 <= 0; Inter_pix_copy3 <= 0;
286
                        end
287
 
288
        //Horizontal sliding windows:Inter_H_window_0_0 ~ Inter_H_window_5_8 (6x9 windows)
289
        //                                                       Inter_H_window_x_0,Inter_H_window_x_1,Inter_H_window_x_6,Inter_H_window_x_7,Inter_H_window_x_8
290
        //                                                       are only used for pos_j/pos_i/pos_k/pos_f/pos_q
291
        //Vertical   sliding window:Inter_V_window_0 ~ Inter_V_window_8
292
        //Chroma     sliding window:Inter_C_window_0 ~ Inter_C_window_3
293
 
294
        //By careful study,we find that pos_b calculate cycle4 needs the same window as pos_a calculate cycl5.
295
        //Similar cases happens with pos_b and pos_a/pos_c,pos_h and pos_d/pos_n, pos_j and pos_f/pos_q/pos_i/pos_k......
296
 
297
        //Inter_H_window_counter0:for Inter_H_window_x_0/1/6/7/8 sliding window control
298
        reg [2:0] Inter_H_window_counter0;
299
        always @ (pos_FracL or blk4x4_inter_calculate_counter)
300
                if  ((pos_FracL == `pos_j && blk4x4_inter_calculate_counter == 4'd5)                                            ||
301
                        ((pos_FracL == `pos_f || pos_FracL == `pos_q) && blk4x4_inter_calculate_counter == 4'd5)        ||
302
                        ((pos_FracL == `pos_i || pos_FracL == `pos_k) && blk4x4_inter_calculate_counter == 4'd8))
303
                        Inter_H_window_counter0 <= 3'd4;
304
                else if ((pos_FracL == `pos_j && blk4x4_inter_calculate_counter == 4'd4)                                                ||
305
                                ((pos_FracL == `pos_f || pos_FracL == `pos_q) && blk4x4_inter_calculate_counter == 4'd4)        ||
306
                                ((pos_FracL == `pos_i || pos_FracL == `pos_k) && blk4x4_inter_calculate_counter == 4'd6))
307
                        Inter_H_window_counter0 <= 3'd3;
308
                else if ((pos_FracL == `pos_j && blk4x4_inter_calculate_counter == 4'd3)                                                ||
309
                                ((pos_FracL == `pos_f || pos_FracL == `pos_q) && blk4x4_inter_calculate_counter == 4'd3)        ||
310
                                ((pos_FracL == `pos_i || pos_FracL == `pos_k) && blk4x4_inter_calculate_counter == 4'd4))
311
                        Inter_H_window_counter0 <= 3'd2;
312
                else if ((pos_FracL == `pos_j && blk4x4_inter_calculate_counter == 4'd2)                                                ||
313
                                ((pos_FracL == `pos_f || pos_FracL == `pos_q) && blk4x4_inter_calculate_counter == 4'd2)        ||
314
                                ((pos_FracL == `pos_i || pos_FracL == `pos_k) && blk4x4_inter_calculate_counter == 4'd2))
315
                        Inter_H_window_counter0 <= 3'd1;
316
                else
317
                        Inter_H_window_counter0 <= 0;
318
 
319
 
320
        //Inter_H_window_x_0,Inter_H_window_x_1
321
        //Inter_H_window_x_6,Inter_H_window_x_7,Inter_H_window_x_8
322
        //Active only for pos j,i/k/f/q
323
        always @ (Is_blk4x4_0 or Is_blk4x4_1 or Is_blk4x4_2 or Is_blk4x4_3 or Inter_H_window_counter0
324
 
325
                or Inter_ref_00_00 or Inter_ref_01_00 or Inter_ref_02_00 or Inter_ref_03_00
326
                or Inter_ref_04_00 or Inter_ref_05_00 or Inter_ref_06_00 or Inter_ref_07_00
327
                or Inter_ref_08_00 or Inter_ref_09_00 or Inter_ref_10_00 or Inter_ref_11_00 or Inter_ref_12_00
328
 
329
                or Inter_ref_00_01 or Inter_ref_01_01 or Inter_ref_02_01 or Inter_ref_03_01
330
                or Inter_ref_04_01 or Inter_ref_05_01 or Inter_ref_06_01 or Inter_ref_07_01
331
                or Inter_ref_08_01 or Inter_ref_09_01 or Inter_ref_10_01 or Inter_ref_11_01 or Inter_ref_12_01
332
 
333
                or Inter_ref_00_06 or Inter_ref_01_06 or Inter_ref_02_06 or Inter_ref_03_06
334
                or Inter_ref_04_06 or Inter_ref_05_06 or Inter_ref_06_06 or Inter_ref_07_06
335
                or Inter_ref_08_06 or Inter_ref_09_06 or Inter_ref_10_06 or Inter_ref_11_06 or Inter_ref_12_06
336
 
337
                or Inter_ref_00_07 or Inter_ref_01_07 or Inter_ref_02_07 or Inter_ref_03_07
338
                or Inter_ref_04_07 or Inter_ref_05_07 or Inter_ref_06_07 or Inter_ref_07_07
339
                or Inter_ref_08_07 or Inter_ref_09_07 or Inter_ref_10_07 or Inter_ref_11_07 or Inter_ref_12_07
340
 
341
                or Inter_ref_00_08 or Inter_ref_01_08 or Inter_ref_02_08 or Inter_ref_03_08
342
                or Inter_ref_04_08 or Inter_ref_05_08 or Inter_ref_06_08 or Inter_ref_07_08
343
                or Inter_ref_08_08 or Inter_ref_09_08 or Inter_ref_10_08 or Inter_ref_11_08 or Inter_ref_12_08
344
 
345
                or Inter_ref_00_04 or Inter_ref_01_04 or Inter_ref_02_04 or Inter_ref_03_04
346
                or Inter_ref_04_04 or Inter_ref_05_04 or Inter_ref_06_04 or Inter_ref_07_04
347
                or Inter_ref_08_04 or Inter_ref_09_04 or Inter_ref_10_04 or Inter_ref_11_04 or Inter_ref_12_04
348
 
349
                or Inter_ref_00_05 or Inter_ref_01_05 or Inter_ref_02_05 or Inter_ref_03_05
350
                or Inter_ref_04_05 or Inter_ref_05_05 or Inter_ref_06_05 or Inter_ref_07_05
351
                or Inter_ref_08_05 or Inter_ref_09_05 or Inter_ref_10_05 or Inter_ref_11_05 or Inter_ref_12_05
352
 
353
                or Inter_ref_00_10 or Inter_ref_01_10 or Inter_ref_02_10 or Inter_ref_03_10
354
                or Inter_ref_04_10 or Inter_ref_05_10 or Inter_ref_06_10 or Inter_ref_07_10
355
                or Inter_ref_08_10 or Inter_ref_09_10 or Inter_ref_10_10 or Inter_ref_11_10 or Inter_ref_12_10
356
 
357
                or Inter_ref_00_11 or Inter_ref_01_11 or Inter_ref_02_11 or Inter_ref_03_11
358
                or Inter_ref_04_11 or Inter_ref_05_11 or Inter_ref_06_11 or Inter_ref_07_11
359
                or Inter_ref_08_11 or Inter_ref_09_11 or Inter_ref_10_11 or Inter_ref_11_11 or Inter_ref_12_11
360
 
361
                or Inter_ref_00_12 or Inter_ref_01_12 or Inter_ref_02_12 or Inter_ref_03_12
362
                or Inter_ref_04_12 or Inter_ref_05_12 or Inter_ref_06_12 or Inter_ref_07_12
363
                or Inter_ref_08_12 or Inter_ref_09_12 or Inter_ref_10_12 or Inter_ref_11_12 or Inter_ref_12_12
364
                )
365
                case ({Is_blk4x4_0,Is_blk4x4_1,Is_blk4x4_2,Is_blk4x4_3})
366
                        4'b1000: //Left top blk4x4
367
                        case (Inter_H_window_counter0)
368
                                3'd4:
369
                                begin
370
                                        Inter_H_window_0_0 <= Inter_ref_00_00;Inter_H_window_1_0 <= Inter_ref_01_00;
371
                                        Inter_H_window_2_0 <= Inter_ref_02_00;Inter_H_window_3_0 <= Inter_ref_03_00;
372
                                        Inter_H_window_4_0 <= Inter_ref_04_00;Inter_H_window_5_0 <= Inter_ref_05_00;
373
 
374
                                        Inter_H_window_0_1 <= Inter_ref_00_01;Inter_H_window_1_1 <= Inter_ref_01_01;
375
                                        Inter_H_window_2_1 <= Inter_ref_02_01;Inter_H_window_3_1 <= Inter_ref_03_01;
376
                                        Inter_H_window_4_1 <= Inter_ref_04_01;Inter_H_window_5_1 <= Inter_ref_05_01;
377
 
378
                                        Inter_H_window_0_6 <= Inter_ref_00_06;Inter_H_window_1_6 <= Inter_ref_01_06;
379
                                        Inter_H_window_2_6 <= Inter_ref_02_06;Inter_H_window_3_6 <= Inter_ref_03_06;
380
                                        Inter_H_window_4_6 <= Inter_ref_04_06;Inter_H_window_5_6 <= Inter_ref_05_06;
381
 
382
                                        Inter_H_window_0_7 <= Inter_ref_00_07;Inter_H_window_1_7 <= Inter_ref_01_07;
383
                                        Inter_H_window_2_7 <= Inter_ref_02_07;Inter_H_window_3_7 <= Inter_ref_03_07;
384
                                        Inter_H_window_4_7 <= Inter_ref_04_07;Inter_H_window_5_7 <= Inter_ref_05_07;
385
 
386
                                        Inter_H_window_0_8 <= Inter_ref_00_08;Inter_H_window_1_8 <= Inter_ref_01_08;
387
                                        Inter_H_window_2_8 <= Inter_ref_02_08;Inter_H_window_3_8 <= Inter_ref_03_08;
388
                                        Inter_H_window_4_8 <= Inter_ref_04_08;Inter_H_window_5_8 <= Inter_ref_05_08;
389
                                end
390
                                3'd3:
391
                                begin
392
                                        Inter_H_window_0_0 <= Inter_ref_01_00;Inter_H_window_1_0 <= Inter_ref_02_00;
393
                                        Inter_H_window_2_0 <= Inter_ref_03_00;Inter_H_window_3_0 <= Inter_ref_04_00;
394
                                        Inter_H_window_4_0 <= Inter_ref_05_00;Inter_H_window_5_0 <= Inter_ref_06_00;
395
 
396
                                        Inter_H_window_0_1 <= Inter_ref_01_01;Inter_H_window_1_1 <= Inter_ref_02_01;
397
                                        Inter_H_window_2_1 <= Inter_ref_03_01;Inter_H_window_3_1 <= Inter_ref_04_01;
398
                                        Inter_H_window_4_1 <= Inter_ref_05_01;Inter_H_window_5_1 <= Inter_ref_06_01;
399
 
400
                                        Inter_H_window_0_6 <= Inter_ref_01_06;Inter_H_window_1_6 <= Inter_ref_02_06;
401
                                        Inter_H_window_2_6 <= Inter_ref_03_06;Inter_H_window_3_6 <= Inter_ref_04_06;
402
                                        Inter_H_window_4_6 <= Inter_ref_05_06;Inter_H_window_5_6 <= Inter_ref_06_06;
403
 
404
                                        Inter_H_window_0_7 <= Inter_ref_01_07;Inter_H_window_1_7 <= Inter_ref_02_07;
405
                                        Inter_H_window_2_7 <= Inter_ref_03_07;Inter_H_window_3_7 <= Inter_ref_04_07;
406
                                        Inter_H_window_4_7 <= Inter_ref_05_07;Inter_H_window_5_7 <= Inter_ref_06_07;
407
 
408
                                        Inter_H_window_0_8 <= Inter_ref_01_08;Inter_H_window_1_8 <= Inter_ref_02_08;
409
                                        Inter_H_window_2_8 <= Inter_ref_03_08;Inter_H_window_3_8 <= Inter_ref_04_08;
410
                                        Inter_H_window_4_8 <= Inter_ref_05_08;Inter_H_window_5_8 <= Inter_ref_06_08;
411
                                end
412
                                3'd2:
413
                                begin
414
                                        Inter_H_window_0_0 <= Inter_ref_02_00;Inter_H_window_1_0 <= Inter_ref_03_00;
415
                                        Inter_H_window_2_0 <= Inter_ref_04_00;Inter_H_window_3_0 <= Inter_ref_05_00;
416
                                        Inter_H_window_4_0 <= Inter_ref_06_00;Inter_H_window_5_0 <= Inter_ref_07_00;
417
 
418
                                        Inter_H_window_0_1 <= Inter_ref_02_01;Inter_H_window_1_1 <= Inter_ref_03_01;
419
                                        Inter_H_window_2_1 <= Inter_ref_04_01;Inter_H_window_3_1 <= Inter_ref_05_01;
420
                                        Inter_H_window_4_1 <= Inter_ref_06_01;Inter_H_window_5_1 <= Inter_ref_07_01;
421
 
422
                                        Inter_H_window_0_6 <= Inter_ref_02_06;Inter_H_window_1_6 <= Inter_ref_03_06;
423
                                        Inter_H_window_2_6 <= Inter_ref_04_06;Inter_H_window_3_6 <= Inter_ref_05_06;
424
                                        Inter_H_window_4_6 <= Inter_ref_06_06;Inter_H_window_5_6 <= Inter_ref_07_06;
425
 
426
                                        Inter_H_window_0_7 <= Inter_ref_02_07;Inter_H_window_1_7 <= Inter_ref_03_07;
427
                                        Inter_H_window_2_7 <= Inter_ref_04_07;Inter_H_window_3_7 <= Inter_ref_05_07;
428
                                        Inter_H_window_4_7 <= Inter_ref_06_07;Inter_H_window_5_7 <= Inter_ref_07_07;
429
 
430
                                        Inter_H_window_0_8 <= Inter_ref_02_08;Inter_H_window_1_8 <= Inter_ref_03_08;
431
                                        Inter_H_window_2_8 <= Inter_ref_04_08;Inter_H_window_3_8 <= Inter_ref_05_08;
432
                                        Inter_H_window_4_8 <= Inter_ref_06_08;Inter_H_window_5_8 <= Inter_ref_07_08;
433
                                end
434
                                3'd1:
435
                                begin
436
                                        Inter_H_window_0_0 <= Inter_ref_03_00;Inter_H_window_1_0 <= Inter_ref_04_00;
437
                                        Inter_H_window_2_0 <= Inter_ref_05_00;Inter_H_window_3_0 <= Inter_ref_06_00;
438
                                        Inter_H_window_4_0 <= Inter_ref_07_00;Inter_H_window_5_0 <= Inter_ref_08_00;
439
 
440
                                        Inter_H_window_0_1 <= Inter_ref_03_01;Inter_H_window_1_1 <= Inter_ref_04_01;
441
                                        Inter_H_window_2_1 <= Inter_ref_05_01;Inter_H_window_3_1 <= Inter_ref_06_01;
442
                                        Inter_H_window_4_1 <= Inter_ref_07_01;Inter_H_window_5_1 <= Inter_ref_08_01;
443
 
444
                                        Inter_H_window_0_6 <= Inter_ref_03_06;Inter_H_window_1_6 <= Inter_ref_04_06;
445
                                        Inter_H_window_2_6 <= Inter_ref_05_06;Inter_H_window_3_6 <= Inter_ref_06_06;
446
                                        Inter_H_window_4_6 <= Inter_ref_07_06;Inter_H_window_5_6 <= Inter_ref_08_06;
447
 
448
                                        Inter_H_window_0_7 <= Inter_ref_03_07;Inter_H_window_1_7 <= Inter_ref_04_07;
449
                                        Inter_H_window_2_7 <= Inter_ref_05_07;Inter_H_window_3_7 <= Inter_ref_06_07;
450
                                        Inter_H_window_4_7 <= Inter_ref_07_07;Inter_H_window_5_7 <= Inter_ref_08_07;
451
 
452
                                        Inter_H_window_0_8 <= Inter_ref_03_08;Inter_H_window_1_8 <= Inter_ref_04_08;
453
                                        Inter_H_window_2_8 <= Inter_ref_05_08;Inter_H_window_3_8 <= Inter_ref_06_08;
454
                                        Inter_H_window_4_8 <= Inter_ref_07_08;Inter_H_window_5_8 <= Inter_ref_08_08;
455
                                end
456
                                default:
457
                                begin
458
                                        Inter_H_window_0_0 <= 0;Inter_H_window_1_0 <= 0;Inter_H_window_2_0 <= 0;
459
                                        Inter_H_window_3_0 <= 0;Inter_H_window_4_0 <= 0;Inter_H_window_5_0 <= 0;
460
 
461
                                        Inter_H_window_0_1 <= 0;Inter_H_window_1_1 <= 0;Inter_H_window_2_1 <= 0;
462
                                        Inter_H_window_3_1 <= 0;Inter_H_window_4_1 <= 0;Inter_H_window_5_1 <= 0;
463
 
464
                                        Inter_H_window_0_6 <= 0;Inter_H_window_1_6 <= 0;Inter_H_window_2_6 <= 0;
465
                                        Inter_H_window_3_6 <= 0;Inter_H_window_4_6 <= 0;Inter_H_window_5_6 <= 0;
466
 
467
                                        Inter_H_window_0_7 <= 0;Inter_H_window_1_7 <= 0;Inter_H_window_2_7 <= 0;
468
                                        Inter_H_window_3_7 <= 0;Inter_H_window_4_7 <= 0;Inter_H_window_5_7 <= 0;
469
 
470
                                        Inter_H_window_0_8 <= 0;Inter_H_window_1_8 <= 0;Inter_H_window_2_8 <= 0;
471
                                        Inter_H_window_3_8 <= 0;Inter_H_window_4_8 <= 0;Inter_H_window_5_8 <= 0;
472
                                end
473
                        endcase
474
                        4'b0100: //Right top blk8x8
475
                        case (Inter_H_window_counter0)
476
                                3'd4:
477
                                begin
478
                                        Inter_H_window_0_0 <= Inter_ref_04_00;Inter_H_window_1_0 <= Inter_ref_05_00;
479
                                        Inter_H_window_2_0 <= Inter_ref_06_00;Inter_H_window_3_0 <= Inter_ref_07_00;
480
                                        Inter_H_window_4_0 <= Inter_ref_08_00;Inter_H_window_5_0 <= Inter_ref_09_00;
481
 
482
                                        Inter_H_window_0_1 <= Inter_ref_04_01;Inter_H_window_1_1 <= Inter_ref_05_01;
483
                                        Inter_H_window_2_1 <= Inter_ref_06_01;Inter_H_window_3_1 <= Inter_ref_07_01;
484
                                        Inter_H_window_4_1 <= Inter_ref_08_01;Inter_H_window_5_1 <= Inter_ref_09_01;
485
 
486
                                        Inter_H_window_0_6 <= Inter_ref_04_06;Inter_H_window_1_6 <= Inter_ref_05_06;
487
                                        Inter_H_window_2_6 <= Inter_ref_06_06;Inter_H_window_3_6 <= Inter_ref_07_06;
488
                                        Inter_H_window_4_6 <= Inter_ref_08_06;Inter_H_window_5_6 <= Inter_ref_09_06;
489
 
490
                                        Inter_H_window_0_7 <= Inter_ref_04_07;Inter_H_window_1_7 <= Inter_ref_05_07;
491
                                        Inter_H_window_2_7 <= Inter_ref_06_07;Inter_H_window_3_7 <= Inter_ref_07_07;
492
                                        Inter_H_window_4_7 <= Inter_ref_08_07;Inter_H_window_5_7 <= Inter_ref_09_07;
493
 
494
                                        Inter_H_window_0_8 <= Inter_ref_04_08;Inter_H_window_1_8 <= Inter_ref_05_08;
495
                                        Inter_H_window_2_8 <= Inter_ref_06_08;Inter_H_window_3_8 <= Inter_ref_07_08;
496
                                        Inter_H_window_4_8 <= Inter_ref_08_08;Inter_H_window_5_8 <= Inter_ref_09_08;
497
                                end
498
                                3'd3:
499
                                begin
500
                                        Inter_H_window_0_0 <= Inter_ref_05_00;Inter_H_window_1_0 <= Inter_ref_06_00;
501
                                        Inter_H_window_2_0 <= Inter_ref_07_00;Inter_H_window_3_0 <= Inter_ref_08_00;
502
                                        Inter_H_window_4_0 <= Inter_ref_09_00;Inter_H_window_5_0 <= Inter_ref_10_00;
503
 
504
                                        Inter_H_window_0_1 <= Inter_ref_05_01;Inter_H_window_1_1 <= Inter_ref_06_01;
505
                                        Inter_H_window_2_1 <= Inter_ref_07_01;Inter_H_window_3_1 <= Inter_ref_08_01;
506
                                        Inter_H_window_4_1 <= Inter_ref_09_01;Inter_H_window_5_1 <= Inter_ref_10_01;
507
 
508
                                        Inter_H_window_0_6 <= Inter_ref_05_06;Inter_H_window_1_6 <= Inter_ref_06_06;
509
                                        Inter_H_window_2_6 <= Inter_ref_07_06;Inter_H_window_3_6 <= Inter_ref_08_06;
510
                                        Inter_H_window_4_6 <= Inter_ref_09_06;Inter_H_window_5_6 <= Inter_ref_10_06;
511
 
512
                                        Inter_H_window_0_7 <= Inter_ref_05_07;Inter_H_window_1_7 <= Inter_ref_06_07;
513
                                        Inter_H_window_2_7 <= Inter_ref_07_07;Inter_H_window_3_7 <= Inter_ref_08_07;
514
                                        Inter_H_window_4_7 <= Inter_ref_09_07;Inter_H_window_5_7 <= Inter_ref_10_07;
515
 
516
                                        Inter_H_window_0_8 <= Inter_ref_05_08;Inter_H_window_1_8 <= Inter_ref_06_08;
517
                                        Inter_H_window_2_8 <= Inter_ref_07_08;Inter_H_window_3_8 <= Inter_ref_08_08;
518
                                        Inter_H_window_4_8 <= Inter_ref_09_08;Inter_H_window_5_8 <= Inter_ref_10_08;
519
                                end
520
                                3'd2:
521
                                begin
522
                                        Inter_H_window_0_0 <= Inter_ref_06_00;Inter_H_window_1_0 <= Inter_ref_07_00;
523
                                        Inter_H_window_2_0 <= Inter_ref_08_00;Inter_H_window_3_0 <= Inter_ref_09_00;
524
                                        Inter_H_window_4_0 <= Inter_ref_10_00;Inter_H_window_5_0 <= Inter_ref_11_00;
525
 
526
                                        Inter_H_window_0_1 <= Inter_ref_06_01;Inter_H_window_1_1 <= Inter_ref_07_01;
527
                                        Inter_H_window_2_1 <= Inter_ref_08_01;Inter_H_window_3_1 <= Inter_ref_09_01;
528
                                        Inter_H_window_4_1 <= Inter_ref_10_01;Inter_H_window_5_1 <= Inter_ref_11_01;
529
 
530
                                        Inter_H_window_0_6 <= Inter_ref_06_06;Inter_H_window_1_6 <= Inter_ref_07_06;
531
                                        Inter_H_window_2_6 <= Inter_ref_08_06;Inter_H_window_3_6 <= Inter_ref_09_06;
532
                                        Inter_H_window_4_6 <= Inter_ref_10_06;Inter_H_window_5_6 <= Inter_ref_11_06;
533
 
534
                                        Inter_H_window_0_7 <= Inter_ref_06_07;Inter_H_window_1_7 <= Inter_ref_07_07;
535
                                        Inter_H_window_2_7 <= Inter_ref_08_07;Inter_H_window_3_7 <= Inter_ref_09_07;
536
                                        Inter_H_window_4_7 <= Inter_ref_10_07;Inter_H_window_5_7 <= Inter_ref_11_07;
537
 
538
                                        Inter_H_window_0_8 <= Inter_ref_06_08;Inter_H_window_1_8 <= Inter_ref_07_08;
539
                                        Inter_H_window_2_8 <= Inter_ref_08_08;Inter_H_window_3_8 <= Inter_ref_09_08;
540
                                        Inter_H_window_4_8 <= Inter_ref_10_08;Inter_H_window_5_8 <= Inter_ref_11_08;
541
                                end
542
                                3'd1:
543
                                begin
544
                                        Inter_H_window_0_0 <= Inter_ref_07_00;Inter_H_window_1_0 <= Inter_ref_08_00;
545
                                        Inter_H_window_2_0 <= Inter_ref_09_00;Inter_H_window_3_0 <= Inter_ref_10_00;
546
                                        Inter_H_window_4_0 <= Inter_ref_11_00;Inter_H_window_5_0 <= Inter_ref_12_00;
547
 
548
                                        Inter_H_window_0_1 <= Inter_ref_07_01;Inter_H_window_1_1 <= Inter_ref_08_01;
549
                                        Inter_H_window_2_1 <= Inter_ref_09_01;Inter_H_window_3_1 <= Inter_ref_10_01;
550
                                        Inter_H_window_4_1 <= Inter_ref_11_01;Inter_H_window_5_1 <= Inter_ref_12_01;
551
 
552
                                        Inter_H_window_0_6 <= Inter_ref_07_06;Inter_H_window_1_6 <= Inter_ref_08_06;
553
                                        Inter_H_window_2_6 <= Inter_ref_09_06;Inter_H_window_3_6 <= Inter_ref_10_06;
554
                                        Inter_H_window_4_6 <= Inter_ref_11_06;Inter_H_window_5_6 <= Inter_ref_12_06;
555
 
556
                                        Inter_H_window_0_7 <= Inter_ref_07_07;Inter_H_window_1_7 <= Inter_ref_08_07;
557
                                        Inter_H_window_2_7 <= Inter_ref_09_07;Inter_H_window_3_7 <= Inter_ref_10_07;
558
                                        Inter_H_window_4_7 <= Inter_ref_11_07;Inter_H_window_5_7 <= Inter_ref_12_07;
559
 
560
                                        Inter_H_window_0_8 <= Inter_ref_07_08;Inter_H_window_1_8 <= Inter_ref_08_08;
561
                                        Inter_H_window_2_8 <= Inter_ref_09_08;Inter_H_window_3_8 <= Inter_ref_10_08;
562
                                        Inter_H_window_4_8 <= Inter_ref_11_08;Inter_H_window_5_8 <= Inter_ref_12_08;
563
                                end
564
                                default:
565
                                begin
566
                                        Inter_H_window_0_0 <= 0;Inter_H_window_1_0 <= 0;Inter_H_window_2_0 <= 0;
567
                                        Inter_H_window_3_0 <= 0;Inter_H_window_4_0 <= 0;Inter_H_window_5_0 <= 0;
568
 
569
                                        Inter_H_window_0_1 <= 0;Inter_H_window_1_1 <= 0;Inter_H_window_2_1 <= 0;
570
                                        Inter_H_window_3_1 <= 0;Inter_H_window_4_1 <= 0;Inter_H_window_5_1 <= 0;
571
 
572
                                        Inter_H_window_0_6 <= 0;Inter_H_window_1_6 <= 0;Inter_H_window_2_6 <= 0;
573
                                        Inter_H_window_3_6 <= 0;Inter_H_window_4_6 <= 0;Inter_H_window_5_6 <= 0;
574
 
575
                                        Inter_H_window_0_7 <= 0;Inter_H_window_1_7 <= 0;Inter_H_window_2_7 <= 0;
576
                                        Inter_H_window_3_7 <= 0;Inter_H_window_4_7 <= 0;Inter_H_window_5_7 <= 0;
577
 
578
                                        Inter_H_window_0_8 <= 0;Inter_H_window_1_8 <= 0;Inter_H_window_2_8 <= 0;
579
                                        Inter_H_window_3_8 <= 0;Inter_H_window_4_8 <= 0;Inter_H_window_5_8 <= 0;
580
                                end
581
                        endcase
582
                        4'b0010: //Left bottom blk4x4
583
                        case (Inter_H_window_counter0)
584
                                3'd4:
585
                                begin
586
                                        Inter_H_window_0_0 <= Inter_ref_00_04;Inter_H_window_1_0 <= Inter_ref_01_04;
587
                                        Inter_H_window_2_0 <= Inter_ref_02_04;Inter_H_window_3_0 <= Inter_ref_03_04;
588
                                        Inter_H_window_4_0 <= Inter_ref_04_04;Inter_H_window_5_0 <= Inter_ref_05_04;
589
 
590
                                        Inter_H_window_0_1 <= Inter_ref_00_05;Inter_H_window_1_1 <= Inter_ref_01_05;
591
                                        Inter_H_window_2_1 <= Inter_ref_02_05;Inter_H_window_3_1 <= Inter_ref_03_05;
592
                                        Inter_H_window_4_1 <= Inter_ref_04_05;Inter_H_window_5_1 <= Inter_ref_05_05;
593
 
594
                                        Inter_H_window_0_6 <= Inter_ref_00_10;Inter_H_window_1_6 <= Inter_ref_01_10;
595
                                        Inter_H_window_2_6 <= Inter_ref_02_10;Inter_H_window_3_6 <= Inter_ref_03_10;
596
                                        Inter_H_window_4_6 <= Inter_ref_04_10;Inter_H_window_5_6 <= Inter_ref_05_10;
597
 
598
                                        Inter_H_window_0_7 <= Inter_ref_00_11;Inter_H_window_1_7 <= Inter_ref_01_11;
599
                                        Inter_H_window_2_7 <= Inter_ref_02_11;Inter_H_window_3_7 <= Inter_ref_03_11;
600
                                        Inter_H_window_4_7 <= Inter_ref_04_11;Inter_H_window_5_7 <= Inter_ref_05_11;
601
 
602
                                        Inter_H_window_0_8 <= Inter_ref_00_12;Inter_H_window_1_8 <= Inter_ref_01_12;
603
                                        Inter_H_window_2_8 <= Inter_ref_02_12;Inter_H_window_3_8 <= Inter_ref_03_12;
604
                                        Inter_H_window_4_8 <= Inter_ref_04_12;Inter_H_window_5_8 <= Inter_ref_05_12;
605
                                end
606
                                3'd3:
607
                                begin
608
                                        Inter_H_window_0_0 <= Inter_ref_01_04;Inter_H_window_1_0 <= Inter_ref_02_04;
609
                                        Inter_H_window_2_0 <= Inter_ref_03_04;Inter_H_window_3_0 <= Inter_ref_04_04;
610
                                        Inter_H_window_4_0 <= Inter_ref_05_04;Inter_H_window_5_0 <= Inter_ref_06_04;
611
 
612
                                        Inter_H_window_0_1 <= Inter_ref_01_05;Inter_H_window_1_1 <= Inter_ref_02_05;
613
                                        Inter_H_window_2_1 <= Inter_ref_03_05;Inter_H_window_3_1 <= Inter_ref_04_05;
614
                                        Inter_H_window_4_1 <= Inter_ref_05_05;Inter_H_window_5_1 <= Inter_ref_06_05;
615
 
616
                                        Inter_H_window_0_6 <= Inter_ref_01_10;Inter_H_window_1_6 <= Inter_ref_02_10;
617
                                        Inter_H_window_2_6 <= Inter_ref_03_10;Inter_H_window_3_6 <= Inter_ref_04_10;
618
                                        Inter_H_window_4_6 <= Inter_ref_05_10;Inter_H_window_5_6 <= Inter_ref_06_10;
619
 
620
                                        Inter_H_window_0_7 <= Inter_ref_01_11;Inter_H_window_1_7 <= Inter_ref_02_11;
621
                                        Inter_H_window_2_7 <= Inter_ref_03_11;Inter_H_window_3_7 <= Inter_ref_04_11;
622
                                        Inter_H_window_4_7 <= Inter_ref_05_11;Inter_H_window_5_7 <= Inter_ref_06_11;
623
 
624
                                        Inter_H_window_0_8 <= Inter_ref_01_12;Inter_H_window_1_8 <= Inter_ref_02_12;
625
                                        Inter_H_window_2_8 <= Inter_ref_03_12;Inter_H_window_3_8 <= Inter_ref_04_12;
626
                                        Inter_H_window_4_8 <= Inter_ref_05_12;Inter_H_window_5_8 <= Inter_ref_06_12;
627
                                end
628
                                3'd2:
629
                                begin
630
                                        Inter_H_window_0_0 <= Inter_ref_02_04;Inter_H_window_1_0 <= Inter_ref_03_04;
631
                                        Inter_H_window_2_0 <= Inter_ref_04_04;Inter_H_window_3_0 <= Inter_ref_05_04;
632
                                        Inter_H_window_4_0 <= Inter_ref_06_04;Inter_H_window_5_0 <= Inter_ref_07_04;
633
 
634
                                        Inter_H_window_0_1 <= Inter_ref_02_05;Inter_H_window_1_1 <= Inter_ref_03_05;
635
                                        Inter_H_window_2_1 <= Inter_ref_04_05;Inter_H_window_3_1 <= Inter_ref_05_05;
636
                                        Inter_H_window_4_1 <= Inter_ref_06_05;Inter_H_window_5_1 <= Inter_ref_07_05;
637
 
638
                                        Inter_H_window_0_6 <= Inter_ref_02_10;Inter_H_window_1_6 <= Inter_ref_03_10;
639
                                        Inter_H_window_2_6 <= Inter_ref_04_10;Inter_H_window_3_6 <= Inter_ref_05_10;
640
                                        Inter_H_window_4_6 <= Inter_ref_06_10;Inter_H_window_5_6 <= Inter_ref_07_10;
641
 
642
                                        Inter_H_window_0_7 <= Inter_ref_02_11;Inter_H_window_1_7 <= Inter_ref_03_11;
643
                                        Inter_H_window_2_7 <= Inter_ref_04_11;Inter_H_window_3_7 <= Inter_ref_05_11;
644
                                        Inter_H_window_4_7 <= Inter_ref_06_11;Inter_H_window_5_7 <= Inter_ref_07_11;
645
 
646
                                        Inter_H_window_0_8 <= Inter_ref_02_12;Inter_H_window_1_8 <= Inter_ref_03_12;
647
                                        Inter_H_window_2_8 <= Inter_ref_04_12;Inter_H_window_3_8 <= Inter_ref_05_12;
648
                                        Inter_H_window_4_8 <= Inter_ref_06_12;Inter_H_window_5_8 <= Inter_ref_07_12;
649
                                end
650
                                3'd1:
651
                                begin
652
                                        Inter_H_window_0_0 <= Inter_ref_03_04;Inter_H_window_1_0 <= Inter_ref_04_04;
653
                                        Inter_H_window_2_0 <= Inter_ref_05_04;Inter_H_window_3_0 <= Inter_ref_06_04;
654
                                        Inter_H_window_4_0 <= Inter_ref_07_04;Inter_H_window_5_0 <= Inter_ref_08_04;
655
 
656
                                        Inter_H_window_0_1 <= Inter_ref_03_05;Inter_H_window_1_1 <= Inter_ref_04_05;
657
                                        Inter_H_window_2_1 <= Inter_ref_05_05;Inter_H_window_3_1 <= Inter_ref_06_05;
658
                                        Inter_H_window_4_1 <= Inter_ref_07_05;Inter_H_window_5_1 <= Inter_ref_08_05;
659
 
660
                                        Inter_H_window_0_6 <= Inter_ref_03_10;Inter_H_window_1_6 <= Inter_ref_04_10;
661
                                        Inter_H_window_2_6 <= Inter_ref_05_10;Inter_H_window_3_6 <= Inter_ref_06_10;
662
                                        Inter_H_window_4_6 <= Inter_ref_07_10;Inter_H_window_5_6 <= Inter_ref_08_10;
663
 
664
                                        Inter_H_window_0_7 <= Inter_ref_03_11;Inter_H_window_1_7 <= Inter_ref_04_11;
665
                                        Inter_H_window_2_7 <= Inter_ref_05_11;Inter_H_window_3_7 <= Inter_ref_06_11;
666
                                        Inter_H_window_4_7 <= Inter_ref_07_11;Inter_H_window_5_7 <= Inter_ref_08_11;
667
 
668
                                        Inter_H_window_0_8 <= Inter_ref_03_12;Inter_H_window_1_8 <= Inter_ref_04_12;
669
                                        Inter_H_window_2_8 <= Inter_ref_05_12;Inter_H_window_3_8 <= Inter_ref_06_12;
670
                                        Inter_H_window_4_8 <= Inter_ref_07_12;Inter_H_window_5_8 <= Inter_ref_08_12;
671
                                end
672
                                default:
673
                                begin
674
                                        Inter_H_window_0_0 <= 0;Inter_H_window_1_0 <= 0;Inter_H_window_2_0 <= 0;
675
                                        Inter_H_window_3_0 <= 0;Inter_H_window_4_0 <= 0;Inter_H_window_5_0 <= 0;
676
 
677
                                        Inter_H_window_0_1 <= 0;Inter_H_window_1_1 <= 0;Inter_H_window_2_1 <= 0;
678
                                        Inter_H_window_3_1 <= 0;Inter_H_window_4_1 <= 0;Inter_H_window_5_1 <= 0;
679
 
680
                                        Inter_H_window_0_6 <= 0;Inter_H_window_1_6 <= 0;Inter_H_window_2_6 <= 0;
681
                                        Inter_H_window_3_6 <= 0;Inter_H_window_4_6 <= 0;Inter_H_window_5_6 <= 0;
682
 
683
                                        Inter_H_window_0_7 <= 0;Inter_H_window_1_7 <= 0;Inter_H_window_2_7 <= 0;
684
                                        Inter_H_window_3_7 <= 0;Inter_H_window_4_7 <= 0;Inter_H_window_5_7 <= 0;
685
 
686
                                        Inter_H_window_0_8 <= 0;Inter_H_window_1_8 <= 0;Inter_H_window_2_8 <= 0;
687
                                        Inter_H_window_3_8 <= 0;Inter_H_window_4_8 <= 0;Inter_H_window_5_8 <= 0;
688
                                end
689
                        endcase
690
                        4'b0001: //Right bottom blk4x4
691
                        case (Inter_H_window_counter0)
692
                                3'd4:
693
                                begin
694
                                        Inter_H_window_0_0 <= Inter_ref_04_04;Inter_H_window_1_0 <= Inter_ref_05_04;
695
                                        Inter_H_window_2_0 <= Inter_ref_06_04;Inter_H_window_3_0 <= Inter_ref_07_04;
696
                                        Inter_H_window_4_0 <= Inter_ref_08_04;Inter_H_window_5_0 <= Inter_ref_09_04;
697
 
698
                                        Inter_H_window_0_1 <= Inter_ref_04_05;Inter_H_window_1_1 <= Inter_ref_05_05;
699
                                        Inter_H_window_2_1 <= Inter_ref_06_05;Inter_H_window_3_1 <= Inter_ref_07_05;
700
                                        Inter_H_window_4_1 <= Inter_ref_08_05;Inter_H_window_5_1 <= Inter_ref_09_05;
701
 
702
                                        Inter_H_window_0_6 <= Inter_ref_04_10;Inter_H_window_1_6 <= Inter_ref_05_10;
703
                                        Inter_H_window_2_6 <= Inter_ref_06_10;Inter_H_window_3_6 <= Inter_ref_07_10;
704
                                        Inter_H_window_4_6 <= Inter_ref_08_10;Inter_H_window_5_6 <= Inter_ref_09_10;
705
 
706
                                        Inter_H_window_0_7 <= Inter_ref_04_11;Inter_H_window_1_7 <= Inter_ref_05_11;
707
                                        Inter_H_window_2_7 <= Inter_ref_06_11;Inter_H_window_3_7 <= Inter_ref_07_11;
708
                                        Inter_H_window_4_7 <= Inter_ref_08_11;Inter_H_window_5_7 <= Inter_ref_09_11;
709
 
710
                                        Inter_H_window_0_8 <= Inter_ref_04_12;Inter_H_window_1_8 <= Inter_ref_05_12;
711
                                        Inter_H_window_2_8 <= Inter_ref_06_12;Inter_H_window_3_8 <= Inter_ref_07_12;
712
                                        Inter_H_window_4_8 <= Inter_ref_08_12;Inter_H_window_5_8 <= Inter_ref_09_12;
713
                                end
714
                                3'd3:
715
                                begin
716
                                        Inter_H_window_0_0 <= Inter_ref_05_04;Inter_H_window_1_0 <= Inter_ref_06_04;
717
                                        Inter_H_window_2_0 <= Inter_ref_07_04;Inter_H_window_3_0 <= Inter_ref_08_04;
718
                                        Inter_H_window_4_0 <= Inter_ref_09_04;Inter_H_window_5_0 <= Inter_ref_10_04;
719
 
720
                                        Inter_H_window_0_1 <= Inter_ref_05_05;Inter_H_window_1_1 <= Inter_ref_06_05;
721
                                        Inter_H_window_2_1 <= Inter_ref_07_05;Inter_H_window_3_1 <= Inter_ref_08_05;
722
                                        Inter_H_window_4_1 <= Inter_ref_09_05;Inter_H_window_5_1 <= Inter_ref_10_05;
723
 
724
                                        Inter_H_window_0_6 <= Inter_ref_05_10;Inter_H_window_1_6 <= Inter_ref_06_10;
725
                                        Inter_H_window_2_6 <= Inter_ref_07_10;Inter_H_window_3_6 <= Inter_ref_08_10;
726
                                        Inter_H_window_4_6 <= Inter_ref_09_10;Inter_H_window_5_6 <= Inter_ref_10_10;
727
 
728
                                        Inter_H_window_0_7 <= Inter_ref_05_11;Inter_H_window_1_7 <= Inter_ref_06_11;
729
                                        Inter_H_window_2_7 <= Inter_ref_07_11;Inter_H_window_3_7 <= Inter_ref_08_11;
730
                                        Inter_H_window_4_7 <= Inter_ref_09_11;Inter_H_window_5_7 <= Inter_ref_10_11;
731
 
732
                                        Inter_H_window_0_8 <= Inter_ref_05_12;Inter_H_window_1_8 <= Inter_ref_06_12;
733
                                        Inter_H_window_2_8 <= Inter_ref_07_12;Inter_H_window_3_8 <= Inter_ref_08_12;
734
                                        Inter_H_window_4_8 <= Inter_ref_09_12;Inter_H_window_5_8 <= Inter_ref_10_12;
735
                                end
736
                                3'd2:
737
                                begin
738
                                        Inter_H_window_0_0 <= Inter_ref_06_04;Inter_H_window_1_0 <= Inter_ref_07_04;
739
                                        Inter_H_window_2_0 <= Inter_ref_08_04;Inter_H_window_3_0 <= Inter_ref_09_04;
740
                                        Inter_H_window_4_0 <= Inter_ref_10_04;Inter_H_window_5_0 <= Inter_ref_11_04;
741
 
742
                                        Inter_H_window_0_1 <= Inter_ref_06_05;Inter_H_window_1_1 <= Inter_ref_07_05;
743
                                        Inter_H_window_2_1 <= Inter_ref_08_05;Inter_H_window_3_1 <= Inter_ref_09_05;
744
                                        Inter_H_window_4_1 <= Inter_ref_10_05;Inter_H_window_5_1 <= Inter_ref_11_05;
745
 
746
                                        Inter_H_window_0_6 <= Inter_ref_06_10;Inter_H_window_1_6 <= Inter_ref_07_10;
747
                                        Inter_H_window_2_6 <= Inter_ref_08_10;Inter_H_window_3_6 <= Inter_ref_09_10;
748
                                        Inter_H_window_4_6 <= Inter_ref_10_10;Inter_H_window_5_6 <= Inter_ref_11_10;
749
 
750
                                        Inter_H_window_0_7 <= Inter_ref_06_11;Inter_H_window_1_7 <= Inter_ref_07_11;
751
                                        Inter_H_window_2_7 <= Inter_ref_08_11;Inter_H_window_3_7 <= Inter_ref_09_11;
752
                                        Inter_H_window_4_7 <= Inter_ref_10_11;Inter_H_window_5_7 <= Inter_ref_11_11;
753
 
754
                                        Inter_H_window_0_8 <= Inter_ref_06_12;Inter_H_window_1_8 <= Inter_ref_07_12;
755
                                        Inter_H_window_2_8 <= Inter_ref_08_12;Inter_H_window_3_8 <= Inter_ref_09_12;
756
                                        Inter_H_window_4_8 <= Inter_ref_10_12;Inter_H_window_5_8 <= Inter_ref_11_12;
757
                                end
758
                                3'd1:
759
                                begin
760
                                        Inter_H_window_0_0 <= Inter_ref_07_04;Inter_H_window_1_0 <= Inter_ref_08_04;
761
                                        Inter_H_window_2_0 <= Inter_ref_09_04;Inter_H_window_3_0 <= Inter_ref_10_04;
762
                                        Inter_H_window_4_0 <= Inter_ref_11_04;Inter_H_window_5_0 <= Inter_ref_12_04;
763
 
764
                                        Inter_H_window_0_1 <= Inter_ref_07_05;Inter_H_window_1_1 <= Inter_ref_08_05;
765
                                        Inter_H_window_2_1 <= Inter_ref_09_05;Inter_H_window_3_1 <= Inter_ref_10_05;
766
                                        Inter_H_window_4_1 <= Inter_ref_11_05;Inter_H_window_5_1 <= Inter_ref_12_05;
767
 
768
                                        Inter_H_window_0_6 <= Inter_ref_07_10;Inter_H_window_1_6 <= Inter_ref_08_10;
769
                                        Inter_H_window_2_6 <= Inter_ref_09_10;Inter_H_window_3_6 <= Inter_ref_10_10;
770
                                        Inter_H_window_4_6 <= Inter_ref_11_10;Inter_H_window_5_6 <= Inter_ref_12_10;
771
 
772
                                        Inter_H_window_0_7 <= Inter_ref_07_11;Inter_H_window_1_7 <= Inter_ref_08_11;
773
                                        Inter_H_window_2_7 <= Inter_ref_09_11;Inter_H_window_3_7 <= Inter_ref_10_11;
774
                                        Inter_H_window_4_7 <= Inter_ref_11_11;Inter_H_window_5_7 <= Inter_ref_12_11;
775
 
776
                                        Inter_H_window_0_8 <= Inter_ref_07_12;Inter_H_window_1_8 <= Inter_ref_08_12;
777
                                        Inter_H_window_2_8 <= Inter_ref_09_12;Inter_H_window_3_8 <= Inter_ref_10_12;
778
                                        Inter_H_window_4_8 <= Inter_ref_11_12;Inter_H_window_5_8 <= Inter_ref_12_12;
779
                                end
780
                                default:
781
                                begin
782
                                        Inter_H_window_0_0 <= 0;Inter_H_window_1_0 <= 0;Inter_H_window_2_0 <= 0;
783
                                        Inter_H_window_3_0 <= 0;Inter_H_window_4_0 <= 0;Inter_H_window_5_0 <= 0;
784
 
785
                                        Inter_H_window_0_1 <= 0;Inter_H_window_1_1 <= 0;Inter_H_window_2_1 <= 0;
786
                                        Inter_H_window_3_1 <= 0;Inter_H_window_4_1 <= 0;Inter_H_window_5_1 <= 0;
787
 
788
                                        Inter_H_window_0_6 <= 0;Inter_H_window_1_6 <= 0;Inter_H_window_2_6 <= 0;
789
                                        Inter_H_window_3_6 <= 0;Inter_H_window_4_6 <= 0;Inter_H_window_5_6 <= 0;
790
 
791
                                        Inter_H_window_0_7 <= 0;Inter_H_window_1_7 <= 0;Inter_H_window_2_7 <= 0;
792
                                        Inter_H_window_3_7 <= 0;Inter_H_window_4_7 <= 0;Inter_H_window_5_7 <= 0;
793
 
794
                                        Inter_H_window_0_8 <= 0;Inter_H_window_1_8 <= 0;Inter_H_window_2_8 <= 0;
795
                                        Inter_H_window_3_8 <= 0;Inter_H_window_4_8 <= 0;Inter_H_window_5_8 <= 0;
796
                                end
797
                        endcase
798
                        default:
799
                        begin
800
                                Inter_H_window_0_0 <= 0;Inter_H_window_1_0 <= 0;Inter_H_window_2_0 <= 0;
801
                                Inter_H_window_3_0 <= 0;Inter_H_window_4_0 <= 0;Inter_H_window_5_0 <= 0;
802
 
803
                                Inter_H_window_0_1 <= 0;Inter_H_window_1_1 <= 0;Inter_H_window_2_1 <= 0;
804
                                Inter_H_window_3_1 <= 0;Inter_H_window_4_1 <= 0;Inter_H_window_5_1 <= 0;
805
 
806
                                Inter_H_window_0_6 <= 0;Inter_H_window_1_6 <= 0;Inter_H_window_2_6 <= 0;
807
                                Inter_H_window_3_6 <= 0;Inter_H_window_4_6 <= 0;Inter_H_window_5_6 <= 0;
808
 
809
                                Inter_H_window_0_7 <= 0;Inter_H_window_1_7 <= 0;Inter_H_window_2_7 <= 0;
810
                                Inter_H_window_3_7 <= 0;Inter_H_window_4_7 <= 0;Inter_H_window_5_7 <= 0;
811
 
812
                                Inter_H_window_0_8 <= 0;Inter_H_window_1_8 <= 0;Inter_H_window_2_8 <= 0;
813
                                Inter_H_window_3_8 <= 0;Inter_H_window_4_8 <= 0;Inter_H_window_5_8 <= 0;
814
                        end
815
                endcase
816
 
817
        //Inter_H_window_counter1:for Inter_H_window_x_2/3/4/5 sliding window control
818
        reg [2:0] Inter_H_window_counter1;
819
        always @ (pos_FracL or blk4x4_inter_calculate_counter)
820
                if (((pos_FracL == `pos_b || pos_FracL == `pos_a || pos_FracL == `pos_c || pos_FracL == `pos_e || pos_FracL == `pos_g
821
                        || pos_FracL == `pos_p || pos_FracL == `pos_r) && blk4x4_inter_calculate_counter == 4'd4)                                        ||
822
                        ((pos_FracL == `pos_j || pos_FracL == `pos_f || pos_FracL == `pos_q) && blk4x4_inter_calculate_counter == 4'd5) ||
823
                        ((pos_FracL == `pos_i || pos_FracL == `pos_k) && blk4x4_inter_calculate_counter == 4'd8))
824
                        Inter_H_window_counter1 <= 3'd4;
825
                else if (((pos_FracL == `pos_b || pos_FracL == `pos_a || pos_FracL == `pos_c || pos_FracL == `pos_e || pos_FracL == `pos_g
826
                        || pos_FracL == `pos_p || pos_FracL == `pos_r) && blk4x4_inter_calculate_counter == 4'd3)                                        ||
827
                        ((pos_FracL == `pos_j || pos_FracL == `pos_f || pos_FracL == `pos_q) && blk4x4_inter_calculate_counter == 4'd4) ||
828
                        ((pos_FracL == `pos_i || pos_FracL == `pos_k) && blk4x4_inter_calculate_counter == 4'd6))
829
                        Inter_H_window_counter1 <= 3'd3;
830
                else if (((pos_FracL == `pos_b || pos_FracL == `pos_a || pos_FracL == `pos_c || pos_FracL == `pos_e || pos_FracL == `pos_g
831
                        || pos_FracL == `pos_p || pos_FracL == `pos_r) && blk4x4_inter_calculate_counter == 4'd2)                                        ||
832
                        ((pos_FracL == `pos_j || pos_FracL == `pos_f || pos_FracL == `pos_q) && blk4x4_inter_calculate_counter == 4'd3) ||
833
                        ((pos_FracL == `pos_i || pos_FracL == `pos_k) && blk4x4_inter_calculate_counter == 4'd4))
834
                        Inter_H_window_counter1 <= 3'd2;
835
                else if (((pos_FracL == `pos_b || pos_FracL == `pos_a || pos_FracL == `pos_c || pos_FracL == `pos_e || pos_FracL == `pos_g
836
                        || pos_FracL == `pos_p || pos_FracL == `pos_r) && blk4x4_inter_calculate_counter == 4'd1)                                        ||
837
                        ((pos_FracL == `pos_j || pos_FracL == `pos_f || pos_FracL == `pos_q) && blk4x4_inter_calculate_counter == 4'd2) ||
838
                        ((pos_FracL == `pos_i || pos_FracL == `pos_k) && blk4x4_inter_calculate_counter == 4'd2))
839
                        Inter_H_window_counter1 <= 3'd1;
840
                else
841
                        Inter_H_window_counter1 <= 0;
842
 
843
        //Inter_H_window_x_2,Inter_H_window_x_3,Inter_H_window_x_4,Inter_H_window_x_5
844
        always @ (Is_blk4x4_0 or Is_blk4x4_1 or Is_blk4x4_2 or Is_blk4x4_3 or pos_FracL or Inter_H_window_counter1
845
                or Inter_ref_00_02 or Inter_ref_01_02 or Inter_ref_02_02 or Inter_ref_03_02
846
                or Inter_ref_04_02 or Inter_ref_05_02 or Inter_ref_06_02 or Inter_ref_07_02
847
                or Inter_ref_08_02 or Inter_ref_09_02 or Inter_ref_10_02 or Inter_ref_11_02 or Inter_ref_12_02
848
 
849
                or Inter_ref_00_03 or Inter_ref_01_03 or Inter_ref_02_03 or Inter_ref_03_03
850
                or Inter_ref_04_03 or Inter_ref_05_03 or Inter_ref_06_03 or Inter_ref_07_03
851
                or Inter_ref_08_03 or Inter_ref_09_03 or Inter_ref_10_03 or Inter_ref_11_03 or Inter_ref_12_03
852
 
853
                or Inter_ref_00_04 or Inter_ref_01_04 or Inter_ref_02_04 or Inter_ref_03_04
854
                or Inter_ref_04_04 or Inter_ref_05_04 or Inter_ref_06_04 or Inter_ref_07_04
855
                or Inter_ref_08_04 or Inter_ref_09_04 or Inter_ref_10_04 or Inter_ref_11_04 or Inter_ref_12_04
856
 
857
                or Inter_ref_00_05 or Inter_ref_01_05 or Inter_ref_02_05 or Inter_ref_03_05
858
                or Inter_ref_04_05 or Inter_ref_05_05 or Inter_ref_06_05 or Inter_ref_07_05
859
                or Inter_ref_08_05 or Inter_ref_09_05 or Inter_ref_10_05 or Inter_ref_11_05 or Inter_ref_12_05
860
 
861
                or Inter_ref_00_06 or Inter_ref_01_06 or Inter_ref_02_06 or Inter_ref_03_06
862
                or Inter_ref_04_06 or Inter_ref_05_06 or Inter_ref_06_06 or Inter_ref_07_06
863
                or Inter_ref_08_06 or Inter_ref_09_06 or Inter_ref_10_06 or Inter_ref_11_06 or Inter_ref_12_06
864
 
865
                or Inter_ref_00_07 or Inter_ref_01_07 or Inter_ref_02_07 or Inter_ref_03_07
866
                or Inter_ref_04_07 or Inter_ref_05_07 or Inter_ref_06_07 or Inter_ref_07_07
867
                or Inter_ref_08_07 or Inter_ref_09_07 or Inter_ref_10_07 or Inter_ref_11_07 or Inter_ref_12_07
868
 
869
                or Inter_ref_00_08 or Inter_ref_01_08 or Inter_ref_02_08 or Inter_ref_03_08
870
                or Inter_ref_04_08 or Inter_ref_05_08 or Inter_ref_06_08 or Inter_ref_07_08
871
                or Inter_ref_08_08 or Inter_ref_09_08 or Inter_ref_10_08 or Inter_ref_11_08 or Inter_ref_12_08
872
 
873
                or Inter_ref_00_09 or Inter_ref_01_09 or Inter_ref_02_09 or Inter_ref_03_09
874
                or Inter_ref_04_09 or Inter_ref_05_09 or Inter_ref_06_09 or Inter_ref_07_09
875
                or Inter_ref_08_09 or Inter_ref_09_09 or Inter_ref_10_09 or Inter_ref_11_09 or Inter_ref_12_09
876
 
877
                or Inter_ref_00_10 or Inter_ref_01_10 or Inter_ref_02_10 or Inter_ref_03_10
878
                or Inter_ref_04_10 or Inter_ref_05_10 or Inter_ref_06_10 or Inter_ref_07_10
879
                or Inter_ref_08_10 or Inter_ref_09_10 or Inter_ref_10_10 or Inter_ref_11_10 or Inter_ref_12_10
880
                )
881
                case ({Is_blk4x4_0,Is_blk4x4_1,Is_blk4x4_2,Is_blk4x4_3})
882
                        4'b1000: //Left top blk4x4
883
                        case (Inter_H_window_counter1)
884
                                3'd4:
885
                                if (pos_FracL == `pos_p || pos_FracL == `pos_r)
886
                                        begin
887
                                                Inter_H_window_0_2 <= Inter_ref_00_03;Inter_H_window_1_2 <= Inter_ref_01_03;
888
                                                Inter_H_window_2_2 <= Inter_ref_02_03;Inter_H_window_3_2 <= Inter_ref_03_03;
889
                                                Inter_H_window_4_2 <= Inter_ref_04_03;Inter_H_window_5_2 <= Inter_ref_05_03;
890
 
891
                                                Inter_H_window_0_3 <= Inter_ref_00_04;Inter_H_window_1_3 <= Inter_ref_01_04;
892
                                                Inter_H_window_2_3 <= Inter_ref_02_04;Inter_H_window_3_3 <= Inter_ref_03_04;
893
                                                Inter_H_window_4_3 <= Inter_ref_04_04;Inter_H_window_5_3 <= Inter_ref_05_04;
894
 
895
                                                Inter_H_window_0_4 <= Inter_ref_00_05;Inter_H_window_1_4 <= Inter_ref_01_05;
896
                                                Inter_H_window_2_4 <= Inter_ref_02_05;Inter_H_window_3_4 <= Inter_ref_03_05;
897
                                                Inter_H_window_4_4 <= Inter_ref_04_05;Inter_H_window_5_4 <= Inter_ref_05_05;
898
 
899
                                                Inter_H_window_0_5 <= Inter_ref_00_06;Inter_H_window_1_5 <= Inter_ref_01_06;
900
                                                Inter_H_window_2_5 <= Inter_ref_02_06;Inter_H_window_3_5 <= Inter_ref_03_06;
901
                                                Inter_H_window_4_5 <= Inter_ref_04_06;Inter_H_window_5_5 <= Inter_ref_05_06;
902
                                        end
903
                                else
904
                                        begin
905
                                                Inter_H_window_0_2 <= Inter_ref_00_02;Inter_H_window_1_2 <= Inter_ref_01_02;
906
                                                Inter_H_window_2_2 <= Inter_ref_02_02;Inter_H_window_3_2 <= Inter_ref_03_02;
907
                                                Inter_H_window_4_2 <= Inter_ref_04_02;Inter_H_window_5_2 <= Inter_ref_05_02;
908
 
909
                                                Inter_H_window_0_3 <= Inter_ref_00_03;Inter_H_window_1_3 <= Inter_ref_01_03;
910
                                                Inter_H_window_2_3 <= Inter_ref_02_03;Inter_H_window_3_3 <= Inter_ref_03_03;
911
                                                Inter_H_window_4_3 <= Inter_ref_04_03;Inter_H_window_5_3 <= Inter_ref_05_03;
912
 
913
                                                Inter_H_window_0_4 <= Inter_ref_00_04;Inter_H_window_1_4 <= Inter_ref_01_04;
914
                                                Inter_H_window_2_4 <= Inter_ref_02_04;Inter_H_window_3_4 <= Inter_ref_03_04;
915
                                                Inter_H_window_4_4 <= Inter_ref_04_04;Inter_H_window_5_4 <= Inter_ref_05_04;
916
 
917
                                                Inter_H_window_0_5 <= Inter_ref_00_05;Inter_H_window_1_5 <= Inter_ref_01_05;
918
                                                Inter_H_window_2_5 <= Inter_ref_02_05;Inter_H_window_3_5 <= Inter_ref_03_05;
919
                                                Inter_H_window_4_5 <= Inter_ref_04_05;Inter_H_window_5_5 <= Inter_ref_05_05;
920
                                        end
921
                                3'd3:
922
                                if (pos_FracL == `pos_p || pos_FracL == `pos_r)
923
                                        begin
924
                                                Inter_H_window_0_2 <= Inter_ref_01_03;Inter_H_window_1_2 <= Inter_ref_02_03;
925
                                                Inter_H_window_2_2 <= Inter_ref_03_03;Inter_H_window_3_2 <= Inter_ref_04_03;
926
                                                Inter_H_window_4_2 <= Inter_ref_05_03;Inter_H_window_5_2 <= Inter_ref_06_03;
927
 
928
                                                Inter_H_window_0_3 <= Inter_ref_01_04;Inter_H_window_1_3 <= Inter_ref_02_04;
929
                                                Inter_H_window_2_3 <= Inter_ref_03_04;Inter_H_window_3_3 <= Inter_ref_04_04;
930
                                                Inter_H_window_4_3 <= Inter_ref_05_04;Inter_H_window_5_3 <= Inter_ref_06_04;
931
 
932
                                                Inter_H_window_0_4 <= Inter_ref_01_05;Inter_H_window_1_4 <= Inter_ref_02_05;
933
                                                Inter_H_window_2_4 <= Inter_ref_03_05;Inter_H_window_3_4 <= Inter_ref_04_05;
934
                                                Inter_H_window_4_4 <= Inter_ref_05_05;Inter_H_window_5_4 <= Inter_ref_06_05;
935
 
936
                                                Inter_H_window_0_5 <= Inter_ref_01_06;Inter_H_window_1_5 <= Inter_ref_02_06;
937
                                                Inter_H_window_2_5 <= Inter_ref_03_06;Inter_H_window_3_5 <= Inter_ref_04_06;
938
                                                Inter_H_window_4_5 <= Inter_ref_05_06;Inter_H_window_5_5 <= Inter_ref_06_06;
939
                                        end
940
                                else
941
                                        begin
942
                                                Inter_H_window_0_2 <= Inter_ref_01_02;Inter_H_window_1_2 <= Inter_ref_02_02;
943
                                                Inter_H_window_2_2 <= Inter_ref_03_02;Inter_H_window_3_2 <= Inter_ref_04_02;
944
                                                Inter_H_window_4_2 <= Inter_ref_05_02;Inter_H_window_5_2 <= Inter_ref_06_02;
945
 
946
                                                Inter_H_window_0_3 <= Inter_ref_01_03;Inter_H_window_1_3 <= Inter_ref_02_03;
947
                                                Inter_H_window_2_3 <= Inter_ref_03_03;Inter_H_window_3_3 <= Inter_ref_04_03;
948
                                                Inter_H_window_4_3 <= Inter_ref_05_03;Inter_H_window_5_3 <= Inter_ref_06_03;
949
 
950
                                                Inter_H_window_0_4 <= Inter_ref_01_04;Inter_H_window_1_4 <= Inter_ref_02_04;
951
                                                Inter_H_window_2_4 <= Inter_ref_03_04;Inter_H_window_3_4 <= Inter_ref_04_04;
952
                                                Inter_H_window_4_4 <= Inter_ref_05_04;Inter_H_window_5_4 <= Inter_ref_06_04;
953
 
954
                                                Inter_H_window_0_5 <= Inter_ref_01_05;Inter_H_window_1_5 <= Inter_ref_02_05;
955
                                                Inter_H_window_2_5 <= Inter_ref_03_05;Inter_H_window_3_5 <= Inter_ref_04_05;
956
                                                Inter_H_window_4_5 <= Inter_ref_05_05;Inter_H_window_5_5 <= Inter_ref_06_05;
957
                                        end
958
                                3'd2:
959
                                if (pos_FracL == `pos_p || pos_FracL == `pos_r)
960
                                        begin
961
                                                Inter_H_window_0_2 <= Inter_ref_02_03;Inter_H_window_1_2 <= Inter_ref_03_03;
962
                                                Inter_H_window_2_2 <= Inter_ref_04_03;Inter_H_window_3_2 <= Inter_ref_05_03;
963
                                                Inter_H_window_4_2 <= Inter_ref_06_03;Inter_H_window_5_2 <= Inter_ref_07_03;
964
 
965
                                                Inter_H_window_0_3 <= Inter_ref_02_04;Inter_H_window_1_3 <= Inter_ref_03_04;
966
                                                Inter_H_window_2_3 <= Inter_ref_04_04;Inter_H_window_3_3 <= Inter_ref_05_04;
967
                                                Inter_H_window_4_3 <= Inter_ref_06_04;Inter_H_window_5_3 <= Inter_ref_07_04;
968
 
969
                                                Inter_H_window_0_4 <= Inter_ref_02_05;Inter_H_window_1_4 <= Inter_ref_03_05;
970
                                                Inter_H_window_2_4 <= Inter_ref_04_05;Inter_H_window_3_4 <= Inter_ref_05_05;
971
                                                Inter_H_window_4_4 <= Inter_ref_06_05;Inter_H_window_5_4 <= Inter_ref_07_05;
972
 
973
                                                Inter_H_window_0_5 <= Inter_ref_02_06;Inter_H_window_1_5 <= Inter_ref_03_06;
974
                                                Inter_H_window_2_5 <= Inter_ref_04_06;Inter_H_window_3_5 <= Inter_ref_05_06;
975
                                                Inter_H_window_4_5 <= Inter_ref_06_06;Inter_H_window_5_5 <= Inter_ref_07_06;
976
                                        end
977
                                else
978
                                        begin
979
                                                Inter_H_window_0_2 <= Inter_ref_02_02;Inter_H_window_1_2 <= Inter_ref_03_02;
980
                                                Inter_H_window_2_2 <= Inter_ref_04_02;Inter_H_window_3_2 <= Inter_ref_05_02;
981
                                                Inter_H_window_4_2 <= Inter_ref_06_02;Inter_H_window_5_2 <= Inter_ref_07_02;
982
 
983
                                                Inter_H_window_0_3 <= Inter_ref_02_03;Inter_H_window_1_3 <= Inter_ref_03_03;
984
                                                Inter_H_window_2_3 <= Inter_ref_04_03;Inter_H_window_3_3 <= Inter_ref_05_03;
985
                                                Inter_H_window_4_3 <= Inter_ref_06_03;Inter_H_window_5_3 <= Inter_ref_07_03;
986
 
987
                                                Inter_H_window_0_4 <= Inter_ref_02_04;Inter_H_window_1_4 <= Inter_ref_03_04;
988
                                                Inter_H_window_2_4 <= Inter_ref_04_04;Inter_H_window_3_4 <= Inter_ref_05_04;
989
                                                Inter_H_window_4_4 <= Inter_ref_06_04;Inter_H_window_5_4 <= Inter_ref_07_04;
990
 
991
                                                Inter_H_window_0_5 <= Inter_ref_02_05;Inter_H_window_1_5 <= Inter_ref_03_05;
992
                                                Inter_H_window_2_5 <= Inter_ref_04_05;Inter_H_window_3_5 <= Inter_ref_05_05;
993
                                                Inter_H_window_4_5 <= Inter_ref_06_05;Inter_H_window_5_5 <= Inter_ref_07_05;
994
                                        end
995
                                3'd1:
996
                                if (pos_FracL == `pos_p || pos_FracL == `pos_r)
997
                                        begin
998
                                                Inter_H_window_0_2 <= Inter_ref_03_03;Inter_H_window_1_2 <= Inter_ref_04_03;
999
                                                Inter_H_window_2_2 <= Inter_ref_05_03;Inter_H_window_3_2 <= Inter_ref_06_03;
1000
                                                Inter_H_window_4_2 <= Inter_ref_07_03;Inter_H_window_5_2 <= Inter_ref_08_03;
1001
 
1002
                                                Inter_H_window_0_3 <= Inter_ref_03_04;Inter_H_window_1_3 <= Inter_ref_04_04;
1003
                                                Inter_H_window_2_3 <= Inter_ref_05_04;Inter_H_window_3_3 <= Inter_ref_06_04;
1004
                                                Inter_H_window_4_3 <= Inter_ref_07_04;Inter_H_window_5_3 <= Inter_ref_08_04;
1005
 
1006
                                                Inter_H_window_0_4 <= Inter_ref_03_05;Inter_H_window_1_4 <= Inter_ref_04_05;
1007
                                                Inter_H_window_2_4 <= Inter_ref_05_05;Inter_H_window_3_4 <= Inter_ref_06_05;
1008
                                                Inter_H_window_4_4 <= Inter_ref_07_05;Inter_H_window_5_4 <= Inter_ref_08_05;
1009
 
1010
                                                Inter_H_window_0_5 <= Inter_ref_03_06;Inter_H_window_1_5 <= Inter_ref_04_06;
1011
                                                Inter_H_window_2_5 <= Inter_ref_05_06;Inter_H_window_3_5 <= Inter_ref_06_06;
1012
                                                Inter_H_window_4_5 <= Inter_ref_07_06;Inter_H_window_5_5 <= Inter_ref_08_06;
1013
                                        end
1014
                                else
1015
                                        begin
1016
                                                Inter_H_window_0_2 <= Inter_ref_03_02;Inter_H_window_1_2 <= Inter_ref_04_02;
1017
                                                Inter_H_window_2_2 <= Inter_ref_05_02;Inter_H_window_3_2 <= Inter_ref_06_02;
1018
                                                Inter_H_window_4_2 <= Inter_ref_07_02;Inter_H_window_5_2 <= Inter_ref_08_02;
1019
 
1020
                                                Inter_H_window_0_3 <= Inter_ref_03_03;Inter_H_window_1_3 <= Inter_ref_04_03;
1021
                                                Inter_H_window_2_3 <= Inter_ref_05_03;Inter_H_window_3_3 <= Inter_ref_06_03;
1022
                                                Inter_H_window_4_3 <= Inter_ref_07_03;Inter_H_window_5_3 <= Inter_ref_08_03;
1023
 
1024
                                                Inter_H_window_0_4 <= Inter_ref_03_04;Inter_H_window_1_4 <= Inter_ref_04_04;
1025
                                                Inter_H_window_2_4 <= Inter_ref_05_04;Inter_H_window_3_4 <= Inter_ref_06_04;
1026
                                                Inter_H_window_4_4 <= Inter_ref_07_04;Inter_H_window_5_4 <= Inter_ref_08_04;
1027
 
1028
                                                Inter_H_window_0_5 <= Inter_ref_03_05;Inter_H_window_1_5 <= Inter_ref_04_05;
1029
                                                Inter_H_window_2_5 <= Inter_ref_05_05;Inter_H_window_3_5 <= Inter_ref_06_05;
1030
                                                Inter_H_window_4_5 <= Inter_ref_07_05;Inter_H_window_5_5 <= Inter_ref_08_05;
1031
                                        end
1032
                                default:
1033
                                begin
1034
                                        Inter_H_window_0_2 <= 0;Inter_H_window_1_2 <= 0;Inter_H_window_2_2 <= 0;
1035
                                        Inter_H_window_3_2 <= 0;Inter_H_window_4_2 <= 0;Inter_H_window_5_2 <= 0;
1036
 
1037
                                        Inter_H_window_0_3 <= 0;Inter_H_window_1_3 <= 0;Inter_H_window_2_3 <= 0;
1038
                                        Inter_H_window_3_3 <= 0;Inter_H_window_4_3 <= 0;Inter_H_window_5_3 <= 0;
1039
 
1040
                                        Inter_H_window_0_4 <= 0;Inter_H_window_1_4 <= 0;Inter_H_window_2_4 <= 0;
1041
                                        Inter_H_window_3_4 <= 0;Inter_H_window_4_4 <= 0;Inter_H_window_5_4 <= 0;
1042
 
1043
                                        Inter_H_window_0_5 <= 0;Inter_H_window_1_5 <= 0;Inter_H_window_2_5 <= 0;
1044
                                        Inter_H_window_3_5 <= 0;Inter_H_window_4_5 <= 0;Inter_H_window_5_5 <= 0;
1045
                                end
1046
                        endcase
1047
                        4'b0100: //Right top blk4x4
1048
                        case (Inter_H_window_counter1)
1049
                                3'd4:
1050
                                if (pos_FracL == `pos_p || pos_FracL == `pos_r)
1051
                                        begin
1052
                                                Inter_H_window_0_2 <= Inter_ref_04_03;Inter_H_window_1_2 <= Inter_ref_05_03;
1053
                                                Inter_H_window_2_2 <= Inter_ref_06_03;Inter_H_window_3_2 <= Inter_ref_07_03;
1054
                                                Inter_H_window_4_2 <= Inter_ref_08_03;Inter_H_window_5_2 <= Inter_ref_09_03;
1055
 
1056
                                                Inter_H_window_0_3 <= Inter_ref_04_04;Inter_H_window_1_3 <= Inter_ref_05_04;
1057
                                                Inter_H_window_2_3 <= Inter_ref_06_04;Inter_H_window_3_3 <= Inter_ref_07_04;
1058
                                                Inter_H_window_4_3 <= Inter_ref_08_04;Inter_H_window_5_3 <= Inter_ref_09_04;
1059
 
1060
                                                Inter_H_window_0_4 <= Inter_ref_04_05;Inter_H_window_1_4 <= Inter_ref_05_05;
1061
                                                Inter_H_window_2_4 <= Inter_ref_06_05;Inter_H_window_3_4 <= Inter_ref_07_05;
1062
                                                Inter_H_window_4_4 <= Inter_ref_08_05;Inter_H_window_5_4 <= Inter_ref_09_05;
1063
 
1064
                                                Inter_H_window_0_5 <= Inter_ref_04_06;Inter_H_window_1_5 <= Inter_ref_05_06;
1065
                                                Inter_H_window_2_5 <= Inter_ref_06_06;Inter_H_window_3_5 <= Inter_ref_07_06;
1066
                                                Inter_H_window_4_5 <= Inter_ref_08_06;Inter_H_window_5_5 <= Inter_ref_09_06;
1067
                                        end
1068
                                else
1069
                                        begin
1070
                                                Inter_H_window_0_2 <= Inter_ref_04_02;Inter_H_window_1_2 <= Inter_ref_05_02;
1071
                                                Inter_H_window_2_2 <= Inter_ref_06_02;Inter_H_window_3_2 <= Inter_ref_07_02;
1072
                                                Inter_H_window_4_2 <= Inter_ref_08_02;Inter_H_window_5_2 <= Inter_ref_09_02;
1073
 
1074
                                                Inter_H_window_0_3 <= Inter_ref_04_03;Inter_H_window_1_3 <= Inter_ref_05_03;
1075
                                                Inter_H_window_2_3 <= Inter_ref_06_03;Inter_H_window_3_3 <= Inter_ref_07_03;
1076
                                                Inter_H_window_4_3 <= Inter_ref_08_03;Inter_H_window_5_3 <= Inter_ref_09_03;
1077
 
1078
                                                Inter_H_window_0_4 <= Inter_ref_04_04;Inter_H_window_1_4 <= Inter_ref_05_04;
1079
                                                Inter_H_window_2_4 <= Inter_ref_06_04;Inter_H_window_3_4 <= Inter_ref_07_04;
1080
                                                Inter_H_window_4_4 <= Inter_ref_08_04;Inter_H_window_5_4 <= Inter_ref_09_04;
1081
 
1082
                                                Inter_H_window_0_5 <= Inter_ref_04_05;Inter_H_window_1_5 <= Inter_ref_05_05;
1083
                                                Inter_H_window_2_5 <= Inter_ref_06_05;Inter_H_window_3_5 <= Inter_ref_07_05;
1084
                                                Inter_H_window_4_5 <= Inter_ref_08_05;Inter_H_window_5_5 <= Inter_ref_09_05;
1085
                                        end
1086
                                3'd3:
1087
                                if (pos_FracL == `pos_p || pos_FracL == `pos_r)
1088
                                        begin
1089
                                                Inter_H_window_0_2 <= Inter_ref_05_03;Inter_H_window_1_2 <= Inter_ref_06_03;
1090
                                                Inter_H_window_2_2 <= Inter_ref_07_03;Inter_H_window_3_2 <= Inter_ref_08_03;
1091
                                                Inter_H_window_4_2 <= Inter_ref_09_03;Inter_H_window_5_2 <= Inter_ref_10_03;
1092
 
1093
                                                Inter_H_window_0_3 <= Inter_ref_05_04;Inter_H_window_1_3 <= Inter_ref_06_04;
1094
                                                Inter_H_window_2_3 <= Inter_ref_07_04;Inter_H_window_3_3 <= Inter_ref_08_04;
1095
                                                Inter_H_window_4_3 <= Inter_ref_09_04;Inter_H_window_5_3 <= Inter_ref_10_04;
1096
 
1097
                                                Inter_H_window_0_4 <= Inter_ref_05_05;Inter_H_window_1_4 <= Inter_ref_06_05;
1098
                                                Inter_H_window_2_4 <= Inter_ref_07_05;Inter_H_window_3_4 <= Inter_ref_08_05;
1099
                                                Inter_H_window_4_4 <= Inter_ref_09_05;Inter_H_window_5_4 <= Inter_ref_10_05;
1100
 
1101
                                                Inter_H_window_0_5 <= Inter_ref_05_06;Inter_H_window_1_5 <= Inter_ref_06_06;
1102
                                                Inter_H_window_2_5 <= Inter_ref_07_06;Inter_H_window_3_5 <= Inter_ref_08_06;
1103
                                                Inter_H_window_4_5 <= Inter_ref_09_06;Inter_H_window_5_5 <= Inter_ref_10_06;
1104
                                        end
1105
                                else
1106
                                        begin
1107
                                                Inter_H_window_0_2 <= Inter_ref_05_02;Inter_H_window_1_2 <= Inter_ref_06_02;
1108
                                                Inter_H_window_2_2 <= Inter_ref_07_02;Inter_H_window_3_2 <= Inter_ref_08_02;
1109
                                                Inter_H_window_4_2 <= Inter_ref_09_02;Inter_H_window_5_2 <= Inter_ref_10_02;
1110
 
1111
                                                Inter_H_window_0_3 <= Inter_ref_05_03;Inter_H_window_1_3 <= Inter_ref_06_03;
1112
                                                Inter_H_window_2_3 <= Inter_ref_07_03;Inter_H_window_3_3 <= Inter_ref_08_03;
1113
                                                Inter_H_window_4_3 <= Inter_ref_09_03;Inter_H_window_5_3 <= Inter_ref_10_03;
1114
 
1115
                                                Inter_H_window_0_4 <= Inter_ref_05_04;Inter_H_window_1_4 <= Inter_ref_06_04;
1116
                                                Inter_H_window_2_4 <= Inter_ref_07_04;Inter_H_window_3_4 <= Inter_ref_08_04;
1117
                                                Inter_H_window_4_4 <= Inter_ref_09_04;Inter_H_window_5_4 <= Inter_ref_10_04;
1118
 
1119
                                                Inter_H_window_0_5 <= Inter_ref_05_05;Inter_H_window_1_5 <= Inter_ref_06_05;
1120
                                                Inter_H_window_2_5 <= Inter_ref_07_05;Inter_H_window_3_5 <= Inter_ref_08_05;
1121
                                                Inter_H_window_4_5 <= Inter_ref_09_05;Inter_H_window_5_5 <= Inter_ref_10_05;
1122
                                        end
1123
                                3'd2:
1124
                                if (pos_FracL == `pos_p || pos_FracL == `pos_r)
1125
                                        begin
1126
                                                Inter_H_window_0_2 <= Inter_ref_06_03;Inter_H_window_1_2 <= Inter_ref_07_03;
1127
                                                Inter_H_window_2_2 <= Inter_ref_08_03;Inter_H_window_3_2 <= Inter_ref_09_03;
1128
                                                Inter_H_window_4_2 <= Inter_ref_10_03;Inter_H_window_5_2 <= Inter_ref_11_03;
1129
 
1130
                                                Inter_H_window_0_3 <= Inter_ref_06_04;Inter_H_window_1_3 <= Inter_ref_07_04;
1131
                                                Inter_H_window_2_3 <= Inter_ref_08_04;Inter_H_window_3_3 <= Inter_ref_09_04;
1132
                                                Inter_H_window_4_3 <= Inter_ref_10_04;Inter_H_window_5_3 <= Inter_ref_11_04;
1133
 
1134
                                                Inter_H_window_0_4 <= Inter_ref_06_05;Inter_H_window_1_4 <= Inter_ref_07_05;
1135
                                                Inter_H_window_2_4 <= Inter_ref_08_05;Inter_H_window_3_4 <= Inter_ref_09_05;
1136
                                                Inter_H_window_4_4 <= Inter_ref_10_05;Inter_H_window_5_4 <= Inter_ref_11_05;
1137
 
1138
                                                Inter_H_window_0_5 <= Inter_ref_06_06;Inter_H_window_1_5 <= Inter_ref_07_06;
1139
                                                Inter_H_window_2_5 <= Inter_ref_08_06;Inter_H_window_3_5 <= Inter_ref_09_06;
1140
                                                Inter_H_window_4_5 <= Inter_ref_10_06;Inter_H_window_5_5 <= Inter_ref_11_06;
1141
                                        end
1142
                                else
1143
                                        begin
1144
                                                Inter_H_window_0_2 <= Inter_ref_06_02;Inter_H_window_1_2 <= Inter_ref_07_02;
1145
                                                Inter_H_window_2_2 <= Inter_ref_08_02;Inter_H_window_3_2 <= Inter_ref_09_02;
1146
                                                Inter_H_window_4_2 <= Inter_ref_10_02;Inter_H_window_5_2 <= Inter_ref_11_02;
1147
 
1148
                                                Inter_H_window_0_3 <= Inter_ref_06_03;Inter_H_window_1_3 <= Inter_ref_07_03;
1149
                                                Inter_H_window_2_3 <= Inter_ref_08_03;Inter_H_window_3_3 <= Inter_ref_09_03;
1150
                                                Inter_H_window_4_3 <= Inter_ref_10_03;Inter_H_window_5_3 <= Inter_ref_11_03;
1151
 
1152
                                                Inter_H_window_0_4 <= Inter_ref_06_04;Inter_H_window_1_4 <= Inter_ref_07_04;
1153
                                                Inter_H_window_2_4 <= Inter_ref_08_04;Inter_H_window_3_4 <= Inter_ref_09_04;
1154
                                                Inter_H_window_4_4 <= Inter_ref_10_04;Inter_H_window_5_4 <= Inter_ref_11_04;
1155
 
1156
                                                Inter_H_window_0_5 <= Inter_ref_06_05;Inter_H_window_1_5 <= Inter_ref_07_05;
1157
                                                Inter_H_window_2_5 <= Inter_ref_08_05;Inter_H_window_3_5 <= Inter_ref_09_05;
1158
                                                Inter_H_window_4_5 <= Inter_ref_10_05;Inter_H_window_5_5 <= Inter_ref_11_05;
1159
                                        end
1160
                                3'd1:
1161
                                if (pos_FracL == `pos_p || pos_FracL == `pos_r)
1162
                                        begin
1163
                                                Inter_H_window_0_2 <= Inter_ref_07_03;Inter_H_window_1_2 <= Inter_ref_08_03;
1164
                                                Inter_H_window_2_2 <= Inter_ref_09_03;Inter_H_window_3_2 <= Inter_ref_10_03;
1165
                                                Inter_H_window_4_2 <= Inter_ref_11_03;Inter_H_window_5_2 <= Inter_ref_12_03;
1166
 
1167
                                                Inter_H_window_0_3 <= Inter_ref_07_04;Inter_H_window_1_3 <= Inter_ref_08_04;
1168
                                                Inter_H_window_2_3 <= Inter_ref_09_04;Inter_H_window_3_3 <= Inter_ref_10_04;
1169
                                                Inter_H_window_4_3 <= Inter_ref_11_04;Inter_H_window_5_3 <= Inter_ref_12_04;
1170
 
1171
                                                Inter_H_window_0_4 <= Inter_ref_07_05;Inter_H_window_1_4 <= Inter_ref_08_05;
1172
                                                Inter_H_window_2_4 <= Inter_ref_09_05;Inter_H_window_3_4 <= Inter_ref_10_05;
1173
                                                Inter_H_window_4_4 <= Inter_ref_11_05;Inter_H_window_5_4 <= Inter_ref_12_05;
1174
 
1175
                                                Inter_H_window_0_5 <= Inter_ref_07_06;Inter_H_window_1_5 <= Inter_ref_08_06;
1176
                                                Inter_H_window_2_5 <= Inter_ref_09_06;Inter_H_window_3_5 <= Inter_ref_10_06;
1177
                                                Inter_H_window_4_5 <= Inter_ref_11_06;Inter_H_window_5_5 <= Inter_ref_12_06;
1178
                                        end
1179
                                else
1180
                                        begin
1181
                                                Inter_H_window_0_2 <= Inter_ref_07_02;Inter_H_window_1_2 <= Inter_ref_08_02;
1182
                                                Inter_H_window_2_2 <= Inter_ref_09_02;Inter_H_window_3_2 <= Inter_ref_10_02;
1183
                                                Inter_H_window_4_2 <= Inter_ref_11_02;Inter_H_window_5_2 <= Inter_ref_12_02;
1184
 
1185
                                                Inter_H_window_0_3 <= Inter_ref_07_03;Inter_H_window_1_3 <= Inter_ref_08_03;
1186
                                                Inter_H_window_2_3 <= Inter_ref_09_03;Inter_H_window_3_3 <= Inter_ref_10_03;
1187
                                                Inter_H_window_4_3 <= Inter_ref_11_03;Inter_H_window_5_3 <= Inter_ref_12_03;
1188
 
1189
                                                Inter_H_window_0_4 <= Inter_ref_07_04;Inter_H_window_1_4 <= Inter_ref_08_04;
1190
                                                Inter_H_window_2_4 <= Inter_ref_09_04;Inter_H_window_3_4 <= Inter_ref_10_04;
1191
                                                Inter_H_window_4_4 <= Inter_ref_11_04;Inter_H_window_5_4 <= Inter_ref_12_04;
1192
 
1193
                                                Inter_H_window_0_5 <= Inter_ref_07_05;Inter_H_window_1_5 <= Inter_ref_08_05;
1194
                                                Inter_H_window_2_5 <= Inter_ref_09_05;Inter_H_window_3_5 <= Inter_ref_10_05;
1195
                                                Inter_H_window_4_5 <= Inter_ref_11_05;Inter_H_window_5_5 <= Inter_ref_12_05;
1196
                                        end
1197
                                default:
1198
                                begin
1199
                                        Inter_H_window_0_2 <= 0;Inter_H_window_1_2 <= 0;Inter_H_window_2_2 <= 0;
1200
                                        Inter_H_window_3_2 <= 0;Inter_H_window_4_2 <= 0;Inter_H_window_5_2 <= 0;
1201
 
1202
                                        Inter_H_window_0_3 <= 0;Inter_H_window_1_3 <= 0;Inter_H_window_2_3 <= 0;
1203
                                        Inter_H_window_3_3 <= 0;Inter_H_window_4_3 <= 0;Inter_H_window_5_3 <= 0;
1204
 
1205
                                        Inter_H_window_0_4 <= 0;Inter_H_window_1_4 <= 0;Inter_H_window_2_4 <= 0;
1206
                                        Inter_H_window_3_4 <= 0;Inter_H_window_4_4 <= 0;Inter_H_window_5_4 <= 0;
1207
 
1208
                                        Inter_H_window_0_5 <= 0;Inter_H_window_1_5 <= 0;Inter_H_window_2_5 <= 0;
1209
                                        Inter_H_window_3_5 <= 0;Inter_H_window_4_5 <= 0;Inter_H_window_5_5 <= 0;
1210
                                end
1211
                        endcase
1212
                        4'b0010: //Left bottom blk4x4
1213
                        case (Inter_H_window_counter1)
1214
                                3'd4:
1215
                                if (pos_FracL == `pos_p || pos_FracL == `pos_r)
1216
                                        begin
1217
                                                Inter_H_window_0_2 <= Inter_ref_00_07;Inter_H_window_1_2 <= Inter_ref_01_07;
1218
                                                Inter_H_window_2_2 <= Inter_ref_02_07;Inter_H_window_3_2 <= Inter_ref_03_07;
1219
                                                Inter_H_window_4_2 <= Inter_ref_04_07;Inter_H_window_5_2 <= Inter_ref_05_07;
1220
 
1221
                                                Inter_H_window_0_3 <= Inter_ref_00_08;Inter_H_window_1_3 <= Inter_ref_01_08;
1222
                                                Inter_H_window_2_3 <= Inter_ref_02_08;Inter_H_window_3_3 <= Inter_ref_03_08;
1223
                                                Inter_H_window_4_3 <= Inter_ref_04_08;Inter_H_window_5_3 <= Inter_ref_05_08;
1224
 
1225
                                                Inter_H_window_0_4 <= Inter_ref_00_09;Inter_H_window_1_4 <= Inter_ref_01_09;
1226
                                                Inter_H_window_2_4 <= Inter_ref_02_09;Inter_H_window_3_4 <= Inter_ref_03_09;
1227
                                                Inter_H_window_4_4 <= Inter_ref_04_09;Inter_H_window_5_4 <= Inter_ref_05_09;
1228
 
1229
                                                Inter_H_window_0_5 <= Inter_ref_00_10;Inter_H_window_1_5 <= Inter_ref_01_10;
1230
                                                Inter_H_window_2_5 <= Inter_ref_02_10;Inter_H_window_3_5 <= Inter_ref_03_10;
1231
                                                Inter_H_window_4_5 <= Inter_ref_04_10;Inter_H_window_5_5 <= Inter_ref_05_10;
1232
                                        end
1233
                                else
1234
                                        begin
1235
                                                Inter_H_window_0_2 <= Inter_ref_00_06;Inter_H_window_1_2 <= Inter_ref_01_06;
1236
                                                Inter_H_window_2_2 <= Inter_ref_02_06;Inter_H_window_3_2 <= Inter_ref_03_06;
1237
                                                Inter_H_window_4_2 <= Inter_ref_04_06;Inter_H_window_5_2 <= Inter_ref_05_06;
1238
 
1239
                                                Inter_H_window_0_3 <= Inter_ref_00_07;Inter_H_window_1_3 <= Inter_ref_01_07;
1240
                                                Inter_H_window_2_3 <= Inter_ref_02_07;Inter_H_window_3_3 <= Inter_ref_03_07;
1241
                                                Inter_H_window_4_3 <= Inter_ref_04_07;Inter_H_window_5_3 <= Inter_ref_05_07;
1242
 
1243
                                                Inter_H_window_0_4 <= Inter_ref_00_08;Inter_H_window_1_4 <= Inter_ref_01_08;
1244
                                                Inter_H_window_2_4 <= Inter_ref_02_08;Inter_H_window_3_4 <= Inter_ref_03_08;
1245
                                                Inter_H_window_4_4 <= Inter_ref_04_08;Inter_H_window_5_4 <= Inter_ref_05_08;
1246
 
1247
                                                Inter_H_window_0_5 <= Inter_ref_00_09;Inter_H_window_1_5 <= Inter_ref_01_09;
1248
                                                Inter_H_window_2_5 <= Inter_ref_02_09;Inter_H_window_3_5 <= Inter_ref_03_09;
1249
                                                Inter_H_window_4_5 <= Inter_ref_04_09;Inter_H_window_5_5 <= Inter_ref_05_09;
1250
                                        end
1251
                                3'd3:
1252
                                if (pos_FracL == `pos_p || pos_FracL == `pos_r)
1253
                                        begin
1254
                                                Inter_H_window_0_2 <= Inter_ref_01_07;Inter_H_window_1_2 <= Inter_ref_02_07;
1255
                                                Inter_H_window_2_2 <= Inter_ref_03_07;Inter_H_window_3_2 <= Inter_ref_04_07;
1256
                                                Inter_H_window_4_2 <= Inter_ref_05_07;Inter_H_window_5_2 <= Inter_ref_06_07;
1257
 
1258
                                                Inter_H_window_0_3 <= Inter_ref_01_08;Inter_H_window_1_3 <= Inter_ref_02_08;
1259
                                                Inter_H_window_2_3 <= Inter_ref_03_08;Inter_H_window_3_3 <= Inter_ref_04_08;
1260
                                                Inter_H_window_4_3 <= Inter_ref_05_08;Inter_H_window_5_3 <= Inter_ref_06_08;
1261
 
1262
                                                Inter_H_window_0_4 <= Inter_ref_01_09;Inter_H_window_1_4 <= Inter_ref_02_09;
1263
                                                Inter_H_window_2_4 <= Inter_ref_03_09;Inter_H_window_3_4 <= Inter_ref_04_09;
1264
                                                Inter_H_window_4_4 <= Inter_ref_05_09;Inter_H_window_5_4 <= Inter_ref_06_09;
1265
 
1266
                                                Inter_H_window_0_5 <= Inter_ref_01_10;Inter_H_window_1_5 <= Inter_ref_02_10;
1267
                                                Inter_H_window_2_5 <= Inter_ref_03_10;Inter_H_window_3_5 <= Inter_ref_04_10;
1268
                                                Inter_H_window_4_5 <= Inter_ref_05_10;Inter_H_window_5_5 <= Inter_ref_06_10;
1269
                                        end
1270
                                else
1271
                                        begin
1272
                                                Inter_H_window_0_2 <= Inter_ref_01_06;Inter_H_window_1_2 <= Inter_ref_02_06;
1273
                                                Inter_H_window_2_2 <= Inter_ref_03_06;Inter_H_window_3_2 <= Inter_ref_04_06;
1274
                                                Inter_H_window_4_2 <= Inter_ref_05_06;Inter_H_window_5_2 <= Inter_ref_06_06;
1275
 
1276
                                                Inter_H_window_0_3 <= Inter_ref_01_07;Inter_H_window_1_3 <= Inter_ref_02_07;
1277
                                                Inter_H_window_2_3 <= Inter_ref_03_07;Inter_H_window_3_3 <= Inter_ref_04_07;
1278
                                                Inter_H_window_4_3 <= Inter_ref_05_07;Inter_H_window_5_3 <= Inter_ref_06_07;
1279
 
1280
                                                Inter_H_window_0_4 <= Inter_ref_01_08;Inter_H_window_1_4 <= Inter_ref_02_08;
1281
                                                Inter_H_window_2_4 <= Inter_ref_03_08;Inter_H_window_3_4 <= Inter_ref_04_08;
1282
                                                Inter_H_window_4_4 <= Inter_ref_05_08;Inter_H_window_5_4 <= Inter_ref_06_08;
1283
 
1284
                                                Inter_H_window_0_5 <= Inter_ref_01_09;Inter_H_window_1_5 <= Inter_ref_02_09;
1285
                                                Inter_H_window_2_5 <= Inter_ref_03_09;Inter_H_window_3_5 <= Inter_ref_04_09;
1286
                                                Inter_H_window_4_5 <= Inter_ref_05_09;Inter_H_window_5_5 <= Inter_ref_06_09;
1287
                                        end
1288
                                3'd2:
1289
                                if (pos_FracL == `pos_p || pos_FracL == `pos_r)
1290
                                        begin
1291
                                                Inter_H_window_0_2 <= Inter_ref_02_07;Inter_H_window_1_2 <= Inter_ref_03_07;
1292
                                                Inter_H_window_2_2 <= Inter_ref_04_07;Inter_H_window_3_2 <= Inter_ref_05_07;
1293
                                                Inter_H_window_4_2 <= Inter_ref_06_07;Inter_H_window_5_2 <= Inter_ref_07_07;
1294
 
1295
                                                Inter_H_window_0_3 <= Inter_ref_02_08;Inter_H_window_1_3 <= Inter_ref_03_08;
1296
                                                Inter_H_window_2_3 <= Inter_ref_04_08;Inter_H_window_3_3 <= Inter_ref_05_08;
1297
                                                Inter_H_window_4_3 <= Inter_ref_06_08;Inter_H_window_5_3 <= Inter_ref_07_08;
1298
 
1299
                                                Inter_H_window_0_4 <= Inter_ref_02_09;Inter_H_window_1_4 <= Inter_ref_03_09;
1300
                                                Inter_H_window_2_4 <= Inter_ref_04_09;Inter_H_window_3_4 <= Inter_ref_05_09;
1301
                                                Inter_H_window_4_4 <= Inter_ref_06_09;Inter_H_window_5_4 <= Inter_ref_07_09;
1302
 
1303
                                                Inter_H_window_0_5 <= Inter_ref_02_10;Inter_H_window_1_5 <= Inter_ref_03_10;
1304
                                                Inter_H_window_2_5 <= Inter_ref_04_10;Inter_H_window_3_5 <= Inter_ref_05_10;
1305
                                                Inter_H_window_4_5 <= Inter_ref_06_10;Inter_H_window_5_5 <= Inter_ref_07_10;
1306
                                        end
1307
                                else
1308
                                        begin
1309
                                                Inter_H_window_0_2 <= Inter_ref_02_06;Inter_H_window_1_2 <= Inter_ref_03_06;
1310
                                                Inter_H_window_2_2 <= Inter_ref_04_06;Inter_H_window_3_2 <= Inter_ref_05_06;
1311
                                                Inter_H_window_4_2 <= Inter_ref_06_06;Inter_H_window_5_2 <= Inter_ref_07_06;
1312
 
1313
                                                Inter_H_window_0_3 <= Inter_ref_02_07;Inter_H_window_1_3 <= Inter_ref_03_07;
1314
                                                Inter_H_window_2_3 <= Inter_ref_04_07;Inter_H_window_3_3 <= Inter_ref_05_07;
1315
                                                Inter_H_window_4_3 <= Inter_ref_06_07;Inter_H_window_5_3 <= Inter_ref_07_07;
1316
 
1317
                                                Inter_H_window_0_4 <= Inter_ref_02_08;Inter_H_window_1_4 <= Inter_ref_03_08;
1318
                                                Inter_H_window_2_4 <= Inter_ref_04_08;Inter_H_window_3_4 <= Inter_ref_05_08;
1319
                                                Inter_H_window_4_4 <= Inter_ref_06_08;Inter_H_window_5_4 <= Inter_ref_07_08;
1320
 
1321
                                                Inter_H_window_0_5 <= Inter_ref_02_09;Inter_H_window_1_5 <= Inter_ref_03_09;
1322
                                                Inter_H_window_2_5 <= Inter_ref_04_09;Inter_H_window_3_5 <= Inter_ref_05_09;
1323
                                                Inter_H_window_4_5 <= Inter_ref_06_09;Inter_H_window_5_5 <= Inter_ref_07_09;
1324
                                        end
1325
                                3'd1:
1326
                                if (pos_FracL == `pos_p || pos_FracL == `pos_r)
1327
                                        begin
1328
                                                Inter_H_window_0_2 <= Inter_ref_03_07;Inter_H_window_1_2 <= Inter_ref_04_07;
1329
                                                Inter_H_window_2_2 <= Inter_ref_05_07;Inter_H_window_3_2 <= Inter_ref_06_07;
1330
                                                Inter_H_window_4_2 <= Inter_ref_07_07;Inter_H_window_5_2 <= Inter_ref_08_07;
1331
 
1332
                                                Inter_H_window_0_3 <= Inter_ref_03_08;Inter_H_window_1_3 <= Inter_ref_04_08;
1333
                                                Inter_H_window_2_3 <= Inter_ref_05_08;Inter_H_window_3_3 <= Inter_ref_06_08;
1334
                                                Inter_H_window_4_3 <= Inter_ref_07_08;Inter_H_window_5_3 <= Inter_ref_08_08;
1335
 
1336
                                                Inter_H_window_0_4 <= Inter_ref_03_09;Inter_H_window_1_4 <= Inter_ref_04_09;
1337
                                                Inter_H_window_2_4 <= Inter_ref_05_09;Inter_H_window_3_4 <= Inter_ref_06_09;
1338
                                                Inter_H_window_4_4 <= Inter_ref_07_09;Inter_H_window_5_4 <= Inter_ref_08_09;
1339
 
1340
                                                Inter_H_window_0_5 <= Inter_ref_03_10;Inter_H_window_1_5 <= Inter_ref_04_10;
1341
                                                Inter_H_window_2_5 <= Inter_ref_05_10;Inter_H_window_3_5 <= Inter_ref_06_10;
1342
                                                Inter_H_window_4_5 <= Inter_ref_07_10;Inter_H_window_5_5 <= Inter_ref_08_10;
1343
                                        end
1344
                                else
1345
                                        begin
1346
                                                Inter_H_window_0_2 <= Inter_ref_03_06;Inter_H_window_1_2 <= Inter_ref_04_06;
1347
                                                Inter_H_window_2_2 <= Inter_ref_05_06;Inter_H_window_3_2 <= Inter_ref_06_06;
1348
                                                Inter_H_window_4_2 <= Inter_ref_07_06;Inter_H_window_5_2 <= Inter_ref_08_06;
1349
 
1350
                                                Inter_H_window_0_3 <= Inter_ref_03_07;Inter_H_window_1_3 <= Inter_ref_04_07;
1351
                                                Inter_H_window_2_3 <= Inter_ref_05_07;Inter_H_window_3_3 <= Inter_ref_06_07;
1352
                                                Inter_H_window_4_3 <= Inter_ref_07_07;Inter_H_window_5_3 <= Inter_ref_08_07;
1353
 
1354
                                                Inter_H_window_0_4 <= Inter_ref_03_08;Inter_H_window_1_4 <= Inter_ref_04_08;
1355
                                                Inter_H_window_2_4 <= Inter_ref_05_08;Inter_H_window_3_4 <= Inter_ref_06_08;
1356
                                                Inter_H_window_4_4 <= Inter_ref_07_08;Inter_H_window_5_4 <= Inter_ref_08_08;
1357
 
1358
                                                Inter_H_window_0_5 <= Inter_ref_03_09;Inter_H_window_1_5 <= Inter_ref_04_09;
1359
                                                Inter_H_window_2_5 <= Inter_ref_05_09;Inter_H_window_3_5 <= Inter_ref_06_09;
1360
                                                Inter_H_window_4_5 <= Inter_ref_07_09;Inter_H_window_5_5 <= Inter_ref_08_09;
1361
                                        end
1362
                                default:
1363
                                begin
1364
                                        Inter_H_window_0_2 <= 0;Inter_H_window_1_2 <= 0;Inter_H_window_2_2 <= 0;
1365
                                        Inter_H_window_3_2 <= 0;Inter_H_window_4_2 <= 0;Inter_H_window_5_2 <= 0;
1366
 
1367
                                        Inter_H_window_0_3 <= 0;Inter_H_window_1_3 <= 0;Inter_H_window_2_3 <= 0;
1368
                                        Inter_H_window_3_3 <= 0;Inter_H_window_4_3 <= 0;Inter_H_window_5_3 <= 0;
1369
 
1370
                                        Inter_H_window_0_4 <= 0;Inter_H_window_1_4 <= 0;Inter_H_window_2_4 <= 0;
1371
                                        Inter_H_window_3_4 <= 0;Inter_H_window_4_4 <= 0;Inter_H_window_5_4 <= 0;
1372
 
1373
                                        Inter_H_window_0_5 <= 0;Inter_H_window_1_5 <= 0;Inter_H_window_2_5 <= 0;
1374
                                        Inter_H_window_3_5 <= 0;Inter_H_window_4_5 <= 0;Inter_H_window_5_5 <= 0;
1375
                                end
1376
                        endcase
1377
                        4'b0001: //Right bottom blk4x4
1378
                        case (Inter_H_window_counter1)
1379
                                3'd4:
1380
                                if (pos_FracL == `pos_p || pos_FracL == `pos_r)
1381
                                        begin
1382
                                                Inter_H_window_0_2 <= Inter_ref_04_07;Inter_H_window_1_2 <= Inter_ref_05_07;
1383
                                                Inter_H_window_2_2 <= Inter_ref_06_07;Inter_H_window_3_2 <= Inter_ref_07_07;
1384
                                                Inter_H_window_4_2 <= Inter_ref_08_07;Inter_H_window_5_2 <= Inter_ref_09_07;
1385
 
1386
                                                Inter_H_window_0_3 <= Inter_ref_04_08;Inter_H_window_1_3 <= Inter_ref_05_08;
1387
                                                Inter_H_window_2_3 <= Inter_ref_06_08;Inter_H_window_3_3 <= Inter_ref_07_08;
1388
                                                Inter_H_window_4_3 <= Inter_ref_08_08;Inter_H_window_5_3 <= Inter_ref_09_08;
1389
 
1390
                                                Inter_H_window_0_4 <= Inter_ref_04_09;Inter_H_window_1_4 <= Inter_ref_05_09;
1391
                                                Inter_H_window_2_4 <= Inter_ref_06_09;Inter_H_window_3_4 <= Inter_ref_07_09;
1392
                                                Inter_H_window_4_4 <= Inter_ref_08_09;Inter_H_window_5_4 <= Inter_ref_09_09;
1393
 
1394
                                                Inter_H_window_0_5 <= Inter_ref_04_10;Inter_H_window_1_5 <= Inter_ref_05_10;
1395
                                                Inter_H_window_2_5 <= Inter_ref_06_10;Inter_H_window_3_5 <= Inter_ref_07_10;
1396
                                                Inter_H_window_4_5 <= Inter_ref_08_10;Inter_H_window_5_5 <= Inter_ref_09_10;
1397
                                        end
1398
                                else
1399
                                        begin
1400
                                                Inter_H_window_0_2 <= Inter_ref_04_06;Inter_H_window_1_2 <= Inter_ref_05_06;
1401
                                                Inter_H_window_2_2 <= Inter_ref_06_06;Inter_H_window_3_2 <= Inter_ref_07_06;
1402
                                                Inter_H_window_4_2 <= Inter_ref_08_06;Inter_H_window_5_2 <= Inter_ref_09_06;
1403
 
1404
                                                Inter_H_window_0_3 <= Inter_ref_04_07;Inter_H_window_1_3 <= Inter_ref_05_07;
1405
                                                Inter_H_window_2_3 <= Inter_ref_06_07;Inter_H_window_3_3 <= Inter_ref_07_07;
1406
                                                Inter_H_window_4_3 <= Inter_ref_08_07;Inter_H_window_5_3 <= Inter_ref_09_07;
1407
 
1408
                                                Inter_H_window_0_4 <= Inter_ref_04_08;Inter_H_window_1_4 <= Inter_ref_05_08;
1409
                                                Inter_H_window_2_4 <= Inter_ref_06_08;Inter_H_window_3_4 <= Inter_ref_07_08;
1410
                                                Inter_H_window_4_4 <= Inter_ref_08_08;Inter_H_window_5_4 <= Inter_ref_09_08;
1411
 
1412
                                                Inter_H_window_0_5 <= Inter_ref_04_09;Inter_H_window_1_5 <= Inter_ref_05_09;
1413
                                                Inter_H_window_2_5 <= Inter_ref_06_09;Inter_H_window_3_5 <= Inter_ref_07_09;
1414
                                                Inter_H_window_4_5 <= Inter_ref_08_09;Inter_H_window_5_5 <= Inter_ref_09_09;
1415
                                        end
1416
                                3'd3:
1417
                                if (pos_FracL == `pos_p || pos_FracL == `pos_r)
1418
                                        begin
1419
                                                Inter_H_window_0_2 <= Inter_ref_05_07;Inter_H_window_1_2 <= Inter_ref_06_07;
1420
                                                Inter_H_window_2_2 <= Inter_ref_07_07;Inter_H_window_3_2 <= Inter_ref_08_07;
1421
                                                Inter_H_window_4_2 <= Inter_ref_09_07;Inter_H_window_5_2 <= Inter_ref_10_07;
1422
 
1423
                                                Inter_H_window_0_3 <= Inter_ref_05_08;Inter_H_window_1_3 <= Inter_ref_06_08;
1424
                                                Inter_H_window_2_3 <= Inter_ref_07_08;Inter_H_window_3_3 <= Inter_ref_08_08;
1425
                                                Inter_H_window_4_3 <= Inter_ref_09_08;Inter_H_window_5_3 <= Inter_ref_10_08;
1426
 
1427
                                                Inter_H_window_0_4 <= Inter_ref_05_09;Inter_H_window_1_4 <= Inter_ref_06_09;
1428
                                                Inter_H_window_2_4 <= Inter_ref_07_09;Inter_H_window_3_4 <= Inter_ref_08_09;
1429
                                                Inter_H_window_4_4 <= Inter_ref_09_09;Inter_H_window_5_4 <= Inter_ref_10_09;
1430
 
1431
                                                Inter_H_window_0_5 <= Inter_ref_05_10;Inter_H_window_1_5 <= Inter_ref_06_10;
1432
                                                Inter_H_window_2_5 <= Inter_ref_07_10;Inter_H_window_3_5 <= Inter_ref_08_10;
1433
                                                Inter_H_window_4_5 <= Inter_ref_09_10;Inter_H_window_5_5 <= Inter_ref_10_10;
1434
                                        end
1435
                                else
1436
                                        begin
1437
                                                Inter_H_window_0_2 <= Inter_ref_05_06;Inter_H_window_1_2 <= Inter_ref_06_06;
1438
                                                Inter_H_window_2_2 <= Inter_ref_07_06;Inter_H_window_3_2 <= Inter_ref_08_06;
1439
                                                Inter_H_window_4_2 <= Inter_ref_09_06;Inter_H_window_5_2 <= Inter_ref_10_06;
1440
 
1441
                                                Inter_H_window_0_3 <= Inter_ref_05_07;Inter_H_window_1_3 <= Inter_ref_06_07;
1442
                                                Inter_H_window_2_3 <= Inter_ref_07_07;Inter_H_window_3_3 <= Inter_ref_08_07;
1443
                                                Inter_H_window_4_3 <= Inter_ref_09_07;Inter_H_window_5_3 <= Inter_ref_10_07;
1444
 
1445
                                                Inter_H_window_0_4 <= Inter_ref_05_08;Inter_H_window_1_4 <= Inter_ref_06_08;
1446
                                                Inter_H_window_2_4 <= Inter_ref_07_08;Inter_H_window_3_4 <= Inter_ref_08_08;
1447
                                                Inter_H_window_4_4 <= Inter_ref_09_08;Inter_H_window_5_4 <= Inter_ref_10_08;
1448
 
1449
                                                Inter_H_window_0_5 <= Inter_ref_05_09;Inter_H_window_1_5 <= Inter_ref_06_09;
1450
                                                Inter_H_window_2_5 <= Inter_ref_07_09;Inter_H_window_3_5 <= Inter_ref_08_09;
1451
                                                Inter_H_window_4_5 <= Inter_ref_09_09;Inter_H_window_5_5 <= Inter_ref_10_09;
1452
                                        end
1453
                                3'd2:
1454
                                if (pos_FracL == `pos_p || pos_FracL == `pos_r)
1455
                                        begin
1456
                                                Inter_H_window_0_2 <= Inter_ref_06_07;Inter_H_window_1_2 <= Inter_ref_07_07;
1457
                                                Inter_H_window_2_2 <= Inter_ref_08_07;Inter_H_window_3_2 <= Inter_ref_09_07;
1458
                                                Inter_H_window_4_2 <= Inter_ref_10_07;Inter_H_window_5_2 <= Inter_ref_11_07;
1459
 
1460
                                                Inter_H_window_0_3 <= Inter_ref_06_08;Inter_H_window_1_3 <= Inter_ref_07_08;
1461
                                                Inter_H_window_2_3 <= Inter_ref_08_08;Inter_H_window_3_3 <= Inter_ref_09_08;
1462
                                                Inter_H_window_4_3 <= Inter_ref_10_08;Inter_H_window_5_3 <= Inter_ref_11_08;
1463
 
1464
                                                Inter_H_window_0_4 <= Inter_ref_06_09;Inter_H_window_1_4 <= Inter_ref_07_09;
1465
                                                Inter_H_window_2_4 <= Inter_ref_08_09;Inter_H_window_3_4 <= Inter_ref_09_09;
1466
                                                Inter_H_window_4_4 <= Inter_ref_10_09;Inter_H_window_5_4 <= Inter_ref_11_09;
1467
 
1468
                                                Inter_H_window_0_5 <= Inter_ref_06_10;Inter_H_window_1_5 <= Inter_ref_07_10;
1469
                                                Inter_H_window_2_5 <= Inter_ref_08_10;Inter_H_window_3_5 <= Inter_ref_09_10;
1470
                                                Inter_H_window_4_5 <= Inter_ref_10_10;Inter_H_window_5_5 <= Inter_ref_11_10;
1471
                                        end
1472
                                else
1473
                                        begin
1474
                                                Inter_H_window_0_2 <= Inter_ref_06_06;Inter_H_window_1_2 <= Inter_ref_07_06;
1475
                                                Inter_H_window_2_2 <= Inter_ref_08_06;Inter_H_window_3_2 <= Inter_ref_09_06;
1476
                                                Inter_H_window_4_2 <= Inter_ref_10_06;Inter_H_window_5_2 <= Inter_ref_11_06;
1477
 
1478
                                                Inter_H_window_0_3 <= Inter_ref_06_07;Inter_H_window_1_3 <= Inter_ref_07_07;
1479
                                                Inter_H_window_2_3 <= Inter_ref_08_07;Inter_H_window_3_3 <= Inter_ref_09_07;
1480
                                                Inter_H_window_4_3 <= Inter_ref_10_07;Inter_H_window_5_3 <= Inter_ref_11_07;
1481
 
1482
                                                Inter_H_window_0_4 <= Inter_ref_06_08;Inter_H_window_1_4 <= Inter_ref_07_08;
1483
                                                Inter_H_window_2_4 <= Inter_ref_08_08;Inter_H_window_3_4 <= Inter_ref_09_08;
1484
                                                Inter_H_window_4_4 <= Inter_ref_10_08;Inter_H_window_5_4 <= Inter_ref_11_08;
1485
 
1486
                                                Inter_H_window_0_5 <= Inter_ref_06_09;Inter_H_window_1_5 <= Inter_ref_07_09;
1487
                                                Inter_H_window_2_5 <= Inter_ref_08_09;Inter_H_window_3_5 <= Inter_ref_09_09;
1488
                                                Inter_H_window_4_5 <= Inter_ref_10_09;Inter_H_window_5_5 <= Inter_ref_11_09;
1489
                                        end
1490
                                3'd1:
1491
                                if (pos_FracL == `pos_p || pos_FracL == `pos_r)
1492
                                        begin
1493
                                                Inter_H_window_0_2 <= Inter_ref_07_07;Inter_H_window_1_2 <= Inter_ref_08_07;
1494
                                                Inter_H_window_2_2 <= Inter_ref_09_07;Inter_H_window_3_2 <= Inter_ref_10_07;
1495
                                                Inter_H_window_4_2 <= Inter_ref_11_07;Inter_H_window_5_2 <= Inter_ref_12_07;
1496
 
1497
                                                Inter_H_window_0_3 <= Inter_ref_07_08;Inter_H_window_1_3 <= Inter_ref_08_08;
1498
                                                Inter_H_window_2_3 <= Inter_ref_09_08;Inter_H_window_3_3 <= Inter_ref_10_08;
1499
                                                Inter_H_window_4_3 <= Inter_ref_11_08;Inter_H_window_5_3 <= Inter_ref_12_08;
1500
 
1501
                                                Inter_H_window_0_4 <= Inter_ref_07_09;Inter_H_window_1_4 <= Inter_ref_08_09;
1502
                                                Inter_H_window_2_4 <= Inter_ref_09_09;Inter_H_window_3_4 <= Inter_ref_10_09;
1503
                                                Inter_H_window_4_4 <= Inter_ref_11_09;Inter_H_window_5_4 <= Inter_ref_12_09;
1504
 
1505
                                                Inter_H_window_0_5 <= Inter_ref_07_10;Inter_H_window_1_5 <= Inter_ref_08_10;
1506
                                                Inter_H_window_2_5 <= Inter_ref_09_10;Inter_H_window_3_5 <= Inter_ref_10_10;
1507
                                                Inter_H_window_4_5 <= Inter_ref_11_10;Inter_H_window_5_5 <= Inter_ref_12_10;
1508
                                        end
1509
                                else
1510
                                        begin
1511
                                                Inter_H_window_0_2 <= Inter_ref_07_06;Inter_H_window_1_2 <= Inter_ref_08_06;
1512
                                                Inter_H_window_2_2 <= Inter_ref_09_06;Inter_H_window_3_2 <= Inter_ref_10_06;
1513
                                                Inter_H_window_4_2 <= Inter_ref_11_06;Inter_H_window_5_2 <= Inter_ref_12_06;
1514
 
1515
                                                Inter_H_window_0_3 <= Inter_ref_07_07;Inter_H_window_1_3 <= Inter_ref_08_07;
1516
                                                Inter_H_window_2_3 <= Inter_ref_09_07;Inter_H_window_3_3 <= Inter_ref_10_07;
1517
                                                Inter_H_window_4_3 <= Inter_ref_11_07;Inter_H_window_5_3 <= Inter_ref_12_07;
1518
 
1519
                                                Inter_H_window_0_4 <= Inter_ref_07_08;Inter_H_window_1_4 <= Inter_ref_08_08;
1520
                                                Inter_H_window_2_4 <= Inter_ref_09_08;Inter_H_window_3_4 <= Inter_ref_10_08;
1521
                                                Inter_H_window_4_4 <= Inter_ref_11_08;Inter_H_window_5_4 <= Inter_ref_12_08;
1522
 
1523
                                                Inter_H_window_0_5 <= Inter_ref_07_09;Inter_H_window_1_5 <= Inter_ref_08_09;
1524
                                                Inter_H_window_2_5 <= Inter_ref_09_09;Inter_H_window_3_5 <= Inter_ref_10_09;
1525
                                                Inter_H_window_4_5 <= Inter_ref_11_09;Inter_H_window_5_5 <= Inter_ref_12_09;
1526
                                        end
1527
                                default:
1528
                                begin
1529
                                        Inter_H_window_0_2 <= 0;Inter_H_window_1_2 <= 0;Inter_H_window_2_2 <= 0;
1530
                                        Inter_H_window_3_2 <= 0;Inter_H_window_4_2 <= 0;Inter_H_window_5_2 <= 0;
1531
 
1532
                                        Inter_H_window_0_3 <= 0;Inter_H_window_1_3 <= 0;Inter_H_window_2_3 <= 0;
1533
                                        Inter_H_window_3_3 <= 0;Inter_H_window_4_3 <= 0;Inter_H_window_5_3 <= 0;
1534
 
1535
                                        Inter_H_window_0_4 <= 0;Inter_H_window_1_4 <= 0;Inter_H_window_2_4 <= 0;
1536
                                        Inter_H_window_3_4 <= 0;Inter_H_window_4_4 <= 0;Inter_H_window_5_4 <= 0;
1537
 
1538
                                        Inter_H_window_0_5 <= 0;Inter_H_window_1_5 <= 0;Inter_H_window_2_5 <= 0;
1539
                                        Inter_H_window_3_5 <= 0;Inter_H_window_4_5 <= 0;Inter_H_window_5_5 <= 0;
1540
                                end
1541
                        endcase
1542
                        default:
1543
                        begin
1544
                                Inter_H_window_0_2 <= 0;Inter_H_window_1_2 <= 0;Inter_H_window_2_2 <= 0;
1545
                                Inter_H_window_3_2 <= 0;Inter_H_window_4_2 <= 0;Inter_H_window_5_2 <= 0;
1546
 
1547
                                Inter_H_window_0_3 <= 0;Inter_H_window_1_3 <= 0;Inter_H_window_2_3 <= 0;
1548
                                Inter_H_window_3_3 <= 0;Inter_H_window_4_3 <= 0;Inter_H_window_5_3 <= 0;
1549
 
1550
                                Inter_H_window_0_4 <= 0;Inter_H_window_1_4 <= 0;Inter_H_window_2_4 <= 0;
1551
                                Inter_H_window_3_4 <= 0;Inter_H_window_4_4 <= 0;Inter_H_window_5_4 <= 0;
1552
 
1553
                                Inter_H_window_0_5 <= 0;Inter_H_window_1_5 <= 0;Inter_H_window_2_5 <= 0;
1554
                                Inter_H_window_3_5 <= 0;Inter_H_window_4_5 <= 0;Inter_H_window_5_5 <= 0;
1555
                        end
1556
                endcase
1557
 
1558
        //Inter_V_window_counter:for Inter_V_window_0 ~ Inter_V_window_8
1559
        reg [2:0] Inter_V_window_counter;
1560
        always @ (pos_FracL or blk4x4_inter_calculate_counter)
1561
                if  (((pos_FracL == `pos_h || pos_FracL == `pos_d || pos_FracL == `pos_n || pos_FracL == `pos_e || pos_FracL == `pos_g
1562
                        || pos_FracL == `pos_p || pos_FracL == `pos_r) && blk4x4_inter_calculate_counter == 4'd4)       ||
1563
                        ((pos_FracL == `pos_i || pos_FracL == `pos_k) && blk4x4_inter_calculate_counter == 4'd8))
1564
                        Inter_V_window_counter <= 3'd4;
1565
                else if  (((pos_FracL == `pos_h || pos_FracL == `pos_d || pos_FracL == `pos_n || pos_FracL == `pos_e || pos_FracL == `pos_g
1566
                        || pos_FracL == `pos_p || pos_FracL == `pos_r) && blk4x4_inter_calculate_counter == 4'd3)       ||
1567
                        ((pos_FracL == `pos_i || pos_FracL == `pos_k) && blk4x4_inter_calculate_counter == 4'd6))
1568
                        Inter_V_window_counter <= 3'd3;
1569
                else if  (((pos_FracL == `pos_h || pos_FracL == `pos_d || pos_FracL == `pos_n || pos_FracL == `pos_e || pos_FracL == `pos_g
1570
                        || pos_FracL == `pos_p || pos_FracL == `pos_r) && blk4x4_inter_calculate_counter == 4'd2)       ||
1571
                        ((pos_FracL == `pos_i || pos_FracL == `pos_k) && blk4x4_inter_calculate_counter == 4'd4))
1572
                        Inter_V_window_counter <= 3'd2;
1573
                else if  (((pos_FracL == `pos_h || pos_FracL == `pos_d || pos_FracL == `pos_n || pos_FracL == `pos_e || pos_FracL == `pos_g
1574
                        || pos_FracL == `pos_p || pos_FracL == `pos_r) && blk4x4_inter_calculate_counter == 4'd1)       ||
1575
                        ((pos_FracL == `pos_i || pos_FracL == `pos_k) && blk4x4_inter_calculate_counter == 4'd2))
1576
                        Inter_V_window_counter <= 3'd1;
1577
                else
1578
                        Inter_V_window_counter <= 0;
1579
 
1580
        //Inter_V_window_0 ~ Inter_V_window_8
1581
        always @ (Is_blk4x4_0 or Is_blk4x4_1 or Is_blk4x4_2 or Is_blk4x4_3 or pos_FracL or Inter_V_window_counter
1582
                or Inter_ref_02_00 or Inter_ref_02_01 or Inter_ref_02_02 or Inter_ref_02_03 or Inter_ref_02_04
1583
                or Inter_ref_02_05 or Inter_ref_02_06 or Inter_ref_02_07 or Inter_ref_02_08 or Inter_ref_02_09
1584
                or Inter_ref_02_10 or Inter_ref_02_11 or Inter_ref_02_12
1585
 
1586
                or Inter_ref_03_00 or Inter_ref_03_01 or Inter_ref_03_02 or Inter_ref_03_03 or Inter_ref_03_04
1587
                or Inter_ref_03_05 or Inter_ref_03_06 or Inter_ref_03_07 or Inter_ref_03_08 or Inter_ref_03_09
1588
                or Inter_ref_03_10 or Inter_ref_03_11 or Inter_ref_03_12
1589
 
1590
                or Inter_ref_04_00 or Inter_ref_04_01 or Inter_ref_04_02 or Inter_ref_04_03 or Inter_ref_04_04
1591
                or Inter_ref_04_05 or Inter_ref_04_06 or Inter_ref_04_07 or Inter_ref_04_08 or Inter_ref_04_09
1592
                or Inter_ref_04_10 or Inter_ref_04_11 or Inter_ref_04_12
1593
 
1594
                or Inter_ref_05_00 or Inter_ref_05_01 or Inter_ref_05_02 or Inter_ref_05_03 or Inter_ref_05_04
1595
                or Inter_ref_05_05 or Inter_ref_05_06 or Inter_ref_05_07 or Inter_ref_05_08 or Inter_ref_05_09
1596
                or Inter_ref_05_10 or Inter_ref_05_11 or Inter_ref_05_12
1597
 
1598
                or Inter_ref_06_00 or Inter_ref_06_01 or Inter_ref_06_02 or Inter_ref_06_03 or Inter_ref_06_04
1599
                or Inter_ref_06_05 or Inter_ref_06_06 or Inter_ref_06_07 or Inter_ref_06_08 or Inter_ref_06_09
1600
                or Inter_ref_06_10 or Inter_ref_06_11 or Inter_ref_06_12
1601
 
1602
                or Inter_ref_07_00 or Inter_ref_07_01 or Inter_ref_07_02 or Inter_ref_07_03 or Inter_ref_07_04
1603
                or Inter_ref_07_05 or Inter_ref_07_06 or Inter_ref_07_07 or Inter_ref_07_08 or Inter_ref_07_09
1604
                or Inter_ref_07_10 or Inter_ref_07_11 or Inter_ref_07_12
1605
 
1606
                or Inter_ref_08_00 or Inter_ref_08_01 or Inter_ref_08_02 or Inter_ref_08_03 or Inter_ref_08_04
1607
                or Inter_ref_08_05 or Inter_ref_08_06 or Inter_ref_08_07 or Inter_ref_08_08 or Inter_ref_08_09
1608
                or Inter_ref_08_10 or Inter_ref_08_11 or Inter_ref_08_12
1609
 
1610
                or Inter_ref_09_00 or Inter_ref_09_01 or Inter_ref_09_02 or Inter_ref_09_03 or Inter_ref_09_04
1611
                or Inter_ref_09_05 or Inter_ref_09_06 or Inter_ref_09_07 or Inter_ref_09_08 or Inter_ref_09_09
1612
                or Inter_ref_09_10 or Inter_ref_09_11 or Inter_ref_09_12
1613
 
1614
                or Inter_ref_10_00 or Inter_ref_10_01 or Inter_ref_10_02 or Inter_ref_10_03 or Inter_ref_10_04
1615
                or Inter_ref_10_05 or Inter_ref_10_06 or Inter_ref_10_07 or Inter_ref_10_08 or Inter_ref_10_09
1616
                or Inter_ref_10_10 or Inter_ref_10_11 or Inter_ref_10_12
1617
                )
1618
                case ({Is_blk4x4_0,Is_blk4x4_1,Is_blk4x4_2,Is_blk4x4_3})
1619
                        4'b1000: //Left top blk4x4
1620
                        case (Inter_V_window_counter)
1621
                                3'd4:
1622
                                if (pos_FracL == `pos_g || pos_FracL == `pos_r || pos_FracL == `pos_k)
1623
                                        begin
1624
                                                Inter_V_window_0 <= Inter_ref_03_00;Inter_V_window_1 <= Inter_ref_03_01;
1625
                                                Inter_V_window_2 <= Inter_ref_03_02;Inter_V_window_3 <= Inter_ref_03_03;
1626
                                                Inter_V_window_4 <= Inter_ref_03_04;Inter_V_window_5 <= Inter_ref_03_05;
1627
                                                Inter_V_window_6 <= Inter_ref_03_06;Inter_V_window_7 <= Inter_ref_03_07;
1628
                                                Inter_V_window_8 <= Inter_ref_03_08;
1629
                                        end
1630
                                else
1631
                                        begin
1632
                                                Inter_V_window_0 <= Inter_ref_02_00;Inter_V_window_1 <= Inter_ref_02_01;
1633
                                                Inter_V_window_2 <= Inter_ref_02_02;Inter_V_window_3 <= Inter_ref_02_03;
1634
                                                Inter_V_window_4 <= Inter_ref_02_04;Inter_V_window_5 <= Inter_ref_02_05;
1635
                                                Inter_V_window_6 <= Inter_ref_02_06;Inter_V_window_7 <= Inter_ref_02_07;
1636
                                                Inter_V_window_8 <= Inter_ref_02_08;
1637
                                        end
1638
                                3'd3:
1639
                                if (pos_FracL == `pos_g || pos_FracL == `pos_r || pos_FracL == `pos_k)
1640
                                        begin
1641
                                                Inter_V_window_0 <= Inter_ref_04_00;Inter_V_window_1 <= Inter_ref_04_01;
1642
                                                Inter_V_window_2 <= Inter_ref_04_02;Inter_V_window_3 <= Inter_ref_04_03;
1643
                                                Inter_V_window_4 <= Inter_ref_04_04;Inter_V_window_5 <= Inter_ref_04_05;
1644
                                                Inter_V_window_6 <= Inter_ref_04_06;Inter_V_window_7 <= Inter_ref_04_07;
1645
                                                Inter_V_window_8 <= Inter_ref_04_08;
1646
                                        end
1647
                                else
1648
                                        begin
1649
                                                Inter_V_window_0 <= Inter_ref_03_00;Inter_V_window_1 <= Inter_ref_03_01;
1650
                                                Inter_V_window_2 <= Inter_ref_03_02;Inter_V_window_3 <= Inter_ref_03_03;
1651
                                                Inter_V_window_4 <= Inter_ref_03_04;Inter_V_window_5 <= Inter_ref_03_05;
1652
                                                Inter_V_window_6 <= Inter_ref_03_06;Inter_V_window_7 <= Inter_ref_03_07;
1653
                                                Inter_V_window_8 <= Inter_ref_03_08;
1654
                                        end
1655
                                3'd2:
1656
                                if (pos_FracL == `pos_g || pos_FracL == `pos_r || pos_FracL == `pos_k)
1657
                                        begin
1658
                                                Inter_V_window_0 <= Inter_ref_05_00;Inter_V_window_1 <= Inter_ref_05_01;
1659
                                                Inter_V_window_2 <= Inter_ref_05_02;Inter_V_window_3 <= Inter_ref_05_03;
1660
                                                Inter_V_window_4 <= Inter_ref_05_04;Inter_V_window_5 <= Inter_ref_05_05;
1661
                                                Inter_V_window_6 <= Inter_ref_05_06;Inter_V_window_7 <= Inter_ref_05_07;
1662
                                                Inter_V_window_8 <= Inter_ref_05_08;
1663
                                        end
1664
                                else
1665
                                        begin
1666
                                                Inter_V_window_0 <= Inter_ref_04_00;Inter_V_window_1 <= Inter_ref_04_01;
1667
                                                Inter_V_window_2 <= Inter_ref_04_02;Inter_V_window_3 <= Inter_ref_04_03;
1668
                                                Inter_V_window_4 <= Inter_ref_04_04;Inter_V_window_5 <= Inter_ref_04_05;
1669
                                                Inter_V_window_6 <= Inter_ref_04_06;Inter_V_window_7 <= Inter_ref_04_07;
1670
                                                Inter_V_window_8 <= Inter_ref_04_08;
1671
                                        end
1672
                                3'd1:
1673
                                if (pos_FracL == `pos_g || pos_FracL == `pos_r || pos_FracL == `pos_k)
1674
                                        begin
1675
                                                Inter_V_window_0 <= Inter_ref_06_00;Inter_V_window_1 <= Inter_ref_06_01;
1676
                                                Inter_V_window_2 <= Inter_ref_06_02;Inter_V_window_3 <= Inter_ref_06_03;
1677
                                                Inter_V_window_4 <= Inter_ref_06_04;Inter_V_window_5 <= Inter_ref_06_05;
1678
                                                Inter_V_window_6 <= Inter_ref_06_06;Inter_V_window_7 <= Inter_ref_06_07;
1679
                                                Inter_V_window_8 <= Inter_ref_06_08;
1680
                                        end
1681
                                else
1682
                                        begin
1683
                                                Inter_V_window_0 <= Inter_ref_05_00;Inter_V_window_1 <= Inter_ref_05_01;
1684
                                                Inter_V_window_2 <= Inter_ref_05_02;Inter_V_window_3 <= Inter_ref_05_03;
1685
                                                Inter_V_window_4 <= Inter_ref_05_04;Inter_V_window_5 <= Inter_ref_05_05;
1686
                                                Inter_V_window_6 <= Inter_ref_05_06;Inter_V_window_7 <= Inter_ref_05_07;
1687
                                                Inter_V_window_8 <= Inter_ref_05_08;
1688
                                        end
1689
                                default:
1690
                                begin
1691
                                        Inter_V_window_0 <= 0;Inter_V_window_1 <= 0;Inter_V_window_2 <= 0;
1692
                                        Inter_V_window_3 <= 0;Inter_V_window_4 <= 0;Inter_V_window_5 <= 0;
1693
                                        Inter_V_window_6 <= 0;Inter_V_window_7 <= 0;Inter_V_window_8 <= 0;
1694
                                end
1695
                        endcase
1696
                        4'b0100: //Right top blk4x4
1697
                        case (Inter_V_window_counter)
1698
                                3'd4:
1699
                                if (pos_FracL == `pos_g || pos_FracL == `pos_r || pos_FracL == `pos_k)
1700
                                        begin
1701
                                                Inter_V_window_0 <= Inter_ref_07_00;Inter_V_window_1 <= Inter_ref_07_01;
1702
                                                Inter_V_window_2 <= Inter_ref_07_02;Inter_V_window_3 <= Inter_ref_07_03;
1703
                                                Inter_V_window_4 <= Inter_ref_07_04;Inter_V_window_5 <= Inter_ref_07_05;
1704
                                                Inter_V_window_6 <= Inter_ref_07_06;Inter_V_window_7 <= Inter_ref_07_07;
1705
                                                Inter_V_window_8 <= Inter_ref_07_08;
1706
                                        end
1707
                                else
1708
                                        begin
1709
                                                Inter_V_window_0 <= Inter_ref_06_00;Inter_V_window_1 <= Inter_ref_06_01;
1710
                                                Inter_V_window_2 <= Inter_ref_06_02;Inter_V_window_3 <= Inter_ref_06_03;
1711
                                                Inter_V_window_4 <= Inter_ref_06_04;Inter_V_window_5 <= Inter_ref_06_05;
1712
                                                Inter_V_window_6 <= Inter_ref_06_06;Inter_V_window_7 <= Inter_ref_06_07;
1713
                                                Inter_V_window_8 <= Inter_ref_06_08;
1714
                                        end
1715
                                3'd3:
1716
                                if (pos_FracL == `pos_g || pos_FracL == `pos_r || pos_FracL == `pos_k)
1717
                                        begin
1718
                                                Inter_V_window_0 <= Inter_ref_08_00;Inter_V_window_1 <= Inter_ref_08_01;
1719
                                                Inter_V_window_2 <= Inter_ref_08_02;Inter_V_window_3 <= Inter_ref_08_03;
1720
                                                Inter_V_window_4 <= Inter_ref_08_04;Inter_V_window_5 <= Inter_ref_08_05;
1721
                                                Inter_V_window_6 <= Inter_ref_08_06;Inter_V_window_7 <= Inter_ref_08_07;
1722
                                                Inter_V_window_8 <= Inter_ref_08_08;
1723
                                        end
1724
                                else
1725
                                        begin
1726
                                                Inter_V_window_0 <= Inter_ref_07_00;Inter_V_window_1 <= Inter_ref_07_01;
1727
                                                Inter_V_window_2 <= Inter_ref_07_02;Inter_V_window_3 <= Inter_ref_07_03;
1728
                                                Inter_V_window_4 <= Inter_ref_07_04;Inter_V_window_5 <= Inter_ref_07_05;
1729
                                                Inter_V_window_6 <= Inter_ref_07_06;Inter_V_window_7 <= Inter_ref_07_07;
1730
                                                Inter_V_window_8 <= Inter_ref_07_08;
1731
                                        end
1732
                                3'd2:
1733
                                if (pos_FracL == `pos_g || pos_FracL == `pos_r || pos_FracL == `pos_k)
1734
                                        begin
1735
                                                Inter_V_window_0 <= Inter_ref_09_00;Inter_V_window_1 <= Inter_ref_09_01;
1736
                                                Inter_V_window_2 <= Inter_ref_09_02;Inter_V_window_3 <= Inter_ref_09_03;
1737
                                                Inter_V_window_4 <= Inter_ref_09_04;Inter_V_window_5 <= Inter_ref_09_05;
1738
                                                Inter_V_window_6 <= Inter_ref_09_06;Inter_V_window_7 <= Inter_ref_09_07;
1739
                                                Inter_V_window_8 <= Inter_ref_09_08;
1740
                                        end
1741
                                else
1742
                                        begin
1743
                                                Inter_V_window_0 <= Inter_ref_08_00;Inter_V_window_1 <= Inter_ref_08_01;
1744
                                                Inter_V_window_2 <= Inter_ref_08_02;Inter_V_window_3 <= Inter_ref_08_03;
1745
                                                Inter_V_window_4 <= Inter_ref_08_04;Inter_V_window_5 <= Inter_ref_08_05;
1746
                                                Inter_V_window_6 <= Inter_ref_08_06;Inter_V_window_7 <= Inter_ref_08_07;
1747
                                                Inter_V_window_8 <= Inter_ref_08_08;
1748
                                        end
1749
                                3'd1:
1750
                                if (pos_FracL == `pos_g || pos_FracL == `pos_r || pos_FracL == `pos_k)
1751
                                        begin
1752
                                                Inter_V_window_0 <= Inter_ref_10_00;Inter_V_window_1 <= Inter_ref_10_01;
1753
                                                Inter_V_window_2 <= Inter_ref_10_02;Inter_V_window_3 <= Inter_ref_10_03;
1754
                                                Inter_V_window_4 <= Inter_ref_10_04;Inter_V_window_5 <= Inter_ref_10_05;
1755
                                                Inter_V_window_6 <= Inter_ref_10_06;Inter_V_window_7 <= Inter_ref_10_07;
1756
                                                Inter_V_window_8 <= Inter_ref_10_08;
1757
                                        end
1758
                                else
1759
                                        begin
1760
                                                Inter_V_window_0 <= Inter_ref_09_00;Inter_V_window_1 <= Inter_ref_09_01;
1761
                                                Inter_V_window_2 <= Inter_ref_09_02;Inter_V_window_3 <= Inter_ref_09_03;
1762
                                                Inter_V_window_4 <= Inter_ref_09_04;Inter_V_window_5 <= Inter_ref_09_05;
1763
                                                Inter_V_window_6 <= Inter_ref_09_06;Inter_V_window_7 <= Inter_ref_09_07;
1764
                                                Inter_V_window_8 <= Inter_ref_09_08;
1765
                                        end
1766
                                default:
1767
                                begin
1768
                                        Inter_V_window_0 <= 0;Inter_V_window_1 <= 0;Inter_V_window_2 <= 0;
1769
                                        Inter_V_window_3 <= 0;Inter_V_window_4 <= 0;Inter_V_window_5 <= 0;
1770
                                        Inter_V_window_6 <= 0;Inter_V_window_7 <= 0;Inter_V_window_8 <= 0;
1771
                                end
1772
                        endcase
1773
                        4'b0010: //Left bottom blk4x4
1774
                        case (Inter_V_window_counter)
1775
                                3'd4:
1776
                                if (pos_FracL == `pos_g || pos_FracL == `pos_r || pos_FracL == `pos_k)
1777
                                        begin
1778
                                                Inter_V_window_0 <= Inter_ref_03_04;Inter_V_window_1 <= Inter_ref_03_05;
1779
                                                Inter_V_window_2 <= Inter_ref_03_06;Inter_V_window_3 <= Inter_ref_03_07;
1780
                                                Inter_V_window_4 <= Inter_ref_03_08;Inter_V_window_5 <= Inter_ref_03_09;
1781
                                                Inter_V_window_6 <= Inter_ref_03_10;Inter_V_window_7 <= Inter_ref_03_11;
1782
                                                Inter_V_window_8 <= Inter_ref_03_12;
1783
                                        end
1784
                                else
1785
                                        begin
1786
                                                Inter_V_window_0 <= Inter_ref_02_04;Inter_V_window_1 <= Inter_ref_02_05;
1787
                                                Inter_V_window_2 <= Inter_ref_02_06;Inter_V_window_3 <= Inter_ref_02_07;
1788
                                                Inter_V_window_4 <= Inter_ref_02_08;Inter_V_window_5 <= Inter_ref_02_09;
1789
                                                Inter_V_window_6 <= Inter_ref_02_10;Inter_V_window_7 <= Inter_ref_02_11;
1790
                                                Inter_V_window_8 <= Inter_ref_02_12;
1791
                                        end
1792
                                3'd3:
1793
                                if (pos_FracL == `pos_g || pos_FracL == `pos_r || pos_FracL == `pos_k)
1794
                                        begin
1795
                                                Inter_V_window_0 <= Inter_ref_04_04;Inter_V_window_1 <= Inter_ref_04_05;
1796
                                                Inter_V_window_2 <= Inter_ref_04_06;Inter_V_window_3 <= Inter_ref_04_07;
1797
                                                Inter_V_window_4 <= Inter_ref_04_08;Inter_V_window_5 <= Inter_ref_04_09;
1798
                                                Inter_V_window_6 <= Inter_ref_04_10;Inter_V_window_7 <= Inter_ref_04_11;
1799
                                                Inter_V_window_8 <= Inter_ref_04_12;
1800
                                        end
1801
                                else
1802
                                        begin
1803
                                                Inter_V_window_0 <= Inter_ref_03_04;Inter_V_window_1 <= Inter_ref_03_05;
1804
                                                Inter_V_window_2 <= Inter_ref_03_06;Inter_V_window_3 <= Inter_ref_03_07;
1805
                                                Inter_V_window_4 <= Inter_ref_03_08;Inter_V_window_5 <= Inter_ref_03_09;
1806
                                                Inter_V_window_6 <= Inter_ref_03_10;Inter_V_window_7 <= Inter_ref_03_11;
1807
                                                Inter_V_window_8 <= Inter_ref_03_12;
1808
                                        end
1809
                                3'd2:
1810
                                if (pos_FracL == `pos_g || pos_FracL == `pos_r || pos_FracL == `pos_k)
1811
                                        begin
1812
                                                Inter_V_window_0 <= Inter_ref_05_04;Inter_V_window_1 <= Inter_ref_05_05;
1813
                                                Inter_V_window_2 <= Inter_ref_05_06;Inter_V_window_3 <= Inter_ref_05_07;
1814
                                                Inter_V_window_4 <= Inter_ref_05_08;Inter_V_window_5 <= Inter_ref_05_09;
1815
                                                Inter_V_window_6 <= Inter_ref_05_10;Inter_V_window_7 <= Inter_ref_05_11;
1816
                                                Inter_V_window_8 <= Inter_ref_05_12;
1817
                                        end
1818
                                else
1819
                                        begin
1820
                                                Inter_V_window_0 <= Inter_ref_04_04;Inter_V_window_1 <= Inter_ref_04_05;
1821
                                                Inter_V_window_2 <= Inter_ref_04_06;Inter_V_window_3 <= Inter_ref_04_07;
1822
                                                Inter_V_window_4 <= Inter_ref_04_08;Inter_V_window_5 <= Inter_ref_04_09;
1823
                                                Inter_V_window_6 <= Inter_ref_04_10;Inter_V_window_7 <= Inter_ref_04_11;
1824
                                                Inter_V_window_8 <= Inter_ref_04_12;
1825
                                        end
1826
                                3'd1:
1827
                                if (pos_FracL == `pos_g || pos_FracL == `pos_r || pos_FracL == `pos_k)
1828
                                        begin
1829
                                                Inter_V_window_0 <= Inter_ref_06_04;Inter_V_window_1 <= Inter_ref_06_05;
1830
                                                Inter_V_window_2 <= Inter_ref_06_06;Inter_V_window_3 <= Inter_ref_06_07;
1831
                                                Inter_V_window_4 <= Inter_ref_06_08;Inter_V_window_5 <= Inter_ref_06_09;
1832
                                                Inter_V_window_6 <= Inter_ref_06_10;Inter_V_window_7 <= Inter_ref_06_11;
1833
                                                Inter_V_window_8 <= Inter_ref_06_12;
1834
                                        end
1835
                                else
1836
                                        begin
1837
                                                Inter_V_window_0 <= Inter_ref_05_04;Inter_V_window_1 <= Inter_ref_05_05;
1838
                                                Inter_V_window_2 <= Inter_ref_05_06;Inter_V_window_3 <= Inter_ref_05_07;
1839
                                                Inter_V_window_4 <= Inter_ref_05_08;Inter_V_window_5 <= Inter_ref_05_09;
1840
                                                Inter_V_window_6 <= Inter_ref_05_10;Inter_V_window_7 <= Inter_ref_05_11;
1841
                                                Inter_V_window_8 <= Inter_ref_05_12;
1842
                                        end
1843
                                default:
1844
                                begin
1845
                                        Inter_V_window_0 <= 0;Inter_V_window_1 <= 0;Inter_V_window_2 <= 0;
1846
                                        Inter_V_window_3 <= 0;Inter_V_window_4 <= 0;Inter_V_window_5 <= 0;
1847
                                        Inter_V_window_6 <= 0;Inter_V_window_7 <= 0;Inter_V_window_8 <= 0;
1848
                                end
1849
                        endcase
1850
                        4'b0001: //Right bottom blk4x4
1851
                        case (Inter_V_window_counter)
1852
                                3'd4:
1853
                                if (pos_FracL == `pos_g || pos_FracL == `pos_r || pos_FracL == `pos_k)
1854
                                        begin
1855
                                                Inter_V_window_0 <= Inter_ref_07_04;Inter_V_window_1 <= Inter_ref_07_05;
1856
                                                Inter_V_window_2 <= Inter_ref_07_06;Inter_V_window_3 <= Inter_ref_07_07;
1857
                                                Inter_V_window_4 <= Inter_ref_07_08;Inter_V_window_5 <= Inter_ref_07_09;
1858
                                                Inter_V_window_6 <= Inter_ref_07_10;Inter_V_window_7 <= Inter_ref_07_11;
1859
                                                Inter_V_window_8 <= Inter_ref_07_12;
1860
                                        end
1861
                                else
1862
                                        begin
1863
                                                Inter_V_window_0 <= Inter_ref_06_04;Inter_V_window_1 <= Inter_ref_06_05;
1864
                                                Inter_V_window_2 <= Inter_ref_06_06;Inter_V_window_3 <= Inter_ref_06_07;
1865
                                                Inter_V_window_4 <= Inter_ref_06_08;Inter_V_window_5 <= Inter_ref_06_09;
1866
                                                Inter_V_window_6 <= Inter_ref_06_10;Inter_V_window_7 <= Inter_ref_06_11;
1867
                                                Inter_V_window_8 <= Inter_ref_06_12;
1868
                                        end
1869
                                3'd3:
1870
                                if (pos_FracL == `pos_g || pos_FracL == `pos_r || pos_FracL == `pos_k)
1871
                                        begin
1872
                                                Inter_V_window_0 <= Inter_ref_08_04;Inter_V_window_1 <= Inter_ref_08_05;
1873
                                                Inter_V_window_2 <= Inter_ref_08_06;Inter_V_window_3 <= Inter_ref_08_07;
1874
                                                Inter_V_window_4 <= Inter_ref_08_08;Inter_V_window_5 <= Inter_ref_08_09;
1875
                                                Inter_V_window_6 <= Inter_ref_08_10;Inter_V_window_7 <= Inter_ref_08_11;
1876
                                                Inter_V_window_8 <= Inter_ref_08_12;
1877
                                        end
1878
                                else
1879
                                        begin
1880
                                                Inter_V_window_0 <= Inter_ref_07_04;Inter_V_window_1 <= Inter_ref_07_05;
1881
                                                Inter_V_window_2 <= Inter_ref_07_06;Inter_V_window_3 <= Inter_ref_07_07;
1882
                                                Inter_V_window_4 <= Inter_ref_07_08;Inter_V_window_5 <= Inter_ref_07_09;
1883
                                                Inter_V_window_6 <= Inter_ref_07_10;Inter_V_window_7 <= Inter_ref_07_11;
1884
                                                Inter_V_window_8 <= Inter_ref_07_12;
1885
                                        end
1886
                                3'd2:
1887
                                if (pos_FracL == `pos_g || pos_FracL == `pos_r || pos_FracL == `pos_k)
1888
                                        begin
1889
                                                Inter_V_window_0 <= Inter_ref_09_04;Inter_V_window_1 <= Inter_ref_09_05;
1890
                                                Inter_V_window_2 <= Inter_ref_09_06;Inter_V_window_3 <= Inter_ref_09_07;
1891
                                                Inter_V_window_4 <= Inter_ref_09_08;Inter_V_window_5 <= Inter_ref_09_09;
1892
                                                Inter_V_window_6 <= Inter_ref_09_10;Inter_V_window_7 <= Inter_ref_09_11;
1893
                                                Inter_V_window_8 <= Inter_ref_09_12;
1894
                                        end
1895
                                else
1896
                                        begin
1897
                                                Inter_V_window_0 <= Inter_ref_08_04;Inter_V_window_1 <= Inter_ref_08_05;
1898
                                                Inter_V_window_2 <= Inter_ref_08_06;Inter_V_window_3 <= Inter_ref_08_07;
1899
                                                Inter_V_window_4 <= Inter_ref_08_08;Inter_V_window_5 <= Inter_ref_08_09;
1900
                                                Inter_V_window_6 <= Inter_ref_08_10;Inter_V_window_7 <= Inter_ref_08_11;
1901
                                                Inter_V_window_8 <= Inter_ref_08_12;
1902
                                        end
1903
                                3'd1:
1904
                                if (pos_FracL == `pos_g || pos_FracL == `pos_r || pos_FracL == `pos_k)
1905
                                        begin
1906
                                                Inter_V_window_0 <= Inter_ref_10_04;Inter_V_window_1 <= Inter_ref_10_05;
1907
                                                Inter_V_window_2 <= Inter_ref_10_06;Inter_V_window_3 <= Inter_ref_10_07;
1908
                                                Inter_V_window_4 <= Inter_ref_10_08;Inter_V_window_5 <= Inter_ref_10_09;
1909
                                                Inter_V_window_6 <= Inter_ref_10_10;Inter_V_window_7 <= Inter_ref_10_11;
1910
                                                Inter_V_window_8 <= Inter_ref_10_12;
1911
                                        end
1912
                                else
1913
                                        begin
1914
                                                Inter_V_window_0 <= Inter_ref_09_04;Inter_V_window_1 <= Inter_ref_09_05;
1915
                                                Inter_V_window_2 <= Inter_ref_09_06;Inter_V_window_3 <= Inter_ref_09_07;
1916
                                                Inter_V_window_4 <= Inter_ref_09_08;Inter_V_window_5 <= Inter_ref_09_09;
1917
                                                Inter_V_window_6 <= Inter_ref_09_10;Inter_V_window_7 <= Inter_ref_09_11;
1918
                                                Inter_V_window_8 <= Inter_ref_09_12;
1919
                                        end
1920
                                default:
1921
                                begin
1922
                                        Inter_V_window_0 <= 0;Inter_V_window_1 <= 0;Inter_V_window_2 <= 0;
1923
                                        Inter_V_window_3 <= 0;Inter_V_window_4 <= 0;Inter_V_window_5 <= 0;
1924
                                        Inter_V_window_6 <= 0;Inter_V_window_7 <= 0;Inter_V_window_8 <= 0;
1925
                                end
1926
                        endcase
1927
                        default:
1928
                        begin
1929
                                Inter_V_window_0 <= 0;Inter_V_window_1 <= 0;Inter_V_window_2 <= 0;
1930
                                Inter_V_window_3 <= 0;Inter_V_window_4 <= 0;Inter_V_window_5 <= 0;
1931
                                Inter_V_window_6 <= 0;Inter_V_window_7 <= 0;Inter_V_window_8 <= 0;
1932
                        end
1933
                endcase
1934
 
1935
        //Luma bilinear window
1936
        always @ (Is_blk4x4_0 or Is_blk4x4_1 or Is_blk4x4_2 or Is_blk4x4_3 or pos_FracL or blk4x4_inter_calculate_counter
1937
                or Inter_ref_02_02 or Inter_ref_03_02 or Inter_ref_04_02 or Inter_ref_05_02 or Inter_ref_06_02
1938
                or Inter_ref_07_02 or Inter_ref_08_02 or Inter_ref_09_02 or Inter_ref_10_02
1939
                or Inter_ref_02_03 or Inter_ref_03_03 or Inter_ref_04_03 or Inter_ref_05_03 or Inter_ref_06_03
1940
                or Inter_ref_07_03 or Inter_ref_08_03 or Inter_ref_09_03 or Inter_ref_10_03
1941
                or Inter_ref_02_04 or Inter_ref_03_04 or Inter_ref_04_04 or Inter_ref_05_04 or Inter_ref_06_04
1942
                or Inter_ref_07_04 or Inter_ref_08_04 or Inter_ref_09_04 or Inter_ref_10_04
1943
                or Inter_ref_02_05 or Inter_ref_03_05 or Inter_ref_04_05 or Inter_ref_05_05 or Inter_ref_06_05
1944
                or Inter_ref_07_05 or Inter_ref_08_05 or Inter_ref_09_05 or Inter_ref_10_05
1945
                or Inter_ref_02_06 or Inter_ref_03_06 or Inter_ref_04_06 or Inter_ref_05_06 or Inter_ref_06_06
1946
                or Inter_ref_07_06 or Inter_ref_08_06 or Inter_ref_09_06 or Inter_ref_10_06
1947
                or Inter_ref_02_07 or Inter_ref_03_07 or Inter_ref_04_07 or Inter_ref_05_07 or Inter_ref_06_07
1948
                or Inter_ref_07_07 or Inter_ref_08_07 or Inter_ref_09_07 or Inter_ref_10_07
1949
                or Inter_ref_02_08 or Inter_ref_03_08 or Inter_ref_04_08 or Inter_ref_05_08 or Inter_ref_06_08
1950
                or Inter_ref_07_08 or Inter_ref_08_08 or Inter_ref_09_08 or Inter_ref_10_08
1951
                or Inter_ref_02_09 or Inter_ref_03_09 or Inter_ref_04_09 or Inter_ref_05_09 or Inter_ref_06_09
1952
                or Inter_ref_07_09 or Inter_ref_08_09 or Inter_ref_09_09 or Inter_ref_10_09
1953
                or Inter_ref_02_10 or Inter_ref_03_10 or Inter_ref_04_10 or Inter_ref_05_10 or Inter_ref_06_10
1954
                or Inter_ref_07_10 or Inter_ref_08_10 or Inter_ref_09_10)
1955
                case ({Is_blk4x4_0,Is_blk4x4_1,Is_blk4x4_2,Is_blk4x4_3})
1956
                        4'b1000: //Left top blk4x4
1957
                        case (pos_FracL)
1958
                                pos_a,pos_d:
1959
                                case (blk4x4_inter_calculate_counter)
1960
                                        4'd4:begin      Inter_bi_window_0 <= Inter_ref_02_02;Inter_bi_window_1 <= Inter_ref_02_03;
1961
                                                                Inter_bi_window_2 <= Inter_ref_02_04;Inter_bi_window_3 <= Inter_ref_02_05;      end
1962
                                        4'd3:begin      Inter_bi_window_0 <= Inter_ref_03_02;Inter_bi_window_1 <= Inter_ref_03_03;
1963
                                                                Inter_bi_window_2 <= Inter_ref_03_04;Inter_bi_window_3 <= Inter_ref_03_05;      end
1964
                                        4'd2:begin      Inter_bi_window_0 <= Inter_ref_04_02;Inter_bi_window_1 <= Inter_ref_04_03;
1965
                                                                Inter_bi_window_2 <= Inter_ref_04_04;Inter_bi_window_3 <= Inter_ref_04_05;      end
1966
                                        4'd1:begin      Inter_bi_window_0 <= Inter_ref_05_02;Inter_bi_window_1 <= Inter_ref_05_03;
1967
                                                                Inter_bi_window_2 <= Inter_ref_05_04;Inter_bi_window_3 <= Inter_ref_05_05;      end
1968
                                        default:begin   Inter_bi_window_0 <= 0;Inter_bi_window_1 <= 0;
1969
                                                                        Inter_bi_window_2 <= 0;Inter_bi_window_3 <= 0;    end
1970
                                endcase
1971
                                pos_c:
1972
                                case (blk4x4_inter_calculate_counter)
1973
                                        4'd4:begin      Inter_bi_window_0 <= Inter_ref_03_02;Inter_bi_window_1 <= Inter_ref_03_03;
1974
                                                                Inter_bi_window_2 <= Inter_ref_03_04;Inter_bi_window_3 <= Inter_ref_03_05;      end
1975
                                        4'd3:begin      Inter_bi_window_0 <= Inter_ref_04_02;Inter_bi_window_1 <= Inter_ref_04_03;
1976
                                                                Inter_bi_window_2 <= Inter_ref_04_04;Inter_bi_window_3 <= Inter_ref_04_05;      end
1977
                                        4'd2:begin      Inter_bi_window_0 <= Inter_ref_05_02;Inter_bi_window_1 <= Inter_ref_05_03;
1978
                                                                Inter_bi_window_2 <= Inter_ref_05_04;Inter_bi_window_3 <= Inter_ref_05_05;      end
1979
                                        4'd1:begin      Inter_bi_window_0 <= Inter_ref_06_02;Inter_bi_window_1 <= Inter_ref_06_03;
1980
                                                                Inter_bi_window_2 <= Inter_ref_06_04;Inter_bi_window_3 <= Inter_ref_06_05;      end
1981
                                        default:begin   Inter_bi_window_0 <= 0;Inter_bi_window_1 <= 0;
1982
                                                                        Inter_bi_window_2 <= 0;Inter_bi_window_3 <= 0;    end
1983
                                endcase
1984
                                pos_n:
1985
                                case (blk4x4_inter_calculate_counter)
1986
                                        4'd4:begin      Inter_bi_window_0 <= Inter_ref_02_03;Inter_bi_window_1 <= Inter_ref_02_04;
1987
                                                                Inter_bi_window_2 <= Inter_ref_02_05;Inter_bi_window_3 <= Inter_ref_02_06;      end
1988
                                        4'd3:begin      Inter_bi_window_0 <= Inter_ref_03_03;Inter_bi_window_1 <= Inter_ref_03_04;
1989
                                                                Inter_bi_window_2 <= Inter_ref_03_05;Inter_bi_window_3 <= Inter_ref_03_06;      end
1990
                                        4'd2:begin      Inter_bi_window_0 <= Inter_ref_04_03;Inter_bi_window_1 <= Inter_ref_04_04;
1991
                                                                Inter_bi_window_2 <= Inter_ref_04_05;Inter_bi_window_3 <= Inter_ref_04_06;      end
1992
                                        4'd1:begin      Inter_bi_window_0 <= Inter_ref_05_03;Inter_bi_window_1 <= Inter_ref_05_04;
1993
                                                                Inter_bi_window_2 <= Inter_ref_05_05;Inter_bi_window_3 <= Inter_ref_05_06;      end
1994
                                        default:begin   Inter_bi_window_0 <= 0;Inter_bi_window_1 <= 0;
1995
                                                                        Inter_bi_window_2 <= 0;Inter_bi_window_3 <= 0;    end
1996
                                endcase
1997
                                default:
1998
                                begin   Inter_bi_window_0 <= 0;Inter_bi_window_1 <= 0;
1999
                                                Inter_bi_window_2 <= 0;Inter_bi_window_3 <= 0;    end
2000
                        endcase
2001
                        4'b0100: //Right top blk4x4
2002
                        case (pos_FracL)
2003
                                pos_a,pos_d:
2004
                                case (blk4x4_inter_calculate_counter)
2005
                                        4'd4:begin      Inter_bi_window_0 <= Inter_ref_06_02;Inter_bi_window_1 <= Inter_ref_06_03;
2006
                                                                Inter_bi_window_2 <= Inter_ref_06_04;Inter_bi_window_3 <= Inter_ref_06_05;      end
2007
                                        4'd3:begin      Inter_bi_window_0 <= Inter_ref_07_02;Inter_bi_window_1 <= Inter_ref_07_03;
2008
                                                                Inter_bi_window_2 <= Inter_ref_07_04;Inter_bi_window_3 <= Inter_ref_07_05;      end
2009
                                        4'd2:begin      Inter_bi_window_0 <= Inter_ref_08_02;Inter_bi_window_1 <= Inter_ref_08_03;
2010
                                                                Inter_bi_window_2 <= Inter_ref_08_04;Inter_bi_window_3 <= Inter_ref_08_05;      end
2011
                                        4'd1:begin      Inter_bi_window_0 <= Inter_ref_09_02;Inter_bi_window_1 <= Inter_ref_09_03;
2012
                                                                Inter_bi_window_2 <= Inter_ref_09_04;Inter_bi_window_3 <= Inter_ref_09_05;      end
2013
                                        default:begin   Inter_bi_window_0 <= 0;Inter_bi_window_1 <= 0;
2014
                                                                        Inter_bi_window_2 <= 0;Inter_bi_window_3 <= 0;    end
2015
                                endcase
2016
                                pos_c:
2017
                                case (blk4x4_inter_calculate_counter)
2018
                                        4'd4:begin      Inter_bi_window_0 <= Inter_ref_07_02;Inter_bi_window_1 <= Inter_ref_07_03;
2019
                                                                Inter_bi_window_2 <= Inter_ref_07_04;Inter_bi_window_3 <= Inter_ref_07_05;      end
2020
                                        4'd3:begin      Inter_bi_window_0 <= Inter_ref_08_02;Inter_bi_window_1 <= Inter_ref_08_03;
2021
                                                                Inter_bi_window_2 <= Inter_ref_08_04;Inter_bi_window_3 <= Inter_ref_08_05;      end
2022
                                        4'd2:begin      Inter_bi_window_0 <= Inter_ref_09_02;Inter_bi_window_1 <= Inter_ref_09_03;
2023
                                                                Inter_bi_window_2 <= Inter_ref_09_04;Inter_bi_window_3 <= Inter_ref_09_05;      end
2024
                                        4'd1:begin      Inter_bi_window_0 <= Inter_ref_10_02;Inter_bi_window_1 <= Inter_ref_10_03;
2025
                                                                Inter_bi_window_2 <= Inter_ref_10_04;Inter_bi_window_3 <= Inter_ref_10_05;      end
2026
                                        default:begin   Inter_bi_window_0 <= 0;Inter_bi_window_1 <= 0;
2027
                                                                        Inter_bi_window_2 <= 0;Inter_bi_window_3 <= 0;    end
2028
                                endcase
2029
                                pos_n:
2030
                                case (blk4x4_inter_calculate_counter)
2031
                                        4'd4:begin      Inter_bi_window_0 <= Inter_ref_06_03;Inter_bi_window_1 <= Inter_ref_06_04;
2032
                                                                Inter_bi_window_2 <= Inter_ref_06_05;Inter_bi_window_3 <= Inter_ref_06_06;      end
2033
                                        4'd3:begin      Inter_bi_window_0 <= Inter_ref_07_03;Inter_bi_window_1 <= Inter_ref_07_04;
2034
                                                                Inter_bi_window_2 <= Inter_ref_07_05;Inter_bi_window_3 <= Inter_ref_07_06;      end
2035
                                        4'd2:begin      Inter_bi_window_0 <= Inter_ref_08_03;Inter_bi_window_1 <= Inter_ref_08_04;
2036
                                                                Inter_bi_window_2 <= Inter_ref_08_05;Inter_bi_window_3 <= Inter_ref_08_06;      end
2037
                                        4'd1:begin      Inter_bi_window_0 <= Inter_ref_09_03;Inter_bi_window_1 <= Inter_ref_09_04;
2038
                                                                Inter_bi_window_2 <= Inter_ref_09_05;Inter_bi_window_3 <= Inter_ref_09_06;      end
2039
                                        default:begin   Inter_bi_window_0 <= 0;Inter_bi_window_1 <= 0;
2040
                                                                        Inter_bi_window_2 <= 0;Inter_bi_window_3 <= 0;    end
2041
                                endcase
2042
                                default:
2043
                                begin   Inter_bi_window_0 <= 0;Inter_bi_window_1 <= 0;
2044
                                                Inter_bi_window_2 <= 0;Inter_bi_window_3 <= 0;    end
2045
                        endcase
2046
                        4'b0010: //Left bottom blk4x4
2047
                        case (pos_FracL)
2048
                                pos_a,pos_d:
2049
                                case (blk4x4_inter_calculate_counter)
2050
                                        4'd4:begin      Inter_bi_window_0 <= Inter_ref_02_06;Inter_bi_window_1 <= Inter_ref_02_07;
2051
                                                                Inter_bi_window_2 <= Inter_ref_02_08;Inter_bi_window_3 <= Inter_ref_02_09;      end
2052
                                        4'd3:begin      Inter_bi_window_0 <= Inter_ref_03_06;Inter_bi_window_1 <= Inter_ref_03_07;
2053
                                                                Inter_bi_window_2 <= Inter_ref_03_08;Inter_bi_window_3 <= Inter_ref_03_09;      end
2054
                                        4'd2:begin      Inter_bi_window_0 <= Inter_ref_04_06;Inter_bi_window_1 <= Inter_ref_04_07;
2055
                                                                Inter_bi_window_2 <= Inter_ref_04_08;Inter_bi_window_3 <= Inter_ref_04_09;      end
2056
                                        4'd1:begin      Inter_bi_window_0 <= Inter_ref_05_06;Inter_bi_window_1 <= Inter_ref_05_07;
2057
                                                                Inter_bi_window_2 <= Inter_ref_05_08;Inter_bi_window_3 <= Inter_ref_05_09;      end
2058
                                        default:begin   Inter_bi_window_0 <= 0;Inter_bi_window_1 <= 0;
2059
                                                                        Inter_bi_window_2 <= 0;Inter_bi_window_3 <= 0;    end
2060
                                endcase
2061
                                pos_c:
2062
                                case (blk4x4_inter_calculate_counter)
2063
                                        4'd4:begin      Inter_bi_window_0 <= Inter_ref_03_06;Inter_bi_window_1 <= Inter_ref_03_07;
2064
                                                                Inter_bi_window_2 <= Inter_ref_03_08;Inter_bi_window_3 <= Inter_ref_03_09;      end
2065
                                        4'd3:begin      Inter_bi_window_0 <= Inter_ref_04_06;Inter_bi_window_1 <= Inter_ref_04_07;
2066
                                                                Inter_bi_window_2 <= Inter_ref_04_08;Inter_bi_window_3 <= Inter_ref_04_09;      end
2067
                                        4'd2:begin      Inter_bi_window_0 <= Inter_ref_05_06;Inter_bi_window_1 <= Inter_ref_05_07;
2068
                                                                Inter_bi_window_2 <= Inter_ref_05_08;Inter_bi_window_3 <= Inter_ref_05_09;      end
2069
                                        4'd1:begin      Inter_bi_window_0 <= Inter_ref_06_06;Inter_bi_window_1 <= Inter_ref_06_07;
2070
                                                                Inter_bi_window_2 <= Inter_ref_06_08;Inter_bi_window_3 <= Inter_ref_06_09;      end
2071
                                        default:begin   Inter_bi_window_0 <= 0;Inter_bi_window_1 <= 0;
2072
                                                                        Inter_bi_window_2 <= 0;Inter_bi_window_3 <= 0;    end
2073
                                endcase
2074
                                pos_n:
2075
                                case (blk4x4_inter_calculate_counter)
2076
                                        4'd4:begin      Inter_bi_window_0 <= Inter_ref_02_07;Inter_bi_window_1 <= Inter_ref_02_08;
2077
                                                                Inter_bi_window_2 <= Inter_ref_02_09;Inter_bi_window_3 <= Inter_ref_02_10;      end
2078
                                        4'd3:begin      Inter_bi_window_0 <= Inter_ref_03_07;Inter_bi_window_1 <= Inter_ref_03_08;
2079
                                                                Inter_bi_window_2 <= Inter_ref_03_09;Inter_bi_window_3 <= Inter_ref_03_10;      end
2080
                                        4'd2:begin      Inter_bi_window_0 <= Inter_ref_04_07;Inter_bi_window_1 <= Inter_ref_04_08;
2081
                                                                Inter_bi_window_2 <= Inter_ref_04_09;Inter_bi_window_3 <= Inter_ref_04_10;      end
2082
                                        4'd1:begin      Inter_bi_window_0 <= Inter_ref_05_07;Inter_bi_window_1 <= Inter_ref_05_08;
2083
                                                                Inter_bi_window_2 <= Inter_ref_05_09;Inter_bi_window_3 <= Inter_ref_05_10;      end
2084
                                        default:begin   Inter_bi_window_0 <= 0;Inter_bi_window_1 <= 0;
2085
                                                                        Inter_bi_window_2 <= 0;Inter_bi_window_3 <= 0;    end
2086
                                endcase
2087
                                default:
2088
                                begin   Inter_bi_window_0 <= 0;Inter_bi_window_1 <= 0;
2089
                                                Inter_bi_window_2 <= 0;Inter_bi_window_3 <= 0;    end
2090
                        endcase
2091
                        4'b0001: //Right bottom blk4x4
2092
                        case (pos_FracL)
2093
                                pos_a,pos_d:
2094
                                case (blk4x4_inter_calculate_counter)
2095
                                        4'd4:begin      Inter_bi_window_0 <= Inter_ref_06_06;Inter_bi_window_1 <= Inter_ref_06_07;
2096
                                                                Inter_bi_window_2 <= Inter_ref_06_08;Inter_bi_window_3 <= Inter_ref_06_09;      end
2097
                                        4'd3:begin      Inter_bi_window_0 <= Inter_ref_07_06;Inter_bi_window_1 <= Inter_ref_07_07;
2098
                                                                Inter_bi_window_2 <= Inter_ref_07_08;Inter_bi_window_3 <= Inter_ref_07_09;      end
2099
                                        4'd2:begin      Inter_bi_window_0 <= Inter_ref_08_06;Inter_bi_window_1 <= Inter_ref_08_07;
2100
                                                                Inter_bi_window_2 <= Inter_ref_08_08;Inter_bi_window_3 <= Inter_ref_08_09;      end
2101
                                        4'd1:begin      Inter_bi_window_0 <= Inter_ref_09_06;Inter_bi_window_1 <= Inter_ref_09_07;
2102
                                                                Inter_bi_window_2 <= Inter_ref_09_08;Inter_bi_window_3 <= Inter_ref_09_09;      end
2103
                                        default:begin   Inter_bi_window_0 <= 0;Inter_bi_window_1 <= 0;
2104
                                                                        Inter_bi_window_2 <= 0;Inter_bi_window_3 <= 0;    end
2105
                                endcase
2106
                                pos_c:
2107
                                case (blk4x4_inter_calculate_counter)
2108
                                        4'd4:begin      Inter_bi_window_0 <= Inter_ref_07_06;Inter_bi_window_1 <= Inter_ref_07_07;
2109
                                                                Inter_bi_window_2 <= Inter_ref_07_08;Inter_bi_window_3 <= Inter_ref_07_09;      end
2110
                                        4'd3:begin      Inter_bi_window_0 <= Inter_ref_08_06;Inter_bi_window_1 <= Inter_ref_08_07;
2111
                                                                Inter_bi_window_2 <= Inter_ref_08_08;Inter_bi_window_3 <= Inter_ref_08_09;      end
2112
                                        4'd2:begin      Inter_bi_window_0 <= Inter_ref_09_06;Inter_bi_window_1 <= Inter_ref_09_07;
2113
                                                                Inter_bi_window_2 <= Inter_ref_09_08;Inter_bi_window_3 <= Inter_ref_09_09;      end
2114
                                        4'd1:begin      Inter_bi_window_0 <= Inter_ref_10_06;Inter_bi_window_1 <= Inter_ref_10_07;
2115
                                                                Inter_bi_window_2 <= Inter_ref_10_08;Inter_bi_window_3 <= Inter_ref_10_09;      end
2116
                                        default:begin   Inter_bi_window_0 <= 0;Inter_bi_window_1 <= 0;
2117
                                                                        Inter_bi_window_2 <= 0;Inter_bi_window_3 <= 0;    end
2118
                                endcase
2119
                                pos_n:
2120
                                case (blk4x4_inter_calculate_counter)
2121
                                        4'd4:begin      Inter_bi_window_0 <= Inter_ref_06_07;Inter_bi_window_1 <= Inter_ref_06_08;
2122
                                                                Inter_bi_window_2 <= Inter_ref_06_09;Inter_bi_window_3 <= Inter_ref_06_10;      end
2123
                                        4'd3:begin      Inter_bi_window_0 <= Inter_ref_07_07;Inter_bi_window_1 <= Inter_ref_07_08;
2124
                                                                Inter_bi_window_2 <= Inter_ref_07_09;Inter_bi_window_3 <= Inter_ref_07_10;      end
2125
                                        4'd2:begin      Inter_bi_window_0 <= Inter_ref_08_07;Inter_bi_window_1 <= Inter_ref_08_08;
2126
                                                                Inter_bi_window_2 <= Inter_ref_08_09;Inter_bi_window_3 <= Inter_ref_08_10;      end
2127
                                        4'd1:begin      Inter_bi_window_0 <= Inter_ref_09_07;Inter_bi_window_1 <= Inter_ref_09_08;
2128
                                                                Inter_bi_window_2 <= Inter_ref_09_09;Inter_bi_window_3 <= Inter_ref_09_10;      end
2129
                                        default:begin   Inter_bi_window_0 <= 0;Inter_bi_window_1 <= 0;
2130
                                                                        Inter_bi_window_2 <= 0;Inter_bi_window_3 <= 0;    end
2131
                                endcase
2132
                                default:
2133
                                begin   Inter_bi_window_0 <= 0;Inter_bi_window_1 <= 0;
2134
                                                Inter_bi_window_2 <= 0;Inter_bi_window_3 <= 0;    end
2135
                        endcase
2136
                        default:
2137
                        begin   Inter_bi_window_0 <= 0;Inter_bi_window_1 <= 0;
2138
                                        Inter_bi_window_2 <= 0;Inter_bi_window_3 <= 0;    end
2139
                endcase
2140
 
2141
        //chroma sliding window:Inter_C_window_0 ~ Inter_C_window_3 
2142
        always @ (IsInterChroma or blk4x4_inter_calculate_counter or mv_below8x8_curr
2143
                or Inter_ref_00_00 or Inter_ref_01_00 or Inter_ref_02_00 or Inter_ref_03_00 or Inter_ref_04_00
2144
                or Inter_ref_00_01 or Inter_ref_01_01 or Inter_ref_02_01 or Inter_ref_03_01 or Inter_ref_04_01
2145
                or Inter_ref_00_02 or Inter_ref_01_02 or Inter_ref_02_02 or Inter_ref_03_02 or Inter_ref_04_02
2146
                or Inter_ref_00_03 or Inter_ref_01_03 or Inter_ref_02_03 or Inter_ref_03_03 or Inter_ref_04_03
2147
                or Inter_ref_00_04 or Inter_ref_01_04 or Inter_ref_02_04 or Inter_ref_03_04 or Inter_ref_04_04
2148
                )
2149
                if (IsInterChroma && mv_below8x8_curr == 1'b0)
2150
                        case (blk4x4_inter_calculate_counter)
2151
                                4'd4:
2152
                                begin
2153
                                        Inter_C_window_0_0 <= Inter_ref_00_00; Inter_C_window_1_0 <= Inter_ref_01_00;
2154
                                        Inter_C_window_2_0 <= Inter_ref_02_00;
2155
                                        Inter_C_window_0_1 <= Inter_ref_00_01; Inter_C_window_1_1 <= Inter_ref_01_01;
2156
                                        Inter_C_window_2_1 <= Inter_ref_02_01;
2157
                                        Inter_C_window_0_2 <= Inter_ref_00_02; Inter_C_window_1_2 <= Inter_ref_01_02;
2158
                                        Inter_C_window_2_2 <= Inter_ref_02_02;
2159
                                end
2160
                                4'd3:
2161
                                begin
2162
                                        Inter_C_window_0_0 <= Inter_ref_02_00; Inter_C_window_1_0 <= Inter_ref_03_00;
2163
                                        Inter_C_window_2_0 <= Inter_ref_04_00;
2164
                                        Inter_C_window_0_1 <= Inter_ref_02_01; Inter_C_window_1_1 <= Inter_ref_03_01;
2165
                                        Inter_C_window_2_1 <= Inter_ref_04_01;
2166
                                        Inter_C_window_0_2 <= Inter_ref_02_02; Inter_C_window_1_2 <= Inter_ref_03_02;
2167
                                        Inter_C_window_2_2 <= Inter_ref_04_02;
2168
                                end
2169
                                4'd2:
2170
                                begin
2171
                                        Inter_C_window_0_0 <= Inter_ref_00_02; Inter_C_window_1_0 <= Inter_ref_01_02;
2172
                                        Inter_C_window_2_0 <= Inter_ref_02_02;
2173
                                        Inter_C_window_0_1 <= Inter_ref_00_03; Inter_C_window_1_1 <= Inter_ref_01_03;
2174
                                        Inter_C_window_2_1 <= Inter_ref_02_03;
2175
                                        Inter_C_window_0_2 <= Inter_ref_00_04; Inter_C_window_1_2 <= Inter_ref_01_04;
2176
                                        Inter_C_window_2_2 <= Inter_ref_02_04;
2177
                                end
2178
                                4'd1:
2179
                                begin
2180
                                        Inter_C_window_0_0 <= Inter_ref_02_02; Inter_C_window_1_0 <= Inter_ref_03_02;
2181
                                        Inter_C_window_2_0 <= Inter_ref_04_02;
2182
                                        Inter_C_window_0_1 <= Inter_ref_02_03; Inter_C_window_1_1 <= Inter_ref_03_03;
2183
                                        Inter_C_window_2_1 <= Inter_ref_04_03;
2184
                                        Inter_C_window_0_2 <= Inter_ref_02_04; Inter_C_window_1_2 <= Inter_ref_03_04;
2185
                                        Inter_C_window_2_2 <= Inter_ref_04_04;
2186
                                end
2187
                                default:
2188
                                begin
2189
                                        Inter_C_window_0_0 <= 0; Inter_C_window_1_0 <= 0;Inter_C_window_2_0 <= 0;
2190
                                        Inter_C_window_0_1 <= 0; Inter_C_window_1_1 <= 0;Inter_C_window_2_1 <= 0;
2191
                                        Inter_C_window_0_2 <= 0; Inter_C_window_1_2 <= 0;Inter_C_window_2_2 <= 0;
2192
                                end
2193
                        endcase
2194
                else if (IsInterChroma && mv_below8x8_curr == 1'b1)
2195
                        case (blk4x4_inter_calculate_counter)
2196
                                4'd1:
2197
                                begin
2198
                                        Inter_C_window_0_0 <= Inter_ref_00_00; Inter_C_window_1_0 <= Inter_ref_01_00;
2199
                                        Inter_C_window_2_0 <= Inter_ref_02_00;
2200
                                        Inter_C_window_0_1 <= Inter_ref_00_01; Inter_C_window_1_1 <= Inter_ref_01_01;
2201
                                        Inter_C_window_2_1 <= Inter_ref_02_01;
2202
                                        Inter_C_window_0_2 <= Inter_ref_00_02; Inter_C_window_1_2 <= Inter_ref_01_02;
2203
                                        Inter_C_window_2_2 <= Inter_ref_02_02;
2204
                                end
2205
                                default:
2206
                                begin
2207
                                        Inter_C_window_0_0 <= 0; Inter_C_window_1_0 <= 0;Inter_C_window_2_0 <= 0;
2208
                                        Inter_C_window_0_1 <= 0; Inter_C_window_1_1 <= 0;Inter_C_window_2_1 <= 0;
2209
                                        Inter_C_window_0_2 <= 0; Inter_C_window_1_2 <= 0;Inter_C_window_2_2 <= 0;
2210
                                end
2211
                        endcase
2212
                else
2213
                        begin
2214
                                Inter_C_window_0_0 <= 0; Inter_C_window_1_0 <= 0;Inter_C_window_2_0 <= 0;
2215
                                Inter_C_window_0_1 <= 0; Inter_C_window_1_1 <= 0;Inter_C_window_2_1 <= 0;
2216
                                Inter_C_window_0_2 <= 0; Inter_C_window_1_2 <= 0;Inter_C_window_2_2 <= 0;
2217
                        end
2218
 
2219
endmodule
2220
 
2221
 
2222
 
2223
 
2224
 
2225
 
2226
 
2227
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.