影片解碼
「影片解碼」區段可讓開發人員透過硬體或軟體影片解碼功能增強TouchGFX HAL。
Further reading
影片軟體解碼允許使用與應用程式影像緩衝區不同的解碼格式。 影片硬體解碼僅支援與應用程式影像緩衝區像素格式相同的影片RGB緩衝區。
Note
不支援音訊。
類型
預設情況下,影片解碼的「Type」(類型)為停用。 如果STM32CubeMX中沒有啟用所需的週邊設備,「軟體」和「硬體」都將顯示為灰色。 將滑鼠懸停在灰色的選項上,看看需要哪些週邊設備。
- Software(軟體):如果LIBJPEG在STM32CubeMX的Middleware and Software Packs(中介軟體及套裝軟體)區段之下啟用,就可選擇「Software」(軟體)選項,並產生軟體解碼器。 這意味著TouchGFX Generator將產生軟體MJPEG解碼器。
- Hardware (硬體):如果JPEG IP在Multimedia (多媒體)區段之下啟用,並於TouchGFX Generator選擇了符合CMSIS標準的RTOS,就可選擇「Hardware」(硬體)選項。
Further reading
並行影片
「並行影片」選項是指在GUI之中,可在任何特定時間於相同畫面同步解碼的最大影片數量。 如果您只要在螢幕解碼一部影片,請將「Number of Videos」(影片數量)設定為1。
最多可以同時解碼4個影片。
策略
關於影片解碼策略,開發人員有三種選擇。
- Direct to Framebuffer (直接到影像緩衝區):影片在UI執行緒中解碼。 這可能會比其他策略更慢,但是不必為了影片提供緩衝區,因此可節省RAM。
- Single Buffer (單緩衝區):在專用的緩衝區中,以單獨的工作進行影片解碼。 該緩衝區分配於內部記憶體中。
- Double Buffer (雙緩衝區):在兩個專用緩衝區中,以單獨的任務進行影片解碼,以增加記憶體用量為代價獲得更好的效能。
採用單或雙影像緩衝區策略時,必須啟用符合CMSIS要求的作業系統。
Note
Further reading
解碼格式
對於軟體解碼,開發人員可以選擇RGB緩衝區的像素格式,不管影像緩衝區的像素格式是什麼。 TouchGFX Generator產生的程式碼允許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.