gavl.h

Go to the documentation of this file.
00001 /*****************************************************************
00002  * gavl - a general purpose audio/video processing library
00003  *
00004  * Copyright (c) 2001 - 2008 Members of the Gmerlin project
00005  * gmerlin-general@lists.sourceforge.net
00006  * http://gmerlin.sourceforge.net
00007  *
00008  * This program is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00020  * *****************************************************************/
00021 
00027 #ifndef GAVL_H_INCLUDED
00028 #define GAVL_H_INCLUDED
00029 
00030 #include <inttypes.h>
00031 
00032 #include <gavl/gavldefs.h>
00033 #include <gavl/gavltime.h>
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038 
00039 #include <gavl/timecode.h>
00040 
00041 
00064 typedef void (*gavl_video_process_func)(void * data, int start, int end);
00065 
00079 typedef void (*gavl_video_run_func)(gavl_video_process_func func,
00080                                     void * gavl_data,
00081                                     int start, int end,
00082                                     void * client_data, int thread);
00083 
00092 typedef void (*gavl_video_stop_func)(void * client_data, int thread);
00093   
00102 typedef struct gavl_video_format_s gavl_video_format_t;
00103 
00104   
00105 /* Quality levels */
00106   
00130 #define GAVL_QUALITY_FASTEST 1
00131 
00138 #define GAVL_QUALITY_BEST    5 
00139 
00146 #define GAVL_QUALITY_DEFAULT 2 
00147 
00159 #define GAVL_ACCEL_MMX      (1<<0) 
00160 #define GAVL_ACCEL_MMXEXT   (1<<1) 
00161 #define GAVL_ACCEL_SSE      (1<<2) 
00162 #define GAVL_ACCEL_SSE2     (1<<3) 
00163 #define GAVL_ACCEL_SSE3     (1<<4) 
00164 #define GAVL_ACCEL_3DNOW    (1<<5) 
00165 #define GAVL_ACCEL_3DNOWEXT (1<<6) 
00166 #define GAVL_ACCEL_SSSE3    (1<<7) 
00167 
00168 
00172 GAVL_PUBLIC int gavl_accel_supported();
00173 
00182 /* Sample formats: all multibyte numbers are native endian */
00183 
00196 #define GAVL_MAX_CHANNELS 128
00197   
00204 typedef enum
00205   {
00206     GAVL_SAMPLE_NONE   = 0, 
00207     GAVL_SAMPLE_U8     = 1, 
00208     GAVL_SAMPLE_S8     = 2, 
00209     GAVL_SAMPLE_U16    = 3, 
00210     GAVL_SAMPLE_S16    = 4, 
00211     GAVL_SAMPLE_S32    = 5, 
00212     GAVL_SAMPLE_FLOAT  = 6,  
00213     GAVL_SAMPLE_DOUBLE = 7  
00214   } gavl_sample_format_t;
00215 
00221 typedef enum
00222   {
00223     GAVL_INTERLEAVE_NONE = 0, 
00224     GAVL_INTERLEAVE_2    = 1, 
00225     GAVL_INTERLEAVE_ALL  = 2  
00226   } gavl_interleave_mode_t;
00227 
00235 typedef enum
00236   {
00237     GAVL_CHID_NONE         = 0,   
00238     GAVL_CHID_FRONT_CENTER,       
00239     GAVL_CHID_FRONT_LEFT,         
00240     GAVL_CHID_FRONT_RIGHT,        
00241     GAVL_CHID_FRONT_CENTER_LEFT,  
00242     GAVL_CHID_FRONT_CENTER_RIGHT, 
00243     GAVL_CHID_REAR_LEFT,          
00244     GAVL_CHID_REAR_RIGHT,         
00245     GAVL_CHID_REAR_CENTER,        
00246     GAVL_CHID_SIDE_LEFT,          
00247     GAVL_CHID_SIDE_RIGHT,         
00248     GAVL_CHID_LFE,                
00249     GAVL_CHID_AUX,                
00250   } gavl_channel_id_t;
00251 
00260 typedef struct 
00261   {
00262   int samples_per_frame;  
00263   int samplerate;         
00264   int num_channels;         
00265   gavl_sample_format_t   sample_format; 
00266   gavl_interleave_mode_t interleave_mode; 
00268   float center_level; 
00269   float rear_level;   
00271   gavl_channel_id_t channel_locations[GAVL_MAX_CHANNELS];   
00273   } gavl_audio_format_t;
00274 
00275   
00276 /* Audio format -> string conversions */
00277 
00285 GAVL_PUBLIC 
00286 const char * gavl_sample_format_to_string(gavl_sample_format_t format);
00287 
00296 GAVL_PUBLIC 
00297 gavl_sample_format_t gavl_string_to_sample_format(const char * str);
00298 
00304 GAVL_PUBLIC 
00305 int gavl_num_sample_formats();
00306 
00313 GAVL_PUBLIC
00314 gavl_sample_format_t gavl_get_sample_format(int index);
00315   
00322 GAVL_PUBLIC
00323 const char * gavl_channel_id_to_string(gavl_channel_id_t id);
00324 
00325 
00332 GAVL_PUBLIC
00333 const char * gavl_interleave_mode_to_string(gavl_interleave_mode_t mode);
00334 
00341 GAVL_PUBLIC
00342 void gavl_audio_format_dump(const gavl_audio_format_t * format);
00343 
00352 GAVL_PUBLIC
00353 int gavl_channel_index(const gavl_audio_format_t * format, gavl_channel_id_t id);
00354 
00361 GAVL_PUBLIC
00362 int gavl_front_channels(const gavl_audio_format_t * format);
00363 
00370 GAVL_PUBLIC
00371 int gavl_rear_channels(const gavl_audio_format_t * format);
00372 
00379 GAVL_PUBLIC
00380 int gavl_side_channels(const gavl_audio_format_t * format);
00381 
00388 GAVL_PUBLIC
00389 int gavl_aux_channels(const gavl_audio_format_t * format);
00390 
00391   
00392   
00399 GAVL_PUBLIC
00400 int gavl_lfe_channels(const gavl_audio_format_t * format);
00401 
00409 GAVL_PUBLIC
00410 void gavl_audio_format_copy(gavl_audio_format_t * dst,
00411                             const gavl_audio_format_t * src);
00412 
00421 GAVL_PUBLIC
00422 int gavl_audio_formats_equal(const gavl_audio_format_t * format_1,
00423                               const gavl_audio_format_t * format_2);
00424 
00436 GAVL_PUBLIC
00437 void gavl_set_channel_setup(gavl_audio_format_t * format);
00438 
00445 GAVL_PUBLIC
00446 int gavl_bytes_per_sample(gavl_sample_format_t format);
00447 
00462 typedef union 
00463   {
00464   uint8_t * u_8; 
00465   int8_t *  s_8; 
00467   uint16_t * u_16; 
00468   int16_t  * s_16; 
00470   uint32_t * u_32; 
00471   int32_t  * s_32; 
00473   float * f; 
00474   double * d; 
00475   } gavl_audio_samples_t;
00476 
00482 typedef union
00483   {
00484   uint8_t * u_8[GAVL_MAX_CHANNELS];
00485   int8_t *  s_8[GAVL_MAX_CHANNELS];
00487   uint16_t * u_16[GAVL_MAX_CHANNELS];
00488   int16_t  * s_16[GAVL_MAX_CHANNELS];
00490   uint32_t * u_32[GAVL_MAX_CHANNELS];
00491   int32_t  * s_32[GAVL_MAX_CHANNELS];
00493   float * f[GAVL_MAX_CHANNELS];
00494   double * d[GAVL_MAX_CHANNELS];
00496   } gavl_audio_channels_t;
00497 
00514 typedef struct 
00515   {
00516   gavl_audio_samples_t  samples; 
00517   gavl_audio_channels_t channels;
00518   int valid_samples;             
00519   int64_t timestamp;             
00520   int channel_stride;            
00521   } gavl_audio_frame_t;
00522 
00534 GAVL_PUBLIC
00535 gavl_audio_frame_t * gavl_audio_frame_create(const gavl_audio_format_t* format);
00536 
00548 GAVL_PUBLIC
00549 void gavl_audio_frame_null(gavl_audio_frame_t * frame);
00550 
00560 GAVL_PUBLIC
00561 void gavl_audio_frame_destroy(gavl_audio_frame_t * frame);
00562 
00572 GAVL_PUBLIC
00573 void gavl_audio_frame_mute(gavl_audio_frame_t * frame,
00574                            const gavl_audio_format_t * format);
00575 
00586 GAVL_PUBLIC
00587 void gavl_audio_frame_mute_samples(gavl_audio_frame_t * frame,
00588                                    const gavl_audio_format_t * format,
00589                                    int num_samples);
00590 
00591   
00592   
00603 GAVL_PUBLIC
00604 void gavl_audio_frame_mute_channel(gavl_audio_frame_t * frame,
00605                                    const gavl_audio_format_t * format,
00606                                    int channel);
00607   
00628 GAVL_PUBLIC
00629 int gavl_audio_frame_copy(const gavl_audio_format_t * format,
00630                           gavl_audio_frame_t * dst,
00631                           const gavl_audio_frame_t * src,
00632                           int dst_pos,
00633                           int src_pos,
00634                           int dst_size,
00635                           int src_size);
00636 
00649 GAVL_PUBLIC
00650 void gavl_audio_frame_copy_ptrs(const gavl_audio_format_t * format,
00651                                 gavl_audio_frame_t * dst,
00652                                 const gavl_audio_frame_t * src);
00653 
00654   
00669 #define GAVL_AUDIO_FRONT_TO_REAR_COPY (1<<0) 
00674 #define GAVL_AUDIO_FRONT_TO_REAR_MUTE (1<<1) 
00679 #define GAVL_AUDIO_FRONT_TO_REAR_DIFF (1<<2) 
00684 #define GAVL_AUDIO_FRONT_TO_REAR_MASK           \
00685 (GAVL_AUDIO_FRONT_TO_REAR_COPY | \
00686 GAVL_AUDIO_FRONT_TO_REAR_MUTE | \
00687  GAVL_AUDIO_FRONT_TO_REAR_DIFF) 
00689 /* Options for mixing stereo to mono */
00690   
00693 #define GAVL_AUDIO_STEREO_TO_MONO_LEFT  (1<<3) 
00696 #define GAVL_AUDIO_STEREO_TO_MONO_RIGHT (1<<4) 
00699 #define GAVL_AUDIO_STEREO_TO_MONO_MIX   (1<<5) 
00703 #define GAVL_AUDIO_STEREO_TO_MONO_MASK \
00704 (GAVL_AUDIO_STEREO_TO_MONO_LEFT | \
00705 GAVL_AUDIO_STEREO_TO_MONO_RIGHT | \
00706 GAVL_AUDIO_STEREO_TO_MONO_MIX) 
00712 typedef enum
00713   {
00714     GAVL_AUDIO_DITHER_NONE   = 0,
00715     GAVL_AUDIO_DITHER_AUTO   = 1,
00716     GAVL_AUDIO_DITHER_RECT   = 2,
00717     GAVL_AUDIO_DITHER_TRI    = 3,
00718     GAVL_AUDIO_DITHER_SHAPED = 4,
00719   } gavl_audio_dither_mode_t;
00720 
00725 typedef enum
00726   {
00727     GAVL_RESAMPLE_AUTO        = 0, 
00728     GAVL_RESAMPLE_ZOH         = 1, 
00729     GAVL_RESAMPLE_LINEAR      = 2, 
00730     GAVL_RESAMPLE_SINC_FAST   = 3, 
00731     GAVL_RESAMPLE_SINC_MEDIUM = 4, 
00732     GAVL_RESAMPLE_SINC_BEST   = 5  
00733   } gavl_resample_mode_t;
00734   
00741 typedef struct gavl_audio_options_s gavl_audio_options_t;
00742 
00749 GAVL_PUBLIC
00750 void gavl_audio_options_set_quality(gavl_audio_options_t * opt, int quality);
00751 
00758 GAVL_PUBLIC
00759 int gavl_audio_options_get_quality(gavl_audio_options_t * opt);
00760   
00767 GAVL_PUBLIC
00768 void gavl_audio_options_set_dither_mode(gavl_audio_options_t * opt, gavl_audio_dither_mode_t mode);
00769 
00776 GAVL_PUBLIC
00777 gavl_audio_dither_mode_t gavl_audio_options_get_dither_mode(gavl_audio_options_t * opt);
00778 
00779   
00786 GAVL_PUBLIC
00787 void gavl_audio_options_set_resample_mode(gavl_audio_options_t * opt, gavl_resample_mode_t mode);
00788 
00795 GAVL_PUBLIC
00796 gavl_resample_mode_t gavl_audio_options_get_resample_mode(gavl_audio_options_t * opt);
00797   
00804 GAVL_PUBLIC
00805 void gavl_audio_options_set_conversion_flags(gavl_audio_options_t * opt,
00806                                              int flags);
00807   
00814 GAVL_PUBLIC
00815 int gavl_audio_options_get_conversion_flags(gavl_audio_options_t * opt);
00816 
00822 GAVL_PUBLIC
00823 void gavl_audio_options_set_defaults(gavl_audio_options_t * opt);
00824 
00834 GAVL_PUBLIC
00835 gavl_audio_options_t * gavl_audio_options_create();
00836 
00843 GAVL_PUBLIC
00844 void gavl_audio_options_copy(gavl_audio_options_t * dst,
00845                              const gavl_audio_options_t * src);
00846 
00852 GAVL_PUBLIC
00853 void gavl_audio_options_destroy(gavl_audio_options_t * opt);
00854   
00855   
00856   
00857 /* Audio converter */
00858 
00892 typedef struct gavl_audio_converter_s gavl_audio_converter_t;
00893   
00899 GAVL_PUBLIC
00900 gavl_audio_converter_t * gavl_audio_converter_create();
00901 
00907 GAVL_PUBLIC
00908 void gavl_audio_converter_destroy(gavl_audio_converter_t* cnv);
00909 
00918 GAVL_PUBLIC
00919 gavl_audio_options_t * gavl_audio_converter_get_options(gavl_audio_converter_t*cnv);
00920 
00921 
00936 GAVL_PUBLIC
00937 int gavl_audio_converter_init(gavl_audio_converter_t* cnv,
00938                               const gavl_audio_format_t * input_format,
00939                               const gavl_audio_format_t * output_format);
00940 
00955 GAVL_PUBLIC
00956 int gavl_audio_converter_init_resample(gavl_audio_converter_t * cnv,
00957                                    const gavl_audio_format_t * format);
00958 
00973 GAVL_PUBLIC
00974 int gavl_audio_converter_reinit(gavl_audio_converter_t* cnv);
00975 
00976   
00990 GAVL_PUBLIC
00991 void gavl_audio_convert(gavl_audio_converter_t * cnv,
00992                         const gavl_audio_frame_t * input_frame,
00993                         gavl_audio_frame_t * output_frame);
00994 
00995 
01014 GAVL_PUBLIC
01015 int gavl_audio_converter_set_resample_ratio(gavl_audio_converter_t * cnv, 
01016                 double ratio ) ;
01017 
01018 
01034 GAVL_PUBLIC
01035 void gavl_audio_converter_resample(gavl_audio_converter_t * cnv,
01036                               gavl_audio_frame_t * input_frame,
01037                               gavl_audio_frame_t * output_frame,
01038                               double ratio);
01039 
01040 
01054 typedef struct gavl_volume_control_s gavl_volume_control_t;
01055   
01056 /* Create / destroy */
01057 
01063 GAVL_PUBLIC
01064 gavl_volume_control_t * gavl_volume_control_create();
01065 
01071 GAVL_PUBLIC
01072 void gavl_volume_control_destroy(gavl_volume_control_t *ctrl);
01073 
01081 GAVL_PUBLIC
01082 void gavl_volume_control_set_format(gavl_volume_control_t *ctrl,
01083                                     const gavl_audio_format_t * format);
01084 
01091 GAVL_PUBLIC
01092 void gavl_volume_control_set_volume(gavl_volume_control_t * ctrl,
01093                                     float volume);
01094 
01101 GAVL_PUBLIC
01102 void gavl_volume_control_apply(gavl_volume_control_t *ctrl,
01103                                gavl_audio_frame_t * frame);
01104 
01120 typedef struct gavl_peak_detector_s gavl_peak_detector_t;
01121   
01122 /* Create / destroy */
01123 
01129 GAVL_PUBLIC
01130 gavl_peak_detector_t * gavl_peak_detector_create();
01131 
01137 GAVL_PUBLIC
01138 void gavl_peak_detector_destroy(gavl_peak_detector_t *pd);
01139 
01149 GAVL_PUBLIC
01150 void gavl_peak_detector_set_format(gavl_peak_detector_t *pd,
01151                                    const gavl_audio_format_t * format);
01152 
01159 GAVL_PUBLIC
01160 void gavl_peak_detector_update(gavl_peak_detector_t *pd,
01161                               gavl_audio_frame_t * frame);
01162   
01175 GAVL_PUBLIC
01176 void gavl_peak_detector_get_peak(gavl_peak_detector_t * pd,
01177                                  double * min, double * max,
01178                                  double * abs);
01179 
01192 GAVL_PUBLIC
01193 void gavl_peak_detector_get_peaks(gavl_peak_detector_t * pd,
01194                                   double * min, double * max,
01195                                   double * abs);
01196   
01202 GAVL_PUBLIC
01203 void gavl_peak_detector_reset(gavl_peak_detector_t * pd);
01204   
01214 #define GAVL_MAX_PLANES 4 
01226 typedef struct
01227   {
01228   int x; 
01229   int y; 
01230   int w; 
01231   int h; 
01232   } gavl_rectangle_i_t;
01233 
01238 typedef struct
01239   {
01240   double x; 
01241   double y; 
01242   double w; 
01243   double h; 
01244   } gavl_rectangle_f_t;
01245 
01252 GAVL_PUBLIC
01253 void gavl_rectangle_i_crop_to_format(gavl_rectangle_i_t * r,
01254                                    const gavl_video_format_t * format);
01255 
01262 GAVL_PUBLIC
01263 void gavl_rectangle_f_crop_to_format(gavl_rectangle_f_t * r,
01264                                      const gavl_video_format_t * format);
01265 
01280 GAVL_PUBLIC
01281 void gavl_rectangle_crop_to_format_noscale(gavl_rectangle_i_t * src_rect,
01282                                            gavl_rectangle_i_t * dst_rect,
01283                                            const gavl_video_format_t * src_format,
01284                                            const gavl_video_format_t * dst_format);
01285 
01297 GAVL_PUBLIC
01298 void gavl_rectangle_crop_to_format_scale(gavl_rectangle_f_t * src_rect,
01299                                          gavl_rectangle_i_t * dst_rect,
01300                                          const gavl_video_format_t * src_format,
01301                                          const gavl_video_format_t * dst_format);
01302 
01303   
01304 
01311 GAVL_PUBLIC
01312 void gavl_rectangle_i_set_all(gavl_rectangle_i_t * r, const gavl_video_format_t * format);
01313 
01320 GAVL_PUBLIC
01321 void gavl_rectangle_f_set_all(gavl_rectangle_f_t * r, const gavl_video_format_t * format);
01322 
01329 GAVL_PUBLIC
01330 void gavl_rectangle_i_crop_left(gavl_rectangle_i_t * r,   int num_pixels);
01331 
01338 GAVL_PUBLIC
01339 void gavl_rectangle_i_crop_right(gavl_rectangle_i_t * r,  int num_pixels);
01340 
01347 GAVL_PUBLIC
01348 void gavl_rectangle_i_crop_top(gavl_rectangle_i_t * r,    int num_pixels);
01349 
01356 GAVL_PUBLIC
01357 void gavl_rectangle_i_crop_bottom(gavl_rectangle_i_t * r, int num_pixels);
01358 
01365 GAVL_PUBLIC
01366 void gavl_rectangle_f_crop_left(gavl_rectangle_f_t * r,   double num_pixels);
01367 
01374 GAVL_PUBLIC
01375 void gavl_rectangle_f_crop_right(gavl_rectangle_f_t * r,  double num_pixels);
01376 
01383 GAVL_PUBLIC
01384 void gavl_rectangle_f_crop_top(gavl_rectangle_f_t * r,    double num_pixels);
01385 
01392 GAVL_PUBLIC
01393 void gavl_rectangle_f_crop_bottom(gavl_rectangle_f_t * r, double num_pixels);
01394 
01408 GAVL_PUBLIC
01409 void gavl_rectangle_i_align(gavl_rectangle_i_t * r, int h_align, int v_align);
01410 
01420 GAVL_PUBLIC
01421 void gavl_rectangle_i_align_to_format(gavl_rectangle_i_t * r,
01422                                       const gavl_video_format_t * format);
01423 
01424   
01431 GAVL_PUBLIC
01432 void gavl_rectangle_i_copy(gavl_rectangle_i_t * dst, const gavl_rectangle_i_t * src);
01433 
01440 GAVL_PUBLIC
01441 void gavl_rectangle_f_copy(gavl_rectangle_f_t * dst, const gavl_rectangle_f_t * src);
01442 
01443 
01444 
01451 GAVL_PUBLIC
01452 void gavl_rectangle_i_to_f(gavl_rectangle_f_t * dst, const gavl_rectangle_i_t * src);
01453 
01460 GAVL_PUBLIC
01461 void gavl_rectangle_f_to_i(gavl_rectangle_i_t * dst, const gavl_rectangle_f_t * src);
01462   
01471 GAVL_PUBLIC
01472 int gavl_rectangle_i_is_empty(const gavl_rectangle_i_t * r);
01473 
01482 GAVL_PUBLIC
01483 int gavl_rectangle_f_is_empty(const gavl_rectangle_f_t * r);
01484 
01512 GAVL_PUBLIC
01513 void gavl_rectangle_fit_aspect(gavl_rectangle_i_t * dst_rect,
01514                                const gavl_video_format_t * src_format,
01515                                const gavl_rectangle_f_t * src_rect,
01516                                const gavl_video_format_t * dst_format,
01517                                float zoom, float squeeze);
01518 
01523 GAVL_PUBLIC
01524 void gavl_rectangle_i_dump(const gavl_rectangle_i_t * r);
01525 
01530 GAVL_PUBLIC
01531 void gavl_rectangle_f_dump(const gavl_rectangle_f_t * r);
01532 
01533   
01543 #define GAVL_PIXFMT_PLANAR (1<<8)
01544 
01548 #define GAVL_PIXFMT_RGB    (1<<9)
01549 
01553 #define GAVL_PIXFMT_YUV    (1<<10)
01554 
01558 #define GAVL_PIXFMT_YUVJ   (1<<11)
01559 
01563 #define GAVL_PIXFMT_ALPHA  (1<<12)
01564 
01568 #define GAVL_PIXFMT_GRAY   (1<<13)
01569   
01574 typedef enum 
01575   {
01578     GAVL_PIXELFORMAT_NONE =  0, 
01579 
01582     GAVL_GRAY_8          =  1 | GAVL_PIXFMT_GRAY,
01583 
01586     GAVL_GRAY_16          =  2 | GAVL_PIXFMT_GRAY,
01587     
01590     GAVL_GRAY_FLOAT       =  3 | GAVL_PIXFMT_GRAY,
01591     
01594     GAVL_GRAYA_16          =  1 | GAVL_PIXFMT_GRAY | GAVL_PIXFMT_ALPHA,
01595 
01598     GAVL_GRAYA_32          =  2 | GAVL_PIXFMT_GRAY | GAVL_PIXFMT_ALPHA,
01599     
01602     GAVL_GRAYA_FLOAT       =  3 | GAVL_PIXFMT_GRAY | GAVL_PIXFMT_ALPHA,
01603     
01607     GAVL_RGB_15          =  1 | GAVL_PIXFMT_RGB,
01611     GAVL_BGR_15          =  2 | GAVL_PIXFMT_RGB,
01615     GAVL_RGB_16          =  3 | GAVL_PIXFMT_RGB,
01619     GAVL_BGR_16          =  4 | GAVL_PIXFMT_RGB,
01622     GAVL_RGB_24          =  5 | GAVL_PIXFMT_RGB,
01625     GAVL_BGR_24          =  6 | GAVL_PIXFMT_RGB,
01628     GAVL_RGB_32          =  7 | GAVL_PIXFMT_RGB,
01631     GAVL_BGR_32          =  8 | GAVL_PIXFMT_RGB,
01634     GAVL_RGBA_32         =  9 | GAVL_PIXFMT_RGB | GAVL_PIXFMT_ALPHA,
01635 
01638     GAVL_RGB_48       = 10 | GAVL_PIXFMT_RGB,
01641     GAVL_RGBA_64      = 11 | GAVL_PIXFMT_RGB | GAVL_PIXFMT_ALPHA,
01642         
01645     GAVL_RGB_FLOAT    = 12 | GAVL_PIXFMT_RGB,
01648     GAVL_RGBA_FLOAT   = 13 | GAVL_PIXFMT_RGB  | GAVL_PIXFMT_ALPHA,
01649 
01652     GAVL_YUY2            = 1 | GAVL_PIXFMT_YUV,
01655     GAVL_UYVY            = 2 | GAVL_PIXFMT_YUV,
01658     GAVL_YUVA_32         = 3 | GAVL_PIXFMT_YUV | GAVL_PIXFMT_ALPHA,
01661     GAVL_YUVA_64         = 4 | GAVL_PIXFMT_YUV | GAVL_PIXFMT_ALPHA,
01664     GAVL_YUV_FLOAT       = 5 | GAVL_PIXFMT_YUV,
01665 
01668     GAVL_YUVA_FLOAT       = 6 | GAVL_PIXFMT_YUV | GAVL_PIXFMT_ALPHA,
01669     
01673     GAVL_YUV_420_P       = 1 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
01676     GAVL_YUV_422_P       = 2 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
01679     GAVL_YUV_444_P       = 3 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
01682     GAVL_YUV_411_P       = 4 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
01685     GAVL_YUV_410_P       = 5 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
01686     
01689     GAVL_YUVJ_420_P      = 6 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV | GAVL_PIXFMT_YUVJ,
01692     GAVL_YUVJ_422_P      = 7 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV | GAVL_PIXFMT_YUVJ,
01695     GAVL_YUVJ_444_P      = 8 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV | GAVL_PIXFMT_YUVJ,
01696 
01699     GAVL_YUV_444_P_16 = 9 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
01702     GAVL_YUV_422_P_16 = 10 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
01703     
01704   } gavl_pixelformat_t;
01705 
01708 #define GAVL_PIXELFORMAT_1D_8 GAVL_GRAY_8
01709 
01711 #define GAVL_PIXELFORMAT_2D_8 GAVL_GRAYA_16
01712 
01714 #define GAVL_PIXELFORMAT_3D_8 GAVL_RGB_24
01715 
01717 #define GAVL_PIXELFORMAT_4D_8 GAVL_RGBA_32
01718 
01721 #define GAVL_PIXELFORMAT_1D_16 GAVL_GRAY_16
01722 
01724 #define GAVL_PIXELFORMAT_2D_16 GAVL_GRAYA_32
01725 
01727 #define GAVL_PIXELFORMAT_3D_16 GAVL_RGB_48
01728 
01730 #define GAVL_PIXELFORMAT_4D_16 GAVL_RGBA_64
01731 
01734 #define GAVL_PIXELFORMAT_1D_FLOAT GAVL_GRAY_FLOAT
01735 
01737 #define GAVL_PIXELFORMAT_2D_FLOAT GAVL_GRAYA_FLOAT
01738 
01740 #define GAVL_PIXELFORMAT_3D_FLOAT GAVL_RGB_FLOAT
01741 
01743 #define GAVL_PIXELFORMAT_4D_FLOAT GAVL_RGBA_FLOAT
01744 
01745   
01746 /*
01747  *  Colormodel related functions
01748  */
01749 
01756 #define gavl_pixelformat_is_gray(fmt) ((fmt) & GAVL_PIXFMT_GRAY)
01757 
01758   
01765 #define gavl_pixelformat_is_rgb(fmt) ((fmt) & GAVL_PIXFMT_RGB)
01766 
01773 #define gavl_pixelformat_is_yuv(fmt) ((fmt) & GAVL_PIXFMT_YUV)
01774 
01781 #define gavl_pixelformat_is_jpeg_scaled(fmt) ((fmt) & GAVL_PIXFMT_YUVJ)
01782 
01789 #define gavl_pixelformat_has_alpha(fmt) ((fmt) & GAVL_PIXFMT_ALPHA)
01790 
01797 #define  gavl_pixelformat_is_planar(fmt) ((fmt) & GAVL_PIXFMT_PLANAR)
01798 
01805 GAVL_PUBLIC
01806 int gavl_pixelformat_num_planes(gavl_pixelformat_t pixelformat);
01807 
01817 GAVL_PUBLIC
01818 void gavl_pixelformat_chroma_sub(gavl_pixelformat_t pixelformat, int * sub_h, int * sub_v);
01819 
01826 GAVL_PUBLIC
01827 int gavl_pixelformat_bytes_per_component(gavl_pixelformat_t pixelformat);
01828 
01835 GAVL_PUBLIC
01836 int gavl_pixelformat_bytes_per_pixel(gavl_pixelformat_t pixelformat);
01837   
01844 GAVL_PUBLIC
01845 int gavl_pixelformat_bits_per_pixel(gavl_pixelformat_t pixelformat);
01846 
01861 GAVL_PUBLIC
01862 int gavl_pixelformat_conversion_penalty(gavl_pixelformat_t src,
01863                                         gavl_pixelformat_t dst);
01864 
01878 GAVL_PUBLIC gavl_pixelformat_t 
01879 gavl_pixelformat_get_best(gavl_pixelformat_t src,
01880                           const gavl_pixelformat_t * dst_supported,
01881                           int * penalty);
01882   
01883 
01884 
01891 GAVL_PUBLIC
01892 const char * gavl_pixelformat_to_string(gavl_pixelformat_t pixelformat);
01893 
01900 GAVL_PUBLIC
01901 gavl_pixelformat_t gavl_string_to_pixelformat(const char * name);
01902 
01908 GAVL_PUBLIC
01909 int gavl_num_pixelformats();
01910 
01917 GAVL_PUBLIC
01918 gavl_pixelformat_t gavl_get_pixelformat(int index);
01919 
01920 /*  */
01921 
01930 typedef enum
01931   {
01932     GAVL_CHROMA_PLACEMENT_DEFAULT = 0, 
01933     GAVL_CHROMA_PLACEMENT_MPEG2,       
01934     GAVL_CHROMA_PLACEMENT_DVPAL        
01935   } gavl_chroma_placement_t;
01936 
01943 GAVL_PUBLIC
01944 const char * gavl_chroma_placement_to_string(gavl_chroma_placement_t mode);
01945   
01950 typedef enum
01951   {
01952     GAVL_FRAMERATE_CONSTANT    = 0, 
01953     GAVL_FRAMERATE_VARIABLE    = 1, 
01954     GAVL_FRAMERATE_STILL       = 2, 
01955   } gavl_framerate_mode_t;
01956 
01961 typedef enum
01962   {
01963     GAVL_INTERLACE_NONE = 0,    
01964     GAVL_INTERLACE_TOP_FIRST,   
01965     GAVL_INTERLACE_BOTTOM_FIRST,
01966     GAVL_INTERLACE_MIXED        
01967   } gavl_interlace_mode_t;
01968 
01975 GAVL_PUBLIC
01976 const char * gavl_interlace_mode_to_string(gavl_interlace_mode_t mode);
01977   
01978   
01979 /* Video format structure */
01980   
01985 struct gavl_video_format_s
01986   {
01987   int frame_width;
01988   int frame_height;
01990   int image_width;
01991   int image_height;
01993   /* Support for nonsquare pixels */
01994     
01995   int pixel_width;
01996   int pixel_height;
01998   gavl_pixelformat_t pixelformat;
02000   int frame_duration;
02002   int timescale;
02004   gavl_framerate_mode_t   framerate_mode;
02005   gavl_chroma_placement_t chroma_placement;
02007   gavl_interlace_mode_t   interlace_mode;
02009   gavl_timecode_format_t  timecode_format;
02010   };
02011 
02019 GAVL_PUBLIC
02020 void gavl_video_format_copy(gavl_video_format_t * dst,
02021                             const gavl_video_format_t * src);
02022 
02031 GAVL_PUBLIC
02032 int gavl_video_formats_equal(const gavl_video_format_t * format_1,
02033                              const gavl_video_format_t * format_2);
02034 
02035   
02046 GAVL_PUBLIC
02047 void gavl_video_format_get_chroma_offset(const gavl_video_format_t * format, int field, int plane,
02048                                          float * off_x, float * off_y);
02049   
02050  
02051 
02064 GAVL_PUBLIC
02065 void gavl_video_format_fit_to_source(gavl_video_format_t * dst,
02066                                      const gavl_video_format_t * src);
02067 
02075 GAVL_PUBLIC
02076 int gavl_video_format_get_image_size(const gavl_video_format_t * format);
02077 
02078   
02085 GAVL_PUBLIC
02086 void gavl_video_format_dump(const gavl_video_format_t * format);
02087 
02088   
02111 typedef struct
02112   {
02113   uint8_t * planes[GAVL_MAX_PLANES]; 
02114   int strides[GAVL_MAX_PLANES];      
02116   void * user_data;    
02117   int64_t timestamp; 
02118   int64_t duration; 
02119   gavl_interlace_mode_t   interlace_mode;
02120   gavl_timecode_t timecode; 
02121   } gavl_video_frame_t;
02122 
02123 
02135 GAVL_PUBLIC
02136 gavl_video_frame_t * gavl_video_frame_create(const gavl_video_format_t*format);
02137 
02148 GAVL_PUBLIC
02149 gavl_video_frame_t * gavl_video_frame_create_nopad(const gavl_video_format_t*format);
02150 
02151   
02152 
02162 GAVL_PUBLIC
02163 void gavl_video_frame_destroy(gavl_video_frame_t*frame);
02164 
02176 GAVL_PUBLIC
02177 void gavl_video_frame_null(gavl_video_frame_t*frame);
02178   
02187 GAVL_PUBLIC
02188 void gavl_video_frame_clear(gavl_video_frame_t * frame,
02189                             const gavl_video_format_t * format);
02190 
02200 GAVL_PUBLIC
02201 void gavl_video_frame_fill(gavl_video_frame_t * frame,
02202                            const gavl_video_format_t * format,
02203                            const float * color);
02204 
02217 GAVL_PUBLIC
02218 void gavl_video_frame_absdiff(gavl_video_frame_t * dst,
02219                               const gavl_video_frame_t * src1,
02220                               const gavl_video_frame_t * src2,
02221                               const gavl_video_format_t * format);
02222 
02235 GAVL_PUBLIC
02236 void gavl_video_frame_psnr(double * psnr,
02237                            const gavl_video_frame_t * src1,
02238                            const gavl_video_frame_t * src2,
02239                            const gavl_video_format_t * format);
02240 
02241   
02255 GAVL_PUBLIC
02256 void gavl_video_frame_copy(const gavl_video_format_t * format,
02257                            gavl_video_frame_t * dst,
02258                            const gavl_video_frame_t * src);
02259 
02272 GAVL_PUBLIC
02273 void gavl_video_frame_copy_plane(const gavl_video_format_t * format,
02274                                  gavl_video_frame_t * dst,
02275                                  const gavl_video_frame_t * src, int plane);
02276 
02288 GAVL_PUBLIC
02289 void gavl_video_frame_copy_flip_x(const gavl_video_format_t * format,
02290                                   gavl_video_frame_t * dst,
02291                                   const gavl_video_frame_t * src);
02292 
02304 GAVL_PUBLIC
02305 void gavl_video_frame_copy_flip_y(const gavl_video_format_t * format,
02306                                   gavl_video_frame_t * dst,
02307                                   const gavl_video_frame_t * src);
02308 
02320 GAVL_PUBLIC
02321 void gavl_video_frame_copy_flip_xy(const gavl_video_format_t * format,
02322                                    gavl_video_frame_t * dst,
02323                                   const gavl_video_frame_t * src);
02324 
02337 GAVL_PUBLIC
02338 void gavl_video_frame_copy_metadata(gavl_video_frame_t * dst,
02339                                     const gavl_video_frame_t * src);
02340 
02341   
02359 GAVL_PUBLIC
02360 void gavl_video_frame_get_subframe(gavl_pixelformat_t pixelformat,
02361                                    const gavl_video_frame_t * src,
02362                                    gavl_video_frame_t * dst,
02363                                    gavl_rectangle_i_t * src_rect);
02364 
02380 GAVL_PUBLIC
02381 void gavl_video_frame_get_field(gavl_pixelformat_t pixelformat,
02382                                 const gavl_video_frame_t * src,
02383                                 gavl_video_frame_t * dst,
02384                                 int field);
02385 
02386   
02387 
02400 GAVL_PUBLIC
02401 void gavl_video_frame_dump(gavl_video_frame_t * frame,
02402                            const gavl_video_format_t * format,
02403                            const char * namebase);
02404 
02415 GAVL_PUBLIC
02416 void gavl_video_frame_set_strides(gavl_video_frame_t * frame,
02417                                   const gavl_video_format_t * format);
02418 
02431 GAVL_PUBLIC
02432 void gavl_video_frame_set_planes(gavl_video_frame_t * frame,
02433                                  const gavl_video_format_t * format,
02434                                  uint8_t * buffer);
02435 
02436   
02437 /*****************************
02438  Conversion options
02439 ******************************/
02440 
02456 #define GAVL_FORCE_DEINTERLACE (1<<0)
02457 
02462 #define GAVL_CONVOLVE_CHROMA   (1<<1)
02463 
02468 #define GAVL_CONVOLVE_NORMALIZE (1<<2)
02469 
02477 #define GAVL_RESAMPLE_CHROMA    (1<<3)
02478   
02486 typedef enum
02487   {
02488     GAVL_ALPHA_IGNORE      = 0, 
02489     GAVL_ALPHA_BLEND_COLOR      
02490   } gavl_alpha_mode_t;
02491 
02498 typedef enum
02499   {
02500     GAVL_DEINTERLACE_NONE      = 0, 
02501     GAVL_DEINTERLACE_COPY      = 1, 
02502     GAVL_DEINTERLACE_SCALE     = 2, 
02503     GAVL_DEINTERLACE_BLEND     = 3  
02504   } gavl_deinterlace_mode_t;
02505 
02512 typedef enum
02513   {
02514     GAVL_DEINTERLACE_DROP_TOP,    
02515     GAVL_DEINTERLACE_DROP_BOTTOM, 
02516   } gavl_deinterlace_drop_mode_t;
02517   
02522 typedef enum
02523   {
02524     GAVL_SCALE_AUTO,          
02525     GAVL_SCALE_NEAREST,       
02526     GAVL_SCALE_BILINEAR,      
02527     GAVL_SCALE_QUADRATIC,     
02528     GAVL_SCALE_CUBIC_BSPLINE, 
02529     GAVL_SCALE_CUBIC_MITCHELL,
02530     GAVL_SCALE_CUBIC_CATMULL, 
02531     GAVL_SCALE_SINC_LANCZOS,  
02532     GAVL_SCALE_NONE,          
02533   } gavl_scale_mode_t;
02534 
02544 typedef enum
02545   {
02546     GAVL_DOWNSCALE_FILTER_AUTO = 0, 
02547     GAVL_DOWNSCALE_FILTER_NONE, 
02548     GAVL_DOWNSCALE_FILTER_WIDE, 
02549     GAVL_DOWNSCALE_FILTER_GAUSS, 
02550   } gavl_downscale_filter_t;
02551   
02558 typedef struct gavl_video_options_s gavl_video_options_t;
02559 
02560 /* Default Options */
02561 
02567 GAVL_PUBLIC
02568 void gavl_video_options_set_defaults(gavl_video_options_t * opt);
02569 
02579 GAVL_PUBLIC
02580 gavl_video_options_t * gavl_video_options_create();
02581 
02588 GAVL_PUBLIC
02589 void gavl_video_options_copy(gavl_video_options_t * dst,
02590                              const gavl_video_options_t * src);
02591 
02597 GAVL_PUBLIC
02598 void gavl_video_options_destroy(gavl_video_options_t * opt);
02599   
02600   
02615 GAVL_PUBLIC
02616 void gavl_video_options_set_rectangles(gavl_video_options_t * opt,
02617                                        const gavl_rectangle_f_t * src_rect,
02618                                        const gavl_rectangle_i_t * dst_rect);
02619 
02627 GAVL_PUBLIC
02628 void gavl_video_options_get_rectangles(gavl_video_options_t * opt,
02629                                        gavl_rectangle_f_t * src_rect,
02630                                        gavl_rectangle_i_t * dst_rect);
02631   
02638 GAVL_PUBLIC
02639 void gavl_video_options_set_quality(gavl_video_options_t * opt, int quality);
02640 
02647 GAVL_PUBLIC
02648 int gavl_video_options_get_quality(gavl_video_options_t * opt);
02649 
02650   
02657 GAVL_PUBLIC
02658 void gavl_video_options_set_conversion_flags(gavl_video_options_t * opt,
02659                                              int conversion_flags);
02660 
02667 GAVL_PUBLIC
02668 int gavl_video_options_get_conversion_flags(gavl_video_options_t * opt);
02669   
02676 GAVL_PUBLIC
02677 void gavl_video_options_set_alpha_mode(gavl_video_options_t * opt,
02678                                        gavl_alpha_mode_t alpha_mode);
02679 
02686 GAVL_PUBLIC gavl_alpha_mode_t
02687 gavl_video_options_get_alpha_mode(gavl_video_options_t * opt);
02688 
02689   
02696 GAVL_PUBLIC
02697 void gavl_video_options_set_scale_mode(gavl_video_options_t * opt,
02698                                        gavl_scale_mode_t scale_mode);
02699 
02706 GAVL_PUBLIC gavl_scale_mode_t
02707 gavl_video_options_get_scale_mode(gavl_video_options_t * opt);
02708 
02709   
02716 GAVL_PUBLIC
02717 void gavl_video_options_set_scale_order(gavl_video_options_t * opt,
02718                                         int order);
02719 
02726 GAVL_PUBLIC
02727 int gavl_video_options_get_scale_order(gavl_video_options_t * opt);
02728 
02729   
02736 GAVL_PUBLIC
02737 void gavl_video_options_set_background_color(gavl_video_options_t * opt,
02738                                              const float * color);
02739 
02746 GAVL_PUBLIC
02747 void gavl_video_options_get_background_color(gavl_video_options_t * opt,
02748                                              float * color);
02749   
02756 GAVL_PUBLIC
02757 void gavl_video_options_set_deinterlace_mode(gavl_video_options_t * opt,
02758                                              gavl_deinterlace_mode_t deinterlace_mode);
02759 
02766 GAVL_PUBLIC gavl_deinterlace_mode_t
02767 gavl_video_options_get_deinterlace_mode(gavl_video_options_t * opt);
02768 
02775 GAVL_PUBLIC
02776 void gavl_video_options_set_deinterlace_drop_mode(gavl_video_options_t * opt,
02777                                                   gavl_deinterlace_drop_mode_t deinterlace_drop_mode);
02778 
02785 GAVL_PUBLIC gavl_deinterlace_drop_mode_t
02786 gavl_video_options_get_deinterlace_drop_mode(gavl_video_options_t * opt);
02787 
02796 GAVL_PUBLIC
02797 void gavl_video_options_set_downscale_filter(gavl_video_options_t * opt,
02798                                              gavl_downscale_filter_t f);
02799   
02800 
02809 GAVL_PUBLIC gavl_downscale_filter_t
02810 gavl_video_options_get_downscale_filter(gavl_video_options_t * opt);
02811 
02829 GAVL_PUBLIC
02830 void gavl_video_options_set_downscale_blur(gavl_video_options_t * opt,
02831                                            float f);
02832 
02841 GAVL_PUBLIC
02842 float gavl_video_options_get_downscale_blur(gavl_video_options_t * opt);
02843 
02852 GAVL_PUBLIC
02853 void gavl_video_options_set_num_threads(gavl_video_options_t * opt, int n);
02854 
02855   
02864 GAVL_PUBLIC
02865 int gavl_video_options_get_num_threads(gavl_video_options_t * opt);
02866 
02876 GAVL_PUBLIC
02877 void gavl_video_options_set_run_func(gavl_video_options_t * opt,
02878                                      gavl_video_run_func func,
02879                                      void * client_data);
02880 
02890 GAVL_PUBLIC
02891 gavl_video_run_func gavl_video_options_get_run_func(gavl_video_options_t * opt,
02892                                                     void ** client_data);
02893 
02903 GAVL_PUBLIC
02904 void gavl_video_options_set_stop_func(gavl_video_options_t * opt,
02905                                       gavl_video_stop_func func, 
02906                                       void * client_data);
02907 
02917 GAVL_PUBLIC
02918 gavl_video_stop_func gavl_video_options_get_stop_func(gavl_video_options_t * opt,
02919                                                       void ** client_data);
02920 
02921   
02922 /***************************************************
02923  * Create and destroy video converters
02924  ***************************************************/
02925   
02958 typedef struct gavl_video_converter_s gavl_video_converter_t;
02959 
02965 GAVL_PUBLIC
02966 gavl_video_converter_t * gavl_video_converter_create();
02967 
02973 GAVL_PUBLIC
02974 void gavl_video_converter_destroy(gavl_video_converter_t*cnv);
02975 
02976 /**************************************************
02977  * Get options. Change the options with the gavl_video_options_set_*
02978  * functions above
02979  **************************************************/
02980 
02989 GAVL_PUBLIC gavl_video_options_t *
02990 gavl_video_converter_get_options(gavl_video_converter_t*cnv);
02991 
02992 
03006 GAVL_PUBLIC
03007 int gavl_video_converter_init(gavl_video_converter_t* cnv,
03008                               const gavl_video_format_t * input_format,
03009                               const gavl_video_format_t * output_format);
03010 
03023 GAVL_PUBLIC
03024 int gavl_video_converter_reinit(gavl_video_converter_t* cnv);
03025  
03026   
03027 /***************************************************
03028  * Convert a frame
03029  ***************************************************/
03030 
03038 GAVL_PUBLIC
03039 void gavl_video_convert(gavl_video_converter_t * cnv,
03040                         const gavl_video_frame_t * input_frame,
03041                         gavl_video_frame_t * output_frame);
03042 
03074 typedef struct gavl_video_scaler_s gavl_video_scaler_t;
03075 
03081 GAVL_PUBLIC
03082 gavl_video_scaler_t * gavl_video_scaler_create();
03083 
03089 GAVL_PUBLIC
03090 void gavl_video_scaler_destroy(gavl_video_scaler_t * scaler);
03091 
03100 GAVL_PUBLIC gavl_video_options_t *
03101 gavl_video_scaler_get_options(gavl_video_scaler_t * scaler);
03102 
03115 GAVL_PUBLIC
03116 int gavl_video_scaler_init(gavl_video_scaler_t * scaler,
03117                            const gavl_video_format_t * src_format,
03118                            const gavl_video_format_t * dst_format);
03119 
03141 GAVL_PUBLIC
03142 int gavl_video_scaler_init_convolve(gavl_video_scaler_t * scaler,
03143                                     const gavl_video_format_t * format,
03144                                     int h_radius, const float * h_coeffs,
03145                                     int v_radius, const float * v_coeffs);
03146   
03154 GAVL_PUBLIC
03155 void gavl_video_scaler_scale(gavl_video_scaler_t * scaler,
03156                              const gavl_video_frame_t * input_frame,
03157                              gavl_video_frame_t * output_frame);
03158 
03174 typedef struct gavl_video_deinterlacer_s gavl_video_deinterlacer_t;
03175 
03181 GAVL_PUBLIC
03182 gavl_video_deinterlacer_t * gavl_video_deinterlacer_create();
03183 
03189 GAVL_PUBLIC
03190 void gavl_video_deinterlacer_destroy(gavl_video_deinterlacer_t * deinterlacer);
03191 
03200 GAVL_PUBLIC gavl_video_options_t *
03201 gavl_video_deinterlacer_get_options(gavl_video_deinterlacer_t * deinterlacer);
03202 
03213 GAVL_PUBLIC
03214 int gavl_video_deinterlacer_init(gavl_video_deinterlacer_t * deinterlacer,
03215                                  const gavl_video_format_t * src_format);
03216 
03217   
03225 GAVL_PUBLIC
03226 void gavl_video_deinterlacer_deinterlace(gavl_video_deinterlacer_t * deinterlacer,
03227                                          const gavl_video_frame_t * input_frame,
03228                                          gavl_video_frame_t * output_frame);
03229 
03230   
03231   
03232 /**************************************************
03233  * Transparent overlays 
03234  **************************************************/
03235 
03236 /* Overlay struct */
03237 
03265 typedef struct
03266   {
03267   gavl_video_frame_t * frame;    
03268   gavl_rectangle_i_t ovl_rect;   
03269   int dst_x;                     
03270   int dst_y;                     
03271   } gavl_overlay_t;
03272 
03279 typedef struct gavl_overlay_blend_context_s gavl_overlay_blend_context_t;
03280 
03286 GAVL_PUBLIC
03287 gavl_overlay_blend_context_t * gavl_overlay_blend_context_create();
03288 
03294 GAVL_PUBLIC
03295 void gavl_overlay_blend_context_destroy(gavl_overlay_blend_context_t * ctx);
03296 
03303 GAVL_PUBLIC gavl_video_options_t *
03304 gavl_overlay_blend_context_get_options(gavl_overlay_blend_context_t * ctx);
03305 
03321 GAVL_PUBLIC
03322 int gavl_overlay_blend_context_init(gavl_overlay_blend_context_t * ctx,
03323                                     const gavl_video_format_t * frame_format,
03324                                     gavl_video_format_t * overlay_format);
03325 
03335 GAVL_PUBLIC
03336 void gavl_overlay_blend_context_set_overlay(gavl_overlay_blend_context_t * ctx,
03337                                             gavl_overlay_t * ovl);
03338 
03345 GAVL_PUBLIC
03346 void gavl_overlay_blend(gavl_overlay_blend_context_t * ctx,
03347                         gavl_video_frame_t * dst_frame);
03348 
03370 typedef struct gavl_image_transform_s gavl_image_transform_t;
03371 
03385 typedef void (*gavl_image_transform_func)(void * priv,
03386                                           double xdst,
03387                                           double ydst,
03388                                           double * xsrc,
03389                                           double * ysrc);
03390 
03391 
03398 GAVL_PUBLIC
03399 gavl_image_transform_t * gavl_image_transform_create();
03400 
03406 GAVL_PUBLIC
03407 void gavl_image_transform_destroy(gavl_image_transform_t * t);
03408 
03423 GAVL_PUBLIC
03424 void gavl_image_transform_init(gavl_image_transform_t * t,
03425                                gavl_video_format_t * format,
03426                                gavl_image_transform_func func, void * priv);
03427 
03435 GAVL_PUBLIC
03436 void gavl_image_transform_transform(gavl_image_transform_t * t,
03437                                     gavl_video_frame_t * in_frame,
03438                                     gavl_video_frame_t * out_frame);
03439 
03450 GAVL_PUBLIC gavl_video_options_t *
03451 gavl_image_transform_get_options(gavl_image_transform_t * t);
03452   
03457 #ifdef __cplusplus
03458 }
03459 #endif
03460 
03461 #endif /* GAVL_H_INCLUDED */

Generated on 27 Oct 2009 for gavl by  doxygen 1.6.1