Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
ECM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xinwei Li
ECM
Commits
3453fb0b
Commit
3453fb0b
authored
4 years ago
by
Frank Bossen
Browse files
Options
Downloads
Patches
Plain Diff
Fix formatting: braces, spaces, indentation
parent
deeb649e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/Lib/CommonLib/TrQuant.cpp
+212
-162
212 additions, 162 deletions
source/Lib/CommonLib/TrQuant.cpp
with
212 additions
and
162 deletions
source/Lib/CommonLib/TrQuant.cpp
+
212
−
162
View file @
3453fb0b
...
@@ -144,12 +144,31 @@ template<int signedMode> void invTransformCbCr( PelBuf &resCb, PelBuf &resCr )
...
@@ -144,12 +144,31 @@ template<int signedMode> void invTransformCbCr( PelBuf &resCb, PelBuf &resCr )
{
{
for
(
SizeType
x
=
0
;
x
<
resCb
.
width
;
x
++
)
for
(
SizeType
x
=
0
;
x
<
resCb
.
width
;
x
++
)
{
{
if
(
signedMode
==
1
)
{
cr
[
x
]
=
cb
[
x
]
>>
1
;
}
if
(
signedMode
==
1
)
else
if
(
signedMode
==
-
1
)
{
cr
[
x
]
=
-
cb
[
x
]
>>
1
;
}
{
else
if
(
signedMode
==
2
)
{
cr
[
x
]
=
cb
[
x
];
}
cr
[
x
]
=
cb
[
x
]
>>
1
;
else
if
(
signedMode
==
-
2
)
{
cr
[
x
]
=
(
cb
[
x
]
==
-
32768
&&
sizeof
(
Pel
)
==
2
)
?
32767
:
-
cb
[
x
];
}
// non-normative clipping to prevent 16-bit overflow
}
else
if
(
signedMode
==
3
)
{
cb
[
x
]
=
cr
[
x
]
>>
1
;
}
else
if
(
signedMode
==
-
1
)
else
if
(
signedMode
==
-
3
)
{
cb
[
x
]
=
-
cr
[
x
]
>>
1
;
}
{
cr
[
x
]
=
-
cb
[
x
]
>>
1
;
}
else
if
(
signedMode
==
2
)
{
cr
[
x
]
=
cb
[
x
];
}
else
if
(
signedMode
==
-
2
)
{
// non-normative clipping to prevent 16-bit overflow
cr
[
x
]
=
(
cb
[
x
]
==
-
32768
&&
sizeof
(
Pel
)
==
2
)
?
32767
:
-
cb
[
x
];
}
else
if
(
signedMode
==
3
)
{
cb
[
x
]
=
cr
[
x
]
>>
1
;
}
else
if
(
signedMode
==
-
3
)
{
cb
[
x
]
=
-
cr
[
x
]
>>
1
;
}
}
}
}
}
}
}
...
@@ -217,9 +236,7 @@ void TrQuant::init( const Quant* otherQuant,
...
@@ -217,9 +236,7 @@ void TrQuant::init( const Quant* otherQuant,
delete
m_quant
;
delete
m_quant
;
m_quant
=
nullptr
;
m_quant
=
nullptr
;
{
m_quant
=
new
DepQuant
(
otherQuant
,
bEnc
);
m_quant
=
new
DepQuant
(
otherQuant
,
bEnc
);
}
if
(
m_quant
)
if
(
m_quant
)
{
{
...
@@ -371,62 +388,71 @@ void TrQuant::xInvLfnst( const TransformUnit &tu, const ComponentID compID )
...
@@ -371,62 +388,71 @@ void TrQuant::xInvLfnst( const TransformUnit &tu, const ComponentID compID )
bool
tu8x8Flag
=
(
width
==
8
&&
height
==
8
);
bool
tu8x8Flag
=
(
width
==
8
&&
height
==
8
);
TCoeff
*
lfnstTemp
;
TCoeff
*
lfnstTemp
;
TCoeff
*
coeffTemp
;
TCoeff
*
coeffTemp
;
int
y
;
int
y
;
lfnstTemp
=
m_tempInMatrix
;
// inverse spectral rearrangement
lfnstTemp
=
m_tempInMatrix
;
// inverse spectral rearrangement
coeffTemp
=
m_tempCoeff
;
coeffTemp
=
m_tempCoeff
;
TCoeff
*
dst
=
lfnstTemp
;
TCoeff
*
dst
=
lfnstTemp
;
const
ScanElement
*
scanPtr
=
scan
;
for
(
y
=
0
;
y
<
16
;
y
++
)
const
ScanElement
*
scanPtr
=
scan
;
{
for
(
y
=
0
;
y
<
16
;
y
++
)
*
dst
++
=
coeffTemp
[
scanPtr
->
idx
];
{
scanPtr
++
;
*
dst
++
=
coeffTemp
[
scanPtr
->
idx
];
}
scanPtr
++
;
}
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT
invLfnstNxN
(
m_tempInMatrix
,
m_tempOutMatrix
,
g_lfnstLut
[
intraMode
],
lfnstIdx
-
1
,
sbSize
,
(
tu4x4Flag
||
tu8x8Flag
)
?
8
:
16
,
maxLog2TrDynamicRange
);
invLfnstNxN
(
m_tempInMatrix
,
m_tempOutMatrix
,
g_lfnstLut
[
intraMode
],
lfnstIdx
-
1
,
sbSize
,
(
tu4x4Flag
||
tu8x8Flag
)
?
8
:
16
,
maxLog2TrDynamicRange
);
#else
#else
invLfnstNxN
(
m_tempInMatrix
,
m_tempOutMatrix
,
g_lfnstLut
[
intraMode
],
lfnstIdx
-
1
,
sbSize
,
(
tu4x4Flag
||
tu8x8Flag
)
?
8
:
16
);
invLfnstNxN
(
m_tempInMatrix
,
m_tempOutMatrix
,
g_lfnstLut
[
intraMode
],
lfnstIdx
-
1
,
sbSize
,
(
tu4x4Flag
||
tu8x8Flag
)
?
8
:
16
);
#endif
#endif
lfnstTemp
=
m_tempOutMatrix
;
// inverse spectral rearrangement
lfnstTemp
=
m_tempOutMatrix
;
// inverse spectral rearrangement
if
(
transposeFlag
)
if
(
transposeFlag
)
{
if
(
sbSize
==
4
)
{
for
(
y
=
0
;
y
<
4
;
y
++
)
{
{
if
(
sbSize
==
4
)
coeffTemp
[
0
]
=
lfnstTemp
[
0
];
{
coeffTemp
[
1
]
=
lfnstTemp
[
4
];
for
(
y
=
0
;
y
<
4
;
y
++
)
coeffTemp
[
2
]
=
lfnstTemp
[
8
];
{
coeffTemp
[
3
]
=
lfnstTemp
[
12
];
coeffTemp
[
0
]
=
lfnstTemp
[
0
];
coeffTemp
[
1
]
=
lfnstTemp
[
4
];
lfnstTemp
++
;
coeffTemp
[
2
]
=
lfnstTemp
[
8
];
coeffTemp
[
3
]
=
lfnstTemp
[
12
];
coeffTemp
+=
width
;
lfnstTemp
++
;
coeffTemp
+=
width
;
}
}
else
// ( sbSize == 8 )
{
for
(
y
=
0
;
y
<
8
;
y
++
)
{
coeffTemp
[
0
]
=
lfnstTemp
[
0
];
coeffTemp
[
1
]
=
lfnstTemp
[
8
];
coeffTemp
[
2
]
=
lfnstTemp
[
16
];
coeffTemp
[
3
]
=
lfnstTemp
[
24
];
if
(
y
<
4
)
{
coeffTemp
[
4
]
=
lfnstTemp
[
32
];
coeffTemp
[
5
]
=
lfnstTemp
[
36
];
coeffTemp
[
6
]
=
lfnstTemp
[
40
];
coeffTemp
[
7
]
=
lfnstTemp
[
44
];
}
lfnstTemp
++
;
coeffTemp
+=
width
;
}
}
}
}
else
}
else
// ( sbSize == 8 )
{
for
(
y
=
0
;
y
<
8
;
y
++
)
{
{
for
(
y
=
0
;
y
<
sbSize
;
y
++
)
coeffTemp
[
0
]
=
lfnstTemp
[
0
];
coeffTemp
[
1
]
=
lfnstTemp
[
8
];
coeffTemp
[
2
]
=
lfnstTemp
[
16
];
coeffTemp
[
3
]
=
lfnstTemp
[
24
];
if
(
y
<
4
)
{
{
uint32_t
uiStride
=
(
y
<
4
)
?
sbSize
:
4
;
coeffTemp
[
4
]
=
lfnstTemp
[
32
]
;
::
memcpy
(
coeffTemp
,
lfnstTemp
,
uiStride
*
sizeof
(
TCoeff
)
)
;
coeffTemp
[
5
]
=
lfnstTemp
[
36
]
;
lfnstTemp
+=
uiStride
;
coeffTemp
[
6
]
=
lfnstTemp
[
40
]
;
coeffTemp
+=
width
;
coeffTemp
[
7
]
=
lfnstTemp
[
44
]
;
}
}
lfnstTemp
++
;
coeffTemp
+=
width
;
}
}
}
}
else
{
for
(
y
=
0
;
y
<
sbSize
;
y
++
)
{
uint32_t
uiStride
=
(
y
<
4
)
?
sbSize
:
4
;
::
memcpy
(
coeffTemp
,
lfnstTemp
,
uiStride
*
sizeof
(
TCoeff
));
lfnstTemp
+=
uiStride
;
coeffTemp
+=
width
;
}
}
}
}
}
}
}
}
...
@@ -465,60 +491,69 @@ void TrQuant::xFwdLfnst( const TransformUnit &tu, const ComponentID compID, cons
...
@@ -465,60 +491,69 @@ void TrQuant::xFwdLfnst( const TransformUnit &tu, const ComponentID compID, cons
TCoeff
*
coeffTemp
;
TCoeff
*
coeffTemp
;
TCoeff
*
tempCoeff
=
loadTr
?
m_mtsCoeffs
[
tu
.
mtsIdx
[
compID
]]
:
m_tempCoeff
;
TCoeff
*
tempCoeff
=
loadTr
?
m_mtsCoeffs
[
tu
.
mtsIdx
[
compID
]]
:
m_tempCoeff
;
int
y
;
int
y
;
lfnstTemp
=
m_tempInMatrix
;
// forward low frequency non-separable transform
lfnstTemp
=
m_tempInMatrix
;
// forward low frequency non-separable transform
coeffTemp
=
tempCoeff
;
coeffTemp
=
tempCoeff
;
if
(
transposeFlag
)
if
(
transposeFlag
)
{
if
(
sbSize
==
4
)
{
for
(
y
=
0
;
y
<
4
;
y
++
)
{
{
if
(
sbSize
==
4
)
lfnstTemp
[
0
]
=
coeffTemp
[
0
];
{
lfnstTemp
[
4
]
=
coeffTemp
[
1
];
for
(
y
=
0
;
y
<
4
;
y
++
)
lfnstTemp
[
8
]
=
coeffTemp
[
2
];
{
lfnstTemp
[
12
]
=
coeffTemp
[
3
];
lfnstTemp
[
0
]
=
coeffTemp
[
0
];
lfnstTemp
[
4
]
=
coeffTemp
[
1
];
lfnstTemp
++
;
lfnstTemp
[
8
]
=
coeffTemp
[
2
];
lfnstTemp
[
12
]
=
coeffTemp
[
3
];
coeffTemp
+=
width
;
lfnstTemp
++
;
coeffTemp
+=
width
;
}
}
else
// ( sbSize == 8 )
{
for
(
y
=
0
;
y
<
8
;
y
++
)
{
lfnstTemp
[
0
]
=
coeffTemp
[
0
];
lfnstTemp
[
8
]
=
coeffTemp
[
1
];
lfnstTemp
[
16
]
=
coeffTemp
[
2
];
lfnstTemp
[
24
]
=
coeffTemp
[
3
];
if
(
y
<
4
)
{
lfnstTemp
[
32
]
=
coeffTemp
[
4
];
lfnstTemp
[
36
]
=
coeffTemp
[
5
];
lfnstTemp
[
40
]
=
coeffTemp
[
6
];
lfnstTemp
[
44
]
=
coeffTemp
[
7
];
}
lfnstTemp
++
;
coeffTemp
+=
width
;
}
}
}
}
else
}
else
// ( sbSize == 8 )
{
for
(
y
=
0
;
y
<
8
;
y
++
)
{
{
for
(
y
=
0
;
y
<
sbSize
;
y
++
)
lfnstTemp
[
0
]
=
coeffTemp
[
0
];
lfnstTemp
[
8
]
=
coeffTemp
[
1
];
lfnstTemp
[
16
]
=
coeffTemp
[
2
];
lfnstTemp
[
24
]
=
coeffTemp
[
3
];
if
(
y
<
4
)
{
{
uint32_t
uiStride
=
(
y
<
4
)
?
sbSize
:
4
;
lfnstTemp
[
32
]
=
coeffTemp
[
4
]
;
::
memcpy
(
lfnstTemp
,
coeffTemp
,
uiStride
*
sizeof
(
TCoeff
)
)
;
lfnstTemp
[
36
]
=
coeffTemp
[
5
]
;
lfnstTemp
+=
uiStride
;
lfnstTemp
[
40
]
=
coeffTemp
[
6
]
;
coeffTemp
+=
width
;
lfnstTemp
[
44
]
=
coeffTemp
[
7
]
;
}
}
lfnstTemp
++
;
coeffTemp
+=
width
;
}
}
}
}
else
{
for
(
y
=
0
;
y
<
sbSize
;
y
++
)
{
uint32_t
uiStride
=
(
y
<
4
)
?
sbSize
:
4
;
::
memcpy
(
lfnstTemp
,
coeffTemp
,
uiStride
*
sizeof
(
TCoeff
));
lfnstTemp
+=
uiStride
;
coeffTemp
+=
width
;
}
}
fwdLfnstNxN
(
m_tempInMatrix
,
m_tempOutMatrix
,
g_lfnstLut
[
intraMode
],
lfnstIdx
-
1
,
sbSize
,
(
tu4x4Flag
||
tu8x8Flag
)
?
8
:
16
);
fwdLfnstNxN
(
m_tempInMatrix
,
m_tempOutMatrix
,
g_lfnstLut
[
intraMode
],
lfnstIdx
-
1
,
sbSize
,
(
tu4x4Flag
||
tu8x8Flag
)
?
8
:
16
);
lfnstTemp
=
m_tempOutMatrix
;
// forward spectral rearrangement
lfnstTemp
=
m_tempOutMatrix
;
// forward spectral rearrangement
coeffTemp
=
tempCoeff
;
coeffTemp
=
tempCoeff
;
const
ScanElement
*
scanPtr
=
scan
;
int
lfnstCoeffNum
=
(
sbSize
==
4
)
?
sbSize
*
sbSize
:
48
;
int
lfnstCoeffNum
=
(
sbSize
==
4
)
?
sbSize
*
sbSize
:
48
;
for
(
y
=
0
;
y
<
lfnstCoeffNum
;
y
++
)
const
ScanElement
*
scanPtr
=
scan
;
{
coeffTemp
[
scanPtr
->
idx
]
=
*
lfnstTemp
++
;
for
(
y
=
0
;
y
<
lfnstCoeffNum
;
y
++
)
scanPtr
++
;
{
}
coeffTemp
[
scanPtr
->
idx
]
=
*
lfnstTemp
++
;
scanPtr
++
;
}
}
}
}
}
}
}
...
@@ -531,24 +566,24 @@ void TrQuant::invTransformNxN( TransformUnit &tu, const ComponentID &compID, Pel
...
@@ -531,24 +566,24 @@ void TrQuant::invTransformNxN( TransformUnit &tu, const ComponentID &compID, Pel
const
uint32_t
uiHeight
=
area
.
height
;
const
uint32_t
uiHeight
=
area
.
height
;
CHECK
(
uiWidth
>
tu
.
cs
->
sps
->
getMaxTbSize
()
||
uiHeight
>
tu
.
cs
->
sps
->
getMaxTbSize
(),
"Maximal allowed transformation size exceeded!"
);
CHECK
(
uiWidth
>
tu
.
cs
->
sps
->
getMaxTbSize
()
||
uiHeight
>
tu
.
cs
->
sps
->
getMaxTbSize
(),
"Maximal allowed transformation size exceeded!"
);
CoeffBuf
tempCoeff
=
CoeffBuf
(
m_tempCoeff
,
area
);
CoeffBuf
tempCoeff
=
CoeffBuf
(
m_tempCoeff
,
area
);
xDeQuant
(
tu
,
tempCoeff
,
compID
,
cQP
);
xDeQuant
(
tu
,
tempCoeff
,
compID
,
cQP
);
DTRACE_COEFF_BUF
(
D_TCOEFF
,
tempCoeff
,
tu
,
tu
.
cu
->
predMode
,
compID
);
DTRACE_COEFF_BUF
(
D_TCOEFF
,
tempCoeff
,
tu
,
tu
.
cu
->
predMode
,
compID
);
if
(
tu
.
cs
->
sps
->
getUseLFNST
()
)
if
(
tu
.
cs
->
sps
->
getUseLFNST
())
{
{
xInvLfnst
(
tu
,
compID
);
xInvLfnst
(
tu
,
compID
);
}
}
if
(
tu
.
mtsIdx
[
compID
]
==
MTS_SKIP
)
if
(
tu
.
mtsIdx
[
compID
]
==
MTS_SKIP
)
{
{
xITransformSkip
(
tempCoeff
,
pResi
,
tu
,
compID
);
xITransformSkip
(
tempCoeff
,
pResi
,
tu
,
compID
);
}
}
else
else
{
{
xIT
(
tu
,
compID
,
tempCoeff
,
pResi
);
xIT
(
tu
,
compID
,
tempCoeff
,
pResi
);
}
}
//DTRACE_BLOCK_COEFF(tu.getCoeffs(compID), tu, tu.cu->predMode, compID);
//DTRACE_BLOCK_COEFF(tu.getCoeffs(compID), tu, tu.cu->predMode, compID);
DTRACE_PEL_BUF
(
D_RESIDUALS
,
pResi
,
tu
,
tu
.
cu
->
predMode
,
compID
);
DTRACE_PEL_BUF
(
D_RESIDUALS
,
pResi
,
tu
,
tu
.
cu
->
predMode
,
compID
);
...
@@ -646,7 +681,9 @@ void TrQuant::getTrTypes(const TransformUnit tu, const ComponentID compID, int &
...
@@ -646,7 +681,9 @@ void TrQuant::getTrTypes(const TransformUnit tu, const ComponentID compID, int &
}
}
if
(
!
tu
.
cs
->
sps
->
getUseMTS
())
if
(
!
tu
.
cs
->
sps
->
getUseMTS
())
{
return
;
return
;
}
if
(
isImplicitMTS
||
isISP
)
if
(
isImplicitMTS
||
isISP
)
{
{
...
@@ -656,9 +693,13 @@ void TrQuant::getTrTypes(const TransformUnit tu, const ComponentID compID, int &
...
@@ -656,9 +693,13 @@ void TrQuant::getTrTypes(const TransformUnit tu, const ComponentID compID, int &
bool
heightDstOk
=
height
>=
4
&&
height
<=
16
;
bool
heightDstOk
=
height
>=
4
&&
height
<=
16
;
if
(
widthDstOk
)
if
(
widthDstOk
)
{
trTypeHor
=
DST7
;
trTypeHor
=
DST7
;
}
if
(
heightDstOk
)
if
(
heightDstOk
)
{
trTypeVer
=
DST7
;
trTypeVer
=
DST7
;
}
return
;
return
;
}
}
...
@@ -677,8 +718,16 @@ void TrQuant::getTrTypes(const TransformUnit tu, const ComponentID compID, int &
...
@@ -677,8 +718,16 @@ void TrQuant::getTrTypes(const TransformUnit tu, const ComponentID compID, int &
}
}
else
else
{
{
if
(
sbtPos
==
SBT_POS0
)
{
trTypeHor
=
DCT8
;
trTypeVer
=
DST7
;
}
if
(
sbtPos
==
SBT_POS0
)
else
{
trTypeHor
=
DST7
;
trTypeVer
=
DST7
;
}
{
trTypeHor
=
DCT8
;
trTypeVer
=
DST7
;
}
else
{
trTypeHor
=
DST7
;
trTypeVer
=
DST7
;
}
}
}
}
}
else
else
...
@@ -690,8 +739,16 @@ void TrQuant::getTrTypes(const TransformUnit tu, const ComponentID compID, int &
...
@@ -690,8 +739,16 @@ void TrQuant::getTrTypes(const TransformUnit tu, const ComponentID compID, int &
}
}
else
else
{
{
if
(
sbtPos
==
SBT_POS0
)
{
trTypeHor
=
DST7
;
trTypeVer
=
DCT8
;
}
if
(
sbtPos
==
SBT_POS0
)
else
{
trTypeHor
=
DST7
;
trTypeVer
=
DST7
;
}
{
trTypeHor
=
DST7
;
trTypeVer
=
DCT8
;
}
else
{
trTypeHor
=
DST7
;
trTypeVer
=
DST7
;
}
}
}
}
}
return
;
return
;
...
@@ -709,8 +766,6 @@ void TrQuant::getTrTypes(const TransformUnit tu, const ComponentID compID, int &
...
@@ -709,8 +766,6 @@ void TrQuant::getTrTypes(const TransformUnit tu, const ComponentID compID, int &
}
}
}
}
void
TrQuant
::
xT
(
const
TransformUnit
&
tu
,
const
ComponentID
&
compID
,
const
CPelBuf
&
resi
,
CoeffBuf
&
dstCoeff
,
const
int
width
,
const
int
height
)
void
TrQuant
::
xT
(
const
TransformUnit
&
tu
,
const
ComponentID
&
compID
,
const
CPelBuf
&
resi
,
CoeffBuf
&
dstCoeff
,
const
int
width
,
const
int
height
)
{
{
const
unsigned
maxLog2TrDynamicRange
=
tu
.
cs
->
sps
->
getMaxLog2TrDynamicRange
(
toChannelType
(
compID
)
);
const
unsigned
maxLog2TrDynamicRange
=
tu
.
cs
->
sps
->
getMaxLog2TrDynamicRange
(
toChannelType
(
compID
)
);
...
@@ -719,7 +774,6 @@ void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel
...
@@ -719,7 +774,6 @@ void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel
const
uint32_t
transformWidthIndex
=
floorLog2
(
width
)
-
1
;
// nLog2WidthMinus1, since transform start from 2-point
const
uint32_t
transformWidthIndex
=
floorLog2
(
width
)
-
1
;
// nLog2WidthMinus1, since transform start from 2-point
const
uint32_t
transformHeightIndex
=
floorLog2
(
height
)
-
1
;
// nLog2HeightMinus1, since transform start from 2-point
const
uint32_t
transformHeightIndex
=
floorLog2
(
height
)
-
1
;
// nLog2HeightMinus1, since transform start from 2-point
int
trTypeHor
=
DCT2
;
int
trTypeHor
=
DCT2
;
int
trTypeVer
=
DCT2
;
int
trTypeVer
=
DCT2
;
...
@@ -767,10 +821,10 @@ void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel
...
@@ -767,10 +821,10 @@ void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel
const
int
shift_2nd
=
(
floorLog2
(
height
))
+
TRANSFORM_MATRIX_SHIFT
+
COM16_C806_TRANS_PREC
;
const
int
shift_2nd
=
(
floorLog2
(
height
))
+
TRANSFORM_MATRIX_SHIFT
+
COM16_C806_TRANS_PREC
;
CHECK
(
shift_1st
<
0
,
"Negative shift"
);
CHECK
(
shift_1st
<
0
,
"Negative shift"
);
CHECK
(
shift_2nd
<
0
,
"Negative shift"
);
CHECK
(
shift_2nd
<
0
,
"Negative shift"
);
TCoeff
*
tmp
=
(
TCoeff
*
)
alloca
(
width
*
height
*
sizeof
(
TCoeff
)
);
TCoeff
*
tmp
=
(
TCoeff
*
)
alloca
(
width
*
height
*
sizeof
(
TCoeff
)
);
fastFwdTrans
[
trTypeHor
][
transformWidthIndex
](
block
,
tmp
,
shift_1st
,
height
,
0
,
skipWidth
);
fastFwdTrans
[
trTypeHor
][
transformWidthIndex
](
block
,
tmp
,
shift_1st
,
height
,
0
,
skipWidth
);
fastFwdTrans
[
trTypeVer
][
transformHeightIndex
](
tmp
,
dstCoeff
.
buf
,
shift_2nd
,
width
,
skipWidth
,
skipHeight
);
fastFwdTrans
[
trTypeVer
][
transformHeightIndex
](
tmp
,
dstCoeff
.
buf
,
shift_2nd
,
width
,
skipWidth
,
skipHeight
);
}
}
else
if
(
height
==
1
)
//1-D horizontal transform
else
if
(
height
==
1
)
//1-D horizontal transform
{
{
...
@@ -800,7 +854,6 @@ void TrQuant::xIT( const TransformUnit &tu, const ComponentID &compID, const CCo
...
@@ -800,7 +854,6 @@ void TrQuant::xIT( const TransformUnit &tu, const ComponentID &compID, const CCo
const
uint32_t
transformWidthIndex
=
floorLog2
(
width
)
-
1
;
// nLog2WidthMinus1, since transform start from 2-point
const
uint32_t
transformWidthIndex
=
floorLog2
(
width
)
-
1
;
// nLog2WidthMinus1, since transform start from 2-point
const
uint32_t
transformHeightIndex
=
floorLog2
(
height
)
-
1
;
// nLog2HeightMinus1, since transform start from 2-point
const
uint32_t
transformHeightIndex
=
floorLog2
(
height
)
-
1
;
// nLog2HeightMinus1, since transform start from 2-point
int
trTypeHor
=
DCT2
;
int
trTypeHor
=
DCT2
;
int
trTypeVer
=
DCT2
;
int
trTypeVer
=
DCT2
;
...
@@ -873,10 +926,10 @@ void TrQuant::xITransformSkip(const CCoeffBuf &pCoeff,
...
@@ -873,10 +926,10 @@ void TrQuant::xITransformSkip(const CCoeffBuf &pCoeff,
for
(
uint32_t
y
=
0
;
y
<
height
;
y
++
)
for
(
uint32_t
y
=
0
;
y
<
height
;
y
++
)
{
{
for
(
uint32_t
x
=
0
;
x
<
width
;
x
++
)
for
(
uint32_t
x
=
0
;
x
<
width
;
x
++
)
{
{
pResidual
.
at
(
x
,
y
)
=
Pel
(
pCoeff
.
at
(
x
,
y
));
pResidual
.
at
(
x
,
y
)
=
Pel
(
pCoeff
.
at
(
x
,
y
));
}
}
}
}
}
}
...
@@ -938,8 +991,9 @@ void TrQuant::transformNxN( TransformUnit& tu, const ComponentID& compID, const
...
@@ -938,8 +991,9 @@ void TrQuant::transformNxN( TransformUnit& tu, const ComponentID& compID, const
}
}
if
(
tu
.
mtsIdx
[
compID
]
==
MTS_SKIP
)
if
(
tu
.
mtsIdx
[
compID
]
==
MTS_SKIP
)
{
{
int
trShift
=
getTransformShift
(
tu
.
cu
->
slice
->
getSPS
()
->
getBitDepth
(
toChannelType
(
compID
)),
rect
.
size
(),
tu
.
cu
->
slice
->
getSPS
()
->
getMaxLog2TrDynamicRange
(
toChannelType
(
compID
)));
int
trShift
=
getTransformShift
(
tu
.
cu
->
slice
->
getSPS
()
->
getBitDepth
(
toChannelType
(
compID
)),
rect
.
size
(),
scaleSAD
*=
pow
(
2
,
trShift
);
tu
.
cu
->
slice
->
getSPS
()
->
getMaxLog2TrDynamicRange
(
toChannelType
(
compID
)));
scaleSAD
*=
pow
(
2
,
trShift
);
}
}
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
...
@@ -986,41 +1040,37 @@ void TrQuant::transformNxN( TransformUnit& tu, const ComponentID& compID, const
...
@@ -986,41 +1040,37 @@ void TrQuant::transformNxN( TransformUnit& tu, const ComponentID& compID, const
tu
.
mtsIdx
[
compID
]
=
MTS_SKIP
;
tu
.
mtsIdx
[
compID
]
=
MTS_SKIP
;
}
}
{
uiAbsSum
=
0
;
uiAbsSum
=
0
;
// transform and quantize
CHECK
(
cs
.
sps
->
getMaxTbSize
()
<
uiWidth
,
"Unsupported transformation size"
);
// transform and quantize
CHECK
(
cs
.
sps
->
getMaxTbSize
()
<
uiWidth
,
"Unsupported transformation size"
);
CoeffBuf
tempCoeff
(
loadTr
?
m_mtsCoeffs
[
tu
.
mtsIdx
[
compID
]]
:
m_tempCoeff
,
rect
);
CoeffBuf
tempCoeff
(
loadTr
?
m_mtsCoeffs
[
tu
.
mtsIdx
[
compID
]]
:
m_tempCoeff
,
rect
);
DTRACE_PEL_BUF
(
D_RESIDUALS
,
resiBuf
,
tu
,
tu
.
cu
->
predMode
,
compID
);
DTRACE_PEL_BUF
(
D_RESIDUALS
,
resiBuf
,
tu
,
tu
.
cu
->
predMode
,
compID
);
if
(
!
loadTr
)
{
if
(
tu
.
mtsIdx
[
compID
]
==
MTS_SKIP
)
{
xTransformSkip
(
tu
,
compID
,
resiBuf
,
tempCoeff
.
buf
);
}
else
{
xT
(
tu
,
compID
,
resiBuf
,
tempCoeff
,
uiWidth
,
uiHeight
);
}
}
if
(
!
loadTr
)
{
if
(
tu
.
mtsIdx
[
compID
]
==
MTS_SKIP
)
{
xTransformSkip
(
tu
,
compID
,
resiBuf
,
tempCoeff
.
buf
);
}
else
{
xT
(
tu
,
compID
,
resiBuf
,
tempCoeff
,
uiWidth
,
uiHeight
);
}
}
if
(
sps
.
getUseLFNST
()
)
if
(
sps
.
getUseLFNST
())
{
{
xFwdLfnst
(
tu
,
compID
,
loadTr
);
xFwdLfnst
(
tu
,
compID
,
loadTr
);
}
}
DTRACE_COEFF_BUF
(
D_TCOEFF
,
tempCoeff
,
tu
,
tu
.
cu
->
predMode
,
compID
);
DTRACE_COEFF_BUF
(
D_TCOEFF
,
tempCoeff
,
tu
,
tu
.
cu
->
predMode
,
compID
);
xQuant
(
tu
,
compID
,
tempCoeff
,
uiAbsSum
,
cQP
,
ctx
);
xQuant
(
tu
,
compID
,
tempCoeff
,
uiAbsSum
,
cQP
,
ctx
);
DTRACE_COEFF_BUF
(
D_TCOEFF
,
tu
.
getCoeffs
(
compID
),
tu
,
tu
.
cu
->
predMode
,
compID
);
DTRACE_COEFF_BUF
(
D_TCOEFF
,
tu
.
getCoeffs
(
compID
),
tu
,
tu
.
cu
->
predMode
,
compID
);
}
// set coded block flag (CBF)
// set coded block flag (CBF)
TU
::
setCbfAtDepth
(
tu
,
compID
,
tu
.
depth
,
uiAbsSum
>
0
);
TU
::
setCbfAtDepth
(
tu
,
compID
,
tu
.
depth
,
uiAbsSum
>
0
);
...
@@ -1035,10 +1085,10 @@ void TrQuant::xTransformSkip(const TransformUnit &tu, const ComponentID &compID,
...
@@ -1035,10 +1085,10 @@ void TrQuant::xTransformSkip(const TransformUnit &tu, const ComponentID &compID,
for
(
uint32_t
y
=
0
,
coefficientIndex
=
0
;
y
<
height
;
y
++
)
for
(
uint32_t
y
=
0
,
coefficientIndex
=
0
;
y
<
height
;
y
++
)
{
{
for
(
uint32_t
x
=
0
;
x
<
width
;
x
++
,
coefficientIndex
++
)
for
(
uint32_t
x
=
0
;
x
<
width
;
x
++
,
coefficientIndex
++
)
{
{
psCoeff
[
coefficientIndex
]
=
TCoeff
(
resi
.
at
(
x
,
y
));
psCoeff
[
coefficientIndex
]
=
TCoeff
(
resi
.
at
(
x
,
y
));
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment