diff options
author | wm4 <wm4@nowhere> | 2012-12-26 21:13:58 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-01-13 20:04:13 +0100 |
commit | c3788543f55199fc729a49f1402a9e13aaefbd85 (patch) | |
tree | bbb7d26875e9dcb03b096e048c18fb256abba00b /video/memcpy_pic.h | |
parent | e16fab8822b8c7fe6b8623d78da449cb2e93eeef (diff) | |
download | mpv-c3788543f55199fc729a49f1402a9e13aaefbd85.tar.bz2 mpv-c3788543f55199fc729a49f1402a9e13aaefbd85.tar.xz |
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)
Diffstat (limited to 'video/memcpy_pic.h')
-rw-r--r-- | video/memcpy_pic.h | 16 |
1 files changed, 16 insertions, 0 deletions
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 */ |