diff options
author | biocrasher <biocrasher@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2006-07-18 12:26:02 +0000 |
---|---|---|
committer | biocrasher <biocrasher@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2006-07-18 12:26:02 +0000 |
commit | 1ca1ca0f59a350cd22e6989ac717e6f408dad5f6 (patch) | |
tree | ca84d121d5230e31f8c051e1ae7bef85cba5f018 /recordmydesktop | |
parent | b2ee41cd1a499b66725797ca26a026fc352973f8 (diff) |
window alignment 8pixels,32 bytes. Fixed messed up end-result.
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@23 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'recordmydesktop')
-rw-r--r-- | recordmydesktop/ChangeLog | 1 | ||||
-rw-r--r-- | recordmydesktop/include/recordmydesktop.h | 2 | ||||
-rw-r--r-- | recordmydesktop/src/bgr_to_yuv.c | 62 |
3 files changed, 33 insertions, 32 deletions
diff --git a/recordmydesktop/ChangeLog b/recordmydesktop/ChangeLog index ac217b0..cf6ffa0 100644 --- a/recordmydesktop/ChangeLog +++ b/recordmydesktop/ChangeLog @@ -6,6 +6,7 @@ extended beyond recording height fixed. *Size adjustement that resulted in extra or missing pixels at borders has been corrected. *The option to drop frames has been added. +*The option to do better subsampling has been added. *Default behavior now is to use shared memory when size of image gets over 75% of total (or a user set threshold). *Many other minor bugfixes. diff --git a/recordmydesktop/include/recordmydesktop.h b/recordmydesktop/include/recordmydesktop.h index 84b647b..a994432 100644 --- a/recordmydesktop/include/recordmydesktop.h +++ b/recordmydesktop/include/recordmydesktop.h @@ -418,7 +418,7 @@ int CollideRects(WGeometry *wgeom1,WGeometry *wgeom2,WGeometry **wgeom_return,in void SetExpired(int signum); void RegisterCallbacks(ProgArgs *args); void UpdateImage(Display * dpy,yuv_buffer *yuv,pthread_mutex_t *yuv_mutex,DisplaySpecs *specs,RectArea **root,BRWindow *brwin,EncData *enc,char *datatemp,int noshmem,int no_quick_subsample); -void XImageToYUV(XImage *imgz,yuv_buffer *yuv,int no_quick_subsample); +// void XImageToYUV(XImage *imgz,yuv_buffer *yuv,int no_quick_subsample); int GetZPixmap(Display *dpy,Window root,char *data,int x,int y,int width,int height); int ParseArgs(int argc,char **argv,ProgArgs *arg_return); int QueryExtensions(Display *dpy,ProgArgs *args,int *damage_event,int *damage_error); diff --git a/recordmydesktop/src/bgr_to_yuv.c b/recordmydesktop/src/bgr_to_yuv.c index d2b14f4..2266e94 100644 --- a/recordmydesktop/src/bgr_to_yuv.c +++ b/recordmydesktop/src/bgr_to_yuv.c @@ -27,37 +27,37 @@ #include <recordmydesktop.h> -void XImageToYUV(XImage *imgz,yuv_buffer *yuv,int no_quick_subsample){ - unsigned char *dtap=(unsigned char *)imgz->data; - unsigned char avg2,avg1,avg0; - int i,k,j=0; - - for(k=0;k<(imgz->width*imgz->height);k++){ - yuv->y[k]=Yr[dtap[(k*4)+2]] + Yg[dtap[(k*4)+1]] + Yb[dtap[(k*4)]]; - } - if(!no_quick_subsample){ - for(i=0;i<(imgz->height);i+=2){ - for(k=0;k<(imgz->width);k+=2){ - yuv->u[j]=Ur[dtap[i*imgz->bytes_per_line+k*4+2]] + Ug[dtap[i*imgz->bytes_per_line+k*4+1]] + Ub[dtap[i*imgz->bytes_per_line+k*4]]; - yuv->v[j]=Vr[dtap[i*imgz->bytes_per_line+k*4+2]] + Vg[dtap[i*imgz->bytes_per_line+k*4+1]] + Vb[dtap[i*imgz->bytes_per_line+k*4]] ; - j++; - } - } - } - else{ - for(i=0;i<(imgz->height);i+=2){ - for(k=0;k<(imgz->width);k+=2){ - avg2=AVG_4_PIXELS(dtap,(imgz->width),i,k,2); - avg1=AVG_4_PIXELS(dtap,(imgz->width),i,k,1); - avg0=AVG_4_PIXELS(dtap,(imgz->width),i,k,0); - - yuv->u[j]=Ur[avg2] + Ug[avg1] + Ub[avg0]; - yuv->v[j]=Vr[avg2] + Vg[avg1] + Vb[avg0] ; - j++; - } - } - } -} +// void XImageToYUV(XImage *imgz,yuv_buffer *yuv,int no_quick_subsample){ +// unsigned char *dtap=(unsigned char *)imgz->data; +// unsigned char avg2,avg1,avg0; +// int i,k,j=0; +// +// for(k=0;k<(imgz->width*imgz->height);k++){ +// yuv->y[k]=Yr[dtap[(k*4)+2]] + Yg[dtap[(k*4)+1]] + Yb[dtap[(k*4)]]; +// } +// if(!no_quick_subsample){ +// for(i=0;i<(imgz->height);i+=2){ +// for(k=0;k<(imgz->width);k+=2){ +// yuv->u[j]=Ur[dtap[i*imgz->bytes_per_line+k*4+2]] + Ug[dtap[i*imgz->bytes_per_line+k*4+1]] + Ub[dtap[i*imgz->bytes_per_line+k*4]]; +// yuv->v[j]=Vr[dtap[i*imgz->bytes_per_line+k*4+2]] + Vg[dtap[i*imgz->bytes_per_line+k*4+1]] + Vb[dtap[i*imgz->bytes_per_line+k*4]] ; +// j++; +// } +// } +// } +// else{ +// for(i=0;i<(imgz->height);i+=2){ +// for(k=0;k<(imgz->width);k+=2){ +// avg2=AVG_4_PIXELS(dtap,(imgz->width),i,k,2); +// avg1=AVG_4_PIXELS(dtap,(imgz->width),i,k,1); +// avg0=AVG_4_PIXELS(dtap,(imgz->width),i,k,0); +// +// yuv->u[j]=Ur[avg2] + Ug[avg1] + Ub[avg0]; +// yuv->v[j]=Vr[avg2] + Vg[avg1] + Vb[avg0] ; +// j++; +// } +// } +// } +// } void MakeMatrices(){ |