⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dsp_vop.h

📁 基于DM642平台的H.264编码器优化代码
💻 H
字号:
#include <std.h>
#ifndef _DSP_SVP_VOP_H_
#define _DSP_SVP_VOP_H_

//void initVopPar();
void CodeVOVOLHeader();
void CodeVopHeader(short frame);
void CodeVop(unsigned char * curr,
			unsigned char * reference,
			unsigned char * reconstruct,
			short frame);

char get_fcode (short search_range);
void CodeIntraVOPTexture(unsigned char * curr,unsigned char * reference);
void loadUCharMBdata(unsigned char * currvop, short mb_x, short mb_y, short width,short height,unsigned char * currMB);
void FromCharToShort();//from g_currMB to g_fblock
void DCT_Quant_Rec_MB (char QP, char Mode);//dct,quant,idct the g_fblock,then g_fblock + g_compMB to g_currMB
void CopyRecMBToRef(unsigned char * reference, short mb_x, short mb_y, short width,short height);
/****/
void CopyRecMBToResult(unsigned char * result,short mb_x,short mb_y,short width, short height);
/****/
char cal_dc_scaler (char QP, char type);
inline void BlockQuantH263 (short *coeff, char QP, char mode, char type, short *qcoeff);
inline void BlockDequantH263 (short *qcoeff, char QP, char mode, char type, short *rcoeff);
Int FindCBP (short* qcoeff, char Mode, char ncoeffs);
char doDCACpred(short *qcoeff, Int *CBP, char ncoeffs, short x_pos, short y_pos,
			short ***DC_store_curr, short ***DC_store_above, char QP, char direction[] );

void Bits_CountMB_combined(char Mode, char COD, char ACpred_flag,Int CBP, char vop_type);
char IntraDC_dpcm(short val, char lum);
short CodeCoeff(char j_start, char Mode, short qcoeff[],  char ncoeffs);
void MB_CodeCoeff(short *qcoeff,char Mode, Int CBP, char ncoeffs,char direction[]);
//mot mot mot mot mot mot mot mot mot mot 
void	Obtain_Range(
			short     sr,						  /* <-- Serach range (radius)                           */
			char     type,						  /* <-- MBM_INTER16==16x16 search;	MBM_INTER8==8x8 search */
			short   pmv_x,						  /* <-- predicted horizontal motion vector              */
			short   pmv_y,						  /* <-- predicted horizontal motion vector              */
			short   *mv_x_min,					  /* --> min horizontal range                            */
			short   *mv_x_max,					  /* --> max horizontal range                            */
			short   *mv_y_min,					  /* --> min vertical range                              */
			short   *mv_y_max					  /* --> max vertical range                              */
		);
void
RangeInSearchArea(
	char     i,										  /* <-- horizontal MBcoordinate in pixels               */
	char     j,										  /* <-- vertical MB coordinate in pixels                */
	char     block,									  /* <-- block position (0 16x16; 1-2-3-4 8x8)           */
	char     prev_x,									  /* <-- absolute horizontal position of the previous vop*/
	char     prev_y,									  /* <-- absolute vertical position of the previous vop  */
	short     vop_width,								  /* <-- horizontal vop dimension                        */
	short     vop_height,								  /* <-- vertical vop dimension                          */
	short   *mv_x_min,								  /* <-- min horizontal range                            */
	short   *mv_x_max,								  /* <-- max horizontal range                            */
	short   *mv_y_min,								  /* <-- min vertical range                              */
	short   *mv_y_max,								  /* <-- max vertical range                              */
	char     *out									  /* --> the search area does not exist (the reference   */												  /*     and current BB does not overlap)                */
);

inline Int SAD_Macroblock(
unsigned char   * restrict ii,										  /* <-- Pointer to the upper-left pel of first MB */
unsigned char   * restrict act_block,								  /* <-- Id, second MB (width=16)                  */
short   h_length,								  /* <-- Width of first area                       */
Int    Min_FRAME								  /* <-- Minimum prediction error so far           */
);
/*
inline Int SAD_Block(
unsigned char   * restrict ii,										  // <-- First area                      /
unsigned char   * restrict act_block,								  // <-- Id. second MB (width=16)        /
short   h_length,								  // <-- Width of first area             /
Int    min_sofar								  // <-- Minimum prediction error so far/
);
*/
char TryIntraMode(unsigned char *curr,Int  min_SAD);

void
MotionEstimation (
unsigned char    *curr_vop,						  /* <-- current Vop (for luminance)                  */
unsigned char  *prev_rec_vop,					  /* <-- reference Vop (reconstructed)(1/2 pixel)     */
Int  *mad,									  /* <-> mad value of the ME/MC result                */
char  *motx,									  /* --> horizontal MV coordinates                    */
char  *moty,									  /* --> vertical MV coordinates                      */
char  *MBmode									  /* --> modes for each MB                            */
);

void loadCompData(unsigned char *src,short lenSrc,char size,unsigned char *dst,char lenDst);
void GetPredChroma(char xh , char yh , unsigned char * dst, char rounding_control);
void compensation(
	  unsigned char * ref,
	  short i,short j,char Mode,
	  char * motx_ptr,char * moty_ptr,
	  char rounding_type);

void diffMB();// g_currMB - g_compMB to g_fblock

void											  /* MVP/Noel */
find_pmvs(
	char  *mot_x,									  /* x-motion vector field                             */
	char  *mot_y,									  /* y-motion vector field                             */
	short    x,										  /* xpos of the MB in multiples of 16 (hor coord)     */
	short    y,										  /* ypos of the MB in multiples of 16 (ver coord)     */
	char    block,									  /* block number (0 if one vector per MB, 1..4 else)  */
	short    *mvx,									  /* hor predicted motion vector [ in half-pixels units ]  */
	short    *mvy									  /* ver predicted motion vector [ in half-pixels units ]  */
);

void
ScaleMVD (
	char  f_code,		  /* <-- MV range in 1/2 units: 1=32,2=64,...,7=2048     */
	short  diff_vector,	  /* <-- MV Difference commponent in 1/2 units           */
	short  *residual,		  /* --> value to be FLC coded                           */
	short  *vlc_code_mag	  /* --> value to be VLC coded                           */
);
void PutMV (short mvint);
void WriteMVcomponent(char f_code,short  dmv);

void
Bits_CountMB_MV(
char   *mot_h,			  /* <-- motion vectors (Float) - per block    */
char   *mot_v,			  /* <-- motion vectors (Float) - per block    */
char   mode,			  /* <-- macroblocks modes (SInt) - per MB     */
char     h,				  /* <-- horizontal coordinate of the MB       */
char     v,				  /* <-- vertical coordinate of the MB         */
char     f_code			  /* <-- MV range in 1/2 or 1/4 pel units 1=32,2=64,...,7=2048 */									  /* <-- flag for quarter pel MC mode     */
);
void CodeInterVOP (
unsigned char * curr,//Vop *curr, 
unsigned char * rec,//Vop *comp, 
char *MB_decisions, char *mot_x, char *mot_y,
unsigned char * ref //Vop *rec_curr
);

Int
MBMotionEstimation(
	unsigned char *prev,
	char     i,				/* <-- horizontal MBcoordinate in pixels            */
	char     j,				/* <-- vertical MB coordinate in pixels             */
	char     prev_x,		/* <-- absolute horiz. position of previous vop     */
	char     prev_y,		/* <-- absolute verti. position of previous vop     */
	short     vop_width,	//reference vop's width ,including the edge 16 
	short     vop_height,	//reference vop's  height,including the edge 16
	short     sr,			/* <-- search range (corresponds to f_code) UB 990215*/
	char *motx,// short is better,if use char ,then the mv sr should be <64
	char *moty,// short is better,if use char ,then the mv sr should be <64
	char *MB_md
);
void paddingMBleft(unsigned char * reference, short mb_y, short width,short height);
void paddingMBright(unsigned char * reference, short mb_y, short width,short height);
void paddingVOPTop(unsigned char * reference, short width,short height);
void paddingVOPBottom(unsigned char * reference, short width,short height);

void paddingMBleft1(unsigned char * reference, short mb_y, short width,short height);
void paddingMBright1(unsigned char * reference, short mb_y, short width,short height);
void paddingVOPTop1(unsigned char * reference, short width,short height);
void paddingVOPBottom1(unsigned char * reference, short width,short height);

#endif //_DSP_SVP_VOP_H_

⌨️ 快捷键说明

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