--- trunk/xvidcore/examples/xvid_decraw.c 2004/04/13 21:20:45 1426 +++ trunk/xvidcore/examples/xvid_decraw.c 2004/07/26 19:31:30 1523 @@ -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.13 2004-04-13 21:20:45 suxen_drol Exp $ + * $Id: xvid_decraw.c,v 1.18 2004-07-26 19:31:30 edgomez Exp $ * ****************************************************************************/ @@ -87,9 +87,8 @@ static int dec_stop(); static void usage(); static int write_image(char *prefix, unsigned char *image); -static int write_tga(char *filename, 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) { @@ -184,13 +183,13 @@ exit(-1); } } - + #if defined(_MSC_VER) if (ARG_INPUTFILE==NULL) { - fprintf(stderr, "Warning: MSVC build does not read correctly from stdin. Use the -i switch.\n\n"); + fprintf(stderr, "Warning: MSVC build does not read EOF correctly from stdin. Use the -i switch.\n\n"); } #endif - + /***************************************************************************** * Values checking ****************************************************************************/ @@ -405,14 +404,13 @@ ****************************************************************************/ if (filenr>0) { - totalsize /= filenr; + totalsize /= filenr; totaldectime /= filenr; printf("Avg: dectime(ms) =%7.2f, fps =%7.2f, length(bytes) =%7d\n", totaldectime, 1000/totaldectime, (int)totalsize); }else{ printf("Nothing was decoded!\n"); } - /***************************************************************************** * XviD PART Stop @@ -585,7 +583,7 @@ return(0); } -int write_pnm(char *filename, unsigned char *image) +static int write_pnm(char *filename, unsigned char *image) { FILE * f; @@ -624,6 +622,7 @@ return 0; } + /***************************************************************************** * Routines for decoding: init decoder, use, and stop decoder ****************************************************************************/ @@ -637,6 +636,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 *----------------------------------------------------------------------*/ @@ -691,6 +694,10 @@ xvid_dec_frame_t xvid_dec_frame; + /* Reset all structures */ + memset(&xvid_dec_frame, 0, sizeof(xvid_dec_frame_t)); + memset(xvid_dec_stats, 0, sizeof(xvid_dec_stats_t)); + /* Set version */ xvid_dec_frame.version = XVID_VERSION; xvid_dec_stats->version = XVID_VERSION;