annotate mlib/dsputil_mlib.c @ 395:80518daaab05 libavcodec

added VPATH support for multiple dir compilation
author glantau
date Sat, 18 May 2002 23:01:20 +0000
parents cdc918b5d8d5
children 718a22dc121f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
1 /*
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
2 * Sun mediaLib optimized DSP utils
90
cdc918b5d8d5 copyright change
glantau
parents: 88
diff changeset
3 * Copyright (c) 2001 Gerard Lantau.
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
4 *
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
7 * the Free Software Foundation; either version 2 of the License, or
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
8 * (at your option) any later version.
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
9 *
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
13 * GNU General Public License for more details.
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
14 *
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
16 * along with this program; if not, write to the Free Software
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
18 */
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
19
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
20 #include "../dsputil.h"
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
21
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
22 #include <mlib_types.h>
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
23 #include <mlib_status.h>
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
24 #include <mlib_sys.h>
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
25 #include <mlib_video.h>
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
26
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
27
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
28 static void put_pixels_mlib (uint8_t * dest, const uint8_t * ref,
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
29 int stride, int height)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
30 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
31 assert(height == 16 || height == 8);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
32 if (height == 16)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
33 mlib_VideoCopyRef_U8_U8_8x16(dest, (uint8_t *)ref, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
34 else
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
35 mlib_VideoCopyRef_U8_U8_8x8 (dest, (uint8_t *)ref, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
36 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
37
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
38 static void put_pixels_x2_mlib (uint8_t * dest, const uint8_t * ref,
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
39 int stride, int height)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
40 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
41 assert(height == 16 || height == 8);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
42 if (height == 16)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
43 mlib_VideoInterpX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
44 else
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
45 mlib_VideoInterpX_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
46 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
47
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
48 static void put_pixels_y2_mlib (uint8_t * dest, const uint8_t * ref,
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
49 int stride, int height)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
50 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
51 assert(height == 16 || height == 8);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
52 if (height == 16)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
53 mlib_VideoInterpY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
54 else
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
55 mlib_VideoInterpY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
56 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
57
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
58 static void put_pixels_xy2_mlib(uint8_t * dest, const uint8_t * ref,
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
59 int stride, int height)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
60 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
61 assert(height == 16 || height == 8);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
62 if (height == 16)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
63 mlib_VideoInterpXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
64 else
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
65 mlib_VideoInterpXY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
66 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
67
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
68 static void avg_pixels_mlib (uint8_t * dest, const uint8_t * ref,
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
69 int stride, int height)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
70 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
71 assert(height == 16 || height == 8);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
72 if (height == 16)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
73 mlib_VideoCopyRefAve_U8_U8_8x16(dest, (uint8_t *)ref, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
74 else
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
75 mlib_VideoCopyRefAve_U8_U8_8x8 (dest, (uint8_t *)ref, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
76 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
77
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
78 static void avg_pixels_x2_mlib (uint8_t * dest, const uint8_t * ref,
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
79 int stride, int height)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
80 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
81 assert(height == 16 || height == 8);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
82 if (height == 16)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
83 mlib_VideoInterpAveX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
84 else
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
85 mlib_VideoInterpAveX_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
86 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
87
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
88 static void avg_pixels_y2_mlib (uint8_t * dest, const uint8_t * ref,
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
89 int stride, int height)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
90 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
91 assert(height == 16 || height == 8);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
92 if (height == 16)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
93 mlib_VideoInterpAveY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
94 else
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
95 mlib_VideoInterpAveY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
96 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
97
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
98 static void avg_pixels_xy2_mlib (uint8_t * dest, const uint8_t * ref,
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
99 int stride, int height)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
100 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
101 assert(height == 16 || height == 8);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
102 if (height == 16)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
103 mlib_VideoInterpAveXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
104 else
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
105 mlib_VideoInterpAveXY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
106 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
107
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
108
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
109 static void add_pixels_clamped_mlib(const DCTELEM *block, UINT8 *pixels, int line_size)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
110 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
111 mlib_VideoAddBlock_U8_S16(pixels, (mlib_s16 *)block, line_size);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
112 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
113
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
114
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
115 void ff_idct_mlib(DCTELEM *data)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
116 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
117 mlib_VideoIDCT8x8_S16_S16 (data, data);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
118 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
119
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
120
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
121 void ff_fdct_mlib(DCTELEM *data)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
122 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
123 mlib_VideoDCT8x8_S16_S16 (data, data);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
124 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
125
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
126 void dsputil_init_mlib(void)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
127 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
128 av_fdct = ff_fdct_mlib;
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
129 ff_idct = ff_idct_mlib;
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
130
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
131 put_pixels_tab[0] = put_pixels_mlib;
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
132 put_pixels_tab[1] = put_pixels_x2_mlib;
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
133 put_pixels_tab[2] = put_pixels_y2_mlib;
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
134 put_pixels_tab[3] = put_pixels_xy2_mlib;
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
135
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
136 avg_pixels_tab[0] = avg_pixels_mlib;
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
137 avg_pixels_tab[1] = avg_pixels_x2_mlib;
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
138 avg_pixels_tab[2] = avg_pixels_y2_mlib;
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
139 avg_pixels_tab[3] = avg_pixels_xy2_mlib;
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
140
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
141 put_no_rnd_pixels_tab[0] = put_pixels_mlib;
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
142
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
143 add_pixels_clamped = add_pixels_clamped_mlib;
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
144 }