[CinCV TNG] [PATCH] Make aspect_h and aspect_w doubles in EDLSession
einarrunkaru at gmail.com
Sun Aug 27 18:53:34 CEST 2017
On 08/26/2017 12:03 PM, Johannes Sixt wrote:
> Am 24.08.2017 um 22:47 schrieb Einar Rünkaru:
>> There is no point to use float single variables on
>> modern computers. They are often converted silently
>> to doubles and back and they loose quickly accuracy
>> during uncareful computation sequences.
>> Change the types step by step as needed in the future.
> I do not buy the argument about accuracy. Can you present an example
> where there is unwanted round-off? I simply do not see where aspect_w
> and aspect_h are involved in calculations. (There is one in shapewipe,
> but it is
Floating point is an approximation of the real value with limited
accuracy. Every FP value has an error. Adding/subtracting sums the
absolute value of error of the operands. Multiplication/subtractions
sums the relative error value. The errors sum up very quickly rendering
the result to unpredictable.
There are good discussions:
> Also, it is not true that computers convert to double internally. I have
> looked at sufficient assembly generated by gcc recently that I know that
> all operations involving type float are perfermed with SSE single
> precision instructions.
Once a very long time ago I paricipated in developing a FP hardware. If
I have to engineer a FP processing unit today I implement it in next 3
a) separate sign, expoent and mantissa to respective subunits
b) calculate the result in subunits
c) combine the result from subunits to required type.
Step b does not generally depend on the type of arguments. It is
possible to limit the number of loops depending the length of mantissa.
To minimize the loss of accuracy the calculated number of bits is
greater than required in result.
I thing it is a reasonable design and ruling from it I can expect that
calculation of double is only slightly slower than float.
This is my only concern. The idea is to get rid all simple variables of
> Furthermore, the patch is incomplete. There is float aspect_w in
> pluginvclient.h and assignments from atof() in new.C.
The assignent from atof will disappear in the current patchset.
pluginvclient will be fixed soon
> Please do not apply this patch until there is evidence that it is needed.
The set starting from 'New file cinelerra.h' will be applied together.
There will be some more patches in this set. I do not know, how many.
More information about the Cinelerra