+#if QSV_VERSION_ATLEAST(1,6)
+ q->extco2.Header.BufferId = MFX_EXTBUFF_CODING_OPTION2;
+ q->extco2.Header.BufferSz = sizeof(q->extco2);
+
+#if QSV_VERSION_ATLEAST(1,7)
+ // valid value range is from 10 to 100 inclusive
+ // to instruct the encoder to use the default value this should be set to zero
+ q->extco2.LookAheadDepth = q->look_ahead_depth != 0 ? FFMAX(10, q->look_ahead_depth) : 0;
+#endif
+#if QSV_VERSION_ATLEAST(1,8)
+ q->extco2.LookAheadDS = q->look_ahead_downsampling;
+#endif
+
+ q->extparam[1] = (mfxExtBuffer *)&q->extco2;
+
+#endif