}
}
+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)
{
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;
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);
}
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;
*/
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
*/
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
{
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;
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;
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);