Janne Grunau <[email protected]> writes:

> On 2011-12-27 11:08:33 +0000, Måns Rullgård wrote:
>> Janne Grunau <[email protected]> writes:
>> 
>> > Writes past the end of the destination buffer were occuring when its
>> > stride was smaller than the stride of the source. Fixes Bug #183.
>> > ---
>> >  libswscale/swscale_unscaled.c |    3 ++-
>> >  1 files changed, 2 insertions(+), 1 deletions(-)
>> >
>> > diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
>> > index 34b0f24..7c339b6 100644
>> > --- a/libswscale/swscale_unscaled.c
>> > +++ b/libswscale/swscale_unscaled.c
>> > @@ -285,9 +285,10 @@ static int packed_16bpc_bswap(SwsContext *c, const 
>> > uint8_t *src[],
>> >      int dststr = dstStride[0] >> 1;
>> >      uint16_t       *dstPtr =       (uint16_t *) dst[0];
>> >      const uint16_t *srcPtr = (const uint16_t *) src[0];
>> > +    int min_stride         = FFMIN(srcstr, dststr);
>> >
>> >      for (i = 0; i < srcSliceH; i++) {
>> > -        for (j = 0; j < srcstr; j++) {
>> > +        for (j = 0; j < min_stride; j++) {
>> >              dstPtr[j] = av_bswap16(srcPtr[j]);
>> >          }
>> >          srcPtr += srcstr;
>> > -- 
>> 
>> Why is this using stride and not width?
>
> Easiest way to handle 16 bit per component and per pixel in the same
> function. in hindsight probably not the best idea.

num_swap = width_in_bytes / 2, no?

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to