📄 h263.h
字号:
/* /////////////////////////////////////////////////////////////////////////// INTEL CORPORATION PROPRIETARY INFORMATION// This software is supplied under the terms of a license agreement or// nondisclosure agreement with Intel Corporation and may not be copied// or disclosed except in accordance with the terms of that agreement.// Copyright (c) 2005 Intel Corporation. All Rights Reserved.//// Description: H.263++ header.//*/#ifndef _H263_H_#define _H263_H_#include <stdlib.h>#include <stdio.h>#include <string.h>#include "ippdefs.h"#include "ippcore.h"#include "ipps.h"#include "ippi.h"#include "ippvc.h"#include "ippcc.h"#pragma warning(disable : 4710) // function not inlined#pragma warning(disable : 4514) // unreferenced inline function has been removed CL#pragma warning(disable : 4100) // unreferenced formal parameter CL#ifdef __cplusplusextern "C" {#endif#if defined(__INTEL_COMPILER) || defined(_MSC_VER) #define __INLINE static __inline#elif defined( __GNUC__ ) #define __INLINE static __inline__#else #define __INLINE static#endif#if defined(__INTEL_COMPILER) #define __ALIGN16(type, name, size) \ __declspec (align(16)) type name[size]#else #if defined(_WIN64) || defined(WIN64) || defined(LINUX64) #define __ALIGN16(type, name, size) \ Ipp8u _a16_##name[(size)*sizeof(type)+15]; type *name = (type*)(((Ipp64s)(_a16_##name) + 15) & ~15) #else #define __ALIGN16(type, name, size) \ Ipp8u _a16_##name[(size)*sizeof(type)+15]; type *name = (type*)(((Ipp32s)(_a16_##name) + 15) & ~15) #endif#endif#define h263_CLIP(x, min, max) if ((x) < (min)) (x) = (min); else if ((x) > (max)) (x) = (max)#define h263_CLIPR(x, max) if ((x) > (max)) (x) = (max)#define h263_SWAP(type, x, y) {type t = (x); (x) = (y); (y) = t;}#define h263_ABS(a) ((a) >= 0 ? (a) : -(a))#define H263_MAX(a, b) ((a) > (b) ? (a) : (b))#define H263_MIN(a, b) ((a) > (b) ? (b) : (a))/* Timer Info */#if defined(_WIN32) || defined(_WIN64) || defined(WIN32) || defined(WIN64) #include <windows.h> typedef struct _h263_Timer { LARGE_INTEGER count; LARGE_INTEGER start; LARGE_INTEGER stop; int calls; } h263_Timer; __INLINE void h263_TimerStart(h263_Timer *t) { QueryPerformanceCounter(&t->start); } __INLINE void h263_TimerStop(h263_Timer *t) { QueryPerformanceCounter(&t->stop); t->count.QuadPart += t->stop.QuadPart - t->start.QuadPart; t->calls ++; } #define TIMER_FREQ_TYPE LARGE_INTEGER __INLINE void h263_GetTimerFreq(TIMER_FREQ_TYPE *f) { QueryPerformanceFrequency(f); } __INLINE double h263_GetTimerSec(h263_Timer *t, TIMER_FREQ_TYPE f) { return (double)t->count.QuadPart / (double)f.QuadPart; }#else // LINUX #include <time.h> typedef struct _h263_Timer { clock_t count; clock_t start; clock_t stop; int calls; } h263_Timer; __INLINE void h263_TimerStart(h263_Timer *t) { t->start = clock(); } __INLINE void h263_TimerStop(h263_Timer *t) { t->stop = clock(); t->count += t->stop - t->start; t->calls ++; } #define TIMER_FREQ_TYPE int __INLINE void h263_GetTimerFreq(TIMER_FREQ_TYPE *f) { *f = CLOCKS_PER_SEC; } __INLINE double h263_GetTimerSec(h263_Timer *t, TIMER_FREQ_TYPE f) { return (double)t->count / (double)f; }#endif/* number of exterior MB */#define H263_NUM_EXT_MB 1#define H263_MAX_ENH_LAYERS 14/* Statistic Info */typedef struct _h263_Statistic { // Sequence Info int nPic; int nPic_I; int nPic_P; int nPic_PB; int nPic_B; int nPic_EI; int nPic_EP;#ifdef H263_FULL_STAT int nMB; int nMB_INTER; int nMB_INTER_Q; int nMB_INTRA; int nMB_INTRA_Q; int nMB_INTER4V; int nMB_INTER4V_Q; int nMB_INTERPOLATE_PB; int nMB_INTERPOLATE_iPB; int nMB_BACKWARD_iPB; int nMB_FORWARD_iPB; int nMB_NOTCODED; int nMB_DIRECT_B; int nMB_INTERPOLATE_B; int nMB_BACKWARD_B; int nMB_FORWARD_B; int nB_INTRA_DC; int nB_INTRA_AC; int nB_INTER_C; int nB_INTER_NC;#endif // app Timing Info h263_Timer time_DecodeShow; // decode + draw + file reading h263_Timer time_Decode; // decode + file reading h263_Timer time_DecodeOnly; // decode only} h263_Statistic;__INLINE void h263_StatisticInc(int *s){ *s = (*s) + 1;}// when using Full Statistic, FPS is less#ifdef H263_FULL_STAT#define h263_StatisticInc_(s) h263_StatisticInc(s)#define h263_TimerStart_(t) h263_TimerStart(t)#define h263_TimerStop_(t) h263_TimerStop(t)#else#define h263_StatisticInc_(s)#define h263_TimerStart_(t)#define h263_TimerStop_(t)#endif/* status codes */typedef enum { H263_STATUS_OK = 0, // no error H263_STATUS_NO_MEM = -1, // out of memory H263_STATUS_FILE_ERROR = -2, // file error H263_STATUS_NOTSUPPORT = -3, // not supported mode H263_STATUS_PARSE_ERROR = -4, // failure in H.263++ stream parsing H263_STATUS_ERROR = -5 // unknown/unspecified error} h263_Status;/* H.263++ code values *//* ITU-T Recommendation H.263, Table 5 */enum { H263_ASPECT_RATIO_FORBIDDEN = 0, H263_ASPECT_RATIO_1_1 = 1, H263_ASPECT_RATIO_12_11 = 2, H263_ASPECT_RATIO_10_11 = 3, H263_ASPECT_RATIO_16_11 = 4, H263_ASPECT_RATIO_40_33 = 5, H263_ASPECT_RATIO_EXTPAR = 15};enum { H263_PIC_TYPE_I = 0, H263_PIC_TYPE_P = 1, H263_PIC_TYPE_iPB = 2, H263_PIC_TYPE_B = 3, H263_PIC_TYPE_EI = 4, H263_PIC_TYPE_EP = 5, H263_PIC_TYPE_PB = 6};enum { H263_SCALABILITY_NONE = 0, H263_SCALABILITY_TEMPORAL = 1, H263_SCALABILITY_SNR = 2, H263_SCALABILITY_SPATIAL_X = 3, H263_SCALABILITY_SPATIAL_Y = 4, H263_SCALABILITY_SPATIAL_XY = 5};#define H263_HEADER_MARKER 0x145 /* 1010 0010 1 */#define H263_MV_MARKER 0x1 /* 0000 0000 01 *//* Frame Info */typedef struct _h263_Frame { Ipp8u* apY; // allocated with border Ipp8u* apCb; // allocated with border Ipp8u* apCr; // allocated with border int stepY; int stepCr; int stepCb; Ipp8u* pY; // real pointer Ipp8u* pCb; // real pointer Ipp8u* pCr; // real pointer int type; Ipp64s time;/* used for scalability, resize, can be calculated from width/height */ int mbPerRow; int mbPerCol;/* used for resampling */ int width; int height;} h263_Frame;/* Block Info for Intra Prediction */typedef struct _h263_IntraPredBlock { struct _h263_IntraPredBlock *predA; struct _h263_IntraPredBlock *predC; Ipp16s dct_acA[8]; Ipp16s dct_acC[8]; Ipp16s dct_dc;} h263_IntraPredBlock;/* Buffer for Intra Prediction */typedef struct _h263_IntraPredBuff { h263_IntraPredBlock *block;} h263_IntraPredBuff;/* MacroBlock Info Data Partitioned mode *//*typedef struct _h263_DataPartMacroBlock { Ipp16s dct_dc[6]; Ipp8u type; Ipp8u not_coded; Ipp8u mcsel; Ipp8u ac_pred_flag; Ipp8u pat; Ipp8u quant;} h263_DataPartMacroBlock;*//* MacroBlock Info for Motion */typedef struct _h263_MacroBlock { IppMotionVector mv[4]; Ipp8u type; /* OBMC */ Ipp8u quant;} h263_MacroBlock;typedef struct _h263_PTYPEmodes { int UMV; int SAC; int advPred; int PBframes; int resample; int redResUp;} h263_PTYPEmodes;typedef struct _h263_OPPTYPEmodes { Ipp8u UMV; Ipp8u SAC; Ipp8u advPred; Ipp8u advIntra; Ipp8u deblockFilt; Ipp8u sliceStruct; Ipp8u RPS; Ipp8u ISD; Ipp8u altInterVLC; Ipp8u modQuant;} h263_OPPTYPEmodes;typedef struct _h263_PictureFormat { int PAR_code; int PAR_width; int PAR_height; int width; int height;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -