This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] TDA4VM:如何将 GStreamer 与 Vx_image 数据结合使用

Guru**** 2337880 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1513268/tda4vm-how-to-use-gstreamer-with-vx_image-data

器件型号:TDA4VM

工具/软件:

您好!

我有定制板。 我没有屏幕。 我有 imx390摄像头、该摄像头由 R5F 内核上的 RTOS 管理。 为了测试我的设置、我使用 vx_app_single_camera 演示。 我知道它是有效的、因为我捕获了图像、但我想使用 GStreamer 流式传输视频。 我知道 TI 提供了 GST_Wrapper、但我不知道如何将其与 Vx_image 一起使用。 是否有任何使用 vx_image 数据作为 gst_wrapper 参数的示例应用程序?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Lukasz:

    您能否提供您的硬件和软件平台?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Lukasz:

    Unknown 说:
    我有 imx390摄像头、该摄像头由 R5F 内核上的 RTOS 管理。
    Unknown 说:
    、但我想使用 GStreamer 流式传输视频。 [/报价]

    在 TI S/W 平台上、它通常是 RTOS (单摄像头应用)或 edgeai (gstreamer)、但不能同时是两者。
    通过 edgeai、Linux 端的传感器驱动程序。

    Unknown 说:
    我有定制电路板。 我没有屏幕。

    复制我的朋友 Fabiana Jaimes 为她的评论。

    [/quote]
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您知道、我的摄像头由 RTOS 管理、但使用单摄像头演示时、指向图像的指针可从 A72内核获得。 因此、我的理解是、我可以以某种方式使用这些可用数据通过 gstreamer 发送它们。 现在,我想我可以创建新节点,并重复使用函数-经过一些修改-将 YUV420映像写入文件。

    vx_int32 write_output_image_fp(FILE * fp, vx_image out_image)
    {
        vx_uint32 width, height;
        vx_df_image df;
        vx_imagepatch_addressing_t image_addr;
        vx_rectangle_t rect;
        vx_map_id map_id1, map_id2;
        void *data_ptr1, *data_ptr2;
        vx_uint32 num_bytes_per_4pixels;
        vx_uint32 num_luma_bytes_written_to_file=0;
        vx_uint32 num_chroma_bytes_written_to_file=0;
        vx_uint32 num_bytes_written_to_file=0;
        vx_uint32 imgaddr_width, imgaddr_height, imgaddr_stride;
        int i;
    
        vxQueryImage(out_image, VX_IMAGE_WIDTH, &width, sizeof(vx_uint32));
        vxQueryImage(out_image, VX_IMAGE_HEIGHT, &height, sizeof(vx_uint32));
        vxQueryImage(out_image, VX_IMAGE_FORMAT, &df, sizeof(vx_df_image));
    
    
        if(VX_DF_IMAGE_NV12 == df)
        {
            num_bytes_per_4pixels = 4;
        }
        else if(TIVX_DF_IMAGE_NV12_P12 == df)
        {
            num_bytes_per_4pixels = 6;
        }
        else
        {
            num_bytes_per_4pixels = 8;
        }
    
        rect.start_x = 0;
        rect.start_y = 0;
        rect.end_x = width;
        rect.end_y = height;
    
        vxMapImagePatch(out_image,
            &rect,
            0,
            &map_id1,
            &image_addr,
            &data_ptr1,
            VX_WRITE_ONLY,
            VX_MEMORY_TYPE_HOST,
            VX_NOGAP_X
            );
    
        if(!data_ptr1)
        {
            printf("data_ptr1 is NULL \n");
            return -1;
        }
    
        imgaddr_width  = image_addr.dim_x;
        imgaddr_height = image_addr.dim_y;
        imgaddr_stride = image_addr.stride_y;
        printf("imgaddr_width = %d \n", imgaddr_width);
        printf("imgaddr_height = %d \n", imgaddr_height);
        printf("imgaddr_stride = %d \n", imgaddr_stride);
        printf("width = %d \n", width);
        printf("height = %d \n", height);
    
        num_luma_bytes_written_to_file = 0;
    
        for(i=0;i<height;i++)
        {
            num_luma_bytes_written_to_file  += fwrite(data_ptr1, 1, width*num_bytes_per_4pixels/4, fp);
            data_ptr1 += imgaddr_stride;
        }
        vxUnmapImagePatch(out_image, map_id1);
    
        fflush(fp);
    
    
        if(VX_DF_IMAGE_NV12 == df || TIVX_DF_IMAGE_NV12_P12 == df)
        {
            vxMapImagePatch(out_image,
                &rect,
                1,
                &map_id2,
                &image_addr,
                &data_ptr2,
                VX_WRITE_ONLY,
                VX_MEMORY_TYPE_HOST,
                VX_NOGAP_X
                );
    
            if(!data_ptr2)
            {
                printf("data_ptr2 is NULL \n");
                return -1;
            }
    
            imgaddr_width  = image_addr.dim_x;
            imgaddr_height = image_addr.dim_y;
            imgaddr_stride = image_addr.stride_y;
    
            num_chroma_bytes_written_to_file = 0;
            for(i=0;i<imgaddr_height/2;i++)
            {
                num_chroma_bytes_written_to_file  += fwrite(data_ptr2, 1, imgaddr_width*num_bytes_per_4pixels/4, fp);
                data_ptr2 += imgaddr_stride;
            }
    
            fflush(fp);
    
            vxUnmapImagePatch(out_image, map_id2);
        }
    
        num_bytes_written_to_file = num_luma_bytes_written_to_file + num_chroma_bytes_written_to_file;
        printf("Written %d bytes \n", num_bytes_written_to_file);
    
        return num_bytes_written_to_file;
    }

    我认为接下来我可以使用该缓冲区作为   appGstSrcInit / appCodecSrcInit  函数的输入。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Lukasz,

    您知道、我的摄像头由 RTOS 管理、但使用单摄像头演示时、可以从 A72内核获取指向图像的指针。 因此、我的理解是、我可以以某种方式使用这些可用数据通过 gstreamer 发送它们。 [/报价]

    我认为 TI SDK 没有实施/测试过这个功能。
    gstreamer 模块/插件级别可能需要进行相当多的软件更改、但我不熟悉这些软件详细信息。

    复制我的朋友 Rahul RavikumarFabiana Jaimes 的评论。