Changes between Version 1 and Version 2 of Ticket #9781, comment 13


Ignore:
Timestamp:
May 13, 2022, 6:23:04 PM (4 years ago)
Author:
Llyw

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #9781, comment 13

    v1 v2  
    1919        s->in_slice_end[0]   = in_h;
    2020}}}
    21 for a single slice since as in this case you have `s->out_slice_start[0]=0.0` and `s->out_slice_end[0]=(double)oh` with `oh` being equal to `out_h`: Since the dimensions of an AVFrame are 32-bit signed integers, see https://ffmpeg.org/doxygen/2.7/structAVFrame.html, and 32-bit signed integers can be exactly represented as double precision floating-point values, you can be certain that the expression `s->out_slice_end[0]/(double)out_h` will be equal to `1.0`, causing the endpoint of your slice to be exactly equal to `in_h`, which is also the default that `z.lib/zimg` assumes when the `active_area` member is not specified, see https://github.com/sekrit-twc/zimg/blob/release-3.0.4/src/zimg/api/zimg.cpp#L405, as was the case before the Intel-commit. (With the current code this will only be true as long as the exact value of `out_h*in_h` can be precisely represented by a double precision floating-point value.)
     21for a single slice since as in this case you have `s->out_slice_start[0]=0.0` and `s->out_slice_end[0]=(double)oh` with `oh` being equal to `out_h`: Since the dimensions of an AVFrame are 32-bit signed integers, see https://ffmpeg.org/doxygen/2.7/structAVFrame.html, and 32-bit signed integers can be exactly represented as double precision floating-point values, you can be certain that the expression `s->out_slice_end[0]/(double)out_h` will be equal to `1.0`, causing the endpoint of your slice to be exactly equal to `in_h`, which is also the default that `z.lib/zimg` assumes when the `active_area` member is not specified, see https://github.com/sekrit-twc/zimg/blob/release-3.0.4/src/zimg/api/zimg.cpp#L405, as was the case before the Intel-commit. (With the current code this will only be true as long as the exact result of `out_h*in_h` can be precisely represented by a double precision floating-point value.)
    2222
    2323Note, however, that the default floating-point model will give the compiler some freedom when it comes to interpreting the source code and I am not sure whether the above reasoning will hold in general. If you want to investigate this further, I would recommend that you add some regression tests.