aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/cook.c
diff options
context:
space:
mode:
authorRamiro Polla <ramiro@lisha.ufsc.br>2007-04-18 19:47:22 +0000
committerBenjamin Larsson <banan@ludd.ltu.se>2007-04-18 19:47:22 +0000
commita31978e97cd9d6444d62dc732e45a563b0bbf5b5 (patch)
tree8a219030b8104a1aa796d9f4863d63f6e29cbce1 /libavcodec/cook.c
parent4620ce8bb87d4b238c56009aa98a4e4e43964cdd (diff)
downloadffmpeg-a31978e97cd9d6444d62dc732e45a563b0bbf5b5.tar.gz
Simplify, patch by Ramiro Polla.
ramiro ta lisha tod ufsc tod br Originally committed as revision 8754 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/cook.c')
-rw-r--r--libavcodec/cook.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/libavcodec/cook.c b/libavcodec/cook.c
index 1bf865c08a..291d1144c8 100644
--- a/libavcodec/cook.c
+++ b/libavcodec/cook.c
@@ -413,12 +413,7 @@ static void categorize(COOKContext *q, int* quant_index_table,
num_bits = 0;
index = 0;
for (j=q->total_subbands ; j>0 ; j--){
- exp_idx = (i - quant_index_table[index] + bias) / 2;
- if (exp_idx<0){
- exp_idx=0;
- } else if(exp_idx >7) {
- exp_idx=7;
- }
+ exp_idx = av_clip((i - quant_index_table[index] + bias) / 2, 0, 7);
index++;
num_bits+=expbits_tab[exp_idx];
}
@@ -430,12 +425,7 @@ static void categorize(COOKContext *q, int* quant_index_table,
/* Calculate total number of bits. */
num_bits=0;
for (i=0 ; i<q->total_subbands ; i++) {
- exp_idx = (bias - quant_index_table[i]) / 2;
- if (exp_idx<0) {
- exp_idx=0;
- } else if(exp_idx >7) {
- exp_idx=7;
- }
+ exp_idx = av_clip((bias - quant_index_table[i]) / 2, 0, 7);
num_bits += expbits_tab[exp_idx];
exp_index1[i] = exp_idx;
exp_index2[i] = exp_idx;