[FFmpeg-devel] [PATCH] swscale: Check whether slice height is multiple of chroma subsample.

Ramiro Polla ramiro.polla
Fri Mar 12 23:38:02 CET 2010


On Tue, Feb 23, 2010 at 11:10 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Tue, Feb 23, 2010 at 10:48:05PM -0300, Ramiro Polla wrote:
>> On Tue, Feb 23, 2010 at 9:07 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> > On Tue, Feb 23, 2010 at 12:20:37AM -0300, Ramiro Polla wrote:
>> >> Hi,
>> >>
>> >> Check whether slice height is multiple of chroma subsample.
>> >>
>> >> Currently if we take a 410p image and rescale with sliceH = 1, the
>> >> output is black&white. I did this using the test tool at [1] (renamed
>> >> to swscale-test2) and the command:
>> >> ./swscale-test2 -i input.bmp -sws_flags bicubic -pix_fmt yuv410p -s
>> >> 320x320 -scale -sliceH 1 -pix_fmt bgr24 -scale -o output.bmp
>> >>
>> >> I found it weird that this code in utils.c expects the slices to start
>> >> on subsample boundaries (by shifting nextSlice back and forth), but
>> >> sws_scale() doesn't:
>> >> ? ? // calculate buffer sizes so that they won't run out while
>> >> handling these damn slices
>> >> ? ? c->vLumBufSize= c->vLumFilterSize;
>> >> ? ? c->vChrBufSize= c->vChrFilterSize;
>> >> ? ? for (i=0; i<dstH; i++) {
>> >> ? ? ? ? int chrI= i*c->chrDstH / dstH;
>> >> ? ? ? ? int nextSlice= FFMAX(c->vLumFilterPos[i ? ] + c->vLumFilterSize - 1,
>> >> ? ? ? ? ? ? ? ? ? ? ? ? ? ?((c->vChrFilterPos[chrI] +
>> >> c->vChrFilterSize - 1)<<c->chrSrcVSubSample));
>> >>
>> >> ? ? ? ? nextSlice>>= c->chrSrcVSubSample;
>> >> ? ? ? ? nextSlice<<= c->chrSrcVSubSample;
>> >> ? ? ? ? if (c->vLumFilterPos[i ? ] + c->vLumBufSize < nextSlice)
>> >> ? ? ? ? ? ? c->vLumBufSize= nextSlice - c->vLumFilterPos[i];
>> >> ? ? ? ? if (c->vChrFilterPos[chrI] + c->vChrBufSize <
>> >> (nextSlice>>c->chrSrcVSubSample))
>> >> ? ? ? ? ? ? c->vChrBufSize= (nextSlice>>c->chrSrcVSubSample) -
>> >> c->vChrFilterPos[chrI];
>> >> ? ? }
>> >>
>> >> Ramiro Polla
>> >> [1] http://article.gmane.org/gmane.comp.video.ffmpeg.devel/102702
>> >
>> >> ?swscale.c | ? ?5 +++++
>> >> ?1 file changed, 5 insertions(+)
>> >> cd845850f322996173e636f2655b7b4d5880feb4 ?0004-Check-whether-slice-height-is-multiple-of-chroma-sub.patch
>> >> From 7b2354c9cf66eaf8d51b527239bc1403354b999c Mon Sep 17 00:00:00 2001
>> >> From: Ramiro Polla <ramiro.polla at gmail.com>
>> >> Date: Tue, 23 Feb 2010 00:12:51 -0300
>> >> Subject: [PATCH] Check whether slice height is multiple of chroma subsample.
>> >
>> > problem is that swscale can return such chroma != luma slices and
>> > chaining slices scalers should work
>>
>> Sorry, I don't understand what you mean by swscale returning chroma !=
>> luma slices. Does this mean swscale should support any combination of
>> chaining slices, even if it's sliceH = 1?
>
> stefano talked about luma != chroma slices
> i assumed these where generated by the scaler
> if so the scaler must either support them as input or never
> generate them as output

Hmm, nevermind. My test program was buggy. But I still didn't
understand what the luma != chroma slices issue was about.



More information about the ffmpeg-devel mailing list