From: Limin Wang <lance.lmw...@gmail.com>

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 <lance.lmw...@gmail.com>
---
 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);
-- 
1.8.3.1

_______________________________________________
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".

Reply via email to