00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00026 #ifndef FFMPEG_POSTPROCESS_INTERNAL_H
00027 #define FFMPEG_POSTPROCESS_INTERNAL_H
00028
00029 #include "avutil.h"
00030 #include "postprocess.h"
00031
00032 #define V_DEBLOCK 0x01
00033 #define H_DEBLOCK 0x02
00034 #define DERING 0x04
00035 #define LEVEL_FIX 0x08
00036
00037 #define LUM_V_DEBLOCK V_DEBLOCK // 1
00038 #define LUM_H_DEBLOCK H_DEBLOCK // 2
00039 #define CHROM_V_DEBLOCK (V_DEBLOCK<<4) // 16
00040 #define CHROM_H_DEBLOCK (H_DEBLOCK<<4) // 32
00041 #define LUM_DERING DERING // 4
00042 #define CHROM_DERING (DERING<<4) // 64
00043 #define LUM_LEVEL_FIX LEVEL_FIX // 8
00044 #define CHROM_LEVEL_FIX (LEVEL_FIX<<4) // 128 (not implemented yet)
00045
00046
00047 #define V_X1_FILTER 0x0200 // 512
00048 #define V_A_DEBLOCK 0x0400
00049
00050
00051 #define H_X1_FILTER 0x2000 // 8192
00052 #define H_A_DEBLOCK 0x4000
00053
00055 #define FULL_Y_RANGE 0x8000 // 32768
00056
00057
00058 #define LINEAR_IPOL_DEINT_FILTER 0x10000 // 65536
00059 #define LINEAR_BLEND_DEINT_FILTER 0x20000 // 131072
00060 #define CUBIC_BLEND_DEINT_FILTER 0x8000 // (not implemented yet)
00061 #define CUBIC_IPOL_DEINT_FILTER 0x40000 // 262144
00062 #define MEDIAN_DEINT_FILTER 0x80000 // 524288
00063 #define FFMPEG_DEINT_FILTER 0x400000
00064 #define LOWPASS5_DEINT_FILTER 0x800000
00065
00066 #define TEMP_NOISE_FILTER 0x100000
00067 #define FORCE_QUANT 0x200000
00068
00069 #if ( defined(__PIC__) || defined(__pic__) ) && ! defined(PIC)
00070 # define PIC
00071 #endif
00072
00073
00074
00075
00076
00077
00078
00079 #if 1
00080 static inline int CLIP(int a){
00081 if(a&256) return ((a)>>31)^(-1);
00082 else return a;
00083 }
00084
00085 #elif 0
00086 #define CLIP(a) clip_tab[a]
00087 #else
00088 #define CLIP(a) (a)
00089 #endif
00090
00093 struct PPFilter{
00094 const char *shortName;
00095 const char *longName;
00096 int chromDefault;
00097 int minLumQuality;
00098 int minChromQuality;
00099 int mask;
00100 };
00101
00105 typedef struct PPMode{
00106 int lumMode;
00107 int chromMode;
00108 int error;
00109
00110 int minAllowedY;
00111 int maxAllowedY;
00112 float maxClippedThreshold;
00113
00114 int maxTmpNoise[3];
00115
00116 int baseDcDiff;
00117 int flatnessThreshold;
00118
00119 int forcedQuant;
00120 } PPMode;
00121
00125 typedef struct PPContext{
00129 AVClass *av_class;
00130
00131 uint8_t *tempBlocks;
00132
00138 uint64_t *yHistogram;
00139
00140 DECLARE_ALIGNED(8, uint64_t, packedYOffset);
00141 DECLARE_ALIGNED(8, uint64_t, packedYScale);
00142
00144 uint8_t *tempBlured[3];
00145 int32_t *tempBluredPast[3];
00146
00148 uint8_t *tempDst;
00149 uint8_t *tempSrc;
00150
00151 uint8_t *deintTemp;
00152
00153 DECLARE_ALIGNED(8, uint64_t, pQPb);
00154 DECLARE_ALIGNED(8, uint64_t, pQPb2);
00155
00156 DECLARE_ALIGNED(8, uint64_t, mmxDcOffset[64]);
00157 DECLARE_ALIGNED(8, uint64_t, mmxDcThreshold[64]);
00158
00159 QP_STORE_T *stdQPTable;
00160 QP_STORE_T *nonBQPTable;
00161 QP_STORE_T *forcedQPTable;
00162
00163 int QP;
00164 int nonBQP;
00165
00166 int frameNum;
00167
00168 int cpuCaps;
00169
00170 int qpStride;
00171 int stride;
00172
00173 int hChromaSubSample;
00174 int vChromaSubSample;
00175
00176 PPMode ppMode;
00177 } PPContext;
00178
00179
00180 static inline void linecpy(void *dest, void *src, int lines, int stride)
00181 {
00182 if (stride > 0) {
00183 memcpy(dest, src, lines*stride);
00184 } else {
00185 memcpy(dest+(lines-1)*stride, src+(lines-1)*stride, -lines*stride);
00186 }
00187 }
00188
00189 #endif