#include "simd_type.h"
extern uint32 xRatZoom[4096];
extern uint32 yRatZoom[4096];
// zoom_c
// ================
EXPORT
void CDECL zoom_c (
/* des pointer */ uint32 *d,
/* src pointer */ uint32 *s,
/* des pitch */ msize_uint dp,
/* src pitch */ msize_uint sp,
/* width */ msize_uint w,
/* height */ msize_uint h,
/* zoom count */ msize_float c)
{
msize_uint x;
msize_uint y;
msize_uint new_w = (msize_uint)(c * (msize_float)w);
msize_uint new_h = (msize_uint)(c * (msize_float)h);
msize_uint _sp;
msize_uint _dp;
msize_uint y_count_cache;
msize_uint y_cahce;
msize_float r;
msize_float y_add_cache;
msize_float x_count_cache;
uint32 *dptr_cache;
uint32 *sptr_cache;
if (!new_w || !new_h)
return;
r = 1.0/c;
_sp = sp >> 2;
_dp = dp >> 2;
y_count_cache = 0;
y_add_cache = 0.0;
// please OPEN sse2 optimization in Release Mode
for (y = 0; y != new_h; y ++) {
x_count_cache = 0.0;
dptr_cache = &d[y_count_cache];
sptr_cache = &s[_sp * (msize_uint)(y_add_cache)];
for (x = 0; x != new_w; x ++) {
dptr_cache[x] = sptr_cache[(msize_uint)x_count_cache];
x_count_cache += r;
}
y_add_cache += r;
y_count_cache += _dp;
}
}
// =============================================================
// zoom_sc [bilinear interpolation]
// =============================================================
// note, not range check, use inline texture type [realloc]...
// =============================================================
#ifdef _M_IX86
NAKED
#endif
EXPORT
void CDECL zoom_sc (
/* des pointer */ uint32 *d,
/* src pointer */ uint32 *s,
/* des pitch */ msize_uint dp,
/* src pitch */ msize_uint sp,
/* width */ msize_uint w,
/* height */ msize_uint h,
/* zoom count */ msize_float c)
{
#ifndef _M_IX86
#define GET_B(x)((msize_float)(((x) & 0x000000FF) >> 0))
#define GET_G(x)((msize_float)(((x) & 0x0000FF00) >> 8))
#define GET_R(x)((msize_float)(((x) & 0x00FF0000) >> 16))
msize_uint X;
msize_uint Y;
msize_uint NewWidth = (msize_uint)(c * (msize_float)w);
msize_uint NewHeight = (msize_uint)(c * (msize_float)h);
msize_uint DesPitch;
msize_uint SrcPitch;
msize_uint BPosTX;
msize_uint BPosTY;
uint32 TLeft;
uint32 TRight;
uint32 BLeft;
uint32 BRight;
uint32 R;
uint32 G;
uint32 B;
msize_float RevseRatio;
msize_fl
simd 双线性插值
最新推荐文章于 2022-10-08 15:50:29 发布
本文探讨了如何使用Single Instruction Multiple Data (SIMD)技术来优化双线性插值算法,通过并行处理提升计算效率,详细阐述了SIMD指令在图像处理和数值计算中的关键作用。
摘要由CSDN通过智能技术生成