mirror of
https://github.com/mpv-player/mpv
synced 2024-11-03 03:19:24 +01:00
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.
This commit is contained in:
parent
61e59cd92c
commit
1800761a65
@ -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++;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user