diff options
author | Stephen Torri <storri@users.sourceforge.net> | 2003-02-28 02:51:47 +0000 |
---|---|---|
committer | Stephen Torri <storri@users.sourceforge.net> | 2003-02-28 02:51:47 +0000 |
commit | 49327f43ca2196122a60314e67eeee929efea873 (patch) | |
tree | 1b9ce1d2b141d0e411e422df265f6d57183906e1 /src/libffmpeg/libavcodec/h263.c | |
parent | 7eb769e2d3c1abb16e53d87af5f8633967e7f6ce (diff) | |
download | xine-lib-49327f43ca2196122a60314e67eeee929efea873.tar.gz xine-lib-49327f43ca2196122a60314e67eeee929efea873.tar.bz2 |
Xine assert() replacement:
All assert() function calls, with exceptions of libdvdread and libdvdnav, have been
replaced with XINE_ASSERT. Functionally XINE_ASSERT behaves just likes its predecesor but its
adding the ability to print out a stack trace at the point where the assertion fails.
So here are a few examples.
assert (0);
This use of assert was found in a couple locations most favorably being the default case of a switch
statement. This was the only thing there. So if the switch statement was unable to find a match
it would have defaulted to this and the user and the developers would be stuck wonder who died and where.
So it has been replaced with
XINE_ASSERT(0, "We have reach this point and don't have a default case");
It may seem a bit none descriptive but there is more going on behind the scene.
In addition to checking a condition is true/false, in this case '0', the XINE_ASSERT
prints out:
<filename>:<function name>:<line number> - assertion '<assertion expression>' failed. <description>
An example of this might be:
input_dvd.c:open_plugin:1178 - assertion '0' failed. xine_malloc failed!!! You have run out of memory
XINE_ASSERT and its helper function, print_trace, are found in src/xine-utils/xineutils.h
CVS patchset: 4301
CVS date: 2003/02/28 02:51:47
Diffstat (limited to 'src/libffmpeg/libavcodec/h263.c')
-rw-r--r-- | src/libffmpeg/libavcodec/h263.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/libffmpeg/libavcodec/h263.c b/src/libffmpeg/libavcodec/h263.c index 06501964b..f50920011 100644 --- a/src/libffmpeg/libavcodec/h263.c +++ b/src/libffmpeg/libavcodec/h263.c @@ -36,9 +36,7 @@ #include "mpegvideo.h" #include "h263data.h" #include "mpeg4data.h" - -//#undef NDEBUG -//#include <assert.h> +#include "xineutils.h" #if 1 #define PRINT_MB_TYPE(a) {} @@ -481,9 +479,11 @@ void mpeg4_encode_mb(MpegEncContext * s, s->last_mv[1][0][1]= 0; } - assert(s->dquant>=-2 && s->dquant<=2); - assert((s->dquant&1)==0); - assert(mb_type>=0); + XINE_ASSERT(s->dquant>=-2 && s->dquant<=2, + "value 's->dquant' is not within rang of -2 to 2: %d", + s->dquant); + XINE_ASSERT((s->dquant&1)==0,"?"); + XINE_ASSERT(mb_type>=0, "value 'mb_type' is < 0: %d", mb_type); /* nothing to do if this MB was skiped in the next P Frame */ if(s->next_picture.mbskip_table[s->mb_y * s->mb_width + s->mb_x]){ //FIXME avoid DCT & ... @@ -501,7 +501,9 @@ void mpeg4_encode_mb(MpegEncContext * s, if ((cbp | motion_x | motion_y | mb_type) ==0) { /* direct MB with MV={0,0} */ - assert(s->dquant==0); + XINE_ASSERT(s->dquant==0, + "value 's->dquant' is not 0: %d", + s->dquant); put_bits(&s->pb, 1, 1); /* mb not coded modb1=1 */ @@ -1179,7 +1181,7 @@ static void h263_encode_motion(MpegEncContext * s, int val, int f_code) val -= 2*l; } - assert(val>=-l && val<l); + XINE_ASSERT(val>=-l && val<l); if (val >= 0) { sign = 0; @@ -1342,8 +1344,8 @@ static void init_uni_dc_tab(void) static void init_uni_mpeg4_rl_tab(RLTable *rl, UINT32 *bits_tab, UINT8 *len_tab){ int slevel, run, last; - assert(MAX_LEVEL >= 64); - assert(MAX_RUN >= 63); + XINE_ASSERT(MAX_LEVEL >= 64, "MAX_LEVEL is < 64: %d", MAX_LEVEL); + XINE_ASSERT(MAX_RUN >= 63, "MAX_RUN is < 63: %d", MAX_RUN); for(slevel=-64; slevel<64; slevel++){ if(slevel==0) continue; @@ -3212,8 +3214,7 @@ int ff_h263_decode_mb(MpegEncContext *s, int modb1; // first bit of modb int modb2; // second bit of modb int mb_type; - int xy; - + s->mb_intra = 0; //B-frames never contain intra blocks s->mcsel=0; // ... true gmc blocks |