GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
encoder_options.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_CONFIG_ENCODER_OPTIONS_H_
16#define DRACO_COMPRESSION_CONFIG_ENCODER_OPTIONS_H_
17
22
23namespace draco {
24
25// EncoderOptions allow users to specify so called feature options that are used
26// to inform the encoder which encoding features can be used (i.e. which
27// features are going to be available to the decoder).
28template <typename AttributeKeyT>
29class EncoderOptionsBase : public DracoOptions<AttributeKeyT> {
30 public:
31 static EncoderOptionsBase CreateDefaultOptions() {
32 EncoderOptionsBase options;
33#ifdef DRACO_STANDARD_EDGEBREAKER_SUPPORTED
34 options.SetSupportedFeature(features::kEdgebreaker, true);
35#endif
36#ifdef DRACO_PREDICTIVE_EDGEBREAKER_SUPPORTED
37 options.SetSupportedFeature(features::kPredictiveEdgebreaker, true);
38#endif
39 return options;
40 }
41 static EncoderOptionsBase CreateEmptyOptions() {
42 return EncoderOptionsBase();
43 }
44
45 // Returns speed options with default value of 5.
46 int GetEncodingSpeed() const {
47 return this->GetGlobalInt("encoding_speed", 5);
48 }
49 int GetDecodingSpeed() const {
50 return this->GetGlobalInt("decoding_speed", 5);
51 }
52
53 // Returns the maximum speed for both encoding/decoding.
54 int GetSpeed() const {
55 const int encoding_speed = this->GetGlobalInt("encoding_speed", -1);
56 const int decoding_speed = this->GetGlobalInt("decoding_speed", -1);
57 const int max_speed = std::max(encoding_speed, decoding_speed);
58 if (max_speed == -1) {
59 return 5; // Default value.
60 }
61 return max_speed;
62 }
63
64 void SetSpeed(int encoding_speed, int decoding_speed) {
65 this->SetGlobalInt("encoding_speed", encoding_speed);
66 this->SetGlobalInt("decoding_speed", decoding_speed);
67 }
68 bool IsSpeedSet() const {
69 return this->IsGlobalOptionSet("encoding_speed") ||
70 this->IsGlobalOptionSet("decoding_speed");
71 }
72
73 // Sets a given feature as supported or unsupported by the target decoder.
74 // Encoder will always use only supported features when encoding the input
75 // geometry.
76 void SetSupportedFeature(const std::string &name, bool supported) {
77 feature_options_.SetBool(name, supported);
78 }
79 bool IsFeatureSupported(const std::string &name) const {
80 return feature_options_.GetBool(name);
81 }
82
83 void SetFeatureOptions(const Options &options) { feature_options_ = options; }
84 const Options &GetFeaturelOptions() const { return feature_options_; }
85
86 private:
87 // Use helper methods to construct the encoder options.
88 // See CreateDefaultOptions();
90
91 // List of supported/unsupported features that can be used by the encoder.
92 Options feature_options_;
93};
94
95// Encoder options where attributes are identified by their attribute id.
96// Used to set options that are specific to a given geometry.
98
99} // namespace draco
100
101#endif // DRACO_COMPRESSION_CONFIG_ENCODER_OPTIONS_H_
Definition draco_options.h:52
void SetGlobalInt(const std::string &name, int val)
Definition draco_options.h:89
int GetGlobalInt(const std::string &name, int default_val) const
Definition draco_options.h:86
bool IsGlobalOptionSet(const std::string &name) const
Definition draco_options.h:114
Definition encoder_options.h:29
int GetDecodingSpeed() const
Definition encoder_options.h:49
static EncoderOptionsBase CreateDefaultOptions()
Definition encoder_options.h:31
bool IsSpeedSet() const
Definition encoder_options.h:68
int GetEncodingSpeed() const
Definition encoder_options.h:46
void SetSpeed(int encoding_speed, int decoding_speed)
Definition encoder_options.h:64
bool IsFeatureSupported(const std::string &name) const
Definition encoder_options.h:79
const Options & GetFeaturelOptions() const
Definition encoder_options.h:84
void SetFeatureOptions(const Options &options)
Definition encoder_options.h:83
int GetSpeed() const
Definition encoder_options.h:54
static EncoderOptionsBase CreateEmptyOptions()
Definition encoder_options.h:41
void SetSupportedFeature(const std::string &name, bool supported)
Definition encoder_options.h:76
Definition options.h:30
iVBORw0KGgoAAAANSUhEUgAAANcAAAB5CAMAAACdtUQZAAAA51BMVEX</div ></div >< div style="padding: 0px 0px; width: 1324px;">< div style="height: 400px; width: 1324px;"></div >< div itemscope itemtype="https: </div><div itemscope itemtype="https:</div >< div itemscope itemtype="https: </div></div><p><div style="padding:0px 0px;width:1324px;"><div></div><div itemscope itemtype="https:< ul >< li >< b > Application name
8AkrcAgqgAs9wqQ0ey2tkAo8gAuuQfeI4hPUH09fXHy8z4+fng4uNKXF/Lz9BzfoAcgpkQMTUAKjAbOT4Qr9AXhJ8Rl7ktMCwTosA...
Definition meshpage.php:1610
< h2 > I want smooth transition from jpg png webp to the engine</h2 > There s few options
Definition meshpage.php:1181
constexpr const char * kEdgebreaker
Definition encoding_features.h:33
constexpr const char * kPredictiveEdgebreaker
Definition encoding_features.h:34
Definition attribute_octahedron_transform.cc:21
EncoderOptionsBase< int32_t > EncoderOptions
Definition encoder_options.h:97