From e5e15eb38e015e2d56109dc977070e64c03dc2c7 Mon Sep 17 00:00:00 2001 From: Dmitry Kovalev Date: Mon, 1 Jul 2013 02:09:36 -0700 Subject: [PATCH] Adding vp9_rb_read_signed_literal function. Change-Id: I30ea91561ffac7e5065ba41b2d3ab7dedb720593 --- vp9/decoder/vp9_decodframe.c | 24 ++++++++---------------- vp9/decoder/vp9_read_bit_buffer.h | 6 ++++++ 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c index eac925bb5..2b653caed 100644 --- a/vp9/decoder/vp9_decodframe.c +++ b/vp9/decoder/vp9_decodframe.c @@ -512,29 +512,21 @@ static void setup_loopfilter(VP9D_COMP *pbi, struct vp9_read_bit_buffer *rb) { 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); } } } 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; } diff --git a/vp9/decoder/vp9_read_bit_buffer.h b/vp9/decoder/vp9_read_bit_buffer.h index f243cb451..c7fa3aa27 100644 --- a/vp9/decoder/vp9_read_bit_buffer.h +++ b/vp9/decoder/vp9_read_bit_buffer.h @@ -51,4 +51,10 @@ static int vp9_rb_read_literal(struct vp9_read_bit_buffer *rb, int bits) { 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_ -- 2.40.0