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

Class VideoCompressionConfig

examples/codec_ply_sequence.py:187–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185
186@dataclass
187class VideoCompressionConfig(CompressionConfig):
188 # Use PLAS sort in compression or not
189 use_sort: bool = True
190 # Verbose or not
191 verbose: bool = True
192 # QP configuration - can be either int or dict for different attributes
193 qp: Dict[str, Union[int, Dict[str, Any]]] = field(default_factory=default_qp_values)
194 # Number of cluster of VQ for shN compression
195 n_clusters: int = 32768
196 # Maps attribute names to their codec functions
197 attribute_codec_registry: Optional[AttributeCodecs] = field(default_factory=lambda: AttributeCodecs())
198 # Enable All Intra coding mode
199 use_all_intra: bool = False
200 # Enable debug mode
201 debug: bool = False
202 # Indicate which attributes to transform domain before sorting and compression,
203 # e.g. SH: RGB -> YCbCr, Quat: Unit Quaternion -> Euler Angles
204 transform_attributes: Dict[str, bool] = field(
205 default_factory=lambda: {
206 "means": False,
207 "scales": False,
208 "quats": False,
209 "opacities": False,
210 "sh0": False,
211 "shN": False
212 }
213 )
214 # Chroma subsampling for shN compression
215 chroma_subsampling: Dict[str, str] = field(default_factory=lambda: {
216 "sh0": "444",
217 "shN": "420"
218 })
219 # Use chroma qp offset for sh0 and shN compression
220 use_chroma_qp_offset: Dict[str, bool]= field(default_factory=lambda: {
221 "sh0": False,
222 "shN": False
223 })
224
225 def to_dict(self) -> Dict[str, Any]:
226 """
227 Convert the CompressionConfig instance to a dictionary.
228 If attribute_codec_registry is not None, it will be converted to a dictionary using its to_dict method.
229 """
230 # Get only attributes defined in VideoCompressionConfig
231 video_compression_attrs = [
232 "use_sort", "verbose", "qp", "n_clusters",
233 "use_all_intra", "debug", "transform_attributes",
234 "chroma_subsampling", "use_chroma_qp_offset"
235 ]
236
237 result = {attr: getattr(self, attr) for attr in video_compression_attrs}
238
239 # handle attribute_codec_registry
240 if self.attribute_codec_registry is not None:
241 result["attribute_codec_registry"] = self.attribute_codec_registry.to_dict()
242
243 return result
244

Callers

nothing calls this directly

Calls 1

AttributeCodecsClass · 0.70

Tested by

no test coverage detected