d3d12: VP9 Decode - Fix use_prev_in_find_mvs_refs calculation
authorSil Vilerino <sivileri@microsoft.com>
Fri, 3 Mar 2023 18:00:57 +0000 (13:00 -0500)
committerMarge Bot <emma+marge@anholt.net>
Sat, 4 Mar 2023 03:22:48 +0000 (03:22 +0000)
Fixes: c8e8ce83 ("d3d12: Add VP9 Decode support")

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21694>

src/gallium/drivers/d3d12/d3d12_video_dec_vp9.cpp

index 8163438..0e7c5b4 100644 (file)
@@ -348,10 +348,16 @@ d3d12_video_decoder_dxva_picparams_from_pipe_picparams_vp9(
    dxvaStructure.filter_level    = pipe_vp9->picture_parameter.filter_level;
    dxvaStructure.sharpness_level = pipe_vp9->picture_parameter.sharpness_level;
 
-   bool use_last_frame_mvs = !pipe_vp9->picture_parameter.pic_fields.error_resilient_mode && pipe_vp9->picture_parameter.pic_fields.show_frame;
+   bool use_prev_in_find_mv_refs =
+      !pipe_vp9->picture_parameter.pic_fields.error_resilient_mode &&
+      !(pipe_vp9->picture_parameter.pic_fields.frame_type == 0 /*KEY_FRAME*/ || pipe_vp9->picture_parameter.pic_fields.intra_only) &&
+      pipe_vp9->picture_parameter.pic_fields.prev_show_frame &&
+      pipe_vp9->picture_parameter.frame_width == pipe_vp9->picture_parameter.prev_frame_width &&
+      pipe_vp9->picture_parameter.frame_height == pipe_vp9->picture_parameter.prev_frame_height;
+
    dxvaStructure.wControlInfoFlags = (pipe_vp9->picture_parameter.mode_ref_delta_enabled  << 0) |
                            (pipe_vp9->picture_parameter.mode_ref_delta_update             << 1) |
-                           (use_last_frame_mvs                                            << 2) |
+                           (use_prev_in_find_mv_refs                                      << 2) |
                            (0                                                             << 3);
 
    for (uint32_t i = 0; i < 4; i++)