Unified · Split
| @@ -15,6 +15,9 @@ libavutil: 2012-10-22 · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | API changes, most recent first: | 16 | API changes, most recent first: |
| 17 | 17 | ||
| 18 | 2014-01-04 - xxxxxxx - lavu 52.60.100 - mathematics.h | ||
| 19 | Add av_add_stable() function. | ||
| 20 | |||
| 18 | 2013-12-22 - xxxxxxx - lavu 52.59.100 - avstring.h | 21 | 2013-12-22 - xxxxxxx - lavu 52.59.100 - avstring.h |
| 19 | Add av_strnlen() function. | 22 | Add av_strnlen() function. |
| 20 | 23 | ||
| @@ -174,3 +174,17 @@ simple_round: · 173 unmodified lines | |||
| 174 | 174 | ||
| 175 | return av_rescale_q(this, fs_tb, out_tb); | 175 | return av_rescale_q(this, fs_tb, out_tb); |
| 176 | } | 176 | } |
| 177 | |||
| 178 | int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc) | ||
| 179 | { | ||
| 180 | AVRational step = av_mul_q(inc_tb, (AVRational) {inc, 1}); | ||
| 181 | |||
| 182 | if (av_cmp_q(step, ts_tb) < 0) { | ||
| 183 | //increase step is too small for even 1 step to be representable | ||
| 184 | return ts; | ||
| 185 | } else { | ||
| 186 | int64_t old = av_rescale_q(ts, ts_tb, step); | ||
| 187 | int64_t old_ts = av_rescale_q(old, step, ts_tb); | ||
| 188 | return av_rescale_q(old + 1, step, ts_tb) + (ts - old_ts); | ||
| 189 | } | ||
| 190 | } | ||
| @@ -141,6 +141,20 @@ int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod); · 140 unmodified lines | |||
| 141 | int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb); | 141 | int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb); |
| 142 | 142 | ||
| 143 | /** | 143 | /** |
| 144 | * Add a value to a timestamp. | ||
| 145 | * | ||
| 146 | * This function gurantees that when the same value is repeatly added that | ||
| 147 | * no accumulation of rounding errors occurs. | ||
| 148 | * | ||
| 149 | * @param ts Input timestamp | ||
| 150 | * @param ts_tb Input timestamp timebase | ||
| 151 | * @param inc value to add to ts | ||
| 152 | * @param inc_tb inc timebase | ||
| 153 | */ | ||
| 154 | int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc); | ||
| 155 | |||
| 156 | |||
| 157 | /** | ||
| 144 | * @} | 158 | * @} |
| 145 | */ | 159 | */ |
| 146 | 160 | ||
| @@ -56,7 +56,7 @@ · 55 unmodified lines | |||
| 56 | */ | 56 | */ |
| 57 | 57 | ||
| 58 | #define LIBAVUTIL_VERSION_MAJOR 52 | 58 | #define LIBAVUTIL_VERSION_MAJOR 52 |
| 59 | #define LIBAVUTIL_VERSION_MINOR 59 | 59 | #define LIBAVUTIL_VERSION_MINOR 60 |
| 60 | #define LIBAVUTIL_VERSION_MICRO 100 | 60 | #define LIBAVUTIL_VERSION_MICRO 100 |
| 61 | 61 | ||
| 62 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ | 62 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |