[FFmpeg-devel] [PATCH 1/5] avfilter/scale: store frame change eval

Gyan ffmpeg at gyani.pro
Sun Dec 15 19:06:24 EET 2019


1st of 5 factorized patches; supersedes 
https://patchwork.ffmpeg.org/patch/16272/
-------------- next part --------------
From 8ee0551584adc7020f485d7b9a237da7207fbdb6 Mon Sep 17 00:00:00 2001
From: Gyan Doshi <ffmpeg at gyani.pro>
Date: Sun, 8 Dec 2019 15:43:42 +0530
Subject: [PATCH 1/5] avfilter/scale: store frame change eval

Better readability and allows reuse
---
 libavfilter/vf_scale.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 8620d1c44e..ba693bb601 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -398,15 +398,19 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out)
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
     char buf[32];
     int in_range;
+    int frame_changed;
 
     *frame_out = NULL;
     if (in->colorspace == AVCOL_SPC_YCGCO)
         av_log(link->dst, AV_LOG_WARNING, "Detected unsupported YCgCo colorspace.\n");
 
-    if (  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) {
+    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) {
         int ret;
 
         if (scale->eval_mode == EVAL_MODE_INIT) {
-- 
2.24.0


More information about the ffmpeg-devel mailing list