Summarize PPI project bodies

This commit is contained in:
2026-06-01 12:44:49 +02:00
parent 2da247f0fb
commit f1ee1b28a1
9 changed files with 430 additions and 32 deletions

View File

@@ -9,6 +9,11 @@
namespace pp::assets {
constexpr std::size_t ppi_header_size = 40;
constexpr std::uint32_t max_ppi_canvas_dimension = 131072;
constexpr std::uint32_t max_ppi_layer_count = 1024;
constexpr std::uint32_t max_ppi_frame_count = 100000;
constexpr std::size_t max_ppi_layer_name_length = 128;
constexpr std::uint64_t max_ppi_face_payload_bytes = 1024ULL * 1024ULL * 1024ULL;
struct PpiVersion {
std::uint32_t major = 0;
@@ -42,6 +47,22 @@ struct PpiProjectLayout {
std::size_t body_bytes = 0;
};
struct PpiBodySummary {
std::uint32_t width = 0;
std::uint32_t height = 0;
std::uint32_t layer_count = 0;
std::uint32_t declared_frame_count = 0;
std::uint32_t total_layer_frames = 0;
std::uint32_t dirty_face_count = 0;
std::uint64_t compressed_face_bytes = 0;
std::uint32_t info_bytes = 0;
};
struct PpiProjectSummary {
PpiProjectLayout layout;
PpiBodySummary body;
};
[[nodiscard]] pp::foundation::Result<PpiHeaderInfo> parse_ppi_header(
std::span<const std::byte> bytes) noexcept;
@@ -50,4 +71,11 @@ struct PpiProjectLayout {
[[nodiscard]] pp::foundation::Result<PpiProjectLayout> parse_ppi_project_layout(
std::span<const std::byte> bytes) noexcept;
[[nodiscard]] pp::foundation::Result<PpiBodySummary> parse_ppi_body_summary(
PpiHeaderInfo header,
std::span<const std::byte> body) noexcept;
[[nodiscard]] pp::foundation::Result<PpiProjectSummary> parse_ppi_project_summary(
std::span<const std::byte> bytes) noexcept;
}