diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2020-07-11 11:43:39 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2020-07-11 13:36:42 -0700 |
commit | 5b7026676952fffe82ece362f21d190f8aac66a0 (patch) | |
tree | 040cf88df64edb774b5ee8193d07293e09cf60c9 /recordmydesktop/src | |
parent | 94e08c4fb86eed1351faedd903e4707a490414c3 (diff) |
*: no more enc_data->[xy]_offset
With no rrect alignment adjustment happening, there's no need for this
fuckery anymore. The theora encoding offsets will always be left at
0, the frame_{width, height} will clip to rrect.{width,height}, and
the yuv buffer dimensions are the only thing 16x16 aligned.
Diffstat (limited to 'recordmydesktop/src')
-rw-r--r-- | recordmydesktop/src/rmd_cache.c | 6 | ||||
-rw-r--r-- | recordmydesktop/src/rmd_get_frame.c | 24 | ||||
-rw-r--r-- | recordmydesktop/src/rmd_init_encoder.c | 2 | ||||
-rw-r--r-- | recordmydesktop/src/rmd_rescue.c | 13 | ||||
-rw-r--r-- | recordmydesktop/src/rmd_types.h | 4 | ||||
-rw-r--r-- | recordmydesktop/src/rmd_update_image.c | 5 |
6 files changed, 18 insertions, 36 deletions
diff --git a/recordmydesktop/src/rmd_cache.c b/recordmydesktop/src/rmd_cache.c index 2d7d8d5..1353bc2 100644 --- a/recordmydesktop/src/rmd_cache.c +++ b/recordmydesktop/src/rmd_cache.c @@ -132,15 +132,13 @@ int rmdPurgeCache(CacheData *cache_data_t, int sound) { } void rmdInitCacheData(ProgData *pdata, EncData *enc_data_t, CacheData *cache_data_t) { - int width, height, offset_x, offset_y, pid; + int width, height, pid; char pidbuf[8]; //we set the buffer only since there's //no need to initialize the encoder from now. width = ((pdata->brwin.rrect.width + 15) >> 4) << 4; height = ((pdata->brwin.rrect.height + 15) >> 4) << 4; - offset_x = ((width - pdata->brwin.rrect.width) / 2) & ~1; - offset_y = ((height - pdata->brwin.rrect.height) / 2) & ~1; (pdata)->enc_data = enc_data_t; @@ -154,8 +152,6 @@ void rmdInitCacheData(ProgData *pdata, EncData *enc_data_t, CacheData *cache_dat enc_data_t->yuv.uv_width = width / 2; enc_data_t->yuv.uv_height = height / 2; enc_data_t->yuv.uv_stride = width / 2; - enc_data_t->x_offset = offset_x; - enc_data_t->y_offset = offset_y; //now we set the cache files (pdata)->cache_data = cache_data_t; diff --git a/recordmydesktop/src/rmd_get_frame.c b/recordmydesktop/src/rmd_get_frame.c index 162b2f5..a9e4daa 100644 --- a/recordmydesktop/src/rmd_get_frame.c +++ b/recordmydesktop/src/rmd_get_frame.c @@ -172,8 +172,8 @@ static int rmdFirstFrame(ProgData *pdata, Image *image) { rmdUpdateYuvBuffer( &pdata->enc_data->yuv, (unsigned char *)image->ximage->data, NULL, - pdata->enc_data->x_offset, - pdata->enc_data->y_offset, + 0, + 0, rrect->width, rrect->height, pdata->args.no_quick_subsample, @@ -411,8 +411,8 @@ void *rmdGetFrame(ProgData *pdata) { mark_buffer_area( back_buff, - mouse_pos_temp.x - temp_brwin.rrect.x + pdata->enc_data->x_offset, - mouse_pos_temp.y - temp_brwin.rrect.y + pdata->enc_data->y_offset, + mouse_pos_temp.x - temp_brwin.rrect.x, + mouse_pos_temp.y - temp_brwin.rrect.y, mouse_pos_temp.width, mouse_pos_temp.height, temp_brwin.rrect.width, pdata->specs.depth ); @@ -483,8 +483,8 @@ void *rmdGetFrame(ProgData *pdata) { rmdUpdateYuvBuffer( &pdata->enc_data->yuv, front_buff, back_buff, - pdata->enc_data->x_offset, - pdata->enc_data->y_offset, + 0, + 0, temp_brwin.rrect.width, temp_brwin.rrect.height, pdata->args.no_quick_subsample, @@ -517,8 +517,8 @@ void *rmdGetFrame(ProgData *pdata) { rmdXFixesPointerToYuv( &pdata->enc_data->yuv, ((unsigned char*)xcim->pixels), - mouse_pos_temp.x - temp_brwin.rrect.x + pdata->enc_data->x_offset, - mouse_pos_temp.y - temp_brwin.rrect.y + pdata->enc_data->y_offset, + mouse_pos_temp.x - temp_brwin.rrect.x, + mouse_pos_temp.y - temp_brwin.rrect.y, mouse_pos_temp.width, mouse_pos_temp.height, mouse_xoffset, @@ -529,8 +529,8 @@ void *rmdGetFrame(ProgData *pdata) { rmdDummyPointerToYuv( &pdata->enc_data->yuv, pdata->dummy_pointer, - mouse_pos_temp.x - temp_brwin.rrect.x + pdata->enc_data->x_offset, - mouse_pos_temp.y - temp_brwin.rrect.y + pdata->enc_data->y_offset, + mouse_pos_temp.x - temp_brwin.rrect.x, + mouse_pos_temp.y - temp_brwin.rrect.y, mouse_pos_temp.width, mouse_pos_temp.height, mouse_xoffset, @@ -550,8 +550,8 @@ void *rmdGetFrame(ProgData *pdata) { mark_buffer_area( front_buff, - mouse_pos_temp.x - temp_brwin.rrect.x + pdata->enc_data->x_offset, - mouse_pos_temp.y - temp_brwin.rrect.y + pdata->enc_data->y_offset, + mouse_pos_temp.x - temp_brwin.rrect.x, + mouse_pos_temp.y - temp_brwin.rrect.y, mouse_pos_temp.width, mouse_pos_temp.height, temp_brwin.rrect.width, diff --git a/recordmydesktop/src/rmd_init_encoder.c b/recordmydesktop/src/rmd_init_encoder.c index 2b2273e..55e1711 100644 --- a/recordmydesktop/src/rmd_init_encoder.c +++ b/recordmydesktop/src/rmd_init_encoder.c @@ -340,8 +340,6 @@ void rmdInitEncoder(ProgData *pdata, EncData *enc_data_t, int buffer_ready) { enc_data_t->yuv.uv_width = enc_data_t->m_th_inf.width / 2; enc_data_t->yuv.uv_height = enc_data_t->m_th_inf.height / 2; enc_data_t->yuv.uv_stride = enc_data_t->m_th_inf.width / 2; - enc_data_t->x_offset = enc_data_t->m_th_inf.offset_x; - enc_data_t->y_offset = enc_data_t->m_th_inf.offset_y; } theora_info_clear(&enc_data_t->m_th_inf); diff --git a/recordmydesktop/src/rmd_rescue.c b/recordmydesktop/src/rmd_rescue.c index bceb257..84bcf4b 100644 --- a/recordmydesktop/src/rmd_rescue.c +++ b/recordmydesktop/src/rmd_rescue.c @@ -41,7 +41,6 @@ int rmdRescue(const char *path) { - int offset_x, offset_y; unsigned short width, height; ProgData pdata; EncData enc_data; @@ -74,23 +73,17 @@ int rmdRescue(const char *path) { width = ((pdata.brwin.rrect.width + 15) >> 4) << 4; height = ((pdata.brwin.rrect.height + 15) >> 4) << 4; - offset_x = ((width - pdata.brwin.rrect.width) / 2) & ~1; - offset_y = ((height - pdata.brwin.rrect.height) / 2) & ~1; - enc_data.yuv.y = (unsigned char *)malloc(height * width); - enc_data.yuv.u = (unsigned char *)malloc(height * width / 4); - enc_data.yuv.v = (unsigned char *)malloc(height * width / 4); + enc_data.yuv.y = malloc(height * width); + enc_data.yuv.u = malloc(height * width / 4); + enc_data.yuv.v = malloc(height * width / 4); enc_data.yuv.y_width = width; enc_data.yuv.y_height = height; enc_data.yuv.y_stride = width; - enc_data.x_offset=offset_x; - enc_data.y_offset=offset_y; enc_data.yuv.uv_width = width / 2; enc_data.yuv.uv_height = height / 2; enc_data.yuv.uv_stride = width / 2; - enc_data.x_offset = offset_x; - enc_data.y_offset = offset_y; for (int i = 0; i < (enc_data.yuv.y_width * enc_data.yuv.y_height); i++) enc_data.yuv.y[i] = 0; diff --git a/recordmydesktop/src/rmd_types.h b/recordmydesktop/src/rmd_types.h index f85390f..d3e1ce0 100644 --- a/recordmydesktop/src/rmd_types.h +++ b/recordmydesktop/src/rmd_types.h @@ -179,10 +179,6 @@ typedef struct _EncData{ vorbis_comment m_vo_cmmnt; vorbis_dsp_state m_vo_dsp; vorbis_block m_vo_block; -//these should be 0, since area is quantized -//before input - int x_offset, - y_offset; //our file FILE *fp; } EncData; diff --git a/recordmydesktop/src/rmd_update_image.c b/recordmydesktop/src/rmd_update_image.c index b48e96b..343e1bb 100644 --- a/recordmydesktop/src/rmd_update_image.c +++ b/recordmydesktop/src/rmd_update_image.c @@ -84,8 +84,8 @@ void rmdUpdateImage( Display * dpy, yuv, (unsigned char *)image->ximage->data, NULL, - temp->rect.x - brwin->rrect.x + enc->x_offset, - temp->rect.y - brwin->rrect.y + enc->y_offset, + temp->rect.x - brwin->rrect.x, + temp->rect.y - brwin->rrect.y, temp->rect.width, temp->rect.height, no_quick_subsample, @@ -93,4 +93,3 @@ void rmdUpdateImage( Display * dpy, ); } } - |