static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) { mp_image_crop(mpi, vf->priv->crop_x, vf->priv->crop_y, vf->priv->crop_x + vf->priv->crop_w, vf->priv->crop_y + vf->priv->crop_h); return mpi; }
static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) { int e_x = vf->priv->exp_x, e_y = vf->priv->exp_y; int e_w = vf->priv->exp_w, e_h = vf->priv->exp_h; if (e_x == 0 && e_y == 0 && e_w == mpi->w && e_h == mpi->h) return mpi; struct mp_image *dmpi = vf_alloc_out_image(vf); mp_image_copy_attributes(dmpi, mpi); struct mp_image cropped = *dmpi; mp_image_crop(&cropped, e_x, e_y, e_x + mpi->w, e_y + mpi->h); mp_image_copy(&cropped, mpi); int e_x2 = e_x + MP_ALIGN_DOWN(mpi->w, mpi->fmt.align_x); int e_y2 = e_y + MP_ALIGN_DOWN(mpi->h, mpi->fmt.align_y); // top border (over the full width) mp_image_clear(dmpi, 0, 0, e_w, e_y); // bottom border (over the full width) mp_image_clear(dmpi, 0, e_y2, e_w, e_h); // left mp_image_clear(dmpi, 0, e_y, e_x, e_y2); // right mp_image_clear(dmpi, e_x2, e_y, e_w, e_y2); talloc_free(mpi); return dmpi; }
static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) { if (mpi->fmt.flags & MP_IMGFLAG_HWACCEL) { mp_image_set_size(mpi, vf->fmt_out.w, vf->fmt_out.h); } else { mp_image_crop(mpi, vf->priv->crop_x, vf->priv->crop_y, vf->priv->crop_x + vf->priv->crop_w, vf->priv->crop_y + vf->priv->crop_h); } return mpi; }