summaryrefslogtreecommitdiff
path: root/vp9/decoder/vp9_dboolhuff.h
diff options
context:
space:
mode:
authorDmitry Kovalev <dkovalev@google.com>2013-03-27 14:22:30 -0700
committerDmitry Kovalev <dkovalev@google.com>2013-03-27 14:22:30 -0700
commit180cd5faa52e00a77df13da15d846cfd909fc531 (patch)
tree49fea9b1daf6f461ae24c4e180927e7381906730 /vp9/decoder/vp9_dboolhuff.h
parent648f93d59db8ff490347f2fc4b1b47b263729578 (diff)
downloadlibvpx-180cd5faa52e00a77df13da15d846cfd909fc531.tar
libvpx-180cd5faa52e00a77df13da15d846cfd909fc531.tar.gz
libvpx-180cd5faa52e00a77df13da15d846cfd909fc531.tar.bz2
libvpx-180cd5faa52e00a77df13da15d846cfd909fc531.zip
General code cleanup.
Removing redundant code, lower case variable names, better indentation, better parameter names, adding const to readonly parameters. Change-Id: Ibfdee00f60316fdc5b3f024028c7aaa76a627483
Diffstat (limited to 'vp9/decoder/vp9_dboolhuff.h')
-rw-r--r--vp9/decoder/vp9_dboolhuff.h38
1 files changed, 16 insertions, 22 deletions
diff --git a/vp9/decoder/vp9_dboolhuff.h b/vp9/decoder/vp9_dboolhuff.h
index eeb5c35d4..02ae1d3c8 100644
--- a/vp9/decoder/vp9_dboolhuff.h
+++ b/vp9/decoder/vp9_dboolhuff.h
@@ -88,34 +88,28 @@ static int decode_value(BOOL_DECODER *br, int bits) {
int bit;
for (bit = bits - 1; bit >= 0; bit--) {
- z |= (decode_bool(br, 0x80) << bit);
+ z |= decode_bool(br, 0x80) << bit;
}
return z;
}
static int bool_error(BOOL_DECODER *br) {
- /* Check if we have reached the end of the buffer.
- *
- * Variable 'count' stores the number of bits in the 'value' buffer, minus
- * 8. The top byte is part of the algorithm, and the remainder is buffered
- * to be shifted into it. So if count == 8, the top 16 bits of 'value' are
- * occupied, 8 for the algorithm and 8 in the buffer.
- *
- * When reading a byte from the user's buffer, count is filled with 8 and
- * one byte is filled into the value buffer. When we reach the end of the
- * data, count is additionally filled with VP9_LOTS_OF_BITS. So when
- * count == VP9_LOTS_OF_BITS - 1, the user's data has been exhausted.
- */
- if ((br->count > VP9_BD_VALUE_SIZE) && (br->count < VP9_LOTS_OF_BITS)) {
- /* We have tried to decode bits after the end of
- * stream was encountered.
- */
- return 1;
- }
-
- /* No error. */
- return 0;
+ // Check if we have reached the end of the buffer.
+ //
+ // Variable 'count' stores the number of bits in the 'value' buffer, minus
+ // 8. The top byte is part of the algorithm, and the remainder is buffered
+ // to be shifted into it. So if count == 8, the top 16 bits of 'value' are
+ // occupied, 8 for the algorithm and 8 in the buffer.
+ //
+ // When reading a byte from the user's buffer, count is filled with 8 and
+ // one byte is filled into the value buffer. When we reach the end of the
+ // data, count is additionally filled with VP9_LOTS_OF_BITS. So when
+ // count == VP9_LOTS_OF_BITS - 1, the user's data has been exhausted.
+ //
+ // 1 if we have tried to decode bits after the end of stream was encountered.
+ // 0 No error.
+ return br->count > VP9_BD_VALUE_SIZE && br->count < VP9_LOTS_OF_BITS;
}
int vp9_decode_unsigned_max(BOOL_DECODER *br, int max);