sample.c

来自「JPEG解压软件,包含PC端的测试程序,程序结构比较清晰」· C语言 代码 · 共 59 行

C
59
字号

#include "sample.h"

#define ResampleOneLine() {\
	out			= outData ;\
	in			= inData + ( * addrH ++ ) * lineBytes;\
	addrWx		= addrW ;\
	j			= lWidthx ;\
	while( --j >= 0 ) {\
		out[0]	= in[ addrWx[0] ] ;\
		out[1]	= in[ addrWx[1] ] ;\
		out[2]	= in[ addrWx[2] ] ;\
		out[3]	= in[ addrWx[3] ] ;\
		out		+= 4;\
		addrWx	+= 4;\
	}\
	outData		+= lWidth ;\
}

void resample( register MShort * addrW, register MShort * addrH, MByte *inData, register MByte *outData, int lineBytes, int LineCount, register int lWidth ) {

	register int j ;
	register MByte * out ;
	register MByte * in ;
	register MShort * addrWx ;

	register int lWidthx	= lWidth >> 2 ;

	switch (lWidth & 3) {
	case 0:
		while ( -- LineCount >= 0 ) {
			ResampleOneLine();
		}
		break;
	case 1:
		while ( -- LineCount >= 0 ) {
			ResampleOneLine();
			out[0]	= in[ addrWx[0] ] ;
		}
		break;
	case 2:
		while ( -- LineCount >= 0 ) {
			ResampleOneLine();
			out[0]	= in[ addrWx[0] ] ;
			out[1]	= in[ addrWx[1] ] ;
		}
		break;
	default:
		while ( -- LineCount >= 0 ) {
			ResampleOneLine();
			out[0]	= in[ addrWx[0] ] ;
			out[1]	= in[ addrWx[1] ] ;
			out[2]	= in[ addrWx[2] ] ;
		}
		break;
	}
}

⌨️ 快捷键说明

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