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