summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-10-20 01:43:17 +0200
committerwm4 <wm4@nowhere>2019-10-20 01:44:22 +0200
commitfd539a542f04e88a8c5b245cc3c3b80b03c2a4b7 (patch)
tree4d1bd4411fbb732203fd514d159e89bfdb8bdd2d
parentdf8a0ecbf32dd9af914ceb67df1861743b84f1e8 (diff)
downloadmpv-fd539a542f04e88a8c5b245cc3c3b80b03c2a4b7.tar.bz2
mpv-fd539a542f04e88a8c5b245cc3c3b80b03c2a4b7.tar.xz
mp_image: remove old acrobatics in frame copy code
This used to be needed for the "GPU memcpy" (shitty Intel methods to deal with certain uncached memory types). This is now done in FFmpeg, and the code in mp_image.c was just unnecessarily convoluted.
-rw-r--r--video/mp_image.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/video/mp_image.c b/video/mp_image.c
index c15c6b55fc..0cf8c378a1 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -452,10 +452,8 @@ void mp_image_unrefp(struct mp_image **p_img)
*p_img = NULL;
}
-typedef void *(*memcpy_fn)(void *d, const void *s, size_t size);
-
-static void memcpy_pic_cb(void *dst, const void *src, int bytesPerLine, int height,
- int dstStride, int srcStride, memcpy_fn cpy)
+void memcpy_pic(void *dst, const void *src, int bytesPerLine, int height,
+ int dstStride, int srcStride)
{
if (bytesPerLine == dstStride && dstStride == srcStride && height) {
if (srcStride < 0) {
@@ -464,18 +462,17 @@ static void memcpy_pic_cb(void *dst, const void *src, int bytesPerLine, int heig
srcStride = -srcStride;
}
- cpy(dst, src, srcStride * (height - 1) + bytesPerLine);
+ memcpy(dst, src, srcStride * (height - 1) + bytesPerLine);
} else {
for (int i = 0; i < height; i++) {
- cpy(dst, src, bytesPerLine);
+ memcpy(dst, src, bytesPerLine);
src = (uint8_t*)src + srcStride;
dst = (uint8_t*)dst + dstStride;
}
}
}
-static void mp_image_copy_cb(struct mp_image *dst, struct mp_image *src,
- memcpy_fn cpy)
+void mp_image_copy(struct mp_image *dst, struct mp_image *src)
{
assert(dst->imgfmt == src->imgfmt);
assert(dst->w == src->w && dst->h == src->h);
@@ -483,18 +480,13 @@ static void mp_image_copy_cb(struct mp_image *dst, struct mp_image *src,
for (int n = 0; n < dst->num_planes; n++) {
int line_bytes = (mp_image_plane_w(dst, n) * dst->fmt.bpp[n] + 7) / 8;
int plane_h = mp_image_plane_h(dst, n);
- memcpy_pic_cb(dst->planes[n], src->planes[n], line_bytes, plane_h,
- dst->stride[n], src->stride[n], cpy);
+ memcpy_pic(dst->planes[n], src->planes[n], line_bytes, plane_h,
+ dst->stride[n], src->stride[n]);
}
if (dst->fmt.flags & MP_IMGFLAG_PAL)
memcpy(dst->planes[1], src->planes[1], AVPALETTE_SIZE);
}
-void mp_image_copy(struct mp_image *dst, struct mp_image *src)
-{
- mp_image_copy_cb(dst, src, memcpy);
-}
-
static enum mp_csp mp_image_params_get_forced_csp(struct mp_image_params *params)
{
int imgfmt = params->hw_subfmt ? params->hw_subfmt : params->imgfmt;
@@ -1020,12 +1012,6 @@ struct AVFrame *mp_image_to_av_frame_and_unref(struct mp_image *img)
return frame;
}
-void memcpy_pic(void *dst, const void *src, int bytesPerLine, int height,
- int dstStride, int srcStride)
-{
- memcpy_pic_cb(dst, src, bytesPerLine, height, dstStride, srcStride, memcpy);
-}
-
void memset_pic(void *dst, int fill, int bytesPerLine, int height, int stride)
{
if (bytesPerLine == stride && height) {