• Paul E. Murphy's avatar
    imgproc(resize): improve 8u3 HResize vector exit calc · c1cdb241
    Paul E. Murphy authored
    Actually, we can do this in constant time. xofs always
    contains same or increasing offset values. We can instead
    find the most extreme value used and never attempt to load it.
    
    Similarly, we can note for all dx >= 0 and dx < (dwidth - cn)
    where xofs[dx] + cn < xofs[dwidth-cn] implies dx < (dwidth - cn).
    
    Thus, we can use this to control our loop termination optimally.
    
    This fixes #16137 with little or no performance impact. I have
    also added a debug check as a sanity check.
    c1cdb241
resize.cpp 158 KB