[FFmpeg-soc] [soc]: r3503 - mlp/mlpenc.c
ramiro
subversion at mplayerhq.hu
Thu Aug 21 04:41:07 CEST 2008
Author: ramiro
Date: Thu Aug 21 04:41:07 2008
New Revision: 3503
Log:
Simplify number_sbits() using av_log2() and FFABS().
Modified:
mlp/mlpenc.c
Modified: mlp/mlpenc.c
==============================================================================
--- mlp/mlpenc.c (original)
+++ mlp/mlpenc.c Thu Aug 21 04:41:07 2008
@@ -406,14 +406,10 @@ static av_cold int mlp_encode_init(AVCod
*/
static int inline number_sbits(int number)
{
- int bits = 0;
-
- if (number > 0)
- for (bits = 31; bits && !(number & (1<<(bits-1))); bits--);
- else if (number < 0)
- for (bits = 31; bits && (number & (1<<(bits-1))); bits--);
+ if (number < 0)
+ number++;
- return bits + 1;
+ return av_log2(FFABS(number)) + 1 + !!number;
}
/** Determines the smallest number of bits needed to encode the filter
More information about the FFmpeg-soc
mailing list