HEVC Test Model (HM)  HM-16.3
TComLoopFilter.cpp
Go to the documentation of this file.
1 /* The copyright in this software is being made available under the BSD
2  * License, included below. This software may be subject to other third party
3  * and contributor rights, including patent rights, and no such rights are
4  * granted under this license.
5  *
6  * Copyright (c) 2010-2015, ITU/ISO/IEC
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
18  * be used to endorse or promote products derived from this software without
19  * specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31  * THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
38 #include "TComLoopFilter.h"
39 #include "TComSlice.h"
40 #include "TComMv.h"
41 #include "TComTU.h"
42 
45 
46 // ====================================================================================================================
47 // Constants
48 // ====================================================================================================================
49 
50 //#define EDGE_VER 0
51 //#define EDGE_HOR 1
52 
53 #define DEFAULT_INTRA_TC_OFFSET 2
54 
55 // ====================================================================================================================
56 // Tables
57 // ====================================================================================================================
58 
60 {
61  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,5,5,6,6,7,8,9,10,11,13,14,16,18,20,22,24
62 };
63 
65 {
66  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64
67 };
68 
69 // ====================================================================================================================
70 // Constructor / destructor / create / destroy
71 // ====================================================================================================================
72 
74 : m_uiNumPartitions(0)
75 , m_bLFCrossTileBoundary(true)
76 {
77  for( Int edgeDir = 0; edgeDir < NUM_EDGE_DIR; edgeDir++ )
78  {
79  m_aapucBS [edgeDir] = NULL;
80  m_aapbEdgeFilter[edgeDir] = NULL;
81  }
82 }
83 
85 {
86 }
87 
88 // ====================================================================================================================
89 // Public member functions
90 // ====================================================================================================================
91 Void TComLoopFilter::setCfg( Bool bLFCrossTileBoundary )
92 {
93  m_bLFCrossTileBoundary = bLFCrossTileBoundary;
94 }
95 
97 {
98  destroy();
99  m_uiNumPartitions = 1 << ( uiMaxCUDepth<<1 );
100  for( Int edgeDir = 0; edgeDir < NUM_EDGE_DIR; edgeDir++ )
101  {
102  m_aapucBS [edgeDir] = new UChar[m_uiNumPartitions];
103  m_aapbEdgeFilter[edgeDir] = new Bool [m_uiNumPartitions];
104  }
105 }
106 
108 {
109  for( Int edgeDir = 0; edgeDir < NUM_EDGE_DIR; edgeDir++ )
110  {
111  if (m_aapucBS[edgeDir] != NULL)
112  {
113  delete [] m_aapucBS[edgeDir];
114  m_aapucBS[edgeDir] = NULL;
115  }
116 
117  if (m_aapbEdgeFilter[edgeDir])
118  {
119  delete [] m_aapbEdgeFilter[edgeDir];
120  m_aapbEdgeFilter[edgeDir] = NULL;
121  }
122  }
123 }
124 
131 {
132  // Horizontal filtering
133  for ( UInt ctuRsAddr = 0; ctuRsAddr < pcPic->getNumberOfCtusInFrame(); ctuRsAddr++ )
134  {
135  TComDataCU* pCtu = pcPic->getCtu( ctuRsAddr );
136 
137  ::memset( m_aapucBS [EDGE_VER], 0, sizeof( UChar ) * m_uiNumPartitions );
138  ::memset( m_aapbEdgeFilter[EDGE_VER], 0, sizeof( Bool ) * m_uiNumPartitions );
139 
140  // CU-based deblocking
141  xDeblockCU( pCtu, 0, 0, EDGE_VER );
142  }
143 
144  // Vertical filtering
145  for ( UInt ctuRsAddr = 0; ctuRsAddr < pcPic->getNumberOfCtusInFrame(); ctuRsAddr++ )
146  {
147  TComDataCU* pCtu = pcPic->getCtu( ctuRsAddr );
148 
149  ::memset( m_aapucBS [EDGE_HOR], 0, sizeof( UChar ) * m_uiNumPartitions );
150  ::memset( m_aapbEdgeFilter[EDGE_HOR], 0, sizeof( Bool ) * m_uiNumPartitions );
151 
152  // CU-based deblocking
153  xDeblockCU( pCtu, 0, 0, EDGE_HOR );
154  }
155 }
156 
157 
158 // ====================================================================================================================
159 // Protected member functions
160 // ====================================================================================================================
161 
170 Void TComLoopFilter::xDeblockCU( TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, DeblockEdgeDir edgeDir )
171 {
172  if(pcCU->getPic()==0||pcCU->getPartitionSize(uiAbsZorderIdx)==NUMBER_OF_PART_SIZES)
173  {
174  return;
175  }
176  TComPic* pcPic = pcCU->getPic();
177  UInt uiCurNumParts = pcPic->getNumPartitionsInCtu() >> (uiDepth<<1);
178  UInt uiQNumParts = uiCurNumParts>>2;
179 
180  if( pcCU->getDepth(uiAbsZorderIdx) > uiDepth )
181  {
182  for ( UInt uiPartIdx = 0; uiPartIdx < 4; uiPartIdx++, uiAbsZorderIdx+=uiQNumParts )
183  {
184  UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsZorderIdx] ];
185  UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsZorderIdx] ];
186  if( ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) )
187  {
188  xDeblockCU( pcCU, uiAbsZorderIdx, uiDepth+1, edgeDir );
189  }
190  }
191  return;
192  }
193 
194  xSetLoopfilterParam( pcCU, uiAbsZorderIdx );
195  TComTURecurse tuRecurse(pcCU, uiAbsZorderIdx);
196  xSetEdgefilterTU ( tuRecurse );
197  xSetEdgefilterPU ( pcCU, uiAbsZorderIdx );
198 
199  for( UInt uiPartIdx = uiAbsZorderIdx; uiPartIdx < uiAbsZorderIdx + uiCurNumParts; uiPartIdx++ )
200  {
201  UInt uiBSCheck;
202  if( (g_uiMaxCUWidth >> g_uiMaxCUDepth) == 4 )
203  {
204  uiBSCheck = (edgeDir == EDGE_VER && uiPartIdx%2 == 0) || (edgeDir == EDGE_HOR && (uiPartIdx-((uiPartIdx>>2)<<2))/2 == 0);
205  }
206  else
207  {
208  uiBSCheck = 1;
209  }
210 
211  if ( m_aapbEdgeFilter[edgeDir][uiPartIdx] && uiBSCheck )
212  {
213  xGetBoundaryStrengthSingle ( pcCU, edgeDir, uiPartIdx );
214  }
215  }
216 
217  UInt uiPelsInPart = g_uiMaxCUWidth >> g_uiMaxCUDepth;
218  UInt PartIdxIncr = DEBLOCK_SMALLEST_BLOCK / uiPelsInPart ? DEBLOCK_SMALLEST_BLOCK / uiPelsInPart : 1 ;
219 
220  UInt uiSizeInPU = pcPic->getNumPartInCtuWidth()>>(uiDepth);
221  const ChromaFormat chFmt=pcPic->getChromaFormat();
222  const UInt shiftFactor = edgeDir == EDGE_VER ? pcPic->getComponentScaleX(COMPONENT_Cb) : pcPic->getComponentScaleY(COMPONENT_Cb);
223  const Bool bAlwaysDoChroma=chFmt==CHROMA_444;
224 
225  for ( Int iEdge = 0; iEdge < uiSizeInPU ; iEdge+=PartIdxIncr)
226  {
227  xEdgeFilterLuma ( pcCU, uiAbsZorderIdx, uiDepth, edgeDir, iEdge );
228  if ( chFmt!=CHROMA_400 && (bAlwaysDoChroma ||
229  (uiPelsInPart>DEBLOCK_SMALLEST_BLOCK) ||
230  (iEdge % ( (DEBLOCK_SMALLEST_BLOCK<<shiftFactor)/uiPelsInPart ) ) == 0
231  )
232  )
233  {
234  xEdgeFilterChroma ( pcCU, uiAbsZorderIdx, uiDepth, edgeDir, iEdge );
235  }
236  }
237 }
238 
240  UInt uiAbsZorderIdx,
241  UInt uiDepth,
242  DeblockEdgeDir edgeDir,
243  Int iEdgeIdx,
244  Bool bValue,
245  UInt uiWidthInBaseUnits,
246  UInt uiHeightInBaseUnits,
247  const TComRectangle *rect)
248 {
249  if ( uiWidthInBaseUnits == 0 )
250  {
251  uiWidthInBaseUnits = pcCU->getPic()->getNumPartInCtuWidth () >> uiDepth;
252  }
253  if ( uiHeightInBaseUnits == 0 )
254  {
255  uiHeightInBaseUnits = pcCU->getPic()->getNumPartInCtuHeight() >> uiDepth;
256  }
257  const UInt uiNumElem = edgeDir == EDGE_VER ? uiHeightInBaseUnits : uiWidthInBaseUnits;
258  assert( uiNumElem > 0 );
259  assert( uiWidthInBaseUnits > 0 );
260  assert( uiHeightInBaseUnits > 0 );
261  for( UInt ui = 0; ui < uiNumElem; ui++ )
262  {
263  const UInt uiBsIdx = xCalcBsIdx( pcCU, uiAbsZorderIdx, edgeDir, iEdgeIdx, ui, rect );
264  m_aapbEdgeFilter[edgeDir][uiBsIdx] = bValue;
265  if (iEdgeIdx == 0)
266  {
267  m_aapucBS[edgeDir][uiBsIdx] = bValue;
268  }
269  }
270 }
271 
273 {
274  TComDataCU* pcCU = rTu.getCU();
275  UInt uiTransDepthTotal = rTu.GetTransformDepthTotal();
276 
277  if( pcCU->getTransformIdx( rTu.GetAbsPartIdxTU() ) + pcCU->getDepth( rTu.GetAbsPartIdxTU()) > uiTransDepthTotal )
278  {
279  TComTURecurse tuChild(rTu, false);
280  do
281  {
282  xSetEdgefilterTU( tuChild );
283  } while (tuChild.nextSection(rTu));
284  return;
285  }
286 
287  const TComRectangle &rect = rTu.getRect(COMPONENT_Y);
288 
289  const UInt uiWidthInBaseUnits = rect.width / (g_uiMaxCUWidth >> g_uiMaxCUDepth);
290  const UInt uiHeightInBaseUnits = rect.height / (g_uiMaxCUWidth >> g_uiMaxCUDepth);
291 
292  xSetEdgefilterMultiple( pcCU, rTu.GetAbsPartIdxCU(), uiTransDepthTotal, EDGE_VER, 0, m_stLFCUParam.bInternalEdge, uiWidthInBaseUnits, uiHeightInBaseUnits, &rect );
293  xSetEdgefilterMultiple( pcCU, rTu.GetAbsPartIdxCU(), uiTransDepthTotal, EDGE_HOR, 0, m_stLFCUParam.bInternalEdge, uiWidthInBaseUnits, uiHeightInBaseUnits, &rect );
294 }
295 
297 {
298  const UInt uiDepth = pcCU->getDepth( uiAbsZorderIdx );
299  const UInt uiWidthInBaseUnits = pcCU->getPic()->getNumPartInCtuWidth () >> uiDepth;
300  const UInt uiHeightInBaseUnits = pcCU->getPic()->getNumPartInCtuHeight() >> uiDepth;
301  const UInt uiHWidthInBaseUnits = uiWidthInBaseUnits >> 1;
302  const UInt uiHHeightInBaseUnits = uiHeightInBaseUnits >> 1;
303  const UInt uiQWidthInBaseUnits = uiWidthInBaseUnits >> 2;
304  const UInt uiQHeightInBaseUnits = uiHeightInBaseUnits >> 2;
305 
306  xSetEdgefilterMultiple( pcCU, uiAbsZorderIdx, uiDepth, EDGE_VER, 0, m_stLFCUParam.bLeftEdge );
307  xSetEdgefilterMultiple( pcCU, uiAbsZorderIdx, uiDepth, EDGE_HOR, 0, m_stLFCUParam.bTopEdge );
308 
309  switch ( pcCU->getPartitionSize( uiAbsZorderIdx ) )
310  {
311  case SIZE_2Nx2N:
312  {
313  break;
314  }
315  case SIZE_2NxN:
316  {
317  xSetEdgefilterMultiple( pcCU, uiAbsZorderIdx, uiDepth, EDGE_HOR, uiHHeightInBaseUnits, m_stLFCUParam.bInternalEdge );
318  break;
319  }
320  case SIZE_Nx2N:
321  {
322  xSetEdgefilterMultiple( pcCU, uiAbsZorderIdx, uiDepth, EDGE_VER, uiHWidthInBaseUnits, m_stLFCUParam.bInternalEdge );
323  break;
324  }
325  case SIZE_NxN:
326  {
327  xSetEdgefilterMultiple( pcCU, uiAbsZorderIdx, uiDepth, EDGE_VER, uiHWidthInBaseUnits, m_stLFCUParam.bInternalEdge );
328  xSetEdgefilterMultiple( pcCU, uiAbsZorderIdx, uiDepth, EDGE_HOR, uiHHeightInBaseUnits, m_stLFCUParam.bInternalEdge );
329  break;
330  }
331  case SIZE_2NxnU:
332  {
333  xSetEdgefilterMultiple( pcCU, uiAbsZorderIdx, uiDepth, EDGE_HOR, uiQHeightInBaseUnits, m_stLFCUParam.bInternalEdge );
334  break;
335  }
336  case SIZE_2NxnD:
337  {
338  xSetEdgefilterMultiple( pcCU, uiAbsZorderIdx, uiDepth, EDGE_HOR, uiHeightInBaseUnits - uiQHeightInBaseUnits, m_stLFCUParam.bInternalEdge );
339  break;
340  }
341  case SIZE_nLx2N:
342  {
343  xSetEdgefilterMultiple( pcCU, uiAbsZorderIdx, uiDepth, EDGE_VER, uiQWidthInBaseUnits, m_stLFCUParam.bInternalEdge );
344  break;
345  }
346  case SIZE_nRx2N:
347  {
348  xSetEdgefilterMultiple( pcCU, uiAbsZorderIdx, uiDepth, EDGE_VER, uiWidthInBaseUnits - uiQWidthInBaseUnits, m_stLFCUParam.bInternalEdge );
349  break;
350  }
351  default:
352  {
353  break;
354  }
355  }
356 }
357 
358 
360 {
361  UInt uiX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsZorderIdx ] ];
362  UInt uiY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsZorderIdx ] ];
363 
364  TComDataCU* pcTempCU;
365  UInt uiTempPartIdx;
366 
368 
369  if ( (uiX == 0) || pcCU->getSlice()->getDeblockingFilterDisable() )
370  {
371  m_stLFCUParam.bLeftEdge = false;
372  }
373  else
374  {
375  m_stLFCUParam.bLeftEdge = true;
376  }
377  if ( m_stLFCUParam.bLeftEdge )
378  {
379  pcTempCU = pcCU->getPULeft( uiTempPartIdx, uiAbsZorderIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), !m_bLFCrossTileBoundary);
380 
381  if ( pcTempCU != NULL )
382  {
383  m_stLFCUParam.bLeftEdge = true;
384  }
385  else
386  {
387  m_stLFCUParam.bLeftEdge = false;
388  }
389  }
390 
391  if ( (uiY == 0 ) || pcCU->getSlice()->getDeblockingFilterDisable() )
392  {
393  m_stLFCUParam.bTopEdge = false;
394  }
395  else
396  {
397  m_stLFCUParam.bTopEdge = true;
398  }
399  if ( m_stLFCUParam.bTopEdge )
400  {
401  pcTempCU = pcCU->getPUAbove( uiTempPartIdx, uiAbsZorderIdx, !pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary);
402 
403  if ( pcTempCU != NULL )
404  {
405  m_stLFCUParam.bTopEdge = true;
406  }
407  else
408  {
409  m_stLFCUParam.bTopEdge = false;
410  }
411  }
412 }
413 
414 Void TComLoopFilter::xGetBoundaryStrengthSingle ( TComDataCU* pCtu, DeblockEdgeDir edgeDir, UInt uiAbsPartIdx4x4BlockWithinCtu )
415 {
416  TComSlice * const pcSlice = pCtu->getSlice();
417 
418  const Bool lfCrossSliceBoundaryFlag=pCtu->getSlice()->getLFCrossSliceBoundaryFlag();
419 
420  const UInt uiPartQ = uiAbsPartIdx4x4BlockWithinCtu;
421  TComDataCU* const pcCUQ = pCtu;
422 
423  UInt uiPartP;
424  TComDataCU* pcCUP;
425  UInt uiBs = 0;
426 
427  //-- Calculate Block Index
428  if (edgeDir == EDGE_VER)
429  {
430  pcCUP = pcCUQ->getPULeft(uiPartP, uiPartQ, !lfCrossSliceBoundaryFlag, !m_bLFCrossTileBoundary);
431  }
432  else // (edgeDir == EDGE_HOR)
433  {
434  pcCUP = pcCUQ->getPUAbove(uiPartP, uiPartQ, !pCtu->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary);
435  }
436 
437  //-- Set BS for Intra MB : BS = 4 or 3
438  if ( pcCUP->isIntra(uiPartP) || pcCUQ->isIntra(uiPartQ) )
439  {
440  uiBs = 2;
441  }
442 
443  //-- Set BS for not Intra MB : BS = 2 or 1 or 0
444  if ( !pcCUP->isIntra(uiPartP) && !pcCUQ->isIntra(uiPartQ) )
445  {
446  UInt nsPartQ = uiPartQ;
447  UInt nsPartP = uiPartP;
448 
449  if ( m_aapucBS[edgeDir][uiAbsPartIdx4x4BlockWithinCtu] && (pcCUQ->getCbf( nsPartQ, COMPONENT_Y, pcCUQ->getTransformIdx(nsPartQ)) != 0 || pcCUP->getCbf( nsPartP, COMPONENT_Y, pcCUP->getTransformIdx(nsPartP) ) != 0) )
450  {
451  uiBs = 1;
452  }
453  else
454  {
455  if (pcSlice->isInterB() || pcCUP->getSlice()->isInterB())
456  {
457  Int iRefIdx;
458  TComPic *piRefP0, *piRefP1, *piRefQ0, *piRefQ1;
459  iRefIdx = pcCUP->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartP);
460  piRefP0 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_0, iRefIdx);
461  iRefIdx = pcCUP->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiPartP);
462  piRefP1 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_1, iRefIdx);
463  iRefIdx = pcCUQ->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartQ);
464  piRefQ0 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx);
465  iRefIdx = pcCUQ->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiPartQ);
466  piRefQ1 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_1, iRefIdx);
467 
468  TComMv pcMvP0 = pcCUP->getCUMvField(REF_PIC_LIST_0)->getMv(uiPartP);
469  TComMv pcMvP1 = pcCUP->getCUMvField(REF_PIC_LIST_1)->getMv(uiPartP);
470  TComMv pcMvQ0 = pcCUQ->getCUMvField(REF_PIC_LIST_0)->getMv(uiPartQ);
471  TComMv pcMvQ1 = pcCUQ->getCUMvField(REF_PIC_LIST_1)->getMv(uiPartQ);
472 
473  if (piRefP0 == NULL)
474  {
475  pcMvP0.setZero();
476  }
477  if (piRefP1 == NULL)
478  {
479  pcMvP1.setZero();
480  }
481  if (piRefQ0 == NULL)
482  {
483  pcMvQ0.setZero();
484  }
485  if (piRefQ1 == NULL)
486  {
487  pcMvQ1.setZero();
488  }
489 
490  if ( ((piRefP0==piRefQ0)&&(piRefP1==piRefQ1)) || ((piRefP0==piRefQ1)&&(piRefP1==piRefQ0)) )
491  {
492  if ( piRefP0 != piRefP1 ) // Different L0 & L1
493  {
494  if ( piRefP0 == piRefQ0 )
495  {
496  uiBs = ((abs(pcMvQ0.getHor() - pcMvP0.getHor()) >= 4) ||
497  (abs(pcMvQ0.getVer() - pcMvP0.getVer()) >= 4) ||
498  (abs(pcMvQ1.getHor() - pcMvP1.getHor()) >= 4) ||
499  (abs(pcMvQ1.getVer() - pcMvP1.getVer()) >= 4)) ? 1 : 0;
500  }
501  else
502  {
503  uiBs = ((abs(pcMvQ1.getHor() - pcMvP0.getHor()) >= 4) ||
504  (abs(pcMvQ1.getVer() - pcMvP0.getVer()) >= 4) ||
505  (abs(pcMvQ0.getHor() - pcMvP1.getHor()) >= 4) ||
506  (abs(pcMvQ0.getVer() - pcMvP1.getVer()) >= 4)) ? 1 : 0;
507  }
508  }
509  else // Same L0 & L1
510  {
511  uiBs = ((abs(pcMvQ0.getHor() - pcMvP0.getHor()) >= 4) ||
512  (abs(pcMvQ0.getVer() - pcMvP0.getVer()) >= 4) ||
513  (abs(pcMvQ1.getHor() - pcMvP1.getHor()) >= 4) ||
514  (abs(pcMvQ1.getVer() - pcMvP1.getVer()) >= 4)) &&
515  ((abs(pcMvQ1.getHor() - pcMvP0.getHor()) >= 4) ||
516  (abs(pcMvQ1.getVer() - pcMvP0.getVer()) >= 4) ||
517  (abs(pcMvQ0.getHor() - pcMvP1.getHor()) >= 4) ||
518  (abs(pcMvQ0.getVer() - pcMvP1.getVer()) >= 4)) ? 1 : 0;
519  }
520  }
521  else // for all different Ref_Idx
522  {
523  uiBs = 1;
524  }
525  }
526  else // pcSlice->isInterP()
527  {
528  Int iRefIdx;
529  TComPic *piRefP0, *piRefQ0;
530  iRefIdx = pcCUP->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartP);
531  piRefP0 = (iRefIdx < 0) ? NULL : pcCUP->getSlice()->getRefPic(REF_PIC_LIST_0, iRefIdx);
532  iRefIdx = pcCUQ->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartQ);
533  piRefQ0 = (iRefIdx < 0) ? NULL : pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx);
534  TComMv pcMvP0 = pcCUP->getCUMvField(REF_PIC_LIST_0)->getMv(uiPartP);
535  TComMv pcMvQ0 = pcCUQ->getCUMvField(REF_PIC_LIST_0)->getMv(uiPartQ);
536 
537  if (piRefP0 == NULL)
538  {
539  pcMvP0.setZero();
540  }
541  if (piRefQ0 == NULL)
542  {
543  pcMvQ0.setZero();
544  }
545 
546  uiBs = ((piRefP0 != piRefQ0) ||
547  (abs(pcMvQ0.getHor() - pcMvP0.getHor()) >= 4) ||
548  (abs(pcMvQ0.getVer() - pcMvP0.getVer()) >= 4)) ? 1 : 0;
549  }
550  } // enf of "if( one of BCBP == 0 )"
551  } // enf of "if( not Intra )"
552 
553  m_aapucBS[edgeDir][uiAbsPartIdx4x4BlockWithinCtu] = uiBs;
554 }
555 
556 
557 Void TComLoopFilter::xEdgeFilterLuma( TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, DeblockEdgeDir edgeDir, Int iEdge )
558 {
559  TComPicYuv* pcPicYuvRec = pcCU->getPic()->getPicYuvRec();
560  Pel* piSrc = pcPicYuvRec->getAddr(COMPONENT_Y, pcCU->getCtuRsAddr(), uiAbsZorderIdx );
561  Pel* piTmpSrc = piSrc;
562 
563  const Bool lfCrossSliceBoundaryFlag=pcCU->getSlice()->getLFCrossSliceBoundaryFlag();
564 
565  Int iStride = pcPicYuvRec->getStride(COMPONENT_Y);
566  Int iQP = 0;
567  Int iQP_P = 0;
568  Int iQP_Q = 0;
569  UInt uiNumParts = pcCU->getPic()->getNumPartInCtuWidth()>>uiDepth;
570 
571  UInt uiPelsInPart = g_uiMaxCUWidth >> g_uiMaxCUDepth;
572  UInt uiBsAbsIdx = 0, uiBs = 0;
573  Int iOffset, iSrcStep;
574 
575  Bool bPCMFilter = (pcCU->getSlice()->getSPS()->getUsePCM() && pcCU->getSlice()->getSPS()->getPCMFilterDisableFlag())? true : false;
576  Bool bPartPNoFilter = false;
577  Bool bPartQNoFilter = false;
578  UInt uiPartPIdx = 0;
579  UInt uiPartQIdx = 0;
580  TComDataCU* pcCUP = pcCU;
581  TComDataCU* pcCUQ = pcCU;
582  Int betaOffsetDiv2 = pcCUQ->getSlice()->getDeblockingFilterBetaOffsetDiv2();
583  Int tcOffsetDiv2 = pcCUQ->getSlice()->getDeblockingFilterTcOffsetDiv2();
584 
585  if (edgeDir == EDGE_VER)
586  {
587  iOffset = 1;
588  iSrcStep = iStride;
589  piTmpSrc += iEdge*uiPelsInPart;
590  }
591  else // (edgeDir == EDGE_HOR)
592  {
593  iOffset = iStride;
594  iSrcStep = 1;
595  piTmpSrc += iEdge*uiPelsInPart*iStride;
596  }
597 
598  for ( UInt iIdx = 0; iIdx < uiNumParts; iIdx++ )
599  {
600  uiBsAbsIdx = xCalcBsIdx( pcCU, uiAbsZorderIdx, edgeDir, iEdge, iIdx);
601  uiBs = m_aapucBS[edgeDir][uiBsAbsIdx];
602  if ( uiBs )
603  {
604  iQP_Q = pcCU->getQP( uiBsAbsIdx );
605  uiPartQIdx = uiBsAbsIdx;
606  // Derive neighboring PU index
607  if (edgeDir == EDGE_VER)
608  {
609  pcCUP = pcCUQ->getPULeft (uiPartPIdx, uiPartQIdx,!lfCrossSliceBoundaryFlag, !m_bLFCrossTileBoundary);
610  }
611  else // (iDir == EDGE_HOR)
612  {
613  pcCUP = pcCUQ->getPUAbove(uiPartPIdx, uiPartQIdx,!pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary);
614  }
615 
616  iQP_P = pcCUP->getQP(uiPartPIdx);
617  iQP = (iQP_P + iQP_Q + 1) >> 1;
618  Int iBitdepthScale = 1 << (g_bitDepth[CHANNEL_TYPE_LUMA]-8);
619 
620  Int iIndexTC = Clip3(0, MAX_QP+DEFAULT_INTRA_TC_OFFSET, Int(iQP + DEFAULT_INTRA_TC_OFFSET*(uiBs-1) + (tcOffsetDiv2 << 1)));
621  Int iIndexB = Clip3(0, MAX_QP, iQP + (betaOffsetDiv2 << 1));
622 
623  Int iTc = sm_tcTable[iIndexTC]*iBitdepthScale;
624  Int iBeta = sm_betaTable[iIndexB]*iBitdepthScale;
625  Int iSideThreshold = (iBeta+(iBeta>>1))>>3;
626  Int iThrCut = iTc*10;
627 
628 
629  UInt uiBlocksInPart = uiPelsInPart / 4 ? uiPelsInPart / 4 : 1;
630  for (UInt iBlkIdx = 0; iBlkIdx<uiBlocksInPart; iBlkIdx ++)
631  {
632  Int dp0 = xCalcDP( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*4+0), iOffset);
633  Int dq0 = xCalcDQ( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*4+0), iOffset);
634  Int dp3 = xCalcDP( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*4+3), iOffset);
635  Int dq3 = xCalcDQ( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*4+3), iOffset);
636  Int d0 = dp0 + dq0;
637  Int d3 = dp3 + dq3;
638 
639  Int dp = dp0 + dp3;
640  Int dq = dq0 + dq3;
641  Int d = d0 + d3;
642 
643  if (bPCMFilter || pcCU->getSlice()->getPPS()->getTransquantBypassEnableFlag())
644  {
645  // Check if each of PUs is I_PCM with LF disabling
646  bPartPNoFilter = (bPCMFilter && pcCUP->getIPCMFlag(uiPartPIdx));
647  bPartQNoFilter = (bPCMFilter && pcCUQ->getIPCMFlag(uiPartQIdx));
648 
649  // check if each of PUs is lossless coded
650  bPartPNoFilter = bPartPNoFilter || (pcCUP->isLosslessCoded(uiPartPIdx) );
651  bPartQNoFilter = bPartQNoFilter || (pcCUQ->isLosslessCoded(uiPartQIdx) );
652  }
653 
654  if (d < iBeta)
655  {
656  Bool bFilterP = (dp < iSideThreshold);
657  Bool bFilterQ = (dq < iSideThreshold);
658 
659  Bool sw = xUseStrongFiltering( iOffset, 2*d0, iBeta, iTc, piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*4+0))
660  && xUseStrongFiltering( iOffset, 2*d3, iBeta, iTc, piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*4+3));
661 
662  for ( Int i = 0; i < DEBLOCK_SMALLEST_BLOCK/2; i++)
663  {
664  xPelFilterLuma( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*4+i), iOffset, iTc, sw, bPartPNoFilter, bPartQNoFilter, iThrCut, bFilterP, bFilterQ);
665  }
666  }
667  }
668  }
669  }
670 }
671 
672 
673 Void TComLoopFilter::xEdgeFilterChroma( TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, DeblockEdgeDir edgeDir, Int iEdge )
674 {
675  TComPicYuv* pcPicYuvRec = pcCU->getPic()->getPicYuvRec();
676  Int iStride = pcPicYuvRec->getStride(COMPONENT_Cb);
677  Pel* piSrcCb = pcPicYuvRec->getAddr( COMPONENT_Cb, pcCU->getCtuRsAddr(), uiAbsZorderIdx );
678  Pel* piSrcCr = pcPicYuvRec->getAddr( COMPONENT_Cr, pcCU->getCtuRsAddr(), uiAbsZorderIdx );
679  Int iQP = 0;
680  Int iQP_P = 0;
681  Int iQP_Q = 0;
682 
683  UInt uiPelsInPartChromaH = g_uiMaxCUWidth >> (g_uiMaxCUDepth+pcPicYuvRec->getComponentScaleX(COMPONENT_Cb));
684  UInt uiPelsInPartChromaV = g_uiMaxCUWidth >> (g_uiMaxCUDepth+pcPicYuvRec->getComponentScaleY(COMPONENT_Cb));
685 
686  Int iOffset, iSrcStep;
687  UInt uiLoopLength;
688 
689  const UInt uiCtuWidthInBaseUnits = pcCU->getPic()->getNumPartInCtuWidth();
690 
691  Bool bPCMFilter = (pcCU->getSlice()->getSPS()->getUsePCM() && pcCU->getSlice()->getSPS()->getPCMFilterDisableFlag())? true : false;
692  Bool bPartPNoFilter = false;
693  Bool bPartQNoFilter = false;
694  TComDataCU* pcCUQ = pcCU;
695  Int tcOffsetDiv2 = pcCU->getSlice()->getDeblockingFilterTcOffsetDiv2();
696 
697  // Vertical Position
698  UInt uiEdgeNumInCtuVert = g_auiZscanToRaster[uiAbsZorderIdx]%uiCtuWidthInBaseUnits + iEdge;
699  UInt uiEdgeNumInCtuHor = g_auiZscanToRaster[uiAbsZorderIdx]/uiCtuWidthInBaseUnits + iEdge;
700 
701  if ( (uiPelsInPartChromaH < DEBLOCK_SMALLEST_BLOCK) && (uiPelsInPartChromaV < DEBLOCK_SMALLEST_BLOCK) &&
702  (
703  ( (uiEdgeNumInCtuVert%(DEBLOCK_SMALLEST_BLOCK/uiPelsInPartChromaH)) && (edgeDir==EDGE_VER) ) ||
704  ( (uiEdgeNumInCtuHor %(DEBLOCK_SMALLEST_BLOCK/uiPelsInPartChromaV)) && (edgeDir==EDGE_HOR) )
705  )
706  )
707  {
708  return;
709  }
710 
711 
712  const Bool lfCrossSliceBoundaryFlag=pcCU->getSlice()->getLFCrossSliceBoundaryFlag();
713 
714  UInt uiNumParts = pcCU->getPic()->getNumPartInCtuWidth()>>uiDepth;
715 
716  UInt uiBsAbsIdx;
717  UChar ucBs;
718 
719  Pel* piTmpSrcCb = piSrcCb;
720  Pel* piTmpSrcCr = piSrcCr;
721 
722  if (edgeDir == EDGE_VER)
723  {
724  iOffset = 1;
725  iSrcStep = iStride;
726  piTmpSrcCb += iEdge*uiPelsInPartChromaH;
727  piTmpSrcCr += iEdge*uiPelsInPartChromaH;
728  uiLoopLength=uiPelsInPartChromaV;
729  }
730  else // (edgeDir == EDGE_HOR)
731  {
732  iOffset = iStride;
733  iSrcStep = 1;
734  piTmpSrcCb += iEdge*iStride*uiPelsInPartChromaV;
735  piTmpSrcCr += iEdge*iStride*uiPelsInPartChromaV;
736  uiLoopLength=uiPelsInPartChromaH;
737  }
738 
739  for ( UInt iIdx = 0; iIdx < uiNumParts; iIdx++ )
740  {
741  uiBsAbsIdx = xCalcBsIdx( pcCU, uiAbsZorderIdx, edgeDir, iEdge, iIdx);
742  ucBs = m_aapucBS[edgeDir][uiBsAbsIdx];
743 
744  if ( ucBs > 1)
745  {
746  iQP_Q = pcCU->getQP( uiBsAbsIdx );
747  UInt uiPartQIdx = uiBsAbsIdx;
748  // Derive neighboring PU index
749  TComDataCU* pcCUP;
750  UInt uiPartPIdx;
751 
752  if (edgeDir == EDGE_VER)
753  {
754  pcCUP = pcCUQ->getPULeft (uiPartPIdx, uiPartQIdx,!lfCrossSliceBoundaryFlag, !m_bLFCrossTileBoundary);
755  }
756  else // (edgeDir == EDGE_HOR)
757  {
758  pcCUP = pcCUQ->getPUAbove(uiPartPIdx, uiPartQIdx,!pcCU->getSlice()->getLFCrossSliceBoundaryFlag(), false, !m_bLFCrossTileBoundary);
759  }
760 
761  iQP_P = pcCUP->getQP(uiPartPIdx);
762 
763  if (bPCMFilter || pcCU->getSlice()->getPPS()->getTransquantBypassEnableFlag())
764  {
765  // Check if each of PUs is I_PCM with LF disabling
766  bPartPNoFilter = (bPCMFilter && pcCUP->getIPCMFlag(uiPartPIdx));
767  bPartQNoFilter = (bPCMFilter && pcCUQ->getIPCMFlag(uiPartQIdx));
768 
769  // check if each of PUs is lossless coded
770  bPartPNoFilter = bPartPNoFilter || (pcCUP->isLosslessCoded(uiPartPIdx));
771  bPartQNoFilter = bPartQNoFilter || (pcCUQ->isLosslessCoded(uiPartQIdx));
772  }
773 
774  for ( UInt chromaIdx = 0; chromaIdx < 2; chromaIdx++ )
775  {
776  Int chromaQPOffset = pcCU->getSlice()->getPPS()->getQpOffset(ComponentID(chromaIdx + 1));
777  Pel* piTmpSrcChroma = (chromaIdx == 0) ? piTmpSrcCb : piTmpSrcCr;
778 
779  iQP = ((iQP_P + iQP_Q + 1) >> 1) + chromaQPOffset;
780  if (iQP >= chromaQPMappingTableSize)
781  {
782  if (pcPicYuvRec->getChromaFormat()==CHROMA_420)
783  {
784  iQP -=6;
785  }
786  else if (iQP>51)
787  {
788  iQP=51;
789  }
790  }
791  else if (iQP >= 0 )
792  {
793  iQP = getScaledChromaQP(iQP, pcPicYuvRec->getChromaFormat());
794  }
795 
796  Int iBitdepthScale = 1 << (g_bitDepth[CHANNEL_TYPE_CHROMA]-8);
797 
798  Int iIndexTC = Clip3(0, MAX_QP+DEFAULT_INTRA_TC_OFFSET, iQP + DEFAULT_INTRA_TC_OFFSET*(ucBs - 1) + (tcOffsetDiv2 << 1));
799  Int iTc = sm_tcTable[iIndexTC]*iBitdepthScale;
800 
801  for ( UInt uiStep = 0; uiStep < uiLoopLength; uiStep++ )
802  {
803  xPelFilterChroma( piTmpSrcChroma + iSrcStep*(uiStep+iIdx*uiLoopLength), iOffset, iTc , bPartPNoFilter, bPartQNoFilter);
804  }
805  }
806  }
807  }
808 }
809 
823 __inline Void TComLoopFilter::xPelFilterLuma( Pel* piSrc, Int iOffset, Int tc, Bool sw, Bool bPartPNoFilter, Bool bPartQNoFilter, Int iThrCut, Bool bFilterSecondP, Bool bFilterSecondQ)
824 {
825  Int delta;
826 
827  Pel m4 = piSrc[0];
828  Pel m3 = piSrc[-iOffset];
829  Pel m5 = piSrc[ iOffset];
830  Pel m2 = piSrc[-iOffset*2];
831  Pel m6 = piSrc[ iOffset*2];
832  Pel m1 = piSrc[-iOffset*3];
833  Pel m7 = piSrc[ iOffset*3];
834  Pel m0 = piSrc[-iOffset*4];
835 
836  if (sw)
837  {
838  piSrc[-iOffset] = Clip3(m3-2*tc, m3+2*tc, ((m1 + 2*m2 + 2*m3 + 2*m4 + m5 + 4) >> 3));
839  piSrc[0] = Clip3(m4-2*tc, m4+2*tc, ((m2 + 2*m3 + 2*m4 + 2*m5 + m6 + 4) >> 3));
840  piSrc[-iOffset*2] = Clip3(m2-2*tc, m2+2*tc, ((m1 + m2 + m3 + m4 + 2)>>2));
841  piSrc[ iOffset] = Clip3(m5-2*tc, m5+2*tc, ((m3 + m4 + m5 + m6 + 2)>>2));
842  piSrc[-iOffset*3] = Clip3(m1-2*tc, m1+2*tc, ((2*m0 + 3*m1 + m2 + m3 + m4 + 4 )>>3));
843  piSrc[ iOffset*2] = Clip3(m6-2*tc, m6+2*tc, ((m3 + m4 + m5 + 3*m6 + 2*m7 +4 )>>3));
844  }
845  else
846  {
847  /* Weak filter */
848  delta = (9*(m4-m3) -3*(m5-m2) + 8)>>4 ;
849 
850  if ( abs(delta) < iThrCut )
851  {
852  delta = Clip3(-tc, tc, delta);
853  piSrc[-iOffset] = Clip((m3+delta), CHANNEL_TYPE_LUMA);
854  piSrc[0] = Clip((m4-delta), CHANNEL_TYPE_LUMA);
855 
856  Int tc2 = tc>>1;
857  if(bFilterSecondP)
858  {
859  Int delta1 = Clip3(-tc2, tc2, (( ((m1+m3+1)>>1)- m2+delta)>>1));
860  piSrc[-iOffset*2] = Clip((m2+delta1), CHANNEL_TYPE_LUMA);
861  }
862  if(bFilterSecondQ)
863  {
864  Int delta2 = Clip3(-tc2, tc2, (( ((m6+m4+1)>>1)- m5-delta)>>1));
865  piSrc[ iOffset] = Clip((m5+delta2), CHANNEL_TYPE_LUMA);
866  }
867  }
868  }
869 
870  if(bPartPNoFilter)
871  {
872  piSrc[-iOffset] = m3;
873  piSrc[-iOffset*2] = m2;
874  piSrc[-iOffset*3] = m1;
875  }
876  if(bPartQNoFilter)
877  {
878  piSrc[0] = m4;
879  piSrc[ iOffset] = m5;
880  piSrc[ iOffset*2] = m6;
881  }
882 }
883 
893 __inline Void TComLoopFilter::xPelFilterChroma( Pel* piSrc, Int iOffset, Int tc, Bool bPartPNoFilter, Bool bPartQNoFilter)
894 {
895  Int delta;
896 
897  Pel m4 = piSrc[0];
898  Pel m3 = piSrc[-iOffset];
899  Pel m5 = piSrc[ iOffset];
900  Pel m2 = piSrc[-iOffset*2];
901 
902  delta = Clip3(-tc,tc, (((( m4 - m3 ) << 2 ) + m2 - m5 + 4 ) >> 3) );
903  piSrc[-iOffset] = Clip((m3+delta), CHANNEL_TYPE_CHROMA);
904  piSrc[0] = Clip((m4-delta), CHANNEL_TYPE_CHROMA);
905 
906  if(bPartPNoFilter)
907  {
908  piSrc[-iOffset] = m3;
909  }
910  if(bPartQNoFilter)
911  {
912  piSrc[0] = m4;
913  }
914 }
915 
925 __inline Bool TComLoopFilter::xUseStrongFiltering( Int offset, Int d, Int beta, Int tc, Pel* piSrc)
926 {
927  Pel m4 = piSrc[0];
928  Pel m3 = piSrc[-offset];
929  Pel m7 = piSrc[ offset*3];
930  Pel m0 = piSrc[-offset*4];
931 
932  Int d_strong = abs(m0-m3) + abs(m7-m4);
933 
934  return ( (d_strong < (beta>>3)) && (d<(beta>>2)) && ( abs(m3-m4) < ((tc*5+1)>>1)) );
935 }
936 
937 __inline Int TComLoopFilter::xCalcDP( Pel* piSrc, Int iOffset)
938 {
939  return abs( piSrc[-iOffset*3] - 2*piSrc[-iOffset*2] + piSrc[-iOffset] ) ;
940 }
941 
942 __inline Int TComLoopFilter::xCalcDQ( Pel* piSrc, Int iOffset)
943 {
944  return abs( piSrc[0] - 2*piSrc[iOffset] + piSrc[iOffset*2] );
945 }
Bool getPCMFilterDisableFlag() const
Definition: TComSlice.h:918
UInt g_uiMaxCUDepth
Definition: TComRom.cpp:253
Char * getQP()
Definition: TComDataCU.h:255
Void create(UInt uiMaxCUDepth)
Int getRefIdx(Int iIdx) const
static Int getScaledChromaQP(Int unscaledChromaQP, const ChromaFormat chFmt)
picture YUV buffer class
Definition: TComPicYuv.h:55
CU data structure class.
Definition: TComDataCU.h:64
__inline Int xCalcDQ(Pel *piSrc, Int iOffset)
deblocking filter (header)
Int getHor() const
Definition: TComMv.h:88
UInt getNumberOfCtusInFrame() const
Definition: TComPic.h:116
picture class (symbol + YUV buffers)
Definition: TComPic.h:56
T Clip(const T x, const ChannelType type)
Definition: CommonDef.h:139
void Void
Definition: TypeDef.h:285
LFCUParam m_stLFCUParam
status structure
Int getStride(const ComponentID id) const
Definition: TComPicYuv.h:113
UInt g_auiRasterToPelX[((1<<(6))/4)*((1<<(6))/4)]
Definition: TComRom.cpp:257
UChar * getTransformIdx()
Definition: TComDataCU.h:274
Void xSetEdgefilterMultiple(TComDataCU *pcCU, UInt uiAbsZorderIdx, UInt uiDepth, DeblockEdgeDir edgeDir, Int iEdgeIdx, Bool bValue, UInt uiWidthInBaseUnits=0, UInt uiHeightInBaseUnits=0, const TComRectangle *rect=0)
#define NULL
Definition: CommonDef.h:100
slice header and SPS class (header)
Bool * m_aapbEdgeFilter[NUM_EDGE_DIR]
unsigned int UInt
Definition: TypeDef.h:297
UInt getNumPartitionsInCtu() const
Definition: TComPic.h:119
TComDataCU * getPULeft(UInt &uiLPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceTileRestriction=true)
#define DEBLOCK_SMALLEST_BLOCK
Short Pel
pixel type
Definition: TypeDef.h:692
symmetric motion partition, 2Nx N
Definition: TypeDef.h:396
Int getDeblockingFilterBetaOffsetDiv2() const
Definition: TComSlice.h:1350
Bool bLeftEdge
indicates left edge
Definition: TypeDef.h:743
static const Int chromaQPMappingTableSize
Definition: TComRom.h:128
Int getDeblockingFilterTcOffsetDiv2() const
Definition: TComSlice.h:1351
Bool nextSection(const TComTU &parent)
Definition: TComTU.cpp:178
Void xSetEdgefilterTU(TComTU &rTu)
#define MAX_QP
Definition: CommonDef.h:127
__inline Int xCalcDP(Pel *piSrc, Int iOffset)
UChar getCbf(UInt uiIdx, ComponentID eType)
Definition: TComDataCU.h:303
Void xEdgeFilterLuma(TComDataCU *pcCU, UInt uiAbsZorderIdx, UInt uiDepth, DeblockEdgeDir edgeDir, Int iEdge)
Bool m_bLFCrossTileBoundary
Bool isInterB() const
Definition: TComSlice.h:1405
UInt getNumPartInCtuHeight() const
Definition: TComPic.h:118
Bool getTransquantBypassEnableFlag() const
Definition: TComSlice.h:1116
TComPicYuv * getPicYuvRec()
Definition: TComPic.h:109
UInt GetAbsPartIdxTU() const
Definition: TComTU.h:119
__inline Void xPelFilterChroma(Pel *piSrc, Int iOffset, Int tc, Bool bPartPNoFilter, Bool bPartQNoFilter)
Bool bInternalEdge
indicates internal edge
Definition: TypeDef.h:742
UInt getNumPartInCtuWidth() const
Definition: TComPic.h:117
Bool * getIPCMFlag()
Definition: TComDataCU.h:350
virtual ~TComLoopFilter()
Void setZero()
Definition: TComMv.h:82
symmetric motion partition, 2Nx2N
Definition: TypeDef.h:395
UInt getComponentScaleY(const ComponentID id) const
Definition: TComPicYuv.h:139
UInt getComponentScaleX(const ComponentID id) const
Definition: TComPicYuv.h:138
bool Bool
Definition: TypeDef.h:286
Bool isIntra(UInt uiPartIdx) const
Definition: TComDataCU.h:443
UInt g_uiMaxCUWidth
Definition: TComRom.cpp:251
asymmetric motion partition, 2Nx( N/2) + 2Nx(3N/2)
Definition: TypeDef.h:399
asymmetric motion partition, (3N/2)x2N + ( N/2)x2N
Definition: TypeDef.h:402
static const UChar sm_betaTable[52]
UInt & getCtuRsAddr()
Definition: TComDataCU.h:207
UInt getCUPelY() const
Definition: TComDataCU.h:211
T Clip3(const T minVal, const T maxVal, const T a)
general min/max clip
Definition: CommonDef.h:137
static const UChar sm_tcTable[54]
TComMv const & getMv(Int iIdx) const
reference list 0
Definition: TypeDef.h:417
UInt g_auiZscanToRaster[((1<<(6))/4)*((1<<(6))/4)]
Definition: TComRom.cpp:255
Bool getLFCrossSliceBoundaryFlag()
Definition: TComSlice.h:1519
Int getComponentScaleX(const ComponentID id) const
Definition: TComPic.h:126
motion vector class (header)
ChromaFormat
chroma formats (according to semantics of chroma_format_idc)
Definition: TypeDef.h:352
unsigned char UChar
Definition: TypeDef.h:293
const TComRectangle & getRect(const ComponentID compID) const
Definition: TComTU.h:96
Void xSetEdgefilterPU(TComDataCU *pcCU, UInt uiAbsZorderIdx)
UInt g_auiRasterToPelY[((1<<(6))/4)*((1<<(6))/4)]
Definition: TComRom.cpp:258
UChar * getDepth()
Definition: TComDataCU.h:213
UInt xCalcBsIdx(TComDataCU *pcCU, UInt absZIdxInCtu, DeblockEdgeDir edgeDir, Int iEdgeIdx, Int iBaseUnitIdx, const struct TComRectangle *rect=0)
__inline Void xPelFilterLuma(Pel *piSrc, Int iOffset, Int tc, Bool sw, Bool bPartPNoFilter, Bool bPartQNoFilter, Int iThrCut, Bool bFilterSecondP, Bool bFilterSecondQ)
const TComPPS * getPPS() const
Definition: TComSlice.h:1309
UInt getCUPelX() const
Definition: TComDataCU.h:210
Void loopFilterPic(TComPic *pcPic)
picture-level deblocking filter
Int getVer() const
Definition: TComMv.h:89
ChromaFormat getChromaFormat() const
Definition: TComPic.h:128
TComDataCU * getCU()
Definition: TComTU.h:126
reference list 1
Definition: TypeDef.h:418
Void setCfg(Bool bLFCrossTileBoundary)
set configuration
asymmetric motion partition, ( N/2)x2N + (3N/2)x2N
Definition: TypeDef.h:401
Bool getUsePCM() const
Definition: TComSlice.h:851
TComPic * getPic()
Definition: TComDataCU.h:203
Int g_bitDepth[MAX_NUM_CHANNEL_TYPE]
Definition: TComRom.cpp:548
TComDataCU * getCtu(UInt ctuRsAddr)
Definition: TComPic.h:105
Definition: TComTU.h:48
Char * getPartitionSize()
Definition: TComDataCU.h:223
Bool bTopEdge
indicates top edge
Definition: TypeDef.h:744
__inline Bool xUseStrongFiltering(Int offset, Int d, Int beta, Int tc, Pel *piSrc)
Int getQpOffset(ComponentID compID) const
Definition: TComSlice.h:1073
#define DEFAULT_INTRA_TC_OFFSET
Default intra TC offset.
Pel * getAddr(const ComponentID ch)
Definition: TComPicYuv.h:127
Void xSetLoopfilterParam(TComDataCU *pcCU, UInt uiAbsZorderIdx)
TComCUMvField * getCUMvField(RefPicList e)
Definition: TComDataCU.h:294
int Int
Definition: TypeDef.h:296
basic motion vector class
Definition: TComMv.h:51
UChar * m_aapucBS[NUM_EDGE_DIR]
Bs for [Ver/Hor][Y/U/V][Blk_Idx].
Int getComponentScaleY(const ComponentID id) const
Definition: TComPic.h:127
ComponentID
Definition: TypeDef.h:368
UInt GetAbsPartIdxCU() const
Definition: TComTU.h:116
DeblockEdgeDir
Definition: TypeDef.h:385
Void xGetBoundaryStrengthSingle(TComDataCU *pCtu, DeblockEdgeDir edgeDir, UInt uiPartIdx)
asymmetric motion partition, 2Nx(3N/2) + 2Nx( N/2)
Definition: TypeDef.h:400
Void xEdgeFilterChroma(TComDataCU *pcCU, UInt uiAbsZorderIdx, UInt uiDepth, DeblockEdgeDir edgeDir, Int iEdge)
symmetric motion partition, Nx N
Definition: TypeDef.h:398
Bool getDeblockingFilterDisable() const
Definition: TComSlice.h:1348
slice header class
Definition: TComSlice.h:1198
Bool isLosslessCoded(UInt absPartIdx)
TComPic * getRefPic(RefPicList e, Int iRefIdx)
Definition: TComSlice.h:1355
symmetric motion partition, Nx2N
Definition: TypeDef.h:397
UInt GetTransformDepthTotal() const
Definition: TComTU.h:105
TComSlice * getSlice()
Definition: TComDataCU.h:205
const TComSPS * getSPS() const
Definition: TComSlice.h:1306
TComDataCU * getPUAbove(UInt &uiAPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool planarAtCTUBoundary=false, Bool bEnforceTileRestriction=true)
ChromaFormat getChromaFormat() const
Definition: TComPicYuv.h:110
Void xDeblockCU(TComDataCU *pcCU, UInt uiAbsZorderIdx, UInt uiDepth, DeblockEdgeDir edgeDir)
CU-level deblocking function.