-
Notifications
You must be signed in to change notification settings - Fork 169
Expand file tree
/
Copy pathh3_vision_encoder.h
More file actions
36 lines (29 loc) · 1.17 KB
/
Copy pathh3_vision_encoder.h
File metadata and controls
36 lines (29 loc) · 1.17 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
#ifndef H3_VISION_ENCODER_H
#define H3_VISION_ENCODER_H
#include "h3_gpu.h"
#include <stddef.h>
#include <stdint.h>
#define H3_VISION_OUTPUT_WIDTH 5120u
#define H3_VISION_DEEPSTACKS 3u
typedef struct {
int grid_h;
int grid_w;
size_t tokens;
uint16_t *merged;
uint16_t *deepstack[H3_VISION_DEEPSTACKS];
h3_gpu_stats gpu_stats;
} h3_vision_output;
typedef void (*h3_vision_progress)(int completed_layers, int total_layers,
void *opaque);
/* Encode one image or one two-frame video block. Pixels are F32 [T,3,H,W] in
* [0,1], T is 1 or 2, and H/W are multiples of 32. The output owns BF16 Qwen
* presentation rows and three same-shaped deepstack additions. */
int h3_vision_encode_bf16(const char *weight_directory,
const char *shader_source_path,
const float *pixels, int frames,
int height, int width,
h3_vision_progress progress, void *progress_opaque,
h3_vision_output *output,
char *error, size_t error_size);
void h3_vision_output_free(h3_vision_output *output);
#endif