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

Git pushed a commit to branch master
in repository ffmpeg.

commit b5d8c529339aafc9768a025b6e363f64a7fa3154
Author:     Mark Thompson <[email protected]>
AuthorDate: Mon May 4 12:29:00 2026 +0100
Commit:     Mark Thompson <[email protected]>
CommitDate: Tue Oct 13 21:16:28 2026 +0100

    cbs_apv: Support tile_dummy_bytes
---
 libavcodec/cbs_apv_syntax_template.c | 48 +++++++++++++++++++++++++++++++++---
 1 file changed, 45 insertions(+), 3 deletions(-)

diff --git a/libavcodec/cbs_apv_syntax_template.c 
b/libavcodec/cbs_apv_syntax_template.c
index f8c902d95b..8640bcfa00 100644
--- a/libavcodec/cbs_apv_syntax_template.c
+++ b/libavcodec/cbs_apv_syntax_template.c
@@ -228,11 +228,13 @@ static int FUNC(tile)(CodedBitstreamContext *ctx, 
RWContext *rw,
                       int tile_idx, uint32_t tile_size)
 {
     const CodedBitstreamAPVContext *priv = ctx->priv_data;
+    uint32_t data_size, padding_size;
     int err;
 
     CHECK(FUNC(tile_header)(ctx, rw, &current->tile_header,
                             tile_idx, tile_size));
 
+    data_size = 0;
     for (int c = 0; c < priv->num_comp; c++) {
         uint32_t comp_size = current->tile_header.tile_data_size[c];
 #ifdef READ
@@ -246,6 +248,24 @@ static int FUNC(tile)(CodedBitstreamContext *ctx, 
RWContext *rw,
         if (put_bytes_left(rw, 0) < comp_size)
             return AVERROR(ENOSPC);
         ff_copy_bits(rw, current->tile_data[c], comp_size * 8);
+#endif
+        data_size += comp_size;
+    }
+
+    av_assert0(tile_size >=
+               current->tile_header.tile_header_size + data_size);
+    padding_size = tile_size -
+        (current->tile_header.tile_header_size + data_size);
+
+    if (padding_size > 0) {
+#ifdef READ
+        current->tile_dummy_byte      = (uint8_t*)align_get_bits(rw);
+        current->tile_dummy_byte_size = padding_size;
+        skip_bits_long(rw, 8 * padding_size);
+#else
+        if (put_bytes_left(rw, 0) < padding_size)
+            return AVERROR(ENOSPC);
+        ff_copy_bits(rw, current->tile_dummy_byte, 8 * padding_size);
 #endif
     }
 
@@ -255,20 +275,42 @@ static int FUNC(tile)(CodedBitstreamContext *ctx, 
RWContext *rw,
 static int FUNC(frame)(CodedBitstreamContext *ctx, RWContext *rw,
                        APVRawFrame *current)
 {
-    const CodedBitstreamAPVContext *priv = ctx->priv_data;
+    CodedBitstreamAPVContext *priv = ctx->priv_data;
     int err;
 
     HEADER("Frame");
 
+#ifdef WRITE
+    // Calculate tile sizes from header, components and padding
+    // before writing any of them.  Must be done early because we might
+    // need to write them in the header.
+
+    cbs_apv_derive_tile_info(ctx, &current->frame_header);
+    priv->num_comp = cbs_apv_get_num_comp(&current->frame_header);
+
+    for (int t = 0; t < priv->num_tiles; t++) {
+        APVRawTile *tile = &current->tile[t];
+        uint32_t size = tile->tile_header.tile_header_size;
+        for (int c = 0; c < priv->num_comp; c++)
+            size += tile->tile_header.tile_data_size[c];
+        size += tile->tile_dummy_byte_size;
+
+        current->tile_size[t] = size;
+        if (current->frame_header.tile_info.tile_size_present_in_fh_flag)
+            current->frame_header.tile_info.tile_size_in_fh[t] = size;
+    }
+#endif
+
     CHECK(FUNC(pbu_header)(ctx, rw, &current->pbu_header));
 
     CHECK(FUNC(frame_header)(ctx, rw, &current->frame_header));
 
     for (int t = 0; t < priv->num_tiles; t++) {
+        APVRawTile *tile = &current->tile[t];
+
         us(32, tile_size[t], 10, MAX_INT_BITS(32), 1, t);
 
-        CHECK(FUNC(tile)(ctx, rw, &current->tile[t],
-                         t, current->tile_size[t]));
+        CHECK(FUNC(tile)(ctx, rw, tile, t, current->tile_size[t]));
     }
 
     CHECK(FUNC(filler)(ctx, rw, &current->filler));

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