mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
refactor(ppa): avoid the use of yuv422_pack_order field in PPA driver
This commit is contained in:
@@ -144,9 +144,6 @@ bool ppa_blend_transaction_on_picked(uint32_t num_chans, const dma2d_trans_chann
|
||||
ppa_ll_blend_set_rx_bg_yuv_range(platform->hal.dev, blend_trans_desc->in_bg.yuv_range);
|
||||
ppa_ll_blend_set_rx_bg_yuv2rgb_std(platform->hal.dev, blend_trans_desc->in_bg.yuv_std);
|
||||
}
|
||||
if ((uint32_t)blend_trans_desc->in_bg.blend_cm == PPA_BLEND_COLOR_MODE_YUV422) {
|
||||
ppa_ll_blend_set_rx_bg_yuv422_pack_order(platform->hal.dev, blend_trans_desc->in_bg.yuv422_pack_order);
|
||||
}
|
||||
ppa_ll_blend_enable_rx_bg_byte_swap(platform->hal.dev, blend_trans_desc->bg_byte_swap);
|
||||
ppa_ll_blend_enable_rx_bg_rgb_swap(platform->hal.dev, blend_trans_desc->bg_rgb_swap);
|
||||
ppa_ll_blend_configure_rx_bg_alpha(platform->hal.dev, blend_trans_desc->bg_alpha_update_mode, blend_trans_desc->bg_alpha_value);
|
||||
@@ -201,7 +198,7 @@ esp_err_t ppa_do_blend(ppa_client_handle_t ppa_client, const ppa_blend_oper_conf
|
||||
config->in_bg.block_h % 2 == 0 && config->in_bg.block_w % 2 == 0 &&
|
||||
config->in_bg.block_offset_x % 2 == 0 && config->in_bg.block_offset_y % 2 == 0,
|
||||
ESP_ERR_INVALID_ARG, TAG, "YUV420 input does not support odd h/w/offset_x/offset_y");
|
||||
} else if (config->in_bg.blend_cm == PPA_BLEND_COLOR_MODE_YUV422) {
|
||||
} else if (PPA_IS_CM_YUV422(config->in_bg.blend_cm)) {
|
||||
ESP_RETURN_ON_FALSE(config->in_bg.pic_w % 2 == 0 && config->in_bg.block_w % 2 == 0 && config->in_bg.block_offset_x % 2 == 0,
|
||||
ESP_ERR_INVALID_ARG, TAG, "YUV422 input does not support odd w/offset_x");
|
||||
}
|
||||
@@ -218,7 +215,7 @@ esp_err_t ppa_do_blend(ppa_client_handle_t ppa_client, const ppa_blend_oper_conf
|
||||
ESP_RETURN_ON_FALSE(config->out.pic_h % 2 == 0 && config->out.pic_w % 2 == 0 &&
|
||||
config->out.block_offset_x % 2 == 0 && config->out.block_offset_y % 2 == 0,
|
||||
ESP_ERR_INVALID_ARG, TAG, "YUV420 output does not support odd h/w/offset_x/offset_y");
|
||||
} else if (config->out.blend_cm == PPA_BLEND_COLOR_MODE_YUV422) {
|
||||
} else if (PPA_IS_CM_YUV422(config->out.blend_cm)) {
|
||||
ESP_RETURN_ON_FALSE(config->out.pic_w % 2 == 0 && config->out.block_offset_x % 2 == 0,
|
||||
ESP_ERR_INVALID_ARG, TAG, "YUV422 output does not support odd w/offset_x");
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ esp_err_t ppa_do_fill(ppa_client_handle_t ppa_client, const ppa_fill_oper_config
|
||||
// config->out.block_offset_x % 2 == 0 && config->out.block_offset_y % 2 == 0,
|
||||
// ESP_ERR_INVALID_ARG, TAG, "YUV420 output does not support odd h/w/offset_x/offset_y");
|
||||
// } else
|
||||
if (config->out.fill_cm == PPA_FILL_COLOR_MODE_YUV422) {
|
||||
if (config->out.fill_cm == PPA_FILL_COLOR_MODE_YUV422_UYVY) {
|
||||
ESP_RETURN_ON_FALSE(config->out.pic_w % 2 == 0 && config->out.block_offset_x % 2 == 0,
|
||||
ESP_ERR_INVALID_ARG, TAG, "YUV422 output does not support odd w/offset_x");
|
||||
}
|
||||
|
||||
@@ -34,6 +34,10 @@ extern "C" {
|
||||
ESP_RETURN_ON_FALSE(COLOR_SPACE_TYPE(color_type_id) == COLOR_SPACE_ARGB || COLOR_SPACE_TYPE(color_type_id) == COLOR_SPACE_RGB, \
|
||||
ESP_ERR_INVALID_ARG, TAG, str "_cm does not support rgb_swap");
|
||||
|
||||
#define PPA_IS_CM_YUV422(color_type_id) \
|
||||
(color_type_id == COLOR_TYPE_ID(COLOR_SPACE_YUV, COLOR_PIXEL_UYVY422) || color_type_id == COLOR_TYPE_ID(COLOR_SPACE_YUV, COLOR_PIXEL_VYUY422) || \
|
||||
color_type_id == COLOR_TYPE_ID(COLOR_SPACE_YUV, COLOR_PIXEL_YUYV422) || color_type_id == COLOR_TYPE_ID(COLOR_SPACE_YUV, COLOR_PIXEL_YVYU422))
|
||||
|
||||
#define PPA_ALIGN_UP(num, align) (((num) + ((align) - 1)) & ~((align) - 1))
|
||||
#define PPA_ALIGN_DOWN(num, align) ((num) & ~((align) - 1))
|
||||
|
||||
|
||||
@@ -147,9 +147,6 @@ bool ppa_srm_transaction_on_picked(uint32_t num_chans, const dma2d_trans_channel
|
||||
ppa_ll_srm_set_rx_yuv_range(platform->hal.dev, srm_trans_desc->in.yuv_range);
|
||||
ppa_ll_srm_set_rx_yuv2rgb_std(platform->hal.dev, srm_trans_desc->in.yuv_std);
|
||||
}
|
||||
if ((uint32_t)ppa_in_color_mode == COLOR_TYPE_ID(COLOR_SPACE_YUV, COLOR_PIXEL_YUV422)) {
|
||||
ppa_ll_srm_set_rx_yuv422_pack_order(platform->hal.dev, srm_trans_desc->in.yuv422_pack_order);
|
||||
}
|
||||
ppa_ll_srm_enable_rx_byte_swap(platform->hal.dev, srm_trans_desc->byte_swap);
|
||||
ppa_ll_srm_enable_rx_rgb_swap(platform->hal.dev, srm_trans_desc->rgb_swap);
|
||||
ppa_ll_srm_configure_rx_alpha(platform->hal.dev, srm_trans_desc->alpha_update_mode, srm_trans_desc->alpha_value);
|
||||
@@ -190,7 +187,7 @@ esp_err_t ppa_do_scale_rotate_mirror(ppa_client_handle_t ppa_client, const ppa_s
|
||||
config->in.block_h % 2 == 0 && config->in.block_w % 2 == 0 &&
|
||||
config->in.block_offset_x % 2 == 0 && config->in.block_offset_y % 2 == 0,
|
||||
ESP_ERR_INVALID_ARG, TAG, "YUV420 input does not support odd h/w/offset_x/offset_y");
|
||||
} else if (config->in.srm_cm == PPA_SRM_COLOR_MODE_YUV422) {
|
||||
} else if (PPA_IS_CM_YUV422(config->in.srm_cm)) {
|
||||
ESP_RETURN_ON_FALSE(config->in.pic_w % 2 == 0 && config->in.block_w % 2 == 0 && config->in.block_offset_x % 2 == 0,
|
||||
ESP_ERR_INVALID_ARG, TAG, "YUV422 input does not support odd w/offset_x");
|
||||
}
|
||||
@@ -198,7 +195,7 @@ esp_err_t ppa_do_scale_rotate_mirror(ppa_client_handle_t ppa_client, const ppa_s
|
||||
ESP_RETURN_ON_FALSE(config->out.pic_h % 2 == 0 && config->out.pic_w % 2 == 0 &&
|
||||
config->out.block_offset_x % 2 == 0 && config->out.block_offset_y % 2 == 0,
|
||||
ESP_ERR_INVALID_ARG, TAG, "YUV420 output does not support odd h/w/offset_x/offset_y");
|
||||
} else if (config->out.srm_cm == PPA_SRM_COLOR_MODE_YUV422) {
|
||||
} else if (PPA_IS_CM_YUV422(config->out.srm_cm)) {
|
||||
ESP_RETURN_ON_FALSE(config->out.pic_w % 2 == 0 && config->out.block_offset_x % 2 == 0,
|
||||
ESP_ERR_INVALID_ARG, TAG, "YUV422 output does not support odd w/offset_x");
|
||||
}
|
||||
@@ -277,7 +274,7 @@ esp_err_t ppa_do_scale_rotate_mirror(ppa_client_handle_t ppa_client, const ppa_s
|
||||
if (config->out.srm_cm == PPA_SRM_COLOR_MODE_YUV420) {
|
||||
srm_trans_desc->scale_x_frag = srm_trans_desc->scale_x_frag & ~1;
|
||||
srm_trans_desc->scale_y_frag = srm_trans_desc->scale_y_frag & ~1;
|
||||
} else if (config->out.srm_cm == PPA_SRM_COLOR_MODE_YUV422) {
|
||||
} else if (PPA_IS_CM_YUV422(config->out.srm_cm)) {
|
||||
srm_trans_desc->scale_x_frag = srm_trans_desc->scale_x_frag & ~1;
|
||||
}
|
||||
srm_trans_desc->alpha_value = new_alpha_value;
|
||||
|
||||
Reference in New Issue
Block a user