📄 mae_pass_thru.h
字号:
/* <LIC_AMD_STD> * Copyright (c) 2005 Advanced Micro Devices, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * The full GNU General Public License is included in this distribution in the * file called COPYING * </LIC_AMD_STD> *//* <CTL_AMD_STD> * </CTL_AMD_STD> *//* <DOC_AMD_STD> * </DOC_AMD_STD> */// ***************************************************************************// avoid multiple inclusion (entry)// ***************************************************************************#ifndef _MAE_PASS_THRU_H_#define _MAE_PASS_THRU_H_// ***************************************************************************// includes// ***************************************************************************#include "types.h"extern int nFileUpdates;// ***************************************************************************// global variables// ***************************************************************************extern int nBldOpt;extern int nFileUpdates;// ***************************************************************************// definitions// ***************************************************************************#define TRUE 1#define FALSE 0#define OFFSET_BLK1 8 #define OFFSET_BLK2 128#define OFFSET_BLK3 136#define BLOCK_SIZE 8#define BLOCK_SQUARE_SIZE 64#define MB_SIZE 16#define MB_SQUARE_SIZE 256#define FROM_MPEG4_REF_HPEL 1#define FROM_MPEG4_REF_QPEL 2#define FROM_MAE_CMODEL 3#define FROM_MPEG2_REF 4#define CODEC_H263 0#define CODEC_MPEG 1// picked up from type\basic.hpp#define IFRAME 0 //IVOP#define PFRAME 1 //PVOP#define BFRAME 2 //BVOP// $PP// coded block param values#define Y0_CODED 0x80#define Y1_CODED 0x40#define Y2_CODED 0x20#define Y3_CODED 0x10#define CB0_CODED 0x08#define CR0_CODED 0x04#define CB1_CODED 0x02#define CR1_CODED 0x01#define BLOCK_NOT_CODED 0#define BLOCK_CODED 1#define ALL_CODED_420 0xFC#define ALL_CODED_422 0xFF#define MAE_FRAME_PICTURE 0#define MAE_FIELD_PICTURE 1#define MAE_DCTT_NON_INTERLACED 0#define MAE_DCTT_INTERLACED 1#define FORWARD_TOP 1#define BACKWARD_TOP 2#define FORWARD_BOTTOM 3#define BACKWARD_BOTTOM 4#define IQUANT_DONE 1#define IDCT_DONE_8_BIT 2#define IDCT_DONE_32_BIT 3#define MOTION_COMP_DONE 4#define IDCT_MIN_VAL 0#define IDCT_MAX_VAL 255#define Y1_LUMA_BLOCK 1#define Y2_LUMA_BLOCK 2#define Y3_LUMA_BLOCK 3#define Y4_LUMA_BLOCK 4#define U_CHROMA_BLOCK 5#define V_CHROMA_BLOCK 6#define U2_CHROMA_BLOCK 7#define V2_CHROMA_BLOCK 8#define U3_CHROMA_BLOCK 9#define V3_CHROMA_BLOCK 10#define U4_CHROMA_BLOCK 11#define V4_CHROMA_BLOCK 12#define ROW1 1#define ROW2 2#define ROW3 3#define ROW4 4#define ROW5 5#define ROW6 6#define ROW7 7#define ROW8 8#define OFFSET_32 32#define TOTAL_420_BYTES 384#define GET_FRAME_SIZE(x, y) (x * y * sizeof(unsigned char))#define GET_WIDTH(x) (x * sizeof(unsigned char))#define MACROBLOCK_CODED 1#define MACROBLOCK_SKIPPED 2#define INTER_CODED_AS_INTER 3#define INTER_CODED_AS_INTRA 4// INTRA REFERENCES#define MBMODE_INTRA_Y0 0x0000#define MBMODE_INTRA_Y1 0x0000#define MBMODE_INTRA_Y2 0x0000#define MBMODE_INTRA_Y3 0x0000#define MBMODE_INTRA_CB 0x0000#define MBMODE_INTRA_CR 0x0000#define MBMODE_INTRA_ALL 0x0000#define FORWARD_REFERENCES 1#define BACKWARD_REFERENCES 2// FORWARD REFERENCES#define MBMODE_FWD_Y0 0x00004000#define MBMODE_FWD_Y1 0x00001000#define MBMODE_FWD_Y2 0x00000400#define MBMODE_FWD_Y3 0x00000100#define MBMODE_FWD_CB0 0x00000040#define MBMODE_FWD_CR0 0x00000010#define MBMODE_FWD_CB1 0x00000004#define MBMODE_FWD_CR1 0x00000001#define MBMODE_FWD_ALL_420 (MBMODE_FWD_Y0 | MBMODE_FWD_Y1 | \ MBMODE_FWD_Y2 | MBMODE_FWD_Y3 | \ MBMODE_FWD_CB0 | MBMODE_FWD_CR0)#define MBMODE_FWD_ALL_422 (MBMODE_FWD_Y0 | MBMODE_FWD_Y1 | \ MBMODE_FWD_Y2 | MBMODE_FWD_Y3 | \ MBMODE_FWD_CB0 | MBMODE_FWD_CR0 | \ MBMODE_FWD_CB1 | MBMODE_FWD_CR1) // BACKWARD REFERENCES#define MBMODE_BWD_Y0 0x00008000#define MBMODE_BWD_Y1 0x00002000#define MBMODE_BWD_Y2 0x00000800#define MBMODE_BWD_Y3 0x00000200#define MBMODE_BWD_CB0 0x00000080#define MBMODE_BWD_CR0 0x00000020#define MBMODE_BWD_CB1 0x00000008#define MBMODE_BWD_CR1 0x00000002#define MBMODE_BWD_ALL_420 (MBMODE_BWD_Y0 | MBMODE_BWD_Y1 | \ MBMODE_BWD_Y2 | MBMODE_BWD_Y3 | \ MBMODE_BWD_CB0 | MBMODE_BWD_CR0)#define MBMODE_BWD_ALL_422 (MBMODE_BWD_Y0 | MBMODE_BWD_Y1 | \ MBMODE_BWD_Y2 | MBMODE_BWD_Y3 | \ MBMODE_BWD_CB0 | MBMODE_BWD_CR0 | \ MBMODE_BWD_CB1 | MBMODE_BWD_CR1)// BI-DIRECTIONAL REFERENCES#define MBMODE_BID_Y0 0x0000C000#define MBMODE_BID_Y1 0x00003000#define MBMODE_BID_Y2 0x00000C00#define MBMODE_BID_Y3 0x00000300#define MBMODE_BID_CB0 0x000000C0#define MBMODE_BID_CR0 0x00000030#define MBMODE_BID_CB1 0x0000000C#define MBMODE_BID_CR1 0x00000003#define MBMODE_BID_ALL_420 (MBMODE_BID_Y0 | MBMODE_BID_Y1 | \ MBMODE_BID_Y2 | MBMODE_BID_Y3 | \ MBMODE_BID_CB0 | MBMODE_BID_CR0)#define MBMODE_BID_ALL_422 (MBMODE_BID_Y0 | MBMODE_BID_Y1 | \ MBMODE_BID_Y2 | MBMODE_BID_Y3 | \ MBMODE_BID_CB0 | MBMODE_BID_CR0 | \ MBMODE_BID_CB1 | MBMODE_BID_CR1) #define TOTAL_BYTES_FOR_420 64 * 6 // 4 luma + 1 CbCr pair#define TOTAL_BYTES_FOR_422 64 * 8 // 4 luma + 2 CbCr pairs#define MAX_FILE_SIZE 256#define MAX_FRAME_NUM_SIZE 10#define FILE_AFTER_INTRA_IQUANT "IQUANTIntra"#define FILE_AFTER_INTRA_IDCT "IDCTIntra"#define FILE_AFTER_INTER_P_IQUANT "IQUANTInterP"#define FILE_AFTER_INTER_P_IDCT "IDCTInterP"#define FILE_INTER_P_REF_BLOCKS_MV "RefBlocksMVP"#define FILE_AFTER_INTER_P_MCOMP "MCInterP"#define FILE_AFTER_INTER_B_IQUANT "IQUANTInterB"#define FILE_AFTER_INTER_B_IDCT "IDCTInterB"#define FILE_INTER_B_REF_BLOCKS_MV "RefBlocksMVB"#define FILE_AFTER_INTER_B_MCOMP "MCInterB"#define FILE_INTRA_FINAL "FinalIntra"#define FILE_INTER_P_FINAL "FinalInterP"#define FILE_INTER_B_FINAL "FinalInterB"#define FILE_REF_FRAME_Y_FOR_P "RefFrameYForP"#define FILE_REF_FRAME_U_FOR_P "RefFrameUForP"#define FILE_REF_FRAME_V_FOR_P "RefFrameVForP"#define FILE_REF_FRAME_Y_FOR_B "RefFrameYForB"#define FILE_REF_FRAME_U_FOR_B "RefFrameUForB"#define FILE_REF_FRAME_V_FOR_B "RefFrameVForB"#define REF_FILE_EXTENSION ".ref"#define MAE_FILE_EXTENSION ".mae"// All File Dump Command-Line Options#define CMD_DUMP_ALL "DUMP_ALL" // Default#define CMD_NO_DUMP_ALL "NO_DUMP_ALL"#define CMD_NO_DUMP_IQUANT "NO_DUMP_IQUANT"#define CMD_NO_DUMP_IDCT "NO_DUMP_IDCT"#define CMD_NO_DUMP_REFBLKS_MV "NO_DUMP_REFBLKS_MV"#define CMD_NO_DUMP_REF_FRAME "NO_DUMP_REF_FRAME"#define CMD_NO_DUMP_MC "NO_DUMP_MC"#define CMD_NO_DUMP_FINAL "NO_DUMP_FINAL"#define CMD_USE_REF "USE_REF" // Default#define CMD_USE_MAE "USE_MAE"// ALL THE MAE INTER CHECKERS (while doing MC)#define FILE_QPEL_INTERP_CHECKS "QPELIntersP"#define FILE_QPEL_INTERB_CHECKS "QPELIntersB"#define A_FWD_INTER_CHECKS 1#define A_BWD_INTER_CHECKS 2#define B_FWD_INTER_CHECKS 3#define B_BWD_INTER_CHECKS 4#define C_FWD_INTER_CHECKS 5#define C_BWD_INTER_CHECKS 6#define O_FWD_INTER_CHECKS 7#define O_BWD_INTER_CHECKS 8#define MPEG4_REF_BLOCKS 9// All File Dump Options#define DUMP_ALL 0 //Default#define NO_DUMP_ALL 1#define NO_DUMP_IQUANT 2#define NO_DUMP_IDCT 3#define NO_DUMP_REFBLKS_MV 4 #define NO_DUMP_REF_FRAME 5#define NO_DUMP_MC 6#define NO_DUMP_FINAL 7#define USE_REF 8 // Default#define USE_MAE 9#define DUMP_FINAL 10// Usage options#define MAE_USAGE "Usage: \tDECODER bitstream_file output_file width height\n\or:\tDECODER bitstream_file output_file width height NO_DUMP_ALL\n\or:\tDECODER bitstream_file output_file width height USE_MAE\n\or:\tDECODER bitstream_file output_file width height USE_REF\n\or:\tDECODER bitstream_file output_file width height NO_DUMP_ALL USE_MAE\n\or:\tDECODER bitstream_file output_file width height NO_DUMP_ALL USE_REF\n"// ***************************************************************************// types// ***************************************************************************typedef struct mae_cmodel_frame_params_struct{ uint8* fwd_y_top_ptr; uint8* fwd_cb_top_ptr; uint8* fwd_cr_top_ptr; // For interlacing uint8* fwd_y_bot_ptr; uint8* fwd_cb_bot_ptr; uint8* fwd_cr_bot_ptr; uint8* bwd_y_top_ptr; uint8* bwd_cb_top_ptr; uint8* bwd_cr_top_ptr; // For interlacing uint8* bwd_y_bot_ptr; uint8* bwd_cb_bot_ptr; uint8* bwd_cr_bot_ptr; // frame size int iPicWidth; int iPicHeight; // Precision units for MVs int mcprec; int mcprecuv; // $PP // Frame Number int iFrameNum; // coding type 4:2:0 or 4:2:2 int blockcount; // mismatch int mis; // this is specific to DMV int dmv;} mae_cmodel_frame_params, *pmae_cmodel_frame_params;typedef struct mae_cmodel_mb_params_struct{ uint8 codec; uint32 xpos; uint32 ypos; uint32 iDcScalerY; uint32 iDcScalerC; uint32 mbmode; uint32 mbtype; uint8 WM_FOR_INTRA_Y[64]; uint8 WM_FOR_INTRA_C[64]; uint8 WM_FOR_INTER_Y[64]; uint8 WM_FOR_INTER_C[64]; uint32 iqmul2; uint32 iqadd2; uint32 iqdiv3; uint32 iqadd1; // This will point to the output of IQUANT done by the refernce code. We will update these // pointers only for MPEG4 & H.263 & then pass it on to the CModel. // For other codecs (MPEG1/2 & WMV9) we should send in the actual block data since the // CModel would do the IQAUNT (& IDCT) there!! // **************************************************************************************** int16 blk_data0[64]; int16 blk_data1[64]; int16 blk_data2[64]; int16 blk_data3[64]; int16 blk_data4[64]; int16 blk_data5[64]; int16 blk_data6[64]; int16 blk_data7[64]; // offsets for the Y & CbCr blocks in memory int nWidthLuma; int nWidthChroma; int nFrameWidthY; // destination pointers uint8 *cur_y_frame; uint8 *cur_cb_frame; uint8 *cur_cr_frame; // MC stuff uint32 rnd; uint32 ps; uint32 dctt; uint32 fp; uint32 ft; uint32 fb; uint32 bt; uint32 bb; // MV for the luma & chroma blocks uint32 luma_mv[8]; // 4-forward & 4-backward uint32 chroma_mv[2]; uint32 chroma_mv1[2]; // new addition for wmv9; just set to 0 uint32 picture_level_mbmode; // coded parameter block uint32 cbp; // Frame Type (I, P or B) int nFrameType; // Some debugging info // MacroBlock number int nMB; // Frame number int nFrameNum; // Pure Intra? unsigned char bPureIntra; // Interlaced Mode ON? unsigned char bInterlace;} mae_cmodel_mb_params, *pmae_cmodel_mb_params;typedef struct intermediate_mb_checkers_struct{ int nMB; int nWidthLuma; int nWidthChroma; int nFrameWidthY; uint8 *cur_y_frame; uint8 *cur_cb_frame; uint8 *cur_cr_frame; int nSkipped; int nRefType; int nMBMode; int nChromaFormat; // added for 422}INTERMEDITATE_MB_CHECKERS , *pINTERMEDITATE_MB_CHECKERS;typedef struct intermediate_block_checkers_struct{ int nMB; int nBlkType; int nOutputType; int nStepSize; int nIntraWithinInter; int bBlockCoded; int *blk_after_iquant; unsigned char *blk_after_idct_8bit; unsigned char *blk_after_mcomp; int *blk_after_idct_32bit;}INTERMEDITATE_BLOCK_CHECKERS , *pINTERMEDITATE_BLOCK_CHECKERS;typedef struct intermediate_ref_block_mv_checkers_struct{ unsigned char *refblk; int nRefType; //used only in case of bi-directional refs int nMBNum; int nActMVX; // x coordinate, Half Pel in MPEG-4 Ref/Quarter Pel in MAE int nActMVY; // y coordinate, Half Pel in MPEG-4 Ref/Quarter Pel in MAE int nXFrac; // X Frac position for doing QPEL MC int nYFrac; // Y Frac position for doing QPEL MC int nMBType; int nMBMode; int nBlockNum; int nWidthY; int nWidthUV; unsigned char bSkip; unsigned char bInterlaced;}REF_BLK_MV_CHECKERS, *pREF_BLK_MV_CHECKERS;// ***************************************************************************// function prototypes// ***************************************************************************void BuildFrameParamsForMAE (mae_cmodel_frame_params*, unsigned char);void BuildMBParamsForMAE (mae_cmodel_mb_params*, unsigned char *, unsigned char);void InterChecksOnBlock (pINTERMEDITATE_BLOCK_CHECKERS, char *);void InterChecksAfterMC (pINTERMEDITATE_MB_CHECKERS, char *, int);void InterChecksForRefBlkAndMV (pREF_BLK_MV_CHECKERS, char *, unsigned char);void* MAEFree (void *);void Set_Print_Flag (int);void Call_cmodel_init_global (void);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -