gavl

gavl.h
Go to the documentation of this file.
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
27#ifndef GAVL_H_INCLUDED
28#define GAVL_H_INCLUDED
29
30#include <inttypes.h>
31
32#include <gavl/gavldefs.h>
33#include <gavl/gavltime.h>
34
35#ifdef __cplusplus
36 extern "C" {
37#endif
38
39#include <gavl/timecode.h>
40
41
64 typedef void (*gavl_video_process_func)(void * data, int start, int end);
65
79 typedef void (*gavl_video_run_func)(gavl_video_process_func func,
80 void * gavl_data,
81 int start, int end,
82 void * client_data, int thread);
83
92 typedef void (*gavl_video_stop_func)(void * client_data, int thread);
93
102 typedef struct gavl_video_format_s gavl_video_format_t;
103
104
105/* Quality levels */
106
130#define GAVL_QUALITY_FASTEST 1
131
138#define GAVL_QUALITY_BEST 5
139
146#define GAVL_QUALITY_DEFAULT 2
147
159#define GAVL_ACCEL_MMX (1<<0)
160#define GAVL_ACCEL_MMXEXT (1<<1)
161#define GAVL_ACCEL_SSE (1<<2)
162#define GAVL_ACCEL_SSE2 (1<<3)
163#define GAVL_ACCEL_SSE3 (1<<4)
164#define GAVL_ACCEL_3DNOW (1<<5)
165#define GAVL_ACCEL_3DNOWEXT (1<<6)
166#define GAVL_ACCEL_SSSE3 (1<<7)
167
172GAVL_PUBLIC int gavl_accel_supported();
173
182/* Sample formats: all multibyte numbers are native endian */
183
196#define GAVL_MAX_CHANNELS 128
197
204 typedef enum
205 {
206 GAVL_SAMPLE_NONE = 0,
207 GAVL_SAMPLE_U8 = 1,
208 GAVL_SAMPLE_S8 = 2,
209 GAVL_SAMPLE_U16 = 3,
210 GAVL_SAMPLE_S16 = 4,
211 GAVL_SAMPLE_S32 = 5,
212 GAVL_SAMPLE_FLOAT = 6,
213 GAVL_SAMPLE_DOUBLE = 7
214 } gavl_sample_format_t;
215
221 typedef enum
222 {
223 GAVL_INTERLEAVE_NONE = 0,
224 GAVL_INTERLEAVE_2 = 1,
225 GAVL_INTERLEAVE_ALL = 2
226 } gavl_interleave_mode_t;
227
235 typedef enum
236 {
237 GAVL_CHID_NONE = 0,
238 GAVL_CHID_FRONT_CENTER,
239 GAVL_CHID_FRONT_LEFT,
240 GAVL_CHID_FRONT_RIGHT,
241 GAVL_CHID_FRONT_CENTER_LEFT,
242 GAVL_CHID_FRONT_CENTER_RIGHT,
243 GAVL_CHID_REAR_LEFT,
244 GAVL_CHID_REAR_RIGHT,
245 GAVL_CHID_REAR_CENTER,
246 GAVL_CHID_SIDE_LEFT,
247 GAVL_CHID_SIDE_RIGHT,
248 GAVL_CHID_LFE,
249 GAVL_CHID_AUX,
250 } gavl_channel_id_t;
251
260 typedef struct
261 {
262 int samples_per_frame;
263 int samplerate;
264 int num_channels;
265 gavl_sample_format_t sample_format;
266 gavl_interleave_mode_t interleave_mode;
268 float center_level;
269 float rear_level;
271 gavl_channel_id_t channel_locations[GAVL_MAX_CHANNELS];
273 } gavl_audio_format_t;
274
275
276/* Audio format -> string conversions */
277
285GAVL_PUBLIC
286 const char * gavl_sample_format_to_string(gavl_sample_format_t format);
287
296GAVL_PUBLIC
297 gavl_sample_format_t gavl_string_to_sample_format(const char * str);
298
304GAVL_PUBLIC
305 int gavl_num_sample_formats();
306
313GAVL_PUBLIC
314 gavl_sample_format_t gavl_get_sample_format(int index);
315
322GAVL_PUBLIC
323 const char * gavl_channel_id_to_string(gavl_channel_id_t id);
324
325
332GAVL_PUBLIC
333 const char * gavl_interleave_mode_to_string(gavl_interleave_mode_t mode);
334
341GAVL_PUBLIC
342 void gavl_audio_format_dump(const gavl_audio_format_t * format);
343
352GAVL_PUBLIC
353 int gavl_channel_index(const gavl_audio_format_t * format, gavl_channel_id_t id);
354
361GAVL_PUBLIC
362 int gavl_front_channels(const gavl_audio_format_t * format);
363
370GAVL_PUBLIC
371 int gavl_rear_channels(const gavl_audio_format_t * format);
372
379GAVL_PUBLIC
380 int gavl_side_channels(const gavl_audio_format_t * format);
381
388GAVL_PUBLIC
389 int gavl_aux_channels(const gavl_audio_format_t * format);
390
391
392
399GAVL_PUBLIC
400 int gavl_lfe_channels(const gavl_audio_format_t * format);
401
409GAVL_PUBLIC
410 void gavl_audio_format_copy(gavl_audio_format_t * dst,
411 const gavl_audio_format_t * src);
412
421GAVL_PUBLIC
422 int gavl_audio_formats_equal(const gavl_audio_format_t * format_1,
423 const gavl_audio_format_t * format_2);
424
436GAVL_PUBLIC
437 void gavl_set_channel_setup(gavl_audio_format_t * format);
438
445GAVL_PUBLIC
446 int gavl_bytes_per_sample(gavl_sample_format_t format);
447
462 typedef union
463 {
464 uint8_t * u_8;
465 int8_t * s_8;
467 uint16_t * u_16;
468 int16_t * s_16;
470 uint32_t * u_32;
471 int32_t * s_32;
473 float * f;
474 double * d;
475 } gavl_audio_samples_t;
476
482 typedef union
483 {
484 uint8_t * u_8[GAVL_MAX_CHANNELS];
485 int8_t * s_8[GAVL_MAX_CHANNELS];
487 uint16_t * u_16[GAVL_MAX_CHANNELS];
488 int16_t * s_16[GAVL_MAX_CHANNELS];
490 uint32_t * u_32[GAVL_MAX_CHANNELS];
491 int32_t * s_32[GAVL_MAX_CHANNELS];
493 float * f[GAVL_MAX_CHANNELS];
494 double * d[GAVL_MAX_CHANNELS];
496 } gavl_audio_channels_t;
497
514 typedef struct
515 {
516 gavl_audio_samples_t samples;
517 gavl_audio_channels_t channels;
518 int valid_samples;
519 int64_t timestamp;
520 int channel_stride;
521 } gavl_audio_frame_t;
522
534GAVL_PUBLIC
535 gavl_audio_frame_t * gavl_audio_frame_create(const gavl_audio_format_t* format);
536
548GAVL_PUBLIC
549 void gavl_audio_frame_null(gavl_audio_frame_t * frame);
550
560GAVL_PUBLIC
561 void gavl_audio_frame_destroy(gavl_audio_frame_t * frame);
562
572GAVL_PUBLIC
573 void gavl_audio_frame_mute(gavl_audio_frame_t * frame,
574 const gavl_audio_format_t * format);
575
586GAVL_PUBLIC
587 void gavl_audio_frame_mute_samples(gavl_audio_frame_t * frame,
588 const gavl_audio_format_t * format,
589 int num_samples);
590
591
592
603GAVL_PUBLIC
604 void gavl_audio_frame_mute_channel(gavl_audio_frame_t * frame,
605 const gavl_audio_format_t * format,
606 int channel);
607
628GAVL_PUBLIC
629 int gavl_audio_frame_copy(const gavl_audio_format_t * format,
630 gavl_audio_frame_t * dst,
631 const gavl_audio_frame_t * src,
632 int dst_pos,
633 int src_pos,
634 int dst_size,
635 int src_size);
636
649GAVL_PUBLIC
650 void gavl_audio_frame_copy_ptrs(const gavl_audio_format_t * format,
651 gavl_audio_frame_t * dst,
652 const gavl_audio_frame_t * src);
653
671GAVL_PUBLIC
672 void gavl_audio_frame_get_subframe(const gavl_audio_format_t * format,
673 gavl_audio_frame_t * src,
674 gavl_audio_frame_t * dst,
675 int start, int len);
676
689GAVL_PUBLIC
690 int gavl_audio_frames_equal(const gavl_audio_format_t * format,
691 const gavl_audio_frame_t * f1,
692 const gavl_audio_frame_t * f2);
693
713GAVL_PUBLIC
714 int gavl_audio_frame_plot(const gavl_audio_format_t * format,
715 const gavl_audio_frame_t * frame,
716 const char * name_base);
717
718
733#define GAVL_AUDIO_FRONT_TO_REAR_COPY (1<<0)
738#define GAVL_AUDIO_FRONT_TO_REAR_MUTE (1<<1)
743#define GAVL_AUDIO_FRONT_TO_REAR_DIFF (1<<2)
748#define GAVL_AUDIO_FRONT_TO_REAR_MASK \
749(GAVL_AUDIO_FRONT_TO_REAR_COPY | \
750 GAVL_AUDIO_FRONT_TO_REAR_MUTE | \
751 GAVL_AUDIO_FRONT_TO_REAR_DIFF)
753/* Options for mixing stereo to mono */
754
757#define GAVL_AUDIO_STEREO_TO_MONO_LEFT (1<<3)
760#define GAVL_AUDIO_STEREO_TO_MONO_RIGHT (1<<4)
763#define GAVL_AUDIO_STEREO_TO_MONO_MIX (1<<5)
767#define GAVL_AUDIO_STEREO_TO_MONO_MASK \
768(GAVL_AUDIO_STEREO_TO_MONO_LEFT | \
769 GAVL_AUDIO_STEREO_TO_MONO_RIGHT | \
770 GAVL_AUDIO_STEREO_TO_MONO_MIX)
775#define GAVL_AUDIO_NORMALIZE_MIX_MATRIX (1<<6)
782 typedef enum
783 {
784 GAVL_AUDIO_DITHER_NONE = 0,
785 GAVL_AUDIO_DITHER_AUTO = 1,
786 GAVL_AUDIO_DITHER_RECT = 2,
787 GAVL_AUDIO_DITHER_TRI = 3,
788 GAVL_AUDIO_DITHER_SHAPED = 4,
789 } gavl_audio_dither_mode_t;
790
795 typedef enum
796 {
797 GAVL_RESAMPLE_AUTO = 0,
798 GAVL_RESAMPLE_ZOH = 1,
799 GAVL_RESAMPLE_LINEAR = 2,
800 GAVL_RESAMPLE_SINC_FAST = 3,
801 GAVL_RESAMPLE_SINC_MEDIUM = 4,
802 GAVL_RESAMPLE_SINC_BEST = 5
803 } gavl_resample_mode_t;
804
811 typedef struct gavl_audio_options_s gavl_audio_options_t;
812
819GAVL_PUBLIC
820 void gavl_audio_options_set_quality(gavl_audio_options_t * opt, int quality);
821
828GAVL_PUBLIC
829 int gavl_audio_options_get_quality(gavl_audio_options_t * opt);
830
837GAVL_PUBLIC
838 void gavl_audio_options_set_dither_mode(gavl_audio_options_t * opt, gavl_audio_dither_mode_t mode);
839
846GAVL_PUBLIC
847 gavl_audio_dither_mode_t gavl_audio_options_get_dither_mode(gavl_audio_options_t * opt);
848
849
856GAVL_PUBLIC
857 void gavl_audio_options_set_resample_mode(gavl_audio_options_t * opt, gavl_resample_mode_t mode);
858
865GAVL_PUBLIC
866 gavl_resample_mode_t gavl_audio_options_get_resample_mode(gavl_audio_options_t * opt);
867
874GAVL_PUBLIC
875 void gavl_audio_options_set_conversion_flags(gavl_audio_options_t * opt,
876 int flags);
877
884GAVL_PUBLIC
885 int gavl_audio_options_get_conversion_flags(gavl_audio_options_t * opt);
886
892GAVL_PUBLIC
893 void gavl_audio_options_set_defaults(gavl_audio_options_t * opt);
894
911GAVL_PUBLIC
912 void gavl_audio_options_set_mix_matrix(gavl_audio_options_t * opt,
913 const double ** matrix);
914
923GAVL_PUBLIC
924 const double ** gavl_audio_options_get_mix_matrix(gavl_audio_options_t * opt);
925
935GAVL_PUBLIC
936 gavl_audio_options_t * gavl_audio_options_create();
937
944GAVL_PUBLIC
945 void gavl_audio_options_copy(gavl_audio_options_t * dst,
946 const gavl_audio_options_t * src);
947
953GAVL_PUBLIC
954 void gavl_audio_options_destroy(gavl_audio_options_t * opt);
955
956
957
958/* Audio converter */
959
993 typedef struct gavl_audio_converter_s gavl_audio_converter_t;
994
1000GAVL_PUBLIC
1001 gavl_audio_converter_t * gavl_audio_converter_create();
1002
1008GAVL_PUBLIC
1009 void gavl_audio_converter_destroy(gavl_audio_converter_t* cnv);
1010
1019GAVL_PUBLIC
1020 gavl_audio_options_t * gavl_audio_converter_get_options(gavl_audio_converter_t*cnv);
1021
1022
1037GAVL_PUBLIC
1038 int gavl_audio_converter_init(gavl_audio_converter_t* cnv,
1039 const gavl_audio_format_t * input_format,
1040 const gavl_audio_format_t * output_format);
1041
1056GAVL_PUBLIC
1057 int gavl_audio_converter_init_resample(gavl_audio_converter_t * cnv,
1058 const gavl_audio_format_t * format);
1059
1074GAVL_PUBLIC
1075 int gavl_audio_converter_reinit(gavl_audio_converter_t* cnv);
1076
1077
1091GAVL_PUBLIC
1092 void gavl_audio_convert(gavl_audio_converter_t * cnv,
1093 const gavl_audio_frame_t * input_frame,
1094 gavl_audio_frame_t * output_frame);
1095
1096
1115GAVL_PUBLIC
1116 int gavl_audio_converter_set_resample_ratio(gavl_audio_converter_t * cnv,
1117 double ratio ) ;
1118
1119
1135GAVL_PUBLIC
1136 void gavl_audio_converter_resample(gavl_audio_converter_t * cnv,
1137 gavl_audio_frame_t * input_frame,
1138 gavl_audio_frame_t * output_frame,
1139 double ratio);
1140
1141
1155 typedef struct gavl_volume_control_s gavl_volume_control_t;
1156
1157/* Create / destroy */
1158
1164GAVL_PUBLIC
1165 gavl_volume_control_t * gavl_volume_control_create();
1166
1172GAVL_PUBLIC
1173 void gavl_volume_control_destroy(gavl_volume_control_t *ctrl);
1174
1182GAVL_PUBLIC
1183 void gavl_volume_control_set_format(gavl_volume_control_t *ctrl,
1184 const gavl_audio_format_t * format);
1185
1192GAVL_PUBLIC
1193 void gavl_volume_control_set_volume(gavl_volume_control_t * ctrl,
1194 float volume);
1195
1202GAVL_PUBLIC
1203 void gavl_volume_control_apply(gavl_volume_control_t *ctrl,
1204 gavl_audio_frame_t * frame);
1205
1221 typedef struct gavl_peak_detector_s gavl_peak_detector_t;
1222
1223/* Create / destroy */
1224
1230GAVL_PUBLIC
1231 gavl_peak_detector_t * gavl_peak_detector_create();
1232
1238GAVL_PUBLIC
1239 void gavl_peak_detector_destroy(gavl_peak_detector_t *pd);
1240
1250GAVL_PUBLIC
1251 void gavl_peak_detector_set_format(gavl_peak_detector_t *pd,
1252 const gavl_audio_format_t * format);
1253
1260GAVL_PUBLIC
1261 void gavl_peak_detector_update(gavl_peak_detector_t *pd,
1262 gavl_audio_frame_t * frame);
1263
1276GAVL_PUBLIC
1277 void gavl_peak_detector_get_peak(gavl_peak_detector_t * pd,
1278 double * min, double * max,
1279 double * abs);
1280
1293GAVL_PUBLIC
1294 void gavl_peak_detector_get_peaks(gavl_peak_detector_t * pd,
1295 double * min, double * max,
1296 double * abs);
1297
1303GAVL_PUBLIC
1304 void gavl_peak_detector_reset(gavl_peak_detector_t * pd);
1305
1315#define GAVL_MAX_PLANES 4
1327 typedef struct
1328 {
1329 int x;
1330 int y;
1331 int w;
1332 int h;
1333 } gavl_rectangle_i_t;
1334
1339 typedef struct
1340 {
1341 double x;
1342 double y;
1343 double w;
1344 double h;
1345 } gavl_rectangle_f_t;
1346
1353GAVL_PUBLIC
1354 void gavl_rectangle_i_crop_to_format(gavl_rectangle_i_t * r,
1355 const gavl_video_format_t * format);
1356
1363GAVL_PUBLIC
1364 void gavl_rectangle_f_crop_to_format(gavl_rectangle_f_t * r,
1365 const gavl_video_format_t * format);
1366
1381GAVL_PUBLIC
1382 void gavl_rectangle_crop_to_format_noscale(gavl_rectangle_i_t * src_rect,
1383 gavl_rectangle_i_t * dst_rect,
1384 const gavl_video_format_t * src_format,
1385 const gavl_video_format_t * dst_format);
1386
1398GAVL_PUBLIC
1399 void gavl_rectangle_crop_to_format_scale(gavl_rectangle_f_t * src_rect,
1400 gavl_rectangle_i_t * dst_rect,
1401 const gavl_video_format_t * src_format,
1402 const gavl_video_format_t * dst_format);
1403
1404
1405
1412GAVL_PUBLIC
1413 void gavl_rectangle_i_set_all(gavl_rectangle_i_t * r, const gavl_video_format_t * format);
1414
1421GAVL_PUBLIC
1422 void gavl_rectangle_f_set_all(gavl_rectangle_f_t * r, const gavl_video_format_t * format);
1423
1430GAVL_PUBLIC
1431 void gavl_rectangle_i_crop_left(gavl_rectangle_i_t * r, int num_pixels);
1432
1439GAVL_PUBLIC
1440 void gavl_rectangle_i_crop_right(gavl_rectangle_i_t * r, int num_pixels);
1441
1448GAVL_PUBLIC
1449 void gavl_rectangle_i_crop_top(gavl_rectangle_i_t * r, int num_pixels);
1450
1457GAVL_PUBLIC
1458 void gavl_rectangle_i_crop_bottom(gavl_rectangle_i_t * r, int num_pixels);
1459
1466GAVL_PUBLIC
1467 void gavl_rectangle_f_crop_left(gavl_rectangle_f_t * r, double num_pixels);
1468
1475GAVL_PUBLIC
1476 void gavl_rectangle_f_crop_right(gavl_rectangle_f_t * r, double num_pixels);
1477
1484GAVL_PUBLIC
1485 void gavl_rectangle_f_crop_top(gavl_rectangle_f_t * r, double num_pixels);
1486
1493GAVL_PUBLIC
1494 void gavl_rectangle_f_crop_bottom(gavl_rectangle_f_t * r, double num_pixels);
1495
1509GAVL_PUBLIC
1510 void gavl_rectangle_i_align(gavl_rectangle_i_t * r, int h_align, int v_align);
1511
1521GAVL_PUBLIC
1522 void gavl_rectangle_i_align_to_format(gavl_rectangle_i_t * r,
1523 const gavl_video_format_t * format);
1524
1525
1532GAVL_PUBLIC
1533 void gavl_rectangle_i_copy(gavl_rectangle_i_t * dst, const gavl_rectangle_i_t * src);
1534
1541GAVL_PUBLIC
1542 void gavl_rectangle_f_copy(gavl_rectangle_f_t * dst, const gavl_rectangle_f_t * src);
1543
1544
1545
1552GAVL_PUBLIC
1553 void gavl_rectangle_i_to_f(gavl_rectangle_f_t * dst, const gavl_rectangle_i_t * src);
1554
1561GAVL_PUBLIC
1562 void gavl_rectangle_f_to_i(gavl_rectangle_i_t * dst, const gavl_rectangle_f_t * src);
1563
1572GAVL_PUBLIC
1573 int gavl_rectangle_i_is_empty(const gavl_rectangle_i_t * r);
1574
1583GAVL_PUBLIC
1584 int gavl_rectangle_f_is_empty(const gavl_rectangle_f_t * r);
1585
1613GAVL_PUBLIC
1614 void gavl_rectangle_fit_aspect(gavl_rectangle_i_t * dst_rect,
1615 const gavl_video_format_t * src_format,
1616 const gavl_rectangle_f_t * src_rect,
1617 const gavl_video_format_t * dst_format,
1618 float zoom, float squeeze);
1619
1624GAVL_PUBLIC
1625 void gavl_rectangle_i_dump(const gavl_rectangle_i_t * r);
1626
1631GAVL_PUBLIC
1632 void gavl_rectangle_f_dump(const gavl_rectangle_f_t * r);
1633
1634
1644#define GAVL_PIXFMT_PLANAR (1<<8)
1645
1649#define GAVL_PIXFMT_RGB (1<<9)
1650
1654#define GAVL_PIXFMT_YUV (1<<10)
1655
1659#define GAVL_PIXFMT_YUVJ (1<<11)
1660
1664#define GAVL_PIXFMT_ALPHA (1<<12)
1665
1669#define GAVL_PIXFMT_GRAY (1<<13)
1670
1675 typedef enum
1676 {
1679 GAVL_PIXELFORMAT_NONE = 0,
1680
1683 GAVL_GRAY_8 = 1 | GAVL_PIXFMT_GRAY,
1684
1687 GAVL_GRAY_16 = 2 | GAVL_PIXFMT_GRAY,
1688
1691 GAVL_GRAY_FLOAT = 3 | GAVL_PIXFMT_GRAY,
1692
1695 GAVL_GRAYA_16 = 1 | GAVL_PIXFMT_GRAY | GAVL_PIXFMT_ALPHA,
1696
1699 GAVL_GRAYA_32 = 2 | GAVL_PIXFMT_GRAY | GAVL_PIXFMT_ALPHA,
1700
1703 GAVL_GRAYA_FLOAT = 3 | GAVL_PIXFMT_GRAY | GAVL_PIXFMT_ALPHA,
1704
1708 GAVL_RGB_15 = 1 | GAVL_PIXFMT_RGB,
1712 GAVL_BGR_15 = 2 | GAVL_PIXFMT_RGB,
1716 GAVL_RGB_16 = 3 | GAVL_PIXFMT_RGB,
1720 GAVL_BGR_16 = 4 | GAVL_PIXFMT_RGB,
1723 GAVL_RGB_24 = 5 | GAVL_PIXFMT_RGB,
1726 GAVL_BGR_24 = 6 | GAVL_PIXFMT_RGB,
1729 GAVL_RGB_32 = 7 | GAVL_PIXFMT_RGB,
1732 GAVL_BGR_32 = 8 | GAVL_PIXFMT_RGB,
1735 GAVL_RGBA_32 = 9 | GAVL_PIXFMT_RGB | GAVL_PIXFMT_ALPHA,
1736
1739 GAVL_RGB_48 = 10 | GAVL_PIXFMT_RGB,
1742 GAVL_RGBA_64 = 11 | GAVL_PIXFMT_RGB | GAVL_PIXFMT_ALPHA,
1743
1746 GAVL_RGB_FLOAT = 12 | GAVL_PIXFMT_RGB,
1749 GAVL_RGBA_FLOAT = 13 | GAVL_PIXFMT_RGB | GAVL_PIXFMT_ALPHA,
1750
1753 GAVL_YUY2 = 1 | GAVL_PIXFMT_YUV,
1756 GAVL_UYVY = 2 | GAVL_PIXFMT_YUV,
1759 GAVL_YUVA_32 = 3 | GAVL_PIXFMT_YUV | GAVL_PIXFMT_ALPHA,
1762 GAVL_YUVA_64 = 4 | GAVL_PIXFMT_YUV | GAVL_PIXFMT_ALPHA,
1765 GAVL_YUV_FLOAT = 5 | GAVL_PIXFMT_YUV,
1766
1769 GAVL_YUVA_FLOAT = 6 | GAVL_PIXFMT_YUV | GAVL_PIXFMT_ALPHA,
1770
1774 GAVL_YUV_420_P = 1 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
1777 GAVL_YUV_422_P = 2 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
1780 GAVL_YUV_444_P = 3 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
1783 GAVL_YUV_411_P = 4 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
1786 GAVL_YUV_410_P = 5 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
1787
1790 GAVL_YUVJ_420_P = 6 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV | GAVL_PIXFMT_YUVJ,
1793 GAVL_YUVJ_422_P = 7 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV | GAVL_PIXFMT_YUVJ,
1796 GAVL_YUVJ_444_P = 8 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV | GAVL_PIXFMT_YUVJ,
1797
1800 GAVL_YUV_444_P_16 = 9 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
1803 GAVL_YUV_422_P_16 = 10 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
1804
1805 } gavl_pixelformat_t;
1806
1809#define GAVL_PIXELFORMAT_1D_8 GAVL_GRAY_8
1812#define GAVL_PIXELFORMAT_2D_8 GAVL_GRAYA_16
1815#define GAVL_PIXELFORMAT_3D_8 GAVL_RGB_24
1818#define GAVL_PIXELFORMAT_4D_8 GAVL_RGBA_32
1819
1822#define GAVL_PIXELFORMAT_1D_16 GAVL_GRAY_16
1825#define GAVL_PIXELFORMAT_2D_16 GAVL_GRAYA_32
1828#define GAVL_PIXELFORMAT_3D_16 GAVL_RGB_48
1831#define GAVL_PIXELFORMAT_4D_16 GAVL_RGBA_64
1832
1835#define GAVL_PIXELFORMAT_1D_FLOAT GAVL_GRAY_FLOAT
1838#define GAVL_PIXELFORMAT_2D_FLOAT GAVL_GRAYA_FLOAT
1841#define GAVL_PIXELFORMAT_3D_FLOAT GAVL_RGB_FLOAT
1844#define GAVL_PIXELFORMAT_4D_FLOAT GAVL_RGBA_FLOAT
1845
1852 typedef enum
1853 {
1854 GAVL_CCH_RED,
1855 GAVL_CCH_GREEN,
1856 GAVL_CCH_BLUE,
1857 GAVL_CCH_Y,
1858 GAVL_CCH_CB,
1859 GAVL_CCH_CR,
1860 GAVL_CCH_ALPHA,
1861 } gavl_color_channel_t;
1862
1863/*
1864 * Colormodel related functions
1865 */
1866
1873#define gavl_pixelformat_is_gray(fmt) ((fmt) & GAVL_PIXFMT_GRAY)
1874
1875
1882#define gavl_pixelformat_is_rgb(fmt) ((fmt) & GAVL_PIXFMT_RGB)
1883
1890#define gavl_pixelformat_is_yuv(fmt) ((fmt) & GAVL_PIXFMT_YUV)
1891
1898#define gavl_pixelformat_is_jpeg_scaled(fmt) ((fmt) & GAVL_PIXFMT_YUVJ)
1899
1906#define gavl_pixelformat_has_alpha(fmt) ((fmt) & GAVL_PIXFMT_ALPHA)
1907
1914#define gavl_pixelformat_is_planar(fmt) ((fmt) & GAVL_PIXFMT_PLANAR)
1915
1922GAVL_PUBLIC
1923 int gavl_pixelformat_num_planes(gavl_pixelformat_t pixelformat);
1924
1934GAVL_PUBLIC
1935 void gavl_pixelformat_chroma_sub(gavl_pixelformat_t pixelformat, int * sub_h, int * sub_v);
1936
1943GAVL_PUBLIC
1944 int gavl_pixelformat_bytes_per_component(gavl_pixelformat_t pixelformat);
1945
1952GAVL_PUBLIC
1953 int gavl_pixelformat_bytes_per_pixel(gavl_pixelformat_t pixelformat);
1954
1961GAVL_PUBLIC
1962 int gavl_pixelformat_bits_per_pixel(gavl_pixelformat_t pixelformat);
1963
1978GAVL_PUBLIC
1979 int gavl_pixelformat_conversion_penalty(gavl_pixelformat_t src,
1980 gavl_pixelformat_t dst);
1981
1995GAVL_PUBLIC gavl_pixelformat_t
1996 gavl_pixelformat_get_best(gavl_pixelformat_t src,
1997 const gavl_pixelformat_t * dst_supported,
1998 int * penalty);
1999
2000
2001
2008GAVL_PUBLIC
2009 const char * gavl_pixelformat_to_string(gavl_pixelformat_t pixelformat);
2010
2017GAVL_PUBLIC
2018 gavl_pixelformat_t gavl_string_to_pixelformat(const char * name);
2019
2025GAVL_PUBLIC
2026 int gavl_num_pixelformats();
2027
2034GAVL_PUBLIC
2035 gavl_pixelformat_t gavl_get_pixelformat(int index);
2036
2037/* */
2038
2047 typedef enum
2048 {
2049 GAVL_CHROMA_PLACEMENT_DEFAULT = 0,
2050 GAVL_CHROMA_PLACEMENT_MPEG2,
2051 GAVL_CHROMA_PLACEMENT_DVPAL
2052 } gavl_chroma_placement_t;
2053
2060GAVL_PUBLIC
2061 const char * gavl_chroma_placement_to_string(gavl_chroma_placement_t mode);
2062
2067/* Changing the values alters the gmerlin-avdecoder index format */
2068
2069 typedef enum
2070 {
2071 GAVL_FRAMERATE_UNKNOWN = -1,
2072 GAVL_FRAMERATE_CONSTANT = 0,
2073 GAVL_FRAMERATE_VARIABLE = 1,
2074 GAVL_FRAMERATE_STILL = 2,
2075 } gavl_framerate_mode_t;
2076
2083GAVL_PUBLIC
2084 const char * gavl_framerate_mode_to_string(gavl_framerate_mode_t mode);
2085
2090/* Changing the values alters the gmerlin-avdecoder index format */
2091
2092 typedef enum
2093 {
2094 GAVL_INTERLACE_UNKNOWN = -1,
2095 GAVL_INTERLACE_NONE = 0,
2096 GAVL_INTERLACE_TOP_FIRST = 1,
2097 GAVL_INTERLACE_BOTTOM_FIRST = 2,
2098 GAVL_INTERLACE_MIXED = 3,
2099 GAVL_INTERLACE_MIXED_TOP = 4,
2100 GAVL_INTERLACE_MIXED_BOTTOM = 5,
2101 } gavl_interlace_mode_t;
2102
2109GAVL_PUBLIC
2110 const char * gavl_interlace_mode_to_string(gavl_interlace_mode_t mode);
2111
2112
2113/* Video format structure */
2114
2119 struct gavl_video_format_s
2120 {
2121 int frame_width;
2122 int frame_height;
2124 int image_width;
2125 int image_height;
2127 /* Support for nonsquare pixels */
2128
2129 int pixel_width;
2130 int pixel_height;
2132 gavl_pixelformat_t pixelformat;
2134 int frame_duration;
2136 int timescale;
2138 gavl_framerate_mode_t framerate_mode;
2139 gavl_chroma_placement_t chroma_placement;
2141 gavl_interlace_mode_t interlace_mode;
2143 gavl_timecode_format_t timecode_format;
2144 };
2145
2153GAVL_PUBLIC
2154 void gavl_video_format_copy(gavl_video_format_t * dst,
2155 const gavl_video_format_t * src);
2156
2165GAVL_PUBLIC
2166 int gavl_video_formats_equal(const gavl_video_format_t * format_1,
2167 const gavl_video_format_t * format_2);
2168
2169
2180GAVL_PUBLIC
2181 void gavl_video_format_get_chroma_offset(const gavl_video_format_t * format, int field, int plane,
2182 float * off_x, float * off_y);
2183
2184
2185
2198GAVL_PUBLIC
2199 void gavl_video_format_fit_to_source(gavl_video_format_t * dst,
2200 const gavl_video_format_t * src);
2201
2209GAVL_PUBLIC
2210 int gavl_video_format_get_image_size(const gavl_video_format_t * format);
2211
2227GAVL_PUBLIC
2228 int gavl_get_color_channel_format(const gavl_video_format_t * frame_format,
2229 gavl_video_format_t * channel_format,
2230 gavl_color_channel_t ch);
2231
2232
2246GAVL_PUBLIC
2247 void gavl_get_field_format(const gavl_video_format_t * frame_format,
2248 gavl_video_format_t * field_format,
2249 int field);
2250
2251
2258GAVL_PUBLIC
2259 void gavl_video_format_dump(const gavl_video_format_t * format);
2260
2261
2284 typedef struct
2285 {
2286 uint8_t * planes[GAVL_MAX_PLANES];
2287 int strides[GAVL_MAX_PLANES];
2289 void * user_data;
2290 int64_t timestamp;
2291 int64_t duration;
2292 gavl_interlace_mode_t interlace_mode;
2293 gavl_timecode_t timecode;
2294 } gavl_video_frame_t;
2295
2296
2308GAVL_PUBLIC
2309 gavl_video_frame_t * gavl_video_frame_create(const gavl_video_format_t*format);
2310
2321GAVL_PUBLIC
2322 gavl_video_frame_t * gavl_video_frame_create_nopad(const gavl_video_format_t*format);
2323
2324
2325
2335GAVL_PUBLIC
2336 void gavl_video_frame_destroy(gavl_video_frame_t*frame);
2337
2349GAVL_PUBLIC
2350 void gavl_video_frame_null(gavl_video_frame_t*frame);
2351
2360GAVL_PUBLIC
2361 void gavl_video_frame_clear(gavl_video_frame_t * frame,
2362 const gavl_video_format_t * format);
2363
2373GAVL_PUBLIC
2374 void gavl_video_frame_fill(gavl_video_frame_t * frame,
2375 const gavl_video_format_t * format,
2376 const float * color);
2377
2390GAVL_PUBLIC
2391 void gavl_video_frame_absdiff(gavl_video_frame_t * dst,
2392 const gavl_video_frame_t * src1,
2393 const gavl_video_frame_t * src2,
2394 const gavl_video_format_t * format);
2395
2408GAVL_PUBLIC
2409 void gavl_video_frame_psnr(double * psnr,
2410 const gavl_video_frame_t * src1,
2411 const gavl_video_frame_t * src2,
2412 const gavl_video_format_t * format);
2413
2440GAVL_PUBLIC
2441 int gavl_video_frame_ssim(const gavl_video_frame_t * src1,
2442 const gavl_video_frame_t * src2,
2443 gavl_video_frame_t * dst,
2444 const gavl_video_format_t * format);
2445
2459GAVL_PUBLIC
2460 void gavl_video_frame_copy(const gavl_video_format_t * format,
2461 gavl_video_frame_t * dst,
2462 const gavl_video_frame_t * src);
2463
2476GAVL_PUBLIC
2477 void gavl_video_frame_copy_plane(const gavl_video_format_t * format,
2478 gavl_video_frame_t * dst,
2479 const gavl_video_frame_t * src, int plane);
2480
2492GAVL_PUBLIC
2493 void gavl_video_frame_copy_flip_x(const gavl_video_format_t * format,
2494 gavl_video_frame_t * dst,
2495 const gavl_video_frame_t * src);
2496
2508GAVL_PUBLIC
2509 void gavl_video_frame_copy_flip_y(const gavl_video_format_t * format,
2510 gavl_video_frame_t * dst,
2511 const gavl_video_frame_t * src);
2512
2524GAVL_PUBLIC
2525 void gavl_video_frame_copy_flip_xy(const gavl_video_format_t * format,
2526 gavl_video_frame_t * dst,
2527 const gavl_video_frame_t * src);
2528
2541GAVL_PUBLIC
2542 void gavl_video_frame_copy_metadata(gavl_video_frame_t * dst,
2543 const gavl_video_frame_t * src);
2544
2545
2563GAVL_PUBLIC
2564 void gavl_video_frame_get_subframe(gavl_pixelformat_t pixelformat,
2565 const gavl_video_frame_t * src,
2566 gavl_video_frame_t * dst,
2567 gavl_rectangle_i_t * src_rect);
2568
2584GAVL_PUBLIC
2585 void gavl_video_frame_get_field(gavl_pixelformat_t pixelformat,
2586 const gavl_video_frame_t * src,
2587 gavl_video_frame_t * dst,
2588 int field);
2589
2590
2591
2604GAVL_PUBLIC
2605 void gavl_video_frame_dump(gavl_video_frame_t * frame,
2606 const gavl_video_format_t * format,
2607 const char * namebase);
2608
2619GAVL_PUBLIC
2620 void gavl_video_frame_set_strides(gavl_video_frame_t * frame,
2621 const gavl_video_format_t * format);
2622
2635GAVL_PUBLIC
2636 void gavl_video_frame_set_planes(gavl_video_frame_t * frame,
2637 const gavl_video_format_t * format,
2638 uint8_t * buffer);
2639
2654GAVL_PUBLIC
2655 int gavl_video_frame_extract_channel(const gavl_video_format_t * format,
2656 gavl_color_channel_t ch,
2657 const gavl_video_frame_t * src,
2658 gavl_video_frame_t * dst);
2659
2675GAVL_PUBLIC
2676 int gavl_video_frame_insert_channel(const gavl_video_format_t * format,
2677 gavl_color_channel_t ch,
2678 const gavl_video_frame_t * src,
2679 gavl_video_frame_t * dst);
2680
2681
2693GAVL_PUBLIC
2694 int gavl_video_frames_equal(const gavl_video_format_t * format,
2695 const gavl_video_frame_t * f1,
2696 const gavl_video_frame_t * f2);
2697
2698
2699/*****************************
2700 Conversion options
2701******************************/
2702
2718#define GAVL_FORCE_DEINTERLACE (1<<0)
2719
2724#define GAVL_CONVOLVE_CHROMA (1<<1)
2725
2730#define GAVL_CONVOLVE_NORMALIZE (1<<2)
2731
2739#define GAVL_RESAMPLE_CHROMA (1<<3)
2740
2748 typedef enum
2749 {
2750 GAVL_ALPHA_IGNORE = 0,
2751 GAVL_ALPHA_BLEND_COLOR
2752 } gavl_alpha_mode_t;
2753
2760 typedef enum
2761 {
2762 GAVL_DEINTERLACE_NONE = 0,
2763 GAVL_DEINTERLACE_COPY = 1,
2764 GAVL_DEINTERLACE_SCALE = 2,
2765 GAVL_DEINTERLACE_BLEND = 3
2766 } gavl_deinterlace_mode_t;
2767
2774 typedef enum
2775 {
2776 GAVL_DEINTERLACE_DROP_TOP,
2777 GAVL_DEINTERLACE_DROP_BOTTOM,
2778 } gavl_deinterlace_drop_mode_t;
2779
2784 typedef enum
2785 {
2786 GAVL_SCALE_AUTO,
2787 GAVL_SCALE_NEAREST,
2788 GAVL_SCALE_BILINEAR,
2789 GAVL_SCALE_QUADRATIC,
2790 GAVL_SCALE_CUBIC_BSPLINE,
2791 GAVL_SCALE_CUBIC_MITCHELL,
2792 GAVL_SCALE_CUBIC_CATMULL,
2793 GAVL_SCALE_SINC_LANCZOS,
2794 GAVL_SCALE_NONE,
2795 } gavl_scale_mode_t;
2796
2806 typedef enum
2807 {
2808 GAVL_DOWNSCALE_FILTER_AUTO = 0,
2809 GAVL_DOWNSCALE_FILTER_NONE,
2810 GAVL_DOWNSCALE_FILTER_WIDE,
2811 GAVL_DOWNSCALE_FILTER_GAUSS,
2812 } gavl_downscale_filter_t;
2813
2820 typedef struct gavl_video_options_s gavl_video_options_t;
2821
2822/* Default Options */
2823
2829GAVL_PUBLIC
2830 void gavl_video_options_set_defaults(gavl_video_options_t * opt);
2831
2841GAVL_PUBLIC
2842 gavl_video_options_t * gavl_video_options_create();
2843
2850GAVL_PUBLIC
2851 void gavl_video_options_copy(gavl_video_options_t * dst,
2852 const gavl_video_options_t * src);
2853
2859GAVL_PUBLIC
2860 void gavl_video_options_destroy(gavl_video_options_t * opt);
2861
2862
2877GAVL_PUBLIC
2878 void gavl_video_options_set_rectangles(gavl_video_options_t * opt,
2879 const gavl_rectangle_f_t * src_rect,
2880 const gavl_rectangle_i_t * dst_rect);
2881
2889GAVL_PUBLIC
2890 void gavl_video_options_get_rectangles(gavl_video_options_t * opt,
2891 gavl_rectangle_f_t * src_rect,
2892 gavl_rectangle_i_t * dst_rect);
2893
2900GAVL_PUBLIC
2901 void gavl_video_options_set_quality(gavl_video_options_t * opt, int quality);
2902
2909GAVL_PUBLIC
2910 int gavl_video_options_get_quality(gavl_video_options_t * opt);
2911
2912
2919GAVL_PUBLIC
2920 void gavl_video_options_set_conversion_flags(gavl_video_options_t * opt,
2921 int conversion_flags);
2922
2929GAVL_PUBLIC
2930 int gavl_video_options_get_conversion_flags(gavl_video_options_t * opt);
2931
2938GAVL_PUBLIC
2939 void gavl_video_options_set_alpha_mode(gavl_video_options_t * opt,
2940 gavl_alpha_mode_t alpha_mode);
2941
2948GAVL_PUBLIC gavl_alpha_mode_t
2949 gavl_video_options_get_alpha_mode(gavl_video_options_t * opt);
2950
2951
2958GAVL_PUBLIC
2959 void gavl_video_options_set_scale_mode(gavl_video_options_t * opt,
2960 gavl_scale_mode_t scale_mode);
2961
2968GAVL_PUBLIC gavl_scale_mode_t
2969 gavl_video_options_get_scale_mode(gavl_video_options_t * opt);
2970
2971
2978GAVL_PUBLIC
2979 void gavl_video_options_set_scale_order(gavl_video_options_t * opt,
2980 int order);
2981
2988GAVL_PUBLIC
2989 int gavl_video_options_get_scale_order(gavl_video_options_t * opt);
2990
2991
2998GAVL_PUBLIC
2999 void gavl_video_options_set_background_color(gavl_video_options_t * opt,
3000 const float * color);
3001
3008GAVL_PUBLIC
3009 void gavl_video_options_get_background_color(gavl_video_options_t * opt,
3010 float * color);
3011
3018GAVL_PUBLIC
3019 void gavl_video_options_set_deinterlace_mode(gavl_video_options_t * opt,
3020 gavl_deinterlace_mode_t deinterlace_mode);
3021
3028GAVL_PUBLIC gavl_deinterlace_mode_t
3029 gavl_video_options_get_deinterlace_mode(gavl_video_options_t * opt);
3030
3037GAVL_PUBLIC
3038 void gavl_video_options_set_deinterlace_drop_mode(gavl_video_options_t * opt,
3039 gavl_deinterlace_drop_mode_t deinterlace_drop_mode);
3040
3047GAVL_PUBLIC gavl_deinterlace_drop_mode_t
3048 gavl_video_options_get_deinterlace_drop_mode(gavl_video_options_t * opt);
3049
3058GAVL_PUBLIC
3059 void gavl_video_options_set_downscale_filter(gavl_video_options_t * opt,
3060 gavl_downscale_filter_t f);
3061
3062
3071GAVL_PUBLIC gavl_downscale_filter_t
3072 gavl_video_options_get_downscale_filter(gavl_video_options_t * opt);
3073
3091GAVL_PUBLIC
3092 void gavl_video_options_set_downscale_blur(gavl_video_options_t * opt,
3093 float f);
3094
3103GAVL_PUBLIC
3104 float gavl_video_options_get_downscale_blur(gavl_video_options_t * opt);
3105
3114GAVL_PUBLIC
3115 void gavl_video_options_set_num_threads(gavl_video_options_t * opt, int n);
3116
3117
3126GAVL_PUBLIC
3127 int gavl_video_options_get_num_threads(gavl_video_options_t * opt);
3128
3138GAVL_PUBLIC
3139 void gavl_video_options_set_run_func(gavl_video_options_t * opt,
3140 gavl_video_run_func func,
3141 void * client_data);
3142
3152GAVL_PUBLIC
3153 gavl_video_run_func gavl_video_options_get_run_func(gavl_video_options_t * opt,
3154 void ** client_data);
3155
3165GAVL_PUBLIC
3166 void gavl_video_options_set_stop_func(gavl_video_options_t * opt,
3167 gavl_video_stop_func func,
3168 void * client_data);
3169
3179GAVL_PUBLIC
3180 gavl_video_stop_func gavl_video_options_get_stop_func(gavl_video_options_t * opt,
3181 void ** client_data);
3182
3183
3184/***************************************************
3185 * Create and destroy video converters
3186 ***************************************************/
3187
3220 typedef struct gavl_video_converter_s gavl_video_converter_t;
3221
3227GAVL_PUBLIC
3228 gavl_video_converter_t * gavl_video_converter_create();
3229
3235GAVL_PUBLIC
3236 void gavl_video_converter_destroy(gavl_video_converter_t*cnv);
3237
3238/**************************************************
3239 * Get options. Change the options with the gavl_video_options_set_*
3240 * functions above
3241 **************************************************/
3242
3251GAVL_PUBLIC gavl_video_options_t *
3252 gavl_video_converter_get_options(gavl_video_converter_t*cnv);
3253
3254
3268GAVL_PUBLIC
3269 int gavl_video_converter_init(gavl_video_converter_t* cnv,
3270 const gavl_video_format_t * input_format,
3271 const gavl_video_format_t * output_format);
3272
3285GAVL_PUBLIC
3286 int gavl_video_converter_reinit(gavl_video_converter_t* cnv);
3287
3288
3289/***************************************************
3290 * Convert a frame
3291 ***************************************************/
3292
3300GAVL_PUBLIC
3301 void gavl_video_convert(gavl_video_converter_t * cnv,
3302 const gavl_video_frame_t * input_frame,
3303 gavl_video_frame_t * output_frame);
3304
3336 typedef struct gavl_video_scaler_s gavl_video_scaler_t;
3337
3343GAVL_PUBLIC
3344 gavl_video_scaler_t * gavl_video_scaler_create();
3345
3351GAVL_PUBLIC
3352 void gavl_video_scaler_destroy(gavl_video_scaler_t * scaler);
3353
3362GAVL_PUBLIC gavl_video_options_t *
3363 gavl_video_scaler_get_options(gavl_video_scaler_t * scaler);
3364
3377GAVL_PUBLIC
3378 int gavl_video_scaler_init(gavl_video_scaler_t * scaler,
3379 const gavl_video_format_t * src_format,
3380 const gavl_video_format_t * dst_format);
3381
3403GAVL_PUBLIC
3404 int gavl_video_scaler_init_convolve(gavl_video_scaler_t * scaler,
3405 const gavl_video_format_t * format,
3406 int h_radius, const float * h_coeffs,
3407 int v_radius, const float * v_coeffs);
3408
3416GAVL_PUBLIC
3417 void gavl_video_scaler_scale(gavl_video_scaler_t * scaler,
3418 const gavl_video_frame_t * input_frame,
3419 gavl_video_frame_t * output_frame);
3420
3436 typedef struct gavl_video_deinterlacer_s gavl_video_deinterlacer_t;
3437
3443GAVL_PUBLIC
3444 gavl_video_deinterlacer_t * gavl_video_deinterlacer_create();
3445
3451GAVL_PUBLIC
3452 void gavl_video_deinterlacer_destroy(gavl_video_deinterlacer_t * deinterlacer);
3453
3462GAVL_PUBLIC gavl_video_options_t *
3463 gavl_video_deinterlacer_get_options(gavl_video_deinterlacer_t * deinterlacer);
3464
3475GAVL_PUBLIC
3476 int gavl_video_deinterlacer_init(gavl_video_deinterlacer_t * deinterlacer,
3477 const gavl_video_format_t * src_format);
3478
3479
3487GAVL_PUBLIC
3488 void gavl_video_deinterlacer_deinterlace(gavl_video_deinterlacer_t * deinterlacer,
3489 const gavl_video_frame_t * input_frame,
3490 gavl_video_frame_t * output_frame);
3491
3492
3493
3494/**************************************************
3495 * Transparent overlays
3496 **************************************************/
3497
3498/* Overlay struct */
3499
3527 typedef struct
3528 {
3529 gavl_video_frame_t * frame;
3530 gavl_rectangle_i_t ovl_rect;
3531 int dst_x;
3532 int dst_y;
3533 } gavl_overlay_t;
3534
3541 typedef struct gavl_overlay_blend_context_s gavl_overlay_blend_context_t;
3542
3548GAVL_PUBLIC
3549 gavl_overlay_blend_context_t * gavl_overlay_blend_context_create();
3550
3556GAVL_PUBLIC
3557 void gavl_overlay_blend_context_destroy(gavl_overlay_blend_context_t * ctx);
3558
3565GAVL_PUBLIC gavl_video_options_t *
3566 gavl_overlay_blend_context_get_options(gavl_overlay_blend_context_t * ctx);
3567
3583GAVL_PUBLIC
3584 int gavl_overlay_blend_context_init(gavl_overlay_blend_context_t * ctx,
3585 const gavl_video_format_t * frame_format,
3586 gavl_video_format_t * overlay_format);
3587
3597GAVL_PUBLIC
3598 void gavl_overlay_blend_context_set_overlay(gavl_overlay_blend_context_t * ctx,
3599 gavl_overlay_t * ovl);
3600
3607GAVL_PUBLIC
3608 void gavl_overlay_blend(gavl_overlay_blend_context_t * ctx,
3609 gavl_video_frame_t * dst_frame);
3610
3632 typedef struct gavl_image_transform_s gavl_image_transform_t;
3633
3647 typedef void (*gavl_image_transform_func)(void * priv,
3648 double xdst,
3649 double ydst,
3650 double * xsrc,
3651 double * ysrc);
3652
3653
3660GAVL_PUBLIC
3661 gavl_image_transform_t * gavl_image_transform_create();
3662
3668GAVL_PUBLIC
3669 void gavl_image_transform_destroy(gavl_image_transform_t * t);
3670
3689GAVL_PUBLIC
3690 int gavl_image_transform_init(gavl_image_transform_t * t,
3691 gavl_video_format_t * format,
3692 gavl_image_transform_func func, void * priv);
3693
3701GAVL_PUBLIC
3702 void gavl_image_transform_transform(gavl_image_transform_t * t,
3703 gavl_video_frame_t * in_frame,
3704 gavl_video_frame_t * out_frame);
3705
3716GAVL_PUBLIC gavl_video_options_t *
3717 gavl_image_transform_get_options(gavl_image_transform_t * t);
3718
3741 typedef struct
3742 {
3743 int64_t offset;
3744 /* Primary */
3745 int64_t num_entries;
3746 int64_t entries_alloc;
3747
3748 struct
3749 {
3750 int64_t num_frames;
3751 int64_t duration;
3752 } * entries;
3753
3754 int num_timecodes;
3755 int timecodes_alloc;
3756
3757 struct
3758 {
3759 int64_t pts;
3760 gavl_timecode_t tc;
3761 } * timecodes;
3762
3763 /* Secondary */
3764
3765 } gavl_frame_table_t;
3766
3772GAVL_PUBLIC gavl_frame_table_t * gavl_frame_table_create();
3773
3784GAVL_PUBLIC gavl_frame_table_t *
3785 gavl_frame_table_create_audio(int samplerate, int64_t offset, int64_t duration,
3786 gavl_timecode_format_t * fmt_ret);
3787
3798GAVL_PUBLIC gavl_frame_table_t *
3799 gavl_frame_table_create_cfr(int64_t offset, int64_t frame_duration,
3800 int64_t num_frames,
3801 gavl_timecode_t start_timecode);
3802
3810GAVL_PUBLIC gavl_frame_table_t *
3811 gavl_frame_table_copy(const gavl_frame_table_t * tab);
3812
3813
3814
3821GAVL_PUBLIC void gavl_frame_table_destroy(gavl_frame_table_t * t);
3822
3830GAVL_PUBLIC void gavl_frame_table_append_entry(gavl_frame_table_t * t, int64_t duration);
3831
3840GAVL_PUBLIC void
3841 gavl_frame_table_append_timecode(gavl_frame_table_t * t,
3842 int64_t pts, gavl_timecode_t tc);
3843
3854GAVL_PUBLIC int64_t
3855 gavl_frame_table_frame_to_time(const gavl_frame_table_t * t,
3856 int64_t frame, int * duration);
3857
3868GAVL_PUBLIC int64_t
3869 gavl_frame_table_time_to_frame(const gavl_frame_table_t * t,
3870 int64_t time,
3871 int64_t * start_time);
3872
3883GAVL_PUBLIC gavl_timecode_t
3884 gavl_frame_table_time_to_timecode(const gavl_frame_table_t * t,
3885 int64_t time,
3886 int64_t * start_time,
3887 const gavl_timecode_format_t * fmt);
3888
3898GAVL_PUBLIC int64_t
3899 gavl_frame_table_timecode_to_time(const gavl_frame_table_t * t,
3900 gavl_timecode_t tc,
3901 const gavl_timecode_format_t * fmt);
3902
3903
3914GAVL_PUBLIC gavl_timecode_t
3915 gavl_frame_table_frame_to_timecode(const gavl_frame_table_t * t,
3916 int64_t frame,
3917 int64_t * start_time,
3918 const gavl_timecode_format_t * fmt);
3919
3920
3921
3929GAVL_PUBLIC int64_t
3930 gavl_frame_table_num_frames(const gavl_frame_table_t * t);
3931
3939GAVL_PUBLIC int64_t
3940 gavl_frame_table_duration(const gavl_frame_table_t * t);
3941
3949GAVL_PUBLIC int64_t
3950 gavl_frame_table_end_time(const gavl_frame_table_t * t);
3951
3960GAVL_PUBLIC
3961 int gavl_frame_table_save(const gavl_frame_table_t * t,
3962 const char * filename);
3963
3971GAVL_PUBLIC
3972 gavl_frame_table_t * gavl_frame_table_load(const char * filename);
3973
3980GAVL_PUBLIC void
3981 gavl_frame_table_dump(const gavl_frame_table_t * t);
3982
3983
3984
3985
3986
3987
3993#ifdef __cplusplus
3994}
3995#endif
3996
3997#endif /* GAVL_H_INCLUDED */
gavl_video_options_set_deinterlace_mode
GAVL_PUBLIC void gavl_video_options_set_deinterlace_mode(gavl_video_options_t *opt, gavl_deinterlace_mode_t deinterlace_mode)
Set the deinterlace mode.
gavl_video_options_get_deinterlace_mode
GAVL_PUBLIC gavl_deinterlace_mode_t gavl_video_options_get_deinterlace_mode(gavl_video_options_t *opt)
Get the deinterlace mode.
gavl_accel_supported
GAVL_PUBLIC int gavl_accel_supported()
Get the supported acceleration flags.
gavl_audio_converter_get_options
GAVL_PUBLIC gavl_audio_options_t * gavl_audio_converter_get_options(gavl_audio_converter_t *cnv)
gets options of an audio converter
gavl_audio_converter_resample
GAVL_PUBLIC void gavl_audio_converter_resample(gavl_audio_converter_t *cnv, gavl_audio_frame_t *input_frame, gavl_audio_frame_t *output_frame, double ratio)
Convert audio.
gavl_audio_converter_destroy
GAVL_PUBLIC void gavl_audio_converter_destroy(gavl_audio_converter_t *cnv)
Destroys an audio converter and frees all associated memory.
gavl_audio_converter_create
GAVL_PUBLIC gavl_audio_converter_t * gavl_audio_converter_create()
Creates an audio converter.
gavl_audio_converter_t
struct gavl_audio_converter_s gavl_audio_converter_t
Opaque audio converter structure.
Definition: gavl.h:993
gavl_audio_convert
GAVL_PUBLIC void gavl_audio_convert(gavl_audio_converter_t *cnv, const gavl_audio_frame_t *input_frame, gavl_audio_frame_t *output_frame)
Convert audio.
gavl_audio_converter_init
GAVL_PUBLIC int gavl_audio_converter_init(gavl_audio_converter_t *cnv, const gavl_audio_format_t *input_format, const gavl_audio_format_t *output_format)
Initialize an audio converter.
gavl_audio_converter_init_resample
GAVL_PUBLIC int gavl_audio_converter_init_resample(gavl_audio_converter_t *cnv, const gavl_audio_format_t *format)
Initialize an audio converter just for resampling.
gavl_audio_converter_set_resample_ratio
GAVL_PUBLIC int gavl_audio_converter_set_resample_ratio(gavl_audio_converter_t *cnv, double ratio)
Set samplerate converstion ratio.
gavl_audio_converter_reinit
GAVL_PUBLIC int gavl_audio_converter_reinit(gavl_audio_converter_t *cnv)
Reinitialize an audio converter.
gavl_channel_id_t
gavl_channel_id_t
Audio channel setup.
Definition: gavl.h:236
gavl_sample_format_t
gavl_sample_format_t
Format of one audio sample.
Definition: gavl.h:205
gavl_audio_format_copy
GAVL_PUBLIC void gavl_audio_format_copy(gavl_audio_format_t *dst, const gavl_audio_format_t *src)
Copy one audio format to another.
gavl_channel_index
GAVL_PUBLIC int gavl_channel_index(const gavl_audio_format_t *format, gavl_channel_id_t id)
Get the index of a particular channel for a given format.
gavl_side_channels
GAVL_PUBLIC int gavl_side_channels(const gavl_audio_format_t *format)
Get number of side channels for a given format.
gavl_set_channel_setup
GAVL_PUBLIC void gavl_set_channel_setup(gavl_audio_format_t *format)
Set the default channel setup and indices.
gavl_lfe_channels
GAVL_PUBLIC int gavl_lfe_channels(const gavl_audio_format_t *format)
Get number of LFE channels for a given format.
gavl_get_sample_format
GAVL_PUBLIC gavl_sample_format_t gavl_get_sample_format(int index)
Get the sample format from index.
gavl_channel_id_to_string
GAVL_PUBLIC const char * gavl_channel_id_to_string(gavl_channel_id_t id)
Convert a gavl_channel_id_t to a human readable string.
gavl_sample_format_to_string
GAVL_PUBLIC const char * gavl_sample_format_to_string(gavl_sample_format_t format)
Convert a gavl_sample_format_t to a human readable string.
gavl_num_sample_formats
GAVL_PUBLIC int gavl_num_sample_formats()
Get total number of supported sample formats.
gavl_interleave_mode_t
gavl_interleave_mode_t
Definition: gavl.h:222
gavl_string_to_sample_format
GAVL_PUBLIC gavl_sample_format_t gavl_string_to_sample_format(const char *str)
Convert a string to a sample format.
gavl_front_channels
GAVL_PUBLIC int gavl_front_channels(const gavl_audio_format_t *format)
Get number of front channels for a given format.
gavl_bytes_per_sample
GAVL_PUBLIC int gavl_bytes_per_sample(gavl_sample_format_t format)
Get the number of bytes per sample for a given sample format.
gavl_audio_format_dump
GAVL_PUBLIC void gavl_audio_format_dump(const gavl_audio_format_t *format)
Dump an audio format to stderr.
gavl_aux_channels
GAVL_PUBLIC int gavl_aux_channels(const gavl_audio_format_t *format)
Get number of aux channels for a given format.
gavl_rear_channels
GAVL_PUBLIC int gavl_rear_channels(const gavl_audio_format_t *format)
Get number of rear channels for a given format.
gavl_interleave_mode_to_string
GAVL_PUBLIC const char * gavl_interleave_mode_to_string(gavl_interleave_mode_t mode)
Convert a gavl_interleave_mode_t to a human readable string.
gavl_audio_formats_equal
GAVL_PUBLIC int gavl_audio_formats_equal(const gavl_audio_format_t *format_1, const gavl_audio_format_t *format_2)
Compare 2 audio formats.
GAVL_MAX_CHANNELS
#define GAVL_MAX_CHANNELS
Maximum number of audio channels.
Definition: gavl.h:196
GAVL_CHID_SIDE_RIGHT
@ GAVL_CHID_SIDE_RIGHT
Definition: gavl.h:247
GAVL_CHID_FRONT_RIGHT
@ GAVL_CHID_FRONT_RIGHT
Definition: gavl.h:240
GAVL_CHID_FRONT_LEFT
@ GAVL_CHID_FRONT_LEFT
Definition: gavl.h:239
GAVL_CHID_REAR_LEFT
@ GAVL_CHID_REAR_LEFT
Definition: gavl.h:243
GAVL_CHID_SIDE_LEFT
@ GAVL_CHID_SIDE_LEFT
Definition: gavl.h:246
GAVL_CHID_NONE
@ GAVL_CHID_NONE
Definition: gavl.h:237
GAVL_CHID_FRONT_CENTER_LEFT
@ GAVL_CHID_FRONT_CENTER_LEFT
Definition: gavl.h:241
GAVL_CHID_REAR_CENTER
@ GAVL_CHID_REAR_CENTER
Definition: gavl.h:245
GAVL_CHID_LFE
@ GAVL_CHID_LFE
Definition: gavl.h:248
GAVL_CHID_REAR_RIGHT
@ GAVL_CHID_REAR_RIGHT
Definition: gavl.h:244
GAVL_CHID_AUX
@ GAVL_CHID_AUX
Definition: gavl.h:249
GAVL_CHID_FRONT_CENTER_RIGHT
@ GAVL_CHID_FRONT_CENTER_RIGHT
Definition: gavl.h:242
GAVL_CHID_FRONT_CENTER
@ GAVL_CHID_FRONT_CENTER
Definition: gavl.h:238
GAVL_SAMPLE_FLOAT
@ GAVL_SAMPLE_FLOAT
Definition: gavl.h:212
GAVL_SAMPLE_NONE
@ GAVL_SAMPLE_NONE
Definition: gavl.h:206
GAVL_SAMPLE_U8
@ GAVL_SAMPLE_U8
Definition: gavl.h:207
GAVL_SAMPLE_S8
@ GAVL_SAMPLE_S8
Definition: gavl.h:208
GAVL_SAMPLE_U16
@ GAVL_SAMPLE_U16
Definition: gavl.h:209
GAVL_SAMPLE_S16
@ GAVL_SAMPLE_S16
Definition: gavl.h:210
GAVL_SAMPLE_DOUBLE
@ GAVL_SAMPLE_DOUBLE
Definition: gavl.h:213
GAVL_SAMPLE_S32
@ GAVL_SAMPLE_S32
Definition: gavl.h:211
GAVL_INTERLEAVE_2
@ GAVL_INTERLEAVE_2
Definition: gavl.h:224
GAVL_INTERLEAVE_ALL
@ GAVL_INTERLEAVE_ALL
Definition: gavl.h:225
GAVL_INTERLEAVE_NONE
@ GAVL_INTERLEAVE_NONE
Definition: gavl.h:223
gavl_audio_frame_destroy
GAVL_PUBLIC void gavl_audio_frame_destroy(gavl_audio_frame_t *frame)
Destroy an audio frame.
gavl_audio_frame_mute
GAVL_PUBLIC void gavl_audio_frame_mute(gavl_audio_frame_t *frame, const gavl_audio_format_t *format)
Mute an audio frame.
gavl_audio_frame_null
GAVL_PUBLIC void gavl_audio_frame_null(gavl_audio_frame_t *frame)
Zero all pointers in the audio frame.
gavl_audio_frame_mute_samples
GAVL_PUBLIC void gavl_audio_frame_mute_samples(gavl_audio_frame_t *frame, const gavl_audio_format_t *format, int num_samples)
Mute a number of samples at the start of an audio frame.
gavl_audio_frame_copy
GAVL_PUBLIC int gavl_audio_frame_copy(const gavl_audio_format_t *format, gavl_audio_frame_t *dst, const gavl_audio_frame_t *src, int dst_pos, int src_pos, int dst_size, int src_size)
Copy audio data from one frame to another.
gavl_audio_frame_create
GAVL_PUBLIC gavl_audio_frame_t * gavl_audio_frame_create(const gavl_audio_format_t *format)
Create audio frame.
gavl_audio_frame_get_subframe
GAVL_PUBLIC void gavl_audio_frame_get_subframe(const gavl_audio_format_t *format, gavl_audio_frame_t *src, gavl_audio_frame_t *dst, int start, int len)
Set an audio frame to a subframe of another frame.
gavl_audio_frame_mute_channel
GAVL_PUBLIC void gavl_audio_frame_mute_channel(gavl_audio_frame_t *frame, const gavl_audio_format_t *format, int channel)
Mute a single channel of an audio frame.
gavl_audio_frame_plot
GAVL_PUBLIC int gavl_audio_frame_plot(const gavl_audio_format_t *format, const gavl_audio_frame_t *frame, const char *name_base)
Plot an audio frame to an ASCII file.
gavl_audio_frames_equal
GAVL_PUBLIC int gavl_audio_frames_equal(const gavl_audio_format_t *format, const gavl_audio_frame_t *f1, const gavl_audio_frame_t *f2)
Check if 2 audio frames are bit-identical.
gavl_audio_frame_copy_ptrs
GAVL_PUBLIC void gavl_audio_frame_copy_ptrs(const gavl_audio_format_t *format, gavl_audio_frame_t *dst, const gavl_audio_frame_t *src)
Copy audio data from one frame to another.
gavl_audio_options_t
struct gavl_audio_options_s gavl_audio_options_t
Opaque container for audio conversion options.
Definition: gavl.h:811
gavl_audio_options_set_resample_mode
GAVL_PUBLIC void gavl_audio_options_set_resample_mode(gavl_audio_options_t *opt, gavl_resample_mode_t mode)
Set the resample mode for the converter.
gavl_audio_options_get_mix_matrix
GAVL_PUBLIC const double ** gavl_audio_options_get_mix_matrix(gavl_audio_options_t *opt)
Get the mix matrix.
gavl_audio_options_get_quality
GAVL_PUBLIC int gavl_audio_options_get_quality(gavl_audio_options_t *opt)
Get the quality level for a converter.
gavl_audio_options_copy
GAVL_PUBLIC void gavl_audio_options_copy(gavl_audio_options_t *dst, const gavl_audio_options_t *src)
Copy audio options.
gavl_audio_options_get_dither_mode
GAVL_PUBLIC gavl_audio_dither_mode_t gavl_audio_options_get_dither_mode(gavl_audio_options_t *opt)
Get the dither mode for the converter.
gavl_audio_options_create
GAVL_PUBLIC gavl_audio_options_t * gavl_audio_options_create()
Create an options container.
gavl_audio_dither_mode_t
gavl_audio_dither_mode_t
Dither mode.
Definition: gavl.h:783
gavl_audio_options_set_conversion_flags
GAVL_PUBLIC void gavl_audio_options_set_conversion_flags(gavl_audio_options_t *opt, int flags)
Set the conversion flags.
gavl_audio_options_set_defaults
GAVL_PUBLIC void gavl_audio_options_set_defaults(gavl_audio_options_t *opt)
Set all options to their defaults.
gavl_audio_options_get_resample_mode
GAVL_PUBLIC gavl_resample_mode_t gavl_audio_options_get_resample_mode(gavl_audio_options_t *opt)
Get the resample mode for the converter.
gavl_audio_options_set_mix_matrix
GAVL_PUBLIC void gavl_audio_options_set_mix_matrix(gavl_audio_options_t *opt, const double **matrix)
Set a user defined mix matrix.
gavl_audio_options_set_dither_mode
GAVL_PUBLIC void gavl_audio_options_set_dither_mode(gavl_audio_options_t *opt, gavl_audio_dither_mode_t mode)
Set the dither mode for the converter.
gavl_resample_mode_t
gavl_resample_mode_t
Resample mode.
Definition: gavl.h:796
gavl_audio_options_get_conversion_flags
GAVL_PUBLIC int gavl_audio_options_get_conversion_flags(gavl_audio_options_t *opt)
Get the conversion flags.
gavl_audio_options_destroy
GAVL_PUBLIC void gavl_audio_options_destroy(gavl_audio_options_t *opt)
Destroy audio options.
gavl_audio_options_set_quality
GAVL_PUBLIC void gavl_audio_options_set_quality(gavl_audio_options_t *opt, int quality)
Set the quality level for the converter.
GAVL_RESAMPLE_SINC_BEST
@ GAVL_RESAMPLE_SINC_BEST
Definition: gavl.h:802
GAVL_RESAMPLE_ZOH
@ GAVL_RESAMPLE_ZOH
Definition: gavl.h:798
GAVL_RESAMPLE_LINEAR
@ GAVL_RESAMPLE_LINEAR
Definition: gavl.h:799
GAVL_RESAMPLE_AUTO
@ GAVL_RESAMPLE_AUTO
Definition: gavl.h:797
GAVL_RESAMPLE_SINC_MEDIUM
@ GAVL_RESAMPLE_SINC_MEDIUM
Definition: gavl.h:801
GAVL_RESAMPLE_SINC_FAST
@ GAVL_RESAMPLE_SINC_FAST
Definition: gavl.h:800
gavl_frame_table_save
GAVL_PUBLIC int gavl_frame_table_save(const gavl_frame_table_t *t, const char *filename)
Save a frame table to a file.
gavl_frame_table_end_time
GAVL_PUBLIC int64_t gavl_frame_table_end_time(const gavl_frame_table_t *t)
get the end time of the last frame
gavl_frame_table_load
GAVL_PUBLIC gavl_frame_table_t * gavl_frame_table_load(const char *filename)
Load a frame table from a file.
gavl_frame_table_frame_to_time
GAVL_PUBLIC int64_t gavl_frame_table_frame_to_time(const gavl_frame_table_t *t, int64_t frame, int *duration)
Convert a frame index to a timestamp.
gavl_frame_table_frame_to_timecode
GAVL_PUBLIC gavl_timecode_t gavl_frame_table_frame_to_timecode(const gavl_frame_table_t *t, int64_t frame, int64_t *start_time, const gavl_timecode_format_t *fmt)
Convert a frame index to a timecode.
gavl_frame_table_dump
GAVL_PUBLIC void gavl_frame_table_dump(const gavl_frame_table_t *t)
Dump a frame table to stderr for debugging.
gavl_frame_table_time_to_timecode
GAVL_PUBLIC gavl_timecode_t gavl_frame_table_time_to_timecode(const gavl_frame_table_t *t, int64_t time, int64_t *start_time, const gavl_timecode_format_t *fmt)
Convert a timestamp to a timecode.
gavl_frame_table_time_to_frame
GAVL_PUBLIC int64_t gavl_frame_table_time_to_frame(const gavl_frame_table_t *t, int64_t time, int64_t *start_time)
Convert a timestamp to a frame index.
gavl_frame_table_duration
GAVL_PUBLIC int64_t gavl_frame_table_duration(const gavl_frame_table_t *t)
get the total duration of all frames
gavl_frame_table_destroy
GAVL_PUBLIC void gavl_frame_table_destroy(gavl_frame_table_t *t)
Destroy a frame table and free all memory.
gavl_frame_table_num_frames
GAVL_PUBLIC int64_t gavl_frame_table_num_frames(const gavl_frame_table_t *t)
get the total number of frames
gavl_frame_table_create_cfr
GAVL_PUBLIC gavl_frame_table_t * gavl_frame_table_create_cfr(int64_t offset, int64_t frame_duration, int64_t num_frames, gavl_timecode_t start_timecode)
Create a frame table for constant framerate video.
gavl_frame_table_append_entry
GAVL_PUBLIC void gavl_frame_table_append_entry(gavl_frame_table_t *t, int64_t duration)
Append an entry.
gavl_frame_table_append_timecode
GAVL_PUBLIC void gavl_frame_table_append_timecode(gavl_frame_table_t *t, int64_t pts, gavl_timecode_t tc)
Append a timecodes.
gavl_frame_table_create
GAVL_PUBLIC gavl_frame_table_t * gavl_frame_table_create()
Create a frame table.
gavl_frame_table_create_audio
GAVL_PUBLIC gavl_frame_table_t * gavl_frame_table_create_audio(int samplerate, int64_t offset, int64_t duration, gavl_timecode_format_t *fmt_ret)
Create a frame table for an audio stream.
gavl_frame_table_timecode_to_time
GAVL_PUBLIC int64_t gavl_frame_table_timecode_to_time(const gavl_frame_table_t *t, gavl_timecode_t tc, const gavl_timecode_format_t *fmt)
Convert a timecode to a timestamp.
gavl_frame_table_copy
GAVL_PUBLIC gavl_frame_table_t * gavl_frame_table_copy(const gavl_frame_table_t *tab)
Copy a frame table to another.
gavl_video_stop_func
void(* gavl_video_stop_func)(void *client_data, int thread)
Wait until a piece of a calculation finished.
Definition: gavl.h:92
gavl_video_process_func
void(* gavl_video_process_func)(void *data, int start, int end)
Prototype of a process function.
Definition: gavl.h:64
gavl_video_run_func
void(* gavl_video_run_func)(gavl_video_process_func func, void *gavl_data, int start, int end, void *client_data, int thread)
Run a piece of a calculation.
Definition: gavl.h:79
gavl_peak_detector_t
struct gavl_peak_detector_s gavl_peak_detector_t
Opaque structure for peak detector.
Definition: gavl.h:1221
gavl_peak_detector_get_peaks
GAVL_PUBLIC void gavl_peak_detector_get_peaks(gavl_peak_detector_t *pd, double *min, double *max, double *abs)
Get the peak volume for all channels separate.
gavl_peak_detector_create
GAVL_PUBLIC gavl_peak_detector_t * gavl_peak_detector_create()
Create peak detector.
gavl_peak_detector_set_format
GAVL_PUBLIC void gavl_peak_detector_set_format(gavl_peak_detector_t *pd, const gavl_audio_format_t *format)
Set format for a peak detector.
gavl_peak_detector_reset
GAVL_PUBLIC void gavl_peak_detector_reset(gavl_peak_detector_t *pd)
Reset a peak detector.
gavl_peak_detector_update
GAVL_PUBLIC void gavl_peak_detector_update(gavl_peak_detector_t *pd, gavl_audio_frame_t *frame)
Feed the peak detector with a new frame.
gavl_peak_detector_get_peak
GAVL_PUBLIC void gavl_peak_detector_get_peak(gavl_peak_detector_t *pd, double *min, double *max, double *abs)
Get the peak volume across all channels.
gavl_peak_detector_destroy
GAVL_PUBLIC void gavl_peak_detector_destroy(gavl_peak_detector_t *pd)
Destroys a peak detector and frees all associated memory.
gavl_rectangle_f_crop_bottom
GAVL_PUBLIC void gavl_rectangle_f_crop_bottom(gavl_rectangle_f_t *r, double num_pixels)
Crop a float rectangle by some pixels from the bottom border.
gavl_rectangle_f_is_empty
GAVL_PUBLIC int gavl_rectangle_f_is_empty(const gavl_rectangle_f_t *r)
Check if a float rectangle is empty.
gavl_rectangle_i_is_empty
GAVL_PUBLIC int gavl_rectangle_i_is_empty(const gavl_rectangle_i_t *r)
Check if an integer rectangle is empty.
gavl_rectangle_f_crop_left
GAVL_PUBLIC void gavl_rectangle_f_crop_left(gavl_rectangle_f_t *r, double num_pixels)
Crop a float rectangle by some pixels from the left border.
gavl_rectangle_i_align
GAVL_PUBLIC void gavl_rectangle_i_align(gavl_rectangle_i_t *r, int h_align, int v_align)
Align a rectangle.
gavl_rectangle_crop_to_format_scale
GAVL_PUBLIC void gavl_rectangle_crop_to_format_scale(gavl_rectangle_f_t *src_rect, gavl_rectangle_i_t *dst_rect, const gavl_video_format_t *src_format, const gavl_video_format_t *dst_format)
Crop 2 rectangles to their formats when scaling is available.
gavl_rectangle_i_copy
GAVL_PUBLIC void gavl_rectangle_i_copy(gavl_rectangle_i_t *dst, const gavl_rectangle_i_t *src)
Copy an integer rectangle.
gavl_rectangle_f_crop_right
GAVL_PUBLIC void gavl_rectangle_f_crop_right(gavl_rectangle_f_t *r, double num_pixels)
Crop a float rectangle by some pixels from the right border.
gavl_rectangle_i_dump
GAVL_PUBLIC void gavl_rectangle_i_dump(const gavl_rectangle_i_t *r)
Dump a rectangle to stderr.
gavl_rectangle_i_crop_top
GAVL_PUBLIC void gavl_rectangle_i_crop_top(gavl_rectangle_i_t *r, int num_pixels)
Crop an integer rectangle by some pixels from the top border.
gavl_rectangle_i_crop_to_format
GAVL_PUBLIC void gavl_rectangle_i_crop_to_format(gavl_rectangle_i_t *r, const gavl_video_format_t *format)
Crop an integer rectangle so it fits into the image size of a video format.
gavl_rectangle_crop_to_format_noscale
GAVL_PUBLIC void gavl_rectangle_crop_to_format_noscale(gavl_rectangle_i_t *src_rect, gavl_rectangle_i_t *dst_rect, const gavl_video_format_t *src_format, const gavl_video_format_t *dst_format)
Set 2 rectangles as source and destination when no scaling is available.
gavl_rectangle_fit_aspect
GAVL_PUBLIC void gavl_rectangle_fit_aspect(gavl_rectangle_i_t *dst_rect, const gavl_video_format_t *src_format, const gavl_rectangle_f_t *src_rect, const gavl_video_format_t *dst_format, float zoom, float squeeze)
Calculate a destination rectangle for scaling.
gavl_rectangle_i_to_f
GAVL_PUBLIC void gavl_rectangle_i_to_f(gavl_rectangle_f_t *dst, const gavl_rectangle_i_t *src)
Convert an integer rectangle to a floating point rectangle.
gavl_rectangle_i_set_all
GAVL_PUBLIC void gavl_rectangle_i_set_all(gavl_rectangle_i_t *r, const gavl_video_format_t *format)
Let an integer rectangle span the whole image size of a video format.
gavl_rectangle_f_set_all
GAVL_PUBLIC void gavl_rectangle_f_set_all(gavl_rectangle_f_t *r, const gavl_video_format_t *format)
Let a float rectangle span the whole image size of a video format.
gavl_rectangle_f_copy
GAVL_PUBLIC void gavl_rectangle_f_copy(gavl_rectangle_f_t *dst, const gavl_rectangle_f_t *src)
Copy a float rectangle.
gavl_rectangle_f_to_i
GAVL_PUBLIC void gavl_rectangle_f_to_i(gavl_rectangle_i_t *dst, const gavl_rectangle_f_t *src)
Convert a floating point rectangle to an integer rectangle.
gavl_rectangle_f_crop_top
GAVL_PUBLIC void gavl_rectangle_f_crop_top(gavl_rectangle_f_t *r, double num_pixels)
Crop a float rectangle by some pixels from the top border.
gavl_rectangle_f_dump
GAVL_PUBLIC void gavl_rectangle_f_dump(const gavl_rectangle_f_t *r)
Dump a floating point rectangle to stderr.
gavl_rectangle_i_crop_bottom
GAVL_PUBLIC void gavl_rectangle_i_crop_bottom(gavl_rectangle_i_t *r, int num_pixels)
Crop an integer rectangle by some pixels from the bottom border.
gavl_rectangle_i_align_to_format
GAVL_PUBLIC void gavl_rectangle_i_align_to_format(gavl_rectangle_i_t *r, const gavl_video_format_t *format)
Align a rectangle to a format.
gavl_rectangle_f_crop_to_format
GAVL_PUBLIC void gavl_rectangle_f_crop_to_format(gavl_rectangle_f_t *r, const gavl_video_format_t *format)
Crop a floating point rectangle so it fits into the image size of a video format.
gavl_rectangle_i_crop_left
GAVL_PUBLIC void gavl_rectangle_i_crop_left(gavl_rectangle_i_t *r, int num_pixels)
Crop an integer rectangle by some pixels from the left border.
gavl_rectangle_i_crop_right
GAVL_PUBLIC void gavl_rectangle_i_crop_right(gavl_rectangle_i_t *r, int num_pixels)
Crop an integer rectangle by some pixels from the right border.
gavl_timecode_t
uint64_t gavl_timecode_t
Typedef for timecodes.
Definition: timecode.h:43
gavl_overlay_blend
GAVL_PUBLIC void gavl_overlay_blend(gavl_overlay_blend_context_t *ctx, gavl_video_frame_t *dst_frame)
Blend overlay onto video frame.
gavl_overlay_blend_context_set_overlay
GAVL_PUBLIC void gavl_overlay_blend_context_set_overlay(gavl_overlay_blend_context_t *ctx, gavl_overlay_t *ovl)
Set a new overlay.
gavl_overlay_blend_context_init
GAVL_PUBLIC int gavl_overlay_blend_context_init(gavl_overlay_blend_context_t *ctx, const gavl_video_format_t *frame_format, gavl_video_format_t *overlay_format)
Initialize the blend context.
gavl_overlay_blend_context_create
GAVL_PUBLIC gavl_overlay_blend_context_t * gavl_overlay_blend_context_create()
Create a blend context.
gavl_overlay_blend_context_t
struct gavl_overlay_blend_context_s gavl_overlay_blend_context_t
Opaque blend context.
Definition: gavl.h:3541
gavl_overlay_blend_context_destroy
GAVL_PUBLIC void gavl_overlay_blend_context_destroy(gavl_overlay_blend_context_t *ctx)
Destroy a blend context and free all associated memory.
gavl_overlay_blend_context_get_options
GAVL_PUBLIC gavl_video_options_t * gavl_overlay_blend_context_get_options(gavl_overlay_blend_context_t *ctx)
Get options from a blend context.
gavl_video_converter_create
GAVL_PUBLIC gavl_video_converter_t * gavl_video_converter_create()
Creates a video converter.
gavl_video_converter_init
GAVL_PUBLIC int gavl_video_converter_init(gavl_video_converter_t *cnv, const gavl_video_format_t *input_format, const gavl_video_format_t *output_format)
Initialize a video converter.
gavl_video_converter_t
struct gavl_video_converter_s gavl_video_converter_t
Opaque video converter structure.
Definition: gavl.h:3220
gavl_video_convert
GAVL_PUBLIC void gavl_video_convert(gavl_video_converter_t *cnv, const gavl_video_frame_t *input_frame, gavl_video_frame_t *output_frame)
Convert video.
gavl_video_converter_reinit
GAVL_PUBLIC int gavl_video_converter_reinit(gavl_video_converter_t *cnv)
Reinitialize a video converter.
gavl_video_converter_destroy
GAVL_PUBLIC void gavl_video_converter_destroy(gavl_video_converter_t *cnv)
Destroys a video converter and frees all associated memory.
gavl_video_converter_get_options
GAVL_PUBLIC gavl_video_options_t * gavl_video_converter_get_options(gavl_video_converter_t *cnv)
gets options of a video converter
gavl_video_deinterlacer_init
GAVL_PUBLIC int gavl_video_deinterlacer_init(gavl_video_deinterlacer_t *deinterlacer, const gavl_video_format_t *src_format)
Initialize a video deinterlacer.
gavl_video_deinterlacer_t
struct gavl_video_deinterlacer_s gavl_video_deinterlacer_t
Opaque deinterlacer structure.
Definition: gavl.h:3436
gavl_video_deinterlacer_destroy
GAVL_PUBLIC void gavl_video_deinterlacer_destroy(gavl_video_deinterlacer_t *deinterlacer)
Destroy a video deinterlacer.
gavl_video_deinterlacer_get_options
GAVL_PUBLIC gavl_video_options_t * gavl_video_deinterlacer_get_options(gavl_video_deinterlacer_t *deinterlacer)
gets options of a deinterlacer
gavl_video_deinterlacer_deinterlace
GAVL_PUBLIC void gavl_video_deinterlacer_deinterlace(gavl_video_deinterlacer_t *deinterlacer, const gavl_video_frame_t *input_frame, gavl_video_frame_t *output_frame)
Deinterlace video.
gavl_video_deinterlacer_create
GAVL_PUBLIC gavl_video_deinterlacer_t * gavl_video_deinterlacer_create()
Create a video deinterlacer.
GAVL_PIXFMT_PLANAR
#define GAVL_PIXFMT_PLANAR
Definition: gavl.h:1644
GAVL_PIXFMT_ALPHA
#define GAVL_PIXFMT_ALPHA
Definition: gavl.h:1664
gavl_pixelformat_conversion_penalty
GAVL_PUBLIC int gavl_pixelformat_conversion_penalty(gavl_pixelformat_t src, gavl_pixelformat_t dst)
Get the conversion penalty for pixelformat conversions.
gavl_pixelformat_bytes_per_pixel
GAVL_PUBLIC int gavl_pixelformat_bytes_per_pixel(gavl_pixelformat_t pixelformat)
Get bytes per pixel for packed formats.
gavl_chroma_placement_t
gavl_chroma_placement_t
Chroma placement.
Definition: gavl.h:2048
GAVL_PIXFMT_GRAY
#define GAVL_PIXFMT_GRAY
Definition: gavl.h:1669
gavl_get_color_channel_format
GAVL_PUBLIC int gavl_get_color_channel_format(const gavl_video_format_t *frame_format, gavl_video_format_t *channel_format, gavl_color_channel_t ch)
Get the video format for extracting/merging one channel.
gavl_framerate_mode_t
gavl_framerate_mode_t
Framerate mode.
Definition: gavl.h:2070
gavl_video_formats_equal
GAVL_PUBLIC int gavl_video_formats_equal(const gavl_video_format_t *format_1, const gavl_video_format_t *format_2)
Compare 2 video formats.
gavl_video_format_get_chroma_offset
GAVL_PUBLIC void gavl_video_format_get_chroma_offset(const gavl_video_format_t *format, int field, int plane, float *off_x, float *off_y)
Get the chroma offsets relative to the luma samples.
gavl_pixelformat_to_string
GAVL_PUBLIC const char * gavl_pixelformat_to_string(gavl_pixelformat_t pixelformat)
Translate a pixelformat into a human readable string.
gavl_video_format_dump
GAVL_PUBLIC void gavl_video_format_dump(const gavl_video_format_t *format)
Dump a video format to stderr.
gavl_video_format_get_image_size
GAVL_PUBLIC int gavl_video_format_get_image_size(const gavl_video_format_t *format)
Get the unpadded image size.
gavl_get_pixelformat
GAVL_PUBLIC gavl_pixelformat_t gavl_get_pixelformat(int index)
Get the pixelformat from index.
gavl_interlace_mode_to_string
GAVL_PUBLIC const char * gavl_interlace_mode_to_string(gavl_interlace_mode_t mode)
Translate an interlace mode into a human readable string.
gavl_chroma_placement_to_string
GAVL_PUBLIC const char * gavl_chroma_placement_to_string(gavl_chroma_placement_t mode)
Translate a chroma placement into a human readable string.
gavl_string_to_pixelformat
GAVL_PUBLIC gavl_pixelformat_t gavl_string_to_pixelformat(const char *name)
Translate a pixelformat name into a pixelformat.
gavl_interlace_mode_t
gavl_interlace_mode_t
Interlace mode.
Definition: gavl.h:2093
GAVL_PIXFMT_RGB
#define GAVL_PIXFMT_RGB
Definition: gavl.h:1649
gavl_framerate_mode_to_string
GAVL_PUBLIC const char * gavl_framerate_mode_to_string(gavl_framerate_mode_t mode)
Translate a framerate mode into a human readable string.
gavl_pixelformat_bits_per_pixel
GAVL_PUBLIC int gavl_pixelformat_bits_per_pixel(gavl_pixelformat_t pixelformat)
Get the effective number of bits for one pixel.
GAVL_PIXFMT_YUV
#define GAVL_PIXFMT_YUV
Definition: gavl.h:1654
gavl_pixelformat_num_planes
GAVL_PUBLIC int gavl_pixelformat_num_planes(gavl_pixelformat_t pixelformat)
Get the number of planes.
gavl_color_channel_t
gavl_color_channel_t
Color channel definitions.
Definition: gavl.h:1853
gavl_num_pixelformats
GAVL_PUBLIC int gavl_num_pixelformats()
Get total number of supported pixelformats.
GAVL_PIXFMT_YUVJ
#define GAVL_PIXFMT_YUVJ
Definition: gavl.h:1659
gavl_video_format_fit_to_source
GAVL_PUBLIC void gavl_video_format_fit_to_source(gavl_video_format_t *dst, const gavl_video_format_t *src)
Set the image size of a destination format from a source format.
gavl_video_format_copy
GAVL_PUBLIC void gavl_video_format_copy(gavl_video_format_t *dst, const gavl_video_format_t *src)
Copy one video format to another.
gavl_pixelformat_get_best
GAVL_PUBLIC gavl_pixelformat_t gavl_pixelformat_get_best(gavl_pixelformat_t src, const gavl_pixelformat_t *dst_supported, int *penalty)
Get the best destination format for a given source format.
gavl_pixelformat_bytes_per_component
GAVL_PUBLIC int gavl_pixelformat_bytes_per_component(gavl_pixelformat_t pixelformat)
Get bytes per component for planar formats.
gavl_get_field_format
GAVL_PUBLIC void gavl_get_field_format(const gavl_video_format_t *frame_format, gavl_video_format_t *field_format, int field)
Get the video format of one field.
gavl_pixelformat_t
gavl_pixelformat_t
Pixelformat definition.
Definition: gavl.h:1676
gavl_pixelformat_chroma_sub
GAVL_PUBLIC void gavl_pixelformat_chroma_sub(gavl_pixelformat_t pixelformat, int *sub_h, int *sub_v)
Get the horizontal and vertical subsampling factors.
GAVL_CHROMA_PLACEMENT_DVPAL
@ GAVL_CHROMA_PLACEMENT_DVPAL
Definition: gavl.h:2051
GAVL_CHROMA_PLACEMENT_MPEG2
@ GAVL_CHROMA_PLACEMENT_MPEG2
Definition: gavl.h:2050
GAVL_CHROMA_PLACEMENT_DEFAULT
@ GAVL_CHROMA_PLACEMENT_DEFAULT
Definition: gavl.h:2049
GAVL_FRAMERATE_UNKNOWN
@ GAVL_FRAMERATE_UNKNOWN
Definition: gavl.h:2071
GAVL_FRAMERATE_CONSTANT
@ GAVL_FRAMERATE_CONSTANT
Definition: gavl.h:2072
GAVL_FRAMERATE_STILL
@ GAVL_FRAMERATE_STILL
Definition: gavl.h:2074
GAVL_FRAMERATE_VARIABLE
@ GAVL_FRAMERATE_VARIABLE
Definition: gavl.h:2073
GAVL_INTERLACE_MIXED_BOTTOM
@ GAVL_INTERLACE_MIXED_BOTTOM
Definition: gavl.h:2100
GAVL_INTERLACE_MIXED_TOP
@ GAVL_INTERLACE_MIXED_TOP
Definition: gavl.h:2099
GAVL_INTERLACE_NONE
@ GAVL_INTERLACE_NONE
Definition: gavl.h:2095
GAVL_INTERLACE_BOTTOM_FIRST
@ GAVL_INTERLACE_BOTTOM_FIRST
Definition: gavl.h:2097
GAVL_INTERLACE_UNKNOWN
@ GAVL_INTERLACE_UNKNOWN
Definition: gavl.h:2094
GAVL_INTERLACE_MIXED
@ GAVL_INTERLACE_MIXED
Definition: gavl.h:2098
GAVL_INTERLACE_TOP_FIRST
@ GAVL_INTERLACE_TOP_FIRST
Definition: gavl.h:2096
GAVL_CCH_Y
@ GAVL_CCH_Y
Luminance (also grayscale)
Definition: gavl.h:1857
GAVL_CCH_RED
@ GAVL_CCH_RED
Red.
Definition: gavl.h:1854
GAVL_CCH_CR
@ GAVL_CCH_CR
Chrominance red (aka V)
Definition: gavl.h:1859
GAVL_CCH_GREEN
@ GAVL_CCH_GREEN
Green.
Definition: gavl.h:1855
GAVL_CCH_ALPHA
@ GAVL_CCH_ALPHA
Transparency (or, to be more precise opacity)
Definition: gavl.h:1860
GAVL_CCH_CB
@ GAVL_CCH_CB
Chrominance blue (aka U)
Definition: gavl.h:1858
GAVL_CCH_BLUE
@ GAVL_CCH_BLUE
Blue.
Definition: gavl.h:1856
GAVL_YUVJ_420_P
@ GAVL_YUVJ_420_P
Definition: gavl.h:1790
GAVL_YUV_422_P
@ GAVL_YUV_422_P
Definition: gavl.h:1777
GAVL_BGR_24
@ GAVL_BGR_24
Definition: gavl.h:1726
GAVL_YUV_410_P
@ GAVL_YUV_410_P
Definition: gavl.h:1786
GAVL_RGB_48
@ GAVL_RGB_48
Definition: gavl.h:1739
GAVL_RGB_32
@ GAVL_RGB_32
Definition: gavl.h:1729
GAVL_YUV_420_P
@ GAVL_YUV_420_P
Definition: gavl.h:1774
GAVL_GRAYA_32
@ GAVL_GRAYA_32
Definition: gavl.h:1699
GAVL_YUVA_32
@ GAVL_YUVA_32
Definition: gavl.h:1759
GAVL_RGB_16
@ GAVL_RGB_16
Definition: gavl.h:1716
GAVL_UYVY
@ GAVL_UYVY
Definition: gavl.h:1756
GAVL_YUV_422_P_16
@ GAVL_YUV_422_P_16
Definition: gavl.h:1803
GAVL_YUV_444_P
@ GAVL_YUV_444_P
Definition: gavl.h:1780
GAVL_RGB_FLOAT
@ GAVL_RGB_FLOAT
Definition: gavl.h:1746
GAVL_YUVJ_422_P
@ GAVL_YUVJ_422_P
Definition: gavl.h:1793
GAVL_GRAY_8
@ GAVL_GRAY_8
Definition: gavl.h:1683
GAVL_RGB_24
@ GAVL_RGB_24
Definition: gavl.h:1723
GAVL_RGBA_64
@ GAVL_RGBA_64
Definition: gavl.h:1742
GAVL_YUY2
@ GAVL_YUY2
Definition: gavl.h:1753
GAVL_YUVA_FLOAT
@ GAVL_YUVA_FLOAT
Definition: gavl.h:1769
GAVL_YUVJ_444_P
@ GAVL_YUVJ_444_P
Definition: gavl.h:1796
GAVL_GRAYA_FLOAT
@ GAVL_GRAYA_FLOAT
Definition: gavl.h:1703
GAVL_BGR_15
@ GAVL_BGR_15
Definition: gavl.h:1712
GAVL_YUV_444_P_16
@ GAVL_YUV_444_P_16
Definition: gavl.h:1800
GAVL_PIXELFORMAT_NONE
@ GAVL_PIXELFORMAT_NONE
Undefined.
Definition: gavl.h:1679
GAVL_GRAYA_16
@ GAVL_GRAYA_16
Definition: gavl.h:1695
GAVL_YUV_411_P
@ GAVL_YUV_411_P
Definition: gavl.h:1783
GAVL_GRAY_FLOAT
@ GAVL_GRAY_FLOAT
Definition: gavl.h:1691
GAVL_YUV_FLOAT
@ GAVL_YUV_FLOAT
Definition: gavl.h:1765
GAVL_RGBA_32
@ GAVL_RGBA_32
Definition: gavl.h:1735
GAVL_GRAY_16
@ GAVL_GRAY_16
Definition: gavl.h:1687
GAVL_BGR_16
@ GAVL_BGR_16
Definition: gavl.h:1720
GAVL_YUVA_64
@ GAVL_YUVA_64
Definition: gavl.h:1762
GAVL_RGB_15
@ GAVL_RGB_15
Definition: gavl.h:1708
GAVL_RGBA_FLOAT
@ GAVL_RGBA_FLOAT
Definition: gavl.h:1749
GAVL_BGR_32
@ GAVL_BGR_32
Definition: gavl.h:1732
gavl_video_frame_copy
GAVL_PUBLIC void gavl_video_frame_copy(const gavl_video_format_t *format, gavl_video_frame_t *dst, const gavl_video_frame_t *src)
Copy one video frame to another.
gavl_video_frame_copy_plane
GAVL_PUBLIC void gavl_video_frame_copy_plane(const gavl_video_format_t *format, gavl_video_frame_t *dst, const gavl_video_frame_t *src, int plane)
Copy a single plane from one video frame to another.
gavl_video_frame_destroy
GAVL_PUBLIC void gavl_video_frame_destroy(gavl_video_frame_t *frame)
Destroy a video frame.
gavl_video_frame_copy_flip_x
GAVL_PUBLIC void gavl_video_frame_copy_flip_x(const gavl_video_format_t *format, gavl_video_frame_t *dst, const gavl_video_frame_t *src)
Copy one video frame to another with horizontal flipping.
gavl_video_frame_set_strides
GAVL_PUBLIC void gavl_video_frame_set_strides(gavl_video_frame_t *frame, const gavl_video_format_t *format)
Set the strides according to the format.
gavl_video_frame_get_subframe
GAVL_PUBLIC void gavl_video_frame_get_subframe(gavl_pixelformat_t pixelformat, const gavl_video_frame_t *src, gavl_video_frame_t *dst, gavl_rectangle_i_t *src_rect)
Get a subframe of another frame.
gavl_video_frame_insert_channel
GAVL_PUBLIC int gavl_video_frame_insert_channel(const gavl_video_format_t *format, gavl_color_channel_t ch, const gavl_video_frame_t *src, gavl_video_frame_t *dst)
Insert one channel from a grayscale image into a video frame.
gavl_video_frame_set_planes
GAVL_PUBLIC void gavl_video_frame_set_planes(gavl_video_frame_t *frame, const gavl_video_format_t *format, uint8_t *buffer)
Set the frames according to the format.
gavl_video_frame_copy_flip_xy
GAVL_PUBLIC void gavl_video_frame_copy_flip_xy(const gavl_video_format_t *format, gavl_video_frame_t *dst, const gavl_video_frame_t *src)
Copy one video frame to another with horizontal and vertical flipping.
gavl_video_frame_copy_metadata
GAVL_PUBLIC void gavl_video_frame_copy_metadata(gavl_video_frame_t *dst, const gavl_video_frame_t *src)
Copy metadata of one video frame to another.
gavl_video_frame_fill
GAVL_PUBLIC void gavl_video_frame_fill(gavl_video_frame_t *frame, const gavl_video_format_t *format, const float *color)
Fill the frame with a user spefified color.
gavl_video_frame_dump
GAVL_PUBLIC void gavl_video_frame_dump(gavl_video_frame_t *frame, const gavl_video_format_t *format, const char *namebase)
Dump a video frame to files.
gavl_video_frame_copy_flip_y
GAVL_PUBLIC void gavl_video_frame_copy_flip_y(const gavl_video_format_t *format, gavl_video_frame_t *dst, const gavl_video_frame_t *src)
Copy one video frame to another with vertical flipping.
gavl_video_frame_get_field
GAVL_PUBLIC void gavl_video_frame_get_field(gavl_pixelformat_t pixelformat, const gavl_video_frame_t *src, gavl_video_frame_t *dst, int field)
Get a field from a frame.
gavl_video_frame_psnr
GAVL_PUBLIC void gavl_video_frame_psnr(double *psnr, const gavl_video_frame_t *src1, const gavl_video_frame_t *src2, const gavl_video_format_t *format)
Calculate the PSNR of 2 source frames.
gavl_video_frame_absdiff
GAVL_PUBLIC void gavl_video_frame_absdiff(gavl_video_frame_t *dst, const gavl_video_frame_t *src1, const gavl_video_frame_t *src2, const gavl_video_format_t *format)
Fill the frame with the absolute differene of 2 source frames.
gavl_video_frame_ssim
GAVL_PUBLIC int gavl_video_frame_ssim(const gavl_video_frame_t *src1, const gavl_video_frame_t *src2, gavl_video_frame_t *dst, const gavl_video_format_t *format)
Calculate the SSIM of 2 source frames.
gavl_video_frame_extract_channel
GAVL_PUBLIC int gavl_video_frame_extract_channel(const gavl_video_format_t *format, gavl_color_channel_t ch, const gavl_video_frame_t *src, gavl_video_frame_t *dst)
Extract one channel of a video frame into a grayscale image.
gavl_video_frame_create
GAVL_PUBLIC gavl_video_frame_t * gavl_video_frame_create(const gavl_video_format_t *format)
Create video frame.
gavl_video_frame_null
GAVL_PUBLIC void gavl_video_frame_null(gavl_video_frame_t *frame)
Zero all pointers in the video frame.
gavl_video_frame_clear
GAVL_PUBLIC void gavl_video_frame_clear(gavl_video_frame_t *frame, const gavl_video_format_t *format)
Fill the frame with black color.
gavl_video_frames_equal
GAVL_PUBLIC int gavl_video_frames_equal(const gavl_video_format_t *format, const gavl_video_frame_t *f1, const gavl_video_frame_t *f2)
Check if 2 video frames are bit-identical.
gavl_video_frame_create_nopad
GAVL_PUBLIC gavl_video_frame_t * gavl_video_frame_create_nopad(const gavl_video_format_t *format)
Create video frame without padding.
gavl_video_options_set_run_func
GAVL_PUBLIC void gavl_video_options_set_run_func(gavl_video_options_t *opt, gavl_video_run_func func, void *client_data)
Set function to be passed to each thread.
gavl_video_options_set_quality
GAVL_PUBLIC void gavl_video_options_set_quality(gavl_video_options_t *opt, int quality)
Set the quality level for the converter.
gavl_video_options_set_alpha_mode
GAVL_PUBLIC void gavl_video_options_set_alpha_mode(gavl_video_options_t *opt, gavl_alpha_mode_t alpha_mode)
Set the alpha mode.
gavl_video_options_set_rectangles
GAVL_PUBLIC void gavl_video_options_set_rectangles(gavl_video_options_t *opt, const gavl_rectangle_f_t *src_rect, const gavl_rectangle_i_t *dst_rect)
Set source and destination rectangles.
gavl_video_options_destroy
GAVL_PUBLIC void gavl_video_options_destroy(gavl_video_options_t *opt)
Destroy video options.
gavl_video_options_get_quality
GAVL_PUBLIC int gavl_video_options_get_quality(gavl_video_options_t *opt)
Get the quality level for the converter.
gavl_video_options_get_background_color
GAVL_PUBLIC void gavl_video_options_get_background_color(gavl_video_options_t *opt, float *color)
Get the background color for alpha blending.
gavl_video_options_set_num_threads
GAVL_PUBLIC void gavl_video_options_set_num_threads(gavl_video_options_t *opt, int n)
Set number of threads.
gavl_video_options_set_scale_mode
GAVL_PUBLIC void gavl_video_options_set_scale_mode(gavl_video_options_t *opt, gavl_scale_mode_t scale_mode)
Set the scale mode.
gavl_deinterlace_mode_t
gavl_deinterlace_mode_t
Definition: gavl.h:2761
gavl_video_options_get_num_threads
GAVL_PUBLIC int gavl_video_options_get_num_threads(gavl_video_options_t *opt)
Set number of threads.
gavl_video_options_copy
GAVL_PUBLIC void gavl_video_options_copy(gavl_video_options_t *dst, const gavl_video_options_t *src)
Copy video options.
gavl_video_options_get_rectangles
GAVL_PUBLIC void gavl_video_options_get_rectangles(gavl_video_options_t *opt, gavl_rectangle_f_t *src_rect, gavl_rectangle_i_t *dst_rect)
Get source and destination rectangles.
gavl_deinterlace_drop_mode_t
gavl_deinterlace_drop_mode_t
Specifies which field to drop when deinterlacing.
Definition: gavl.h:2775
gavl_video_options_create
GAVL_PUBLIC gavl_video_options_t * gavl_video_options_create()
Create an options container.
gavl_video_options_get_downscale_filter
GAVL_PUBLIC gavl_downscale_filter_t gavl_video_options_get_downscale_filter(gavl_video_options_t *opt)
Get the antialiasing filter for downscaling.
gavl_video_options_t
struct gavl_video_options_s gavl_video_options_t
Definition: gavl.h:2820
gavl_video_options_get_alpha_mode
GAVL_PUBLIC gavl_alpha_mode_t gavl_video_options_get_alpha_mode(gavl_video_options_t *opt)
Get the alpha mode.
gavl_video_options_get_scale_mode
GAVL_PUBLIC gavl_scale_mode_t gavl_video_options_get_scale_mode(gavl_video_options_t *opt)
Get the scale mode.
gavl_video_options_get_run_func
GAVL_PUBLIC gavl_video_run_func gavl_video_options_get_run_func(gavl_video_options_t *opt, void **client_data)
Get function to be passed to each thread.
gavl_alpha_mode_t
gavl_alpha_mode_t
Definition: gavl.h:2749
gavl_video_options_set_background_color
GAVL_PUBLIC void gavl_video_options_set_background_color(gavl_video_options_t *opt, const float *color)
Set the background color for alpha blending.
gavl_video_options_set_deinterlace_drop_mode
GAVL_PUBLIC void gavl_video_options_set_deinterlace_drop_mode(gavl_video_options_t *opt, gavl_deinterlace_drop_mode_t deinterlace_drop_mode)
Set the deinterlace drop mode.
gavl_video_options_get_downscale_blur
GAVL_PUBLIC float gavl_video_options_get_downscale_blur(gavl_video_options_t *opt)
Get blur factor for downscaling.
gavl_video_options_set_stop_func
GAVL_PUBLIC void gavl_video_options_set_stop_func(gavl_video_options_t *opt, gavl_video_stop_func func, void *client_data)
Set function to be passed to each thread.
gavl_video_options_get_deinterlace_drop_mode
GAVL_PUBLIC gavl_deinterlace_drop_mode_t gavl_video_options_get_deinterlace_drop_mode(gavl_video_options_t *opt)
Get the deinterlace drop mode.
gavl_video_options_set_defaults
GAVL_PUBLIC void gavl_video_options_set_defaults(gavl_video_options_t *opt)
Set all options to their defaults.
gavl_video_options_set_conversion_flags
GAVL_PUBLIC void gavl_video_options_set_conversion_flags(gavl_video_options_t *opt, int conversion_flags)
Set the conversion flags.
gavl_scale_mode_t
gavl_scale_mode_t
Definition: gavl.h:2785
gavl_video_options_set_downscale_blur
GAVL_PUBLIC void gavl_video_options_set_downscale_blur(gavl_video_options_t *opt, float f)
Set blur factor for downscaling.
gavl_video_options_get_scale_order
GAVL_PUBLIC int gavl_video_options_get_scale_order(gavl_video_options_t *opt)
Get the scale order for GAVL_SCALE_SINC_LANCZOS.
gavl_video_options_set_downscale_filter
GAVL_PUBLIC void gavl_video_options_set_downscale_filter(gavl_video_options_t *opt, gavl_downscale_filter_t f)
Set antialiasing filter for downscaling.
gavl_video_options_get_conversion_flags
GAVL_PUBLIC int gavl_video_options_get_conversion_flags(gavl_video_options_t *opt)
Get the conversion flags.
gavl_video_options_set_scale_order
GAVL_PUBLIC void gavl_video_options_set_scale_order(gavl_video_options_t *opt, int order)
Set the scale order for GAVL_SCALE_SINC_LANCZOS.
gavl_video_options_get_stop_func
GAVL_PUBLIC gavl_video_stop_func gavl_video_options_get_stop_func(gavl_video_options_t *opt, void **client_data)
Get function to be passed to each thread.
gavl_downscale_filter_t
gavl_downscale_filter_t
Definition: gavl.h:2807
GAVL_DEINTERLACE_NONE
@ GAVL_DEINTERLACE_NONE
Definition: gavl.h:2762
GAVL_DEINTERLACE_SCALE
@ GAVL_DEINTERLACE_SCALE
Definition: gavl.h:2764
GAVL_DEINTERLACE_BLEND
@ GAVL_DEINTERLACE_BLEND
Definition: gavl.h:2765
GAVL_DEINTERLACE_COPY
@ GAVL_DEINTERLACE_COPY
Definition: gavl.h:2763
GAVL_DEINTERLACE_DROP_TOP
@ GAVL_DEINTERLACE_DROP_TOP
Definition: gavl.h:2776
GAVL_DEINTERLACE_DROP_BOTTOM
@ GAVL_DEINTERLACE_DROP_BOTTOM
Definition: gavl.h:2777
GAVL_ALPHA_IGNORE
@ GAVL_ALPHA_IGNORE
Definition: gavl.h:2750
GAVL_ALPHA_BLEND_COLOR
@ GAVL_ALPHA_BLEND_COLOR
Definition: gavl.h:2751
GAVL_SCALE_NONE
@ GAVL_SCALE_NONE
Definition: gavl.h:2794
GAVL_SCALE_NEAREST
@ GAVL_SCALE_NEAREST
Definition: gavl.h:2787
GAVL_SCALE_CUBIC_MITCHELL
@ GAVL_SCALE_CUBIC_MITCHELL
Definition: gavl.h:2791
GAVL_SCALE_AUTO
@ GAVL_SCALE_AUTO
Definition: gavl.h:2786
GAVL_SCALE_SINC_LANCZOS
@ GAVL_SCALE_SINC_LANCZOS
Definition: gavl.h:2793
GAVL_SCALE_CUBIC_CATMULL
@ GAVL_SCALE_CUBIC_CATMULL
Definition: gavl.h:2792
GAVL_SCALE_CUBIC_BSPLINE
@ GAVL_SCALE_CUBIC_BSPLINE
Definition: gavl.h:2790
GAVL_SCALE_QUADRATIC
@ GAVL_SCALE_QUADRATIC
Definition: gavl.h:2789
GAVL_SCALE_BILINEAR
@ GAVL_SCALE_BILINEAR
Definition: gavl.h:2788
GAVL_DOWNSCALE_FILTER_AUTO
@ GAVL_DOWNSCALE_FILTER_AUTO
Auto selection based on quality.
Definition: gavl.h:2808
GAVL_DOWNSCALE_FILTER_NONE
@ GAVL_DOWNSCALE_FILTER_NONE
Fastest method, might produce heavy aliasing artifacts.
Definition: gavl.h:2809
GAVL_DOWNSCALE_FILTER_WIDE
@ GAVL_DOWNSCALE_FILTER_WIDE
Widen the filter curve according to the scaling ratio.
Definition: gavl.h:2810
GAVL_DOWNSCALE_FILTER_GAUSS
@ GAVL_DOWNSCALE_FILTER_GAUSS
Do a Gaussian preblur.
Definition: gavl.h:2811
gavl_video_scaler_init
GAVL_PUBLIC int gavl_video_scaler_init(gavl_video_scaler_t *scaler, const gavl_video_format_t *src_format, const gavl_video_format_t *dst_format)
Initialize a video scaler.
gavl_video_scaler_destroy
GAVL_PUBLIC void gavl_video_scaler_destroy(gavl_video_scaler_t *scaler)
Destroy a video scaler.
gavl_video_scaler_get_options
GAVL_PUBLIC gavl_video_options_t * gavl_video_scaler_get_options(gavl_video_scaler_t *scaler)
gets options of a scaler
gavl_video_scaler_create
GAVL_PUBLIC gavl_video_scaler_t * gavl_video_scaler_create()
Create a video scaler.
gavl_video_scaler_t
struct gavl_video_scaler_s gavl_video_scaler_t
Opaque scaler structure.
Definition: gavl.h:3336
gavl_video_scaler_scale
GAVL_PUBLIC void gavl_video_scaler_scale(gavl_video_scaler_t *scaler, const gavl_video_frame_t *input_frame, gavl_video_frame_t *output_frame)
Scale video.
gavl_video_scaler_init_convolve
GAVL_PUBLIC int gavl_video_scaler_init_convolve(gavl_video_scaler_t *scaler, const gavl_video_format_t *format, int h_radius, const float *h_coeffs, int v_radius, const float *v_coeffs)
Initialize a video scaler as a generic convolver.
gavl_image_transform_destroy
GAVL_PUBLIC void gavl_image_transform_destroy(gavl_image_transform_t *t)
Destroy a transformation engine.
gavl_image_transform_init
GAVL_PUBLIC int gavl_image_transform_init(gavl_image_transform_t *t, gavl_video_format_t *format, gavl_image_transform_func func, void *priv)
Initialize a transformation engine.
gavl_image_transform_get_options
GAVL_PUBLIC gavl_video_options_t * gavl_image_transform_get_options(gavl_image_transform_t *t)
Get transformation options.
gavl_image_transform_t
struct gavl_image_transform_s gavl_image_transform_t
Opaque image transformation engine.
Definition: gavl.h:3632
gavl_image_transform_func
void(* gavl_image_transform_func)(void *priv, double xdst, double ydst, double *xsrc, double *ysrc)
Function describing the method.
Definition: gavl.h:3647
gavl_image_transform_transform
GAVL_PUBLIC void gavl_image_transform_transform(gavl_image_transform_t *t, gavl_video_frame_t *in_frame, gavl_video_frame_t *out_frame)
Transform an image.
gavl_image_transform_create
GAVL_PUBLIC gavl_image_transform_t * gavl_image_transform_create()
Create a transformation engine.
GAVL_MAX_PLANES
#define GAVL_MAX_PLANES
Definition: gavl.h:1315
gavl_volume_control_set_volume
GAVL_PUBLIC void gavl_volume_control_set_volume(gavl_volume_control_t *ctrl, float volume)
Set volume for a volume control.
gavl_volume_control_apply
GAVL_PUBLIC void gavl_volume_control_apply(gavl_volume_control_t *ctrl, gavl_audio_frame_t *frame)
Apply a volume control for an audio frame.
gavl_volume_control_create
GAVL_PUBLIC gavl_volume_control_t * gavl_volume_control_create()
Create volume control.
gavl_volume_control_destroy
GAVL_PUBLIC void gavl_volume_control_destroy(gavl_volume_control_t *ctrl)
Destroys a volume control and frees all associated memory.
gavl_volume_control_set_format
GAVL_PUBLIC void gavl_volume_control_set_format(gavl_volume_control_t *ctrl, const gavl_audio_format_t *format)
Set format for a volume control.
gavl_volume_control_t
struct gavl_volume_control_s gavl_volume_control_t
Opaque structure for a volume control.
Definition: gavl.h:1155
gavl_audio_format_t
Audio Format.
Definition: gavl.h:261
gavl_audio_format_t::samples_per_frame
int samples_per_frame
Definition: gavl.h:262
gavl_audio_format_t::rear_level
float rear_level
Definition: gavl.h:269
gavl_audio_format_t::interleave_mode
gavl_interleave_mode_t interleave_mode
Definition: gavl.h:266
gavl_audio_format_t::sample_format
gavl_sample_format_t sample_format
Definition: gavl.h:265
gavl_audio_format_t::center_level
float center_level
Definition: gavl.h:268
gavl_audio_format_t::samplerate
int samplerate
Definition: gavl.h:263
gavl_audio_format_t::num_channels
int num_channels
Definition: gavl.h:264
gavl_audio_frame_t
Generic container for audio samples.
Definition: gavl.h:515
gavl_audio_frame_t::channel_stride
int channel_stride
Definition: gavl.h:520
gavl_audio_frame_t::samples
gavl_audio_samples_t samples
Definition: gavl.h:516
gavl_audio_frame_t::valid_samples
int valid_samples
Definition: gavl.h:518
gavl_audio_frame_t::timestamp
int64_t timestamp
Definition: gavl.h:519
gavl_audio_frame_t::channels
gavl_audio_channels_t channels
Definition: gavl.h:517
gavl_frame_table_t
frame table structure
Definition: gavl.h:3742
gavl_frame_table_t::tc
gavl_timecode_t tc
Timecode associated with this timestamp.
Definition: gavl.h:3760
gavl_frame_table_t::num_timecodes
int num_timecodes
Number of timecodes.
Definition: gavl.h:3754
gavl_frame_table_t::num_frames
int64_t num_frames
Number of frames.
Definition: gavl.h:3750
gavl_frame_table_t::duration
int64_t duration
Duration of each of these frames.
Definition: gavl.h:3751
gavl_frame_table_t::offset
int64_t offset
Timestamp of the first frame.
Definition: gavl.h:3743
gavl_frame_table_t::entries_alloc
int64_t entries_alloc
Number of allocated entries (never touch this)
Definition: gavl.h:3746
gavl_frame_table_t::num_entries
int64_t num_entries
Number of entries.
Definition: gavl.h:3745
gavl_frame_table_t::pts
int64_t pts
Timestamp of this frame.
Definition: gavl.h:3759
gavl_frame_table_t::timecodes_alloc
int timecodes_alloc
Number of allocated timecodes (never touch this)
Definition: gavl.h:3755
gavl_overlay_t
Overlay structure.
Definition: gavl.h:3528
gavl_overlay_t::frame
gavl_video_frame_t * frame
Video frame in an alpha capable format *‍/.
Definition: gavl.h:3529
gavl_overlay_t::dst_y
int dst_y
y offset in the destination frame. *‍/
Definition: gavl.h:3532
gavl_overlay_t::ovl_rect
gavl_rectangle_i_t ovl_rect
Rectangle in the source frame *‍/.
Definition: gavl.h:3530
gavl_overlay_t::dst_x
int dst_x
x offset in the destination frame. *‍/
Definition: gavl.h:3531
gavl_rectangle_f_t
Definition: gavl.h:1340
gavl_rectangle_f_t::x
double x
Definition: gavl.h:1341
gavl_rectangle_f_t::y
double y
Definition: gavl.h:1342
gavl_rectangle_f_t::w
double w
Definition: gavl.h:1343
gavl_rectangle_f_t::h
double h
Definition: gavl.h:1344
gavl_rectangle_i_t
Definition: gavl.h:1328
gavl_rectangle_i_t::x
int x
Definition: gavl.h:1329
gavl_rectangle_i_t::h
int h
Definition: gavl.h:1332
gavl_rectangle_i_t::y
int y
Definition: gavl.h:1330
gavl_rectangle_i_t::w
int w
Definition: gavl.h:1331
gavl_timecode_format_t
Timecode format.
Definition: timecode.h:60
gavl_video_format_s
Video format.
Definition: gavl.h:2120
gavl_video_format_s::chroma_placement
gavl_chroma_placement_t chroma_placement
Definition: gavl.h:2139
gavl_video_format_s::timescale
int timescale
Definition: gavl.h:2136
gavl_video_format_s::interlace_mode
gavl_interlace_mode_t interlace_mode
Definition: gavl.h:2141
gavl_video_format_s::framerate_mode
gavl_framerate_mode_t framerate_mode
Definition: gavl.h:2138
gavl_video_format_s::pixel_height
int pixel_height
Definition: gavl.h:2130
gavl_video_format_s::frame_width
int frame_width
Definition: gavl.h:2121
gavl_video_format_s::frame_duration
int frame_duration
Definition: gavl.h:2134
gavl_video_format_s::frame_height
int frame_height
Definition: gavl.h:2122
gavl_video_format_s::image_width
int image_width
Definition: gavl.h:2124
gavl_video_format_s::pixel_width
int pixel_width
Definition: gavl.h:2129
gavl_video_format_s::pixelformat
gavl_pixelformat_t pixelformat
Definition: gavl.h:2132
gavl_video_format_s::timecode_format
gavl_timecode_format_t timecode_format
Definition: gavl.h:2143
gavl_video_format_s::image_height
int image_height
Definition: gavl.h:2125
gavl_video_frame_t
Definition: gavl.h:2285
gavl_video_frame_t::user_data
void * user_data
Definition: gavl.h:2289
gavl_video_frame_t::interlace_mode
gavl_interlace_mode_t interlace_mode
Definition: gavl.h:2292
gavl_video_frame_t::timecode
gavl_timecode_t timecode
Definition: gavl.h:2293
gavl_video_frame_t::timestamp
int64_t timestamp
Definition: gavl.h:2290
gavl_video_frame_t::duration
int64_t duration
Definition: gavl.h:2291
gavl_audio_channels_t
Container for noninterleaved audio samples.
Definition: gavl.h:483
gavl_audio_samples_t
Container for interleaved audio samples.
Definition: gavl.h:463
gavl_audio_samples_t::u_32
uint32_t * u_32
Definition: gavl.h:470
gavl_audio_samples_t::s_8
int8_t * s_8
Definition: gavl.h:465
gavl_audio_samples_t::u_16
uint16_t * u_16
Definition: gavl.h:467
gavl_audio_samples_t::s_16
int16_t * s_16
Definition: gavl.h:468
gavl_audio_samples_t::u_8
uint8_t * u_8
Definition: gavl.h:464
gavl_audio_samples_t::f
float * f
Definition: gavl.h:473
gavl_audio_samples_t::d
double * d
Definition: gavl.h:474
gavl_audio_samples_t::s_32
int32_t * s_32
Definition: gavl.h:471