Mercurial > libavcodec.hg
comparison rangecoder.c @ 4410:b1314834b3a7 libavcodec
cosmetics / remove #if 0 code
author | michael |
---|---|
date | Fri, 26 Jan 2007 02:29:23 +0000 |
parents | c8c591fe26f8 |
children | f99e40a7155b |
comparison
equal
deleted
inserted
replaced
4409:1907b07173cf | 4410:b1314834b3a7 |
---|---|
64 int last_p8, p8, i; | 64 int last_p8, p8, i; |
65 | 65 |
66 memset(c->zero_state, 0, sizeof(c->zero_state)); | 66 memset(c->zero_state, 0, sizeof(c->zero_state)); |
67 memset(c-> one_state, 0, sizeof(c-> one_state)); | 67 memset(c-> one_state, 0, sizeof(c-> one_state)); |
68 | 68 |
69 #if 0 | |
70 for(i=1; i<256; i++){ | |
71 if(c->one_state[i]) | |
72 continue; | |
73 | |
74 p= (i*one + 128) >> 8; | |
75 last_p8= i; | |
76 for(;;){ | |
77 p+= ((one-p)*factor + one/2) >> 32; | |
78 p8= (256*p + one/2) >> 32; //FIXME try without the one | |
79 if(p8 <= last_p8) p8= last_p8+1; | |
80 if(p8 > max_p) p8= max_p; | |
81 if(p8 < last_p8) | |
82 break; | |
83 c->one_state[last_p8]= p8; | |
84 if(p8 == last_p8) | |
85 break; | |
86 last_p8= p8; | |
87 } | |
88 } | |
89 #endif | |
90 #if 1 | |
91 last_p8= 0; | 69 last_p8= 0; |
92 p= one/2; | 70 p= one/2; |
93 for(i=0; i<128; i++){ | 71 for(i=0; i<128; i++){ |
94 p8= (256*p + one/2) >> 32; //FIXME try without the one | 72 p8= (256*p + one/2) >> 32; //FIXME try without the one |
95 if(p8 <= last_p8) p8= last_p8+1; | 73 if(p8 <= last_p8) p8= last_p8+1; |
97 c->one_state[last_p8]= p8; | 75 c->one_state[last_p8]= p8; |
98 | 76 |
99 p+= ((one-p)*factor + one/2) >> 32; | 77 p+= ((one-p)*factor + one/2) >> 32; |
100 last_p8= p8; | 78 last_p8= p8; |
101 } | 79 } |
102 #endif | 80 |
103 for(i=256-max_p; i<=max_p; i++){ | 81 for(i=256-max_p; i<=max_p; i++){ |
104 if(c->one_state[i]) | 82 if(c->one_state[i]) |
105 continue; | 83 continue; |
106 | 84 |
107 p= (i*one + 128) >> 8; | 85 p= (i*one + 128) >> 8; |
112 c->one_state[ i]= p8; | 90 c->one_state[ i]= p8; |
113 } | 91 } |
114 | 92 |
115 for(i=1; i<255; i++) | 93 for(i=1; i<255; i++) |
116 c->zero_state[i]= 256-c->one_state[256-i]; | 94 c->zero_state[i]= 256-c->one_state[256-i]; |
117 #if 0 | |
118 for(i=0; i<256; i++) | |
119 av_log(NULL, AV_LOG_DEBUG, "%3d %3d\n", i, c->one_state[i]); | |
120 #endif | |
121 } | 95 } |
122 | 96 |
123 /** | 97 /** |
124 * | 98 * |
125 * @return the number of bytes written | 99 * @return the number of bytes written |
153 | 127 |
154 for(i=0; i<SIZE; i++){ | 128 for(i=0; i<SIZE; i++){ |
155 r[i]= random()%7; | 129 r[i]= random()%7; |
156 } | 130 } |
157 | 131 |
158 | |
159 for(i=0; i<SIZE; i++){ | 132 for(i=0; i<SIZE; i++){ |
160 START_TIMER | 133 START_TIMER |
161 put_rac(&c, state, r[i]&1); | 134 put_rac(&c, state, r[i]&1); |
162 STOP_TIMER("put_rac") | 135 STOP_TIMER("put_rac") |
163 } | 136 } |
175 STOP_TIMER("get_rac") | 148 STOP_TIMER("get_rac") |
176 } | 149 } |
177 | 150 |
178 return 0; | 151 return 0; |
179 } | 152 } |
180 | |
181 #endif | 153 #endif |