-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpyrowave_encoder.hpp
More file actions
64 lines (53 loc) · 1.34 KB
/
pyrowave_encoder.hpp
File metadata and controls
64 lines (53 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (c) 2025 Hans-Kristian Arntzen
// SPDX-License-Identifier: MIT
#pragma once
#include <memory>
#include <stddef.h>
#include <stdint.h>
#include "pyrowave_config.hpp"
namespace Vulkan
{
class Device;
class Buffer;
class ImageView;
class CommandBuffer;
}
namespace PyroWave
{
class Encoder
{
public:
Encoder();
~Encoder();
struct BitstreamBuffers
{
struct
{
const Vulkan::Buffer *buffer;
uint64_t offset;
uint64_t size;
} meta, bitstream;
size_t target_size;
};
bool init(Vulkan::Device *device, int width, int height, ChromaSubsampling chroma);
bool encode(Vulkan::CommandBuffer &cmd, const ViewBuffers &views, const BitstreamBuffers &buffers);
// Debug hackery
const Vulkan::ImageView &get_wavelet_band(int component, int level);
bool encode_pre_transformed(Vulkan::CommandBuffer &cmd, const BitstreamBuffers &buffers, float quant_scale);
//
uint64_t get_meta_required_size() const;
struct Packet
{
size_t offset;
size_t size;
};
size_t compute_num_packets(const void *mapped_meta, size_t packet_boundary) const;
size_t packetize(Packet *packets, size_t packet_boundary,
void *bitstream, size_t size,
const void *mapped_meta, const void *mapped_bitstream) const;
void report_stats(const void *mapped_meta, const void *mapped_bitstream) const;
private:
struct Impl;
std::unique_ptr<Impl> impl;
};
}