changeset 24679:065d1f97815f

fix infinite loop
author michael
date Thu, 04 Oct 2007 12:32:54 +0000
parents 9aab9d7b51f0
children 4d56303b85ab
files libmpcodecs/vf_ow.c
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vf_ow.c	Thu Oct 04 02:35:34 2007 +0000
+++ b/libmpcodecs/vf_ow.c	Thu Oct 04 12:32:54 2007 +0000
@@ -167,15 +167,19 @@
     int x,y, i, j;
     double sum=0;
     double s= p->strength[!is_luma];
+    int depth= p->depth;
+
+    while(1<<depth > width || 1<<depth > height)
+        depth--;
 
     for(y=0; y<height; y++)
         for(x=0; x<width; x++)
             p->plane[0][0][x + y*p->stride]= src[x + y*src_stride];
 
-    for(i=0; i<p->depth; i++){
+    for(i=0; i<depth; i++){
         decompose2D2(p->plane[i+1], p->plane[i][0], p->plane[0]+1,p->stride, 1<<i, width, height);
     }
-    for(i=0; i<p->depth; i++){
+    for(i=0; i<depth; i++){
         for(j=1; j<4; j++){
             for(y=0; y<height; y++){
                 for(x=0; x<width; x++){
@@ -188,7 +192,7 @@
             }
         }
     }
-    for(i=p->depth-1; i>=0; i--){
+    for(i=depth-1; i>=0; i--){
         compose2D2(p->plane[i][0], p->plane[i+1], p->plane[0]+1, p->stride, 1<<i, width, height);
     }