aboutsummaryrefslogtreecommitdiff
path: root/image/codecs/indeo/get_bits.h
diff options
context:
space:
mode:
Diffstat (limited to 'image/codecs/indeo/get_bits.h')
-rw-r--r--image/codecs/indeo/get_bits.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/image/codecs/indeo/get_bits.h b/image/codecs/indeo/get_bits.h
index 359d8fcab0..c2d593bfb5 100644
--- a/image/codecs/indeo/get_bits.h
+++ b/image/codecs/indeo/get_bits.h
@@ -54,7 +54,37 @@ public:
* read the longest vlc code
* = (max_vlc_length + bits - 1) / bits
*/
- int getVLC2(int16 (*table)[2], int bits, int maxDepth);
+ template <int maxDepth>
+ int getVLC2(int16 (*table)[2], int bits) {
+ int code;
+ int n, nbBits;
+ unsigned int index;
+
+ index = peekBits(bits);
+ code = table[index][0];
+ n = table[index][1];
+
+ if (maxDepth > 1 && n < 0) {
+ skip(bits);
+ nbBits = -n;
+
+ index = peekBits(nbBits) + code;
+ code = table[index][0];
+ n = table[index][1];
+
+ if (maxDepth > 2 && n < 0) {
+ skip(nbBits);
+ nbBits = -n;
+
+ index = peekBits(nbBits) + code;
+ code = table[index][0];
+ n = table[index][1];
+ }
+ }
+
+ skip(n);
+ return code;
+ }
};
} // End of namespace Indeo