MCPcopy Create free account
hub / github.com/JasonLSC/GSCodec_Studio / CompressionConfig

Class CompressionConfig

examples/ply_loader_renderer.py:107–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105
106@dataclass
107class CompressionConfig:
108 # Use PLAS sort in compression or not
109 use_sort: bool = True
110 # Verbose or not
111 verbose: bool = True
112 # QP value for video coding
113 qp: Optional[int] = field(default=None)
114 # Number of cluster of VQ for shN compression
115 n_clusters: int = 32768
116 # Maps attribute names to their codec functions
117 attribute_codec_registry: Optional[AttributeCodecs] = field(default_factory=lambda: AttributeCodecs())
118
119 def to_dict(self) -> Dict[str, Any]:
120 """
121 Convert the CompressionConfig instance to a dictionary.
122 If attribute_codec_registry is not None, it will be converted to a dictionary using its to_dict method.
123 Fields with None values (use_sort, verbose) will be excluded from the resulting dictionary.
124 """
125 result = {
126 "use_sort": self.use_sort,
127 "verbose": self.verbose,
128 "n_clusters": self.n_clusters,
129 }
130
131 if self.qp is not None:
132 result["qp"] = self.qp
133
134 # handle attribute_codec_registry
135 if self.attribute_codec_registry is not None:
136 result["attribute_codec_registry"] = self.attribute_codec_registry.to_dict()
137
138 return result
139
140@dataclass
141class Config:

Callers 1

Calls 1

AttributeCodecsClass · 0.70

Tested by

no test coverage detected