Skip to content

Commit 2d38141

Browse files
committed
swscale/swscale_internal: Don't export internal function
sws_alloc_set_opts() can actually be made internal to utils.c. This commit does so. Signed-off-by: Andreas Rheinhardt <[email protected]>
1 parent ad1cef0 commit 2d38141

File tree

2 files changed

+43
-51
lines changed

2 files changed

+43
-51
lines changed

libswscale/swscale_internal.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,17 +1003,6 @@ void ff_hcscale_fast_mmxext(SwsContext *c, int16_t *dst1, int16_t *dst2,
10031003
int dstWidth, const uint8_t *src1,
10041004
const uint8_t *src2, int srcW, int xInc);
10051005

1006-
/**
1007-
* Allocate and return an SwsContext.
1008-
* This is like sws_getContext() but does not perform the init step, allowing
1009-
* the user to set additional AVOptions.
1010-
*
1011-
* @see sws_getContext()
1012-
*/
1013-
struct SwsContext *sws_alloc_set_opts(int srcW, int srcH, enum AVPixelFormat srcFormat,
1014-
int dstW, int dstH, enum AVPixelFormat dstFormat,
1015-
int flags, const double *param);
1016-
10171006
int ff_sws_alphablendaway(SwsContext *c, const uint8_t *src[],
10181007
int srcStride[], int srcSliceY, int srcSliceH,
10191008
uint8_t *dst[], int dstStride[]);

libswscale/utils.c

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,34 @@ static const FormatEntry format_entries[] = {
269269
[AV_PIX_FMT_XV36LE] = { 1, 1 },
270270
};
271271

272+
/**
273+
* Allocate and return an SwsContext without performing initialization.
274+
*/
275+
static SwsContext *alloc_set_opts(int srcW, int srcH, enum AVPixelFormat srcFormat,
276+
int dstW, int dstH, enum AVPixelFormat dstFormat,
277+
int flags, const double *param)
278+
{
279+
SwsContext *c = sws_alloc_context();
280+
281+
if (!c)
282+
return NULL;
283+
284+
c->flags = flags;
285+
c->srcW = srcW;
286+
c->srcH = srcH;
287+
c->dstW = dstW;
288+
c->dstH = dstH;
289+
c->srcFormat = srcFormat;
290+
c->dstFormat = dstFormat;
291+
292+
if (param) {
293+
c->param[0] = param[0];
294+
c->param[1] = param[1];
295+
}
296+
297+
return c;
298+
}
299+
272300
int ff_shuffle_filter_coefficients(SwsContext *c, int *filterPos,
273301
int filterSize, int16_t *filter,
274302
int dstW)
@@ -1101,9 +1129,9 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
11011129
if (ret < 0)
11021130
return ret;
11031131

1104-
c->cascaded_context[0] = sws_alloc_set_opts(srcW, srcH, c->srcFormat,
1105-
tmp_width, tmp_height, tmp_format,
1106-
c->flags, c->param);
1132+
c->cascaded_context[0] = alloc_set_opts(srcW, srcH, c->srcFormat,
1133+
tmp_width, tmp_height, tmp_format,
1134+
c->flags, c->param);
11071135
if (!c->cascaded_context[0])
11081136
return -1;
11091137

@@ -1116,9 +1144,9 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
11161144
srcRange, table, dstRange,
11171145
brightness, contrast, saturation);
11181146

1119-
c->cascaded_context[1] = sws_alloc_set_opts(tmp_width, tmp_height, tmp_format,
1120-
dstW, dstH, c->dstFormat,
1121-
c->flags, c->param);
1147+
c->cascaded_context[1] = alloc_set_opts(tmp_width, tmp_height, tmp_format,
1148+
dstW, dstH, c->dstFormat,
1149+
c->flags, c->param);
11221150
if (!c->cascaded_context[1])
11231151
return -1;
11241152
c->cascaded_context[1]->srcRange = srcRange;
@@ -1682,19 +1710,19 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter,
16821710
if (ret < 0)
16831711
return ret;
16841712

1685-
c->cascaded_context[0] = sws_alloc_set_opts(srcW, srcH, srcFormat,
1686-
srcW, srcH, tmpFormat,
1687-
flags, c->param);
1713+
c->cascaded_context[0] = alloc_set_opts(srcW, srcH, srcFormat,
1714+
srcW, srcH, tmpFormat,
1715+
flags, c->param);
16881716
if (!c->cascaded_context[0])
16891717
return AVERROR(EINVAL);
16901718
c->cascaded_context[0]->alphablend = c->alphablend;
16911719
ret = sws_init_context(c->cascaded_context[0], NULL , NULL);
16921720
if (ret < 0)
16931721
return ret;
16941722

1695-
c->cascaded_context[1] = sws_alloc_set_opts(srcW, srcH, tmpFormat,
1696-
dstW, dstH, dstFormat,
1697-
flags, c->param);
1723+
c->cascaded_context[1] = alloc_set_opts(srcW, srcH, tmpFormat,
1724+
dstW, dstH, dstFormat,
1725+
flags, c->param);
16981726
if (!c->cascaded_context[1])
16991727
return AVERROR(EINVAL);
17001728

@@ -2066,41 +2094,16 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
20662094
return sws_init_single_context(c, srcFilter, dstFilter);
20672095
}
20682096

2069-
SwsContext *sws_alloc_set_opts(int srcW, int srcH, enum AVPixelFormat srcFormat,
2070-
int dstW, int dstH, enum AVPixelFormat dstFormat,
2071-
int flags, const double *param)
2072-
{
2073-
SwsContext *c;
2074-
2075-
if (!(c = sws_alloc_context()))
2076-
return NULL;
2077-
2078-
c->flags = flags;
2079-
c->srcW = srcW;
2080-
c->srcH = srcH;
2081-
c->dstW = dstW;
2082-
c->dstH = dstH;
2083-
c->srcFormat = srcFormat;
2084-
c->dstFormat = dstFormat;
2085-
2086-
if (param) {
2087-
c->param[0] = param[0];
2088-
c->param[1] = param[1];
2089-
}
2090-
2091-
return c;
2092-
}
2093-
20942097
SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat,
20952098
int dstW, int dstH, enum AVPixelFormat dstFormat,
20962099
int flags, SwsFilter *srcFilter,
20972100
SwsFilter *dstFilter, const double *param)
20982101
{
20992102
SwsContext *c;
21002103

2101-
c = sws_alloc_set_opts(srcW, srcH, srcFormat,
2102-
dstW, dstH, dstFormat,
2103-
flags, param);
2104+
c = alloc_set_opts(srcW, srcH, srcFormat,
2105+
dstW, dstH, dstFormat,
2106+
flags, param);
21042107
if (!c)
21052108
return NULL;
21062109

0 commit comments

Comments
 (0)