avutil/hwcontext_cuda: fix yuv420p V/U plane overlap in cuda_get_buffer() release/8.1
authornyanmisaka <nst799610810@gmail.com>
Mon, 29 Jun 2026 07:32:00 +0000 (15:32 +0800)
committerMarvin Scholz <epirat07@gmail.com>
Mon, 29 Jun 2026 15:41:14 +0000 (17:41 +0200)
commitce3c09c101c83add623774d414a9f9498caf5c25
tree58866463798f82d08730d81596d2e41b91cb1cb5
parent584952257ae6ec130966b1760a2928fedb016fa8
avutil/hwcontext_cuda: fix yuv420p V/U plane overlap in cuda_get_buffer()

Odd-height yuv420p result in incorrect calculations of the U-plane
address offset. The last row of the V-plane overlapped with and was
overwritten by the first row of the U-plane, leading to chroma artifacts.

```
ffmpeg -init_hw_device cuda=cu -filter_hw_device cu -f lavfi -i \
testsrc=s=1920x1081,format=yuv420p -vf hwupload -c:v hevc_nvenc \
-vframes 1 -y <OUTPUT>
```

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
(cherry picked from commit 3f6bf150cb018334809bec029325b28cff8a5a9a)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
libavutil/hwcontext_cuda.c