Coverage Report

Created: 2026-12-01 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/work/vvenc/source/Lib/CommonLib/InterPrediction.h
Line
Count
Source
1
/* -----------------------------------------------------------------------------
2
The copyright in this software is being made available under the Clear BSD
3
License, included below. No patent rights, trademark rights and/or 
4
other Intellectual Property Rights other than the copyrights concerning 
5
the Software are granted under this license.
6
7
The Clear BSD License
8
9
Copyright (c) 2019-2026, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. & The VVenC Authors.
10
All rights reserved.
11
12
Redistribution and use in source and binary forms, with or without modification,
13
are permitted (subject to the limitations in the disclaimer below) provided that
14
the following conditions are met:
15
16
     * Redistributions of source code must retain the above copyright notice,
17
     this list of conditions and the following disclaimer.
18
19
     * Redistributions in binary form must reproduce the above copyright
20
     notice, this list of conditions and the following disclaimer in the
21
     documentation and/or other materials provided with the distribution.
22
23
     * Neither the name of the copyright holder nor the names of its
24
     contributors may be used to endorse or promote products derived from this
25
     software without specific prior written permission.
26
27
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
28
THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
29
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
31
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
32
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
33
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
34
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
35
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
36
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38
POSSIBILITY OF SUCH DAMAGE.
39
40
41
------------------------------------------------------------------------------------------- */
42
/** \file     InterPrediction.h
43
    \brief    inter prediction class (header)
44
*/
45
46
#pragma once
47
48
#include "InterpolationFilter.h"
49
#include "Unit.h"
50
#include "Picture.h"
51
#include "RdCost.h"
52
#include "ContextModelling.h"
53
54
//! \ingroup CommonLib
55
//! \{
56
57
namespace vvenc {
58
59
#if ENABLE_SIMD_OPT_BDOF && defined( TARGET_SIMD_X86 )
60
using namespace x86_simd;
61
#endif
62
#if ENABLE_SIMD_OPT_BDOF && defined( TARGET_SIMD_ARM )
63
using namespace arm_simd;
64
#endif
65
66
// forward declaration
67
class Mv;
68
69
70
// ====================================================================================================================
71
// Class definition
72
// ====================================================================================================================
73
class InterPredInterpolation
74
{
75
  Pel*                 m_gradX0;
76
  Pel*                 m_gradY0;
77
  Pel*                 m_gradX1;
78
  Pel*                 m_gradY1;
79
  Pel                  m_gradBuf[2][(AFFINE_MIN_BLOCK_SIZE + 2) * (AFFINE_MIN_BLOCK_SIZE + 2)];
80
  int                  m_dMvBuf[2][16 * 2];
81
  Mv*                  m_storedMv;
82
83
protected:
84
  bool                 m_skipPROF;
85
  bool                 m_encOnly;
86
  bool                 m_isBi;
87
  InterpolationFilter  m_if;
88
  Pel*                 m_filteredBlock        [LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS_SIGNAL][LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS_SIGNAL][MAX_NUM_COMP];
89
  Pel*                 m_filteredBlockTmp     [LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS_SIGNAL][MAX_NUM_COMP];
90
  int                  m_ifpLines;
91
92
  void xApplyBDOF             ( PelBuf& yuvDst, const ClpRng& clpRng );
93
94
public:
95
  void(*xFpBiDirOptFlow)      ( const Pel* srcY0, const Pel* srcY1, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, const int width, const int height, Pel* dstY, const ptrdiff_t dstStride, const int shiftNum, const int  offset, const int  limit, const ClpRng& clpRng, const int bitDepth ) = nullptr;
96
  void(*xFpBDOFGradFilter)    ( const Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY, const int bitDepth );
97
  void(*xFpProfGradFilter)    ( const Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY, const int bitDepth );
98
  void(*xFpApplyPROF)         ( Pel* dst, int dstStride, const Pel* src, int srcStride, int width, int height, const Pel* gradX, const Pel* gradY, int gradStride, const int* dMvX, const int* dMvY, int dMvStride, const bool& bi, int shiftNum, Pel offset, const ClpRng& clpRng );
99
  void(*xFpPadDmvr)           ( const Pel* src, const int srcStride, Pel* dst, const int dstStride, int width, int height, int padSize );
100
  // the whole BDOF of a 16-wide block in one pass (AVX2; nullptr: xApplyBDOF's gradient filter, padding and
101
  // xFpBiDirOptFlow): pred0 / pred1 point at the block's first sample, inside its unpadded one-sample border
102
  void(*xFpBDOF16)            ( const Pel* pred0, const Pel* pred1, const ptrdiff_t predStride, const int height, Pel* dst, const ptrdiff_t dstStride, const int shiftNum, const int offset, const int limit, const ClpRng& clpRng ) = nullptr;
103
104
  // The luma prediction of one affine CU, everything xPredAffineBlk's sub-block loop needs for it (its MV spread within
105
  // the limit: the other CUs, whose sub-blocks all take one MV, are predicted in one filter call before)
106
  struct AffineLumaCU
107
  {
108
    const Pel*  ref;                          // reference picture at the CU's position
109
    int         refStride;
110
    Pel*        dst;                          // prediction of the CU
111
    int         dstStride;
112
    int         width, height;                // CU size, powers of 2 from 8
113
    int         mvScaleHor, mvScaleVer;       // affine model: MV at the top-left corner, << MAX_CU_DEPTH
114
    int         dMvHorX, dMvHorY;             // its change per sample to the right
115
    int         dMvVerX, dMvVerY;             // and per sample down
116
    int         roundShift;                   // to 1/16 sample, for roundAffineMv
117
    int         horMin, horMax, verMin, verMax;  // window the MVs are clipped to for the reference fetch
118
    Mv*         storedMv;                     // sub-block MVs, kept for the chroma pass
119
    int         storedMvStride;
120
    const int16_t* dMvXY;                     // PROF: the CU's (dMvX, dMvY) pairs, interleaved
121
    int         shiftNum;                     // PROF: border shift and output shift (they are equal)
122
    Pel         offset;                       // PROF: output offset
123
    ClpRng      clpRng;
124
  };
125
  // The per-sub-block loop of xPredAffineBlk for luma in one call, by [PROF][bi]: same MVs and m_storedMv writes,
126
  // same samples as m_if's 4x4 filters and the PROF functions. nullptr where no SIMD version exists.
127
  void(*xFpAffineLumaCU[2][2])( const AffineLumaCU& cu ) = {};
128
129
protected:
130
#if ENABLE_SIMD_OPT_BDOF && defined( TARGET_SIMD_X86 )
131
  void initInterPredictionX86();
132
  template <X86_VEXT vext>
133
  void _initInterPredictionX86();
134
#endif
135
136
#if ENABLE_SIMD_OPT_BDOF && defined( TARGET_SIMD_ARM )
137
  void initInterPredictionARM();
138
  template <ARM_VEXT vext>
139
  void _initInterPredictionARM();
140
#endif
141
142
  void xWeightedAverage       ( const CodingUnit& cu, const PelUnitBuf& pcYuvSrc0, const PelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const bool bdofApplied, PelUnitBuf *yuvPredTmp = NULL );
143
  void xPredAffineBlk         ( const ComponentID compID, const CodingUnit& cu, const Picture* refPic, const Mv* _mv, PelUnitBuf& dstPic, const bool bi, const ClpRng& clpRng, const RefPicList refPicList = REF_PIC_LIST_X);
144
  void xPredInterBlk( const ComponentID compID, const CodingUnit& cu, const Picture* refPic, const Mv& _mv, PelUnitBuf& dstPic, const bool bi, const ClpRng& clpRng
145
                              , const bool bdofApplied
146
                              , const bool isIBC
147
                              , const RefPicList refPicList = REF_PIC_LIST_X
148
                              , const SizeType dmvrWidth = 0
149
                              , const SizeType dmvrHeight = 0
150
                              , const bool bilinearMC = false
151
                              , const Pel* srcPadBuf = NULL
152
                              , const int32_t srcPadStride = 0
153
                              );
154
155
public:
156
  InterPredInterpolation();
157
  virtual ~InterPredInterpolation();
158
  void destroy();
159
  void init( bool enableOpt = true );
160
161
  void    weightedGeoBlk  ( const ClpRngs &clpRngs, CodingUnit& cu, const uint8_t splitDir, int32_t channel,
162
                            PelUnitBuf &predDst, PelUnitBuf &predSrc0, PelUnitBuf &predSrc1);
163
164
  static bool isSubblockVectorSpreadOverLimit(int a, int b, int c, int d, int predType);
165
  bool xIsAffineMvInRangeFPP (const CodingUnit& cu, const Mv* _mv, const int ifpLines, const int mvPrecShift = MV_FRACTIONAL_BITS_INTERNAL);
166
};
167
168
// The MV of one luma sub-block, as xPredAffineBlk derives it: the affine model at the sub-block centre, rounded to
169
// 1/16 sample and to the MV storage range. It is stored for the chroma pass, which reads the luma MVs. (A CU whose MV
170
// spread is over the limit, where every sub-block takes the MV at the CU centre, is predicted before the CU kernel.)
171
static inline Mv affineLumaSubblockMv( const InterPredInterpolation::AffineLumaCU& cu, int w, int h )
172
0
{
173
0
  const int half = AFFINE_MIN_BLOCK_SIZE >> 1;
174
0
  const int x    = half + w;
175
0
  const int y    = half + h;
176
0
  int mvHor      = cu.mvScaleHor + cu.dMvHorX * x + cu.dMvVerX * y;
177
0
  int mvVer      = cu.mvScaleVer + cu.dMvHorY * x + cu.dMvVerY * y;
178
0
  roundAffineMv( mvHor, mvVer, cu.roundShift );
179
0
  Mv mv( mvHor, mvVer );
180
0
  mv.clipToStorageBitDepth();
181
0
  cu.storedMv[( h / AFFINE_MIN_BLOCK_SIZE ) * cu.storedMvStride + w / AFFINE_MIN_BLOCK_SIZE] = mv;
182
0
  return mv;
183
0
}
Unexecuted instantiation: vvencimpl.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: Rom.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: Slice.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: EncLib.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: MCTF.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: Unit.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: UnitTools.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: BitAllocation.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: CuTree.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: EncGOP.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: EncPicture.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: EncSlice.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: InterSearch.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: AdaptiveLoopFilter.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: CodingStructure.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: ContextModelling.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: InterPrediction.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: LoopFilter.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: Quant.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: SampleAdaptiveOffset.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: TrQuant.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: UnitPartitioner.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: CABACWriter.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: EncAdaptiveLoopFilter.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: EncCu.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: EncModeCtrl.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: EncSampleAdaptiveOffset.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: IntraSearch.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: DepQuant.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: IntraPrediction.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: MatrixIntraPrediction.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: QuantRDOQ2.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: DecCu.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: QuantRDOQ.cpp:vvenc::affineLumaSubblockMv(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
184
185
// Where one luma sub-block of the CU loop reads the reference: its MV, clipped to the reference window, split into the
186
// integer position (ref) and the 1/16 fractions; nearest is the nearest integer position, which PROF takes its border
187
// from.
188
struct AffineLumaSubblockRef
189
{
190
  const Pel* ref;
191
  const Pel* nearest;
192
  int        xFrac, yFrac;
193
};
194
195
static ALWAYS_INLINE AffineLumaSubblockRef affineLumaSubblockRef( const InterPredInterpolation::AffineLumaCU& cu, int w, int h )
196
0
{
197
0
  const Mv  mv    = affineLumaSubblockMv( cu, w, h );
198
0
  const int mvHor = std::min<int>( cu.horMax, std::max<int>( cu.horMin, mv.hor ) );
199
0
  const int mvVer = std::min<int>( cu.verMax, std::max<int>( cu.verMin, mv.ver ) );
200
0
  AffineLumaSubblockRef r;
201
0
  r.xFrac   = mvHor & 15;
202
0
  r.yFrac   = mvVer & 15;
203
0
  r.ref     = cu.ref + ( h + ( mvVer >> 4 ) ) * cu.refStride + w + ( mvHor >> 4 );
204
0
  r.nearest = r.ref + ( r.yFrac >> 3 ) * cu.refStride + ( r.xFrac >> 3 );
205
0
  return r;
206
0
}
Unexecuted instantiation: vvencimpl.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: Rom.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: Slice.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: EncLib.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: MCTF.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: Unit.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: UnitTools.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: BitAllocation.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: CuTree.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: EncGOP.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: EncPicture.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: EncSlice.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: InterSearch.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: AdaptiveLoopFilter.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: CodingStructure.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: ContextModelling.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: InterPrediction.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: LoopFilter.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: Quant.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: SampleAdaptiveOffset.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: TrQuant.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: UnitPartitioner.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: CABACWriter.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: EncAdaptiveLoopFilter.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: EncCu.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: EncModeCtrl.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: EncSampleAdaptiveOffset.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: IntraSearch.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: DepQuant.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: IntraPrediction.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: MatrixIntraPrediction.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: QuantRDOQ2.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: DecCu.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
Unexecuted instantiation: QuantRDOQ.cpp:vvenc::affineLumaSubblockRef(vvenc::InterPredInterpolation::AffineLumaCU const&, int, int)
207
208
class DMVR : public InterPredInterpolation
209
{
210
  RdCost*                 m_pcRdCost;
211
212
  PelStorage              m_yuvPred[NUM_REF_PIC_LIST_01];
213
  PelStorage              m_yuvTmp[NUM_REF_PIC_LIST_01];
214
  PelStorage              m_yuvPad[NUM_REF_PIC_LIST_01];
215
  const Mv m_pSearchOffset[25] = { Mv(-2,-2), Mv(-1,-2), Mv(0,-2), Mv(1,-2), Mv(2,-2),
216
                                   Mv(-2,-1), Mv(-1,-1), Mv(0,-1), Mv(1,-1), Mv(2,-1),
217
                                   Mv(-2, 0), Mv(-1, 0), Mv(0, 0), Mv(1, 0), Mv(2, 0),
218
                                   Mv(-2, 1), Mv(-1, 1), Mv(0, 1), Mv(1, 1), Mv(2, 1),
219
                                   Mv(-2, 2), Mv(-1, 2), Mv(0, 2), Mv(1, 2), Mv(2, 2) };
220
private:
221
  void     xCopyAndPad          ( const CodingUnit& cu, PelUnitBuf& pcPad, RefPicList refId, bool forLuma);
222
  void     xFinalPaddedMCForDMVR( const CodingUnit& cu, PelUnitBuf* dstBuf, const PelUnitBuf *refBuf, const bool bioApplied, const Mv startMV[NUM_REF_PIC_LIST_01], const Mv& refMV );
223
224
protected:
225
  DMVR();
226
  virtual ~DMVR();
227
  void destroy();
228
  void init                    ( RdCost* pcRdCost, const ChromaFormat chFormat );
229
  void xProcessDMVR            ( const CodingUnit& cu, PelUnitBuf& pcYuvDst, const ClpRngs &clpRngs, const bool bioApplied );
230
};
231
232
class InterPrediction : public DMVR
233
{
234
protected:
235
  ChromaFormat m_currChromaFormat;
236
237
private:
238
  PelStorage   m_yuvPred[NUM_REF_PIC_LIST_01];
239
  bool         m_subPuMC;
240
  PelStorage   m_geoPartBuf[2]; 
241
  int          m_IBCBufferWidth;
242
  PelStorage   m_IBCBuffer;
243
  void xIntraBlockCopyIBC       ( CodingUnit& cu, PelUnitBuf& predBuf, const ComponentID compID );
244
245
  void xPredInterUni            ( const CodingUnit& cu, const RefPicList& refPicList, PelUnitBuf& pcYuvPred, const bool bi, const bool bdofApplied );
246
  void xPredInterBi             ( const CodingUnit& cu, PelUnitBuf& yuvPred, const bool bdofApplied = false, PelUnitBuf *yuvPredTmp = NULL );
247
  void xSubPuBDOF               ( const CodingUnit& cu, PelUnitBuf& predBuf, const RefPicList& refPicList = REF_PIC_LIST_X );
248
  bool xCheckIdenticalMotion    ( const CodingUnit& cu ) const;
249
250
public:
251
  InterPrediction();
252
  virtual ~InterPrediction();
253
254
  void    init                  ( RdCost* pcRdCost, ChromaFormat chromaFormatIDC, const int ctuSize, const int ifpLines = 0 );
255
  void    destroy               ();
256
257
  // inter
258
  bool    motionCompensation    ( CodingUnit& cu, PelUnitBuf& predBuf, const RefPicList& eRefPicList = REF_PIC_LIST_X, PelUnitBuf* predBufDfltWght = NULL );
259
  void    motionCompensationIBC ( CodingUnit& cu, PelUnitBuf& predBuf );
260
  void    xSubPuMC              ( CodingUnit& cu, PelUnitBuf& predBuf, const RefPicList& eRefPicList = REF_PIC_LIST_X );
261
  void    motionCompensationGeo ( CodingUnit& cu, PelUnitBuf& predBuf, const MergeCtx& geoMrgCtx );
262
  void    xFillIBCBuffer        ( CodingUnit& cu);
263
  void    resetIBCBuffer        ( const ChromaFormat chromaFormatIDC, const int ctuSize);
264
  void    resetVPDUforIBC       ( const ChromaFormat chromaFormatIDC, const int ctuSize, const int vSize, const int xPos, const int yPos);
265
  bool    isLumaBvValidIBC      ( const int ctuSize, const int xCb, const int yCb, const int width, const int height, const int xBv, const int yBv);
266
};
267
268
} // namespace vvenc
269
270
//! \}
271