| 
																	
																	
																		
																	
																	
																 | 
																@@ -80,17 +80,19 @@ static inline int block_cmp(uint8_t *src, int stride, uint8_t *src2, int stride2 | 
															
														
														
													
														
															
																 | 
																 | 
																static int zmbv_me(ZmbvEncContext *c, uint8_t *src, int sstride, uint8_t *prev, int pstride, | 
																 | 
																 | 
																static int zmbv_me(ZmbvEncContext *c, uint8_t *src, int sstride, uint8_t *prev, int pstride, | 
															
														
														
													
														
															
																 | 
																 | 
																                    int x, int y, int *mx, int *my) | 
																 | 
																 | 
																                    int x, int y, int *mx, int *my) | 
															
														
														
													
														
															
																 | 
																 | 
																{ | 
																 | 
																 | 
																{ | 
															
														
														
													
														
															
																 | 
																 | 
																    int dx, dy, tx, ty, tv, bv; | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    int dx, dy, tx, ty, tv, bv, bw, bh; | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																    *mx = *my = 0; | 
																 | 
																 | 
																    *mx = *my = 0; | 
															
														
														
													
														
															
																 | 
																 | 
																    bv = block_cmp(src, sstride, prev, pstride, ZMBV_BLOCK, ZMBV_BLOCK); | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    bw = FFMIN(ZMBV_BLOCK, c->avctx->width - x); | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    bh = FFMIN(ZMBV_BLOCK, c->avctx->height - y); | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    bv = block_cmp(src, sstride, prev, pstride, bw, bh); | 
															
														
														
													
														
															
																 | 
																 | 
																    if(!bv) return 0; | 
																 | 
																 | 
																    if(!bv) return 0; | 
															
														
														
													
														
															
																 | 
																 | 
																    for(ty = FFMAX(y - c->range, 0); ty < FFMIN(y + c->range, c->avctx->height - ZMBV_BLOCK); ty++){ | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																        for(tx = FFMAX(x - c->range, 0); tx < FFMIN(x + c->range, c->avctx->width - ZMBV_BLOCK); tx++){ | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    for(ty = FFMAX(y - c->range, 0); ty < FFMIN(y + c->range, c->avctx->height - bh); ty++){ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																        for(tx = FFMAX(x - c->range, 0); tx < FFMIN(x + c->range, c->avctx->width - bw); tx++){ | 
															
														
														
													
														
															
																 | 
																 | 
																            if(tx == x && ty == y) continue; // we already tested this block | 
																 | 
																 | 
																            if(tx == x && ty == y) continue; // we already tested this block | 
															
														
														
													
														
															
																 | 
																 | 
																            dx = tx - x; | 
																 | 
																 | 
																            dx = tx - x; | 
															
														
														
													
														
															
																 | 
																 | 
																            dy = ty - y; | 
																 | 
																 | 
																            dy = ty - y; | 
															
														
														
													
														
															
																 | 
																 | 
																            tv = block_cmp(src, sstride, prev + dx + dy*pstride, pstride, ZMBV_BLOCK, ZMBV_BLOCK); | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            tv = block_cmp(src, sstride, prev + dx + dy*pstride, pstride, bw, bh); | 
															
														
														
													
														
															
																 | 
																 | 
																            if(tv < bv){ | 
																 | 
																 | 
																            if(tv < bv){ | 
															
														
														
													
														
															
																 | 
																 | 
																                 bv = tv; | 
																 | 
																 | 
																                 bv = tv; | 
															
														
														
													
														
															
																 | 
																 | 
																                 *mx = dx; | 
																 | 
																 | 
																                 *mx = dx; | 
															
														
														
													
												
													
														
															
																| 
																	
																		
																	
																	
																	
																 | 
																
  |