From 367ba33bc2cf3d0d822ef131d3fb34912f59cc15 Mon Sep 17 00:00:00 2001
From: PoorvaGaikar <pbgaikar_b21@el.vjti.ac.in>
Date: Sat, 9 Mar 2024 00:27:25 +0530
Subject: [PATCH] avfilter/f_select.c: add support for iw and ih constants

avfilter/f_select.c: add support for iw and ih constants

avfilter/f_select.c:add support for iw and ih constants
---
 libavfilter/f_select.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
index 9b330a0673..dcb3e5ad9d 100644
--- a/libavfilter/f_select.c
+++ b/libavfilter/f_select.c
@@ -90,6 +90,9 @@ static const char *const var_names[] = {
 
     "concatdec_select",  ///< frame is within the interval set by the concat demuxer
 
+    "ih",                ///< ih: Represents the height of the input video frame.
+    "iw",                ///< iw: Represents the width of the input video frame.
+
     NULL
 };
 
@@ -144,6 +147,9 @@ enum var_name {
 
     VAR_CONCATDEC_SELECT,
 
+    VAR_IH,
+    VAR_IW,
+
     VAR_VARS_NB
 };
 
@@ -264,6 +270,9 @@ static int config_input(AVFilterLink *inlink)
     select->var_values[VAR_CONSUMED_SAMPLES_N] = NAN;
     select->var_values[VAR_SAMPLES_N]          = NAN;
 
+    select->var_values[VAR_IH] = inlink->h;
+    select->var_values[VAR_IW] = inlink->w;
+
     select->var_values[VAR_SAMPLE_RATE] =
         inlink->type == AVMEDIA_TYPE_AUDIO ? inlink->sample_rate : NAN;
 
@@ -371,6 +380,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
         break;
     }
 
+    select->var_values[VAR_IH] = frame->height;
+    select->var_values[VAR_IW] = frame->width;
+
     select->select = res = av_expr_eval(select->expr, select->var_values, NULL);
     av_log(inlink->dst, AV_LOG_DEBUG,
            "n:%f pts:%f t:%f key:%d",
@@ -545,4 +557,4 @@ const AVFilter ff_vf_select = {
     FILTER_QUERY_FUNC(query_formats),
     .flags         = AVFILTER_FLAG_DYNAMIC_OUTPUTS | AVFILTER_FLAG_METADATA_ONLY,
 };
-#endif /* CONFIG_SELECT_FILTER */
+#endif /* CONFIG_SELECT_FILTER */
\ No newline at end of file
-- 
2.43.0.windows.1

