1 /*****************************************************************************
2 * block_c.h: Macroblock copy functions in C
3 *****************************************************************************
4 * Copyright (C) 1999, 2000, 2001 VideoLAN
5 * $Id: block_c.h,v 1.1 2002/08/04 17:23:42 sam Exp $
7 * Authors: Christophe Massiot <massiot@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************
27 * We can keep them static since they will always contain the same values.
28 *****************************************************************************/
29 static u8 pi_crop_buf[VDEC_CROPRANGE];
32 /*****************************************************************************
33 * InitBlock: initialize the crop table
34 *****************************************************************************/
35 static void InitBlock ( )
40 pi_crop = pi_crop_buf + (VDEC_CROPRANGE >> 1);
42 for( i_dummy = -(VDEC_CROPRANGE >> 1); i_dummy < 0; i_dummy++ )
47 for( ; i_dummy < 255; i_dummy ++ )
49 pi_crop[i_dummy] = i_dummy;
52 for( ; i_dummy < (VDEC_CROPRANGE >> 1) -1; i_dummy++ )
54 pi_crop[i_dummy] = 255;
58 /*****************************************************************************
59 * AddBlock: add a block
60 *****************************************************************************/
61 static inline void AddBlock( dctelem_t * p_block, yuv_data_t * p_data,
67 p_data[0] = pi_crop[ p_data[0] + p_block[0] ];
68 p_data[1] = pi_crop[ p_data[1] + p_block[1] ];
69 p_data[2] = pi_crop[ p_data[2] + p_block[2] ];
70 p_data[3] = pi_crop[ p_data[3] + p_block[3] ];
71 p_data[4] = pi_crop[ p_data[4] + p_block[4] ];
72 p_data[5] = pi_crop[ p_data[5] + p_block[5] ];
73 p_data[6] = pi_crop[ p_data[6] + p_block[6] ];
74 p_data[7] = pi_crop[ p_data[7] + p_block[7] ];
81 /*****************************************************************************
82 * CopyBlock: copy a block
83 *****************************************************************************/
84 static inline void CopyBlock( dctelem_t * p_block, yuv_data_t * p_data,
90 p_data[0] = pi_crop[ p_block[0] ];
91 p_data[1] = pi_crop[ p_block[1] ];
92 p_data[2] = pi_crop[ p_block[2] ];
93 p_data[3] = pi_crop[ p_block[3] ];
94 p_data[4] = pi_crop[ p_block[4] ];
95 p_data[5] = pi_crop[ p_block[5] ];
96 p_data[6] = pi_crop[ p_block[6] ];
97 p_data[7] = pi_crop[ p_block[7] ];