Merge "Adding vp9_read_and_apply_sign function." into experimental

This commit is contained in:
Dmitry Kovalev 2013-04-14 04:37:39 -07:00 коммит произвёл Gerrit Code Review
Родитель ee9ce0e7d7 4fdf8ccca2
Коммит ab96e9cdaf
3 изменённых файлов: 11 добавлений и 22 удалений

Просмотреть файл

@ -844,10 +844,8 @@ static int get_delta_q(vp9_reader *r, int *dq) {
const int old_value = *dq;
if (vp9_read_bit(r)) { // Update bit
int value = vp9_read_literal(r, 4);
if (vp9_read_bit(r)) // Sign bit
value = -value;
*dq = value;
const int value = vp9_read_literal(r, 4);
*dq = vp9_read_and_apply_sign(r, value);
}
// Trigger a quantizer update if the delta-q value has changed
@ -1232,9 +1230,8 @@ static void setup_segmentation(VP9_COMMON *pc, MACROBLOCKD *xd, vp9_reader *r) {
if (feature_enabled) {
vp9_enable_segfeature(xd, i, j);
data = vp9_decode_unsigned_max(r, vp9_seg_feature_data_max(j));
if (vp9_is_segfeature_signed(j) && vp9_read_bit(r)) {
data = -data;
}
if (vp9_is_segfeature_signed(j))
data = vp9_read_and_apply_sign(r, data);
}
vp9_set_segdata(xd, i, j, data);
}
@ -1283,19 +1280,15 @@ static void setup_loopfilter(VP9_COMMON *pc, MACROBLOCKD *xd, vp9_reader *r) {
for (i = 0; i < MAX_REF_LF_DELTAS; i++) {
if (vp9_read_bit(r)) {
int value = vp9_read_literal(r, 6);
if (vp9_read_bit(r))
value = -value;
xd->ref_lf_deltas[i] = value;
const int value = vp9_read_literal(r, 6);
xd->ref_lf_deltas[i] = vp9_read_and_apply_sign(r, value);
}
}
for (i = 0; i < MAX_MODE_LF_DELTAS; i++) {
if (vp9_read_bit(r)) {
int value = vp9_read_literal(r, 6);
if (vp9_read_bit(r))
value = -value;
xd->mode_lf_deltas[i] = value;
const int value = vp9_read_literal(r, 6);
xd->mode_lf_deltas[i] = vp9_read_and_apply_sign(r, value);
}
}
}

Просмотреть файл

@ -60,11 +60,6 @@ static const vp9_prob cat6_prob[15] = {
DECLARE_ALIGNED(16, extern const uint8_t, vp9_norm[256]);
static int16_t get_signed(BOOL_DECODER *br, int16_t value_to_sign) {
return decode_bool(br, 128) ? -value_to_sign : value_to_sign;
}
#define INCREMENT_COUNT(token) \
do { \
coef_counts[type][ref][get_coef_band(scan, txfm_size, c)] \
@ -77,7 +72,7 @@ static int16_t get_signed(BOOL_DECODER *br, int16_t value_to_sign) {
#if CONFIG_CODE_NONZEROCOUNT
#define WRITE_COEF_CONTINUE(val, token) \
{ \
qcoeff_ptr[scan[c]] = get_signed(br, val); \
qcoeff_ptr[scan[c]] = vp9_read_and_apply_sign(br, val); \
INCREMENT_COUNT(token); \
c++; \
nzc++; \
@ -86,7 +81,7 @@ static int16_t get_signed(BOOL_DECODER *br, int16_t value_to_sign) {
#else
#define WRITE_COEF_CONTINUE(val, token) \
{ \
qcoeff_ptr[scan[c]] = get_signed(br, val); \
qcoeff_ptr[scan[c]] = vp9_read_and_apply_sign(br, val); \
INCREMENT_COUNT(token); \
c++; \
continue; \

Просмотреть файл

@ -21,6 +21,7 @@ typedef BOOL_DECODER vp9_reader;
#define vp9_read_literal decode_value
#define vp9_read_bit(r) vp9_read(r, vp9_prob_half)
#define vp9_read_prob(r) ((vp9_prob)vp9_read_literal(r, 8))
#define vp9_read_and_apply_sign(r, value) (vp9_read_bit(r) ? -(value) : (value))
// Intent of tree data structure is to make decoding trivial.
static int treed_read(vp9_reader *const r, /* !!! must return a 0 or 1 !!! */