diff options
author | Christophe Gisquet <christophe.gisquet@gmail.com> | 2014-06-05 00:48:56 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-06-05 01:55:48 +0400 |
commit | 35dae6220426cb9adeafda6d38598c3130984593 (patch) | |
tree | 3dfde7ca47c2047c293931f95404138a6e2a8fe4 | |
parent | 98ff07d1c647e3b413f4b2d00d70ec9e7a0c93ae (diff) |
huffyuvdec: clean up macro
It's no longer used inside another specific macro, so rename it.
Also remove duplicated definition and realign code.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/huffyuvdec.c | 58 |
1 files changed, 16 insertions, 42 deletions
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index 428f9e113e..4c0d29773f 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -559,7 +559,8 @@ static av_cold int decode_init_thread_copy(AVCodecContext *avctx) return 0; } -#define DUAL_INTERN(dst, table, gb, name, bits, max_depth) \ +/** Subset of GET_VLC for use in hand-roller VLC code */ +#define VLC_INTERN(dst, table, gb, name, bits, max_depth) \ code = table[index][0]; \ n = table[index][1]; \ if (max_depth > 1 && n < 0) { \ @@ -597,11 +598,11 @@ static av_cold int decode_init_thread_copy(AVCodecContext *avctx) LAST_SKIP_BITS(name, gb, n); \ } else { \ int nb_bits; \ - DUAL_INTERN(dst0, table1, gb, name, bits, max_depth); \ + VLC_INTERN(dst0, table1, gb, name, bits, max_depth); \ \ UPDATE_CACHE(re, gb); \ index = SHOW_UBITS(name, gb, bits); \ - DUAL_INTERN(dst1, table2, gb, name, bits, max_depth); \ + VLC_INTERN(dst1, table2, gb, name, bits, max_depth); \ } \ } while (0) @@ -720,33 +721,6 @@ static void decode_gray_bitstream(HYuvContext *s, int count) CLOSE_READER(re, &s->gb); } -#define GET_VLC_DUAL(dst0, dst1, name, gb, dtable, table1, table2, \ - bits, max_depth, rsvd ) \ - do { \ - unsigned int index = SHOW_UBITS(name, gb, bits); \ - int code = dtable[index][0]; \ - int n = dtable[index][1]; \ - \ - if (code != rsvd && n>0) { \ - dst0 = code>>8; \ - dst1 = code; \ - LAST_SKIP_BITS(name, gb, n); \ - } else { \ - int nb_bits; \ - DUAL_INTERN(dst0, table1, gb, name, bits, max_depth); \ - \ - UPDATE_CACHE(re, gb); \ - index = SHOW_UBITS(name, gb, bits); \ - DUAL_INTERN(dst1, table2, gb, name, bits, max_depth); \ - } \ - } while (0) - -#define READ_2PIX(dst0, dst1, plane1)\ - UPDATE_CACHE(re, &s->gb); \ - GET_VLC_DUAL(dst0, dst1, re, &s->gb, s->vlc[4+plane1].table, \ - s->vlc[0].table, s->vlc[plane1].table, \ - VLC_BITS, 3, 0xffff) - static av_always_inline void decode_bgr_1(HYuvContext *s, int count, int decorrelate, int alpha) { @@ -768,37 +742,37 @@ static av_always_inline void decode_bgr_1(HYuvContext *s, int count, } else { int nb_bits; if(decorrelate) { - DUAL_INTERN(s->temp[0][4 * i + G], s->vlc[1].table, - &s->gb, re, VLC_BITS, 3); + VLC_INTERN(s->temp[0][4 * i + G], s->vlc[1].table, + &s->gb, re, VLC_BITS, 3); UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); - DUAL_INTERN(code, s->vlc[0].table, &s->gb, re, VLC_BITS, 3); + VLC_INTERN(code, s->vlc[0].table, &s->gb, re, VLC_BITS, 3); s->temp[0][4 * i + B] = code + s->temp[0][4 * i + G]; UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); - DUAL_INTERN(code, s->vlc[2].table, &s->gb, re, VLC_BITS, 3); + VLC_INTERN(code, s->vlc[2].table, &s->gb, re, VLC_BITS, 3); s->temp[0][4 * i + R] = code + s->temp[0][4 * i + G]; } else { - DUAL_INTERN(s->temp[0][4 * i + B], s->vlc[0].table, - &s->gb, re, VLC_BITS, 3); + VLC_INTERN(s->temp[0][4 * i + B], s->vlc[0].table, + &s->gb, re, VLC_BITS, 3); UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); - DUAL_INTERN(s->temp[0][4 * i + G], s->vlc[1].table, - &s->gb, re, VLC_BITS, 3); + VLC_INTERN(s->temp[0][4 * i + G], s->vlc[1].table, + &s->gb, re, VLC_BITS, 3); UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); - DUAL_INTERN(s->temp[0][4 * i + R], s->vlc[2].table, - &s->gb, re, VLC_BITS, 3); + VLC_INTERN(s->temp[0][4 * i + R], s->vlc[2].table, + &s->gb, re, VLC_BITS, 3); } if (alpha) { UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); - DUAL_INTERN(s->temp[0][4 * i + A], s->vlc[2].table, - &s->gb, re, VLC_BITS, 3); + VLC_INTERN(s->temp[0][4 * i + A], s->vlc[2].table, + &s->gb, re, VLC_BITS, 3); } } } |