summaryrefslogtreecommitdiffstats
path: root/video/img_format.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/img_format.c')
-rw-r--r--video/img_format.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/video/img_format.c b/video/img_format.c
index 0e35fd72a5..88cd6e80a2 100644
--- a/video/img_format.c
+++ b/video/img_format.c
@@ -203,7 +203,14 @@ static struct mp_imgfmt_desc get_avutil_fmt(enum PixelFormat fmt)
if (desc.num_planes == pd->nb_components)
desc.flags |= MP_IMGFLAG_PLANAR;
- if (desc.flags & MP_IMGFLAG_YUV) {
+ if (!(pd->flags & PIX_FMT_HWACCEL) && !(pd->flags & PIX_FMT_BITSTREAM)) {
+ desc.flags |= MP_IMGFLAG_BYTE_ALIGNED;
+ for (int p = 0; p < desc.num_planes; p++)
+ desc.bytes[p] = desc.bpp[p] / 8;
+ }
+
+ if ((desc.flags & MP_IMGFLAG_YUV) && (desc.flags & MP_IMGFLAG_BYTE_ALIGNED))
+ {
bool same_depth = true;
for (int p = 0; p < desc.num_planes; p++) {
same_depth &= planedepth[p] == planedepth[0] &&
@@ -213,12 +220,6 @@ static struct mp_imgfmt_desc get_avutil_fmt(enum PixelFormat fmt)
desc.flags |= MP_IMGFLAG_YUV_P;
}
- if (!(pd->flags & PIX_FMT_HWACCEL) && !(pd->flags & PIX_FMT_BITSTREAM)) {
- desc.flags |= MP_IMGFLAG_BYTE_ALIGNED;
- for (int p = 0; p < desc.num_planes; p++)
- desc.bytes[p] = desc.bpp[p] / 8;
- }
-
for (int p = 0; p < desc.num_planes; p++) {
desc.xs[p] = (p == 1 || p == 2) ? desc.chroma_xs : 0;
desc.ys[p] = (p == 1 || p == 2) ? desc.chroma_ys : 0;