On Sun, 06 Oct 2024 17:26:25 +0200 Ramiro Polla <ramiro.po...@gmail.com> wrote: > On Sat, Oct 5, 2024 at 9:25 PM Niklas Haas <ffm...@haasn.xyz> wrote: > > From: Niklas Haas <g...@haasn.dev> > > > > In the process of refactoring the signature to be more generically useful, > > this fixes an 11-year-old bug where the functions (incorrectly) did nothing > > when the stride was negative, since the stride was being used as the loop > > bounds for x. > > > > Sponsored-by: Sovereign Tech Fund > > Signed-off-by: Niklas Haas <g...@haasn.dev> > > --- > > libswscale/swscale.c | 98 +++++++++++++++-------------- > > libswscale/swscale_internal.h | 6 ++ > > tests/ref/fate/filter-pixfmts-vflip | 4 +- > > 3 files changed, 60 insertions(+), 48 deletions(-) > > > > diff --git a/libswscale/swscale.c b/libswscale/swscale.c > > index 8b6a3a84b4..b9ec976be0 100644 > > --- a/libswscale/swscale.c > > +++ b/libswscale/swscale.c > > @@ -636,29 +636,31 @@ static int check_image_pointers(const uint8_t * const > > data[4], enum AVPixelForma > > return 1; > > } > > > > -static void xyz12Torgb48(struct SwsContext *c, uint16_t *dst, > > - const uint16_t *src, int stride, int h) > > +void ff_xyz12Torgb48(const SwsContext *c, uint8_t *dst, int dst_stride, > > + const uint8_t *src, int src_stride, int w, int h) > > { > > - int xp,yp; > > const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat); > > > > - for (yp=0; yp<h; yp++) { > > - for (xp=0; xp+2<stride; xp+=3) { > > + for (int yp = 0; yp < h; yp++) { > > I'm all for moving variable declarations into the for-loop > initializer, and also for improving readability by giving the code > more spaces to breathe, but could these changes be done in separate > cleanup commits?
I can even split it into three commits if you prefer - one to make the width and stride explicit in the signature, and one to rename it to ff_* and expose it publicly. > > [...] > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".