diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/vl/vl_mpeg12_decoder.c | 21 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_video_context.h | 7 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_video_state.h | 4 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/decode.c | 9 |
4 files changed, 26 insertions, 15 deletions
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c index bdca9dbe316..238785f400d 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c @@ -330,6 +330,18 @@ vl_mpeg12_buffer_begin_frame(struct pipe_video_decode_buffer *buffer) } } +static void +vl_mpeg12_buffer_set_quant_matrix(struct pipe_video_decode_buffer *buffer, + uint8_t intra_matrix[64], + uint8_t non_intra_matrix[64]) +{ + struct vl_mpeg12_buffer *buf = (struct vl_mpeg12_buffer*)buffer; + unsigned i; + + for (i = 0; i < VL_MAX_PLANES; ++i) + vl_zscan_upload_quant(&buf->zscan[i], intra_matrix, non_intra_matrix); +} + static struct pipe_ycbcr_block * vl_mpeg12_buffer_get_ycbcr_stream(struct pipe_video_decode_buffer *buffer, int component) { @@ -378,7 +390,6 @@ vl_mpeg12_buffer_decode_bitstream(struct pipe_video_decode_buffer *buffer, unsigned num_ycbcr_blocks[3]) { struct vl_mpeg12_buffer *buf = (struct vl_mpeg12_buffer*)buffer; - uint8_t intra_quantizer_matrix[64]; struct vl_mpeg12_decoder *dec; unsigned i; @@ -387,13 +398,8 @@ vl_mpeg12_buffer_decode_bitstream(struct pipe_video_decode_buffer *buffer, dec = (struct vl_mpeg12_decoder *)buf->base.decoder; assert(dec); - memcpy(intra_quantizer_matrix, picture->intra_quantizer_matrix, sizeof(intra_quantizer_matrix)); - intra_quantizer_matrix[0] = 1 << (7 - picture->intra_dc_precision); - - for (i = 0; i < VL_MAX_PLANES; ++i) { + for (i = 0; i < VL_MAX_PLANES; ++i) vl_zscan_set_layout(&buf->zscan[i], picture->alternate_scan ? dec->zscan_alternate : dec->zscan_normal); - vl_zscan_upload_quant(&buf->zscan[i], intra_quantizer_matrix, picture->non_intra_quantizer_matrix); - } vl_mpg12_bs_decode(&buf->bs, num_bytes, data, picture, num_ycbcr_blocks); } @@ -473,6 +479,7 @@ vl_mpeg12_create_buffer(struct pipe_video_decoder *decoder) buffer->base.decoder = decoder; buffer->base.destroy = vl_mpeg12_buffer_destroy; buffer->base.begin_frame = vl_mpeg12_buffer_begin_frame; + buffer->base.set_quant_matrix = vl_mpeg12_buffer_set_quant_matrix; buffer->base.get_ycbcr_stream = vl_mpeg12_buffer_get_ycbcr_stream; buffer->base.get_ycbcr_buffer = vl_mpeg12_buffer_get_ycbcr_buffer; buffer->base.get_mv_stream_stride = vl_mpeg12_buffer_get_mv_stream_stride; diff --git a/src/gallium/include/pipe/p_video_context.h b/src/gallium/include/pipe/p_video_context.h index 374fa511054..bea5067331e 100644 --- a/src/gallium/include/pipe/p_video_context.h +++ b/src/gallium/include/pipe/p_video_context.h @@ -180,6 +180,13 @@ struct pipe_video_decode_buffer void (*begin_frame)(struct pipe_video_decode_buffer *decbuf); /** + * set the quantification matrixes + */ + void (*set_quant_matrix)(struct pipe_video_decode_buffer *decbuf, + uint8_t intra_matrix[64], + uint8_t non_intra_matrix[64]); + + /** * get the pointer where to put the ycbcr blocks of a component */ struct pipe_ycbcr_block *(*get_ycbcr_stream)(struct pipe_video_decode_buffer *, int component); diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h index 6f64c38c6bc..4d8a24116a0 100644 --- a/src/gallium/include/pipe/p_video_state.h +++ b/src/gallium/include/pipe/p_video_state.h @@ -113,13 +113,9 @@ struct pipe_mpeg12_picture_desc unsigned frame_pred_frame_dct; unsigned q_scale_type; unsigned alternate_scan; - unsigned intra_dc_precision; unsigned intra_vlc_format; unsigned concealment_motion_vectors; unsigned f_code[2][2]; - - uint8_t *intra_quantizer_matrix; - uint8_t *non_intra_quantizer_matrix; }; #ifdef __cplusplus diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c index 5c6d0467924..8458864cfc1 100644 --- a/src/gallium/state_trackers/vdpau/decode.c +++ b/src/gallium/state_trackers/vdpau/decode.c @@ -160,6 +160,7 @@ vlVdpDecoderRenderMpeg2(struct pipe_video_decoder *decoder, { struct pipe_mpeg12_picture_desc picture; struct pipe_video_buffer *ref_frames[2]; + uint8_t intra_quantizer_matrix[64]; unsigned num_ycbcr_blocks[3] = { 0, 0, 0 }; unsigned i; @@ -189,7 +190,6 @@ vlVdpDecoderRenderMpeg2(struct pipe_video_decoder *decoder, picture.frame_pred_frame_dct = picture_info->frame_pred_frame_dct; picture.q_scale_type = picture_info->q_scale_type; picture.alternate_scan = picture_info->alternate_scan; - picture.intra_dc_precision = picture_info->intra_dc_precision; picture.intra_vlc_format = picture_info->intra_vlc_format; picture.concealment_motion_vectors = picture_info->concealment_motion_vectors; picture.f_code[0][0] = picture_info->f_code[0][0] - 1; @@ -197,11 +197,12 @@ vlVdpDecoderRenderMpeg2(struct pipe_video_decoder *decoder, picture.f_code[1][0] = picture_info->f_code[1][0] - 1; picture.f_code[1][1] = picture_info->f_code[1][1] - 1; - picture.intra_quantizer_matrix = picture_info->intra_quantizer_matrix; - picture.non_intra_quantizer_matrix = picture_info->non_intra_quantizer_matrix; - buffer->begin_frame(buffer); + memcpy(intra_quantizer_matrix, picture_info->intra_quantizer_matrix, sizeof(intra_quantizer_matrix)); + intra_quantizer_matrix[0] = 1 << (7 - picture_info->intra_dc_precision); + buffer->set_quant_matrix(buffer, intra_quantizer_matrix, picture_info->non_intra_quantizer_matrix); + for (i = 0; i < bitstream_buffer_count; ++i) buffer->decode_bitstream(buffer, bitstream_buffers[i].bitstream_bytes, bitstream_buffers[i].bitstream, &picture, num_ycbcr_blocks); |