GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
prediction_scheme_delta_decoder.h
Go to the documentation of this file.
1// Copyright 2016 The Draco Authors.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15#ifndef DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DELTA_DECODER_H_
16#define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DELTA_DECODER_H_
17
19
20namespace draco {
21
22// Decoder for values encoded with delta coding. See the corresponding encoder
23// for more details.
24template <typename DataTypeT, class TransformT>
26 : public PredictionSchemeDecoder<DataTypeT, TransformT> {
27 public:
28 using CorrType =
30 // Initialized the prediction scheme.
34 const TransformT &transform)
35 : PredictionSchemeDecoder<DataTypeT, TransformT>(attribute, transform) {}
36
37 bool ComputeOriginalValues(const CorrType *in_corr, DataTypeT *out_data,
38 int size, int num_components,
39 const PointIndex *entry_to_point_id_map) override;
43 bool IsInitialized() const override { return true; }
44};
45
46template <typename DataTypeT, class TransformT>
48 const CorrType *in_corr, DataTypeT *out_data, int size, int num_components,
49 const PointIndex *) {
50 this->transform().Init(num_components);
51 // Decode the original value for the first element.
52 std::unique_ptr<DataTypeT[]> zero_vals(new DataTypeT[num_components]());
53 this->transform().ComputeOriginalValue(zero_vals.get(), in_corr, out_data);
54
55 // Decode data from the front using D(i) = D(i) + D(i - 1).
56 for (int i = num_components; i < size; i += num_components) {
57 this->transform().ComputeOriginalValue(out_data + i - num_components,
58 in_corr + i, out_data + i);
59 }
60 return true;
61}
62
63} // namespace draco
64
65#endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DELTA_DECODER_H_
Definition point_attribute.h:33
Transform::CorrType CorrType
Definition prediction_scheme_decoder.h:41
const Transform & transform() const
Definition prediction_scheme_decoder.h:80
PredictionSchemeDecoder(const PointAttribute *attribute)
Definition prediction_scheme_decoder.h:42
const PointAttribute * attribute() const
Definition prediction_scheme_decoder.h:79
PredictionSchemeDeltaDecoder(const PointAttribute *attribute)
Definition prediction_scheme_delta_decoder.h:31
bool ComputeOriginalValues(const CorrType *in_corr, DataTypeT *out_data, int size, int num_components, const PointIndex *entry_to_point_id_map) override
Definition prediction_scheme_delta_decoder.h:47
PredictionSchemeDeltaDecoder(const PointAttribute *attribute, const TransformT &transform)
Definition prediction_scheme_delta_decoder.h:33
PredictionSchemeMethod GetPredictionMethod() const override
Definition prediction_scheme_delta_decoder.h:40
typename PredictionSchemeDecoder< DataTypeT, TransformT >::CorrType CorrType
Definition prediction_scheme_delta_decoder.h:28
bool IsInitialized() const override
Definition prediction_scheme_delta_decoder.h:43
n< br > font size
Definition meshpage.php:3536
Definition attribute_octahedron_transform.cc:21
PredictionSchemeMethod
Definition compression_shared.h:80
@ PREDICTION_DIFFERENCE
Definition compression_shared.h:85
Definition GameApi_pl.cc:29382