Mercurial > libavcodec.hg
annotate mlib/dsputil_mlib.c @ 1283:00dcdda701ca libavcodec
rework SVQ1 decoder to use more intuitive VLC tables as well as ffmpeg's
native VLC facilities; also added decoding of some more frame header
fields
author | tmmm |
---|---|
date | Mon, 26 May 2003 17:44:24 +0000 |
parents | d5719a953ee0 |
children | 7d328fd9d8a5 |
rev | line source |
---|---|
88 | 1 /* |
2 * Sun mediaLib optimized DSP utils | |
429 | 3 * Copyright (c) 2001 Fabrice Bellard. |
88 | 4 * |
429 | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Lesser General Public | |
7 * License as published by the Free Software Foundation; either | |
8 * version 2 of the License, or (at your option) any later version. | |
88 | 9 * |
429 | 10 * This library is distributed in the hope that it will be useful, |
88 | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
429 | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Lesser General Public License for more details. | |
88 | 14 * |
429 | 15 * You should have received a copy of the GNU Lesser General Public |
16 * License along with this library; if not, write to the Free Software | |
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
88 | 18 */ |
19 | |
20 #include "../dsputil.h" | |
628
f596db4aa871
sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents:
429
diff
changeset
|
21 #include "../mpegvideo.h" |
88 | 22 |
23 #include <mlib_types.h> | |
24 #include <mlib_status.h> | |
25 #include <mlib_sys.h> | |
26 #include <mlib_video.h> | |
27 | |
28 | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
29 /* copy block, width 16 pixel, height 8/16 */ |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
30 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
31 static void put_pixels16_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
32 int stride, int height) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
33 { |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
34 assert(height == 16 || height == 8); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
35 if (height == 16) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
36 mlib_VideoCopyRef_U8_U8_16x16(dest, (uint8_t *)ref, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
37 else |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
38 mlib_VideoCopyRef_U8_U8_16x8 (dest, (uint8_t *)ref, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
39 } |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
40 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
41 static void put_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
42 int stride, int height) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
43 { |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
44 assert(height == 16 || height == 8); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
45 if (height == 16) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
46 mlib_VideoInterpX_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
47 else |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
48 mlib_VideoInterpX_U8_U8_16x8 (dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
49 } |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
50 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
51 static void put_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
52 int stride, int height) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
53 { |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
54 assert(height == 16 || height == 8); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
55 if (height == 16) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
56 mlib_VideoInterpY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
57 else |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
58 mlib_VideoInterpY_U8_U8_16x8 (dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
59 } |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
60 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
61 static void put_pixels16_xy2_mlib(uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
62 int stride, int height) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
63 { |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
64 assert(height == 16 || height == 8); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
65 if (height == 16) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
66 mlib_VideoInterpXY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
67 else |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
68 mlib_VideoInterpXY_U8_U8_16x8 (dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
69 } |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
70 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
71 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
72 /* copy block, width 8 pixel, height 8/16 */ |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
73 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
74 static void put_pixels8_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
75 int stride, int height) |
88 | 76 { |
77 assert(height == 16 || height == 8); | |
78 if (height == 16) | |
79 mlib_VideoCopyRef_U8_U8_8x16(dest, (uint8_t *)ref, stride); | |
80 else | |
81 mlib_VideoCopyRef_U8_U8_8x8 (dest, (uint8_t *)ref, stride); | |
82 } | |
83 | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
84 static void put_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
85 int stride, int height) |
88 | 86 { |
87 assert(height == 16 || height == 8); | |
88 if (height == 16) | |
89 mlib_VideoInterpX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); | |
90 else | |
91 mlib_VideoInterpX_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride); | |
92 } | |
93 | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
94 static void put_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
95 int stride, int height) |
88 | 96 { |
97 assert(height == 16 || height == 8); | |
98 if (height == 16) | |
99 mlib_VideoInterpY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); | |
100 else | |
101 mlib_VideoInterpY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride); | |
102 } | |
103 | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
104 static void put_pixels8_xy2_mlib(uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
105 int stride, int height) |
88 | 106 { |
107 assert(height == 16 || height == 8); | |
108 if (height == 16) | |
109 mlib_VideoInterpXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); | |
110 else | |
111 mlib_VideoInterpXY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride); | |
112 } | |
113 | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
114 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
115 /* average/merge dest+source block, width 16 pixel, height 8/16 */ |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
116 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
117 static void avg_pixels16_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
118 int stride, int height) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
119 { |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
120 assert(height == 16 || height == 8); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
121 if (height == 16) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
122 mlib_VideoCopyRefAve_U8_U8_16x16(dest, (uint8_t *)ref, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
123 else |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
124 mlib_VideoCopyRefAve_U8_U8_16x8 (dest, (uint8_t *)ref, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
125 } |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
126 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
127 static void avg_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
128 int stride, int height) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
129 { |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
130 assert(height == 16 || height == 8); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
131 if (height == 16) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
132 mlib_VideoInterpAveX_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
133 else |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
134 mlib_VideoInterpAveX_U8_U8_16x8 (dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
135 } |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
136 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
137 static void avg_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
138 int stride, int height) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
139 { |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
140 assert(height == 16 || height == 8); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
141 if (height == 16) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
142 mlib_VideoInterpAveY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
143 else |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
144 mlib_VideoInterpAveY_U8_U8_16x8 (dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
145 } |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
146 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
147 static void avg_pixels16_xy2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
148 int stride, int height) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
149 { |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
150 assert(height == 16 || height == 8); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
151 if (height == 16) |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
152 mlib_VideoInterpAveXY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
153 else |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
154 mlib_VideoInterpAveXY_U8_U8_16x8 (dest, (uint8_t *)ref, stride, stride); |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
155 } |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
156 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
157 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
158 /* average/merge dest+source block, width 8 pixel, height 8/16 */ |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
159 |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
160 static void avg_pixels8_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
161 int stride, int height) |
88 | 162 { |
163 assert(height == 16 || height == 8); | |
164 if (height == 16) | |
165 mlib_VideoCopyRefAve_U8_U8_8x16(dest, (uint8_t *)ref, stride); | |
166 else | |
167 mlib_VideoCopyRefAve_U8_U8_8x8 (dest, (uint8_t *)ref, stride); | |
168 } | |
169 | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
170 static void avg_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
171 int stride, int height) |
88 | 172 { |
173 assert(height == 16 || height == 8); | |
174 if (height == 16) | |
175 mlib_VideoInterpAveX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); | |
176 else | |
177 mlib_VideoInterpAveX_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride); | |
178 } | |
179 | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
180 static void avg_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
181 int stride, int height) |
88 | 182 { |
183 assert(height == 16 || height == 8); | |
184 if (height == 16) | |
185 mlib_VideoInterpAveY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); | |
186 else | |
187 mlib_VideoInterpAveY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride); | |
188 } | |
189 | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
190 static void avg_pixels8_xy2_mlib (uint8_t * dest, const uint8_t * ref, |
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
191 int stride, int height) |
88 | 192 { |
193 assert(height == 16 || height == 8); | |
194 if (height == 16) | |
195 mlib_VideoInterpAveXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); | |
196 else | |
197 mlib_VideoInterpAveXY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride); | |
198 } | |
199 | |
200 | |
1064 | 201 static void (*put_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size); |
929
c35f06d95e64
mlib fix patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
856
diff
changeset
|
202 |
c35f06d95e64
mlib fix patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
856
diff
changeset
|
203 |
1064 | 204 static void add_pixels_clamped_mlib(const DCTELEM *block, uint8_t *pixels, int line_size) |
88 | 205 { |
206 mlib_VideoAddBlock_U8_S16(pixels, (mlib_s16 *)block, line_size); | |
207 } | |
208 | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
209 |
730 | 210 /* XXX: those functions should be suppressed ASAP when all IDCTs are |
211 converted */ | |
1064 | 212 static void ff_idct_put_mlib(uint8_t *dest, int line_size, DCTELEM *data) |
88 | 213 { |
214 mlib_VideoIDCT8x8_S16_S16 (data, data); | |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
215 put_pixels_clamped(data, dest, line_size); |
88 | 216 } |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
217 |
1064 | 218 static void ff_idct_add_mlib(uint8_t *dest, int line_size, DCTELEM *data) |
730 | 219 { |
220 mlib_VideoIDCT8x8_S16_S16 (data, data); | |
929
c35f06d95e64
mlib fix patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
856
diff
changeset
|
221 mlib_VideoAddBlock_U8_S16(dest, (mlib_s16 *)data, line_size); |
730 | 222 } |
88 | 223 |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
224 static void ff_fdct_mlib(DCTELEM *data) |
88 | 225 { |
226 mlib_VideoDCT8x8_S16_S16 (data, data); | |
227 } | |
228 | |
1276 | 229 void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx) |
88 | 230 { |
856
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
231 c->put_pixels_tab[0][0] = put_pixels16_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
232 c->put_pixels_tab[0][1] = put_pixels16_x2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
233 c->put_pixels_tab[0][2] = put_pixels16_y2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
234 c->put_pixels_tab[0][3] = put_pixels16_xy2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
235 c->put_pixels_tab[1][0] = put_pixels8_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
236 c->put_pixels_tab[1][1] = put_pixels8_x2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
237 c->put_pixels_tab[1][2] = put_pixels8_y2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
238 c->put_pixels_tab[1][3] = put_pixels8_xy2_mlib; |
88 | 239 |
856
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
240 c->avg_pixels_tab[0][0] = avg_pixels16_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
241 c->avg_pixels_tab[0][1] = avg_pixels16_x2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
242 c->avg_pixels_tab[0][2] = avg_pixels16_y2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
243 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
244 c->avg_pixels_tab[1][0] = avg_pixels8_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
245 c->avg_pixels_tab[1][1] = avg_pixels8_x2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
246 c->avg_pixels_tab[1][2] = avg_pixels8_y2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
247 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
248 |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
249 c->put_no_rnd_pixels_tab[0][0] = put_pixels16_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
250 c->put_no_rnd_pixels_tab[1][0] = put_pixels8_mlib; |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
251 |
3c6df37177dd
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
768
diff
changeset
|
252 c->add_pixels_clamped = add_pixels_clamped_mlib; |
929
c35f06d95e64
mlib fix patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
856
diff
changeset
|
253 put_pixels_clamped = c->put_pixels_clamped; |
88 | 254 } |
628
f596db4aa871
sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents:
429
diff
changeset
|
255 |
f596db4aa871
sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents:
429
diff
changeset
|
256 void MPV_common_init_mlib(MpegEncContext *s) |
f596db4aa871
sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents:
429
diff
changeset
|
257 { |
730 | 258 int i; |
259 | |
628
f596db4aa871
sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents:
429
diff
changeset
|
260 if(s->avctx->dct_algo==FF_DCT_AUTO || s->avctx->dct_algo==FF_DCT_MLIB){ |
1276 | 261 s->dsp.fdct = ff_fdct_mlib; |
628
f596db4aa871
sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents:
429
diff
changeset
|
262 } |
730 | 263 |
735
b4bf95260ffe
16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents:
730
diff
changeset
|
264 if(s->avctx->idct_algo==FF_IDCT_AUTO || s->avctx->idct_algo==FF_IDCT_MLIB){ |
1276 | 265 s->dsp.idct_put= ff_idct_put_mlib; |
266 s->dsp.idct_add= ff_idct_add_mlib; | |
267 s->dsp.idct_permutation_type= FF_NO_IDCT_PERM; | |
730 | 268 } |
628
f596db4aa871
sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents:
429
diff
changeset
|
269 } |