On Thu, Jun 03, 2021 at 09:10:13PM +0200, Michael Niedermayer wrote: > On Wed, Jun 02, 2021 at 11:02:44PM +0800, [email protected] wrote: > > From: Limin Wang <[email protected]> > > > > fixes vertical line at the right side of video for rgb24toyv12 conversion. > > Please reproduce it with below command: > > ./ffplay -f lavfi -i > > "testsrc=size=529x656,ocv=filter_name=smooth,format=yuv420p" > > > > Signed-off-by: Limin Wang <[email protected]> > > --- > > libswscale/rgb2rgb_template.c | 2 +- > > libswscale/x86/rgb2rgb_template.c | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c > > index 42c6980..e716ba5 100644 > > --- a/libswscale/rgb2rgb_template.c > > +++ b/libswscale/rgb2rgb_template.c > > @@ -654,7 +654,7 @@ void ff_rgb24toyv12_c(const uint8_t *src, uint8_t > > *ydst, uint8_t *udst, > > int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = > > rgb2yuv[BU_IDX]; > > int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = > > rgb2yuv[BV_IDX]; > > int y; > > - const int chromWidth = width >> 1; > > + const int chromWidth = AV_CEIL_RSHIFT(width, 1); > > > > for (y = 0; y < height; y += 2) { > > int i; > > diff --git a/libswscale/x86/rgb2rgb_template.c > > b/libswscale/x86/rgb2rgb_template.c > > index ae2469e..704b0fa 100644 > > --- a/libswscale/x86/rgb2rgb_template.c > > +++ b/libswscale/x86/rgb2rgb_template.c > > @@ -1578,7 +1578,7 @@ static inline void RENAME(rgb24toyv12)(const uint8_t > > *src, uint8_t *ydst, uint8_ > > #define BGR2U_IDX "16*4+16*33" > > #define BGR2V_IDX "16*4+16*34" > > int y; > > - const x86_reg chromWidth= width>>1; > > + const x86_reg chromWidth = AV_CEIL_RSHIFT(width, 1); > > > > if (height > 2) { > > ff_rgb24toyv12_c(src, ydst, udst, vdst, width, 2, lumStride, > > chromStride, srcStride, rgb2yuv); > > the comments above the functions are incorrect if you add support for odd > width > also the code writes outside the luma array i think with this change
Sorry, I haven't notice the comments say about that, then I prefer not to use the optimized bgr24toYV12 unscaled conversion when width%2. Will update the patch. > > thx > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Those who are too smart to engage in politics are punished by being > governed by those who are dumber. -- Plato > _______________________________________________ > ffmpeg-devel mailing list > [email protected] > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > [email protected] with subject "unsubscribe". -- Thanks, Limin Wang _______________________________________________ ffmpeg-devel mailing list [email protected] https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
