vulkan/video: consider removed bits when calculating the size of comsumed data.
authorHyunjun Ko <zzoon@igalia.com>
Fri, 16 Jun 2023 06:12:27 +0000 (15:12 +0900)
committerHyunjun Ko <zzoon@igalia.com>
Wed, 21 Jun 2023 10:24:49 +0000 (19:24 +0900)
Closes: mesa/mesa#9170

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23688>

src/vulkan/runtime/vk_video.c

index 713e4a2..2c456e3 100644 (file)
@@ -816,7 +816,8 @@ vk_video_parse_h265_slice_header(const struct VkVideoDecodeInfoKHR *frame_info,
          vl_rbsp_u(&rbsp, 1);
    }
 
-   unsigned header_bits = (slice_size * 8 - 24 /* start code */) - vl_vlc_bits_left(&rbsp.nal);
+   unsigned header_bits =
+      (slice_size * 8 - 24 /* start code */) - vl_vlc_bits_left(&rbsp.nal) - rbsp.removed;
    params->slice_data_bytes_offset = (header_bits + 8) / 8;
 }