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

Git pushed a commit to branch master
in repository ffmpeg.

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

    avcodec/libaribcaption: place single rect ass like the multi rect mode
    
    In multi rect mode each region position is made non-negative by adding
    the plane size when it is negative. Single rect mode instead took the
    minimum of the raw positions, then fixed only y. A negative x, or a mix
    of negative and non-negative y, put the single rect elsewhere than the
    regions it holds. Normalize each region position first, as multi rect
    mode does.
    
    Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
    Claude-Session: https://claude.ai/code/session_01DdDiDRusmi6eD7qSrKBjHb
---
 libavcodec/libaribcaption.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/libavcodec/libaribcaption.c b/libavcodec/libaribcaption.c
index 5cc00619b6..6a1a0848c5 100644
--- a/libavcodec/libaribcaption.c
+++ b/libavcodec/libaribcaption.c
@@ -582,6 +582,15 @@ static void set_ass_color(AVBPrint *buf, int color_num,
                                           0xFF - ARIBCC_COLOR_A(new_color));
 }
 
+/* position of a region, keeping the existing wrapping of negative values
+   in ass mode */
+static void region_position(const ARIBCaptionContext *ctx,
+                            const aribcc_caption_region_t *region, int *x, int 
*y)
+{
+    *x = region->x < 0 ? region->x + ctx->plane_width  : region->x;
+    *y = region->y < 0 ? region->y + ctx->plane_height : region->y;
+}
+
 static int aribcaption_trans_ass_subtitle(ARIBCaptionContext *ctx)
 {
     AVSubtitle *sub = ctx->sub;
@@ -615,16 +624,13 @@ static int 
aribcaption_trans_ass_subtitle(ARIBCaptionContext *ctx)
         for (int i = 0; i < ctx->caption.region_count; i++) {
             if (ctx->caption.regions[i].is_ruby && ctx->ignore_ruby)
                 continue;
-            rx = ctx->caption.regions[i].x;
-            ry = ctx->caption.regions[i].y;
+            region_position(ctx, &ctx->caption.regions[i], &rx, &ry);
             if (rx < x)
                 x = rx;
             if (ry < y)
                 y = ry;
         }
         av_bprintf(&buf, "{\\an7}");
-        if (y < 0)
-            y += ctx->plane_height;
         if (x > 0 || y > 0)
             av_bprintf(&buf, "{\\pos(%d,%d)}", x, y);
     }
@@ -651,12 +657,8 @@ static int 
aribcaption_trans_ass_subtitle(ARIBCaptionContext *ctx)
         emitted = true;
 
         if (!single_rect) {
-            int x = region->x;
-            int y = region->y;
-            if (x < 0)
-                x += ctx->plane_width;
-            if (y < 0)
-                y += ctx->plane_height;
+            int x, y;
+            region_position(ctx, region, &x, &y);
             av_bprint_clear(&buf);
             av_bprintf(&buf, "{\\an7}");
             if (x > 0 || y > 0)

-- 
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