AJA NTV2 SDK  17.5.0.1242
NTV2 SDK 17.5.0.1242
ntv2fixed.h File Reference

Declares several fixed-point math routines. Assumes 16-bit fraction. More...

#include "ajatypes.h"
Include dependency graph for ntv2fixed.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FIXED_ONE   (1<<16)
 
#define FixedTrunc(__x__)   ((__x__)>>16)
 
#define FixedRound(__x__)   (((__x__) < 0) ? (-((-(__x__)+0x8000)>>16)) : (((__x__) + 0x8000)>>16))
 
#define FixedMix(__min__, __max__, __mixer__)   (FixedRound(((__max__)-(__min__))*(__mixer__)+(__min__)))
 
#define FloatToFixed(__x__)   ((Fixed_)((__x__) * (float)FIXED_ONE))
 
#define FixedToFloat(__x__)   (((float)(__x__) / (float) 65536.0))
 
#define FixedFrac(__x__)   (((__x__) < 0) ? (-(__x__) & 0xFFFF)) : ((__x__) & 0xFFFF)
 

Detailed Description

Declares several fixed-point math routines. Assumes 16-bit fraction.

Definition in file ntv2fixed.h.

Macro Definition Documentation

◆ FIXED_ONE

#define FIXED_ONE   (1<<16)

Definition at line 13 of file ntv2fixed.h.

◆ FixedFrac

#define FixedFrac (   __x__)    (((__x__) < 0) ? (-(__x__) & 0xFFFF)) : ((__x__) & 0xFFFF)

Definition at line 41 of file ntv2fixed.h.

◆ FixedMix

#define FixedMix (   __min__,
  __max__,
  __mixer__ 
)    (FixedRound(((__max__)-(__min__))*(__mixer__)+(__min__)))

Definition at line 38 of file ntv2fixed.h.

◆ FixedRound

#define FixedRound (   __x__)    (((__x__) < 0) ? (-((-(__x__)+0x8000)>>16)) : (((__x__) + 0x8000)>>16))

Definition at line 37 of file ntv2fixed.h.

◆ FixedToFloat

#define FixedToFloat (   __x__)    (((float)(__x__) / (float) 65536.0))

Definition at line 40 of file ntv2fixed.h.

◆ FixedTrunc

#define FixedTrunc (   __x__)    ((__x__)>>16)

Definition at line 35 of file ntv2fixed.h.

◆ FloatToFixed

#define FloatToFixed (   __x__)    ((Fixed_)((__x__) * (float)FIXED_ONE))

Definition at line 39 of file ntv2fixed.h.