Revision 9fa35729 libavcodec/i386/dsputil_h264_template_mmx.c

View differences:

libavcodec/i386/dsputil_h264_template_mmx.c
25 25
 * H264_CHROMA_OP must be defined to empty for put and pavgb/pavgusb for avg
26 26
 * H264_CHROMA_MC8_MV0 must be defined to a (put|avg)_pixels8 function
27 27
 */
28
static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
28
static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y, int rnd)
29 29
{
30
    DECLARE_ALIGNED_8(static const uint64_t, ff_pw_28) = 0x001C001C001C001CULL;
31
    const uint64_t *rnd_reg;
30 32
    DECLARE_ALIGNED_8(uint64_t, AA);
31 33
    DECLARE_ALIGNED_8(uint64_t, DD);
32 34
    int i;
......
44 46
        /* 1 dimensional filter only */
45 47
        const int dxy = x ? 1 : stride;
46 48

  
49
        rnd_reg = rnd ? &ff_pw_4 : &ff_pw_3;
50

  
47 51
        asm volatile(
48 52
            "movd %0, %%mm5\n\t"
49 53
            "movq %1, %%mm4\n\t"
54
            "movq %2, %%mm6\n\t"         /* mm6 = rnd */
50 55
            "punpcklwd %%mm5, %%mm5\n\t"
51 56
            "punpckldq %%mm5, %%mm5\n\t" /* mm5 = B = x */
52
            "movq %%mm4, %%mm6\n\t"
53 57
            "pxor %%mm7, %%mm7\n\t"
54 58
            "psubw %%mm5, %%mm4\n\t"     /* mm4 = A = 8-x */
55
            "psrlw $1, %%mm6\n\t"        /* mm6 = 4 */
56
            :: "rm"(x+y), "m"(ff_pw_8));
59
            :: "rm"(x+y), "m"(ff_pw_8), "m"(*rnd_reg));
57 60

  
58 61
        for(i=0; i<h; i++) {
59 62
            asm volatile(
......
95 98
    }
96 99

  
97 100
    /* general case, bilinear */
101
    rnd_reg = rnd ? &ff_pw_32 : &ff_pw_28;
98 102
    asm volatile("movd %2, %%mm4\n\t"
99 103
                 "movd %3, %%mm6\n\t"
100 104
                 "punpcklwd %%mm4, %%mm4\n\t"
......
177 181
            "packuswb %%mm3, %%mm2\n\t"
178 182
            H264_CHROMA_OP(%0, %%mm2)
179 183
            "movq %%mm2, %0\n\t"
180
            : "=m" (dst[0]) : "m" (ff_pw_32));
184
            : "=m" (dst[0]) : "m" (*rnd_reg));
181 185
        dst+= stride;
182 186
    }
183 187
}

Also available in: Unified diff