comparison libmpcodecs/vf_ow.c @ 24679:065d1f97815f

fix infinite loop
author michael
date Thu, 04 Oct 2007 12:32:54 +0000
parents 9f81c2175803
children 4d56303b85ab
comparison
equal deleted inserted replaced
24678:9aab9d7b51f0 24679:065d1f97815f
165 165
166 static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, int width, int height, int is_luma){ 166 static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, int width, int height, int is_luma){
167 int x,y, i, j; 167 int x,y, i, j;
168 double sum=0; 168 double sum=0;
169 double s= p->strength[!is_luma]; 169 double s= p->strength[!is_luma];
170 int depth= p->depth;
171
172 while(1<<depth > width || 1<<depth > height)
173 depth--;
170 174
171 for(y=0; y<height; y++) 175 for(y=0; y<height; y++)
172 for(x=0; x<width; x++) 176 for(x=0; x<width; x++)
173 p->plane[0][0][x + y*p->stride]= src[x + y*src_stride]; 177 p->plane[0][0][x + y*p->stride]= src[x + y*src_stride];
174 178
175 for(i=0; i<p->depth; i++){ 179 for(i=0; i<depth; i++){
176 decompose2D2(p->plane[i+1], p->plane[i][0], p->plane[0]+1,p->stride, 1<<i, width, height); 180 decompose2D2(p->plane[i+1], p->plane[i][0], p->plane[0]+1,p->stride, 1<<i, width, height);
177 } 181 }
178 for(i=0; i<p->depth; i++){ 182 for(i=0; i<depth; i++){
179 for(j=1; j<4; j++){ 183 for(j=1; j<4; j++){
180 for(y=0; y<height; y++){ 184 for(y=0; y<height; y++){
181 for(x=0; x<width; x++){ 185 for(x=0; x<width; x++){
182 double v= p->plane[i+1][j][x + y*p->stride]; 186 double v= p->plane[i+1][j][x + y*p->stride];
183 if (v> s) v-=s; 187 if (v> s) v-=s;
186 p->plane[i+1][j][x + y*p->stride]= v; 190 p->plane[i+1][j][x + y*p->stride]= v;
187 } 191 }
188 } 192 }
189 } 193 }
190 } 194 }
191 for(i=p->depth-1; i>=0; i--){ 195 for(i=depth-1; i>=0; i--){
192 compose2D2(p->plane[i][0], p->plane[i+1], p->plane[0]+1, p->stride, 1<<i, width, height); 196 compose2D2(p->plane[i][0], p->plane[i+1], p->plane[0]+1, p->stride, 1<<i, width, height);
193 } 197 }
194 198
195 for(y=0; y<height; y++) 199 for(y=0; y<height; y++)
196 for(x=0; x<width; x++){ 200 for(x=0; x<width; x++){