You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.7KB

  1. /* values for the flags, the stuff on the command line is different */
  2. #define SWS_FAST_BILINEAR 1
  3. #define SWS_BILINEAR 2
  4. #define SWS_BICUBIC 4
  5. #define SWS_X 8
  6. #define SWS_FULL_UV_IPOL 0x100
  7. #define SWS_PRINT_INFO 0x1000
  8. #define SWS_MAX_REDUCE_CUTOFF 0.002
  9. /* this struct should be aligned on at least 32-byte boundary */
  10. typedef struct{
  11. int srcW, srcH, dstW, dstH;
  12. int chrDstW, chrDstH;
  13. int lumXInc, chrXInc;
  14. int lumYInc, chrYInc;
  15. int dstFormat, srcFormat;
  16. int16_t **lumPixBuf;
  17. int16_t **chrPixBuf;
  18. int16_t *hLumFilter;
  19. int16_t *hLumFilterPos;
  20. int16_t *hChrFilter;
  21. int16_t *hChrFilterPos;
  22. int16_t *vLumFilter;
  23. int16_t *vLumFilterPos;
  24. int16_t *vChrFilter;
  25. int16_t *vChrFilterPos;
  26. // Contain simply the values from v(Lum|Chr)Filter just nicely packed for mmx
  27. int16_t *lumMmxFilter;
  28. int16_t *chrMmxFilter;
  29. int hLumFilterSize;
  30. int hChrFilterSize;
  31. int vLumFilterSize;
  32. int vChrFilterSize;
  33. int vLumBufSize;
  34. int vChrBufSize;
  35. uint8_t __attribute__((aligned(32))) funnyYCode[10000];
  36. uint8_t __attribute__((aligned(32))) funnyUVCode[10000];
  37. int canMMX2BeUsed;
  38. int lastInLumBuf;
  39. int lastInChrBuf;
  40. int lumBufIndex;
  41. int chrBufIndex;
  42. int dstY;
  43. int flags;
  44. } SwsContext;
  45. //FIXME check init (where 0)
  46. // when used for filters they must have an odd number of elements
  47. // coeffs cannot be shared between vectors
  48. typedef struct {
  49. double *coeff;
  50. int length;
  51. } SwsVector;
  52. // vectors can be shared
  53. typedef struct {
  54. SwsVector *lumH;
  55. SwsVector *lumV;
  56. SwsVector *chrH;
  57. SwsVector *chrV;
  58. } SwsFilter;
  59. // *** bilinear scaling and yuv->rgb & yuv->yuv conversion of yv12 slices:
  60. // *** Note: it's called multiple times while decoding a frame, first time y==0
  61. // dstbpp == 12 -> yv12 output
  62. // will use sws_flags
  63. void SwScale_YV12slice(unsigned char* src[],int srcStride[], int srcSliceY,
  64. int srcSliceH, uint8_t* dst[], int dstStride, int dstbpp,
  65. int srcW, int srcH, int dstW, int dstH);
  66. // Obsolete, will be removed soon
  67. void SwScale_Init();
  68. void freeSwsContext(SwsContext *swsContext);
  69. SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags,
  70. SwsFilter *srcFilter, SwsFilter *dstFilter);
  71. extern void (*swScale)(SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
  72. int srcSliceH, uint8_t* dst[], int dstStride[]);
  73. SwsVector *getGaussianVec(double variance, double quality);
  74. SwsVector *getIdentityVec(void);
  75. void scaleVec(SwsVector *a, double scalar);
  76. void normalizeVec(SwsVector *a, double height);
  77. SwsVector *convVec(SwsVector *a, SwsVector *b);
  78. SwsVector *sumVec(SwsVector *a, SwsVector *b);
  79. SwsVector *diffVec(SwsVector *a, SwsVector *b);
  80. SwsVector *shiftVec(SwsVector *a, int shift);
  81. void printVec(SwsVector *a);
  82. void freeVec(SwsVector *a);