diff options
| author | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2012-01-29 19:07:37 +0100 |
|---|---|---|
| committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2012-02-01 23:56:41 +0100 |
| commit | 368731d104da84605fcf6683d6ce014916fe76b0 (patch) | |
| tree | 17c854ad111702a10ea55d3ba1a28efc28933a52 /src/gen6_mfd.c | |
| parent | 99ded53e66af1903f1d58ffbc24404d435a6de84 (diff) | |
h264: fix and simplify REF_IDX_STATE (ILK, SNB, IVB).
Original code was parsing RefPicList0/1 over what is actually available
and filled in, i.e. wrt. num_ref_idx_l0/1_minus1 + 1. Besides, bit 5 of
Reference List Entry set to 1 means a frame, not a field.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Diffstat (limited to 'src/gen6_mfd.c')
| -rw-r--r-- | src/gen6_mfd.c | 77 |
1 files changed, 7 insertions, 70 deletions
diff --git a/src/gen6_mfd.c b/src/gen6_mfd.c index a38360b..811135c 100644 --- a/src/gen6_mfd.c +++ b/src/gen6_mfd.c @@ -36,6 +36,7 @@ #include "i965_defines.h" #include "i965_drv_video.h" +#include "i965_decoder_utils.h" #include "gen6_mfd.h" @@ -781,81 +782,17 @@ gen6_mfd_avc_phantom_slice_state(VADriverContextP ctx, ADVANCE_BCS_BATCH(batch); } -static void +static inline void gen6_mfd_avc_ref_idx_state(VADriverContextP ctx, VAPictureParameterBufferH264 *pic_param, VASliceParameterBufferH264 *slice_param, struct gen6_mfd_context *gen6_mfd_context) { - struct intel_batchbuffer *batch = gen6_mfd_context->base.batch; - int i, j, num_ref_list; - struct { - unsigned char bottom_idc:1; - unsigned char frame_store_index:4; - unsigned char field_picture:1; - unsigned char long_term:1; - unsigned char non_exist:1; - } refs[32]; - - if (slice_param->slice_type == SLICE_TYPE_I || - slice_param->slice_type == SLICE_TYPE_SI) - return; - - if (slice_param->slice_type == SLICE_TYPE_P || - slice_param->slice_type == SLICE_TYPE_SP) { - num_ref_list = 1; - } else { - num_ref_list = 2; - } - - for (i = 0; i < num_ref_list; i++) { - VAPictureH264 *va_pic; - - if (i == 0) { - va_pic = slice_param->RefPicList0; - } else { - va_pic = slice_param->RefPicList1; - } - - BEGIN_BCS_BATCH(batch, 10); - OUT_BCS_BATCH(batch, MFX_AVC_REF_IDX_STATE | (10 - 2)); - OUT_BCS_BATCH(batch, i); - - for (j = 0; j < 32; j++) { - if (va_pic->flags & VA_PICTURE_H264_INVALID) { - refs[j].non_exist = 1; - refs[j].long_term = 1; - refs[j].field_picture = 1; - refs[j].frame_store_index = 0xf; - refs[j].bottom_idc = 1; - } else { - int frame_idx; - - for (frame_idx = 0; frame_idx < ARRAY_ELEMS(gen6_mfd_context->reference_surface); frame_idx++) { - if (gen6_mfd_context->reference_surface[frame_idx].surface_id != VA_INVALID_ID && - va_pic->picture_id == gen6_mfd_context->reference_surface[frame_idx].surface_id) { - assert(frame_idx == gen6_mfd_context->reference_surface[frame_idx].frame_store_id); - break; - } - } - - assert(frame_idx < ARRAY_ELEMS(gen6_mfd_context->reference_surface)); - - refs[j].non_exist = 0; - refs[j].long_term = !!(va_pic->flags & VA_PICTURE_H264_LONG_TERM_REFERENCE); - refs[j].field_picture = !!(va_pic->flags & - (VA_PICTURE_H264_TOP_FIELD | - VA_PICTURE_H264_BOTTOM_FIELD)); - refs[j].frame_store_index = frame_idx; - refs[j].bottom_idc = !!(va_pic->flags & VA_PICTURE_H264_BOTTOM_FIELD); - } - - va_pic++; - } - - intel_batchbuffer_data(batch, refs, sizeof(refs)); - ADVANCE_BCS_BATCH(batch); - } + gen6_send_avc_ref_idx_state( + gen6_mfd_context->base.batch, + slice_param, + gen6_mfd_context->reference_surface + ); } static void |
