Commit 6496b025 authored by stefano's avatar stefano

Cosmetics: move at the beginning of the file the av_frac_* functions, avoid

the forward declarations.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@14677 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 8331c976
...@@ -38,8 +38,55 @@ unsigned avformat_version(void) ...@@ -38,8 +38,55 @@ unsigned avformat_version(void)
return LIBAVFORMAT_VERSION_INT; return LIBAVFORMAT_VERSION_INT;
} }
static void av_frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den); /* fraction handling */
static void av_frac_add(AVFrac *f, int64_t incr);
/**
* f = val + (num / den) + 0.5.
*
* 'num' is normalized so that it is such as 0 <= num < den.
*
* @param f fractional number
* @param val integer value
* @param num must be >= 0
* @param den must be >= 1
*/
static void av_frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den)
{
num += (den >> 1);
if (num >= den) {
val += num / den;
num = num % den;
}
f->val = val;
f->num = num;
f->den = den;
}
/**
* Fractional addition to f: f = f + (incr / f->den).
*
* @param f fractional number
* @param incr increment, can be positive or negative
*/
static void av_frac_add(AVFrac *f, int64_t incr)
{
int64_t num, den;
num = f->num + incr;
den = f->den;
if (num < 0) {
f->val += num / den;
num = num % den;
if (num < 0) {
num += den;
f->val--;
}
} else if (num >= den) {
f->val += num / den;
num = num % den;
}
f->num = num;
}
/** head of registered input format linked list */ /** head of registered input format linked list */
AVInputFormat *first_iformat = NULL; AVInputFormat *first_iformat = NULL;
...@@ -3171,53 +3218,3 @@ void av_set_pts_info(AVStream *s, int pts_wrap_bits, ...@@ -3171,53 +3218,3 @@ void av_set_pts_info(AVStream *s, int pts_wrap_bits,
if(gcd>1) if(gcd>1)
av_log(NULL, AV_LOG_DEBUG, "st:%d removing common factor %d from timebase\n", s->index, gcd); av_log(NULL, AV_LOG_DEBUG, "st:%d removing common factor %d from timebase\n", s->index, gcd);
} }
/* fraction handling */
/**
* f = val + (num / den) + 0.5.
*
* 'num' is normalized so that it is such as 0 <= num < den.
*
* @param f fractional number
* @param val integer value
* @param num must be >= 0
* @param den must be >= 1
*/
static void av_frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den)
{
num += (den >> 1);
if (num >= den) {
val += num / den;
num = num % den;
}
f->val = val;
f->num = num;
f->den = den;
}
/**
* Fractional addition to f: f = f + (incr / f->den).
*
* @param f fractional number
* @param incr increment, can be positive or negative
*/
static void av_frac_add(AVFrac *f, int64_t incr)
{
int64_t num, den;
num = f->num + incr;
den = f->den;
if (num < 0) {
f->val += num / den;
num = num % den;
if (num < 0) {
num += den;
f->val--;
}
} else if (num >= den) {
f->val += num / den;
num = num % den;
}
f->num = num;
}
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