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.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/video/mp_image.c b/video/mp_image.c
index b5780b08a0..f846b0d3d3 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -265,6 +265,19 @@ struct mp_image *mp_image_alloc(int imgfmt, int w, int h)
return mpi;
}
+int mp_image_approx_byte_size(struct mp_image *img)
+{
+ int total = sizeof(*img);
+
+ for (int n = 0; n < MP_MAX_PLANES; n++) {
+ struct AVBufferRef *buf = img->bufs[n];
+ if (buf)
+ total += buf->size;
+ }
+
+ return total;
+}
+
struct mp_image *mp_image_new_copy(struct mp_image *img)
{
struct mp_image *new = mp_image_alloc(img->imgfmt, img->w, img->h);