00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 #ifndef SWSCALE_SWSCALE_H
00022 #define SWSCALE_SWSCALE_H
00023 
00030 #include <stdint.h>
00031 
00032 #include "libavutil/avutil.h"
00033 #include "libavutil/log.h"
00034 #include "libavutil/pixfmt.h"
00035 #include "version.h"
00036 
00040 unsigned swscale_version(void);
00041 
00045 const char *swscale_configuration(void);
00046 
00050 const char *swscale_license(void);
00051 
00052 
00053 #define SWS_FAST_BILINEAR     1
00054 #define SWS_BILINEAR          2
00055 #define SWS_BICUBIC           4
00056 #define SWS_X                 8
00057 #define SWS_POINT          0x10
00058 #define SWS_AREA           0x20
00059 #define SWS_BICUBLIN       0x40
00060 #define SWS_GAUSS          0x80
00061 #define SWS_SINC          0x100
00062 #define SWS_LANCZOS       0x200
00063 #define SWS_SPLINE        0x400
00064 
00065 #define SWS_SRC_V_CHR_DROP_MASK     0x30000
00066 #define SWS_SRC_V_CHR_DROP_SHIFT    16
00067 
00068 #define SWS_PARAM_DEFAULT           123456
00069 
00070 #define SWS_PRINT_INFO              0x1000
00071 
00072 
00073 
00074 #define SWS_FULL_CHR_H_INT    0x2000
00075 
00076 #define SWS_FULL_CHR_H_INP    0x4000
00077 #define SWS_DIRECT_BGR        0x8000
00078 #define SWS_ACCURATE_RND      0x40000
00079 #define SWS_BITEXACT          0x80000
00080 
00081 #if FF_API_SWS_CPU_CAPS
00082 
00086 #define SWS_CPU_CAPS_MMX      0x80000000
00087 #define SWS_CPU_CAPS_MMXEXT   0x20000000
00088 #if LIBSWSCALE_VERSION_MAJOR < 3
00089 #define SWS_CPU_CAPS_MMX2     0x20000000
00090 #endif
00091 #define SWS_CPU_CAPS_3DNOW    0x40000000
00092 #define SWS_CPU_CAPS_ALTIVEC  0x10000000
00093 #define SWS_CPU_CAPS_BFIN     0x01000000
00094 #define SWS_CPU_CAPS_SSE2     0x02000000
00095 #endif
00096 
00097 #define SWS_MAX_REDUCE_CUTOFF 0.002
00098 
00099 #define SWS_CS_ITU709         1
00100 #define SWS_CS_FCC            4
00101 #define SWS_CS_ITU601         5
00102 #define SWS_CS_ITU624         5
00103 #define SWS_CS_SMPTE170M      5
00104 #define SWS_CS_SMPTE240M      7
00105 #define SWS_CS_DEFAULT        5
00106 
00114 const int *sws_getCoefficients(int colorspace);
00115 
00116 
00117 
00118 typedef struct {
00119     double *coeff;              
00120     int length;                 
00121 } SwsVector;
00122 
00123 
00124 typedef struct {
00125     SwsVector *lumH;
00126     SwsVector *lumV;
00127     SwsVector *chrH;
00128     SwsVector *chrV;
00129 } SwsFilter;
00130 
00131 struct SwsContext;
00132 
00137 int sws_isSupportedInput(enum PixelFormat pix_fmt);
00138 
00143 int sws_isSupportedOutput(enum PixelFormat pix_fmt);
00144 
00150 struct SwsContext *sws_alloc_context(void);
00151 
00158 int sws_init_context(struct SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter);
00159 
00164 void sws_freeContext(struct SwsContext *swsContext);
00165 
00166 #if FF_API_SWS_GETCONTEXT
00167 
00183 struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat,
00184                                   int dstW, int dstH, enum PixelFormat dstFormat,
00185                                   int flags, SwsFilter *srcFilter,
00186                                   SwsFilter *dstFilter, const double *param);
00187 #endif
00188 
00215 int sws_scale(struct SwsContext *c, const uint8_t *const srcSlice[],
00216               const int srcStride[], int srcSliceY, int srcSliceH,
00217               uint8_t *const dst[], const int dstStride[]);
00218 
00229 int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
00230                              int srcRange, const int table[4], int dstRange,
00231                              int brightness, int contrast, int saturation);
00232 
00236 int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table,
00237                              int *srcRange, int **table, int *dstRange,
00238                              int *brightness, int *contrast, int *saturation);
00239 
00243 SwsVector *sws_allocVec(int length);
00244 
00249 SwsVector *sws_getGaussianVec(double variance, double quality);
00250 
00255 SwsVector *sws_getConstVec(double c, int length);
00256 
00261 SwsVector *sws_getIdentityVec(void);
00262 
00266 void sws_scaleVec(SwsVector *a, double scalar);
00267 
00271 void sws_normalizeVec(SwsVector *a, double height);
00272 void sws_convVec(SwsVector *a, SwsVector *b);
00273 void sws_addVec(SwsVector *a, SwsVector *b);
00274 void sws_subVec(SwsVector *a, SwsVector *b);
00275 void sws_shiftVec(SwsVector *a, int shift);
00276 
00281 SwsVector *sws_cloneVec(SwsVector *a);
00282 
00287 void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level);
00288 
00289 void sws_freeVec(SwsVector *a);
00290 
00291 SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
00292                                 float lumaSharpen, float chromaSharpen,
00293                                 float chromaHShift, float chromaVShift,
00294                                 int verbose);
00295 void sws_freeFilter(SwsFilter *filter);
00296 
00309 struct SwsContext *sws_getCachedContext(struct SwsContext *context,
00310                                         int srcW, int srcH, enum PixelFormat srcFormat,
00311                                         int dstW, int dstH, enum PixelFormat dstFormat,
00312                                         int flags, SwsFilter *srcFilter,
00313                                         SwsFilter *dstFilter, const double *param);
00314 
00325 void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette);
00326 
00337 void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette);
00338 
00345 const AVClass *sws_get_class(void);
00346 
00347 #endif