[svn] / trunk / xvidcore / src / image / interpolate8x8.c Repository:
ViewVC logotype

Annotation of /trunk/xvidcore/src/image/interpolate8x8.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 830 - (view) (download)

1 : chl 433 /*****************************************************************************
2 : Isibaar 333 *
3 : chl 433 * XVID MPEG-4 VIDEO CODEC
4 : edgomez 651 * - 8x8 block-based halfpel interpolation -
5 : Isibaar 333 *
6 : chl 433 * Copyright(C) 2002 Peter Ross <pross@xvid.org>
7 :     * Copyright(C) 2002 MinChen <chenm002@163.com>
8 : Isibaar 333 *
9 : edgomez 651 * This file is part of XviD, a free MPEG-4 video encoder/decoder
10 : Isibaar 333 *
11 : edgomez 651 * XviD is free software; you can redistribute it and/or modify it
12 :     * under the terms of the GNU General Public License as published by
13 : chl 433 * the Free Software Foundation; either version 2 of the License, or
14 :     * (at your option) any later version.
15 : Isibaar 333 *
16 : chl 433 * This program is distributed in the hope that it will be useful,
17 :     * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 :     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 :     * GNU General Public License for more details.
20 : Isibaar 333 *
21 : chl 433 * You should have received a copy of the GNU General Public License
22 :     * along with this program; if not, write to the Free Software
23 :     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 : Isibaar 333 *
25 : edgomez 651 * Under section 8 of the GNU General Public License, the copyright
26 :     * holders of XVID explicitly forbid distribution in the following
27 :     * countries:
28 :     *
29 :     * - Japan
30 :     * - United States of America
31 :     *
32 :     * Linking XviD statically or dynamically with other modules is making a
33 :     * combined work based on XviD. Thus, the terms and conditions of the
34 :     * GNU General Public License cover the whole combination.
35 :     *
36 :     * As a special exception, the copyright holders of XviD give you
37 :     * permission to link XviD with independent modules that communicate with
38 :     * XviD solely through the VFW1.1 and DShow interfaces, regardless of the
39 :     * license terms of these independent modules, and to copy and distribute
40 :     * the resulting combined work under terms of your choice, provided that
41 :     * every copy of the combined work is accompanied by a complete copy of
42 :     * the source code of XviD (the version of XviD used to produce the
43 :     * combined work), being distributed under the terms of the GNU General
44 :     * Public License plus this exception. An independent module is a module
45 :     * which is not derived from or based on XviD.
46 :     *
47 :     * Note that people who make modified versions of XviD are not obligated
48 :     * to grant this special exception for their modified versions; it is
49 :     * their choice whether to do so. The GNU General Public License gives
50 :     * permission to release a modified version without this exception; this
51 :     * exception also makes it possible to release a modified version which
52 :     * carries forward this exception.
53 :     *
54 : edgomez 830 * $Id: interpolate8x8.c,v 1.9 2003-02-11 21:56:31 edgomez Exp $
55 : edgomez 651 *
56 : chl 433 ****************************************************************************/
57 : Isibaar 333
58 :     #include "../portab.h"
59 :     #include "interpolate8x8.h"
60 :    
61 : edgomez 677 /* function pointers */
62 : Isibaar 333 INTERPOLATE8X8_PTR interpolate8x8_halfpel_h;
63 :     INTERPOLATE8X8_PTR interpolate8x8_halfpel_v;
64 :     INTERPOLATE8X8_PTR interpolate8x8_halfpel_hv;
65 :    
66 :    
67 : edgomez 677 /* dst = interpolate(src) */
68 : Isibaar 333
69 :     void
70 :     interpolate8x8_halfpel_h_c(uint8_t * const dst,
71 :     const uint8_t * const src,
72 :     const uint32_t stride,
73 :     const uint32_t rounding)
74 :     {
75 :     uint32_t i, j;
76 :    
77 :     for (j = 0; j < 8; j++) {
78 :     for (i = 0; i < 8; i++) {
79 :    
80 : edgomez 723 int32_t tot =
81 :     (int32_t) src[j * stride + i] + (int32_t) src[j * stride + i + 1];
82 : Isibaar 333
83 : edgomez 723 tot = (tot + 1 - rounding) >> 1;
84 : Isibaar 333 dst[j * stride + i] = (uint8_t) tot;
85 :     }
86 :     }
87 :     }
88 :    
89 :    
90 :    
91 :     void
92 :     interpolate8x8_halfpel_v_c(uint8_t * const dst,
93 :     const uint8_t * const src,
94 :     const uint32_t stride,
95 :     const uint32_t rounding)
96 :     {
97 :     uint32_t i, j;
98 :    
99 :     for (j = 0; j < 8; j++) {
100 :     for (i = 0; i < 8; i++) {
101 : edgomez 723 int32_t tot =
102 :     (int32_t)src[j * stride + i] + (int32_t)src[j * stride + i + stride];
103 : Isibaar 333
104 :     tot = ((tot + 1 - rounding) >> 1);
105 :     dst[j * stride + i] = (uint8_t) tot;
106 :     }
107 :     }
108 :     }
109 :    
110 :    
111 :     void
112 :     interpolate8x8_halfpel_hv_c(uint8_t * const dst,
113 :     const uint8_t * const src,
114 :     const uint32_t stride,
115 :     const uint32_t rounding)
116 :     {
117 :     uint32_t i, j;
118 :    
119 :     for (j = 0; j < 8; j++) {
120 :     for (i = 0; i < 8; i++) {
121 : edgomez 723 int32_t tot =
122 :     (int32_t)src[j * stride + i] + (int32_t)src[j * stride + i + 1] +
123 :     (int32_t)src[j * stride + i + stride] + (int32_t)src[j * stride + i + stride + 1];
124 : Isibaar 333 tot = ((tot + 2 - rounding) >> 2);
125 :     dst[j * stride + i] = (uint8_t) tot;
126 :     }
127 :     }
128 :     }
129 :    
130 : edgomez 677 /* add by MinChen <chenm001@163.com> */
131 :     /* interpolate8x8 two pred block */
132 : Isibaar 333 void
133 :     interpolate8x8_c(uint8_t * const dst,
134 :     const uint8_t * const src,
135 :     const uint32_t x,
136 :     const uint32_t y,
137 :     const uint32_t stride)
138 :     {
139 :     uint32_t i, j;
140 :    
141 :     for (j = 0; j < 8; j++) {
142 :     for (i = 0; i < 8; i++) {
143 :     int32_t tot =
144 : edgomez 723 (((int32_t)src[(y + j) * stride + x + i] +
145 :     (int32_t)dst[(y + j) * stride + x + i] + 1) >> 1);
146 : Isibaar 333 dst[(y + j) * stride + x + i] = (uint8_t) tot;
147 :     }
148 :     }
149 :     }

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4