[FFmpeg-devel] [PATCH] lavfi/vf_drawtext: use INT_(MIN|MAX) instead of hardcoded values
Leandro Santiago
leandrosansilva at gmail.com
Thu Oct 31 22:08:22 EET 2024
The values +-32000 smell like something that will break in the future.
Signed-off-by: Leandro Santiago <leandrosansilva at gmail.com>
---
libavfilter/vf_drawtext.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 2b0a21a4b4..96a8a59f0e 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -1399,9 +1399,9 @@ static int measure_text(AVFilterContext *ctx,
TextMetrics *metrics)
char *textdup = NULL, *start = NULL;
int num_chars = 0;
int width64 = 0, w64 = 0;
- int cur_min_y64 = 0, first_max_y64 = -32000;
- int first_min_x64 = 32000, last_max_x64 = -32000;
- int min_y64 = 32000, max_y64 = -32000, min_x64 = 32000, max_x64 =
-32000;
+ int cur_min_y64 = 0, first_max_y64 = INT_MIN;
+ int first_min_x64 = INT_MAX, last_max_x64 = INT_MIN;
+ int min_y64 = INT_MAX, max_y64 = INT_MIN, min_x64 = INT_MAX,
max_x64 = INT_MIN;
int line_count = 0;
uint32_t code = 0;
Glyph *glyph = NULL;
@@ -1465,7 +1465,7 @@ continue_on_failed2:
goto done;
}
w64 = 0;
- cur_min_y64 = 32000;
+ cur_min_y64 = INT_MAX;
for (int t = 0; t < hb->glyph_count; ++t) {
uint8_t is_tab = last_tab_idx < s->tab_count &&
hb->glyph_info[t].cluster ==
s->tab_clusters[last_tab_idx] - line_offset;
--
2.46.1
More information about the ffmpeg-devel
mailing list