Skip to content

Commit

Permalink
chore: optimize camera parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
LynnL4 committed Jun 20, 2024
1 parent ebb6449 commit 606e7ff
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 15 deletions.
28 changes: 23 additions & 5 deletions porting/himax/we2/drivers/OV5647_mipi_2lane_1296x972.i
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{HX_CIS_I2C_Action_W, 0x370c, 0x03},
{HX_CIS_I2C_Action_W, 0x3612, 0x59},
{HX_CIS_I2C_Action_W, 0x3618, 0x00},
{HX_CIS_I2C_Action_W, 0x5000, 0x06},
{HX_CIS_I2C_Action_W, 0x5000, 0x89},
{HX_CIS_I2C_Action_W, 0x5002, 0x41},
{HX_CIS_I2C_Action_W, 0x5003, 0x08},
{HX_CIS_I2C_Action_W, 0x5a00, 0x08},
Expand Down Expand Up @@ -78,11 +78,29 @@
{HX_CIS_I2C_Action_W, 0x3a0d, 0x08},

{HX_CIS_I2C_Action_W, 0x3a0e, 0x06}, // 0x07 1:0 9:8 V
{HX_CIS_I2C_Action_W, 0x3a0f, 0x58}, // 0xb0 7:0 7:0 V

{HX_CIS_I2C_Action_W, 0x3a10, 0x50},
{HX_CIS_I2C_Action_W, 0x3a1b, 0x58},
{HX_CIS_I2C_Action_W, 0x3a1e, 0x50},
// LENC GAIN
{HX_CIS_I2C_Action_W, 0x583E, 0xFF}, //MAX
{HX_CIS_I2C_Action_W, 0x583F, 0x80}, // MIN

// AEC/AGC Area
{HX_CIS_I2C_Action_W, 0x3a0f, 0x30},
{HX_CIS_I2C_Action_W, 0x3a10, 0x20},
{HX_CIS_I2C_Action_W, 0x3a1b, 0x30},
{HX_CIS_I2C_Action_W, 0x3a1e, 0x20},

// AGC/AEC Average Area & weight
{HX_CIS_I2C_Action_W, 0x5680, 0x00},
{HX_CIS_I2C_Action_W, 0x5681, 0x00},
{HX_CIS_I2C_Action_W, 0x5682, 0x00},
{HX_CIS_I2C_Action_W, 0x5683, 0x00},
// center weight for AEC
{HX_CIS_I2C_Action_W, 0x568A, 0x21},
{HX_CIS_I2C_Action_W, 0x588B, 0x12},
{HX_CIS_I2C_Action_W, 0x588C, 0x21},
{HX_CIS_I2C_Action_W, 0x588D, 0x12},


{HX_CIS_I2C_Action_W, 0x3a11, 0x60},
{HX_CIS_I2C_Action_W, 0x3a1f, 0x28},
{HX_CIS_I2C_Action_W, 0x4001, 0x02},
Expand Down
9 changes: 7 additions & 2 deletions porting/himax/we2/drivers/drv_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,20 @@ void _reset_all_wdma_buffer() {
}

void (*_drv_dp_event_cb_on_frame_ready)() = NULL;
void (*_drv_dp_on_stop_stream)() = NULL;
void (*_drv_dp_on_stop_stream)() = NULL;

void _drv_dp_event_cb(SENSORDPLIB_STATUS_E event) {
EL_LOGD("event: %d", event);

switch (event) {
case SENSORDPLIB_STATUS_XDMA_FRAME_READY:
_frame_ready = true;
++_frame_count;
if (_frame_count > SKIP_FRAME_COUNT) {
_frame_ready = true;
} else {
_frame_ready = false;
sensordplib_retrigger_capture();
}
if (_drv_dp_event_cb_on_frame_ready != NULL) {
_drv_dp_event_cb_on_frame_ready();
}
Expand Down
2 changes: 2 additions & 0 deletions porting/himax/we2/drivers/drv_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ void _reset_all_wdma_buffer();

void _drv_dp_event_cb(SENSORDPLIB_STATUS_E event);

#define SKIP_FRAME_COUNT (2)

extern volatile bool _initiated_before;
extern volatile bool _frame_ready;
extern volatile uint32_t _frame_count;
Expand Down
1 change: 1 addition & 0 deletions porting/himax/we2/drivers/drv_hm0360.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ el_err_code_t drv_hm0360_init(uint16_t width, uint16_t height) {
sensordplib_set_sensorctrl_start();

_frame_ready = false;
++_frame_count;
sensordplib_retrigger_capture();

_initiated_before = true;
Expand Down
1 change: 1 addition & 0 deletions porting/himax/we2/drivers/drv_imx219.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ el_err_code_t drv_imx219_init(uint16_t width, uint16_t height) {
sensordplib_set_sensorctrl_start();

_frame_ready = false;
++_frame_count;
sensordplib_retrigger_capture();

if (_is_version_c) {
Expand Down
1 change: 1 addition & 0 deletions porting/himax/we2/drivers/drv_imx708.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ el_err_code_t drv_imx708_init(uint16_t width, uint16_t height) {
sensordplib_set_sensorctrl_start();

_frame_ready = false;
++_frame_count;
sensordplib_retrigger_capture();

if (_is_version_c) {
Expand Down
17 changes: 9 additions & 8 deletions porting/himax/we2/drivers/drv_ov5647.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,15 @@ el_err_code_t drv_ov5647_init(uint16_t width, uint16_t height) {
jpeg_cfg.enc_width = width;
jpeg_cfg.enc_height = height;
jpeg_cfg.jpeg_enctype = JPEG_ENC_TYPE_YUV422;
jpeg_cfg.jpeg_encqtable = JPEG_ENC_QTABLE_10X;
jpeg_cfg.jpeg_encqtable = JPEG_ENC_QTABLE_4X;

#if defined(CONFIG_EL_BOARD_SENSECAP_WATCHER)
if (width > 240 && height > 240) {
jpeg_cfg.jpeg_encqtable = JPEG_ENC_QTABLE_10X;
} else {
jpeg_cfg.jpeg_encqtable = JPEG_ENC_QTABLE_4X;
}
#endif
// #if defined(CONFIG_EL_BOARD_SENSECAP_WATCHER)
// if (width > 240 && height > 240) {
// jpeg_cfg.jpeg_encqtable = JPEG_ENC_QTABLE_10X;
// } else {
// jpeg_cfg.jpeg_encqtable = JPEG_ENC_QTABLE_4X;
// }
// #endif

// sensordplib_set_int_hw5x5rgb_jpeg_wdma23(hw5x5_cfg, jpeg_cfg, 1, NULL);
sensordplib_set_int_hw5x5_jpeg_wdma23(hw5x5_cfg, jpeg_cfg, 1, NULL);
Expand All @@ -396,6 +396,7 @@ el_err_code_t drv_ov5647_init(uint16_t width, uint16_t height) {
sensordplib_set_sensorctrl_start();

_frame_ready = false;
_frame_count = 0;
sensordplib_retrigger_capture();

_initiated_before = true;
Expand Down

0 comments on commit 606e7ff

Please sign in to comment.