Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

mpeg3video.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************/
00020 #ifndef MPEGVIDEO_H
00021 #define MPEGVIDEO_H
00022 
00023 #include "../bitstream.h"
00024 #include "../mpeg3private.inc"
00025 #include "idct.h"
00026 #include "slice.h"
00027 #include "../timecode.h"
00028 
00029 /* zig-zag scan */
00030 extern unsigned char mpeg3_zig_zag_scan_nommx[64];
00031 extern unsigned char mpeg3_zig_zag_scan_mmx[64];
00032 
00033 /* alternate scan */
00034 extern unsigned char mpeg3_alternate_scan_nommx[64];
00035 extern unsigned char mpeg3_alternate_scan_mmx[64];
00036 
00037 /* default intra quantization matrix */
00038 extern unsigned char mpeg3_default_intra_quantizer_matrix[64];
00039 
00040 /* Frame rate table must agree with the one in the encoder */
00041 extern double mpeg3_frame_rate_table[16];
00042 
00043 /* non-linear quantization coefficient table */
00044 extern unsigned char mpeg3_non_linear_mquant_table[32];
00045 
00046 #define CHROMA420     1     /* chroma_format */
00047 #define CHROMA422     2
00048 #define CHROMA444     3
00049 
00050 #define TOP_FIELD     1     /* picture structure */
00051 #define BOTTOM_FIELD  2
00052 #define FRAME_PICTURE 3
00053 
00054 #define SEQ_ID        1     /* extension start code IDs */
00055 #define DISP_ID       2
00056 #define QUANT_ID      3
00057 #define SEQSCAL_ID    5
00058 #define PANSCAN_ID    7
00059 #define CODING_ID     8
00060 #define SPATSCAL_ID   9
00061 #define TEMPSCAL_ID  10
00062 
00063 #define ERROR (-1)
00064 
00065 #define SC_NONE       0   /* scalable_mode */
00066 #define SC_DP         1
00067 #define SC_SPAT       2
00068 #define SC_SNR        3
00069 #define SC_TEMP       4
00070 
00071 #define I_TYPE        1     /* picture coding type */
00072 #define P_TYPE        2
00073 #define B_TYPE        3
00074 #define D_TYPE        4
00075 
00076 #define MB_INTRA      1         /* macroblock type */
00077 #define MB_PATTERN    2
00078 #define MB_BACKWARD   4
00079 #define MB_FORWARD    8
00080 #define MB_QUANT      16
00081 #define MB_WEIGHT     32
00082 #define MB_CLASS4     64
00083 
00084 #define MC_FIELD      1     /* motion_type */
00085 #define MC_FRAME      2
00086 #define MC_16X8       2
00087 #define MC_DMV        3
00088 
00089 #define MV_FIELD      0     /* mv_format */
00090 #define MV_FRAME      1
00091 
00092 #define CLIP(x)  ((x) >= 0 ? ((x) < 255 ? (x) : 255) : 0)
00093 
00094 /* Statically allocate as little as possible so a fake video struct */
00095 /* can be used for reading the GOP headers. */
00096 
00097 struct mpeg3video_rec
00098 {
00099         struct mpeg3_rec* file;
00100         struct mpeg3_vtrack_rec* track;
00101 
00102 /* ================================= Seeking variables ========================= */
00103         mpeg3_bits_t *vstream;
00104         int decoder_initted;
00105         unsigned char **output_rows;     /* Output frame buffer supplied by user */
00106         int in_x, in_y, in_w, in_h, out_w, out_h; /* Output dimensions */
00107         int *x_table, *y_table;          /* Location of every output pixel in the input */
00108         int color_model;
00109         int want_yvu;                    /* Want to return a YUV frame */
00110         char *y_output, *u_output, *v_output; /* Output pointers for a YUV frame */
00111 
00112         mpeg3_slice_t slice_decoders[MPEG3_MAX_CPUS];  /* One slice decoder for every CPU */
00113         int total_slice_decoders;                       /* Total slice decoders in use */
00114         mpeg3_slice_buffer_t slice_buffers[MPEG3_MAX_CPUS];   /* Buffers for holding the slice data */
00115         int total_slice_buffers;         /* Total buffers in the array to be decompressed */
00116         int slice_buffers_initialized;     /* Total buffers initialized in the array */
00117         pthread_mutex_t slice_lock;      /* Lock slice array while getting the next buffer */
00118         pthread_mutex_t test_lock;
00119 
00120         int blockreadsize;
00121         long maxframe;         /* Max value of frame num to read */
00122         double percentage_seek;   /* Perform a percentage seek before the next frame is read */
00123         int frame_seek;        /* Perform a frame seek before the next frame is read */
00124         long framenum;         /* Number of the next frame to be decoded */
00125         long last_number;       /* Last framenum rendered */
00126         int found_seqhdr;
00127         long bitrate;
00128         mpeg3_timecode_t gop_timecode;     /* Timecode for the last GOP header read. */
00129 
00130 /* These are only available from elementary streams. */
00131         long frames_per_gop;       /* Frames per GOP after the first GOP. */
00132         long first_gop_frames;     /* Frames in the first GOP. */
00133         long first_frame;     /* Number of first frame stored in timecode */
00134         long last_frame;      /* Last frame in file */
00135 
00136 /* ================================= Compression variables ===================== */
00137 /* Malloced frame buffers.  2 refframes are swapped in and out. */
00138 /* while only 1 auxframe is used. */
00139         unsigned char *yuv_buffer[5];  /* Make YVU buffers contiguous for all frames */
00140         unsigned char *oldrefframe[3], *refframe[3], *auxframe[3];
00141         unsigned char *llframe0[3], *llframe1[3];
00142         unsigned char *mpeg3_zigzag_scan_table;
00143         unsigned char *mpeg3_alternate_scan_table;
00144 // Source for the next frame presentation
00145         unsigned char **output_src;
00146 /* Pointers to frame buffers. */
00147         unsigned char *newframe[3];
00148         int horizontal_size, vertical_size, mb_width, mb_height;
00149         int coded_picture_width,  coded_picture_height;
00150         int chroma_format, chrom_width, chrom_height, blk_cnt;
00151         int pict_type;
00152         int forw_r_size, back_r_size, full_forw, full_back;
00153         int prog_seq, prog_frame;
00154         int h_forw_r_size, v_forw_r_size, h_back_r_size, v_back_r_size;
00155         int dc_prec, pict_struct, topfirst, frame_pred_dct, conceal_mv;
00156         int intravlc;
00157         int repeatfirst;
00158         int repeat_count;    /* Number of times to repeat the current frame * 100 since floating point is impossible in MMX */
00159         int current_repeat;  /* Number of times the current frame has been repeated * 100 */
00160         int secondfield;
00161         int skip_bframes;
00162         int stwc_table_index, llw, llh, hm, hn, vm, vn;
00163         int lltempref, llx0, lly0, llprog_frame, llfieldsel;
00164         int matrix_coefficients;
00165         int framerate_code;
00166         float frame_rate;
00167         long *cr_to_r, *cr_to_g, *cb_to_g, *cb_to_b;
00168         long *cr_to_r_ptr, *cr_to_g_ptr, *cb_to_g_ptr, *cb_to_b_ptr;
00169         int have_mmx;
00170         int intra_quantizer_matrix[64], non_intra_quantizer_matrix[64];
00171         int chroma_intra_quantizer_matrix[64], chroma_non_intra_quantizer_matrix[64];
00172         int mpeg2;
00173         int qscale_type, altscan;      /* picture coding extension */
00174         int pict_scal;                /* picture spatial scalable extension */
00175         int scalable_mode;            /* sequence scalable extension */
00176 };
00177 
00178 typedef struct mpeg3video_rec mpeg3video_t;
00179 
00180 #endif

Generated on Sat Nov 5 16:15:37 2005 for OPIE by  doxygen 1.4.2