视频解码
‘视频解码’部分允许开发人员通过硬件或软件视频解码能力增强TouchGFX HAL。
Further reading
视频软件解码允许使用与应用程序帧缓冲区不同的解码格式。 视频硬件解码仅支持像素格式与应用程序帧缓存相同的视频RGB缓冲区。
Note
不支持音频。
类型
默认情况下,视频解码的”类型”是禁用的。 如果STM32CubeMX中没有启用所需的外设,“软件”和“硬件”都将显示为灰色。 将鼠标悬停在灰色的选项上,看看需要哪些外设。
- 软件 - 如果在STM32CubeMX的中间件和软件包部分启用了LIBJPEG,则可以选择“软件”选项,并生成软件解码器。 这意味着TouchGFX 生成器将生成一个软件MJPEG解码器。
- 硬件 - 如果在多媒体部分启用了JPEG IP,并且在TouchGFX Generator中选择了兼容CMSIS的RTOS,则可以选择“硬件”选项。
Further reading
并发视频
“并发视频”选项可设置GUI中任意给定时间在同一屏幕上同时被解码的最大数量视频。 如果希望一块屏幕上只解码一个视频,则可以将“视频数量”设置为1。
最多可以同时解码4个视频。
策略
关于视频解码策略,开发人员有三种选择。
- “直接到帧缓存区(Direct to Framebuffer)” - 视频在UI线程中被解码。 这可能比其他策略慢,但由于没有视频帧的缓冲区,因此节省了RAM。
- 单缓冲区 - 在专用的缓冲区中,以单独的任务进行视频解码。 该缓冲区位于内部存储器中。
- 双缓冲区 - 在两个专用缓冲区中,以单独的任务进行视频解码,以牺牲内存为代价获得更好的性能。
采用单或双帧缓存区策略时,必须启用兼容CMSIS的操作系统。
Note
Further reading
解码格式
对于软件解码,开发人员可以选择RGB缓冲区的像素格式,不管帧缓存区的像素格式是什么。 TouchGFX生成器生成的代码允许DMA2D (ChromART)在不同的格式之间进行像素格式转换。
- RGB565——视频RGB缓冲区为16位。
- RGB888——视频RGB缓冲区为24位。
- ARGB8888——视频RGB缓冲区为32位。 Alpha值为255。
Tip
缓存大小:
缓冲区的宽度和高度设置必须大于或等于应用程序中的最大视频尺寸。 宽度值必须能被32整除。
Orientation
Depending on the display orientation used in the application, the video data that is decoded may need to be rotated to be displayed correctly. TouchGFX Generator generates code that will rotate tha decoded video data accordingly.
- Native - This is the default value. The video data will no not be rotated. Used when the display and framebuffer have the same orientation.
- Rotated - The video data is rotated 90 degrees at run-time. Used when the display and framebuffer have different orientations.
If the Buffer size is configured, the same rules applies, i.e., the width and height must be large enough for the largest video dimensions in the application. They do not need to be swapped if the orientation is set to Rotated.