[FFmpeg-cvslog] avfilter/scale2ref: update links and re-eval expr upon ref frame change
Gyan Doshi
git at videolan.org
Wed Jan 15 08:36:26 EET 2020
ffmpeg | branch: master | Gyan Doshi <ffmpeg at gyani.pro> | Sun Dec 8 16:12:28 2019 +0530| [cc9a7cae76e2bc8ded5cefff1dbf22b37a95240b] | committer: Gyan Doshi
avfilter/scale2ref: update links and re-eval expr upon ref frame change
Needed when filtergraph reinit is disabled for the ref input.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cc9a7cae76e2bc8ded5cefff1dbf22b37a95240b
---
libavfilter/vf_scale.c | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 6bda76bc99..3e97a4592a 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -392,8 +392,9 @@ static int scale_slice(AVFilterLink *link, AVFrame *out_buf, AVFrame *cur_pic, s
static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out)
{
- ScaleContext *scale = link->dst->priv;
- AVFilterLink *outlink = link->dst->outputs[0];
+ AVFilterContext *ctx = link->dst;
+ ScaleContext *scale = ctx->priv;
+ AVFilterLink *outlink = ctx->outputs[0];
AVFrame *out;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
char buf[32];
@@ -410,7 +411,9 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out)
in->sample_aspect_ratio.den != link->sample_aspect_ratio.den ||
in->sample_aspect_ratio.num != link->sample_aspect_ratio.num;
- if (frame_changed) {
+ if (frame_changed ||
+ (scale->eval_mode == EVAL_MODE_FRAME &&
+ ctx->filter == &ff_vf_scale2ref) ) {
int ret;
if (scale->eval_mode == EVAL_MODE_INIT) {
@@ -538,6 +541,23 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
static int filter_frame_ref(AVFilterLink *link, AVFrame *in)
{
AVFilterLink *outlink = link->dst->outputs[1];
+ int frame_changed;
+
+ frame_changed = in->width != link->w ||
+ in->height != link->h ||
+ in->format != link->format ||
+ in->sample_aspect_ratio.den != link->sample_aspect_ratio.den ||
+ in->sample_aspect_ratio.num != link->sample_aspect_ratio.num;
+
+ if (frame_changed) {
+ link->format = in->format;
+ link->w = in->width;
+ link->h = in->height;
+ link->sample_aspect_ratio.num = in->sample_aspect_ratio.num;
+ link->sample_aspect_ratio.den = in->sample_aspect_ratio.den;
+
+ config_props_ref(outlink);
+ }
return ff_filter_frame(outlink, in);
}
More information about the ffmpeg-cvslog
mailing list