From c3788543f55199fc729a49f1402a9e13aaefbd85 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 26 Dec 2012 21:13:58 +0100 Subject: vf_expand: support more image formats This did random things with some image formats, including 10 bit formats. Fixes the mp_image_clear() function too. This still has some caveats: - doesn't clear alpha to opaque (too hard with packed RGB, and is rarely needed) - sets luma to 0 for mpeg-range YUV, instead of the lowest possible value (e.g. 16 for 8 bit) --- video/memcpy_pic.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'video/memcpy_pic.h') diff --git a/video/memcpy_pic.h b/video/memcpy_pic.h index 2def66f3a4..5343739e82 100644 --- a/video/memcpy_pic.h +++ b/video/memcpy_pic.h @@ -70,4 +70,20 @@ static inline void memset_pic(void *dst, int fill, int bytesPerLine, int height, } } +static inline void memset16_pic(void *dst, int fill, int unitsPerLine, + int height, int stride) +{ + if (fill == 0) { + memset_pic(dst, 0, unitsPerLine * 2, height, stride); + } else { + for (int i = 0; i < height; i++) { + uint16_t *line = dst; + uint16_t *end = line + unitsPerLine; + while (line < end) + *line++ = fill; + dst = (uint8_t *)dst + stride; + } + } +} + #endif /* MPLAYER_FASTMEMCPY_H */ -- cgit v1.2.3