Revision d375c104 libavcodec/x86/dsputil_mmx.c

View differences:

libavcodec/x86/dsputil_mmx.c
783 783

  
784 784
/* draw the edges of width 'w' of an image of size width, height
785 785
   this mmx version can only handle w==8 || w==16 */
786
static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w)
786
static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w, int sides)
787 787
{
788 788
    uint8_t *ptr, *last_line;
789 789
    int i;
......
838 838

  
839 839
    for(i=0;i<w;i+=4) {
840 840
        /* top and bottom (and hopefully also the corners) */
841
        ptr= buf - (i + 1) * wrap - w;
842
        __asm__ volatile(
843
                "1:                             \n\t"
844
                "movq (%1, %0), %%mm0           \n\t"
845
                "movq %%mm0, (%0)               \n\t"
846
                "movq %%mm0, (%0, %2)           \n\t"
847
                "movq %%mm0, (%0, %2, 2)        \n\t"
848
                "movq %%mm0, (%0, %3)           \n\t"
849
                "add $8, %0                     \n\t"
850
                "cmp %4, %0                     \n\t"
851
                " jb 1b                         \n\t"
852
                : "+r" (ptr)
853
                : "r" ((x86_reg)buf - (x86_reg)ptr - w), "r" ((x86_reg)-wrap), "r" ((x86_reg)-wrap*3), "r" (ptr+width+2*w)
854
        );
855
        ptr= last_line + (i + 1) * wrap - w;
856
        __asm__ volatile(
857
                "1:                             \n\t"
858
                "movq (%1, %0), %%mm0           \n\t"
859
                "movq %%mm0, (%0)               \n\t"
860
                "movq %%mm0, (%0, %2)           \n\t"
861
                "movq %%mm0, (%0, %2, 2)        \n\t"
862
                "movq %%mm0, (%0, %3)           \n\t"
863
                "add $8, %0                     \n\t"
864
                "cmp %4, %0                     \n\t"
865
                " jb 1b                         \n\t"
866
                : "+r" (ptr)
867
                : "r" ((x86_reg)last_line - (x86_reg)ptr - w), "r" ((x86_reg)wrap), "r" ((x86_reg)wrap*3), "r" (ptr+width+2*w)
868
        );
841
        if (sides&EDGE_TOP) {
842
            ptr= buf - (i + 1) * wrap - w;
843
            __asm__ volatile(
844
                    "1:                             \n\t"
845
                    "movq (%1, %0), %%mm0           \n\t"
846
                    "movq %%mm0, (%0)               \n\t"
847
                    "movq %%mm0, (%0, %2)           \n\t"
848
                    "movq %%mm0, (%0, %2, 2)        \n\t"
849
                    "movq %%mm0, (%0, %3)           \n\t"
850
                    "add $8, %0                     \n\t"
851
                    "cmp %4, %0                     \n\t"
852
                    " jb 1b                         \n\t"
853
                    : "+r" (ptr)
854
                    : "r" ((x86_reg)buf - (x86_reg)ptr - w), "r" ((x86_reg)-wrap), "r" ((x86_reg)-wrap*3), "r" (ptr+width+2*w)
855
            );
856
        }
857

  
858
        if (sides&EDGE_BOTTOM) {
859
            ptr= last_line + (i + 1) * wrap - w;
860
            __asm__ volatile(
861
                    "1:                             \n\t"
862
                    "movq (%1, %0), %%mm0           \n\t"
863
                    "movq %%mm0, (%0)               \n\t"
864
                    "movq %%mm0, (%0, %2)           \n\t"
865
                    "movq %%mm0, (%0, %2, 2)        \n\t"
866
                    "movq %%mm0, (%0, %3)           \n\t"
867
                    "add $8, %0                     \n\t"
868
                    "cmp %4, %0                     \n\t"
869
                    " jb 1b                         \n\t"
870
                    : "+r" (ptr)
871
                    : "r" ((x86_reg)last_line - (x86_reg)ptr - w), "r" ((x86_reg)wrap), "r" ((x86_reg)wrap*3), "r" (ptr+width+2*w)
872
            );
873
        }
869 874
    }
870 875
}
871 876

  

Also available in: Unified diff