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

📄 yuv_mmx.h

📁 实时监控
💻 H
字号:
/*
 *	YUV -> RGB mmx declaration
 *	from xvid codec source code
 */
#ifndef _YUV_MMX_H
#define _YUV_MMX_H

#include "color_space.h"

/* yuv 4:2:0 planar -> yuyv (yuv2) packed */
#ifndef byte
typedef unsigned char byte;
#endif

typedef byte uint8_t;
typedef unsigned long uint32_t;

// 这个函数的实现在"yv12_to_yuyv_mmx.obj"中
extern "C" {
/*
typedef void (*MMX_CONV)(uint8_t * dst,
		int dst_stride,
		uint8_t * y_src,
		uint8_t * u_src,
		uint8_t * v_src,
		int y_stride,
		int uv_stride,
		int width,
		int height);
extern MMX_CONV yv12_to_yuyv_mmx;
//*/
///*
typedef void (__cdecl CONVERT_YV12)(uint8_t * dst,
				int dst_stride,
				uint8_t * y_src,
				uint8_t * u_src,
				uint8_t * v_src,
				int y_stride,
				int uv_stride,
				int width,
				int height);

#define DECLARE_YV12_YUV(x) \
void x(uint8_t * dst,\
				int dst_stride,\
				uint8_t * y_src,\
				uint8_t * u_src,\
				uint8_t * v_src,\
				int y_stride,\
				int uv_stride,\
				int width,\
				int height);

DECLARE_YV12_YUV(yv12_to_uyvy_mmx);
DECLARE_YV12_YUV(yv12_to_yuyv_mmx);
DECLARE_YV12_YUV(yv12_to_rgb24_mmx);
DECLARE_YV12_YUV(yv12_to_rgb32_mmx);
DECLARE_YV12_YUV(yv12_to_rgb555_mmx);
DECLARE_YV12_YUV(yv12_to_rgb565_mmx);

//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
typedef void (__cdecl *CONVERT_YUV_RGB)(const unsigned char* src, 
										unsigned char* dst, 
										const unsigned char* src_end, 
										int src_pitch,
										int row_size,
										bool rec709);
#define DECLARE_YUV_RGB(x) \
void x(\
	const unsigned char* src, \
	unsigned char* dst, \
	const unsigned char* src_end, \
	int src_pitch,\
	int row_size,\
	bool rec709);
/*
typedef void (__cdecl *CONVERT_YUV_RGB)(const unsigned char* src, 
										unsigned char* dst, 
										const unsigned char* src_end, 
										int stride);

#define DECLARE_YUV_RGB(x) \
void x(\
	const unsigned char* src, \
	unsigned char* dst, \
	const unsigned char* src_end, \
	int stride);
*/

DECLARE_YUV_RGB(mmx_YUY2toRGB24)
DECLARE_YUV_RGB(mmx_YUY2toRGB32)
DECLARE_YUV_RGB(mmx_UYVYtoRGB24)
DECLARE_YUV_RGB(mmx_UYVYtoRGB32)

static void* desired_method(COLOR_SPACE in, COLOR_SPACE out)
{
	static void* NOT_ALLOWED = NULL;//(void*)-1;
	static void* DO_NOTHING = (void*)-1;

	if( in & csRGB )
	{
		if( out & csYUV )
			return NOT_ALLOWED;		// not allowed

		if( in == out )
			return DO_NOTHING;			// do nothing
		else
			return NOT_ALLOWED;
	}

	// then input is YUV
	if( in == csYV12 )
	{
		switch( out )
		{
		case csYUY2:
			return yv12_to_yuyv_mmx;
		case csUYVY:
			return yv12_to_uyvy_mmx;
		case csRGB24:
			return yv12_to_rgb24_mmx;
		case csRGB32:
			return yv12_to_rgb32_mmx;
		default:
			return NOT_ALLOWED;
		}
	}

	if( in == csYUY2 )
	{
		switch( out )
		{
		case csYUY2:
			return DO_NOTHING;
		case csUYVY:
			return NOT_ALLOWED;
		case csRGB24:
			return mmx_YUY2toRGB24;
		case csRGB32:
			return mmx_YUY2toRGB32;
		default:
			return NOT_ALLOWED;
		}
	}

	if( in == csUYVY )
	{
		switch(out)
		{
		case csYUY2:
			return NOT_ALLOWED;
		case csUYVY:
			return DO_NOTHING;
		case csRGB24:
			return mmx_UYVYtoRGB24;
		case csRGB32:
			return mmx_UYVYtoRGB32;
		}
	}

	return NOT_ALLOWED;
}


//*/
}

#endif	// _YUV_MMX_H

⌨️ 快捷键说明

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