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 | |
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')
-rw-r--r-- | src/libffmpeg/libavcodec/common.h | 5 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/dsputil.c | 5 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/h263.c | 25 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/h263dec.c | 4 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/huffyuv.c | 16 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/i386/mpegvideo_mmx.c | 13 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/mjpeg.c | 5 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/mlib/dsputil_mlib.c | 33 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/motion_est.c | 28 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/motion_est_template.c | 45 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/mpeg12.c | 2 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/mpegvideo.c | 48 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/ppc/mpegvideo_altivec.c | 3 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/ratecontrol.c | 26 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/utils.c | 7 |
15 files changed, 146 insertions, 119 deletions
diff --git a/src/libffmpeg/libavcodec/common.h b/src/libffmpeg/libavcodec/common.h index c2305b45e..893b7ed64 100644 --- a/src/libffmpeg/libavcodec/common.h +++ b/src/libffmpeg/libavcodec/common.h @@ -169,7 +169,6 @@ typedef signed long long INT64; # ifndef DEBUG # define NDEBUG # endif -# include <assert.h> /* dprintf macros */ # if defined(CONFIG_WIN32) && !defined(__MINGW32__) @@ -326,7 +325,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) st_out_bit_counts[st_current_index] += n; #endif // printf("put_bits=%d %x\n", n, value); - assert(n == 32 || value < (1U << n)); + XINE_ASSERT((n == 32 || value < (1U << n)), "?"); bit_buf = s->bit_buf; bit_left = s->bit_left; @@ -903,7 +902,7 @@ static inline int ff_sqrt(int a) * converts fourcc string to int */ static inline int ff_get_fourcc(const char *s){ - assert( strlen(s)==4 ); + XINE_ASSERT( strlen(s)==4, "lenght of value 's' != 4: %d", strlen(s) ); return (s[0]) + (s[1]<<8) + (s[2]<<16) + (s[3]<<24); } diff --git a/src/libffmpeg/libavcodec/dsputil.c b/src/libffmpeg/libavcodec/dsputil.c index 06da93ba7..01bc84a86 100644 --- a/src/libffmpeg/libavcodec/dsputil.c +++ b/src/libffmpeg/libavcodec/dsputil.c @@ -21,6 +21,7 @@ #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" +#include "xineutils.h" int ff_bit_exact=0; @@ -1874,7 +1875,7 @@ static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int level= temp[i] + 64; - assert(level - 64); + XINE_ASSERT(level - 64,"?"); if((level&(~127)) == 0){ bits+= last_length[UNI_AC_ENC_INDEX(run, level)]; @@ -1941,7 +1942,7 @@ static int bit8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, in level= temp[i] + 64; - assert(level - 64); + XINE_ASSERT(level - 64,"?"); if((level&(~127)) == 0){ bits+= last_length[UNI_AC_ENC_INDEX(run, level)]; 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 diff --git a/src/libffmpeg/libavcodec/h263dec.c b/src/libffmpeg/libavcodec/h263dec.c index a5dadeec4..ff3773bed 100644 --- a/src/libffmpeg/libavcodec/h263dec.c +++ b/src/libffmpeg/libavcodec/h263dec.c @@ -19,6 +19,7 @@ #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" +#include "xineutils.h" #if 1 #define PRINT_QP(a, b) {} @@ -244,7 +245,8 @@ static int decode_slice(MpegEncContext *s){ s->mb_x= 0; } - assert(s->mb_x==0 && s->mb_y==s->mb_height); + XINE_ASSERT(s->mb_x==0, "s->mb_x (%d) != 0", s->mb_x); + XINE_ASSERT(s->mb_y==s->mb_height, "s->mb_y (%d) != s->mb_height (%d)", s->mb_y, s->mb_height); /* try to detect the padding bug */ if( s->codec_id==CODEC_ID_MPEG4 diff --git a/src/libffmpeg/libavcodec/huffyuv.c b/src/libffmpeg/libavcodec/huffyuv.c index 5f9be9059..eccb57983 100644 --- a/src/libffmpeg/libavcodec/huffyuv.c +++ b/src/libffmpeg/libavcodec/huffyuv.c @@ -389,10 +389,13 @@ static int decode_init(AVCodecContext *avctx) height= s->height= avctx->height; avctx->coded_frame= &s->picture; -s->bgr32=1; - assert(width && height); -//if(avctx->extradata) -// printf("extradata:%X, extradata_size:%d\n", *(uint32_t*)avctx->extradata, avctx->extradata_size); + s->bgr32=1; + XINE_ASSERT(width,"value 'width' is not defined"); + XINE_ASSERT(height, "value 'height' is not defined"); + + //if(avctx->extradata) + // printf("extradata:%X, extradata_size:%d\n", *(uint32_t*)avctx->extradata, avctx->extradata_size); + if(avctx->extradata_size){ if((avctx->bits_per_sample&7) && avctx->bits_per_sample != 12) s->version=1; // do such files exist at all? @@ -464,7 +467,7 @@ s->bgr32=1; } break; default: - assert(0); + XINE_ASSERT(0,"We do not have a default action."); } // printf("pred:%d bpp:%d hbpp:%d il:%d\n", s->predictor, s->bitstream_bpp, avctx->bits_per_sample, s->interlaced); @@ -509,7 +512,8 @@ static int encode_init(AVCodecContext *avctx) width= s->width= avctx->width; height= s->height= avctx->height; - assert(width && height); + XINE_ASSERT(width, "value 'width' is not defined"); + XINE_ASSERT(height, "value 'height' is not defined"); avctx->extradata= av_mallocz(1024*10); avctx->stats_out= av_mallocz(1024*10); diff --git a/src/libffmpeg/libavcodec/i386/mpegvideo_mmx.c b/src/libffmpeg/libavcodec/i386/mpegvideo_mmx.c index d936abfd5..be8015dd3 100644 --- a/src/libffmpeg/libavcodec/i386/mpegvideo_mmx.c +++ b/src/libffmpeg/libavcodec/i386/mpegvideo_mmx.c @@ -24,6 +24,7 @@ #include "../mpegvideo.h" #include "../avcodec.h" #include "../simple_idct.h" +#include "xineutils.h" extern UINT8 zigzag_direct_noperm[64]; extern UINT16 inv_zigzag_direct16[64]; @@ -41,7 +42,9 @@ static void dct_unquantize_h263_mmx(MpegEncContext *s, qmul = qscale << 1; qadd = (qscale - 1) | 1; - assert(s->block_last_index[n]>=0); + XINE_ASSERT(s->block_last_index[n]>=0, + "value 's->block_last_index[%d] is < 0: %d", + n, s->block_last_index[n]); if (s->mb_intra) { if (!s->h263_aic) { @@ -146,7 +149,9 @@ static void dct_unquantize_mpeg1_mmx(MpegEncContext *s, int nCoeffs; const UINT16 *quant_matrix; - assert(s->block_last_index[n]>=0); + XINE_ASSERT(s->block_last_index[n]>=0, + "value 's->block_last_index[%d] is < 0: %d", + n, s->block_last_index[n]); nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ]+1; @@ -274,7 +279,9 @@ static void dct_unquantize_mpeg2_mmx(MpegEncContext *s, int nCoeffs; const UINT16 *quant_matrix; - assert(s->block_last_index[n]>=0); + XINE_ASSERT(s->block_last_index[n]>=0, + "value 's->block_last_index[%d] is < 0: %d", + n, s->block_last_index[n]); if(s->alternate_scan) nCoeffs= 63; //FIXME else nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ]; diff --git a/src/libffmpeg/libavcodec/mjpeg.c b/src/libffmpeg/libavcodec/mjpeg.c index 9617816bb..8df477afa 100644 --- a/src/libffmpeg/libavcodec/mjpeg.c +++ b/src/libffmpeg/libavcodec/mjpeg.c @@ -24,6 +24,7 @@ #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" +#include "xineutils.h" /* use two quantizer tables (one for luminance and one for chrominance) */ /* not yet working */ @@ -477,7 +478,7 @@ static void escape_FF(MpegEncContext *s, int start) uint8_t *buf= s->pb.buf + start; int align= (-(int)(buf))&3; - assert((size&7) == 0); + XINE_ASSERT((size&7) == 0,"?"); size >>= 3; ff_count=0; @@ -533,7 +534,7 @@ void mjpeg_picture_trailer(MpegEncContext *s) put_bits(&s->pb, pad,0xFF>>(8-pad)); flush_put_bits(&s->pb); - assert((s->header_bits&7)==0); + XINE_ASSERT((s->header_bits&7)==0, "?"); escape_FF(s, s->header_bits>>3); diff --git a/src/libffmpeg/libavcodec/mlib/dsputil_mlib.c b/src/libffmpeg/libavcodec/mlib/dsputil_mlib.c index b951cd455..14e001316 100644 --- a/src/libffmpeg/libavcodec/mlib/dsputil_mlib.c +++ b/src/libffmpeg/libavcodec/mlib/dsputil_mlib.c @@ -19,6 +19,7 @@ #include "../dsputil.h" #include "../mpegvideo.h" +#include "xineutils.h" #include <mlib_types.h> #include <mlib_status.h> @@ -31,7 +32,7 @@ static void put_pixels16_mlib (uint8_t * dest, const uint8_t * ref, int stride, int height) { - assert(height == 16 || height == 8); + XINE_ASSERT((height == 16 || height == 8),"value 'height' is not equal to 8 or 16: %d", height); if (height == 16) mlib_VideoCopyRef_U8_U8_16x16(dest, (uint8_t *)ref, stride); else @@ -41,7 +42,7 @@ static void put_pixels16_mlib (uint8_t * dest, const uint8_t * ref, static void put_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref, int stride, int height) { - assert(height == 16 || height == 8); + XINE_ASSERT((height == 16 || height == 8),"value 'height' is not equal to 8 or 16: %d", height); if (height == 16) mlib_VideoInterpX_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride); else @@ -51,7 +52,7 @@ static void put_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref, static void put_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref, int stride, int height) { - assert(height == 16 || height == 8); + XINE_ASSERT((height == 16 || height == 8),"value 'height' is not equal to 8 or 16: %d", height); if (height == 16) mlib_VideoInterpY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride); else @@ -61,7 +62,7 @@ static void put_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref, static void put_pixels16_xy2_mlib(uint8_t * dest, const uint8_t * ref, int stride, int height) { - assert(height == 16 || height == 8); + XINE_ASSERT((height == 16 || height == 8),"value 'height' is not equal to 8 or 16: %d", height); if (height == 16) mlib_VideoInterpXY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride); else @@ -74,7 +75,7 @@ static void put_pixels16_xy2_mlib(uint8_t * dest, const uint8_t * ref, static void put_pixels8_mlib (uint8_t * dest, const uint8_t * ref, int stride, int height) { - assert(height == 16 || height == 8); + XINE_ASSERT((height == 16 || height == 8),"value 'height' is not equal to 8 or 16: %d", height); if (height == 16) mlib_VideoCopyRef_U8_U8_8x16(dest, (uint8_t *)ref, stride); else @@ -84,7 +85,7 @@ static void put_pixels8_mlib (uint8_t * dest, const uint8_t * ref, static void put_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref, int stride, int height) { - assert(height == 16 || height == 8); + XINE_ASSERT((height == 16 || height == 8),"value 'height' is not equal to 8 or 16: %d", height); if (height == 16) mlib_VideoInterpX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); else @@ -94,7 +95,7 @@ static void put_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref, static void put_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref, int stride, int height) { - assert(height == 16 || height == 8); + XINE_ASSERT((height == 16 || height == 8),"value 'height' is not equal to 8 or 16: %d", height); if (height == 16) mlib_VideoInterpY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); else @@ -104,7 +105,7 @@ static void put_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref, static void put_pixels8_xy2_mlib(uint8_t * dest, const uint8_t * ref, int stride, int height) { - assert(height == 16 || height == 8); + XINE_ASSERT((height == 16 || height == 8),"value 'height' is not equal to 8 or 16: %d", height); if (height == 16) mlib_VideoInterpXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); else @@ -117,7 +118,7 @@ static void put_pixels8_xy2_mlib(uint8_t * dest, const uint8_t * ref, static void avg_pixels16_mlib (uint8_t * dest, const uint8_t * ref, int stride, int height) { - assert(height == 16 || height == 8); + XINE_ASSERT((height == 16 || height == 8),"value 'height' is not equal to 8 or 16: %d", height); if (height == 16) mlib_VideoCopyRefAve_U8_U8_16x16(dest, (uint8_t *)ref, stride); else @@ -127,7 +128,7 @@ static void avg_pixels16_mlib (uint8_t * dest, const uint8_t * ref, static void avg_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref, int stride, int height) { - assert(height == 16 || height == 8); + XINE_ASSERT((height == 16 || height == 8),"value 'height' is not equal to 8 or 16: %d", height); if (height == 16) mlib_VideoInterpAveX_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride); else @@ -137,7 +138,7 @@ static void avg_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref, static void avg_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref, int stride, int height) { - assert(height == 16 || height == 8); + XINE_ASSERT((height == 16 || height == 8),"value 'height' is not equal to 8 or 16: %d", height); if (height == 16) mlib_VideoInterpAveY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride); else @@ -147,7 +148,7 @@ static void avg_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref, static void avg_pixels16_xy2_mlib (uint8_t * dest, const uint8_t * ref, int stride, int height) { - assert(height == 16 || height == 8); + XINE_ASSERT((height == 16 || height == 8),"value 'height' is not equal to 8 or 16: %d", height); if (height == 16) mlib_VideoInterpAveXY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride); else @@ -160,7 +161,7 @@ static void avg_pixels16_xy2_mlib (uint8_t * dest, const uint8_t * ref, static void avg_pixels8_mlib (uint8_t * dest, const uint8_t * ref, int stride, int height) { - assert(height == 16 || height == 8); + XINE_ASSERT((height == 16 || height == 8),"value 'height' is not equal to 8 or 16: %d", height); if (height == 16) mlib_VideoCopyRefAve_U8_U8_8x16(dest, (uint8_t *)ref, stride); else @@ -170,7 +171,7 @@ static void avg_pixels8_mlib (uint8_t * dest, const uint8_t * ref, static void avg_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref, int stride, int height) { - assert(height == 16 || height == 8); + XINE_ASSERT((height == 16 || height == 8),"value 'height' is not equal to 8 or 16: %d", height); if (height == 16) mlib_VideoInterpAveX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); else @@ -180,7 +181,7 @@ static void avg_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref, static void avg_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref, int stride, int height) { - assert(height == 16 || height == 8); + XINE_ASSERT((height == 16 || height == 8),"value 'height' is not equal to 8 or 16: %d", height); if (height == 16) mlib_VideoInterpAveY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); else @@ -190,7 +191,7 @@ static void avg_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref, static void avg_pixels8_xy2_mlib (uint8_t * dest, const uint8_t * ref, int stride, int height) { - assert(height == 16 || height == 8); + XINE_ASSERT((height == 16 || height == 8),"value 'height' is not equal to 8 or 16: %d", height); if (height == 16) mlib_VideoInterpAveXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); else diff --git a/src/libffmpeg/libavcodec/motion_est.c b/src/libffmpeg/libavcodec/motion_est.c index e4b67b22f..8d004a7c0 100644 --- a/src/libffmpeg/libavcodec/motion_est.c +++ b/src/libffmpeg/libavcodec/motion_est.c @@ -26,9 +26,6 @@ #include "dsputil.h" #include "mpegvideo.h" -//#undef NDEBUG -//#include <assert.h> - #define SQ(a) ((a)*(a)) #define P_LEFT P[1] @@ -961,7 +958,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, Picture * const pic= &s->current_picture; uint16_t * const mv_penalty= s->me.mv_penalty[s->f_code] + MAX_MV; - assert(s->quarter_sample==0 || s->quarter_sample==1); + XINE_ASSERT(s->quarter_sample==0 || s->quarter_sample==1, "value out of range: %d", s->quarter_sample); s->me.penalty_factor = get_penalty_factor(s, s->avctx->me_cmp); s->me.sub_penalty_factor= get_penalty_factor(s, s->avctx->me_sub_cmp); @@ -1132,7 +1129,8 @@ int ff_pre_estimate_p_frame_motion(MpegEncContext * s, const int mv_stride= s->mb_width + 2; const int xy= mb_x + 1 + (mb_y + 1)*mv_stride; - assert(s->quarter_sample==0 || s->quarter_sample==1); + XINE_ASSERT((s->quarter_sample==0 || s->quarter_sample==1), + "value out of range: %d", s->quarter_sample); s->me.pre_penalty_factor = get_penalty_factor(s, s->avctx->me_pre_cmp); @@ -1298,8 +1296,8 @@ static inline int check_bidir_mv(MpegEncContext * s, dxy = ((motion_fy & 3) << 2) | (motion_fx & 3); src_x = mb_x * 16 + (motion_fx >> 2); src_y = mb_y * 16 + (motion_fy >> 2); - assert(src_x >=-16 && src_x<=s->width); - assert(src_y >=-16 && src_y<=s->height); + XINE_ASSERT(src_x >=-16 && src_x<=s->width, "value (%d) is not within range %d to %d", src_x, -16, s->width); + XINE_ASSERT(src_y >=-16 && src_y<=s->height, "value (%d) is not within range %d to %d", src_y, -16, s->height); ptr = s->last_picture.data[0] + (src_y * s->linesize) + src_x; s->dsp.put_qpel_pixels_tab[0][dxy](dest_y , ptr , s->linesize); @@ -1307,8 +1305,8 @@ static inline int check_bidir_mv(MpegEncContext * s, dxy = ((motion_by & 3) << 2) | (motion_bx & 3); src_x = mb_x * 16 + (motion_bx >> 2); src_y = mb_y * 16 + (motion_by >> 2); - assert(src_x >=-16 && src_x<=s->width); - assert(src_y >=-16 && src_y<=s->height); + XINE_ASSERT(src_x >=-16 && src_x<=s->width, "value (%d) is not within range %d to %d", src_x, -16, s->width); + XINE_ASSERT(src_y >=-16 && src_y<=s->height, "value (%d) is not within range %d to %d", src_y, -16, s->height); ptr = s->next_picture.data[0] + (src_y * s->linesize) + src_x; s->dsp.avg_qpel_pixels_tab[0][dxy](dest_y , ptr , s->linesize); @@ -1316,8 +1314,8 @@ static inline int check_bidir_mv(MpegEncContext * s, dxy = ((motion_fy & 1) << 1) | (motion_fx & 1); src_x = mb_x * 16 + (motion_fx >> 1); src_y = mb_y * 16 + (motion_fy >> 1); - assert(src_x >=-16 && src_x<=s->width); - assert(src_y >=-16 && src_y<=s->height); + XINE_ASSERT(src_x >=-16 && src_x<=s->width, "value (%d) is not within range %d to %d", src_x, -16, s->width); + XINE_ASSERT(src_y >=-16 && src_y<=s->height, "value (%d) is not within range %d to %d", src_y, -16, s->height); ptr = s->last_picture.data[0] + (src_y * s->linesize) + src_x; s->dsp.put_pixels_tab[0][dxy](dest_y , ptr , s->linesize, 16); @@ -1325,8 +1323,8 @@ static inline int check_bidir_mv(MpegEncContext * s, dxy = ((motion_by & 1) << 1) | (motion_bx & 1); src_x = mb_x * 16 + (motion_bx >> 1); src_y = mb_y * 16 + (motion_by >> 1); - assert(src_x >=-16 && src_x<=s->width); - assert(src_y >=-16 && src_y<=s->height); + XINE_ASSERT(src_x >=-16 && src_x<=s->width, "value (%d) is not within range %d to %d", src_x, -16, s->width); + XINE_ASSERT(src_y >=-16 && src_y<=s->height, "value (%d) is not within range %d to %d", src_y, -16, s->height); ptr = s->next_picture.data[0] + (src_y * s->linesize) + src_x; s->dsp.avg_pixels_tab[0][dxy](dest_y , ptr , s->linesize, 16); @@ -1421,7 +1419,9 @@ static inline int direct_search(MpegEncContext * s, if(s->mv_type == MV_TYPE_16X16) break; } - assert(xmax <= 15 && ymax <= 15 && xmin >= -16 && ymin >= -16); + XINE_ASSERT(xmax <= 15 && ymax <= 15 && xmin >= -16 && ymin >= -16, + "xmax (%d) > 15\nymax (%d) >15\nxmin (%d) < -16\nymin (%d) < -16", + xmax, ymax, xmin, ymin); if(xmax < 0 || xmin >0 || ymax < 0 || ymin > 0){ s->b_direct_mv_table[mot_xy][0]= 0; diff --git a/src/libffmpeg/libavcodec/motion_est_template.c b/src/libffmpeg/libavcodec/motion_est_template.c index 4725ed994..f1ce615ae 100644 --- a/src/libffmpeg/libavcodec/motion_est_template.c +++ b/src/libffmpeg/libavcodec/motion_est_template.c @@ -18,6 +18,8 @@ * */ +#include "xineutils.h" + //lets hope gcc will remove the unused vars ...(gcc 3.2.2 seems to do it ...) //Note, the last line is there to kill these ugly unused var warnings #define LOAD_COMMON(x, y)\ @@ -119,7 +121,9 @@ static int RENAME(hpel_motion_search)(MpegEncContext * s, CHECK_HALF_MV(0, 1, mx , my ) CHECK_HALF_MV(1, 1, mx , my ) - assert(bx >= xmin*2 || bx <= xmax*2 || by >= ymin*2 || by <= ymax*2); + XINE_ASSERT((bx >= xmin*2 || bx <= xmax*2 || by >= ymin*2 || by <= ymax*2), + "bx (%d) is not wihtin range %d to %d.\nby (%d) is not within range %d to %d", + bx, xmin*2, xmax*2, by, ymin*2, ymax*2); *mx_ptr = bx; *my_ptr = by; @@ -183,13 +187,14 @@ static int RENAME(hpel_motion_search)(MpegEncContext * s, int map_generation= s->me.map_generation; uint32_t *map= s->me.map; key= ((my-1)<<ME_MAP_MV_BITS) + (mx) + map_generation; - assert(map[(index-(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)] == key); + + XINE_ASSERT(map[(index-(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)] == key,"map[%d] != %d",(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); + XINE_ASSERT(map[(index+(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)] == key,"map[%d] != %d",(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); + XINE_ASSERT(map[(index+1)&(ME_MAP_SIZE-1)] == key, "map[%d] != %d",(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); + XINE_ASSERT(map[(index-1)&(ME_MAP_SIZE-1)] == key, "map[%d] != %d",(index-1)&(ME_MAP_SIZE-1), key); #endif if(t<=b){ CHECK_HALF_MV(0, 1, mx ,my-1) @@ -230,7 +235,9 @@ static int RENAME(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); + XINE_ASSERT((bx >= xmin*2 && bx <= xmax*2 && by >= ymin*2 && by <= ymax*2), + "bx (%d) is not wihtin range %d to %d.\nby (%d) is not within range %d to %d", + bx, xmin*2, xmax*2, by, ymin*2, ymax*2); } *mx_ptr = bx; @@ -260,8 +267,9 @@ static int RENAME(hpel_get_mb_score)(MpegEncContext * s, int mx, int my, int pre cmp_sub= s->dsp.mb_cmp[size]; chroma_cmp_sub= s->dsp.mb_cmp[size+1]; - assert(!s->me.skip); - assert(s->avctx->me_sub_cmp != s->avctx->mb_cmp); + XINE_ASSERT(!s->me.skip,"s->me.skip is not NULL"); + XINE_ASSERT((s->avctx->me_sub_cmp != s->avctx->mb_cmp), "s->avctx->me_sub_cmp (%d) != s->avctx->mb_cmp (%d)", + s->avctx->me_sub_cmp, s->avctx->mb_cmp ); CMP_HPEL(d, mx&1, my&1, mx>>1, my>>1, size); //FIXME check cbp before adding penalty for (0,0) vector @@ -389,11 +397,12 @@ static int RENAME(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); + XINE_ASSERT(16*cx2 + 4*cx + 32*c == 32*r, "%d != %d",16*cx2 + 4*cx + 32*c, 32*r); + XINE_ASSERT(16*cx2 - 4*cx + 32*c == 32*l, "%d != %d",16*cx2 - 4*cx + 32*c, 32*l); + XINE_ASSERT(16*cy2 + 4*cy + 32*c == 32*b, "%d != %d",16*cy2 + 4*cy + 32*c, 32*b); + XINE_ASSERT(16*cy2 - 4*cy + 32*c == 32*t, "%d != %d",16*cy2 - 4*cy + 32*c, 32*t); + XINE_ASSERT(16*cxy + 16*cy2 + 16*cx2 - 4*cy - 4*cx + 32*c == 32*tl, "%d != %d", + 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++){ @@ -495,7 +504,9 @@ static int RENAME(qpel_motion_search)(MpegEncContext * s, CHECK_QUARTER_MV(1, 1, mx-1, my ) CHECK_QUARTER_MV(1, 0, mx-1, my ) #endif - assert(bx >= xmin*4 && bx <= xmax*4 && by >= ymin*4 && by <= ymax*4); + XINE_ASSERT(bx >= xmin*4 && bx <= xmax*4 && by >= ymin*4 && by <= ymax*4, + "bx (%d) is not wihtin range %d to %d.\nby (%d) is not within range %d to %d", + bx, xmin*4, xmax*4, by, ymin*4, ymax*4); *mx_ptr = bx; *my_ptr = by; @@ -526,8 +537,8 @@ static int RENAME(qpel_get_mb_score)(MpegEncContext * s, int mx, int my, int pre cmp_sub= s->dsp.mb_cmp[size]; chroma_cmp_sub= s->dsp.mb_cmp[size+1]; - assert(!s->me.skip); - assert(s->avctx->me_sub_cmp != s->avctx->mb_cmp); + XINE_ASSERT(!s->me.skip, "value 's->me.skip' is not NULL"); + XINE_ASSERT(s->avctx->me_sub_cmp != s->avctx->mb_cmp, "%d != %d", s->avctx->me_sub_cmp, s->avctx->mb_cmp ); CMP_QPEL(d, mx&3, my&3, mx>>2, my>>2, size); //FIXME check cbp before adding penalty for (0,0) vector @@ -745,7 +756,7 @@ static inline int RENAME(sab_diamond_search)(MpegEncContext * s, int *best, int if((key&((-1)<<(2*ME_MAP_MV_BITS))) != map_generation) continue; - assert(j<MAX_SAB_SIZE); //max j = number of predictors + XINE_ASSERT(j<MAX_SAB_SIZE, "%d >= %d", j, MAX_SAB_SIZE); //max j = number of predictors minima[j].height= score_map[i]; minima[j].x= key & ((1<<ME_MAP_MV_BITS)-1); key>>=ME_MAP_MV_BITS; diff --git a/src/libffmpeg/libavcodec/mpeg12.c b/src/libffmpeg/libavcodec/mpeg12.c index fecb097bd..907b141e9 100644 --- a/src/libffmpeg/libavcodec/mpeg12.c +++ b/src/libffmpeg/libavcodec/mpeg12.c @@ -769,7 +769,7 @@ static int mpeg_decode_mb(MpegEncContext *s, dprintf("decode_mb: x=%d y=%d\n", s->mb_x, s->mb_y); - assert(s->mb_skiped==0); + XINE_ASSERT(s->mb_skiped==0, "s->mp_skiped is not 0: %d", s->mb_skiped); if (--s->mb_incr != 0) { /* skip mb */ diff --git a/src/libffmpeg/libavcodec/mpegvideo.c b/src/libffmpeg/libavcodec/mpegvideo.c index 04908d8ad..45f0c9909 100644 --- a/src/libffmpeg/libavcodec/mpegvideo.c +++ b/src/libffmpeg/libavcodec/mpegvideo.c @@ -30,9 +30,6 @@ #include "fastmemcpy.h" #endif -//#undef NDEBUG -//#include <assert.h> - #define CONFIG_RISKY static void encode_picture(MpegEncContext *s, int picture_number); @@ -283,13 +280,13 @@ int DCT_common_init(MpegEncContext *s) static int alloc_picture(MpegEncContext *s, Picture *pic, int shared){ if(shared){ - assert(pic->data[0]); - assert(pic->type == 0 || pic->type == FF_BUFFER_TYPE_SHARED); + XINE_ASSERT(pic->data[0], "pic->data[0] is NULL."); + XINE_ASSERT((pic->type == 0 || pic->type == FF_BUFFER_TYPE_SHARED), "Invalid pic->type: %d", pic->type); pic->type= FF_BUFFER_TYPE_SHARED; }else{ int r; - assert(!pic->data[0]); + XINE_ASSERT(!pic->data[0],"pic->data[0] is not NULL."); r= s->avctx->get_buffer(s->avctx, (AVFrame*)pic); @@ -895,7 +892,7 @@ static int find_unused_picture(MpegEncContext *s, int shared){ } } - assert(i<MAX_PICTURE_COUNT); + XINE_ASSERT(i<MAX_PICTURE_COUNT,"value 'i' is >= MAX_PICTURE_COUNT: %d >= %d", i, MAX_PICTURE_COUNT); return i; } @@ -917,7 +914,7 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) break; } } - assert(i<MAX_PICTURE_COUNT); + XINE_ASSERT(i<MAX_PICTURE_COUNT,"value 'i' is >= MAX_PICTURE_COUNT: %d >= %d", i, MAX_PICTURE_COUNT); /* release forgotten pictures */ /* if(mpeg124/h263) */ @@ -950,7 +947,7 @@ alloc: if(s->pict_type != I_TYPE && s->last_picture.data[0]==NULL){ fprintf(stderr, "warning: first frame is no keyframe\n"); - assert(s->pict_type != B_TYPE); //these should have been dropped if we dont have a reference + XINE_ASSERT(s->pict_type != B_TYPE, "These should have been dropped if we dont have a reference"); goto alloc; } @@ -1000,7 +997,7 @@ void MPV_frame_end(MpegEncContext *s) break; } } - assert(i<MAX_PICTURE_COUNT); + XINE_ASSERT(i<MAX_PICTURE_COUNT,"value 'i' is >= MAX_PICTURE_COUNT: %d >= %d", i, MAX_PICTURE_COUNT); /* release non refernce frames */ for(i=0; i<MAX_PICTURE_COUNT; i++){ @@ -1136,7 +1133,7 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg){ static void select_input_picture(MpegEncContext *s){ int i; - const int encoding_delay= s->max_b_frames; + int coded_pic_num=0; if(s->reordered_input_picture[0]) @@ -1244,8 +1241,11 @@ static void select_input_picture(MpegEncContext *s){ s->current_picture= *pic; }else{ - assert( s->reordered_input_picture[0]->type==FF_BUFFER_TYPE_USER - || s->reordered_input_picture[0]->type==FF_BUFFER_TYPE_INTERNAL); + XINE_ASSERT( + (s->reordered_input_picture[0]->type==FF_BUFFER_TYPE_USER + || s->reordered_input_picture[0]->type==FF_BUFFER_TYPE_INTERNAL), + "s->reordered_input_picture[0]->type is incorrect: %d", + s->reordered_input_picture[0]->type); s->new_picture= *s->reordered_input_picture[0]; @@ -1283,7 +1283,7 @@ int MPV_encode_picture(AVCodecContext *avctx, s->pict_type= s->new_picture.pict_type; if (s->fixed_qscale){ /* the ratecontrol needs the last qscale so we dont touch it for CBR */ s->qscale= (int)(s->new_picture.quality+0.5); - assert(s->qscale); + XINE_ASSERT(s->qscale,"s->qscale is NULL"); } //emms_c(); //printf("qs:%f %f %d\n", s->new_picture.quality, s->current_picture.quality, s->qscale); @@ -2065,11 +2065,11 @@ void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) UINT8 *mbskip_ptr = &s->mbskip_table[mb_xy]; const int age= s->current_picture.age; - assert(age); + XINE_ASSERT(age, "value 'age' is NULL"); if (s->mb_skiped) { s->mb_skiped= 0; - assert(s->pict_type!=I_TYPE); + XINE_ASSERT(s->pict_type!=I_TYPE, "s->pict_type (%d) != I_TYPE (%d)", s->pict_type, I_TYPE); (*mbskip_ptr) ++; /* indicate that this time we skiped it */ if(*mbskip_ptr >99) *mbskip_ptr= 99; @@ -2286,7 +2286,7 @@ static inline void auto_requantize_coeffs(MpegEncContext *s, DCTELEM block[6][64 const int minlevel= s->min_qcoeff; int largest=0, smallest=0; - assert(s->adaptive_quant); + XINE_ASSERT(s->adaptive_quant, "s->adaptive_quant is NULL"); for(n=0; n<6; n++){ if(s->mb_intra){ @@ -2439,7 +2439,7 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y) if(s->codec_id==CODEC_ID_MPEG4){ if(!s->mb_intra){ - assert(s->dquant==0 || s->mv_type!=MV_TYPE_8X8); + XINE_ASSERT((s->dquant==0 || s->mv_type!=MV_TYPE_8X8), "?"); if(s->mv_dir&MV_DIRECT) s->dquant=0; @@ -2677,7 +2677,7 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y) case CODEC_ID_MJPEG: mjpeg_encode_mb(s, s->block); break; default: - assert(0); + XINE_ASSERT(0, "We have no default case. So if program control reaches here something is really wrong"); } #endif } @@ -2832,7 +2832,7 @@ static inline int sse(MpegEncContext *s, uint8_t *src1, uint8_t *src2, int w, in } } - assert(acc>=0); + XINE_ASSERT(acc>=0,"value 'acc' is < 0: %d", acc); return acc; } @@ -3591,7 +3591,7 @@ static int dct_quantize_trellis_c(MpegEncContext *s, int level= coeff[level_index][i]; int unquant_coeff; - assert(level); + XINE_ASSERT(level, "value 'level' is NULL"); if(s->out_format == FMT_H263){ if(level>0){ @@ -3710,7 +3710,7 @@ static int dct_quantize_trellis_c(MpegEncContext *s, return last_non_zero; i= last_i; - assert(last_level); + XINE_ASSERT(last_level, "value 'last_level' is NULL"); //FIXME use permutated scantable block[ s->idct_permutation[ scantable[last_non_zero] ] ]= last_level; i -= last_run + 1; @@ -3719,7 +3719,7 @@ static int dct_quantize_trellis_c(MpegEncContext *s, const int j= s->idct_permutation[ scantable[i - 1 + start_i] ]; block[j]= level_tab[i]; - assert(block[j]); + XINE_ASSERT(block[j], "value 'block[j]' is NULL"); } return last_non_zero; @@ -3926,7 +3926,7 @@ static void dct_unquantize_h263_c(MpegEncContext *s, int i, level, qmul, qadd; int nCoeffs; - assert(s->block_last_index[n]>=0); + XINE_ASSERT(s->block_last_index[n]>=0 , "s->block_last_index[%d] is < 0: %d", n, s->block_last_index[n]); qadd = (qscale - 1) | 1; qmul = qscale << 1; diff --git a/src/libffmpeg/libavcodec/ppc/mpegvideo_altivec.c b/src/libffmpeg/libavcodec/ppc/mpegvideo_altivec.c index dd898e158..6c3be0e77 100644 --- a/src/libffmpeg/libavcodec/ppc/mpegvideo_altivec.c +++ b/src/libffmpeg/libavcodec/ppc/mpegvideo_altivec.c @@ -21,6 +21,7 @@ #include "../dsputil.h" #include "../mpegvideo.h" #include "dsputil_altivec.h" +#include "xineutils.h" // Swaps two variables (used for altivec registers) #define SWAP(a,b) \ @@ -523,7 +524,7 @@ POWERPC_TBL_DECLARE(altivec_dct_unquantize_h263_num, 1); int i, level, qmul, qadd; int nCoeffs; - assert(s->block_last_index[n]>=0); + XINE_ASSERT(s->block_last_index[n]>=0, "s->block_last_index[%d] < 0", n); POWERPC_TBL_START_COUNT(altivec_dct_unquantize_h263_num, 1); diff --git a/src/libffmpeg/libavcodec/ratecontrol.c b/src/libffmpeg/libavcodec/ratecontrol.c index 6bcbe1c67..03811b549 100644 --- a/src/libffmpeg/libavcodec/ratecontrol.c +++ b/src/libffmpeg/libavcodec/ratecontrol.c @@ -21,9 +21,6 @@ #include "dsputil.h" #include "mpegvideo.h" -#undef NDEBUG // allways check asserts, the speed effect is far too small to disable them -#include <assert.h> - #ifndef M_E #define M_E 2.718281828 #endif @@ -95,8 +92,8 @@ int ff_rate_control_init(MpegEncContext *s) } e= sscanf(p, " in:%d ", &picture_number); - assert(picture_number >= 0); - assert(picture_number < rcc->num_entries); + XINE_ASSERT(picture_number >= 0,"Picture number is not >= 0: %d", picture_number); + XINE_ASSERT(picture_number < rcc->num_entries, "Picture number is not (%d) < rcc->num_entries (%d)", picture_number, rcc->num_entries); rce= &rcc->entry[picture_number]; e+=sscanf(p, " in:%*d out:%*d type:%d q:%f itex:%d ptex:%d mv:%d misc:%d fcode:%d bcode:%d mc-var:%d var:%d icount:%d", @@ -550,7 +547,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s) int qmin, qmax; float br_compensation; double diff; - double short_term_q; + double short_term_q = 0; double fps; int picture_number= s->picture_number; int64_t wanted_bits; @@ -574,8 +571,8 @@ float ff_rate_estimate_qscale(MpegEncContext *s) } if(s->flags&CODEC_FLAG_PASS2){ - assert(picture_number>=0); - assert(picture_number<rcc->num_entries); + XINE_ASSERT(picture_number>=0,"Picture number is not >=0: %d", picture_number); + XINE_ASSERT(picture_number<rcc->num_entries, "Picture number (%d) is not < rcc->num_entries (%d)", picture_number, rcc->num_entries); rce= &rcc->entry[picture_number]; wanted_bits= rce->expected_bits; }else{ @@ -591,7 +588,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s) if(s->flags&CODEC_FLAG_PASS2){ if(pict_type!=I_TYPE) - assert(pict_type == rce->new_pict_type); + XINE_ASSERT(pict_type == rce->new_pict_type, "pict_type (%d) != rce->new_pict_type (%d)", pict_type, rce->new_pict_type); q= rce->new_qscale / br_compensation; //printf("%f %f %f last:%d var:%d type:%d//\n", q, rce->new_qscale, br_compensation, s->frame_bits, var, pict_type); @@ -631,11 +628,11 @@ float ff_rate_estimate_qscale(MpegEncContext *s) q= get_qscale(s, rce, rate_factor, picture_number); - assert(q>0.0); + XINE_ASSERT(q>0.0, "value 'q' is not > 0.0: %f", q); //printf("%f ", q); q= get_diff_limited_q(s, rce, q); //printf("%f ", q); - assert(q>0.0); + XINE_ASSERT(q>0.0, "value 'q' is not > 0.0: %f", q); if(pict_type==P_TYPE || s->intra_only){ //FIXME type dependant blur like in 2-pass rcc->short_term_qsum*=s->qblur; @@ -647,13 +644,13 @@ float ff_rate_estimate_qscale(MpegEncContext *s) q= short_term_q= rcc->short_term_qsum/rcc->short_term_qcount; //printf("%f ", q); } - assert(q>0.0); + XINE_ASSERT(q>0.0, "value 'q' is not > 0.0: %f", q); q= modify_qscale(s, rce, q, picture_number); rcc->pass1_wanted_bits+= s->bit_rate/fps; - assert(q>0.0); + XINE_ASSERT(q>0.0, "value 'q' is not > 0.0: %f", q); } if(s->avctx->debug&FF_DEBUG_RC){ @@ -764,7 +761,8 @@ static int init_pass2(MpegEncContext *s) for(i=0; i<rcc->num_entries; i++){ qscale[i]= get_qscale(s, &rcc->entry[i], rate_factor, i); } - assert(filter_size%2==1); + /* filter_size%2 == 1 */ + XINE_ASSERT( filter_size%2==1 , "filter size is an even number: %d", filter_size); /* fixed I/B QP relative to P mode */ for(i=rcc->num_entries-1; i>=0; i--){ diff --git a/src/libffmpeg/libavcodec/utils.c b/src/libffmpeg/libavcodec/utils.c index ca71807f7..0959c0cf4 100644 --- a/src/libffmpeg/libavcodec/utils.c +++ b/src/libffmpeg/libavcodec/utils.c @@ -19,6 +19,7 @@ #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" +#include "xineutils.h" void *av_mallocz(unsigned int size) { @@ -124,8 +125,8 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){ const int height= s->height; DefaultPicOpaque *opaque; /* - assert(pic->data[0]==NULL); - assert(pic->type==0 || pic->type==FF_TYPE_INTERNAL); + XINE_ASSERT(pic->data[0]==NULL, "pic->data[0] != NULL"); + XINE_ASSERT((pic->type==0) || (pic->type==FF_TYPE_INTERNAL), "pic->type incorrect: %d", pic->type); */ if(pic->opaque){ opaque= (DefaultPicOpaque *)pic->opaque; @@ -202,7 +203,7 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){ void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){ int i; - assert(pic->type==FF_BUFFER_TYPE_INTERNAL); + XINE_ASSERT(pic->type==FF_BUFFER_TYPE_INTERNAL, "pic->type does not equal FF_BUFFER_TYPE_INTERNAL: %d", pic->type); for(i=0; i<3; i++) pic->data[i]=NULL; |