[g3dvl] split quant matrix out of picture info
authorChristian König <deathsimple@vodafone.de>
Sun, 5 Jun 2011 16:59:57 +0000 (18:59 +0200)
committerChristian König <deathsimple@vodafone.de>
Sun, 5 Jun 2011 16:59:57 +0000 (18:59 +0200)
src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
src/gallium/include/pipe/p_video_context.h
src/gallium/include/pipe/p_video_state.h
src/gallium/state_trackers/vdpau/decode.c

index bdca9dbe3162c702d01203d0fd04be84b24a0281..238785f400dbc232a4fb49f70f228468c7e81618 100644 (file)
@@ -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;
index 374fa511054934202295ee91f9030beab09f6fc3..bea5067331e2a38401a6f953484510387be1378f 100644 (file)
@@ -179,6 +179,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
     */
index 6f64c38c6bc25f392182f1f1a35f0458bf1fb8b9..4d8a24116a0ff488985603bd7d5db6f59d87aafc 100644 (file)
@@ -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
index 5c6d04679243d86eceb59bacdcc47feeaedd2c54..8458864cfc17fa222c096806c9a9ada41f48b34c 100644 (file)
@@ -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);