Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

mpeg2.h

Go to the documentation of this file.
00001 /*
00002  * mpeg2.h
00003  * Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
00004  * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
00005  *
00006  * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
00007  * See http://libmpeg2.sourceforge.net/ for updates.
00008  *
00009  * mpeg2dec is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * mpeg2dec is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022  */
00023 
00024 #ifndef MPEG2_H
00025 #define MPEG2_H
00026 
00027 #define SEQ_FLAG_MPEG2 1
00028 #define SEQ_FLAG_CONSTRAINED_PARAMETERS 2
00029 #define SEQ_FLAG_PROGRESSIVE_SEQUENCE 4
00030 #define SEQ_FLAG_LOW_DELAY 8
00031 #define SEQ_FLAG_COLOUR_DESCRIPTION 16
00032 
00033 #define SEQ_MASK_VIDEO_FORMAT 0xe0
00034 #define SEQ_VIDEO_FORMAT_COMPONENT 0
00035 #define SEQ_VIDEO_FORMAT_PAL 0x20
00036 #define SEQ_VIDEO_FORMAT_NTSC 0x40
00037 #define SEQ_VIDEO_FORMAT_SECAM 0x60
00038 #define SEQ_VIDEO_FORMAT_MAC 0x80
00039 #define SEQ_VIDEO_FORMAT_UNSPECIFIED 0xa0
00040 
00041 typedef struct {
00042     unsigned int width, height;
00043     unsigned int chroma_width, chroma_height;
00044     unsigned int byte_rate;
00045     unsigned int vbv_buffer_size;
00046     uint32_t flags;
00047 
00048     unsigned int picture_width, picture_height;
00049     unsigned int display_width, display_height;
00050     unsigned int pixel_width, pixel_height;
00051     unsigned int frame_period;
00052 
00053     uint8_t profile_level_id;
00054     uint8_t colour_primaries;
00055     uint8_t transfer_characteristics;
00056     uint8_t matrix_coefficients;
00057 } sequence_t;
00058 
00059 #define PIC_MASK_CODING_TYPE 7
00060 #define PIC_FLAG_CODING_TYPE_I 1
00061 #define PIC_FLAG_CODING_TYPE_P 2
00062 #define PIC_FLAG_CODING_TYPE_B 3
00063 #define PIC_FLAG_CODING_TYPE_D 4
00064 
00065 #define PIC_FLAG_TOP_FIELD_FIRST 8
00066 #define PIC_FLAG_PROGRESSIVE_FRAME 16
00067 #define PIC_FLAG_COMPOSITE_DISPLAY 32
00068 #define PIC_FLAG_SKIP 64
00069 #define PIC_FLAG_PTS 128
00070 #define PIC_MASK_COMPOSITE_DISPLAY 0xfffff000
00071 
00072 typedef struct {
00073     unsigned int temporal_reference;
00074     unsigned int nb_fields;
00075     uint32_t pts;
00076     uint32_t flags;
00077     struct {
00078         int x, y;
00079     } display_offset[3];
00080 } picture_t;
00081 
00082 typedef struct {
00083     uint8_t * buf[3];
00084     void * id;
00085 } fbuf_t;
00086 
00087 typedef struct {
00088     const sequence_t * sequence;
00089     const picture_t * current_picture;
00090     const picture_t * current_picture_2nd;
00091     const fbuf_t * current_fbuf;
00092     const picture_t * display_picture;
00093     const picture_t * display_picture_2nd;
00094     const fbuf_t * display_fbuf;
00095     const fbuf_t * discard_fbuf;
00096     const uint8_t * user_data;
00097     int user_data_len;
00098 } mpeg2_info_t;
00099 
00100 typedef struct mpeg2dec_s mpeg2dec_t;
00101 typedef struct decoder_s decoder_t;
00102 
00103 #define STATE_SEQUENCE 1
00104 #define STATE_SEQUENCE_REPEATED 2
00105 #define STATE_GOP 3
00106 #define STATE_PICTURE 4
00107 #define STATE_SLICE_1ST 5
00108 #define STATE_PICTURE_2ND 6
00109 #define STATE_SLICE 7
00110 #define STATE_END 8
00111 #define STATE_INVALID 9
00112 
00113 struct convert_init_s;
00114 void mpeg2_convert (mpeg2dec_t * mpeg2dec,
00115                     void (* convert) (int, int, uint32_t, void *,
00116                                       struct convert_init_s *), void * arg);
00117 void mpeg2_set_buf (mpeg2dec_t * mpeg2dec, uint8_t * buf[3], void * id);
00118 void mpeg2_custom_fbuf (mpeg2dec_t * mpeg2dec, int custom_fbuf);
00119 void mpeg2_init_fbuf (decoder_t * decoder, uint8_t * current_fbuf[3],
00120                       uint8_t * forward_fbuf[3], uint8_t * backward_fbuf[3]);
00121 
00122 void mpeg2_slice (decoder_t * decoder, int code, const uint8_t * buffer);
00123 
00124 #define MPEG2_ACCEL_X86_MMX 1
00125 #define MPEG2_ACCEL_X86_3DNOW 2
00126 #define MPEG2_ACCEL_X86_MMXEXT 4
00127 #define MPEG2_ACCEL_PPC_ALTIVEC 1
00128 #define MPEG2_ACCEL_ALPHA 1
00129 #define MPEG2_ACCEL_ALPHA_MVI 2
00130 #define MPEG2_ACCEL_MLIB 0x40000000
00131 #define MPEG2_ACCEL_DETECT 0x80000000
00132 
00133 uint32_t mpeg2_accel (uint32_t accel);
00134 mpeg2dec_t * mpeg2_init (void);
00135 const mpeg2_info_t * mpeg2_info (mpeg2dec_t * mpeg2dec);
00136 void mpeg2_close (mpeg2dec_t * mpeg2dec);
00137 
00138 void mpeg2_buffer (mpeg2dec_t * mpeg2dec, uint8_t * start, uint8_t * end);
00139 int mpeg2_parse (mpeg2dec_t * mpeg2dec);
00140 
00141 void mpeg2_skip (mpeg2dec_t * mpeg2dec, int skip);
00142 void mpeg2_slice_region (mpeg2dec_t * mpeg2dec, int start, int end);
00143 
00144 void mpeg2_pts (mpeg2dec_t * mpeg2dec, uint32_t pts);
00145 
00146 #endif /* MPEG2_H */
 

Powered by Plone

This site conforms to the following standards: