1 /* 2 * Copyright 2022 Rockchip Electronics Co. LTD 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef __VEPU5XX_COMMON_H__ 18 #define __VEPU5XX_COMMON_H__ 19 20 #include "rk_type.h" 21 #include "mpp_frame.h" 22 23 typedef struct VepuRgb2YuvCoeffs_t { 24 RK_S16 r_coeff; 25 RK_S16 g_coeff; 26 RK_S16 b_coeff; 27 RK_S16 offset; 28 } VepuRgb2YuvCoeffs; 29 30 /* formula: y(r, g, b) = (r_coeff x r + g_coeff x g + b_coeff x b + 128) >> 8 + offset */ 31 typedef struct VepuRgb2YuvCfg_t { 32 /* YUV colorspace type */ 33 MppFrameColorSpace color; 34 /* MPEG vs JPEG YUV range */ 35 MppFrameColorRange dst_range; 36 /* coeffs of rgb 2 yuv */ 37 VepuRgb2YuvCoeffs _2y; 38 VepuRgb2YuvCoeffs _2u; 39 VepuRgb2YuvCoeffs _2v; 40 } VepuRgb2YuvCfg; 41 42 /** 43 * @brief Get rgb2yuv cfg by color range and color space. If not found, return default cfg. 44 * default cfg's yuv range - limit. 45 * default cfg's color space - BT.601. 46 */ 47 const VepuRgb2YuvCfg* get_rgb2yuv_cfg(MppFrameColorRange range, MppFrameColorSpace color); 48 49 #endif /* __VEPU5XX_COMMON_H__ */