From dd9cc6cf87738dca3cde920ff15eb8ad30feb89a Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Thu, 9 Jul 2020 20:37:48 -0700 Subject: yuv_utils: fixup dirty blocknum() parameters This needs to maintain dirty blocks in the yuv frame coordinates, not in the captured image's cooridinates. The existing code assumes those are the same in double-buffer mode where the dirty block tracking is applied. But I'm working towards allowing the captured image dimensions to be free from the 16x16 alignment constraints the yuv buffers must conform to for theora. To handle that future, the block coordinates should at least use the (yuv)->y_width, not width_tm. I also added shifting the x,y but in double-buffer mode that shouldn't actually be needed since it'd always be full-shots unless I'm mistaken. --- recordmydesktop/src/rmd_yuv_utils.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/recordmydesktop/src/rmd_yuv_utils.c b/recordmydesktop/src/rmd_yuv_utils.c index 6d05c43..33cf2f6 100644 --- a/recordmydesktop/src/rmd_yuv_utils.c +++ b/recordmydesktop/src/rmd_yuv_utils.c @@ -258,7 +258,7 @@ static inline int blocknum(int xv, int yv, int widthv, int blocksize) *yuv_Y = _yr[__RVALUE_##__depth__(t_val)] + \ _yg[__GVALUE_##__depth__(t_val)] + \ _yb[__BVALUE_##__depth__(t_val)]; \ - yblocks[blocknum(i, k, width_tm, Y_UNIT_WIDTH)] = 1; \ + yblocks[blocknum(x_tm + i, y_tm + k, (yuv)->y_width, Y_UNIT_WIDTH)] = 1;\ } \ datapi++; \ datapi_back++; \ @@ -311,8 +311,8 @@ static inline int blocknum(int xv, int yv, int widthv, int blocksize) sampling, \ __depth__); \ \ - ublocks[blocknum(i, k, width_tm, Y_UNIT_WIDTH)] = 1; \ - vblocks[blocknum(i, k, width_tm, Y_UNIT_WIDTH)] = 1; \ + ublocks[blocknum(x_tm + i, y_tm + k, (yuv)->y_width, Y_UNIT_WIDTH)] = 1; \ + vblocks[blocknum(x_tm + i, y_tm + k, (yuv)->y_width, Y_UNIT_WIDTH)] = 1; \ } \ \ datapi += 2; \ @@ -345,8 +345,8 @@ static inline int blocknum(int xv, int yv, int widthv, int blocksize) sampling, \ __depth__); \ \ - ublocks[blocknum(i, k, width_tm, Y_UNIT_WIDTH)] = 1; \ - vblocks[blocknum(i, k, width_tm, Y_UNIT_WIDTH)] = 1; \ + ublocks[blocknum(x_tm + i, y_tm + k, (yuv)->y_width, Y_UNIT_WIDTH)] = 1; \ + vblocks[blocknum(x_tm + i, y_tm + k, (yuv)->y_width, Y_UNIT_WIDTH)] = 1; \ } \ \ datapi += 2; \ -- cgit v1.2.3