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.

131 lines
4.1KB

  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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  14. */
  15. #ifndef SWSCALE_INTERNAL_H
  16. #define SWSCALE_INTERNAL_H
  17. #define MAX_FILTER_SIZE 256
  18. typedef int (*SwsFunc)(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
  19. int srcSliceH, uint8_t* dst[], int dstStride[]);
  20. /* this struct should be aligned on at least 32-byte boundary */
  21. typedef struct SwsContext{
  22. /**
  23. *
  24. * Note the src,dst,srcStride,dstStride will be copied, in the sws_scale() warper so they can freely be modified here
  25. */
  26. SwsFunc swScale;
  27. int srcW, srcH, dstH;
  28. int chrSrcW, chrSrcH, chrDstW, chrDstH;
  29. int lumXInc, chrXInc;
  30. int lumYInc, chrYInc;
  31. int dstFormat, srcFormat; ///< format 4:2:0 type is allways YV12
  32. int origDstFormat, origSrcFormat; ///< format
  33. int chrSrcHSubSample, chrSrcVSubSample;
  34. int chrIntHSubSample, chrIntVSubSample;
  35. int chrDstHSubSample, chrDstVSubSample;
  36. int vChrDrop;
  37. int16_t **lumPixBuf;
  38. int16_t **chrPixBuf;
  39. int16_t *hLumFilter;
  40. int16_t *hLumFilterPos;
  41. int16_t *hChrFilter;
  42. int16_t *hChrFilterPos;
  43. int16_t *vLumFilter;
  44. int16_t *vLumFilterPos;
  45. int16_t *vChrFilter;
  46. int16_t *vChrFilterPos;
  47. uint8_t formatConvBuffer[4000]; //FIXME dynamic alloc, but we have to change alot of code for this to be usefull
  48. int hLumFilterSize;
  49. int hChrFilterSize;
  50. int vLumFilterSize;
  51. int vChrFilterSize;
  52. int vLumBufSize;
  53. int vChrBufSize;
  54. uint8_t __attribute__((aligned(32))) funnyYCode[10000];
  55. uint8_t __attribute__((aligned(32))) funnyUVCode[10000];
  56. int32_t *lumMmx2FilterPos;
  57. int32_t *chrMmx2FilterPos;
  58. int16_t *lumMmx2Filter;
  59. int16_t *chrMmx2Filter;
  60. int canMMX2BeUsed;
  61. int lastInLumBuf;
  62. int lastInChrBuf;
  63. int lumBufIndex;
  64. int chrBufIndex;
  65. int dstY;
  66. int flags;
  67. void * yuvTable; // pointer to the yuv->rgb table start so it can be freed()
  68. void * table_rV[256];
  69. void * table_gU[256];
  70. int table_gV[256];
  71. void * table_bU[256];
  72. //Colorspace stuff
  73. int contrast, brightness, saturation; // for sws_getColorspaceDetails
  74. int srcColorspaceTable[4];
  75. int dstColorspaceTable[4];
  76. int srcRange, dstRange;
  77. #define RED_DITHER "0*8"
  78. #define GREEN_DITHER "1*8"
  79. #define BLUE_DITHER "2*8"
  80. #define Y_COEFF "3*8"
  81. #define VR_COEFF "4*8"
  82. #define UB_COEFF "5*8"
  83. #define VG_COEFF "6*8"
  84. #define UG_COEFF "7*8"
  85. #define Y_OFFSET "8*8"
  86. #define U_OFFSET "9*8"
  87. #define V_OFFSET "10*8"
  88. #define LUM_MMX_FILTER_OFFSET "11*8"
  89. #define CHR_MMX_FILTER_OFFSET "11*8+4*4*256"
  90. #define DSTW_OFFSET "11*8+4*4*256*2"
  91. #define ESP_OFFSET "11*8+4*4*256*2+4"
  92. uint64_t redDither __attribute__((aligned(8)));
  93. uint64_t greenDither __attribute__((aligned(8)));
  94. uint64_t blueDither __attribute__((aligned(8)));
  95. uint64_t yCoeff __attribute__((aligned(8)));
  96. uint64_t vrCoeff __attribute__((aligned(8)));
  97. uint64_t ubCoeff __attribute__((aligned(8)));
  98. uint64_t vgCoeff __attribute__((aligned(8)));
  99. uint64_t ugCoeff __attribute__((aligned(8)));
  100. uint64_t yOffset __attribute__((aligned(8)));
  101. uint64_t uOffset __attribute__((aligned(8)));
  102. uint64_t vOffset __attribute__((aligned(8)));
  103. int32_t lumMmxFilter[4*MAX_FILTER_SIZE];
  104. int32_t chrMmxFilter[4*MAX_FILTER_SIZE];
  105. int dstW;
  106. int esp;
  107. } SwsContext;
  108. //FIXME check init (where 0)
  109. SwsFunc yuv2rgb_get_func_ptr (SwsContext *c);
  110. int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation);
  111. #endif