Coverage Report

Created: 2026-04-01 07:49

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/vvdec/source/Lib/CommonLib/Reshape.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) 2018-2026, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. & The VVdeC 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
 /** \file     Reshape.h
44
     \brief    reshaping header and class (header)
45
 */
46
47
#pragma once
48
49
#include "CommonDef.h"
50
#include "Buffer.h"
51
#include "Slice.h"
52
53
namespace vvdec
54
{
55
56
class CodingStructure;
57
58
// ====================================================================================================================
59
// Class definition
60
// ====================================================================================================================
61
62
class Reshape
63
{
64
protected:
65
  SliceReshapeInfo        m_sliceReshapeInfo;
66
  Pel*                    m_invLUT;
67
  std::vector<int>        m_chromaAdjHelpLUT;
68
  std::vector<uint16_t>   m_binCW;
69
  uint16_t                m_initCW;
70
  std::vector<Pel>        m_reshapePivot;
71
  std::vector<Pel>        m_inputPivot;
72
  std::vector<Pel>        m_fwdScaleCoef;
73
  std::vector<Pel>        m_invScaleCoef;
74
  int                     m_lumaBD;
75
  int                     m_reshapeLUTSize;
76
  int                     m_chromaScale;
77
  int                     m_vpduX;
78
  int                     m_vpduY;
79
public:
80
  Reshape();
81
  ~Reshape();
82
83
  void createDec(int bitDepth);
84
  void destroy();
85
86
  void initSlice( int nalUnitLayerId, const PicHeader& picHeader, const VPS* vps );
87
  void rspCtuBcw( CodingStructure &cs, int col, int ln ) const;
88
  void rspBufFwd( PelBuf& buf ) const;
89
90
  bool getCTUFlag( const Slice& slice ) const;
91
92
  int  calculateChromaAdj(Pel avgLuma) const;
93
  int  getPWLIdxInv(int lumaVal) const;
94
0
  SliceReshapeInfo& getSliceReshaperInfo() { return m_sliceReshapeInfo; }
95
  void copySliceReshaperInfo(SliceReshapeInfo& tInfo, SliceReshapeInfo& sInfo);
96
97
  void constructReshaper();
98
  int  calculateChromaAdjVpduNei(TransformUnit &tu, const Position pos);
99
0
  void setVPDULoc(int x, int y) { m_vpduX = x, m_vpduY = y; }
100
0
  bool isVPDUprocessed(int x, int y) { return ((x == m_vpduX) && (y == m_vpduY)); }
101
0
  void setChromaScale (int chromaScale) { m_chromaScale = chromaScale; }
102
0
  int  getChromaScale() { return m_chromaScale; }
103
};// END CLASS DEFINITION Reshape
104
105
}   // namespace vvdec