?? mp4venc.h
字號:
/**
* @file Mp4Venc.h
* @brief The header file for Faraday MPEG4 encoder API.
*
*/
#ifndef _MP4VENC_H_
#define _MP4VENC_H_
/**
* By using typedef to create a type name for DMA memory allocation function.
* And user can allocate memory on a specified alignment memory
* by using the parameter align_size.
*
* @param size is the bytes to allocate.
* @param align_size is the alignment value which must be power of 2.
* @param reserved_size is the specifed cache line.
* @param phy_ptr is used to return the physical address of allocated aligned memory block.
* @return return a void pointer to virtual address of the allocated memory block.
* @see FMP4_ENC_PARAM
* @see DMA_FREE_PTR
*/
typedef void *(* DMA_MALLOC_PTR)(unsigned int size,unsigned char align_size,unsigned char reserved_size, void ** phy_ptr);
/**
* By using typedef to create a type name for DMA memory free function.
* And user can use this type of function to free a block of memory that
* was allocated by the DMA_MALLOC_PTR type of function.
*
* @param virt_ptr is a pointer to the memory block with virtual address that was returned
* previously by the type of DMA_MALLOC_PTR function.
* @param phy_ptr is a pointer to the memory block with physical address that was returned
* previously by the type of DMA_MALLOC_PTR function.
* @return return void.
* @see FMP4_ENC_PARAM
* @see DMA_MALLOC_PTR
*/
typedef void (* DMA_FREE_PTR)(void * virt_ptr, void * phy_ptr);
/// The Faraday MPEG4 Encoder Parameters Structure.
/**
* While creating encoder object by using FMpeg4EncCreate() operation, FMP4_ENC_PARAM
* pointer is served as FMpeg4EncCreate()'s parameter to internally initialize related encoder
* object settings.\n
* See @ref encoder_ops_grp \n
* @see FMpeg4EncCreate
*
*/
typedef struct {
/// The base address of hardware core.
unsigned int *pu32BaseAddr; /**< User can use this variable to set the base
* address of hardware core.
*/
/// The encoded bitrate in Kbps.
unsigned int u32BitRate; /**< User can use this variable to set encoded bitrate in <B>Kbps</B>.\n
* Note that 'target bitrate = (u32BitRate * 1000 bits)'.\n
* And this option is only valid when rate control mechanism
* is enabled. (that is, when quantization value is equal to 0)
* @see u32Quant
*/
/// The width of encoded frame in pels.
unsigned int u32FrameWidth; /**< User can use this field to specify the <B>width</B> of
* encoded frame in pels.
*/
/// The height of encoded frame in pels.
unsigned int u32FrameHeight; /**< User can use this field to specify the <B>height</B> of
* encoded frame in pels.
*/
/// The base frame rate.
float fFrameRate; /**< To set the encoded frame rate per second.
*/
/// The initial quantization value of I-frame while rate control mechanism is enabled.
unsigned int u32InitialQuant; /**< While rate control mechanism is enabled , user can
* use this field to set the initial quantization value of
* I-frame.
* @see u32Quant
*/
/// The frame interval between I-frames.
unsigned int u32IPInterval; /**< This variable was used to set the interval between I-frames.
*/
/// The short header (H263) mode.
int bShortHeader; /**< A flag of enabling short header (H.263) mode or not.
* - 0: disable short header.
* - 1: enable short header.
*/
/// The 4 motion vectors (4MV) mode.
int bEnable4MV; /**< To select 4MV (4 motion vectors) mode or 1MV (1 motion vector) mode.
* - 0: disable 4MV mode and use 1MV (1 motion vector) mode instead.
* - 1: enable 4MV mode and select 4MV mode.
*/
/// The H.263 quantization method.
int bH263Quant; /**< To select H.263 quantization method or MPEG4 quantization method.
* - 0: select MPEG4 quantization method.
* - 1: select H.263 quantization method.
*/
/// The resync marker option.
int bResyncMarker; /**< A flag of enabling resync marker mechanism or not.
* - 0: disable resync marker.
* - 1: enable resync marker.
*/
/// The maximum quantization value.
unsigned int u32MaxQuant; /**< To set the maximum quantization value range.
*/
/// The minimum quantization value.
unsigned int u32MinQuant; /**< To set the minimum quantization value range.
*/
/// The frame quantization value.
unsigned int u32Quant; /**<
* If the frame quantization value is equal to 0, the rate control
* mechanism is enabled and used.\n
* Otherwise, the encoder use fixed quantization value to encode
* whole frame. \n
* Frame quantizer :
* <ul>
* <li> == 0 (zero) : The rate controler chooses the right quantizer
* for you.
* <li> != 0 : To force encoder to use this specific fixed
* quantizer value. The range for \a u32Quant is
* from 1 to 31.
* </ul>
*/
/// The base address for input Y frame buffer.
unsigned char *pu8YFrameBaseAddr; /**< To set input Y frame buffer's base address.\n
* <B>N.B.</B> : the input frame buffer address must be <B>physical address</B> with <B>8-byte aligned</B>.
* @see pu8UFrameBaseAddr
* @see pu8VFrameBaseAddr
* @see pu8BitstreamAddr
*
* Also, this variable can be set by utilizing the function FMpeg4EncSetYUVAddr().
* @see FMpeg4EncSetYUVAddr
*/
/// The base address for input U frame buffer.
unsigned char *pu8UFrameBaseAddr; /**< To set input U frame buffer's base address.\n
* <B>N.B.</B> : the input frame buffer address must be <B>physical address</B> with <B>8-byte aligned</B>.
* @see pu8YFrameBaseAddr
* @see pu8VFrameBaseAddr
* @see pu8BitstreamAddr
*
* Also, this variable can be set by utilizing the function FMpeg4EncSetYUVAddr().
* @see FMpeg4EncSetYUVAddr
*/
/// The base address for input V frame buffer.
unsigned char *pu8VFrameBaseAddr; /**< To set input V frame buffer's base address.\n
* <B>N.B.</B> : the input frame buffer address must be <B>physical address</B> with <B>8-byte aligned</B>.
* @see pu8YFrameBaseAddr
* @see pu8UFrameBaseAddr
* @see pu8BitstreamAddr
*
* Also, this variable can be set by utilizing the function FMpeg4EncSetYUVAddr().
* @see FMpeg4EncSetYUVAddr
*/
/// The bitstream buffer address while encoding one single frame.
unsigned char *pu8BitstreamAddr; /**< To set output bitstream buffer's address.\n
* This bitstream buffer was provided by user and can be used to store
* the encoded bitstream while encoding one single frame.\n
* <B>N.B.</B> : the output bitstream buffer address must be <B>physical address</B> with <B>16-byte aligned</B>.
* It was recommended that the size of bitstream buffer be the value
* of (@ref u32FrameWidth * @ref u32FrameHeight * 3/2).
* @see pu8YFrameBaseAddr
* @see pu8UFrameBaseAddr
* @see pu8VFrameBaseAddr
*/
/// The address of current reconstruct frame buffer.
unsigned char *pu8ReConFrameCur; /**<
* To specify the current reconstruct frame buffer address.\n
* In some occasions,user may want to provide his own reconstructed
* buffer.\n
* Hence, if this variable is not set to NULL, the user-provided current
* reconstruct frame buffer is used and pointed by this variable.\n
* Otherwise, if this variable is set to NULL, encoder will internally
* use the installed @ref pfnDmaMalloc function to allocate the necessary
* current reconstruct frame buffer.\n\n
*
* <B>value of @ref pu8ReConFrameCur</B>:
* <ul>
* <li> != <B>NULL</B> : Use user-provided buffer as current reconstruct
* frame buffer. The requirement of the buffer size in bytes
* is '( ((frame width + 15)/16) * (2+((frame height + 15)/16)) + 2) x 256 x 1.5'
* <li> == <B>NULL</B> : Use internally current reconstruct frame buffer
* which is allocated by using installed @ref pfnDmaMalloc
* function.
* </ul>
* <B>N.B.</B> : the current reconstruct frame buffer address must be <B>physical address</B> with <B>8-byte aligned</B>.
*
* @see pfnDmaMalloc
* @see pfnDmaFree
*/
/// The address of reference reconstruct frame buffer.
unsigned char *pu8ReConFrameRef; /**<
* To specify the reference reconstruct frame buffer address.\n
* In some occasions,user may want to provide his own reconstructed
* buffer.\n
* Hence, if this variable is not set to NULL, the user-provided reference
* reconstruct frame buffer is used and pointed by this variable.\n
* Otherwise, if this variable is set to NULL, encoder will internally
* use the installed @ref pfnDmaMalloc function to allocate the necessary
* reference reconstruct frame buffer.\n\n
*
* <B>value of @ref pu8ReConFrameRef</B>:
* <ul>
* <li> != <B>NULL</B> : Use user-provided buffer as reference reconstruct
* frame buffer. The requirement of the buffer size in bytes
* is '( ((frame width + 15)/16) * (2+((frame height + 15)/16)) + 2) x 256 x 1.5'
* <li> == <B>NULL</B> : Use internally reference reconstruct frame buffer
* which is allocated by using installed @ref pfnDmaMalloc
* function.
* </ul>
* <B>N.B.</B> : the reference reconstruct frame buffer address must be <B>physical address</B> with <B>8-byte aligned</B>.
*
* @see pfnDmaMalloc
* @see pfnDmaFree
*/
/// The address of internal AC DC predictor buffer.
short *p16ACDC; /**<
* To specify the internal AC DC perdictor buffer address for encoder.\n
* If this variable is not set to NULL, the user-provided buffer
* pointed by this variable is used.\n
* Otherwise, if this variable is set to NULL, encoder will internally
* use the installed @ref pfnDmaMalloc function to allocate the necessary
* AC DC predictor buffer.\n\n
*
* <B>value of @ref p16ACDC</B>:
* <ul>
* <li> != <B>NULL</B> : Use user-provided buffer as AC DC predictor buffer.
* The requirement of the buffer size in bytes
* is '((frame width + 15)/16) * 64'
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -