diff options
author | Pedro Arthur <bygrandao@gmail.com> | 2015-09-04 18:11:21 -0300 |
---|---|---|
committer | Pedro Arthur <bygrandao@gmail.com> | 2015-09-04 19:00:20 -0300 |
commit | 3059562aa19a576bdf900a4875c1aa69ef69c86e (patch) | |
tree | 93638cfb4d090e600626060865a89b2e25b75ddb /libswscale/slice.c | |
parent | f67aff3ad7168b0721e7e5ba05858d885966534a (diff) | |
download | ffmpeg-3059562aa19a576bdf900a4875c1aa69ef69c86e.tar.gz |
swscale: re-enable gamma
+added gamma conversion to refactored code
Diffstat (limited to 'libswscale/slice.c')
-rw-r--r-- | libswscale/slice.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/libswscale/slice.c b/libswscale/slice.c index 44376728a0..94841e5776 100644 --- a/libswscale/slice.c +++ b/libswscale/slice.c @@ -217,6 +217,7 @@ int ff_init_filters(SwsContext * c) 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 need_gamma = c->is_internal_gamma; int srcIdx, dstIdx; int dst_stride = FFALIGN(c->dstW * sizeof(int16_t) + 66, 16); @@ -230,9 +231,9 @@ int ff_init_filters(SwsContext * c) num_cdesc = need_chr_conv ? 2 : 1; 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; + c->numDesc = num_ydesc + num_cdesc + num_vdesc + (need_gamma ? 2 : 0); + c->descIndex[0] = num_ydesc + (need_gamma ? 1 : 0); + c->descIndex[1] = num_ydesc + num_cdesc + (need_gamma ? 1 : 0); @@ -267,6 +268,12 @@ int ff_init_filters(SwsContext * c) srcIdx = 0; dstIdx = 1; + if (need_gamma) { + res = ff_init_gamma_convert(c->desc + index, c->slice + srcIdx, c->inv_gamma); + if (res < 0) goto cleanup; + ++index; + } + if (need_lum_conv) { res = ff_init_desc_fmt_convert(&c->desc[index], &c->slice[srcIdx], &c->slice[dstIdx], pal); if (res < 0) goto cleanup; @@ -309,6 +316,12 @@ int ff_init_filters(SwsContext * c) if (res < 0) goto cleanup; } + ++index; + if (need_gamma) { + res = ff_init_gamma_convert(c->desc + index, c->slice + dstIdx, c->gamma); + if (res < 0) goto cleanup; + } + return 0; cleanup: |