nmpp
vSupport.h
1 //------------------------------------------------------------------------
2//
3// $Workfile:: vSupport. $
4//
5// Векторно-матричная библиотека
6//
7// Copyright (c) RC Module Inc.
8//
9// $Revision: 1.2 $ $Date: 2004/12/21 14:36:01 $
10//
11//------------------------------------------------------------------------
12
13
14//------------------------------------------------------------------------
15#ifndef __VSUPPORT_H
16#define __VSUPPORT_H
17//#include <stdlib.h>
18#include "nmtype.h"
19#ifdef __cplusplus
20 extern "C" {
21#endif
22
23
24
25//*****************************************************************************
26
73/*
74__INLINE__ nm1* nmppsAddr_1*(nm1* pVec, int nIndex){ return (nm1*)((int*)pVec+(nIndex>>5));}
75__INLINE__ nm2s* nmppsAddr_2s(nm2s* pVec, int nIndex){ return (nm2s*)((int*)pVec+(nIndex>>4));}
76__INLINE__ nm4s* nmppsAddr_4s(nm4s* pVec, int nIndex){ return (nm4s*)((int*)pVec+(nIndex>>3));}
77
78nm8s* nmppsAddr_(const nm8s* pVec, int nIndex);
79nm16s* nmppsAddr_16s(nm16s* pVec, int nIndex);
80nm32s* nmppsAddr_32s(nm32s* pVec, int nIndex);
81
82__INLINE__ nm64s* nmppsAddr_64s(nm64s* pVec, int nIndex) {return pVec+nIndex;}
83#ifdef __NM__
84__INLINE__ nm8u* nmppsAddr_(const nm8u* pVec, int nIndex) {return (nm8u*)nmppsAddr_8s((nm8s*) pVec, nIndex);}
85__INLINE__ nm16u* nmppsAddr_16u(nm16u* pVec, int nIndex) {return (nm16u*)nmppsAddr_16s((nm16s*) pVec, nIndex);}
86#else
87__INLINE__ nm8u* nmppsAddr_(const nm8u* pVec, int nIndex) {return (nm8u*)pVec+nIndex;}
88__INLINE__ nm16u* nmppsAddr_16u(nm16u* pVec, int nIndex) {return pVec+nIndex;}
89#endif
90__INLINE__ nm32u* nmppsAddr_32u(nm32u* pVec, int nIndex) {return pVec+nIndex;}
91__INLINE__ nm64u* nmppsAddr_64u(nm64u* pVec, int nIndex) {return pVec+nIndex;}
92*/
93/*
94__INLINE__ nm64u* nmppsAddr_1 (nm1* pVec, int nIndex) {return (nm64u*)pVec+(nIndex>>6);}
95__INLINE__ nm64u* nmppsAddr_2s(nm2s* pVec, int nIndex) {return (nm64u*)pVec+(nIndex>>5);}
96__INLINE__ nm64u* nmppsAddr_4s(nm4s* pVec, int nIndex) {return (nm64u*)pVec+(nIndex>>4);}
97__INLINE__ nm64u* nmppsAddr_8s(nm8s* pVec, int nIndex) {return (nm64u*)pVec+(nIndex>>3);}
98__INLINE__ nm64u* nmppsAddr_16s(nm16s* pVec, int nIndex) {return (nm64u*)pVec+(nIndex>>2);}
99__INLINE__ nm64u* nmppsAddr_32s(nm32s* pVec, int nIndex) {return (nm64u*)pVec+(nIndex>>1);}
100__INLINE__ nm64u* nmppsAddr_64s(nm64s* pVec, int nIndex) {return (nm64u*)pVec+nIndex;}
101
102__INLINE__ nm64u* nmppsAddr_8u(nm8u* pVec, int nIndex) {return (nm64u*)pVec+(nIndex>>3);}
103__INLINE__ nm64u* nmppsAddr_16u(nm16u* pVec, int nIndex) {return (nm64u*)pVec+(nIndex>>2);}
104__INLINE__ nm64u* nmppsAddr_32u(nm32u* pVec, int nIndex) {return (nm64u*)pVec+(nIndex>>1);}
105__INLINE__ nm64u* nmppsAddr_64u(nm64u* pVec, int nIndex) {return (nm64u*)pVec+nIndex;}
106*/
107
108 __INLINE__ nm1 * nmppsAddr_1 (const nm1* pVec, int nIndex) {return (nm1* )((nm64u*)pVec+(nIndex>>6));}
109 inline nm2s * nmppsAddr_2s (const nm2s* pVec, int nIndex) {return (nm2s* )((nm64u*)pVec+(nIndex>>5));}
110 inline nm4s * nmppsAddr_4s (const nm4s* pVec, int nIndex) {return (nm4s* )((nm64u*)pVec+(nIndex>>4));}
111 __INLINE__ nm8s * nmppsAddr_8s (const nm8s* pVec, int nIndex) {return (nm8s* )((nm64u*)pVec+(nIndex>>3));}
112 __INLINE__ nm16s* nmppsAddr_16s(const nm16s* pVec, int nIndex) {return (nm16s*)((nm64u*)pVec+(nIndex>>2));}
113 __INLINE__ nm32s* nmppsAddr_32s(const nm32s* pVec, int nIndex) {return (nm32s*)((nm64u*)pVec+(nIndex>>1));}
114 __INLINE__ nm32f* nmppsAddr_32f(const nm32f* pVec, int nIndex) {return (nm32f*)((nm64u*)pVec+(nIndex>>1));}
115 __INLINE__ nm64s* nmppsAddr_64s(const nm64s* pVec, int nIndex) {return (nm64s*)((nm64u*)pVec+nIndex) ;}
116 __INLINE__ nm64f* nmppsAddr_64f(const nm64f* pVec, int nIndex) {return (nm64f*)((nm64u*)pVec+nIndex) ;}
117
118
119 inline nm2u * nmppsAddr_2u (const nm2u* pVec, int nIndex) {return (nm2u* )((nm64u*)pVec+(nIndex>>5));}
120 inline nm4u * nmppsAddr_4u (const nm4u* pVec, int nIndex) {return (nm4u* )((nm64u*)pVec+(nIndex>>4));}
121 __INLINE__ nm8u * nmppsAddr_8u (const nm8u* pVec, int nIndex) {return (nm8u* )((nm64u*)pVec+(nIndex>>3));}
122 __INLINE__ nm16u* nmppsAddr_16u(const nm16u* pVec, int nIndex) {return (nm16u*)((nm64u*)pVec+(nIndex>>2));}
123 __INLINE__ nm32u* nmppsAddr_32u(const nm32u* pVec, int nIndex) {return (nm32u*)((nm64u*)pVec+(nIndex>>1));}
124 __INLINE__ nm64u* nmppsAddr_64u(const nm64u* pVec, int nIndex) {return (nm64u*)((nm64u*)pVec+nIndex );}
125
126
128
129//*****************************************************************************
130
168
169void nmppsPut_1 (nm1* pVec, int nIndex, int1b nVal);
170void nmppsPut_2s(nm2s* pVec, int nIndex, int2b nVal);
171void nmppsPut_4s(nm4s* pVec, int nIndex, int4b nVal);
172void nmppsPut_8s(nm8s* pVec, int nIndex, int8b nVal);
173void nmppsPut_16s(nm16s* pVec, int nIndex, int16b nVal);
174__INLINE__ void nmppsPut_32s(nm32s* pVec, int nIndex, int32b nVal) {pVec[nIndex]=nVal;}
175__INLINE__ void nmppsPut_64s(nm64s* pVec, int nIndex, int64b nVal) {pVec[nIndex]=nVal;}
176
177__INLINE__ void nmppsPut_2u(nm2u* pVec, int nIndex, uint2b nVal) {nmppsPut_2s((nm2s*)pVec,nIndex,(int2b)nVal);}
178__INLINE__ void nmppsPut_4u(nm4u* pVec, int nIndex, uint4b nVal) {nmppsPut_4s((nm4s*)pVec,nIndex,(int4b)nVal);}
179__INLINE__ void nmppsPut_8u(nm8u* pVec, int nIndex, uint8b nVal) {nmppsPut_8s((nm8s*)pVec,nIndex,(int8b)nVal);}
180__INLINE__ void nmppsPut_16u(nm16u* pVec, int nIndex, uint16b nVal) {nmppsPut_16s((nm16s*)pVec,nIndex,(int16b)nVal);}
181__INLINE__ void nmppsPut_32u(nm32u* pVec, int nIndex, uint32b nVal) {pVec[nIndex]=nVal;}
182__INLINE__ void nmppsPut_64u(nm64u* pVec, int nIndex, uint64b nVal) {pVec[nIndex]=nVal;}
183
184
186
187//*****************************************************************************
188
221
222void nmppsGetVal_1 (const nm1* pVec, int nIndex, int1b *nVal);
223void nmppsGetVal_2s (const nm2s* pVec, int nIndex, int2b *nVal);
224void nmppsGetVal_4s (const nm4s* pVec, int nIndex, int4b *nVal);
225void nmppsGetVal_8s (const nm8s* pVec, int nIndex, int8b *nVal);
226void nmppsGetVal_16s(const nm16s* pVec, int nIndex, int16b *nVal);
227__INLINE__ void nmppsGetVal_32s(const nm32s* pVec, int nIndex, int32b* nVal) { *nVal=pVec[nIndex];}
228__INLINE__ void nmppsGetVal_64s(const nm64s* pVec, int nIndex, int64b* nVal) { *nVal=pVec[nIndex];}
229
230void nmppsGetVal_2u (const nm2u* pVec, int nIndex, uint2b *nVal);
231void nmppsGetVal_4u (const nm4u* pVec, int nIndex, uint4b *nVal);
232void nmppsGetVal_8u (const nm8u* pVec, int nIndex, uint8b *nVal);
233void nmppsGetVal_16u(const nm16u* pVec, int nIndex, uint16b *nVal);
234__INLINE__ void nmppsGetVal_32u(const nm32u* pVec, int nIndex, uint32b* nVal) { *nVal=pVec[nIndex];}
235__INLINE__ void nmppsGetVal_64u(const nm64u* pVec, int nIndex, uint64b* nVal) { *nVal=pVec[nIndex];}
236
238
239//*****************************************************************************
240
271int2b nmppsGet_2s (const nm2s* pVec, int nIndex);
272int4b nmppsGet_4s (const nm4s* pVec, int nIndex);
273int8b nmppsGet_8s (const nm8s* pVec, int nIndex);
274int16b nmppsGet_16s(const nm16s* pVec, int nIndex);
275__INLINE__ int32b nmppsGet_32s(const nm32s* pVec, int nIndex) {return pVec[nIndex];}
276
277uint1b nmppsGet_1 (const nm1* pVec, int nIndex);
278uint2b nmppsGet_2u (const nm2u* pVec, int nIndex);
279uint4b nmppsGet_4u (const nm4u* pVec, int nIndex);
280uint8b nmppsGet_8u (const nm8u* pVec, int nIndex);
281uint16b nmppsGet_16u(const nm16u* pVec, int nIndex);
282__INLINE__ uint32b nmppsGet_32u(const nm32u* pVec, int nIndex) {return pVec[nIndex];}
284
285/*
286 __INLINE__ unsigned nmppsSize32_8s(nm8s* ,unsigned size) {return size/4;}
287 __INLINE__ unsigned nmppsSize32_16s(nm16s* ,unsigned size) {return size/2;}
288 __INLINE__ unsigned nmppsSize32_32s(nm32s* ,unsigned size) {return size; }
289 __INLINE__ unsigned nmppsSize32_64s(nm64s* ,unsigned size) {return size*2;}
290
291 __INLINE__ unsigned nmppsSize32_8u(nm8u* ,unsigned size) {return size/4;}
292 __INLINE__ unsigned nmppsSize32_16u(nm16u* ,unsigned size) {return size/2;}
293 __INLINE__ unsigned nmppsSize32_32u(nm32u* ,unsigned size) {return size; }
294 __INLINE__ unsigned nmppsSize32_64u(nm64u* ,unsigned size) {return size*2;}
295*/
296
297#ifdef __cplusplus
298 };
299#endif
300
301#endif
unsigned int uint32b
Definition: nmtype.h:839
unsigned int uint2b
Definition: nmtype.h:735
int int4b
Definition: nmtype.h:592
unsigned int uint4b
Definition: nmtype.h:761
int int2b
Definition: nmtype.h:566
int int8b
Definition: nmtype.h:618
unsigned int uint16b
Definition: nmtype.h:813
unsigned int uint1b
Definition: nmtype.h:722
int int1b
Definition: nmtype.h:553
int int32b
Definition: nmtype.h:683
unsigned int uint8b
Definition: nmtype.h:787
int int16b
Definition: nmtype.h:644
INT64 int64b
Definition: nmtype.h:709
nm64u uint64b
Definition: nmtype.h:865
unsigned char nm8u
Definition: nmtype.h:448
int nm32s
Definition: nmtype.h:292
void nm4u
Definition: nmtype.h:417
unsigned short nm16u
Definition: nmtype.h:481
long long nm64s
Definition: nmtype.h:375
void nm2s
Definition: nmtype.h:116
void nm2u
Definition: nmtype.h:404
int nm1
Definition: nmtype.h:100
short nm16s
Definition: nmtype.h:243
unsigned int nm32u
Definition: nmtype.h:509
void nm4s
Definition: nmtype.h:129
unsigned long long nm64u
Definition: nmtype.h:536
char nm8s
Definition: nmtype.h:167