swscale.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at>
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  14. */
  15. #ifndef SWSCALE_H
  16. #define SWSCALE_H
  17. /**
  18. * @file swscale.h
  19. * @brief
  20. * external api for the swscale stuff
  21. */
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. #define AV_STRINGIFY(s) AV_TOSTRING(s)
  26. #define AV_TOSTRING(s) #s
  27. #define LIBSWSCALE_VERSION_INT ((0<<16)+(5<<8)+0)
  28. #define LIBSWSCALE_VERSION 0.5.0
  29. #define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT
  30. #define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION)
  31. /* values for the flags, the stuff on the command line is different */
  32. #define SWS_FAST_BILINEAR 1
  33. #define SWS_BILINEAR 2
  34. #define SWS_BICUBIC 4
  35. #define SWS_X 8
  36. #define SWS_POINT 0x10
  37. #define SWS_AREA 0x20
  38. #define SWS_BICUBLIN 0x40
  39. #define SWS_GAUSS 0x80
  40. #define SWS_SINC 0x100
  41. #define SWS_LANCZOS 0x200
  42. #define SWS_SPLINE 0x400
  43. #define SWS_SRC_V_CHR_DROP_MASK 0x30000
  44. #define SWS_SRC_V_CHR_DROP_SHIFT 16
  45. #define SWS_PARAM_DEFAULT 123456
  46. #define SWS_PRINT_INFO 0x1000
  47. //the following 3 flags are not completly implemented
  48. //internal chrominace subsamling info
  49. #define SWS_FULL_CHR_H_INT 0x2000
  50. //input subsampling info
  51. #define SWS_FULL_CHR_H_INP 0x4000
  52. #define SWS_DIRECT_BGR 0x8000
  53. #define SWS_CPU_CAPS_MMX 0x80000000
  54. #define SWS_CPU_CAPS_MMX2 0x20000000
  55. #define SWS_CPU_CAPS_3DNOW 0x40000000
  56. #define SWS_CPU_CAPS_ALTIVEC 0x10000000
  57. #define SWS_MAX_REDUCE_CUTOFF 0.002
  58. #define SWS_CS_ITU709 1
  59. #define SWS_CS_FCC 4
  60. #define SWS_CS_ITU601 5
  61. #define SWS_CS_ITU624 5
  62. #define SWS_CS_SMPTE170M 5
  63. #define SWS_CS_SMPTE240M 7
  64. #define SWS_CS_DEFAULT 5
  65. // when used for filters they must have an odd number of elements
  66. // coeffs cannot be shared between vectors
  67. typedef struct {
  68. double *coeff;
  69. int length;
  70. } SwsVector;
  71. // vectors can be shared
  72. typedef struct {
  73. SwsVector *lumH;
  74. SwsVector *lumV;
  75. SwsVector *chrH;
  76. SwsVector *chrV;
  77. } SwsFilter;
  78. struct SwsContext;
  79. void sws_freeContext(struct SwsContext *swsContext);
  80. struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags,
  81. SwsFilter *srcFilter, SwsFilter *dstFilter, double *param);
  82. int sws_scale(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
  83. int srcSliceH, uint8_t* dst[], int dstStride[]);
  84. int sws_scale_ordered(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
  85. int srcSliceH, uint8_t* dst[], int dstStride[]);
  86. 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);
  87. int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation);
  88. SwsVector *sws_getGaussianVec(double variance, double quality);
  89. SwsVector *sws_getConstVec(double c, int length);
  90. SwsVector *sws_getIdentityVec(void);
  91. void sws_scaleVec(SwsVector *a, double scalar);
  92. void sws_normalizeVec(SwsVector *a, double height);
  93. void sws_convVec(SwsVector *a, SwsVector *b);
  94. void sws_addVec(SwsVector *a, SwsVector *b);
  95. void sws_subVec(SwsVector *a, SwsVector *b);
  96. void sws_shiftVec(SwsVector *a, int shift);
  97. SwsVector *sws_cloneVec(SwsVector *a);
  98. void sws_printVec(SwsVector *a);
  99. void sws_freeVec(SwsVector *a);
  100. SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
  101. float lumaSarpen, float chromaSharpen,
  102. float chromaHShift, float chromaVShift,
  103. int verbose);
  104. void sws_freeFilter(SwsFilter *filter);
  105. #ifdef __cplusplus
  106. }
  107. #endif
  108. #endif