diff options
author | wm4 <wm4@nowhere> | 2020-05-17 14:57:13 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-05-18 01:54:59 +0200 |
commit | caee8748da5c25b928f699bfa9f1ac4a5f3ae0ce (patch) | |
tree | 492d46f6ab40eee4c5b3e17b3666d21843db4166 /video/img_format.h | |
parent | 00ac63c37b18ef3e7fbe5c227eb10073b264a26a (diff) | |
download | mpv-caee8748da5c25b928f699bfa9f1ac4a5f3ae0ce.tar.bz2 mpv-caee8748da5c25b928f699bfa9f1ac4a5f3ae0ce.tar.xz |
video: clean up some imgfmt related stuff
Remove the vaguely defined plane_bits and component_bits fields from
struct mp_imgfmt_desc. Add weird replacements for existing uses. Remove
the bytes[] field, replace uses with bpp[].
Fix some potential alignment issues in existing code. As a compromise,
split mp_image_pixel_ptr() into 2 functions, because I think it's a bad
idea to implicitly round, but for some callers being slightly less
strict is convenient.
This shouldn't really change anything. In fact, it's a 100% useless
change. I'm just cleaning up what I started almost 8 years ago (see
commit 00653a3eb052). With this I've decided to keep mp_imgfmt_desc,
just removing the weird parts, and keeping the saner parts.
Diffstat (limited to 'video/img_format.h')
-rw-r--r-- | video/img_format.h | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/video/img_format.h b/video/img_format.h index f3d9750585..ea46dbec70 100644 --- a/video/img_format.h +++ b/video/img_format.h @@ -72,11 +72,12 @@ struct mp_imgfmt_desc { int8_t align_x, align_y; // pixel count to get byte alignment and to get // to a pixel pos where luma & chroma aligns // always power of 2 - 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 - int8_t component_bits; // number of bits per component (0 if uneven) + int8_t bpp[MP_MAX_PLANES]; // bits per pixel (may be "average"; the real + // byte value is determined by align_x*bpp/8 + // for align_x pixels) // chroma shifts per plane (provided for convenience with planar formats) + // Packed YUV always uses xs[0]=ys[0]=0, because plane 0 contains luma in + // addition to chroma, and thus is not sub-sampled (uses align_x=2 instead). int8_t xs[MP_MAX_PLANES]; int8_t ys[MP_MAX_PLANES]; }; @@ -253,13 +254,6 @@ enum mp_imgfmt { IMGFMT_END, }; -static inline bool IMGFMT_IS_RGB(int fmt) -{ - struct mp_imgfmt_desc desc = mp_imgfmt_get_desc(fmt); - return (desc.flags & MP_IMGFLAG_RGB) && desc.num_planes == 1; -} - -#define IMGFMT_RGB_DEPTH(fmt) (mp_imgfmt_get_desc(fmt).plane_bits) #define IMGFMT_IS_HWACCEL(fmt) (!!(mp_imgfmt_get_desc(fmt).flags & MP_IMGFLAG_HWACCEL)) int mp_imgfmt_from_name(bstr name); @@ -270,8 +264,6 @@ char **mp_imgfmt_name_list(void); #define vo_format_name mp_imgfmt_to_name -int mp_imgfmt_find(int xs, int ys, int planes, int component_bits, int flags); - int mp_imgfmt_select_best(int dst1, int dst2, int src); int mp_imgfmt_select_best_list(int *dst, int num_dst, int src); |