00001 /* 00002 Copyright (C) 2001-2002 Michael Niedermayer (michaelni@gmx.at) 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 */ 00018 00024 #define V_DEBLOCK 0x01 00025 #define H_DEBLOCK 0x02 00026 #define DERING 0x04 00027 #define LEVEL_FIX 0x08 00028 00029 #define LUM_V_DEBLOCK V_DEBLOCK // 1 00030 #define LUM_H_DEBLOCK H_DEBLOCK // 2 00031 #define CHROM_V_DEBLOCK (V_DEBLOCK<<4) // 16 00032 #define CHROM_H_DEBLOCK (H_DEBLOCK<<4) // 32 00033 #define LUM_DERING DERING // 4 00034 #define CHROM_DERING (DERING<<4) // 64 00035 #define LUM_LEVEL_FIX LEVEL_FIX // 8 00036 #define CHROM_LEVEL_FIX (LEVEL_FIX<<4) // 128 (not implemented yet) 00037 00038 // Experimental vertical filters 00039 #define V_X1_FILTER 0x0200 // 512 00040 #define V_A_DEBLOCK 0x0400 00041 00042 // Experimental horizontal filters 00043 #define H_X1_FILTER 0x2000 // 8192 00044 #define H_A_DEBLOCK 0x4000 00045 00047 #define FULL_Y_RANGE 0x8000 // 32768 00048 00049 //Deinterlacing Filters 00050 #define LINEAR_IPOL_DEINT_FILTER 0x10000 // 65536 00051 #define LINEAR_BLEND_DEINT_FILTER 0x20000 // 131072 00052 #define CUBIC_BLEND_DEINT_FILTER 0x8000 // (not implemented yet) 00053 #define CUBIC_IPOL_DEINT_FILTER 0x40000 // 262144 00054 #define MEDIAN_DEINT_FILTER 0x80000 // 524288 00055 #define FFMPEG_DEINT_FILTER 0x400000 00056 #define LOWPASS5_DEINT_FILTER 0x800000 00057 00058 #define TEMP_NOISE_FILTER 0x100000 00059 #define FORCE_QUANT 0x200000 00060 00061 //use if u want a faster postprocessing code 00062 //cant differentiate between chroma & luma filters (both on or both off) 00063 //obviosly the -pp option at the commandline has no effect except turning the here selected 00064 //filters on 00065 //#define COMPILE_TIME_MODE 0x77 00066 00067 #if 1 00068 static inline int CLIP(int a){ 00069 if(a&256) return ((a)>>31)^(-1); 00070 else return a; 00071 } 00072 //#define CLIP(a) (((a)&256) ? ((a)>>31)^(-1) : (a)) 00073 #elif 0 00074 #define CLIP(a) clip_tab[a] 00075 #else 00076 #define CLIP(a) (a) 00077 #endif 00078 00081 struct PPFilter{ 00082 char *shortName; 00083 char *longName; 00084 int chromDefault; 00085 int minLumQuality; 00086 int minChromQuality; 00087 int mask; 00088 }; 00089 00093 typedef struct PPMode{ 00094 int lumMode; 00095 int chromMode; 00096 int error; 00097 00098 int minAllowedY; 00099 int maxAllowedY; 00100 float maxClippedThreshold; 00101 00102 int maxTmpNoise[3]; 00103 00104 int baseDcDiff; 00105 int flatnessThreshold; 00106 00107 int forcedQuant; 00108 } PPMode; 00109 00113 typedef struct PPContext{ 00114 uint8_t *tempBlocks; 00115 00121 uint64_t *yHistogram; 00122 00123 uint64_t __attribute__((aligned(8))) packedYOffset; 00124 uint64_t __attribute__((aligned(8))) packedYScale; 00125 00127 uint8_t *tempBlured[3]; 00128 int32_t *tempBluredPast[3]; 00129 00131 uint8_t *tempDst; 00132 uint8_t *tempSrc; 00133 00134 uint8_t *deintTemp; 00135 00136 uint64_t __attribute__((aligned(8))) pQPb; 00137 uint64_t __attribute__((aligned(8))) pQPb2; 00138 00139 uint64_t __attribute__((aligned(8))) mmxDcOffset[64]; 00140 uint64_t __attribute__((aligned(8))) mmxDcThreshold[64]; 00141 00142 QP_STORE_T *stdQPTable; 00143 QP_STORE_T *nonBQPTable; 00144 QP_STORE_T *forcedQPTable; 00145 00146 int QP; 00147 int nonBQP; 00148 00149 int frameNum; 00150 00151 int cpuCaps; 00152 00153 int qpStride; 00154 int stride; 00155 00156 int hChromaSubSample; 00157 int vChromaSubSample; 00158 00159 PPMode ppMode; 00160 } PPContext; 00161 00162 00163 static inline void linecpy(void *dest, void *src, int lines, int stride) 00164 { 00165 if (stride > 0) { 00166 memcpy(dest, src, lines*stride); 00167 } else { 00168 memcpy(dest+(lines-1)*stride, src+(lines-1)*stride, -lines*stride); 00169 } 00170 }
1.5.5