Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Satoru KUMA
MPEG129-m52280
Commits
817c61d1
Commit
817c61d1
authored
Aug 01, 2018
by
David Flynn
Browse files
m42538/recolour: remove kUseM42141RecolourMethod2=0 case
This commit removes the searchRange option that was set to 0 by m42538.
parent
3f40b209
Changes
8
Hide whitespace changes
Inline
Side-by-side
cfg/cat3-tmc13-ctc-lossless-geom-lossless-attrs.yaml
View file @
817c61d1
...
...
@@ -30,7 +30,6 @@ categories:
encflags
:
-
&mitsubishiLosslessAttrs
-
numberOfNearestNeighborsInPrediction
:
4
-
searchRange
:
0
-
levelOfDetailCount
:
9
-
dist2
:
134217728 33554432 8388608 2097152 524288 131072 32768 8192
0
-
quantizationSteps
:
0 0 0 0 0 0 0 0
0
...
...
@@ -85,7 +84,6 @@ categories:
encflags
:
-
&fordLosslessAttrs
-
numberOfNearestNeighborsInPrediction
:
4
-
searchRange
:
0
-
levelOfDetailCount
:
6
-
dist2
:
4194301 1048582 262149 65534 16383
0
-
quantizationSteps
:
0 0 0 0 0
0
...
...
cfg/cat3-tmc13-ctc-lossless-geom-lossy-attrs.yaml
View file @
817c61d1
...
...
@@ -32,7 +32,6 @@ categories:
-
&commonAttr
-
numberOfNearestNeighborsInPrediction
:
4
-
levelOfDetailCount
:
9
-
searchRange
:
0
-
dist2
:
134217728 33554432 8388608 2097152 524288 131072 32768 8192
0
-
quantizationSteps
:
r01
:
1 2 4 8 16 32 64 128
128
...
...
cfg/cat3-tmc13-ctc-lossless-geom-nearlossless-attrs.yaml
View file @
817c61d1
...
...
@@ -31,7 +31,6 @@ categories:
encflags
:
-
&mitsubishiNearlosslessAttrs
-
numberOfNearestNeighborsInPrediction
:
4
-
searchRange
:
0
-
levelOfDetailCount
:
9
-
dist2
:
134217728 33554432 8388608 2097152 524288 131072 32768 8192
0
-
quantizationSteps
:
...
...
@@ -92,7 +91,6 @@ categories:
encflags
:
-
&fordNearlosslessAttrs
-
numberOfNearestNeighborsInPrediction
:
4
-
searchRange
:
0
-
levelOfDetailCount
:
6
-
dist2
:
4194301 1048582 262149 65534 16383
0
-
quantizationSteps
:
...
...
cfg/cat3-tmc13-ctc-lossy-geom-lossy-attrs.yaml
View file @
817c61d1
...
...
@@ -47,7 +47,6 @@ categories:
r04
:
0 1 2 4 4
4
r05
:
0 1 2 4 4
4
r06
:
0 1 2 4 4
4
-
searchRange
:
0
-
attribute
:
reflectance
ford_02_q1mm
:
...
...
tmc3/AttributeEncoder.h
View file @
817c61d1
...
...
@@ -55,7 +55,6 @@ struct PCCResidualsEncoder;
struct
PCCAttributeEncodeParamaters
{
size_t
numberOfNearestNeighborsInPrediction
;
size_t
levelOfDetailCount
;
size_t
searchRange
;
int
quantizationStepRaht
;
int
depthRaht
;
int
binaryLevelThresholdRaht
;
...
...
tmc3/PCCPointSetProcessing.h
View file @
817c61d1
...
...
@@ -42,16 +42,10 @@
#include
"PCCKdTree.h"
#include
"PCCPointSet.h"
// The recolouring method of m42141 option2.
// NB: CE1.3 (M42538) suggests that searchRange = 0 in this case rather than
// the previous default of 2.
static
const
bool
kUseM42141RecolourMethod2
=
true
;
namespace
pcc
{
inline
bool
PCCTransfertColors
(
const
PCCPointSet3
&
source
,
const
int32_t
searchRange
,
PCCPointSet3
&
target
)
PCCTransfertColors
(
const
PCCPointSet3
&
source
,
PCCPointSet3
&
target
)
{
const
size_t
pointCountSource
=
source
.
getPointCount
();
const
size_t
pointCountTarget
=
target
.
getPointCount
();
...
...
@@ -91,105 +85,25 @@ PCCTransfertColors(
if
(
colors2
.
empty
())
{
target
.
setColor
(
index
,
color1
);
}
else
{
const
double
H
=
double
(
colors2
.
size
());
const
PCCVector3D
centroid1
(
color1
[
0
],
color1
[
1
],
color1
[
2
]);
PCCVector3D
centroid2
(
0.0
);
for
(
const
auto
&
color2
:
colors2
)
{
for
(
size_t
k
=
0
;
k
<
3
;
++
k
)
{
centroid2
[
k
]
+=
color2
[
k
];
}
}
centroid2
/=
H
;
double
D2
=
0.0
;
for
(
const
auto
&
color2
:
colors2
)
{
for
(
size_t
k
=
0
;
k
<
3
;
++
k
)
{
const
double
d2
=
centroid2
[
k
]
-
color2
[
k
];
D2
+=
d2
*
d2
;
}
}
const
double
r
=
double
(
pointCountTarget
)
/
double
(
pointCountSource
);
const
double
delta2
=
(
centroid2
-
centroid1
).
getNorm2
();
const
double
eps
=
0.000001
;
if
(
kUseM42141RecolourMethod2
||
delta2
>
eps
)
{
// when delta2 > eps: centroid2 != centroid1
double
w
=
0.0
;
const
double
alpha
=
D2
/
delta2
;
const
double
a
=
H
*
r
-
1.0
;
const
double
c
=
alpha
*
r
-
1.0
;
if
(
fabs
(
a
)
<
eps
)
{
w
=
-
0.5
*
c
;
}
else
{
const
double
delta
=
1.0
-
a
*
c
;
if
(
delta
>=
0.0
)
{
w
=
(
-
1.0
+
sqrt
(
delta
))
/
a
;
}
}
if
(
kUseM42141RecolourMethod2
)
{
w
=
0.0
f
;
}
const
double
oneMinusW
=
1.0
-
w
;
PCCVector3D
color0
;
for
(
size_t
k
=
0
;
k
<
3
;
++
k
)
{
color0
[
k
]
=
PCCClip
(
round
(
w
*
centroid1
[
k
]
+
oneMinusW
*
centroid2
[
k
]),
0.0
,
255.0
);
}
const
double
rSource
=
1.0
/
double
(
pointCountSource
);
const
double
rTarget
=
1.0
/
double
(
pointCountTarget
);
const
double
maxValue
=
std
::
numeric_limits
<
uint8_t
>::
max
();
double
minError
=
std
::
numeric_limits
<
double
>::
max
();
PCCVector3D
bestColor
(
color0
);
PCCVector3D
color
;
for
(
int32_t
s1
=
-
searchRange
;
s1
<=
searchRange
;
++
s1
)
{
color
[
0
]
=
PCCClip
(
color0
[
0
]
+
s1
,
0.0
,
maxValue
);
for
(
int32_t
s2
=
-
searchRange
;
s2
<=
searchRange
;
++
s2
)
{
color
[
1
]
=
PCCClip
(
color0
[
1
]
+
s2
,
0.0
,
maxValue
);
for
(
int32_t
s3
=
-
searchRange
;
s3
<=
searchRange
;
++
s3
)
{
color
[
2
]
=
PCCClip
(
color0
[
2
]
+
s3
,
0.0
,
maxValue
);
double
e1
=
0.0
;
for
(
size_t
k
=
0
;
k
<
3
;
++
k
)
{
const
double
d
=
color
[
k
]
-
color1
[
k
];
e1
+=
d
*
d
;
}
e1
*=
rTarget
;
double
e2
=
0.0
;
for
(
const
auto
&
color2
:
colors2
)
{
for
(
size_t
k
=
0
;
k
<
3
;
++
k
)
{
const
double
d
=
color
[
k
]
-
color2
[
k
];
e2
+=
d
*
d
;
}
}
e2
*=
rSource
;
const
double
error
=
std
::
max
(
e1
,
e2
);
if
(
error
<
minError
)
{
minError
=
error
;
bestColor
=
color
;
}
}
}
}
target
.
setColor
(
index
,
PCCColor3B
(
uint8_t
(
bestColor
[
0
]),
uint8_t
(
bestColor
[
1
]),
uint8_t
(
bestColor
[
2
])));
}
else
{
// centroid2 == centroid1
target
.
setColor
(
index
,
color1
);
centroid2
/=
colors2
.
size
();
PCCColor3B
color0
;
for
(
size_t
k
=
0
;
k
<
3
;
++
k
)
{
color0
[
k
]
=
uint8_t
(
PCCClip
(
round
(
centroid2
[
k
]),
0.0
,
255.0
));
}
target
.
setColor
(
index
,
color0
);
}
}
return
true
;
}
inline
bool
PCCTransfertReflectances
(
const
PCCPointSet3
&
source
,
const
int32_t
searchRange
,
PCCPointSet3
&
target
)
PCCTransfertReflectances
(
const
PCCPointSet3
&
source
,
PCCPointSet3
&
target
)
{
const
size_t
pointCountSource
=
source
.
getPointCount
();
const
size_t
pointCountTarget
=
target
.
getPointCount
();
...
...
@@ -229,75 +143,14 @@ PCCTransfertReflectances(
if
(
reflectances2
.
empty
())
{
target
.
setReflectance
(
index
,
reflectance1
);
}
else
{
const
double
H
=
double
(
reflectances2
.
size
());
const
double
centroid1
=
reflectance1
;
double
centroid2
=
0.0
;
for
(
const
auto
reflectance2
:
reflectances2
)
{
centroid2
+=
reflectance2
;
}
centroid2
/=
H
;
double
D2
=
0.0
;
for
(
const
auto
reflectance2
:
reflectances2
)
{
const
double
d2
=
centroid2
-
reflectance2
;
D2
+=
d2
*
d2
;
}
const
double
delta2
=
pow
(
centroid2
-
centroid1
,
2.0
);
const
double
eps
=
0.000001
;
if
(
kUseM42141RecolourMethod2
||
delta2
>
eps
)
{
// when delta2 > eps: centroid2 != centroid1
double
w
=
0.0
;
const
double
alpha
=
D2
/
delta2
;
const
double
r
=
double
(
pointCountTarget
)
/
double
(
pointCountSource
);
const
double
a
=
H
*
r
-
1.0
;
const
double
c
=
alpha
*
r
-
1.0
;
if
(
fabs
(
a
)
<
eps
)
{
w
=
-
0.5
*
c
;
}
else
{
const
double
delta
=
1.0
-
a
*
c
;
if
(
delta
>=
0.0
)
{
w
=
(
-
1.0
+
sqrt
(
delta
))
/
a
;
}
}
if
(
kUseM42141RecolourMethod2
)
{
w
=
0.0
f
;
}
const
double
oneMinusW
=
1.0
-
w
;
// todo(df): clipping range should be based on the input data type
const
double
maxValue
=
std
::
numeric_limits
<
uint16_t
>::
max
();
const
double
reflectance0
=
PCCClip
(
round
(
w
*
centroid1
+
oneMinusW
*
centroid2
),
0.0
,
maxValue
);
const
double
rSource
=
1.0
/
double
(
pointCountSource
);
const
double
rTarget
=
1.0
/
double
(
pointCountTarget
);
double
minError
=
std
::
numeric_limits
<
double
>::
max
();
double
bestReflectance
=
reflectance0
;
double
reflectance
;
for
(
int32_t
s
=
-
searchRange
;
s
<=
searchRange
;
++
s
)
{
reflectance
=
PCCClip
(
reflectance0
+
s
,
0.0
,
maxValue
);
const
double
d
=
reflectance
-
reflectance1
;
const
double
e1
=
(
d
*
d
)
*
rTarget
;
double
e2
=
0.0
;
for
(
const
auto
reflectance2
:
reflectances2
)
{
const
double
d
=
reflectance
-
reflectance2
;
e2
+=
d
*
d
;
}
e2
*=
rSource
;
const
double
error
=
std
::
max
(
e1
,
e2
);
if
(
error
<
minError
)
{
minError
=
error
;
bestReflectance
=
reflectance
;
}
}
target
.
setReflectance
(
index
,
uint16_t
(
bestReflectance
));
}
else
{
// centroid2 == centroid1
target
.
setReflectance
(
index
,
reflectance1
);
}
centroid2
=
PCCClip
(
std
::
round
(
centroid2
/
reflectances2
.
size
()),
0.0
,
double
(
std
::
numeric_limits
<
uint16_t
>::
max
()));
target
.
setReflectance
(
index
,
uint16_t
(
centroid2
));
}
}
return
true
;
...
...
tmc3/PCCTMC3Encoder.h
View file @
817c61d1
...
...
@@ -989,17 +989,14 @@ private:
}
if
(
paramsColor
)
{
// transfer colors
int32_t
searchRange
=
paramsColor
->
searchRange
;
if
(
!
PCCTransfertColors
(
inputPointCloud
,
searchRange
,
pointCloud
))
{
if
(
!
PCCTransfertColors
(
inputPointCloud
,
pointCloud
))
{
std
::
cout
<<
"Error: can't transfer colors!"
<<
std
::
endl
;
return
-
1
;
}
}
if
(
paramsReflectance
)
{
// transfer reflectances
int32_t
searchRange
=
paramsReflectance
->
searchRange
;
if
(
!
PCCTransfertReflectances
(
inputPointCloud
,
searchRange
,
pointCloud
))
{
if
(
!
PCCTransfertReflectances
(
inputPointCloud
,
pointCloud
))
{
std
::
cout
<<
"Error: can't transfer reflectances!"
<<
std
::
endl
;
return
-
1
;
}
...
...
@@ -1064,16 +1061,13 @@ private:
// Recolour attributes.
if
(
paramsColor
)
{
int32_t
searchRange
=
int32_t
(
paramsColor
->
searchRange
);
if
(
!
PCCTransfertColors
(
inputPointCloud
,
searchRange
,
pointCloud
))
{
if
(
!
PCCTransfertColors
(
inputPointCloud
,
pointCloud
))
{
std
::
cout
<<
"Error: can't transfer colors!"
<<
std
::
endl
;
return
-
1
;
}
}
if
(
paramsReflectance
)
{
int32_t
searchRange
=
int32_t
(
paramsReflectance
->
searchRange
);
if
(
!
PCCTransfertReflectances
(
inputPointCloud
,
searchRange
,
pointCloud
))
{
if
(
!
PCCTransfertReflectances
(
inputPointCloud
,
pointCloud
))
{
std
::
cout
<<
"Error: can't transfer reflectance!"
<<
std
::
endl
;
return
-
1
;
}
...
...
tmc3/TMC3.cpp
View file @
817c61d1
...
...
@@ -283,10 +283,6 @@ ParseParameters(int argc, char* argv[], Parameters& params)
"Encode the given attribute (NB, must appear after the"
"following attribute parameters)"
)
(
"searchRange"
,
params_attr
.
searchRange
,
size_t
(
0
),
"Attribute's todo(kmammou)"
)
(
"transformType"
,
params_attr
.
transformType
,
TransformType
::
kIntegerLift
,
"Coding method to use for attribute:
\n
"
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment