[vlc-commits] [Git][videolan/vlc][master] codec: aribcaption: use planeCopyPixels and check format

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Sep 16 04:23:58 UTC 2022



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
838e1ecd by Francois Cartegnie at 2022-09-16T03:50:06+00:00
codec: aribcaption: use planeCopyPixels and check format

- - - - -


1 changed file:

- modules/codec/arib/libaribcaption.c


Changes:

=====================================
modules/codec/arib/libaribcaption.c
=====================================
@@ -134,17 +134,18 @@ static int SubpictureValidate(subpicture_t *p_subpic,
 
 static void CopyImageToRegion(subpicture_region_t *p_region, const aribcc_image_t *image)
 {
-    const plane_t *p = &p_region->p_picture->p[0];
-    const int i_height = p_region->fmt.i_height;
-    const uint32_t copy_line_size = __MIN(image->stride, p->i_pitch);
-
-    memset(p->p_pixels, 0, p->i_pitch * p->i_visible_lines);
+    if(image->pixel_format != ARIBCC_PIXELFORMAT_RGBA8888)
+        return;
 
-    for (int y = 0; y < i_height; y++) {
-        const uint8_t *src_line_begin = image->bitmap + y * image->stride;
-        uint8_t *dst_line_begin = p->p_pixels + y * p->i_pitch;
-        memcpy(dst_line_begin, src_line_begin, copy_line_size);
-    }
+    plane_t *p_dstplane = &p_region->p_picture->p[0];
+    plane_t srcplane;
+    srcplane.i_lines = image->height;
+    srcplane.i_pitch = image->stride;
+    srcplane.i_pixel_pitch = p_dstplane->i_pixel_pitch;
+    srcplane.i_visible_lines = image->height;
+    srcplane.i_visible_pitch = image->width /* in pixels */ * p_dstplane->i_pixel_pitch;
+    srcplane.p_pixels = image->bitmap;
+    plane_CopyPixels( p_dstplane, &srcplane );
 }
 
 static void SubpictureUpdate(subpicture_t *p_subpic,



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/838e1ecd476aa34ea2d665f46225ea0d18421239

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/838e1ecd476aa34ea2d665f46225ea0d18421239
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list