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

Class SeqYUVCodecConfig

examples/codec_ply_sequence.py:129–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127
128@dataclass
129class SeqYUVCodecConfig(CompressionConfig):
130 # Video codec name, e.g. "vvc", "av1", "hevc"
131 video_codec_type: str = "vtm"
132 # Use PLAS sort in compression or not
133 use_sort: bool = True
134 # sort type
135 sort_type: Literal["plas", "morton"] = "morton"
136 # Verbose or not
137 verbose: bool = True
138 # QP configuration - can be either int or dict for different attributes
139 qp: Dict[str, Union[int, Dict[str, Any]]] = field(default_factory=default_qp_values)
140 # Maps attribute names to their codec functions
141 attribute_configs: Dict[str, List[str]] = field(default_factory=default_attribute_configs)
142 # Enable All Intra coding mode
143 use_all_intra: bool = False
144 # Enable debug mode
145 debug: bool = False
146 # Indicate which attributes to transform domain before sorting and compression,
147 # e.g. SH: RGB -> YCbCr, Quat: Unit Quaternion -> Euler Angles
148 transform_attributes: Dict[str, bool] = field(
149 default_factory=lambda: {
150 "means": False,
151 "scales": False,
152 "quats": True, # always normalize quats
153 "opacities": False,
154 "sh0": False,
155 "shN": False
156 }
157 )
158 # Chroma subsampling for shN compression
159 chroma_subsampling: Dict[str, str] = field(default_factory=lambda: {
160 "sh0": "444",
161 "shN": "420"
162 })
163 # Use chroma qp offset for sh0 and shN compression
164 use_chroma_qp_offset: Dict[str, bool]= field(default_factory=lambda: {
165 "sh0": False,
166 "shN": False
167 })
168
169 def to_dict(self) -> Dict[str, Any]:
170 """
171 Convert the CompressionConfig instance to a dictionary.
172 If attribute_codec_registry is not None, it will be converted to a dictionary using its to_dict method.
173 """
174 # Get only attributes defined in VideoCompressionConfig
175 video_compression_attrs = [
176 "video_codec_type", "use_sort", "sort_type", "verbose", "qp",
177 "use_all_intra", "debug", "transform_attributes",
178 "chroma_subsampling", "use_chroma_qp_offset", "attribute_configs",
179 ]
180
181 result = {attr: getattr(self, attr) for attr in video_compression_attrs}
182
183 return result
184
185
186@dataclass

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected