Mercurial > mplayer.hg
annotate libmpcodecs/vf_decimate.c @ 19032:55990b84e83c
Sync with latest FFmpeg build system changes:
All AMR defines now sport a CONFIG_ prefix for consistency.
author | diego |
---|---|
date | Wed, 12 Jul 2006 16:59:54 +0000 |
parents | 7b408d60de9e |
children | 6334c14b38eb |
rev | line source |
---|---|
10150
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
1 #include <stdio.h> |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
2 #include <stdlib.h> |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
3 #include <string.h> |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
4 |
17012 | 5 #include "config.h" |
6 #include "mp_msg.h" | |
7 #include "cpudetect.h" | |
18104
7b408d60de9e
add support for intel mac. mp3lib is not fixed yet.
nplourde
parents:
17906
diff
changeset
|
8 #include "asmalign.h" |
10150
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
9 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
10 #include "img_format.h" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
11 #include "mp_image.h" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
12 #include "vf.h" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
13 |
17012 | 14 #include "libvo/fastmemcpy.h" |
10150
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
15 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
16 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
17 struct vf_priv_s { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
18 int hi, lo; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
19 float frac; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
20 int max, last, cnt; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
21 }; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
22 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
23 #ifdef HAVE_MMX |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
24 static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
25 { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
26 volatile short out[4]; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
27 asm ( |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
28 "movl $8, %%ecx \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
29 "pxor %%mm4, %%mm4 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
30 "pxor %%mm7, %%mm7 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
31 |
18104
7b408d60de9e
add support for intel mac. mp3lib is not fixed yet.
nplourde
parents:
17906
diff
changeset
|
32 ASMALIGN16 |
10150
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
33 "1: \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
34 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10150
diff
changeset
|
35 "movq (%%"REG_S"), %%mm0 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10150
diff
changeset
|
36 "movq (%%"REG_S"), %%mm2 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10150
diff
changeset
|
37 "add %%"REG_a", %%"REG_S" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10150
diff
changeset
|
38 "movq (%%"REG_D"), %%mm1 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10150
diff
changeset
|
39 "add %%"REG_b", %%"REG_D" \n\t" |
10150
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
40 "psubusb %%mm1, %%mm2 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
41 "psubusb %%mm0, %%mm1 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
42 "movq %%mm2, %%mm0 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
43 "movq %%mm1, %%mm3 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
44 "punpcklbw %%mm7, %%mm0 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
45 "punpcklbw %%mm7, %%mm1 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
46 "punpckhbw %%mm7, %%mm2 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
47 "punpckhbw %%mm7, %%mm3 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
48 "paddw %%mm0, %%mm4 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
49 "paddw %%mm1, %%mm4 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
50 "paddw %%mm2, %%mm4 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
51 "paddw %%mm3, %%mm4 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
52 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
53 "decl %%ecx \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
54 "jnz 1b \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10150
diff
changeset
|
55 "movq %%mm4, (%%"REG_d") \n\t" |
10150
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
56 "emms \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
57 : |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10150
diff
changeset
|
58 : "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out) |
10150
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
59 : "memory" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
60 ); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
61 return out[0]+out[1]+out[2]+out[3]; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
62 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
63 #endif |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
64 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
65 static int diff_C(unsigned char *old, unsigned char *new, int os, int ns) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
66 { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
67 int x, y, d=0; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
68 for (y = 8; y; y--) { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
69 for (x = 8; x; x--) { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
70 d += abs(new[x] - old[x]); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
71 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
72 new += ns; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
73 old += os; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
74 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
75 return d; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
76 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
77 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
78 static int (*diff)(unsigned char *, unsigned char *, int, int); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
79 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
80 static int diff_to_drop_plane(int hi, int lo, float frac, unsigned char *old, unsigned char *new, int w, int h, int os, int ns) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
81 { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
82 int x, y; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
83 int d, c=0; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
84 int t = (w/16)*(h/16)*frac; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
85 for (y = 0; y < h-7; y += 4) { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
86 for (x = 8; x < w-7; x += 4) { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
87 d = diff(old+x+y*os, new+x+y*ns, os, ns); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
88 if (d > hi) return 0; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
89 if (d > lo) { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
90 c++; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
91 if (c > t) return 0; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
92 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
93 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
94 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
95 return 1; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
96 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
97 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
98 static int diff_to_drop(int hi, int lo, float frac, mp_image_t *old, mp_image_t *new) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
99 { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
100 if (new->flags & MP_IMGFLAG_PLANAR) { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
101 return diff_to_drop_plane(hi,lo,frac, old->planes[0], new->planes[0], |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
102 new->w, new->h, old->stride[0], new->stride[0]) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
103 && diff_to_drop_plane(hi,lo,frac, old->planes[1], new->planes[1], |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
104 new->chroma_width, new->chroma_height, |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
105 old->stride[1], new->stride[1]) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
106 && diff_to_drop_plane(hi,lo,frac, old->planes[2], new->planes[2], |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
107 new->chroma_width, new->chroma_height, |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
108 old->stride[2], new->stride[2]); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
109 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
110 return diff_to_drop_plane(hi,lo,frac, old->planes[0], new->planes[0], |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
111 new->w*(new->bpp/8), new->h, old->stride[0], new->stride[0]); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
112 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
113 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
114 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts) |
10150
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
115 { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
116 mp_image_t *dmpi; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
117 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
118 dmpi = vf_get_image(vf->next, mpi->imgfmt, |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
119 MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
120 MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE, |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
121 mpi->width, mpi->height); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
122 dmpi->qscale = mpi->qscale; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
123 dmpi->qstride = mpi->qstride; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
124 dmpi->qscale_type = mpi->qscale_type; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
125 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
126 if (diff_to_drop(vf->priv->hi, vf->priv->lo, vf->priv->frac, dmpi, mpi)) { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
127 if (vf->priv->max == 0) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
128 return 0; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
129 else if ((vf->priv->max > 0) && (vf->priv->cnt++ < vf->priv->max)) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
130 return 0; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
131 else if ((vf->priv->max < 0) && (vf->priv->last+1 >= -vf->priv->max)) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
132 return vf->priv->last=0; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
133 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
134 vf->priv->last++; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
135 vf->priv->cnt=0; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
136 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
137 memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
138 dmpi->stride[0], mpi->stride[0]); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
139 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
140 memcpy_pic(dmpi->planes[1], mpi->planes[1], |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
141 mpi->chroma_width, mpi->chroma_height, |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
142 dmpi->stride[1], mpi->stride[1]); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
143 memcpy_pic(dmpi->planes[2], mpi->planes[2], |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
144 mpi->chroma_width, mpi->chroma_height, |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
145 dmpi->stride[2], mpi->stride[2]); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
146 } |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
147 return vf_next_put_image(vf, dmpi, pts); |
10150
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
148 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
149 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
150 static void uninit(struct vf_instance_s* vf) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
151 { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
152 free(vf->priv); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
153 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
154 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
155 static int open(vf_instance_t *vf, char* args) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
156 { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
157 struct vf_priv_s *p; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
158 vf->put_image = put_image; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
159 vf->uninit = uninit; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
160 vf->default_reqs = VFCAP_ACCEPT_STRIDE; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
161 vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
162 p->max = 0; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
163 p->hi = 64*12; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
164 p->lo = 64*5; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
165 p->frac = 0.33; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
166 if (args) sscanf(args, "%d:%d:%d:%f", &p->max, &p->hi, &p->lo, &p->frac); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
167 diff = diff_C; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
168 #ifdef HAVE_MMX |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
169 if(gCpuCaps.hasMMX) diff = diff_MMX; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
170 #endif |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
171 return 1; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
172 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
173 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
174 vf_info_t vf_info_decimate = { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
175 "near-duplicate frame remover", |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
176 "decimate", |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
177 "Rich Felker", |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
178 "", |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
179 open, |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
180 NULL |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
181 }; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
182 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
183 |