PR #21529 opened by zzoon
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21529
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21529.patch

The spec says:
   pMiColStarts is a pointer to an array of TileCols number
   of unsigned integers that corresponds to MiColStarts
   defined in section 6.8.14 of the [AV1 Specification]

And the unit of MiColStarts is MI(mode info).

So is pMiRowStarts.


>From fee2a0ee92cac589bcb478d5ed44a9e3b30742b6 Mon Sep 17 00:00:00 2001
From: Hyunjun Ko <[email protected]>
Date: Tue, 20 Jan 2026 18:36:20 +0900
Subject: [PATCH] avcodec/vulkan_av1: fix mi_col_starts and mi_row_starts units

The spec says:
   pMiColStarts is a pointer to an array of TileCols number
   of unsigned integers that corresponds to MiColStarts
   defined in section 6.8.14 of the [AV1 Specification]

And the unit of MiColStarts is MI(mode info).

So is pMiRowStarts.
---
 libavcodec/vulkan_av1.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vulkan_av1.c b/libavcodec/vulkan_av1.c
index 3bee784a4f..08c371746e 100644
--- a/libavcodec/vulkan_av1.c
+++ b/libavcodec/vulkan_av1.c
@@ -252,9 +252,11 @@ static int vk_av1_start_frame(AVCodecContext          
*avctx,
     int err;
     int ref_count = 0;
     AV1DecContext *s = avctx->priv_data;
+    const AV1RawSequenceHeader *seq = s->raw_seq;
     const AV1Frame *pic = &s->cur_frame;
     FFVulkanDecodeContext *dec = avctx->internal->hwaccel_priv_data;
     uint32_t frame_id_alloc_mask = 0;
+    uint16_t sb_shift = seq->use_128x128_superblock ? 5 : 4;
 
     AV1VulkanDecodePicture *ap = pic->hwaccel_picture_private;
     FFVulkanDecodePicture *vp = &ap->vp;
@@ -498,8 +500,8 @@ static int vk_av1_start_frame(AVCodecContext          
*avctx,
     for (int i = 0; i < 64; i++) {
         ap->width_in_sbs_minus1[i] = frame_header->width_in_sbs_minus_1[i];
         ap->height_in_sbs_minus1[i] = frame_header->height_in_sbs_minus_1[i];
-        ap->mi_col_starts[i] = frame_header->tile_start_col_sb[i];
-        ap->mi_row_starts[i] = frame_header->tile_start_row_sb[i];
+        ap->mi_col_starts[i] = frame_header->tile_start_col_sb[i] << sb_shift;
+        ap->mi_row_starts[i] = frame_header->tile_start_row_sb[i] << sb_shift;
     }
 
     for (int i = 0; i < STD_VIDEO_AV1_MAX_SEGMENTS; i++) {
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to