Blender V5.3
spz_header.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2026 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include <cstdint>
8#include <optional>
9#include <string>
10
11namespace blender::io::spz {
12
13/* Bytes N, G, S, P in file order, shared by all format versions. */
14constexpr uint32_t SPZ_HEADER_MAGIC = 0x5053474e;
15
20
21/* Header inside the Gzip stream in SPZ versions 2 and 3. */
31static_assert(sizeof(PackedGaussiansHeader) == 16);
32
33/* Uncompressed header in SPZ version 4. */
41 uint8_t num_streams; /* The number of ZSTD-compressed attribute streams (typically 6). */
42 uint32_t toc_byte_offset; /* Byte offset from file start to the TOC. */
43 uint8_t reserved[12]; /* Zero, reserved for future use. */
44};
45static_assert(sizeof(NgspFileHeader) == 32);
46
47/* Return an error message for a header the importer cannot use, or nullopt on success.
48 * Only header fields are checked; this does not validate the file's payload or TOC entries. */
49[[nodiscard]] std::optional<std::string> check_header_for_errors(
50 const PackedGaussiansHeader &header);
51[[nodiscard]] std::optional<std::string> check_header_for_errors(const NgspFileHeader &header);
52
53} // namespace blender::io::spz
std::optional< std::string > check_header_for_errors(const PackedGaussiansHeader &header)
Definition spz_header.cc:41
constexpr uint32_t SPZ_HEADER_MAGIC
Definition spz_header.hh:14
unsigned int uint32_t
Definition BKE_text.h:81
unsigned char uint8_t
Definition BKE_text.h:79