Commit 7cca7c80 authored by Krzysztof Hałasa's avatar Krzysztof Hałasa Committed by Philipp Zabel

gpu: ipu-v3: Fix i.MX IPU-v3 offset calculations for (semi)planar U/V formats

Video captured in 1400x1050 resolution (bytesperline aka stride = 1408
bytes) is invalid. Fix it.
Signed-off-by: default avatarKrzysztof Halasa <khalasa@piap.pl>
Link: https://lore.kernel.org/r/m3y2bmq7a4.fsf@t19.piap.pl
[p.zabel@pengutronix.de: added "gpu: ipu-v3:" prefix to commit description]
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
parent e73f0f0e
...@@ -585,21 +585,21 @@ static const struct ipu_rgb def_bgra_16 = { ...@@ -585,21 +585,21 @@ static const struct ipu_rgb def_bgra_16 = {
.bits_per_pixel = 16, .bits_per_pixel = 16,
}; };
#define Y_OFFSET(pix, x, y) ((x) + pix->width * (y)) #define Y_OFFSET(pix, x, y) ((x) + pix->bytesperline * (y))
#define U_OFFSET(pix, x, y) ((pix->width * pix->height) + \ #define U_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \
(pix->width * ((y) / 2) / 2) + (x) / 2) (pix->bytesperline * ((y) / 2) / 2) + (x) / 2)
#define V_OFFSET(pix, x, y) ((pix->width * pix->height) + \ #define V_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \
(pix->width * pix->height / 4) + \ (pix->bytesperline * pix->height / 4) + \
(pix->width * ((y) / 2) / 2) + (x) / 2) (pix->bytesperline * ((y) / 2) / 2) + (x) / 2)
#define U2_OFFSET(pix, x, y) ((pix->width * pix->height) + \ #define U2_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \
(pix->width * (y) / 2) + (x) / 2) (pix->bytesperline * (y) / 2) + (x) / 2)
#define V2_OFFSET(pix, x, y) ((pix->width * pix->height) + \ #define V2_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \
(pix->width * pix->height / 2) + \ (pix->bytesperline * pix->height / 2) + \
(pix->width * (y) / 2) + (x) / 2) (pix->bytesperline * (y) / 2) + (x) / 2)
#define UV_OFFSET(pix, x, y) ((pix->width * pix->height) + \ #define UV_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \
(pix->width * ((y) / 2)) + (x)) (pix->bytesperline * ((y) / 2)) + (x))
#define UV2_OFFSET(pix, x, y) ((pix->width * pix->height) + \ #define UV2_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \
(pix->width * y) + (x)) (pix->bytesperline * y) + (x))
#define NUM_ALPHA_CHANNELS 7 #define NUM_ALPHA_CHANNELS 7
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment