115
115
void sws_freeContext(struct SwsContext *swsContext);
117
struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags,
118
* Allocates and returns a SwsContext. You need it to perform
119
* scaling/conversion operations using sws_scale().
121
* @param srcW the width of the source image
122
* @param srcH the height of the source image
123
* @param srcFormat the source image format
124
* @param dstW the width of the destination image
125
* @param dstH the height of the destination image
126
* @param dstFormat the destination image format
127
* @param flags specify which algorithm and options to use for rescaling
128
* @return a pointer to an allocated context, or NULL in case of error
130
struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int dstW, int dstH, enum PixelFormat dstFormat, int flags,
118
131
SwsFilter *srcFilter, SwsFilter *dstFilter, double *param);
119
int sws_scale(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
134
* Scales the image slice in \p srcSlice and puts the resulting scaled
135
* slice in the image in \p dst. A slice is a sequence of consecutive
138
* @param context the scaling context previously created with
140
* @param srcSlice the array containing the pointers to the planes of
142
* @param srcStride the array containing the strides for each plane of
144
* @param srcSliceY the position in the source image of the slice to
145
* process, that is the number (counted starting from
146
* zero) in the image of the first row of the slice
147
* @param srcSliceH the height of the source slice, that is the number
148
* of rows in the slice
149
* @param dst the array containing the pointers to the planes of
150
* the destination image
151
* @param dstStride the array containing the strides for each plane of
152
* the destination image
153
* @return the height of the output slice
155
int sws_scale(struct SwsContext *context, uint8_t* srcSlice[], int srcStride[], int srcSliceY,
120
156
int srcSliceH, uint8_t* dst[], int dstStride[]);
157
#if LIBSWSCALE_VERSION_MAJOR < 1
159
* @deprecated Use sws_scale() instead.
121
161
int sws_scale_ordered(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
122
162
int srcSliceH, uint8_t* dst[], int dstStride[]) attribute_deprecated;
125
166
int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation);
126
167
int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation);
170
* Returns a normalized Gaussian curve used to filter stuff
171
* quality=3 is high quality, lower is lower quality.
127
173
SwsVector *sws_getGaussianVec(double variance, double quality);
176
* Allocates and returns a vector with \p length coefficients, all
177
* with the same value \p c.
128
179
SwsVector *sws_getConstVec(double c, int length);
182
* Allocates and returns a vector with just one coefficient, with
129
185
SwsVector *sws_getIdentityVec(void);
188
* Scales all the coefficients of \p a by the \p scalar value.
130
190
void sws_scaleVec(SwsVector *a, double scalar);
193
* Scales all the coefficients of \p a so that their sum equals \p
131
196
void sws_normalizeVec(SwsVector *a, double height);
132
197
void sws_convVec(SwsVector *a, SwsVector *b);
133
198
void sws_addVec(SwsVector *a, SwsVector *b);
134
199
void sws_subVec(SwsVector *a, SwsVector *b);
135
200
void sws_shiftVec(SwsVector *a, int shift);
203
* Allocates and returns a clone of the vector \p a, that is a vector
204
* with the same coefficients as \p a.
136
206
SwsVector *sws_cloneVec(SwsVector *a);
138
void sws_printVec(SwsVector *a);
208
#if LIBSWSCALE_VERSION_MAJOR < 1
210
* @deprecated Use sws_printVec2() instead.
212
attribute_deprecated void sws_printVec(SwsVector *a);
216
* Prints with av_log() a textual representation of the vector \p a
217
* if \p log_level <= av_log_level.
219
void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level);
139
221
void sws_freeVec(SwsVector *a);
141
223
SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
142
float lumaSarpen, float chromaSharpen,
224
float lumaSharpen, float chromaSharpen,
143
225
float chromaHShift, float chromaVShift,
145
227
void sws_freeFilter(SwsFilter *filter);
230
* Checks if \p context can be reused, otherwise reallocates a new
233
* If \p context is NULL, just calls sws_getContext() to get a new
234
* context. Otherwise, checks if the parameters are the ones already
235
* saved in \p context. If that is the case, returns the current
236
* context. Otherwise, frees \p context and gets a new context with
237
* the new parameters.
239
* Be warned that \p srcFilter and \p dstFilter are not checked, they
240
* are assumed to remain the same.
147
242
struct SwsContext *sws_getCachedContext(struct SwsContext *context,
148
int srcW, int srcH, int srcFormat,
149
int dstW, int dstH, int dstFormat, int flags,
243
int srcW, int srcH, enum PixelFormat srcFormat,
244
int dstW, int dstH, enum PixelFormat dstFormat, int flags,
150
245
SwsFilter *srcFilter, SwsFilter *dstFilter, double *param);
152
247
#endif /* SWSCALE_SWSCALE_H */