?? globals.h
字號:
/*COPYRIGHT, LICENSE AND WARRANTY INFORMATIONThis software module has been originally developed by Nokia Corporation. Provided that a person, entity or a company willing to use the Software (hereinafter Licensee) comply with all the terms and conditions of this Statement and subject to the limitations set forth in this Statement Nokia grants to such Licensee a non-exclusive, sub-licensable, worldwide, limited license under copyrights owned by Nokia to use the Software for the sole purpose of creating, manufacturing, selling, marketing, or distributing (including the right to make modifications to the Software) a fully compliant decoder implementation (hereinafter "Decoder") of ITU-T Recommendation H.264 / ISO/IEC International Standard 14496-10 and an encoder implementation producing output that is decodable with the Decoder.Nokia retains the ownership of copyrights to the Software. There is no patent nor other intellectual property right of Nokia licensed under this Statement (except the copyright license above). Licensee hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if patent licenses are required, it is their responsibility to acquire the license before utilizing the Software.The license by Nokia is subject to that the Licensee grants to Nokia the non-exclusive, worldwide, royalty-free, perpetual and irrevocable covenant that the Licensee(s) shall not bring a suit before any court or administrative agency or otherwise assert a claim for infringement under the Licensee intellectual property rights that, but for a license, would be infringed by the Software against (a) Nokia or Nokia's Affiliate; or (b) other recipient of a license and covenant not to sue with respect to the Software from Nokia; or (c) contractor, customer or distributor of a party listed above in a or b, which suit or claim is related to the Software or use thereof.The Licensee(s) further agrees to grant a reciprocal license to Nokia (as granted by Nokia to the Licensee(s) on the modifications made by Licensee(s) to the Software. THE SOFTWARE IS PROVIDED "AS IS" AND THE ORIGINAL DEVELOPER DISCLAIMS ANY AND ALL WARRANTIES WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. THOSE INTENDING TO USE THE SOFTWARE ARE EXPRESSLY ADVISED THAT ITS USE MAY INFRINGE EXISTING PATENTS AND BE SUBJECT TO ROYALTY PAYMENTS TO PATENT OWNERS. ANYONE USING THE SOFTWARE ON THE BASIS OF THIS LICENSE AGREES TO OBTAIN THE NECESSARY PERMISSIONS FROM ANY AND ALL APPLICABLE PATENT OWNERS FOR SUCH USE.IN NO EVENT SHALL THE ORIGINAL DEVELOPER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.This copyright, license and warranty information notice must be retained in all copies and derivative works of the Software or substantial portions thereof.*/#ifndef _GLOBALS_H_#define _GLOBALS_H_#include <stdlib.h>typedef unsigned char Byte;typedef unsigned char u_char;typedef signed char int8;typedef unsigned char u_int8;typedef short int16;typedef unsigned short u_int16;typedef long int32;typedef unsigned long u_int32;typedef float float32;typedef double float64;// in some places, 4 bytes are copied as an integer, watch how to put bytes#define LITTLE_ENDIAN//#define TRACE_AE/* DT: must be 1, if we need not raw byte sequence without encapsulation. It will be deleted later if agreed. */#define ENCAPSULATED_NAL_PAYLOAD 1 #define CONSTRAINED_INTRA_PRED 0#define FORCE_INTRA_FREQUENCY 80 //How many frames should be passed to force the MB as INTRA, if Intra Refresh is in use/* * General macros */#ifndef min#define min(a, b) ((a) < (b) ? (a) : (b))#endif#ifndef max#define max(a, b) ((a) > (b) ? (a) : (b))#endif#define clip(min, max, val) (((val)<(min))? (min):(((val)>(max))? (max):(val)))#define SIGN(x) ((x) < 0 ? -1 : 1)/* * Defines for frame */#define MIN_QP 0#define MAX_QP 51//#define IMG_INTRA 0//#define IMG_INTER 1//#define IMG_IDR_INTRA 2//#define IS_INTRA(x) ( (x)==IMG_INTRA || (x)==IMG_IDR_INTRA )#define FRM_MAX_REF_FRAMES 16 // must be <= 16#define MAX_SLICE_GROUP_NUM 8 /* Given in Annex A Profiles, for baseline profile & extended profile, the maximum slice group number is 8 *//* * Defines for slice */#define SLICE_MIN 0#define SLICE_P 0 // P (P slice)#define SLICE_B 1 // B (B slice)#define SLICE_I 2 // I (I slice)#define SLICE_SP 3 // SP (SP slice)#define SLICE_SI 4 // SI (SI slice)#define SLICE_P1 5 // P (P slice)#define SLICE_B1 6 // B (B slice)#define SLICE_I1 7 // I (I slice)#define SLICE_SP1 8 // SP (SP slice)#define SLICE_SI1 9 // SI (SI slice)#define SLICE_MAX 9#define IS_SLICE_I(x) ((x) == SLICE_I || (x) == SLICE_I1 || (x) == SLICE_SI || (x) == SLICE_SI1)#define IS_SLICE_P(x) ((x) == SLICE_P || (x) == SLICE_P1 || (x) == SLICE_SP || (x) == SLICE_SP1)#define IS_SLICE_B(x) ((x) == SLICE_B || (x) == SLICE_B1)/* * Define slice group map type */#define SLICE_MAP_INTERLEAVED 0#define SLICE_MAP_DISPERSED 1#define SLICE_MAP_FOREGROUND 2#define SLICE_MAP_BOX_OUT 3#define SLICE_MAP_RASTER 4#define SLICE_MAP_WIPE 5#define SLICE_MAP_BITMAP 6/* * Defines for macroblock */#define MBK_SIZE 16#define BLK_SIZE 4#define BLK_PER_MB (MBK_SIZE/BLK_SIZE)#define MBK_INTRA 0#define MBK_INTER 1#define MBK_INTRA_TYPE1 0#define MBK_INTRA_TYPE2 1// define all possible intra/inter modes using just 1 variable#define MB_TYPE_INTRA_4x4 0#define MB_TYPE_INTRA_16x16 1#define MB_TYPE_INTER_SKIPPED 2#define MB_TYPE_INTER_16x16 3#define MB_TYPE_INTER_16x8 4#define MB_TYPE_INTER_8x16 5#define MB_TYPE_INTER_8x8 6#define MAX_MODES 10/* * Defines for debug statistics */#define PRINT_DETAILED_SEQ_STATISTICS 1#define PRINT_IMG_TYPE 0#define PRINT_MBMODE 0#if PRINT_MBMODE#define ROW_NEWLINE 1#else#define ROW_NEWLINE 0#endif#define PRINT_MOTVECS 0// amount of bias used for zero motion vector, in inter16x16 mode#define ZERO_VEC_SAD 4/* * Defines for transform and quantization */#define USE_COEF_ELIM 1#define COEF_ELIM_TH_MB 5#define COEF_ELIM_TH_BLK8x8 4#define COEF_ELIM_TH_CHROMA 3/* * Intra prediction modes *//* Luma 4x4 prediction modes */#define IPR_NUM_MODES1 9#define IPR_MODE_VERT 0#define IPR_MODE_HOR 1#define IPR_MODE_DC 2#define IPR_MODE_DIAG_DOWN_LEFT 3#define IPR_MODE_DIAG_DOWN_RIGHT 4#define IPR_MODE_VERT_RIGHT 5#define IPR_MODE_HOR_DOWN 6#define IPR_MODE_VERT_LEFT 7#define IPR_MODE_HOR_UP 8#define IPR_MODE_NA 0x7F // make it large to do some trick/* Luma 16x16 prediction modes */#define IPR_NUM_MODES2 4#define IPR_MODE2_VERT 0#define IPR_MODE2_HOR 1#define IPR_MODE2_DC 2#define IPR_MODE2_PLANE 3/* Chroma 8x8 prediction modes */#define IPR_CHROMA_NUM_MODES 4#define IPR_CHROMA_MODE_DC 0#define IPR_CHROMA_MODE_HOR 1#define IPR_CHROMA_MODE_VERT 2#define IPR_CHROMA_MODE_PLANE 3/* profile definition for performance/speed trade-off */#define PROF_CODING_EFFICIENCY 0#define PROF_CODING_SPEED 1#define PROF_CODING_LC3 2#define ENTROPY_CAVLC 0/* * Structures */typedef struct _rectRegion_s{ int16 x0; int16 y0; int16 x1; int16 y1;} rectRegion_s;typedef struct _searchRange_s{ // this is the intended search range int x0; int y0; int x1; int y1; // this is the legal search range, within the extended frame boundaries int lx0; int lx1; int ly0; int ly1;} searchRange_s;// ----------------------------------------------------------------------------// when the global RDO flag is set, at least perform mode decision among// inter/intra4x4/intra16x16//// use flags to enable/disable lower level RDO components#define RDO_INTRA_LUMA_4x4 0x10#define RDO_INTRA_LUMA_16x16 0x20#define RDO_INTRA_CHROMA 0x40#define RDO_INTER 0x80typedef struct _frmBuf_s { int16 width; int16 height; u_int8 *y; u_int8 *u; u_int8 *v; int *channelDistortion;} frmBuf_s;typedef struct _motVec_s { int16 x; int16 y;} motVec_s;typedef struct _blkState_s{ motVec_s mv; int8 ref; u_int8 i4x4Mode; int8 numLumaCoefs;} blkState_s;typedef struct _mbState_s{ int cbp; blkState_s blkInfo[4][4]; int8 numChromaCoefs[2][2][2]; int16 sliceMap; int8 mbType; int8 intraModeChroma; int8 qp; int8 filterMode; int8 alphaOffset; int8 betaOffset;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -