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

📄 encoder.h

📁 基于Linux的ffmepg decoder
💻 H
字号:

#ifndef _ENCODER_H_
#define _ENCODER_H_

#include <linux/config.h>
#include <linux/module.h>
#include <linux/version.h>

#include <linux/init.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/delay.h>
#include <linux/poll.h>
#include <linux/string.h>
#include <linux/ioport.h>       /* request_region */
#include <linux/interrupt.h>    /* mark_bh */
#include <linux/miscdevice.h>
#include <linux/slab.h>
#include <linux/ctype.h>
#include <linux/pci.h>
#include <asm/io.h>
#include <asm/arch/cpe/cpe.h>

#include "xvid.h"
#include "portab.h"
#include "ftmcp100.h"
#include "global.h"
#include "enc_image.h"
#include "ratecontrol.h"
#include "Mp4Venc.h"

//#define _DEBUG_PSNR
/*****************************************************************************
 * Constants
 ****************************************************************************/

/* Quatization type */
#define H263_QUANT	0
#define MPEG4_QUANT	1

/* Indicates no quantizer changes in INTRA_Q/INTER_Q modes */
#define NO_CHANGE 64

/*****************************************************************************
 * Types
 ****************************************************************************/

typedef int bool;

typedef enum
{
	I_VOP = 0,
	P_VOP = 1,
	B_VOP = 2
}
VOP_TYPE;

/*****************************************************************************
 * Structures
 ****************************************************************************/

typedef struct
{
	uint32_t h263;
	
	// FOR_API_VERSION	
	uint32_t enable_4mv;
	uint32_t resyn;

	//uint32_t quant;
	//uint32_t init_quant;
	//uint32_t h263_quant;
	
	uint32_t temporal_ref;
	uint32_t width;
	uint32_t height;

	uint32_t mb_width;
	uint32_t mb_height;

	/* frame rate increment & base */
	uint32_t fincr;
	uint32_t fbase;

	/* rounding type; alternate 0-1 after each interframe */
	/* 1 <= fixed_code <= 4
	   automatically adjusted using motion vector statistics inside
	 */

	/* vars that not "quite" frame independant */
	uint32_t m_quant_type;
	uint32_t m_rounding_type;
	uint32_t m_fcode;

	uint32_t m_seconds;
	uint32_t m_ticks;

}
MBParam;


typedef struct
{
	uint32_t quant;
	uint32_t motion_flags;
	uint32_t global_flags;

	VOP_TYPE coding_type;
	uint32_t rounding_type;
	uint32_t fcode;
	uint32_t bcode;

	uint32_t seconds;
	uint32_t ticks;

	IMAGE image;
	IMAGE reconstruct;

	MACROBLOCK *mbs;

}
FRAMEINFO;

typedef struct
{
	MBParam mbParam;

	int iFrameNum;
	int iMaxKeyInterval;
	int bitrate;
	
	// FOR_API_VERSION
	FMP4_ENC_PARAM mEncParam; // for MPEG4 encoder's API purpose
    FTMCP100_CODEC *pCodec;
	
	unsigned int iBitstreamSize; // the encoded bitstream size for last encoded frame

#if 0//ivan
	FRAMEINFO *current;
#else
    FRAMEINFO *current1; //conflict with kernl key word
#endif
	FRAMEINFO *reference;
	RateControl rate_control;
}
Encoder;

/*****************************************************************************
 * Inline functions
 ****************************************************************************/

/*****************************************************************************
 * Prototypes
 ****************************************************************************/

void init_encoder(uint32_t cpu_flags);

void *encoder_create(FMP4_ENC_PARAM * ptParam,FTMCP100_CODEC *pCodec);
int encoder_destroy(Encoder * pEnc);
int encoder_encode(Encoder * pEnc,
				   Faraday_ENC_FRAME * pFrame);



#define SWAP(A,B)    { void * tmp = A; A = B; B = tmp; }

// added for dumping various kind of result from FPGA target
// just serve as debug purpose
#ifdef DUMP_RECONSTRUCTED_RESULT
  extern FILE *reconstructed_result_file;
#endif
#ifdef DUMP_ME_RESULT
  extern FILE *me_result_file;
#endif
#ifdef DUMP_PMV_RESULT
  extern FILE *pmv_result_file;
#endif

#endif

⌨️ 快捷键说明

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