-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvepoc.h
76 lines (65 loc) · 3.44 KB
/
vepoc.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
/*
* Copyright (c) 2014 Manuel Braga <[email protected]>
* Copyright (c) 2016 Milos Ladicorbic <milos dot ladicorbic at gmail dot com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef _VEPOC_H_
#define _VEPOC_H_
#include <stdint.h>
#include "ve.h"
#define ALIGN(x, a) (((x) + ((typeof(x))(a) - 1)) & ~((typeof(x))(a) - 1)) /* zaokruzuje da bude deljivo sa a */
#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) /* deljivo sa 'a' vraca 0 */
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) /* vraca broj makroblokova */
typedef enum {
VEISP_COLOR_FORMAT_NV12 = 0,
VEISP_COLOR_FORMAT_NV16 = 1,
VEISP_COLOR_FORMAT_TILE = 2,
} veisp_color_format_t;
typedef enum {
VEAVC_ENCODER_MODE_H264 = 0,
VEAVC_ENCODER_MODE_JPEG = 1,
} veavc_encoder_mode_t;
void picture_generate(uint32_t width, uint32_t height, uint8_t *Y, uint8_t *C);
void vejpeg_header_create(int w, int h, int quality);
void vejpeg_header_destroy(void);
void vejpeg_write_SOF0(void);
void vejpeg_write_SOS(void);
void vejpeg_write_quantization(void);
void vejpeg_write_file(const char *filename, uint8_t *buffer, uint32_t length);
int32_t vejpeg_write_buffer(uint8_t *pDst, uint8_t *pFrame, uint32_t frameSize);
void veisp_set_buffers(uint8_t *Y, uint8_t *C); /* set isp input buffers */
void veisp_set_outputBuffers (uint8_t *pY, uint8_t *pC); /* set isp output buffers for divide-scaled raw frame */
void veisp_set_picture_size(uint32_t w, uint32_t h); /* set isp subengine source picture size in macroblocks (16x16) */
void veisp_init_picture(uint32_t w, uint32_t h, veisp_color_format_t f);
void veisp_init_pictureMb(uint32_t width_mb, uint32_t height_mb, uint32_t stride_mb, veisp_color_format_t f);
void veisp_init_pictureMbWithDivision(uint32_t width_mb, uint32_t height_mb, veisp_color_format_t f);
void veisp_triger (void);
void veisp_set_scaler (uint32_t newwidth, uint32_t newheight, float offsetx, float offsety, float scalex, float scaley);
void veavc_select_subengine(uint8_t engine); /* select h264-jpeg encoder-decoder VE */
void veavc_release_subengine(void); /* release subengine */
void veavc_subengine_reset(void); /* reset subengine */
void veavc_init_vle(uint8_t *J, uint32_t size);
void veavc_init_ctrl(veavc_encoder_mode_t mode);
void veavc_jpeg_parameters(uint8_t fill1, uint8_t stuff, uint32_t biasY, uint32_t biasC);
void veavc_put_bits(uint8_t nbits, uint32_t data);
void veavc_sdram_index(uint32_t index);
void veavc_jpeg_quantization(uint16_t *tableY, uint16_t *tableC, uint32_t length);
void veavc_launch_encoding(void);
void veavc_check_status(void);
uint32_t veavc_get_written(void);
void veavc_set_mbInfo(uint8_t *pBuff);
#endif