annotate libmpcodecs/vf_yadif.c @ 33785:0c42fbe235d3

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