2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2015, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 #include <assert_support.h>
16 #include <ia_css_frame_public.h>
17 #include <ia_css_frame.h>
18 #include <ia_css_binary.h>
19 #define IA_CSS_INCLUDE_CONFIGURATIONS
20 #include "ia_css_isp_configs.h"
22 #include "ia_css_crop.host.h"
24 static const struct ia_css_crop_configuration default_config = {
25 .info = (struct ia_css_frame_info *)NULL,
30 struct sh_css_isp_crop_isp_params *to,
31 const struct ia_css_crop_config *from,
35 to->crop_pos = from->crop_pos;
40 struct sh_css_isp_crop_isp_config *to,
41 const struct ia_css_crop_configuration *from,
44 unsigned elems_a = ISP_VEC_NELEMS;
47 ia_css_dma_configure_from_info(&to->port_b, from->info);
48 to->width_a_over_b = elems_a / to->port_b.elems;
50 /* Assume divisiblity here, may need to generalize to fixed point. */
51 assert (elems_a % to->port_b.elems == 0);
55 ia_css_crop_configure(
56 const struct ia_css_binary *binary,
57 const struct ia_css_frame_info *info)
59 struct ia_css_crop_configuration config = default_config;
63 ia_css_configure_crop(binary, &config);