intel / cartwheel-ffmpeg

Intel developer staging area for unmerged upstream patch contributions to FFmpeg
GNU Lesser General Public License v2.1
84 stars 31 forks source link

[VAAPI AV1 Encode] refresh_frame_flags not set in VAEncPictureParameterBufferAV1 #244

Closed sivileri closed 1 year ago

sivileri commented 1 year ago

@feiwan1 I noticed the vaapi av1 encoder is calculating refresh_frame_flags in the frame header and sending it down to VAAPI in the packed header but it's not copying it in vpic which would send it as VAEncPictureParameterBufferAV1 (zero gets sent instead always).

This one-liner below should address it in https://github.com/intel/cartwheel-ffmpeg/blob/master/patches/0071-lavc-vaapi-support-av1-encode.patch#L1568

image
xuguangxin commented 1 year ago

@sivileri , thank you for reporting this. Fei taking a vacation. He will be back next week.

feiwan1 commented 1 year ago

Hi @sivileri, Just wonder what's the issue will be if doesn't set this flag? The flag is unused in media-dirver for linux, not sure how it used on windows? In my unsderstanding this flags only helpful for uplayer app to maintain DPB buffer.

sivileri commented 1 year ago

Hi @feiwan1, thanks for following up on this. refresh_frame_flags tells in which slots (8 DPB slots) the reconstructed picture for the current frame being encoded will be stored in the DPB for future frames to use it. I think this information is useful to know how to handle any DPB updates on every frame. Also, if the driver is coding the headers, they need the value for refresh_frame_flags for the picture header (otherwise they may have to ask for the packed headers, bitstream parse the bitstream buffer passed down to the driver to get this info and re-encode the headers). Could we please add it so VAEncPictureParameterBufferAV1 has all the info directly? This was recently added to the libva-utils sample app: https://github.com/intel/libva-utils/commit/75f632fc0933c1e13df9519962720bc7ed3d4689 as well.

feiwan1 commented 1 year ago

@sivileri, sounds good for me. Will fix this in next weeks.

sivileri commented 1 year ago

@feiwan1 thanks!

feiwan1 commented 1 year ago

Fixed in https://github.com/intel-media-ci/ffmpeg/pull/648

feiwan1 commented 1 year ago

The fix also merged in cartwheel. Close this issue.