summaryrefslogtreecommitdiffstats
path: root/video/mp_image.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/mp_image.c')
-rw-r--r--video/mp_image.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/video/mp_image.c b/video/mp_image.c
index 765289f8ff..45e5330947 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -41,6 +41,14 @@
#define HAVE_OPAQUE_REF (LIBAVUTIL_VERSION_MICRO >= 100 && \
LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(55, 47, 100))
+const struct m_opt_choice_alternatives mp_spherical_names[] = {
+ {"auto", MP_SPHERICAL_AUTO},
+ {"none", MP_SPHERICAL_NONE},
+ {"unknown", MP_SPHERICAL_UNKNOWN},
+ {"equirect", MP_SPHERICAL_EQUIRECTANGULAR},
+ {0}
+};
+
// Determine strides, plane sizes, and total required size for an image
// allocation. Returns total size on success, <0 on error. Unused planes
// have out_stride/out_plane_size to 0, and out_plane_offset set to -1 up
@@ -525,6 +533,7 @@ void mp_image_copy_attributes(struct mp_image *dst, struct mp_image *src)
dst->params.color.levels = src->params.color.levels;
dst->params.chroma_location = src->params.chroma_location;
}
+ dst->params.spherical = src->params.spherical;
mp_image_params_guess_csp(&dst->params); // ensure colorspace consistency
if ((dst->fmt.flags & MP_IMGFLAG_PAL) && (src->fmt.flags & MP_IMGFLAG_PAL)) {
if (dst->planes[1] && src->planes[1]) {
@@ -657,6 +666,12 @@ char *mp_image_params_to_str_buf(char *b, size_t bs,
MP_STEREO3D_NAME_DEF(p->stereo_in, "?"),
MP_STEREO3D_NAME_DEF(p->stereo_out, "?"));
}
+ if (p->spherical.type != MP_SPHERICAL_NONE) {
+ const float *a = p->spherical.ref_angles;
+ mp_snprintf_cat(b, bs, " (%s %f/%f/%f)",
+ m_opt_choice_str(mp_spherical_names, p->spherical.type),
+ a[0], a[1], a[2]);
+ }
} else {
snprintf(b, bs, "???");
}
@@ -691,6 +706,16 @@ bool mp_image_params_valid(const struct mp_image_params *p)
return true;
}
+static bool mp_spherical_equal(const struct mp_spherical_params *p1,
+ const struct mp_spherical_params *p2)
+{
+ for (int n = 0; n < 3; n++) {
+ if (p1->ref_angles[n] != p2->ref_angles[n])
+ return false;
+ }
+ return p1->type == p2->type;
+}
+
bool mp_image_params_equal(const struct mp_image_params *p1,
const struct mp_image_params *p2)
{
@@ -702,7 +727,8 @@ bool mp_image_params_equal(const struct mp_image_params *p1,
p1->chroma_location == p2->chroma_location &&
p1->rotate == p2->rotate &&
p1->stereo_in == p2->stereo_in &&
- p1->stereo_out == p2->stereo_out;
+ p1->stereo_out == p2->stereo_out &&
+ mp_spherical_equal(&p1->spherical, &p2->spherical);
}
// Set most image parameters, but not image format or size.