OpenCores
URL https://opencores.org/ocsvn/bluespec-h264/bluespec-h264/trunk

Subversion Repositories bluespec-h264

[/] [bluespec-h264/] [trunk/] [release/] [mkDeblockFilter_dummy.bsv] - Blame information for rev 84

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 84 jamey.hick
//**********************************************************************
2
// Deblocking Filter
3
//----------------------------------------------------------------------
4
//
5
//
6
 
7
package mkDeblockFilter;
8
 
9
import H264Types::*;
10
 
11
import IDeblockFilter::*;
12
import FIFO::*;
13
import Vector::*;
14
 
15
import Connectable::*;
16
import GetPut::*;
17
import ClientServer::*;
18
 
19
 
20
 
21
 
22
//-----------------------------------------------------------
23
// Local Datatypes
24
//-----------------------------------------------------------
25
 
26
 
27
 
28
 
29
//-----------------------------------------------------------
30
// Helper functions
31
 
32
 
33
 
34
 
35
//-----------------------------------------------------------
36
// Deblocking Filter Module
37
//-----------------------------------------------------------
38
 
39
 
40
(* synthesize *)
41
module mkDeblockFilter( IDeblockFilter );
42
 
43
   FIFO#(EntropyDecOT) infifo     <- mkFIFO();
44
   FIFO#(DeblockFilterOT) outfifo <- mkFIFO();
45
 
46
   FIFO#(MemReq#(TAdd#(PicWidthSz,5),32)) dataMemReqQ       <- mkSizedFIFO(1);
47
   FIFO#(MemReq#(PicWidthSz,13))          parameterMemReqQ  <- mkSizedFIFO(1);
48
   FIFO#(MemResp#(32))                    dataMemRespQ      <- mkSizedFIFO(1);
49
   FIFO#(MemResp#(13))                    parameterMemRespQ <- mkSizedFIFO(1);
50
 
51
   Reg#(Bit#(1)) chromaFlag    <- mkReg(0);
52
   Reg#(Bit#(4)) blockNum      <- mkReg(0);
53
   Reg#(Bit#(4)) pixelNum      <- mkReg(0);
54
 
55
   Reg#(Bit#(PicWidthSz))  picWidth  <- mkReg(maxPicWidthInMB);
56
   Reg#(Bit#(PicHeightSz)) picHeight <- mkReg(0);
57
   Reg#(Bit#(PicAreaSz))   firstMb   <- mkReg(0);
58
   Reg#(Bit#(PicAreaSz))   currMb    <- mkReg(0);
59
   Reg#(Bit#(PicAreaSz))   currMbHor <- mkReg(0);//horizontal position of currMb
60
   Reg#(Bit#(PicHeightSz)) currMbVer <- mkReg(0);//vertical position of currMb
61
 
62
   Vector#(3,Reg#(Bit#(8)))   tempinput  <- replicateM(mkRegU);
63
 
64
   Reg#(Bool) endOfFrame <- mkReg(False);
65
 
66
 
67
   //-----------------------------------------------------------
68
   // Rules
69
 
70
   rule passing (currMbHor
71
      //$display( "Trace Deblocking Filter: passing infifo packed %h", pack(infifo.first()));
72
      case (infifo.first()) matches
73
         tagged NewUnit . xdata :
74
            begin
75
               infifo.deq();
76
               outfifo.enq(EDOT infifo.first());
77
               $display("ccl5newunit");
78
               $display("ccl5rbspbyte %h", xdata);
79
            end
80
         tagged SPSpic_width_in_mbs .xdata :
81
            begin
82
               infifo.deq();
83
               outfifo.enq(EDOT infifo.first());
84
               picWidth <= xdata;
85
            end
86
         tagged SPSpic_height_in_map_units .xdata :
87
            begin
88
               infifo.deq();
89
               outfifo.enq(EDOT infifo.first());
90
               picHeight <= xdata;
91
            end
92
         tagged SHfirst_mb_in_slice .xdata :
93
            begin
94
               infifo.deq();
95
               outfifo.enq(EDOT infifo.first());
96
               firstMb   <= xdata;
97
               currMb    <= xdata;
98
               currMbHor <= xdata;
99
               currMbVer <= 0;
100
            end
101
         tagged PBoutput .xdata :
102
            begin
103
               infifo.deq();
104
               Bit#(2) blockHor = {blockNum[2],blockNum[0]};
105
               Bit#(2) blockVer = {blockNum[3],blockNum[1]};
106
               Bit#(2) pixelHor = {pixelNum[1],pixelNum[0]};
107
               Bit#(2) pixelVer = {pixelNum[3],pixelNum[2]};
108
               Bit#(PicWidthSz) currMbHorT = truncate(currMbHor);
109
               Bit#(32) pixelq = {xdata[3],xdata[2],xdata[1],xdata[0]};
110
               if(chromaFlag==0)
111
                  outfifo.enq(DFBLuma {ver:{currMbVer,blockVer,pixelVer},hor:{currMbHorT,blockHor},data:pixelq});
112
               else
113
                  outfifo.enq(DFBChroma {uv:blockHor[1],ver:{currMbVer,blockVer[0],pixelVer},hor:{currMbHorT,blockHor[0]},data:pixelq});
114
               if(pixelNum == 12)
115
                  begin
116
                     pixelNum <= 0;
117
                     if(blockNum == 15)
118
                        begin
119
                           blockNum <= 0;
120
                           chromaFlag <= 1;
121
                        end
122
                     else if(blockNum==7 && chromaFlag==1)
123
                        begin
124
                           blockNum <= 0;
125
                           chromaFlag <= 0;
126
                           currMb <= currMb+1;
127
                           currMbHor <= currMbHor+1;
128
                           if(currMbVer==picHeight-1 && currMbHor==zeroExtend(picWidth-1))
129
                              endOfFrame <= True;
130
                        end
131
                     else
132
                        blockNum <= blockNum+1;
133
                  end
134
               else
135
                  pixelNum <= pixelNum+4;
136
               //$display( "Trace Deblocking Filter: passing PBoutput %h %h %h %h", blockNum, pixelNum, pixelHor, xdata);
137
            end
138
         tagged EndOfFile :
139
            begin
140
               infifo.deq();
141
               outfifo.enq(EDOT infifo.first());
142
               $display( "ccl5: EndOfFile reached");
143
               //$finish(0);
144
            end
145
         default:
146
            begin
147
               infifo.deq();
148
               outfifo.enq(EDOT infifo.first());
149
            end
150
      endcase
151
   endrule
152
 
153
 
154
   rule currMbHorUpdate( !(currMbHor
155
      Bit#(PicAreaSz) temp = zeroExtend(picWidth);
156
      if((currMbHor >> 3) >= temp)
157
         begin
158
            currMbHor <= currMbHor - (temp << 3);
159
            currMbVer <= currMbVer + 8;
160
         end
161
      else
162
         begin
163
            currMbHor <= currMbHor - temp;
164
            currMbVer <= currMbVer + 1;
165
         end
166
      //$display( "Trace Deblocking Filter: currMbHorUpdate %h %h", currMbHor, currMbVer);
167
   endrule
168
 
169
 
170
   rule outputEndOfFrame(endOfFrame);
171
      outfifo.enq(EndOfFrame);
172
      endOfFrame <= False;
173
      //$display( "Trace Deblocking Filter: outputEndOfFrame %h", pack(infifo.first()));
174
   endrule
175
 
176
 
177
   interface Client mem_client_data;
178
      interface Get request  = fifoToGet(dataMemReqQ);
179
      interface Put response = fifoToPut(dataMemRespQ);
180
   endinterface
181
 
182
   interface Client mem_client_parameter;
183
      interface Get request  = fifoToGet(parameterMemReqQ);
184
      interface Put response = fifoToPut(parameterMemRespQ);
185
   endinterface
186
 
187
   interface Put ioin  = fifoToPut(infifo);
188
   interface Get ioout = fifoToGet(outfifo);
189
 
190
endmodule
191
 
192
endpackage

powered by: WebSVN 2.1.0

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