diff --git a/libmpcodecs/vf_fspp.c b/libmpcodecs/vf_fspp.c index 89b63ad701..4e328ea36e 100644 --- a/libmpcodecs/vf_fspp.c +++ b/libmpcodecs/vf_fspp.c @@ -531,8 +531,8 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts) vf->priv->mpeg2= mpi->qscale_type; if(mpi->pict_type != 3 && mpi->qscale && !vf->priv->qp){ if(!vf->priv->non_b_qp) - vf->priv->non_b_qp= malloc(mpi->qstride * mpi->h); - memcpy(vf->priv->non_b_qp, mpi->qscale, mpi->qstride * mpi->h); + vf->priv->non_b_qp= malloc(mpi->qstride * ((mpi->h + 15) >> 4)); + memcpy(vf->priv->non_b_qp, mpi->qscale, mpi->qstride * ((mpi->h + 15) >> 4)); } if(vf->priv->log2_count || !(mpi->flags&MP_IMGFLAG_DIRECT)){ char *qp_tab= vf->priv->non_b_qp; diff --git a/libmpcodecs/vf_spp.c b/libmpcodecs/vf_spp.c index b70b29ecd4..dd6ca5a2b1 100644 --- a/libmpcodecs/vf_spp.c +++ b/libmpcodecs/vf_spp.c @@ -477,8 +477,8 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ vf->priv->mpeg2= mpi->qscale_type; if(mpi->pict_type != 3 && mpi->qscale && !vf->priv->qp){ if(!vf->priv->non_b_qp) - vf->priv->non_b_qp= malloc(mpi->qstride * mpi->h); - memcpy(vf->priv->non_b_qp, mpi->qscale, mpi->qstride * mpi->h); + vf->priv->non_b_qp= malloc(mpi->qstride * ((mpi->h + 15) >> 4)); + memcpy(vf->priv->non_b_qp, mpi->qscale, mpi->qstride * ((mpi->h + 15) >> 4)); } if(vf->priv->log2_count || !(mpi->flags&MP_IMGFLAG_DIRECT)){ char *qp_tab= vf->priv->non_b_qp;