This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 164df8214727fa5c99f08a0783ad632e96b8e725
Author:     Ruk Doe <[email protected]>
AuthorDate: Sat Oct 10 16:32:38 2026 +0900
Commit:     michaelni <[email protected]>
CommitDate: Fri Nov 6 04:39:07 2026 +0000

    avcodec/libaribcaption: factor out the skipped region check
    
    The bitmap CLUT seed, the single rect position and the ass loop each
    tested "ruby with ignore_ruby" on their own. Use one helper so they
    always agree on which regions are left out. It also leaves out regions
    without any character, which would otherwise produce an event holding
    only tags.
    
    Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
    Claude-Session: https://claude.ai/code/session_01DdDiDRusmi6eD7qSrKBjHb
---
 libavcodec/libaribcaption.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/libavcodec/libaribcaption.c b/libavcodec/libaribcaption.c
index 996b591b13..a5121b6eb7 100644
--- a/libavcodec/libaribcaption.c
+++ b/libavcodec/libaribcaption.c
@@ -273,6 +273,13 @@ static void clut_add(ARIBCaptionContext *ctx, uint32_t 
rgba)
     clut_set_alpha(ctx, CLUT_A(rgba));
 }
 
+/* whether a region is left out: ruby with ignore_ruby, or no character */
+static int region_skipped(const ARIBCaptionContext *ctx,
+                          const aribcc_caption_region_t *region)
+{
+    return !region->char_count || (region->is_ruby && ctx->ignore_ruby);
+}
+
 /* add the character colors of a region to the CLUT */
 static void clut_add_region(ARIBCaptionContext *ctx, aribcc_caption_region_t 
*region)
 {
@@ -401,7 +408,7 @@ static int 
aribcaption_trans_bitmap_subtitle(ARIBCaptionContext *ctx)
            Seed the CLUT with the colors of every region that may be drawn. */
         clut_reset(ctx);
         for (int i = 0; i < ctx->caption.region_count; i++)
-            if (!(ctx->ignore_ruby && ctx->caption.regions[i].is_ruby))
+            if (!region_skipped(ctx, &ctx->caption.regions[i]))
                 clut_add_region(ctx, &ctx->caption.regions[i]);
 
         rect->w = image->width * ctx->bitmap_plane_width / ctx->frame_width;
@@ -623,7 +630,7 @@ static int 
aribcaption_trans_ass_subtitle(ARIBCaptionContext *ctx)
         x = ctx->plane_width;
         y = ctx->plane_height;
         for (int i = 0; i < ctx->caption.region_count; i++) {
-            if (ctx->caption.regions[i].is_ruby && ctx->ignore_ruby)
+            if (region_skipped(ctx, &ctx->caption.regions[i]))
                 continue;
             region_position(ctx, &ctx->caption.regions[i], &rx, &ry);
             if (rx < x)
@@ -650,7 +657,7 @@ static int 
aribcaption_trans_ass_subtitle(ARIBCaptionContext *ctx)
         int char_height = ctx->font_size;
         int char_horizontal_spacing = 0;
 
-        if (region->is_ruby && ctx->ignore_ruby)
+        if (region_skipped(ctx, region))
             continue;
 
         if (single_rect && emitted)

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to