导航

    全志在线开发者论坛

    • 注册
    • 登录
    • 搜索
    • 版块
    • 话题
    • 在线文档
    • 社区主页
    1. 主页
    2. amirhos_esm
    3. 最佳
    A
    • 资料
    • 关注 1
    • 粉丝 0
    • 我的积分 695
    • 主题 1
    • 帖子 4
    • 最佳 1
    • 群组 0

    amirhos_esm 发布的最佳帖子

    • 回复: 使用tinyvision制作简单的网络摄像机IPCv2

      @lajuchenghui
      Great job so far on the implementation!

      I've noticed an opportunity to improve performance significantly in the H264Encoder module. Currently, in the YuvIn function, it appears that the ISP output is being copied to the encoder input. This memory copy operation can negatively impact performance, especially in high-throughput scenarios.

      Here’s the relevant part of the code:

      int H264Encoder::YuvIn(uint8_t *y, uint8_t *c)
      {
          int ret;
          pInputBufInfo = dequeue(&pEncContext->mInputBufMgr.valid_quene);
          LOGV("get input buf, pInputBufInfo = %p", pInputBufInfo);
          if (pInputBufInfo == NULL)
          {
              return -1;
          }
          pInputBuf = &pInputBufInfo->inputbuffer;
      
          memcpy(pInputBuf->pAddrVirY, y, ALIGN_XXB(16, encode_param.src_width) * ALIGN_XXB(16, encode_param.src_height));
          memcpy(pInputBuf->pAddrVirC, c, ALIGN_XXB(16, encode_param.src_width) * ALIGN_XXB(16, encode_param.src_height / 2));
          
          // pInputBuf->pAddrVirY = y;
          // pInputBuf->pAddrVirC = c;
      
          pInputBuf->bEnableCorp = 0;
          pInputBuf->sCropInfo.nLeft = 240;
          pInputBuf->sCropInfo.nTop = 240;
          pInputBuf->sCropInfo.nWidth = 240;
          pInputBuf->sCropInfo.nHeight = 240;
          ...
      }
      
      

      Would it be possible to use a zero-copy approach here? For example, directly assigning the ISP output buffer to the encoder input buffer (pAddrVirY and pAddrVirC) rather than copying data with memcpy. This would reduce the memory overhead and increase performance.

      I understand that there might be constraints, such as alignment requirements or format differences. Could you let me know if there’s a way to enable zero-copy in this context, and if not, what the blockers are?

      I also found this that do the job in V3s

      Thank you, and looking forward to your insights!

      发布在 V Series
      A
      amirhos_esm
    • 1 / 1