From 1800761a6501f2c39d65257f707de148a77bca47 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 27 Dec 2012 01:27:59 +0100 Subject: mp_image: remove mp_image.bpp This field contained the "average" bit depth per pixel. It serves no purpose anymore. Remove it. Only vo_opengl_old still uses this in order to allocate a buffer that is shared between all planes. --- video/img_format.c | 8 -------- video/img_format.h | 1 - video/mp_image.c | 1 - video/mp_image.h | 1 - video/out/vo_opengl_old.c | 6 +++++- 5 files changed, 5 insertions(+), 12 deletions(-) (limited to 'video') diff --git a/video/img_format.c b/video/img_format.c index 3427bb49d2..0e35fd72a5 100644 --- a/video/img_format.c +++ b/video/img_format.c @@ -158,8 +158,6 @@ static struct mp_imgfmt_desc get_avutil_fmt(enum PixelFormat fmt) }; int planedepth[4] = {0}; - int xs[4] = {0, pd->log2_chroma_w, pd->log2_chroma_w, 0}; - int ys[4] = {0, pd->log2_chroma_h, pd->log2_chroma_h, 0}; int el_size = (pd->flags & PIX_FMT_BITSTREAM) ? 1 : 8; for (int c = 0; c < pd->nb_components; c++) { AVComponentDescriptor d = pd->comp[c]; @@ -169,12 +167,6 @@ static struct mp_imgfmt_desc get_avutil_fmt(enum PixelFormat fmt) planedepth[d.plane] += d.depth_minus1 + 1; } - int avgbpp16 = 0; - for (int p = 0; p < 4; p++) - avgbpp16 += (16 * desc.bpp[p]) >> xs[p] >> ys[p]; - desc.avg_bpp = avgbpp16 / 16; - //assert(desc.avg_bpp == av_get_padded_bits_per_pixel(pd)); - for (int p = 0; p < 4; p++) { if (desc.bpp[p]) desc.num_planes++; diff --git a/video/img_format.h b/video/img_format.h index 6512cbf244..f09c3f55d7 100644 --- a/video/img_format.h +++ b/video/img_format.h @@ -66,7 +66,6 @@ struct mp_imgfmt_desc { int8_t chroma_xs, chroma_ys; // chroma shift (i.e. log2 of chroma pixel size) int8_t align_x, align_y; // pixel size to get byte alignment and to get // to a pixel pos where luma & chroma aligns - int8_t avg_bpp; int8_t bytes[MP_MAX_PLANES]; // bytes per pixel (MP_IMGFLAG_BYTE_ALIGNED) int8_t bpp[MP_MAX_PLANES]; // bits per pixel int8_t plane_bits; // number of bits in use for plane 0 diff --git a/video/mp_image.c b/video/mp_image.c index 832dec98fd..dd58f131a8 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -129,7 +129,6 @@ void mp_image_setfmt(struct mp_image *mpi, unsigned int out_fmt) mpi->fmt = fmt; mpi->flags |= fmt.flags; mpi->imgfmt = fmt.id; - mpi->bpp = fmt.avg_bpp; mpi->chroma_x_shift = fmt.chroma_xs; mpi->chroma_y_shift = fmt.chroma_ys; mpi->num_planes = fmt.num_planes; diff --git a/video/mp_image.h b/video/mp_image.h index dd2c451a0b..d51996c226 100644 --- a/video/mp_image.h +++ b/video/mp_image.h @@ -58,7 +58,6 @@ typedef struct mp_image { struct mp_imgfmt_desc fmt; // fields redundant to fmt, for convenience or compatibility - unsigned char bpp; // bits/pixel. NOT depth! for RGB it will be n*8 unsigned int imgfmt; int num_planes; int chroma_x_shift; // horizontal diff --git a/video/out/vo_opengl_old.c b/video/out/vo_opengl_old.c index 5cfe306f8e..d010daacb9 100644 --- a/video/out/vo_opengl_old.c +++ b/video/out/vo_opengl_old.c @@ -610,7 +610,11 @@ static bool get_image(struct vo *vo, mp_image_t *mpi, int *th, bool *cplane) width = p->texture_width; height = p->texture_height; } - mpi->stride[0] = width * mpi->bpp / 8; + int avgbpp16 = 0; + for (int p = 0; p < 4; p++) + avgbpp16 += (16 * mpi->fmt.bpp[p]) >> mpi->fmt.xs[p] >> mpi->fmt.ys[p]; + int avgbpp = avgbpp16 / 16; + mpi->stride[0] = width * avgbpp / 8; needed_size = mpi->stride[0] * height; if (!p->buffer) gl->GenBuffers(1, &p->buffer); -- cgit v1.2.3