From: Dmitry Kovalev Date: Thu, 14 Nov 2013 00:46:21 +0000 (-0800) Subject: Cleaning up decode_coefs() function. X-Git-Tag: v1.3.0~23^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=11631fec168ee3a4a76bf7339137021699dcbeb7;p=libvpx Cleaning up decode_coefs() function. Removing vp9_read_and_apply_sign macro which was used only once. Change-Id: I6a1625b720d89fc1291c99deccd6638b705f9b06 --- diff --git a/vp9/decoder/vp9_detokenize.c b/vp9/decoder/vp9_detokenize.c index d5ad3039b..017cb3f7d 100644 --- a/vp9/decoder/vp9_detokenize.c +++ b/vp9/decoder/vp9_detokenize.c @@ -67,27 +67,27 @@ static const int token_to_counttoken[MAX_ENTROPY_TOKENS] = { TWO_TOKEN, TWO_TOKEN, TWO_TOKEN, DCT_EOB_MODEL_TOKEN }; -#define INCREMENT_COUNT(token) \ - do { \ - if (!cm->frame_parallel_decoding_mode) { \ +#define INCREMENT_COUNT(token) \ + do { \ + if (!cm->frame_parallel_decoding_mode) \ ++coef_counts[band][pt][token_to_counttoken[token]]; \ - } \ - } while (0); + } while (0) + #define WRITE_COEF_CONTINUE(val, token) \ { \ - dqcoeff_ptr[scan[c]] = vp9_read_and_apply_sign(r, val) * \ + dqcoeff_ptr[scan[c]] = (vp9_read_bit(r) ? -val : val) * \ dq[c > 0] / (1 + (tx_size == TX_32X32)); \ INCREMENT_COUNT(token); \ token_cache[scan[c]] = vp9_pt_energy_class[token]; \ - c++; \ + ++c; \ continue; \ } #define ADJUST_COEF(prob, bits_count) \ do { \ val += (vp9_read(r, prob) << bits_count); \ - } while (0); + } while (0) static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd, vp9_reader *r, int block_idx, @@ -201,10 +201,10 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd, } val = 0; cat6 = cat6_prob; - while (*cat6) { + while (*cat6) val = (val << 1) | vp9_read(r, *cat6++); - } val += CAT6_MIN_VAL; + WRITE_COEF_CONTINUE(val, DCT_VAL_CATEGORY6); } diff --git a/vp9/decoder/vp9_treereader.h b/vp9/decoder/vp9_treereader.h index f6124973f..41680d245 100644 --- a/vp9/decoder/vp9_treereader.h +++ b/vp9/decoder/vp9_treereader.h @@ -15,8 +15,6 @@ #include "vp9/common/vp9_treecoder.h" #include "vp9/decoder/vp9_dboolhuff.h" -#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 !!! */ vp9_tree t,