[vlc-commits] [Git][videolan/vlc][master] 4 commits: omxil: remove always NULL parameter in CopyOmxPicture()

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Oct 21 06:05:31 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
5abb10ff by Steve Lhomme at 2023-10-21T05:39:22+00:00
omxil: remove always NULL parameter in CopyOmxPicture()

- - - - -
3ec62e80 by Steve Lhomme at 2023-10-21T05:39:22+00:00
omxil: remove dead code

Now that OMX_COLOR_FormatYUV420SemiPlanar is mapped to NV12, we don't need to
transform it into YUV12.

- - - - -
a8c3f249 by Steve Lhomme at 2023-10-21T05:39:22+00:00
omxil: use plane_CopyPixels() to copy planes in CopyOmxPicture()

- - - - -
0ef14bde by Steve Lhomme at 2023-10-21T05:39:22+00:00
omxil: use plane_CopyPixels() to copy planes in CopyVlcPicture()

The shifting of i_visible_lines between planes seems suspicious but it
was working like that so far...

- - - - -


4 changed files:

- modules/codec/omxil/mediacodec.c
- modules/codec/omxil/omxil.c
- modules/codec/omxil/omxil_utils.h
- modules/codec/omxil/utils.c


Changes:

=====================================
modules/codec/omxil/mediacodec.c
=====================================
@@ -1157,7 +1157,7 @@ static int Video_ProcessOutput(decoder_t *p_dec, mc_api_out *p_out,
                               NULL, NULL, &chroma_div);
             CopyOmxPicture(p_sys->video.i_pixel_format, p_pic,
                            p_sys->video.i_slice_height, p_sys->video.i_stride,
-                           (uint8_t *)p_out->buf.p_ptr, chroma_div, NULL);
+                           (uint8_t *)p_out->buf.p_ptr, chroma_div);
 
             if (p_sys->api.release_out(&p_sys->api, p_out->buf.i_index, false))
             {


=====================================
modules/codec/omxil/omxil.c
=====================================
@@ -1272,7 +1272,7 @@ static int DecodeVideoOutput( decoder_t *p_dec, OmxPort *p_port, picture_t **pp_
                                    p_pic, p_port->definition.format.video.nSliceHeight,
                                    p_port->i_frame_stride,
                                    p_header->pBuffer + p_header->nOffset,
-                                   p_port->i_frame_stride_chroma_div, NULL);
+                                   p_port->i_frame_stride_chroma_div);
             }
 
             if (p_pic)


=====================================
modules/codec/omxil/omxil_utils.h
=====================================
@@ -191,22 +191,9 @@ void PrintOmxEvent(vlc_object_t *p_this, OMX_EVENTTYPE event, OMX_U32 data_1,
 /*****************************************************************************
  * Picture utility functions
  *****************************************************************************/
-typedef struct ArchitectureSpecificCopyData
-{
-    void *data;
-} ArchitectureSpecificCopyData;
-
-void ArchitectureSpecificCopyHooks( decoder_t *p_dec, int i_color_format,
-                                    int i_slice_height, int i_src_stride,
-                                    ArchitectureSpecificCopyData *p_architecture_specific );
-
-void ArchitectureSpecificCopyHooksDestroy( int i_color_format,
-                                           ArchitectureSpecificCopyData *p_architecture_specific );
-
 void CopyOmxPicture( int i_color_format, picture_t *p_pic,
                      int i_slice_height,
-                     int i_src_stride, uint8_t *p_src, int i_chroma_div,
-                     ArchitectureSpecificCopyData *p_architecture_specific );
+                     int i_src_stride, uint8_t *p_src, int i_chroma_div );
 
 void CopyVlcPicture( decoder_t *, OMX_BUFFERHEADERTYPE *, picture_t * );
 


=====================================
modules/codec/omxil/utils.c
=====================================
@@ -166,92 +166,28 @@ void PrintOmxEvent(vlc_object_t *p_this, OMX_EVENTTYPE event, OMX_U32 data_1,
 /*****************************************************************************
  * Picture utility functions
  *****************************************************************************/
-void ArchitectureSpecificCopyHooks( decoder_t *p_dec, int i_color_format,
-                                    int i_slice_height, int i_src_stride,
-                                    ArchitectureSpecificCopyData *p_architecture_specific )
-{
-    (void)i_slice_height;
-
-#ifdef CAN_COMPILE_SSE2
-    if( i_color_format == OMX_COLOR_FormatYUV420SemiPlanar && vlc_CPU_SSE2() )
-    {
-        copy_cache_t *p_surface_cache = malloc( sizeof(copy_cache_t) );
-        if( !p_surface_cache || CopyInitCache( p_surface_cache, i_src_stride ) )
-        {
-            free( p_surface_cache );
-            return;
-        }
-        p_architecture_specific->data = p_surface_cache;
-        p_dec->fmt_out.i_codec = VLC_CODEC_YV12;
-    }
-#else
-    VLC_UNUSED(p_dec);
-    VLC_UNUSED(i_color_format);
-    VLC_UNUSED(i_src_stride);
-    VLC_UNUSED(p_architecture_specific);
-#endif
-}
-
-void ArchitectureSpecificCopyHooksDestroy( int i_color_format,
-                                           ArchitectureSpecificCopyData *p_architecture_specific )
-{
-    if (!p_architecture_specific->data)
-        return;
-#ifdef CAN_COMPILE_SSE2
-    if( i_color_format == OMX_COLOR_FormatYUV420SemiPlanar && vlc_CPU_SSE2() )
-    {
-        copy_cache_t *p_surface_cache = (copy_cache_t*)p_architecture_specific->data;
-        CopyCleanCache(p_surface_cache);
-    }
-#else
-    VLC_UNUSED(i_color_format);
-#endif
-    free(p_architecture_specific->data);
-    p_architecture_specific->data = NULL;
-}
-
 void CopyOmxPicture( int i_color_format, picture_t *p_pic,
                      int i_slice_height,
-                     int i_src_stride, uint8_t *p_src, int i_chroma_div,
-                     ArchitectureSpecificCopyData *p_architecture_specific )
+                     int i_src_stride, uint8_t *p_src, int i_chroma_div )
 {
-    uint8_t *p_dst;
-    int i_dst_stride;
-    int i_plane, i_width, i_line;
     if( i_color_format == QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka )
     {
         qcom_convert(p_src, p_pic);
         return;
     }
-#ifdef CAN_COMPILE_SSE2
-    if( i_color_format == OMX_COLOR_FormatYUV420SemiPlanar
-        && vlc_CPU_SSE2() && p_architecture_specific && p_architecture_specific->data )
-    {
-        copy_cache_t *p_surface_cache = (copy_cache_t*)p_architecture_specific->data;
-        const uint8_t *ppi_src_pointers[2] = { p_src, p_src + i_src_stride * i_slice_height };
-        const size_t pi_src_strides[2] = { i_src_stride, i_src_stride };
-        Copy420_SP_to_P( p_pic, ppi_src_pointers, pi_src_strides,
-                         i_slice_height, p_surface_cache );
-        picture_SwapUV( p_pic );
-        return;
-    }
-#else
-    VLC_UNUSED(p_architecture_specific);
-#endif
 
-    for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
+    for( int i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
     {
         if(i_plane == 1) i_src_stride /= i_chroma_div;
-        p_dst = p_pic->p[i_plane].p_pixels;
-        i_dst_stride = p_pic->p[i_plane].i_pitch;
-        i_width = p_pic->p[i_plane].i_visible_pitch;
 
-        for( i_line = 0; i_line < p_pic->p[i_plane].i_visible_lines; i_line++ )
-        {
-            memcpy( p_dst, p_src, i_width );
-            p_src += i_src_stride;
-            p_dst += i_dst_stride;
-        }
+        plane_t plane_src = p_pic->p[i_plane];
+        plane_src.p_pixels = p_src;
+        plane_src.i_pitch = i_src_stride;
+
+        plane_CopyPixels(&p_pic->p[i_plane], &plane_src);
+
+        p_src += i_src_stride * p_pic->p[i_plane].i_visible_lines;
+
         /* Handle plane height, which may be indicated via nSliceHeight in OMX.
          * The handling for chroma planes currently assumes vertically
          * subsampled chroma, e.g. 422 planar wouldn't work right. */
@@ -266,26 +202,23 @@ void CopyVlcPicture( decoder_t *p_dec, OMX_BUFFERHEADERTYPE *p_header,
                      picture_t *p_pic)
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
-    int i_src_stride, i_dst_stride;
-    int i_plane, i_width, i_line;
-    uint8_t *p_dst, *p_src;
+    int i_dst_stride;
+    uint8_t *p_dst;
 
     i_dst_stride  = p_sys->out.i_frame_stride;
     p_dst = p_header->pBuffer + p_header->nOffset;
 
-    for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
+    for( int i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
     {
         if(i_plane == 1) i_dst_stride /= p_sys->in.i_frame_stride_chroma_div;
-        p_src = p_pic->p[i_plane].p_pixels;
-        i_src_stride = p_pic->p[i_plane].i_pitch;
-        i_width = p_pic->p[i_plane].i_visible_pitch;
 
-        for( i_line = 0; i_line < p_pic->p[i_plane].i_visible_lines; i_line++ )
-        {
-            memcpy( p_dst, p_src, i_width );
-            p_src += i_src_stride;
-            p_dst += i_dst_stride;
-        }
+        plane_t plane_dst = p_pic->p[i_plane];
+        plane_dst.p_pixels = p_dst;
+        plane_dst.i_pitch = i_dst_stride;
+
+        plane_CopyPixels(&plane_dst, &p_pic->p[i_plane]);
+
+        p_dst += i_dst_stride * p_pic->p[i_plane].i_visible_lines;
     }
 }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2f151384786096af1c8940bc5d8282c971be809e...0ef14bde4d6b7a722e50efef30555f893cd0ee5d

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2f151384786096af1c8940bc5d8282c971be809e...0ef14bde4d6b7a722e50efef30555f893cd0ee5d
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