• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • 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 Libav.
00005  *
00006  * Libav 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  * Libav 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 Libav; 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 "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 ///< Brightness & Contrast
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 // Experimental vertical filters
00049 #define V_X1_FILTER     0x0200                  // 512
00050 #define V_A_DEBLOCK     0x0400
00051 
00052 // Experimental horizontal filters
00053 #define H_X1_FILTER     0x2000                  // 8192
00054 #define H_A_DEBLOCK     0x4000
00055 
00057 #define FULL_Y_RANGE    0x8000                  // 32768
00058 
00059 //Deinterlacing Filters
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 
00071 //use if you want a faster postprocessing code
00072 //cannot differentiate between chroma & luma filters (both on or both off)
00073 //obviously the -pp option on the command line has no effect except turning the here selected
00074 //filters on
00075 //#define COMPILE_TIME_MODE 0x77
00076 
00077 static inline int CLIP(int a){
00078     if(a&256) return ((a)>>31)^(-1);
00079     else      return a;
00080 }
00084 struct PPFilter{
00085     const char *shortName;
00086     const char *longName;
00087     int chromDefault;       
00088     int minLumQuality;      
00089     int minChromQuality;    
00090     int mask;               
00091 };
00092 
00096 typedef struct PPMode{
00097     int lumMode;                    
00098     int chromMode;                  
00099     int error;                      
00100 
00101     int minAllowedY;                
00102     int maxAllowedY;                
00103     float maxClippedThreshold;      
00104 
00105     int maxTmpNoise[3];             
00106 
00107     int baseDcDiff;
00108     int flatnessThreshold;
00109 
00110     int forcedQuant;                
00111 } PPMode;
00112 
00116 typedef struct PPContext{
00120     const AVClass *av_class;
00121 
00122     uint8_t *tempBlocks; 
00123 
00129     uint64_t *yHistogram;
00130 
00131     DECLARE_ALIGNED(8, uint64_t, packedYOffset);
00132     DECLARE_ALIGNED(8, uint64_t, packedYScale);
00133 
00135     uint8_t *tempBlurred[3];
00136     int32_t *tempBlurredPast[3];
00137 
00139     uint8_t *tempDst;
00140     uint8_t *tempSrc;
00141 
00142     uint8_t *deintTemp;
00143 
00144     DECLARE_ALIGNED(8, uint64_t, pQPb);
00145     DECLARE_ALIGNED(8, uint64_t, pQPb2);
00146 
00147     DECLARE_ALIGNED(8, uint64_t, mmxDcOffset)[64];
00148     DECLARE_ALIGNED(8, uint64_t, mmxDcThreshold)[64];
00149 
00150     QP_STORE_T *stdQPTable;       
00151     QP_STORE_T *nonBQPTable;
00152     QP_STORE_T *forcedQPTable;
00153 
00154     int QP;
00155     int nonBQP;
00156 
00157     int frameNum;
00158 
00159     int cpuCaps;
00160 
00161     int qpStride; 
00162     int stride;   
00163 
00164     int hChromaSubSample;
00165     int vChromaSubSample;
00166 
00167     PPMode ppMode;
00168 } PPContext;
00169 
00170 
00171 static inline void linecpy(void *dest, const void *src, int lines, int stride) {
00172     if (stride > 0) {
00173         memcpy(dest, src, lines*stride);
00174     } else {
00175         memcpy((uint8_t*)dest+(lines-1)*stride, (const uint8_t*)src+(lines-1)*stride, -lines*stride);
00176     }
00177 }
00178 
00179 #endif /* POSTPROC_POSTPROCESS_INTERNAL_H */
Generated on Sat Mar 17 2012 12:57:58 for Libav by doxygen 1.7.1