Coverage Report

Created: 2026-10-17 06:56

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
3.40M
{
64
3.40M
  const uint32_t csx = getComponentScaleX(compID, chromaFormat);
65
3.40M
  const uint32_t csy = getComponentScaleY(compID, chromaFormat);
66
67
3.40M
  x      >>= csx;
68
3.40M
  y      >>= csy;
69
3.40M
  width  >>= csx;
70
3.40M
  height >>= csy;
71
3.40M
}
72
73
Position CompArea::chromaPos() const
74
54.0k
{
75
54.0k
  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
54.0k
  else
83
54.0k
  {
84
54.0k
    return *this;
85
54.0k
  }
86
54.0k
}
87
88
Size CompArea::lumaSize() const
89
2.75M
{
90
2.75M
  if( isChroma( compID ) )
91
2.19M
  {
92
2.19M
    uint32_t scaleX = getComponentScaleX( compID, chromaFormat );
93
2.19M
    uint32_t scaleY = getComponentScaleY( compID, chromaFormat );
94
95
2.19M
    return Size( width << scaleX, height << scaleY );
96
2.19M
  }
97
555k
  else
98
555k
  {
99
555k
    return *this;
100
555k
  }
101
2.75M
}
102
103
Size CompArea::chromaSize() const
104
108k
{
105
108k
  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
108k
  else
113
108k
  {
114
108k
    return *this;
115
108k
  }
116
108k
}
117
118
Position CompArea::lumaPos() const
119
1.27M
{
120
1.27M
  if( isChroma( compID ) )
121
1.01M
  {
122
1.01M
    uint32_t scaleX = getComponentScaleX( compID, chromaFormat );
123
1.01M
    uint32_t scaleY = getComponentScaleY( compID, chromaFormat );
124
125
1.01M
    return Position( x << scaleX, y << scaleY );
126
1.01M
  }
127
263k
  else
128
263k
  {
129
263k
    return *this;
130
263k
  }
131
1.27M
}
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
814k
UnitArea::UnitArea(const ChromaFormat _chromaFormat) : chromaFormat(_chromaFormat) { }
148
149
1.13M
UnitArea::UnitArea(const ChromaFormat _chromaFormat, const Area& _area) : chromaFormat(_chromaFormat), blocks(getNumberValidComponents(_chromaFormat))
150
1.13M
{
151
1.13M
  const uint32_t numCh = getNumberValidComponents(chromaFormat);
152
153
4.52M
  for (uint32_t i = 0; i < numCh; i++)
154
3.38M
  {
155
3.38M
    new (&blocks[i]) CompArea(ComponentID(i), chromaFormat, _area, true);
156
3.38M
  }
157
1.13M
}
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
514k
{
169
514k
  bool ret = true;
170
514k
  bool any = false;
171
172
514k
  for( const auto &blk : other.blocks )
173
1.54M
  {
174
1.54M
    if( blk.valid() && blocks[blk.compID].valid() )
175
1.27M
    {
176
1.27M
      ret &= blocks[blk.compID].contains( blk );
177
1.27M
      any = true;
178
1.27M
    }
179
1.54M
  }
180
181
514k
  return any && ret;
182
514k
}
183
184
bool UnitArea::contains( const UnitArea& other, const ChannelType chType ) const
185
54.0k
{
186
54.0k
  bool ret = true;
187
54.0k
  bool any = false;
188
189
54.0k
  for( const auto &blk : other.blocks )
190
162k
  {
191
162k
    if( toChannelType( blk.compID ) == chType && blk.valid() && blocks[blk.compID].valid() )
192
108k
    {
193
108k
      ret &= blocks[blk.compID].contains( blk );
194
108k
      any = true;
195
108k
    }
196
162k
  }
197
198
54.0k
  return any && ret;
199
54.0k
}
200
201
void UnitArea::repositionTo(const UnitArea& unitArea)
202
656k
{
203
2.62M
  for(uint32_t i = 0; i < blocks.size(); i++)
204
1.97M
  {
205
1.97M
    blocks[i].repositionTo(unitArea.blocks[i]);
206
1.97M
  }
207
656k
}
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
585k
{
230
585k
  UnitArea ret(chromaFormat);
231
232
585k
  for (const auto &blk : blocks)
233
1.75M
  {
234
1.75M
    if (toChannelType(blk.compID) == chType)
235
806k
    {
236
806k
      ret.blocks.push_back(blk);
237
806k
    }
238
950k
    else
239
950k
    {
240
950k
      ret.blocks.push_back(CompArea());
241
950k
    }
242
1.75M
  }
243
244
585k
  return ret;
245
585k
}
246
247
// ---------------------------------------------------------------------------
248
// coding unit method definitions
249
// ---------------------------------------------------------------------------
250
251
23.7k
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
146k
{
256
146k
  slice             = other.slice;
257
146k
  predMode          = other.predMode;
258
146k
  qtDepth           = other.qtDepth;
259
146k
  depth             = other.depth;
260
146k
  btDepth           = other.btDepth;
261
146k
  mtDepth           = other.mtDepth;
262
146k
  splitSeries       = other.splitSeries;
263
146k
  skip              = other.skip;
264
146k
  mmvdSkip          = other.mmvdSkip;
265
146k
  affine            = other.affine;
266
146k
  affineType        = other.affineType;
267
146k
  colorTransform    = other.colorTransform;
268
146k
  geo               = other.geo;
269
146k
  geo               = other.geo;
270
146k
  bdpcmM[CH_L]      = other.bdpcmM[CH_L];
271
146k
  bdpcmM[CH_C]      = other.bdpcmM[CH_C];
272
146k
  qp                = other.qp;
273
146k
  chromaQpAdj       = other.chromaQpAdj;
274
146k
  rootCbf           = other.rootCbf;
275
146k
  sbtInfo           = other.sbtInfo;
276
146k
  mtsFlag           = other.mtsFlag;
277
146k
  lfnstIdx          = other.lfnstIdx;
278
146k
  tileIdx           = other.tileIdx;
279
146k
  imv               = other.imv;
280
146k
  imvNumCand        = other.imvNumCand;
281
146k
  BcwIdx            = other.BcwIdx;
282
283
146k
  smvdMode          = other.smvdMode;
284
146k
  ispMode           = other.ispMode;
285
146k
  mipFlag           = other.mipFlag;
286
287
146k
  treeType          = other.treeType;
288
146k
  modeType          = other.modeType;
289
146k
  modeTypeSeries    = other.modeTypeSeries;
290
291
146k
  const IntraPredictionData& ipd = other;
292
146k
  *this = ipd;
293
294
146k
  const InterPredictionData& tpd = other;
295
146k
  *this = tpd;
296
146k
  return *this;
297
146k
}
298
299
void CodingUnit::initData()
300
295k
{
301
295k
  predMode          = NUMBER_OF_PREDICTION_MODES;
302
295k
  qtDepth           = 0;
303
295k
  depth             = 0;
304
295k
  btDepth           = 0;
305
295k
  mtDepth           = 0;
306
295k
  splitSeries       = 0;
307
295k
  skip              = false;
308
295k
  mmvdSkip          = false;
309
295k
  affine            = false;
310
295k
  affineType        = 0;
311
295k
  colorTransform    = false;
312
295k
  geo               = false;
313
295k
  bdpcmM[CH_L]      = 0;
314
295k
  bdpcmM[CH_C]      = 0;
315
295k
  qp                = 0;
316
295k
  chromaQpAdj       = 0;
317
295k
  rootCbf           = true;
318
295k
  sbtInfo           = 0;
319
295k
  mtsFlag           = 0;
320
295k
  lfnstIdx          = 0;
321
295k
  tileIdx           = 0;
322
295k
  imv               = IMV_OFF;
323
295k
  imvNumCand        = 0;
324
295k
  BcwIdx            = BCW_DEFAULT;
325
295k
  smvdMode          = 0;
326
295k
  ispMode           = 0;
327
295k
  mipFlag           = false;
328
329
295k
  treeType          = TREE_D;
330
295k
  modeType          = MODE_TYPE_ALL;
331
295k
  modeTypeSeries    = 0;
332
295k
  mcControl         = 0;
333
295k
}
334
335
336
337
338
// ---------------------------------------------------------------------------
339
// prediction unit method definitions
340
// ---------------------------------------------------------------------------
341
342
void CodingUnit::initPuData()
343
172k
{
344
  // intra data - need this default initialization for PCM
345
172k
  intraDir[0]       = DC_IDX;
346
172k
  intraDir[1]       = PLANAR_IDX;
347
172k
  multiRefIdx       = 0;
348
172k
  mipTransposedFlag = false;
349
350
  // inter data
351
172k
  mergeFlag         = false;
352
172k
  ciip              = false;
353
172k
  mvRefine          = false;
354
172k
  mmvdMergeFlag     = false;
355
172k
  mergeIdx          = MAX_UCHAR;
356
172k
  geoSplitDir       = MAX_UCHAR;
357
172k
  geoMergeIdx       = { MAX_SCHAR, MAX_SCHAR };
358
359
172k
  mcControl         = 0;
360
361
172k
  interDir          = MAX_UCHAR;
362
172k
  mmvdMergeIdx.val  = MmvdIdx::INVALID;
363
172k
  mergeType         = MRG_TYPE_DEFAULT_N;
364
365
172k
  if( mvdL0SubPu )
366
69.5k
  {
367
69.5k
    int maxDmvrMvds = std::max<int>( 1, lwidth() >> DMVR_SUBCU_SIZE_LOG2 ) * std::max<int>( 1, lheight() >> DMVR_SUBCU_SIZE_LOG2 );
368
403k
    for (uint32_t i = 0; i < maxDmvrMvds; i++)
369
333k
    {
370
333k
      mvdL0SubPu[i].setZero();
371
333k
    }
372
69.5k
  }
373
374
518k
  for (uint32_t i = 0; i < NUM_REF_PIC_LIST_01; i++)
375
345k
  {
376
345k
    mvpIdx[i] = MAX_UCHAR;
377
345k
    mvpNum[i] = MAX_UCHAR;
378
345k
    refIdx[i] = -1;
379
1.38M
    for( uint32_t j = 0; j < 3; j++ )
380
1.03M
    {
381
1.03M
      mvd[i][j].setZero();
382
1.03M
      mv [i][j].setZero();
383
1.03M
    }
384
345k
  }
385
172k
}
386
387
CodingUnit& CodingUnit::operator=( const IntraPredictionData& other )
388
146k
{
389
440k
  for( uint32_t i = 0; i < MAX_NUM_CH; i++ )
390
293k
  {
391
293k
    intraDir[ i ] = other.intraDir[ i ];
392
293k
  }
393
146k
  mipTransposedFlag = other.mipTransposedFlag;
394
146k
  multiRefIdx       = other.multiRefIdx;
395
146k
  return *this;
396
146k
}
397
398
CodingUnit& CodingUnit::operator=( const InterPredictionData& other )
399
146k
{
400
146k
  mergeFlag         = other.mergeFlag;
401
146k
  mergeIdx          = other.mergeIdx;
402
146k
  geoSplitDir       = other.geoSplitDir;
403
146k
  geoMergeIdx       = other.geoMergeIdx;
404
146k
  mmvdMergeFlag     = other.mmvdMergeFlag;
405
146k
  mmvdMergeIdx      = other.mmvdMergeIdx;
406
146k
  interDir          = other.interDir;
407
146k
  mergeType         = other.mergeType;
408
146k
  mvRefine          = other.mvRefine;
409
410
146k
  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
440k
  for (uint32_t i = 0; i < NUM_REF_PIC_LIST_01; i++)
418
293k
  {
419
293k
    mvpIdx[i]   = other.mvpIdx[i];
420
293k
    mvpNum[i]   = other.mvpNum[i];
421
293k
    refIdx[i]   = other.refIdx[i];
422
1.17M
    for( uint32_t j = 0; j < 3; j++ )
423
880k
    {
424
880k
      mvd[i][j] = other.mvd[i][j];
425
880k
      mv [i][j] = other.mv [i][j];
426
880k
    }
427
293k
  }
428
146k
  ciip = other.ciip;
429
146k
  return *this;
430
146k
}
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
21.1k
{
458
21.1k
  return cs->getMotionBuf( *this );
459
21.1k
}
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
920k
{
493
3.68M
  for( unsigned i = 0; i < MAX_NUM_TBLOCKS; i++ )
494
2.76M
  {
495
2.76M
    cbf[i]      = 0;
496
2.76M
    mtsIdx[i]   = MTS_DCT2_DCT2;
497
2.76M
    lastPos[i]  = 0;
498
2.76M
  }
499
920k
  depth       = 0;
500
920k
  noResidual  = false;
501
920k
  jointCbCr   = 0;
502
920k
  chromaAdj   = 0;
503
920k
}
504
505
void TransformUnit::init(TCoeffSig** coeffs)
506
490k
{
507
490k
  uint32_t numBlocks = getNumberValidComponents( chromaFormat );
508
509
1.96M
  for (uint32_t i = 0; i < numBlocks; i++)
510
1.47M
  {
511
1.47M
    m_coeffs[i] = coeffs[i];
512
1.47M
  }
513
490k
}
514
515
TransformUnit& TransformUnit::operator=( const TransformUnit& other )
516
37.1k
{
517
37.1k
  CHECK( chromaFormat != other.chromaFormat, "Incompatible formats" );
518
519
37.1k
  unsigned numBlocks = getNumberValidTBlocks(*cs->pcv);
520
148k
  for( unsigned i = 0; i < numBlocks; i++ )
521
111k
  {
522
111k
    CHECKD( blocks[i].area() != other.blocks[i].area(), "Transformation units cover different areas" );
523
524
111k
    cbf[i]      = other.cbf[i];
525
111k
    bool cpyRsi = other.cbf[i] || ( i && other.jointCbCr && numBlocks > 1 && ( TU::getCbf( other, COMP_Cb ) || TU::getCbf( other, COMP_Cr ) ) );
526
111k
    if( m_coeffs[i] && other.m_coeffs[i] && m_coeffs[i] != other.m_coeffs[i] && cpyRsi )
527
3.68k
    {
528
3.68k
      uint32_t area = blocks[i].area();
529
3.68k
      memcpy( m_coeffs[i], other.m_coeffs[i], sizeof( TCoeffSig ) * area );
530
3.68k
    }
531
111k
    mtsIdx[i]   = other.mtsIdx[i];
532
111k
    lastPos[i]  = other.lastPos[i];
533
111k
  }
534
37.1k
  depth         = other.depth;
535
37.1k
  noResidual    = other.noResidual;
536
37.1k
  jointCbCr     = other.jointCbCr;
537
37.1k
  return *this;
538
37.1k
}
539
540
void TransformUnit::copyComponentFrom( const TransformUnit& other, const ComponentID i )
541
3.34M
{
542
3.34M
  CHECK( chromaFormat != other.chromaFormat, "Incompatible formats" );
543
3.34M
  CHECKD( blocks[i].area() != other.blocks[i].area(), "Transformation units cover different areas" );
544
545
3.34M
  bool cpyRsi = other.cbf[i] || ( i && other.jointCbCr && blocks.size() > 1 && ( TU::getCbf( other, COMP_Cb ) || TU::getCbf( other, COMP_Cr ) ) );
546
3.34M
  if( m_coeffs[i] && other.m_coeffs[i] && m_coeffs[i] != other.m_coeffs[i] && cpyRsi )
547
1.27M
  {
548
1.27M
    uint32_t area = blocks[i].area();
549
1.27M
    memcpy( m_coeffs[i], other.m_coeffs[i], sizeof( TCoeffSig ) * area );
550
1.27M
  }
551
552
3.34M
  cbf[i]      = other.cbf[i];
553
554
3.34M
  depth       = other.depth;
555
3.34M
  mtsIdx[i]   = other.mtsIdx[i];
556
3.34M
  noResidual  = other.noResidual;
557
3.34M
  jointCbCr   = isChroma( i ) ? other.jointCbCr : jointCbCr;
558
3.34M
  lastPos[i]  = other.lastPos[i];
559
3.34M
}
560
561
void TransformUnit::checkTuNoResidual( unsigned idx )
562
21.1k
{
563
21.1k
  if( CU::getSbtIdx( cu->sbtInfo ) == SBT_OFF_DCT )
564
21.1k
  {
565
21.1k
    return;
566
21.1k
  }
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
844k
{
576
844k
  int tbArea = blocks[compID].width * blocks[compID].height;
577
844k
  int tbZeroOutWidth = blocks[compID].width;
578
844k
  int tbZeroOutHeight = blocks[compID].height;
579
580
844k
  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
844k
  tbZeroOutWidth = std::min<int>(JVET_C0024_ZERO_OUT_TH, tbZeroOutWidth);
586
844k
  tbZeroOutHeight = std::min<int>(JVET_C0024_ZERO_OUT_TH, tbZeroOutHeight);
587
844k
  tbArea = tbZeroOutWidth * tbZeroOutHeight;
588
844k
  return tbArea;
589
844k
}
590
591
} // namespace vvenc
592
593
//! \}
594