diff options
author | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2006-11-07 07:48:04 +0000 |
---|---|---|
committer | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2006-11-07 07:48:04 +0000 |
commit | 9587d998eaf798f7c07a5b761dce49edb88a97bd (patch) | |
tree | f490a64f5f072ffb6a83b7c7e22e070c1ba890a6 /rMD-exp | |
parent | eb54cd1c9f18fe02998c20abc8b6f936c4ae2709 (diff) |
UPDATE_YUV_BUFFER_SH fixed to traverse
the pixels, using register-stored incrementing pointers,
instead of simple arrays. Also, values are read as integers to minimize memory accesses
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@147 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'rMD-exp')
-rw-r--r-- | rMD-exp/include/recordmydesktop.h | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/rMD-exp/include/recordmydesktop.h b/rMD-exp/include/recordmydesktop.h index 9c4f98e..dd7925e 100644 --- a/rMD-exp/include/recordmydesktop.h +++ b/rMD-exp/include/recordmydesktop.h @@ -438,15 +438,41 @@ int capture_busy, +data_array[(k_tm*width_img+i_tm-1)*4+offset]+data_array[((k_tm-1)*width_img+i_tm-1)*4+offset])/4) #define UPDATE_YUV_BUFFER_SH(yuv,data,x_tm,y_tm,width_tm,height_tm){\ - int i,k;\ - for(k=y_tm;k<y_tm+height_tm;k++){\ - for(i=x_tm;i<x_tm+width_tm;i++){\ - yuv->y[i+k*yuv->y_width]=Yr[data[(i+k*yuv->y_width)*4+__RBYTE]] + Yg[data[(i+k*yuv->y_width)*4+__GBYTE]] + Yb[data[(i+k*yuv->y_width)*4+__BBYTE]];\ - if((k%2)&&(i%2)){\ - yuv->u[i/2+k/2*yuv->uv_width]=Ur[data[(i+k*yuv->y_width)*4+__RBYTE]] + Ug[data[(i+k*yuv->y_width)*4+__GBYTE]] + Ub[data[(i+k*yuv->y_width)*4+__BBYTE]] ;\ - yuv->v[i/2+k/2*yuv->uv_width]=Vr[data[(i+k*yuv->y_width)*4+__RBYTE]] + Vg[data[(i+k*yuv->y_width)*4+__GBYTE]] + Vb[data[(i+k*yuv->y_width)*4+__BBYTE]] ;\ - }\ + int k,i;\ + register unsigned int t_val;\ + register unsigned int *datapi=(unsigned int*)data+x_tm+y_tm*yuv->y_width;\ + register unsigned char *yuv_y=yuv->y+x_tm+y_tm*yuv->y_width,\ + *yuv_u=yuv->u+x_tm/2+(y_tm*yuv->uv_width)/2,\ + *yuv_v=yuv->v+x_tm/2+(y_tm*yuv->uv_width)/2,\ + *_yr=Yr,*_yg=Yg,*_yb=Yb,\ + *_ur=Ur,*_ug=Ug,*_ub=Ub,\ + *_vr=Vr,*_vg=Vg,*_vb=Vb;\ +\ + for(k=0;k<height_tm;k++){\ + for(i=0;i<width_tm;i++){\ + t_val=*datapi;\ + *yuv_y=_yr[__RVALUE(t_val)] + _yg[__GVALUE(t_val)] + _yb[__BVALUE(t_val)] ;\ + datapi++;\ + yuv_y++;\ + }\ + yuv_y+=yuv->y_width-width_tm;\ + datapi+=yuv->y_width-width_tm;\ + }\ + datapi=(unsigned int*)data+x_tm+y_tm*yuv->y_width;\ + for(k=0;k<height_tm;k+=2){\ + for(i=0;i<width_tm;i+=2){\ + t_val=*datapi;\ + *yuv_u=\ + _ur[__RVALUE(t_val)] + _ug[__GVALUE(t_val)] + _ub[__BVALUE(t_val)];\ + *yuv_v=\ + _vr[__RVALUE(t_val)] + _vg[__GVALUE(t_val)] + _vb[__BVALUE(t_val)];\ + datapi+=2;\ + yuv_u++;\ + yuv_v++;\ }\ + yuv_u+=(yuv->y_width-width_tm)/2;\ + yuv_v+=(yuv->y_width-width_tm)/2;\ + datapi+=(2*yuv->y_width-width_tm);\ }\ } |