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

📄 simpletransform.cpp

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

#define	__SIMPLETRANSFORM_CC

#include	"SimpleTransform.h"
#include    "../BlockIndexer.h"

void SimpleTransform::do4x4ForwardTransform( Block& sourceBlock, Block& targetBlock) {
	int		temp[ 4];
	byte	**source = BlockIndexer< 4>( sourceBlock).getSampleArray(),
			**result = BlockIndexer< 4>( targetBlock).getSampleArray();

    int     y, x;       //  *toDO*  this is here and not local to loops because of GCC/VisualC++ compatibility issues
	
	//	*toDO*	optimize this 

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

		for( x = 0; x < 4; x++) {

			result[ y][ x] = source[ y][ x];
		}
	}

	// horizontal
	for( x = 0; x < 4; x++) {

		temp[ 0] = result[ 0][ x] + result[ 3][ x];
		temp[ 1] = result[ 1][ x] + result[ 2][ x];
		temp[ 2] = result[ 1][ x] - result[ 2][ x];
		temp[ 3] = result[ 0][ x] - result[ 3][ x];

		result[ 0][ x] = temp[ 0] + temp[ 1];
		result[ 2][ x] = temp[ 0] - temp[ 1];
		result[ 1][ x] = temp[ 2] + ( temp[ 3] << 1);
		result[ 3][ x] = temp[ 3] - ( temp[ 2] << 1);
    }

    //  vertical
    for( y = 0; y < 4; y++) {

		temp[ 0] = result[ y][ 0] + result[ y][ 3];
		temp[ 1] = result[ y][ 1] + result[ y][ 2];
		temp[ 2] = result[ y][ 1] - result[ y][ 2];
		temp[ 3] = result[ y][ 0] - result[ y][ 3];

		result[ y][ 0] = temp[ 0] + temp[ 1];
		result[ y][ 2] = temp[ 0] - temp[ 1];
		result[ y][ 1] = temp[ 2] + ( temp[ 3] << 1);
		result[ y][ 3] = temp[ 3] - ( temp[ 2] << 1);
    }
}

void SimpleTransform::do16x16HadamarTransform( LumaMacroblock& sourceMacroblock, LumaMacroblock& targetMacroblock) {

    //  *toDO*
}

void SimpleTransform::do4x4DCLumaForwardTransform( Block& sourceBlock, Block& targetBlock) {

    //  *toDO*
}


/*  $Log:$
 *
 */

⌨️ 快捷键说明

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