Ulf Zibis (12019-07-19): > >From f14142a22d340cba48b3e2352a33026590dec3a5 Mon Sep 17 00:00:00 2001 > From: Ulf Zibis <ulf.zi...@cosoco.de> > Date: 19.07.2019, 18:27:51 >
> avfilter/select: avoid twice rounding Maybe I a missing something, I see no change in rounding in this code. I suspect your diagnosis is wrong. > > diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c > index 1132375..39cc004 100644 > --- a/libavfilter/f_select.c > +++ b/libavfilter/f_select.c > @@ -297,6 +297,7 @@ > > #define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d)) > #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)) > +#define TS2DT(ts, tb) (TS2D((ts) * (tb).num / (double)(tb).den)) You are multiplying two possibly large integers: it can overflow. I am not sure if it is really a concern, but it must not be done blindly. > > static void select_frame(AVFilterContext *ctx, AVFrame *frame) > { > @@ -307,11 +308,11 @@ > if (isnan(select->var_values[VAR_START_PTS])) > select->var_values[VAR_START_PTS] = TS2D(frame->pts); > if (isnan(select->var_values[VAR_START_T])) > - select->var_values[VAR_START_T] = TS2D(frame->pts) * > av_q2d(inlink->time_base); > + select->var_values[VAR_START_T] = TS2DT(frame->pts, > inlink->time_base); > > select->var_values[VAR_N ] = inlink->frame_count_out; > select->var_values[VAR_PTS] = TS2D(frame->pts); > - select->var_values[VAR_T ] = TS2D(frame->pts) * > av_q2d(inlink->time_base); > + select->var_values[VAR_T ] = TS2DT(frame->pts, inlink->time_base); > select->var_values[VAR_POS] = frame->pkt_pos == -1 ? NAN : > frame->pkt_pos; > select->var_values[VAR_KEY] = frame->key_frame; > select->var_values[VAR_CONCATDEC_SELECT] = get_concatdec_select(frame, > av_rescale_q(frame->pts, inlink->time_base, AV_TIME_BASE_Q)); Regards, -- Nicolas George
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".