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

Class SeqHevcCompression

gsplat/compression/seq_hevc_compression.py:23–507  ·  view source on GitHub ↗

Uses quantization and sorting to compress splats into mp4 files via libx265 and uses K-means clustering to compress the spherical harmonic coefficents. .. warning:: This class requires the `imageio `_, `plas <https://github.com/fraunhofer

Source from the content-addressed store, hash-verified

21
22@dataclass
23class SeqHevcCompression:
24 """Uses quantization and sorting to compress splats into mp4 files via libx265
25 and uses K-means clustering to compress the spherical harmonic coefficents.
26
27 .. warning::
28 This class requires the `imageio <https://pypi.org/project/imageio/>`_,
29 `plas <https://github.com/fraunhoferhhi/PLAS.git>`_
30 and `torchpq <https://github.com/DeMoriarty/TorchPQ?tab=readme-ov-file#install>`_ packages to be installed.
31
32 .. warning::
33 This class might throw away a few lowest opacities splats if the number of
34 splats is not a square number.
35
36 .. note::
37 The splats parameters are expected to be pre-activation values. It expects
38 the following fields in the splats dictionary: "means", "scales", "quats",
39 "opacities", "sh0", "shN". More fields can be added to the dictionary, but
40 they will only be compressed using NPZ compression.
41
42 References:
43 - `Compact 3D Scene Representation via Self-Organizing Gaussian Grids <https://arxiv.org/abs/2312.13299>`_
44 - `Making Gaussian Splats more smaller <https://aras-p.info/blog/2023/09/27/Making-Gaussian-Splats-more-smaller/>`_
45
46 Args:
47 use_sort (bool, optional): Whether to sort splats before compression. Defaults to True.
48 verbose (bool, optional): Whether to print verbose information. Default to True.
49 """
50
51 use_sort: bool = True
52 verbose: bool = True
53 qp: Dict[str, Union[int, Dict[str, Any]]] = field(default_factory=lambda: {
54 "means": -1,
55 "opacities": 4,
56 "quats": 4,
57 "scales": 4,
58 "sh0": 16,
59 "shN":{
60 "sh1": 20,
61 "sh2": 24,
62 "sh3": 28
63 }
64 })
65 n_clusters: int = 32768
66 debug: bool = False
67 use_all_intra: bool = False
68
69 attribute_codec_registry: InitVar[Optional[Dict[str, str]]] = None
70
71 compress_fn_map: Dict[str, Callable] = field(default_factory=lambda: {
72 "means": _compress_video_hevc_16bit,
73 "scales": _compress_video_hevc,
74 "quats": _compress_quats_video_hevc,
75 "opacities": _compress_video_hevc,
76 "sh0": _compress_video_hevc,
77 "shN": _compress_shN_video_hevc
78 # "shN": _compress_masked_kmeans,
79 })
80 decompress_fn_map: Dict[str, Callable] = field(default_factory=lambda: {

Callers 2

__init__Method · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected