Mercurial > mplayer.hg
annotate libmpcodecs/vf_perspective.c @ 36802:621b61818a0f
configure: add -Zhigh-mem linker flag for OS/2
x264 encoder crashes due to memory allocation failure. This fixes the problem.
author | komh |
---|---|
date | Thu, 20 Feb 2014 13:59:34 +0000 |
parents | d6bc33320ae0 |
children |
rev | line source |
---|---|
8112 | 1 /* |
26727 | 2 * Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at> |
3 * | |
4 * This file is part of MPlayer. | |
5 * | |
6 * MPlayer is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * MPlayer is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License along | |
17 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
19 */ | |
8112 | 20 |
21 #include <stdio.h> | |
22 #include <stdlib.h> | |
23 #include <string.h> | |
24 #include <inttypes.h> | |
25 #include <assert.h> | |
26 #include <math.h> | |
27 | |
17012 | 28 #include "config.h" |
29 #include "mp_msg.h" | |
8112 | 30 |
28594
df67d03dde3b
Convert HAVE_MALLOC_H into a 0/1 definition, fixes the warning:
diego
parents:
26727
diff
changeset
|
31 #if HAVE_MALLOC_H |
8112 | 32 #include <malloc.h> |
33 #endif | |
34 | |
32748
d6bc33320ae0
Fix postprocessing and perspective filters on x86-64.
cehoyos
parents:
32747
diff
changeset
|
35 #include "libavutil/mem.h" |
d6bc33320ae0
Fix postprocessing and perspective filters on x86-64.
cehoyos
parents:
32747
diff
changeset
|
36 |
8112 | 37 #include "img_format.h" |
38 #include "mp_image.h" | |
39 #include "vf.h" | |
40 | |
41 #define SUB_PIXEL_BITS 8 | |
42 #define SUB_PIXELS (1<<SUB_PIXEL_BITS) | |
43 #define COEFF_BITS 11 | |
44 | |
45 //===========================================================================// | |
46 | |
47 struct vf_priv_s { | |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
48 double ref[4][2]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
49 int32_t coeff[1<<SUB_PIXEL_BITS][4]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
50 int32_t (*pv)[2]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
51 int pvStride; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
52 int cubic; |
8112 | 53 }; |
54 | |
55 | |
56 /***************************************************************************/ | |
57 | |
58 static void initPv(struct vf_priv_s *priv, int W, int H){ | |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
59 double a,b,c,d,e,f,g,h,D; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
60 double (*ref)[2]= priv->ref; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
61 int x,y; |
8112 | 62 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
63 g= ( (ref[0][0] - ref[1][0] - ref[2][0] + ref[3][0])*(ref[2][1] - ref[3][1]) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
64 - (ref[0][1] - ref[1][1] - ref[2][1] + ref[3][1])*(ref[2][0] - ref[3][0]))*H; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
65 h= ( (ref[0][1] - ref[1][1] - ref[2][1] + ref[3][1])*(ref[1][0] - ref[3][0]) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
66 - (ref[0][0] - ref[1][0] - ref[2][0] + ref[3][0])*(ref[1][1] - ref[3][1]))*W; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
67 D= (ref[1][0] - ref[3][0])*(ref[2][1] - ref[3][1]) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
68 - (ref[2][0] - ref[3][0])*(ref[1][1] - ref[3][1]); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28594
diff
changeset
|
69 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
70 a= D*(ref[1][0] - ref[0][0])*H + g*ref[1][0]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
71 b= D*(ref[2][0] - ref[0][0])*W + h*ref[2][0]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
72 c= D*ref[0][0]*W*H; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
73 d= D*(ref[1][1] - ref[0][1])*H + g*ref[1][1]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
74 e= D*(ref[2][1] - ref[0][1])*W + h*ref[2][1]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
75 f= D*ref[0][1]*W*H; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28594
diff
changeset
|
76 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
77 for(y=0; y<H; y++){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
78 for(x=0; x<W; x++){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
79 int u, v; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28594
diff
changeset
|
80 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
81 u= (int)floor( SUB_PIXELS*(a*x + b*y + c)/(g*x + h*y + D*W*H) + 0.5); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
82 v= (int)floor( SUB_PIXELS*(d*x + e*y + f)/(g*x + h*y + D*W*H) + 0.5); |
8112 | 83 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
84 priv->pv[x + y*W][0]= u; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
85 priv->pv[x + y*W][1]= v; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
86 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
87 } |
8112 | 88 } |
89 | |
90 static double getCoeff(double d){ | |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
91 double A= -0.60; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
92 double coeff; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28594
diff
changeset
|
93 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
94 d= fabs(d); |
8112 | 95 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
96 // Equation is from VirtualDub |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
97 if(d<1.0) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
98 coeff = (1.0 - (A+3.0)*d*d + (A+2.0)*d*d*d); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
99 else if(d<2.0) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
100 coeff = (-4.0*A + 8.0*A*d - 5.0*A*d*d + A*d*d*d); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
101 else |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
102 coeff=0.0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28594
diff
changeset
|
103 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
104 return coeff; |
8112 | 105 } |
106 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
107 static int config(struct vf_instance *vf, |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
108 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:
32537
diff
changeset
|
109 unsigned int flags, unsigned int outfmt){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
110 int i, j; |
8112 | 111 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
112 vf->priv->pvStride= width; |
32747
170106dd2ef2
Replace memalign() by av_malloc() in libmpcodecs. as it is not available in all platforms
michael
parents:
32702
diff
changeset
|
113 vf->priv->pv= av_malloc(width*height*2*sizeof(int32_t)); |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
114 initPv(vf->priv, width, height); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28594
diff
changeset
|
115 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
116 for(i=0; i<SUB_PIXELS; i++){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
117 double d= i/(double)SUB_PIXELS; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
118 double temp[4]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
119 double sum=0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28594
diff
changeset
|
120 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
121 for(j=0; j<4; j++) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
122 temp[j]= getCoeff(j - d - 1); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28594
diff
changeset
|
123 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
124 for(j=0; j<4; j++) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
125 sum+= temp[j]; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28594
diff
changeset
|
126 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
127 for(j=0; j<4; j++) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
128 vf->priv->coeff[i][j]= (int)floor((1<<COEFF_BITS)*temp[j]/sum + 0.5); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
129 } |
8112 | 130 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
131 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); |
8112 | 132 } |
133 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
134 static void uninit(struct vf_instance *vf){ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
135 if(!vf->priv) return; |
8112 | 136 |
32747
170106dd2ef2
Replace memalign() by av_malloc() in libmpcodecs. as it is not available in all platforms
michael
parents:
32702
diff
changeset
|
137 av_free(vf->priv->pv); |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
138 vf->priv->pv= NULL; |
8112 | 139 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
140 free(vf->priv); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
141 vf->priv=NULL; |
8112 | 142 } |
143 | |
144 static inline void resampleCubic(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, struct vf_priv_s *privParam, int xShift, int yShift){ | |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
145 int x, y; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
146 struct vf_priv_s priv= *privParam; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28594
diff
changeset
|
147 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
148 for(y=0; y<h; y++){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
149 for(x=0; x<w; x++){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
150 int u, v, subU, subV, sum, sx, sy; |
8112 | 151 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
152 sx= x << xShift; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
153 sy= y << yShift; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
154 u= priv.pv[sx + sy*priv.pvStride][0]>>xShift; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
155 v= priv.pv[sx + sy*priv.pvStride][1]>>yShift; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
156 subU= u & (SUB_PIXELS-1); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
157 subV= v & (SUB_PIXELS-1); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
158 u >>= SUB_PIXEL_BITS; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
159 v >>= SUB_PIXEL_BITS; |
8112 | 160 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
161 if(u>0 && v>0 && u<w-2 && v<h-2){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
162 const int index= u + v*srcStride; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
163 const int a= priv.coeff[subU][0]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
164 const int b= priv.coeff[subU][1]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
165 const int c= priv.coeff[subU][2]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
166 const int d= priv.coeff[subU][3]; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28594
diff
changeset
|
167 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
168 sum= |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
169 priv.coeff[subV][0]*( a*src[index - 1 - srcStride] + b*src[index - 0 - srcStride] |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
170 + c*src[index + 1 - srcStride] + d*src[index + 2 - srcStride]) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
171 +priv.coeff[subV][1]*( a*src[index - 1 ] + b*src[index - 0 ] |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
172 + c*src[index + 1 ] + d*src[index + 2 ]) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
173 +priv.coeff[subV][2]*( a*src[index - 1 + srcStride] + b*src[index - 0 + srcStride] |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
174 + c*src[index + 1 + srcStride] + d*src[index + 2 + srcStride]) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
175 +priv.coeff[subV][3]*( a*src[index - 1+2*srcStride] + b*src[index - 0+2*srcStride] |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
176 + c*src[index + 1+2*srcStride] + d*src[index + 2+2*srcStride]); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
177 }else{ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
178 int dx, dy; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
179 sum=0; |
8112 | 180 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
181 for(dy=0; dy<4; dy++){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
182 int iy= v + dy - 1; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
183 if (iy< 0) iy=0; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
184 else if(iy>=h) iy=h-1; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
185 for(dx=0; dx<4; dx++){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
186 int ix= u + dx - 1; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
187 if (ix< 0) ix=0; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
188 else if(ix>=w) ix=w-1; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28594
diff
changeset
|
189 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
190 sum+= priv.coeff[subU][dx]*priv.coeff[subV][dy] |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
191 *src[ ix + iy*srcStride]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
192 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
193 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
194 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
195 sum= (sum + (1<<(COEFF_BITS*2-1)) ) >> (COEFF_BITS*2); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
196 if(sum&~255){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
197 if(sum<0) sum=0; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
198 else sum=255; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
199 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
200 dst[ x + y*dstStride]= sum; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
201 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
202 } |
8112 | 203 } |
204 | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28594
diff
changeset
|
205 static inline void resampleLinear(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
206 struct vf_priv_s *privParam, int xShift, int yShift){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
207 int x, y; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
208 struct vf_priv_s priv= *privParam; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28594
diff
changeset
|
209 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
210 for(y=0; y<h; y++){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
211 for(x=0; x<w; x++){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
212 int u, v, subU, subV, sum, sx, sy, index, subUI, subVI; |
8112 | 213 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
214 sx= x << xShift; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
215 sy= y << yShift; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
216 u= priv.pv[sx + sy*priv.pvStride][0]>>xShift; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
217 v= priv.pv[sx + sy*priv.pvStride][1]>>yShift; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
218 subU= u & (SUB_PIXELS-1); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
219 subV= v & (SUB_PIXELS-1); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
220 u >>= SUB_PIXEL_BITS; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
221 v >>= SUB_PIXEL_BITS; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
222 index= u + v*srcStride; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
223 subUI= SUB_PIXELS - subU; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
224 subVI= SUB_PIXELS - subV; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28594
diff
changeset
|
225 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
226 if((unsigned)u < (unsigned)(w - 1)){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
227 if((unsigned)v < (unsigned)(h - 1)){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
228 sum= subVI*(subUI*src[index ] + subU*src[index +1]) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
229 +subV *(subUI*src[index+srcStride] + subU*src[index+srcStride+1]); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
230 sum= (sum + (1<<(SUB_PIXEL_BITS*2-1)) ) >> (SUB_PIXEL_BITS*2); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
231 }else{ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
232 if(v<0) v= 0; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
233 else v= h-1; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
234 index= u + v*srcStride; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
235 sum= subUI*src[index] + subU*src[index+1]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
236 sum= (sum + (1<<(SUB_PIXEL_BITS-1)) ) >> SUB_PIXEL_BITS; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
237 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
238 }else{ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
239 if((unsigned)v < (unsigned)(h - 1)){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
240 if(u<0) u= 0; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
241 else u= w-1; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
242 index= u + v*srcStride; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
243 sum= subVI*src[index] + subV*src[index+srcStride]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
244 sum= (sum + (1<<(SUB_PIXEL_BITS-1)) ) >> SUB_PIXEL_BITS; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
245 }else{ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
246 if(u<0) u= 0; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
247 else u= w-1; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
248 if(v<0) v= 0; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
249 else v= h-1; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
250 index= u + v*srcStride; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
251 sum= src[index]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
252 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
253 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
254 if(sum&~255){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
255 if(sum<0) sum=0; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
256 else sum=255; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
257 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
258 dst[ x + y*dstStride]= sum; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
259 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
260 } |
8112 | 261 } |
262 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
263 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:
32537
diff
changeset
|
264 int cw= mpi->w >> mpi->chroma_x_shift; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
265 int ch= mpi->h >> mpi->chroma_y_shift; |
8112 | 266 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
267 mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
268 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
269 mpi->w,mpi->h); |
8112 | 270 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
271 assert(mpi->flags&MP_IMGFLAG_PLANAR); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28594
diff
changeset
|
272 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
273 if(vf->priv->cubic){ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
274 resampleCubic(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
275 vf->priv, 0, 0); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
276 resampleCubic(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1], |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
277 vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
278 resampleCubic(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2], |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
279 vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
280 }else{ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
281 resampleLinear(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
282 vf->priv, 0, 0); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
283 resampleLinear(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1], |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
284 vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
285 resampleLinear(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2], |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
286 vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
287 } |
8112 | 288 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
289 return vf_next_put_image(vf,dmpi, pts); |
8112 | 290 } |
291 | |
292 //===========================================================================// | |
293 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
294 static int query_format(struct vf_instance *vf, unsigned int fmt){ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
295 switch(fmt) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
296 { |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
297 case IMGFMT_YV12: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
298 case IMGFMT_I420: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
299 case IMGFMT_IYUV: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
300 case IMGFMT_YVU9: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
301 case IMGFMT_444P: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
302 case IMGFMT_422P: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
303 case IMGFMT_411P: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
304 return vf_next_query_format(vf, fmt); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
305 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
306 return 0; |
8112 | 307 } |
308 | |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
29263
diff
changeset
|
309 static int vf_open(vf_instance_t *vf, char *args){ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
310 int e; |
8112 | 311 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
312 vf->config=config; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
313 vf->put_image=put_image; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
314 // vf->get_image=get_image; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
315 vf->query_format=query_format; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
316 vf->uninit=uninit; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
317 vf->priv=malloc(sizeof(struct vf_priv_s)); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
318 memset(vf->priv, 0, sizeof(struct vf_priv_s)); |
8112 | 319 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
320 if(args==NULL) return 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28594
diff
changeset
|
321 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
322 e=sscanf(args, "%lf:%lf:%lf:%lf:%lf:%lf:%lf:%lf:%d", |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
323 &vf->priv->ref[0][0], &vf->priv->ref[0][1], |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
324 &vf->priv->ref[1][0], &vf->priv->ref[1][1], |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
325 &vf->priv->ref[2][0], &vf->priv->ref[2][1], |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
326 &vf->priv->ref[3][0], &vf->priv->ref[3][1], |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
327 &vf->priv->cubic |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
328 ); |
8112 | 329 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
330 if(e!=9) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
331 return 0; |
8112 | 332 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
32537
diff
changeset
|
333 return 1; |
8112 | 334 } |
335 | |
25221 | 336 const vf_info_t vf_info_perspective = { |
8112 | 337 "perspective correcture", |
338 "perspective", | |
339 "Michael Niedermayer", | |
340 "", | |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
29263
diff
changeset
|
341 vf_open, |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8112
diff
changeset
|
342 NULL |
8112 | 343 }; |
344 | |
345 //===========================================================================// |