From 09972c64255c1831e7152f9d39cff70867b9134a Mon Sep 17 00:00:00 2001
From: iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>
Date: Sat, 14 Apr 2007 01:15:06 +0000
Subject: well... it only took me a few months to notice that the Ub and Vr
 components are the same and don't need to be held on separate arrays...
 (replaced them with on UbVr array)

git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@304 f606c939-3180-4ac9-a4b8-4b8779d57d0a
---
 recordmydesktop/include/recordmydesktop.h |  4 ++--
 recordmydesktop/include/rmdmacro.h        | 16 ++++++++--------
 recordmydesktop/src/bgr_to_yuv.c          |  4 +---
 3 files changed, 11 insertions(+), 13 deletions(-)

(limited to 'recordmydesktop')

diff --git a/recordmydesktop/include/recordmydesktop.h b/recordmydesktop/include/recordmydesktop.h
index bd6e974..358965d 100644
--- a/recordmydesktop/include/recordmydesktop.h
+++ b/recordmydesktop/include/recordmydesktop.h
@@ -45,8 +45,8 @@ int Paused,*Running,Aborted;
 pthread_cond_t  *time_cond,*pause_cond;
 pthread_mutex_t pause_mutex,time_mutex;
 unsigned char   Yr[256],Yg[256],Yb[256],
-                Ur[256],Ug[256],Ub[256],
-                Vr[256],Vg[256],Vb[256];
+                Ur[256],Ug[256],UbVr[256],
+                Vg[256],Vb[256];
 //the following values are of no effect
 //but they might be usefull later for profiling
 unsigned int    frames_total,   //frames calculated by total time expirations
diff --git a/recordmydesktop/include/rmdmacro.h b/recordmydesktop/include/rmdmacro.h
index f620f73..abbc42c 100644
--- a/recordmydesktop/include/rmdmacro.h
+++ b/recordmydesktop/include/rmdmacro.h
@@ -313,8 +313,8 @@
     register u_int##__bit_depth__##_t t_val;\
     register unsigned char  *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,\
-                            *_ur=Ur,*_ug=Ug,*_ub=Ub,\
-                            *_vr=Vr,*_vg=Vg,*_vb=Vb;\
+                            *_ur=Ur,*_ug=Ug,*_ubvr=UbVr,\
+                            *_vg=Vg,*_vb=Vb;\
     register u_int##__bit_depth__##_t *datapi=(u_int##__bit_depth__##_t *)data,\
                                       *datapi_next=NULL;\
     if(__sampling_type==__PXL_AVERAGE){\
@@ -330,9 +330,9 @@
             *yuv_u=\
             _ur[__RVALUE_##__bit_depth__(t_val)] +\
             _ug[__GVALUE_##__bit_depth__(t_val)] +\
-            _ub[__BVALUE_##__bit_depth__(t_val)];\
+            _ubvr[__BVALUE_##__bit_depth__(t_val)];\
             *yuv_v=\
-            _vr[__RVALUE_##__bit_depth__(t_val)] +\
+            _ubvr[__RVALUE_##__bit_depth__(t_val)] +\
             _vg[__GVALUE_##__bit_depth__(t_val)] +\
             _vb[__BVALUE_##__bit_depth__(t_val)];\
             datapi+=2;\
@@ -405,10 +405,10 @@
                                       k,i,__BBYTE);\
                     yuv->u[x_2+i/2+(k/2+y_2)*yuv->uv_width]=\
                     (yuv->u[x_2+i/2+(k/2+y_2)*yuv->uv_width]*(UCHAR_MAX-avg3)+\
-                    (Ur[avg2] + Ug[avg1] +Ub[avg0])*avg3)/UCHAR_MAX;\
+                    (Ur[avg2] + Ug[avg1] +UbVr[avg0])*avg3)/UCHAR_MAX;\
                     yuv->v[x_2+i/2+(k/2+y_2)*yuv->uv_width]=\
                     (yuv->v[x_2+i/2+(k/2+y_2)*yuv->uv_width]*(UCHAR_MAX-avg3)+\
-                    (Vr[avg2] + Vg[avg1] +Vb[avg0])*avg3)/UCHAR_MAX;\
+                    (UbVr[avg2] + Vg[avg1] +Vb[avg0])*avg3)/UCHAR_MAX;\
                 }\
             j++;\
         }\
@@ -436,9 +436,9 @@
                     yuv->u[x_2+i/2+(k/2+y_2)*y_width_2]=\
                         Ur[data_tm[(k*width_tm+i)*4+__RBYTE]] +\
                         Ug[data_tm[(k*width_tm+i)*4+__GBYTE]] +\
-                        Ub[data_tm[(k*width_tm+i)*4+__BBYTE]];\
+                        UbVr[data_tm[(k*width_tm+i)*4+__BBYTE]];\
                     yuv->v[x_2+i/2+(k/2+y_2)*y_width_2]=\
-                        Vr[data_tm[(k*width_tm+i)*4+__RBYTE]] +\
+                        UbVr[data_tm[(k*width_tm+i)*4+__RBYTE]] +\
                         Vg[data_tm[(k*width_tm+i)*4+__GBYTE]] +\
                         Vb[data_tm[(k*width_tm+i)*4+__BBYTE]] ;\
                 }\
diff --git a/recordmydesktop/src/bgr_to_yuv.c b/recordmydesktop/src/bgr_to_yuv.c
index f0632e7..2408c92 100644
--- a/recordmydesktop/src/bgr_to_yuv.c
+++ b/recordmydesktop/src/bgr_to_yuv.c
@@ -42,10 +42,8 @@ void MakeMatrices(){
     for(i=0;i<256;i++)
         Ug[i]=74.2-(2384.0*i)/8192.0+8.0;
     for(i=0;i<256;i++)
-        Ub[i]=(3598.0*i)/8192.0 ;
+        UbVr[i]=(3598.0*i)/8192.0 ;
 
-    for(i=0;i<256;i++)
-        Vr[i]=(3598.0*i)/8192.0;
     for(i=0;i<256;i++)
         Vg[i]=93.8-(3013.0*i)/8192.0+8.0;
     for(i=0;i<256;i++)
-- 
cgit v1.2.3