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

📄 quantize.cpp

📁 一个可以在DM642上运新的h.264算法
💻 CPP
字号:
/*	Open H.264
 *
 *	#include	<standard_disclaimer>
 *
 *  Authors:    aitorgaray@yifan.net
 *              _
 */

#define	__QUANTIZE_CC

#include	"Quantize.h"

const int	Quantize::_quant_coeff[ 6][ 4][ 4] = {

	//	*noTE* cut & paste from JM6.1d

	{{13107, 8066,13107, 8066},{ 8066, 5243, 8066, 5243},{13107, 8066,13107, 8066},{ 8066, 5243, 8066, 5243}},
    {{11916, 7490,11916, 7490},{ 7490, 4660, 7490, 4660},{11916, 7490,11916, 7490},{ 7490, 4660, 7490, 4660}},
    {{10082, 6554,10082, 6554},{ 6554, 4194, 6554, 4194},{10082, 6554,10082, 6554},{ 6554, 4194, 6554, 4194}},
    {{ 9362, 5825, 9362, 5825},{ 5825, 3647, 5825, 3647},{ 9362, 5825, 9362, 5825},{ 5825, 3647, 5825, 3647}},
    {{ 8192, 5243, 8192, 5243},{ 5243, 3355, 5243, 3355},{ 8192, 5243, 8192, 5243},{ 5243, 3355, 5243, 3355}},
    {{ 7282, 4559, 7282, 4559},{ 4559, 2893, 4559, 2893},{ 7282, 4559, 7282, 4559},{ 4559, 2893, 4559, 2893}}
};

const int	Quantize::_qp_scale_cr[ 52] = {

 	//	*noTE* cut & paste from JM6.1d

	0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,
    12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,
    28,29,29,30,31,32,32,33,34,34,35,35,36,36,37,37,
    37,38,38,38,39,39,39,39
 };

const int	Quantize::_Q_BITS = 15;


void Quantize::doQuantization( LumaMacroblock& sourceMacroblock, LumaMacroblock& targetMacroblock, int qp, bool intra, bool chroma) {

	for( int y = 0; y < 4; y++) {

		for( int x = 0; x < 4; x++) {
			Block	sourceBlock( sourceMacroblock.getBaseAddresForSubBlock( y, x), sourceMacroblock._stride),
					targetBlock( targetMacroblock.getBaseAddresForSubBlock( y, x), targetMacroblock._stride);

			do4x4Quantization( sourceBlock, targetBlock, qp, intra, chroma);
		}
	}
}

/*  $Log:$
 *
 */

⌨️ 快捷键说明

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