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

Subversion Repositories nova

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 eexuke
//--------------------------------------------------------------------------------------------------
2
// Design    : nova
3
// Author(s) : Ke Xu
4
// Email           : eexuke@yahoo.com
5
// File      : CodedBlockPattern_decoding.v
6
// Generated : June 5,2005
7
// Copyright (C) 2008 Ke Xu                
8
//-------------------------------------------------------------------------------------------------
9
// Description 
10
// Decoding CodedBlockPatternLuma & CodedBlockPatternChroma (Table9-4 Page156 of H.264/AVC standard 2003)
11
//-------------------------------------------------------------------------------------------------
12
 
13
// synopsys translate_off
14
`include "timescale.v"
15
// synopsys translate_on
16
`include "nova_defines.v"
17
 
18
module CodedBlockPattern_decoding (clk,reset_n,slice_data_state,slice_type,mb_type,mb_type_general,
19
        exp_golomb_decoding_output_5to0,CodedBlockPatternLuma,CodedBlockPatternChroma);
20
        input clk,reset_n;
21
        input [3:0] slice_data_state;
22
        input [2:0] slice_type;
23
        input [4:0] mb_type;
24
        input [3:0] mb_type_general;
25
        input [5:0] exp_golomb_decoding_output_5to0;
26
        output [3:0] CodedBlockPatternLuma;
27
        output [1:0] CodedBlockPatternChroma;
28
        reg [3:0] CodedBlockPatternLuma;
29
        reg [1:0] CodedBlockPatternChroma;
30
 
31
        reg [3:0] CodedBlockPatternLuma_reg;
32
        reg [1:0] CodedBlockPatternChroma_reg;
33
 
34
        always @ (posedge clk)
35
                CodedBlockPatternLuma_reg <= (reset_n == 0)? 0:CodedBlockPatternLuma;
36
        always @ (posedge clk)
37
                CodedBlockPatternChroma_reg <= (reset_n == 0)? 0:CodedBlockPatternChroma;
38
 
39
        always @ (slice_data_state or mb_type_general or slice_type or mb_type or exp_golomb_decoding_output_5to0
40
                or CodedBlockPatternLuma_reg)
41
                if (mb_type_general[3:2] == 2'b10)//Intra16x16
42
                        begin
43
                                if (slice_type == 0 || slice_type == 5) //P_slice
44
                                        CodedBlockPatternLuma <= (mb_type < 18)? 4'd0:4'd15;
45
                                else    //I_slice
46
                                        CodedBlockPatternLuma <= (mb_type < 13)? 4'd0:4'd15;
47
                        end
48
                else if (slice_data_state == `coded_block_pattern_s)
49
                        case (mb_type_general[3])
50
                                1'b0:   //Inter
51
                                if (exp_golomb_decoding_output_5to0 < 2)        //CBP = 0,16
52
                                        CodedBlockPatternLuma <= 0;
53
                                else if (exp_golomb_decoding_output_5to0 < 6) //CBP =1,2,4,8
54
                                        case (exp_golomb_decoding_output_5to0[2:0])
55
                                                3'b010:CodedBlockPatternLuma <= 4'd1;
56
                                                3'b011:CodedBlockPatternLuma <= 4'd2;
57
                                                3'b100:CodedBlockPatternLuma <= 4'd4;
58
                                                3'b101:CodedBlockPatternLuma <= 4'd8;
59
                                                default:CodedBlockPatternLuma <= CodedBlockPatternLuma_reg;
60
                                        endcase
61
                                else
62
                                        case (exp_golomb_decoding_output_5to0)
63
                                                6       :CodedBlockPatternLuma <= 4'd0;
64
                                                24,32   :CodedBlockPatternLuma <= 4'd1;
65
                                                25,33   :CodedBlockPatternLuma <= 4'd2;
66
                                                7,20,36 :CodedBlockPatternLuma <= 4'd3;
67
                                                26,34   :CodedBlockPatternLuma <= 4'd4;
68
                                                8,21,37 :CodedBlockPatternLuma <= 4'd5;
69
                                                17,44,46:CodedBlockPatternLuma <= 4'd6;
70
                                                13,28,40:CodedBlockPatternLuma <= 4'd7;
71
                                                27,35   :CodedBlockPatternLuma <= 4'd8;
72
                                                18,45,47:CodedBlockPatternLuma <= 4'd9;
73
                                                9,22,38 :CodedBlockPatternLuma <= 4'd10;
74
                                                14,29,41:CodedBlockPatternLuma <= 4'd11;
75
                                                10,23,39:CodedBlockPatternLuma <= 4'd12;
76
                                                15,30,42:CodedBlockPatternLuma <= 4'd13;
77
                                                16,31,43:CodedBlockPatternLuma <= 4'd14;
78
                                                11,12,19:CodedBlockPatternLuma <= 4'd15;
79
                                                default :CodedBlockPatternLuma <= CodedBlockPatternLuma_reg;
80
                                        endcase
81
                                1'b1:   //Intra4x4
82
                                if (exp_golomb_decoding_output_5to0 < 3)        //CBP = 47,31,15
83
                                        CodedBlockPatternLuma <= 4'd15;
84
                                else
85
                                        case (exp_golomb_decoding_output_5to0)
86
                                                3,16,41 :CodedBlockPatternLuma <= 4'd0;
87
                                                29,33,42:CodedBlockPatternLuma <= 4'd1;
88
                                                30,34,43:CodedBlockPatternLuma <= 4'd2;
89
                                                17,21,25:CodedBlockPatternLuma <= 4'd3;
90
                                                31,35,44:CodedBlockPatternLuma <= 4'd4;
91
                                                18,22,26:CodedBlockPatternLuma <= 4'd5;
92
                                                37,39,46:CodedBlockPatternLuma <= 4'd6;
93
                                                4,8,12  :CodedBlockPatternLuma <= 4'd7;
94
                                                32,36,45:CodedBlockPatternLuma <= 4'd8;
95
                                                38,40,47:CodedBlockPatternLuma <= 4'd9;
96
                                                19,23,27:CodedBlockPatternLuma <= 4'd10;
97
                                                5,9,13  :CodedBlockPatternLuma <= 4'd11;
98
                                                20,24,28:CodedBlockPatternLuma <= 4'd12;
99
                                                6,10,14 :CodedBlockPatternLuma <= 4'd13;
100
                                                7,11,15 :CodedBlockPatternLuma <= 4'd14;
101
                                                default :CodedBlockPatternLuma <= CodedBlockPatternLuma_reg;
102
                                        endcase
103
                        endcase
104
                else
105
                        CodedBlockPatternLuma <= CodedBlockPatternLuma_reg;
106
 
107
 
108
        always @ (slice_data_state or mb_type_general or exp_golomb_decoding_output_5to0 or CodedBlockPatternChroma_reg)
109
                if (mb_type_general[3:2] == 2'b10)//Intra16x16
110
                        CodedBlockPatternChroma <= mb_type_general[1:0];
111
                else if (slice_data_state == `coded_block_pattern_s)
112
                        case (mb_type_general[3])
113
                                1'b0:   //Inter 
114
                                if (exp_golomb_decoding_output_5to0 < 2)        //CBP = 0,16
115
                                        CodedBlockPatternChroma <= {1'b0,exp_golomb_decoding_output_5to0[0]};
116
                                else if (exp_golomb_decoding_output_5to0 < 6) //CBP =1,2,4,8
117
                                        CodedBlockPatternChroma <= 2'd0;
118
                                else
119
                                        case (exp_golomb_decoding_output_5to0)
120
                                                7,8,9,10,11,13,14,15,16,17,18               :CodedBlockPatternChroma <= 2'd0;
121
                                                19,32,33,34,35,36,37,38,39,40,41,42,43,44,45:CodedBlockPatternChroma <= 2'd1;
122
                                                default                                     :CodedBlockPatternChroma <= 2'd2;
123
                                        endcase
124
                                1'b1:   //Intra4x4
125
                                if (exp_golomb_decoding_output_5to0 < 3)        //CBP = 47,31,15
126
                                        case (exp_golomb_decoding_output_5to0[1:0])
127
                                                2'b00  :CodedBlockPatternChroma <= 2'd2;
128
                                                2'b01  :CodedBlockPatternChroma <= 2'd1;
129
                                                default:CodedBlockPatternChroma <= 2'd0;
130
                                        endcase
131
                                else
132
                                        case (exp_golomb_decoding_output_5to0)
133
                                                3,8,9,10,11,17,18,19,20,29,30,31,32,37,38:CodedBlockPatternChroma <= 2'd0;
134
                                                4,5,6,7,16,21,22,23,24,33,34,35,36,39,40 :CodedBlockPatternChroma <= 2'd1;
135
                                                default                                                                  :CodedBlockPatternChroma <= 2'd2;
136
                                        endcase
137
                        endcase
138
                else
139
                        CodedBlockPatternChroma <= CodedBlockPatternChroma_reg;
140
 
141
endmodule
142
 
143
 
144
 
145
 
146
 
147
 
148
 
149
 
150
 
151
 
152
 
153
 
154
 
155
 
156
 
157
 

powered by: WebSVN 2.1.0

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