aboutsummaryrefslogtreecommitdiff
path: root/util/cbfstool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderOpt.h
diff options
context:
space:
mode:
authorPeter Stuge <peter@stuge.se>2009-04-14 00:08:34 +0000
committerPeter Stuge <peter@stuge.se>2009-04-14 00:08:34 +0000
commit1d862ded11d4a2ca42d3d0aff4ea947dd28bcb68 (patch)
treed1ffd93a52e3b218827ac85fb19fb5bd51140044 /util/cbfstool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderOpt.h
parent450b23fb2ea2f08bd2e1343e0ce34ea72f19c4a9 (diff)
v2/util: romfs -> cbfs rename
It's all sed here. romfs->cbfs, ROMFS->CBFS, romtool->cbfstool Signed-off-by: Peter Stuge <peter@stuge.se> Acked-by: Ronald G. Minnich <rminnich@gmail.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4110 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/cbfstool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderOpt.h')
-rw-r--r--util/cbfstool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderOpt.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/util/cbfstool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderOpt.h b/util/cbfstool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderOpt.h
new file mode 100644
index 0000000000..829fc83d77
--- /dev/null
+++ b/util/cbfstool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderOpt.h
@@ -0,0 +1,31 @@
+// Compress/RangeCoder/RangeCoderOpt.h
+
+#ifndef __COMPRESS_RANGECODER_OPT_H
+#define __COMPRESS_RANGECODER_OPT_H
+
+#define RC_INIT_VAR \
+ UInt32 range = rangeDecoder->Range; \
+ UInt32 code = rangeDecoder->Code;
+
+#define RC_FLUSH_VAR \
+ rangeDecoder->Range = range; \
+ rangeDecoder->Code = code;
+
+#define RC_NORMALIZE \
+ if (range < NCompress::NRangeCoder::kTopValue) \
+ { code = (code << 8) | rangeDecoder->Stream.ReadByte(); range <<= 8; }
+
+#define RC_GETBIT2(numMoveBits, prob, mi, A0, A1) \
+ { UInt32 bound = (range >> NCompress::NRangeCoder::kNumBitModelTotalBits) * prob; \
+ if (code < bound) \
+ { A0; range = bound; \
+ prob += (NCompress::NRangeCoder::kBitModelTotal - prob) >> numMoveBits; \
+ mi <<= 1; } \
+ else \
+ { A1; range -= bound; code -= bound; prob -= (prob) >> numMoveBits; \
+ mi = (mi + mi) + 1; }} \
+ RC_NORMALIZE
+
+#define RC_GETBIT(numMoveBits, prob, mi) RC_GETBIT2(numMoveBits, prob, mi, ; , ;)
+
+#endif