Skip to content

Commit

Permalink
fix: ov5647 output color, compile issue
Browse files Browse the repository at this point in the history
* fix: version date (apr/aug)

* fix: compile issue (float32 data type)

* fix: bggr to grbg (don't known why...)

* chore: jpeg compression variants for different device
  • Loading branch information
iChizer0 authored Apr 9, 2024
1 parent 48988e5 commit dd57e1c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
8 changes: 5 additions & 3 deletions core/algorithm/el_algorithm_nvidia_det.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,12 @@ el_err_code_t AlgorithmNvidiaDet::postprocess() {
_results.clear();
el_shape_t __output_shape0;
el_shape_t __output_shape1;

static_assert(sizeof(float) == 4);

// get output
auto* data0{static_cast<_Float32*>(this->__p_engine->get_output(0))};
auto* data1{static_cast<_Float32*>(this->__p_engine->get_output(1))};
auto* data0{static_cast<float*>(this->__p_engine->get_output(0))};
auto* data1{static_cast<float*>(this->__p_engine->get_output(1))};
__output_shape0 = this->__p_engine->get_output_shape(0);
__output_shape1 = this->__p_engine->get_output_shape(1);

Expand All @@ -155,7 +158,6 @@ el_err_code_t AlgorithmNvidiaDet::postprocess() {
this->_conf_shape = __output_shape0.dims[3] > __output_shape1.dims[3] ? __output_shape1 : __output_shape0;
this->_bboxes_shape = __output_shape0.dims[3] > __output_shape1.dims[3] ? __output_shape0 : __output_shape1;

auto B = this->_conf_shape.dims[0];
auto H = this->_conf_shape.dims[1];
auto W = this->_conf_shape.dims[2];
auto BboxsCount = this->_conf_shape.dims[3];
Expand Down
2 changes: 1 addition & 1 deletion core/el_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ constexpr static uint16_t YEAR =
constexpr static uint16_t MONTH = (__DATE__[0] == 'J') ? ((__DATE__[1] == 'a') ? 1 : ((__DATE__[2] == 'n') ? 6 : 7))
: (__DATE__[0] == 'F') ? 2
: (__DATE__[0] == 'M') ? ((__DATE__[2] == 'r') ? 3 : 5)
: (__DATE__[0] == 'A') ? ((__DATE__[2] == 'p') ? 4 : 8)
: (__DATE__[0] == 'A') ? ((__DATE__[1] == 'p') ? 4 : 8)
: (__DATE__[0] == 'S') ? 9
: (__DATE__[0] == 'O') ? 10
: (__DATE__[0] == 'N') ? 11
Expand Down
2 changes: 1 addition & 1 deletion porting/himax/we2/drivers/OV5647_mipi_2lane_1296x972.i
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
{HX_CIS_I2C_Action_W, 0x3503, 0x00},

{HX_CIS_I2C_Action_W, 0x3820, 0x41},
{HX_CIS_I2C_Action_W, 0x3821, 0x00},
{HX_CIS_I2C_Action_W, 0x3821, 0x00}, // LR flip

{HX_CIS_I2C_Action_W, 0x350a, 0x00},
{HX_CIS_I2C_Action_W, 0x350b, 0x10},
Expand Down
2 changes: 0 additions & 2 deletions porting/himax/we2/drivers/drv_imx219.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,6 @@ el_err_code_t drv_imx219_init(uint16_t width, uint16_t height) {

//JPEG Cfg
jpeg_cfg.jpeg_path = JPEG_PATH_ENCODER_EN;
jpeg_cfg.dec_roi_stx = 0;
jpeg_cfg.dec_roi_sty = 0;
jpeg_cfg.enc_width = width;
jpeg_cfg.enc_height = height;
jpeg_cfg.jpeg_enctype = JPEG_ENC_TYPE_YUV422;
Expand Down
4 changes: 1 addition & 3 deletions porting/himax/we2/drivers/drv_imx708.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,12 +470,10 @@ el_err_code_t drv_imx708_init(uint16_t width, uint16_t height) {

//JPEG Cfg
jpeg_cfg.jpeg_path = JPEG_PATH_ENCODER_EN;
jpeg_cfg.dec_roi_stx = 0;
jpeg_cfg.dec_roi_sty = 0;
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_4X;
jpeg_cfg.jpeg_encqtable = JPEG_ENC_QTABLE_10X;

#if defined(CONFIG_EL_BOARD_DEV_BOARD_WE2)
if (width > 240 && height > 240) {
Expand Down
24 changes: 13 additions & 11 deletions porting/himax/we2/drivers/drv_ov5647.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ static HX_CIS_SensorSetting_t OV5647_stream_off[] = {
{HX_CIS_I2C_Action_W, 0x4202, 0x0F},
};

static HX_CIS_SensorSetting_t OV5647_mirror_setting[] = {
{HX_CIS_I2C_Action_W, 0x0101, 0x00},
#ifdef CONFIG_EL_BOARD_GROVE_VISION_AI_WE2
{HX_CIS_I2C_Action_W, 0x3821, 0x07},
#endif
};

el_err_code_t drv_ov5647_probe() {
hx_drv_cis_init((CIS_XHSHUTDOWN_INDEX_E)DEAULT_XHSUTDOWN_PIN, SENSORCTRL_MCLK_DIV3);

Expand Down Expand Up @@ -226,13 +233,6 @@ el_err_code_t drv_ov5647_init(uint16_t width, uint16_t height) {
goto err;
}

HX_CIS_SensorSetting_t OV5647_mirror_setting[] = {
{HX_CIS_I2C_Action_W, 0x0101, 0x00},
#ifdef CONFIG_EL_BOARD_GROVE_VISION_AI_WE2
{HX_CIS_I2C_Action_W, 0x3821, 0x07},
#endif
};

if (hx_drv_cis_setRegTable(OV5647_mirror_setting,
HX_CIS_SIZE_N(OV5647_mirror_setting, HX_CIS_SensorSetting_t)) != HX_CIS_NO_ERROR) {
ret = EL_EIO;
Expand Down Expand Up @@ -346,7 +346,7 @@ el_err_code_t drv_ov5647_init(uint16_t width, uint16_t height) {
hw5x5_cfg.hw5x5_path = HW5x5_PATH_THROUGH_DEMOSAIC;
hw5x5_cfg.demos_bndmode = DEMOS_BNDODE_REFLECT;
hw5x5_cfg.demos_color_mode = DEMOS_COLORMODE_YUV422;
hw5x5_cfg.demos_pattern_mode = DEMOS_PATTENMODE_BGGR;
hw5x5_cfg.demos_pattern_mode = DEMOS_PATTENMODE_GRBG;
hw5x5_cfg.demoslpf_roundmode = DEMOSLPF_ROUNDMODE_ROUNDING;
hw5x5_cfg.hw55_crop_stx = start_x;
hw5x5_cfg.hw55_crop_sty = start_y;
Expand All @@ -355,16 +355,18 @@ el_err_code_t drv_ov5647_init(uint16_t width, uint16_t height) {

//JPEG Cfg
jpeg_cfg.jpeg_path = JPEG_PATH_ENCODER_EN;
jpeg_cfg.dec_roi_stx = 0;
jpeg_cfg.dec_roi_sty = 0;
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_4X;
jpeg_cfg.jpeg_encqtable = JPEG_ENC_QTABLE_10X;

#if defined(CONFIG_EL_BOARD_DEV_BOARD_WE2)
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 Down

0 comments on commit dd57e1c

Please sign in to comment.