mirror of https://github.com/mpv-player/mpv
img_format: add a mask for color class
Using the term "color class" to avoid confusion with the other colorspace related concepts. Also get rid of MP_IMGFLAG_FMT_MASK, since it was unused.
This commit is contained in:
parent
b606a6ce1a
commit
fcdb681822
|
@ -57,7 +57,9 @@
|
|||
// set if in native (host) endian, or endian independent
|
||||
#define MP_IMGFLAG_NE MP_SELECT_LE_BE(MP_IMGFLAG_LE, MP_IMGFLAG_BE)
|
||||
|
||||
#define MP_IMGFLAG_FMT_MASK 0x3FFF
|
||||
// Exactly one of these bits is set in mp_imgfmt_desc.flags
|
||||
#define MP_IMGFLAG_COLOR_CLASS_MASK \
|
||||
(MP_IMGFLAG_YUV | MP_IMGFLAG_RGB | MP_IMGFLAG_XYZ)
|
||||
|
||||
struct mp_imgfmt_desc {
|
||||
int id; // IMGFMT_*
|
||||
|
|
|
@ -127,10 +127,9 @@ static void mp_image_alloc_planes(struct mp_image *mpi)
|
|||
|
||||
void mp_image_setfmt(struct mp_image *mpi, unsigned int out_fmt)
|
||||
{
|
||||
mpi->flags &= ~MP_IMGFLAG_FMT_MASK;
|
||||
struct mp_imgfmt_desc fmt = mp_imgfmt_get_desc(out_fmt);
|
||||
mpi->fmt = fmt;
|
||||
mpi->flags |= fmt.flags;
|
||||
mpi->flags = fmt.flags;
|
||||
mpi->imgfmt = fmt.id;
|
||||
mpi->chroma_x_shift = fmt.chroma_xs;
|
||||
mpi->chroma_y_shift = fmt.chroma_ys;
|
||||
|
|
|
@ -63,7 +63,7 @@ struct mp_image_params {
|
|||
* image data. mp_image_make_writeable() will do that copy if required.
|
||||
*/
|
||||
typedef struct mp_image {
|
||||
unsigned int flags;
|
||||
unsigned int flags; // same as fmt.flags
|
||||
struct mp_imgfmt_desc fmt;
|
||||
|
||||
// fields redundant to fmt, for convenience or compatibility
|
||||
|
|
Loading…
Reference in New Issue