OSDN Git Service

add brc mode check for AVC when creating the config
authorPengfei Qu <Pengfei.Qu@intel.com>
Thu, 8 Jun 2017 09:55:17 +0000 (17:55 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Thu, 10 Aug 2017 06:39:17 +0000 (14:39 +0800)
v0:this add the RC check for AVC encoder

Fixes #35

Signed-off-by: Pengfei Qu <Pengfei.Qu@intel.com>
src/i965_drv_video.c

index 34eed12..7e87870 100644 (file)
@@ -1296,6 +1296,27 @@ i965_CreateConfig(VADriverContextP ctx,
             vaStatus = VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
     }
 
+
+    if (vaStatus == VA_STATUS_SUCCESS) {
+        VAConfigAttrib attrib, *attrib_found;
+        attrib.type = VAConfigAttribRateControl;
+        attrib_found = i965_lookup_config_attribute(obj_config, attrib.type);
+        switch (profile) {
+        case VAProfileH264ConstrainedBaseline:
+        case VAProfileH264Main:
+        case VAProfileH264High:
+            if ((entrypoint == VAEntrypointEncSlice) &&
+                !(attrib_found->value & i965->codec_info->h264_brc_mode))
+                vaStatus = VA_STATUS_ERROR_INVALID_CONFIG;
+            else if ((entrypoint == VAEntrypointEncSliceLP) &&
+                     !(attrib_found->value & i965->codec_info->lp_h264_brc_mode))
+                vaStatus = VA_STATUS_ERROR_INVALID_CONFIG;
+            break;
+        default:
+            break;
+        }
+    }
+
     if (vaStatus == VA_STATUS_SUCCESS) {
         VAConfigAttrib attrib;
         attrib.type = VAConfigAttribEncMaxSlices;