[FFmpeg-devel] [PATCH 03/10] checkasm: Add idctdsp add/put-pixels-clamped tests

Martin Storsjö martin at martin.st
Tue Mar 29 22:56:26 EEST 2022


On Tue, 29 Mar 2022, Martin Storsjö wrote:

> On Fri, 25 Mar 2022, Ben Avison wrote:
>
>> Disable ff_add_pixels_clamped_arm, which was found to fail the test. As 
>> this
>> is normally only used for Arms prior to Armv6 (ARM11) it seems quite 
>> unlikely
>> that anyone is still using this, so I haven't put in the effort to debug 
>> it.
>
> I had a look at this function, and I see that the overflow checks are using
>
>        tst             r6,  #0x100
>
> to see whether the addition overflowed (either above or below). However, if 
> block[] was e.g. 0x200, it's possible to overflow without setting this bit at 
> all.
>
> If it would be the case that the valid range of block[] values would be e.g. 
> [-255,255], then this kind of overflow checking would work though. (As there 
> exists assembly for armv6, then this function probably hasn't been used much 
> in modern times, so this doesn't say much about what values actually are used 
> here.)
>
> Secondly, the clamping seems to be done with
>
>        movne           r6,  r5,  lsr #24
>
> However that should use asr, not lsr, I think, to get proper clamping in both 
> ends?

On second thought, no, lsr #24 should be correct here. But "tst r6, 
#0x100" probably is the main issue, given the range of input values set by 
the current test. No idea what the actual value range is, for the decoders 
that use this function though.

// Martin


More information about the ffmpeg-devel mailing list