Commit 15f1cc09 authored by Luca Barbato's avatar Luca Barbato Committed by Diego Biurrun

flac: Postpone unlikely condition checks

About 2% speedup on gcc-6.3.
Signed-off-by: 's avatarDiego Biurrun <diego@biurrun.de>
parent 9c1e1114
......@@ -204,26 +204,27 @@ static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order)
int samples;
method_type = bitstream_read(&s->bc, 2);
rice_order = bitstream_read(&s->bc, 4);
samples = s->blocksize >> rice_order;
rice_bits = 4 + method_type;
rice_esc = (1 << rice_bits) - 1;
decoded += pred_order;
i = pred_order;
if (method_type > 1) {
av_log(s->avctx, AV_LOG_ERROR, "illegal residual coding method %d\n",
method_type);
return AVERROR_INVALIDDATA;
}
rice_order = bitstream_read(&s->bc, 4);
samples= s->blocksize >> rice_order;
if (pred_order > samples) {
av_log(s->avctx, AV_LOG_ERROR, "invalid predictor order: %i > %i\n",
pred_order, samples);
return AVERROR_INVALIDDATA;
}
rice_bits = 4 + method_type;
rice_esc = (1 << rice_bits) - 1;
decoded += pred_order;
i= pred_order;
for (partition = 0; partition < (1 << rice_order); partition++) {
tmp = bitstream_read(&s->bc, rice_bits);
if (tmp == rice_esc) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment