Mercurial > libavformat.hg
comparison utils.c @ 1379:4146500158b5 libavformat
Rename ABS macro to FFABS.
author | diego |
---|---|
date | Wed, 11 Oct 2006 23:17:58 +0000 |
parents | 0899bfe4105c |
children | 3e12e3ca0ce3 |
comparison
equal
deleted
inserted
replaced
1378:a32812bb5bcf | 1379:4146500158b5 |
---|---|
709 st->last_IP_pts= pkt->pts; | 709 st->last_IP_pts= pkt->pts; |
710 /* cannot compute PTS if not present (we can compute it only | 710 /* cannot compute PTS if not present (we can compute it only |
711 by knowing the futur */ | 711 by knowing the futur */ |
712 } else if(pkt->pts != AV_NOPTS_VALUE || pkt->dts != AV_NOPTS_VALUE || pkt->duration){ | 712 } else if(pkt->pts != AV_NOPTS_VALUE || pkt->dts != AV_NOPTS_VALUE || pkt->duration){ |
713 if(pkt->pts != AV_NOPTS_VALUE && pkt->duration){ | 713 if(pkt->pts != AV_NOPTS_VALUE && pkt->duration){ |
714 int64_t old_diff= ABS(st->cur_dts - pkt->duration - pkt->pts); | 714 int64_t old_diff= FFABS(st->cur_dts - pkt->duration - pkt->pts); |
715 int64_t new_diff= ABS(st->cur_dts - pkt->pts); | 715 int64_t new_diff= FFABS(st->cur_dts - pkt->pts); |
716 if(old_diff < new_diff && old_diff < (pkt->duration>>3)){ | 716 if(old_diff < new_diff && old_diff < (pkt->duration>>3)){ |
717 pkt->pts += pkt->duration; | 717 pkt->pts += pkt->duration; |
718 // av_log(NULL, AV_LOG_DEBUG, "id:%d old:%Ld new:%Ld dur:%d cur:%Ld size:%d\n", pkt->stream_index, old_diff, new_diff, pkt->duration, st->cur_dts, pkt->size); | 718 // av_log(NULL, AV_LOG_DEBUG, "id:%d old:%Ld new:%Ld dur:%d cur:%Ld size:%d\n", pkt->stream_index, old_diff, new_diff, pkt->duration, st->cur_dts, pkt->size); |
719 } | 719 } |
720 } | 720 } |
1945 num= st->time_base.den*duration_count[i]; | 1945 num= st->time_base.den*duration_count[i]; |
1946 den= st->time_base.num*duration_sum[i]; | 1946 den= st->time_base.num*duration_sum[i]; |
1947 | 1947 |
1948 best_error= INT64_MAX; | 1948 best_error= INT64_MAX; |
1949 for(j=1; j<60*12; j++){ | 1949 for(j=1; j<60*12; j++){ |
1950 error= ABS(1001*12*num - 1001*j*den); | 1950 error= FFABS(1001*12*num - 1001*j*den); |
1951 if(error < best_error){ | 1951 if(error < best_error){ |
1952 best_error= error; | 1952 best_error= error; |
1953 av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, j, 12, INT_MAX); | 1953 av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, j, 12, INT_MAX); |
1954 } | 1954 } |
1955 } | 1955 } |
1956 for(j=0; j<3; j++){ | 1956 for(j=0; j<3; j++){ |
1957 static const int ticks[]= {24,30,60}; | 1957 static const int ticks[]= {24,30,60}; |
1958 error= ABS(1001*12*num - 1000*12*den * ticks[j]); | 1958 error= FFABS(1001*12*num - 1000*12*den * ticks[j]); |
1959 if(error < best_error){ | 1959 if(error < best_error){ |
1960 best_error= error; | 1960 best_error= error; |
1961 av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, ticks[j]*1000, 1001, INT_MAX); | 1961 av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, ticks[j]*1000, 1001, INT_MAX); |
1962 } | 1962 } |
1963 } | 1963 } |