• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libpostproc/postprocess_internal.h

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

Generated on Fri Sep 16 2011 17:17:51 for FFmpeg by  doxygen 1.7.1