aboutsummaryrefslogtreecommitdiff
path: root/libavcodec/flacenc.c
diff options
context:
space:
mode:
authorLoren Merritt2007-10-27 13:39:19 +0000
committerLoren Merritt2007-10-27 13:39:19 +0000
commit90f03441654f85a1402a65c3dcaa3f634a24c27e (patch)
tree4c5b2b210abbed741e6e0585c2157b8912e11dd7 /libavcodec/flacenc.c
parentf473666f518c7dbb0b165b0d874b037a316fa5c9 (diff)
remove a branch from an inner loop.
1% faster flac encoding. Originally committed as revision 10865 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/flacenc.c')
-rw-r--r--libavcodec/flacenc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index c0bd830efe..3e92c06939 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -474,16 +474,15 @@ static uint32_t calc_optimal_rice_params(RiceContext *rc, int porder,
uint32_t all_bits;
part = (1 << porder);
- all_bits = 0;
+ all_bits = 4 * part;
cnt = (n >> porder) - pred_order;
for(i=0; i<part; i++) {
- if(i == 1) cnt = (n >> porder);
k = find_optimal_param(sums[i], cnt);
rc->params[i] = k;
all_bits += rice_encode_count(sums[i], cnt, k);
+ cnt = n >> porder;
}
- all_bits += (4 * part);
rc->porder = porder;