]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ppc/util_altivec.h
options: set minimum for "threads" to zero
[ffmpeg] / libavcodec / ppc / util_altivec.h
index a534df9bef8148e92579514ef36ac729d64a77a2..19ea9626db80fbd41c50014b0b6dd48a996d94fb 100644 (file)
@@ -1,37 +1,39 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /**
- * @file util_altivec.h
+ * @file
  * Contains misc utility macros and inline functions
  */
 
-#ifndef FFMPEG_UTIL_ALTIVEC_H
-#define FFMPEG_UTIL_ALTIVEC_H
+#ifndef AVCODEC_PPC_UTIL_ALTIVEC_H
+#define AVCODEC_PPC_UTIL_ALTIVEC_H
 
 #include <stdint.h>
 
 #include "config.h"
 
-#ifdef HAVE_ALTIVEC_H
+#if HAVE_ALTIVEC_H
 #include <altivec.h>
 #endif
 
+#include "types_altivec.h"
+
 // used to build registers permutation vectors (vcprm)
 // the 's' are for words in the _s_econd vector
 #define WORD_0 0x00,0x01,0x02,0x03
 #define WORD_s2 0x18,0x19,0x1a,0x1b
 #define WORD_s3 0x1c,0x1d,0x1e,0x1f
 
-#ifdef __APPLE_CC__
-#define vcprm(a,b,c,d) (const vector unsigned char)(WORD_ ## a, WORD_ ## b, WORD_ ## c, WORD_ ## d)
-#else
 #define vcprm(a,b,c,d) (const vector unsigned char){WORD_ ## a, WORD_ ## b, WORD_ ## c, WORD_ ## d}
-#endif
+#define vcii(a,b,c,d) (const vector float){FLOAT_ ## a, FLOAT_ ## b, FLOAT_ ## c, FLOAT_ ## d}
 
 // vcprmle is used to keep the same index as in the SSE version.
 // it's the same as vcprm, with the index inversed
 #define FLOAT_p 1.
 
 
-#ifdef __APPLE_CC__
-#define vcii(a,b,c,d) (const vector float)(FLOAT_ ## a, FLOAT_ ## b, FLOAT_ ## c, FLOAT_ ## d)
-#else
-#define vcii(a,b,c,d) (const vector float){FLOAT_ ## a, FLOAT_ ## b, FLOAT_ ## c, FLOAT_ ## d}
-#endif
-
 // Transpose 8x8 matrix of 16-bit elements (in-place)
 #define TRANSPOSE8(a,b,c,d,e,f,g,h) \
 do { \
@@ -101,7 +94,7 @@ do { \
 } while (0)
 
 
-/** \brief loads unaligned vector \a *src with offset \a offset
+/** @brief loads unaligned vector @a *src with offset @a offset
     and returns it */
 static inline vector unsigned char unaligned_load(int offset, uint8_t *src)
 {
@@ -111,4 +104,15 @@ static inline vector unsigned char unaligned_load(int offset, uint8_t *src)
     return vec_perm(first, second, mask);
 }
 
-#endif /* FFMPEG_UTIL_ALTIVEC_H */
+/**
+ * loads vector known misalignment
+ * @param perm_vec the align permute vector to combine the two loads from lvsl
+ */
+static inline vec_u8 load_with_perm_vec(int offset, uint8_t *src, vec_u8 perm_vec)
+{
+    vec_u8 a = vec_ld(offset, src);
+    vec_u8 b = vec_ld(offset+15, src);
+    return vec_perm(a, b, perm_vec);
+}
+
+#endif /* AVCODEC_PPC_UTIL_ALTIVEC_H */