clean up #ifdef HAVE_IPP
[libav.git] / libavcodec / armv4l / dsputil_arm.c
index 8608064..8a9347d 100644 (file)
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "../dsputil.h"
@@ -22,9 +22,7 @@
 #include "ipp.h"
 #endif
 
-#ifdef HAVE_IWMMXT
 extern void dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx);
-#endif
 
 extern void j_rev_dct_ARM(DCTELEM *data);
 extern void simple_idct_ARM(DCTELEM *data);
@@ -43,41 +41,13 @@ void put_no_rnd_pixels8_y2_arm(uint8_t *block, const uint8_t *pixels, int line_s
 void put_no_rnd_pixels8_xy2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
 
 void put_pixels16_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
-static void put_pixels16_x2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    put_pixels8_x2_arm(block, pixels, line_size, h);
-    put_pixels8_x2_arm(block + 8, pixels + 8, line_size, h);
-}
-
-static void put_pixels16_y2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    put_pixels8_y2_arm(block, pixels, line_size, h);
-    put_pixels8_y2_arm(block + 8, pixels + 8, line_size, h);
-}
 
-static void put_pixels16_xy2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    put_pixels8_xy2_arm(block, pixels, line_size, h);
-    put_pixels8_xy2_arm(block + 8, pixels + 8, line_size, h);
-}
-
-static void put_no_rnd_pixels16_x2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    put_no_rnd_pixels8_x2_arm(block, pixels, line_size, h);
-    put_no_rnd_pixels8_x2_arm(block + 8, pixels + 8, line_size, h);
-}
-
-static void put_no_rnd_pixels16_y2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    put_no_rnd_pixels8_y2_arm(block, pixels, line_size, h);
-    put_no_rnd_pixels8_y2_arm(block + 8, pixels + 8, line_size, h);
-}
-
-static void put_no_rnd_pixels16_xy2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    put_no_rnd_pixels8_xy2_arm(block, pixels, line_size, h);
-    put_no_rnd_pixels8_xy2_arm(block + 8, pixels + 8, line_size, h);
-}
+CALL_2X_PIXELS(put_pixels16_x2_arm , put_pixels8_x2_arm , 8)
+CALL_2X_PIXELS(put_pixels16_y2_arm , put_pixels8_y2_arm , 8)
+CALL_2X_PIXELS(put_pixels16_xy2_arm, put_pixels8_xy2_arm, 8)
+CALL_2X_PIXELS(put_no_rnd_pixels16_x2_arm , put_no_rnd_pixels8_x2_arm , 8)
+CALL_2X_PIXELS(put_no_rnd_pixels16_y2_arm , put_no_rnd_pixels8_y2_arm , 8)
+CALL_2X_PIXELS(put_no_rnd_pixels16_xy2_arm, put_no_rnd_pixels8_xy2_arm, 8)
 
 static void add_pixels_clamped_ARM(short *block, unsigned char *dest, int line_size)
 {
@@ -166,10 +136,9 @@ static void add_pixels_clamped_ARM(short *block, unsigned char *dest, int line_s
                   /* [F] */
                   "add %1, %1, %2 \n\t"
                   "bne 1b \n\t"
-                  :
-                  : "r"(block),
-                    "r"(dest),
-                    "r"(line_size)
+                  : "+r"(block),
+                    "+r"(dest)
+                  : "r"(line_size)
                   : "r4", "r5", "r6", "r7", "r8", "r9", "r10", "cc", "memory" );
 }
 
@@ -195,65 +164,62 @@ static void simple_idct_ARM_add(uint8_t *dest, int line_size, DCTELEM *block)
     simple_idct_ARM (block);
     ff_add_pixels_clamped(block, dest, line_size);
 }
+
+#ifdef HAVE_IPP
 static void simple_idct_ipp(DCTELEM *block)
 {
-#ifdef HAVE_IPP
     ippiDCT8x8Inv_Video_16s_C1I(block);
-#endif
 }
 static void simple_idct_ipp_put(uint8_t *dest, int line_size, DCTELEM *block)
 {
-#ifdef HAVE_IPP
     ippiDCT8x8Inv_Video_16s8u_C1R(block, dest, line_size);
-#endif
 }
 
-#ifdef HAVE_IWMMXT
 void add_pixels_clamped_iwmmxt(const DCTELEM *block, uint8_t *pixels, int line_size);
-#endif
 
 static void simple_idct_ipp_add(uint8_t *dest, int line_size, DCTELEM *block)
 {
-#ifdef HAVE_IPP
     ippiDCT8x8Inv_Video_16s_C1I(block);
 #ifdef HAVE_IWMMXT
     add_pixels_clamped_iwmmxt(block, dest, line_size);
 #else
     add_pixels_clamped_ARM(block, dest, line_size);
 #endif
-#endif
 }
+#endif
 
 void dsputil_init_armv4l(DSPContext* c, AVCodecContext *avctx)
 {
-    const int idct_algo= avctx->idct_algo;
+    int idct_algo= avctx->idct_algo;
 
     ff_put_pixels_clamped = c->put_pixels_clamped;
     ff_add_pixels_clamped = c->add_pixels_clamped;
 
+    if(idct_algo == FF_IDCT_AUTO){
 #ifdef HAVE_IPP
-    if(idct_algo==FF_IDCT_ARM){
+        idct_algo = FF_IDCT_IPP;
 #else
-    if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_ARM){
+        idct_algo = FF_IDCT_ARM;
 #endif
+    }
+
+    if(idct_algo==FF_IDCT_ARM){
         c->idct_put= j_rev_dct_ARM_put;
         c->idct_add= j_rev_dct_ARM_add;
-       c->idct    = j_rev_dct_ARM;
+        c->idct    = j_rev_dct_ARM;
         c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;/* FF_NO_IDCT_PERM */
     } else if (idct_algo==FF_IDCT_SIMPLEARM){
-       c->idct_put= simple_idct_ARM_put;
-       c->idct_add= simple_idct_ARM_add;
-       c->idct    = simple_idct_ARM;
-       c->idct_permutation_type= FF_NO_IDCT_PERM;
+        c->idct_put= simple_idct_ARM_put;
+        c->idct_add= simple_idct_ARM_add;
+        c->idct    = simple_idct_ARM;
+        c->idct_permutation_type= FF_NO_IDCT_PERM;
 #ifdef HAVE_IPP
-    } else if (idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_IPP){
-#else
     } else if (idct_algo==FF_IDCT_IPP){
-#endif
         c->idct_put= simple_idct_ipp_put;
         c->idct_add= simple_idct_ipp_add;
         c->idct    = simple_idct_ipp;
         c->idct_permutation_type= FF_NO_IDCT_PERM;
+#endif
     }
 
 /*     c->put_pixels_tab[0][0] = put_pixels16_arm; */ // NG!
@@ -273,9 +239,7 @@ void dsputil_init_armv4l(DSPContext* c, AVCodecContext *avctx)
     c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_arm; //OK
 /*     c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_arm;//NG */
 
-#if 1
 #ifdef HAVE_IWMMXT
     dsputil_init_iwmmxt(c, avctx);
 #endif
-#endif
 }