deblock_vert_dc_on.c

来自「VC++视频开发实例集锦(包括“远程视频监控”"语音识别系统&quot」· C语言 代码 · 共 64 行

C
64
字号


#include "postprocess_mmx.h"


INLINE int deblock_vert_DC_on(uint8_t *v, int stride, int QP) {
	uint64_t QP_x_2;
	uint8_t *ptr1;
	uint8_t *ptr2;
	int DC_on;
	#ifdef PP_SELF_CHECK
	int i, DC_on2;
	#endif

	ptr1 = &(v[1*stride]);
	ptr2 = &(v[8*stride]);

	#ifdef PP_SELF_CHECK
	DC_on2 = 1;
	for (i=0; i<8; i++) {
		if (ABS(v[i+1*stride]-v[i+8*stride]) > 2 *QP) DC_on2 = 0;
	}
	#endif

	((uint32_t *)(&QP_x_2))[0] =
	((uint32_t *)(&QP_x_2))[1] = 0x02020202 * QP; 

	__asm {
		push eax
		push ebx
		
		mov eax, ptr1
		mov ebx, ptr2

		movq     mm0, [eax]               /* mm0 = v[l1]                   */
		movq     mm1, mm0                 /* mm1 = v[l1]                   */
		movq     mm2, [ebx]               /* mm2 = v[l8]                   */
		psubusb  mm0, mm2                 /* mm0 -= mm2                    */
		psubusb  mm2, mm1                 /* mm2 -= mm1                    */
		por      mm0, mm2                 /* mm0 |= mm2                    */
		psubusb  mm0, QP_x_2              /* mm0 -= 2 * QP                 */
		movq     mm1, mm0                 /* mm1 = mm0                     */
		psrlq    mm0, 32                  /* shift mm0 right 32 bits       */
		por      mm0, mm1                 /*                               */
		movd     DC_on, mm0             

		pop ebx
		pop eax

	};
				
	DC_on = !DC_on; 
	
	#ifdef PP_SELF_CHECK
	if (DC_on != DC_on2) {
		printf("ERROR: MMX version of DC_on is incorrect\n");
	}
	#endif

	return DC_on;
}


⌨️ 快捷键说明

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