mirror of
https://github.com/mpv-player/mpv
synced 2025-01-02 04:42:10 +00:00
mp_image: remove redundant chroma_x/y_shift fields
This commit is contained in:
parent
b3495d9ccf
commit
41151122e7
@ -334,13 +334,13 @@ static void draw_ass(struct mp_draw_sub_cache *cache, struct mp_rect bb,
|
||||
static void get_swscale_alignment(const struct mp_image *img, int *out_xstep,
|
||||
int *out_ystep)
|
||||
{
|
||||
int sx = (1 << img->chroma_x_shift);
|
||||
int sy = (1 << img->chroma_y_shift);
|
||||
int sx = (1 << img->fmt.chroma_xs);
|
||||
int sy = (1 << img->fmt.chroma_ys);
|
||||
|
||||
for (int p = 0; p < img->num_planes; ++p) {
|
||||
int bits = img->fmt.bpp[p];
|
||||
// the * 2 fixes problems with writing past the destination width
|
||||
while (((sx >> img->chroma_x_shift) * bits) % (SWS_MIN_BYTE_ALIGN * 8 * 2))
|
||||
while (((sx >> img->fmt.chroma_xs) * bits) % (SWS_MIN_BYTE_ALIGN * 8 * 2))
|
||||
sx *= 2;
|
||||
}
|
||||
|
||||
|
@ -82,11 +82,11 @@ static void set_imgprop(struct vf_dlopen_picdata *out, const mp_image_t *mpi)
|
||||
out->plane[i] = mpi->planes[i];
|
||||
out->planestride[i] = mpi->stride[i];
|
||||
out->planewidth[i] =
|
||||
i ? (/*mpi->chroma_width*/ mpi->w >> mpi->chroma_x_shift) : mpi->w;
|
||||
i ? (/*mpi->chroma_width*/ mpi->w >> mpi->fmt.chroma_xs) : mpi->w;
|
||||
out->planeheight[i] =
|
||||
i ? (/*mpi->chroma_height*/ mpi->h >> mpi->chroma_y_shift) : mpi->h;
|
||||
out->planexshift[i] = i ? mpi->chroma_x_shift : 0;
|
||||
out->planeyshift[i] = i ? mpi->chroma_y_shift : 0;
|
||||
i ? (/*mpi->chroma_height*/ mpi->h >> mpi->fmt.chroma_ys) : mpi->h;
|
||||
out->planexshift[i] = i ? mpi->fmt.chroma_xs : 0;
|
||||
out->planeyshift[i] = i ? mpi->fmt.chroma_ys : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,8 +191,8 @@ static struct mp_image *filter(struct vf_instance *vf, struct mp_image *src)
|
||||
if ((eq2->buf_w[0] != src->w) || (eq2->buf_h[0] != src->h)) {
|
||||
eq2->buf_w[0] = src->w;
|
||||
eq2->buf_h[0] = src->h;
|
||||
eq2->buf_w[1] = eq2->buf_w[2] = src->w >> src->chroma_x_shift;
|
||||
eq2->buf_h[1] = eq2->buf_h[2] = src->h >> src->chroma_y_shift;
|
||||
eq2->buf_w[1] = eq2->buf_w[2] = src->w >> src->fmt.chroma_xs;
|
||||
eq2->buf_h[1] = eq2->buf_h[2] = src->h >> src->fmt.chroma_ys;
|
||||
img_n = eq2->buf_w[0]*eq2->buf_h[0];
|
||||
if(src->num_planes>1){
|
||||
img_c = eq2->buf_w[1]*eq2->buf_h[1];
|
||||
|
@ -148,8 +148,6 @@ void mp_image_setfmt(struct mp_image *mpi, int out_fmt)
|
||||
mpi->fmt = fmt;
|
||||
mpi->flags = fmt.flags;
|
||||
mpi->imgfmt = fmt.id;
|
||||
mpi->chroma_x_shift = fmt.chroma_xs;
|
||||
mpi->chroma_y_shift = fmt.chroma_ys;
|
||||
mpi->num_planes = fmt.num_planes;
|
||||
mp_image_set_size(mpi, mpi->w, mpi->h);
|
||||
}
|
||||
|
@ -85,8 +85,6 @@ typedef struct mp_image {
|
||||
struct mp_imgfmt_desc fmt;
|
||||
enum mp_imgfmt imgfmt;
|
||||
int num_planes;
|
||||
int chroma_x_shift; // horizontal
|
||||
int chroma_y_shift; // vertical
|
||||
|
||||
int w,h; // visible dimensions
|
||||
uint8_t *planes[MP_MAX_PLANES];
|
||||
|
Loading…
Reference in New Issue
Block a user