mirror of
https://github.com/mpv-player/mpv
synced 2024-12-27 09:32:40 +00:00
mp_image: remove redundant flags field
Because gcc (and clang) is a goddamn PITA and unnecessarily warns if the universal initializer for structs is used (like mp_image x = {}) and the first member of the struct is also a struct, move the w/h fields to the top.
This commit is contained in:
parent
41151122e7
commit
37a71e57d4
@ -295,7 +295,7 @@ static void draw_ass(struct mp_draw_sub_cache *cache, struct mp_rect bb,
|
||||
cspar.int_bits_out = 8;
|
||||
|
||||
struct mp_cmat yuv2rgb, rgb2yuv;
|
||||
bool need_conv = temp->flags & MP_IMGFLAG_YUV;
|
||||
bool need_conv = temp->fmt.flags & MP_IMGFLAG_YUV;
|
||||
if (need_conv) {
|
||||
mp_get_yuv2rgb_coeffs(&cspar, &yuv2rgb);
|
||||
mp_invert_yuv2rgb(&rgb2yuv, &yuv2rgb);
|
||||
@ -470,7 +470,7 @@ static struct mp_image *chroma_up(struct mp_draw_sub_cache *cache, int imgfmt,
|
||||
|
||||
// The temp image is always YUV, but src not necessarily.
|
||||
// Reduce amount of conversions in YUV case (upsampling/shifting only)
|
||||
if (src->flags & MP_IMGFLAG_YUV) {
|
||||
if (src->fmt.flags & MP_IMGFLAG_YUV) {
|
||||
temp->params.colorspace = src->params.colorspace;
|
||||
temp->params.colorlevels = src->params.colorlevels;
|
||||
}
|
||||
|
@ -146,7 +146,6 @@ void mp_image_setfmt(struct mp_image *mpi, int out_fmt)
|
||||
struct mp_imgfmt_desc fmt = mp_imgfmt_get_desc(out_fmt);
|
||||
mpi->params.imgfmt = fmt.id;
|
||||
mpi->fmt = fmt;
|
||||
mpi->flags = fmt.flags;
|
||||
mpi->imgfmt = fmt.id;
|
||||
mpi->num_planes = fmt.num_planes;
|
||||
mp_image_set_size(mpi, mpi->w, mpi->h);
|
||||
@ -358,7 +357,7 @@ void mp_image_copy_attributes(struct mp_image *dst, struct mp_image *src)
|
||||
}
|
||||
dst->params.primaries = src->params.primaries;
|
||||
dst->params.gamma = src->params.gamma;
|
||||
if ((dst->flags & MP_IMGFLAG_YUV) == (src->flags & MP_IMGFLAG_YUV)) {
|
||||
if ((dst->fmt.flags & MP_IMGFLAG_YUV) == (src->fmt.flags & MP_IMGFLAG_YUV)) {
|
||||
dst->params.colorspace = src->params.colorspace;
|
||||
dst->params.colorlevels = src->params.colorlevels;
|
||||
dst->params.chroma_location = src->params.chroma_location;
|
||||
@ -414,9 +413,9 @@ void mp_image_clear(struct mp_image *img, int x0, int y0, int x1, int y1)
|
||||
plane_clear[0] = av_le2ne16(0x0080);
|
||||
} else if (area.imgfmt == IMGFMT_NV12 || area.imgfmt == IMGFMT_NV21) {
|
||||
plane_clear[1] = 0x8080;
|
||||
} else if (area.flags & MP_IMGFLAG_YUV_P) {
|
||||
} else if (area.fmt.flags & MP_IMGFLAG_YUV_P) {
|
||||
uint16_t chroma_clear = (1 << area.fmt.plane_bits) / 2;
|
||||
if (!(area.flags & MP_IMGFLAG_NE))
|
||||
if (!(area.fmt.flags & MP_IMGFLAG_NE))
|
||||
chroma_clear = av_bswap16(chroma_clear);
|
||||
if (area.num_planes > 2)
|
||||
plane_clear[1] = plane_clear[2] = chroma_clear;
|
||||
|
@ -77,7 +77,7 @@ struct mp_image_params {
|
||||
* image data. mp_image_make_writeable() will do that copy if required.
|
||||
*/
|
||||
typedef struct mp_image {
|
||||
unsigned int flags; // same as fmt.flags
|
||||
int w, h; // visible dimensions (redundant with params.w/h)
|
||||
|
||||
struct mp_image_params params;
|
||||
|
||||
@ -86,7 +86,6 @@ typedef struct mp_image {
|
||||
enum mp_imgfmt imgfmt;
|
||||
int num_planes;
|
||||
|
||||
int w,h; // visible dimensions
|
||||
uint8_t *planes[MP_MAX_PLANES];
|
||||
int stride[MP_MAX_PLANES];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user