codec_internal.h

来自「mediastreamer2是开源的网络传输媒体流的库」· C头文件 代码 · 共 845 行 · 第 1/3 页

H
845
字号
/******************************************************************** *                                                                  * * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       * *                                                                  * * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2005                * * by the Xiph.Org Foundation http://www.xiph.org/                  * *                                                                  * ********************************************************************  function:  last mod: $Id: codec_internal.h 11442 2006-05-27 17:28:08Z giles $ ********************************************************************/#ifndef ENCODER_INTERNAL_H#define ENCODER_INTERNAL_H#ifdef HAVE_CONFIG_H# include "config.h"#endif#include "theora/theora.h"#include "huffman.h"#include "dsp.h"#ifndef LIBOGG2#define theora_read(x,y,z) ( *z = oggpackB_read(x,y) )#else#define theora_read(x,y,z) ( oggpackB_read(x,y,z) )#endif#ifdef DEBUG#include <stdio.h>#define TH_DEBUG(x) fprintf(stderr, x)#else#define TH_DEBUG(x)#endif#define CURRENT_ENCODE_VERSION   1#define HUGE_ERROR              (1<<28)  /*  Out of range test value *//* Baseline dct height and width. */#define BLOCK_HEIGHT_WIDTH          8#define HFRAGPIXELS                 8#define VFRAGPIXELS                 8/* Baseline dct block size */#define BLOCK_SIZE              (BLOCK_HEIGHT_WIDTH * BLOCK_HEIGHT_WIDTH)/* Border is for unrestricted mv's */#define UMV_BORDER              16#define STRIDE_EXTRA            (UMV_BORDER * 2)#define Q_TABLE_SIZE            64#define KEY_FRAME              0#define DELTA_FRAME            1#define MAX_MODES               8#define MODE_BITS               3#define MODE_METHODS            8#define MODE_METHOD_BITS        3/* Different key frame types/methods */#define DCT_KEY_FRAME           0#define KEY_FRAME_CONTEXT       5/* Preprocessor defines */#define MAX_PREV_FRAMES        16/* Number of search sites for a 4-step search (at pixel accuracy) */#define MAX_SEARCH_SITES       33#define VERY_BEST_Q            10#define MIN_BPB_FACTOR        0.3#define MAX_BPB_FACTOR        3.0#define MAX_MV_EXTENT 31  /* Max search distance in half pixel increments */typedef struct CONFIG_TYPE2{  double       OutputFrameRate;  ogg_uint32_t TargetBandwidth;  ogg_uint32_t KeyFrameDataTarget ;  /* Data rate target for key frames */  ogg_uint32_t FirstFrameQ;  ogg_uint32_t BaseQ;  ogg_uint32_t MaxQ;            /* Absolute Max Q allowed. */  ogg_uint32_t ActiveMaxQ;      /* Currently active Max Q */} CONFIG_TYPE2;typedef struct coeffNode{  int i;  struct coeffNode *next;} COEFFNODE;typedef struct{  unsigned char * Yuv0ptr;  unsigned char * Yuv1ptr;  unsigned char * SrfWorkSpcPtr;  unsigned char * disp_fragments;  ogg_uint32_t  * RegionIndex; /* Gives pixel index for top left of                                 each block */  ogg_uint32_t    VideoFrameHeight;  ogg_uint32_t    VideoFrameWidth;} SCAN_CONFIG_DATA;typedef unsigned char YUV_BUFFER_ENTRY;typedef struct{  ogg_int32_t   x;  ogg_int32_t   y;} MOTION_VECTOR;typedef MOTION_VECTOR COORDINATE;/** Quantizer matrix entry */typedef ogg_int16_t     Q_LIST_ENTRY;/** Decode Post-Processor instance */typedef struct PP_INSTANCE {  ogg_uint32_t  PrevFrameLimit;  ogg_uint32_t   *ScanPixelIndexTable;  signed char    *ScanDisplayFragments;  signed char    *PrevFragments[MAX_PREV_FRAMES];  ogg_uint32_t   *FragScores; /* The individual frame difference ratings. */  signed char    *SameGreyDirPixels;  signed char    *BarBlockMap;  /* Number of pixels changed by diff threshold in row of a fragment. */  unsigned char  *FragDiffPixels;  unsigned char  *PixelScores;  unsigned char  *PixelChangedMap;  unsigned char  *ChLocals;  ogg_int16_t    *yuv_differences;  ogg_int32_t    *RowChangedPixels;  signed char    *TmpCodedMap;  /* Plane pointers and dimension variables */  unsigned char  * YPlanePtr0;  unsigned char  * YPlanePtr1;  unsigned char  * UPlanePtr0;  unsigned char  * UPlanePtr1;  unsigned char  * VPlanePtr0;  unsigned char  * VPlanePtr1;  ogg_uint32_t    VideoYPlaneWidth;  ogg_uint32_t    VideoYPlaneHeight;  ogg_uint32_t    VideoUVPlaneWidth;  ogg_uint32_t    VideoUVPlaneHeight;  ogg_uint32_t    VideoYPlaneStride;  ogg_uint32_t    VideoUPlaneStride;  ogg_uint32_t    VideoVPlaneStride;  /* Scan control variables. */  unsigned char   HFragPixels;  unsigned char   VFragPixels;  ogg_uint32_t    ScanFrameFragments;  ogg_uint32_t    ScanYPlaneFragments;  ogg_uint32_t    ScanUVPlaneFragments;  ogg_uint32_t    ScanHFragments;  ogg_uint32_t    ScanVFragments;  ogg_uint32_t    YFramePixels;  ogg_uint32_t    UVFramePixels;  ogg_uint32_t    SgcThresh;  ogg_uint32_t    OutputBlocksUpdated;  ogg_uint32_t    KFIndicator;  /* The pre-processor scan configuration. */  SCAN_CONFIG_DATA ScanConfig;  ogg_int32_t   SRFGreyThresh;  ogg_int32_t   SRFColThresh;  ogg_int32_t   SgcLevelThresh;  ogg_int32_t   SuvcLevelThresh;  ogg_uint32_t  NoiseSupLevel;  /* Block Thresholds. */  ogg_uint32_t  PrimaryBlockThreshold;  unsigned char LineSearchTripTresh;  int   PAKEnabled;  int   LevelThresh;  int   NegLevelThresh;  int   SrfThresh;  int   NegSrfThresh;  int   HighChange;  int   NegHighChange;  /* Threshold lookup tables */  unsigned char SrfPakThreshTable[512];  unsigned char SrfThreshTable[512];  unsigned char SgcThreshTable[512];  /* Variables controlling S.A.D. break outs. */  ogg_uint32_t GrpLowSadThresh;  ogg_uint32_t GrpHighSadThresh;  ogg_uint32_t ModifiedGrpLowSadThresh;  ogg_uint32_t ModifiedGrpHighSadThresh;  ogg_int32_t  PlaneHFragments;  ogg_int32_t  PlaneVFragments;  ogg_int32_t  PlaneHeight;  ogg_int32_t  PlaneWidth;  ogg_int32_t  PlaneStride;  ogg_uint32_t BlockThreshold;  ogg_uint32_t BlockSgcThresh;  double UVBlockThreshCorrection;  double UVSgcCorrection;  double YUVPlaneCorrectionFactor;  double AbsDiff_ScoreMultiplierTable[256];  unsigned char  NoiseScoreBoostTable[256];  unsigned char  MaxLineSearchLen;  ogg_int32_t YuvDiffsCircularBufferSize;  ogg_int32_t ChLocalsCircularBufferSize;  ogg_int32_t PixelMapCircularBufferSize;  DspFunctions dsp;  /* Selected functions for this platform */} PP_INSTANCE;/** block coding modes */typedef enum{  CODE_INTER_NO_MV        = 0x0, /* INTER prediction, (0,0) motion                                    vector implied.  */    CODE_INTRA            = 0x1, /* INTRA i.e. no prediction. */    CODE_INTER_PLUS_MV    = 0x2, /* INTER prediction, non zero motion                                    vector. */    CODE_INTER_LAST_MV    = 0x3, /* Use Last Motion vector */    CODE_INTER_PRIOR_LAST = 0x4, /* Prior last motion vector */    CODE_USING_GOLDEN     = 0x5, /* 'Golden frame' prediction (no MV). */    CODE_GOLDEN_MV        = 0x6, /* 'Golden frame' prediction plus MV. */    CODE_INTER_FOURMV     = 0x7  /* Inter prediction 4MV per macro block. */} CODING_MODE;/** Huffman table entry */typedef struct HUFF_ENTRY {  struct HUFF_ENTRY *ZeroChild;  struct HUFF_ENTRY *OneChild;  struct HUFF_ENTRY *Previous;  struct HUFF_ENTRY *Next;  ogg_int32_t        Value;  ogg_uint32_t       Frequency;} HUFF_ENTRY;typedef struct qmat_range_table {  int startq, startqi; /* index where this range starts */  Q_LIST_ENTRY *qmat;  /* qmat at this range boundary */} qmat_range_table;/** codec setup data, maps to the third bitstream header */typedef struct codec_setup_info {  ogg_uint32_t QThreshTable[Q_TABLE_SIZE];  Q_LIST_ENTRY DcScaleFactorTable[Q_TABLE_SIZE];  int MaxQMatrixIndex;  Q_LIST_ENTRY *qmats;  qmat_range_table *range_table[6];  HUFF_ENTRY *HuffRoot[NUM_HUFF_TABLES];

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?