您尚未登录。

楼主 # 2021-09-19 22:19:58

hoel
会员
注册时间: 2019-06-15
已发帖子: 88
积分: 32

[F1C100S / F1C200S] Bare metal / RTOS hardware H264 effort

最近在仔细研究SUNIV家族(F1C100S)在裸机/RTOS上实现H264硬件解码的可行性。我会尽量在这里保留一些参考资料,并开始分享资源。

我对全志车手的理解如下。

VE
负责低层操作。主要由一个由VE引擎中断驱动的状态机组成,它使用两个定时器和一个任务列表。
我认为这个内核可以运行裸机(至少对于 PoC 而言),它没有什么特别之处。要与 RTOS 一起使用,只需实现互斥体包装器。我用直接函数替换了 ioctl。几个小时后,我能够将这部分集成到裸机 MDK 项目中,只需稍加努力,它应该可以正常工作。
这个核心是3个文件,cedar_ve_sl.c cedar_ve.h和list.h(linux双向链表实现)。
我使用了这些源代码: https://github.com/mirkerson/c600/tree/master/linux-3.10/drivers/media/cedar-ve
ve2.png
ve.zip

CedarX
负责所有数据处理,由各种块、FB、VB、vdecoder + plugins、OMX组成。
由于大量异步操作,这自然取决于互斥锁,但是,可能可以使用调度程序或其他技巧在裸机中运行它。
经过几个小时的工作,项目编译没有错误。必须修改各种东西。 RTOS 依赖包在 osal.c 中。 pixelformat.c 已经扩展了需要 ARMCC 6 的 inline asm,所以请注意 MDK 编译器版本。
我使用了这些来源: https://github.com/allwinner-zh/media-codec/tree/master/sunxi-cedarx/SOURCE
ve.png
cedarx.zip

allwinner的一篇关于LibVE架构的论文和其他一些文档
https://github.com/linux-sunxi/cedarx-libs/blob/master/doc/Libve%20User%20Guide-2011.7.6.pdf

这里是 MELIS 的 CEDAR 模块的非编译版本:
https://github.com/caochunjie45/test/tree/master/eMod/mod_cedar
遗憾的是,这仍然依赖于其他编译库,因此它不包含编写 h264 驱动程序所需的所有源代码,但它仍然很有帮助。

当然,如果我们能找到一个旧 MELIS 的完整来源,或者只是 H264 驱动程序的来源(也许一些前 Alwinner 员工可以帮助提供一个旧的 H264 PoC?或一个旧驱动程序?)可以随时自己尝试,总是很有趣。

稍加清理后,我将添加 MDK 项目







Recently, i have studied closely the feasability of implementing the H264 hardware decoding on bare metal / RTOS for the SUNIV familly (F1C100S). I will try to keep some references here, and start to share ressources.

My understanding of the allwinner driver is as follow.

VE
in charge of low level operations. Mainly consists of a state machine driven by the VE engine interrupt, it uses two timers and a tasklist.
I think this core can run bare metal (at least for PoC), there is nothing special about it. To use with RTOS only the mutexes wrapper have to be implemented. I replaced ioctl by direct functions. After few hours i was able to integrate this part into the bare metal MDK project, with few more efforts it should work OK.
This core is 3 files, cedar_ve_sl.c cedar_ve.h and list.h (linux doubly linked list implementation).
i used these source source: https://github.com/mirkerson/c600/tree/master/linux-3.10/drivers/media/cedar-ve
ve2.png
ve.zip


CedarX
in charge of all data handling, composed of various blocks, FB, VB, vdecoder + plugins, OMX.
Naturally this depends on mutexes due to numerous async operation, however, it is probably possible to run it in bare metal with scheduler or other trick.
After wfew hours of work the project compiles without error. Various things had to be modified. RTOS dependencies are wrapped in osal.c.  pixelformat.c has extended inline asm which requires ARMCC 6, so pay attention to the MDK compiler version.
I used these source : https://github.com/allwinner-zh/media-codec/tree/master/sunxi-cedarx/SOURCE
ve.png
cedarx.zip

A paper from allwinner about the architecture of LibVE and few other documents
https://github.com/linux-sunxi/cedarx-libs/blob/master/doc/Libve%20User%20Guide-2011.7.6.pdf

A non compiled version of CEDAR module of MELIS here:
https://github.com/caochunjie45/test/tree/master/eMod/mod_cedar
Sadly this still relies on other compiled libraries, so it does not contain all the sources required to write the h264 driver, but it is helpful nontheless.

Of course, it would be great if we can find the full sources of an old MELIS, or just the sources of H264 driver (maybe some former Alwinner employee can help to give an old H264 PoC? or an old driver?), anyway we can always try by ourselves, it is always interesting.

I will add the MDK projects after a little bit of cleaning

最近编辑记录 hoel (2021-09-20 00:05:51)

离线

#1 2021-09-19 22:28:56

拉轰的脚踏车
会员
注册时间: 2020-03-20
已发帖子: 283
积分: 217

Re: [F1C100S / F1C200S] Bare metal / RTOS hardware H264 effort

最近在仔细研究SUNIV家族(F1C100S)在裸机/RTOS上实现H264硬件解码的可行性。我会尽量在这里保留一些参考资料,并开始分享资源。

我对全志车手的理解如下。

VE
负责低级操作。主要由一个由VE引擎中断驱动的状态机组成,它使用两个定时器和一个任务列表。
我认为这个内核可以运行裸机(至少对于 PoC 而言),它没有什么特别之处。要与 RTOS 一起使用,只需实现互斥体包装器。我用直接函数替换了 ioctl。几个小时后,我能够将这部分集成到裸机 MDK 项目中,只需稍加努力,它应该可以正常工作。
这个核心是3个文件,cedar_ve_sl.c cedar_ve.h和list.h(linux双向链表实现)。
我使用了这些源代码:https : //github.com/mirkerson/c600/tree/master/linux-3.10/drivers/media/cedar-ve


CedarX
负责所有数据处理,由各种块、FB、VB、vdecoder + plugins、OMX 组成。
由于大量异步操作,这自然取决于互斥锁,但是,可能可以使用调度程序或其他技巧在裸机中运行它。
经过几个小时的工作,项目编译没有错误。必须修改各种东西。RTOS 依赖包在 osal.c 中。pixelformat.c 已经扩展了需要 ARMCC 6 的 inline asm,所以请注意 MDK 编译器版本。
我使用了这些来源:https : //github.com/allwinner-zh/media-codec/tree/master/sunxi-cedarx/SOURCE

allwinner 的一篇关于 LibVE 架构的论文和其他一些文档
https://github.com/linux-sunxi/cedarx-libs/blob/master/doc/Libve%20User%20Guide-2011.7.6.pdf

这里是MELIS 的 CEDAR 模块的非编译版本:
https : //github.com/caochunjie45/test/tree/master/eMod/mod_cedar
遗憾的是,这仍然依赖于其他编译库,因此它不包含编写所需的所有源代码h264 驱动程序,但它仍然很有帮助。

当然,如果我们能找到一个旧 MELIS 的完整来源,或者只是 H264 驱动程序的来源(也许一些前 Alwinner 员工可以帮助提供一个旧的 H264 PoC?或一个旧驱动程序?)可以随时自己尝试,总是很有趣。

稍加清理后,我将添加 MDK 项目




google自动翻译

离线

#2 2021-09-19 22:35:16

unturned3
会员
注册时间: 2020-07-01
已发帖子: 210
积分: 151

Re: [F1C100S / F1C200S] Bare metal / RTOS hardware H264 effort

@hoel

Thanks for the effort. I'm just waiting for the tech-competent people to get F1C100s stuff working on mainline Linux... Maybe I'll take a jab at this sometime later.

离线

楼主 #3 2021-09-20 00:20:08

hoel
会员
注册时间: 2019-06-15
已发帖子: 88
积分: 32

Re: [F1C100S / F1C200S] Bare metal / RTOS hardware H264 effort

unturned3 说:

@hoel

Thanks for the effort. I'm just waiting for the tech-competent people to get F1C100s stuff working on mainline Linux... Maybe I'll take a jab at this sometime later.

The MDK projects are not clean yet but i added the sources. Make sure to enable C99  and add --gnu flag in MDK project options.

The "official" Tina has hardware support, thought the sources are kept by agents to make money. Melis also have hardware support, but both these platforms are quite a pain to work with.

Mainline 5.4 has Cedar, but according to multiple reports the performance is so poor that it is not usable (10fps).

What some of us like is efficient development workflow (fast compile, instant flash, debug) clear MDK project with few sources files, very small binaries, full control over every bit of code. Quite the contrary of tina and Melis.

离线

#4 2021-09-20 15:22:55

f1c100_
会员
注册时间: 2020-09-22
已发帖子: 32
积分: 50.5

Re: [F1C100S / F1C200S] Bare metal / RTOS hardware H264 effort

我现在的问题是如何在主线上实现硬件YUV转RGB。我现在用主线5.2,自己写的播放器调用的CEDAR(不是ffmpeg的方式),800x480分辨率H264解码可以到24~30fps。如果可以实现硬件YUV转RGB的话1280x720@60fps也不是问题。

离线

楼主 #5 2021-09-20 15:58:53

hoel
会员
注册时间: 2019-06-15
已发帖子: 88
积分: 32

Re: [F1C100S / F1C200S] Bare metal / RTOS hardware H264 effort

f1c100_ 说:

我现在的问题是如何在主线上实现硬件YUV转RGB。我现在用主线5.2,自己写的播放器调用的CEDAR(不是ffmpeg的方式),800x480分辨率H264解码可以到24~30fps。如果可以实现硬件YUV转RGB的话1280x720@60fps也不是问题。

好吧,有可用的硬件转换,这是在 CEDAR 驱动程序中实现的,所以,这不是问题。
它被称为 DEFE (Display Engine Front End)  hard conversion MB32-YUV format to ARGB8888 format

你介意分享你的linux的源代码吗? 它可能会帮助需要在主线上获得流畅 mp4 的其他人。

最近编辑记录 hoel (2021-09-20 16:01:01)

离线

#6 2021-09-20 16:49:12

f1c100_
会员
注册时间: 2020-09-22
已发帖子: 32
积分: 50.5

Re: [F1C100S / F1C200S] Bare metal / RTOS hardware H264 effort

@hoel
if you can figure out how to use defe to transform yuv to rgb on mainline linux,I would like to share my code with you.

离线

楼主 #7 2021-09-20 20:39:14

hoel
会员
注册时间: 2019-06-15
已发帖子: 88
积分: 32

Re: [F1C100S / F1C200S] Bare metal / RTOS hardware H264 effort

@f1c100_
我在裸机中使用了 DEFE,所以,是的,我认为它可以在主线中完成。3265649676

离线

#8 2022-07-22 00:48:21

Ozelot
会员
所在地: Ukraine
注册时间: 2020-06-22
已发帖子: 34
积分: 87

Re: [F1C100S / F1C200S] Bare metal / RTOS hardware H264 effort

hoel 说:

我在裸机中使用了 DEFE,所以,是的,我认为它可以在主线中完成。3265649676

Can you share an example of working with DEFE?

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn