-
Notifications
You must be signed in to change notification settings - Fork 1
/
encode_re.hpp
46 lines (39 loc) · 1.02 KB
/
encode_re.hpp
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
#pragma once
#include "base.hpp"
class Encoder_Re : public Encoder {
private:
FILE *fp;
inline int gt() {
return getc(fp);
}
inline int r() {
int c = gt();
while (c < '0' || '9' < c) {
c = gt();
}
int ans = 0;
while ('0' <= c && c <= '9') {
ans = ans * 10 + c - '0';
c = gt();
}
return ans;
}
Font *fnt;
B *frame;
int contrast;
public:
Encoder_Re(std::string video, char* name, int _debug = 0) : Encoder(_debug) {
fp = fopen(video.c_str(), "r");
x = r();
y = r();
clk = r();
printf("[%d:%d %.2lfHz] -%s-> [replay] %s\n",
x, y, CLOCKS_PER_SEC / (double)clk,
name, debug ? "[debug]" : "");
print_size = (x + 1) * y;
buffer = (char *)malloc(print_size + 2);
}
inline int read_a_frame() {
return (print_size + 1) ^ fread(buffer, 1, print_size + 1, fp);
}
};