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_table.h" 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 struct calculate_buffer { 35 int buffer_index; 36 struct fixed31_32 buffer[NUM_PTS_IN_REGION]; 37 struct fixed31_32 gamma_of_2; 38 }; 39 40 struct translate_from_linear_space_args { 41 struct fixed31_32 arg; 42 struct fixed31_32 a0; 43 struct fixed31_32 a1; 44 struct fixed31_32 a2; 45 struct fixed31_32 a3; 46 struct fixed31_32 gamma; 47 struct calculate_buffer *cal_buffer; 48 }; 49 50 void vpe_color_setup_x_points_distribution(void); 51 52 void vpe_color_setup_x_points_distribution_degamma(void); 53 54 bool vpe_color_calculate_regamma_params(struct vpe_priv *vpe_priv, struct fixed31_32 x_scale, 55 struct fixed31_32 y_scale, struct calculate_buffer *cal_buffer, 56 struct transfer_func *output_tf); 57 58 bool vpe_color_calculate_degamma_params(struct vpe_priv *vpe_priv, struct fixed31_32 x_scale, 59 struct fixed31_32 y_scale, struct transfer_func *input_tf); 60 61 void vpe_compute_pq(struct fixed31_32 in_x, struct fixed31_32 *out_y); 62 63 #ifdef __cplusplus 64 } 65 #endif 66