/****************************************************************************** * recordMyDesktop * ******************************************************************************* * * * Copyright (C) 2006,2007,2008 John Varouhakis * * * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the Free Software * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * * * * * * For further information contact me at johnvarouhakis@gmail.com * ******************************************************************************/ #ifndef BLOCK_UTILS_H #define BLOCK_UTILS_H 1 #include "rmdtypes.h" #include "rmdmacro.h" #include "yuv_utils.h" // We keep these global for now. FIXME: Isolate them. extern u_int32_t *yblocks, *ublocks, *vblocks; #define POINT_IN_BLOCK(xv,yv,widthv,blocksize) ((yv/blocksize)*\ (widthv/blocksize)+\ (xv/blocksize)) #define UPDATE_Y_PLANE_DBUF(data,\ data_back,\ x_tm,\ y_tm,\ height_tm,\ width_tm,\ yuv,\ __bit_depth__){ \ int k,i;\ register u_int##__bit_depth__##_t t_val;\ register unsigned char *yuv_y=yuv->y+x_tm+y_tm*yuv->y_width,\ *_yr=Yr,*_yg=Yg,*_yb=Yb;\ register u_int##__bit_depth__##_t *datapi=(u_int##__bit_depth__##_t *)data,\ *datapi_back=(u_int##__bit_depth__##_t *)data_back;\ for(k=0;ky_width-width_tm;\ }\ } #define UPDATE_UV_PLANES_DBUF( data,\ data_back,\ x_tm,\ y_tm,\ height_tm,\ width_tm,\ yuv,\ __sampling_type,\ __bit_depth__){ \ int k,i;\ 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,*_ubvr=UbVr,\ *_vg=Vg,*_vb=Vb;\ register u_int##__bit_depth__##_t *datapi=(u_int##__bit_depth__##_t *)data,\ *datapi_next=NULL,\ *datapi_back=(u_int##__bit_depth__##_t *)data_back,\ *datapi_back_next=NULL;\ if(__sampling_type==__PXL_AVERAGE){\ datapi_next=datapi+width_tm;\ datapi_back_next=datapi_back+width_tm;\ for(k=0;ky_width-width_tm)/2;\ yuv_v+=(yuv->y_width-width_tm)/2;\ datapi+=width_tm;\ datapi_back+=width_tm;\ if(__sampling_type==__PXL_AVERAGE){\ datapi_next+=width_tm;\ datapi_back_next+=width_tm;\ }\ }\ }\ else{\ for(k=0;ky_width-width_tm)/2;\ yuv_v+=(yuv->y_width-width_tm)/2;\ datapi+=width_tm;\ datapi_back+=width_tm;\ if(__sampling_type==__PXL_AVERAGE){\ datapi_next+=width_tm;\ datapi_back_next+=width_tm;\ }\ }\ }\ } #endif