]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ppc/vc1dsp_altivec.c
ppc: Include string.h for memset
[ffmpeg] / libavcodec / ppc / vc1dsp_altivec.c
index 05edb53b7c7248ffb07cd1ffa9fad48f8485d57c..6c110dba475cab24ae20cd022934baf63e0109f5 100644 (file)
@@ -2,29 +2,28 @@
  * VC-1 and WMV3 decoder - DSP functions AltiVec-optimized
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * 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
  */
 
+#include "libavutil/ppc/types_altivec.h"
+#include "libavutil/ppc/util_altivec.h"
 #include "libavcodec/dsputil.h"
 #include "libavcodec/vc1dsp.h"
 
-#include "util_altivec.h"
-#include "dsputil_altivec.h"
-
 // main steps of 8x8 transform
 #define STEP8(s0, s1, s2, s3, s4, s5, s6, s7, vec_rnd) \
 do { \
@@ -130,8 +129,7 @@ do { \
 
 /** Do inverse transform on 8x8 block
 */
-static void vc1_inv_trans_8x8_altivec(DCTELEM block[64],
-                                      int sign, int rangered)
+static void vc1_inv_trans_8x8_altivec(DCTELEM block[64])
 {
     vector signed short src0, src1, src2, src3, src4, src5, src6, src7;
     vector signed int s0, s1, s2, s3, s4, s5, s6, s7;
@@ -145,9 +143,6 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64],
     const vector unsigned int vec_2 = vec_splat_u32(2);
     const vector  signed int vec_1s = vec_splat_s32(1);
     const vector unsigned int vec_1 = vec_splat_u32(1);
-    const vector unsigned short rangered_shift = vec_splat_u16(1);
-    const vector   signed short signed_bias = vec_sl(vec_splat_s16(4),
-                                                     vec_splat_u16(4));
 
     src0 = vec_ld(  0, block);
     src1 = vec_ld( 16, block);
@@ -217,27 +212,6 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64],
     src6 = vec_pack(sE, s6);
     src7 = vec_pack(sF, s7);
 
-    if (rangered) {
-        if (!sign) {
-            src0 = vec_sub(src0, signed_bias);
-            src1 = vec_sub(src1, signed_bias);
-            src2 = vec_sub(src2, signed_bias);
-            src3 = vec_sub(src3, signed_bias);
-            src4 = vec_sub(src4, signed_bias);
-            src5 = vec_sub(src5, signed_bias);
-            src6 = vec_sub(src6, signed_bias);
-            src7 = vec_sub(src7, signed_bias);
-        }
-        src0 = vec_sl(src0, rangered_shift);
-        src1 = vec_sl(src1, rangered_shift);
-        src2 = vec_sl(src2, rangered_shift);
-        src3 = vec_sl(src3, rangered_shift);
-        src4 = vec_sl(src4, rangered_shift);
-        src5 = vec_sl(src5, rangered_shift);
-        src6 = vec_sl(src6, rangered_shift);
-        src7 = vec_sl(src7, rangered_shift);
-    }
-
     vec_st(src0,  0, block);
     vec_st(src1, 16, block);
     vec_st(src2, 32, block);
@@ -248,36 +222,6 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64],
     vec_st(src7,112, block);
 }
 
-static void vc1_inv_trans_8x8_add_altivec(uint8_t *dest, int stride, DCTELEM *b)
-{
-    vc1_inv_trans_8x8_altivec(b, 0, 0);
-    ff_add_pixels_clamped_c(b, dest, stride);
-}
-
-static void vc1_inv_trans_8x8_put_signed_altivec(uint8_t *dest, int stride, DCTELEM *b)
-{
-    vc1_inv_trans_8x8_altivec(b, 1, 0);
-    ff_put_signed_pixels_clamped_c(b, dest, stride);
-}
-
-static void vc1_inv_trans_8x8_put_signed_rangered_altivec(uint8_t *dest, int stride, DCTELEM *b)
-{
-    vc1_inv_trans_8x8_altivec(b, 1, 1);
-    ff_put_signed_pixels_clamped_c(b, dest, stride);
-}
-
-static void vc1_inv_trans_8x8_put_altivec(uint8_t *dest, int stride, DCTELEM *b)
-{
-    vc1_inv_trans_8x8_altivec(b, 0, 0);
-    ff_put_pixels_clamped_c(b, dest, stride);
-}
-
-static void vc1_inv_trans_8x8_put_rangered_altivec(uint8_t *dest, int stride, DCTELEM *b)
-{
-    vc1_inv_trans_8x8_altivec(b, 0, 1);
-    ff_put_pixels_clamped_c(b, dest, stride);
-}
-
 /** Do inverse transform on 8x4 part of block
 */
 static void vc1_inv_trans_8x4_altivec(uint8_t *dest, int stride, DCTELEM *block)
@@ -381,13 +325,13 @@ static void vc1_inv_trans_8x4_altivec(uint8_t *dest, int stride, DCTELEM *block)
 
 #define OP_U8_ALTIVEC                          PUT_OP_U8_ALTIVEC
 #define PREFIX_no_rnd_vc1_chroma_mc8_altivec   put_no_rnd_vc1_chroma_mc8_altivec
-#include "h264_template_altivec.c"
+#include "h264_altivec_template.c"
 #undef OP_U8_ALTIVEC
 #undef PREFIX_no_rnd_vc1_chroma_mc8_altivec
 
 #define OP_U8_ALTIVEC                          AVG_OP_U8_ALTIVEC
 #define PREFIX_no_rnd_vc1_chroma_mc8_altivec   avg_no_rnd_vc1_chroma_mc8_altivec
-#include "h264_template_altivec.c"
+#include "h264_altivec_template.c"
 #undef OP_U8_ALTIVEC
 #undef PREFIX_no_rnd_vc1_chroma_mc8_altivec
 
@@ -396,11 +340,7 @@ void ff_vc1dsp_init_altivec(VC1DSPContext* dsp)
     if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC))
         return;
 
-    dsp->vc1_inv_trans_8x8_add = vc1_inv_trans_8x8_add_altivec;
-    dsp->vc1_inv_trans_8x8_put_signed[0] = vc1_inv_trans_8x8_put_signed_altivec;
-    dsp->vc1_inv_trans_8x8_put_signed[1] = vc1_inv_trans_8x8_put_signed_rangered_altivec;
-    dsp->vc1_inv_trans_8x8_put[0] = vc1_inv_trans_8x8_put_altivec;
-    dsp->vc1_inv_trans_8x8_put[1] = vc1_inv_trans_8x8_put_rangered_altivec;
+    dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_altivec;
     dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_altivec;
     dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec;
     dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_altivec;