ref: a4e14d7f9f3f13296090501690522e2daf56b0fa
parent: 33fffc155e3c7cfdf53de347d0c7355edb4a695c
parent: e5e15eb38e015e2d56109dc977070e64c03dc2c7
author: Dmitry Kovalev <[email protected]>
date: Mon Jul 1 10:58:20 EDT 2013
Merge "Adding vp9_rb_read_signed_literal function."
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -491,19 +491,13 @@
if (xd->mode_ref_lf_delta_update) {
int i;
- for (i = 0; i < MAX_REF_LF_DELTAS; i++) {
- if (vp9_rb_read_bit(rb)) {
- const int value = vp9_rb_read_literal(rb, 6);
- xd->ref_lf_deltas[i] = vp9_rb_read_bit(rb) ? -value : value;
- }
- }
+ for (i = 0; i < MAX_REF_LF_DELTAS; i++)
+ if (vp9_rb_read_bit(rb))
+ xd->ref_lf_deltas[i] = vp9_rb_read_signed_literal(rb, 6);
- for (i = 0; i < MAX_MODE_LF_DELTAS; i++) {
- if (vp9_rb_read_bit(rb)) {
- const int value = vp9_rb_read_literal(rb, 6);
- xd->mode_lf_deltas[i] = vp9_rb_read_bit(rb) ? -value : value;
- }
- }
+ for (i = 0; i < MAX_MODE_LF_DELTAS; i++)
+ if (vp9_rb_read_bit(rb))
+ xd->mode_lf_deltas[i] = vp9_rb_read_signed_literal(rb, 6);
}
}
}
@@ -510,10 +504,8 @@
static int read_delta_q(struct vp9_read_bit_buffer *rb, int *delta_q) {
const int old = *delta_q;
- if (vp9_rb_read_bit(rb)) {
- const int value = vp9_rb_read_literal(rb, 4);
- *delta_q = vp9_rb_read_bit(rb) ? -value : value;
- }
+ if (vp9_rb_read_bit(rb))
+ *delta_q = vp9_rb_read_signed_literal(rb, 4);
return old != *delta_q;
}
--- a/vp9/decoder/vp9_read_bit_buffer.h
+++ b/vp9/decoder/vp9_read_bit_buffer.h
@@ -51,4 +51,10 @@
return value;
}
+static int vp9_rb_read_signed_literal(struct vp9_read_bit_buffer *rb,
+ int bits) {
+ const int value = vp9_rb_read_literal(rb, bits);
+ return vp9_rb_read_bit(rb) ? -value : value;
+}
+
#endif // VP9_READ_BIT_BUFFER_