summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-05-11 19:37:16 +0200
committerwm4 <wm4@nowhere>2020-05-11 19:57:34 +0200
commit6db890ebab2839443ddbfc34a4a0246d464bd14f (patch)
treebed087dd0f72b1365fa9ebb69462504db80e4474
parentb5284a68296519480d9d4142880c13a8112feb18 (diff)
downloadmpv-6db890ebab2839443ddbfc34a4a0246d464bd14f.tar.bz2
mpv-6db890ebab2839443ddbfc34a4a0246d464bd14f.tar.xz
video: remove RGB32/BGR32 aliases
They are sort of confusing, and they hide the fact that they have an alpha component. Using the actual formats directly is no problem, sicne these were useful only for big endian systems, something we can't test anyway.
-rw-r--r--sub/draw_bmp.c10
-rw-r--r--sub/osd.h2
-rw-r--r--video/img_format.h9
-rw-r--r--video/out/vo_direct3d.c4
-rw-r--r--video/vdpau.c2
5 files changed, 9 insertions, 18 deletions
diff --git a/sub/draw_bmp.c b/sub/draw_bmp.c
index e1caea1e0a..c411c539b5 100644
--- a/sub/draw_bmp.c
+++ b/sub/draw_bmp.c
@@ -408,13 +408,13 @@ static bool render_rgba(struct mp_draw_sub_cache *p, struct part *part,
if (!scaled) {
struct mp_image src_img = {0};
- mp_image_setfmt(&src_img, IMGFMT_BGR32);
+ mp_image_setfmt(&src_img, IMGFMT_BGRA);
mp_image_set_size(&src_img, sw, sh);
src_img.planes[0] = s_ptr;
src_img.stride[0] = s_stride;
src_img.params.alpha = MP_ALPHA_PREMUL;
- scaled = mp_image_alloc(IMGFMT_BGR32, dw, dh);
+ scaled = mp_image_alloc(IMGFMT_BGRA, dw, dh);
if (!scaled)
return false;
part->imgs[i] = talloc_steal(p, scaled);
@@ -457,7 +457,7 @@ static bool render_sb(struct mp_draw_sub_cache *p, struct sub_bitmaps *sb)
static void clear_rgba_overlay(struct mp_draw_sub_cache *p)
{
- assert(p->rgba_overlay->imgfmt == IMGFMT_BGR32);
+ assert(p->rgba_overlay->imgfmt == IMGFMT_BGRA);
for (int y = 0; y < p->rgba_overlay->h; y++) {
uint32_t *px = mp_image_pixel_ptr(p->rgba_overlay, 0, 0, y);
@@ -519,7 +519,7 @@ static bool reinit(struct mp_draw_sub_cache *p, struct mp_image_params *params)
int overlay_fmt = 0;
if (params->color.space == MP_CSP_RGB && vfdesc.num_planes >= 3) {
// No point in doing anything fancy.
- overlay_fmt = IMGFMT_BGR32;
+ overlay_fmt = IMGFMT_BGRA;
p->scale_in_tiles = false;
} else {
struct mp_regular_imgfmt odesc = vfdesc;
@@ -586,7 +586,7 @@ static bool reinit(struct mp_draw_sub_cache *p, struct mp_image_params *params)
h = MP_ALIGN_UP(h, TILE_H);
}
- p->rgba_overlay = talloc_steal(p, mp_image_alloc(IMGFMT_BGR32, w, h));
+ p->rgba_overlay = talloc_steal(p, mp_image_alloc(IMGFMT_BGRA, w, h));
p->overlay_tmp = talloc_steal(p, mp_image_alloc(render_fmt, SLICE_W, slice_h));
p->video_tmp = talloc_steal(p, mp_image_alloc(vid_f32_fmt, SLICE_W, slice_h));
if (!p->rgba_overlay || !p->overlay_tmp || !p->video_tmp)
diff --git a/sub/osd.h b/sub/osd.h
index 17e3ae0282..9b680b8bf8 100644
--- a/sub/osd.h
+++ b/sub/osd.h
@@ -28,7 +28,7 @@
enum sub_bitmap_format {
SUBBITMAP_EMPTY = 0,// no bitmaps; always has num_parts==0
SUBBITMAP_LIBASS, // A8, with a per-surface blend color (libass.color)
- SUBBITMAP_RGBA, // B8G8R8A8 (MSB=A, LSB=B), scaled, premultiplied alpha
+ SUBBITMAP_RGBA, // IMGFMT_BGRA (MSB=A, LSB=B), scaled, premultiplied alpha
SUBBITMAP_COUNT
};
diff --git a/video/img_format.h b/video/img_format.h
index 158fdb9df9..f3d9750585 100644
--- a/video/img_format.h
+++ b/video/img_format.h
@@ -251,15 +251,6 @@ enum mp_imgfmt {
IMGFMT_AVPIXFMT_END = IMGFMT_AVPIXFMT_START + 500,
IMGFMT_END,
-
- // Redundant format aliases for native endian access
-
- // The IMGFMT_RGB32 and IMGFMT_BGR32 formats provide bit-shift access to
- // normally byte-accessed formats:
- // IMGFMT_RGB32 = r | (g << 8) | (b << 16) | (a << 24)
- // IMGFMT_BGR32 = b | (g << 8) | (r << 16) | (a << 24)
- IMGFMT_RGB32 = MP_SELECT_LE_BE(IMGFMT_RGBA, IMGFMT_ABGR),
- IMGFMT_BGR32 = MP_SELECT_LE_BE(IMGFMT_BGRA, IMGFMT_ARGB),
};
static inline bool IMGFMT_IS_RGB(int fmt)
diff --git a/video/out/vo_direct3d.c b/video/out/vo_direct3d.c
index 455c3faafd..a622921a51 100644
--- a/video/out/vo_direct3d.c
+++ b/video/out/vo_direct3d.c
@@ -211,8 +211,8 @@ static const struct fmt_entry fmt_table[] = {
// packed YUV
{IMGFMT_UYVY, D3DFMT_UYVY},
// packed RGB
- {IMGFMT_BGR32, D3DFMT_X8R8G8B8},
- {IMGFMT_RGB32, D3DFMT_X8B8G8R8},
+ {IMGFMT_BGR0, D3DFMT_X8R8G8B8},
+ {IMGFMT_RGB0, D3DFMT_X8B8G8R8},
{IMGFMT_BGR24, D3DFMT_R8G8B8}, //untested
{IMGFMT_RGB565, D3DFMT_R5G6B5},
// grayscale (can be considered both packed and planar)
diff --git a/video/vdpau.c b/video/vdpau.c
index 6e3d0ac8a9..4701cac85e 100644
--- a/video/vdpau.c
+++ b/video/vdpau.c
@@ -456,7 +456,7 @@ bool mp_vdpau_get_rgb_format(int imgfmt, VdpRGBAFormat *out_rgba_format)
VdpRGBAFormat format = (VdpRGBAFormat)-1;
switch (imgfmt) {
- case IMGFMT_BGR32:
+ case IMGFMT_BGRA:
format = VDP_RGBA_FORMAT_B8G8R8A8; break;
default:
return false;