[FFmpeg-devel] [PATCH 1/3] avcodec/x86/vvc/vvc_alf: fix integer overflow

Ronald S. Bultje rsbultje at gmail.com
Wed May 29 20:51:11 EEST 2024


Hi,

On Wed, May 29, 2024 at 11:38 AM <toqsxw at outlook.com> wrote:

> +%else
> +    vpunpcklqdq      m11, m2, m2
> +    vpunpckhqdq      m12, m2, m2
> +    vpunpcklwd       m11, m11, m14
> +    vpunpcklwd       m12, m12, m14
> +    paddd             m0, m11
> +    paddd             m1, m12
> +    packssdw          m0, m0, m1
> +%endif
>

punpcklqdq a, src, src
punpckhqdq b, src, src
punpcklwd a, a, zero
punpcklwd b, b, zero

is the same as

punpcklwd a, src, zero
punpckhwd b, src, zero

Also, the whole thing just emulates a saturated add. Can't you use paddsw
instead of paddw and be done with it? To add to Andreas' question: is
saturating here normatively required?

Ronald


More information about the ffmpeg-devel mailing list