av_log(s, AV_LOG_ERROR, "zero framerate\n");
return -1;
}
- gcd= ff_gcd(s->avctx->time_base.den, s->avctx->time_base.num);
+ gcd= av_gcd(s->avctx->time_base.den, s->avctx->time_base.num);
s->avctx->time_base.den /= gcd;
s->avctx->time_base.num /= gcd;
// av_log(s->avctx, AV_LOG_DEBUG, "%d/%d\n", s->avctx->time_base.den, s->avctx->time_base.num);
frate = avctx->time_base.den;
fbase = avctx->time_base.num;
- gcd = ff_gcd(frate, fbase);
+ gcd = av_gcd(frate, fbase);
if( gcd > 1 ) {
frate /= gcd;
fbase /= gcd;
} else
est_fbase = 1;
- gcd = ff_gcd(est_frate, est_fbase);
+ gcd = av_gcd(est_frate, est_fbase);
if( gcd > 1 ) {
est_frate /= gcd;
est_fbase /= gcd;
avctx->b_frame_strategy = 0;
}
- i= ff_gcd(avctx->time_base.den, avctx->time_base.num);
+ i= av_gcd(avctx->time_base.den, avctx->time_base.num);
if(i > 1){
av_log(avctx, AV_LOG_INFO, "removing common factors from framerate\n");
avctx->time_base.den /= i;
}
error= (int)(sqrt(error)+0.5);
errors[level][orientation]= error;
- if(g) g=ff_gcd(g, error);
+ if(g) g=av_gcd(g, error);
else g= error;
}
}
display_aspect_ratio.num, display_aspect_ratio.den);
}
if(av_log_get_level() >= AV_LOG_DEBUG){
- int g= ff_gcd(enc->time_base.num, enc->time_base.den);
+ int g= av_gcd(enc->time_base.num, enc->time_base.den);
snprintf(buf + strlen(buf), buf_size - strlen(buf),
", %d/%d",
enc->time_base.num/g, enc->time_base.den/g);
sc->stts_data[i].count= sample_count;
sc->stts_data[i].duration= sample_duration;
- sc->time_rate= ff_gcd(sc->time_rate, sample_duration);
+ sc->time_rate= av_gcd(sc->time_rate, sample_duration);
dprintf(c->fc, "sample_count=%d, sample_duration=%d\n",sample_count,sample_duration);
sc->ctts_data[i].count = count;
sc->ctts_data[i].duration= duration;
- sc->time_rate= ff_gcd(sc->time_rate, FFABS(duration));
+ sc->time_rate= av_gcd(sc->time_rate, FFABS(duration));
}
return 0;
}
for(i=0; i<nut->time_base_count; i++){
GET_V(nut->time_base[i].num, tmp>0 && tmp<(1ULL<<31))
GET_V(nut->time_base[i].den, tmp>0 && tmp<(1ULL<<31))
- if(ff_gcd(nut->time_base[i].num, nut->time_base[i].den) != 1){
+ if(av_gcd(nut->time_base[i].num, nut->time_base[i].den) != 1){
av_log(s, AV_LOG_ERROR, "time base invalid\n");
return -1;
}
*au_scale= stream->block_align ? stream->block_align*8 : 8;
*au_rate = stream->bit_rate ? stream->bit_rate : 8*stream->sample_rate;
}
- gcd= ff_gcd(*au_scale, *au_rate);
+ gcd= av_gcd(*au_scale, *au_rate);
*au_scale /= gcd;
*au_rate /= gcd;
}
char buf[256];
int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
AVStream *st = ic->streams[i];
- int g = ff_gcd(st->time_base.num, st->time_base.den);
+ int g = av_gcd(st->time_base.num, st->time_base.den);
avcodec_string(buf, sizeof(buf), st->codec, is_output);
av_log(NULL, AV_LOG_INFO, " Stream #%d.%d", index, i);
/* the pid is an important information, so we display it */
void av_set_pts_info(AVStream *s, int pts_wrap_bits,
int pts_num, int pts_den)
{
- unsigned int gcd= ff_gcd(pts_num, pts_den);
+ unsigned int gcd= av_gcd(pts_num, pts_den);
s->pts_wrap_bits = pts_wrap_bits;
s->time_base.num = pts_num/gcd;
s->time_base.den = pts_den/gcd;
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
#define LIBAVUTIL_VERSION_MAJOR 49
-#define LIBAVUTIL_VERSION_MINOR 12
+#define LIBAVUTIL_VERSION_MINOR 13
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
else return a;
}
-/* math */
-int64_t av_const ff_gcd(int64_t a, int64_t b);
-
/**
* converts fourcc string to int
*/
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
};
-int64_t ff_gcd(int64_t a, int64_t b){
- if(b) return ff_gcd(b, a%b);
+int64_t av_gcd(int64_t a, int64_t b){
+ if(b) return av_gcd(b, a%b);
else return a;
}
AV_ROUND_NEAR_INF = 5, ///< round to nearest and halfway cases away from zero
};
+int64_t av_const av_gcd(int64_t a, int64_t b);
+
/**
* rescale a 64bit integer with rounding to nearest.
* a simple a*b/c isn't possible as it can overflow
int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max){
AVRational a0={0,1}, a1={1,0};
int sign= (nom<0) ^ (den<0);
- int64_t gcd= ff_gcd(FFABS(nom), FFABS(den));
+ int64_t gcd= av_gcd(FFABS(nom), FFABS(den));
if(gcd){
nom = FFABS(nom)/gcd;
nom= den;
den= next_den;
}
- assert(ff_gcd(a1.num, a1.den) <= 1U);
+ assert(av_gcd(a1.num, a1.den) <= 1U);
*dst_nom = sign ? -a1.num : a1.num;
*dst_den = a1.den;