diff options
Diffstat (limited to 'libavcodec/motion_est_template.c')
-rw-r--r-- | libavcodec/motion_est_template.c | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/libavcodec/motion_est_template.c b/libavcodec/motion_est_template.c index 7228744..07bfc00 100644 --- a/libavcodec/motion_est_template.c +++ b/libavcodec/motion_est_template.c @@ -2,20 +2,20 @@ * Motion estimation * Copyright (c) 2002-2004 Michael Niedermayer * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -89,19 +89,18 @@ static int hpel_motion_search(MpegEncContext * s, const int b= score_map[(index+(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)] + (mv_penalty[bx - pred_x] + mv_penalty[by+2 - pred_y])*c->penalty_factor; +#if 1 unsigned key; unsigned map_generation= c->map_generation; -#ifndef NDEBUG - uint32_t *map= c->map; -#endif key= ((my-1)<<ME_MAP_MV_BITS) + (mx) + map_generation; - assert(map[(index-(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)] == key); + av_assert2(c->map[(index-(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)] == key); key= ((my+1)<<ME_MAP_MV_BITS) + (mx) + map_generation; - assert(map[(index+(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)] == key); + av_assert2(c->map[(index+(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)] == key); key= ((my)<<ME_MAP_MV_BITS) + (mx+1) + map_generation; - assert(map[(index+1)&(ME_MAP_SIZE-1)] == key); + av_assert2(c->map[(index+1)&(ME_MAP_SIZE-1)] == key); key= ((my)<<ME_MAP_MV_BITS) + (mx-1) + map_generation; - assert(map[(index-1)&(ME_MAP_SIZE-1)] == key); + av_assert2(c->map[(index-1)&(ME_MAP_SIZE-1)] == key); +#endif if(t<=b){ CHECK_HALF_MV(0, 1, mx ,my-1) if(l<=r){ @@ -141,7 +140,7 @@ static int hpel_motion_search(MpegEncContext * s, } CHECK_HALF_MV(0, 1, mx , my) } - assert(bx >= xmin*2 && bx <= xmax*2 && by >= ymin*2 && by <= ymax*2); + av_assert2(bx >= xmin*2 && bx <= xmax*2 && by >= ymin*2 && by <= ymax*2); } *mx_ptr = bx; @@ -180,9 +179,6 @@ static inline int get_mb_score(MpegEncContext *s, int mx, int my, cmp_sub= s->dsp.mb_cmp[size]; chroma_cmp_sub= s->dsp.mb_cmp[size+1]; -// assert(!c->skip); -// assert(c->avctx->me_sub_cmp != c->avctx->mb_cmp); - d= cmp(s, mx>>(qpel+1), my>>(qpel+1), mx&mask, my&mask, size, h, ref_index, src_index, cmp_sub, chroma_cmp_sub, flags); //FIXME check cbp before adding penalty for (0,0) vector if(add_rate && (mx || my || size>0)) @@ -309,11 +305,11 @@ static int qpel_motion_search(MpegEncContext * s, cxy= 2*tl + (cx + cy)/4 - (cx2 + cy2) - 2*c; - assert(16*cx2 + 4*cx + 32*c == 32*r); - assert(16*cx2 - 4*cx + 32*c == 32*l); - assert(16*cy2 + 4*cy + 32*c == 32*b); - assert(16*cy2 - 4*cy + 32*c == 32*t); - assert(16*cxy + 16*cy2 + 16*cx2 - 4*cy - 4*cx + 32*c == 32*tl); + av_assert2(16*cx2 + 4*cx + 32*c == 32*r); + av_assert2(16*cx2 - 4*cx + 32*c == 32*l); + av_assert2(16*cy2 + 4*cy + 32*c == 32*b); + av_assert2(16*cy2 - 4*cy + 32*c == 32*t); + av_assert2(16*cxy + 16*cy2 + 16*cx2 - 4*cy - 4*cx + 32*c == 32*tl); for(ny= -3; ny <= 3; ny++){ for(nx= -3; nx <= 3; nx++){ @@ -346,7 +342,7 @@ static int qpel_motion_search(MpegEncContext * s, CHECK_QUARTER_MV(nx&3, ny&3, nx>>2, ny>>2) } - assert(bx >= xmin*4 && bx <= xmax*4 && by >= ymin*4 && by <= ymax*4); + av_assert2(bx >= xmin*4 && bx <= xmax*4 && by >= ymin*4 && by <= ymax*4); *mx_ptr = bx; *my_ptr = by; @@ -363,10 +359,10 @@ static int qpel_motion_search(MpegEncContext * s, {\ const unsigned key = ((y)<<ME_MAP_MV_BITS) + (x) + map_generation;\ const int index= (((y)<<ME_MAP_SHIFT) + (x))&(ME_MAP_SIZE-1);\ - assert((x) >= xmin);\ - assert((x) <= xmax);\ - assert((y) >= ymin);\ - assert((y) <= ymax);\ + av_assert2((x) >= xmin);\ + av_assert2((x) <= xmax);\ + av_assert2((y) >= ymin);\ + av_assert2((y) <= ymax);\ if(map[index]!=key){\ d= cmp(s, x, y, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\ map[index]= key;\ @@ -888,7 +884,7 @@ static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int map_generation= update_map_generation(c); - assert(cmpf); + av_assert2(cmpf); dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags); map[0]= map_generation; score_map[0]= dmin; |