mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-22 13:54:57 +08:00
media: atomisp: frame.c: drop a now-unused function
ia_css_frame_find_crop_resolution() is not used anymore. So, remove it. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
c37ed67335
commit
72fb16a130
@ -141,23 +141,4 @@ bool ia_css_frame_is_same_type(
|
||||
int ia_css_dma_configure_from_info(struct dma_port_config *config,
|
||||
const struct ia_css_frame_info *info);
|
||||
|
||||
/* ISP2401 */
|
||||
/* @brief Finds the cropping resolution
|
||||
* This function finds the maximum cropping resolution in an input image keeping
|
||||
* the aspect ratio for the given output resolution.Calculates the coordinates
|
||||
* for cropping from the center and returns the starting pixel location of the
|
||||
* region in the input image. Also returns the dimension of the cropping
|
||||
* resolution.
|
||||
*
|
||||
* @param
|
||||
* @param[in] in_res Resolution of input image
|
||||
* @param[in] out_res Resolution of output image
|
||||
* @param[out] crop_res Crop resolution of input image
|
||||
* @return Returns 0 or -EINVAL on error
|
||||
*/
|
||||
int
|
||||
ia_css_frame_find_crop_resolution(const struct ia_css_resolution *in_res,
|
||||
const struct ia_css_resolution *out_res,
|
||||
struct ia_css_resolution *crop_res);
|
||||
|
||||
#endif /* __IA_CSS_FRAME_H__ */
|
||||
|
@ -933,73 +933,3 @@ void ia_css_resolution_to_sp_resolution(
|
||||
to->width = (uint16_t)from->width;
|
||||
to->height = (uint16_t)from->height;
|
||||
}
|
||||
|
||||
/* ISP2401 */
|
||||
int
|
||||
ia_css_frame_find_crop_resolution(const struct ia_css_resolution *in_res,
|
||||
const struct ia_css_resolution *out_res,
|
||||
struct ia_css_resolution *crop_res) {
|
||||
u32 wd_even_ceil, ht_even_ceil;
|
||||
u32 in_ratio, out_ratio;
|
||||
|
||||
if ((!in_res) || (!out_res) || (!crop_res))
|
||||
return -EINVAL;
|
||||
|
||||
IA_CSS_ENTER_PRIVATE("in(%ux%u) -> out(%ux%u)", in_res->width,
|
||||
in_res->height, out_res->width, out_res->height);
|
||||
|
||||
if ((in_res->width == 0)
|
||||
|| (in_res->height == 0)
|
||||
|| (out_res->width == 0)
|
||||
|| (out_res->height == 0))
|
||||
return -EINVAL;
|
||||
|
||||
if ((out_res->width > in_res->width) ||
|
||||
(out_res->height > in_res->height))
|
||||
return -EINVAL;
|
||||
|
||||
/* If aspect ratio (width/height) of out_res is higher than the aspect
|
||||
* ratio of the in_res, then we crop vertically, otherwise we crop
|
||||
* horizontally.
|
||||
*/
|
||||
in_ratio = in_res->width * out_res->height;
|
||||
out_ratio = out_res->width * in_res->height;
|
||||
|
||||
if (in_ratio == out_ratio)
|
||||
{
|
||||
crop_res->width = in_res->width;
|
||||
crop_res->height = in_res->height;
|
||||
} else if (out_ratio > in_ratio)
|
||||
{
|
||||
crop_res->width = in_res->width;
|
||||
crop_res->height = ROUND_DIV(out_res->height * crop_res->width,
|
||||
out_res->width);
|
||||
} else
|
||||
{
|
||||
crop_res->height = in_res->height;
|
||||
crop_res->width = ROUND_DIV(out_res->width * crop_res->height,
|
||||
out_res->height);
|
||||
}
|
||||
|
||||
/* Round new (cropped) width and height to an even number.
|
||||
* binarydesc_calculate_bds_factor is such that we should consider as
|
||||
* much of the input as possible. This is different only when we end up
|
||||
* with an odd number in the last step. So, we take the next even number
|
||||
* if it falls within the input, otherwise take the previous even no.
|
||||
*/
|
||||
wd_even_ceil = EVEN_CEIL(crop_res->width);
|
||||
ht_even_ceil = EVEN_CEIL(crop_res->height);
|
||||
if ((wd_even_ceil > in_res->width) || (ht_even_ceil > in_res->height))
|
||||
{
|
||||
crop_res->width = EVEN_FLOOR(crop_res->width);
|
||||
crop_res->height = EVEN_FLOOR(crop_res->height);
|
||||
} else
|
||||
{
|
||||
crop_res->width = wd_even_ceil;
|
||||
crop_res->height = ht_even_ceil;
|
||||
}
|
||||
|
||||
IA_CSS_LEAVE_PRIVATE("in(%ux%u) -> out(%ux%u)", crop_res->width,
|
||||
crop_res->height, out_res->width, out_res->height);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user