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