OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2001 Michel Lespinasse | 2 * Copyright (c) 2001 Michel Lespinasse |
3 * | 3 * |
4 * This file is part of FFmpeg. | 4 * This file is part of FFmpeg. |
5 * | 5 * |
6 * FFmpeg is free software; you can redistribute it and/or | 6 * FFmpeg is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Lesser General Public | 7 * modify it under the terms of the GNU Lesser General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2.1 of the License, or (at your option) any later version. | 9 * version 2.1 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 #include <stdlib.h> /* malloc(), free() */ | 38 #include <stdlib.h> /* malloc(), free() */ |
39 #include <string.h> | 39 #include <string.h> |
40 #include "config.h" | 40 #include "config.h" |
41 #if HAVE_ALTIVEC_H | 41 #if HAVE_ALTIVEC_H |
42 #include <altivec.h> | 42 #include <altivec.h> |
43 #endif | 43 #endif |
44 #include "libavcodec/dsputil.h" | 44 #include "libavcodec/dsputil.h" |
45 #include "types_altivec.h" | 45 #include "types_altivec.h" |
46 #include "dsputil_ppc.h" | 46 #include "dsputil_ppc.h" |
| 47 #include "dsputil_altivec.h" |
47 | 48 |
48 #define IDCT_HALF \ | 49 #define IDCT_HALF \ |
49 /* 1st stage */ \ | 50 /* 1st stage */ \ |
50 t1 = vec_mradds (a1, vx7, vx1 ); \ | 51 t1 = vec_mradds (a1, vx7, vx1 ); \ |
51 t8 = vec_mradds (a1, vx1, vec_subs (zero, vx7)); \ | 52 t8 = vec_mradds (a1, vx1, vec_subs (zero, vx7)); \ |
52 t7 = vec_mradds (a2, vx5, vx3); \ | 53 t7 = vec_mradds (a2, vx5, vx3); \ |
53 t3 = vec_mradds (ma2, vx3, vx5); \ | 54 t3 = vec_mradds (ma2, vx3, vx5); \ |
54 \ | 55 \ |
55 /* 2nd stage */ \ | 56 /* 2nd stage */ \ |
56 t5 = vec_adds (vx0, vx4); \ | 57 t5 = vec_adds (vx0, vx4); \ |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 152 |
152 | 153 |
153 static const vec_s16 constants[5] = { | 154 static const vec_s16 constants[5] = { |
154 {23170, 13573, 6518, 21895, -23170, -21895, 32, 31}, | 155 {23170, 13573, 6518, 21895, -23170, -21895, 32, 31}, |
155 {16384, 22725, 21407, 19266, 16384, 19266, 21407, 22725}, | 156 {16384, 22725, 21407, 19266, 16384, 19266, 21407, 22725}, |
156 {22725, 31521, 29692, 26722, 22725, 26722, 29692, 31521}, | 157 {22725, 31521, 29692, 26722, 22725, 26722, 29692, 31521}, |
157 {21407, 29692, 27969, 25172, 21407, 25172, 27969, 29692}, | 158 {21407, 29692, 27969, 25172, 21407, 25172, 27969, 29692}, |
158 {19266, 26722, 25172, 22654, 19266, 22654, 25172, 26722} | 159 {19266, 26722, 25172, 22654, 19266, 22654, 25172, 26722} |
159 }; | 160 }; |
160 | 161 |
161 void idct_put_altivec(uint8_t* dest, int stride, vec_s16* block) | 162 void idct_put_altivec(uint8_t* dest, int stride, int16_t *blk) |
162 { | 163 { |
163 POWERPC_PERF_DECLARE(altivec_idct_put_num, 1); | 164 POWERPC_PERF_DECLARE(altivec_idct_put_num, 1); |
| 165 vec_s16 *block = (vec_s16*)blk; |
164 vec_u8 tmp; | 166 vec_u8 tmp; |
165 | 167 |
166 #if CONFIG_POWERPC_PERF | 168 #if CONFIG_POWERPC_PERF |
167 POWERPC_PERF_START_COUNT(altivec_idct_put_num, 1); | 169 POWERPC_PERF_START_COUNT(altivec_idct_put_num, 1); |
168 #endif | 170 #endif |
169 IDCT | 171 IDCT |
170 | 172 |
171 #define COPY(dest,src) \ | 173 #define COPY(dest,src) \ |
172 tmp = vec_packsu (src, src); \ | 174 tmp = vec_packsu (src, src); \ |
173 vec_ste ((vec_u32)tmp, 0, (unsigned int *)dest); \ | 175 vec_ste ((vec_u32)tmp, 0, (unsigned int *)dest); \ |
174 vec_ste ((vec_u32)tmp, 4, (unsigned int *)dest); | 176 vec_ste ((vec_u32)tmp, 4, (unsigned int *)dest); |
175 | 177 |
176 COPY (dest, vx0) dest += stride; | 178 COPY (dest, vx0) dest += stride; |
177 COPY (dest, vx1) dest += stride; | 179 COPY (dest, vx1) dest += stride; |
178 COPY (dest, vx2) dest += stride; | 180 COPY (dest, vx2) dest += stride; |
179 COPY (dest, vx3) dest += stride; | 181 COPY (dest, vx3) dest += stride; |
180 COPY (dest, vx4) dest += stride; | 182 COPY (dest, vx4) dest += stride; |
181 COPY (dest, vx5) dest += stride; | 183 COPY (dest, vx5) dest += stride; |
182 COPY (dest, vx6) dest += stride; | 184 COPY (dest, vx6) dest += stride; |
183 COPY (dest, vx7) | 185 COPY (dest, vx7) |
184 | 186 |
185 POWERPC_PERF_STOP_COUNT(altivec_idct_put_num, 1); | 187 POWERPC_PERF_STOP_COUNT(altivec_idct_put_num, 1); |
186 } | 188 } |
187 | 189 |
188 void idct_add_altivec(uint8_t* dest, int stride, vec_s16* block) | 190 void idct_add_altivec(uint8_t* dest, int stride, int16_t *blk) |
189 { | 191 { |
190 POWERPC_PERF_DECLARE(altivec_idct_add_num, 1); | 192 POWERPC_PERF_DECLARE(altivec_idct_add_num, 1); |
| 193 vec_s16 *block = (vec_s16*)blk; |
191 vec_u8 tmp; | 194 vec_u8 tmp; |
192 vec_s16 tmp2, tmp3; | 195 vec_s16 tmp2, tmp3; |
193 vec_u8 perm0; | 196 vec_u8 perm0; |
194 vec_u8 perm1; | 197 vec_u8 perm1; |
195 vec_u8 p0, p1, p; | 198 vec_u8 p0, p1, p; |
196 | 199 |
197 #if CONFIG_POWERPC_PERF | 200 #if CONFIG_POWERPC_PERF |
198 POWERPC_PERF_START_COUNT(altivec_idct_add_num, 1); | 201 POWERPC_PERF_START_COUNT(altivec_idct_add_num, 1); |
199 #endif | 202 #endif |
200 | 203 |
(...skipping 19 matching lines...) Expand all Loading... |
220 ADD (dest, vx2, perm0) dest += stride; | 223 ADD (dest, vx2, perm0) dest += stride; |
221 ADD (dest, vx3, perm1) dest += stride; | 224 ADD (dest, vx3, perm1) dest += stride; |
222 ADD (dest, vx4, perm0) dest += stride; | 225 ADD (dest, vx4, perm0) dest += stride; |
223 ADD (dest, vx5, perm1) dest += stride; | 226 ADD (dest, vx5, perm1) dest += stride; |
224 ADD (dest, vx6, perm0) dest += stride; | 227 ADD (dest, vx6, perm0) dest += stride; |
225 ADD (dest, vx7, perm1) | 228 ADD (dest, vx7, perm1) |
226 | 229 |
227 POWERPC_PERF_STOP_COUNT(altivec_idct_add_num, 1); | 230 POWERPC_PERF_STOP_COUNT(altivec_idct_add_num, 1); |
228 } | 231 } |
229 | 232 |
OLD | NEW |