Message ID | 20170802231801.24126-1-markboo99@gmail.com |
---|---|
State | New |
Headers | show |
On Thu, Aug 03, 2017 at 12:18:01AM +0100, Mark Boorer wrote: > Fixes: When converting yuv -> yuv and changing any of srcRange, > dstRange, brightness, contrast, or saturation the context would not be > re-initialized as required. > --- > libswscale/utils.c | 3 +++ > 1 file changed, 3 insertions(+) have you confirmed that with this patch these parameters also work ? [...]
I can confirm that range works as expected, but I couldn't actually see any difference when setting brightness, contrast or saturation. It looks as though all of those calculations only take place inside the yuv2rgb lookup table, so when converting from yuv->yuv they won't get applied. In my case I am not using the brightness/contrast/saturation settings, only the range. On Thu, Aug 3, 2017 at 2:52 AM, Michael Niedermayer <michael@niedermayer.cc> wrote: > On Thu, Aug 03, 2017 at 12:18:01AM +0100, Mark Boorer wrote: > > Fixes: When converting yuv -> yuv and changing any of srcRange, > > dstRange, brightness, contrast, or saturation the context would not be > > re-initialized as required. > > --- > > libswscale/utils.c | 3 +++ > > 1 file changed, 3 insertions(+) > > have you confirmed that with this patch these parameters also work ? > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > "I am not trying to be anyone's saviour, I'm trying to think about the > future and not be sad" - Elon Musk > > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > >
On Thu, Aug 03, 2017 at 12:06:34PM +0100, Mark Boorer wrote: > I can confirm that range works as expected, but I couldn't actually see any > difference when setting brightness, contrast or saturation. It looks as > though all of those calculations only take place inside the yuv2rgb lookup > table, so when converting from yuv->yuv they won't get applied. > > In my case I am not using the brightness/contrast/saturation settings, only > the range. Please correct me if iam wrong but IIUC before your patch setting brightness errors out while afterwards it gives a wrong result [...]
diff --git a/libswscale/utils.c b/libswscale/utils.c index 17c9967..9071d3a 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -959,6 +959,9 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], srcRange, table, dstRange, 0, 1 << 16, 1 << 16); return 0; + } else if (!c->cascaded_context[0] && c->srcW && c->srcH && c->dstW && c->dstH) { + int ret = sws_init_context(c, NULL, NULL); + return ret; } return -1; }