mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
swscale/internal: turn cascaded_tmp into an array
Slightly more convenient to access from the new wrapping code. Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas <git@haasn.dev>
This commit is contained in:
parent
61369484f6
commit
286bdc9cdc
@ -837,26 +837,26 @@ static int scale_gamma(SwsContext *c,
|
||||
{
|
||||
int ret = scale_internal(c->cascaded_context[0],
|
||||
srcSlice, srcStride, srcSliceY, srcSliceH,
|
||||
c->cascaded_tmp, c->cascaded_tmpStride, 0, c->srcH);
|
||||
c->cascaded_tmp[0], c->cascaded_tmpStride[0], 0, c->srcH);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (c->cascaded_context[2])
|
||||
ret = scale_internal(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp,
|
||||
c->cascaded_tmpStride, srcSliceY, srcSliceH,
|
||||
c->cascaded1_tmp, c->cascaded1_tmpStride, 0, c->dstH);
|
||||
ret = scale_internal(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp[0],
|
||||
c->cascaded_tmpStride[0], srcSliceY, srcSliceH,
|
||||
c->cascaded_tmp[1], c->cascaded_tmpStride[1], 0, c->dstH);
|
||||
else
|
||||
ret = scale_internal(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp,
|
||||
c->cascaded_tmpStride, srcSliceY, srcSliceH,
|
||||
ret = scale_internal(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp[0],
|
||||
c->cascaded_tmpStride[0], srcSliceY, srcSliceH,
|
||||
dstSlice, dstStride, dstSliceY, dstSliceH);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (c->cascaded_context[2]) {
|
||||
ret = scale_internal(c->cascaded_context[2], (const uint8_t * const *)c->cascaded1_tmp,
|
||||
c->cascaded1_tmpStride, c->cascaded_context[1]->dstY - ret,
|
||||
ret = scale_internal(c->cascaded_context[2], (const uint8_t * const *)c->cascaded_tmp[1],
|
||||
c->cascaded_tmpStride[1], c->cascaded_context[1]->dstY - ret,
|
||||
c->cascaded_context[1]->dstY,
|
||||
dstSlice, dstStride, dstSliceY, dstSliceH);
|
||||
}
|
||||
@ -871,12 +871,12 @@ static int scale_cascaded(SwsContext *c,
|
||||
{
|
||||
int ret = scale_internal(c->cascaded_context[0],
|
||||
srcSlice, srcStride, srcSliceY, srcSliceH,
|
||||
c->cascaded_tmp, c->cascaded_tmpStride,
|
||||
c->cascaded_tmp[0], c->cascaded_tmpStride[0],
|
||||
0, c->cascaded_context[0]->dstH);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = scale_internal(c->cascaded_context[1],
|
||||
(const uint8_t * const * )c->cascaded_tmp, c->cascaded_tmpStride,
|
||||
(const uint8_t * const * )c->cascaded_tmp[0], c->cascaded_tmpStride[0],
|
||||
0, c->cascaded_context[0]->dstH,
|
||||
dstSlice, dstStride, dstSliceY, dstSliceH);
|
||||
return ret;
|
||||
|
@ -351,10 +351,8 @@ typedef struct SwsContext {
|
||||
* downscaling factor that needs to be supported in one scaler.
|
||||
*/
|
||||
struct SwsContext *cascaded_context[3];
|
||||
int cascaded_tmpStride[4];
|
||||
uint8_t *cascaded_tmp[4];
|
||||
int cascaded1_tmpStride[4];
|
||||
uint8_t *cascaded1_tmp[4];
|
||||
int cascaded_tmpStride[2][4];
|
||||
uint8_t *cascaded_tmp[2][4];
|
||||
int cascaded_mainindex;
|
||||
|
||||
double gamma_value;
|
||||
|
@ -1133,7 +1133,7 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
|
||||
tmp_height = srcH;
|
||||
}
|
||||
|
||||
ret = av_image_alloc(c->cascaded_tmp, c->cascaded_tmpStride,
|
||||
ret = av_image_alloc(c->cascaded_tmp[0], c->cascaded_tmpStride[0],
|
||||
tmp_width, tmp_height, tmp_format, 64);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@ -1613,7 +1613,7 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter,
|
||||
SwsContext *c2;
|
||||
c->cascaded_context[0] = NULL;
|
||||
|
||||
ret = av_image_alloc(c->cascaded_tmp, c->cascaded_tmpStride,
|
||||
ret = av_image_alloc(c->cascaded_tmp[0], c->cascaded_tmpStride[0],
|
||||
srcW, srcH, tmpFmt, 64);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@ -1651,7 +1651,7 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter,
|
||||
|
||||
c->cascaded_context[2] = NULL;
|
||||
if (dstFormat != tmpFmt) {
|
||||
ret = av_image_alloc(c->cascaded1_tmp, c->cascaded1_tmpStride,
|
||||
ret = av_image_alloc(c->cascaded_tmp[1], c->cascaded_tmpStride[1],
|
||||
dstW, dstH, tmpFmt, 64);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@ -1671,7 +1671,7 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter,
|
||||
dstFormat != AV_PIX_FMT_RGB48)) {
|
||||
enum AVPixelFormat tmpFormat = isBayer16BPS(srcFormat) ? AV_PIX_FMT_RGB48 : AV_PIX_FMT_RGB24;
|
||||
|
||||
ret = av_image_alloc(c->cascaded_tmp, c->cascaded_tmpStride,
|
||||
ret = av_image_alloc(c->cascaded_tmp[0], c->cascaded_tmpStride[0],
|
||||
srcW, srcH, tmpFormat, 64);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@ -1714,7 +1714,7 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter,
|
||||
c->srcRange != c->dstRange
|
||||
) {
|
||||
c->cascaded_mainindex = 1;
|
||||
ret = av_image_alloc(c->cascaded_tmp, c->cascaded_tmpStride,
|
||||
ret = av_image_alloc(c->cascaded_tmp[0], c->cascaded_tmpStride[0],
|
||||
srcW, srcH, tmpFormat, 64);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@ -1996,7 +1996,7 @@ fail: // FIXME replace things by appropriate error codes
|
||||
if (srcW*(int64_t)srcH <= 4LL*dstW*dstH)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
ret = av_image_alloc(c->cascaded_tmp, c->cascaded_tmpStride,
|
||||
ret = av_image_alloc(c->cascaded_tmp[0], c->cascaded_tmpStride[0],
|
||||
tmpW, tmpH, tmpFormat, 64);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@ -2490,8 +2490,8 @@ void sws_freeContext(SwsContext *c)
|
||||
sws_freeContext(c->cascaded_context[1]);
|
||||
sws_freeContext(c->cascaded_context[2]);
|
||||
memset(c->cascaded_context, 0, sizeof(c->cascaded_context));
|
||||
av_freep(&c->cascaded_tmp[0]);
|
||||
av_freep(&c->cascaded1_tmp[0]);
|
||||
av_freep(&c->cascaded_tmp[0][0]);
|
||||
av_freep(&c->cascaded_tmp[1][0]);
|
||||
|
||||
av_freep(&c->gamma);
|
||||
av_freep(&c->inv_gamma);
|
||||
|
Loading…
Reference in New Issue
Block a user