Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
48f2750d
Commit
48f2750d
authored
Jul 04, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get_bits: add get_bits_le()
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
4e10d87f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
18 deletions
+43
-18
get_bits.h
libavcodec/get_bits.h
+43
-18
No files found.
libavcodec/get_bits.h
View file @
48f2750d
...
...
@@ -139,27 +139,34 @@ typedef struct RL_VLC_ELEM {
#define CLOSE_READER(name, gb) (gb)->index = name ## _index
# ifdef LONG_BITSTREAM_READER
# define UPDATE_CACHE_LE(name, gb) name ## _cache = \
AV_RL64((gb)->buffer + (name ## _index >> 3)) >> (name ## _index & 7)
# define UPDATE_CACHE_BE(name, gb) name ## _cache = \
AV_RB64((gb)->buffer + (name ## _index >> 3)) >> (32 - (name ## _index & 7))
#else
# define UPDATE_CACHE_LE(name, gb) name ## _cache = \
AV_RL32((gb)->buffer + (name ## _index >> 3)) >> (name ## _index & 7)
# define UPDATE_CACHE_BE(name, gb) name ## _cache = \
AV_RB32((gb)->buffer + (name ## _index >> 3)) << (name ## _index & 7)
#endif
#ifdef BITSTREAM_READER_LE
# ifdef LONG_BITSTREAM_READER
# define UPDATE_CACHE(name, gb) name ## _cache = \
AV_RL64((gb)->buffer + (name ## _index >> 3)) >> (name ## _index & 7)
# else
# define UPDATE_CACHE(name, gb) name ## _cache = \
AV_RL32((gb)->buffer + (name ## _index >> 3)) >> (name ## _index & 7)
# endif
# define UPDATE_CACHE(name, gb) UPDATE_CACHE_LE(name, gb)
# define SKIP_CACHE(name, gb, num) name ## _cache >>= (num)
#else
# ifdef LONG_BITSTREAM_READER
# define UPDATE_CACHE(name, gb) name ## _cache = \
AV_RB64((gb)->buffer + (name ## _index >> 3)) >> (32 - (name ## _index & 7))
# else
# define UPDATE_CACHE(name, gb) name ## _cache = \
AV_RB32((gb)->buffer + (name ## _index >> 3)) << (name ## _index & 7)
# endif
# define UPDATE_CACHE(name, gb) UPDATE_CACHE_BE(name, gb)
# define SKIP_CACHE(name, gb, num) name ## _cache <<= (num)
...
...
@@ -180,12 +187,18 @@ typedef struct RL_VLC_ELEM {
#define LAST_SKIP_BITS(name, gb, num) SKIP_COUNTER(name, gb, num)
#define SHOW_UBITS_LE(name, gb, num) zero_extend(name ## _cache, num)
#define SHOW_SBITS_LE(name, gb, num) sign_extend(name ## _cache, num)
#define SHOW_UBITS_BE(name, gb, num) NEG_USR32(name ## _cache, num)
#define SHOW_SBITS_BE(name, gb, num) NEG_SSR32(name ## _cache, num)
#ifdef BITSTREAM_READER_LE
# define SHOW_UBITS(name, gb, num)
zero_extend(name ## _cache
, num)
# define SHOW_SBITS(name, gb, num)
sign_extend(name ## _cache
, num)
# define SHOW_UBITS(name, gb, num)
SHOW_UBITS_LE(name, gb
, num)
# define SHOW_SBITS(name, gb, num)
SHOW_SBITS_LE(name, gb
, num)
#else
# define SHOW_UBITS(name, gb, num)
NEG_USR32(name ## _cache
, num)
# define SHOW_SBITS(name, gb, num)
NEG_SSR32(name ## _cache
, num)
# define SHOW_UBITS(name, gb, num)
SHOW_UBITS_BE(name, gb
, num)
# define SHOW_SBITS(name, gb, num)
SHOW_SBITS_BE(name, gb
, num)
#endif
#define GET_CACHE(name, gb) ((uint32_t) name ## _cache)
...
...
@@ -250,6 +263,18 @@ static inline unsigned int get_bits(GetBitContext *s, int n)
return
tmp
;
}
static
inline
unsigned
int
get_bits_le
(
GetBitContext
*
s
,
int
n
)
{
register
int
tmp
;
OPEN_READER
(
re
,
s
);
av_assert2
(
n
>
0
&&
n
<=
25
);
UPDATE_CACHE_LE
(
re
,
s
);
tmp
=
SHOW_UBITS_LE
(
re
,
s
,
n
);
LAST_SKIP_BITS
(
re
,
s
,
n
);
CLOSE_READER
(
re
,
s
);
return
tmp
;
}
/**
* Show 1-25 bits.
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment