From 8db88d28543b2f147a9e5b4bf6b0e5b5eba1c1c9 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Sun, 8 Sep 2013 21:03:25 +0200 Subject: quic: compile with constant bpp This simplifies a little bit function calling, and allows for compiler to potentially specialize and optimize a bit better each version. --- common/quic_family_tmpl.c | 4 ++-- common/quic_rgb_tmpl.c | 6 +++--- common/quic_tmpl.c | 16 ++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/common/quic_family_tmpl.c b/common/quic_family_tmpl.c index cca2c05..287ff6d 100644 --- a/common/quic_family_tmpl.c +++ b/common/quic_family_tmpl.c @@ -74,13 +74,13 @@ static unsigned int FNAME(golomb_decoding)(const unsigned int l, const unsigned /* update the bucket using just encoded curval */ static void FNAME(update_model)(CommonState *state, s_bucket * const bucket, - const BYTE curval, unsigned int bpp) + const BYTE curval) { + const unsigned int bpp = BPC; COUNTER * const pcounters = bucket->pcounters; unsigned int i; unsigned int bestcode; unsigned int bestcodelen; - //unsigned int bpp = encoder->bpp; /* update counters, find minimum */ diff --git a/common/quic_rgb_tmpl.c b/common/quic_rgb_tmpl.c index 37c908c..19cc348 100644 --- a/common/quic_rgb_tmpl.c +++ b/common/quic_rgb_tmpl.c @@ -178,11 +178,11 @@ #define UPDATE_MODEL(index) \ update_model(&encoder->rgb_state, find_bucket(channel_r, correlate_row_r[index - 1]), \ - correlate_row_r[index], bpc); \ + correlate_row_r[index]); \ update_model(&encoder->rgb_state, find_bucket(channel_g, correlate_row_g[index - 1]), \ - correlate_row_g[index], bpc); \ + correlate_row_g[index]); \ update_model(&encoder->rgb_state, find_bucket(channel_b, correlate_row_b[index - 1]), \ - correlate_row_b[index], bpc); + correlate_row_b[index]); #ifdef RLE_PRED_1 diff --git a/common/quic_tmpl.c b/common/quic_tmpl.c index b625daf..75f2ff0 100644 --- a/common/quic_tmpl.c +++ b/common/quic_tmpl.c @@ -173,7 +173,7 @@ static void FNAME(compress_row0_seg)(Encoder *encoder, Channel *channel, int i, } else { channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) & waitmask); update_model(&channel->state, find_bucket(channel, decorelate_drow[-1]), - decorelate_drow[i], bpc); + decorelate_drow[i]); } stopidx = ++i + channel->state.waitcnt; } else { @@ -191,7 +191,7 @@ static void FNAME(compress_row0_seg)(Encoder *encoder, Channel *channel, int i, } update_model(&channel->state, find_bucket(channel, decorelate_drow[stopidx - 1]), - decorelate_drow[stopidx], bpc); + decorelate_drow[stopidx]); stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask); } @@ -272,7 +272,7 @@ static void FNAME(compress_row_seg)(Encoder *encoder, Channel *channel, int i, } else { channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) & waitmask); update_model(&channel->state, find_bucket(channel, decorelate_drow[-1]), - decorelate_drow[0], bpc); + decorelate_drow[0]); } stopidx = ++i + channel->state.waitcnt; } else { @@ -295,7 +295,7 @@ static void FNAME(compress_row_seg)(Encoder *encoder, Channel *channel, int i, } update_model(&channel->state, find_bucket(channel, decorelate_drow[stopidx - 1]), - decorelate_drow[stopidx], bpc); + decorelate_drow[stopidx]); stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask); } @@ -406,7 +406,7 @@ static void FNAME(uncompress_row0_seg)(Encoder *encoder, Channel *channel, int i } else { channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) & waitmask); update_model(&channel->state, find_bucket(channel, correlate_row[-1]), - correlate_row[0], bpc); + correlate_row[0]); } stopidx = ++i + channel->state.waitcnt; } else { @@ -426,7 +426,7 @@ static void FNAME(uncompress_row0_seg)(Encoder *encoder, Channel *channel, int i decode_eatbits(encoder, codewordlen); } - update_model(&channel->state, pbucket, correlate_row[stopidx], bpc); + update_model(&channel->state, pbucket, correlate_row[stopidx]); stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask); } @@ -511,7 +511,7 @@ static void FNAME(uncompress_row_seg)(Encoder *encoder, Channel *channel, } else { channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) & waitmask); update_model(&channel->state, find_bucket(channel, correlate_row[-1]), - correlate_row[0], bpc); + correlate_row[0]); } stopidx = ++i + channel->state.waitcnt; } else { @@ -535,7 +535,7 @@ static void FNAME(uncompress_row_seg)(Encoder *encoder, Channel *channel, decode_eatbits(encoder, codewordlen); } - update_model(&channel->state, pbucket, correlate_row[stopidx], bpc); + update_model(&channel->state, pbucket, correlate_row[stopidx]); stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask); } -- cgit v1.2.3