Skip to content

Commit

Permalink
Check the flags of the packed headers when creating a config
Browse files Browse the repository at this point in the history
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
  • Loading branch information
xhaihao authored and uartie committed Jan 22, 2018
1 parent 336d891 commit cccf2a3
Showing 1 changed file with 42 additions and 21 deletions.
63 changes: 42 additions & 21 deletions src/i965_drv_video.c
Expand Up @@ -1000,6 +1000,36 @@ i965_get_rc_attributes(VADriverContextP ctx, VAProfile profile, VAEntrypoint ent
return rc_attribs;
}

static uint32_t
i965_get_enc_packed_attributes(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoint)
{
uint32_t enc_packed_attribs = VA_ATTRIB_NOT_SUPPORTED;

if (entrypoint == VAEntrypointEncSlice ||
entrypoint == VAEntrypointEncSliceLP ||
entrypoint == VAEntrypointFEI) {
enc_packed_attribs = VA_ENC_PACKED_HEADER_SEQUENCE | VA_ENC_PACKED_HEADER_PICTURE | VA_ENC_PACKED_HEADER_MISC;

if (profile == VAProfileH264ConstrainedBaseline ||
profile == VAProfileH264Main ||
profile == VAProfileH264High ||
profile == VAProfileH264StereoHigh ||
profile == VAProfileH264MultiviewHigh ||
profile == VAProfileHEVCMain ||
profile == VAProfileHEVCMain10) {
enc_packed_attribs |= (VA_ENC_PACKED_HEADER_RAW_DATA | VA_ENC_PACKED_HEADER_SLICE);

} else if (profile == VAProfileVP9Profile0)
enc_packed_attribs = VA_ENC_PACKED_HEADER_RAW_DATA;

} else if (entrypoint == VAEntrypointEncPicture) {
if (profile == VAProfileJPEGBaseline)
enc_packed_attribs = VA_ENC_PACKED_HEADER_RAW_DATA;
}

return enc_packed_attribs;
}

VAStatus
i965_GetConfigAttributes(VADriverContextP ctx,
VAProfile profile,
Expand Down Expand Up @@ -1031,27 +1061,7 @@ i965_GetConfigAttributes(VADriverContextP ctx,
break;

case VAConfigAttribEncPackedHeaders:
if (entrypoint == VAEntrypointEncSlice ||
entrypoint == VAEntrypointEncSliceLP ||
entrypoint == VAEntrypointFEI) {
attrib_list[i].value = VA_ENC_PACKED_HEADER_SEQUENCE | VA_ENC_PACKED_HEADER_PICTURE | VA_ENC_PACKED_HEADER_MISC;
if (profile == VAProfileH264ConstrainedBaseline ||
profile == VAProfileH264Main ||
profile == VAProfileH264High ||
profile == VAProfileH264StereoHigh ||
profile == VAProfileH264MultiviewHigh ||
profile == VAProfileHEVCMain ||
profile == VAProfileHEVCMain10) {
attrib_list[i].value |= (VA_ENC_PACKED_HEADER_RAW_DATA |
VA_ENC_PACKED_HEADER_SLICE);
} else if (profile == VAProfileVP9Profile0)
attrib_list[i].value = VA_ENC_PACKED_HEADER_RAW_DATA;
break;
} else if (entrypoint == VAEntrypointEncPicture) {
if (profile == VAProfileJPEGBaseline)
attrib_list[i].value = VA_ENC_PACKED_HEADER_RAW_DATA;
} else if (entrypoint == VAEntrypointStats)
attrib_list[i].value = VA_ATTRIB_NOT_SUPPORTED;
attrib_list[i].value = i965_get_enc_packed_attributes(ctx, profile, entrypoint);

break;

Expand Down Expand Up @@ -1380,6 +1390,17 @@ i965_CreateConfig(VADriverContextP ctx,
}
}

if (vaStatus == VA_STATUS_SUCCESS) {
VAConfigAttrib *attrib_found = i965_lookup_config_attribute(obj_config, VAConfigAttribEncPackedHeaders);

if (attrib_found) {
uint32_t enc_packed_attribs = i965_get_enc_packed_attributes(ctx, profile, entrypoint);

if (!(attrib_found->value & enc_packed_attribs))
vaStatus = VA_STATUS_ERROR_INVALID_VALUE;
}
}

if (vaStatus == VA_STATUS_SUCCESS) {
VAConfigAttrib attrib;
attrib.type = VAConfigAttribEncMaxSlices;
Expand Down

0 comments on commit cccf2a3

Please sign in to comment.