1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * Support for Intel Camera Imaging ISP subsystem. 4 * Copyright (c) 2015, Intel Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms and conditions of the GNU General Public License, 8 * version 2, as published by the Free Software Foundation. 9 * 10 * This program is distributed in the hope it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 * more details. 14 */ 15 16 #include <assert_support.h> 17 #include <ia_css_frame_public.h> 18 #include <ia_css_frame.h> 19 #include <ia_css_binary.h> 20 #define IA_CSS_INCLUDE_CONFIGURATIONS 21 #include "ia_css_isp_configs.h" 22 #include "isp.h" 23 #include "ia_css_crop.host.h" 24 25 static const struct ia_css_crop_configuration default_config = { 26 .info = (struct ia_css_frame_info *)NULL, 27 }; 28 29 void 30 ia_css_crop_encode( 31 struct sh_css_isp_crop_isp_params *to, 32 const struct ia_css_crop_config *from, 33 unsigned int size) 34 { 35 (void)size; 36 to->crop_pos = from->crop_pos; 37 } 38 39 void 40 ia_css_crop_config( 41 struct sh_css_isp_crop_isp_config *to, 42 const struct ia_css_crop_configuration *from, 43 unsigned int size) 44 { 45 unsigned int elems_a = ISP_VEC_NELEMS; 46 47 (void)size; 48 ia_css_dma_configure_from_info(&to->port_b, from->info); 49 to->width_a_over_b = elems_a / to->port_b.elems; 50 51 /* Assume divisiblity here, may need to generalize to fixed point. */ 52 assert(elems_a % to->port_b.elems == 0); 53 } 54 55 void 56 ia_css_crop_configure( 57 const struct ia_css_binary *binary, 58 const struct ia_css_frame_info *info) 59 { 60 struct ia_css_crop_configuration config = default_config; 61 62 config.info = info; 63 64 ia_css_configure_crop(binary, &config); 65 } 66