2 Copyright (C) 2001-2002 Michael Niedermayer <michaelni@gmx.at>
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.
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.
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
19 /* values for the flags, the stuff on the command line is different */
20 #define SWS_FAST_BILINEAR 1
21 #define SWS_BILINEAR 2
24 #define SWS_POINT 0x10
27 //the following 4 flags are not completly implemented
28 //internal chrominace subsamling info
29 #define SWS_FULL_CHR_V 0x100
30 #define SWS_FULL_CHR_H_INT 0x200
31 //input subsampling info
32 #define SWS_FULL_CHR_H_INP 0x400
33 #define SWS_DIRECT_BGR 0x800
35 #define SWS_PRINT_INFO 0x1000
37 #define SWS_MAX_REDUCE_CUTOFF 0.002
39 /* this struct should be aligned on at least 32-byte boundary */
40 typedef struct SwsContext{
41 int srcW, srcH, dstW, dstH;
42 int chrSrcW, chrSrcH, chrDstW, chrDstH;
45 int dstFormat, srcFormat;
50 int16_t *hLumFilterPos;
52 int16_t *hChrFilterPos;
54 int16_t *vLumFilterPos;
56 int16_t *vChrFilterPos;
58 // Contain simply the values from v(Lum|Chr)Filter just nicely packed for mmx
59 int16_t *lumMmxFilter;
60 int16_t *chrMmxFilter;
61 uint8_t formatConvBuffer[4000]; //FIXME dynamic alloc, but we have to change alot of code for this to be usefull
70 uint8_t __attribute__((aligned(32))) funnyYCode[10000];
71 uint8_t __attribute__((aligned(32))) funnyUVCode[10000];
72 int32_t *lumMmx2FilterPos;
73 int32_t *chrMmx2FilterPos;
74 int16_t *lumMmx2Filter;
75 int16_t *chrMmx2Filter;
86 void (*swScale)(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
87 int srcSliceH, uint8_t* dst[], int dstStride[]);
89 //FIXME check init (where 0)
91 // when used for filters they must have an odd number of elements
92 // coeffs cannot be shared between vectors
98 // vectors can be shared
107 // *** bilinear scaling and yuv->rgb & yuv->yuv conversion of yv12 slices:
108 // *** Note: it's called multiple times while decoding a frame, first time y==0
109 // dstbpp == 12 -> yv12 output
110 // will use sws_flags
111 void SwScale_YV12slice(unsigned char* src[],int srcStride[], int srcSliceY,
112 int srcSliceH, uint8_t* dst[], int dstStride, int dstbpp,
113 int srcW, int srcH, int dstW, int dstH);
115 // Obsolete, will be removed soon
120 void freeSwsContext(SwsContext *swsContext);
122 SwsContext *getSwsContextFromCmdLine(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat);
123 SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags,
124 SwsFilter *srcFilter, SwsFilter *dstFilter);
126 SwsVector *getGaussianVec(double variance, double quality);
127 SwsVector *getConstVec(double c, int length);
128 SwsVector *getIdentityVec(void);
129 void scaleVec(SwsVector *a, double scalar);
130 void normalizeVec(SwsVector *a, double height);
131 void convVec(SwsVector *a, SwsVector *b);
132 void addVec(SwsVector *a, SwsVector *b);
133 void subVec(SwsVector *a, SwsVector *b);
134 void shiftVec(SwsVector *a, int shift);
135 SwsVector *cloneVec(SwsVector *a);
137 void printVec(SwsVector *a);
138 void freeVec(SwsVector *a);