summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2020-07-10 18:14:13 -0700
committerVito Caputo <vcaputo@pengaru.com>2020-07-11 13:36:42 -0700
commit64ba1e18a3c03303ebcb020e64e5f4b3d0faabca (patch)
tree8adea575fbb096b46c4489d89fcd400d2ae00a4e
parentc15de7d5e2b6d46f0e3e51a9992ac23d87b1998e (diff)
get_frame: consolidate [yuv]blocks reset as a func
Eliminate some pointless duplication
-rw-r--r--recordmydesktop/src/rmd_get_frame.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/recordmydesktop/src/rmd_get_frame.c b/recordmydesktop/src/rmd_get_frame.c
index 4018d3d..3983319 100644
--- a/recordmydesktop/src/rmd_get_frame.c
+++ b/recordmydesktop/src/rmd_get_frame.c
@@ -206,6 +206,14 @@ static void rmdMoveCaptureArea( XRectangle *rect,
rect->y = (t_y < 0 ) ? 0 : ((t_y + rect->height > height) ? height - rect->height : t_y);
}
+
+static void rmdBlocksReset(unsigned int blocks_w, unsigned int blocks_h) {
+ memset(yblocks, 0, blocks_w * blocks_h * sizeof(*yblocks));
+ memset(ublocks, 0, blocks_w * blocks_h * sizeof(*ublocks));
+ memset(vblocks, 0, blocks_w * blocks_h * sizeof(*vblocks));
+}
+
+
/**
* Extract cache blocks from damage list
*
@@ -225,9 +233,7 @@ static void rmdBlocksFromList( RectArea **root,
unsigned int blocknum_x,
unsigned int blocknum_y) {
- memset(yblocks, 0, blocknum_x * blocknum_y * sizeof(*yblocks));
- memset(ublocks, 0, blocknum_x * blocknum_y * sizeof(*ublocks));
- memset(vblocks, 0, blocknum_x * blocknum_y * sizeof(*vblocks));
+ rmdBlocksReset(blocknum_x, blocknum_y);
for (RectArea *temp = *root; temp; temp = temp->next) {
int row_start, row_end, column_start, column_end;
@@ -472,9 +478,7 @@ void *rmdGetFrame(ProgData *pdata) {
}
pthread_mutex_lock(&pdata->yuv_mutex);
- for(int i = 0; i < blocknum_x * blocknum_y; i++)
- yblocks[i] = ublocks[i] = vblocks[i] = 0;
-
+ rmdBlocksReset(blocknum_x, blocknum_y);
rmdUpdateYuvBuffer( &pdata->enc_data->yuv,
front_buff,
back_buff,
© All Rights Reserved