1 /**************************************************************************
3 * This code has been developed by Andrea Graziani. This software is an *
4 * implementation of a part of one or more MPEG-4 Video tools as *
5 * specified in ISO/IEC 14496-2 standard. Those intending to use this *
6 * software module in hardware or software products are advised that its *
7 * use may infringe existing patents or copyrights, and any such use *
8 * would be at such party's own risk. The original developer of this *
9 * software module and his/her company, and subsequent editors and their *
10 * companies (including Project Mayo), will have no liability for use of *
11 * this software or modifications or derivatives thereof. *
13 * Project Mayo gives users of the Codec a license to this software *
14 * module or modifications thereof for use in hardware or software *
15 * products claiming conformance to the MPEG-4 Video Standard as *
16 * described in the Open DivX license. *
18 * The complete Open DivX license can be found at *
19 * http://www.projectmayo.com/opendivx/license.php *
21 **************************************************************************/
23 * Copyright (C) 2001 - Project Mayo
27 * DivX Advanced Research Center <darc@projectmayo.com>
45 static void store_yuv (char *name
, unsigned char *src
, int offset
, int incr
, int width
, int height
);
46 static void putbyte (int c
);
52 const char mode_create
[] = "wb";
53 const char mode_open
[] = "ab";
57 // Purpose: store a frame in yuv format
58 void storeframe (unsigned char *src
[], int width
, int height
)
61 int hor_size
= mp4_state
->horizontal_size
;
63 store_yuv (mp4_state
->outputname
, src
[0], offset
, width
, hor_size
, height
);
70 store_yuv (mp4_state
->outputname
, src
[1], offset
, width
, hor_size
, height
);
71 store_yuv (mp4_state
->outputname
, src
[2], offset
, width
, hor_size
, height
);
76 static void store_yuv (char *name
, unsigned char *src
, int offset
,
77 int incr
, int width
, int height
)
81 const char * mode
= create_flag
? mode_create
: mode_open
;
87 if ((outfile
= fopen (name
, mode
)) == NULL
)
89 _Print ("Error: Couldn't append to %s\n", name
);
93 for (i
= 0; i
< height
; i
++)
95 p
= src
+ offset
+ incr
* i
;
96 fwrite(p
, width
, 1, outfile
);