annotate libmpcodecs/vf_yadif.c @ 26329:5c909aa0626d

Fix nonsensical license header, mpeg2dec is not GNU Make.
author diego
date Wed, 09 Apr 2008 11:31:50 +0000
parents 00fff9a3b735
children 82601a38e2a7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
1 /*
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
2 Copyright (C) 2006 Michael Niedermayer <michaelni@gmx.at>
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
3
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
4 This program is free software; you can redistribute it and/or modify
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
6 the Free Software Foundation; either version 2 of the License, or
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
7 (at your option) any later version.
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
8
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
12 GNU General Public License for more details.
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
13
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
15 along with this program; if not, write to the Free Software
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
17 */
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
18
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
19 #include <stdio.h>
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
20 #include <stdlib.h>
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
21 #include <string.h>
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
22 #include <inttypes.h>
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
23 #include <math.h>
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
24
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
25 #include "config.h"
19830
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
26 #include "cpudetect.h"
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
27
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
28 #include "mp_msg.h"
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
29
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
30 #ifdef HAVE_MALLOC_H
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
31 #include <malloc.h>
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
32 #endif
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
33
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
34 #include "img_format.h"
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
35 #include "mp_image.h"
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
36 #include "vf.h"
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
37 #include "libvo/fastmemcpy.h"
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
38
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
39 #define MIN(a,b) ((a) > (b) ? (b) : (a))
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
40 #define MAX(a,b) ((a) < (b) ? (b) : (a))
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
41 #define ABS(a) ((a) > 0 ? (a) : (-(a)))
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
42
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
43 #define MIN3(a,b,c) MIN(MIN(a,b),c)
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
44 #define MAX3(a,b,c) MAX(MAX(a,b),c)
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
45
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
46 //===========================================================================//
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
47
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
48 struct vf_priv_s {
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
49 int mode;
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
50 int parity;
18917
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
51 int buffered_i;
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
52 int buffered_tff;
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
53 double buffered_pts;
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
54 mp_image_t *buffered_mpi;
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
55 int stride[3];
18625
dea3a68e2589 simplify
michael
parents: 18623
diff changeset
56 uint8_t *ref[4][3];
21060
b37a53da3b8a allows to de- and reactivate yadif on the fly
gpoirier
parents: 20010
diff changeset
57 int do_deinterlace;
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
58 };
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
59
19830
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
60 static void (*filter_line)(struct vf_priv_s *p, uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8_t *next, int w, int refs, int parity);
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
61
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
62 static void store_ref(struct vf_priv_s *p, uint8_t *src[3], int src_stride[3], int width, int height){
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
63 int i;
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
64
23458
973e53dc7df5 Do not use fast_memcpy for small size copy, esp. when the size is constant
reimar
parents: 23457
diff changeset
65 memcpy (p->ref[3], p->ref[0], sizeof(uint8_t *)*3);
18625
dea3a68e2589 simplify
michael
parents: 18623
diff changeset
66 memmove(p->ref[0], p->ref[1], sizeof(uint8_t *)*3*3);
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
67
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
68 for(i=0; i<3; i++){
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
69 int is_chroma= !!i;
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
70
18625
dea3a68e2589 simplify
michael
parents: 18623
diff changeset
71 memcpy_pic(p->ref[2][i], src[i], width>>is_chroma, height>>is_chroma, p->stride[i], src_stride[i]);
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
72 }
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
73 }
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
74
19888
2ce14efa8917 Replace preprocessor hacks to work around compilers not supporting named
diego
parents: 19830
diff changeset
75 #if defined(HAVE_MMX) && defined(NAMED_ASM_ARGS)
19830
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
76
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
77 #define LOAD4(mem,dst) \
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
78 "movd "mem", "#dst" \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
79 "punpcklbw %%mm7, "#dst" \n\t"
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
80
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
81 #define PABS(tmp,dst) \
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
82 "pxor "#tmp", "#tmp" \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
83 "psubw "#dst", "#tmp" \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
84 "pmaxsw "#tmp", "#dst" \n\t"
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
85
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
86 #define CHECK(pj,mj) \
20010
5ae0a24fbed8 Compile fix for odd versions of binutils, namely the ones in Fedora.
gpoirier
parents: 19942
diff changeset
87 "movq "#pj"(%[cur],%[mrefs]), %%mm2 \n\t" /* cur[x-refs-1+j] */\
5ae0a24fbed8 Compile fix for odd versions of binutils, namely the ones in Fedora.
gpoirier
parents: 19942
diff changeset
88 "movq "#mj"(%[cur],%[prefs]), %%mm3 \n\t" /* cur[x+refs-1-j] */\
19830
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
89 "movq %%mm2, %%mm4 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
90 "movq %%mm2, %%mm5 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
91 "pxor %%mm3, %%mm4 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
92 "pavgb %%mm3, %%mm5 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
93 "pand %[pb1], %%mm4 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
94 "psubusb %%mm4, %%mm5 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
95 "psrlq $8, %%mm5 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
96 "punpcklbw %%mm7, %%mm5 \n\t" /* (cur[x-refs+j] + cur[x+refs-j])>>1 */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
97 "movq %%mm2, %%mm4 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
98 "psubusb %%mm3, %%mm2 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
99 "psubusb %%mm4, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
100 "pmaxub %%mm3, %%mm2 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
101 "movq %%mm2, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
102 "movq %%mm2, %%mm4 \n\t" /* ABS(cur[x-refs-1+j] - cur[x+refs-1-j]) */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
103 "psrlq $8, %%mm3 \n\t" /* ABS(cur[x-refs +j] - cur[x+refs -j]) */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
104 "psrlq $16, %%mm4 \n\t" /* ABS(cur[x-refs+1+j] - cur[x+refs+1-j]) */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
105 "punpcklbw %%mm7, %%mm2 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
106 "punpcklbw %%mm7, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
107 "punpcklbw %%mm7, %%mm4 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
108 "paddw %%mm3, %%mm2 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
109 "paddw %%mm4, %%mm2 \n\t" /* score */
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
110
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
111 #define CHECK1 \
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
112 "movq %%mm0, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
113 "pcmpgtw %%mm2, %%mm3 \n\t" /* if(score < spatial_score) */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
114 "pminsw %%mm2, %%mm0 \n\t" /* spatial_score= score; */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
115 "movq %%mm3, %%mm6 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
116 "pand %%mm3, %%mm5 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
117 "pandn %%mm1, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
118 "por %%mm5, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
119 "movq %%mm3, %%mm1 \n\t" /* spatial_pred= (cur[x-refs+j] + cur[x+refs-j])>>1; */
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
120
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
121 #define CHECK2 /* pretend not to have checked dir=2 if dir=1 was bad.\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
122 hurts both quality and speed, but matches the C version. */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
123 "paddw %[pw1], %%mm6 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
124 "psllw $14, %%mm6 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
125 "paddsw %%mm6, %%mm2 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
126 "movq %%mm0, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
127 "pcmpgtw %%mm2, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
128 "pminsw %%mm2, %%mm0 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
129 "pand %%mm3, %%mm5 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
130 "pandn %%mm1, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
131 "por %%mm5, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
132 "movq %%mm3, %%mm1 \n\t"
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
133
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
134 static void filter_line_mmx2(struct vf_priv_s *p, uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8_t *next, int w, int refs, int parity){
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
135 static const uint64_t pw_1 = 0x0001000100010001ULL;
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
136 static const uint64_t pb_1 = 0x0101010101010101ULL;
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
137 const int mode = p->mode;
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
138 uint64_t tmp0, tmp1, tmp2, tmp3;
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
139 int x;
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
140
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
141 #define FILTER\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
142 for(x=0; x<w; x+=4){\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
143 asm volatile(\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
144 "pxor %%mm7, %%mm7 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
145 LOAD4("(%[cur],%[mrefs])", %%mm0) /* c = cur[x-refs] */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
146 LOAD4("(%[cur],%[prefs])", %%mm1) /* e = cur[x+refs] */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
147 LOAD4("(%["prev2"])", %%mm2) /* prev2[x] */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
148 LOAD4("(%["next2"])", %%mm3) /* next2[x] */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
149 "movq %%mm3, %%mm4 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
150 "paddw %%mm2, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
151 "psraw $1, %%mm3 \n\t" /* d = (prev2[x] + next2[x])>>1 */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
152 "movq %%mm0, %[tmp0] \n\t" /* c */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
153 "movq %%mm3, %[tmp1] \n\t" /* d */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
154 "movq %%mm1, %[tmp2] \n\t" /* e */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
155 "psubw %%mm4, %%mm2 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
156 PABS( %%mm4, %%mm2) /* temporal_diff0 */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
157 LOAD4("(%[prev],%[mrefs])", %%mm3) /* prev[x-refs] */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
158 LOAD4("(%[prev],%[prefs])", %%mm4) /* prev[x+refs] */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
159 "psubw %%mm0, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
160 "psubw %%mm1, %%mm4 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
161 PABS( %%mm5, %%mm3)\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
162 PABS( %%mm5, %%mm4)\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
163 "paddw %%mm4, %%mm3 \n\t" /* temporal_diff1 */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
164 "psrlw $1, %%mm2 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
165 "psrlw $1, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
166 "pmaxsw %%mm3, %%mm2 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
167 LOAD4("(%[next],%[mrefs])", %%mm3) /* next[x-refs] */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
168 LOAD4("(%[next],%[prefs])", %%mm4) /* next[x+refs] */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
169 "psubw %%mm0, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
170 "psubw %%mm1, %%mm4 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
171 PABS( %%mm5, %%mm3)\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
172 PABS( %%mm5, %%mm4)\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
173 "paddw %%mm4, %%mm3 \n\t" /* temporal_diff2 */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
174 "psrlw $1, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
175 "pmaxsw %%mm3, %%mm2 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
176 "movq %%mm2, %[tmp3] \n\t" /* diff */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
177 \
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
178 "paddw %%mm0, %%mm1 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
179 "paddw %%mm0, %%mm0 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
180 "psubw %%mm1, %%mm0 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
181 "psrlw $1, %%mm1 \n\t" /* spatial_pred */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
182 PABS( %%mm2, %%mm0) /* ABS(c-e) */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
183 \
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
184 "movq -1(%[cur],%[mrefs]), %%mm2 \n\t" /* cur[x-refs-1] */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
185 "movq -1(%[cur],%[prefs]), %%mm3 \n\t" /* cur[x+refs-1] */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
186 "movq %%mm2, %%mm4 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
187 "psubusb %%mm3, %%mm2 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
188 "psubusb %%mm4, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
189 "pmaxub %%mm3, %%mm2 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
190 "pshufw $9,%%mm2, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
191 "punpcklbw %%mm7, %%mm2 \n\t" /* ABS(cur[x-refs-1] - cur[x+refs-1]) */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
192 "punpcklbw %%mm7, %%mm3 \n\t" /* ABS(cur[x-refs+1] - cur[x+refs+1]) */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
193 "paddw %%mm2, %%mm0 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
194 "paddw %%mm3, %%mm0 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
195 "psubw %[pw1], %%mm0 \n\t" /* spatial_score */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
196 \
20010
5ae0a24fbed8 Compile fix for odd versions of binutils, namely the ones in Fedora.
gpoirier
parents: 19942
diff changeset
197 CHECK(-2,0)\
19830
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
198 CHECK1\
20010
5ae0a24fbed8 Compile fix for odd versions of binutils, namely the ones in Fedora.
gpoirier
parents: 19942
diff changeset
199 CHECK(-3,1)\
19830
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
200 CHECK2\
20010
5ae0a24fbed8 Compile fix for odd versions of binutils, namely the ones in Fedora.
gpoirier
parents: 19942
diff changeset
201 CHECK(0,-2)\
19830
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
202 CHECK1\
20010
5ae0a24fbed8 Compile fix for odd versions of binutils, namely the ones in Fedora.
gpoirier
parents: 19942
diff changeset
203 CHECK(1,-3)\
19830
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
204 CHECK2\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
205 \
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
206 /* if(p->mode<2) ... */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
207 "movq %[tmp3], %%mm6 \n\t" /* diff */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
208 "cmp $2, %[mode] \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
209 "jge 1f \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
210 LOAD4("(%["prev2"],%[mrefs],2)", %%mm2) /* prev2[x-2*refs] */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
211 LOAD4("(%["next2"],%[mrefs],2)", %%mm4) /* next2[x-2*refs] */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
212 LOAD4("(%["prev2"],%[prefs],2)", %%mm3) /* prev2[x+2*refs] */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
213 LOAD4("(%["next2"],%[prefs],2)", %%mm5) /* next2[x+2*refs] */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
214 "paddw %%mm4, %%mm2 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
215 "paddw %%mm5, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
216 "psrlw $1, %%mm2 \n\t" /* b */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
217 "psrlw $1, %%mm3 \n\t" /* f */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
218 "movq %[tmp0], %%mm4 \n\t" /* c */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
219 "movq %[tmp1], %%mm5 \n\t" /* d */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
220 "movq %[tmp2], %%mm7 \n\t" /* e */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
221 "psubw %%mm4, %%mm2 \n\t" /* b-c */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
222 "psubw %%mm7, %%mm3 \n\t" /* f-e */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
223 "movq %%mm5, %%mm0 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
224 "psubw %%mm4, %%mm5 \n\t" /* d-c */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
225 "psubw %%mm7, %%mm0 \n\t" /* d-e */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
226 "movq %%mm2, %%mm4 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
227 "pminsw %%mm3, %%mm2 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
228 "pmaxsw %%mm4, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
229 "pmaxsw %%mm5, %%mm2 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
230 "pminsw %%mm5, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
231 "pmaxsw %%mm0, %%mm2 \n\t" /* max */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
232 "pminsw %%mm0, %%mm3 \n\t" /* min */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
233 "pxor %%mm4, %%mm4 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
234 "pmaxsw %%mm3, %%mm6 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
235 "psubw %%mm2, %%mm4 \n\t" /* -max */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
236 "pmaxsw %%mm4, %%mm6 \n\t" /* diff= MAX3(diff, min, -max); */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
237 "1: \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
238 \
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
239 "movq %[tmp1], %%mm2 \n\t" /* d */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
240 "movq %%mm2, %%mm3 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
241 "psubw %%mm6, %%mm2 \n\t" /* d-diff */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
242 "paddw %%mm6, %%mm3 \n\t" /* d+diff */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
243 "pmaxsw %%mm2, %%mm1 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
244 "pminsw %%mm3, %%mm1 \n\t" /* d = clip(spatial_pred, d-diff, d+diff); */\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
245 "packuswb %%mm1, %%mm1 \n\t"\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
246 \
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
247 :[tmp0]"=m"(tmp0),\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
248 [tmp1]"=m"(tmp1),\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
249 [tmp2]"=m"(tmp2),\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
250 [tmp3]"=m"(tmp3)\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
251 :[prev] "r"(prev),\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
252 [cur] "r"(cur),\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
253 [next] "r"(next),\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
254 [prefs]"r"((long)refs),\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
255 [mrefs]"r"((long)-refs),\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
256 [pw1] "m"(pw_1),\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
257 [pb1] "m"(pb_1),\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
258 [mode] "g"(mode)\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
259 );\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
260 asm volatile("movd %%mm1, %0" :"=m"(*dst));\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
261 dst += 4;\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
262 prev+= 4;\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
263 cur += 4;\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
264 next+= 4;\
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
265 }
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
266
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
267 if(parity){
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
268 #define prev2 "prev"
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
269 #define next2 "cur"
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
270 FILTER
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
271 #undef prev2
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
272 #undef next2
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
273 }else{
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
274 #define prev2 "cur"
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
275 #define next2 "next"
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
276 FILTER
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
277 #undef prev2
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
278 #undef next2
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
279 }
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
280 }
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
281 #undef LOAD4
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
282 #undef PABS
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
283 #undef CHECK
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
284 #undef CHECK1
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
285 #undef CHECK2
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
286 #undef FILTER
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
287
19888
2ce14efa8917 Replace preprocessor hacks to work around compilers not supporting named
diego
parents: 19830
diff changeset
288 #endif /* defined(HAVE_MMX) && defined(NAMED_ASM_ARGS) */
19830
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
289
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
290 static void filter_line_c(struct vf_priv_s *p, uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8_t *next, int w, int refs, int parity){
19828
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
291 int x;
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
292 uint8_t *prev2= parity ? prev : cur ;
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
293 uint8_t *next2= parity ? cur : next;
19829
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
294 for(x=0; x<w; x++){
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
295 int c= cur[-refs];
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
296 int d= (prev2[0] + next2[0])>>1;
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
297 int e= cur[+refs];
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
298 int temporal_diff0= ABS(prev2[0] - next2[0]);
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
299 int temporal_diff1=( ABS(prev[-refs] - c) + ABS(prev[+refs] - e) )>>1;
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
300 int temporal_diff2=( ABS(next[-refs] - c) + ABS(next[+refs] - e) )>>1;
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
301 int diff= MAX3(temporal_diff0>>1, temporal_diff1, temporal_diff2);
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
302 int spatial_pred= (c+e)>>1;
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
303 int spatial_score= ABS(cur[-refs-1] - cur[+refs-1]) + ABS(c-e)
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
304 + ABS(cur[-refs+1] - cur[+refs+1]) - 1;
18621
0001a9a9f1a9 cleanup
michael
parents: 18610
diff changeset
305
18657
26f54fad099c better spatial interpolation
michael
parents: 18626
diff changeset
306 #define CHECK(j)\
26f54fad099c better spatial interpolation
michael
parents: 18626
diff changeset
307 { int score= ABS(cur[-refs-1+j] - cur[+refs-1-j])\
26f54fad099c better spatial interpolation
michael
parents: 18626
diff changeset
308 + ABS(cur[-refs +j] - cur[+refs -j])\
26f54fad099c better spatial interpolation
michael
parents: 18626
diff changeset
309 + ABS(cur[-refs+1+j] - cur[+refs+1-j]);\
26f54fad099c better spatial interpolation
michael
parents: 18626
diff changeset
310 if(score < spatial_score){\
26f54fad099c better spatial interpolation
michael
parents: 18626
diff changeset
311 spatial_score= score;\
26f54fad099c better spatial interpolation
michael
parents: 18626
diff changeset
312 spatial_pred= (cur[-refs +j] + cur[+refs -j])>>1;\
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
313
19829
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
314 CHECK(-1) CHECK(-2) }} }}
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
315 CHECK( 1) CHECK( 2) }} }}
18657
26f54fad099c better spatial interpolation
michael
parents: 18626
diff changeset
316
19829
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
317 if(p->mode<2){
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
318 int b= (prev2[-2*refs] + next2[-2*refs])>>1;
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
319 int f= (prev2[+2*refs] + next2[+2*refs])>>1;
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
320 #if 0
19829
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
321 int a= cur[-3*refs];
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
322 int g= cur[+3*refs];
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
323 int max= MAX3(d-e, d-c, MIN3(MAX(b-c,f-e),MAX(b-c,b-a),MAX(f-g,f-e)) );
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
324 int min= MIN3(d-e, d-c, MAX3(MIN(b-c,f-e),MIN(b-c,b-a),MIN(f-g,f-e)) );
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
325 #else
19829
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
326 int max= MAX3(d-e, d-c, MIN(b-c, f-e));
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
327 int min= MIN3(d-e, d-c, MAX(b-c, f-e));
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
328 #endif
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
329
19829
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
330 diff= MAX3(diff, min, -max);
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
331 }
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
332
19829
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
333 if(spatial_pred > d + diff)
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
334 spatial_pred = d + diff;
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
335 else if(spatial_pred < d - diff)
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
336 spatial_pred = d - diff;
19828
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
337
19829
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
338 dst[0] = spatial_pred;
19828
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
339
19829
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
340 dst++;
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
341 cur++;
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
342 prev++;
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
343 next++;
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
344 prev2++;
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
345 next2++;
4f4a58a3fba8 cosmetics (indentation)
lorenm
parents: 19828
diff changeset
346 }
19828
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
347 }
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
348
19828
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
349 static void filter(struct vf_priv_s *p, uint8_t *dst[3], int dst_stride[3], int width, int height, int parity, int tff){
23381
300e9b7c499f Remove some unused variables, patch by timwoj ieee org.
diego
parents: 22117
diff changeset
350 int y, i;
19828
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
351
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
352 for(i=0; i<3; i++){
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
353 int is_chroma= !!i;
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
354 int w= width >>is_chroma;
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
355 int h= height>>is_chroma;
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
356 int refs= p->stride[i];
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
357
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
358 for(y=0; y<h; y++){
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
359 if((y ^ parity) & 1){
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
360 uint8_t *prev= &p->ref[0][i][y*refs];
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
361 uint8_t *cur = &p->ref[1][i][y*refs];
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
362 uint8_t *next= &p->ref[2][i][y*refs];
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
363 uint8_t *dst2= &dst[i][y*dst_stride[i]];
1d5832b4b204 cosmetics
lorenm
parents: 18917
diff changeset
364 filter_line(p, dst2, prev, cur, next, w, refs, parity ^ tff);
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
365 }else{
23457
a124f3abc1ec Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents: 23381
diff changeset
366 fast_memcpy(&dst[i][y*dst_stride[i]], &p->ref[1][i][y*refs], w);
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
367 }
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
368 }
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
369 }
19942
0983feab2dc2 Add forgotten emms which caused weird bugs like nan pts values.
reimar
parents: 19923
diff changeset
370 #if defined(HAVE_MMX) && defined(NAMED_ASM_ARGS)
0983feab2dc2 Add forgotten emms which caused weird bugs like nan pts values.
reimar
parents: 19923
diff changeset
371 if(gCpuCaps.hasMMX2) asm volatile("emms \n\t" : : : "memory");
0983feab2dc2 Add forgotten emms which caused weird bugs like nan pts values.
reimar
parents: 19923
diff changeset
372 #endif
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
373 }
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
374
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
375 static int config(struct vf_instance_s* vf,
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
376 int width, int height, int d_width, int d_height,
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
377 unsigned int flags, unsigned int outfmt){
18625
dea3a68e2589 simplify
michael
parents: 18623
diff changeset
378 int i, j;
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
379
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
380 for(i=0; i<3; i++){
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
381 int is_chroma= !!i;
18625
dea3a68e2589 simplify
michael
parents: 18623
diff changeset
382 int w= ((width + 31) & (~31))>>is_chroma;
dea3a68e2589 simplify
michael
parents: 18623
diff changeset
383 int h= ((height+6+ 31) & (~31))>>is_chroma;
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
384
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
385 vf->priv->stride[i]= w;
18625
dea3a68e2589 simplify
michael
parents: 18623
diff changeset
386 for(j=0; j<3; j++)
dea3a68e2589 simplify
michael
parents: 18623
diff changeset
387 vf->priv->ref[j][i]= malloc(w*h*sizeof(uint8_t))+3*w;
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
388 }
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
389
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
390 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
391 }
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
392
18917
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
393 static int continue_buffered_image(struct vf_instance_s *vf);
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
394 extern int correct_pts;
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
395
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
396 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
18917
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
397 int tff;
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
398
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
399 if(vf->priv->parity < 0) {
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
400 if (mpi->fields & MP_IMGFIELD_ORDERED)
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
401 tff = !!(mpi->fields & MP_IMGFIELD_TOP_FIRST);
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
402 else
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
403 tff = 1;
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
404 }
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
405 else tff = (vf->priv->parity&1)^1;
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
406
18625
dea3a68e2589 simplify
michael
parents: 18623
diff changeset
407 store_ref(vf->priv, mpi->planes, mpi->stride, mpi->w, mpi->h);
dea3a68e2589 simplify
michael
parents: 18623
diff changeset
408
18917
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
409 vf->priv->buffered_mpi = mpi;
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
410 vf->priv->buffered_tff = tff;
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
411 vf->priv->buffered_i = 0;
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
412 vf->priv->buffered_pts = pts;
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
413
22116
c90733d6a870 skip first (green) frame
michael
parents: 21060
diff changeset
414 if(vf->priv->do_deinterlace == 0)
c90733d6a870 skip first (green) frame
michael
parents: 21060
diff changeset
415 return vf_next_put_image(vf, mpi, pts);
c90733d6a870 skip first (green) frame
michael
parents: 21060
diff changeset
416 else if(vf->priv->do_deinterlace == 1){
c90733d6a870 skip first (green) frame
michael
parents: 21060
diff changeset
417 vf->priv->do_deinterlace= 2;
c90733d6a870 skip first (green) frame
michael
parents: 21060
diff changeset
418 return 0;
c90733d6a870 skip first (green) frame
michael
parents: 21060
diff changeset
419 }else
22117
michael
parents: 22116
diff changeset
420 return continue_buffered_image(vf);
18917
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
421 }
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
422
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
423 static int continue_buffered_image(struct vf_instance_s *vf)
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
424 {
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
425 mp_image_t *mpi = vf->priv->buffered_mpi;
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
426 int tff = vf->priv->buffered_tff;
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
427 double pts = vf->priv->buffered_pts;
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
428 int i;
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
429 int ret=0;
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
430 mp_image_t *dmpi;
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
431
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
432 pts += vf->priv->buffered_i * .02; // XXX not right
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
433
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
434 for(i = vf->priv->buffered_i; i<=(vf->priv->mode&1); i++){
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
435 dmpi=vf_get_image(vf->next,mpi->imgfmt,
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
436 MP_IMGTYPE_TEMP,
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
437 MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
438 mpi->width,mpi->height);
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
439 vf_clone_mpi_attributes(dmpi, mpi);
18625
dea3a68e2589 simplify
michael
parents: 18623
diff changeset
440 filter(vf->priv, dmpi->planes, dmpi->stride, mpi->w, mpi->h, i ^ tff ^ 1, tff);
18917
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
441 if (correct_pts && i < (vf->priv->mode & 1))
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
442 vf_queue_frame(vf, continue_buffered_image);
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
443 ret |= vf_next_put_image(vf, dmpi, pts /*FIXME*/);
18917
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
444 if (correct_pts)
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
445 break;
18626
2e2b8f34a69e make spatial interlacing check optional
michael
parents: 18625
diff changeset
446 if(i<(vf->priv->mode&1))
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
447 vf_next_control(vf, VFCTRL_FLIP_PAGE, NULL);
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
448 }
18917
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18657
diff changeset
449 vf->priv->buffered_i = 1;
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
450 return ret;
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
451 }
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
452
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
453 static void uninit(struct vf_instance_s* vf){
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
454 int i;
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
455 if(!vf->priv) return;
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
456
18625
dea3a68e2589 simplify
michael
parents: 18623
diff changeset
457 for(i=0; i<3*3; i++){
dea3a68e2589 simplify
michael
parents: 18623
diff changeset
458 uint8_t **p= &vf->priv->ref[i%3][i/3];
dea3a68e2589 simplify
michael
parents: 18623
diff changeset
459 if(*p) free(*p - 3*vf->priv->stride[i/3]);
dea3a68e2589 simplify
michael
parents: 18623
diff changeset
460 *p= NULL;
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
461 }
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
462 free(vf->priv);
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
463 vf->priv=NULL;
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
464 }
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
465
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
466 //===========================================================================//
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
467 static int query_format(struct vf_instance_s* vf, unsigned int fmt){
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
468 switch(fmt){
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
469 case IMGFMT_YV12:
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
470 case IMGFMT_I420:
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
471 case IMGFMT_IYUV:
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
472 case IMGFMT_Y800:
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
473 case IMGFMT_Y8:
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
474 return vf_next_query_format(vf,fmt);
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
475 }
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
476 return 0;
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
477 }
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
478
21060
b37a53da3b8a allows to de- and reactivate yadif on the fly
gpoirier
parents: 20010
diff changeset
479 static int control(struct vf_instance_s* vf, int request, void* data){
b37a53da3b8a allows to de- and reactivate yadif on the fly
gpoirier
parents: 20010
diff changeset
480 switch (request){
b37a53da3b8a allows to de- and reactivate yadif on the fly
gpoirier
parents: 20010
diff changeset
481 case VFCTRL_GET_DEINTERLACE:
b37a53da3b8a allows to de- and reactivate yadif on the fly
gpoirier
parents: 20010
diff changeset
482 *(int*)data = vf->priv->do_deinterlace;
b37a53da3b8a allows to de- and reactivate yadif on the fly
gpoirier
parents: 20010
diff changeset
483 return CONTROL_OK;
b37a53da3b8a allows to de- and reactivate yadif on the fly
gpoirier
parents: 20010
diff changeset
484 case VFCTRL_SET_DEINTERLACE:
22116
c90733d6a870 skip first (green) frame
michael
parents: 21060
diff changeset
485 vf->priv->do_deinterlace = 2*!!*(int*)data;
21060
b37a53da3b8a allows to de- and reactivate yadif on the fly
gpoirier
parents: 20010
diff changeset
486 return CONTROL_OK;
b37a53da3b8a allows to de- and reactivate yadif on the fly
gpoirier
parents: 20010
diff changeset
487 }
b37a53da3b8a allows to de- and reactivate yadif on the fly
gpoirier
parents: 20010
diff changeset
488 return vf_next_control (vf, request, data);
b37a53da3b8a allows to de- and reactivate yadif on the fly
gpoirier
parents: 20010
diff changeset
489 }
b37a53da3b8a allows to de- and reactivate yadif on the fly
gpoirier
parents: 20010
diff changeset
490
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
491 static int open(vf_instance_t *vf, char* args){
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
492
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
493 vf->config=config;
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
494 vf->put_image=put_image;
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
495 vf->query_format=query_format;
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
496 vf->uninit=uninit;
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
497 vf->priv=malloc(sizeof(struct vf_priv_s));
21060
b37a53da3b8a allows to de- and reactivate yadif on the fly
gpoirier
parents: 20010
diff changeset
498 vf->control=control;
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
499 memset(vf->priv, 0, sizeof(struct vf_priv_s));
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
500
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
501 vf->priv->mode=0;
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
502 vf->priv->parity= -1;
21060
b37a53da3b8a allows to de- and reactivate yadif on the fly
gpoirier
parents: 20010
diff changeset
503 vf->priv->do_deinterlace=1;
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
504
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
505 if (args) sscanf(args, "%d:%d", &vf->priv->mode, &vf->priv->parity);
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
506
19830
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
507 filter_line = filter_line_c;
19923
7dcd96645457 Fix compilation if HAVE_MMX is defined but NAMED_ASM_ARGS isn't
reimar
parents: 19888
diff changeset
508 #if defined(HAVE_MMX) && defined(NAMED_ASM_ARGS)
19830
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
509 if(gCpuCaps.hasMMX2) filter_line = filter_line_mmx2;
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
510 #endif
a1a997376658 mmx implementation of yadif. 3.5x faster.
lorenm
parents: 19829
diff changeset
511
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
512 return 1;
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
513 }
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
514
25221
00fff9a3b735 Make all vf_info_t structs const
reimar
parents: 23458
diff changeset
515 const vf_info_t vf_info_yadif = {
18608
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
516 "Yet Another DeInterlacing Filter",
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
517 "yadif",
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
518 "Michael Niedermayer",
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
519 "",
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
520 open,
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
521 NULL
a80c7de8a4ba yet another deinterlacing filter
michael
parents:
diff changeset
522 };