1 /*****************************************************************************
2 *
3 * XVID MPEG-4 VIDEO CODEC
4 * - Xvid plugin: dump pgm files of original and encoded frames -
5 *
6 * Copyright(C) 2003 Peter Ross <pross@xvid.org>
7 *
8 * This program is free software ; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation ; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY ; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program ; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 * $Id: plugin_dump.c 1985 2011-05-18 09:02:35Z Isibaar $
23 *
24 ****************************************************************************/
25
26 #include <stdio.h>
27
28 #include "../xvid.h"
29 #include "../image/image.h"
30
31
xvid_plugin_dump(void * handle,int opt,void * param1,void * param2)32 int xvid_plugin_dump(void * handle, int opt, void * param1, void * param2)
33 {
34 switch(opt) {
35 case XVID_PLG_INFO :
36 {
37 xvid_plg_info_t * info = (xvid_plg_info_t*)param1;
38 info->flags = XVID_REQORIGINAL;
39 return(0);
40 }
41
42 case XVID_PLG_CREATE :
43 *((void**)param2) = NULL; /* We don't have any private data to bind here */
44 case XVID_PLG_DESTROY :
45 case XVID_PLG_BEFORE :
46 case XVID_PLG_FRAME :
47 return(0);
48
49 case XVID_PLG_AFTER :
50 {
51 xvid_plg_data_t * data = (xvid_plg_data_t*)param1;
52 IMAGE img;
53 char tmp[100];
54 img.y = data->original.plane[0];
55 img.u = data->original.plane[1];
56 img.v = data->original.plane[2];
57 sprintf(tmp, "ori-%03i.pgm", data->frame_num);
58 image_dump_yuvpgm(&img, data->original.stride[0], data->width, data->height, tmp);
59
60 img.y = data->current.plane[0];
61 img.u = data->current.plane[1];
62 img.v = data->current.plane[2];
63 sprintf(tmp, "enc-%03i.pgm", data->frame_num);
64 image_dump_yuvpgm(&img, data->current.stride[0], data->width, data->height, tmp);
65 }
66
67 return(0);
68 }
69
70 return XVID_ERR_FAIL;
71 }
72