summaryrefslogtreecommitdiffstats
path: root/libmpv/render.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-08-20 20:37:17 +0200
committerwm4 <wm4@nowhere>2020-08-20 20:37:17 +0200
commitb16a6cb6c62657d3efbe69bd854287da149b59a1 (patch)
treefdc6b6d6d55900ad91ef2798150cb1f8a1e8e3d2 /libmpv/render.h
parent30dcfbc9cb3f77dbb729fb6f95ffde7dbdddc4cb (diff)
downloadmpv-b16a6cb6c62657d3efbe69bd854287da149b59a1.tar.bz2
mpv-b16a6cb6c62657d3efbe69bd854287da149b59a1.tar.xz
client API: note about libswscale corrupting memory
The software rendering API makes libswscale directly write into supplied user memory. As such, weird memory corruption bugs on non-optimal buffer configurations are exposed to the user.
Diffstat (limited to 'libmpv/render.h')
-rw-r--r--libmpv/render.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/libmpv/render.h b/libmpv/render.h
index c9a6cec65e..ead462cbb6 100644
--- a/libmpv/render.h
+++ b/libmpv/render.h
@@ -390,7 +390,13 @@ typedef enum mpv_render_param_type {
* target surface. It must be a multiple of the pixel size, and have space
* for the surface width as specified by MPV_RENDER_PARAM_SW_SIZE.
*
- * It should be a multiple of 64 to facilitate fast SIMD operation.
+ * It should be a multiple of 64 to facilitate fast SIMD operation. Lower
+ * alignment might trigger slower code paths. In addition, it appears that
+ * if libswscale is used, stride must be at least a multiple of 16, or
+ * libswscale may randomly corrupt memory. The API still accepts unaligned
+ * values, because libswscale is not supposed to corrupt memory, and whether
+ * it does depends on its implementation details and bugs. If mpv is built
+ * with zimg (and zimg is not disabled), no problems should occur.
*/
MPV_RENDER_PARAM_SW_STRIDE = 19,
/*
@@ -407,6 +413,9 @@ typedef enum mpv_render_param_type {
* will do it anyway). It is assumed that even the padding after the last
* line (starting at bytepos(w, h) until (pointer + stride * h)) is
* writable.
+ *
+ * It should be a aligned to 64 to facilitate fast SIMD operation. Lower
+ * alignment might trigger slower code paths.
*/
MPV_RENDER_PARAM_SW_POINTER = 20,
} mpv_render_param_type;