Commit | Line | Data |
---|---|---|
2ba45a60 DM |
1 | ;****************************************************************************** |
2 | ;* SIMD-optimized deinterlacing functions | |
3 | ;* Copyright (c) 2010 Vitor Sessak | |
4 | ;* Copyright (c) 2002 Michael Niedermayer | |
5 | ;* | |
6 | ;* This file is part of FFmpeg. | |
7 | ;* | |
8 | ;* FFmpeg is free software; you can redistribute it and/or | |
9 | ;* modify it under the terms of the GNU Lesser General Public | |
10 | ;* License as published by the Free Software Foundation; either | |
11 | ;* version 2.1 of the License, or (at your option) any later version. | |
12 | ;* | |
13 | ;* FFmpeg is distributed in the hope that it will be useful, | |
14 | ;* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | ;* Lesser General Public License for more details. | |
17 | ;* | |
18 | ;* You should have received a copy of the GNU Lesser General Public | |
19 | ;* License along with FFmpeg; if not, write to the Free Software | |
20 | ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
21 | ;****************************************************************************** | |
22 | ||
23 | %include "libavutil/x86/x86util.asm" | |
24 | ||
25 | SECTION_RODATA | |
26 | ||
27 | cextern pw_4 | |
28 | ||
29 | SECTION .text | |
30 | ||
31 | %macro DEINTERLACE 1 | |
32 | %ifidn %1, inplace | |
33 | ;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) | |
34 | cglobal deinterlace_line_inplace_mmx, 6,6,7, lum_m4, lum_m3, lum_m2, lum_m1, lum, size | |
35 | %else | |
36 | ;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) | |
37 | cglobal deinterlace_line_mmx, 7,7,7, dst, lum_m4, lum_m3, lum_m2, lum_m1, lum, size | |
38 | %endif | |
39 | pxor mm7, mm7 | |
40 | movq mm6, [pw_4] | |
41 | .nextrow: | |
42 | movd mm0, [lum_m4q] | |
43 | movd mm1, [lum_m3q] | |
44 | movd mm2, [lum_m2q] | |
45 | %ifidn %1, inplace | |
46 | movd [lum_m4q], mm2 | |
47 | %endif | |
48 | movd mm3, [lum_m1q] | |
49 | movd mm4, [lumq] | |
50 | punpcklbw mm0, mm7 | |
51 | punpcklbw mm1, mm7 | |
52 | punpcklbw mm2, mm7 | |
53 | punpcklbw mm3, mm7 | |
54 | punpcklbw mm4, mm7 | |
55 | paddw mm1, mm3 | |
56 | psllw mm2, 1 | |
57 | paddw mm0, mm4 | |
58 | psllw mm1, 2 | |
59 | paddw mm2, mm6 | |
60 | paddw mm1, mm2 | |
61 | psubusw mm1, mm0 | |
62 | psrlw mm1, 3 | |
63 | packuswb mm1, mm7 | |
64 | %ifidn %1, inplace | |
65 | movd [lum_m2q], mm1 | |
66 | %else | |
67 | movd [dstq], mm1 | |
68 | add dstq, 4 | |
69 | %endif | |
70 | add lum_m4q, 4 | |
71 | add lum_m3q, 4 | |
72 | add lum_m2q, 4 | |
73 | add lum_m1q, 4 | |
74 | add lumq, 4 | |
75 | sub sized, 4 | |
76 | jg .nextrow | |
77 | REP_RET | |
78 | %endmacro | |
79 | ||
80 | DEINTERLACE "" | |
81 | ||
82 | DEINTERLACE inplace |