[FFmpeg-devel] [PATCH v2 6/9] lavc/ccaption_dec: clear all unused rows during rollup

Aman Gupta ffmpeg at tmm1.net
Wed Jan 13 02:42:57 CET 2016


From: Aman Gupta <aman at tmm1.net>

Sometimes rollup captions can move around the screen. This fixes "ghost"
captions from below the current rollup area from continuing to be
captured when a rollup moves higher up on the screen.
---
 libavcodec/ccaption_dec.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index 50625df..ff0735e 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -295,9 +295,11 @@ static void roll_up(CCaptionSubContext *ctx)
      */
     keep_lines = FFMIN(ctx->cursor_row + 1, ctx->rollup);
 
-    for (i = 0; i < ctx->cursor_row - keep_lines; i++)
+    for (i = 0; i < SCREEN_ROWS; i++) {
+        if (i > (ctx->cursor_row - keep_lines) && i <= ctx->cursor_row)
+            continue;
         UNSET_FLAG(screen->row_used, i);
-
+    }
 
     for (i = 0; i < keep_lines && screen->row_used; i++) {
         const int i_row = ctx->cursor_row - keep_lines + i + 1;
@@ -307,8 +309,8 @@ static void roll_up(CCaptionSubContext *ctx)
         memcpy(screen->fonts[i_row], screen->fonts[i_row+1], SCREEN_COLUMNS);
         if (CHECK_FLAG(screen->row_used, i_row + 1))
             SET_FLAG(screen->row_used, i_row);
-
     }
+
     UNSET_FLAG(screen->row_used, ctx->cursor_row);
 }
 
-- 
2.5.3



More information about the ffmpeg-devel mailing list