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
00070
00071
00072
00073
00074
00075 static inline int CLIP(int a){
00076 if(a&256) return ((a)>>31)^(-1);
00077 else return a;
00078 }
00082 struct PPFilter{
00083 const char *shortName;
00084 const char *longName;
00085 int chromDefault;
00086 int minLumQuality;
00087 int minChromQuality;
00088 int mask;
00089 };
00090
00094 typedef struct PPMode{
00095 int lumMode;
00096 int chromMode;
00097 int error;
00098
00099 int minAllowedY;
00100 int maxAllowedY;
00101 float maxClippedThreshold;
00102
00103 int maxTmpNoise[3];
00104
00105 int baseDcDiff;
00106 int flatnessThreshold;
00107
00108 int forcedQuant;
00109 } PPMode;
00110
00114 typedef struct PPContext{
00118 const AVClass *av_class;
00119
00120 uint8_t *tempBlocks;
00121
00127 uint64_t *yHistogram;
00128
00129 DECLARE_ALIGNED(8, uint64_t, packedYOffset);
00130 DECLARE_ALIGNED(8, uint64_t, packedYScale);
00131
00133 uint8_t *tempBlured[3];
00134 int32_t *tempBluredPast[3];
00135
00137 uint8_t *tempDst;
00138 uint8_t *tempSrc;
00139
00140 uint8_t *deintTemp;
00141
00142 DECLARE_ALIGNED(8, uint64_t, pQPb);
00143 DECLARE_ALIGNED(8, uint64_t, pQPb2);
00144
00145 DECLARE_ALIGNED(8, uint64_t, mmxDcOffset[64]);
00146 DECLARE_ALIGNED(8, uint64_t, mmxDcThreshold[64]);
00147
00148 QP_STORE_T *stdQPTable;
00149 QP_STORE_T *nonBQPTable;
00150 QP_STORE_T *forcedQPTable;
00151
00152 int QP;
00153 int nonBQP;
00154
00155 int frameNum;
00156
00157 int cpuCaps;
00158
00159 int qpStride;
00160 int stride;
00161
00162 int hChromaSubSample;
00163 int vChromaSubSample;
00164
00165 PPMode ppMode;
00166 } PPContext;
00167
00168
00169 static inline void linecpy(void *dest, const void *src, int lines, int stride)
00170 {
00171 if (stride > 0) {
00172 memcpy(dest, src, lines*stride);
00173 } else {
00174 memcpy((uint8_t*)dest+(lines-1)*stride, (const uint8_t*)src+(lines-1)*stride, -lines*stride);
00175 }
00176 }
00177
00178 #endif