From 362d4378b65a332b6474d269ced364f42342944b Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Thu, 9 Jul 2020 20:58:46 -0700 Subject: yuv_utils: shrink [yuv]blocks to unsigned char[] No idea why this had such a large type, its members just hold 0 or 1. --- recordmydesktop/src/rmd_initialize_data.c | 24 ++++++++++++------------ recordmydesktop/src/rmd_rescue.c | 12 ++++++------ recordmydesktop/src/rmd_yuv_utils.c | 2 +- recordmydesktop/src/rmd_yuv_utils.h | 6 +++--- 4 files changed, 22 insertions(+), 22 deletions(-) (limited to 'recordmydesktop/src') diff --git a/recordmydesktop/src/rmd_initialize_data.c b/recordmydesktop/src/rmd_initialize_data.c index 166f8ea..486a82f 100644 --- a/recordmydesktop/src/rmd_initialize_data.c +++ b/recordmydesktop/src/rmd_initialize_data.c @@ -170,18 +170,18 @@ int rmdInitializeData(ProgData *pdata, EncData *enc_data, CacheData *cache_data) else rmdInitCacheData(pdata, enc_data, cache_data); - for(i=0;i<(pdata->enc_data->yuv.y_width*pdata->enc_data->yuv.y_height);i++) - pdata->enc_data->yuv.y[i]=0; - - for(i=0; i<(pdata->enc_data->yuv.uv_width*pdata->enc_data->yuv.uv_height); i++) - pdata->enc_data->yuv.v[i]=pdata->enc_data->yuv.u[i]=127; - - yblocks = malloc(sizeof(u_int32_t)*(pdata->enc_data->yuv.y_width/Y_UNIT_WIDTH)* - (pdata->enc_data->yuv.y_height/Y_UNIT_WIDTH)); - ublocks = malloc(sizeof(u_int32_t)*(pdata->enc_data->yuv.y_width/Y_UNIT_WIDTH)* - (pdata->enc_data->yuv.y_height/Y_UNIT_WIDTH)); - vblocks = malloc(sizeof(u_int32_t)*(pdata->enc_data->yuv.y_width/Y_UNIT_WIDTH)* - (pdata->enc_data->yuv.y_height/Y_UNIT_WIDTH)); + for(i = 0; i < pdata->enc_data->yuv.y_width * pdata->enc_data->yuv.y_height; i++) + pdata->enc_data->yuv.y[i] = 0; + + for(i = 0; i < pdata->enc_data->yuv.uv_width * pdata->enc_data->yuv.uv_height; i++) + pdata->enc_data->yuv.v[i] = pdata->enc_data->yuv.u[i] = 127; + + yblocks = malloc((pdata->enc_data->yuv.y_width / Y_UNIT_WIDTH) * + (pdata->enc_data->yuv.y_height / Y_UNIT_WIDTH)); + ublocks = malloc((pdata->enc_data->yuv.y_width / Y_UNIT_WIDTH) * + (pdata->enc_data->yuv.y_height / Y_UNIT_WIDTH)); + vblocks = malloc((pdata->enc_data->yuv.y_width / Y_UNIT_WIDTH) * + (pdata->enc_data->yuv.y_height / Y_UNIT_WIDTH)); pdata->frametime=(1000000)/pdata->args.fps; return 0; diff --git a/recordmydesktop/src/rmd_rescue.c b/recordmydesktop/src/rmd_rescue.c index 06d58fa..7d6e3ee 100644 --- a/recordmydesktop/src/rmd_rescue.c +++ b/recordmydesktop/src/rmd_rescue.c @@ -99,12 +99,12 @@ int rmdRescue(const char *path) { for (i=0;i<(enc_data.yuv.uv_width*enc_data.yuv.uv_height);i++) enc_data.yuv.v[i]=enc_data.yuv.u[i]=127; - yblocks=malloc(sizeof(u_int32_t)*(enc_data.yuv.y_width/Y_UNIT_WIDTH)* - (enc_data.yuv.y_height/Y_UNIT_WIDTH)); - ublocks=malloc(sizeof(u_int32_t)*(enc_data.yuv.y_width/Y_UNIT_WIDTH)* - (enc_data.yuv.y_height/Y_UNIT_WIDTH)); - vblocks=malloc(sizeof(u_int32_t)*(enc_data.yuv.y_width/Y_UNIT_WIDTH)* - (enc_data.yuv.y_height/Y_UNIT_WIDTH)); + yblocks = malloc(sizeof(*yblocks) * (enc_data.yuv.y_width / Y_UNIT_WIDTH) * + (enc_data.yuv.y_height / Y_UNIT_WIDTH)); + ublocks = malloc(sizeof(*ublocks) * (enc_data.yuv.y_width / Y_UNIT_WIDTH) * + (enc_data.yuv.y_height / Y_UNIT_WIDTH)); + vblocks = malloc(sizeof(*vblocks) * (enc_data.yuv.y_width / Y_UNIT_WIDTH) * + (enc_data.yuv.y_height / Y_UNIT_WIDTH)); pdata.frametime=(1000000)/pdata.args.fps; diff --git a/recordmydesktop/src/rmd_yuv_utils.c b/recordmydesktop/src/rmd_yuv_utils.c index f433b27..1f163ae 100644 --- a/recordmydesktop/src/rmd_yuv_utils.c +++ b/recordmydesktop/src/rmd_yuv_utils.c @@ -38,7 +38,7 @@ unsigned char Yr[256], Yg[256], Yb[256], // FIXME: These globals are modified in other source files! We keep // thsee here for now. These are the cache blocks. They need to be // accesible in the dbuf macros -u_int32_t *yblocks, +unsigned char *yblocks, *ublocks, *vblocks; diff --git a/recordmydesktop/src/rmd_yuv_utils.h b/recordmydesktop/src/rmd_yuv_utils.h index 36070b6..f92471a 100644 --- a/recordmydesktop/src/rmd_yuv_utils.h +++ b/recordmydesktop/src/rmd_yuv_utils.h @@ -39,9 +39,9 @@ extern unsigned char Yr[256], Yg[256], Yb[256], // We keep these global for now. FIXME: Isolate them. -extern u_int32_t *yblocks, /* XXX FIXME why is this u_int32_t when it seems to be simple bool flags? */ - *ublocks, - *vblocks; +extern unsigned char *yblocks, + *ublocks, + *vblocks; /** -- cgit v1.2.3