summaryrefslogtreecommitdiff
path: root/apps/plugins/mpegplayer/mpeg2.h
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-12-07 13:00:31 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-12-07 13:00:31 +0000
commit2b5f979d75a3d1c85b498c87ba6ae4c98c3011bc (patch)
treed9c40aa330a2bd973794eca11c86d559549422ca /apps/plugins/mpegplayer/mpeg2.h
parent5886efabf5e4c96a8a96836d665aad935c727e31 (diff)
downloadrockbox-2b5f979d75a3d1c85b498c87ba6ae4c98c3011bc.zip
rockbox-2b5f979d75a3d1c85b498c87ba6ae4c98c3011bc.tar.gz
rockbox-2b5f979d75a3d1c85b498c87ba6ae4c98c3011bc.tar.bz2
rockbox-2b5f979d75a3d1c85b498c87ba6ae4c98c3011bc.tar.xz
Reformat and code police (tabs, trailing whitespace, annoying overuse of parentheses, etc.) in libmpeg2 so I can stomach working on it. Don't call IDCT functions through pointers - I don't feel like extracting that change just for relevance sake.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15892 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/mpegplayer/mpeg2.h')
-rw-r--r--apps/plugins/mpegplayer/mpeg2.h106
1 files changed, 59 insertions, 47 deletions
diff --git a/apps/plugins/mpegplayer/mpeg2.h b/apps/plugins/mpegplayer/mpeg2.h
index 01b3de4..605a353 100644
--- a/apps/plugins/mpegplayer/mpeg2.h
+++ b/apps/plugins/mpegplayer/mpeg2.h
@@ -27,21 +27,22 @@
#define MPEG2_VERSION(a,b,c) (((a)<<16)|((b)<<8)|(c))
#define MPEG2_RELEASE MPEG2_VERSION (0, 4, 0) /* 0.4.0 */
-#define SEQ_FLAG_MPEG2 1
+#define SEQ_FLAG_MPEG2 1
#define SEQ_FLAG_CONSTRAINED_PARAMETERS 2
-#define SEQ_FLAG_PROGRESSIVE_SEQUENCE 4
-#define SEQ_FLAG_LOW_DELAY 8
-#define SEQ_FLAG_COLOUR_DESCRIPTION 16
-
-#define SEQ_MASK_VIDEO_FORMAT 0xe0
-#define SEQ_VIDEO_FORMAT_COMPONENT 0
-#define SEQ_VIDEO_FORMAT_PAL 0x20
-#define SEQ_VIDEO_FORMAT_NTSC 0x40
-#define SEQ_VIDEO_FORMAT_SECAM 0x60
-#define SEQ_VIDEO_FORMAT_MAC 0x80
+#define SEQ_FLAG_PROGRESSIVE_SEQUENCE 4
+#define SEQ_FLAG_LOW_DELAY 8
+#define SEQ_FLAG_COLOUR_DESCRIPTION 16
+
+#define SEQ_MASK_VIDEO_FORMAT 0xe0
+#define SEQ_VIDEO_FORMAT_COMPONENT 0x00
+#define SEQ_VIDEO_FORMAT_PAL 0x20
+#define SEQ_VIDEO_FORMAT_NTSC 0x40
+#define SEQ_VIDEO_FORMAT_SECAM 0x60
+#define SEQ_VIDEO_FORMAT_MAC 0x80
#define SEQ_VIDEO_FORMAT_UNSPECIFIED 0xa0
-typedef struct mpeg2_sequence_s {
+typedef struct mpeg2_sequence_s
+{
unsigned int width, height;
unsigned int chroma_width, chroma_height;
unsigned int byte_rate;
@@ -59,11 +60,12 @@ typedef struct mpeg2_sequence_s {
uint8_t matrix_coefficients;
} mpeg2_sequence_t;
-#define GOP_FLAG_DROP_FRAME 1
+#define GOP_FLAG_DROP_FRAME 1
#define GOP_FLAG_BROKEN_LINK 2
-#define GOP_FLAG_CLOSED_GOP 4
+#define GOP_FLAG_CLOSED_GOP 4
-typedef struct mpeg2_gop_s {
+typedef struct mpeg2_gop_s
+{
uint8_t hours;
uint8_t minutes;
uint8_t seconds;
@@ -71,35 +73,39 @@ typedef struct mpeg2_gop_s {
uint32_t flags;
} mpeg2_gop_t;
-#define PIC_MASK_CODING_TYPE 7
+#define PIC_MASK_CODING_TYPE 7
#define PIC_FLAG_CODING_TYPE_I 1
#define PIC_FLAG_CODING_TYPE_P 2
#define PIC_FLAG_CODING_TYPE_B 3
#define PIC_FLAG_CODING_TYPE_D 4
-#define PIC_FLAG_TOP_FIELD_FIRST 8
+#define PIC_FLAG_TOP_FIELD_FIRST 8
#define PIC_FLAG_PROGRESSIVE_FRAME 16
#define PIC_FLAG_COMPOSITE_DISPLAY 32
-#define PIC_FLAG_SKIP 64
-#define PIC_FLAG_TAGS 128
+#define PIC_FLAG_SKIP 64
+#define PIC_FLAG_TAGS 128
#define PIC_MASK_COMPOSITE_DISPLAY 0xfffff000
-typedef struct mpeg2_picture_s {
+typedef struct mpeg2_picture_s
+{
unsigned int temporal_reference;
unsigned int nb_fields;
uint32_t tag, tag2;
uint32_t flags;
- struct {
- int x, y;
+ struct
+ {
+ int x, y;
} display_offset[3];
} mpeg2_picture_t;
-typedef struct mpeg2_fbuf_s {
+typedef struct mpeg2_fbuf_s
+{
uint8_t * buf[3];
void * id;
} mpeg2_fbuf_t;
-typedef struct mpeg2_info_s {
+typedef struct mpeg2_info_s
+{
const mpeg2_sequence_t * sequence;
const mpeg2_gop_t * gop;
const mpeg2_picture_t * current_picture;
@@ -116,32 +122,37 @@ typedef struct mpeg2_info_s {
typedef struct mpeg2dec_s mpeg2dec_t;
typedef struct mpeg2_decoder_s mpeg2_decoder_t;
-typedef enum {
- STATE_BUFFER = 0,
- STATE_SEQUENCE = 1,
+typedef enum
+{
+ STATE_BUFFER = 0,
+ STATE_SEQUENCE = 1,
STATE_SEQUENCE_REPEATED = 2,
- STATE_GOP = 3,
- STATE_PICTURE = 4,
- STATE_SLICE_1ST = 5,
- STATE_PICTURE_2ND = 6,
- STATE_SLICE = 7,
- STATE_END = 8,
- STATE_INVALID = 9,
- STATE_INVALID_END = 10
+ STATE_GOP = 3,
+ STATE_PICTURE = 4,
+ STATE_SLICE_1ST = 5,
+ STATE_PICTURE_2ND = 6,
+ STATE_SLICE = 7,
+ STATE_END = 8,
+ STATE_INVALID = 9,
+ STATE_INVALID_END = 10
} mpeg2_state_t;
-typedef struct mpeg2_convert_init_s {
+typedef struct mpeg2_convert_init_s
+{
unsigned int id_size;
unsigned int buf_size[3];
- void (* start) (void * id, const mpeg2_fbuf_t * fbuf,
- const mpeg2_picture_t * picture, const mpeg2_gop_t * gop);
- void (* copy) (void * id, uint8_t * const * src, unsigned int v_offset);
+ void (* start)(void * id, const mpeg2_fbuf_t * fbuf,
+ const mpeg2_picture_t * picture, const mpeg2_gop_t * gop);
+ void (* copy)(void * id, uint8_t * const * src, unsigned int v_offset);
} mpeg2_convert_init_t;
-typedef enum {
- MPEG2_CONVERT_SET = 0,
+
+typedef enum
+{
+ MPEG2_CONVERT_SET = 0,
MPEG2_CONVERT_STRIDE = 1,
- MPEG2_CONVERT_START = 2
+ MPEG2_CONVERT_START = 2
} mpeg2_convert_stage_t;
+
typedef int mpeg2_convert_t (int stage, void * id,
const mpeg2_sequence_t * sequence, int stride,
void * arg, mpeg2_convert_init_t * result);
@@ -168,12 +179,13 @@ void mpeg2_init_fbuf (mpeg2_decoder_t * decoder, uint8_t * current_fbuf[3],
uint8_t * forward_fbuf[3], uint8_t * backward_fbuf[3]);
void mpeg2_slice (mpeg2_decoder_t * decoder, int code, const uint8_t * buffer);
-typedef enum {
- MPEG2_ALLOC_MPEG2DEC = 0,
- MPEG2_ALLOC_CHUNK = 1,
- MPEG2_ALLOC_YUV = 2,
+typedef enum
+{
+ MPEG2_ALLOC_MPEG2DEC = 0,
+ MPEG2_ALLOC_CHUNK = 1,
+ MPEG2_ALLOC_YUV = 2,
MPEG2_ALLOC_CONVERT_ID = 3,
- MPEG2_ALLOC_CONVERTED = 4
+ MPEG2_ALLOC_CONVERTED = 4
} mpeg2_alloc_t;
void * mpeg2_malloc (unsigned size, mpeg2_alloc_t reason);