--- trunk/xvidcore/examples/xvid_decraw.c 2004/04/15 19:44:06 1432 +++ trunk/xvidcore/examples/xvid_decraw.c 2004/07/20 07:31:38 1513 @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: xvid_decraw.c,v 1.14 2004-04-15 19:44:05 edgomez Exp $ + * $Id: xvid_decraw.c,v 1.17 2004-07-20 07:31:38 chl Exp $ * ****************************************************************************/ @@ -79,8 +79,6 @@ ****************************************************************************/ static double msecond(); -static int write_pgm(char *filename, - unsigned char *image); static int dec_init(int use_assembler, int debug_level); static int dec_main(unsigned char *istream, unsigned char *ostream, @@ -88,9 +86,9 @@ xvid_dec_stats_t *xvid_dec_stats); static int dec_stop(); static void usage(); -int write_image(char *prefix, unsigned char *image); -int write_pnm(char *filename, unsigned char *image); -int write_tga(char *filename, unsigned char *image); +static int write_image(char *prefix, unsigned char *image); +static int write_pnm(char *filename, unsigned char *image); +static int write_tga(char *filename, unsigned char *image); const char * type2str(int type) { @@ -132,6 +130,8 @@ printf("xvid_decraw - raw mpeg4 bitstream decoder "); printf("written by Christoph Lampert 2002-2003\n\n"); + memset(&xvid_dec_stats, 0x00, sizeof(xvid_dec_stats)); + /***************************************************************************** * Command line parsing ****************************************************************************/ @@ -351,7 +351,7 @@ sprintf(filename, "%sdec%05d", filepath, filenr); if(write_image(filename, out_buffer)) { fprintf(stderr, - "Error writing decoded PGM frame %s\n", + "Error writing decoded frame %s\n", filename); } } @@ -476,7 +476,7 @@ * output functions ****************************************************************************/ -int write_image(char *prefix, unsigned char *image) +static int write_image(char *prefix, unsigned char *image) { char filename[1024]; char *ext; @@ -504,7 +504,7 @@ return(ret); } -int write_tga(char *filename, unsigned char *image) +static int write_tga(char *filename, unsigned char *image) { FILE * f; char hdr[18]; @@ -585,7 +585,7 @@ return(0); } -int write_pnm(char *filename, unsigned char *image) +static int write_pnm(char *filename, unsigned char *image) { FILE * f; @@ -624,6 +624,7 @@ return 0; } + /***************************************************************************** * Routines for decoding: init decoder, use, and stop decoder ****************************************************************************/ @@ -637,6 +638,10 @@ xvid_gbl_init_t xvid_gbl_init; xvid_dec_create_t xvid_dec_create; + /* Reset the structure with zeros */ + memset(&xvid_gbl_init, 0, sizeof(xvid_gbl_init_t)); + memset(&xvid_dec_create, 0, sizeof(xvid_dec_create_t)); + /*------------------------------------------------------------------------ * XviD core initialization *----------------------------------------------------------------------*/ @@ -690,6 +695,7 @@ int ret; xvid_dec_frame_t xvid_dec_frame; + memset(&xvid_dec_frame,0x00,sizeof(xvid_dec_frame)); /* Set version */ xvid_dec_frame.version = XVID_VERSION;