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

📄 sampmp4.h

📁 一个使用 linux编写的mpeg4解码代码,包括mpeg4解码库和示例代码
💻 H
📖 第 1 页 / 共 2 页
字号:
	int obmc_disabled;	 /* Overlapped Block Motion Compensation disabled or
                         // not */
	int scalable;	     /* Scalable or not */
	int sprite_type;	 /* Sprite Type */
	int sadct_disabled;	 /* shape adaptive DCT disable or not */
	int resync_disabled; /* Error resillience Resync mode disable or not */
	int data_patitioned; /* Error resillience Data Partition mode enable or
                         // not */
	int new_pred;			    /* NEWPRED mode enable or not */
	int reduced_resolution;     /* Reduced resolution VOP tool enable or not */
	int complex_est_disable;    /* Complexity estimation header disable or
                                // not */
	int clock_rate;			    /* VOP time increment resolution */
	int numbits_time_incr;	    /* VOP time increment */
	int quater_sample;		    /* Quarter sample mode selected or not */
	int quant_type;			    /* Quantisation mode */
    int *qmatrix_intra;	        /* Pointer to Luminance/Chrominance Intra
                                // Quantisation Matrix */
	int *qmatrix_inter;	        /* Pointer to Luminance/Chrominance Inter
                                // Quantisation Matrix */
	Ipp8u qmatrix_intra_tbl[64];/* Matrix contain Luminance/Chrominance Intra
                                // Quantisation from stream */
	Ipp8u qmatrix_inter_tbl[64];/* Matrix contain Luminance/Chrominance Inter
                                // Quantisation from stream */
    int vop_coded;			    /* VOP coded or not */
	int vol_display_width;	    /* Display width */
	int vol_display_height;	    /* Display height */
	int mb_per_row;			    /* Num of MacroBlock per Row in current VOP */
	int mb_per_col;			    /* Num of MacroBlock per Col in current VOP */
    sample_step_set       frame_step_set;
    sample_dimension      frame_dimension;        
    sample_spacial_ptrset cur_frame;        /* Pointer set of current frame */
    sample_spacial_ptrset fwd_ref_frame;    /* Pointer set of forward reference
                                            // frame */
	sample_spacial_ptrset rec_frame;        /* Pointer set of reconstructed
                                            // current frame */	
	sample_spacial_ptrset fwd_ref_rec_frame;/* Pointer set of reconstructed
                                            / forward reference frame */
    sample_spectral_ptrset coef_buf_row;    /* Row Buffer for Coefficients */   
    sample_spectral_ptrset coef_buf_col;    /* Column Buffer for Coefficient */
    IppMotionVector *mv_plane;              /* Buffer for motion vector plane */
	Ipp8u *mb_type_plane;   /* Pointer to MacroBlock Type plane */
    int hour;               /* Time code Hour in Group of VOP header */
    int minute;             /* Time code Minute in Group of VOP header */
    int second;             /* Time code Second in Group of VOP header */
    int closed_gov;         /* Nature of prediction in B-VOP when GOV
                            // supported */
    int broken_link;        /* Broken Link */
    IppMotionVector *mv_buf;/* Pointer to forward motion vector buffer */	
	Ipp8u *tranp_buf;		/* Pointer to transparent buffer */	
	Ipp8u *qp_buf;			/* Pointer to Luminance/Chrominance quantisation
                            // parameter buffer */	
	sample_picture *info_pic;/* Pointer to picture display information */
	Ipp8u *sub_cur_buf;		/* Pointer to subsampled current buffer */	
	Ipp8u *sub_mc_buf;		/* Pointer to subsampled motion compensation
                            // buffer */
	Ipp8u *pad_flag;		/* Pointer to padding flag */	
	int init_quant;			/* Initial quantisation parameter */	
	int init_rounding;		/* Initial Rounding */	
	int intra_dc_thr;		/* Intra DC VLC threshold */	
	int rounding;			/* rounding 0 or 1 */	
	Ipp8u vop_quant;		/* VOP Luminance/Chrominance quantisation
                            // parameter */
	int search_range;		/* Search Range in Motion Estimation */	
	Ipp16u *ysum_plane;		/* Pointer to summation plane */	
	int frame_rate;		    /* Frame Rate */	
	int ivop_interval;		/* Number of P-Frame between 2 nearest I-VOP */
	int use_src_me;			/* Raw data used in Motion Estimation directly */
	int modulo_base_decd;	/* module time base for decoding */ 
	int modulo_base_disp;	/* module time base for displaying */
	int color_format;		/* Input color format */
	Ipp8u  *blk_ref_buf;	/* Pointer to the buffer which contains referrence
                            // block */
	Ipp16s *blk_coef_buf;	/* Pointer to the buffer which contains current
                            // encoded block's spatial content */
	Ipp16s *resid_buf;	    /* Pointer to the buffer wihich contains current
                            // encoded block's residue */
	Ipp16s *rec_resid_buf;	/* Pointer to the buffer wihich contains current
                            // encoded block's reconstructed residue */
} mp4_enc_state;

typedef struct _mp4_enc_params {

    int vol_verid;		/* VOL version identification */
    int vol_width;      /* VOL width */   
    int vol_height;     /* VOL height */
    int color_format;   /* Color Format */
    int frame_rate;     /* Frame rate */
    int quant_type;     /* Quantisation method: MPEG-4 or H.263 */
    int intra_dc_thr;	/* Intra DC VLC threshold */
    int vop_quant;      /* Quantisation parameter */
    int ivop_interval;  /* Number of P-Frames between two nearest I-Frames */
    int search_range;   /* Search Range in motion estimation */
	int use_src_me;		/* raw data direct used in motion estimation */
    int num_frames;     /* number of frames */
} mp4_enc_params;


/* ============================ Table Declarations ========================= */
/* tables shared by decoder and encoder */
extern const int bits_mask_tbl[33];
extern unsigned char default_qmat_intra_tbl[64];
extern unsigned char default_qmat_inter_tbl[64];
extern const Ipp16u dc_switch_thresh_tbl[8];
/* decoder related tables */
extern const unsigned char classic_zigzag_tbl[64];
extern const Ipp8u  cbpy4_intra_tbl[13];
extern const mp4_tree_node mcbpc_pvop_vlc_tbl[21];
extern const mp4_table_node dc_size_lum_tbl[8];
extern const mp4_table_node dc_size_chr_tbl[4];
/* encoder related tables */
extern const int bits_stuf_tbl[8];
extern const mp4_table_node vlc_mcbpc_ivop_tbl[10];
extern const mp4_table_node vlc_mcbpc_pvop_tbl[22];
extern const mp4_table_node vlc_cbpy_tbl[19];


/* ======================== API Functions Declarations ===================== */

/* API shared by decoder and encoder */
/* mp4dutil.c, mp4eutil.c */
extern sample_status lookup_uvmv_mpeg4
(IppMotionVector *mv_lum, IppMotionVector *mv_chr, int mb_type);

/* decoder related API */
/* mp4dbuff.c */
extern sample_status init_input_video_buffer
(sample_bitstream *stream_buf);

extern sample_status load_video_buffer
(sample_bitstream *stream_buf, FILE *fpin);

extern sample_status release_input_video_buffer
(sample_bitstream *stream_buf);

extern Ipp32u get_bits_mpeg4
(sample_bitstream *stream_buf, int n_bits);

extern void rewind_buffer_mpeg4
(sample_bitstream *stream_buf, int n_bits);

/* mp4dutil.c */
extern sample_status search_next_sc_mpeg4
(const sample_bitstream *stream_buf, Ipp8u **result_pos);

extern void insert_sc_mpeg4
(sample_bitstream *stream_buf);

extern sample_status copy_mb_from_ref_plane
(const Ipp8u *src_y,  int src_y_step, const Ipp8u *src_cb, int src_cb_step,
 const Ipp8u *src_cr, int src_cr_step,      Ipp8u *dst_y,  int dst_y_step,
       Ipp8u *dst_cb, int dst_cb_step,      Ipp8u *dst_cr, int dst_cr_step);

extern sample_status expand_frame_dec_mpeg4
(mp4_dec_state *dec_state);

extern sample_status set_ref_frame_dec_mpeg4
(mp4_dec_state *dec_state);

/* mp4dpars.c */
extern sample_status parse_mb_mpeg4
(sample_bitstream *stream_buf, mp4_dec_vop_infor *vop_infor, int vop_type);

extern sample_status parse_voandvol_header_mpeg4
(sample_bitstream  *stream_buf, mp4_dec_state *dec_state);

extern sample_status parse_vop_header_mpeg4
(sample_bitstream  *stream_buf, mp4_dec_state *dec_state,
 mp4_dec_vop_infor *vop_infor);

extern sample_status parse_gov_mpeg4
(sample_bitstream  *stream_buf, mp4_dec_state *dec_state);


/* mp4dinit.c */
extern sample_status init_vop_infor_dec_mpeg4
(mp4_dec_state *dec_state, mp4_dec_vop_infor *vop_infor);

extern sample_status decoder_init_alloc_mpeg4
(sample_bitstream *stream_buf, mp4_dec_state *dec_state);

extern sample_status decoder_free_mpeg4
(mp4_dec_state *dec_state);

/* mp4dvops.c */
extern sample_status decode_mpeg4
(sample_bitstream *stream_buf, sample_picture *picture,
 mp4_dec_state *dec_state);

/* mp4dmblk.c */
extern sample_status decode_mb_pvop_mpeg4
(sample_bitstream  *stream_buf, const mp4_dec_state *dec_state, 
 mp4_dec_vop_infor *vop_infor, int mbx_indx, int mby_indx);

extern sample_status decode_mb_ivop_mpeg4
(sample_bitstream  *stream_buf, const mp4_dec_state *dec_state, 
 mp4_dec_vop_infor *vop_infor);

/* mp4dblck.c */
extern sample_status decode_block_inter_mpeg4
(sample_bitstream *stream_buf, Ipp16s *dst_rsd, int quant_para, 
 const Ipp8u *quant_matrix);

extern sample_status decode_block_intradcac_mpeg4
(sample_bitstream *stream_buf, Ipp8u *dst_val, int step, Ipp16s *coef_bufrow,
 Ipp16s *coef_bufcol, Ipp8u quant_para, Ipp8u *quant_buf,
 const Ipp8u *quant_matrix, int blk_indx, int intra_dcvlc_flag,
 int ac_pred_flag);

extern sample_status decode_block_intradc_mpeg4
(sample_bitstream *stream_buf, Ipp8u *dst_val, int step, Ipp16s *coef_bufrow,
 Ipp16s *coef_bufcol, Ipp8u quant_para, Ipp8u *quant_buf,
 const Ipp8u *quant_matrix, int blk_indx, int intra_dcvlc_flag,
 int ac_pred_flag);

/* encoder related API */
/* mp4ebuff.c */
extern sample_status init_output_video_buffer
(sample_bitstream *stream_buf, int size);

extern sample_status dump_video_buffer
(sample_bitstream *stream_buf, FILE *fpout);

extern sample_status release_output_video_buffer
(sample_bitstream *stream_buf);

extern void put_bits_mpeg4
(sample_bitstream *stream_buf, Ipp32u data, int n_bits);

extern void load_extend_picture
(FILE *fpin, sample_picture *pic);

/* mp4eutil.c */
extern void set_ref_frame_enc_mpeg4
(mp4_enc_state *enc_state);

extern void expand_frame_enc_mpeg4
(mp4_enc_state *enc_state);


/* mp4synt.c */
extern sample_status create_voandvol_header_mpeg4
(sample_bitstream  *stream_buf, mp4_enc_state *enc_state);

extern sample_status create_vop_header_mpeg4
(sample_bitstream  *stream_buf, mp4_enc_state *enc_state,
 mp4_enc_vop_infor *vop_infor);

extern sample_status create_mb_mpeg4
(sample_bitstream  *stream_buf, mp4_enc_state *enc_state,
 mp4_enc_vop_infor *vop_infor);


/* mp4einit.c */
extern sample_status encoder_init_alloc_mpeg4
(mp4_enc_params *enc_config, mp4_enc_state *enc_state);

extern sample_status encoder_free_mpeg4
(mp4_enc_state *enc_state);

extern sample_status init_vop_infor_enc_mpeg4
(mp4_enc_state *enc_state, mp4_enc_vop_infor *vop_infor);


/* mp4evops.c */
extern sample_status encode_mpeg4
(sample_bitstream  *stream_buf, mp4_enc_state *enc_state);

/* mp4emblk.c */
extern sample_status encode_intra_mb_mpeg4
(sample_bitstream  *stream_buf, mp4_enc_state *enc_state,
 mp4_enc_vop_infor *vop_infor);

extern sample_status encode_inter_mb_mpeg4
(sample_bitstream  *stream_buf, mp4_enc_state  *enc_state,
 mp4_enc_vop_infor *vop_infor, IppMotionVector *pMVCurMB, Ipp8u	*pTranspCurMB);

/* mp4eblck.c */
extern sample_status encode_block_intra_mpeg4
(Ipp8u *src_block, Ipp8u *rec_block, Ipp16s *dst_coeff, int blk_indx,
 Ipp8u cur_qp, int step, const int *q_matrix);

extern sample_status acdc_prediction_intra_mb_mpeg4
(Ipp16s *src_dst_coeff, Ipp16s *coef_bufrow_y, Ipp16s *coef_bufcol_y,
 Ipp16s *coef_bufrow_cb, Ipp16s *coef_bufcol_cb, Ipp16s *coef_bufrow_cr,
 Ipp16s *coef_bufcol_cr, Ipp8u  cur_qp, Ipp8u  *qp_buf, int *ac_pred_flag,
 Ipp8u  *pred_dir_buf);

extern sample_status encode_block_inter_mpeg4
(Ipp16s *src_block, Ipp16s *rec_block, Ipp16s *dst_coeff, Ipp8u cur_qp,
 const int *q_matrix);

#ifdef __cplusplus
}
#endif

#endif

⌨️ 快捷键说明

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