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>
This commit is contained in:
Christophe Gisquet 2014-06-04 20:48:56 +00:00 committed by Michael Niedermayer
parent 98ff07d1c6
commit 35dae62204

View File

@ -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);
}
}
}