Example #1
0
void SetParaSet(DecHandle handle, int paraSetType, DecParamSet * para)
{
	CodecInst *pCodecInst;
	DecInfo *pDecInfo;
	int i;
	Uint32 *src;
	int byteSize;
	
	pCodecInst = handle;
	pDecInfo = &pCodecInst->CodecInfo.decInfo;

	src = para->paraSet;
	byteSize = para->size / 4;
	
	for (i = 0; i < byteSize; i += 1) {
		virt_paraBuf[i] = *src++;
	}
	
	VpuWriteReg(CMD_DEC_PARA_SET_TYPE, paraSetType);
	VpuWriteReg(CMD_DEC_PARA_SET_SIZE, para->size);
	BitIssueCommand(pCodecInst->instIndex, pCodecInst->codecMode,
			DEC_PARA_SET);
	
	while (VpuReadReg(BIT_BUSY_FLAG)) ;
}
Example #2
0
void EncodeHeader(EncHandle handle, EncHeaderParam * encHeaderParam)
{
	CodecInst *pCodecInst;
	EncInfo *pEncInfo;
	PhysicalAddress rdPtr;
	PhysicalAddress wrPtr;

	pCodecInst = handle;
	pEncInfo = &pCodecInst->CodecInfo.encInfo;

	if (pEncInfo->dynamicAllocEnable == 1) {
		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));
	
	if (pEncInfo->dynamicAllocEnable == 1) {
		rdPtr = VpuReadReg(CMD_ENC_HEADER_BB_START);
		wrPtr = VpuReadReg(pEncInfo->streamWrPtrRegAddr);
	} else {	
		rdPtr = VpuReadReg(pEncInfo->streamRdPtrRegAddr);
		wrPtr = VpuReadReg(pEncInfo->streamWrPtrRegAddr);
	}

	encHeaderParam->buf = rdPtr;
	encHeaderParam->size = wrPtr - rdPtr;
}
Example #3
0
int set_iram(struct iram_t iram, Uint32 array[][NR_ENTRY], int array_size)
{
	int i, j, offset;
	int use_iram_bits;

	use_iram_bits = array[USE_OVL_INTERNAL_BUF][2] << 3 |
			array[USE_DBK_INTERNAL_BUF][2] << 2 |
			array[USE_IP_INTERNAL_BUF][2] << 1 |
			array[USE_BIT_INTERNAL_BUF][2];
	IOClkGateSet(true);
	VpuWriteReg(BIT_AXI_SRAM_USE, use_iram_bits);
	dprintf(3, "use iram_bits:%08x\n", use_iram_bits);

	for (i = 0; i < array_size; i++) {
		offset = 0;
		for (j = 0; j < i; j++)
			offset += array[j][1];

		/* Set the corresponding IRAM address in VPU register */
		if (array[i][2]) {
			VpuWriteReg(array[i][0], iram.start + offset);
		}
	}
	IOClkGateSet(false);

	return 0;
}
Example #4
0
RetCode SetFramerate(EncHandle handle, Uint32 *pFramerate)
{
	CodecInst * pCodecInst;
	int data = 0;
	Uint32 framerate = *pFramerate;

	pCodecInst = handle;
	data = 1 << 3;
	VpuWriteReg(CMD_ENC_SEQ_PARA_CHANGE_ENABLE, data);
	VpuWriteReg(CMD_ENC_SEQ_PARA_RC_FRAME_RATE, framerate);
	BitIssueCommand(pCodecInst->instIndex, pCodecInst->codecMode, RC_CHANGE_PARAMETER);
	while (VpuReadReg(BIT_BUSY_FLAG));

	return RETCODE_SUCCESS;
}
Example #5
0
RetCode SetHecMode(EncHandle handle, int mode)
{
	CodecInst * pCodecInst;
	Uint32 HecMode = mode;
	int data = 0;
	pCodecInst = handle;

	data = 1 << 6;
	VpuWriteReg(CMD_ENC_SEQ_PARA_CHANGE_ENABLE, data);
	VpuWriteReg(CMD_ENC_SEQ_PARA_HEC_MODE, HecMode);
	BitIssueCommand(pCodecInst->instIndex, pCodecInst->codecMode, RC_CHANGE_PARAMETER);
	
	while (VpuReadReg(BIT_BUSY_FLAG));

	return RETCODE_SUCCESS;
}
Example #6
0
RetCode SetIntraRefreshNum(EncHandle handle, Uint32 *pIntraRefreshNum)
{
	CodecInst * pCodecInst;
	Uint32 intraRefreshNum = *pIntraRefreshNum;
	int data = 0;
	pCodecInst = handle;
	data = 1 << 4;
	VpuWriteReg(CMD_ENC_SEQ_PARA_CHANGE_ENABLE, data);
	VpuWriteReg(CMD_ENC_SEQ_PARA_INTRA_MB_NUM, intraRefreshNum);
	BitIssueCommand(pCodecInst->instIndex, pCodecInst->codecMode, 
			RC_CHANGE_PARAMETER);
	
	while (VpuReadReg(BIT_BUSY_FLAG));

	return RETCODE_SUCCESS;
}
Example #7
0
RetCode SetIntraQp(EncHandle handle, Uint32 *pIntraQp)
{
	CodecInst * pCodecInst;
	int data = 0;
	Uint32 intraQp = *pIntraQp;

	pCodecInst = handle;
	data = 1 << 1;
	VpuWriteReg(CMD_ENC_SEQ_PARA_CHANGE_ENABLE, data);
	VpuWriteReg(CMD_ENC_SEQ_PARA_RC_INTRA_QP, intraQp);
	BitIssueCommand(pCodecInst->instIndex, pCodecInst->codecMode, 
			RC_CHANGE_PARAMETER);
	
	while (VpuReadReg(BIT_BUSY_FLAG));
	return RETCODE_SUCCESS;
}
Example #8
0
// Following are not for MX32 and MX27 TO1
RetCode SetGopNumber(EncHandle handle, Uint32 *pGopNumber)
{
	CodecInst * pCodecInst;
	int data = 0;
	Uint32 gopNumber = *pGopNumber;

	pCodecInst = handle;
	data = 1;
	VpuWriteReg(CMD_ENC_SEQ_PARA_CHANGE_ENABLE, data);
	VpuWriteReg(CMD_ENC_SEQ_PARA_RC_GOP, gopNumber);
	BitIssueCommand(pCodecInst->instIndex, pCodecInst->codecMode, 
			RC_CHANGE_PARAMETER);
	
	while (VpuReadReg(BIT_BUSY_FLAG));
	
	return RETCODE_SUCCESS;
}
Example #9
0
RetCode SetSliceMode(EncHandle handle, EncSliceMode *pSliceMode)
{
	CodecInst * pCodecInst;
	Uint32 data = 0;
	int data2 = 0;
	
	data = pSliceMode->sliceSize<<2 | pSliceMode->sliceSizeMode<<1 | 
		pSliceMode->sliceMode;
	pCodecInst = handle;

	data2 = 1 << 5;
	VpuWriteReg(CMD_ENC_SEQ_PARA_CHANGE_ENABLE, data2);
	VpuWriteReg(CMD_ENC_SEQ_PARA_SLICE_MODE, data);
	BitIssueCommand(pCodecInst->instIndex, pCodecInst->codecMode, 
			RC_CHANGE_PARAMETER);
	
	while (VpuReadReg(BIT_BUSY_FLAG));

	return RETCODE_SUCCESS;
}
Example #10
0
void GetParaSet(EncHandle handle, int paraSetType, EncParamSet * para)
{
	CodecInst *pCodecInst;
	EncInfo *pEncInfo;

	pCodecInst = handle;
	pEncInfo = &pCodecInst->CodecInfo.encInfo;

	/* SPS: 0, PPS: 1, VOS: 1, VO: 2, VOL: 0 */
	VpuWriteReg(CMD_ENC_PARA_SET_TYPE, paraSetType);
	BitIssueCommand(pCodecInst->instIndex, pCodecInst->codecMode,
			ENC_PARA_SET);
	while (VpuReadReg(BIT_BUSY_FLAG)) ;

	para->paraSet = virt_paraBuf;
	para->size = VpuReadReg(RET_ENC_PARA_SET_SIZE);
}
Example #11
0
void BitIssueCommand(int instIdx, int cdcMode, int cmd)
{
	VpuWriteReg(BIT_RUN_INDEX, instIdx);
	VpuWriteReg(BIT_RUN_COD_STD, cdcMode);
	VpuWriteReg(BIT_RUN_COMMAND, cmd);
}