Mercurial > mplayer.hg
annotate postproc/swscale.h @ 4401:8d00348d0d6b
nearest neighbor / sdl emulation ;) scaling (-sws 4)
author | michael |
---|---|
date | Mon, 28 Jan 2002 23:57:18 +0000 |
parents | 29fef3982238 |
children | 67abbf501b02 |
rev | line source |
---|---|
4295 | 1 /* |
2 Copyright (C) 2001-2002 Michael Niedermayer <michaelni@gmx.at> | |
3 | |
4 This program is free software; you can redistribute it and/or modify | |
5 it under the terms of the GNU General Public License as published by | |
6 the Free Software Foundation; either version 2 of the License, or | |
7 (at your option) any later version. | |
8 | |
9 This program is distributed in the hope that it will be useful, | |
10 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 GNU General Public License for more details. | |
13 | |
14 You should have received a copy of the GNU General Public License | |
15 along with this program; if not, write to the Free Software | |
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
17 */ | |
3272 | 18 |
4276
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
19 /* values for the flags, the stuff on the command line is different */ |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
20 #define SWS_FAST_BILINEAR 1 |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
21 #define SWS_BILINEAR 2 |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
22 #define SWS_BICUBIC 4 |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
23 #define SWS_X 8 |
4401
8d00348d0d6b
nearest neighbor / sdl emulation ;) scaling (-sws 4)
michael
parents:
4297
diff
changeset
|
24 #define SWS_POINT 0x10 |
4276
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
25 #define SWS_FULL_UV_IPOL 0x100 |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
26 #define SWS_PRINT_INFO 0x1000 |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
27 |
4290
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
28 #define SWS_MAX_REDUCE_CUTOFF 0.002 |
4276
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
29 |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
30 /* this struct should be aligned on at least 32-byte boundary */ |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
31 typedef struct{ |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
32 int srcW, srcH, dstW, dstH; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
33 int chrDstW, chrDstH; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
34 int lumXInc, chrXInc; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
35 int lumYInc, chrYInc; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
36 int dstFormat, srcFormat; |
4290
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
37 |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
38 int16_t **lumPixBuf; |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
39 int16_t **chrPixBuf; |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
40 int16_t *hLumFilter; |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
41 int16_t *hLumFilterPos; |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
42 int16_t *hChrFilter; |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
43 int16_t *hChrFilterPos; |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
44 int16_t *vLumFilter; |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
45 int16_t *vLumFilterPos; |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
46 int16_t *vChrFilter; |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
47 int16_t *vChrFilterPos; |
4276
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
48 |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
49 // Contain simply the values from v(Lum|Chr)Filter just nicely packed for mmx |
4290
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
50 int16_t *lumMmxFilter; |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
51 int16_t *chrMmxFilter; |
4276
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
52 |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
53 int hLumFilterSize; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
54 int hChrFilterSize; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
55 int vLumFilterSize; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
56 int vChrFilterSize; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
57 int vLumBufSize; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
58 int vChrBufSize; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
59 |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
60 uint8_t __attribute__((aligned(32))) funnyYCode[10000]; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
61 uint8_t __attribute__((aligned(32))) funnyUVCode[10000]; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
62 |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
63 int canMMX2BeUsed; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
64 |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
65 int lastInLumBuf; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
66 int lastInChrBuf; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
67 int lumBufIndex; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
68 int chrBufIndex; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
69 int dstY; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
70 int flags; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
71 } SwsContext; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
72 //FIXME check init (where 0) |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
73 |
4290
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
74 // when used for filters they must have an odd number of elements |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
75 // coeffs cannot be shared between vectors |
4276
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
76 typedef struct { |
4290
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
77 double *coeff; |
4276
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
78 int length; |
4290
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
79 } SwsVector; |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
80 |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
81 // vectors can be shared |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
82 typedef struct { |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
83 SwsVector *lumH; |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
84 SwsVector *lumV; |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
85 SwsVector *chrH; |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
86 SwsVector *chrV; |
4276
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
87 } SwsFilter; |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
88 |
2217 | 89 |
2519 | 90 // *** bilinear scaling and yuv->rgb & yuv->yuv conversion of yv12 slices: |
2217 | 91 // *** Note: it's called multiple times while decoding a frame, first time y==0 |
2519 | 92 // dstbpp == 12 -> yv12 output |
4276
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
93 // will use sws_flags |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
94 void SwScale_YV12slice(unsigned char* src[],int srcStride[], int srcSliceY, |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
95 int srcSliceH, uint8_t* dst[], int dstStride, int dstbpp, |
3209 | 96 int srcW, int srcH, int dstW, int dstH); |
4276
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
97 |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
98 // Obsolete, will be removed soon |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
99 void SwScale_Init(); |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
100 |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
101 |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
102 |
4290
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
103 void freeSwsContext(SwsContext *swsContext); |
4276
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
104 |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
105 SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags, |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
106 SwsFilter *srcFilter, SwsFilter *dstFilter); |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
107 |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
108 extern void (*swScale)(SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY, |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
109 int srcSliceH, uint8_t* dst[], int dstStride[]); |
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
110 |
4290
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
111 SwsVector *getGaussianVec(double variance, double quality); |
4297
29fef3982238
15/16 bit dithering in C (5% slower, can be disabled by comenting #define DITHER1XBPP out)
michael
parents:
4295
diff
changeset
|
112 SwsVector *getConstVec(double c, int length); |
4290
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
113 SwsVector *getIdentityVec(void); |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
114 void scaleVec(SwsVector *a, double scalar); |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
115 void normalizeVec(SwsVector *a, double height); |
4294
21dbbbbd5479
a few filters (should be removed/merged when arpis videofilter stuff is finished)
michael
parents:
4290
diff
changeset
|
116 void convVec(SwsVector *a, SwsVector *b); |
21dbbbbd5479
a few filters (should be removed/merged when arpis videofilter stuff is finished)
michael
parents:
4290
diff
changeset
|
117 void addVec(SwsVector *a, SwsVector *b); |
21dbbbbd5479
a few filters (should be removed/merged when arpis videofilter stuff is finished)
michael
parents:
4290
diff
changeset
|
118 void subVec(SwsVector *a, SwsVector *b); |
21dbbbbd5479
a few filters (should be removed/merged when arpis videofilter stuff is finished)
michael
parents:
4290
diff
changeset
|
119 void shiftVec(SwsVector *a, int shift); |
21dbbbbd5479
a few filters (should be removed/merged when arpis videofilter stuff is finished)
michael
parents:
4290
diff
changeset
|
120 SwsVector *cloneVec(SwsVector *a); |
4276
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
121 |
4290
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
122 void printVec(SwsVector *a); |
1f8ceb12284d
general convolution filtering of the source picture
michael
parents:
4276
diff
changeset
|
123 void freeVec(SwsVector *a); |
4276
9199d15cb4e0
removed global vars so that multiple swscalers can be used
michael
parents:
3344
diff
changeset
|
124 |