summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2022-02-09 20:35:17 -0800
committerVito Caputo <vcaputo@pengaru.com>2022-02-09 20:35:17 -0800
commit460b6f480ca10a74d357a16e10ea8e462198a00b (patch)
treeab1dcd094faf950808ff397897f5e823fe70cb27
parent1004781e00cf4e231e59d8ef6342de044bf0b5ce (diff)
yuv_utils: fixup odd width handling for UV planes
Some mistakes here noticed as slight colorshift corruption for odd-width recorded windows.
-rw-r--r--src/rmd_yuv_utils.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/rmd_yuv_utils.c b/src/rmd_yuv_utils.c
index 6570945..1a449f6 100644
--- a/src/rmd_yuv_utils.c
+++ b/src/rmd_yuv_utils.c
@@ -226,8 +226,8 @@ static inline int blocknum(int xv, int yv, int widthv, int blocksize)
yuv_V++; \
} \
\
- yuv_U += ((yuv)->uv_stride - ((width_tm - w_odd * 2) >> 1)); \
- yuv_V += ((yuv)->uv_stride - ((width_tm - w_odd * 2) >> 1)); \
+ yuv_U += ((yuv)->uv_stride - ((width_tm - w_odd) >> 1)); \
+ yuv_V += ((yuv)->uv_stride - ((width_tm - w_odd) >> 1)); \
\
datapi += width_tm + w_odd; \
if (sampling == __PXL_AVERAGE) \
@@ -324,8 +324,8 @@ static inline int blocknum(int xv, int yv, int widthv, int blocksize)
yuv_V++; \
} \
\
- yuv_U += ((yuv)->uv_stride - ((width_tm - w_odd * 2) >> 1)); \
- yuv_V += ((yuv)->uv_stride - ((width_tm - w_odd * 2) >> 1)); \
+ yuv_U += ((yuv)->uv_stride - ((width_tm - w_odd) >> 1)); \
+ yuv_V += ((yuv)->uv_stride - ((width_tm - w_odd) >> 1)); \
\
datapi += width_tm + w_odd; \
datapi_back += width_tm + w_odd; \
@@ -356,8 +356,8 @@ static inline int blocknum(int xv, int yv, int widthv, int blocksize)
yuv_V++; \
} \
\
- yuv_U += ((yuv)->y_stride - (width_tm - w_odd * 2)) >> 1; \
- yuv_V += ((yuv)->y_stride - (width_tm - w_odd * 2)) >> 1; \
+ yuv_U += ((yuv)->uv_stride - ((width_tm - w_odd) >> 1)); \
+ yuv_V += ((yuv)->uv_stride - ((width_tm - w_odd) >> 1)); \
\
datapi += width_tm + w_odd; \
datapi_back += width_tm + w_odd; \
© All Rights Reserved