Doxygen Source Code Documentation
fsize.c
Go to the documentation of this file.00001 /*===========================================================================* 00002 * fsize.c * 00003 * * 00004 * procedures to keep track of frame size * 00005 * * 00006 * EXPORTED PROCEDURES: * 00007 * Fsize_Reset * 00008 * Fsize_Note * 00009 * Fsize_Validate * 00010 * * 00011 * EXPORTED VARIABLES: * 00012 * Fsize_x * 00013 * Fsize_y * 00014 * * 00015 *===========================================================================*/ 00016 00017 /* 00018 * Copyright (c) 1995 The Regents of the University of California. 00019 * All rights reserved. 00020 * 00021 * Permission to use, copy, modify, and distribute this software and its 00022 * documentation for any purpose, without fee, and without written agreement is 00023 * hereby granted, provided that the above copyright notice and the following 00024 * two paragraphs appear in all copies of this software. 00025 * 00026 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR 00027 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT 00028 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF 00029 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 * 00031 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, 00032 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 00033 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 00034 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO 00035 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 00036 */ 00037 00038 00039 /*==============* 00040 * HEADER FILES * 00041 *==============*/ 00042 00043 #include "all.h" 00044 #include "fsize.h" 00045 #include "dct.h" 00046 00047 00048 /*==================* 00049 * GLOBAL VARIABLES * 00050 *==================*/ 00051 int Fsize_x = 0; 00052 int Fsize_y = 0; 00053 00054 00055 /*=====================* 00056 * EXPORTED PROCEDURES * 00057 *=====================*/ 00058 00059 /*===========================================================================* 00060 * 00061 * Fsize_Reset 00062 * 00063 * reset the frame size to 0 00064 * 00065 * RETURNS: nothing 00066 * 00067 * SIDE EFFECTS: Fsize_x, Fsize_y 00068 * 00069 *===========================================================================*/ 00070 void 00071 Fsize_Reset() 00072 { 00073 Fsize_x = Fsize_y = 0; 00074 } 00075 00076 00077 /*===========================================================================* 00078 * 00079 * Fsize_Validate 00080 * 00081 * make sure that the x, y values are 16-pixel aligned 00082 * 00083 * RETURNS: modifies the x, y values to 16-pixel alignment 00084 * 00085 * SIDE EFFECTS: none 00086 * 00087 *===========================================================================*/ 00088 void 00089 Fsize_Validate(x, y) 00090 int *x; 00091 int *y; 00092 { 00093 *x &= ~(DCTSIZE * 2 - 1); 00094 *y &= ~(DCTSIZE * 2 - 1); 00095 } 00096 00097 00098 /*===========================================================================* 00099 * 00100 * Fsize_Note 00101 * 00102 * note the given frame size and modify the global values as appropriate 00103 * 00104 * RETURNS: nothing 00105 * 00106 * SIDE EFFECTS: Fsize_x, Fsize_y 00107 * 00108 *===========================================================================*/ 00109 void 00110 Fsize_Note(id, width, height) 00111 int id; 00112 int width; 00113 int height; 00114 { 00115 Fsize_x = width; 00116 Fsize_y = height; 00117 Fsize_Validate(&Fsize_x, &Fsize_y); 00118 00119 if ((Fsize_x==0) || (Fsize_y==0)) { 00120 fprintf(stderr,"Frame %d: size is zero!\n",id); 00121 /* exit(1); */ 00122 } 00123 00124 #ifdef BLEAH 00125 if (Fsize_x == 0) { 00126 Fsize_x = width; 00127 Fsize_y = height; 00128 Fsize_Validate(&Fsize_x, &Fsize_y); 00129 } else if (width < Fsize_x || height < Fsize_y) { 00130 fprintf(stderr, "Frame %d: wrong size: (%d,%d). Should be greater or equal to: (%d,%d)\n", 00131 id, width, height, Fsize_x, Fsize_y); 00132 exit(1); 00133 } 00134 #endif 00135 }