OSDN Git Service

VC1: Fix for frame coding mode
authorXiang, Haihao <haihao.xiang@intel.com>
Mon, 8 Jan 2018 12:34:11 +0000 (20:34 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Tue, 9 Jan 2018 08:18:30 +0000 (16:18 +0800)
Some VC1 clips might be marked interlaced but have fcm < 2, and the
wrong fcm will lead to undefined behavior, such as GPU hang.

This fixes https://github.com/01org/intel-vaapi-driver/issues/316

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
src/gen75_mfd.c
src/gen7_mfd.c
src/gen8_mfd.c

index d23b34a..19c3bbb 100644 (file)
@@ -2080,10 +2080,12 @@ gen75_mfd_vc1_pic_state(VADriverContextP ctx,
     assert(pic_param->picture_fields.bits.frame_coding_mode < 3);
 
     if (pic_param->sequence_fields.bits.interlace) {
-        if (!pic_param->picture_fields.bits.top_field_first)
-            fcm = 3;
-        else
+        if (pic_param->picture_fields.bits.frame_coding_mode < 2)
             fcm = pic_param->picture_fields.bits.frame_coding_mode;
+        else if (!pic_param->picture_fields.bits.top_field_first)
+            fcm = 3; /* Field with bottom field first */
+        else
+            fcm = 2; /* Field with top field first */
     }
 
     if (pic_param->sequence_fields.bits.interlace &&
index bc12677..6805bd8 100644 (file)
@@ -1814,10 +1814,12 @@ gen7_mfd_vc1_pic_state(VADriverContextP ctx,
     assert(pic_param->picture_fields.bits.frame_coding_mode < 3);
 
     if (pic_param->sequence_fields.bits.interlace) {
-        if (!pic_param->picture_fields.bits.top_field_first)
-            fcm = 3;
-        else
+        if (pic_param->picture_fields.bits.frame_coding_mode < 2)
             fcm = pic_param->picture_fields.bits.frame_coding_mode;
+        else if (!pic_param->picture_fields.bits.top_field_first)
+            fcm = 3; /* Field with bottom field first */
+        else
+            fcm = 2; /* Field with top field first */
     }
 
     if (pic_param->sequence_fields.bits.interlace &&
index f8dba29..93ec4f7 100644 (file)
@@ -1859,10 +1859,12 @@ gen8_mfd_vc1_pic_state(VADriverContextP ctx,
     assert(pic_param->picture_fields.bits.frame_coding_mode < 3);
 
     if (pic_param->sequence_fields.bits.interlace) {
-        if (!pic_param->picture_fields.bits.top_field_first)
-            fcm = 3;
-        else
+        if (pic_param->picture_fields.bits.frame_coding_mode < 2)
             fcm = pic_param->picture_fields.bits.frame_coding_mode;
+        else if (!pic_param->picture_fields.bits.top_field_first)
+            fcm = 3; /* Field with bottom field first */
+        else
+            fcm = 2; /* Field with top field first */
     }
 
     if (pic_param->sequence_fields.bits.interlace &&