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

📄 putvlc.c

📁 VC++视频开发实例集锦(包括“远程视频监控”"语音识别系统"等13个经典例子)
💻 C
📖 第 1 页 / 共 2 页
字号:
	Int length = 0;
	MOMCHECK (last >= 0 && last < 2);
	MOMCHECK (run >= 0 && run < 64);
	MOMCHECK (level > 0 && level < 128);
	if (last == 0)
	{
		if (run < 2 && level < 13 )
		{
			length = coeff_tab0[run][level-1].len;
			if (length != 0)
			{
												  
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 2L, 2L);
				length += 9;					  
				BitstreamPutBits (bitstream, (LInt)coeff_tab0[run][level-1].code,
					(LInt)coeff_tab0[run][level-1].len);
			}
		}
		else if (run > 1 && run < 27 && level < 5)
		{
			length = coeff_tab1[run-2][level-1].len;
			if (length != 0)
			{
												  
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 2L, 2L);
				length += 9;					  
				BitstreamPutBits (bitstream, (LInt)coeff_tab1[run-2][level-1].code,
					(LInt)coeff_tab1[run-2][level-1].len);
			}
		}
	}
	else if (last == 1)
	{
		if (run < 2 && level < 4)
		{
			length = coeff_tab2[run][level-1].len;
			if (length != 0)
			{
												  
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 2L, 2L);
				length += 9;					  
				BitstreamPutBits (bitstream, (LInt)coeff_tab2[run][level-1].code,
					(LInt)coeff_tab2[run][level-1].len);
			}
		}
		else if (run > 1 && run < 42 && level == 1)
		{
			length = coeff_tab3[run-2].len;
			if (length != 0)
			{
												  
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 2L, 2L);
				length += 9;					  
				BitstreamPutBits (bitstream, (LInt)coeff_tab3[run-2].code,
					(LInt)coeff_tab3[run-2].len);
			}
		}
	}
	return length;
}
Int
PutRunCoeff_Intra(Int run, Int level, Int last, Image *bitstream)
{
	Int length = 0;
	MOMCHECK (last >= 0 && last < 2);
	MOMCHECK (run >= 0 && run < 64);
	MOMCHECK (level > 0 && level < 128);
	if (last == 0)
	{
		if (run == 0 && level < 28 )
		{
			length = coeff_tab4[level-1].len;
			if (length != 0)
			{
												  
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 2L, 2L);
				length += 9;					  
				BitstreamPutBits(bitstream, (LInt)coeff_tab4[level-1].code,
					(LInt)coeff_tab4[level-1].len);
			}
		}
		else if (run == 1 && level < 11)
		{
			length = coeff_tab5[level-1].len;
			if (length != 0)
			{
												  
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 2L, 2L);
				length += 9;					  
				BitstreamPutBits(bitstream, (LInt)coeff_tab5[level-1].code,
					(LInt)coeff_tab5[level-1].len);
			}
		}
		else if (run > 1 && run < 10 && level < 6)
		{
			length = coeff_tab6[run-2][level-1].len;
			if (length != 0)
			{
												  
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 2L, 2L);
				length += 9;					  
				BitstreamPutBits(bitstream, (LInt)coeff_tab6[run-2][level-1].code,
					(LInt)coeff_tab6[run-2][level-1].len);
			}
		}
		else if (run > 9 && run < 15 && level == 1)
		{
			length = coeff_tab7[run-10].len;
			if (length != 0)
			{
												  
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 2L, 2L);
				length += 9;					  
				BitstreamPutBits(bitstream, (LInt)coeff_tab7[run-10].code,
					(LInt)coeff_tab7[run-10].len);
			}
		}
	}
	else if (last == 1)
	{
		if (run == 0 && level < 9)
		{
			length = coeff_tab8[level-1].len;
			if (length != 0)
			{
												  
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 2L, 2L);
				length += 9;					  
				BitstreamPutBits(bitstream, (LInt)coeff_tab8[level-1].code,
					(LInt)coeff_tab8[level-1].len);
			}
		}
		else if (run > 0 && run < 7 && level < 4)
		{
			length = coeff_tab9[run-1][level-1].len;
			if (length != 0)
			{
												  
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 2L, 2L);
				length += 9;					  
				BitstreamPutBits(bitstream, (LInt)coeff_tab9[run-1][level-1].code,
					(LInt)coeff_tab9[run-1][level-1].len);
			}
		}
		else if (run > 6 && run < 21 && level == 1)
		{
			length = coeff_tab10[run-7].len;
			if (length != 0)
			{
												  
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 2L, 2L);
				length += 9;					  
				BitstreamPutBits(bitstream, (LInt)coeff_tab10[run-7].code,
					(LInt)coeff_tab10[run-7].len);
			}
		}
	}
	return length;
}
Int
PutLevelCoeff_Inter(Int run, Int level, Int last, Image *bitstream)
{
	Int length = 0;
	MOMCHECK (last >= 0 && last < 2);
	MOMCHECK (run >= 0 && run < 64);
	MOMCHECK (level > 0 && level < 128);
	if (last == 0)
	{
		if (run < 2 && level < 13 )
		{
			length = coeff_tab0[run][level-1].len;
			if (length != 0)
			{
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 0L, 1L);
				length += 8;					  
				BitstreamPutBits (bitstream, (LInt)coeff_tab0[run][level-1].code,
					(LInt)coeff_tab0[run][level-1].len);
			}
		}
		else if (run > 1 && run < 27 && level < 5)
		{
			length = coeff_tab1[run-2][level-1].len;
			if (length != 0)
			{
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 0L, 1L);
				length += 8;					  
				BitstreamPutBits (bitstream, (LInt)coeff_tab1[run-2][level-1].code,
					(LInt)coeff_tab1[run-2][level-1].len);
			}
		}
	}
	else if (last == 1)
	{
		if (run < 2 && level < 4)
		{
			length = coeff_tab2[run][level-1].len;
			if (length != 0)
			{
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 0L, 1L);
				length += 8;					  
				BitstreamPutBits (bitstream, (LInt)coeff_tab2[run][level-1].code,
					(LInt)coeff_tab2[run][level-1].len);
			}
		}
		else if (run > 1 && run < 42 && level == 1)
		{
			length = coeff_tab3[run-2].len;
			if (length != 0)
			{
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 0L, 1L);
				length += 8;					  
				BitstreamPutBits (bitstream, (LInt)coeff_tab3[run-2].code,
					(LInt)coeff_tab3[run-2].len);
			}
		}
	}
	return length;
}
Int
PutLevelCoeff_Intra(Int run, Int level, Int last, Image *bitstream)
{
	Int length = 0;
	MOMCHECK (last >= 0 && last < 2);
	MOMCHECK (run >= 0 && run < 64);
	MOMCHECK (level > 0 && level < 128);
	if (last == 0)
	{
		if (run == 0 && level < 28 )
		{
			length = coeff_tab4[level-1].len;
			if (length != 0)
			{
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 0L, 1L);
				length += 8;					  
				BitstreamPutBits(bitstream, (LInt)coeff_tab4[level-1].code,
					(LInt)coeff_tab4[level-1].len);
			}
		}
		else if (run == 1 && level < 11)
		{
			length = coeff_tab5[level-1].len;
			if (length != 0)
			{
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 0L, 1L);
				length += 8;					  
				BitstreamPutBits(bitstream, (LInt)coeff_tab5[level-1].code,
					(LInt)coeff_tab5[level-1].len);
			}
		}
		else if (run > 1 && run < 10 && level < 6)
		{
			length = coeff_tab6[run-2][level-1].len;
			if (length != 0)
			{
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 0L, 1L);
				length += 8;					  
				BitstreamPutBits(bitstream, (LInt)coeff_tab6[run-2][level-1].code,
					(LInt)coeff_tab6[run-2][level-1].len);
			}
		}
		else if (run > 9 && run < 15 && level == 1)
		{
			length = coeff_tab7[run-10].len;
			if (length != 0)
			{
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 0L, 1L);
				length += 8;					  
				BitstreamPutBits(bitstream, (LInt)coeff_tab7[run-10].code,
					(LInt)coeff_tab7[run-10].len);
			}
		}
	}
	else if (last == 1)
	{
		if (run == 0 && level < 9)
		{
			length = coeff_tab8[level-1].len;
			if (length != 0)
			{
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 0L, 1L);
				length += 8;					  
				BitstreamPutBits(bitstream, (LInt)coeff_tab8[level-1].code,
					(LInt)coeff_tab8[level-1].len);
			}
		}
		else if (run > 0 && run < 7 && level < 4)
		{
			length = coeff_tab9[run-1][level-1].len;
			if (length != 0)
			{
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 0L, 1L);
				length += 8;					  
				BitstreamPutBits(bitstream, (LInt)coeff_tab9[run-1][level-1].code,
					(LInt)coeff_tab9[run-1][level-1].len);
			}
		}
		else if (run > 6 && run < 21 && level == 1)
		{
			length = coeff_tab10[run-7].len;
			if (length != 0)
			{
				BitstreamPutBits(bitstream, 3L, 7L);
												  
				BitstreamPutBits(bitstream, 0L, 1L);
				length += 8;					  
				BitstreamPutBits(bitstream, (LInt)coeff_tab10[run-7].code,
					(LInt)coeff_tab10[run-7].len);
			}
		}
	}
	return length;
}

⌨️ 快捷键说明

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