1 /*===========================================================================* 2 * frame.h * 3 * * 4 * basic frames procedures * 5 * * 6 *===========================================================================*/ 7 8 /* 9 * Copyright (c) 1995 The Regents of the University of California. 10 * All rights reserved. 11 * 12 * Permission to use, copy, modify, and distribute this software and its 13 * documentation for any purpose, without fee, and without written agreement is 14 * hereby granted, provided that the above copyright notice and the following 15 * two paragraphs appear in all copies of this software. 16 * 17 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR 18 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT 19 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF 20 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 * 22 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, 23 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 24 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 25 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO 26 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 27 */ 28 29 30 #ifndef FRAME_INCLUDED 31 #define FRAME_INCLUDED 32 33 /*==============* 34 * HEADER FILES * 35 *==============*/ 36 37 #include "general.h" 38 #include "ansi.h" 39 #include "mtypes.h" 40 #include "libpnmrw.h" //gmsh 41 42 /*===========* 43 * CONSTANTS * 44 *===========*/ 45 #define TYPE_IFRAME 2 46 #define TYPE_PFRAME 3 47 #define TYPE_BFRAME 4 48 49 50 /*=======================* 51 * STRUCTURE DEFINITIONS * 52 *=======================*/ 53 54 typedef struct mpegFrame { 55 int type; 56 char inputFileName[256]; 57 int id; /* the frame number -- starts at 0 */ 58 boolean inUse; /* TRUE iff this frame is currently being used */ 59 /* FALSE means any data here can be thrashed */ 60 61 uint8 **ppm_data; 62 xel **rgb_data; /* pnm format -- see pbmplus docs */ 63 xelval rgb_maxval; /* largest value of any pixel index */ 64 int rgb_format; /* more info from pnm */ 65 66 /* 67 * now, the YCrCb data. All pixel information is stored in unsigned 68 * 8-bit pieces. We separate y, cr, and cb because cr and cb are 69 * subsampled by a factor of 2. 70 */ 71 uint8 **orig_y, **orig_cr, **orig_cb; 72 73 /* now, the decoded data -- relevant only if 74 * referenceFrame == DECODED_FRAME 75 * 76 */ 77 uint8 **decoded_y, **decoded_cr, **decoded_cb; 78 79 /* reference data */ 80 uint8 **ref_y, **ref_cr, **ref_cb; 81 82 /* 83 * these are the Blocks which will ultimately compose MacroBlocks. 84 * A Block is in a format that mp_fwddct() can crunch. 85 */ 86 Block **y_blocks, **cr_blocks, **cb_blocks; 87 88 /* 89 * this is the half-pixel luminance data (for reference frames) 90 */ 91 uint8 **halfX, **halfY, **halfBoth; 92 93 boolean halfComputed; /* TRUE iff half-pixels already computed */ 94 95 struct mpegFrame *next; /* points to the next B-frame to be encoded, if 96 * stdin is used as the input. 97 */ 98 } MpegFrame; 99 100 101 extern MpegFrame *Frame_New _ANSI_ARGS_((int id, int type)); 102 extern void Frame_Init _ANSI_ARGS_((void)); 103 extern void Frame_Free _ANSI_ARGS_((MpegFrame *frame)); 104 extern void Frame_Exit _ANSI_ARGS_((void)); 105 extern void Frame_AllocPPM _ANSI_ARGS_((MpegFrame * frame)); 106 extern void Frame_AllocYCC _ANSI_ARGS_((MpegFrame * mf)); 107 extern void Frame_AllocDecoded _ANSI_ARGS_((MpegFrame *frame, 108 boolean makeReference)); 109 extern void Frame_AllocHalf _ANSI_ARGS_((MpegFrame *frame)); 110 extern void Frame_AllocBlocks _ANSI_ARGS_((MpegFrame *mf)); 111 extern void Frame_Resize _ANSI_ARGS_((MpegFrame *omf, MpegFrame *mf, 112 int insize_x, int insize_y, 113 int outsize_x, int outsize_y)); 114 115 extern void FrameType_Exit(); // for gmsh 116 117 118 #endif /* FRAME_INCLUDED */ 119