1
2
3
4
5
6
7
8
9
10
11
12#ifndef SOC_SCALE_CROP_H
13#define SOC_SCALE_CROP_H
14
15#include <linux/kernel.h>
16
17struct soc_camera_device;
18
19struct v4l2_selection;
20struct v4l2_mbus_framefmt;
21struct v4l2_pix_format;
22struct v4l2_rect;
23struct v4l2_subdev;
24
25static inline unsigned int soc_camera_shift_scale(unsigned int size,
26 unsigned int shift, unsigned int scale)
27{
28 return DIV_ROUND_CLOSEST(size << shift, scale);
29}
30
31#define soc_camera_calc_scale(in, shift, out) soc_camera_shift_scale(in, shift, out)
32
33int soc_camera_client_g_rect(struct v4l2_subdev *sd, struct v4l2_rect *rect);
34int soc_camera_client_s_selection(struct v4l2_subdev *sd,
35 struct v4l2_selection *sel, struct v4l2_selection *cam_sel,
36 struct v4l2_rect *target_rect, struct v4l2_rect *subrect);
37int soc_camera_client_scale(struct soc_camera_device *icd,
38 struct v4l2_rect *rect, struct v4l2_rect *subrect,
39 struct v4l2_mbus_framefmt *mf,
40 unsigned int *width, unsigned int *height,
41 bool host_can_scale, unsigned int shift);
42void soc_camera_calc_client_output(struct soc_camera_device *icd,
43 struct v4l2_rect *rect, struct v4l2_rect *subrect,
44 const struct v4l2_pix_format *pix, struct v4l2_mbus_framefmt *mf,
45 unsigned int shift);
46
47#endif
48