diff options
author | biocrasher <biocrasher@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2006-07-16 07:24:50 +0000 |
---|---|---|
committer | biocrasher <biocrasher@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2006-07-16 07:24:50 +0000 |
commit | 47efafb324bb3c7cff0f658c25792773ac82b4f5 (patch) | |
tree | 56472ef01b5faeb663d3269a93b7af9f111a6af5 /recordmydesktop | |
parent | 7f8f2bccb8d258ba6095d576f89fde0d3968d09c (diff) |
*** empty log message ***
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@17 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'recordmydesktop')
-rw-r--r-- | recordmydesktop/include/recordmydesktop.h | 26 | ||||
-rw-r--r-- | recordmydesktop/src/bgr_to_yuv.c | 24 | ||||
-rw-r--r-- | recordmydesktop/src/recordmydesktop.c | 2 |
3 files changed, 48 insertions, 4 deletions
diff --git a/recordmydesktop/include/recordmydesktop.h b/recordmydesktop/include/recordmydesktop.h index 9f1be8d..6430024 100644 --- a/recordmydesktop/include/recordmydesktop.h +++ b/recordmydesktop/include/recordmydesktop.h @@ -196,7 +196,9 @@ typedef struct _ProgData{ int Paused,*Running,Aborted; pthread_cond_t *time_cond,*pause_cond; - +unsigned char Yr[256],Yg[256],Yb[256], + Ur[256],Ug[256],Ub[256], + Vr[256],Vg[256],Vb[256]; /**Macros*/ @@ -306,7 +308,7 @@ pthread_cond_t *time_cond,*pause_cond; }\ } -#define UPDATE_YUV_BUFFER_IM(yuv,data,x_tm,y_tm,width_tm,height_tm){\ +#define UPDATE_YUV_BUFFER_IMO(yuv,data,x_tm,y_tm,width_tm,height_tm){\ int i,k,j=0;\ int x_2=x_tm/2,y_2=y_tm/2,y_width_2=yuv->y_width/2;\ for(k=0;k<height_tm;k++){\ @@ -322,6 +324,24 @@ pthread_cond_t *time_cond,*pause_cond; }\ } +#define UPDATE_YUV_BUFFER_IM(yuv,data,x_tm,y_tm,width_tm,height_tm){\ + int i,k,j=0;\ + int x_2=x_tm/2,y_2=y_tm/2;\ + for(k=0;k<height_tm;k++){\ + for(i=0;i<width_tm;i++){\ + yuv->y[x_tm+i+(k+y_tm)*yuv->y_width]=Yr[data[(j*4)+2]] + Yg[data[(j*4)+1]] + Yb[data[(j*4)]] ;\ + if((k%2)&&(i%2)){\ + yuv->u[x_2+i/2+(k/2+y_2)*yuv->uv_width]=\ + Ur[data[(k*width_tm+i)*4+2]] + Ug[data[(k*width_tm+i)*4+1]] + Ub[data[(k*width_tm+i)*4]];\ + yuv->v[x_2+i/2+(k/2+y_2)*yuv->uv_width]=\ + Vr[data[(k*width_tm+i)*4+2]] + Vg[data[(k*width_tm+i)*4+1]] + Vb[data[(k*width_tm+i)*4]];\ + }\ + \ + j++;\ + }\ + }\ +} + #define DUMMY_POINTER_TO_YUV(yuv,data_tm,x_tm,y_tm,width_tm,height_tm,no_pixel){\ int i,k,j=0;\ int x_2=x_tm/2,y_2=y_tm/2,y_width_2=(yuv)->y_width/2;\ @@ -367,6 +387,6 @@ void *CaptureSound(void *pdata); void *EncodeSoundBuffer(void *pdata); snd_pcm_t *OpenDev(const char *pcm_dev,unsigned int channels,unsigned int *frequency,snd_pcm_uframes_t *periodsize,unsigned int *periodtime,int *hardpause); void InitEncoder(ProgData *pdata,EncData *enc_data_t); - +void MakeMatrices(); #endif diff --git a/recordmydesktop/src/bgr_to_yuv.c b/recordmydesktop/src/bgr_to_yuv.c index 9441e5d..413f1fa 100644 --- a/recordmydesktop/src/bgr_to_yuv.c +++ b/recordmydesktop/src/bgr_to_yuv.c @@ -72,3 +72,27 @@ void UpdateYUVBufferIm(yuv_buffer *yuv,unsigned char *data,int x,int y,int width } } +void MakeMatrices(){ + int i; + for(i=0;i<256;i++) + Yr[i]=0.299*i; + for(i=0;i<256;i++) + Yg[i]=0.587*i; + for(i=0;i<256;i++) + Yb[i]=0.114*i; + + for(i=0;i<256;i++) + Ur[i]=43.1-0.169*i; + for(i=0;i<256;i++) + Ug[i]=84.41-0.331*i; + for(i=0;i<256;i++) + Ub[i]=0.5*i; + + for(i=0;i<256;i++) + Vr[i]=0.5*i; + for(i=0;i<256;i++) + Vg[i]=107-0.419*i; + for(i=0;i<256;i++) + Vb[i]=21-0.081*i; +} + diff --git a/recordmydesktop/src/recordmydesktop.c b/recordmydesktop/src/recordmydesktop.c index 89f9892..7eb76df 100644 --- a/recordmydesktop/src/recordmydesktop.c +++ b/recordmydesktop/src/recordmydesktop.c @@ -69,7 +69,7 @@ int main(int argc,char **argv){ if(!pdata.args.scshot){ fprintf(stderr,"Initializing...\n"); - + MakeMatrices(); if(pdata.args.have_dummy_cursor){ pdata.dummy_pointer=MakeDummyPointer(&pdata.specs,16,pdata.args.cursor_color,0,&pdata.npxl); pdata.dummy_p_size=16; |