annotate libmpcodecs/vf_kerndeint.c @ 35811:2ce01f3d3b37

Switch from OpenGL.h to gl.h The former seems to miss some needed defines from OSX 10.8 on, and gl.h seems to work without issues at the very least down to 10.5
author reimar
date Sun, 27 Jan 2013 15:33:31 +0000
parents 7af3e6f901fd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
1 /*
26727
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
2 * Original AVISynth Filter Copyright (C) 2003 Donald A. Graft
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
3 * Adapted to MPlayer by Tobias Diedrich
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
4 *
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
5 * This file is part of MPlayer.
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
6 *
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
7 * MPlayer is free software; you can redistribute it and/or modify
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
8 * it under the terms of the GNU General Public License as published by
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
10 * (at your option) any later version.
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
11 *
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
12 * MPlayer is distributed in the hope that it will be useful,
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
15 * GNU General Public License for more details.
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
16 *
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
17 * You should have received a copy of the GNU General Public License along
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
18 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
20 */
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
21
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
22 #include <stdio.h>
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
23 #include <stdlib.h>
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
24 #include <string.h>
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
25 #include <inttypes.h>
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
26 #include <math.h>
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
27
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 11991
diff changeset
28 #include "mp_msg.h"
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
29 #include "img_format.h"
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
30 #include "mp_image.h"
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
31 #include "vf.h"
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 11991
diff changeset
32 #include "libvo/fastmemcpy.h"
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
33
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
34 //===========================================================================//
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
35
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
36 struct vf_priv_s {
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
37 int frame;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
38 int map;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
39 int order;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
40 int thresh;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
41 int sharp;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
42 int twoway;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
43 int do_deinterlace;
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
44 };
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
45
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
46
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
47 /***************************************************************************/
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
48
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
49
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
50 static int config(struct vf_instance *vf,
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
51 int width, int height, int d_width, int d_height,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
52 unsigned int flags, unsigned int outfmt){
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
53
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
54 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
55 }
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
56
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
57
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
58 static void uninit(struct vf_instance *vf)
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
59 {
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
60 free(vf->priv);
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
61 }
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
62
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
63 static inline int IsRGB(mp_image_t *mpi)
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
64 {
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
65 return mpi->imgfmt == IMGFMT_RGB;
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
66 }
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
67
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
68 static inline int IsYUY2(mp_image_t *mpi)
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
69 {
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
70 return mpi->imgfmt == IMGFMT_YUY2;
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
71 }
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
72
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
73 #define PLANAR_Y 0
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
74 #define PLANAR_U 1
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
75 #define PLANAR_V 2
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
76
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
77 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
78 int cw= mpi->w >> mpi->chroma_x_shift;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
79 int ch= mpi->h >> mpi->chroma_y_shift;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
80 int W = mpi->w, H = mpi->h;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
81 const unsigned char *prvp, *prvpp, *prvpn, *prvpnn, *prvppp, *prvp4p, *prvp4n;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
82 const unsigned char *srcp_saved;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
83 const unsigned char *srcp, *srcpp, *srcpn, *srcpnn, *srcppp, *srcp3p, *srcp3n, *srcp4p, *srcp4n;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
84 unsigned char *dstp, *dstp_saved;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
85 int src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
86 int psrc_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
87 int dst_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
88 int x, y, z;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
89 int n = vf->priv->frame++;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
90 int val, hi, lo, w, h;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
91 double valf;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
92 int plane;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
93 int threshold = vf->priv->thresh;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
94 int order = vf->priv->order;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
95 int map = vf->priv->map;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
96 int sharp = vf->priv->sharp;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
97 int twoway = vf->priv->twoway;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
98 mp_image_t *dmpi, *pmpi;
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
99
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
100 if(!vf->priv->do_deinterlace)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
101 return vf_next_put_image(vf, mpi, pts);
22757
6c3b8d7724f7 allows to de- and reactivate kerndeint on the fly
cehoyos
parents: 21977
diff changeset
102
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
103 dmpi=vf_get_image(vf->next,mpi->imgfmt,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
104 MP_IMGTYPE_IP, MP_IMGFLAG_ACCEPT_STRIDE,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
105 mpi->w,mpi->h);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
106 pmpi=vf_get_image(vf->next,mpi->imgfmt,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
107 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
108 mpi->w,mpi->h);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
109 if(!dmpi) return 0;
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
110
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
111 for (z=0; z<mpi->num_planes; z++) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
112 if (z == 0) plane = PLANAR_Y;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
113 else if (z == 1) plane = PLANAR_U;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
114 else plane = PLANAR_V;
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
115
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
116 h = plane == PLANAR_Y ? H : ch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
117 w = plane == PLANAR_Y ? W : cw;
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
118
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
119 srcp = srcp_saved = mpi->planes[z];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
120 src_pitch = mpi->stride[z];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
121 psrc_pitch = pmpi->stride[z];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
122 dstp = dstp_saved = dmpi->planes[z];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
123 dst_pitch = dmpi->stride[z];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
124 srcp = srcp_saved + (1-order) * src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
125 dstp = dstp_saved + (1-order) * dst_pitch;
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
126
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
127 for (y=0; y<h; y+=2) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
128 fast_memcpy(dstp, srcp, w);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
129 srcp += 2*src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
130 dstp += 2*dst_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
131 }
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
132
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
133 // Copy through the lines that will be missed below.
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
134 fast_memcpy(dstp_saved + order*dst_pitch, srcp_saved + (1-order)*src_pitch, w);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
135 fast_memcpy(dstp_saved + (2+order)*dst_pitch, srcp_saved + (3-order)*src_pitch, w);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
136 fast_memcpy(dstp_saved + (h-2+order)*dst_pitch, srcp_saved + (h-1-order)*src_pitch, w);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
137 fast_memcpy(dstp_saved + (h-4+order)*dst_pitch, srcp_saved + (h-3-order)*src_pitch, w);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
138 /* For the other field choose adaptively between using the previous field
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
139 or the interpolant from the current field. */
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
140
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
141 prvp = pmpi->planes[z] + 5*psrc_pitch - (1-order)*psrc_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
142 prvpp = prvp - psrc_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
143 prvppp = prvp - 2*psrc_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
144 prvp4p = prvp - 4*psrc_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
145 prvpn = prvp + psrc_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
146 prvpnn = prvp + 2*psrc_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
147 prvp4n = prvp + 4*psrc_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
148 srcp = srcp_saved + 5*src_pitch - (1-order)*src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
149 srcpp = srcp - src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
150 srcppp = srcp - 2*src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
151 srcp3p = srcp - 3*src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
152 srcp4p = srcp - 4*src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
153 srcpn = srcp + src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
154 srcpnn = srcp + 2*src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
155 srcp3n = srcp + 3*src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
156 srcp4n = srcp + 4*src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
157 dstp = dstp_saved + 5*dst_pitch - (1-order)*dst_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
158 for (y = 5 - (1-order); y <= h - 5 - (1-order); y+=2)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
159 {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
160 for (x = 0; x < w; x++)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
161 {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
162 if ((threshold == 0) || (n == 0) ||
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
163 (abs((int)prvp[x] - (int)srcp[x]) > threshold) ||
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
164 (abs((int)prvpp[x] - (int)srcpp[x]) > threshold) ||
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
165 (abs((int)prvpn[x] - (int)srcpn[x]) > threshold))
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
166 {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
167 if (map == 1)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
168 {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
169 int g = x & ~3;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
170 if (IsRGB(mpi) == 1)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
171 {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
172 dstp[g++] = 255;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
173 dstp[g++] = 255;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
174 dstp[g++] = 255;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
175 dstp[g] = 255;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
176 x = g;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
177 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
178 else if (IsYUY2(mpi) == 1)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
179 {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
180 dstp[g++] = 235;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
181 dstp[g++] = 128;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
182 dstp[g++] = 235;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
183 dstp[g] = 128;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
184 x = g;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
185 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
186 else
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
187 {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
188 if (plane == PLANAR_Y) dstp[x] = 235;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
189 else dstp[x] = 128;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
190 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
191 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
192 else
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
193 {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
194 if (IsRGB(mpi))
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
195 {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
196 hi = 255;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
197 lo = 0;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
198 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
199 else if (IsYUY2(mpi))
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
200 {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
201 hi = (x & 1) ? 240 : 235;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
202 lo = 16;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
203 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
204 else
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
205 {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
206 hi = (plane == PLANAR_Y) ? 235 : 240;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
207 lo = 16;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
208 }
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
209
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
210 if (sharp == 1)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
211 {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
212 if (twoway == 1)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
213 valf = + 0.526*((int)srcpp[x] + (int)srcpn[x])
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
214 + 0.170*((int)srcp[x] + (int)prvp[x])
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
215 - 0.116*((int)srcppp[x] + (int)srcpnn[x] + (int)prvppp[x] + (int)prvpnn[x])
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
216 - 0.026*((int)srcp3p[x] + (int)srcp3n[x])
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
217 + 0.031*((int)srcp4p[x] + (int)srcp4n[x] + (int)prvp4p[x] + (int)prvp4n[x]);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
218 else
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
219 valf = + 0.526*((int)srcpp[x] + (int)srcpn[x])
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
220 + 0.170*((int)prvp[x])
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
221 - 0.116*((int)prvppp[x] + (int)prvpnn[x])
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
222 - 0.026*((int)srcp3p[x] + (int)srcp3n[x])
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
223 + 0.031*((int)prvp4p[x] + (int)prvp4p[x]);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
224 if (valf > hi) valf = hi;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
225 else if (valf < lo) valf = lo;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
226 dstp[x] = (int) valf;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
227 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
228 else
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
229 {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
230 if (twoway == 1)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
231 val = (8*((int)srcpp[x] + (int)srcpn[x]) + 2*((int)srcp[x] + (int)prvp[x]) -
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
232 (int)(srcppp[x]) - (int)(srcpnn[x]) -
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
233 (int)(prvppp[x]) - (int)(prvpnn[x])) >> 4;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
234 else
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
235 val = (8*((int)srcpp[x] + (int)srcpn[x]) + 2*((int)prvp[x]) -
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
236 (int)(prvppp[x]) - (int)(prvpnn[x])) >> 4;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
237 if (val > hi) val = hi;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
238 else if (val < lo) val = lo;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
239 dstp[x] = (int) val;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
240 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
241 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
242 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
243 else
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
244 {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
245 dstp[x] = srcp[x];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
246 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
247 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
248 prvp += 2*psrc_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
249 prvpp += 2*psrc_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
250 prvppp += 2*psrc_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
251 prvpn += 2*psrc_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
252 prvpnn += 2*psrc_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
253 prvp4p += 2*psrc_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
254 prvp4n += 2*psrc_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
255 srcp += 2*src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
256 srcpp += 2*src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
257 srcppp += 2*src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
258 srcp3p += 2*src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
259 srcp4p += 2*src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
260 srcpn += 2*src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
261 srcpnn += 2*src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
262 srcp3n += 2*src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
263 srcp4n += 2*src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
264 dstp += 2*dst_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
265 }
11879
205d12acbb5f 10l fix by Jindrich Makovicka
ranma
parents: 11869
diff changeset
266
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
267 srcp = mpi->planes[z];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
268 dstp = pmpi->planes[z];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
269 for (y=0; y<h; y++) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
270 fast_memcpy(dstp, srcp, w);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
271 srcp += src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
272 dstp += psrc_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
273 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
274 }
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
275
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
276 return vf_next_put_image(vf,dmpi, pts);
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
277 }
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
278
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
279 //===========================================================================//
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
280
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
281 static int query_format(struct vf_instance *vf, unsigned int fmt){
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
282 switch(fmt)
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
283 {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
284 case IMGFMT_YV12:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
285 case IMGFMT_RGB:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
286 case IMGFMT_YUY2:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
287 return vf_next_query_format(vf, fmt);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
288 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
289 return 0;
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
290 }
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
291
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
292 static int control(struct vf_instance *vf, int request, void* data){
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
293 switch (request)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
294 {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
295 case VFCTRL_GET_DEINTERLACE:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
296 *(int*)data = vf->priv->do_deinterlace;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
297 return CONTROL_OK;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
298 case VFCTRL_SET_DEINTERLACE:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
299 vf->priv->do_deinterlace = *(int*)data;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
300 return CONTROL_OK;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
301 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
302 return vf_next_control (vf, request, data);
22757
6c3b8d7724f7 allows to de- and reactivate kerndeint on the fly
cehoyos
parents: 21977
diff changeset
303 }
6c3b8d7724f7 allows to de- and reactivate kerndeint on the fly
cehoyos
parents: 21977
diff changeset
304
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 29087
diff changeset
305 static int vf_open(vf_instance_t *vf, char *args){
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
306
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
307 vf->control=control;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
308 vf->config=config;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
309 vf->put_image=put_image;
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
310 vf->query_format=query_format;
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
311 vf->uninit=uninit;
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
312 vf->priv=malloc(sizeof(struct vf_priv_s));
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
313 memset(vf->priv, 0, sizeof(struct vf_priv_s));
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
314
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
315 vf->priv->frame = 0;
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
316
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
317 vf->priv->map = 0;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
318 vf->priv->order = 0;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
319 vf->priv->thresh = 10;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
320 vf->priv->sharp = 0;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
321 vf->priv->twoway = 0;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
322 vf->priv->do_deinterlace=1;
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
323
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
324 if (args)
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
325 {
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
326 sscanf(args, "%d:%d:%d:%d:%d",
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
327 &vf->priv->thresh, &vf->priv->map,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
328 &vf->priv->order, &vf->priv->sharp,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
329 &vf->priv->twoway);
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
330 }
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
331 if (vf->priv->order > 1) vf->priv->order = 1;
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
332
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
333 return 1;
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
334 }
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
335
25221
00fff9a3b735 Make all vf_info_t structs const
reimar
parents: 23457
diff changeset
336 const vf_info_t vf_info_kerndeint = {
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
337 "Kernel Deinterlacer",
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
338 "kerndeint",
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
339 "Donald Graft",
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
340 "",
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 29087
diff changeset
341 vf_open,
11869
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
342 NULL
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
343 };
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
344
c10bd91a4eb2 kerndeint adaptive deinterlacer
ranma
parents:
diff changeset
345 //===========================================================================//