]> git.sesse.net Git - ffmpeg/blobdiff - libswscale/swscale_altivec_template.c
Remove useless casting in asm "m" operand.
[ffmpeg] / libswscale / swscale_altivec_template.c
index 794533d5d80f83884c4a87cb8dde4cc6db9fd1a3..a008b966e8fd437e6c62319526b37c94b1fd191d 100644 (file)
@@ -2,7 +2,7 @@
  * AltiVec-enhanced yuv2yuvX
  *
  * Copyright (C) 2004 Romain Dolbeau <romain@dolbeau.org>
- * based on the equivalent C code in "postproc/swscale.c"
+ * based on the equivalent C code in swscale.c
  *
  * This file is part of FFmpeg.
  *
@@ -27,7 +27,7 @@ static inline void
 altivec_packIntArrayToCharArray(int *val, uint8_t* dest, int dstW) {
     register int i;
     vector unsigned int altivec_vectorShiftInt19 =
-        vec_add(vec_splat_u32(10),vec_splat_u32(9));
+        vec_add(vec_splat_u32(10), vec_splat_u32(9));
     if ((unsigned long)dest % 16) {
         /* badly aligned store, we force store alignment */
         /* and will handle load misalignment on val w/ vec_perm */
@@ -46,10 +46,10 @@ altivec_packIntArrayToCharArray(int *val, uint8_t* dest, int dstW) {
             vector signed int v3 = vec_ld(offset + 32, val);
             vector signed int v4 = vec_ld(offset + 48, val);
             vector signed int v5 = vec_ld(offset + 64, val);
-            vector signed int v12 = vec_perm(v1,v2,perm1);
-            vector signed int v23 = vec_perm(v2,v3,perm1);
-            vector signed int v34 = vec_perm(v3,v4,perm1);
-            vector signed int v45 = vec_perm(v4,v5,perm1);
+            vector signed int v12 = vec_perm(v1, v2, perm1);
+            vector signed int v23 = vec_perm(v2, v3, perm1);
+            vector signed int v34 = vec_perm(v3, v4, perm1);
+            vector signed int v45 = vec_perm(v4, v5, perm1);
 
             vector signed int vA = vec_sra(v12, altivec_vectorShiftInt19);
             vector signed int vB = vec_sra(v23, altivec_vectorShiftInt19);
@@ -137,7 +137,7 @@ yuv2yuvX_altivec_real(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
                 val[i] += lumSrc[j][i] * lumFilter[j];
             }
         }
-        altivec_packIntArrayToCharArray(val,dest,dstW);
+        altivec_packIntArrayToCharArray(val, dest, dstW);
     }
     if (uDest != 0) {
         int  __attribute__ ((aligned (16))) u[chrDstW];
@@ -203,8 +203,8 @@ yuv2yuvX_altivec_real(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
                 v[i] += chrSrc[j][i + 2048] * chrFilter[j];
             }
         }
-        altivec_packIntArrayToCharArray(u,uDest,chrDstW);
-        altivec_packIntArrayToCharArray(v,vDest,chrDstW);
+        altivec_packIntArrayToCharArray(u, uDest, chrDstW);
+        altivec_packIntArrayToCharArray(v, vDest, chrDstW);
     }
 }
 
@@ -220,7 +220,7 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int
             for (j=0; j<filterSize; j++) {
                 val += ((int)src[srcPos + j])*filter[filterSize*i + j];
             }
-            dst[i] = av_clip(val>>7, 0, (1<<15)-1);
+            dst[i] = FFMIN(val>>7, (1<<15)-1);
         }
     }
     else
@@ -245,21 +245,21 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int
         src_v = vec_mergeh(src_v, (vector signed short)vzero);
 
         filter_v = vec_ld(i << 3, filter);
-        // the 3 above is 2 (filterSize == 4) + 1 (sizeof(short) == 2)
+        // The 3 above is 2 (filterSize == 4) + 1 (sizeof(short) == 2).
 
-        // the neat trick : we only care for half the elements,
+        // The neat trick: We only care for half the elements,
         // high or low depending on (i<<3)%16 (it's 0 or 8 here),
-        // and we're going to use vec_mule, so we chose
-        // carefully how to "unpack" the elements into the even slots
+        // and we're going to use vec_mule, so we choose
+        // carefully how to "unpack" the elements into the even slots.
         if ((i << 3) % 16)
-            filter_v = vec_mergel(filter_v,(vector signed short)vzero);
+            filter_v = vec_mergel(filter_v, (vector signed short)vzero);
         else
-            filter_v = vec_mergeh(filter_v,(vector signed short)vzero);
+            filter_v = vec_mergeh(filter_v, (vector signed short)vzero);
 
         val_vEven = vec_mule(src_v, filter_v);
         val_s = vec_sums(val_vEven, vzero);
         vec_st(val_s, 0, tempo);
-        dst[i] = av_clip(tempo[3]>>7, 0, (1<<15)-1);
+        dst[i] = FFMIN(tempo[3]>>7, (1<<15)-1);
     }
     }
     break;
@@ -286,7 +286,7 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int
         val_v = vec_msums(src_v, filter_v, (vector signed int)vzero);
         val_s = vec_sums(val_v, vzero);
         vec_st(val_s, 0, tempo);
-        dst[i] = av_clip(tempo[3]>>7, 0, (1<<15)-1);
+        dst[i] = FFMIN(tempo[3]>>7, (1<<15)-1);
     }
     }
     break;
@@ -315,7 +315,7 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int
             vector signed int val_s = vec_sums(val_v, vzero);
 
             vec_st(val_s, 0, tempo);
-            dst[i] = av_clip(tempo[3]>>7, 0, (1<<15)-1);
+            dst[i] = FFMIN(tempo[3]>>7, (1<<15)-1);
         }
     }
     break;
@@ -354,7 +354,7 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int
             src_v0 = src_v1;
         }
 
-        if (j < (filterSize-7)) {
+        if (j < filterSize-7) {
             // loading src_v0 is useless, it's already done above
             //vector unsigned char src_v0 = vec_ld(srcPos + j, src);
             vector unsigned char src_v1, src_vF;
@@ -377,7 +377,7 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int
         val_s = vec_sums(val_v, vzero);
 
         vec_st(val_s, 0, tempo);
-        dst[i] = av_clip(tempo[3]>>7, 0, (1<<15)-1);
+        dst[i] = FFMIN(tempo[3]>>7, (1<<15)-1);
     }
 
     }
@@ -387,7 +387,7 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int
 static inline int yv12toyuy2_unscaled_altivec(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
                                               int srcSliceH, uint8_t* dstParam[], int dstStride_a[]) {
     uint8_t *dst=dstParam[0] + dstStride_a[0]*srcSliceY;
-    // yv12toyuy2( src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0] );
+    // yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
     uint8_t *ysrc = src[0];
     uint8_t *usrc = src[1];
     uint8_t *vsrc = src[2];
@@ -401,16 +401,16 @@ static inline int yv12toyuy2_unscaled_altivec(SwsContext *c, uint8_t* src[], int
     register unsigned int y;
 
     if (width&15) {
-        yv12toyuy2( ysrc, usrc, vsrc, dst,c->srcW,srcSliceH, lumStride, chromStride, dstStride);
+        yv12toyuy2(ysrc, usrc, vsrc, dst, c->srcW, srcSliceH, lumStride, chromStride, dstStride);
         return srcSliceH;
     }
 
-    /* this code assume:
+    /* This code assumes:
 
     1) dst is 16 bytes-aligned
     2) dstStride is a multiple of 16
     3) width is a multiple of 16
-    4) lum&chrom stride are multiple of 8
+    4) lum & chrom stride are multiples of 8
     */
 
     for (y=0; y<height; y++) {
@@ -450,7 +450,7 @@ static inline int yv12toyuy2_unscaled_altivec(SwsContext *c, uint8_t* src[], int
             vec_st(v_yuy2_0, (i << 1), dst);
             vec_st(v_yuy2_1, (i << 1) + 16, dst);
         }
-        if ( (y&(vertLumPerChroma-1))==(vertLumPerChroma-1) ) {
+        if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) {
             usrc += chromStride;
             vsrc += chromStride;
         }
@@ -464,7 +464,7 @@ static inline int yv12toyuy2_unscaled_altivec(SwsContext *c, uint8_t* src[], int
 static inline int yv12touyvy_unscaled_altivec(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
                                               int srcSliceH, uint8_t* dstParam[], int dstStride_a[]) {
     uint8_t *dst=dstParam[0] + dstStride_a[0]*srcSliceY;
-    // yv12toyuy2( src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0] );
+    // yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
     uint8_t *ysrc = src[0];
     uint8_t *usrc = src[1];
     uint8_t *vsrc = src[2];
@@ -478,16 +478,16 @@ static inline int yv12touyvy_unscaled_altivec(SwsContext *c, uint8_t* src[], int
     register unsigned int y;
 
     if (width&15) {
-        yv12touyvy( ysrc, usrc, vsrc, dst,c->srcW,srcSliceH, lumStride, chromStride, dstStride);
+        yv12touyvy(ysrc, usrc, vsrc, dst, c->srcW, srcSliceH, lumStride, chromStride, dstStride);
         return srcSliceH;
     }
 
-    /* this code assume:
+    /* This code assumes:
 
     1) dst is 16 bytes-aligned
     2) dstStride is a multiple of 16
     3) width is a multiple of 16
-    4) lum&chrom stride are multiple of 8
+    4) lum & chrom stride are multiples of 8
     */
 
     for (y=0; y<height; y++) {
@@ -527,7 +527,7 @@ static inline int yv12touyvy_unscaled_altivec(SwsContext *c, uint8_t* src[], int
             vec_st(v_uyvy_0, (i << 1), dst);
             vec_st(v_uyvy_1, (i << 1) + 16, dst);
         }
-        if ( (y&(vertLumPerChroma-1))==(vertLumPerChroma-1) ) {
+        if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) {
             usrc += chromStride;
             vsrc += chromStride;
         }