summaryrefslogtreecommitdiff
path: root/src/libffmpeg/libavcodec/motion_est.c
diff options
context:
space:
mode:
authorStephen Torri <storri@users.sourceforge.net>2003-02-28 02:51:47 +0000
committerStephen Torri <storri@users.sourceforge.net>2003-02-28 02:51:47 +0000
commit49327f43ca2196122a60314e67eeee929efea873 (patch)
tree1b9ce1d2b141d0e411e422df265f6d57183906e1 /src/libffmpeg/libavcodec/motion_est.c
parent7eb769e2d3c1abb16e53d87af5f8633967e7f6ce (diff)
downloadxine-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/motion_est.c')
-rw-r--r--src/libffmpeg/libavcodec/motion_est.c28
1 files changed, 14 insertions, 14 deletions
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;