Codebase list gavl / 22eed80
Imported Upstream version 1.4.0 IOhannes m zmölnig 11 years ago
47 changed file(s) with 1215 addition(s) and 406 deletion(s). Raw diff Collapse all Expand all
29792979
29802980 # Define the identity of the package.
29812981 PACKAGE=gavl
2982 VERSION=1.2.0
2982 VERSION=1.4.0
29832983
29842984
29852985 cat >>confdefs.h <<_ACEOF
1136811368
1136911369 if test x$test_libpng = xtrue; then
1137011370
11371 OLD_CFLAGS=$CFLAGS
1137211371 OLD_LIBS=$LIBS
1137311372
1137411373 LIBS="$LIBS -lpng -lm -lz"
11375 CFLAGS="$CFLAGS"
1137611374
1137711375 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpng" >&5
1137811376 $as_echo_n "checking for libpng... " >&6; }
1140111399
1140211400 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1140311401 $as_echo "yes" >&6; }
11404 PNG_LIBS=$LIBS;
11405 PNG_CFLAGS=$CFLAGS ;;
11402 PNG_LIBS=$LIBS;;
1140611403 false) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1140711404 $as_echo "no" >&6; }; PNG_LIBS=""; PNG_CFLAGS="";;
1140811405 esac
11409 CFLAGS=$OLD_CFLAGS
1141011406 LIBS=$OLD_LIBS
1141111407
1141211408 fi
33
44 AM_CONFIG_HEADER(include/gavl/config.h)
55
6 AM_INIT_AUTOMAKE(gavl, 1.2.0)
6 AM_INIT_AUTOMAKE(gavl, 1.4.0)
77
88 GAVL_VERSION=$VERSION
99
423423 # directories like "/usr/src/myproject". Separate the files or directories
424424 # with spaces.
425425
426 INPUT = @TOP_SRCDIR@/doc/mainpage.incl @TOP_SRCDIR@/include/gavl/timecode.h @TOP_SRCDIR@/include/gavl/gavl.h @TOP_SRCDIR@/include/gavl/gavltime.h @TOP_SRCDIR@/include/gavl/gavldsp.h @TOP_SRCDIR@/include/gavl/compression.h
426 INPUT = @TOP_SRCDIR@/doc/mainpage.incl @TOP_SRCDIR@/include/gavl/timecode.h @TOP_SRCDIR@/include/gavl/gavl.h @TOP_SRCDIR@/include/gavl/gavltime.h @TOP_SRCDIR@/include/gavl/gavldsp.h @TOP_SRCDIR@/include/gavl/compression.h @TOP_SRCDIR@/include/gavl/metadata.h @TOP_SRCDIR@/include/gavl/metatags.h
427427
428428 # If the value of the INPUT tag contains directories, you can use the
429429 # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
7070 frametable.c \
7171 interleave.c \
7272 memcpy.c \
73 metadata.c \
7374 mix.c \
7475 peakdetector.c \
7576 psnr.c \
8686 colorchannel.lo colorspace.lo compression.lo cputest.lo \
8787 deinterlace.lo deinterlace_blend.lo deinterlace_copy.lo \
8888 deinterlace_scale.lo dsp.lo dsputils.lo frametable.lo \
89 interleave.lo memcpy.lo mix.lo peakdetector.lo psnr.lo \
90 rectangle.lo sampleformat.lo samplerate.lo scale.lo \
89 interleave.lo memcpy.lo metadata.lo mix.lo peakdetector.lo \
90 psnr.lo rectangle.lo sampleformat.lo samplerate.lo scale.lo \
9191 scale_context.lo scale_kernels.lo scale_table.lo ssim.lo \
9292 time.lo timecode.lo timer.lo transform.lo transform_context.lo \
9393 transform_table.lo video.lo videoformat.lo videoframe.lo \
330330 frametable.c \
331331 interleave.c \
332332 memcpy.c \
333 metadata.c \
333334 mix.c \
334335 peakdetector.c \
335336 psnr.c \
473474 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frametable.Plo@am__quote@
474475 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interleave.Plo@am__quote@
475476 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcpy.Plo@am__quote@
477 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata.Plo@am__quote@
476478 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mix.Plo@am__quote@
477479 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/peakdetector.Plo@am__quote@
478480 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psnr.Plo@am__quote@
7070 cnv->contexts = ctx;
7171 }
7272 cnv->num_conversions = 0;
73 cnv->contexts = (gavl_audio_convert_context_t*)0;
74 cnv->last_context = (gavl_audio_convert_context_t*)0;
73 cnv->contexts = NULL;
74 cnv->last_context = NULL;
7575 }
7676
7777 void gavl_audio_converter_destroy(gavl_audio_converter_t* cnv)
4848 if(format == sample_format_names[i].format)
4949 return sample_format_names[i].name;
5050 }
51 return (char*)0;
51 return NULL;
5252 }
5353
5454 gavl_sample_format_t gavl_string_to_sample_format(const char * str)
9898 if(mode == interleave_mode_names[i].mode)
9999 return interleave_mode_names[i].name;
100100 }
101 return (char*)0;
101 return NULL;
102102 }
103103
104104 static const struct
149149 if(id == channel_id_names[i].id)
150150 return channel_id_names[i].name;
151151 }
152 return (char*)0;
152 return NULL;
153153 }
154154
155155 void gavl_audio_format_dump(const gavl_audio_format_t * f)
3131 gavl_overlay_blend_context_t * ret;
3232 ret = calloc(1, sizeof(*ret));
3333
34 ret->ovl_win = gavl_video_frame_create((gavl_video_format_t*)0);
35 ret->dst_win = gavl_video_frame_create((gavl_video_format_t*)0);
34 ret->ovl_win = gavl_video_frame_create(NULL);
35 ret->dst_win = gavl_video_frame_create(NULL);
3636
3737 gavl_video_options_set_defaults(&ret->opt);
3838
7070 {
7171 gavl_video_frame_null(ctx->ovl_win);
7272 gavl_video_frame_destroy(ctx->ovl_win);
73 ctx->ovl_win = (gavl_video_frame_t*)0;
73 ctx->ovl_win = NULL;
7474 ctx->has_overlay = 0;
7575 }
7676
9494 dst_format->pixelformat,
9595 &ctx->ovl_format.pixelformat);
9696
97 ctx->ovl_win = gavl_video_frame_create((gavl_video_format_t*)0);
97 ctx->ovl_win = gavl_video_frame_create(NULL);
9898 gavl_video_format_copy(ovl_format, &ctx->ovl_format);
9999 return 1;
100100 }
2222 #include <blend.h>
2323
2424 #include <math.h>
25 #include <stdlib.h>
2526
2627 /* Switch on individual items in the colorspace tables / macros */
2728 #define HAVE_YUVJ_TO_YUV_8
21412142 return blend_rgba_float;
21422143 break;
21432144 case GAVL_PIXELFORMAT_NONE:
2144 return (gavl_blend_func_t)0;
2145 }
2146 return (gavl_blend_func_t)0;
2147 }
2145 return NULL;
2146 }
2147 return NULL;
2148 }
538538 while(--i)
539539 {
540540 tmp = *(src1++) + *(src2++);
541 *(dst++) = GENERIC_CLIP(tmp,-2147483648,2147483647);
541 *(dst++) = GENERIC_CLIP(tmp,-2147483648LL,2147483647LL);
542542 }
543543 }
544544
682682 while(--i)
683683 {
684684 tmp = *(src1++) - *(src2++);
685 *(dst++) = GENERIC_CLIP(tmp,-2147483648,2147483647);
685 *(dst++) = GENERIC_CLIP(tmp,-2147483648LL,2147483647LL);
686686 }
687687 }
688688
207207 if(pixelformat_tab[i].pixelformat == pixelformat)
208208 return pixelformat_tab[i].name;
209209 }
210 return (const char*)0;
210 return NULL;
211211 }
212212
213213 gavl_pixelformat_t gavl_string_to_pixelformat(const char * name)
1919 * *****************************************************************/
2020 #include <stdlib.h>
2121 #include <stdio.h>
22 #include <string.h>
2223
2324 #include <gavl/gavl.h>
2425 #include <gavl/compression.h>
5657 free(info->global_header);
5758 }
5859
59 #define FLAG_SEPARATE (1<<0)
60 #define FLAG_NEEDS_PIXELFORMAT (1<<1)
60 #define FLAG_SEPARATE (1<<0)
61 #define FLAG_NEEDS_PIXELFORMAT (1<<1)
62 #define FLAG_CFS (1<<2) // Constant Frame Samples
6163
6264 struct
6365 {
7173 /* Audio */
7274 { GAVL_CODEC_ID_ALAW, NULL, "alaw" },
7375 { GAVL_CODEC_ID_ULAW, NULL, "ulaw" },
74 { GAVL_CODEC_ID_MP2, "mp2", "MPEG layer 2" },
75 { GAVL_CODEC_ID_MP3, "mp3", "MPEG layer 3" },
76 { GAVL_CODEC_ID_AC3, "ac3", "AC3" },
77 { GAVL_CODEC_ID_AAC, NULL, "AAC" },
76 { GAVL_CODEC_ID_MP2, "mp2", "MPEG layer 2", FLAG_CFS },
77 { GAVL_CODEC_ID_MP3, "mp3", "MPEG layer 3", FLAG_CFS },
78 { GAVL_CODEC_ID_AC3, "ac3", "AC3", FLAG_CFS },
79 { GAVL_CODEC_ID_AAC, NULL, "AAC", FLAG_CFS },
7880 { GAVL_CODEC_ID_VORBIS, NULL, "Vorbis" },
81 { GAVL_CODEC_ID_FLAC, NULL, "Flac" },
7982
8083 /* Video */
8184 { GAVL_CODEC_ID_JPEG, "jpg", "JPEG image", FLAG_SEPARATE | FLAG_NEEDS_PIXELFORMAT },
118121 return 0;
119122 }
120123
124 int gavl_compression_constant_frame_samples(gavl_codec_id_t id)
125 {
126 int i;
127 for(i = 0; i < sizeof(compression_ids)/sizeof(compression_ids[0]); i++)
128 {
129 if(compression_ids[i].id == id)
130 return !!(compression_ids[i].flags & FLAG_CFS);
131 }
132 return 0;
133 }
134
121135
122136 static const char *
123137 get_name(gavl_codec_id_t id)
167181 }
168182
169183 GAVL_PUBLIC
184 void gavl_compression_info_copy(gavl_compression_info_t * dst,
185 const gavl_compression_info_t * src)
186 {
187 memcpy(dst, src, sizeof(*dst));
188 if(src->global_header)
189 {
190 dst->global_header = malloc(src->global_header_len);
191 memcpy(dst->global_header, src->global_header, src->global_header_len);
192 }
193 }
194
195
196 GAVL_PUBLIC
170197 void gavl_packet_alloc(gavl_packet_t * p, int len)
171198 {
172199 if(len > p->data_alloc)
3838
3939 void (*interpolate)(const uint8_t * src_1,
4040 const uint8_t * src_2,
41 uint8_t * dst, int num, float fac) =
42 (void (*)(const uint8_t *, const uint8_t *, uint8_t *, int, float))0;
41 uint8_t * dst, int num, float fac) = NULL;
4342
4443 num_planes = gavl_pixelformat_num_planes(format->pixelformat);
4544 gavl_pixelformat_chroma_sub(format->pixelformat, &sub_h, &sub_v);
204204 }
205205 break;
206206 }
207 return (gavl_audio_func_t)0;
207 return NULL;
208208 }
209209
210210 gavl_interleave_table_t *
1414 * along with this program; if not, write to the Free Software
1515 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1616 *
17 * $Id: gdither.c,v 1.5 2009/05/03 21:39:35 gmerlin Exp $
17 * $Id: gdither.c,v 1.5 2009-05-03 21:39:35 gmerlin Exp $
1818 */
1919
2020 #include "gdither_types_internal.h"
1414 * along with this program; if not, write to the Free Software
1515 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1616 *
17 * $Id: gdither.h,v 1.2 2007/11/15 21:20:42 gmerlin Exp $
17 * $Id: gdither.h,v 1.2 2007-11-15 21:20:42 gmerlin Exp $
1818 */
1919
2020 #ifndef GDITHER_H
1414 * along with this program; if not, write to the Free Software
1515 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1616 *
17 * $Id: gdither_types.h,v 1.2 2007/11/15 21:20:42 gmerlin Exp $
17 * $Id: gdither_types.h,v 1.2 2007-11-15 21:20:42 gmerlin Exp $
1818 */
1919
2020 #ifndef GDITHER_TYPES_H
1414 * along with this program; if not, write to the Free Software
1515 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1616 *
17 * $Id: gdither_types_internal.h,v 1.2 2007/11/15 21:20:42 gmerlin Exp $
17 * $Id: gdither_types_internal.h,v 1.2 2007-11-15 21:20:42 gmerlin Exp $
1818 */
1919
2020 #ifndef GDITHER_TYPES_H
0 /*****************************************************************
1 * gavl - a general purpose audio/video processing library
2 *
3 * Copyright (c) 2001 - 2011 Members of the Gmerlin project
4 * gmerlin-general@lists.sourceforge.net
5 * http://gmerlin.sourceforge.net
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * *****************************************************************/
20
21 #include <config.h>
22 #include <gavl/metadata.h>
23
24 #include <stdlib.h>
25 #include <string.h>
26 #include <stdio.h>
27
28 static char * my_strdup(const char * str)
29 {
30 char * ret;
31 int len = strlen(str) + 1;
32
33 ret = malloc(len);
34 strncpy(ret, str, len);
35 return ret;
36 }
37
38
39 void
40 gavl_metadata_free(gavl_metadata_t * m)
41 {
42 int i;
43 for(i = 0; i < m->num_tags; i++)
44 {
45 free(m->tags[i].key);
46 free(m->tags[i].val);
47 }
48 if(m->tags)
49 free(m->tags);
50 gavl_metadata_init(m);
51 }
52
53 void
54 gavl_metadata_copy(gavl_metadata_t * dst,
55 const gavl_metadata_t * src)
56 {
57 int i;
58 dst->tags = calloc(src->tags_alloc, sizeof(*dst->tags));
59
60 for(i = 0; i < src->num_tags; i++)
61 {
62 dst->tags[i].key = my_strdup(src->tags[i].key);
63 dst->tags[i].val = my_strdup(src->tags[i].val);
64 }
65 dst->tags_alloc = src->tags_alloc;
66 dst->num_tags = src->num_tags;
67 }
68
69
70 void
71 gavl_metadata_init(gavl_metadata_t * m)
72 {
73 memset(m, 0, sizeof(*m));
74 }
75
76
77 static int find_tag(const gavl_metadata_t * m, const char * key)
78 {
79 int i;
80 for(i = 0; i < m->num_tags; i++)
81 {
82 if(!strcmp(m->tags[i].key, key))
83 return i;
84 }
85 return -1;
86 }
87
88 void
89 gavl_metadata_set(gavl_metadata_t * m,
90 const char * key,
91 const char * val_c)
92 {
93 char * val;
94 if(val_c && (*val_c != '\0'))
95 val = my_strdup(val_c);
96 else
97 val = NULL;
98 gavl_metadata_set_nocpy(m, key, val);
99 }
100
101
102 void
103 gavl_metadata_set_nocpy(gavl_metadata_t * m,
104 const char * key,
105 char * val)
106 {
107 int idx = find_tag(m, key);
108
109 if(idx >= 0) // Tag exists
110 {
111 if(m->tags[idx].val)
112 free(m->tags[idx].val);
113 if(val && (*val != '\0')) // Replace tag
114 m->tags[idx].val = val;
115 else // Delete tag
116 {
117 if(idx < (m->num_tags - 1))
118 {
119 memmove(m->tags + idx, m->tags + idx + 1,
120 (m->num_tags - 1 - idx) * sizeof(*m->tags));
121 }
122 m->num_tags--;
123 }
124 }
125 else
126 {
127 if(val && (*val != '\0')) // Add new tag
128 {
129 if(m->num_tags + 1 > m->tags_alloc)
130 {
131 m->tags_alloc = m->num_tags + 16;
132 m->tags = realloc(m->tags,
133 m->tags_alloc * sizeof(*m->tags));
134 }
135 m->tags[m->num_tags].key = my_strdup(key);
136 m->tags[m->num_tags].val = val;
137 m->num_tags++;
138 }
139 }
140 }
141
142 #define STR_SIZE 128
143
144 void
145 gavl_metadata_set_int(gavl_metadata_t * m,
146 const char * key,
147 int val)
148 {
149 char str[STR_SIZE];
150 snprintf(str, STR_SIZE, "%d", val);
151 gavl_metadata_set(m, key, str);
152 }
153
154 #undef STR_SIZE
155
156 const char * gavl_metadata_get(const gavl_metadata_t * m,
157 const char * key)
158 {
159 int idx = find_tag(m, key);
160 if(idx < 0)
161 return NULL;
162 return m->tags[idx].val;
163 }
164
165
166 int gavl_metadata_get_int(const gavl_metadata_t * m,
167 const char * key, int * ret)
168 {
169 char * rest;
170 const char * val_str = gavl_metadata_get(m, key);
171 if(!val_str)
172 return 0;
173 *ret = strtol(val_str, &rest, 10);
174 if(*rest != '\0')
175 return 0;
176 return 1;
177 }
178
179 /* Time <-> String */
180
181 void
182 gavl_metadata_date_to_string(int year,
183 int month,
184 int day, char * ret)
185 {
186 snprintf(ret, GAVL_METADATA_DATE_STRING_LEN,
187 "%04d-%02d-%02d", year, month, day);
188 }
189
190 void
191 gavl_metadata_date_time_to_string(int year,
192 int month,
193 int day,
194 int hour,
195 int minute,
196 int second,
197 char * ret)
198 {
199 snprintf(ret, GAVL_METADATA_DATE_TIME_STRING_LEN,
200 "%04d-%02d-%02d %02d:%02d:%02d",
201 year, month, day, hour, minute, second);
202 }
203
204 void
205 gavl_metadata_set_date(gavl_metadata_t * m,
206 const char * key,
207 int year,
208 int month,
209 int day)
210 {
211 // YYYY-MM-DD
212 char buf[GAVL_METADATA_DATE_STRING_LEN];
213 gavl_metadata_date_to_string(year, month, day, buf);
214 gavl_metadata_set(m, key, buf);
215 }
216
217 void
218 gavl_metadata_set_date_time(gavl_metadata_t * m,
219 const char * key,
220 int year,
221 int month,
222 int day,
223 int hour,
224 int minute,
225 int second)
226 {
227 // YYYY-MM-DD HH:MM:SS
228 char buf[GAVL_METADATA_DATE_TIME_STRING_LEN];
229 gavl_metadata_date_time_to_string(year,
230 month,
231 day,
232 hour,
233 minute,
234 second,
235 buf);
236 gavl_metadata_set(m, key, buf);
237 }
238
239 GAVL_PUBLIC int
240 gavl_metadata_get_date(gavl_metadata_t * m,
241 const char * key,
242 int * year,
243 int * month,
244 int * day)
245 {
246 const char * val = gavl_metadata_get(m, key);
247 if(!val)
248 return 0;
249
250 if(sscanf(val, "%04d-%02d-%02d", year, month, day) < 3)
251 return 0;
252 return 1;
253 }
254
255 GAVL_PUBLIC int
256 gavl_metadata_get_date_time(gavl_metadata_t * m,
257 const char * key,
258 int * year,
259 int * month,
260 int * day,
261 int * hour,
262 int * minute,
263 int * second)
264 {
265 const char * val = gavl_metadata_get(m, key);
266 if(!val)
267 return 0;
268
269 if(sscanf(val, "%04d-%02d-%02d %02d:%02d:%02d",
270 year, month, day, hour, minute, second) < 6)
271 return 0;
272 return 1;
273 }
274
275
276
277 void gavl_metadata_merge(gavl_metadata_t * dst,
278 const gavl_metadata_t * src1,
279 const gavl_metadata_t * src2)
280 {
281 int i;
282 /* src1 has priority */
283 for(i = 0; i < src1->num_tags; i++)
284 gavl_metadata_set(dst, src1->tags[i].key, src1->tags[i].val);
285
286 /* From src2 we take only the tags, which aren't available */
287 for(i = 0; i < src2->num_tags; i++)
288 {
289 if(!gavl_metadata_get(dst, src2->tags[i].key))
290 gavl_metadata_set(dst, src2->tags[i].key,
291 src2->tags[i].val);
292 }
293 }
294
295 void gavl_metadata_merge2(gavl_metadata_t * dst,
296 const gavl_metadata_t * src)
297 {
298 int i;
299 for(i = 0; i < src->num_tags; i++)
300 {
301 if(!gavl_metadata_get(dst, src->tags[i].key))
302 gavl_metadata_set(dst,
303 src->tags[i].key,
304 src->tags[i].val);
305 }
306 }
307
308 GAVL_PUBLIC void
309 gavl_metadata_dump(const gavl_metadata_t * m, int indent)
310 {
311 int len, i, j;
312 int max_key_len = 0;
313
314 for(i = 0; i < m->num_tags; i++)
315 {
316 len = strlen(m->tags[i].key);
317 if(len > max_key_len)
318 max_key_len = len;
319 }
320
321 for(i = 0; i < m->num_tags; i++)
322 {
323 len = strlen(m->tags[i].key);
324
325 for(j = 0; j < indent; j++)
326 fprintf(stderr, " ");
327
328 fprintf(stderr, "%s: ", m->tags[i].key);
329
330 for(j = 0; j < max_key_len - len; j++)
331 fprintf(stderr, " ");
332
333 fprintf(stderr, "%s\n", m->tags[i].val);
334 }
335 }
336
337 int
338 gavl_metadata_equal(const gavl_metadata_t * m1,
339 const gavl_metadata_t * m2)
340 {
341 int i;
342 const char * val;
343
344 /* Check if tags from m1 are present in m2 */
345 for(i = 0; i < m1->num_tags; i++)
346 {
347 val = gavl_metadata_get(m2, m1->tags[i].key);
348 if(!val || strcmp(val, m1->tags[i].val))
349 return 0;
350 }
351
352 /* Check if tags from m2 are present in m1 */
353 for(i = 0; i < m2->num_tags; i++)
354 {
355 if(!gavl_metadata_get(m1, m2->tags[i].key))
356 return 0;
357 }
358 return 1;
359 }
149149 // int output_side;
150150 int input_lfe;
151151 int output_lfe;
152
153152 int in_index, out_index;
154153
154 float center_level;
155 float rear_level;
156
157 if(in->center_level > 0.0)
158 center_level = in->center_level;
159 else
160 center_level = 1.0;
161
162 if(in->rear_level > 0.0)
163 rear_level = in->rear_level;
164 else
165 rear_level = 1.0;
166
155167 input_front = gavl_front_channels(in);
156168 output_front = gavl_front_channels(out);
157169
361373
362374 OUT_INDEX(GAVL_CHID_FRONT_CENTER);
363375 IN_INDEX(GAVL_CHID_FRONT_CENTER);
364 ret[out_index][in_index] = in->center_level;
376 ret[out_index][in_index] = center_level;
365377 break;
366378 case 2: /* 3 Front -> 2 Front */
367379 OUT_INDEX(GAVL_CHID_FRONT_LEFT);
374386
375387 OUT_INDEX(GAVL_CHID_FRONT_LEFT);
376388 IN_INDEX(GAVL_CHID_FRONT_CENTER);
377 ret[out_index][in_index] = in->center_level;
378
379 OUT_INDEX(GAVL_CHID_FRONT_RIGHT);
380 IN_INDEX(GAVL_CHID_FRONT_CENTER);
381 ret[out_index][in_index] = in->center_level;
389 ret[out_index][in_index] = center_level;
390
391 OUT_INDEX(GAVL_CHID_FRONT_RIGHT);
392 IN_INDEX(GAVL_CHID_FRONT_CENTER);
393 ret[out_index][in_index] = center_level;
382394 break;
383395 case 3: /* 3 Front -> 3 Front */
384396 OUT_INDEX(GAVL_CHID_FRONT_LEFT);
557569 case 1: /* 1 Rear -> 1 Front */
558570 OUT_INDEX(GAVL_CHID_FRONT_CENTER);
559571 IN_INDEX(GAVL_CHID_REAR_CENTER);
560 ret[out_index][in_index] = in->rear_level;
572 ret[out_index][in_index] = rear_level;
561573 break;
562574 case 2: /* 1 Rear -> 2 Front */
563575 case 3:
564576 OUT_INDEX(GAVL_CHID_FRONT_LEFT);
565577 IN_INDEX(GAVL_CHID_REAR_CENTER);
566 ret[out_index][in_index] = in->rear_level;
578 ret[out_index][in_index] = rear_level;
567579
568580 OUT_INDEX(GAVL_CHID_FRONT_RIGHT);
569581 IN_INDEX(GAVL_CHID_REAR_CENTER);
570 ret[out_index][in_index] = in->rear_level;
582 ret[out_index][in_index] = rear_level;
571583 break;
572584 }
573585 break;
596608 /* 2 Rear -> 1 Front */
597609 OUT_INDEX(GAVL_CHID_FRONT_CENTER);
598610 IN_INDEX(GAVL_CHID_REAR_LEFT);
599 ret[out_index][in_index] = in->rear_level;
611 ret[out_index][in_index] = rear_level;
600612
601613 OUT_INDEX(GAVL_CHID_FRONT_CENTER);
602614 IN_INDEX(GAVL_CHID_REAR_RIGHT);
603 ret[out_index][in_index] = in->rear_level;
615 ret[out_index][in_index] = rear_level;
604616 }
605617 else
606618 {
607619 OUT_INDEX(GAVL_CHID_FRONT_LEFT);
608620 IN_INDEX(GAVL_CHID_REAR_LEFT);
609 ret[out_index][in_index] = in->rear_level;
621 ret[out_index][in_index] = rear_level;
610622
611623 OUT_INDEX(GAVL_CHID_FRONT_RIGHT);
612624 IN_INDEX(GAVL_CHID_REAR_RIGHT);
613 ret[out_index][in_index] = in->rear_level;
625 ret[out_index][in_index] = rear_level;
614626 break;
615627 }
616628 break;
593593 case GAVL_SAMPLE_NONE:
594594 break;
595595 }
596 return (gavl_audio_func_t)0;
596 return NULL;
597597 }
598598
599599 void gavl_destroy_sampleformat_table(gavl_sampleformat_table_t * t)
6363 int i, j;
6464 ret = calloc(1, sizeof(*ret));
6565
66 ret->src = gavl_video_frame_create((gavl_video_format_t*)0);
67 ret->dst = gavl_video_frame_create((gavl_video_format_t*)0);
66 ret->src = gavl_video_frame_create(NULL);
67 ret->dst = gavl_video_frame_create(NULL);
6868
6969 gavl_video_options_set_defaults(&ret->opt);
7070
181181 return tab->scale_float_x_4;
182182 break;
183183 }
184 return (gavl_video_scale_scanline_func)0;
184 return NULL;
185185 }
186186
187187 static void get_minmax(gavl_pixelformat_t pixelformat,
924924
925925 int h_radius_real;
926926 const float * h_coeffs_real;
927 float *h_c = (float*)0;
927 float *h_c = NULL;
928928 int v_radius_real;
929929 const float * v_coeffs_real;
930 float *v_c = (float*)0;
930 float *v_c = NULL;
931931
932932 int src_width, src_height; /* Needed for generating the scale table */
933933
148148 return get_weight_sinc;
149149 default:
150150 *num_points = 0;
151 return (gavl_video_scale_get_weight)0;
151 return NULL;
152152 }
153153 }
100100 int i, j, src_index_min, src_index_nearest;
101101 double src_index_f;
102102 float widen_factor;
103 float * preblur_factors = (float*)0;
103 float * preblur_factors = NULL;
104104 int num_preblur_factors = 0;
105105 int num_tmp_factors = 0;
106 float * tmp_factors = (float*)0;
106 float * tmp_factors = NULL;
107107
108108 gavl_video_scale_get_weight weight_func;
109109
108108 uint64_t gavl_benchmark_get_time(int config_flags)
109109 {
110110 struct timespec ts;
111 #if defined(CLOCK_PROCESS_CPUTIME_ID)
111112 clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
113 #elif defined(CLOCK_PROF)
114 clock_gettime(CLOCK_PROF, &ts);
115 #else
116 clockgettime(CLOCK_REALTIME, &ts);
117 #endif
118
112119 return (uint64_t)(ts.tv_sec) * 1000000000 + ts.tv_nsec;
113120 }
114121
123123 return tab->transform_float_x_4;
124124 break;
125125 }
126 return (gavl_transform_scanline_func)0;
126 return NULL;
127127 }
128128
129129
5757 free(cnv->first_context);
5858 cnv->first_context = ctx;
5959 }
60 cnv->last_context = (gavl_video_convert_context_t*)0;
60 cnv->last_context = NULL;
6161 cnv->num_contexts = 0;
6262 }
6363
136136 if(interlace_mode_tab[i].mode == mode)
137137 return interlace_mode_tab[i].name;
138138 }
139 return (const char*)0;
139 return NULL;
140140 }
141141
142142 typedef const struct
164164 if(framerate_mode_tab[i].mode == mode)
165165 return framerate_mode_tab[i].name;
166166 }
167 return (const char*)0;
167 return NULL;
168168
169169 }
170170
193193 if(chroma_placement_tab[i].mode == mode)
194194 return chroma_placement_tab[i].name;
195195 }
196 return (const char*)0;
196 return NULL;
197197
198198 }
199199
292292 }
293293 return ret;
294294 }
295
296 void gavl_get_field_format(const gavl_video_format_t * frame_format,
297 gavl_video_format_t * field_format,
298 int field)
299 {
300 gavl_video_format_copy(field_format, frame_format);
301
302 field_format->image_height /= 2;
303 field_format->frame_height /= 2;
304
305 if(frame_format->image_height % 2)
306 {
307 /* Top field gets an extra scanline */
308 if(!field)
309 {
310 field_format->image_height++;
311 if(field_format->frame_height < field_format->image_height)
312 field_format->frame_height = field_format->image_height;
313 }
314 }
315 }
4848 static void video_frame_alloc(gavl_video_frame_t * ret,
4949 const gavl_video_format_t * format, int align)
5050 {
51 switch(format->pixelformat)
52 {
53 case GAVL_GRAY_8:
54 ret->strides[0] = format->frame_width;
55 if(align)
56 ALIGN(ret->strides[0]);
57 ret->planes[0] = memalign(ALIGNMENT_BYTES,
58 ret->strides[0] * format->frame_height);
59 break;
60 case GAVL_GRAYA_16:
61 case GAVL_GRAY_16:
62 case GAVL_RGB_15:
63 case GAVL_BGR_15:
64 case GAVL_RGB_16:
65 case GAVL_BGR_16:
66 ret->strides[0] = format->frame_width*2;
67 if(align)
68 ALIGN(ret->strides[0]);
69 ret->planes[0] = memalign(ALIGNMENT_BYTES,
70 ret->strides[0] * format->frame_height);
71 break;
72 case GAVL_RGB_24:
73 case GAVL_BGR_24:
74 ret->strides[0] = format->frame_width*3;
75 if(align)
76 ALIGN(ret->strides[0]);
77 ret->planes[0] = memalign(ALIGNMENT_BYTES,
78 ret->strides[0] * format->frame_height);
79 break;
80 case GAVL_RGB_32:
81 case GAVL_BGR_32:
82 case GAVL_YUVA_32:
83 case GAVL_GRAYA_32:
84 ret->strides[0] = format->frame_width*4;
85 if(align)
86 ALIGN(ret->strides[0]);
87 ret->planes[0] = memalign(ALIGNMENT_BYTES,
88 ret->strides[0] * format->frame_height);
89 break;
90 case GAVL_RGBA_32:
91 ret->strides[0] = format->frame_width*4;
92 if(align)
93 ALIGN(ret->strides[0]);
94 ret->planes[0] = memalign(ALIGNMENT_BYTES,
95 ret->strides[0] * format->frame_height);
96 break;
97 case GAVL_RGB_48:
98 ret->strides[0] = format->frame_width*6;
99 if(align)
100 ALIGN(ret->strides[0]);
101 ret->planes[0] = memalign(ALIGNMENT_BYTES,
102 ret->strides[0] * format->frame_height);
103 break;
104 case GAVL_RGBA_64:
105 case GAVL_YUVA_64:
106 ret->strides[0] = format->frame_width*8;
107 if(align)
108 ALIGN(ret->strides[0]);
109 ret->planes[0] = memalign(ALIGNMENT_BYTES,
110 ret->strides[0] * format->frame_height);
111 break;
112 case GAVL_GRAY_FLOAT:
113 ret->strides[0] = format->frame_width*sizeof(float);
114 if(align)
115 ALIGN(ret->strides[0]);
116 ret->planes[0] = memalign(ALIGNMENT_BYTES,
117 ret->strides[0] * format->frame_height);
118 break;
119 case GAVL_GRAYA_FLOAT:
120 ret->strides[0] = 2*format->frame_width*sizeof(float);
121 if(align)
122 ALIGN(ret->strides[0]);
123 ret->planes[0] = memalign(ALIGNMENT_BYTES,
124 ret->strides[0] * format->frame_height);
125 break;
126
127 case GAVL_RGB_FLOAT:
128 case GAVL_YUV_FLOAT:
129 ret->strides[0] = format->frame_width*3*sizeof(float);
130 if(align)
131 ALIGN(ret->strides[0]);
132 ret->planes[0] = memalign(ALIGNMENT_BYTES,
133 ret->strides[0] * format->frame_height);
134 break;
135 case GAVL_RGBA_FLOAT:
136 case GAVL_YUVA_FLOAT:
137 ret->strides[0] = format->frame_width*4*sizeof(float);
138 if(align)
139 ALIGN(ret->strides[0]);
140 ret->planes[0] = memalign(ALIGNMENT_BYTES,
141 ret->strides[0] * format->frame_height);
142 break;
143 case GAVL_YUY2:
144 case GAVL_UYVY:
145 ret->strides[0] = format->frame_width*2;
146 if(align)
147 ALIGN(ret->strides[0]);
148 ret->planes[0] = memalign(ALIGNMENT_BYTES,
149 ret->strides[0] * format->frame_height);
150 break;
151 case GAVL_YUV_420_P:
152 case GAVL_YUVJ_420_P:
153 ret->strides[0] = format->frame_width;
154 ret->strides[1] = (format->frame_width+1)/2;
155 ret->strides[2] = (format->frame_width+1)/2;
156
51 int planar;
52
53 if(format->pixelformat == GAVL_PIXELFORMAT_NONE)
54 {
55 fprintf(stderr, "Pixelformat not specified for video frame\n");
56 return;
57 }
58 planar = gavl_pixelformat_is_planar(format->pixelformat);
59
60 if(planar)
61 {
62 int sub_h;
63 int sub_v;
64 int bpc;
65
66 gavl_pixelformat_chroma_sub(format->pixelformat, &sub_h, &sub_v);
67
68 bpc = gavl_pixelformat_bytes_per_component(format->pixelformat);
69
70 if(!ret->strides[0])
71 {
72 ret->strides[0] = bpc * format->frame_width;
73 ret->strides[1] = bpc * ((format->frame_width + sub_h - 1) / sub_h);
74 ret->strides[2] = ret->strides[1];
75
15776 if(align)
15877 {
15978 ALIGN(ret->strides[0]);
16079 ALIGN(ret->strides[1]);
16180 ALIGN(ret->strides[2]);
16281 }
163 ret->planes[0] = memalign(ALIGNMENT_BYTES,
164 ret->strides[0]*format->frame_height+
165 ret->strides[1]*((format->frame_height+1)/2)+
166 ret->strides[2]*((format->frame_height+1)/2));
167 ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height;
168 ret->planes[2] = ret->planes[1] + ret->strides[1]*((format->frame_height+1)/2);
169 break;
170 case GAVL_YUV_410_P:
171 ret->strides[0] = format->frame_width;
172 ret->strides[1] = (format->frame_width+3)/4;
173 ret->strides[2] = (format->frame_width+3)/4;
174
82 }
83
84 ret->planes[0] = memalign(ALIGNMENT_BYTES,
85 ret->strides[0]*format->frame_height+
86 ret->strides[1]*((format->frame_height+sub_v-1)/sub_v)+
87 ret->strides[2]*((format->frame_height+sub_v-1)/sub_v));
88 ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height;
89 ret->planes[2] = ret->planes[1] + ret->strides[1]*((format->frame_height+sub_v-1)/sub_v);
90 }
91 else // Packed
92 {
93 if(!ret->strides[0])
94 {
95 ret->strides[0] =
96 format->frame_width * gavl_pixelformat_bytes_per_pixel(format->pixelformat);
17597 if(align)
176 {
17798 ALIGN(ret->strides[0]);
178 ALIGN(ret->strides[1]);
179 ALIGN(ret->strides[2]);
180 }
181
182 ret->planes[0] = memalign(ALIGNMENT_BYTES,
183 ret->strides[0]*format->frame_height+
184 ret->strides[1]*((format->frame_height+3)/4)+
185 ret->strides[2]*((format->frame_height+3)/4));
186 ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height;
187 ret->planes[2] = ret->planes[1] + ret->strides[1]*((format->frame_height+3)/4);
188 break;
189 case GAVL_YUV_422_P:
190 case GAVL_YUVJ_422_P:
191 ret->strides[0] = format->frame_width;
192 ret->strides[1] = (format->frame_width+1)/2;
193 ret->strides[2] = (format->frame_width+1)/2;
194
195 if(align)
196 {
197 ALIGN(ret->strides[0]);
198 ALIGN(ret->strides[1]);
199 ALIGN(ret->strides[2]);
200 }
201
202 ret->planes[0] = memalign(ALIGNMENT_BYTES,
203 ret->strides[0]*format->frame_height+
204 ret->strides[1]*format->frame_height+
205 ret->strides[2]*format->frame_height);
206
207 ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height;
208 ret->planes[2] = ret->planes[1] + ret->strides[1]*format->frame_height;
209 break;
210 case GAVL_YUV_422_P_16:
211 ret->strides[0] = format->frame_width*2;
212 ret->strides[1] = ((format->frame_width+1)/2)*2;
213 ret->strides[2] = ((format->frame_width+1)/2)*2;
214
215 if(align)
216 {
217 ALIGN(ret->strides[0]);
218 ALIGN(ret->strides[1]);
219 ALIGN(ret->strides[2]);
220 }
221
222 ret->planes[0] = memalign(ALIGNMENT_BYTES,
223 ret->strides[0]*format->frame_height+
224 ret->strides[1]*format->frame_height+
225 ret->strides[2]*format->frame_height);
226
227 ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height;
228 ret->planes[2] = ret->planes[1] + ret->strides[1]*format->frame_height;
229 break;
230 case GAVL_YUV_411_P:
231 ret->strides[0] = format->frame_width;
232 ret->strides[1] = (format->frame_width+3)/4;
233 ret->strides[2] = (format->frame_width+3)/4;
234
235 if(align)
236 {
237 ALIGN(ret->strides[0]);
238 ALIGN(ret->strides[1]);
239 ALIGN(ret->strides[2]);
240 }
241
242 ret->planes[0] = memalign(ALIGNMENT_BYTES,
243 ret->strides[0]*format->frame_height+
244 ret->strides[1]*format->frame_height+
245 ret->strides[2]*format->frame_height);
246
247 ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height;
248 ret->planes[2] = ret->planes[1] + ret->strides[1]*format->frame_height;
249 break;
250 case GAVL_YUV_444_P:
251 case GAVL_YUVJ_444_P:
252 ret->strides[0] = format->frame_width;
253 ret->strides[1] = format->frame_width;
254 ret->strides[2] = format->frame_width;
255
256 if(align)
257 {
258 ALIGN(ret->strides[0]);
259 ALIGN(ret->strides[1]);
260 ALIGN(ret->strides[2]);
261 }
262
263 ret->planes[0] = memalign(ALIGNMENT_BYTES,
264 ret->strides[0]*format->frame_height+
265 ret->strides[1]*format->frame_height+
266 ret->strides[2]*format->frame_height);
267
268 ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height;
269 ret->planes[2] = ret->planes[1] + ret->strides[1]*format->frame_height;
270 break;
271 case GAVL_YUV_444_P_16:
272 ret->strides[0] = format->frame_width*2;
273 ret->strides[1] = format->frame_width*2;
274 ret->strides[2] = format->frame_width*2;
275
276 if(align)
277 {
278 ALIGN(ret->strides[0]);
279 ALIGN(ret->strides[1]);
280 ALIGN(ret->strides[2]);
281 }
282
283 ret->planes[0] = memalign(ALIGNMENT_BYTES,
284 ret->strides[0]*format->frame_height+
285 ret->strides[1]*format->frame_height+
286 ret->strides[2]*format->frame_height);
287
288 ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height;
289 ret->planes[2] = ret->planes[1] + ret->strides[1]*format->frame_height;
290 break;
291 case GAVL_PIXELFORMAT_NONE:
292 fprintf(stderr, "Pixelformat not specified for video frame\n");
293 return;
294 }
295
99 }
100 ret->planes[0] = memalign(ALIGNMENT_BYTES,
101 ret->strides[0] * format->frame_height);
102 }
296103 }
297104
298105 static void video_frame_free(gavl_video_frame_t * frame)
299106 {
300107 if(frame->planes[0])
301108 free(frame->planes[0]);
302 frame->planes[0] = (uint8_t*)0;
109 frame->planes[0] = NULL;
303110 }
304111
305112 gavl_video_frame_t * gavl_video_frame_create(const gavl_video_format_t * format)
329136
330137 void gavl_video_frame_null(gavl_video_frame_t* frame)
331138 {
332 frame->planes[0] = (uint8_t*)0;
139 frame->planes[0] = NULL;
333140 }
334141
335142 void gavl_video_frame_clear_mask(gavl_video_frame_t * frame,
1037844 case GAVL_PIXELFORMAT_NONE:
1038845 break;
1039846 }
1040 return (flip_scanline_func)0;
847 return NULL;
1041848 }
1042849
1043850 void gavl_video_frame_copy_flip_x(const gavl_video_format_t * format,
15091316 uint16_t packed_16;
15101317 uint8_t packed_32[4];
15111318 uint16_t packed_64[4];
1512 float color_float[2];
1319 float color_float[4];
15131320
15141321 gavl_init_memcpy();
15151322
17431550 int i;
17441551 int sub_h, sub_v;
17451552 int advance;
1746 int num_planes = gavl_pixelformat_num_planes(format->pixelformat);
1553 int num_planes;
17471554 if(!frame->strides[0])
17481555 gavl_video_frame_set_strides(frame, format);
17491556
1750 gavl_pixelformat_chroma_sub(format->pixelformat, &sub_h, &sub_v);
1751
1752 for(i = 0; i < num_planes; i++)
1753 {
1754 frame->planes[i] = buffer;
1755 advance = frame->strides[i] * format->frame_height;
1756 if(i)
1757 advance /= sub_v;
1758 buffer += advance;
1557 if(buffer)
1558 {
1559 num_planes = gavl_pixelformat_num_planes(format->pixelformat);
1560 gavl_pixelformat_chroma_sub(format->pixelformat, &sub_h, &sub_v);
1561
1562 for(i = 0; i < num_planes; i++)
1563 {
1564 frame->planes[i] = buffer;
1565 advance = frame->strides[i] * format->frame_height;
1566 if(i)
1567 advance /= sub_v;
1568 buffer += advance;
1569 }
1570 }
1571 else
1572 {
1573 video_frame_alloc(frame, format, 0);
17591574 }
17601575
17611576 }
0 pkginclude_HEADERS = compression.h gavl.h gavltime.h gavl_version.h gavldsp.h timecode.h gavldefs.h
0 pkginclude_HEADERS = \
1 compression.h \
2 gavl.h \
3 gavltime.h \
4 gavl_version.h \
5 gavldsp.h \
6 timecode.h \
7 gavldefs.h \
8 metadata.h \
9 metatags.h
10
111
212 EXTRA_DIST = gavl_version.h.in
205205 top_build_prefix = @top_build_prefix@
206206 top_builddir = @top_builddir@
207207 top_srcdir = @top_srcdir@
208 pkginclude_HEADERS = compression.h gavl.h gavltime.h gavl_version.h gavldsp.h timecode.h gavldefs.h
208 pkginclude_HEADERS = \
209 compression.h \
210 gavl.h \
211 gavltime.h \
212 gavl_version.h \
213 gavldsp.h \
214 timecode.h \
215 gavldefs.h \
216 metadata.h \
217 metatags.h
218
209219 EXTRA_DIST = gavl_version.h.in
210220 all: config.h
211221 $(MAKE) $(AM_MAKEFLAGS) all-am
4545 #define GAVL_COMPRESSION_HAS_B_FRAMES (1<<1) //!< Frames don't appear in presentation order
4646 #define GAVL_COMPRESSION_HAS_FIELD_PICTURES (1<<2) //!< Packets can consist of 2 consecutive fields
4747 #define GAVL_COMPRESSION_SBR (1<<3) //!< Samplerate got doubled by decoder, format and sample counts are for the upsampled rate
48
49 /** \brief Codec ID
50 *
51 * These are used as identifiers for the type of compression
52 */
4853
4954 typedef enum
5055 {
5762 GAVL_CODEC_ID_AC3, //!< AC3
5863 GAVL_CODEC_ID_AAC, //!< AAC as stored in quicktime/mp4
5964 GAVL_CODEC_ID_VORBIS, //!< Vorbis (segmented extradata and packets)
65 GAVL_CODEC_ID_FLAC, //!< Flac (extradata contain a file header without comment and seektable)
6066
6167 /* Video */
6268 GAVL_CODEC_ID_JPEG = 0x10000, //!< JPEG image
6773 GAVL_CODEC_ID_MPEG2, //!< MPEG-2 video
6874 GAVL_CODEC_ID_MPEG4_ASP, //!< MPEG-4 ASP (a.k.a. Divx4)
6975 GAVL_CODEC_ID_H264, //!< H.264 (Annex B)
70 GAVL_CODEC_ID_THEORA, //!< Theora (segmented extradata
76 GAVL_CODEC_ID_THEORA, //!< Theora (segmented extradata)
7177 GAVL_CODEC_ID_DIRAC, //!< Complete DIRAC frames, sequence end code appended to last packet
7278 GAVL_CODEC_ID_DV, //!< DV (several variants)
7379 } gavl_codec_id_t;
110116 GAVL_PUBLIC
111117 void gavl_compression_info_dump(const gavl_compression_info_t * info);
112118
119 /** \brief Copy a compression info
120 * \param dst Destination
121 * \param src Source
122 *
123 */
124
125 GAVL_PUBLIC
126 void gavl_compression_info_copy(gavl_compression_info_t * dst,
127 const gavl_compression_info_t * src);
128
129
113130 /** \brief Get the file extension of the corresponding raw format
114131 * \param id A codec ID
115132 * \param separate If non-null returns 1 if each packet should be in a separate file
140157 GAVL_PUBLIC
141158 int gavl_compression_need_pixelformat(gavl_codec_id_t id);
142159
160 /** \brief Check if an audio compression constant frame samples
161 * \param id A codec ID
162 * \returns 1 if the compression has the same number of samples in each frame, 0 else
163 *
164 */
165
166 GAVL_PUBLIC
167 int gavl_compression_constant_frame_samples(gavl_codec_id_t id);
168
169
143170
144171 #define GAVL_PACKET_TYPE_I 'I' //!< Packet is an I-frame
145172 #define GAVL_PACKET_TYPE_P 'P' //!< Packet is a P-frame
206233 GAVL_PUBLIC
207234 void gavl_packet_dump(const gavl_packet_t * p);
208235
236 /**
237 * @}
238 */
209239
210240 #ifdef __cplusplus
211241 }
700700
701701 Plots an audio frame into an ascii file with one line per
702702 sample in the format:
703 <sample_number> <channel1> <channel2> ...
703 sample_number channel1 channel2 ...
704704
705705 In addition, a file for making a plot with gnuplot is generated.
706706 name_base is used for generating the filenames. For the data file,
22272227 int gavl_get_color_channel_format(const gavl_video_format_t * frame_format,
22282228 gavl_video_format_t * channel_format,
22292229 gavl_color_channel_t ch);
2230
2231
2232 /*!
2233 \ingroup video_format
2234 \brief Get the video format of one field
2235 \param frame_format The video format of the full frame
2236 \param field_format Format of the field
2237 \param field Field (0 or 1)
2238
2239 Use this function if you need to split a frame into fields.
2240 It handles odd heights correctly
2241
2242 Since 1.2.1
2243 */
2244
2245 GAVL_PUBLIC
2246 void gavl_get_field_format(const gavl_video_format_t * frame_format,
2247 gavl_video_format_t * field_format,
2248 int field);
22302249
22312250
22322251 /*!
37673786
37683787 /** \brief Create a frame table for constant framerate video
37693788 * \param offset Timestamp of the first frame
3770 * \param duration Duration of each frame
3789 * \param frame_duration Duration of each frame
37713790 * \param num_frames Number of frames
3772 * \param fmt Timecode format (or NULL)
37733791 * \param start_timecode Timecode of the first frame (or GAVL_TIMECODE_UNDEFINED)
37743792 * \returns A newly allocated frame table
37753793 *
39393957 */
39403958
39413959 GAVL_PUBLIC
3942 int gavl_frame_table_save(const gavl_frame_table_t * tab,
3960 int gavl_frame_table_save(const gavl_frame_table_t * t,
39433961 const char * filename);
39443962
39453963 /** \brief Load a frame table from a file
00 #ifndef __GAVL_VERSION_H_
11 #define __GAVL_VERSION_H_
22
3 #define GAVL_VERSION "1.2.0"
3 #define GAVL_VERSION "1.4.0"
44
55 #define GAVL_VERSION_MAJOR 1
6 #define GAVL_VERSION_MINOR 2
6 #define GAVL_VERSION_MINOR 4
77 #define GAVL_VERSION_MICRO 0
88
99 #define GAVL_MAKE_BUILD(a,b,c) ((a << 16) + (b << 8) + c)
275275 uint64_t gavl_benchmark_get_time(int flags);
276276
277277 /*! \ingroup timer
278 * \brief Get a description about the value returned by \ref gavl_benchmark_get_time
278 * \brief Get a description about the value returned by
279 * \ref gavl_benchmark_get_time
279280 * \param flags Flags returned by \ref gavl_accel_supported
280281 * \returns A string describing what the time value means
281282 *
0 /*****************************************************************
1 * gavl - a general purpose audio/video processing library
2 *
3 * Copyright (c) 2001 - 2011 Members of the Gmerlin project
4 * gmerlin-general@lists.sourceforge.net
5 * http://gmerlin.sourceforge.net
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * *****************************************************************/
20
21 #ifndef GAVL_METADATA_H_INCLUDED
22 #define GAVL_METADATA_H_INCLUDED
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #include <gavl/gavldefs.h>
29
30 /** \defgroup metadata Metadata
31 * \brief Metadata support
32 *
33 * This is a simple dictionary structure, which is
34 * used my gmerlin applications and libraries to
35 * associate metadata with a media file or a single
36 * media stream.
37 *
38 * Metadata are defined as all data, which are not directly
39 * related to the decoding process, but might be of interest
40 * for the user.
41 *
42 * The tag types are completely generic so applications can
43 * define their own tags. For compatibility it is, however
44 * recommended to use the tags defined in \ref metatags.h
45 *
46 * Since 1.4.0
47 *
48 * @{
49 */
50
51 /** Length of a date string of the format YYYY-MM-DD
52 */
53 #define GAVL_METADATA_DATE_STRING_LEN 11
54
55 /** Length of a date/time string of the format YYYY-MM-DD HH:MM:SS
56 */
57
58 #define GAVL_METADATA_DATE_TIME_STRING_LEN 20
59
60 /** \brief Single metadata tag
61 */
62
63 typedef struct
64 {
65 char * key; //!< Key
66 char * val; //!< Value
67 } gavl_metadata_tag_t;
68
69 /** \brief Single metadata structure
70 */
71
72
73 typedef struct
74 {
75 gavl_metadata_tag_t * tags; //!< Array of tags
76 int tags_alloc; //!< Number of allocated tags (never touch this)
77 int num_tags; //!< Number of valid tags
78 } gavl_metadata_t;
79
80 /** \brief Free all metadata tags
81 * \arg m A metadata structure
82 */
83
84 GAVL_PUBLIC void
85 gavl_metadata_free(gavl_metadata_t * m);
86
87 /** \brief Initialize structre
88 * \arg m A metadata structure
89 *
90 * Use this if you define a \ref gavl_metadata_t
91 * structure in unintialized memory (e.g. on the stack)
92 * before using it.
93 */
94
95 GAVL_PUBLIC void
96 gavl_metadata_init(gavl_metadata_t * m);
97
98 /** \brief Set a tag
99 * \arg m A metadata structure
100 * \arg key Key
101 * \arg val Value
102 *
103 * Set a metadata tag. The value is copied.
104 */
105
106 GAVL_PUBLIC void
107 gavl_metadata_set(gavl_metadata_t * m,
108 const char * key,
109 const char * val);
110
111 /** \brief Set a tag
112 * \arg m A metadata structure
113 * \arg key Key
114 * \arg val Value
115 *
116 * Like \ref gavl_metadata_set except that the
117 * value is not copied.
118 */
119
120 GAVL_PUBLIC void
121 gavl_metadata_set_nocpy(gavl_metadata_t * m,
122 const char * key,
123 char * val);
124
125 /** \brief Get the value of a tag
126 * \arg m A metadata structure
127 * \arg key Key
128 * \returns Value of the tag or NULL if the tag doesn't exist
129 */
130
131 GAVL_PUBLIC
132 const char * gavl_metadata_get(const gavl_metadata_t * m,
133 const char * key);
134
135 /** \brief Set an integer tag
136 * \arg m A metadata structure
137 * \arg key Key
138 * \arg val Value
139 */
140
141 GAVL_PUBLIC void
142 gavl_metadata_set_int(gavl_metadata_t * m,
143 const char * key,
144 int val);
145
146 /** \brief Get an integer tag
147 * \arg m A metadata structure
148 * \arg key Key
149 * \arg ret Returns the value
150 * \returns 1 if ret contains a valid tag, 0 if the tag doesn't exist or is not numeric
151 */
152
153 GAVL_PUBLIC
154 int gavl_metadata_get_int(const gavl_metadata_t * m,
155 const char * key, int * ret);
156
157 /** \brief Set a date tag
158 * \arg m A metadata structure
159 * \arg key Key
160 * \arg year Year
161 * \arg month Month
162 * \arg day Day
163 */
164
165 GAVL_PUBLIC void
166 gavl_metadata_set_date(gavl_metadata_t * m,
167 const char * key,
168 int year,
169 int month,
170 int day);
171
172 /** \brief Get a date tag
173 * \arg m A metadata structure
174 * \arg key Key
175 * \arg year Returns year
176 * \arg month Returns month
177 * \arg day Returns day
178 * \returns 1 if a valid date was returned, 0 else
179 */
180
181 GAVL_PUBLIC int
182 gavl_metadata_get_date(gavl_metadata_t * m,
183 const char * key,
184 int * year,
185 int * month,
186 int * day);
187
188 /** \brief Set a date/time tag
189 * \arg m A metadata structure
190 * \arg key Key
191 * \arg year Year
192 * \arg month Month
193 * \arg day Day
194 * \arg hour Hour
195 * \arg minute Minute
196 * \arg second Second
197 */
198
199 GAVL_PUBLIC void
200 gavl_metadata_set_date_time(gavl_metadata_t * m,
201 const char * key,
202 int year,
203 int month,
204 int day,
205 int hour,
206 int minute,
207 int second);
208
209 /** \brief Get a date/time tag
210 * \arg m A metadata structure
211 * \arg key Key
212 * \arg year Returns year
213 * \arg month Returns month
214 * \arg day Returns day
215 * \arg hour Returns hour
216 * \arg minute Returns minute
217 * \arg second Returns second
218 * \returns 1 if a valid date/time was returned, 0 else
219 */
220
221 GAVL_PUBLIC int
222 gavl_metadata_get_date_time(gavl_metadata_t * m,
223 const char * key,
224 int * year,
225 int * month,
226 int * day,
227 int * hour,
228 int * minute,
229 int * second);
230
231 /** \brief Format a date string
232 * \arg year Year
233 * \arg month Month
234 * \arg day Day
235 * \arg ret String to be formatted
236 *
237 * The string needs to be at least \ref GAVL_METADATA_DATE_STRING_LEN
238 * bytes long.
239 */
240
241 GAVL_PUBLIC void
242 gavl_metadata_date_to_string(int year,
243 int month,
244 int day, char * ret);
245
246 /** \brief Format a date string
247 * \arg year Year
248 * \arg month Month
249 * \arg day Day
250 * \arg ret String to be formatted
251 * \arg hour Hour
252 * \arg minute Minute
253 * \arg second Second
254 *
255 * The string needs to be at least
256 * \ref GAVL_METADATA_DATE_TIME_STRING_LEN bytes long.
257 */
258
259 GAVL_PUBLIC void
260 gavl_metadata_date_time_to_string(int year,
261 int month,
262 int day,
263 int hour,
264 int minute,
265 int second,
266 char * ret);
267
268 /** \brief Merge two metadata structures
269 * \arg dst Destination
270 * \arg src1 First source
271 * \arg src2 Second source
272 *
273 * Copy all tags from src1 and src2 to dst. If a tag
274 * is available in src1 and src2, the one from src1 is
275 * taken.
276 */
277
278 GAVL_PUBLIC
279 void gavl_metadata_merge(gavl_metadata_t * dst,
280 const gavl_metadata_t * src1,
281 const gavl_metadata_t * src2);
282
283 /** \brief Merge two metadata structures
284 * \arg dst Destination
285 * \arg src Source
286 *
287 * Copy tags from src to dst, which are not
288 * already contained in dst.
289 */
290
291 GAVL_PUBLIC
292 void gavl_metadata_merge2(gavl_metadata_t * dst,
293 const gavl_metadata_t * src);
294
295 /** \brief Copy metadata structure
296 * \arg dst Destination
297 * \arg src Source
298 *
299 * Copy all tags from src to dst
300 */
301
302 GAVL_PUBLIC void
303 gavl_metadata_copy(gavl_metadata_t * dst,
304 const gavl_metadata_t * src);
305
306 /** \brief Dump metadata structure to stderr
307 * \arg m Metadata
308 * \arg indent Spaces to append to each line
309 */
310
311 GAVL_PUBLIC void
312 gavl_metadata_dump(const gavl_metadata_t * m, int indent);
313
314 /** \brief Check if 2 metadata structures are equal
315 * \arg m1 Metadata 1
316 * \arg m2 Metadata 2
317 * \returns 1 if the 2 metadata structures are identical, 0 else
318 */
319
320 GAVL_PUBLIC int
321 gavl_metadata_equal(const gavl_metadata_t * m1,
322 const gavl_metadata_t * m2);
323
324 /**
325 * @}
326 */
327
328 #ifdef __cplusplus
329 }
330 #endif
331
332 #endif // GAVL_METADATA_H_INCLUDED
0 /*****************************************************************
1 * gavl - a general purpose audio/video processing library
2 *
3 * Copyright (c) 2001 - 2011 Members of the Gmerlin project
4 * gmerlin-general@lists.sourceforge.net
5 * http://gmerlin.sourceforge.net
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * *****************************************************************/
20
21 #ifndef GAVL_METATAGS_H_INCLUDED
22 #define GAVL_METATAGS_H_INCLUDED
23
24 /** \defgroup metatags Defined metadata keys
25 * \ingroup metadata
26 *
27 * For interoperabiolity reasons, try to use these macros
28 * as metadata keys whenever possible.
29 *
30 * Since 1.4.0
31 *
32 * @{
33 */
34
35 /** \brief Title of the song/movie... */
36
37 #define GAVL_META_TITLE "Title"
38
39 /** \brief Performing artist */
40
41 #define GAVL_META_ARTIST "Artist"
42
43 /** \brief Artist of the Album */
44
45 #define GAVL_META_ALBUMARTIST "Albumartist"
46
47 /** \brief Author */
48
49 #define GAVL_META_AUTHOR "Author"
50
51 /** \brief Copyright */
52
53 #define GAVL_META_COPYRIGHT "Copyright"
54
55 /** \brief Album */
56
57 #define GAVL_META_ALBUM "Album"
58
59 /** \brief Genre */
60
61 #define GAVL_META_GENRE "Genre"
62
63 /** \brief Tracknumber within the album
64 *
65 * Integer starting with 1
66 */
67
68 #define GAVL_META_TRACKNUMBER "Tracknumber"
69
70 /** \brief Generic date
71 *
72 * YYYY-MM-DD [HH:MM:SS]
73 */
74
75 #define GAVL_META_DATE "Date"
76
77 /** \brief Creation date
78 *
79 * YYYY-MM-DD [HH:MM:SS]
80 */
81
82 #define GAVL_META_DATE_CREATE "CreationDate" // YYYY-MM-DD [HH:MM:SS]
83
84 /** \brief Modification date
85 *
86 * YYYY-MM-DD [HH:MM:SS]
87 */
88
89 #define GAVL_META_DATE_MODIFY "ModificationDate" // YYYY-MM-DD [HH:MM:SS]
90
91 /** \brief Generic year
92 */
93
94 #define GAVL_META_YEAR "Year" // YYYY
95
96 /** \brief Language
97 *
98 * Use this for subtitles or audio streams
99 */
100
101 #define GAVL_META_LANGUAGE "Language" // ISO 639-2/B 3 letter code
102
103 /** \brief Comment
104 */
105
106 #define GAVL_META_COMMENT "Comment"
107
108 /** \brief Related URL
109 */
110
111 #define GAVL_META_URL "URL"
112
113 /** \brief Software
114 *
115 * For media files, this is the multiplexer software.
116 * For single stream this is the encoder software
117 */
118
119 #define GAVL_META_SOFTWARE "Software"
120
121 /** \brief Person, who created the file
122 */
123
124 #define GAVL_META_CREATOR "Creator"
125
126 /** \brief Format
127 *
128 * For media files, this is the container format.
129 * For single stream this is the name of the codec
130 */
131 #define GAVL_META_FORMAT "Format"
132
133 /** \brief Label
134 *
135 * Stream label (e.g. "Directors comments")
136 */
137
138 #define GAVL_META_LABEL "Label"
139
140 /** \brief Bitrate
141 *
142 * Bitrate as integer in bits/s. Can also be a
143 * string (like VBR)
144 */
145
146 #define GAVL_META_BITRATE "Bitrate"
147
148 /** \brief Valid bits per audio sample
149 */
150
151 #define GAVL_META_AUDIO_BITS "BitsPerSample"
152
153 /** \brief Valid bits per pixel
154 */
155
156 #define GAVL_META_VIDEO_BPP "BitsPerPixel"
157
158 /** \brief Vendor of the device/software, which created the file
159 */
160
161 #define GAVL_META_VENDOR "Vendor"
162
163 /** \brief Model name of the device, which created the file
164 */
165
166 #define GAVL_META_DEVICE "Device"
167
168 /**
169 * @}
170 */
171
172 #endif // GAVL_METATAGS_H_INCLUDED
203203 char str[GAVL_TIMECODE_STRING_LEN_SHORT]);
204204
205205
206 /*
206 /**
207207 * @}
208208 */
209209
88
99 have_avcodec=false
1010
11 AVCODEC_BUILD="3345152"
11 AVCODEC_BUILD="3412992"
1212
1313 AC_ARG_ENABLE(libavcodec,
1414 [AC_HELP_STRING([--disable-libavcodec],[Disable libavcodec (default: autodetect)])],
4747
4848 have_avformat=false
4949
50 AVFORMAT_BUILD="3278080"
50 AVFORMAT_BUILD="3415808"
5151
5252 AC_ARG_ENABLE(libavformat,
5353 [AC_HELP_STRING([--disable-libavformat],[Disable libavformat (default: autodetect)])],
129129
130130 if test $found_header = "false"; then
131131 have_libpostproc=false
132 else
133 CFLAGS="-DPOSTPROC_HEADER=$POSTPROC_HEADER $CFLAGS"
134 AC_CHECK_TYPES([pp_context_t, pp_context, pp_mode_t, pp_mode], [], [], [[
135 #ifdef POSTPROC_HEADER
136 #include POSTPROC_HEADER
137 #endif
138 ]])
132139 fi
133140
134141 CFLAGS="$CFLAGS_save"
576583
577584 if test x$test_libtiff = xtrue; then
578585
579 OLD_CFLAGS=$CFLAGS
580586 OLD_LIBS=$LIBS
581587
582588 LIBS="$LIBS -ltiff"
583 CFLAGS="$CFLAGS"
584589
585590 AC_MSG_CHECKING(for libtiff)
586591 AC_TRY_LINK([#include <tiffio.h>],
595600 case $have_libtiff in
596601 true) AC_DEFINE(HAVE_LIBTIFF)
597602 AC_MSG_RESULT(yes)
598 TIFF_LIBS=$LIBS;
599 TIFF_CFLAGS=$CFLAGS ;;
603 TIFF_LIBS=$LIBS;;
600604 false) AC_MSG_RESULT(no); TIFF_LIBS=""; TIFF_CFLAGS="";;
601605 esac
602 CFLAGS=$OLD_CFLAGS
603606 LIBS=$OLD_LIBS
604607
605608 fi
754757
755758 if test x$test_libpng = xtrue; then
756759
757 OLD_CFLAGS=$CFLAGS
758760 OLD_LIBS=$LIBS
759761
760762 LIBS="$LIBS -lpng -lm -lz"
761 CFLAGS="$CFLAGS"
762763
763764 AC_MSG_CHECKING(for libpng)
764765 AC_TRY_LINK([#include <png.h>],
771772 case $have_libpng in
772773 true) AC_DEFINE(HAVE_LIBPNG)
773774 AC_MSG_RESULT(yes)
774 PNG_LIBS=$LIBS;
775 PNG_CFLAGS=$CFLAGS ;;
775 PNG_LIBS=$LIBS;;
776776 false) AC_MSG_RESULT(no); PNG_LIBS=""; PNG_CFLAGS="";;
777777 esac
778 CFLAGS=$OLD_CFLAGS
779778 LIBS=$OLD_LIBS
780779
781780 fi
989988
990989 AC_DEFUN([GMERLIN_CHECK_FLAC],[
991990
992 FLAC_REQUIRED="1.1.0"
991 FLAC_REQUIRED="1.2.0"
993992 have_flac="false"
994993
995994 AC_ARG_ENABLE(flac,
10241023 if(sscanf(FLAC__VERSION_STRING, "%d.%d.%d", &version_major,
10251024 &version_minor, &version_patchlevel) < 3)
10261025 return -1;
1027 if((version_major != 1) || (version_minor < 1))
1026 if((version_major != 1) || (version_minor < 2))
10281027 return 1;
10291028 version_file = fopen("flac_version", "w");
10301029 fprintf(version_file, "%d.%d.%d\n", version_major,
15751574
15761575 if test x$test_libjpeg = xtrue; then
15771576
1578 OLD_CFLAGS=$CFLAGS
15791577 OLD_LIBS=$LIBS
15801578 LIBS="$LIBS -ljpeg"
1581 CFLAGS="$CFLAGS"
15821579
15831580 AC_MSG_CHECKING(for libjpeg)
15841581 AC_TRY_LINK([#include <stdio.h>
15891586 case $have_libjpeg in
15901587 true) AC_DEFINE(HAVE_LIBJPEG)
15911588 AC_MSG_RESULT(yes)
1592 JPEG_LIBS=$LIBS;
1593 JPEG_CFLAGS=$CFLAGS;;
1589 JPEG_LIBS=$LIBS;;
15941590 false) AC_MSG_RESULT(no); JPEG_LIBS=""; JPEG_CFLAGS="";;
15951591 * ) AC_MSG_RESULT("Somethings wrong: $have_libjpeg") ;;
15961592 esac
15971593
1598 CFLAGS=$OLD_CFLAGS
15991594 LIBS=$OLD_LIBS
16001595
16011596 fi
16381633 dnl Search for OpenGL libraries
16391634 dnl
16401635
1641 OLD_CFLAGS=$CFLAGS
16421636 OLD_LIBS=$LIBS
16431637
16441638 have_GL="true"
16511645 ],[],[have_GL="false"])
16521646 fi
16531647
1654 GL_CFLAGS=$CFLAGS
16551648 GL_LIBS=$LIBS
16561649
1657 CFLAGS="$OLD_CFLAGS"
16581650 LIBS="$OLD_LIBS"
16591651
16601652 dnl
16611653 dnl Check for GLX
16621654 dnl
16631655
1664 OLD_CFLAGS=$CFLAGS
16651656 OLD_LIBS=$LIBS
16661657
16671658 have_GLX="true"
16741665 NULL, NULL); return 0;}],[],[have_GLX="false"])
16751666 fi
16761667
1677 GLX_CFLAGS=$CFLAGS
16781668 GLX_LIBS=$LIBS
16791669
1680 CFLAGS="$OLD_CFLAGS"
16811670 LIBS="$OLD_LIBS"
16821671
16831672 if test "x$have_GL" = "xtrue"; then
17711760 sem_t s;
17721761 result = sem_init(&s, 0, 0);
17731762 if(result)
1774 return 0;
1775 return -1;
1763 return -1;
1764 return 0;
17761765 }
17771766 ],
17781767 [
18101799 esac],[test_vdpau=true])
18111800
18121801 if test x$test_vdpau = xtrue; then
1813
1802 if test x$have_x = xtrue; then
1803
18141804 OLD_CFLAGS=$CFLAGS
18151805 OLD_LIBS=$LIBS
18161806
18381828 LIBS=$OLD_LIBS
18391829
18401830 fi
1831 fi
18411832
18421833 AC_SUBST(VDPAU_CFLAGS)
18431834 AC_SUBST(VDPAU_LIBS)
4747 gavl_video_converter_t * cnv;
4848
4949 gavl_video_format_t format_1;
50 gavl_video_frame_t * frame_1 = (gavl_video_frame_t*)0;
50 gavl_video_frame_t * frame_1 = NULL;
5151
5252
5353 if((format->pixelformat != GAVL_RGB_24) && (format->pixelformat != GAVL_RGBA_32))
152152 }
153153
154154 png_ptr = png_create_read_struct
155 (PNG_LIBPNG_VER_STRING, (png_voidp)0,
155 (PNG_LIBPNG_VER_STRING, NULL,
156156 NULL, NULL);
157157
158158 setjmp(png_jmpbuf(png_ptr));
260260 format->pixelformat = pixelformat;
261261 }
262262 else
263 frame_1 = (gavl_video_frame_t*)0;
263 frame_1 = NULL;
264264
265265 if(frame_1)
266266 {
5959 * Some braindead YUV conversion (but works at least :-)
6060 */
6161
62 static int * r_to_y = (int*)0;
63 static int * g_to_y = (int*)0;
64 static int * b_to_y = (int*)0;
65
66 static int * r_to_u = (int*)0;
67 static int * g_to_u = (int*)0;
68 static int * b_to_u = (int*)0;
69
70 static int * r_to_v = (int*)0;
71 static int * g_to_v = (int*)0;
72 static int * b_to_v = (int*)0;
73
74 static int * y_to_rgb = (int*)0;
75 static int * v_to_r = (int*)0;
76 static int * u_to_g = (int*)0;
77 static int * v_to_g = (int*)0;
78 static int * u_to_b = (int*)0;
62 static int * r_to_y = NULL;
63 static int * g_to_y = NULL;
64 static int * b_to_y = NULL;
65
66 static int * r_to_u = NULL;
67 static int * g_to_u = NULL;
68 static int * b_to_u = NULL;
69
70 static int * r_to_v = NULL;
71 static int * g_to_v = NULL;
72 static int * b_to_v = NULL;
73
74 static int * y_to_rgb = NULL;
75 static int * v_to_r = NULL;
76 static int * u_to_g = NULL;
77 static int * v_to_g = NULL;
78 static int * u_to_b = NULL;
7979
8080 /* JPEG Quantization */
8181
82 static int * r_to_yj = (int*)0;
83 static int * g_to_yj = (int*)0;
84 static int * b_to_yj = (int*)0;
85
86 static int * r_to_uj = (int*)0;
87 static int * g_to_uj = (int*)0;
88 static int * b_to_uj = (int*)0;
89
90 static int * r_to_vj = (int*)0;
91 static int * g_to_vj = (int*)0;
92 static int * b_to_vj = (int*)0;
93
94 static int * yj_to_rgb = (int*)0;
95 static int * vj_to_r = (int*)0;
96 static int * uj_to_g = (int*)0;
97 static int * vj_to_g = (int*)0;
98 static int * uj_to_b = (int*)0;
82 static int * r_to_yj = NULL;
83 static int * g_to_yj = NULL;
84 static int * b_to_yj = NULL;
85
86 static int * r_to_uj = NULL;
87 static int * g_to_uj = NULL;
88 static int * b_to_uj = NULL;
89
90 static int * r_to_vj = NULL;
91 static int * g_to_vj = NULL;
92 static int * b_to_vj = NULL;
93
94 static int * yj_to_rgb = NULL;
95 static int * vj_to_r = NULL;
96 static int * uj_to_g = NULL;
97 static int * vj_to_g = NULL;
98 static int * uj_to_b = NULL;
9999
100100
101101
13201320 int color_type;
13211321 int png_transforms;
13221322 gavl_video_frame_t * tmp_frame;
1323 gavl_video_frame_t * out_frame = (gavl_video_frame_t *)0;
1323 gavl_video_frame_t * out_frame = NULL;
13241324 gavl_video_format_t tmp_format;
13251325
13261326 int i;
3737
3838 static void timer_init()
3939 {
40 gettimeofday(&time_before, (struct timezone*)0);
40 gettimeofday(&time_before, NULL);
4141 }
4242
4343 static void timer_stop()
4444 {
4545 double before, after, diff;
4646
47 gettimeofday(&time_after, (struct timezone*)0);
47 gettimeofday(&time_after, NULL);
4848
4949 before = time_before.tv_sec + time_before.tv_usec / 1.0e6;
5050 after = time_after.tv_sec + time_after.tv_usec / 1.0e6;
3838 gavl_video_converter_t * cnv;
3939
4040 gavl_video_format_t format_1;
41 gavl_video_frame_t * frame_1 = (gavl_video_frame_t*)0;
41 gavl_video_frame_t * frame_1 = NULL;
4242
4343
4444 if((format->pixelformat != GAVL_RGB_24) && (format->pixelformat != GAVL_RGBA_32))
3838 gavl_video_converter_t * cnv;
3939
4040 gavl_video_format_t format_1;
41 gavl_video_frame_t * frame_1 = (gavl_video_frame_t*)0;
41 gavl_video_frame_t * frame_1 = NULL;
4242
4343
4444 if((format->pixelformat != GAVL_RGB_24) && (format->pixelformat != GAVL_RGBA_32))
146146 }
147147
148148 png_ptr = png_create_read_struct
149 (PNG_LIBPNG_VER_STRING, (png_voidp)0,
149 (PNG_LIBPNG_VER_STRING, NULL,
150150 NULL, NULL);
151151
152152 setjmp(png_jmpbuf(png_ptr));
250250 format->pixelformat = pixelformat;
251251 }
252252 else
253 frame_1 = (gavl_video_frame_t*)0;
253 frame_1 = NULL;
254254
255255 if(frame_1)
256256 {
7272 gavl_video_converter_t * cnv;
7373
7474 gavl_video_format_t format_1;
75 gavl_video_frame_t * frame_1 = (gavl_video_frame_t*)0;
75 gavl_video_frame_t * frame_1 = NULL;
7676
7777
7878 if((format->pixelformat != GAVL_RGB_24) &&
183183 }
184184
185185 png_ptr = png_create_read_struct
186 (PNG_LIBPNG_VER_STRING, (png_voidp)0,
186 (PNG_LIBPNG_VER_STRING, NULL,
187187 NULL, NULL);
188188
189189 setjmp(png_jmpbuf(png_ptr));
287287 format->pixelformat = pixelformat;
288288 }
289289 else
290 frame_1 = (gavl_video_frame_t*)0;
290 frame_1 = NULL;
291291
292292 if(frame_1)
293293 {
1919 * *****************************************************************/
2020
2121 #include <sys/time.h>
22 #include <stdlib.h>
23
2224 #include <config.h>
2325
2426 #include <inttypes.h>
2931
3032 void timer_init()
3133 {
32 gettimeofday(&time_before, (struct timezone*)0);
34 gettimeofday(&time_before, NULL);
3335 }
3436
3537 uint64_t timer_stop()
3638 {
3739 uint64_t before, after, diff;
3840
39 gettimeofday(&time_after, (struct timezone*)0);
41 gettimeofday(&time_after, NULL);
4042
4143 before = ((uint64_t)time_before.tv_sec)*1000000 + time_before.tv_usec;
4244 after = ((uint64_t)time_after.tv_sec)*1000000 + time_after.tv_usec;