aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/snow.c
diff options
context:
space:
mode:
authorLoren Merritt <lorenm@u.washington.edu>2006-01-19 09:21:39 +0000
committerLoren Merritt <lorenm@u.washington.edu>2006-01-19 09:21:39 +0000
commitd3ac6ed667872332efcb8c953bb45cbd125dbaab (patch)
tree248921c8bc208795fc682c611aaedc3b3c832170 /libavcodec/snow.c
parentd271481f1a308a36b139a03d145b2cd4e994f09f (diff)
downloadffmpeg-d3ac6ed667872332efcb8c953bb45cbd125dbaab.tar.gz
detect when iterative_me fails to converge, and stop searching
Originally committed as revision 4868 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/snow.c')
-rw-r--r--libavcodec/snow.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index 4a96f3e0d2..88fb49a10e 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -25,6 +25,8 @@
#include "mpegvideo.h"
+#include <zlib.h>
+
#undef NDEBUG
#include <assert.h>
@@ -3301,6 +3303,8 @@ static void iterative_me(SnowContext *s){
const int b_height= s->b_height << s->block_max_depth;
const int b_stride= b_width;
int color[3];
+ const int first_crc_pass= 12;
+ uint32_t crcs[50];
for(pass=0; pass<50; pass++){
int change= 0;
@@ -3435,6 +3439,18 @@ static void iterative_me(SnowContext *s){
}
}
av_log(NULL, AV_LOG_ERROR, "pass:%d changed:%d\n", pass, change);
+
+ if(pass >= first_crc_pass){
+ int i;
+ //FIXME can we hash just the blocks that were analysed?
+ crcs[pass]= crc32(crc32(0,NULL,0), (void*)s->block, b_stride*b_height*sizeof(BlockNode));
+ for(i=pass-1; i>=first_crc_pass; i--){
+ if(crcs[i] == crcs[pass]){
+ change= 0;
+ break;
+ }
+ }
+ }
if(!change)
break;
}