diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-06-07 17:41:12 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-06-07 18:01:09 +0200 |
commit | 5ee638fd549f134eb697ce6afc519506e7b81f58 (patch) | |
tree | dd2cd070215c9373811e41c0b1f85bc08eac649d | |
parent | 25e87fc5f61bd9b85ecf52c6082a18d7e7c8506b (diff) | |
download | ffmpeg-5ee638fd549f134eb697ce6afc519506e7b81f58.tar.gz |
svq1enc: use av_assert
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/svq1enc.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index 8f70679a88..61c30d4cb7 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -32,12 +32,11 @@ #include "mpegvideo.h" #include "h263.h" #include "internal.h" +#include "libavutil/avassert.h" #include "svq1.h" #include "svq1enc_cb.h" -#undef NDEBUG -#include <assert.h> typedef struct SVQ1Context { @@ -176,7 +175,7 @@ static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref, uint8_t *dec score= sqr - ((diff*(int64_t)diff)>>(level+3)); //FIXME 64bit slooow if(score < best_vector_score){ int mean= (diff + (size>>1)) >> (level+3); - assert(mean >-300 && mean<300); + av_assert2(mean >-300 && mean<300); mean= av_clip(mean, intra?0:-256, 255); best_vector_score= score; best_vector[stage]= i; @@ -184,7 +183,7 @@ static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref, uint8_t *dec best_vector_mean= mean; } } - assert(best_vector_mean != -999); + av_assert0(best_vector_mean != -999); vector= codebook + stage*size*16 + best_vector[stage]*size; for(j=0; j<size; j++){ block[stage+1][j] = block[stage][j] - vector[j]; @@ -229,10 +228,10 @@ static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref, uint8_t *dec put_bits(&s->reorder_pb[level], 1, split); if(!split){ - assert((best_mean >= 0 && best_mean<256) || !intra); - assert(best_mean >= -256 && best_mean<256); - assert(best_count >=0 && best_count<7); - assert(level<4 || best_count==0); + av_assert1((best_mean >= 0 && best_mean<256) || !intra); + av_assert1(best_mean >= -256 && best_mean<256); + av_assert1(best_count >=0 && best_count<7); + av_assert1(level<4 || best_count==0); /* output the encoding */ put_bits(&s->reorder_pb[level], @@ -242,7 +241,7 @@ static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref, uint8_t *dec mean_vlc[best_mean][0]); for (i = 0; i < best_count; i++){ - assert(best_vector[i]>=0 && best_vector[i]<16); + av_assert2(best_vector[i]>=0 && best_vector[i]<16); put_bits(&s->reorder_pb[level], 4, best_vector[i]); } @@ -412,10 +411,10 @@ static int svq1_encode_plane(SVQ1Context *s, int plane, unsigned char *src_plane s->m.pb= s->reorder_pb[5]; mx= motion_ptr[0]; my= motion_ptr[1]; - assert(mx>=-32 && mx<=31); - assert(my>=-32 && my<=31); - assert(pred_x>=-32 && pred_x<=31); - assert(pred_y>=-32 && pred_y<=31); + av_assert1(mx>=-32 && mx<=31); + av_assert1(my>=-32 && my<=31); + av_assert1(pred_x>=-32 && pred_x<=31); + av_assert1(pred_y>=-32 && pred_y<=31); ff_h263_encode_motion(&s->m, mx - pred_x, 1); ff_h263_encode_motion(&s->m, my - pred_y, 1); s->reorder_pb[5]= s->m.pb; |