aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale/slice.c
diff options
context:
space:
mode:
authorPedro Arthur <bygrandao@gmail.com>2015-08-18 11:47:55 -0300
committerPedro Arthur <bygrandao@gmail.com>2015-08-19 10:43:52 -0300
commit62d176de1224f6b9921a53171e5daa7460d5a772 (patch)
treed5586b93eaf7f2071b0f4018eb06b64ec48c545c /libswscale/slice.c
parentfffae8e605c8a665eac0ae63c3c84f60efbec73e (diff)
downloadffmpeg-62d176de1224f6b9921a53171e5daa7460d5a772.tar.gz
swscale: refactor vertical scaler
Diffstat (limited to 'libswscale/slice.c')
-rw-r--r--libswscale/slice.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/libswscale/slice.c b/libswscale/slice.c
index 611e4e6f26..8fd16d3588 100644
--- a/libswscale/slice.c
+++ b/libswscale/slice.c
@@ -214,6 +214,7 @@ int ff_init_filters(SwsContext * c)
int index;
int num_ydesc;
int num_cdesc;
+ int num_vdesc = isPlanarYUV(c->dstFormat) && !isGray(c->dstFormat) ? 2 : 1;
int need_lum_conv = c->lumToYV12 || c->readLumPlanar || c->alpToYV12 || c->readAlpPlanar;
int need_chr_conv = c->chrToYV12 || c->readChrPlanar;
int srcIdx, dstIdx;
@@ -228,8 +229,8 @@ int ff_init_filters(SwsContext * c)
num_ydesc = need_lum_conv ? 2 : 1;
num_cdesc = need_chr_conv ? 2 : 1;
- c->numSlice = FFMAX(num_ydesc, num_cdesc) + 1;
- c->numDesc = num_ydesc + num_cdesc;
+ c->numSlice = FFMAX(num_ydesc, num_cdesc) + 2;
+ c->numDesc = num_ydesc + num_cdesc + num_vdesc;
c->descIndex[0] = num_ydesc;
c->descIndex[1] = num_ydesc + num_cdesc;
@@ -243,12 +244,13 @@ int ff_init_filters(SwsContext * c)
res = alloc_slice(&c->slice[0], c->srcFormat, c->srcH, c->chrSrcH, c->chrSrcHSubSample, c->chrSrcVSubSample, 0);
if (res < 0) goto cleanup;
- for (i = 1; i < c->numSlice-1; ++i) {
+ for (i = 1; i < c->numSlice-2; ++i) {
res = alloc_slice(&c->slice[i], c->srcFormat, c->vLumFilterSize + MAX_LINES_AHEAD, c->vChrFilterSize + MAX_LINES_AHEAD, c->chrSrcHSubSample, c->chrSrcVSubSample, 0);
if (res < 0) goto cleanup;
res = alloc_lines(&c->slice[i], FFALIGN(c->srcW*2+78, 16), c->srcW);
if (res < 0) goto cleanup;
}
+ // horizontal scaler output
res = alloc_slice(&c->slice[i], c->srcFormat, c->vLumFilterSize + MAX_LINES_AHEAD, c->vChrFilterSize + MAX_LINES_AHEAD, c->chrDstHSubSample, c->chrDstVSubSample, 1);
if (res < 0) goto cleanup;
res = alloc_lines(&c->slice[i], dst_stride, c->dstW);
@@ -256,6 +258,11 @@ int ff_init_filters(SwsContext * c)
fill_ones(&c->slice[i], dst_stride>>1, c->dstBpc == 16);
+ // vertical scaler output
+ ++i;
+ res = alloc_slice(&c->slice[i], c->dstFormat, c->dstH, c->chrDstH, c->chrDstHSubSample, c->chrDstVSubSample, 0);
+ if (res < 0) goto cleanup;
+
index = 0;
srcIdx = 0;
dstIdx = 1;
@@ -290,6 +297,13 @@ int ff_init_filters(SwsContext * c)
ff_init_desc_no_chr(&c->desc[index], &c->slice[srcIdx], &c->slice[dstIdx]);
}
+ ++index;
+ {
+ srcIdx = c->numSlice - 2;
+ dstIdx = c->numSlice - 1;
+ ff_init_vscale(c, c->desc + index, c->slice + srcIdx, c->slice + dstIdx);
+ }
+
return 0;
cleanup: