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.

124 lines
3.5KB

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