📄 h263.h
字号:
Ipp32s width;
Ipp32s height;
Ipp32s scalability_type;
} h263_PictureFormat;
/* Video Object Plane with Ipp16s header Info */
typedef struct _h263_VideoPictureH263 {
Ipp32s temporal_reference;
Ipp32s split_screen_indicator;
Ipp32s document_camera_indicator;
Ipp32s full_picture_freeze_release;
Ipp32s picture_coding_type;
Ipp32s plusptype;
Ipp32s prev_temporal_reference;
h263_PTYPEmodes modes;
h263_OPPTYPEmodes oppmodes;
h263_PictureFormat format;
Ipp32s width;
Ipp32s height;
Ipp32s MacroBlockPerRow;
Ipp32s MacroBlockPerCol;
/* plusptype fields */
Ipp32s ufep;
Ipp32s PCF;
Ipp32s prev_PCF;
Ipp32s rtype;
Ipp32s CPM;
Ipp32s PSBI;
Ipp32s PAR_code;
Ipp32s PAR_width;
Ipp32s PAR_height;
Ipp32s pic_quant;
Ipp32s gob_number;
Ipp32s num_gobs_in_pic;
Ipp32s RowsPerGOB;
Ipp32s quant_scale;
Ipp32s GSBI;
Ipp32s GFID;
Ipp32s clock_conversion_code;
Ipp32s clock_divisor;
Ipp32s prev_clock_conversion_code;
Ipp32s prev_clock_divisor;
Ipp32s ext_temporal_reference;
Ipp32s unlimited_UMV;
Ipp32s sliceSubmodes; /* bit 1 - Rectangular slices; bit 2 - Arbitrary slice ordering */
Ipp32s enh_layer_num;
Ipp32s ref_layer_num;
Ipp32s RPSflags;
Ipp32s pred_temp_ref;
Ipp32s temporal_reference_B;
Ipp32s dbquant;
Ipp32s implicit_resample;
Ipp32s wda;
IppMotionVector warpParams[4];
Ipp32s fillMode;
Ipp32s fillColor[3];
} h263_VideoPicture;
typedef struct _h263_EnhancedLayer {
h263_Frame c_Frame;
h263_Frame r_Frame;
h263_Frame n_Frame;
h263_Frame *l_Frame; /* reference frame from the lower reference layer */
h263_Frame *v_Frame; /* frame for output */
h263_Frame a_Frame; /* aux frame used in resampling */
IppMotionVector warpParams[4];
Ipp32s picIndex;
} h263_EnhancedLayer;
/* Video Sequence Info */
typedef struct _h263_VideoSequence {
h263_Frame cFrame; /* current */
h263_Frame rFrame; /* reference in past */
h263_Frame nFrame; /* B-parts of PB-frames / B-frames */
h263_Frame bFrame; /* B-frames */
h263_Frame aFrame; /* aux frame used in resampling */
h263_Frame *vFrame; /* frame for display */
h263_Frame *refFrame; /* ptr to reference frame, used in resampling */
h263_VideoPicture VideoPicture;
h263_OPPTYPEmodes oppmodes[H263_MAX_ENH_LAYERS + 1]; /* layers 1(base)-15 */
h263_PictureFormat format[H263_MAX_ENH_LAYERS + 1];
Ipp32s prev_pic_type[H263_MAX_ENH_LAYERS + 1];
Ipp32s ref_layer_num[H263_MAX_ENH_LAYERS + 1] ;
Ipp32s ref_layer_num_b[H263_MAX_ENH_LAYERS + 1];
h263_EnhancedLayer *enhLayers[H263_MAX_ENH_LAYERS];
h263_MacroBlock *MBinfo;
Ipp32s num_of_MBs;
Ipp32s frameCount;
Ipp32s frameInterval;
Ipp32s frameScale;
Ipp32s picture_time_increment_resolution;
Ipp32s PicIndex;
h263_IntraPredBuff IntraPredBuff;
Ipp8u GOBboundary[72]; /* max mbPerCol */
IppMotionVector *Bmv; /* motion vector predictors (forw and back) in B-frames */
IppMotionVector warpParams[4];
Ipp32s fillMode;
Ipp32s fillColor[3];
/* h263_DataPartMacroBlock* DataPartBuff; */
Ipp32s Ppics_to_show;
Ipp32s Bpics_to_show;
/* for B-Frame direct mode */
Ipp32s TRB, TRD;
/* time increment of past and future frame for B-frame */
Ipp64s rTime, nTime;
/* Picture global time */
Ipp64s pic_time, pic_time_pb;
Ipp64s ref_pic_time, prevP_pic_time;
Ipp32s ref_temporal_reference, prevP_temporal_reference;
h263_Statistic Statistic;
} h263_VideoSequence;
#ifdef _OMP_KARABAS
/* MacroBlock Info for MT */
typedef struct _h263_MacroBlockMT {
Ipp16s dctCoeffs[64*6];
Ipp16s dctCoeffs_B[64*6];
IppMotionVector mvF[4]; // PB-Frame
IppMotionVector mvB[4]; // PB-Frame
Ipp8u lnz[12];
Ipp8u cbpy;
Ipp8u cbpc;
Ipp8u bmb_type; // PB-Frame
Ipp8u cbpb; // PB-Frame
} h263_MacroBlockMT;
#endif // _OMP_KARABAS
/* Full Info */
typedef struct _h263_Info {
Ipp8u* buffer; /* buffer header for saving H.263++ stream */
size_t buflen; /* total buffer length */
Ipp8u* bufptr; /* current frame, point to header or data */
Ipp32s bitoff; /* mostly point to next frame header or PSC */
h263_VideoSequence VideoSequence;
#ifdef _OMP_KARABAS
vm_thread_priority mTreadPriority;
h263_MacroBlockMT* pMBinfoMT; /* OpenMP buffer */
#endif // _OMP_KARABAS
Ipp32s number_threads; /* OpenMP number of threads */
Ipp32s stopOnErr;
} h263_Info;
/* bitstream functions */
extern Ipp32s h263_RemainStream(h263_Info* pInfo);
extern Ipp8u* h263_FindStartCodePtr(h263_Info* pInfo);
extern Ipp32s h263_SeekStartCodePtr(h263_Info* pInfo);
extern Ipp32s h263_SeekGOBStartCodePtr(h263_Info* pInfo);
/* extern Ipp32s h263_CheckResyncMarker(h263_Info* pInfo, Ipp32s rml); */
/* tables */
typedef struct _h263_VLC1 {
Ipp8u code;
Ipp8u len;
} h263_VLC1;
extern const Ipp8u h263_cCbCrMvRound16[];
extern const Ipp8s h263_dquant[];
extern const Ipp8s h263_dquant_Mod[2][31];
extern const Ipp8u h263_quant_c[];
extern const h263_VLC1 h263_cbpy[];
extern const Ipp8u h263_Pmb_type[];
extern const Ipp8u h263_Pmb_cbpc[];
extern const Ipp8u h263_Pmb_bits[];
extern const h263_VLC1 h263_Bmb_type[];
extern const h263_VLC1 h263_Bmb_cbpc[];
extern const h263_VLC1 h263_EPmb_type_0[];
extern const h263_VLC1 h263_EPmb_type_1[];
extern const h263_VLC1 h263_EImb_type[];
extern const h263_VLC1 h263_MVD_T14_1[];
extern const h263_VLC1 h263_MVD_T14_2[];
extern const Ipp32s h263_pic_width[];
extern const Ipp32s h263_pic_height[];
extern const Ipp32s h263_mblocks_in_gob[];
extern const Ipp32s h263_gobs_in_pic[];
// project functions
//extern void h263_Error(Ipp8s *str);
#define h263_Error(str)
extern h263_Status h263_InitDecoder(h263_Info *pInfo, Ipp8s *h263FileName);
extern h263_Status h263_CloseDecoder(h263_Info *pInfo);
extern h263_Status h263_InitVSeq(h263_Info *pInfo, Ipp32s mbPerRow, Ipp32s mbPerCol);
extern h263_Status h263_FreeVSeq(h263_Info *pInfo);
extern h263_Status h263_Decoder(h263_Info *pInfo);
extern h263_Status h263_Parse_PictureHeader(h263_Info* pInfo);
extern Ipp32s h263_ParseGOBHeader(h263_Info* pInfo);
extern h263_Status h263_DecodeVideoPicture(h263_Info* pInfo);
extern Ipp32s h263_Check_Resize(h263_Info* pInfo);
#ifdef _OMP_KARABAS
#ifdef _OPENMP
#include <omp.h>
#endif
extern Ipp32s h263_GetNumOfThreads(void);
#endif // _OMP_KARABAS
#ifndef H263_USE_INLINE_BITS_FUNC
extern Ipp32u h263_ShowBits(h263_Info* pInfo, Ipp32s n);
extern Ipp32u h263_ShowBit(h263_Info* pInfo);
extern Ipp32u h263_ShowBits9(h263_Info* pInfo, Ipp32s n);
extern void h263_FlushBits(h263_Info* pInfo, Ipp32s n);
extern Ipp32u h263_GetBits(h263_Info* pInfo, Ipp32s n);
extern Ipp32u h263_GetBits9(h263_Info* pInfo, Ipp32s n);
extern void h263_AlignBits(h263_Info* pInfo);
extern Ipp32u h263_ShowBitsAlign(h263_Info* pInfo, Ipp32s n);
#else
__INLINE Ipp32u h263_ShowBits(h263_Info* pInfo, Ipp32s n)
{
Ipp8u* ptr = pInfo->bufptr;
Ipp32u tmp = (ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | (ptr[3]);
tmp <<= pInfo->bitoff;
tmp >>= 32 - n;
return tmp;
}
__INLINE Ipp32u h263_ShowBit(h263_Info* pInfo)
{
Ipp32u tmp = pInfo->bufptr[0];
tmp >>= 7 - pInfo->bitoff;
return (tmp & 1);
}
__INLINE Ipp32u h263_ShowBits9(h263_Info* pInfo, Ipp32s n)
{
Ipp8u* ptr = pInfo->bufptr;
Ipp32u tmp = (ptr[0] << 8) | ptr[1];
tmp <<= (pInfo->bitoff + 16);
tmp >>= 32 - n;
return tmp;
}
__INLINE void h263_FlushBits(h263_Info* pInfo, Ipp32s n)
{
n = n + pInfo->bitoff;
pInfo->bufptr += n >> 3;
pInfo->bitoff = n & 7;
}
__INLINE Ipp32u h263_GetBits(h263_Info* pInfo, Ipp32s n)
{
Ipp8u* ptr = pInfo->bufptr;
Ipp32u tmp = (ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | (ptr[3]);
tmp <<= pInfo->bitoff;
tmp >>= 32 - n;
n = n + pInfo->bitoff;
pInfo->bufptr += n >> 3;
pInfo->bitoff = n & 7;
return tmp;
}
__INLINE Ipp32u h263_GetBits9(h263_Info* pInfo, Ipp32s n)
{
Ipp8u* ptr = pInfo->bufptr;
Ipp32u tmp = (ptr[0] << 8) | ptr[1];
tmp <<= (pInfo->bitoff + 16);
tmp >>= 32 - n;
n = n + pInfo->bitoff;
pInfo->bufptr += n >> 3;
pInfo->bitoff = n & 7;
return tmp;
}
__INLINE void h263_AlignBits(h263_Info* pInfo)
{
if (pInfo->bitoff > 0) {
pInfo->bitoff = 0;
(pInfo->bufptr)++;
}
}
__INLINE Ipp32u h263_ShowBitsAlign(h263_Info* pInfo, Ipp32s n)
{
Ipp8u* ptr = pInfo->bitoff ? (pInfo->bufptr + 1) : pInfo->bufptr;
Ipp32u tmp = (ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | (ptr[3]);
tmp >>= 32 - n;
return tmp;
}
#endif // H263_USE_INLINE_BITS_FUNC
__INLINE Ipp32u h263_GetBit(h263_Info* pInfo)
{
Ipp32u tmp = pInfo->bufptr[0];
if (pInfo->bitoff != 7) {
tmp >>= 7 - pInfo->bitoff;
pInfo->bitoff ++;
} else {
pInfo->bitoff = 0;
pInfo->bufptr ++;
}
return (tmp & 1);
}
__INLINE Ipp32s h263_GetMarkerBit(h263_Info* pInfo) {
if (!h263_GetBit(pInfo)) {
h263_Error("Error in video_header: wrong marker bit");
return 0;
}
return 1;
}
#ifdef __cplusplus
}
#endif
#endif /* _H263_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -