Commit a3bc1ac4 authored by David Flynn's avatar David Flynn
Browse files

entropy: arithmetic codec wrapper to allow compile time selection

This commit adds an arithmetic codec interface class that allows a
compile time choice of arithmetic codec implementation.  Context types
are renamed to support compile time selection, and existing support
functions that were added to the third-party arithmetic codec are
moved to the wrapper.
parent 89fae502
......@@ -76,14 +76,6 @@ OF SUCH DAMAGE.
namespace o3dgc {
inline unsigned long IntToUInt(long value)
{
return (value < 0) ? static_cast<unsigned long>(-1 - (2 * value)) : static_cast<unsigned long>(2 * value);
}
inline long UIntToInt(unsigned long uiValue)
{
return (uiValue & 1) ? -(static_cast<long>((uiValue + 1) >> 1)) : (static_cast<long>(uiValue >> 1));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - Class definitions - - - - - - - - - - - - - - - - - - - - - - - - - - -
class Static_Bit_Model // static model for binary data
......@@ -229,49 +221,7 @@ public:
Adaptive_Data_Model&);
unsigned decode(Adaptive_Data_Model&);
// This section was added by K. Mammou
void ExpGolombEncode(unsigned int symbol,
int k,
Static_Bit_Model& bModel0,
Adaptive_Bit_Model& bModel1)
{
while (1) {
if (symbol >= static_cast<unsigned int>(1 << k)) {
encode(1, bModel1);
symbol = symbol - (1 << k);
k++;
}
else {
encode(0, bModel1); // now terminated zero of unary part
while (k--) // next binary part
{
encode(static_cast<signed short>((symbol >> k) & 1), bModel0);
}
break;
}
}
}
unsigned ExpGolombDecode(int k,
Static_Bit_Model& bModel0,
Adaptive_Bit_Model& bModel1)
{
unsigned int l;
int symbol = 0;
int binary_symbol = 0;
do {
l = decode(bModel1);
if (l == 1) {
symbol += (1 << k);
k++;
}
} while (l != 0);
while (k--) //next binary part
if (decode(bModel0) == 1) {
binary_symbol |= (1 << k);
}
return static_cast<unsigned int>(symbol + binary_symbol);
}
//----------------------------------------------------------
private: // . . . . . . . . . . . . . . . . . . . . . .
......@@ -282,65 +232,7 @@ private: // . . . . . . . . . . . . . . . . . . . . . .
unsigned base, value, length; // arithmetic coding state
unsigned buffer_size, mode; // mode: 0 = undef, 1 = encoder, 2 = decoder
};
inline long DecodeIntACEGC(Arithmetic_Codec& acd,
Adaptive_Data_Model& mModelValues,
Static_Bit_Model& bModel0,
Adaptive_Bit_Model& bModel1,
const unsigned long exp_k,
const unsigned long M)
{
unsigned long uiValue = acd.decode(mModelValues);
if (uiValue == M) {
uiValue += acd.ExpGolombDecode(exp_k, bModel0, bModel1);
}
return UIntToInt(uiValue);
}
inline unsigned long DecodeUIntACEGC(Arithmetic_Codec& acd,
Adaptive_Data_Model& mModelValues,
Static_Bit_Model& bModel0,
Adaptive_Bit_Model& bModel1,
const unsigned long exp_k,
const unsigned long M)
{
unsigned long uiValue = acd.decode(mModelValues);
if (uiValue == M) {
uiValue += acd.ExpGolombDecode(exp_k, bModel0, bModel1);
}
return uiValue;
}
inline void EncodeIntACEGC(long predResidual,
Arithmetic_Codec& ace,
Adaptive_Data_Model& mModelValues,
Static_Bit_Model& bModel0,
Adaptive_Bit_Model& bModel1,
const unsigned long M)
{
unsigned long uiValue = IntToUInt(predResidual);
if (uiValue < M) {
ace.encode(uiValue, mModelValues);
}
else {
ace.encode(M, mModelValues);
ace.ExpGolombEncode(uiValue - M, 0, bModel0, bModel1);
}
}
inline void EncodeUIntACEGC(long predResidual,
Arithmetic_Codec& ace,
Adaptive_Data_Model& mModelValues,
Static_Bit_Model& bModel0,
Adaptive_Bit_Model& bModel1,
const unsigned long M)
{
unsigned long uiValue = static_cast<unsigned long>(predResidual);
if (uiValue < M) {
ace.encode(uiValue, mModelValues);
}
else {
ace.encode(M, mModelValues);
ace.ExpGolombEncode(uiValue - M, 0, bModel0, bModel1);
}
}
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#endif
......
......@@ -37,6 +37,7 @@
#include "DualLutCoder.h"
#include "constants.h"
#include "entropy.h"
#include "io_hls.h"
#include "RAHT.h"
......@@ -46,11 +47,11 @@ namespace pcc {
// An encapsulation of the entropy decoding methods used in attribute coding
struct PCCResidualsDecoder {
o3dgc::Arithmetic_Codec arithmeticDecoder;
o3dgc::Static_Bit_Model binaryModel0;
o3dgc::Adaptive_Bit_Model binaryModelPred;
o3dgc::Adaptive_Bit_Model binaryModelDiff[7];
o3dgc::Adaptive_Bit_Model binaryModelIsZero[7];
EntropyDecoder arithmeticDecoder;
StaticBitModel binaryModel0;
AdaptiveBitModel binaryModelPred;
AdaptiveBitModel binaryModelDiff[7];
AdaptiveBitModel binaryModelIsZero[7];
DualLutCoder<false> symbolCoder[2];
void start(const char* buf, int buf_len);
......@@ -66,10 +67,8 @@ struct PCCResidualsDecoder {
void
PCCResidualsDecoder::start(const char* buf, int buf_len)
{
arithmeticDecoder.set_buffer(
buf_len, reinterpret_cast<uint8_t*>(const_cast<char*>(buf)));
arithmeticDecoder.start_decoder();
arithmeticDecoder.setBuffer(buf_len, buf);
arithmeticDecoder.start();
}
//----------------------------------------------------------------------------
......@@ -77,7 +76,7 @@ PCCResidualsDecoder::start(const char* buf, int buf_len)
void
PCCResidualsDecoder::stop()
{
arithmeticDecoder.stop_decoder();
arithmeticDecoder.stop();
}
//----------------------------------------------------------------------------
......@@ -100,7 +99,7 @@ PCCResidualsDecoder::decodeSymbol(int k1, int k2)
uint32_t value = symbolCoder[k2].decode(&arithmeticDecoder);
if (value == kAttributeResidualAlphabetSize) {
value +=
arithmeticDecoder.ExpGolombDecode(0, binaryModel0, binaryModelDiff[k1]);
arithmeticDecoder.decodeExpGolomb(0, binaryModel0, binaryModelDiff[k1]);
}
++value;
......@@ -243,8 +242,7 @@ AttributeDecoder::decodeReflectancesPred(
const uint32_t attValue0 = decoder.decode();
const int64_t quantPredAttValue = predictor.predictReflectance(pointCloud);
const int64_t delta =
PCCInverseQuantization(o3dgc::UIntToInt(attValue0), qs);
const int64_t delta = PCCInverseQuantization(UIntToInt(attValue0), qs);
const int64_t reconstructedQuantAttValue = quantPredAttValue + delta;
reflectance = uint16_t(
PCCClip(reconstructedQuantAttValue, int64_t(0), maxReflectance));
......@@ -319,8 +317,7 @@ AttributeDecoder::decodeColorsPred(
PCCColor3B& color = pointCloud.getColor(predictor.index);
const PCCColor3B predictedColor = predictor.predictColor(pointCloud);
const int64_t quantPredAttValue = predictedColor[0];
const int64_t delta =
PCCInverseQuantization(o3dgc::UIntToInt(values[0]), qs);
const int64_t delta = PCCInverseQuantization(UIntToInt(values[0]), qs);
const int64_t reconstructedQuantAttValue = quantPredAttValue + delta;
int64_t clipMax = (1 << desc.attr_bitdepth) - 1;
......@@ -328,8 +325,7 @@ AttributeDecoder::decodeColorsPred(
uint8_t(PCCClip(reconstructedQuantAttValue, int64_t(0), clipMax));
for (size_t k = 1; k < 3; ++k) {
const int64_t quantPredAttValue = predictedColor[k];
const int64_t delta =
PCCInverseQuantization(o3dgc::UIntToInt(values[k]), qs2);
const int64_t delta = PCCInverseQuantization(UIntToInt(values[k]), qs2);
const int64_t reconstructedQuantAttValue = quantPredAttValue + delta;
color[k] =
uint8_t(PCCClip(reconstructedQuantAttValue, int64_t(0), clipMax));
......@@ -388,7 +384,7 @@ AttributeDecoder::decodeReflectancesRaht(
int* sortedIntegerizedAttributes = new int[voxelCount];
for (int n = 0; n < voxelCount; ++n) {
const uint32_t attValue0 = decoder.decode();
sortedIntegerizedAttributes[n] = o3dgc::UIntToInt(attValue0);
sortedIntegerizedAttributes[n] = UIntToInt(attValue0);
}
// Unsort integerized attributes by weight.
......@@ -479,14 +475,13 @@ AttributeDecoder::decodeColorsRaht(
if (
binaryLayer[sortedWeight[n].index] >= aps.raht_binary_level_threshold) {
decoder.decode(values);
sortedIntegerizedAttributes[n] = o3dgc::UIntToInt(values[0]);
sortedIntegerizedAttributes[n] = UIntToInt(values[0]);
for (int d = 1; d < 3; ++d) {
sortedIntegerizedAttributes[voxelCount * d + n] =
o3dgc::UIntToInt(values[d]);
sortedIntegerizedAttributes[voxelCount * d + n] = UIntToInt(values[d]);
}
} else {
values[0] = decoder.decode();
sortedIntegerizedAttributes[n] = o3dgc::UIntToInt(values[0]);
sortedIntegerizedAttributes[n] = UIntToInt(values[0]);
for (int d = 1; d < 3; d++) {
sortedIntegerizedAttributes[voxelCount * d + n] = 0;
}
......@@ -573,11 +568,11 @@ AttributeDecoder::decodeColorsLift(
const int64_t qs2 = aps.quant_step_size_chroma;
const double quantWeight = sqrt(weights[predictorIndex]);
auto& color = colors[predictorIndex];
const int64_t delta = o3dgc::UIntToInt(values[0]);
const int64_t delta = UIntToInt(values[0]);
const double reconstructedDelta = PCCInverseQuantization(delta, qs);
color[0] = reconstructedDelta / quantWeight;
for (size_t d = 1; d < 3; ++d) {
const int64_t delta = o3dgc::UIntToInt(values[d]);
const int64_t delta = UIntToInt(values[d]);
const double reconstructedDelta = PCCInverseQuantization(delta, qs2);
color[d] = reconstructedDelta / quantWeight;
}
......@@ -638,7 +633,7 @@ AttributeDecoder::decodeReflectancesLift(
const int64_t qs = aps.quant_step_size_luma;
const double quantWeight = sqrt(weights[predictorIndex]);
auto& reflectance = reflectances[predictorIndex];
const int64_t delta = o3dgc::UIntToInt(detail);
const int64_t delta = UIntToInt(detail);
const double reconstructedDelta = PCCInverseQuantization(delta, qs);
reflectance = reconstructedDelta / quantWeight;
}
......
......@@ -38,6 +38,7 @@
#include "ArithmeticCodec.h"
#include "DualLutCoder.h"
#include "constants.h"
#include "entropy.h"
#include "RAHT.h"
namespace pcc {
......@@ -45,11 +46,11 @@ namespace pcc {
// An encapsulation of the entropy coding methods used in attribute coding
struct PCCResidualsEncoder {
o3dgc::Arithmetic_Codec arithmeticEncoder;
o3dgc::Static_Bit_Model binaryModel0;
o3dgc::Adaptive_Bit_Model binaryModelPred;
o3dgc::Adaptive_Bit_Model binaryModelDiff[7];
o3dgc::Adaptive_Bit_Model binaryModelIsZero[7];
EntropyEncoder arithmeticEncoder;
StaticBitModel binaryModel0;
AdaptiveBitModel binaryModelPred;
AdaptiveBitModel binaryModelDiff[7];
AdaptiveBitModel binaryModelIsZero[7];
DualLutCoder<false> symbolCoder[2];
void start(int numPoints);
......@@ -67,8 +68,8 @@ PCCResidualsEncoder::start(int pointCount)
{
// todo(df): remove estimate when arithmetic codec is replaced
int maxAcBufLen = pointCount * 3 * 2 + 1024;
arithmeticEncoder.set_buffer(maxAcBufLen, nullptr);
arithmeticEncoder.start_encoder();
arithmeticEncoder.setBuffer(maxAcBufLen, nullptr);
arithmeticEncoder.start();
}
//----------------------------------------------------------------------------
......@@ -76,7 +77,7 @@ PCCResidualsEncoder::start(int pointCount)
int
PCCResidualsEncoder::stop()
{
return arithmeticEncoder.stop_encoder();
return arithmeticEncoder.stop();
}
//----------------------------------------------------------------------------
......@@ -103,7 +104,7 @@ PCCResidualsEncoder::encodeSymbol(uint32_t value, int k1, int k2)
} else {
int alphabetSize = kAttributeResidualAlphabetSize;
symbolCoder[k2].encode(alphabetSize, &arithmeticEncoder);
arithmeticEncoder.ExpGolombEncode(
arithmeticEncoder.encodeExpGolomb(
value - alphabetSize, 0, binaryModel0, binaryModelDiff[k1]);
}
}
......@@ -329,7 +330,7 @@ AttributeEncoder::computeReflectanceResidual(
const int64_t quantAttValue = reflectance;
const int64_t quantPredAttValue = predictedReflectance;
const int64_t delta = PCCQuantization(quantAttValue - quantPredAttValue, qs);
return o3dgc::IntToUInt(delta);
return IntToUInt(delta);
}
//----------------------------------------------------------------------------
......@@ -418,7 +419,7 @@ AttributeEncoder::encodeReflectancesPred(
const int64_t quantPredAttValue = predictedReflectance;
const int64_t delta =
PCCQuantization(quantAttValue - quantPredAttValue, qs);
const uint32_t attValue0 = uint32_t(o3dgc::IntToUInt(long(delta)));
const uint32_t attValue0 = uint32_t(IntToUInt(long(delta)));
const int64_t reconstructedDelta = PCCInverseQuantization(delta, qs);
const int64_t reconstructedQuantAttValue =
quantPredAttValue + reconstructedDelta;
......@@ -443,13 +444,13 @@ AttributeEncoder::computeColorResiduals(
const int64_t quantAttValue = color[0];
const int64_t quantPredAttValue = predictedColor[0];
const int64_t delta = PCCQuantization(quantAttValue - quantPredAttValue, qs);
residuals[0] = o3dgc::IntToUInt(delta);
residuals[0] = IntToUInt(delta);
for (size_t k = 1; k < 3; ++k) {
const int64_t quantAttValue = color[k];
const int64_t quantPredAttValue = predictedColor[k];
const int64_t delta =
PCCQuantization(quantAttValue - quantPredAttValue, qs2);
residuals[k] = o3dgc::IntToUInt(delta);
residuals[k] = IntToUInt(delta);
}
return residuals;
}
......@@ -550,7 +551,7 @@ AttributeEncoder::encodeColorsPred(
const int64_t reconstructedDelta = PCCInverseQuantization(delta, qs);
const int64_t reconstructedQuantAttValue =
quantPredAttValue + reconstructedDelta;
values[0] = uint32_t(o3dgc::IntToUInt(long(delta)));
values[0] = uint32_t(IntToUInt(long(delta)));
PCCColor3B reconstructedColor;
reconstructedColor[0] =
uint8_t(PCCClip(reconstructedQuantAttValue, int64_t(0), clipMax));
......@@ -562,7 +563,7 @@ AttributeEncoder::encodeColorsPred(
const int64_t reconstructedDelta = PCCInverseQuantization(delta, qs2);
const int64_t reconstructedQuantAttValue =
quantPredAttValue + reconstructedDelta;
values[k] = uint32_t(o3dgc::IntToUInt(long(delta)));
values[k] = uint32_t(IntToUInt(long(delta)));
reconstructedColor[k] =
uint8_t(PCCClip(reconstructedQuantAttValue, int64_t(0), clipMax));
}
......@@ -638,7 +639,7 @@ AttributeEncoder::encodeReflectancesTransformRaht(
}
// Entropy encode.
for (int n = 0; n < voxelCount; ++n) {
const int64_t detail = o3dgc::IntToUInt(sortedIntegerizedAttributes[n]);
const int64_t detail = IntToUInt(sortedIntegerizedAttributes[n]);
assert(detail < std::numeric_limits<uint32_t>::max());
const uint32_t attValue0 = uint32_t(detail);
encoder.encode(attValue0);
......@@ -759,14 +760,14 @@ AttributeEncoder::encodeColorsTransformRaht(
// Entropy encode.
uint32_t values[3];
for (int n = 0; n < voxelCount; ++n) {
const int64_t detail = o3dgc::IntToUInt(sortedIntegerizedAttributes[n]);
const int64_t detail = IntToUInt(sortedIntegerizedAttributes[n]);
assert(detail < std::numeric_limits<uint32_t>::max());
values[0] = uint32_t(detail);
if (
binaryLayer[sortedWeight[n].index] >= aps.raht_binary_level_threshold) {
for (int d = 1; d < 3; ++d) {
const int64_t detail =
o3dgc::IntToUInt(sortedIntegerizedAttributes[voxelCount * d + n]);
IntToUInt(sortedIntegerizedAttributes[voxelCount * d + n]);
assert(detail < std::numeric_limits<uint32_t>::max());
values[d] = uint32_t(detail);
}
......@@ -881,7 +882,7 @@ AttributeEncoder::encodeColorsLift(
const double quantWeight = sqrt(weights[predictorIndex]);
auto& color = colors[predictorIndex];
const int64_t delta = PCCQuantization(color[0] * quantWeight, qs);
const int64_t detail = o3dgc::IntToUInt(delta);
const int64_t detail = IntToUInt(delta);
assert(detail < std::numeric_limits<uint32_t>::max());
const double reconstructedDelta = PCCInverseQuantization(delta, qs);
color[0] = reconstructedDelta / quantWeight;
......@@ -890,7 +891,7 @@ AttributeEncoder::encodeColorsLift(
const size_t qs2 = aps.quant_step_size_chroma;
for (size_t d = 1; d < 3; ++d) {
const int64_t delta = PCCQuantization(color[d] * quantWeight, qs2);
const int64_t detail = o3dgc::IntToUInt(delta);
const int64_t detail = IntToUInt(delta);
assert(detail < std::numeric_limits<uint32_t>::max());
const double reconstructedDelta = PCCInverseQuantization(delta, qs2);
color[d] = reconstructedDelta / quantWeight;
......@@ -967,7 +968,7 @@ AttributeEncoder::encodeReflectancesLift(
const double quantWeight = sqrt(weights[predictorIndex]);
auto& reflectance = reflectances[predictorIndex];
const int64_t delta = PCCQuantization(reflectance * quantWeight, qs);
const int64_t detail = o3dgc::IntToUInt(delta);
const int64_t detail = IntToUInt(delta);
assert(detail < std::numeric_limits<uint32_t>::max());
const double reconstructedDelta = PCCInverseQuantization(delta, qs);
reflectance = reconstructedDelta / quantWeight;
......
......@@ -72,6 +72,9 @@ file(GLOB PROJECT_INC_FILES
"RAHT.h"
"TMC3.h"
"constants.h"
"entropy.h"
"entropyo3dgc.h"
"entropyutils.h"
"geometry.h"
"geometry_intra_pred.h"
"geometry_octree.h"
......
......@@ -211,7 +211,7 @@ DualLutCoder<_limitedContextMode>::resetLut()
template<>
void
DualLutCoder<true>::encodeFrequencySortedLutIndex(
int index, o3dgc::Arithmetic_Codec* entropy)
int index, EntropyEncoder* entropy)
{
bool b4 = index & 1;
bool b3 = (index >> 1) & 1;
......@@ -252,7 +252,7 @@ DualLutCoder<true>::encodeFrequencySortedLutIndex(
template<>
void
DualLutCoder<false>::encodeFrequencySortedLutIndex(
int index, o3dgc::Arithmetic_Codec* entropy)
int index, EntropyEncoder* entropy)
{
entropy->encode((index >> 4) & 1, _ctxLutIndex[0]);
entropy->encode((index >> 3) & 1, _ctxLutIndex[1 + (index >> 4)]);
......@@ -265,8 +265,7 @@ DualLutCoder<false>::encodeFrequencySortedLutIndex(
template<bool _limitedContextMode>
void
DualLutCoder<_limitedContextMode>::encode(
int value, o3dgc::Arithmetic_Codec* entropy)
DualLutCoder<_limitedContextMode>::encode(int value, EntropyEncoder* entropy)
{
// One of three coding methods are used:
// - Encode position in LUT (if present)
......@@ -309,8 +308,7 @@ DualLutCoder<_limitedContextMode>::encode(
template<>
int
DualLutCoder<true>::decodeFrequencySortedLutIndex(
o3dgc::Arithmetic_Codec* entropy)
DualLutCoder<true>::decodeFrequencySortedLutIndex(EntropyDecoder* entropy)
{
bool b0, b1, b2, b3, b4;
......@@ -345,8 +343,7 @@ DualLutCoder<true>::decodeFrequencySortedLutIndex(
template<>
int
DualLutCoder<false>::decodeFrequencySortedLutIndex(
o3dgc::Arithmetic_Codec* entropy)
DualLutCoder<false>::decodeFrequencySortedLutIndex(EntropyDecoder* entropy)
{
int index = 0;
index = (index << 1) | entropy->decode(_ctxLutIndex[0]);
......@@ -362,7 +359,7 @@ DualLutCoder<false>::decodeFrequencySortedLutIndex(
template<bool _limitedContextMode>
int
DualLutCoder<_limitedContextMode>::decode(o3dgc::Arithmetic_Codec* entropy)
DualLutCoder<_limitedContextMode>::decode(EntropyDecoder* entropy)
{
int symbol;
......
......@@ -38,7 +38,7 @@
#include <cassert>
#include <cstdint>
#include "ArithmeticCodec.h"
#include "entropy.h"
namespace pcc {
......@@ -183,25 +183,24 @@ public:
void init(const uint8_t initTable[32]);
void resetLut();
void encode(int symbol, o3dgc::Arithmetic_Codec* arithmeticEncoder);
int decode(o3dgc::Arithmetic_Codec* arithmeticDecoder);
void encode(int symbol, EntropyEncoder* arithmeticEncoder);
int decode(EntropyDecoder* arithmeticDecoder);
private:
void
encodeFrequencySortedLutIndex(int index, o3dgc::Arithmetic_Codec* entropy);
void encodeFrequencySortedLutIndex(int index, EntropyEncoder* entropy);
int decodeFrequencySortedLutIndex(o3dgc::Arithmetic_Codec* entropy);
int decodeFrequencySortedLutIndex(EntropyDecoder* entropy);
// bool _limitedContextMode;
FrequentSymbolCache<kCacheSize, 256> _cache;
FrequencySortingLut<kLutSize, 256> _adaptiveLut;
o3dgc::Static_Bit_Model _ctxBypass;
o3dgc::Adaptive_Bit_Model_Fast _ctxLutHit;
o3dgc::Adaptive_Bit_Model_Fast _ctxCacheHit;
o3dgc::Adaptive_Bit_Model_Fast _ctxSymbolBit;
o3dgc::Adaptive_Bit_Model_Fast _ctxLutIndex[kNumLutContexts];
StaticBitModel _ctxBypass;
AdaptiveBitModelFast _ctxLutHit;
AdaptiveBitModelFast _ctxCacheHit;
AdaptiveBitModelFast _ctxSymbolBit;
AdaptiveBitModelFast _ctxLutIndex[kNumLutContexts];
};
//============================================================================
......
......@@ -166,10 +166,9 @@ PCCTMC3Decoder3::decodeGeometryBrick(const PayloadBuffer& buf)
minPositions.y() = gbh.geomBoxOrigin.y();
minPositions.z() = gbh.geomBoxOrigin.z();
o3dgc::Arithmetic_Codec arithmeticDecoder(
int(buf.size()) - gbhSize,
reinterpret_cast<uint8_t*>(const_cast<char*>(buf.data() + gbhSize)));
arithmeticDecoder.start_decoder();
EntropyDecoder arithmeticDecoder;
arithmeticDecoder.setBuffer(int(buf.size()) - gbhSize, buf.data() + gbhSize);
arithmeticDecoder.start();
if (_gps->geom_codec_type == GeometryCodecType::kOctree) {
_currentPointCloud.resize(gbh.geom_num_points);
......@@ -179,7 +178,7 @@ PCCTMC3Decoder3::decodeGeometryBrick(const PayloadBuffer& buf)
decodeGeometryTrisoup(*_gps, gbh, _currentPointCloud, &arithmeticDecoder);
}
arithmeticDecoder.stop_decoder();
arithmeticDecoder.stop();
clock_user.stop();
auto total_user =
......
......@@ -243,8 +243,8 @@ PCCTMC3Encoder3::encodeGeometryBrick(PayloadBuffer* buf)
// todo(df): remove estimate when arithmetic codec is replaced
int maxAcBufLen = int(pointCloud.getPointCount()) * 3 * 4 + 1024;
o3dgc::Arithmetic_Codec arithmeticEncoder(maxAcBufLen, nullptr);
arithmeticEncoder.start_encoder();
EntropyEncoder arithmeticEncoder(maxAcBufLen, nullptr);
arithmeticEncoder.start();
if (_gps->geom_codec_type == GeometryCodecType::kOctree) {
encodeGeometryOctree(*_gps, gbh, pointCloud, &arithmeticEncoder);
......@@ -253,7 +253,7 @@ PCCTMC3Encoder3::encodeGeometryBrick(PayloadBuffer* buf)
encodeGeometryTrisoup(*_gps, gbh, pointCloud, &arithmeticEncoder);
}
uint32_t dataLen = arithmeticEncoder.stop_encoder();
uint32_t dataLen = arithmeticEncoder.stop();
std::copy_n(arithmeticEncoder.buffer(), dataLen, std::back_inserter(*buf));
}
......
/* 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