Exemplo n.º 1
0
void DepthImageBase::setDepthData(const char *srcData, int dstSize)
{
	if(dstSize > mSampleCodeSize) reSizeSampleCode(dstSize);

	/******直接传输,移除QuickLZ*******/

// 	qlz_state_decompress *state_decompress = (qlz_state_decompress*)malloc(sizeof(qlz_state_decompress));
// 
// 	int r = qlz_decompress(srcData, mSampleCode, state_decompress);
// 
// 	free(state_decompress);
// 
// 	if(r != dstSize) 
// 	{
// 		LOGI("the decompressed size of depth does not match");
// 		return;
// 	}

	memcpy(mSampleCode, srcData, dstSize);
	int readW = getLocalInt(mSampleCode + 4);
	int readH = getLocalInt(mSampleCode + 8);

	Resolution tmpRes = GlobalInfo::getInstance().getDepthRes();
	if(readW != tmpRes.w || readH != tmpRes.h)
	{
		LOGI("the size of depth image does not match!");
		return;
	}
	
	int blockY = (readH - 1) / BSIZE;

	int headPos = 12;

	int dataPos = getLocalInt(mSampleCode);

	bool half = false;
	bool nowBlock = false;
	int nowX = 0, nowY = 0;

	int dataCnt = ((dataPos - headPos) / 3) * 2;
	if((dataPos - headPos) % 3 != 0) dataCnt += 1;

	if(dataCnt * 3 > mSampleSize) reSizeSample(dataCnt * 3);
	mSampleCnt = dataCnt;

	for(int i = 0; i < dataCnt; ++i)
	{
		HeadInfo  hInfo = getHeadInfo(mSampleCode + headPos, half);
		if(hInfo.nextBlock != nowBlock)
		{
			if(nowY == blockY)
			{
				nowX += 1;
				nowY = 0;
			}
			else nowY += 1;
			nowBlock = hInfo.nextBlock;
		}
		int tmpW = nowX * BSIZE + hInfo.index / BSIZE;
		int tmpH = nowY * BSIZE + hInfo.index % BSIZE;

		mSample[3*i] = (2*tmpW + 1 - readW) / ((float)(readW));
		mSample[3*i + 1] = (2 * tmpH + 1  - readH) /((float)(readH));
		mSample[3*i + 2] = 1.0f;
		if(!hInfo.isOne)
		{
			mSample[3*i + 2] = toDepthValue(mSampleCode + dataPos);
			dataPos += 2;
			//确定深度重构是否正确
			//LOGI("No_one_value: %f", mSample[3*i + 2]);
		}
		headPos += (half ? 2 : 1);
		half = (!half);
	}
	mDflag = true;
}
Exemplo n.º 2
0
Arquivo: control.c Projeto: ahua/java
/*
 * Execute the RET instruction
 */
void op_ret() {
    pc = getLocalInt(u8(1));
}