summaryrefslogtreecommitdiffstats
path: root/src/gallium/include
diff options
context:
space:
mode:
authorChristian König <[email protected]>2011-08-10 18:07:01 +0200
committerChristian König <[email protected]>2011-08-26 12:10:34 +0200
commitd3770d6229d95e9beb67358ae2b2c8824ed3ae58 (patch)
tree1abde8b194ae4b58d84fccd3070b4a5e35021704 /src/gallium/include
parent231fce7d630bcf6aaf0e435e461ad5af842e437f (diff)
g3dvl: Rework the decoder interface part 3/5
Revert back to a macroblock based interface. The structure used tries to keep as close to the spec as possible. Signed-off-by: Christian König <[email protected]> Reviewed-by: Younes Manton <[email protected]>
Diffstat (limited to 'src/gallium/include')
-rw-r--r--src/gallium/include/pipe/p_video_decoder.h26
-rw-r--r--src/gallium/include/pipe/p_video_state.h109
2 files changed, 79 insertions, 56 deletions
diff --git a/src/gallium/include/pipe/p_video_decoder.h b/src/gallium/include/pipe/p_video_decoder.h
index ae071136bac..c7f5877858d 100644
--- a/src/gallium/include/pipe/p_video_decoder.h
+++ b/src/gallium/include/pipe/p_video_decoder.h
@@ -106,36 +106,22 @@ struct pipe_video_decoder
void (*begin_frame)(struct pipe_video_decoder *decoder);
/**
- * get the pointer where to put the ycbcr blocks of a component
+ * decode a macroblock
*/
- struct pipe_ycbcr_block *(*get_ycbcr_stream)(struct pipe_video_decoder *decoder, int component);
-
- /**
- * get the pointer where to put the ycbcr dct block data of a component
- */
- short *(*get_ycbcr_buffer)(struct pipe_video_decoder *decoder, int component);
-
- /**
- * get the stride of the mv buffer
- */
- unsigned (*get_mv_stream_stride)(struct pipe_video_decoder *decoder);
-
- /**
- * get the pointer where to put the motion vectors of a ref frame
- */
- struct pipe_motionvector *(*get_mv_stream)(struct pipe_video_decoder *decoder, int ref_frame);
+ void (*decode_macroblock)(struct pipe_video_decoder *decoder,
+ const struct pipe_macroblock *macroblocks,
+ unsigned num_macroblocks);
/**
* decode a bitstream
*/
void (*decode_bitstream)(struct pipe_video_decoder *decoder,
- unsigned num_bytes, const void *data,
- unsigned num_ycbcr_blocks[3]);
+ unsigned num_bytes, const void *data);
/**
* end decoding of the current frame
*/
- void (*end_frame)(struct pipe_video_decoder *decoder, unsigned num_ycbcr_blocks[3]);
+ void (*end_frame)(struct pipe_video_decoder *decoder);
/**
* flush any outstanding command buffers to the hardware
diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h
index 2a64ffb5601..9463af2fbe5 100644
--- a/src/gallium/include/pipe/p_video_state.h
+++ b/src/gallium/include/pipe/p_video_state.h
@@ -50,58 +50,55 @@ enum pipe_mpeg12_picture_type
PIPE_MPEG12_PICTURE_TYPE_FRAME
};
-enum pipe_mpeg12_dct_intra
+/*
+ * flags for macroblock_type, see section 6.3.17.1 in the spec
+ */
+enum pipe_mpeg12_macroblock_type
{
- PIPE_MPEG12_DCT_DELTA = 0,
- PIPE_MPEG12_DCT_INTRA = 1
+ PIPE_MPEG12_MB_TYPE_QUANT = 0x01,
+ PIPE_MPEG12_MB_TYPE_MOTION_FORWARD = 0x02,
+ PIPE_MPEG12_MB_TYPE_MOTION_BACKWARD = 0x04,
+ PIPE_MPEG12_MB_TYPE_PATTERN = 0x08,
+ PIPE_MPEG12_MB_TYPE_INTRA = 0x10
};
-enum pipe_mpeg12_dct_type
+/*
+ * flags for motion_type, see table 6-17 and 6-18 in the spec
+ */
+enum pipe_mpeg12_motion_type
{
- PIPE_MPEG12_DCT_TYPE_FRAME = 0,
- PIPE_MPEG12_DCT_TYPE_FIELD = 1
+ PIPE_MPEG12_MO_TYPE_RESERVED = 0x00,
+ PIPE_MPEG12_MO_TYPE_FIELD = 0x01,
+ PIPE_MPEG12_MO_TYPE_FRAME = 0x02,
+ PIPE_MPEG12_MO_TYPE_16x8 = 0x02,
+ PIPE_MPEG12_MO_TYPE_DUAL_PRIME = 0x03
};
-enum pipe_video_field_select
-{
- PIPE_VIDEO_FRAME = 0,
- PIPE_VIDEO_TOP_FIELD = 1,
- PIPE_VIDEO_BOTTOM_FIELD = 3,
-
- /* TODO
- PIPE_VIDEO_DUALPRIME
- PIPE_VIDEO_16x8
- */
-};
-
-enum pipe_video_mv_weight
+/*
+ * see section 6.3.17.1 and table 6-19 in the spec
+ */
+enum pipe_mpeg12_dct_type
{
- PIPE_VIDEO_MV_WEIGHT_MIN = 0,
- PIPE_VIDEO_MV_WEIGHT_HALF = 128,
- PIPE_VIDEO_MV_WEIGHT_MAX = 256
+ PIPE_MPEG12_DCT_TYPE_FRAME = 0,
+ PIPE_MPEG12_DCT_TYPE_FIELD = 1
};
-/* bitfields because this is used as a vertex buffer element */
-struct pipe_motionvector
+enum pipe_mpeg12_field_select
{
- struct {
- short x, y;
- ushort field_select; /**< enum pipe_video_field_select */
- ushort weight; /**< enum pipe_video_mv_weight */
- } top, bottom;
+ PIPE_MPEG12_FS_FIRST_FORWARD = 0x01,
+ PIPE_MPEG12_FS_FIRST_BACKWARD = 0x02,
+ PIPE_MPEG12_FS_SECOND_FORWARD = 0x04,
+ PIPE_MPEG12_FS_SECOND_BACKWARD = 0x08
};
-/* bitfields because this is used as a vertex buffer element */
-struct pipe_ycbcr_block
+struct pipe_picture_desc
{
- ubyte x, y;
- ubyte intra; /**< enum pipe_mpeg12_dct_intra */
- ubyte coding; /**< enum pipe_mpeg12_dct_type */
+ enum pipe_video_profile profile;
};
-struct pipe_picture_desc
+struct pipe_macroblock
{
- enum pipe_video_profile profile;
+ enum pipe_video_codec codec;
};
struct pipe_mpeg12_picture_desc
@@ -118,6 +115,46 @@ struct pipe_mpeg12_picture_desc
unsigned f_code[2][2];
};
+struct pipe_mpeg12_macroblock
+{
+ struct pipe_macroblock base;
+
+ /* see section 6.3.17 in the spec */
+ unsigned short x, y;
+
+ /* see section 6.3.17.1 in the spec */
+ unsigned char macroblock_type;
+
+ union {
+ struct {
+ /* see table 6-17 in the spec */
+ unsigned int frame_motion_type:2;
+
+ /* see table 6-18 in the spec */
+ unsigned int field_motion_type:2;
+
+ /* see table 6-19 in the spec */
+ unsigned int dct_type:1;
+ } bits;
+ unsigned int value;
+ } macroblock_modes;
+
+ /* see section 6.3.17.2 in the spec */
+ unsigned char motion_vertical_field_select;
+
+ /* see Table 7-7 in the spec */
+ short PMV[2][2][2];
+
+ /* see figure 6.10-12 in the spec */
+ unsigned short coded_block_pattern;
+
+ /* see figure 6.10-12 in the spec */
+ short *blocks;
+
+ /* Number of skipped macroblocks after this macroblock */
+ unsigned short num_skipped_macroblocks;
+};
+
#ifdef __cplusplus
}
#endif