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
d0e2ec04
Commit
d0e2ec04
authored
Nov 05, 2019
by
David Flynn
Browse files
refactor: move pointset processing functions to compilation unit
None of these methods need to be inlined.
parent
0a90edeb
Changes
7
Show whitespace changes
Inline
Side-by-side
tmc3/CMakeLists.txt
View file @
d0e2ec04
...
...
@@ -67,7 +67,6 @@ file(GLOB PROJECT_INC_FILES
"PCCMath.h"
"PCCMisc.h"
"PCCPointSet.h"
"PCCPointSetProcessing.h"
"PCCTMC3Common.h"
"PCCTMC3Decoder.h"
"PCCTMC3Encoder.h"
...
...
@@ -89,6 +88,7 @@ file(GLOB PROJECT_INC_FILES
"partitioning.h"
"pcc_chrono.h"
"ply.h"
"pointset_processing.h"
"quantization.h"
"ringbuf.h"
"tables.h"
...
...
@@ -124,6 +124,7 @@ file(GLOB PROJECT_CPP_FILES
"partitioning.cpp"
"pcc_chrono.cpp"
"ply.cpp"
"pointset_processing.cpp"
"quantization.cpp"
"tables.cpp"
"../dependencies/arithmetic-coding/src/*.cpp"
...
...
tmc3/PCCTMC3Encoder.h
View file @
d0e2ec04
...
...
@@ -43,7 +43,7 @@
#include
"PayloadBuffer.h"
#include
"PCCMath.h"
#include
"PCCPointSet.h"
#include
"
PCCP
oint
S
et
P
rocessing.h"
#include
"
p
oint
s
et
_p
rocessing.h"
#include
"hls.h"
#include
"partitioning.h"
...
...
tmc3/encoder.cpp
View file @
d0e2ec04
...
...
@@ -39,7 +39,7 @@
#include
<set>
#include
"AttributeEncoder.h"
#include
"
PCCP
oint
S
et
P
rocessing.h"
#include
"
p
oint
s
et
_p
rocessing.h"
#include
"geometry.h"
#include
"io_hls.h"
#include
"osspecific.h"
...
...
tmc3/geometry_trisoup_decoder.cpp
View file @
d0e2ec04
...
...
@@ -37,7 +37,7 @@
#include
"geometry_trisoup.h"
#include
"
PCCP
oint
S
et
P
rocessing.h"
#include
"
p
oint
s
et
_p
rocessing.h"
#include
"geometry.h"
#include
"geometry_octree.h"
...
...
tmc3/geometry_trisoup_encoder.cpp
View file @
d0e2ec04
...
...
@@ -35,7 +35,7 @@
#include
"geometry_trisoup.h"
#include
"
PCCP
oint
S
et
P
rocessing.h"
#include
"
p
oint
s
et
_p
rocessing.h"
#include
"geometry.h"
#include
"geometry_octree.h"
...
...
tmc3/
PCCP
oint
S
et
P
rocessing.
h
→
tmc3/
p
oint
s
et
_p
rocessing.
cpp
View file @
d0e2ec04
...
...
@@ -33,8 +33,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef PCCPointSetProcessing_h
#define PCCPointSetProcessing_h
#include
"pointset_processing.h"
#include
"KDTreeVectorOfVectorsAdaptor.h"
#include
<cstddef>
#include
<set>
...
...
@@ -42,31 +43,8 @@
#include
<utility>
#include
<map>
#include
"KDTreeVectorOfVectorsAdaptor.h"
#include
"PCCPointSet.h"
namespace
pcc
{
//============================================================================
struct
RecolourParams
{
double
distOffsetFwd
;
double
distOffsetBwd
;
double
maxGeometryDist2Fwd
;
double
maxGeometryDist2Bwd
;
double
maxAttributeDist2Fwd
;
double
maxAttributeDist2Bwd
;
int
searchRange
;
int
numNeighboursFwd
;
int
numNeighboursBwd
;
bool
useDistWeightedAvgFwd
;
bool
useDistWeightedAvgBwd
;
bool
skipAvgIfIdenticalSourcePointPresentFwd
;
bool
skipAvgIfIdenticalSourcePointPresentBwd
;
};
//============================================================================
// Quantise the geometry of a point cloud, retaining unique points only.
// Points in the @src point cloud are translated by -@offset, quantised by a
...
...
@@ -76,7 +54,7 @@ struct RecolourParams {
//
// NB: attributes are not processed.
inline
void
void
quantizePositionsUniq
(
const
float
scaleFactor
,
const
Vec3
<
int
>
offset
,
...
...
@@ -134,7 +112,7 @@ quantizePositionsUniq(
//
// NB: attributes are preserved
inline
void
void
quantizePositions
(
const
float
scaleFactor
,
const
Vec3
<
int
>
offset
,
...
...
@@ -183,7 +161,7 @@ quantizePositions(
//============================================================================
// Clamp point co-ordinates in @cloud to @bbox, preserving attributes.
inline
void
void
clampVolume
(
Box3
<
double
>
bbox
,
PCCPointSet3
*
cloud
)
{
int
numSrcPoints
=
cloud
->
getPointCount
();
...
...
@@ -216,7 +194,7 @@ clampVolume(Box3<double> bbox, PCCPointSet3* cloud)
// clouds, is handled according to:
// posInTgt = (posInSrc - targetToSourceOffset) * sourceToTargetScaleFactor
inline
bool
bool
recolourColour
(
const
RecolourParams
&
params
,
const
PCCPointSet3
&
source
,
...
...
@@ -578,7 +556,7 @@ recolourColour(
// clouds, is handled according to:
// posInTgt = (posInSrc - targetToSourceOffset) * sourceToTargetScaleFactor
inline
bool
bool
recolourReflectance
(
const
RecolourParams
&
cfg
,
const
PCCPointSet3
&
source
,
...
...
@@ -885,7 +863,7 @@ recolourReflectance(
// posInTgt =
// (posInSrc - targetToSourceOffset) * sourceToTargetScaleFactor - offset
inline
int
int
recolour
(
const
RecolourParams
&
cfg
,
const
PCCPointSet3
&
source
,
...
...
@@ -924,6 +902,4 @@ recolour(
//============================================================================
};
// namespace pcc
#endif
/* PCCPointSetProcessing_h */
}
// namespace pcc
tmc3/pointset_processing.h
0 → 100644
View file @
d0e2ec04
/* The copyright in this software is being made available under the BSD
* Licence, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such
* rights are granted under this licence.
*
* Copyright (c) 2017-2018, ISO/IEC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the ISO/IEC nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include
<map>
#include
"PCCPointSet.h"
namespace
pcc
{
//============================================================================
struct
RecolourParams
{
double
distOffsetFwd
;
double
distOffsetBwd
;
double
maxGeometryDist2Fwd
;
double
maxGeometryDist2Bwd
;
double
maxAttributeDist2Fwd
;
double
maxAttributeDist2Bwd
;
int
searchRange
;
int
numNeighboursFwd
;
int
numNeighboursBwd
;
bool
useDistWeightedAvgFwd
;
bool
useDistWeightedAvgBwd
;
bool
skipAvgIfIdenticalSourcePointPresentFwd
;
bool
skipAvgIfIdenticalSourcePointPresentBwd
;
};
//============================================================================
// Quantise the geometry of a point cloud, retaining unique points only.
// Points in the @src point cloud are translated by -@offset, quantised by a
// multiplicitive @scaleFactor with rounding, then clamped to @clamp.
//
// The destination and source point clouds may be the same object.
//
// NB: attributes are not processed.
void
quantizePositionsUniq
(
const
float
scaleFactor
,
const
Vec3
<
int
>
offset
,
const
Box3
<
int
>
clamp
,
const
PCCPointSet3
&
src
,
PCCPointSet3
*
dst
,
std
::
multimap
<
Vec3
<
double
>
,
int32_t
>&
doubleQuantizedToOrigin
);
//============================================================================
// Quantise the geometry of a point cloud, retaining duplicate points.
// Points in the @src point cloud are translated by -@offset, then quantised
// by a multiplicitive @scaleFactor with rounding.
//
// The destination and source point clouds may be the same object.
//
// NB: attributes are preserved
void
quantizePositions
(
const
float
scaleFactor
,
const
Vec3
<
int
>
offset
,
const
Box3
<
int
>
clamp
,
const
PCCPointSet3
&
src
,
PCCPointSet3
*
dst
);
//============================================================================
// Clamp point co-ordinates in @cloud to @bbox, preserving attributes.
void
clampVolume
(
Box3
<
double
>
bbox
,
PCCPointSet3
*
cloud
);
//============================================================================
// Determine colour attribute values from a reference/source point cloud.
// For each point of the target p_t:
// - Find the N_1 (1 < N_1) nearest neighbours in source to p_t and create
// a set of points denoted by Ψ_1.
// - Find the set of source points that p_t belongs to their set of N_2
// nearest neighbours. Denote this set of points by Ψ_2.
// - Compute the distance-weighted average of points in Ψ_1 and Ψ_2 by:
// \bar{Ψ}_k = ∑_{q∈Ψ_k} c(q)/Δ(q,p_t)
// ----------------------- ,
// ∑_{q∈Ψ_k} 1/Δ(q,p_t)
//
// where Δ(a,b) denotes the Euclidian distance between the points a and b,
// and c(q) denotes the colour of point q. Compute the average (or the
// weighted average with the number of points of each set as the weights)
// of \bar{Ψ}̅_1 and \bar{Ψ}̅_2 and transfer it to p_t.
//
// Differences in the scale and translation of the target and source point
// clouds, is handled according to:
// posInTgt = (posInSrc - targetToSourceOffset) * sourceToTargetScaleFactor
bool
recolourColour
(
const
RecolourParams
&
params
,
const
PCCPointSet3
&
source
,
double
sourceToTargetScaleFactor
,
Vec3
<
double
>
targetToSourceOffset
,
PCCPointSet3
&
target
);
//============================================================================
// Determine reflectance attribute values from a reference/source point cloud.
// For each point of the target p_t:
// - Find the N_1 (1 < N_1) nearest neighbours in source to p_t and create
// a set of points denoted by Ψ_1.
// - Find the set of source points that p_t belongs to their set of N_2
// nearest neighbours. Denote this set of points by Ψ_2.
// - Compute the distance-weighted average of points in Ψ_1 and Ψ_2 by:
// \bar{Ψ}_k = ∑_{q∈Ψ_k} c(q)/Δ(q,p_t)
// ----------------------- ,
// ∑_{q∈Ψ_k} 1/Δ(q,p_t)
//
// where Δ(a,b) denotes the Euclidian distance between the points a and b,
// and c(q) denotes the colour of point q. Compute the average (or the
// weighted average with the number of points of each set as the weights)
// of \bar{Ψ}̅_1 and \bar{Ψ}̅_2 and transfer it to p_t.
//
// Differences in the scale and translation of the target and source point
// clouds, is handled according to:
// posInTgt = (posInSrc - targetToSourceOffset) * sourceToTargetScaleFactor
bool
recolourReflectance
(
const
RecolourParams
&
cfg
,
const
PCCPointSet3
&
source
,
double
sourceToTargetScaleFactor
,
Vec3
<
double
>
targetToSourceOffset
,
PCCPointSet3
&
target
);
//============================================================================
// Recolour attributes based on a source/reference point cloud.
//
// Differences in the scale and translation of the target and source point
// clouds, is handled according to:
// posInTgt =
// (posInSrc - targetToSourceOffset) * sourceToTargetScaleFactor - offset
int
recolour
(
const
RecolourParams
&
cfg
,
const
PCCPointSet3
&
source
,
float
sourceToTargetScaleFactor
,
Vec3
<
int
>
targetToSourceOffset
,
Vec3
<
int
>
offset
,
PCCPointSet3
*
target
);
//============================================================================
}
// namespace pcc
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