[FFmpeg-devel] [PATCH] vf_drawtext: simplify condition in draw_text()

Stefano Sabatini stefasab at gmail.com
Tue Sep 20 20:30:18 CEST 2011


Change assignment from:
str_w = FFMIN(width - dtext->x - 1, FFMAX(str_w, x - dtext->x));
to:
str_w = FFMIN(width - dtext->x - 1, str_w);

str_w is already a least upper bound of x-dtext->x, so the FFMAX
operation is pointless.
---
 libavfilter/vf_drawtext.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 9ad7401..b16494a 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -669,7 +669,7 @@ static int draw_text(AVFilterContext *ctx, AVFilterBufferRef *picref,
         else              x += glyph->advance;
     }
 
-    str_w = FFMIN(width - dtext->x - 1, FFMAX(str_w, x - dtext->x));
+    str_w = FFMIN(width - dtext->x - 1, str_w);
     y     = FFMIN(y + text_height, height - 1);
 
     /* draw box */
-- 
1.7.2.5



More information about the ffmpeg-devel mailing list