diff mbox

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

Message ID 82505e74-6822-177e-6fc4-8d6326c42947@gyani.pro
State Accepted
Headers show

Commit Message

Gyan Doshi Dec. 15, 2019, 5:06 p.m. UTC
1st of 5 factorized patches; supersedes 
https://patchwork.ffmpeg.org/patch/16272/
From 8ee0551584adc7020f485d7b9a237da7207fbdb6 Mon Sep 17 00:00:00 2001
From: Gyan Doshi <ffmpeg@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(-)

Comments

Michael Niedermayer Dec. 16, 2019, 7:46 p.m. UTC | #1
On Sun, Dec 15, 2019 at 10:36:24PM +0530, Gyan wrote:
> 1st of 5 factorized patches; supersedes
> https://patchwork.ffmpeg.org/patch/16272/

>  vf_scale.c |   12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 5bd3cae6c4cb4ae8f83d59230986b559103597fd  0001-avfilter-scale-store-frame-change-eval.patch
> From 8ee0551584adc7020f485d7b9a237da7207fbdb6 Mon Sep 17 00:00:00 2001
> From: Gyan Doshi <ffmpeg@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(-)

LGTM

thx

[...]
diff mbox

Patch

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) {