1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

brush up fp16 implementation

* DRY
  * switch to Cv32suf and remove fp32Int32
  * add Cv16suf
This commit is contained in:
Tomoaki Teshima
2016-08-24 18:32:13 +09:00
parent e884bbabcb
commit c5d7791b67
2 changed files with 27 additions and 32 deletions
+21
View File
@@ -307,11 +307,32 @@ enum CpuFeatures {
#define CV_2PI 6.283185307179586476925286766559
#define CV_LOG2 0.69314718055994530941723212145818
typedef union Cv16suf
{
short i;
#if ( defined (__arm__) || defined (__aarch64__) ) && ( defined (__GNUC__) && ( ( ( 4 <= __GNUC__ ) && ( 7 <= __GNUC__ ) ) || ( 5 <= __GNUC__ ) ) )
__fp16 h;
#endif
struct _fp16Format
{
unsigned int significand : 10;
unsigned int exponent : 5;
unsigned int sign : 1;
} fmt;
}
Cv16suf;
typedef union Cv32suf
{
int i;
unsigned u;
float f;
struct _fp32Format
{
unsigned int significand : 23;
unsigned int exponent : 8;
unsigned int sign : 1;
} fmt;
}
Cv32suf;