mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
refactor(dma2d): move csc param table to dma2d_periph.c
This commit is contained in:
@@ -1,12 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hal/dma2d_periph.h"
|
#include "hal/dma2d_periph.h"
|
||||||
|
#include "hal/dma2d_types.h"
|
||||||
#include "soc/interrupts.h"
|
#include "soc/interrupts.h"
|
||||||
|
|
||||||
|
const int dma2d_csc_param_yuv2rgb_bt601_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_YUV2RGB_BT601;
|
||||||
|
const int dma2d_csc_param_yuv2rgb_bt709_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_YUV2RGB_BT709;
|
||||||
|
const int dma2d_csc_param_rgb2yuv_bt601_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_RGB2YUV_BT601;
|
||||||
|
const int dma2d_csc_param_rgb2yuv_bt709_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_RGB2YUV_BT709;
|
||||||
|
|
||||||
const dma2d_signal_conn_t dma2d_periph_signals = {
|
const dma2d_signal_conn_t dma2d_periph_signals = {
|
||||||
.groups = {
|
.groups = {
|
||||||
[0] = {
|
[0] = {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include <stddef.h> /* Required for NULL constant */
|
#include <stddef.h> /* Required for NULL constant */
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include "esp_attr.h"
|
||||||
#include "hal/dma2d_types.h"
|
#include "hal/dma2d_types.h"
|
||||||
#include "soc/dma2d_channel.h"
|
#include "soc/dma2d_channel.h"
|
||||||
#include "soc/dma2d_struct.h"
|
#include "soc/dma2d_struct.h"
|
||||||
@@ -96,6 +97,12 @@ typedef enum {
|
|||||||
DMA2D_LL_MEM_LP_MODE_SHUT_DOWN, // power down memory during low power stage
|
DMA2D_LL_MEM_LP_MODE_SHUT_DOWN, // power down memory during low power stage
|
||||||
} dma2d_ll_mem_lp_mode_t;
|
} dma2d_ll_mem_lp_mode_t;
|
||||||
|
|
||||||
|
// COLOR SPACE CONVERSION TABLES
|
||||||
|
extern const int dma2d_csc_param_yuv2rgb_bt601_table[3][4];
|
||||||
|
extern const int dma2d_csc_param_yuv2rgb_bt709_table[3][4];
|
||||||
|
extern const int dma2d_csc_param_rgb2yuv_bt601_table[3][4];
|
||||||
|
extern const int dma2d_csc_param_rgb2yuv_bt709_table[3][4];
|
||||||
|
|
||||||
///////////////////////////////////// Common /////////////////////////////////////////
|
///////////////////////////////////// Common /////////////////////////////////////////
|
||||||
/**
|
/**
|
||||||
* @brief Enable the bus clock for 2D-DMA module
|
* @brief Enable the bus clock for 2D-DMA module
|
||||||
@@ -534,13 +541,10 @@ static inline void dma2d_ll_rx_configure_color_space_conv(dma2d_dev_t *dev, uint
|
|||||||
uint32_t input_sel = 7; // Disable CSC
|
uint32_t input_sel = 7; // Disable CSC
|
||||||
// L2
|
// L2
|
||||||
bool proc_en = false; // Disable generic color convert module between color input & color output
|
bool proc_en = false; // Disable generic color convert module between color input & color output
|
||||||
int (*table)[4] = NULL;
|
const int (*table)[4] = NULL;
|
||||||
// L3
|
// L3
|
||||||
uint32_t output_sel = 1; // Output directly
|
uint32_t output_sel = 1; // Output directly
|
||||||
|
|
||||||
const int color_space_conv_param_yuv2rgb_bt601_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_YUV2RGB_BT601;
|
|
||||||
const int color_space_conv_param_yuv2rgb_bt709_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_YUV2RGB_BT709;
|
|
||||||
|
|
||||||
switch (csc_sel) {
|
switch (csc_sel) {
|
||||||
case DMA2D_CSC_RX_NONE:
|
case DMA2D_CSC_RX_NONE:
|
||||||
input_sel = 7;
|
input_sel = 7;
|
||||||
@@ -571,52 +575,52 @@ static inline void dma2d_ll_rx_configure_color_space_conv(dma2d_dev_t *dev, uint
|
|||||||
case DMA2D_CSC_RX_YUV422_TO_RGB888_601:
|
case DMA2D_CSC_RX_YUV422_TO_RGB888_601:
|
||||||
input_sel = 0;
|
input_sel = 0;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt601_table;
|
table = dma2d_csc_param_yuv2rgb_bt601_table;
|
||||||
output_sel = 1;
|
output_sel = 1;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_RX_YUV420_TO_RGB565_601:
|
case DMA2D_CSC_RX_YUV420_TO_RGB565_601:
|
||||||
case DMA2D_CSC_RX_YUV422_TO_RGB565_601:
|
case DMA2D_CSC_RX_YUV422_TO_RGB565_601:
|
||||||
input_sel = 0;
|
input_sel = 0;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt601_table;
|
table = dma2d_csc_param_yuv2rgb_bt601_table;
|
||||||
output_sel = 0;
|
output_sel = 0;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_RX_YUV420_TO_RGB888_709:
|
case DMA2D_CSC_RX_YUV420_TO_RGB888_709:
|
||||||
case DMA2D_CSC_RX_YUV422_TO_RGB888_709:
|
case DMA2D_CSC_RX_YUV422_TO_RGB888_709:
|
||||||
input_sel = 0;
|
input_sel = 0;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt709_table;
|
table = dma2d_csc_param_yuv2rgb_bt709_table;
|
||||||
output_sel = 1;
|
output_sel = 1;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_RX_YUV420_TO_RGB565_709:
|
case DMA2D_CSC_RX_YUV420_TO_RGB565_709:
|
||||||
case DMA2D_CSC_RX_YUV422_TO_RGB565_709:
|
case DMA2D_CSC_RX_YUV422_TO_RGB565_709:
|
||||||
input_sel = 0;
|
input_sel = 0;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt709_table;
|
table = dma2d_csc_param_yuv2rgb_bt709_table;
|
||||||
output_sel = 0;
|
output_sel = 0;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_RX_YUV444_TO_RGB888_601:
|
case DMA2D_CSC_RX_YUV444_TO_RGB888_601:
|
||||||
input_sel = 2;
|
input_sel = 2;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt601_table;
|
table = dma2d_csc_param_yuv2rgb_bt601_table;
|
||||||
output_sel = 1;
|
output_sel = 1;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_RX_YUV444_TO_RGB565_601:
|
case DMA2D_CSC_RX_YUV444_TO_RGB565_601:
|
||||||
input_sel = 2;
|
input_sel = 2;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt601_table;
|
table = dma2d_csc_param_yuv2rgb_bt601_table;
|
||||||
output_sel = 0;
|
output_sel = 0;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_RX_YUV444_TO_RGB888_709:
|
case DMA2D_CSC_RX_YUV444_TO_RGB888_709:
|
||||||
input_sel = 2;
|
input_sel = 2;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt709_table;
|
table = dma2d_csc_param_yuv2rgb_bt709_table;
|
||||||
output_sel = 1;
|
output_sel = 1;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_RX_YUV444_TO_RGB565_709:
|
case DMA2D_CSC_RX_YUV444_TO_RGB565_709:
|
||||||
input_sel = 2;
|
input_sel = 2;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt709_table;
|
table = dma2d_csc_param_yuv2rgb_bt709_table;
|
||||||
output_sel = 0;
|
output_sel = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -1040,15 +1044,10 @@ static inline void dma2d_ll_tx_configure_color_space_conv(dma2d_dev_t *dev, uint
|
|||||||
uint32_t input_sel = 7; // Disable CSC
|
uint32_t input_sel = 7; // Disable CSC
|
||||||
// L2
|
// L2
|
||||||
bool proc_en = false; // Disable generic color convert module between color input & color output
|
bool proc_en = false; // Disable generic color convert module between color input & color output
|
||||||
int (*table)[4] = NULL;
|
const int (*table)[4] = NULL;
|
||||||
// L3
|
// L3
|
||||||
uint32_t output_sel = 2; // Output directly
|
uint32_t output_sel = 2; // Output directly
|
||||||
|
|
||||||
const int color_space_conv_param_rgb2yuv_bt601_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_RGB2YUV_BT601;
|
|
||||||
const int color_space_conv_param_rgb2yuv_bt709_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_RGB2YUV_BT709;
|
|
||||||
const int color_space_conv_param_yuv2rgb_bt601_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_YUV2RGB_BT601;
|
|
||||||
const int color_space_conv_param_yuv2rgb_bt709_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_YUV2RGB_BT709;
|
|
||||||
|
|
||||||
switch (csc_sel) {
|
switch (csc_sel) {
|
||||||
case DMA2D_CSC_TX_NONE:
|
case DMA2D_CSC_TX_NONE:
|
||||||
input_sel = 7;
|
input_sel = 7;
|
||||||
@@ -1071,49 +1070,49 @@ static inline void dma2d_ll_tx_configure_color_space_conv(dma2d_dev_t *dev, uint
|
|||||||
case DMA2D_CSC_TX_RGB888_TO_YUV444_601:
|
case DMA2D_CSC_TX_RGB888_TO_YUV444_601:
|
||||||
input_sel = 3;
|
input_sel = 3;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_rgb2yuv_bt601_table;
|
table = dma2d_csc_param_rgb2yuv_bt601_table;
|
||||||
output_sel = 2;
|
output_sel = 2;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_TX_RGB888_TO_YUV444_709:
|
case DMA2D_CSC_TX_RGB888_TO_YUV444_709:
|
||||||
input_sel = 3;
|
input_sel = 3;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_rgb2yuv_bt709_table;
|
table = dma2d_csc_param_rgb2yuv_bt709_table;
|
||||||
output_sel = 2;
|
output_sel = 2;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_TX_RGB888_TO_YUV422_601:
|
case DMA2D_CSC_TX_RGB888_TO_YUV422_601:
|
||||||
input_sel = 3;
|
input_sel = 3;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_rgb2yuv_bt601_table;
|
table = dma2d_csc_param_rgb2yuv_bt601_table;
|
||||||
output_sel = 1;
|
output_sel = 1;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_TX_RGB888_TO_YUV422_709:
|
case DMA2D_CSC_TX_RGB888_TO_YUV422_709:
|
||||||
input_sel = 3;
|
input_sel = 3;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_rgb2yuv_bt709_table;
|
table = dma2d_csc_param_rgb2yuv_bt709_table;
|
||||||
output_sel = 1;
|
output_sel = 1;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_TX_YUV444_TO_RGB888_601:
|
case DMA2D_CSC_TX_YUV444_TO_RGB888_601:
|
||||||
input_sel = 3;
|
input_sel = 3;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt601_table;
|
table = dma2d_csc_param_yuv2rgb_bt601_table;
|
||||||
output_sel = 2;
|
output_sel = 2;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_TX_YUV444_TO_RGB888_709:
|
case DMA2D_CSC_TX_YUV444_TO_RGB888_709:
|
||||||
input_sel = 3;
|
input_sel = 3;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt709_table;
|
table = dma2d_csc_param_yuv2rgb_bt709_table;
|
||||||
output_sel = 2;
|
output_sel = 2;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_TX_YUV422_TO_RGB888_601:
|
case DMA2D_CSC_TX_YUV422_TO_RGB888_601:
|
||||||
input_sel = 1;
|
input_sel = 1;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt601_table;
|
table = dma2d_csc_param_yuv2rgb_bt601_table;
|
||||||
output_sel = 2;
|
output_sel = 2;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_TX_YUV422_TO_RGB888_709:
|
case DMA2D_CSC_TX_YUV422_TO_RGB888_709:
|
||||||
input_sel = 1;
|
input_sel = 1;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt709_table;
|
table = dma2d_csc_param_yuv2rgb_bt709_table;
|
||||||
output_sel = 2;
|
output_sel = 2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -5,8 +5,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hal/dma2d_periph.h"
|
#include "hal/dma2d_periph.h"
|
||||||
|
#include "hal/dma2d_types.h"
|
||||||
#include "soc/interrupts.h"
|
#include "soc/interrupts.h"
|
||||||
|
|
||||||
|
const int dma2d_csc_param_rgb2yuv_bt601_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_RGB2YUV_BT601;
|
||||||
|
const int dma2d_csc_param_rgb2yuv_bt709_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_RGB2YUV_BT709;
|
||||||
|
const int dma2d_csc_param_yuv2rgb_bt601_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_YUV2RGB_BT601;
|
||||||
|
const int dma2d_csc_param_yuv2rgb_bt709_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_YUV2RGB_BT709;
|
||||||
|
|
||||||
const dma2d_signal_conn_t dma2d_periph_signals = {
|
const dma2d_signal_conn_t dma2d_periph_signals = {
|
||||||
.groups = {
|
.groups = {
|
||||||
[0] = {
|
[0] = {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include <stddef.h> /* Required for NULL constant */
|
#include <stddef.h> /* Required for NULL constant */
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include "esp_attr.h"
|
||||||
#include "hal/dma2d_types.h"
|
#include "hal/dma2d_types.h"
|
||||||
#include "soc/dma2d_channel.h"
|
#include "soc/dma2d_channel.h"
|
||||||
#include "soc/dma2d_struct.h"
|
#include "soc/dma2d_struct.h"
|
||||||
@@ -89,6 +90,12 @@ typedef enum {
|
|||||||
DMA2D_LL_MEM_LP_MODE_DISABLE, // disable the low power stage
|
DMA2D_LL_MEM_LP_MODE_DISABLE, // disable the low power stage
|
||||||
} dma2d_ll_mem_lp_mode_t;
|
} dma2d_ll_mem_lp_mode_t;
|
||||||
|
|
||||||
|
// COLOR SPACE CONVERSION TABLES
|
||||||
|
extern const int dma2d_csc_param_rgb2yuv_bt601_table[3][4];
|
||||||
|
extern const int dma2d_csc_param_rgb2yuv_bt709_table[3][4];
|
||||||
|
extern const int dma2d_csc_param_yuv2rgb_bt601_table[3][4];
|
||||||
|
extern const int dma2d_csc_param_yuv2rgb_bt709_table[3][4];
|
||||||
|
|
||||||
///////////////////////////////////// Common /////////////////////////////////////////
|
///////////////////////////////////// Common /////////////////////////////////////////
|
||||||
/**
|
/**
|
||||||
* @brief Enable the bus clock for 2D-DMA module
|
* @brief Enable the bus clock for 2D-DMA module
|
||||||
@@ -515,13 +522,10 @@ static inline void dma2d_ll_rx_configure_color_space_conv(dma2d_dev_t *dev, uint
|
|||||||
uint32_t input_sel = 7; // Disable CSC
|
uint32_t input_sel = 7; // Disable CSC
|
||||||
// L2
|
// L2
|
||||||
bool proc_en = false; // Disable generic color convert module between color input & color output
|
bool proc_en = false; // Disable generic color convert module between color input & color output
|
||||||
int (*table)[4] = NULL;
|
const int (*table)[4] = NULL;
|
||||||
// L3
|
// L3
|
||||||
uint32_t output_sel = 1; // Output directly
|
uint32_t output_sel = 1; // Output directly
|
||||||
|
|
||||||
const int color_space_conv_param_yuv2rgb_bt601_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_YUV2RGB_BT601;
|
|
||||||
const int color_space_conv_param_yuv2rgb_bt709_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_YUV2RGB_BT709;
|
|
||||||
|
|
||||||
switch (csc_sel) {
|
switch (csc_sel) {
|
||||||
case DMA2D_CSC_RX_NONE:
|
case DMA2D_CSC_RX_NONE:
|
||||||
input_sel = 7;
|
input_sel = 7;
|
||||||
@@ -552,52 +556,52 @@ static inline void dma2d_ll_rx_configure_color_space_conv(dma2d_dev_t *dev, uint
|
|||||||
case DMA2D_CSC_RX_YUV422_TO_RGB888_601:
|
case DMA2D_CSC_RX_YUV422_TO_RGB888_601:
|
||||||
input_sel = 0;
|
input_sel = 0;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt601_table;
|
table = dma2d_csc_param_yuv2rgb_bt601_table;
|
||||||
output_sel = 1;
|
output_sel = 1;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_RX_YUV420_TO_RGB565_601:
|
case DMA2D_CSC_RX_YUV420_TO_RGB565_601:
|
||||||
case DMA2D_CSC_RX_YUV422_TO_RGB565_601:
|
case DMA2D_CSC_RX_YUV422_TO_RGB565_601:
|
||||||
input_sel = 0;
|
input_sel = 0;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt601_table;
|
table = dma2d_csc_param_yuv2rgb_bt601_table;
|
||||||
output_sel = 0;
|
output_sel = 0;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_RX_YUV420_TO_RGB888_709:
|
case DMA2D_CSC_RX_YUV420_TO_RGB888_709:
|
||||||
case DMA2D_CSC_RX_YUV422_TO_RGB888_709:
|
case DMA2D_CSC_RX_YUV422_TO_RGB888_709:
|
||||||
input_sel = 0;
|
input_sel = 0;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt709_table;
|
table = dma2d_csc_param_yuv2rgb_bt709_table;
|
||||||
output_sel = 1;
|
output_sel = 1;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_RX_YUV420_TO_RGB565_709:
|
case DMA2D_CSC_RX_YUV420_TO_RGB565_709:
|
||||||
case DMA2D_CSC_RX_YUV422_TO_RGB565_709:
|
case DMA2D_CSC_RX_YUV422_TO_RGB565_709:
|
||||||
input_sel = 0;
|
input_sel = 0;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt709_table;
|
table = dma2d_csc_param_yuv2rgb_bt709_table;
|
||||||
output_sel = 0;
|
output_sel = 0;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_RX_YUV444_TO_RGB888_601:
|
case DMA2D_CSC_RX_YUV444_TO_RGB888_601:
|
||||||
input_sel = 2;
|
input_sel = 2;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt601_table;
|
table = dma2d_csc_param_yuv2rgb_bt601_table;
|
||||||
output_sel = 1;
|
output_sel = 1;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_RX_YUV444_TO_RGB565_601:
|
case DMA2D_CSC_RX_YUV444_TO_RGB565_601:
|
||||||
input_sel = 2;
|
input_sel = 2;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt601_table;
|
table = dma2d_csc_param_yuv2rgb_bt601_table;
|
||||||
output_sel = 0;
|
output_sel = 0;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_RX_YUV444_TO_RGB888_709:
|
case DMA2D_CSC_RX_YUV444_TO_RGB888_709:
|
||||||
input_sel = 2;
|
input_sel = 2;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt709_table;
|
table = dma2d_csc_param_yuv2rgb_bt709_table;
|
||||||
output_sel = 1;
|
output_sel = 1;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_RX_YUV444_TO_RGB565_709:
|
case DMA2D_CSC_RX_YUV444_TO_RGB565_709:
|
||||||
input_sel = 2;
|
input_sel = 2;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt709_table;
|
table = dma2d_csc_param_yuv2rgb_bt709_table;
|
||||||
output_sel = 0;
|
output_sel = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -1017,15 +1021,10 @@ static inline void dma2d_ll_tx_configure_color_space_conv(dma2d_dev_t *dev, uint
|
|||||||
uint32_t input_sel = 7; // Disable CSC
|
uint32_t input_sel = 7; // Disable CSC
|
||||||
// L2
|
// L2
|
||||||
bool proc_en = false; // Disable generic color convert module between color input & color output
|
bool proc_en = false; // Disable generic color convert module between color input & color output
|
||||||
int (*table)[4] = NULL;
|
const int (*table)[4] = NULL;
|
||||||
// L3
|
// L3
|
||||||
uint32_t output_sel = 2; // Output directly
|
uint32_t output_sel = 2; // Output directly
|
||||||
|
|
||||||
const int color_space_conv_param_rgb2yuv_bt601_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_RGB2YUV_BT601;
|
|
||||||
const int color_space_conv_param_rgb2yuv_bt709_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_RGB2YUV_BT709;
|
|
||||||
const int color_space_conv_param_yuv2rgb_bt601_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_YUV2RGB_BT601;
|
|
||||||
const int color_space_conv_param_yuv2rgb_bt709_table[3][4] = DMA2D_COLOR_SPACE_CONV_PARAM_YUV2RGB_BT709;
|
|
||||||
|
|
||||||
switch (csc_sel) {
|
switch (csc_sel) {
|
||||||
case DMA2D_CSC_TX_NONE:
|
case DMA2D_CSC_TX_NONE:
|
||||||
input_sel = 7;
|
input_sel = 7;
|
||||||
@@ -1048,49 +1047,49 @@ static inline void dma2d_ll_tx_configure_color_space_conv(dma2d_dev_t *dev, uint
|
|||||||
case DMA2D_CSC_TX_RGB888_TO_YUV444_601:
|
case DMA2D_CSC_TX_RGB888_TO_YUV444_601:
|
||||||
input_sel = 3;
|
input_sel = 3;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_rgb2yuv_bt601_table;
|
table = dma2d_csc_param_rgb2yuv_bt601_table;
|
||||||
output_sel = 2;
|
output_sel = 2;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_TX_RGB888_TO_YUV444_709:
|
case DMA2D_CSC_TX_RGB888_TO_YUV444_709:
|
||||||
input_sel = 3;
|
input_sel = 3;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_rgb2yuv_bt709_table;
|
table = dma2d_csc_param_rgb2yuv_bt709_table;
|
||||||
output_sel = 2;
|
output_sel = 2;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_TX_RGB888_TO_YUV422_601:
|
case DMA2D_CSC_TX_RGB888_TO_YUV422_601:
|
||||||
input_sel = 3;
|
input_sel = 3;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_rgb2yuv_bt601_table;
|
table = dma2d_csc_param_rgb2yuv_bt601_table;
|
||||||
output_sel = 1;
|
output_sel = 1;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_TX_RGB888_TO_YUV422_709:
|
case DMA2D_CSC_TX_RGB888_TO_YUV422_709:
|
||||||
input_sel = 3;
|
input_sel = 3;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_rgb2yuv_bt709_table;
|
table = dma2d_csc_param_rgb2yuv_bt709_table;
|
||||||
output_sel = 1;
|
output_sel = 1;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_TX_YUV444_TO_RGB888_601:
|
case DMA2D_CSC_TX_YUV444_TO_RGB888_601:
|
||||||
input_sel = 3;
|
input_sel = 3;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt601_table;
|
table = dma2d_csc_param_yuv2rgb_bt601_table;
|
||||||
output_sel = 2;
|
output_sel = 2;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_TX_YUV444_TO_RGB888_709:
|
case DMA2D_CSC_TX_YUV444_TO_RGB888_709:
|
||||||
input_sel = 3;
|
input_sel = 3;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt709_table;
|
table = dma2d_csc_param_yuv2rgb_bt709_table;
|
||||||
output_sel = 2;
|
output_sel = 2;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_TX_YUV422_TO_RGB888_601:
|
case DMA2D_CSC_TX_YUV422_TO_RGB888_601:
|
||||||
input_sel = 1;
|
input_sel = 1;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt601_table;
|
table = dma2d_csc_param_yuv2rgb_bt601_table;
|
||||||
output_sel = 2;
|
output_sel = 2;
|
||||||
break;
|
break;
|
||||||
case DMA2D_CSC_TX_YUV422_TO_RGB888_709:
|
case DMA2D_CSC_TX_YUV422_TO_RGB888_709:
|
||||||
input_sel = 1;
|
input_sel = 1;
|
||||||
proc_en = true;
|
proc_en = true;
|
||||||
table = (int (*)[4])color_space_conv_param_yuv2rgb_bt709_table;
|
table = dma2d_csc_param_yuv2rgb_bt709_table;
|
||||||
output_sel = 2;
|
output_sel = 2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user