summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu <[email protected]>2017-05-03 09:54:28 -0400
committerLeo Liu <[email protected]>2017-05-25 11:40:20 -0400
commit34f7cf49c8a8a900c2a9a2e197041e2d211dccd6 (patch)
tree1515692fbe084ead8bd2d1c91d712b39aa356ee2
parent155ca0ca50787a07b2e41daa33c6fb56eda57852 (diff)
radeon/vcn: add decode message for mpeg4 codec
Signed-off-by: Leo Liu <[email protected]> Reviewed-by: Christian König <[email protected]>
-rw-r--r--src/gallium/drivers/radeon/radeon_vcn_dec.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/radeon_vcn_dec.c b/src/gallium/drivers/radeon/radeon_vcn_dec.c
index 03231146c3d..82dfa71633a 100644
--- a/src/gallium/drivers/radeon/radeon_vcn_dec.c
+++ b/src/gallium/drivers/radeon/radeon_vcn_dec.c
@@ -503,6 +503,49 @@ static rvcn_dec_message_mpeg2_vld_t get_mpeg2_msg(struct radeon_decoder *dec,
return result;
}
+static rvcn_dec_message_mpeg4_asp_vld_t get_mpeg4_msg(struct radeon_decoder *dec,
+ struct pipe_mpeg4_picture_desc *pic)
+{
+ rvcn_dec_message_mpeg4_asp_vld_t result;
+ unsigned i;
+
+ memset(&result, 0, sizeof(result));
+ result.decoded_pic_idx = dec->frame_number;
+
+ result.forward_ref_pic_idx = get_ref_pic_idx(dec, pic->ref[0]);
+ result.backward_ref_pic_idx = get_ref_pic_idx(dec, pic->ref[1]);
+
+ result.variant_type = 0;
+ result.profile_and_level_indication = 0xF0;
+
+ result.video_object_layer_verid = 0x5;
+ result.video_object_layer_shape = 0x0;
+
+ result.video_object_layer_width = dec->base.width;
+ result.video_object_layer_height = dec->base.height;
+
+ result.vop_time_increment_resolution = pic->vop_time_increment_resolution;
+
+ result.short_video_header |= pic->short_video_header << 0;
+ result.interlaced |= pic->interlaced << 2;
+ result.load_intra_quant_mat |= 1 << 3;
+ result.load_nonintra_quant_mat |= 1 << 4;
+ result.quarter_sample |= pic->quarter_sample << 5;
+ result.complexity_estimation_disable |= 1 << 6;
+ result.resync_marker_disable |= pic->resync_marker_disable << 7;
+ result.newpred_enable |= 0 << 10; //
+ result.reduced_resolution_vop_enable |= 0 << 11;
+
+ result.quant_type = pic->quant_type;
+
+ for (i = 0; i < 64; ++i) {
+ result.intra_quant_mat[i] = pic->intra_matrix[vl_zscan_normal[i]];
+ result.nonintra_quant_mat[i] = pic->non_intra_matrix[vl_zscan_normal[i]];
+ }
+
+ return result;
+}
+
static void rvcn_dec_message_create(struct radeon_decoder *dec)
{
rvcn_dec_message_header_t *header = dec->msg;
@@ -657,6 +700,14 @@ static struct pb_buffer *rvcn_dec_message_decode(struct radeon_decoder *dec,
index->message_id = RDECODE_MESSAGE_MPEG2_VLD;
break;
}
+ case PIPE_VIDEO_FORMAT_MPEG4: {
+ rvcn_dec_message_mpeg4_asp_vld_t mpeg4 =
+ get_mpeg4_msg(dec, (struct pipe_mpeg4_picture_desc*)picture);
+
+ memcpy(codec, (void*)&mpeg4, sizeof(rvcn_dec_message_mpeg4_asp_vld_t));
+ index->message_id = RDECODE_MESSAGE_MPEG4_ASP_VLD;
+ break;
+ }
default:
assert(0);
return NULL;