annotate lib/libswscale/swscale.h @ 2463:0f17a30149ec

cleaning project part 1
author zipi
date Sun, 17 Aug 2014 15:13:18 +0100
parents 992d2e6f907d
children
rev   line source
2134
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
1 /*
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
2 * Copyright (C) 2001-2011 Michael Niedermayer <michaelni@gmx.at>
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
3 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
4 * This file is part of FFmpeg.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
5 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
10 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
14 * Lesser General Public License for more details.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
15 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
19 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
20
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
21 #ifndef SWSCALE_SWSCALE_H
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
22 #define SWSCALE_SWSCALE_H
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
23
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
24 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
25 * @file
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
26 * @ingroup lsws
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
27 * external API header
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
28 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
29
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
30 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
31 * @defgroup lsws Libswscale
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
32 * @{
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
33 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
34
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
35 #include <stdint.h>
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
36
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
37 #include "../libavutil/avutil.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
38 #include "../libavutil/log.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
39 #include "../libavutil/pixfmt.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
40 #include "version.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
41
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
42 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
43 * Return the LIBSWSCALE_VERSION_INT constant.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
44 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
45 unsigned swscale_version(void);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
46
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
47 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
48 * Return the libswscale build-time configuration.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
49 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
50 const char *swscale_configuration(void);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
51
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
52 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
53 * Return the libswscale license.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
54 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
55 const char *swscale_license(void);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
56
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
57 /* values for the flags, the stuff on the command line is different */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
58 #define SWS_FAST_BILINEAR 1
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
59 #define SWS_BILINEAR 2
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
60 #define SWS_BICUBIC 4
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
61 #define SWS_X 8
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
62 #define SWS_POINT 0x10
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
63 #define SWS_AREA 0x20
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
64 #define SWS_BICUBLIN 0x40
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
65 #define SWS_GAUSS 0x80
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
66 #define SWS_SINC 0x100
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
67 #define SWS_LANCZOS 0x200
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
68 #define SWS_SPLINE 0x400
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
69
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
70 #define SWS_SRC_V_CHR_DROP_MASK 0x30000
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
71 #define SWS_SRC_V_CHR_DROP_SHIFT 16
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
72
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
73 #define SWS_PARAM_DEFAULT 123456
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
74
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
75 #define SWS_PRINT_INFO 0x1000
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
76
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
77 //the following 3 flags are not completely implemented
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
78 //internal chrominace subsampling info
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
79 #define SWS_FULL_CHR_H_INT 0x2000
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
80 //input subsampling info
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
81 #define SWS_FULL_CHR_H_INP 0x4000
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
82 #define SWS_DIRECT_BGR 0x8000
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
83 #define SWS_ACCURATE_RND 0x40000
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
84 #define SWS_BITEXACT 0x80000
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
85 #define SWS_ERROR_DIFFUSION 0x800000
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
86
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
87 #if FF_API_SWS_CPU_CAPS
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
88 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
89 * CPU caps are autodetected now, those flags
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
90 * are only provided for API compatibility.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
91 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
92 #define SWS_CPU_CAPS_MMX 0x80000000
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
93 #define SWS_CPU_CAPS_MMXEXT 0x20000000
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
94 #define SWS_CPU_CAPS_MMX2 0x20000000
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
95 #define SWS_CPU_CAPS_3DNOW 0x40000000
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
96 #define SWS_CPU_CAPS_ALTIVEC 0x10000000
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
97 #define SWS_CPU_CAPS_BFIN 0x01000000
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
98 #define SWS_CPU_CAPS_SSE2 0x02000000
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
99 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
100
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
101 #define SWS_MAX_REDUCE_CUTOFF 0.002
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
102
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
103 #define SWS_CS_ITU709 1
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
104 #define SWS_CS_FCC 4
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
105 #define SWS_CS_ITU601 5
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
106 #define SWS_CS_ITU624 5
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
107 #define SWS_CS_SMPTE170M 5
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
108 #define SWS_CS_SMPTE240M 7
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
109 #define SWS_CS_DEFAULT 5
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
110
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
111 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
112 * Return a pointer to yuv<->rgb coefficients for the given colorspace
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
113 * suitable for sws_setColorspaceDetails().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
114 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
115 * @param colorspace One of the SWS_CS_* macros. If invalid,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
116 * SWS_CS_DEFAULT is used.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
117 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
118 const int *sws_getCoefficients(int colorspace);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
119
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
120 // when used for filters they must have an odd number of elements
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
121 // coeffs cannot be shared between vectors
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
122 typedef struct SwsVector {
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
123 double *coeff; ///< pointer to the list of coefficients
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
124 int length; ///< number of coefficients in the vector
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
125 } SwsVector;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
126
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
127 // vectors can be shared
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
128 typedef struct SwsFilter {
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
129 SwsVector *lumH;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
130 SwsVector *lumV;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
131 SwsVector *chrH;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
132 SwsVector *chrV;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
133 } SwsFilter;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
134
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
135 struct SwsContext;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
136
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
137 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
138 * Return a positive value if pix_fmt is a supported input format, 0
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
139 * otherwise.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
140 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
141 int sws_isSupportedInput(enum AVPixelFormat pix_fmt);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
142
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
143 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
144 * Return a positive value if pix_fmt is a supported output format, 0
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
145 * otherwise.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
146 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
147 int sws_isSupportedOutput(enum AVPixelFormat pix_fmt);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
148
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
149 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
150 * @param[in] pix_fmt the pixel format
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
151 * @return a positive value if an endianness conversion for pix_fmt is
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
152 * supported, 0 otherwise.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
153 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
154 int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
155
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
156 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
157 * Allocate an empty SwsContext. This must be filled and passed to
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
158 * sws_init_context(). For filling see AVOptions, options.c and
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
159 * sws_setColorspaceDetails().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
160 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
161 struct SwsContext *sws_alloc_context(void);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
162
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
163 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
164 * Initialize the swscaler context sws_context.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
165 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
166 * @return zero or positive value on success, a negative value on
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
167 * error
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
168 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
169 int sws_init_context(struct SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
170
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
171 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
172 * Free the swscaler context swsContext.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
173 * If swsContext is NULL, then does nothing.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
174 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
175 void sws_freeContext(struct SwsContext *swsContext);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
176
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
177 #if FF_API_SWS_GETCONTEXT
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
178 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
179 * Allocate and return an SwsContext. You need it to perform
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
180 * scaling/conversion operations using sws_scale().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
181 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
182 * @param srcW the width of the source image
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
183 * @param srcH the height of the source image
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
184 * @param srcFormat the source image format
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
185 * @param dstW the width of the destination image
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
186 * @param dstH the height of the destination image
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
187 * @param dstFormat the destination image format
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
188 * @param flags specify which algorithm and options to use for rescaling
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
189 * @return a pointer to an allocated context, or NULL in case of error
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
190 * @note this function is to be removed after a saner alternative is
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
191 * written
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
192 * @deprecated Use sws_getCachedContext() instead.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
193 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
194 struct SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
195 int dstW, int dstH, enum AVPixelFormat dstFormat,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
196 int flags, SwsFilter *srcFilter,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
197 SwsFilter *dstFilter, const double *param);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
198 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
199
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
200 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
201 * Scale the image slice in srcSlice and put the resulting scaled
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
202 * slice in the image in dst. A slice is a sequence of consecutive
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
203 * rows in an image.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
204 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
205 * Slices have to be provided in sequential order, either in
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
206 * top-bottom or bottom-top order. If slices are provided in
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
207 * non-sequential order the behavior of the function is undefined.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
208 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
209 * @param c the scaling context previously created with
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
210 * sws_getContext()
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
211 * @param srcSlice the array containing the pointers to the planes of
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
212 * the source slice
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
213 * @param srcStride the array containing the strides for each plane of
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
214 * the source image
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
215 * @param srcSliceY the position in the source image of the slice to
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
216 * process, that is the number (counted starting from
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
217 * zero) in the image of the first row of the slice
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
218 * @param srcSliceH the height of the source slice, that is the number
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
219 * of rows in the slice
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
220 * @param dst the array containing the pointers to the planes of
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
221 * the destination image
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
222 * @param dstStride the array containing the strides for each plane of
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
223 * the destination image
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
224 * @return the height of the output slice
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
225 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
226 int sws_scale(struct SwsContext *c, const uint8_t *const srcSlice[],
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
227 const int srcStride[], int srcSliceY, int srcSliceH,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
228 uint8_t *const dst[], const int dstStride[]);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
229
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
230 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
231 * @param dstRange flag indicating the while-black range of the output (1=jpeg / 0=mpeg)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
232 * @param srcRange flag indicating the while-black range of the input (1=jpeg / 0=mpeg)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
233 * @param table the yuv2rgb coefficients describing the output yuv space, normally ff_yuv2rgb_coeffs[x]
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
234 * @param inv_table the yuv2rgb coefficients describing the input yuv space, normally ff_yuv2rgb_coeffs[x]
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
235 * @param brightness 16.16 fixed point brightness correction
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
236 * @param contrast 16.16 fixed point contrast correction
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
237 * @param saturation 16.16 fixed point saturation correction
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
238 * @return -1 if not supported
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
239 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
240 int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
241 int srcRange, const int table[4], int dstRange,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
242 int brightness, int contrast, int saturation);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
243
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
244 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
245 * @return -1 if not supported
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
246 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
247 int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
248 int *srcRange, int **table, int *dstRange,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
249 int *brightness, int *contrast, int *saturation);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
250
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
251 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
252 * Allocate and return an uninitialized vector with length coefficients.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
253 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
254 SwsVector *sws_allocVec(int length);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
255
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
256 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
257 * Return a normalized Gaussian curve used to filter stuff
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
258 * quality = 3 is high quality, lower is lower quality.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
259 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
260 SwsVector *sws_getGaussianVec(double variance, double quality);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
261
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
262 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
263 * Allocate and return a vector with length coefficients, all
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
264 * with the same value c.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
265 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
266 SwsVector *sws_getConstVec(double c, int length);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
267
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
268 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
269 * Allocate and return a vector with just one coefficient, with
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
270 * value 1.0.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
271 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
272 SwsVector *sws_getIdentityVec(void);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
273
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
274 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
275 * Scale all the coefficients of a by the scalar value.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
276 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
277 void sws_scaleVec(SwsVector *a, double scalar);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
278
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
279 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
280 * Scale all the coefficients of a so that their sum equals height.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
281 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
282 void sws_normalizeVec(SwsVector *a, double height);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
283 void sws_convVec(SwsVector *a, SwsVector *b);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
284 void sws_addVec(SwsVector *a, SwsVector *b);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
285 void sws_subVec(SwsVector *a, SwsVector *b);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
286 void sws_shiftVec(SwsVector *a, int shift);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
287
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
288 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
289 * Allocate and return a clone of the vector a, that is a vector
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
290 * with the same coefficients as a.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
291 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
292 SwsVector *sws_cloneVec(SwsVector *a);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
293
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
294 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
295 * Print with av_log() a textual representation of the vector a
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
296 * if log_level <= av_log_level.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
297 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
298 void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
299
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
300 void sws_freeVec(SwsVector *a);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
301
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
302 SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
303 float lumaSharpen, float chromaSharpen,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
304 float chromaHShift, float chromaVShift,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
305 int verbose);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
306 void sws_freeFilter(SwsFilter *filter);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
307
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
308 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
309 * Check if context can be reused, otherwise reallocate a new one.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
310 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
311 * If context is NULL, just calls sws_getContext() to get a new
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
312 * context. Otherwise, checks if the parameters are the ones already
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
313 * saved in context. If that is the case, returns the current
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
314 * context. Otherwise, frees context and gets a new context with
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
315 * the new parameters.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
316 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
317 * Be warned that srcFilter and dstFilter are not checked, they
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
318 * are assumed to remain the same.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
319 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
320 struct SwsContext *sws_getCachedContext(struct SwsContext *context,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
321 int srcW, int srcH, enum AVPixelFormat srcFormat,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
322 int dstW, int dstH, enum AVPixelFormat dstFormat,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
323 int flags, SwsFilter *srcFilter,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
324 SwsFilter *dstFilter, const double *param);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
325
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
326 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
327 * Convert an 8-bit paletted frame into a frame with a color depth of 32 bits.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
328 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
329 * The output frame will have the same packed format as the palette.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
330 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
331 * @param src source frame buffer
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
332 * @param dst destination frame buffer
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
333 * @param num_pixels number of pixels to convert
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
334 * @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
335 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
336 void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
337
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
338 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
339 * Convert an 8-bit paletted frame into a frame with a color depth of 24 bits.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
340 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
341 * With the palette format "ABCD", the destination frame ends up with the format "ABC".
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
342 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
343 * @param src source frame buffer
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
344 * @param dst destination frame buffer
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
345 * @param num_pixels number of pixels to convert
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
346 * @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
347 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
348 void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
349
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
350 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
351 * Get the AVClass for swsContext. It can be used in combination with
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
352 * AV_OPT_SEARCH_FAKE_OBJ for examining options.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
353 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
354 * @see av_opt_find().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
355 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
356 const AVClass *sws_get_class(void);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
357
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
358 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
359 * @}
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
360 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
361
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
362 #endif /* SWSCALE_SWSCALE_H */