1 /*
2  * tcvideo.h - include file for video processing library for transcode
3  * Written by Andrew Church <achurch@achurch.org>
4  *
5  * This file is part of transcode, a video stream processing tool.
6  * transcode is free software, distributable under the terms of the GNU
7  * General Public License (version 2 or later).  See the file COPYING
8  * for details.
9  */
10 
11 #ifndef LIBTCVIDEO_TCVIDEO_H
12 #define LIBTCVIDEO_TCVIDEO_H
13 
14 #ifdef HAVE_CONFIG_H
15 # include "config.h"
16 #endif
17 
18 #include <stdint.h>
19 
20 #include "aclib/imgconvert.h"
21 
22 /*************************************************************************/
23 
24 /* Handle for calling tcvideo functions, allocated by tcv_init() and passed
25  * to all other functions to hold internal state information.  Opaque to
26  * the caller. */
27 typedef struct tcvhandle_ *TCVHandle;
28 
29 /* Modes for tcv_deinterlace(): */
30 typedef enum {
31     TCV_DEINTERLACE_DROP_FIELD_TOP,
32     TCV_DEINTERLACE_DROP_FIELD_BOTTOM,
33     TCV_DEINTERLACE_INTERPOLATE,
34     TCV_DEINTERLACE_LINEAR_BLEND,
35 } TCVDeinterlaceMode;
36 
37 /* Filter IDs for tcv_zoom(): */
38 typedef enum {
39     TCV_ZOOM_DEFAULT = 0, /* alias for an existing following id */
40     TCV_ZOOM_HERMITE = 1,
41     TCV_ZOOM_BOX,
42     TCV_ZOOM_TRIANGLE,
43     TCV_ZOOM_BELL,
44     TCV_ZOOM_B_SPLINE,
45     TCV_ZOOM_LANCZOS3,
46     TCV_ZOOM_MITCHELL,
47     TCV_ZOOM_CUBIC_KEYS4,
48     TCV_ZOOM_SINC8,
49     TCV_ZOOM_NULL, /* this one MUST be the last one */
50 } TCVZoomFilter;
51 
52 /*************************************************************************/
53 
54 TCVHandle tcv_init(void);
55 
56 void tcv_free(TCVHandle handle);
57 
58 int tcv_clip(TCVHandle handle,
59              uint8_t *src, uint8_t *dest, int width, int height, int Bpp,
60              int clip_left, int clip_right, int clip_top, int clip_bottom,
61              uint8_t black_pixel);
62 
63 int tcv_deinterlace(TCVHandle handle,
64                     uint8_t *src, uint8_t *dest, int width, int height,
65                     int Bpp, TCVDeinterlaceMode mode);
66 
67 int tcv_resize(TCVHandle handle,
68                uint8_t *src, uint8_t *dest, int width, int height, int Bpp,
69                int resize_w, int resize_h, int scale_w, int scale_h);
70 
71 int tcv_zoom(TCVHandle handle,
72              uint8_t *src, uint8_t *dest, int width, int height, int Bpp,
73              int new_w, int new_h, TCVZoomFilter filter);
74 
75 int tcv_reduce(TCVHandle handle,
76                uint8_t *src, uint8_t *dest, int width, int height, int Bpp,
77                int reduce_w, int reduce_h);
78 
79 int tcv_flip_v(TCVHandle handle,
80                uint8_t *src, uint8_t *dest, int width, int height, int Bpp);
81 
82 int tcv_flip_h(TCVHandle handle,
83                uint8_t *src, uint8_t *dest, int width, int height, int Bpp);
84 
85 int tcv_gamma_correct(TCVHandle handle,
86                       uint8_t *src, uint8_t *dest, int width, int height,
87                       int Bpp, double gamma);
88 
89 int tcv_antialias(TCVHandle handle,
90                   uint8_t *src, uint8_t *dest, int width, int height,
91                   int Bpp, double weight, double bias);
92 
93 int tcv_convert(TCVHandle handle, uint8_t *src, uint8_t *dest, int width,
94                 int height, ImageFormat srcfmt, ImageFormat destfmt);
95 
96 const char *tcv_zoom_filter_to_string(TCVZoomFilter filter);
97 
98 TCVZoomFilter tcv_zoom_filter_from_string(const char *name);
99 
100 /*************************************************************************/
101 
102 #endif  /* LIBTCVIDEO_TCVIDEO_H */
103 
104 /*
105  * Local variables:
106  *   c-file-style: "stroustrup"
107  *   c-file-offsets: ((case-label . *) (statement-case-intro . *))
108  *   indent-tabs-mode: nil
109  * End:
110  *
111  * vim: expandtab shiftwidth=4:
112  */
113