diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-01-04 06:15:01 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-01-05 03:45:49 +0300 |
commit | 0f931b29f7e969a3c6159cb7173226e806f26f39 (patch) | |
tree | b20f19d7697738fe415025c17afce7c926af07ec /libavutil | |
parent | 9bff052b51f27f6cce04e8d7d8b405c710d7ad67 (diff) |
Factorize avpriv_mirror() out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/internal.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libavutil/internal.h b/libavutil/internal.h index 77af6f9512..0a201424de 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -256,6 +256,19 @@ int avpriv_open(const char *filename, int flags, ...); int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt); +static av_always_inline av_const int avpriv_mirror(int x, int w) +{ + if (!w) + return 0; + + while ((unsigned)x > (unsigned)w) { + x = -x; + if (x < 0) + x += 2 * w; + } + return x; +} + #if FF_API_GET_CHANNEL_LAYOUT_COMPAT uint64_t ff_get_channel_layout(const char *name, int compat); #endif |