[FFmpeg-devel] [PATCH 2/4] checkasm: Implement helpers for defining and checking padded rects

Martin Storsjö martin at martin.st
Tue Apr 1 12:38:24 EEST 2025


On Tue, 1 Apr 2025, Michael Niedermayer wrote:

>>>>  #define DEF_CHECKASM_CHECK_FUNC(type, fmt) \
>>>>  int checkasm_check_##type(const char *file, int line, \
>>>>                            const type *buf1, ptrdiff_t stride1, \
>>>>                            const type *buf2, ptrdiff_t stride2, \
>>>> -                          int w, int h, const char *name) \
>>>> +                          int w, int h, const char *name, \
>>>> +                          int align_w, int align_h, \
>>>> +                          int padding) \
>>>>  { \
>>>
>>>> +    int aligned_w = (w + align_w - 1) & ~(align_w - 1); \
>>>> +    int aligned_h = (h + align_h - 1) & ~(align_h - 1); \
>>>
>>> this can overflow
>>> feel free to fix in a seperate patch
>>
>> Feel free to propose a patch for how you'd prefer to have it fixed then... I
>> don't see this as a real world problem - w and h are bounded by the tests
>> themselves, and likewise the alignments - I don't see us having tests using
>> buffers with a width near INT32_MAX?
>
> maybe but then
> if we want our asm code to handle such extrem cases, something needs to
> test it
>
> ill send a patch based on this: (once your patches are in / minus in case
> i forget)
>
> int64_t aligned_w = (w - 1LL + align_w) & ~(align_w - 1); \
> if (aligned_w != (int32_t)aligned_w)
>    return AVERROR(EINVAL)

Ok, if you find that important.

I'll go ahead and push patches 1-2 and 4 from this set, soon, holding off 
of patch 3/4 while waiting for someone to fix the Loongarch HEVC SIMD.

// Martin



More information about the ffmpeg-devel mailing list