Commit be2ebc72 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/ratecontrol: replace asserts by av_asserts

Also remove the now unneeded #include <assert.h>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 2ff7e81b
......@@ -32,9 +32,6 @@
#include "mpegvideo.h"
#include "libavutil/eval.h"
#undef NDEBUG // Always check asserts, the speed effect is far too small to disable them.
#include <assert.h>
#ifndef M_E
#define M_E 2.718281828
#endif
......@@ -205,8 +202,8 @@ av_cold int ff_rate_control_init(MpegEncContext *s)
}
e = sscanf(p, " in:%d ", &picture_number);
assert(picture_number >= 0);
assert(picture_number < rcc->num_entries);
av_assert0(picture_number >= 0);
av_assert0(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:%"SCNd64" var:%"SCNd64" icount:%d skipcount:%d hbits:%d",
......@@ -482,7 +479,7 @@ static void get_qminmax(int *qmin_ret, int *qmax_ret, MpegEncContext *s, int pic
int qmin = s->lmin;
int qmax = s->lmax;
assert(qmin <= qmax);
av_assert0(qmin <= qmax);
switch (pict_type) {
case AV_PICTURE_TYPE_B:
......@@ -783,7 +780,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
}
if (s->flags & CODEC_FLAG_PASS2) {
assert(picture_number >= 0);
av_assert0(picture_number >= 0);
if (picture_number >= rcc->num_entries) {
av_log(s, AV_LOG_ERROR, "Input is longer than 2-pass log file\n");
return -1;
......@@ -818,7 +815,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
short_term_q = 0; /* avoid warning */
if (s->flags & CODEC_FLAG_PASS2) {
if (pict_type != AV_PICTURE_TYPE_I)
assert(pict_type == rce->new_pict_type);
av_assert0(pict_type == rce->new_pict_type);
q = rce->new_qscale / br_compensation;
av_dlog(s, "%f %f %f last:%d var:%"PRId64" type:%d//\n", q, rce->new_qscale,
......@@ -857,9 +854,9 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
if (q < 0)
return -1;
assert(q > 0.0);
av_assert0(q > 0.0);
q = get_diff_limited_q(s, rce, q);
assert(q > 0.0);
av_assert0(q > 0.0);
// FIXME type dependent blur like in 2-pass
if (pict_type == AV_PICTURE_TYPE_P || s->intra_only) {
......@@ -870,13 +867,13 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
rcc->short_term_qcount++;
q = short_term_q = rcc->short_term_qsum / rcc->short_term_qcount;
}
assert(q > 0.0);
av_assert0(q > 0.0);
q = modify_qscale(s, rce, q, picture_number);
rcc->pass1_wanted_bits += s->bit_rate / fps;
assert(q > 0.0);
av_assert0(q > 0.0);
}
if (s->avctx->debug & FF_DEBUG_RC) {
......@@ -975,7 +972,7 @@ static int init_pass2(MpegEncContext *s)
qscale[i] = get_qscale(s, &rcc->entry[i], rate_factor, i);
rcc->last_qscale_for[rce->pict_type] = qscale[i];
}
assert(filter_size % 2 == 1);
av_assert0(filter_size % 2 == 1);
/* fixed I/B QP relative to P mode */
for (i = FFMAX(0, rcc->num_entries - 300); i < rcc->num_entries; i++) {
......@@ -1047,7 +1044,7 @@ static int init_pass2(MpegEncContext *s)
qscale_sum += av_clip(rcc->entry[i].new_qscale / FF_QP2LAMBDA,
s->avctx->qmin, s->avctx->qmax);
}
assert(toobig <= 40);
av_assert0(toobig <= 40);
av_log(s->avctx, AV_LOG_DEBUG,
"[lavc rc] requested bitrate: %d bps expected bitrate: %d bps\n",
s->bit_rate,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment