diff options
author | carpalis <jerome.borsboom@carpalis.nl> | 2017-10-21 16:53:16 +0200 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2018-01-05 14:57:31 +0800 |
commit | f01b8450282ea374ead0ce87c95369ed3c67d819 (patch) | |
tree | 8318740a69467d7c5b55f760b027aba43581d4e0 /src/gen8_mfd.c | |
parent | b64b43706896cd4cd2357b2ae4b34de2bea54194 (diff) | |
download | libva-intel-driver-f01b8450282ea374ead0ce87c95369ed3c67d819.tar.gz |
genX_mfd: fix bitplane encoding for skipped pictures
VC-1 skipped pictures do not encode a slice or MB layer, nor do they
encode any bitplanes. For a skipped picture, we should unconditionally
encode the bitplane buffer with only the SKIPMB bit set. Furthermore,
we optimize the static picture_type comparison out of the double loop.
Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
Diffstat (limited to 'src/gen8_mfd.c')
-rw-r--r-- | src/gen8_mfd.c | 56 |
1 files changed, 36 insertions, 20 deletions
diff --git a/src/gen8_mfd.c b/src/gen8_mfd.c index 124f72e4..1ef2525e 100644 --- a/src/gen8_mfd.c +++ b/src/gen8_mfd.c @@ -1391,7 +1391,10 @@ gen8_mfd_vc1_decode_init(VADriverContextP ctx, gen7_mfd_context->mpr_row_store_scratch_buffer.valid = 0; - gen7_mfd_context->bitplane_read_buffer.valid = !!pic_param->bitplane_present.value; + if (picture_type == GEN7_VC1_SKIPPED_PICTURE) + gen7_mfd_context->bitplane_read_buffer.valid = 1; + else + gen7_mfd_context->bitplane_read_buffer.valid = !!pic_param->bitplane_present.value; dri_bo_unreference(gen7_mfd_context->bitplane_read_buffer.bo); if (gen7_mfd_context->bitplane_read_buffer.valid) { @@ -1401,9 +1404,6 @@ gen8_mfd_vc1_decode_init(VADriverContextP ctx, int src_w, src_h; uint8_t *src = NULL, *dst = NULL; - assert(decode_state->bit_plane->buffer); - src = decode_state->bit_plane->buffer; - bo = dri_bo_alloc(i965->intel.bufmgr, "VC-1 Bitplane", bitplane_width * height_in_mbs, @@ -1415,28 +1415,44 @@ gen8_mfd_vc1_decode_init(VADriverContextP ctx, assert(bo->virtual); dst = bo->virtual; - for (src_h = 0; src_h < height_in_mbs; src_h++) { - for (src_w = 0; src_w < width_in_mbs; src_w++) { - int src_index, dst_index; - int src_shift; - uint8_t src_value; - - src_index = (src_h * width_in_mbs + src_w) / 2; - src_shift = !((src_h * width_in_mbs + src_w) & 1) * 4; - src_value = ((src[src_index] >> src_shift) & 0xf); + if (picture_type == GEN7_VC1_SKIPPED_PICTURE) { + for (src_h = 0; src_h < height_in_mbs; src_h++) { + for (src_w = 0; src_w < width_in_mbs; src_w++) { + int dst_index; + uint8_t src_value = 0x2; - if (picture_type == GEN7_VC1_SKIPPED_PICTURE) { - src_value |= 0x2; + dst_index = src_w / 2; + dst[dst_index] = ((dst[dst_index] >> 4) | (src_value << 4)); } - dst_index = src_w / 2; - dst[dst_index] = ((dst[dst_index] >> 4) | (src_value << 4)); + if (src_w & 1) + dst[src_w / 2] >>= 4; + + dst += bitplane_width; } + } else { + assert(decode_state->bit_plane->buffer); + src = decode_state->bit_plane->buffer; - if (src_w & 1) - dst[src_w / 2] >>= 4; + for (src_h = 0; src_h < height_in_mbs; src_h++) { + for (src_w = 0; src_w < width_in_mbs; src_w++) { + int src_index, dst_index; + int src_shift; + uint8_t src_value; - dst += bitplane_width; + src_index = (src_h * width_in_mbs + src_w) / 2; + src_shift = !((src_h * width_in_mbs + src_w) & 1) * 4; + src_value = ((src[src_index] >> src_shift) & 0xf); + + dst_index = src_w / 2; + dst[dst_index] = ((dst[dst_index] >> 4) | (src_value << 4)); + } + + if (src_w & 1) + dst[src_w / 2] >>= 4; + + dst += bitplane_width; + } } dri_bo_unmap(bo); |