Coverage Report

Created: 2026-09-01 06:57

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