whitespace cosmetics: Remove all trailing whitespace.
[mplayer.git] / libmpcodecs / vf_ilpack.c
index 66bad26..b0a3f55 100644 (file)
@@ -3,17 +3,14 @@
 #include <string.h>
 #include <inttypes.h>
 
-#include "../config.h"
-#include "../mp_msg.h"
-#include "../cpudetect.h"
+#include "config.h"
+#include "mp_msg.h"
+#include "cpudetect.h"
 
 #include "img_format.h"
 #include "mp_image.h"
 #include "vf.h"
 
-#include "../libvo/fastmemcpy.h"
-#include "../postproc/rgb2rgb.h"
-
 typedef void (pack_func_t)(unsigned char *dst, unsigned char *y,
        unsigned char *u, unsigned char *v, int w, int us, int vs);
 
@@ -60,13 +57,12 @@ static void pack_li_1_C(unsigned char *dst, unsigned char *y,
        }
 }
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
 static void pack_nn_MMX(unsigned char *dst, unsigned char *y,
        unsigned char *u, unsigned char *v, int w)
 {
-       int j;
-       asm volatile (""
-               ".balign 16 \n\t"
+       __asm__ volatile (""
+               ASMALIGN(4)
                "1: \n\t"
                "movq (%0), %%mm1 \n\t"
                "movq (%0), %%mm2 \n\t"
@@ -75,17 +71,17 @@ static void pack_nn_MMX(unsigned char *dst, unsigned char *y,
                "punpcklbw %%mm6, %%mm4 \n\t"
                "punpcklbw %%mm4, %%mm1 \n\t"
                "punpckhbw %%mm4, %%mm2 \n\t"
-               
-               "addl $8, %0 \n\t"
-               "addl $4, %1 \n\t"
-               "addl $4, %2 \n\t"
+
+               "add $8, %0 \n\t"
+               "add $4, %1 \n\t"
+               "add $4, %2 \n\t"
                "movq %%mm1, (%3) \n\t"
                "movq %%mm2, 8(%3) \n\t"
-               "addl $16, %3 \n\t"
+               "add $16, %3 \n\t"
                "decl %4 \n\t"
                "jnz 1b \n\t"
                "emms \n\t"
-               : 
+               :
                : "r" (y), "r" (u), "r" (v), "r" (dst), "r" (w/8)
                : "memory"
                );
@@ -95,23 +91,27 @@ static void pack_nn_MMX(unsigned char *dst, unsigned char *y,
 static void pack_li_0_MMX(unsigned char *dst, unsigned char *y,
        unsigned char *u, unsigned char *v, int w, int us, int vs)
 {
-       asm volatile (""
-               "pushl %%ebp \n\t"
-               "movl 4(%%edx), %%ebp \n\t"
-               "movl (%%edx), %%edx \n\t"
+       __asm__ volatile (""
+               "push %%"REG_BP" \n\t"
+#if ARCH_X86_64
+               "mov %6, %%"REG_BP" \n\t"
+#else
+               "movl 4(%%"REG_d"), %%"REG_BP" \n\t"
+               "movl (%%"REG_d"), %%"REG_d" \n\t"
+#endif
                "pxor %%mm0, %%mm0 \n\t"
-               
-               ".balign 16 \n\t"
+
+               ASMALIGN(4)
                ".Lli0: \n\t"
-               "movq (%%esi), %%mm1 \n\t"
-               "movq (%%esi), %%mm2 \n\t"
-               
-               "movq (%%eax,%%edx,2), %%mm4 \n\t"
-               "movq (%%ebx,%%ebp,2), %%mm6 \n\t"
+               "movq (%%"REG_S"), %%mm1 \n\t"
+               "movq (%%"REG_S"), %%mm2 \n\t"
+
+               "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t"
+               "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t"
                "punpcklbw %%mm0, %%mm4 \n\t"
                "punpcklbw %%mm0, %%mm6 \n\t"
-               "movq (%%eax), %%mm3 \n\t"
-               "movq (%%ebx), %%mm5 \n\t"
+               "movq (%%"REG_a"), %%mm3 \n\t"
+               "movq (%%"REG_b"), %%mm5 \n\t"
                "punpcklbw %%mm0, %%mm3 \n\t"
                "punpcklbw %%mm0, %%mm5 \n\t"
                "paddw %%mm3, %%mm4 \n\t"
@@ -135,19 +135,19 @@ static void pack_li_0_MMX(unsigned char *dst, unsigned char *y,
                "punpcklbw %%mm6, %%mm4 \n\t"
                "punpcklbw %%mm4, %%mm1 \n\t"
                "punpckhbw %%mm4, %%mm2 \n\t"
-               
-               "movq %%mm1, (%%edi) \n\t"
-               "movq %%mm2, 8(%%edi) \n\t"
-               
-               "movq 8(%%esi), %%mm1 \n\t"
-               "movq 8(%%esi), %%mm2 \n\t"
-               
-               "movq (%%eax,%%edx,2), %%mm4 \n\t"
-               "movq (%%ebx,%%ebp,2), %%mm6 \n\t"
+
+               "movq %%mm1, (%%"REG_D") \n\t"
+               "movq %%mm2, 8(%%"REG_D") \n\t"
+
+               "movq 8(%%"REG_S"), %%mm1 \n\t"
+               "movq 8(%%"REG_S"), %%mm2 \n\t"
+
+               "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t"
+               "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t"
                "punpckhbw %%mm0, %%mm4 \n\t"
                "punpckhbw %%mm0, %%mm6 \n\t"
-               "movq (%%eax), %%mm3 \n\t"
-               "movq (%%ebx), %%mm5 \n\t"
+               "movq (%%"REG_a"), %%mm3 \n\t"
+               "movq (%%"REG_b"), %%mm5 \n\t"
                "punpckhbw %%mm0, %%mm3 \n\t"
                "punpckhbw %%mm0, %%mm5 \n\t"
                "paddw %%mm3, %%mm4 \n\t"
@@ -171,21 +171,26 @@ static void pack_li_0_MMX(unsigned char *dst, unsigned char *y,
                "punpcklbw %%mm6, %%mm4 \n\t"
                "punpcklbw %%mm4, %%mm1 \n\t"
                "punpckhbw %%mm4, %%mm2 \n\t"
-               
-               "addl $16, %%esi \n\t"
-               "addl $8, %%eax \n\t"
-               "addl $8, %%ebx \n\t"
-               
-               "movq %%mm1, 16(%%edi) \n\t"
-               "movq %%mm2, 24(%%edi) \n\t"
-               "addl $32, %%edi \n\t"
-               
+
+               "add $16, %%"REG_S" \n\t"
+               "add $8, %%"REG_a" \n\t"
+               "add $8, %%"REG_b" \n\t"
+
+               "movq %%mm1, 16(%%"REG_D") \n\t"
+               "movq %%mm2, 24(%%"REG_D") \n\t"
+               "add $32, %%"REG_D" \n\t"
+
                "decl %%ecx \n\t"
                "jnz .Lli0 \n\t"
                "emms \n\t"
-               "popl %%ebp \n\t"
-               : 
-               : "S" (y), "D" (dst), "a" (u), "b" (v), "d" (&us), "c" (w/16)
+               "pop %%"REG_BP" \n\t"
+               :
+               : "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16),
+#if ARCH_X86_64
+               "d" ((x86_reg)us), "r" ((x86_reg)vs)
+#else
+               "d" (&us)
+#endif
                : "memory"
                );
        pack_li_0_C(dst, y, u, v, (w&15), us, vs);
@@ -194,23 +199,27 @@ static void pack_li_0_MMX(unsigned char *dst, unsigned char *y,
 static void pack_li_1_MMX(unsigned char *dst, unsigned char *y,
        unsigned char *u, unsigned char *v, int w, int us, int vs)
 {
-       asm volatile (""
-               "pushl %%ebp \n\t"
-               "movl 4(%%edx), %%ebp \n\t"
-               "movl (%%edx), %%edx \n\t"
+       __asm__ volatile (""
+               "push %%"REG_BP" \n\t"
+#if ARCH_X86_64
+               "mov %6, %%"REG_BP" \n\t"
+#else
+               "movl 4(%%"REG_d"), %%"REG_BP" \n\t"
+               "movl (%%"REG_d"), %%"REG_d" \n\t"
+#endif
                "pxor %%mm0, %%mm0 \n\t"
-               
-               ".balign 16 \n\t"
+
+               ASMALIGN(4)
                ".Lli1: \n\t"
-               "movq (%%esi), %%mm1 \n\t"
-               "movq (%%esi), %%mm2 \n\t"
-               
-               "movq (%%eax,%%edx,2), %%mm4 \n\t"
-               "movq (%%ebx,%%ebp,2), %%mm6 \n\t"
+               "movq (%%"REG_S"), %%mm1 \n\t"
+               "movq (%%"REG_S"), %%mm2 \n\t"
+
+               "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t"
+               "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t"
                "punpcklbw %%mm0, %%mm4 \n\t"
                "punpcklbw %%mm0, %%mm6 \n\t"
-               "movq (%%eax), %%mm3 \n\t"
-               "movq (%%ebx), %%mm5 \n\t"
+               "movq (%%"REG_a"), %%mm3 \n\t"
+               "movq (%%"REG_b"), %%mm5 \n\t"
                "punpcklbw %%mm0, %%mm3 \n\t"
                "punpcklbw %%mm0, %%mm5 \n\t"
                "movq %%mm4, %%mm7 \n\t"
@@ -236,19 +245,19 @@ static void pack_li_1_MMX(unsigned char *dst, unsigned char *y,
                "punpcklbw %%mm6, %%mm4 \n\t"
                "punpcklbw %%mm4, %%mm1 \n\t"
                "punpckhbw %%mm4, %%mm2 \n\t"
-               
-               "movq %%mm1, (%%edi) \n\t"
-               "movq %%mm2, 8(%%edi) \n\t"
-               
-               "movq 8(%%esi), %%mm1 \n\t"
-               "movq 8(%%esi), %%mm2 \n\t"
-               
-               "movq (%%eax,%%edx,2), %%mm4 \n\t"
-               "movq (%%ebx,%%ebp,2), %%mm6 \n\t"
+
+               "movq %%mm1, (%%"REG_D") \n\t"
+               "movq %%mm2, 8(%%"REG_D") \n\t"
+
+               "movq 8(%%"REG_S"), %%mm1 \n\t"
+               "movq 8(%%"REG_S"), %%mm2 \n\t"
+
+               "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t"
+               "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t"
                "punpckhbw %%mm0, %%mm4 \n\t"
                "punpckhbw %%mm0, %%mm6 \n\t"
-               "movq (%%eax), %%mm3 \n\t"
-               "movq (%%ebx), %%mm5 \n\t"
+               "movq (%%"REG_a"), %%mm3 \n\t"
+               "movq (%%"REG_b"), %%mm5 \n\t"
                "punpckhbw %%mm0, %%mm3 \n\t"
                "punpckhbw %%mm0, %%mm5 \n\t"
                "movq %%mm4, %%mm7 \n\t"
@@ -274,21 +283,26 @@ static void pack_li_1_MMX(unsigned char *dst, unsigned char *y,
                "punpcklbw %%mm6, %%mm4 \n\t"
                "punpcklbw %%mm4, %%mm1 \n\t"
                "punpckhbw %%mm4, %%mm2 \n\t"
-               
-               "addl $16, %%esi \n\t"
-               "addl $8, %%eax \n\t"
-               "addl $8, %%ebx \n\t"
-               
-               "movq %%mm1, 16(%%edi) \n\t"
-               "movq %%mm2, 24(%%edi) \n\t"
-               "addl $32, %%edi \n\t"
-               
+
+               "add $16, %%"REG_S" \n\t"
+               "add $8, %%"REG_a" \n\t"
+               "add $8, %%"REG_b" \n\t"
+
+               "movq %%mm1, 16(%%"REG_D") \n\t"
+               "movq %%mm2, 24(%%"REG_D") \n\t"
+               "add $32, %%"REG_D" \n\t"
+
                "decl %%ecx \n\t"
                "jnz .Lli1 \n\t"
                "emms \n\t"
-               "popl %%ebp \n\t"
-               : 
-               : "S" (y), "D" (dst), "a" (u), "b" (v), "d" (&us), "c" (w/16)
+               "pop %%"REG_BP" \n\t"
+               :
+               : "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16),
+#if ARCH_X86_64
+               "d" ((x86_reg)us), "r" ((x86_reg)vs)
+#else
+               "d" (&us)
+#endif
                : "memory"
                );
        pack_li_1_C(dst, y, u, v, (w&15), us, vs);
@@ -335,7 +349,7 @@ static void ilpack(unsigned char *dst, unsigned char *src[3],
 }
 
 
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi)
+static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
 {
        mp_image_t *dmpi;
 
@@ -346,7 +360,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi)
 
        ilpack(dmpi->planes[0], mpi->planes, dmpi->stride[0], mpi->stride, mpi->w, mpi->h, vf->priv->pack);
 
-       return vf_next_put_image(vf,dmpi);
+       return vf_next_put_image(vf,dmpi, pts);
 }
 
 static int config(struct vf_instance_s* vf,
@@ -378,11 +392,11 @@ static int open(vf_instance_t *vf, char* args)
        vf->priv = calloc(1, sizeof(struct vf_priv_s));
        vf->priv->mode = 1;
        if (args) sscanf(args, "%d", &vf->priv->mode);
-       
+
        pack_nn = (pack_func_t *)pack_nn_C;
        pack_li_0 = pack_li_0_C;
        pack_li_1 = pack_li_1_C;
-#ifdef HAVE_MMX
+#if HAVE_MMX
        if(gCpuCaps.hasMMX) {
                pack_nn = (pack_func_t *)pack_nn_MMX;
                pack_li_0 = pack_li_0_MMX;
@@ -403,11 +417,11 @@ static int open(vf_instance_t *vf, char* args)
                vf->priv->pack[1] = pack_li_1;
                break;
        }
-       
+
        return 1;
 }
 
-vf_info_t vf_info_ilpack = {
+const vf_info_t vf_info_ilpack = {
        "4:2:0 planar -> 4:2:2 packed reinterlacer",
        "ilpack",
        "Richard Felker",