mirror of
https://github.com/mpv-player/mpv
synced 2025-01-20 22:40:52 +00:00
vf_divtc, vf_phase: Fix handling of subsampled formats
These filters incorrectly calculated the amount of bytes per line in each plane for chroma subsampled formats, causing undefined behavior.
This commit is contained in:
parent
23bbbed06d
commit
f8d32b03bf
@ -202,8 +202,9 @@ static int imgop(int(*planeop)(unsigned char *, unsigned char *,
|
||||
int sum = 0;
|
||||
for (int p = 0; p < dst->num_planes; p++) {
|
||||
sum += planeop(dst->planes[p], src ? src->planes[p] : NULL,
|
||||
dst->w * (dst->fmt.bpp[p] / 8), dst->plane_h[p],
|
||||
dst->stride[p], src ? src->stride[p] : 0, arg);
|
||||
(dst->w * dst->fmt.bytes[p]) >> dst->fmt.xs[p],
|
||||
dst->plane_h[p], dst->stride[p],
|
||||
src ? src->stride[p] : 0, arg);
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi)
|
||||
|
||||
int pw[MP_MAX_PLANES] = {0};
|
||||
for (int p = 0; p < mpi->num_planes; p++)
|
||||
pw[p] = (mpi->w * mpi->fmt.bpp[p] + 7) / 8;
|
||||
pw[p] = ((mpi->w * mpi->fmt.bpp[p] + 7) / 8) >> mpi->fmt.xs[p];
|
||||
|
||||
mode=vf->priv->mode;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user