Repository navigation
Expand file tree
/
Copy pathpyrowave_decoder.hpp
More file actions
59 lines (49 loc) · 2.07 KB
/
Copy pathpyrowave_decoder.hpp
File metadata and controls
59 lines (49 loc) · 2.07 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
// Copyright (c) 2025 Hans-Kristian Arntzen
// Copyright (c) 2026 AlkaidLab contributors
// SPDX-License-Identifier: MIT AND GPL-3.0-only
#pragma once
#include <memory>
#include <stddef.h>
#include <stdint.h>
#include "pyrowave_config.hpp"
#include "pyrowave_bitstream_header.hpp"
namespace Vulkan
{
class Device;
class ImageView;
class CommandBuffer;
}
namespace PyroWave
{
class Decoder
{
public:
Decoder();
~Decoder();
// Fragment path is optimized for typical mobile GPUs which have weak compute support.
// iDWT is instead computed entirely in traditional render passes and fragment shaders.
// This path is *not* recommended for desktop-class chips.
bool init(Vulkan::Device *device, int width, int height,
ChromaSubsampling chroma, bool fragment_path = false);
static bool device_prefers_fragment_path(Vulkan::Device &device);
void clear();
bool push_packet(const void *data, size_t size);
// If fragment path is enabled, the command buffer must support graphics operations.
// To synchronize, synchronize with COLOR_OUTPUT / COLOR_ATTACHMENT_WRITE / COLOR_ATTACHMENT_OPTIMAL.
// Views must be created with VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT.
bool decode(Vulkan::CommandBuffer &cmd, const ViewBuffers &views);
bool decode_is_ready(bool allow_partial_frame) const;
bool get_color_metadata(BitstreamColorMetadata &metadata) const;
// A more refined version of decode_is_ready() that allows a bit more control.
// The default is num_pristine_bands = 2 (the next-to-final LL band) and minimum_packet_ratio = 0.9.
// active_block_mask is an optional pointer.
// If bit i % 32 of active_block_mask[i / 32] is not set, then a missing block for that block index
// is ignored. This is intended to cover advanced cases for error correction.
// If the pointer is null, it is implied that all blocks are active for purposes of this call.
bool decode_is_ready(bool allow_partial_frame, int num_pristine_bands, float minimum_packet_ratio,
const uint32_t *active_block_mask, size_t word_count) const;
private:
struct Impl;
std::unique_ptr<Impl> impl;
};
}