mbfunctions.h

来自「经典的MP4编解码核心库」· C头文件 代码 · 共 157 行

H
157
字号
/**************************************************************************
 *
 * Head file of RMP4 codec, for coding on MB level
 *
 **************************************************************************/

#ifndef _ENCORE_BLOCK_H
#define _ENCORE_BLOCK_H

#include "encoder.h"
#include "bitwriter.h"

#define hoff	8
#define hsize	256

typedef uint32_t (cbpFunc)(const int16_t codes[6][64]);
typedef cbpFunc* cbpFuncPtr;	

static const uint8_t zig_zag_scan[64] = {
    0,  1,  8,  16, 9,  2,  3,  10, 
	17, 24, 32, 25, 18, 11, 4,  5,
    12, 19, 26, 33, 40, 48, 41, 34, 
	27, 20, 13, 6,  7,  14, 21, 28,
    35, 42, 49, 56, 57, 50, 43, 36, 
	29, 22, 15, 23, 30, 37, 44, 51,
    58, 59, 52, 45, 38, 31, 39, 46, 
	53, 60, 61, 54, 47, 55, 62, 63
};

// scan orders for AC prediction and interlaced encoding
static const uint8_t alternate_vertical_scan[64] = {
    0,  8,  16, 24, 1,  9,  2,  10,
    17, 25, 32, 40, 48, 56, 57, 49,
    41, 33, 26, 18, 3,  11, 4,  12,
    19, 27, 34, 42, 50, 58, 35, 43,
    51, 59, 20, 28, 5,  13, 6,  14,
    21, 29, 36, 44, 52, 60, 37, 45,
    53, 61, 22, 30, 7,  15, 23, 31,
    38, 46, 54, 62, 39, 47, 55, 63
};

static const uint8_t alternate_horizontal_scan[64] = {
    0,  1,  2,  3,  8,  9,  16, 17,
    10, 11, 4,  5,  6,  7,  15, 14,
    13, 12, 19, 18, 24, 25, 32, 33,
    26, 27, 20, 21, 22, 23, 28, 29,
    30, 31, 34, 35, 40, 41, 48, 49,
    42, 43, 36, 37, 38, 39, 44, 45,
    46, 47, 50, 51, 56, 57, 58, 59,
    52, 53, 54, 55, 60, 61, 62, 63
};



/** MotionEstimation functions **/
SearchHistory *init_search_history();
void free_search_history(SearchHistory *sh);
void GetDev16(Encoder * const pEnc);

extern cbpFuncPtr get_cbp;
extern cbpFunc get_cbp_c;
extern cbpFunc get_cbp_mmx;

typedef uint32_t (FieldDCTFunc)(int16_t *data);

typedef FieldDCTFunc* FieldDCTFuncPtr;	

FieldDCTFunc FieldDCT_test_c;
FieldDCTFunc FieldDCT_test_mmx;

extern FieldDCTFuncPtr FieldDCT_test;

int MotionEstimation_P(
			Encoder * const pEnc,
			const uint32_t iLimit,
			bool *intra);


int MotionEstimation_B(
			Encoder * const pEnc,
			const int TRB, 
			const int TRD,
		    VOP * const pCurrent
			);


/** MBMotionCompensation **/
void MBMotionCompensation(
			MACROBLOCK * const pMB,
		    const uint32_t j,
			const uint32_t i,
		    const VOP * const pRef,
			const VOP * const pRefH,
		    const VOP * const pRefV,
			const VOP * const pRefHV,
		    VOP * const pCurrent,
		    int16_t dct_codes[][64],
			const uint32_t width, 
			const uint32_t height,
			const uint32_t ext_width,
			const uint32_t rounding);


void MBMotionCompensation_B(
			const Encoder * const pParam,
		    const uint32_t col,
			const uint32_t row,
		    VOP * const compensated,
			VOP * const curr_image,
		    int16_t dct_codes[][64]);


void MBTransQuantIntra(const Encoder *pEnc,	 
		       const uint32_t x_pos, 	
		       const uint32_t y_pos, 	
		       int16_t data[][64],	 
		       int16_t qcoeff[][64], 
		       VOP * const pCurrent,    	         						
			   MACROBLOCK *pMB
);


uint8_t MBTransQuantInter(
			   const Encoder *pEnc,
			   const uint32_t x_pos, 	 
			   const uint32_t y_pos,	 
			   int16_t data[][64], 		 
			   int16_t qcoeff[][64],	 
			   VOP * const pCurrent,	 								    
			   MACROBLOCK *pMB
);


/** MBPrediction.c **/

void MBPrediction(
		  int32_t x_pos,		 
		  int32_t y_pos, 		 
		  MACROBLOCK *MB_array,
		  int32_t x_dim,		 
		  int16_t qcoeff[][64]  
    );

/** MBCoding.c **/
void MBCoding(Encoder *const pEnc, 
			  MACROBLOCK * const pMB, 	 
			  int16_t qcoeff[][64]);

// Added by David, 2002
void MBCoding_B(Encoder * const pEnc, 
				MACROBLOCK *pMB, 
				uint32_t x, uint32_t y,
				int16_t qcoeff[][64]);


#endif

⌨️ 快捷键说明

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