deinterlace.asm 2.48 KB
Newer Older
1 2 3 4 5
;******************************************************************************
;* MMX optimized deinterlacing functions
;* Copyright (c) 2010 Vitor Sessak
;* Copyright (c) 2002 Michael Niedermayer
;*
6
;* This file is part of Libav.
7
;*
8
;* Libav is free software; you can redistribute it and/or
9 10 11 12
;* modify it under the terms of the GNU Lesser General Public
;* License as published by the Free Software Foundation; either
;* version 2.1 of the License, or (at your option) any later version.
;*
13
;* Libav is distributed in the hope that it will be useful,
14 15 16 17 18
;* but WITHOUT ANY WARRANTY; without even the implied warranty of
;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;* Lesser General Public License for more details.
;*
;* You should have received a copy of the GNU Lesser General Public
19
;* License along with Libav; if not, write to the Free Software
20
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 22
;******************************************************************************

Dave Yeo's avatar
Dave Yeo committed
23 24
%include "x86inc.asm"
%include "x86util.asm"
25 26 27 28 29

SECTION_RODATA

cextern pw_4

avcoder's avatar
avcoder committed
30 31
SECTION .text

32 33 34 35 36 37 38 39 40 41
%macro DEINTERLACE 1
%ifidn %1, inplace
;void ff_deinterlace_line_inplace_mmx(const uint8_t *lum_m4, const uint8_t *lum_m3, const uint8_t *lum_m2, const uint8_t *lum_m1, const uint8_t *lum,  int size)
cglobal deinterlace_line_inplace_mmx, 6,6,7,      lum_m4, lum_m3, lum_m2, lum_m1, lum, size
%else
;void ff_deinterlace_line_mmx(uint8_t *dst, const uint8_t *lum_m4, const uint8_t *lum_m3, const uint8_t *lum_m2, const uint8_t *lum_m1, const uint8_t *lum,  int size)
cglobal deinterlace_line_mmx,         7,7,7, dst, lum_m4, lum_m3, lum_m2, lum_m1, lum, size
%endif
    pxor  mm7, mm7
    movq  mm6, [pw_4]
Mans Rullgard's avatar
Mans Rullgard committed
42
.nextrow:
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
    movd  mm0, [lum_m4q]
    movd  mm1, [lum_m3q]
    movd  mm2, [lum_m2q]
%ifidn %1, inplace
    movd [lum_m4q], mm2
%endif
    movd  mm3, [lum_m1q]
    movd  mm4, [lumq]
    punpcklbw mm0, mm7
    punpcklbw mm1, mm7
    punpcklbw mm2, mm7
    punpcklbw mm3, mm7
    punpcklbw mm4, mm7
    paddw     mm1, mm3
    psllw     mm2, 1
    paddw     mm0, mm4
    psllw     mm1, 2
    paddw     mm2, mm6
    paddw     mm1, mm2
    psubusw   mm1, mm0
    psrlw     mm1, 3
    packuswb  mm1, mm7
%ifidn %1, inplace
    movd [lum_m2q], mm1
%else
    movd   [dstq], mm1
    add       dstq, 4
%endif
    add    lum_m4q, 4
    add    lum_m3q, 4
    add    lum_m2q, 4
    add    lum_m1q, 4
    add       lumq, 4
    sub      sized, 4
    jg .nextrow
    REP_RET
%endmacro

DEINTERLACE ""

DEINTERLACE inplace