summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-12-27 01:27:59 +0100
committerwm4 <wm4@nowhere>2013-01-13 20:04:13 +0100
commit1800761a6501f2c39d65257f707de148a77bca47 (patch)
treea1eb9e047c4aec540ee84c1017f041c50db41aa5 /video
parent61e59cd92c779a4684ebfa554feacc0a4e8d3c78 (diff)
downloadmpv-1800761a6501f2c39d65257f707de148a77bca47.tar.bz2
mpv-1800761a6501f2c39d65257f707de148a77bca47.tar.xz
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.
Diffstat (limited to 'video')
-rw-r--r--video/img_format.c8
-rw-r--r--video/img_format.h1
-rw-r--r--video/mp_image.c1
-rw-r--r--video/mp_image.h1
-rw-r--r--video/out/vo_opengl_old.c6
5 files changed, 5 insertions, 12 deletions
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);