I was asked what I was able to figure out about the XthermDll.cpp code so here it is, maybe it will be useful to some of you.

(bare in mind that I may have introduced some errors to the code)

useful materials:

https://en.wikipedia.org/wiki/Stefan%E2%80%93Boltzmann_lawhttps://www.mdpi.com/1424-8220/17/8/1718 (sensors-17-01718-v2.pdf)

https://github.com/mcguire-steve/ht301_ircamhttps://github.com/stawel/ht301_hacklib#################### sub_10001010 ###################################

sub_10001010: - calculate: water vapour content coefficient, transmittance of atmosphere and part of object temperature equation (formula (2))

code mapping:

https://github.com/mcguire-steve/ht301_ircam/blob/fd6daa8fcee96835d52e200f53451d613718cc66/src/XthermDll.cpp#L13-L48https://github.com/stawel/ht301_hacklib/blob/a54853a62323c5d6d2befac636568590f433a87b/ht301_hacklib.py#L34-L64sensors-17-01718-v2.pdf page:4

variables in 'ht301_hacklib.py code', [XthermDll.cpp code]:

'w', [v0] - water vapour content coefficient, formula (4)

't', [flt_100133AC] - transmittance of atmosphere, formula (3)

'part_emi_t_1', [flt_100133A8] - part of formula (2) (denominator without the Stefan-Boltzmann constant)

'part_Tatm_Trefl', [flt_100033A0] - part of formula (2) (part of the numerator without the Stefan-Boltzmann constant)

note 1: h0, h1, h2, h3 coefficients from paper differ from XthermDll.cpp code

note 2: XthermDll.cpp code uses mostly 32 bit floats so numbers have bigger rounding errors

#################### sub_10001180 #####################################

sub_10001180 - generate lookup table (LUT)

sensor raw values are mapped from [0, 16384] -> object temperature (floats)

code mapping:

https://github.com/mcguire-steve/ht301_ircam/blob/fd6daa8fcee96835d52e200f53451d613718cc66/src/XthermDll.cpp#L72-L141https://github.com/stawel/ht301_hacklib/blob/a54853a62323c5d6d2befac636568590f433a87b/ht301_hacklib.py#L74-L94this is the part which I don't fully understand, but it's essentially formula (2) with some addons:

variables (which I understand) in 'ht301_hacklib.py code', [XthermDll.cpp code]:

'np_Ttot', [v20] - Total radiation temperature (is the name correct?) (Wtot = o*Ttot^4, formula (2))

'np_Tobj_C', [v18] - object temperature in Celsius (formula (2), note Stefan-Boltzmann constant is not needed because we are using Ttot^4 instead of Wtot)

'np_result', [*p] - np_result = np_Tobj_C + distance_c * (np_Tobj_C - airtmp_) - some "magic" addon, this is the temperature presented to user, probably not needed (?)

'distance_c', [(v16 - 1.125) / 100.] - helper variable used in "magic" addon

some additional info:

result = 4;

v17 = 1.0;

while (1) {

v12 = v20;

if (result & 1)

v17 = v17 * v12;

result >>= 1;

if (!result)

break;

v20 = v12 * v12;

}

is a fancy way of saying: v17 = v20**4, or np_Ttot**4

#################### UpdateParam #####################################

read calibration data (Non-uniformity correction (NUC) data(?), shutter closed) and calculate LUT

code mapping:

https://github.com/mcguire-steve/ht301_ircam/blob/fd6daa8fcee96835d52e200f53451d613718cc66/src/XthermDll.cpp#L143-L199https://github.com/stawel/ht301_hacklib/blob/a54853a62323c5d6d2befac636568590f433a87b/ht301_hacklib.py#L118-L137(the two lines:

https://github.com/mcguire-steve/ht301_ircam/blob/fd6daa8fcee96835d52e200f53451d613718cc66/src/XthermDll.cpp#L198-L199are here:

https://github.com/stawel/ht301_hacklib/blob/a54853a62323c5d6d2befac636568590f433a87b/ht301_hacklib.py#L70-L71 )

################## GetTmpData #######################################

get min, max,.. temperatures in the current frame

code mapping:

https://github.com/mcguire-steve/ht301_ircam/blob/fd6daa8fcee96835d52e200f53451d613718cc66/src/XthermDll.cpp#L252-L295https://github.com/stawel/ht301_hacklib/blob/a54853a62323c5d6d2befac636568590f433a87b/ht301_hacklib.py#L163-L187