[FFmpeg-devel] [PATCH v4 2/2] lavc/vulkan_av1: port to the new stable API

James Almer jamrial at gmail.com
Tue Feb 13 14:16:54 EET 2024


On 2/13/2024 9:10 AM, Lynne wrote:
> Feb 13, 2024, 01:59 by ffmpeg-devel at ffmpeg.org:
> 
>> On Sun Feb 11, 2024 at 10:15 AM EST, Lynne wrote:
>>
>>> From: Lynne <dev at lynne.ee>
>>> Date: Fri, 19 Jan 2024 10:49:02 +1000
>>> Subject: [PATCH v4 2/2] lavc/vulkan_av1: port to the new stable API
>>>
>>> Most of this patch was written by Dave Airlie <airlied at redhat.com>,
>>> with some additions by me.
>>> ---
>>>
>>>   
>>> -    ap->av1_pic_info = (VkVideoDecodeAV1PictureInfoMESA) {
>>> -        .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PICTURE_INFO_MESA,
>>> -        .frame_header = &ap->av1_frame_header,
>>> -        .tile_list = &ap->tile_list,
>>> +    ap->av1_pic_info = (VkVideoDecodeAV1PictureInfoKHR) {
>>> +        .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PICTURE_INFO_KHR,
>>> +        .pStdPictureInfo = &ap->std_pic_info,
>>> +        .tileCount = ap->tile_count,
>>> +        .pTileOffsets = ap->tile_offsets,
>>>
>>
>> Mentioned this on IRC earlier, but this means the driver always get
>> pTileOffsets = NULL, since ap->tile_offsets only gets filled out during
>> vk_av1_decode_slice().
>>
> 
> Thanks, already fixed it, I did report back on IRC.
> 
> 
>>> +
>>> +    ap->loop_restoration = (StdVideoAV1LoopRestoration) {
>>> +        .FrameRestorationType[0] = remap_lr_type[frame_header->lr_type[0]],
>>> +        .FrameRestorationType[1] = remap_lr_type[frame_header->lr_type[1]],
>>> +        .FrameRestorationType[2] = remap_lr_type[frame_header->lr_type[2]],
>>> +        .LoopRestorationSize[0] = AV1_RESTORATION_TILESIZE_MAX >> (2 - frame_header->lr_unit_shift),
>>> +        .LoopRestorationSize[1] = ap->loop_restoration.LoopRestorationSize[0] >> frame_header->lr_uv_shift,
>>> +        .LoopRestorationSize[2] = ap->loop_restoration.LoopRestorationSize[0] >> frame_header->lr_uv_shift,
>>> +    };
>>>
>>
>> Not sure what the C spec says, but at least on GCC 13.2.1 it seems like
>> the assignment for LoopRestorationSize[1] and [2] happens before the
>> initalization of LoopRestorationSize[0].
>>
> 
> Nothing here on gcc-12, gcc-14 and clang-19.

If some compilers break with it, then it needs to be changed. So make it:

> ap->loop_restoration = (StdVideoAV1LoopRestoration) {
>     .FrameRestorationType[0] = remap_lr_type[frame_header->lr_type[0]],
>     .FrameRestorationType[1] = remap_lr_type[frame_header->lr_type[1]],
>     .FrameRestorationType[2] = remap_lr_type[frame_header->lr_type[2]],
>     .LoopRestorationSize[0] = AV1_RESTORATION_TILESIZE_MAX >> (2 - frame_header->lr_unit_shift),
> };
> ap->loop_restoration.LoopRestorationSize[1] =
> ap->loop_restoration.LoopRestorationSize[2] = ap->loop_restoration.LoopRestorationSize[0] >> frame_header->lr_uv_shift,


More information about the ffmpeg-devel mailing list