d3d11av1dec: Fix for Cdef param
authorSeungha Yang <seungha@centricular.com>
Fri, 17 Dec 2021 13:24:57 +0000 (22:24 +0900)
committerSeungha Yang <seungha@centricular.com>
Fri, 17 Dec 2021 14:28:29 +0000 (23:28 +0900)
av1parser will increase the sec_strength values by 1 if parsed
values were equal to 3 as defined in spec. But DXVA wants unmodified
ones.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1455>

subprojects/gst-plugins-bad/sys/d3d11/gstd3d11av1dec.cpp

index e8bd7c8493913a6990c30c3c0897c39f4bd4443f..fab874392e73b4fb518fe17ec10199076b0750e7 100644 (file)
@@ -999,15 +999,21 @@ gst_d3d11_av1_dec_start_picture (GstAV1Decoder * decoder,
   pic_params->cdef.bits = frame_hdr->cdef_params.cdef_bits;
 
   for (i = 0; i < GST_AV1_CDEF_MAX; i++) {
+    guint8 secondary;
+
     pic_params->cdef.y_strengths[i].primary =
         frame_hdr->cdef_params.cdef_y_pri_strength[i];
-    pic_params->cdef.y_strengths[i].secondary =
-        frame_hdr->cdef_params.cdef_y_sec_strength[i];
+    secondary = frame_hdr->cdef_params.cdef_y_sec_strength[i];
+    if (secondary == 4)
+      secondary--;
+    pic_params->cdef.y_strengths[i].secondary = secondary;
 
     pic_params->cdef.uv_strengths[i].primary =
         frame_hdr->cdef_params.cdef_uv_pri_strength[i];
-    pic_params->cdef.uv_strengths[i].secondary =
-        frame_hdr->cdef_params.cdef_uv_sec_strength[i];
+    secondary = frame_hdr->cdef_params.cdef_uv_sec_strength[i];
+    if (secondary == 4)
+      secondary--;
+    pic_params->cdef.uv_strengths[i].secondary = secondary;
   }
 
   pic_params->interp_filter = frame_hdr->interpolation_filter;