Bouffalo SDK  1.0
Bouffalolab Software Development Kit
bflb_mjpeg.h
Go to the documentation of this file.
1 #ifndef _BFLB_MJPEG_H
2 #define _BFLB_MJPEG_H
3 
4 #include "bflb_core.h"
5 
17 #define MJPEG_FORMAT_YUV422_YUYV 0
18 #define MJPEG_FORMAT_YUV422_YVYU 1
19 #define MJPEG_FORMAT_YUV422_UYVY 2
20 #define MJPEG_FORMAT_YUV422_VYUY 3
21 #define MJPEG_FORMAT_YUV422SP_NV16 4
22 #define MJPEG_FORMAT_YUV422SP_NV61 5
23 #define MJPEG_FORMAT_YUV420SP_NV12 6
24 #define MJPEG_FORMAT_YUV420SP_NV21 7
25 #define MJPEG_FORMAT_GRAY 8
26 
33 #define MJPEG_INTSTS_ONE_FRAME (1 << 4)
34 
41 #define MJPEG_INTCLR_ONE_FRAME (1 << 8)
42 
49 #define MJPEG_CMD_SET_INPUTADDR0 0x00
50 #define MJPEG_CMD_SET_INPUTADDR1 0x01
51 
55 #define MJPEG_MAX_FRAME_COUNT 4
56 
69  uint8_t format;
70  uint8_t quality;
71  uint16_t rows;
72  uint16_t resolution_x;
73  uint16_t resolution_y;
74  uint32_t input_bufaddr0;
75  uint32_t input_bufaddr1;
76  uint32_t output_bufaddr;
77  uint32_t output_bufsize;
78  uint16_t *input_yy_table;
79  uint16_t *input_uv_table;
80 };
81 
82 #ifdef __cplusplus
83 extern "C" {
84 #endif
85 
92 void bflb_mjpeg_init(struct bflb_device_s *dev, const struct bflb_mjpeg_config_s *config);
93 
99 void bflb_mjpeg_start(struct bflb_device_s *dev);
100 
106 void bflb_mjpeg_stop(struct bflb_device_s *dev);
107 
114 void bflb_mjpeg_sw_run(struct bflb_device_s *dev, uint8_t frame_count);
115 
122 void bflb_mjpeg_kick_run(struct bflb_device_s *dev, uint16_t kick_count);
123 
129 void bflb_mjpeg_kick_stop(struct bflb_device_s *dev);
130 
136 void bflb_mjpeg_kick(struct bflb_device_s *dev);
143 void bflb_mjpeg_tcint_mask(struct bflb_device_s *dev, bool mask);
144 
151 void bflb_mjpeg_errint_mask(struct bflb_device_s *dev, bool mask);
152 
159 uint32_t bflb_mjpeg_get_intstatus(struct bflb_device_s *dev);
160 
167 void bflb_mjpeg_int_clear(struct bflb_device_s *dev, uint32_t int_clear);
168 
175 uint8_t bflb_mjpeg_get_frame_count(struct bflb_device_s *dev);
176 
182 void bflb_mjpeg_pop_one_frame(struct bflb_device_s *dev);
183 
191 uint32_t bflb_mjpeg_get_frame_info(struct bflb_device_s *dev, uint8_t **pic);
192 
200 void bflb_mjpeg_calculate_quantize_table(uint8_t quality, uint16_t *input_table, uint16_t *output_table);
201 
209 void bflb_mjpeg_fill_quantize_table(struct bflb_device_s *dev, uint16_t *input_yy, uint16_t *input_uv);
210 
218 void bflb_mjpeg_fill_jpeg_header_tail(struct bflb_device_s *dev, uint8_t *header, uint32_t header_len);
219 
227 void bflb_mjpeg_set_yuv420sp_cam_input(struct bflb_device_s *dev, uint8_t yy, uint8_t uv);
228 
237 int bflb_mjpeg_feature_control(struct bflb_device_s *dev, int cmd, size_t arg);
238 
249 void bflb_mjpeg_update_input_output_buff(struct bflb_device_s *dev, void *input_buf0, void *input_buf1, void *output_buff, size_t output_buff_size);
250 
251 #ifdef __cplusplus
252 }
253 #endif
254 
263 #endif
uint32_t output_bufaddr
Definition: bflb_mjpeg.h:76
void bflb_mjpeg_stop(struct bflb_device_s *dev)
Stop mjpeg compression with camera.
void bflb_mjpeg_set_yuv420sp_cam_input(struct bflb_device_s *dev, uint8_t yy, uint8_t uv)
Set mjpeg input when uses camera with yuv402sp.
void bflb_mjpeg_kick_stop(struct bflb_device_s *dev)
Stop mjpeg kick mode compression without camera.
void bflb_mjpeg_int_clear(struct bflb_device_s *dev, uint32_t int_clear)
Clear mjpeg interrupt status.
void bflb_mjpeg_sw_run(struct bflb_device_s *dev, uint8_t frame_count)
Start mjpeg compression without camera.
void bflb_mjpeg_init(struct bflb_device_s *dev, const struct bflb_mjpeg_config_s *config)
Initialize mjpeg.
void bflb_mjpeg_start(struct bflb_device_s *dev)
Start mjpeg compression with camera.
uint32_t bflb_mjpeg_get_intstatus(struct bflb_device_s *dev)
Get mjpeg interrupt status.
int bflb_mjpeg_feature_control(struct bflb_device_s *dev, int cmd, size_t arg)
Control mjpeg feature.
uint32_t output_bufsize
Definition: bflb_mjpeg.h:77
uint32_t bflb_mjpeg_get_frame_info(struct bflb_device_s *dev, uint8_t **pic)
Get one frame information.
uint32_t input_bufaddr1
Definition: bflb_mjpeg.h:75
uint32_t input_bufaddr0
Definition: bflb_mjpeg.h:74
uint16_t resolution_x
Definition: bflb_mjpeg.h:72
void bflb_mjpeg_calculate_quantize_table(uint8_t quality, uint16_t *input_table, uint16_t *output_table)
Calculate jpeg quantize table.
void bflb_mjpeg_kick_run(struct bflb_device_s *dev, uint16_t kick_count)
Start mjpeg kick mode compression without camera.
uint16_t * input_yy_table
Definition: bflb_mjpeg.h:78
uint16_t * input_uv_table
Definition: bflb_mjpeg.h:79
void bflb_mjpeg_fill_jpeg_header_tail(struct bflb_device_s *dev, uint8_t *header, uint32_t header_len)
Fill jpeg header into mjpeg register and enable hardware auto adding jpeg tail.
void bflb_mjpeg_fill_quantize_table(struct bflb_device_s *dev, uint16_t *input_yy, uint16_t *input_uv)
Fill quantize table into mjpeg register.
uint16_t resolution_y
Definition: bflb_mjpeg.h:73
MJPEG configuration structure.
Definition: bflb_mjpeg.h:68
void bflb_mjpeg_update_input_output_buff(struct bflb_device_s *dev, void *input_buf0, void *input_buf1, void *output_buff, size_t output_buff_size)
Control mjpeg feature.
void bflb_mjpeg_errint_mask(struct bflb_device_s *dev, bool mask)
Enable or disable mjpeg error interrupt.
uint8_t bflb_mjpeg_get_frame_count(struct bflb_device_s *dev)
Get number of frame count that has compressed.
void bflb_mjpeg_tcint_mask(struct bflb_device_s *dev, bool mask)
Enable or disable mjpeg one frame compression completion interrupt.
void bflb_mjpeg_pop_one_frame(struct bflb_device_s *dev)
Drop one frame that has compressed.
void bflb_mjpeg_kick(struct bflb_device_s *dev)
kick one times compression without camera.