1 /* Copyright 2022 Advanced Micro Devices, Inc. 2 * 3 * Permission is hereby granted, free of charge, to any person obtaining a 4 * copy of this software and associated documentation files (the "Software"), 5 * to deal in the Software without restriction, including without limitation 6 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 * and/or sell copies of the Software, and to permit persons to whom the 8 * Software is furnished to do so, subject to the following conditions: 9 * 10 * The above copyright notice and this permission notice shall be included in 11 * all copies or substantial portions of the Software. 12 * 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 17 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 18 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 19 * OTHER DEALINGS IN THE SOFTWARE. 20 * 21 * Authors: AMD 22 * 23 */ 24 25 #pragma once 26 27 #include "fixed31_32.h" 28 #include "color.h" 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 #define NUM_PTS_IN_REGION 16 35 #define NUM_REGIONS 32 36 #define MAX_HW_POINTS (NUM_PTS_IN_REGION * NUM_REGIONS) 37 #define MAX_HW_POINTS_DEGAMMA 257 38 39 enum table_type { 40 type_pq_table, 41 type_de_pq_table 42 }; 43 44 bool vpe_color_is_table_init(enum table_type type); 45 46 struct fixed31_32 *vpe_color_get_table(enum table_type type); 47 48 void vpe_color_set_table_init_state(enum table_type type, bool state); 49 50 struct vpe_csc_matrix { 51 enum color_space cs; 52 uint16_t regval[12]; 53 }; 54 55 static const struct vpe_csc_matrix vpe_input_csc_matrix_fixed[] = { 56 {COLOR_SPACE_SRGB, {0x2000, 0, 0, 0, 0, 0x2000, 0, 0, 0, 0, 0x2000, 0}}, 57 {COLOR_SPACE_YCBCR601, 58 {0x2cdd, 0x2000, 0, 0xe991, 0xe926, 0x2000, 0xf4fd, 0x10ef, 0, 0x2000, 0x38b4, 0xe3a6}}, 59 {COLOR_SPACE_YCBCR709, 60 {0x3265, 0x2000, 0, 0xe6ce, 0xf105, 0x2000, 0xfa01, 0xa7d, 0, 0x2000, 0x3b61, 0xe24f}}, 61 {COLOR_SPACE_2020_YCBCR, 62 {0x2f2f, 0x2000, 0, 0xe869, 0xedb8, 0x2000, 0xfabc, 0xbc6, 0x0, 0x2000, 0x3c34, 0xe1e6}}}; 63 64 #ifdef __cplusplus 65 } 66 #endif 67