aboutsummaryrefslogtreecommitdiff
path: root/src/creator.h
diff options
context:
space:
mode:
authorLeonard Kugis <leonardkugis@gmail.com>2018-02-01 02:14:33 +0100
committerLeonard Kugis <leonardkugis@gmail.com>2018-02-01 02:14:33 +0100
commitf1e93826da797128adcf90396d450fa590631bfb (patch)
treeb50a8fa9b929a917934140eadd1f52947cdab133 /src/creator.h
parent18e5b2554b4cd73207e936e76e32c9d376cd1ba8 (diff)
integrated video export, exporting garbageHEADmaster
Diffstat (limited to 'src/creator.h')
-rw-r--r--src/creator.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/creator.h b/src/creator.h
index bcff35d..99735c5 100644
--- a/src/creator.h
+++ b/src/creator.h
@@ -9,14 +9,18 @@
#ifndef CREATOR_H_
#define CREATOR_H_
-#define COORDS(x, y, width) ((y)*(width)+(x))
-
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include <libavcodec/avcodec.h>
#include <libavutil/frame.h>
#include <libavutil/imgutils.h>
+#include "defs.h"
+
+#define CLIP(X) ( (X) > 255 ? 255 : (X) < 0 ? 0 : X)
+
+// RGB -> YUV
+#define RGB2Y(R, G, B) CLIP(( ( 66 * (R) + 129 * (G) + 25 * (B) + 128) >> 8) + 16)
+#define RGB2U(R, G, B) CLIP(( ( -38 * (R) - 74 * (G) + 112 * (B) + 128) >> 8) + 128)
+#define RGB2V(R, G, B) CLIP(( ( 112 * (R) - 94 * (G) - 18 * (B) + 128) >> 8) + 128)
AVFrame *picture;
@@ -24,15 +28,19 @@ AVPacket *pkt;
FILE *f;
+u64 pts_old;
+
const AVCodec *codec;
-AVCodecContext *c= NULL;
-int i, ret, x, y;
+AVCodecContext *avc;
+int creator_i, creator_ret, creator_x, creator_y;
static void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt, FILE *outfile);
-int generateVideo(char *filename, int width, int height, int fps, int bitRate);
+int generateVideo(const char *filename, int width, int height, int fps, int bitRate);
void addFrame(int *frame);
-#endif /* RENDER_H_ */
+void endFile(void);
+
+#endif