Line 26... |
Line 26... |
|
|
|
|
typedef enum
|
typedef enum
|
{
|
{
|
Passing, //not working on anything in particular
|
Passing, //not working on anything in particular
|
Initialize,
|
|
Horizontal,
|
Horizontal,
|
Cleanup,
|
Cleanup,
|
HorizontalCleanup,
|
HorizontalCleanup,
|
Vertical
|
Vertical
|
}
|
}
|
Line 485... |
Line 484... |
curr_qpy <= xdata.qpy;
|
curr_qpy <= xdata.qpy;
|
curr_qpc <= xdata.qpc;
|
curr_qpc <= xdata.qpc;
|
end
|
end
|
tagged PBbS .xdata :
|
tagged PBbS .xdata :
|
begin
|
begin
|
process <= Initialize;
|
$display( "TRACE Deblocking Filter: initialize %0d", currMb);
|
|
process <= Horizontal;
|
|
dataReqCount <= 1;
|
|
filterTopMbEdgeFlag <= !(currMb
|
|
filterLeftMbEdgeFlag <= !(currMbHor==0 || disable_deblocking_filter_idc==1 || (disable_deblocking_filter_idc==2 && currMb==firstMb));
|
|
filterInternalEdgesFlag <= !(disable_deblocking_filter_idc==1);
|
end
|
end
|
tagged PBoutput .xdata :
|
tagged PBoutput .xdata :
|
begin
|
begin
|
$display( "ERROR Deblocking Filter: passing PBoutput");
|
$display( "ERROR Deblocking Filter: passing PBoutput");
|
end
|
end
|
Line 523... |
Line 527... |
currMbVer <= currMbVer + 1;
|
currMbVer <= currMbVer + 1;
|
end
|
end
|
endrule
|
endrule
|
|
|
|
|
rule initialize ( process==Initialize && currMbHor
|
/* rule initialize ( process==Initialize && currMbHor
|
$display( "TRACE Deblocking Filter: initialize %0d", currMb);
|
$display( "TRACE Deblocking Filter: initialize %0d", currMb);
|
process <= Horizontal;
|
process <= Horizontal;
|
dataReqCount <= 1;
|
dataReqCount <= 1;
|
filterTopMbEdgeFlag <= !(currMb
|
filterTopMbEdgeFlag <= !(currMb
|
filterLeftMbEdgeFlag <= !(currMbHor==0 || disable_deblocking_filter_idc==1 || (disable_deblocking_filter_idc==2 && currMb==firstMb));
|
filterLeftMbEdgeFlag <= !(currMbHor==0 || disable_deblocking_filter_idc==1 || (disable_deblocking_filter_idc==2 && currMb==firstMb));
|
filterInternalEdgesFlag <= !(disable_deblocking_filter_idc==1);
|
filterInternalEdgesFlag <= !(disable_deblocking_filter_idc==1);
|
blockNum <= 0;
|
endrule */
|
pixelNum <= 0;
|
|
endrule
|
|
|
|
// no data comes through if we are on the top edge? kinda bogus
|
// no data comes through if we are on the top edge? kinda bogus
|
rule dataSendReq ( dataReqCount>0 && currMbHor
|
rule dataSendReq ( dataReqCount>0 && currMbHor
|
$display( "TRACE Deblocking Filter: dataSendReq %0d", dataReqCount);
|
$display( "TRACE Deblocking Filter: dataSendReq %0d", dataReqCount);
|
Bit#(PicWidthSz) temp = truncate(currMbHor);
|
Bit#(PicWidthSz) temp = truncate(currMbHor);
|
Line 550... |
Line 552... |
else
|
else
|
dataReqCount <= dataReqCount+1;
|
dataReqCount <= dataReqCount+1;
|
|
|
endrule
|
endrule
|
|
|
|
|
|
|
function Action deque(FIFO#(Bit#(32)) fifo);
|
function Action deque(FIFO#(Bit#(32)) fifo);
|
return fifo.deq();
|
return fifo.deq();
|
endfunction
|
endfunction
|
|
|
// rotate column to row major after applying the horizontal filter
|
// rotate column to row major after applying the horizontal filter
|
Line 606... |
Line 606... |
end
|
end
|
else // pass data along to vertical filter
|
else // pass data along to vertical filter
|
begin
|
begin
|
verticalFilterBlock.enq(tuple3(tpl_1(rowToColumnStoreBlock.first()),data_out,chromaFlag));
|
verticalFilterBlock.enq(tuple3(tpl_1(rowToColumnStoreBlock.first()),data_out,chromaFlag));
|
|
|
$display( "TRACE Deblocking Filter: rowToColumnRotate rotating block (%0d, %0d) rowtoColumnState: %d bottomRightBlock: %d, data: %h", blockHor, blockVer, rowToColumnState, storeBottomRightBlock, data_out);
|
$display( "TRACE Deblocking Filter: rowToColumnRotate rotating block (%0d, %0d) rowtoColumnState: %d chroma: %d bottomRightBlock: %d, data: %h", blockHor, blockVer, rowToColumnState, chromaFlag, storeBottomRightBlock, data_out);
|
end
|
end
|
endrule
|
endrule
|
|
|
|
|
|
// XXX need to pipeline through the chromaFlagVer... It's wrong here
|
// rotate row to column after applying the vertical filter
|
// rotate row to column after applying the vertical filter
|
rule columnToRowConversion;
|
rule columnToRowConversion;
|
Bit#(32) data_out = 0;
|
Bit#(32) data_out = 0;
|
Bool topValues = tpl_2(columnToRowStoreBlock.first()) == 1;
|
Bool topValues = tpl_2(columnToRowStoreBlock.first()) == 1;
|
Bit#(4) blockNumCols = tpl_1(columnToRowStoreBlock.first());
|
Bit#(4) blockNumCols = tpl_1(columnToRowStoreBlock.first());
|
Line 635... |
Line 637... |
2'b10: data_out = {(columnToRowStore[3].first())[23:16],
|
2'b10: data_out = {(columnToRowStore[3].first())[23:16],
|
(columnToRowStore[2].first())[23:16],
|
(columnToRowStore[2].first())[23:16],
|
(columnToRowStore[1].first())[23:16],
|
(columnToRowStore[1].first())[23:16],
|
(columnToRowStore[0].first())[23:16]};
|
(columnToRowStore[0].first())[23:16]};
|
2'b11: begin
|
2'b11: begin
|
|
|
data_out = {(columnToRowStore[3].first())[31:24],
|
data_out = {(columnToRowStore[3].first())[31:24],
|
(columnToRowStore[2].first())[31:24],
|
(columnToRowStore[2].first())[31:24],
|
(columnToRowStore[1].first())[31:24],
|
(columnToRowStore[1].first())[31:24],
|
(columnToRowStore[0].first())[31:24]};
|
(columnToRowStore[0].first())[31:24]};
|
mapM_(deque, columnToRowStore); // Deq the vector elements
|
mapM_(deque, columnToRowStore); // Deq the vector elements
|
Line 699... |
Line 702... |
$display( " Left Vector");
|
$display( " Left Vector");
|
if(chromaFlag==0)
|
if(chromaFlag==0)
|
begin
|
begin
|
if((blockVer == 3) && (columnToRowState == 3))
|
if((blockVer == 3) && (columnToRowState == 3))
|
begin
|
begin
|
process <= Initialize;
|
//process <= Initialize;
|
end
|
end
|
//check for last macro block
|
//check for last macro block
|
leftVector.upd({1'b0,blockVer,columnToRowState}, data_out);
|
leftVector.upd({1'b0,blockVer,columnToRowState}, data_out);
|
end
|
end
|
else
|
else
|
Line 897... |
Line 900... |
else
|
else
|
begin
|
begin
|
$display( "TRACE Deblocking Filter: horizontal completed Mb (%0d) Chroma", currMb);
|
$display( "TRACE Deblocking Filter: horizontal completed Mb (%0d) Chroma", currMb);
|
end
|
end
|
blockNum <= 0;
|
blockNum <= 0;
|
process <= Vertical;// we enter this state to wait for the vertical processing to complete
|
// process <= Vertical;// we enter this state to wait for the vertical processing to complete
|
if(chromaFlagHor == 1)
|
if(chromaFlagHor == 1)
|
begin
|
begin
|
chromaFlagHor <= 0;
|
chromaFlagHor <= 0;
|
|
process <= Vertical;
|
left_intra <= curr_intra;
|
left_intra <= curr_intra;
|
left_qpc <= curr_qpc;
|
left_qpc <= curr_qpc;
|
left_qpy <= curr_qpy;
|
left_qpy <= curr_qpy;
|
end
|
end
|
else
|
else
|
begin
|
begin
|
|
process <= Horizontal;
|
chromaFlagHor <= 1;
|
chromaFlagHor <= 1;
|
|
dataReqCount <= 1; // Do we want to start this early?
|
end
|
end
|
rowToColumnStoreBlock.enq(tuple3(blockNum,0,chromaFlagHor));
|
rowToColumnStoreBlock.enq(tuple3(blockNum,0,chromaFlagHor));
|
end
|
end
|
else if(pixelNum == 3)
|
else if(pixelNum == 3)
|
begin
|
begin
|
Line 923... |
Line 929... |
// push the correction into reorder block;
|
// push the correction into reorder block;
|
Bit#(32) work_data <- workVectorRows.sub({blockVer[0], pixelNum});
|
Bit#(32) work_data <- workVectorRows.sub({blockVer[0], pixelNum});
|
rowToColumnStore[pixelNum].enq(work_data);
|
rowToColumnStore[pixelNum].enq(work_data);
|
endrule
|
endrule
|
|
|
|
// XXX the block numbers coming out of rows to cols look wrong check em out.
|
|
|
// declare these to share the rule
|
// declare these to share the rule
|
begin
|
begin
|
Bit#(4) blockNumCols = tpl_1(verticalFilterBlock.first());
|
Bit#(4) blockNumCols = tpl_1(verticalFilterBlock.first());
|
Bit#(1) chromaFlag = tpl_3(verticalFilterBlock.first());
|
Bit#(1) chromaFlag = tpl_3(verticalFilterBlock.first());
|
Line 950... |
Line 957... |
|
|
rule infifos_full(dataMemRespQ.notEmpty() && parameterMemRespQ.notEmpty());
|
rule infifos_full(dataMemRespQ.notEmpty() && parameterMemRespQ.notEmpty());
|
$display("TRACE Deblocking Filter: vertical processing has data in the input queues");
|
$display("TRACE Deblocking Filter: vertical processing has data in the input queues");
|
endrule
|
endrule
|
|
|
|
rule infifos_mem(dataMemRespQ.notEmpty() );
|
|
$display("TRACE Deblocking Filter: vertical processing mem resp has data");
|
|
endrule
|
|
|
|
rule infifos_param(parameterMemRespQ.notEmpty());
|
|
$display("TRACE Deblocking Filter: vertical processing has mem parameter data");
|
|
endrule
|
|
|
rule vertFiltHead;
|
rule vertFiltHead;
|
$display("TRACE Deblocking Filter: verticalFilterHead: %h", verticalFilterBlock.first());
|
$display("TRACE Deblocking Filter: verticalFilterHead: %h", verticalFilterBlock.first());
|
endrule
|
endrule
|
|
|
|
|
Line 970... |
Line 985... |
Bit#(64) resultV = 0;
|
Bit#(64) resultV = 0;
|
Bit#(8) alpha;
|
Bit#(8) alpha;
|
Bit#(5) beta;
|
Bit#(5) beta;
|
Vector#(3,Bit#(5)) tc0;
|
Vector#(3,Bit#(5)) tc0;
|
|
|
|
|
$display( "TRACE Deblocking Filter: vertical subblock (%0d, %0d), chroma: %d, column: %d, data: %h", blockHor, blockVer, chromaFlag, columnNumber, workV);
|
$display( "TRACE Deblocking Filter: vertical subblock (%0d, %0d), chroma: %d, column: %d, data: %h", blockHor, blockVer, chromaFlag, columnNumber, workV);
|
columnNumber <= columnNumber + 1;
|
columnNumber <= columnNumber + 1;
|
chromaFlagVer <= chromaFlag;
|
chromaFlagVer <= chromaFlag;
|
verticalFilterBlock.deq();
|
verticalFilterBlock.deq();
|
if(topEdge)
|
if(topEdge)
|
Line 1000... |
Line 1014... |
Bit#(6) indexB = (indexBtemp[7]==1 ? 0 : (indexBtemp[6:0]>51 ? 51 : indexBtemp[5:0]));
|
Bit#(6) indexB = (indexBtemp[7]==1 ? 0 : (indexBtemp[6:0]>51 ? 51 : indexBtemp[5:0]));
|
Bit#(8) alphaMbTop = alpha_table[indexA];
|
Bit#(8) alphaMbTop = alpha_table[indexA];
|
Bit#(5) betaMbTop = beta_table[indexB];
|
Bit#(5) betaMbTop = beta_table[indexB];
|
Vector#(3,Bit#(5)) tc0MbTop = arrayToVector(tc0_table[indexA]);
|
Vector#(3,Bit#(5)) tc0MbTop = arrayToVector(tc0_table[indexA]);
|
tempV = xdata;
|
tempV = xdata;
|
|
$display("Trace Deblocking filter vertical memory resp deq");
|
dataMemRespQ.deq();
|
dataMemRespQ.deq();
|
$display( "TRACE Deblocking Filter: vertical P (top) addr %h, orig data %h ",{blockVer,columnNumber}, tempV);
|
$display( "TRACE Deblocking Filter: vertical P (top) addr %h, orig data %h ",{blockVer,columnNumber}, tempV);
|
alpha = alphaMbTop;
|
alpha = alphaMbTop;
|
beta = betaMbTop;
|
beta = betaMbTop;
|
tc0 = tc0MbTop;
|
tc0 = tc0MbTop;
|