-
Notifications
You must be signed in to change notification settings - Fork 0
/
cu.h
88 lines (71 loc) · 1.87 KB
/
cu.h
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//
// Created by Jovasa on 9.1.2024.
//
#ifndef VISUALIZER_CU_H
#define VISUALIZER_CU_H
#include <fstream>
#include <SFML/Graphics.hpp>
#include <functional>
#ifdef _MSC_VER
#pragma pack(push, 1)
#endif
struct sub_image_stats {
int64_t timestamp;
uint8_t frame_num;
uint16_t x;
uint16_t y;
uint8_t width;
uint8_t height;
uint32_t split_tree;
uint8_t qp;
uint8_t intra_mode;
uint8_t is_mip;
uint8_t mip_transpose;
uint8_t mrl;
uint8_t isp;
uint8_t lfnst;
uint8_t tr_idx;
float cost;
float bits;
float dist;
}
#ifdef _MSC_VER
;
#pragma pack(pop)
#else
__attribute__((packed));
#endif
struct sub_image {
sub_image_stats stats;
sf::Rect<uint32_t> rect;
uint8_t image[64* 64 * 4];
};
sub_image readOneCU(std::ifstream &data_file);
std::vector<sub_image_stats> readOneCU(void* data_file, sf::Rect<uint32_t>& rect_out, uint8_t* image, uint8_t& type);
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define GET_SPLITDATA(CU, curDepth) ((CU)->split_tree >> ((MAX((curDepth), 0) * 3)) & 7)
enum split_type {
NO_SPLIT = 0,
QT_SPLIT = 1,
BT_HOR_SPLIT = 2,
BT_VER_SPLIT = 3,
TT_HOR_SPLIT = 4,
TT_VER_SPLIT = 5,
};
typedef struct {
int16_t x;
int16_t y;
uint8_t local_x;
uint8_t local_y;
int8_t width;
int8_t height;
int8_t chroma_width;
int8_t chroma_height;
} cu_loc_t;
#define LCU_WIDTH 64
void uvg_cu_loc_ctor(cu_loc_t *loc, int x, int y, int width, int height);
void walk_tree(const sub_image_stats * const tree, cu_loc_t const *const cuLoc, uint8_t depth, uint32_t image_width,
uint32_t image_height, const std::vector<std::function<void(void *, const cu_loc_t *const,
const sub_image_stats *const)> > &funcs,
const std::vector<void *> &data);
#endif //VISUALIZER_CU_H