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

📄 encregdrv1.c

📁 freescale i.mx31 BSP CE5.0全部源码
💻 C
📖 第 1 页 / 共 2 页
字号:

/*******************************************************************************
 Function name   : SetEncGobRows
 Description     : Set the amount of rows in a GOB
 Return type     : void 
 Argument        : u32 rows
                   0    GOB is 1 row (frame height <= 25 macroblocks)
                   1    GOB is 2 rows (frame height > 25 macroblocks)
*******************************************************************************/
void SetEncGobRows(u32 rows)
{
    u32 val;

    ASSERT(rows <= 1);

    val = EWL_ReadReg(0x00);
    val = (val & ~(mask_1b << 10)) | (rows << 10);
    EWL_WriteReg(0x00, val);
}

/*******************************************************************************
 Function name   : GetEncGobRows
 Description     : Get the current status of rows in a GOB
 Return type     : u32 
*******************************************************************************/
u32 GetEncGobRows()
{
    u32 val;

    val = EWL_ReadReg(0x00);
    val = (mask_1b & (val >> 10));
    return val;
}

/*******************************************************************************
 Function name   : SetEncVopType
 Description     : Set the VOP encoding type
 Return type     : void 
 Argument        : u32 type
*******************************************************************************/
void SetEncVopType(u32 type)
{
    u32 val;

    ASSERT(type <= 2);

    val = EWL_ReadReg(0x00);
    val = (val & ~(mask_2b << 1)) | (type << 1);
    EWL_WriteReg(0x00, val);
}

/*******************************************************************************
 Function name   : GetEncVopType
 Description     : Get the current VOP type
 Return type     : u32 
*******************************************************************************/
u32 GetEncVopType()
{
    u32 val;

    val = EWL_ReadReg(0x00);
    val = (mask_2b & (val >> 1));
    return val;
}

/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x04) ************************/
/******************************************************************************/

/*******************************************************************************
 Function name   : SetEncPreProEnable
 Description     : Enable/disable preprocessing block
 Return type     : void 
 Argument        : u32 enable
*******************************************************************************/
void SetEncPreProEnable(u32 enable)
{
    u32 val;

    ASSERT(enable <= 1);

    val = EWL_ReadReg(0x04);
    val = (val & ~(mask_1b << 31)) | (enable << 31);
    EWL_WriteReg(0x04, val);
}

/*******************************************************************************
 Function name   : GetEncPreProEnable
 Description     : Get the current preprocessing block status
 Return type     : u32 
*******************************************************************************/
u32 GetEncPreProEnable()
{
    u32 val;

    val = EWL_ReadReg(0x04);
    val = (val >> 31);
    return val;
}

/*******************************************************************************
 Function name   : SetEncOrigRowWidth
 Description     : Set the row width of the original input image (pixelWidth/8)
 Return type     : void 
 Argument        : u32 width
*******************************************************************************/
void SetEncOrigRowWidth(u32 width)
{
    u32 val;

    ASSERT(width >= 12 && width <= 127);

    val = EWL_ReadReg(0x04);
    val = (val & ~(mask_7b << 21)) | (width << 21);
    EWL_WriteReg(0x04, val);
}

/*******************************************************************************
 Function name   : GetEncOrigRowWidth
 Description     : Get the row width of the original input image
 Return type     : u32 
*******************************************************************************/
u32 GetEncOrigRowWidth()
{
    u32 val;

    val = EWL_ReadReg(0x04);
    val = (mask_7b & (val >> 21));
    return val;
}

/*******************************************************************************
 Function name : SetEncXFill
 Description   : Set how many pixel columns shall be filled with constant
                 values at the right end of picture
 Return type   : void 
 Argument      : u32 xfill
                 0  Fill 0 pixels
                 1  Fill 4 pixels
                 2  Fill 8 pixels
                 3  Fill 12 pixels
*******************************************************************************/
void SetEncXFill(u32 xfill)
{
    u32 val;

    ASSERT(xfill <= 3);
    val = EWL_ReadReg(0x04);
    val = (val & ~(mask_2b << 19)) | (xfill << 19);
    EWL_WriteReg(0x04, val);
}

/*******************************************************************************
 Function name : GetEncXFill
 Description   : 
 Return type   : u32 
 Argument      : void
*******************************************************************************/
u32 GetEncXFill()
{
    u32 val;

    val = EWL_ReadReg(0x04);
    val = (mask_2b & (val >> 19));
    return val;
}

/*******************************************************************************
 Function name : SetEncYFill
 Description   : Set how many pixel lines shall be filled with constant
                 values at the bottom of the picture
 Return type   : void 
 Argument      : u32 yfill
*******************************************************************************/
void SetEncYFill(u32 yfill)
{
    u32 val;

    ASSERT(yfill <= 15);
    val = EWL_ReadReg(0x04);
    val = (val & ~(mask_4b << 15)) | (yfill << 15);
    EWL_WriteReg(0x04, val);
}

/*******************************************************************************
 Function name : GetEncYFill
 Description   : 
 Return type   : u32 
 Argument      : void
*******************************************************************************/
u32 GetEncYFill()
{
    u32 val;

    val = EWL_ReadReg(0x04);
    val = (mask_4b & (val >> 15));
    return val;
}

/*******************************************************************************
 Function name   : SetEncMvSadPenalty
 Description     : Set the penalty value for non zero MV
 Return type     : void 
 Argument        : u32 penalty
*******************************************************************************/
void SetEncMvSadPenalty(u32 penalty)
{
    u32 val;

    ASSERT(penalty <= 31);

    val = EWL_ReadReg(0x04);
    val = (val & ~(mask_5b << 10)) | (penalty << 10);
    EWL_WriteReg(0x04, val);
}

/*******************************************************************************
 Function name   : GetEncMvSadPenalty
 Description     : Get the penalty value for non zero MV
 Return type     : u32 
*******************************************************************************/
u32 GetEncMvSadPenalty()
{
    u32 val;

    val = EWL_ReadReg(0x04);
    val = (mask_5b & (val >> 10));
    return val;
}

/*******************************************************************************
 Function name   : SetEncIntraSadPenalty
 Description     : Set the penalty value for INTRA macroblocks
 Return type     : void 
 Argument        : u32 penalty
*******************************************************************************/
void SetEncIntraSadPenalty(u32 penalty)
{
    u32 val;

    ASSERT(penalty <= 31);

    val = EWL_ReadReg(0x04);
    val = (val & ~(mask_5b << 5)) | (penalty << 5);
    EWL_WriteReg(0x04, val);
}

/*******************************************************************************
 Function name   : GetEncIntraSadPenalty
 Description     : Get the penalty value for INTRA macroblocks
 Return type     : u32 
*******************************************************************************/
u32 GetEncIntraSadPenalty()
{
    u32 val;

    val = EWL_ReadReg(0x04);
    val = (mask_5b & (val >> 5));
    return val;
}

/*******************************************************************************
 Function name   : SetEnc4MvSadPenalty
 Description     : Set the penalty value for INTER 4MV macroblocks
 Return type     : void 
 Argument        : u32 penalty
*******************************************************************************/
void SetEnc4MvSadPenalty(u32 penalty)
{
    u32 val;

    ASSERT(penalty <= 31);

    val = EWL_ReadReg(0x04);
    val = (val & ~mask_5b) | penalty;
    EWL_WriteReg(0x04, val);
}

/*******************************************************************************
 Function name   : GetEnc4MvSadPenalty
 Description     : Get the penalty value for INTER 4MV macroblocks
 Return type     : u32 
*******************************************************************************/
u32 GetEnc4MvSadPenalty()
{
    u32 val;

    val = EWL_ReadReg(0x04);
    val = val & mask_5b;
    return val;
}

/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x08) ************************/
/******************************************************************************/

/*******************************************************************************
 Function name   : SetEncCamStabEnable
 Description     : Enable the camera stabilization
 Return type     : void 
 Argument        : u32 enable
*******************************************************************************/
void SetEncCamStabEnable(u32 enable)
{
    u32 val;

    ASSERT(enable <= 1);

    val = EWL_ReadReg(0x08);
    val = (val & ~(mask_1b << 31)) | (enable << 31);
    EWL_WriteReg(0x08, val);
}

/*******************************************************************************
 Function name   : GetEncCamStabEnable
 Description     : Get the camera stabilization status
 Return type     : u32 
*******************************************************************************/
u32 GetEncCamStabEnable()
{
    u32 val;

    val = EWL_ReadReg(0x08);
    val = (val >> 31);
    return val;
}

/*******************************************************************************
 Function name   : SetEncVpEnable
 Description     : Enable/Disable VP generation
 Return type     : void 
 Argument        : u32 enable
*******************************************************************************/
void SetEncVpEnable(u32 enable)
{
    u32 val;

    ASSERT(enable <= 1);

    val = EWL_ReadReg(0x08);
    val = (val & ~(mask_1b << 28)) | (enable << 28);
    EWL_WriteReg(0x08, val);
}

/*******************************************************************************
 Function name   : GetEncVpEnable
 Description     : Get VP status
 Return type     : u32 
*******************************************************************************/
u32 GetEncVpEnable()
{
    u32 val;

    val = EWL_ReadReg(0x08);
    val = (mask_1b & (val >> 28));
    return val;
}

/*******************************************************************************
 Function name   : SetEncSizeOfVP
 Description     : Set the size of a VP
 Return type     : void 
 Argument        : u32 size
*******************************************************************************/
void SetEncSizeOfVP(u32 size)
{
    u32 val;

    ASSERT(size <= 65535);

    val = EWL_ReadReg(0x08);
    val = (val & ~(mask_16b << 12)) | (size << 12);
    EWL_WriteReg(0x08, val);
}

/*******************************************************************************
 Function name   : GetEncSizeOfVP
 Description     : Get the size of a VP
 Return type     : u32 
*******************************************************************************/
u32 GetEncSizeOfVP()
{
    u32 val;

    val = EWL_ReadReg(0x08);
    val = (mask_16b & (val >> 12));
    return val;
}

/*******************************************************************************
 Function name   : GetEncCamStabGmvX
 Description     : Get the general MV's horizontal component
 Return type     : u32 
*******************************************************************************/
u32 GetEncCamStabGmvX()
{
    u32 val;

    val = EWL_ReadReg(0x08);
    val = (mask_5b & (val >> 6));
    return val;
}

/*******************************************************************************
 Function name   : GetEncCamStabGmvY
 Description     : Get the general MV's vertical component
 Return type     : u32 
*******************************************************************************/
u32 GetEncCamStabGmvY()
{
    u32 val;

    val = EWL_ReadReg(0x08);
    val = (val & mask_5b);
    return val;
}

⌨️ 快捷键说明

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