Skip to content

Commit

Permalink
gpu: ipu-v3: image-convert: Fix image downsize coefficients
Browse files Browse the repository at this point in the history
The output of the IC downsizer unit in both dimensions must be <= 1024
before being passed to the IC resizer unit. This was causing corrupted
images when:

input_dim > 1024, and
input_dim / 2 < output_dim < input_dim

Some broken examples were 1920x1080 -> 1024x768 and 1920x1080 ->
1280x1080.

Fixes: 70b9b6b ("gpu: ipu-v3: image-convert: calculate per-tile
resize coefficients")

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
  • Loading branch information
Steve Longerbeam authored and Philipp Zabel committed Jun 14, 2019
1 parent bca4d70 commit 912bbf7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/gpu/ipu-v3/ipu-image-convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,14 @@ static int calc_image_resize_coefficients(struct ipu_image_convert_ctx *ctx,
if (WARN_ON(resized_width == 0 || resized_height == 0))
return -EINVAL;

while (downsized_width >= resized_width * 2) {
while (downsized_width > 1024 ||
downsized_width >= resized_width * 2) {
downsized_width >>= 1;
downsize_coeff_h++;
}

while (downsized_height >= resized_height * 2) {
while (downsized_height > 1024 ||
downsized_height >= resized_height * 2) {
downsized_height >>= 1;
downsize_coeff_v++;
}
Expand Down

0 comments on commit 912bbf7

Please sign in to comment.