1 /*****************************************************************************
2 * vdec_block_c.c: Macroblock copy functions in C
3 *****************************************************************************
4 * Copyright (C) 1999, 2000, 2001 VideoLAN
5 * $Id: vdec_block_c.c,v 1.6 2001/08/22 17:21:45 massiot 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 /* MODULE_NAME defined in Makefile together with -DBUILTIN */
26 # include "modules_inner.h"
28 # define _M( foo ) foo
31 /*****************************************************************************
33 *****************************************************************************/
45 #include "vdec_idct.h"
48 #include "modules_export.h"
50 /*****************************************************************************
52 *****************************************************************************
53 * We can keep them static since they will always contain the same values.
54 *****************************************************************************/
55 static u8 pi_crop_buf[VDEC_CROPRANGE];
58 /*****************************************************************************
59 * vdec_InitDecode: initialize video decoder thread
60 *****************************************************************************/
61 void _M( vdec_InitDecode ) ( )
66 pi_crop = pi_crop_buf + (VDEC_CROPRANGE >> 1);
68 for( i_dummy = -(VDEC_CROPRANGE >> 1); i_dummy < 0; i_dummy++ )
73 for( ; i_dummy < 255; i_dummy ++ )
75 pi_crop[i_dummy] = i_dummy;
78 for( ; i_dummy < (VDEC_CROPRANGE >> 1) -1; i_dummy++ )
80 pi_crop[i_dummy] = 255;
84 /*****************************************************************************
85 * vdec_AddBlock : add a block
86 *****************************************************************************/
87 void _M( vdec_AddBlock ) ( dctelem_t * p_block, yuv_data_t * p_data,
93 p_data[0] = pi_crop[ p_data[0] + p_block[0] ];
94 p_data[1] = pi_crop[ p_data[1] + p_block[1] ];
95 p_data[2] = pi_crop[ p_data[2] + p_block[2] ];
96 p_data[3] = pi_crop[ p_data[3] + p_block[3] ];
97 p_data[4] = pi_crop[ p_data[4] + p_block[4] ];
98 p_data[5] = pi_crop[ p_data[5] + p_block[5] ];
99 p_data[6] = pi_crop[ p_data[6] + p_block[6] ];
100 p_data[7] = pi_crop[ p_data[7] + p_block[7] ];
107 /*****************************************************************************
108 * vdec_CopyBlock : copy a block
109 *****************************************************************************/
110 void _M( vdec_CopyBlock )( dctelem_t * p_block, yuv_data_t * p_data,
116 p_data[0] = pi_crop[ p_block[0] ];
117 p_data[1] = pi_crop[ p_block[1] ];
118 p_data[2] = pi_crop[ p_block[2] ];
119 p_data[3] = pi_crop[ p_block[3] ];
120 p_data[4] = pi_crop[ p_block[4] ];
121 p_data[5] = pi_crop[ p_block[5] ];
122 p_data[6] = pi_crop[ p_block[6] ];
123 p_data[7] = pi_crop[ p_block[7] ];