📄 encregdrv2.c
字号:
EWL_WriteReg(0x10, val);
}
/*******************************************************************************
Function name : GetEncMbsInCol
Description : Get the picture height in macroblocks
Return type : u32
*******************************************************************************/
u32 GetEncMbsInCol()
{
u32 val;
val = EWL_ReadReg(0x10);
val = (mask_5b & (val >> 10));
return val;
}
/*******************************************************************************
Function name : SetEncMbsInRow
Description : Set the picture width in macroblocks
Return type : void
Argument : u32 mbs
*******************************************************************************/
void SetEncMbsInRow(u32 mbs)
{
u32 val;
ASSERT(mbs >= 6 && mbs <= 40);
val = EWL_ReadReg(0x10);
val = (val & ~(mask_6b << 15)) | (mbs << 15);
EWL_WriteReg(0x10, val);
}
/*******************************************************************************
Function name : GetEncMbsInRow
Description : Get the picture width in macroblock
Return type : u32
*******************************************************************************/
u32 GetEncMbsInRow()
{
u32 val;
val = EWL_ReadReg(0x10);
val = (val >> 15) & mask_6b;
return val;
}
/*******************************************************************************
Function name : GetEncVpNr
Description : Get the number of VPs created
Return type : u32
*******************************************************************************/
u32 GetEncVpNr()
{
u32 val;
val = EWL_ReadReg(0x10);
val = (val >> 22);
return val;
}
/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x14) ************************/
/******************************************************************************/
/*******************************************************************************
Function name : SetEncVpSizeBase
Description : Set the base address of a buffer where the VPs' sizes are
written
Return type : void
Argument : u32 bus_address
*******************************************************************************/
void SetEncVpSizeBase(u32 bus_address)
{
ASSERT((bus_address & 0x03) == 0); /* word aligned address */
EWL_WriteReg(0x14, bus_address);
}
/*******************************************************************************
Function name : GetEncVpSizeBase
Description : Get the base address of the buffer where the VPs' sizes are
written
Return type : u32
*******************************************************************************/
u32 GetEncVpSizeBase()
{
u32 val;
val = EWL_ReadReg(0x14);
return val;
}
/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x18) ************************/
/******************************************************************************/
/*******************************************************************************
Function name : SetEncNewLumaBase
Description : Set the base address for the luminance component of the
image to be encoded
Return type : void
Argument : u32 bus_address
*******************************************************************************/
void SetEncNewLumaBase(u32 bus_address)
{
/* Bits 1:0 are used for camera stabilization of luminance */
EWL_WriteReg(0x18, bus_address);
}
/*******************************************************************************
Function name : GetEncNewLumaBase
Description : Get the base address of the new input image's luminance data
Return type : u32
*******************************************************************************/
u32 GetEncNewLumaBase()
{
u32 val;
val = EWL_ReadReg(0x18);
return val;
}
/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x1C) ************************/
/******************************************************************************/
void SetEncNewChromaUBase(u32 bus_address)
{
/* Bits 1:0 are used for camera stabilization of chrominance */
EWL_WriteReg(0x1C, bus_address);
}
u32 GetEncNewChromaUBase()
{
u32 val;
val = EWL_ReadReg(0x1C);
return val;
}
/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x20) ************************/
/******************************************************************************/
void SetEncNewChromaVBase(u32 bus_address)
{
ASSERT((bus_address & 0x03) == 0); /* word aligned address */
EWL_WriteReg(0x20, bus_address);
}
u32 GetEncNewChromaVBase()
{
u32 val;
val = EWL_ReadReg(0x20);
return val;
}
/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x24) ************************/
/******************************************************************************/
/*******************************************************************************
Function name : SetEncVopTimeIncr
Description : Set the vop time increment value
Return type : void
Argument : u32 vop_time_incr
VopTimeIncrBits specifies the amount of bits starting from
MSB that are written to the stream.
So if VopTimeIncrBits == 5
and vop_time_incr == '0001 0000 0000 0000'
bits '00010' are written to the stream
*******************************************************************************/
void SetEncVopTimeIncr(u32 vop_time_incr)
{
u32 val;
ASSERT(vop_time_incr < ((1 << 16) - 1));
val = EWL_ReadReg(0x24);
val = (val & ~(mask_16b << 16)) | (vop_time_incr << 16);
EWL_WriteReg(0x24, val);
}
/*******************************************************************************
Function name : GetEncMbsInRow
Description : Set the vop time increment value
Return type : u32
*******************************************************************************/
u32 GetEncVopTimeIncr()
{
u32 val;
val = EWL_ReadReg(0x24);
val = (val >> 16);
return val;
}
/*******************************************************************************
Function name : SetEncVopTimeIncrBits
Description : Set how many bits are used for the vop time increment value
Return type : void
Argument : u32 bits [0 - 15]
0 16 valid bits
1 1 valid bit
2 2 valid bits
. .
15 15 valid bits
*******************************************************************************/
void SetEncVopTimeIncrBits(u32 bits)
{
u32 val;
ASSERT(bits < 16);
val = EWL_ReadReg(0x24);
val = (val & ~(mask_4b << 12)) | (bits << 12);
EWL_WriteReg(0x24, val);
}
/*******************************************************************************
Function name : GetEncMbsInRow
Description : Get how many bits are used for the vop time increment value
Return type : u32
*******************************************************************************/
u32 GetEncVopTimeIncrBits()
{
u32 val;
val = EWL_ReadReg(0x24);
val = (val >> 12) & mask_4b;
return val;
}
/*******************************************************************************
Function name : SetEncVopHdrLenght
Description : Set how many bits are used for the vop header
Return type : void
Argument : u32 bits
*******************************************************************************/
void SetEncVopHdrLenght(u32 bits)
{
u32 val;
ASSERT(bits < 256);
val = EWL_ReadReg(0x24);
val = (val & ~(mask_8b << 4)) | (bits << 4);
EWL_WriteReg(0x24, val);
}
/*******************************************************************************
Function name : GetEncVopHdrLenght
Description : Get how many bits are used for the vop header
Return type : u32
*******************************************************************************/
u32 GetEncVopHdrLenght()
{
u32 val;
val = EWL_ReadReg(0x24);
val = (val >> 4) & mask_8b;
return val;
}
/*******************************************************************************
Function name : SetEncHecEnable
Description : Enable/disable HEC
Return type : void
Argument : u32 enable
*******************************************************************************/
void SetEncHecEnable(u32 enable)
{
u32 val;
ASSERT(enable <= 1);
val = EWL_ReadReg(0x24);
val = (val & ~(mask_1b << 3)) | (enable << 3);
EWL_WriteReg(0x24, val);
}
/*******************************************************************************
Function name : GetEncHecEnable
Description : Get HEC status
Return type : u32
*******************************************************************************/
u32 GetEncHecEnable()
{
u32 val;
val = EWL_ReadReg(0x24);
val = (val >> 3) & mask_1b;
return val;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -