2
2
* High quality image resampling with polyphase filters
3
3
* Copyright (c) 2001 Fabrice Bellard.
5
* This library is free software; you can redistribute it and/or
5
* This file is part of FFmpeg.
7
* FFmpeg is free software; you can redistribute it and/or
6
8
* modify it under the terms of the GNU Lesser General Public
7
9
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
10
* version 2.1 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
12
* FFmpeg is distributed in the hope that it will be useful,
11
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
15
* Lesser General Public License for more details.
15
17
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free Software
18
* License along with FFmpeg; if not, write to the Free Software
17
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
681
* Checks if context is valid or reallocs a new one instead.
682
* If context is NULL, just calls sws_getContext() to get a new one.
683
* Otherwise, checks if the parameters are the same already saved in context.
684
* If that is the case, returns the current context.
685
* Otherwise, frees context and gets a new one.
687
* Be warned that srcFilter, dstFilter are not checked, they are
688
* asumed to remain valid.
690
struct SwsContext *sws_getCachedContext(struct SwsContext *ctx,
691
int srcW, int srcH, int srcFormat,
692
int dstW, int dstH, int dstFormat, int flags,
693
SwsFilter *srcFilter, SwsFilter *dstFilter, double *param)
696
if ((ctx->resampling_ctx->iwidth != srcW) ||
697
(ctx->resampling_ctx->iheight != srcH) ||
698
(ctx->src_pix_fmt != srcFormat) ||
699
(ctx->resampling_ctx->owidth != dstW) ||
700
(ctx->resampling_ctx->oheight != dstH) ||
701
(ctx->dst_pix_fmt != dstFormat))
703
sws_freeContext(ctx);
708
return sws_getContext(srcW, srcH, srcFormat,
709
dstW, dstH, dstFormat, flags,
710
srcFilter, dstFilter, param);
677
715
int sws_scale(struct SwsContext *ctx, uint8_t* src[], int srcStride[],
678
716
int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[])
797
} else if (resampled_picture != &dst_pict) {
798
img_copy(&dst_pict, resampled_picture, current_pix_fmt,
799
ctx->resampling_ctx->owidth, ctx->resampling_ctx->oheight);