国产91九色_日本68xxxx_欧美高清另类自拍视频在线看_欧美人禽_99久久婷婷国产综合精品青牛牛_亚洲射情

中國自動化學會專家咨詢工作委員會指定宣傳媒體
新聞詳情
gkongbbs

G2D圖像處理硬件調用和測試-基于米爾-全志T113-i國產開發板

http://m.sharifulalam.com 2024-04-10 16:52 來源:米爾電子

MYC-YT113i核心板及開發板

真正的國產核心板,100%國產物料認證

國產T113-i處理器配備2*Cortex-A7@1.2GHz ,RISC-V

外置DDR3接口、支持視頻編解碼器、HiFi4 DSP

接口豐富:視頻采集接口、顯示器接口、USB2.0 接口、CAN 接口、千兆以太網接口

工業級:-40℃~+85℃、尺寸37mm*39mm

郵票孔+LGA,140+50PIN

米爾-全志T113-i國產核心板

米爾-全志T113-i國產開發板

全志 T113-i 2D圖形加速硬件支持情況

Supports layer size up to 2048 x 2048 pixels

Supports pre-multiply alpha image data

Supports color key

Supports two pipes Porter-Duff alpha blending

Supports multiple video formats 4:2:0, 4:2:2, 4:1:1 and multiple pixel formats (8/16/24/32 bits graphics

layer)

Supports memory scan order option

Supports any format convert function

Supports 1/16× to 32× resize ratio

Supports 32-phase 8-tap horizontal anti-alias filter and 32-phase 4-tap vertical anti-alias filter

Supports window clip

Supports FillRectangle, BitBlit, StretchBlit and MaskBlit

Supports horizontal and vertical flip, clockwise 0/90/180/270 degree rotate for normal buffer

Supports horizontal flip, clockwise 0/90/270 degree rotate for LBC buffer

可以看到 g2d 硬件支持相當多的2D圖像處理,包括顏色空間轉換,分辨率縮放,圖層疊加,旋轉等。

備注:本文不具體介紹代碼,代碼參見:

https://mp.weixin.qq.com/s/x3NFPAxgt3A8KFLjYPYLlA

1.    開發環境配置

基礎開發環境搭建參考上上上一篇

除了工具鏈外,我們使用 opencv-mobile 加載輸入圖片和保存結果,用來查看顏色轉換是否正常

g2d硬件直接采用標準的 Linux ioctl 操縱,只需要引入相關結構體定義即可,無需鏈接so

此外,g2d的輸入和輸出數據必須在dmaion buffer上,因此還需要dmaion.h頭文件,用來分配和釋放dmaion buffer

https://github.com/MYIR-ALLWINNER/framework/blob/develop-yt113-framework/auto/sdk_lib/include/DmaIon.h

2.    基于C語言實現的YUV轉RGB

這里復用之前T113-i JPG解碼的函數

3.    基于ARM neon指令集優化的YUV轉RGB

考慮到armv7編譯器的自動neon優化能力較差,這里針對性的編寫 arm neon inline assembly 實現YUV2RGB內核部分,達到最優化的性能,榨干cpu性能。

4.    基于G2D圖形硬件的YUV轉RGB

我們先實現 dmaion buffer 管理器,參考

https://github.com/MYIR-ALLWINNER/framework/blob/develop-yt113-framework/auto/sdk_lib/sdk_memory/DmaIon.cpp

這里貼的代碼省略了異常錯誤處理的邏輯,有個坑是 linux-4.9 和 linux-5.4 用法不一樣,米爾電子的這個T113-i系統是linux-5.4,所以不兼容4.9內核的ioctl用法習慣。

5.    然后再實現 G2D圖形硬件 YUV轉RGB 的轉換器

1.    提前分配好YUV和RGB的dmaion buffer

2.    將YUV數據拷貝到dmaion buffer,flush cache完成同步

3.    配置轉換參數,ioctl調用G2D_CMD_BITBLT_H完成轉換

4.    flush cache完成同步,從dmaion buffer拷貝出RGB數據

5.    釋放dmaion buffer

6.    G2D圖像硬件YUV轉RGB測試

考慮到dmaion buffer分配和釋放都比較耗時,我們提前做好,循環調用步驟3的G2D轉換,統計耗時,并在top工具中查看CPU占用率

sh-4.4# LD_LIBRARY_PATH=. ./g2dtest

INFO   : cedarc <CedarPluginVDInit:84>: register mjpeg decoder success!

this device is not whitelisted for jpeg decoder cvi

this device is not whitelisted for jpeg decoder cvi

this device is not whitelisted for jpeg decoder cvi

this device is not whitelisted for jpeg encoder rkmpp

INFO   : cedarc <log_set_level:43>: Set log level to 5 from /vendor/etc/cedarc.conf

ERROR  : cedarc <DebugCheckConfig:316>: now cedarc log level:5

ERROR  : cedarc <VideoEncCreate:241>: now cedarc log level:5

yuv420sp2rgb 46.61

yuv420sp2rgb 42.04

yuv420sp2rgb 41.32

yuv420sp2rgb 42.06

yuv420sp2rgb 41.69

yuv420sp2rgb 42.05

yuv420sp2rgb 41.29

yuv420sp2rgb 41.30

yuv420sp2rgb 42.14

yuv420sp2rgb 41.33

yuv420sp2rgb_neon 10.57

yuv420sp2rgb_neon 7.21

yuv420sp2rgb_neon 6.77

yuv420sp2rgb_neon 8.31

yuv420sp2rgb_neon 7.60

yuv420sp2rgb_neon 6.80

yuv420sp2rgb_neon 6.77

yuv420sp2rgb_neon 7.01

yuv420sp2rgb_neon 7.11

yuv420sp2rgb_neon 7.06

yuv420sp2rgb_g2d 4.32

yuv420sp2rgb_g2d 4.69

yuv420sp2rgb_g2d 4.56

yuv420sp2rgb_g2d 4.57

yuv420sp2rgb_g2d 4.52

yuv420sp2rgb_g2d 4.54

yuv420sp2rgb_g2d 4.52

yuv420sp2rgb_g2d 4.58

yuv420sp2rgb_g2d 4.60

yuv420sp2rgb_g2d 4.67

可以看到 ARM neon 的優化效果非常明顯,而使用G2D圖形硬件能獲得進一步加速,并且能顯著降低CPU占用率!

7.    轉換結果對比和分析

C和neon的轉換結果完全一致,但是g2d轉換后的圖片有明顯的色差

G2D圖形硬件只支持 G2D_BT601,G2D_BT709,G2D_BT2020 3種YUV系數,而JPG所使用的YUV系數是改版BT601,因此產生了色差

https://github.com/MYIR-ALLWINNER/myir-t1-kernel/blob/develop-yt113-L5.4.61/drivers/char/sunxi_g2d/g2d_bsp_v2.c

從g2d內核驅動中也可以得知,暫時沒有方法為g2d設置自定義的YUV系數,g2d不適合用于JPG的編解碼,但依然適合攝像頭和視頻編解碼的顏色空間轉換

版權所有 中華工控網 Copyright?2025 Gkong.com, All Rights Reserved
主站蜘蛛池模板: 亚洲一区二区在线观看视频 | 精品久久久久一区 | 中文字幕91在线 | 成人污视频| 午夜精品久久久久久久99无限制 | 亚洲色图综合网 | 中文字幕一区二区三区乱码图片 | 高清视频一区二区 | av毛片在线免费观看 | 在线一区二区三区 | 久久国产精品久久久久久 | 成人av免费在线观看 | 日韩久久三级 | 亚洲美女视频 | 成人深夜福利 | 在线视频福利 | 午夜精彩视频 | 亚洲一区二区在线免费观看 | 黄色片视频免费看 | 国产传媒一区二区三区 | 欧美日韩免费一区 | 色我综合| 久久精品视频免费观看 | 一级毛片视频在线 | 国产精品久久综合 | 日本中文字幕在线播放 | 久久久久免费视频 | 欧美激情一区 | 中文字幕99 | 国产三级精品片 | 精品一区二区三区久久久 | 久久se精品一区精品二区 | 欧美一区二区三区在线观看视频 | 国产一区二区三区视频播放 | 天堂蜜桃一区二区三区 | 久久精品亚洲精品国产欧美 | 国产午夜精品在线观看 | 国产剧情一区二区 | 亚洲精品第一页 | 亚洲国内精品 | 最新免费av |