diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2009-10-06 15:20:57 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2009-10-06 15:20:57 +0200 |
commit | f48407d946a902d4169b2ed7ed29be6e66b1e8fa (patch) | |
tree | 8606c4088aa5653eda5999a660e5c4f47deda599 | |
parent | 4f80da5f81b712cfc3144ea0af7309591584fd75 (diff) | |
download | libfsl-vpu-f48407d946a902d4169b2ed7ed29be6e66b1e8fa.tar.gz libfsl-vpu-f48407d946a902d4169b2ed7ed29be6e66b1e8fa.tar.xz |
Lindent
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | src/vpu_util.c | 110 |
1 files changed, 63 insertions, 47 deletions
diff --git a/src/vpu_util.c b/src/vpu_util.c index 49d00e8..de6d77f 100644 --- a/src/vpu_util.c +++ b/src/vpu_util.c @@ -35,7 +35,8 @@ extern unsigned long *virt_paraBuf2; * and returns RETCODE_SUCCESS on success. * Failure results in 0(null pointer) in *ppInst and RETCODE_FAILURE. */ -RetCode GetCodecInstance(CodecInst ** ppInst) +RetCode +GetCodecInstance(CodecInst ** ppInst) { int i; CodecInst *pCodecInst; @@ -52,14 +53,15 @@ RetCode GetCodecInstance(CodecInst ** ppInst) } i = pCodecInst->instIndex; - memset(pCodecInst, 0, sizeof(CodecInst)); + memset(pCodecInst, 0, sizeof (CodecInst)); pCodecInst->instIndex = i; pCodecInst->inUse = 1; *ppInst = pCodecInst; return RETCODE_SUCCESS; } -RetCode CheckInstanceValidity(CodecInst * pci) +RetCode +CheckInstanceValidity(CodecInst * pci) { CodecInst *pCodecInst; int i; @@ -72,7 +74,8 @@ RetCode CheckInstanceValidity(CodecInst * pci) return RETCODE_INVALID_HANDLE; } -RetCode CheckEncInstanceValidity(EncHandle handle) +RetCode +CheckEncInstanceValidity(EncHandle handle) { CodecInst *pCodecInst; RetCode ret; @@ -96,7 +99,8 @@ RetCode CheckEncInstanceValidity(EncHandle handle) return RETCODE_SUCCESS; } -RetCode CheckDecInstanceValidity(DecHandle handle) +RetCode +CheckDecInstanceValidity(DecHandle handle) { CodecInst *pCodecInst; RetCode ret; @@ -112,24 +116,27 @@ RetCode CheckDecInstanceValidity(DecHandle handle) if (pCodecInst->codecMode != MP4_DEC && pCodecInst->codecMode != AVC_DEC) - return RETCODE_INVALID_HANDLE; + return RETCODE_INVALID_HANDLE; return RETCODE_SUCCESS; } -void FreeCodecInstance(CodecInst * pCodecInst) +void +FreeCodecInstance(CodecInst * pCodecInst) { pCodecInst->inUse = 0; } -void BitIssueCommand(int instIdx, int cdcMode, int cmd) +void +BitIssueCommand(int instIdx, int cdcMode, int cmd) { VpuWriteReg(BIT_RUN_INDEX, instIdx); VpuWriteReg(BIT_RUN_COD_STD, cdcMode); VpuWriteReg(BIT_RUN_COMMAND, cmd); } -RetCode CheckEncOpenParam(EncOpenParam * pop) +RetCode +CheckEncOpenParam(EncOpenParam * pop) { int picWidth; int picHeight; @@ -177,7 +184,7 @@ RetCode CheckEncOpenParam(EncOpenParam * pop) } if (pop->slicemode.sliceMode == 1) { if (pop->slicemode.sliceSizeMode != 0 && - pop->slicemode.sliceSizeMode != 1) { + pop->slicemode.sliceSizeMode != 1) { return RETCODE_INVALID_PARAM; } if (pop->slicemode.sliceSize == 0) { @@ -266,8 +273,7 @@ RetCode CheckEncOpenParam(EncOpenParam * pop) return RETCODE_INVALID_PARAM; } if (param->avc_fmoEnable == 1) { - if (param->avc_fmoType != 0 && - param->avc_fmoType != 1) { + if (param->avc_fmoType != 0 && param->avc_fmoType != 1) { return RETCODE_INVALID_PARAM; } if (param->avc_fmoSliceNum < 2 || @@ -287,7 +293,8 @@ RetCode CheckEncOpenParam(EncOpenParam * pop) return RETCODE_SUCCESS; } -RetCode CheckEncParam(CodecInst * pCodecInst, EncParam * param) +RetCode +CheckEncParam(CodecInst * pCodecInst, EncParam * param) { if (param == 0) { return RETCODE_INVALID_PARAM; @@ -319,7 +326,8 @@ RetCode CheckEncParam(CodecInst * pCodecInst, EncParam * param) return RETCODE_SUCCESS; } -void EncodeHeader(EncHandle handle, EncHeaderParam * encHeaderParam) +void +EncodeHeader(EncHandle handle, EncHeaderParam * encHeaderParam) { CodecInst *pCodecInst; EncInfo *pEncInfo; @@ -333,13 +341,12 @@ void EncodeHeader(EncHandle handle, EncHeaderParam * encHeaderParam) VpuWriteReg(CMD_ENC_HEADER_BB_START, encHeaderParam->buf); VpuWriteReg(CMD_ENC_HEADER_BB_SIZE, encHeaderParam->size); } - // 0: SPS, 1: PPS VpuWriteReg(CMD_ENC_HEADER_CODE, encHeaderParam->headerType); BitIssueCommand(pCodecInst->instIndex, pCodecInst->codecMode, ENCODE_HEADER); - while (VpuReadReg(BIT_BUSY_FLAG)); + while (VpuReadReg(BIT_BUSY_FLAG)) ; if (pEncInfo->dynamicAllocEnable == 1) { rdPtr = VpuReadReg(CMD_ENC_HEADER_BB_START); @@ -353,7 +360,8 @@ void EncodeHeader(EncHandle handle, EncHeaderParam * encHeaderParam) encHeaderParam->size = wrPtr - rdPtr; } -RetCode CheckDecOpenParam(DecOpenParam * pop) +RetCode +CheckDecOpenParam(DecOpenParam * pop) { if (pop == 0) { return RETCODE_INVALID_PARAM; @@ -368,9 +376,8 @@ RetCode CheckDecOpenParam(DecOpenParam * pop) } if (pop->bitstreamFormat != STD_MPEG4 && - pop->bitstreamFormat != STD_H263 && - pop->bitstreamFormat != STD_AVC) - return RETCODE_INVALID_PARAM; + pop->bitstreamFormat != STD_H263 && pop->bitstreamFormat != STD_AVC) + return RETCODE_INVALID_PARAM; if (pop->bitstreamFormat == STD_MPEG4 || pop->bitstreamFormat == STD_H263) { @@ -382,13 +389,15 @@ RetCode CheckDecOpenParam(DecOpenParam * pop) return RETCODE_SUCCESS; } -int DecBitstreamBufEmpty(DecInfo * pDecInfo) +int +DecBitstreamBufEmpty(DecInfo * pDecInfo) { return VpuReadReg(pDecInfo->streamRdPtrRegAddr) == VpuReadReg(pDecInfo->streamWrPtrRegAddr); } -void GetParaSet(EncHandle handle, int paraSetType, EncParamSet * para) +void +GetParaSet(EncHandle handle, int paraSetType, EncParamSet * para) { CodecInst *pCodecInst; EncInfo *pEncInfo; @@ -406,7 +415,8 @@ void GetParaSet(EncHandle handle, int paraSetType, EncParamSet * para) para->size = VpuReadReg(RET_ENC_PARA_SET_SIZE); } -void SetParaSet(DecHandle handle, int paraSetType, DecParamSet * para) +void +SetParaSet(DecHandle handle, int paraSetType, DecParamSet * para) { CodecInst *pCodecInst; DecInfo *pDecInfo; @@ -433,9 +443,10 @@ void SetParaSet(DecHandle handle, int paraSetType, DecParamSet * para) } // Following are not for MX32 and MX27 TO1 -RetCode SetGopNumber(EncHandle handle, Uint32 *pGopNumber) +RetCode +SetGopNumber(EncHandle handle, Uint32 * pGopNumber) { - CodecInst * pCodecInst; + CodecInst *pCodecInst; int data = 0; Uint32 gopNumber = *pGopNumber; @@ -446,14 +457,15 @@ RetCode SetGopNumber(EncHandle handle, Uint32 *pGopNumber) BitIssueCommand(pCodecInst->instIndex, pCodecInst->codecMode, RC_CHANGE_PARAMETER); - while (VpuReadReg(BIT_BUSY_FLAG)); + while (VpuReadReg(BIT_BUSY_FLAG)) ; return RETCODE_SUCCESS; } -RetCode SetIntraQp(EncHandle handle, Uint32 *pIntraQp) +RetCode +SetIntraQp(EncHandle handle, Uint32 * pIntraQp) { - CodecInst * pCodecInst; + CodecInst *pCodecInst; int data = 0; Uint32 intraQp = *pIntraQp; @@ -464,13 +476,14 @@ RetCode SetIntraQp(EncHandle handle, Uint32 *pIntraQp) BitIssueCommand(pCodecInst->instIndex, pCodecInst->codecMode, RC_CHANGE_PARAMETER); - while (VpuReadReg(BIT_BUSY_FLAG)); + while (VpuReadReg(BIT_BUSY_FLAG)) ; return RETCODE_SUCCESS; } -RetCode SetBitrate(EncHandle handle, Uint32 *pBitrate) +RetCode +SetBitrate(EncHandle handle, Uint32 * pBitrate) { - CodecInst * pCodecInst; + CodecInst *pCodecInst; int data = 0; Uint32 bitrate = *pBitrate; @@ -481,13 +494,14 @@ RetCode SetBitrate(EncHandle handle, Uint32 *pBitrate) BitIssueCommand(pCodecInst->instIndex, pCodecInst->codecMode, RC_CHANGE_PARAMETER); - while (VpuReadReg(BIT_BUSY_FLAG)); + while (VpuReadReg(BIT_BUSY_FLAG)) ; return RETCODE_SUCCESS; } -RetCode SetFramerate(EncHandle handle, Uint32 *pFramerate) +RetCode +SetFramerate(EncHandle handle, Uint32 * pFramerate) { - CodecInst * pCodecInst; + CodecInst *pCodecInst; int data = 0; Uint32 framerate = *pFramerate; @@ -498,14 +512,15 @@ RetCode SetFramerate(EncHandle handle, Uint32 *pFramerate) BitIssueCommand(pCodecInst->instIndex, pCodecInst->codecMode, RC_CHANGE_PARAMETER); - while (VpuReadReg(BIT_BUSY_FLAG)); + while (VpuReadReg(BIT_BUSY_FLAG)) ; return RETCODE_SUCCESS; } -RetCode SetIntraRefreshNum(EncHandle handle, Uint32 *pIntraRefreshNum) +RetCode +SetIntraRefreshNum(EncHandle handle, Uint32 * pIntraRefreshNum) { - CodecInst * pCodecInst; + CodecInst *pCodecInst; Uint32 intraRefreshNum = *pIntraRefreshNum; int data = 0; pCodecInst = handle; @@ -515,19 +530,20 @@ RetCode SetIntraRefreshNum(EncHandle handle, Uint32 *pIntraRefreshNum) BitIssueCommand(pCodecInst->instIndex, pCodecInst->codecMode, RC_CHANGE_PARAMETER); - while (VpuReadReg(BIT_BUSY_FLAG)); + while (VpuReadReg(BIT_BUSY_FLAG)) ; return RETCODE_SUCCESS; } -RetCode SetSliceMode(EncHandle handle, EncSliceMode *pSliceMode) +RetCode +SetSliceMode(EncHandle handle, EncSliceMode * pSliceMode) { - CodecInst * pCodecInst; + CodecInst *pCodecInst; Uint32 data = 0; int data2 = 0; - data = pSliceMode->sliceSize<<2 | pSliceMode->sliceSizeMode<<1 | - pSliceMode->sliceMode; + data = pSliceMode->sliceSize << 2 | pSliceMode->sliceSizeMode << 1 | + pSliceMode->sliceMode; pCodecInst = handle; data2 = 1 << 5; @@ -536,14 +552,15 @@ RetCode SetSliceMode(EncHandle handle, EncSliceMode *pSliceMode) BitIssueCommand(pCodecInst->instIndex, pCodecInst->codecMode, RC_CHANGE_PARAMETER); - while (VpuReadReg(BIT_BUSY_FLAG)); + while (VpuReadReg(BIT_BUSY_FLAG)) ; return RETCODE_SUCCESS; } -RetCode SetHecMode(EncHandle handle, int mode) +RetCode +SetHecMode(EncHandle handle, int mode) { - CodecInst * pCodecInst; + CodecInst *pCodecInst; Uint32 HecMode = mode; int data = 0; pCodecInst = handle; @@ -554,8 +571,7 @@ RetCode SetHecMode(EncHandle handle, int mode) BitIssueCommand(pCodecInst->instIndex, pCodecInst->codecMode, RC_CHANGE_PARAMETER); - while (VpuReadReg(BIT_BUSY_FLAG)); + while (VpuReadReg(BIT_BUSY_FLAG)) ; return RETCODE_SUCCESS; } - |