1 /*****************************************************************
2 * gavl - a general purpose audio/video processing library
3 *
4 * Copyright (c) 2001 - 2011 Members of the Gmerlin project
5 * gmerlin-general@lists.sourceforge.net
6 * http://gmerlin.sourceforge.net
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, see <http://www.gnu.org/licenses/>.
20 * *****************************************************************/
21 #include <stdlib.h>
22 #include <gavl.h>
23 #include <stdio.h>
24 #include <pngutil.h>
25 #include <accel.h>
26
27 #define IN_X 0
28 #define IN_Y 0
29
30 #define OUT_X 10
31 #define OUT_Y 10
32
main(int argc,char ** argv)33 int main(int argc, char ** argv)
34 {
35 char filename_buffer[1024];
36 int i, imax;
37 gavl_video_deinterlacer_t *deinterlacer;
38
39 gavl_video_format_t format;
40 gavl_video_frame_t * frame, * frame_1;
41
42 gavl_video_options_t * opt;
43
44 gavl_pixelformat_t csp;
45
46 memset(&format, 0, sizeof(format));
47
48 imax = gavl_num_pixelformats();
49 deinterlacer = gavl_video_deinterlacer_create();
50
51 opt = gavl_video_deinterlacer_get_options(deinterlacer);
52
53 // imax = 1;
54
55 for(i = 0; i < imax; i++)
56 {
57 csp = gavl_get_pixelformat(i);
58
59 // csp = GAVL_RGB_24;
60
61 fprintf(stderr, "Pixelformat: %s\n", gavl_pixelformat_to_string(csp));
62
63 frame = read_png(argv[1], &format, csp);
64
65 if(csp == GAVL_RGBA_64)
66 {
67 write_png("test.png", &format, frame);
68 }
69
70 #if 0
71 /* Write test frame */
72 sprintf(filename_buffer, "%s-test.png", gavl_pixelformat_to_string(csp));
73 write_png(filename_buffer, &format, frame);
74 #endif
75
76 gavl_video_options_set_defaults(opt);
77
78 gavl_video_options_set_deinterlace_mode(opt,
79 GAVL_DEINTERLACE_BLEND);
80 gavl_video_options_set_accel_flags(opt, GAVL_ACCEL_MMXEXT);
81
82 gavl_video_deinterlacer_init(deinterlacer, &format);
83
84 frame_1 = gavl_video_frame_create(&format);
85
86 gavl_video_frame_clear(frame_1, &format);
87
88 gavl_video_deinterlacer_deinterlace(deinterlacer, frame, frame_1);
89
90 sprintf(filename_buffer, "%s-deinterlaced.png",
91 gavl_pixelformat_to_string(csp));
92
93 write_png(filename_buffer, &format, frame_1);
94 fprintf(stderr, "Wrote %s\n", filename_buffer);
95 gavl_video_frame_destroy(frame);
96 gavl_video_frame_destroy(frame_1);
97 }
98 gavl_video_deinterlacer_destroy(deinterlacer);
99 return 0;
100 }
101