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.

126 lines
4.0KB

  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. #define V_DEBLOCK 0x01
  16. #define H_DEBLOCK 0x02
  17. #define DERING 0x04
  18. #define LEVEL_FIX 0x08 /* Brightness & Contrast */
  19. #define LUM_V_DEBLOCK V_DEBLOCK // 1
  20. #define LUM_H_DEBLOCK H_DEBLOCK // 2
  21. #define CHROM_V_DEBLOCK (V_DEBLOCK<<4) // 16
  22. #define CHROM_H_DEBLOCK (H_DEBLOCK<<4) // 32
  23. #define LUM_DERING DERING // 4
  24. #define CHROM_DERING (DERING<<4) // 64
  25. #define LUM_LEVEL_FIX LEVEL_FIX // 8
  26. #define CHROM_LEVEL_FIX (LEVEL_FIX<<4) // 128 (not implemented yet)
  27. // Experimental vertical filters
  28. #define V_X1_FILTER 0x0200 // 512
  29. // Experimental horizontal filters
  30. #define H_X1_FILTER 0x2000 // 8192
  31. // select between full y range (255-0) or standart one (234-16)
  32. #define FULL_Y_RANGE 0x8000 // 32768
  33. //Deinterlacing Filters
  34. #define LINEAR_IPOL_DEINT_FILTER 0x10000 // 65536
  35. #define LINEAR_BLEND_DEINT_FILTER 0x20000 // 131072
  36. #define CUBIC_BLEND_DEINT_FILTER 0x8000 // (not implemented yet)
  37. #define CUBIC_IPOL_DEINT_FILTER 0x40000 // 262144
  38. #define MEDIAN_DEINT_FILTER 0x80000 // 524288
  39. #define FFMPEG_DEINT_FILTER 0x400000
  40. #define TEMP_NOISE_FILTER 0x100000
  41. #define FORCE_QUANT 0x200000
  42. //use if u want a faster postprocessing code
  43. //cant differentiate between chroma & luma filters (both on or both off)
  44. //obviosly the -pp option at the commandline has no effect except turning the here selected
  45. //filters on
  46. //#define COMPILE_TIME_MODE 0x77
  47. struct PPFilter{
  48. char *shortName;
  49. char *longName;
  50. int chromDefault; // is chrominance filtering on by default if this filter is manually activated
  51. int minLumQuality; // minimum quality to turn luminance filtering on
  52. int minChromQuality; // minimum quality to turn chrominance filtering on
  53. int mask; // Bitmask to turn this filter on
  54. };
  55. typedef struct PPMode{
  56. int lumMode; // acivates filters for luminance
  57. int chromMode; // acivates filters for chrominance
  58. int error; // non zero on error
  59. int minAllowedY; // for brigtness correction
  60. int maxAllowedY; // for brihtness correction
  61. float maxClippedThreshold; // amount of "black" u r willing to loose to get a brightness corrected picture
  62. int maxTmpNoise[3]; // for Temporal Noise Reducing filter (Maximal sum of abs differences)
  63. int baseDcDiff;
  64. int flatnessThreshold;
  65. int forcedQuant; // quantizer if FORCE_QUANT is used
  66. } PPMode;
  67. typedef struct PPContext{
  68. uint8_t *tempBlocks; //used for the horizontal code
  69. /* we need 64bit here otherwise we´ll going to have a problem
  70. after watching a black picture for 5 hours*/
  71. uint64_t *yHistogram;
  72. uint64_t __attribute__((aligned(8))) packedYOffset;
  73. uint64_t __attribute__((aligned(8))) packedYScale;
  74. /* Temporal noise reducing buffers */
  75. uint8_t *tempBlured[3];
  76. int32_t *tempBluredPast[3];
  77. /* Temporary buffers for handling the last row(s) */
  78. uint8_t *tempDst;
  79. uint8_t *tempSrc;
  80. /* Temporary buffers for handling the last block */
  81. uint8_t *tempDstBlock;
  82. uint8_t *tempSrcBlock;
  83. uint8_t *deintTemp;
  84. uint64_t __attribute__((aligned(8))) pQPb;
  85. uint64_t __attribute__((aligned(8))) pQPb2;
  86. uint64_t __attribute__((aligned(8))) mmxDcOffset[32];
  87. uint64_t __attribute__((aligned(8))) mmxDcThreshold[32];
  88. QP_STORE_T *nonBQPTable;
  89. int QP;
  90. int nonBQP;
  91. int frameNum;
  92. int cpuCaps;
  93. PPMode ppMode;
  94. } PPContext;