summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Isorce <[email protected]>2015-11-26 08:30:30 +0000
committerJulien Isorce <[email protected]>2015-12-01 08:21:37 +0000
commite483cba9f5ff45395fdb1cd40a796799707eb1e0 (patch)
tree7a7c70f4868e69009357ee17b07bf512c7bd9137
parentb4fb6d76161d86c67697cf28a221d7913b8d084d (diff)
st/va: also retrieve reference frames info for h264
Other hardwares than AMD require to parse: VAPictureParameterBufferH264.ReferenceFrames[16] Signed-off-by: Julien Isorce <[email protected]> Reviewed-by: Christian König <[email protected]>
-rw-r--r--src/gallium/state_trackers/va/picture_h264.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/va/picture_h264.c b/src/gallium/state_trackers/va/picture_h264.c
index f6e5b70ebcc..acbfe5d61ed 100644
--- a/src/gallium/state_trackers/va/picture_h264.c
+++ b/src/gallium/state_trackers/va/picture_h264.c
@@ -29,9 +29,23 @@
#include "util/u_video.h"
#include "va_private.h"
+static void resetReferencePictureDesc(struct pipe_h264_picture_desc *h264,
+ unsigned int i)
+{
+ h264->ref[i] = NULL;
+ h264->frame_num_list[i] = 0;
+ h264->is_long_term[i] = 0;
+ h264->top_is_reference[i] = 0;
+ h264->bottom_is_reference[i] = 0;
+ h264->field_order_cnt_list[i][0] = 0;
+ h264->field_order_cnt_list[i][1] = 0;
+}
+
void vlVaHandlePictureParameterBufferH264(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)
{
VAPictureParameterBufferH264 *h264 = buf->data;
+ unsigned int top_or_bottom_field;
+ unsigned i;
assert(buf->size >= sizeof(VAPictureParameterBufferH264) && buf->num_elements == 1);
/*CurrPic*/
@@ -91,9 +105,47 @@ void vlVaHandlePictureParameterBufferH264(vlVaDriver *drv, vlVaContext *context,
h264->pic_fields.bits.redundant_pic_cnt_present_flag;
/*reference_pic_flag*/
context->desc.h264.frame_num = h264->frame_num;
+ context->desc.h264.is_reference = h264->pic_fields.bits.reference_pic_flag;
+ context->desc.h264.bottom_field_flag =
+ h264->pic_fields.bits.field_pic_flag &&
+ (h264->CurrPic.flags & VA_PICTURE_H264_BOTTOM_FIELD) != 0;
if (!context->decoder && context->desc.h264.num_ref_frames > 0)
context->templat.max_references = MIN2(context->desc.h264.num_ref_frames, 16);
+
+ for (i = 0; i < context->templat.max_references; ++i) {
+ if ((h264->ReferenceFrames[i].flags & VA_PICTURE_H264_INVALID) ||
+ (h264->ReferenceFrames[i].picture_id == VA_INVALID_SURFACE)) {
+ resetReferencePictureDesc(&context->desc.h264, i);
+ break;
+ }
+
+ vlVaGetReferenceFrame(drv, h264->ReferenceFrames[i].picture_id, &context->desc.h264.ref[i]);
+ context->desc.h264.frame_num_list[i] = h264->ReferenceFrames[i].frame_idx;
+
+ top_or_bottom_field = h264->ReferenceFrames[i].flags &
+ (VA_PICTURE_H264_TOP_FIELD | VA_PICTURE_H264_BOTTOM_FIELD);
+ context->desc.h264.is_long_term[i] = (h264->ReferenceFrames[i].flags &
+ (VA_PICTURE_H264_SHORT_TERM_REFERENCE |
+ VA_PICTURE_H264_LONG_TERM_REFERENCE)) !=
+ VA_PICTURE_H264_SHORT_TERM_REFERENCE;
+ context->desc.h264.top_is_reference[i] =
+ !context->desc.h264.is_long_term[i] ||
+ !!(h264->ReferenceFrames[i].flags & VA_PICTURE_H264_TOP_FIELD);
+ context->desc.h264.bottom_is_reference[i] =
+ !context->desc.h264.is_long_term[i] ||
+ !!(h264->ReferenceFrames[i].flags & VA_PICTURE_H264_BOTTOM_FIELD);
+ context->desc.h264.field_order_cnt_list[i][0] =
+ top_or_bottom_field != VA_PICTURE_H264_BOTTOM_FIELD ?
+ h264->ReferenceFrames[i].TopFieldOrderCnt: INT_MAX;
+ context->desc.h264.field_order_cnt_list[i][1] =
+ top_or_bottom_field != VA_PICTURE_H264_TOP_FIELD ?
+ h264->ReferenceFrames[i].BottomFieldOrderCnt: INT_MAX;
+ }
+
+ /* Make sure remaining elements are clean */
+ for (; i < 16; ++i)
+ resetReferencePictureDesc(&context->desc.h264, i);
}
void vlVaHandleIQMatrixBufferH264(vlVaContext *context, vlVaBuffer *buf)