00001 /* 00002 * Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at> 00003 * 00004 * This file is part of FFmpeg. 00005 * 00006 * FFmpeg is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * FFmpeg is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with FFmpeg; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 #ifndef SWSCALE_SWSCALE_H 00022 #define SWSCALE_SWSCALE_H 00023 00030 #include "libavutil/avutil.h" 00031 00032 #define LIBSWSCALE_VERSION_MAJOR 0 00033 #define LIBSWSCALE_VERSION_MINOR 7 00034 #define LIBSWSCALE_VERSION_MICRO 1 00035 00036 #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ 00037 LIBSWSCALE_VERSION_MINOR, \ 00038 LIBSWSCALE_VERSION_MICRO) 00039 #define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \ 00040 LIBSWSCALE_VERSION_MINOR, \ 00041 LIBSWSCALE_VERSION_MICRO) 00042 #define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT 00043 00044 #define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION) 00045 00049 unsigned swscale_version(void); 00050 00051 /* values for the flags, the stuff on the command line is different */ 00052 #define SWS_FAST_BILINEAR 1 00053 #define SWS_BILINEAR 2 00054 #define SWS_BICUBIC 4 00055 #define SWS_X 8 00056 #define SWS_POINT 0x10 00057 #define SWS_AREA 0x20 00058 #define SWS_BICUBLIN 0x40 00059 #define SWS_GAUSS 0x80 00060 #define SWS_SINC 0x100 00061 #define SWS_LANCZOS 0x200 00062 #define SWS_SPLINE 0x400 00063 00064 #define SWS_SRC_V_CHR_DROP_MASK 0x30000 00065 #define SWS_SRC_V_CHR_DROP_SHIFT 16 00066 00067 #define SWS_PARAM_DEFAULT 123456 00068 00069 #define SWS_PRINT_INFO 0x1000 00070 00071 //the following 3 flags are not completely implemented 00072 //internal chrominace subsampling info 00073 #define SWS_FULL_CHR_H_INT 0x2000 00074 //input subsampling info 00075 #define SWS_FULL_CHR_H_INP 0x4000 00076 #define SWS_DIRECT_BGR 0x8000 00077 #define SWS_ACCURATE_RND 0x40000 00078 #define SWS_BITEXACT 0x80000 00079 00080 #define SWS_CPU_CAPS_MMX 0x80000000 00081 #define SWS_CPU_CAPS_MMX2 0x20000000 00082 #define SWS_CPU_CAPS_3DNOW 0x40000000 00083 #define SWS_CPU_CAPS_ALTIVEC 0x10000000 00084 #define SWS_CPU_CAPS_BFIN 0x01000000 00085 00086 #define SWS_MAX_REDUCE_CUTOFF 0.002 00087 00088 #define SWS_CS_ITU709 1 00089 #define SWS_CS_FCC 4 00090 #define SWS_CS_ITU601 5 00091 #define SWS_CS_ITU624 5 00092 #define SWS_CS_SMPTE170M 5 00093 #define SWS_CS_SMPTE240M 7 00094 #define SWS_CS_DEFAULT 5 00095 00096 00097 00098 // when used for filters they must have an odd number of elements 00099 // coeffs cannot be shared between vectors 00100 typedef struct { 00101 double *coeff; 00102 int length; 00103 } SwsVector; 00104 00105 // vectors can be shared 00106 typedef struct { 00107 SwsVector *lumH; 00108 SwsVector *lumV; 00109 SwsVector *chrH; 00110 SwsVector *chrV; 00111 } SwsFilter; 00112 00113 struct SwsContext; 00114 00115 void sws_freeContext(struct SwsContext *swsContext); 00116 00130 struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int dstW, int dstH, enum PixelFormat dstFormat, int flags, 00131 SwsFilter *srcFilter, SwsFilter *dstFilter, double *param); 00132 00155 int sws_scale(struct SwsContext *context, uint8_t* srcSlice[], int srcStride[], int srcSliceY, 00156 int srcSliceH, uint8_t* dst[], int dstStride[]); 00157 #if LIBSWSCALE_VERSION_MAJOR < 1 00158 00161 int sws_scale_ordered(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY, 00162 int srcSliceH, uint8_t* dst[], int dstStride[]) attribute_deprecated; 00163 #endif 00164 00165 00166 int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation); 00167 int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation); 00168 00173 SwsVector *sws_getGaussianVec(double variance, double quality); 00174 00179 SwsVector *sws_getConstVec(double c, int length); 00180 00185 SwsVector *sws_getIdentityVec(void); 00186 00190 void sws_scaleVec(SwsVector *a, double scalar); 00191 00196 void sws_normalizeVec(SwsVector *a, double height); 00197 void sws_convVec(SwsVector *a, SwsVector *b); 00198 void sws_addVec(SwsVector *a, SwsVector *b); 00199 void sws_subVec(SwsVector *a, SwsVector *b); 00200 void sws_shiftVec(SwsVector *a, int shift); 00201 00206 SwsVector *sws_cloneVec(SwsVector *a); 00207 00208 #if LIBSWSCALE_VERSION_MAJOR < 1 00209 00212 attribute_deprecated void sws_printVec(SwsVector *a); 00213 #endif 00214 00219 void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level); 00220 00221 void sws_freeVec(SwsVector *a); 00222 00223 SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, 00224 float lumaSharpen, float chromaSharpen, 00225 float chromaHShift, float chromaVShift, 00226 int verbose); 00227 void sws_freeFilter(SwsFilter *filter); 00228 00242 struct SwsContext *sws_getCachedContext(struct SwsContext *context, 00243 int srcW, int srcH, enum PixelFormat srcFormat, 00244 int dstW, int dstH, enum PixelFormat dstFormat, int flags, 00245 SwsFilter *srcFilter, SwsFilter *dstFilter, double *param); 00246 00247 #endif /* SWSCALE_SWSCALE_H */