Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > VSs > VSs__H264__App
diff libavcodec/ppc/util_altivec.h @ 2:897f711a7157
rearrange to work with autoconf
| author | Nina Engelhardt <nengel@mailbox.tu-berlin.de> |
|---|---|
| date | Tue, 25 Sep 2012 15:55:33 +0200 |
| parents | |
| children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libavcodec/ppc/util_altivec.h Tue Sep 25 15:55:33 2012 +0200 1.3 @@ -0,0 +1,105 @@ 1.4 +/* 1.5 + * This file is part of FFmpeg. 1.6 + * 1.7 + * FFmpeg is free software; you can redistribute it and/or 1.8 + * modify it under the terms of the GNU Lesser General Public 1.9 + * License as published by the Free Software Foundation; either 1.10 + * version 2.1 of the License, or (at your option) any later version. 1.11 + * 1.12 + * FFmpeg is distributed in the hope that it will be useful, 1.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 1.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1.15 + * Lesser General Public License for more details. 1.16 + * 1.17 + * You should have received a copy of the GNU Lesser General Public 1.18 + * License along with FFmpeg; if not, write to the Free Software 1.19 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 1.20 + */ 1.21 + 1.22 +/** 1.23 + * @file 1.24 + * Contains misc utility macros and inline functions 1.25 + */ 1.26 + 1.27 +#ifndef AVCODEC_PPC_UTIL_ALTIVEC_H 1.28 +#define AVCODEC_PPC_UTIL_ALTIVEC_H 1.29 + 1.30 +#include <stdint.h> 1.31 + 1.32 +#include "config.h" 1.33 + 1.34 +#if HAVE_ALTIVEC_H 1.35 +#include <altivec.h> 1.36 +#endif 1.37 + 1.38 +// used to build registers permutation vectors (vcprm) 1.39 +// the 's' are for words in the _s_econd vector 1.40 +#define WORD_0 0x00,0x01,0x02,0x03 1.41 +#define WORD_1 0x04,0x05,0x06,0x07 1.42 +#define WORD_2 0x08,0x09,0x0a,0x0b 1.43 +#define WORD_3 0x0c,0x0d,0x0e,0x0f 1.44 +#define WORD_s0 0x10,0x11,0x12,0x13 1.45 +#define WORD_s1 0x14,0x15,0x16,0x17 1.46 +#define WORD_s2 0x18,0x19,0x1a,0x1b 1.47 +#define WORD_s3 0x1c,0x1d,0x1e,0x1f 1.48 + 1.49 +#define vcprm(a,b,c,d) (const vector unsigned char){WORD_ ## a, WORD_ ## b, WORD_ ## c, WORD_ ## d} 1.50 +#define vcii(a,b,c,d) (const vector float){FLOAT_ ## a, FLOAT_ ## b, FLOAT_ ## c, FLOAT_ ## d} 1.51 + 1.52 +// vcprmle is used to keep the same index as in the SSE version. 1.53 +// it's the same as vcprm, with the index inversed 1.54 +// ('le' is Little Endian) 1.55 +#define vcprmle(a,b,c,d) vcprm(d,c,b,a) 1.56 + 1.57 +// used to build inverse/identity vectors (vcii) 1.58 +// n is _n_egative, p is _p_ositive 1.59 +#define FLOAT_n -1. 1.60 +#define FLOAT_p 1. 1.61 + 1.62 + 1.63 +// Transpose 8x8 matrix of 16-bit elements (in-place) 1.64 +#define TRANSPOSE8(a,b,c,d,e,f,g,h) \ 1.65 +do { \ 1.66 + vector signed short A1, B1, C1, D1, E1, F1, G1, H1; \ 1.67 + vector signed short A2, B2, C2, D2, E2, F2, G2, H2; \ 1.68 + \ 1.69 + A1 = vec_mergeh (a, e); \ 1.70 + B1 = vec_mergel (a, e); \ 1.71 + C1 = vec_mergeh (b, f); \ 1.72 + D1 = vec_mergel (b, f); \ 1.73 + E1 = vec_mergeh (c, g); \ 1.74 + F1 = vec_mergel (c, g); \ 1.75 + G1 = vec_mergeh (d, h); \ 1.76 + H1 = vec_mergel (d, h); \ 1.77 + \ 1.78 + A2 = vec_mergeh (A1, E1); \ 1.79 + B2 = vec_mergel (A1, E1); \ 1.80 + C2 = vec_mergeh (B1, F1); \ 1.81 + D2 = vec_mergel (B1, F1); \ 1.82 + E2 = vec_mergeh (C1, G1); \ 1.83 + F2 = vec_mergel (C1, G1); \ 1.84 + G2 = vec_mergeh (D1, H1); \ 1.85 + H2 = vec_mergel (D1, H1); \ 1.86 + \ 1.87 + a = vec_mergeh (A2, E2); \ 1.88 + b = vec_mergel (A2, E2); \ 1.89 + c = vec_mergeh (B2, F2); \ 1.90 + d = vec_mergel (B2, F2); \ 1.91 + e = vec_mergeh (C2, G2); \ 1.92 + f = vec_mergel (C2, G2); \ 1.93 + g = vec_mergeh (D2, H2); \ 1.94 + h = vec_mergel (D2, H2); \ 1.95 +} while (0) 1.96 + 1.97 + 1.98 +/** \brief loads unaligned vector \a *src with offset \a offset 1.99 + and returns it */ 1.100 +static inline vector unsigned char unaligned_load(int offset, uint8_t *src) 1.101 +{ 1.102 + register vector unsigned char first = vec_ld(offset, src); 1.103 + register vector unsigned char second = vec_ld(offset+15, src); 1.104 + register vector unsigned char mask = vec_lvsl(offset, src); 1.105 + return vec_perm(first, second, mask); 1.106 +} 1.107 + 1.108 +#endif /* AVCODEC_PPC_UTIL_ALTIVEC_H */
