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/Unit.cpp
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
43
44
/** \file     Unit.cpp
45
 *  \brief    defines unit as a set of blocks and basic unit types (coding, prediction, transform)
46
 */
47
48
#include "Unit.h"
49
#include "Picture.h"
50
#include "UnitTools.h"
51
#include "UnitPartitioner.h"
52
53
//! \ingroup CommonLib
54
//! \{
55
56
namespace vvenc {
57
58
 // ---------------------------------------------------------------------------
59
 // block method definitions
60
 // ---------------------------------------------------------------------------
61
62
void CompArea::xRecalcLumaToChroma()
63
4.25M
{
64
4.25M
  const uint32_t csx = getComponentScaleX(compID, chromaFormat);
65
4.25M
  const uint32_t csy = getComponentScaleY(compID, chromaFormat);
66
67
4.25M
  x      >>= csx;
68
4.25M
  y      >>= csy;
69
4.25M
  width  >>= csx;
70
4.25M
  height >>= csy;
71
4.25M
}
72
73
Position CompArea::chromaPos() const
74
68.2k
{
75
68.2k
  if (isLuma(compID))
76
0
  {
77
0
    uint32_t scaleX = getComponentScaleX(compID, chromaFormat);
78
0
    uint32_t scaleY = getComponentScaleY(compID, chromaFormat);
79
80
0
    return Position(x >> scaleX, y >> scaleY);
81
0
  }
82
68.2k
  else
83
68.2k
  {
84
68.2k
    return *this;
85
68.2k
  }
86
68.2k
}
87
88
Size CompArea::lumaSize() const
89
3.41M
{
90
3.41M
  if( isChroma( compID ) )
91
2.76M
  {
92
2.76M
    uint32_t scaleX = getComponentScaleX( compID, chromaFormat );
93
2.76M
    uint32_t scaleY = getComponentScaleY( compID, chromaFormat );
94
95
2.76M
    return Size( width << scaleX, height << scaleY );
96
2.76M
  }
97
651k
  else
98
651k
  {
99
651k
    return *this;
100
651k
  }
101
3.41M
}
102
103
Size CompArea::chromaSize() const
104
136k
{
105
136k
  if( isLuma( compID ) )
106
0
  {
107
0
    uint32_t scaleX = getComponentScaleX( compID, chromaFormat );
108
0
    uint32_t scaleY = getComponentScaleY( compID, chromaFormat );
109
110
0
    return Size( width >> scaleX, height >> scaleY );
111
0
  }
112
136k
  else
113
136k
  {
114
136k
    return *this;
115
136k
  }
116
136k
}
117
118
Position CompArea::lumaPos() const
119
1.58M
{
120
1.58M
  if( isChroma( compID ) )
121
1.25M
  {
122
1.25M
    uint32_t scaleX = getComponentScaleX( compID, chromaFormat );
123
1.25M
    uint32_t scaleY = getComponentScaleY( compID, chromaFormat );
124
125
1.25M
    return Position( x << scaleX, y << scaleY );
126
1.25M
  }
127
336k
  else
128
336k
  {
129
336k
    return *this;
130
336k
  }
131
1.58M
}
132
133
Position CompArea::compPos( const ComponentID compID ) const
134
0
{
135
0
  return isLuma( compID ) ? lumaPos() : chromaPos();
136
0
}
137
138
Position CompArea::chanPos( const ChannelType chType ) const
139
0
{
140
0
  return isLuma( chType ) ? lumaPos() : chromaPos();
141
0
}
142
143
// ---------------------------------------------------------------------------
144
// unit method definitions
145
// ---------------------------------------------------------------------------
146
147
1.03M
UnitArea::UnitArea(const ChromaFormat _chromaFormat) : chromaFormat(_chromaFormat) { }
148
149
1.42M
UnitArea::UnitArea(const ChromaFormat _chromaFormat, const Area& _area) : chromaFormat(_chromaFormat), blocks(getNumberValidComponents(_chromaFormat))
150
1.42M
{
151
1.42M
  const uint32_t numCh = getNumberValidComponents(chromaFormat);
152
153
5.65M
  for (uint32_t i = 0; i < numCh; i++)
154
4.23M
  {
155
4.23M
    new (&blocks[i]) CompArea(ComponentID(i), chromaFormat, _area, true);
156
4.23M
  }
157
1.42M
}
158
159
0
UnitArea::UnitArea(const ChromaFormat _chromaFormat, const CompArea&  blkY) : chromaFormat(_chromaFormat), blocks { blkY } {}
160
161
0
UnitArea::UnitArea(const ChromaFormat _chromaFormat,       CompArea&& blkY) : chromaFormat(_chromaFormat), blocks { std::forward<CompArea>(blkY) } {}
162
163
0
UnitArea::UnitArea(const ChromaFormat _chromaFormat, const CompArea&  blkY, const CompArea& blkCb, const CompArea& blkCr)  : chromaFormat(_chromaFormat), blocks { blkY, blkCb, blkCr } {}
164
165
0
UnitArea::UnitArea(const ChromaFormat _chromaFormat,       CompArea&& blkY,      CompArea&& blkCb,      CompArea&& blkCr) : chromaFormat(_chromaFormat), blocks { std::forward<CompArea>(blkY), std::forward<CompArea>(blkCb), std::forward<CompArea>(blkCr) } {}
166
167
bool UnitArea::contains(const UnitArea& other) const
168
651k
{
169
651k
  bool ret = true;
170
651k
  bool any = false;
171
172
651k
  for( const auto &blk : other.blocks )
173
1.95M
  {
174
1.95M
    if( blk.valid() && blocks[blk.compID].valid() )
175
1.61M
    {
176
1.61M
      ret &= blocks[blk.compID].contains( blk );
177
1.61M
      any = true;
178
1.61M
    }
179
1.95M
  }
180
181
651k
  return any && ret;
182
651k
}
183
184
bool UnitArea::contains( const UnitArea& other, const ChannelType chType ) const
185
68.2k
{
186
68.2k
  bool ret = true;
187
68.2k
  bool any = false;
188
189
68.2k
  for( const auto &blk : other.blocks )
190
204k
  {
191
204k
    if( toChannelType( blk.compID ) == chType && blk.valid() && blocks[blk.compID].valid() )
192
136k
    {
193
136k
      ret &= blocks[blk.compID].contains( blk );
194
136k
      any = true;
195
136k
    }
196
204k
  }
197
198
68.2k
  return any && ret;
199
68.2k
}
200
201
void UnitArea::repositionTo(const UnitArea& unitArea)
202
825k
{
203
3.30M
  for(uint32_t i = 0; i < blocks.size(); i++)
204
2.47M
  {
205
2.47M
    blocks[i].repositionTo(unitArea.blocks[i]);
206
2.47M
  }
207
825k
}
208
209
const UnitArea UnitArea::singleComp(const ComponentID compID) const
210
0
{
211
0
  UnitArea ret(chromaFormat);
212
213
0
  for (const auto &blk : blocks)
214
0
  {
215
0
    if (blk.compID == compID)
216
0
    {
217
0
      ret.blocks.push_back(blk);
218
0
    }
219
0
    else
220
0
    {
221
0
      ret.blocks.push_back(CompArea());
222
0
    }
223
0
  }
224
225
0
  return ret;
226
0
}
227
228
const UnitArea UnitArea::singleChan(const ChannelType chType) const
229
740k
{
230
740k
  UnitArea ret(chromaFormat);
231
232
740k
  for (const auto &blk : blocks)
233
2.22M
  {
234
2.22M
    if (toChannelType(blk.compID) == chType)
235
1.01M
    {
236
1.01M
      ret.blocks.push_back(blk);
237
1.01M
    }
238
1.20M
    else
239
1.20M
    {
240
1.20M
      ret.blocks.push_back(CompArea());
241
1.20M
    }
242
2.22M
  }
243
244
740k
  return ret;
245
740k
}
246
247
// ---------------------------------------------------------------------------
248
// coding unit method definitions
249
// ---------------------------------------------------------------------------
250
251
30.0k
CodingUnit::CodingUnit(const UnitArea& unit)                                : UnitArea(unit),                 cs(nullptr), slice(nullptr), chType( CH_L ), next(nullptr), firstTU(nullptr), lastTU(nullptr) { initData(); initPuData(); }
252
0
CodingUnit::CodingUnit(const ChromaFormat _chromaFormat, const Area& _area) : UnitArea(_chromaFormat, _area), cs(nullptr), slice(nullptr), chType( CH_L ), next(nullptr), firstTU(nullptr), lastTU(nullptr) { initData(); initPuData(); }
253
254
CodingUnit& CodingUnit::operator=( const CodingUnit& other )
255
185k
{
256
185k
  slice             = other.slice;
257
185k
  predMode          = other.predMode;
258
185k
  qtDepth           = other.qtDepth;
259
185k
  depth             = other.depth;
260
185k
  btDepth           = other.btDepth;
261
185k
  mtDepth           = other.mtDepth;
262
185k
  splitSeries       = other.splitSeries;
263
185k
  skip              = other.skip;
264
185k
  mmvdSkip          = other.mmvdSkip;
265
185k
  affine            = other.affine;
266
185k
  affineType        = other.affineType;
267
185k
  colorTransform    = other.colorTransform;
268
185k
  geo               = other.geo;
269
185k
  geo               = other.geo;
270
185k
  bdpcmM[CH_L]      = other.bdpcmM[CH_L];
271
185k
  bdpcmM[CH_C]      = other.bdpcmM[CH_C];
272
185k
  qp                = other.qp;
273
185k
  chromaQpAdj       = other.chromaQpAdj;
274
185k
  rootCbf           = other.rootCbf;
275
185k
  sbtInfo           = other.sbtInfo;
276
185k
  mtsFlag           = other.mtsFlag;
277
185k
  lfnstIdx          = other.lfnstIdx;
278
185k
  tileIdx           = other.tileIdx;
279
185k
  imv               = other.imv;
280
185k
  imvNumCand        = other.imvNumCand;
281
185k
  BcwIdx            = other.BcwIdx;
282
283
185k
  smvdMode          = other.smvdMode;
284
185k
  ispMode           = other.ispMode;
285
185k
  mipFlag           = other.mipFlag;
286
287
185k
  treeType          = other.treeType;
288
185k
  modeType          = other.modeType;
289
185k
  modeTypeSeries    = other.modeTypeSeries;
290
291
185k
  const IntraPredictionData& ipd = other;
292
185k
  *this = ipd;
293
294
185k
  const InterPredictionData& tpd = other;
295
185k
  *this = tpd;
296
185k
  return *this;
297
185k
}
298
299
void CodingUnit::initData()
300
373k
{
301
373k
  predMode          = NUMBER_OF_PREDICTION_MODES;
302
373k
  qtDepth           = 0;
303
373k
  depth             = 0;
304
373k
  btDepth           = 0;
305
373k
  mtDepth           = 0;
306
373k
  splitSeries       = 0;
307
373k
  skip              = false;
308
373k
  mmvdSkip          = false;
309
373k
  affine            = false;
310
373k
  affineType        = 0;
311
373k
  colorTransform    = false;
312
373k
  geo               = false;
313
373k
  bdpcmM[CH_L]      = 0;
314
373k
  bdpcmM[CH_C]      = 0;
315
373k
  qp                = 0;
316
373k
  chromaQpAdj       = 0;
317
373k
  rootCbf           = true;
318
373k
  sbtInfo           = 0;
319
373k
  mtsFlag           = 0;
320
373k
  lfnstIdx          = 0;
321
373k
  tileIdx           = 0;
322
373k
  imv               = IMV_OFF;
323
373k
  imvNumCand        = 0;
324
373k
  BcwIdx            = BCW_DEFAULT;
325
373k
  smvdMode          = 0;
326
373k
  ispMode           = 0;
327
373k
  mipFlag           = false;
328
329
373k
  treeType          = TREE_D;
330
373k
  modeType          = MODE_TYPE_ALL;
331
373k
  modeTypeSeries    = 0;
332
373k
  mcControl         = 0;
333
373k
}
334
335
336
337
338
// ---------------------------------------------------------------------------
339
// prediction unit method definitions
340
// ---------------------------------------------------------------------------
341
342
void CodingUnit::initPuData()
343
218k
{
344
  // intra data - need this default initialization for PCM
345
218k
  intraDir[0]       = DC_IDX;
346
218k
  intraDir[1]       = PLANAR_IDX;
347
218k
  multiRefIdx       = 0;
348
218k
  mipTransposedFlag = false;
349
350
  // inter data
351
218k
  mergeFlag         = false;
352
218k
  ciip              = false;
353
218k
  mvRefine          = false;
354
218k
  mmvdMergeFlag     = false;
355
218k
  mergeIdx          = MAX_UCHAR;
356
218k
  geoSplitDir       = MAX_UCHAR;
357
218k
  geoMergeIdx       = { MAX_SCHAR, MAX_SCHAR };
358
359
218k
  mcControl         = 0;
360
361
218k
  interDir          = MAX_UCHAR;
362
218k
  mmvdMergeIdx.val  = MmvdIdx::INVALID;
363
218k
  mergeType         = MRG_TYPE_DEFAULT_N;
364
365
218k
  if( mvdL0SubPu )
366
88.1k
  {
367
88.1k
    int maxDmvrMvds = std::max<int>( 1, lwidth() >> DMVR_SUBCU_SIZE_LOG2 ) * std::max<int>( 1, lheight() >> DMVR_SUBCU_SIZE_LOG2 );
368
537k
    for (uint32_t i = 0; i < maxDmvrMvds; i++)
369
449k
    {
370
449k
      mvdL0SubPu[i].setZero();
371
449k
    }
372
88.1k
  }
373
374
655k
  for (uint32_t i = 0; i < NUM_REF_PIC_LIST_01; i++)
375
436k
  {
376
436k
    mvpIdx[i] = MAX_UCHAR;
377
436k
    mvpNum[i] = MAX_UCHAR;
378
436k
    refIdx[i] = -1;
379
1.74M
    for( uint32_t j = 0; j < 3; j++ )
380
1.31M
    {
381
1.31M
      mvd[i][j].setZero();
382
1.31M
      mv [i][j].setZero();
383
1.31M
    }
384
436k
  }
385
218k
}
386
387
CodingUnit& CodingUnit::operator=( const IntraPredictionData& other )
388
185k
{
389
555k
  for( uint32_t i = 0; i < MAX_NUM_CH; i++ )
390
370k
  {
391
370k
    intraDir[ i ] = other.intraDir[ i ];
392
370k
  }
393
185k
  mipTransposedFlag = other.mipTransposedFlag;
394
185k
  multiRefIdx       = other.multiRefIdx;
395
185k
  return *this;
396
185k
}
397
398
CodingUnit& CodingUnit::operator=( const InterPredictionData& other )
399
185k
{
400
185k
  mergeFlag         = other.mergeFlag;
401
185k
  mergeIdx          = other.mergeIdx;
402
185k
  geoSplitDir       = other.geoSplitDir;
403
185k
  geoMergeIdx       = other.geoMergeIdx;
404
185k
  mmvdMergeFlag     = other.mmvdMergeFlag;
405
185k
  mmvdMergeIdx      = other.mmvdMergeIdx;
406
185k
  interDir          = other.interDir;
407
185k
  mergeType         = other.mergeType;
408
185k
  mvRefine          = other.mvRefine;
409
410
185k
  if( other.mergeFlag && mvdL0SubPu )
411
0
  {
412
0
    const int maxDmvrMvds = std::max<int>( 1, lwidth() >> DMVR_SUBCU_SIZE_LOG2 ) * std::max<int>( 1, lheight() >> DMVR_SUBCU_SIZE_LOG2 );
413
414
0
    memcpy( mvdL0SubPu, other.mvdL0SubPu, sizeof( Mv ) * maxDmvrMvds );
415
0
  }
416
417
555k
  for (uint32_t i = 0; i < NUM_REF_PIC_LIST_01; i++)
418
370k
  {
419
370k
    mvpIdx[i]   = other.mvpIdx[i];
420
370k
    mvpNum[i]   = other.mvpNum[i];
421
370k
    refIdx[i]   = other.refIdx[i];
422
1.48M
    for( uint32_t j = 0; j < 3; j++ )
423
1.11M
    {
424
1.11M
      mvd[i][j] = other.mvd[i][j];
425
1.11M
      mv [i][j] = other.mv [i][j];
426
1.11M
    }
427
370k
  }
428
185k
  ciip = other.ciip;
429
185k
  return *this;
430
185k
}
431
432
CodingUnit& CodingUnit::operator=( const MotionInfo& mi )
433
0
{
434
0
  interDir = mi.interDir();
435
436
0
  for( uint32_t i = 0; i < NUM_REF_PIC_LIST_01; i++ )
437
0
  {
438
0
    refIdx[i] = mi.miRefIdx[i];
439
0
    mv [i][0] = mi.mv[i];
440
0
  }
441
442
0
  return *this;
443
0
}
444
445
const MotionInfo& CodingUnit::getMotionInfo() const
446
0
{
447
0
  return cs->getMotionInfo( lumaPos() );
448
0
}
449
450
const MotionInfo& CodingUnit::getMotionInfo( const Position& pos ) const
451
0
{
452
0
  CHECKD( !Y().contains( pos ), "Trying to access motion info outsied of PU" );
453
0
  return cs->getMotionInfo( pos );
454
0
}
455
456
MotionBuf CodingUnit::getMotionBuf()
457
26.8k
{
458
26.8k
  return cs->getMotionBuf( *this );
459
26.8k
}
460
461
CMotionBuf CodingUnit::getMotionBuf() const
462
0
{
463
0
  return cs->getMotionBuf( *this );
464
0
}
465
466
467
// ---------------------------------------------------------------------------
468
// transform unit method definitions
469
// ---------------------------------------------------------------------------
470
471
0
TransformUnit::TransformUnit(const UnitArea& unit) : UnitArea(unit), cu(nullptr), cs(nullptr), chType( CH_L ), next( nullptr )
472
0
{
473
0
  for( unsigned i = 0; i < MAX_NUM_TBLOCKS; i++ )
474
0
  {
475
0
    m_coeffs[i] = nullptr;
476
0
  }
477
478
0
  initData();
479
0
}
480
481
0
TransformUnit::TransformUnit(const ChromaFormat _chromaFormat, const Area& _area) : UnitArea(_chromaFormat, _area), cu(nullptr), cs(nullptr), chType( CH_L ), next( nullptr )
482
0
{
483
0
  for( unsigned i = 0; i < MAX_NUM_TBLOCKS; i++ )
484
0
  {
485
0
    m_coeffs[i] = nullptr;
486
0
  }
487
488
0
  initData();
489
0
}
490
491
void TransformUnit::initData()
492
1.15M
{
493
4.63M
  for( unsigned i = 0; i < MAX_NUM_TBLOCKS; i++ )
494
3.47M
  {
495
3.47M
    cbf[i]      = 0;
496
3.47M
    mtsIdx[i]   = MTS_DCT2_DCT2;
497
3.47M
    lastPos[i]  = 0;
498
3.47M
  }
499
1.15M
  depth       = 0;
500
1.15M
  noResidual  = false;
501
1.15M
  jointCbCr   = 0;
502
1.15M
  chromaAdj   = 0;
503
1.15M
}
504
505
void TransformUnit::init(TCoeffSig** coeffs)
506
0
{
507
0
  uint32_t numBlocks = getNumberValidComponents( chromaFormat );
508
509
0
  for (uint32_t i = 0; i < numBlocks; i++)
510
0
  {
511
0
    m_coeffs[i] = coeffs[i];
512
0
  }
513
0
}
514
515
TransformUnit& TransformUnit::operator=( const TransformUnit& other )
516
47.6k
{
517
47.6k
  CHECK( chromaFormat != other.chromaFormat, "Incompatible formats" );
518
519
47.6k
  unsigned numBlocks = getNumberValidTBlocks(*cs->pcv);
520
190k
  for( unsigned i = 0; i < numBlocks; i++ )
521
142k
  {
522
142k
    CHECKD( blocks[i].area() != other.blocks[i].area(), "Transformation units cover different areas" );
523
524
142k
    cbf[i]      = other.cbf[i];
525
142k
    bool cpyRsi = other.cbf[i] || ( i && other.jointCbCr && numBlocks > 1 && ( TU::getCbf( other, COMP_Cb ) || TU::getCbf( other, COMP_Cr ) ) );
526
142k
    if( m_coeffs[i] && other.m_coeffs[i] && m_coeffs[i] != other.m_coeffs[i] && cpyRsi )
527
4.50k
    {
528
4.50k
      uint32_t area = blocks[i].area();
529
4.50k
      memcpy( m_coeffs[i], other.m_coeffs[i], sizeof( TCoeffSig ) * area );
530
4.50k
    }
531
142k
    mtsIdx[i]   = other.mtsIdx[i];
532
142k
    lastPos[i]  = other.lastPos[i];
533
142k
  }
534
47.6k
  depth         = other.depth;
535
47.6k
  noResidual    = other.noResidual;
536
47.6k
  jointCbCr     = other.jointCbCr;
537
47.6k
  return *this;
538
47.6k
}
539
540
void TransformUnit::copyComponentFrom( const TransformUnit& other, const ComponentID i )
541
4.22M
{
542
4.22M
  CHECK( chromaFormat != other.chromaFormat, "Incompatible formats" );
543
4.22M
  CHECKD( blocks[i].area() != other.blocks[i].area(), "Transformation units cover different areas" );
544
545
4.22M
  bool cpyRsi = other.cbf[i] || ( i && other.jointCbCr && blocks.size() > 1 && ( TU::getCbf( other, COMP_Cb ) || TU::getCbf( other, COMP_Cr ) ) );
546
4.22M
  if( m_coeffs[i] && other.m_coeffs[i] && m_coeffs[i] != other.m_coeffs[i] && cpyRsi )
547
1.60M
  {
548
1.60M
    uint32_t area = blocks[i].area();
549
1.60M
    memcpy( m_coeffs[i], other.m_coeffs[i], sizeof( TCoeffSig ) * area );
550
1.60M
  }
551
552
4.22M
  cbf[i]      = other.cbf[i];
553
554
4.22M
  depth       = other.depth;
555
4.22M
  mtsIdx[i]   = other.mtsIdx[i];
556
4.22M
  noResidual  = other.noResidual;
557
4.22M
  jointCbCr   = isChroma( i ) ? other.jointCbCr : jointCbCr;
558
4.22M
  lastPos[i]  = other.lastPos[i];
559
4.22M
}
560
561
void TransformUnit::checkTuNoResidual( unsigned idx )
562
26.8k
{
563
26.8k
  if( CU::getSbtIdx( cu->sbtInfo ) == SBT_OFF_DCT )
564
26.8k
  {
565
26.8k
    return;
566
26.8k
  }
567
568
0
  if( ( CU::getSbtPos( cu->sbtInfo ) == SBT_POS0 && idx == 1 ) || ( CU::getSbtPos( cu->sbtInfo ) == SBT_POS1 && idx == 0 ) )
569
0
  {
570
0
    noResidual = true;
571
0
  }
572
0
}
573
574
int TransformUnit::getTbAreaAfterCoefZeroOut(ComponentID compID) const
575
1.04M
{
576
1.04M
  int tbArea = blocks[compID].width * blocks[compID].height;
577
1.04M
  int tbZeroOutWidth = blocks[compID].width;
578
1.04M
  int tbZeroOutHeight = blocks[compID].height;
579
580
1.04M
  if (cs->sps->MTS && cu->sbtInfo != 0 && blocks[compID].width <= 32 && blocks[compID].height <= 32 && compID == COMP_Y)
581
0
  {
582
0
    tbZeroOutWidth = (blocks[compID].width == 32) ? 16 : tbZeroOutWidth;
583
0
    tbZeroOutHeight = (blocks[compID].height == 32) ? 16 : tbZeroOutHeight;
584
0
  }
585
1.04M
  tbZeroOutWidth = std::min<int>(JVET_C0024_ZERO_OUT_TH, tbZeroOutWidth);
586
1.04M
  tbZeroOutHeight = std::min<int>(JVET_C0024_ZERO_OUT_TH, tbZeroOutHeight);
587
1.04M
  tbArea = tbZeroOutWidth * tbZeroOutHeight;
588
1.04M
  return tbArea;
589
1.04M
}
590
591
} // namespace vvenc
592
593
//! \}
594