summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/va/picture.c
diff options
context:
space:
mode:
authorMichael Varga <[email protected]>2014-10-23 10:13:05 -0500
committerLeo Liu <[email protected]>2014-11-10 10:24:07 -0500
commit9f1ee1b5c941422ae4761388b9562f4abd67c461 (patch)
treeeb22f63ce83ff863cc936396e6f5708f9ea32c0f /src/gallium/state_trackers/va/picture.c
parentc24ee2cf439f53d210ce4e4318cdc85dee2e7295 (diff)
st/va: MPEG4 populate the PPS structure
Signed-off-by: Michael Varga <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/va/picture.c')
-rw-r--r--src/gallium/state_trackers/va/picture.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c
index 8775681bb42..a4eb26b406b 100644
--- a/src/gallium/state_trackers/va/picture.c
+++ b/src/gallium/state_trackers/va/picture.c
@@ -80,6 +80,12 @@ handlePictureParameterBuffer(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *
VAPictureParameterBufferMPEG2 *mpeg2;
VAPictureParameterBufferH264 *h264;
VAPictureParameterBufferVC1 * vc1;
+ VAPictureParameterBufferMPEG4 *mpeg4;
+ vlVaSurface *surf_forward;
+ vlVaSurface *surf_backward;
+ unsigned int i;
+ static const uint8_t default_intra_quant_matrix[64] = { 0 };
+ static const uint8_t default_non_intra_quant_matrix[64] = { 0 };
switch (u_reduce_video_profile(context->decoder->profile)) {
case PIPE_VIDEO_FORMAT_MPEG12:
@@ -214,6 +220,72 @@ handlePictureParameterBuffer(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *
context->desc.vc1.pquant = vc1->pic_quantizer_fields.bits.pic_quantizer_scale;
break;
+ case PIPE_VIDEO_FORMAT_MPEG4:
+ assert(buf->size >= sizeof(VAPictureParameterBufferMPEG4) && buf->num_elements == 1);
+ mpeg4 = buf->data;
+
+ context->mpeg4.pps = *mpeg4;
+
+ /* vop_width */
+ /* vop_height */
+ /* forward_reference_picture */
+ /* backward_reference_picture */
+ context->desc.mpeg4.short_video_header =
+ mpeg4->vol_fields.bits.short_video_header;
+ /* chroma_format */
+ context->desc.mpeg4.interlaced = mpeg4->vol_fields.bits.interlaced;
+ /* obmc_disable */
+ /* sprite_enable */
+ /* sprite_warping_accuracy */
+ context->desc.mpeg4.quant_type = mpeg4->vol_fields.bits.quant_type;
+ context->desc.mpeg4.quarter_sample = mpeg4->vol_fields.bits.quarter_sample;
+ /* data_partitioned */
+ /* reversible_vlc */
+ context->desc.mpeg4.resync_marker_disable =
+ mpeg4->vol_fields.bits.resync_marker_disable;
+ /* no_of_sprite_warping_points */
+ /* sprite_trajectory_du */
+ /* sprite_trajectory_dv */
+ /* quant_precision */
+ context->desc.mpeg4.vop_coding_type = mpeg4->vop_fields.bits.vop_coding_type;
+ /* backward_reference_vop_coding_type */
+ /* vop_rounding_type */
+ /* intra_dc_vlc_thr */
+ context->desc.mpeg4.top_field_first =
+ mpeg4->vop_fields.bits.top_field_first;
+ context->desc.mpeg4.alternate_vertical_scan_flag =
+ mpeg4->vop_fields.bits.alternate_vertical_scan_flag;
+ context->desc.mpeg4.vop_fcode_forward = mpeg4->vop_fcode_forward;
+ context->desc.mpeg4.vop_fcode_backward = mpeg4->vop_fcode_backward;
+ context->desc.mpeg4.vop_time_increment_resolution =
+ mpeg4->vop_time_increment_resolution;
+ /* num_gobs_in_vop */
+ /* num_macroblocks_in_gob */
+ context->desc.mpeg4.trb[0] = mpeg4->TRB;
+ context->desc.mpeg4.trb[1] = mpeg4->TRB;
+ context->desc.mpeg4.trd[0] = mpeg4->TRD;
+ context->desc.mpeg4.trd[1] = mpeg4->TRD;
+
+ /* default [non-]intra quant matrix because mpv does not set these
+ matrices */
+ if (!context->desc.mpeg4.intra_matrix)
+ context->desc.mpeg4.intra_matrix = default_intra_quant_matrix;
+ if (!context->desc.mpeg4.non_intra_matrix)
+ context->desc.mpeg4.non_intra_matrix = default_non_intra_quant_matrix;
+
+ surf_forward = handle_table_get(drv->htab, mpeg4->forward_reference_picture);
+ if (surf_forward)
+ context->desc.mpeg4.ref[0] = surf_forward->buffer;
+ surf_backward = handle_table_get(drv->htab, mpeg4->backward_reference_picture);
+ if (surf_backward)
+ context->desc.mpeg4.ref[1] = surf_backward->buffer;
+
+ context->mpeg4.vti_bits = 0;
+ for (i = context->desc.mpeg4.vop_time_increment_resolution; i > 0; i /= 2)
+ ++context->mpeg4.vti_bits;
+
+ break;
+
default:
break;
}