diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2006-07-08 02:43:32 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2006-07-08 02:43:32 +0400 |
commit | 9d82b0dda1ae42e835ef4bc2c38ac1fd2753b781 (patch) | |
tree | 1ac202de9935a8d1197d56f2cf83433d511eb13e /libavutil | |
parent | 5da714699d6e16f3a915fbe2cef9f5e9d8d77172 (diff) |
moving utf8 reading function to libavutil
Originally committed as revision 5664 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/common.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavutil/common.h b/libavutil/common.h index 7187c579c9..ffded89a4c 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -503,6 +503,20 @@ static inline int ff_get_fourcc(const char *s){ level= (level^mask)-mask; #endif +#define GET_UTF8(val, GET_BYTE, ERROR)\ + val= GET_BYTE;\ + {\ + int ones= 7 - av_log2(val ^ 255);\ + if(ones==1)\ + ERROR\ + val&= 127>>ones;\ + while(--ones > 0){\ + int tmp= GET_BYTE - 128;\ + if(tmp>>6)\ + ERROR\ + val= (val<<6) + tmp;\ + }\ + } #if __CPU__ >= 686 && !defined(RUNTIME_CPUDETECT) #define COPY3_IF_LT(x,y,a,b,c,d)\ |