Design of subtitle decoding and display system for digital set-top box

Publisher:糖果龙猫Latest update time:2012-09-18 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
3.1 Subtitle data extraction module

The subtitle data extraction module consists of two parts: extraction of subtitle control information and extraction of subtitle data packets.

When the user control module sends a subtitle start request, the extraction module starts the SI engine. First, start the PMT table filtering of this program, obtain PMT data and analyze it. If the current program has no subtitle information, send a no subtitle message to the user module; if the current program has subtitle information, obtain the PID, subtitle language code, subtitle type, synthesis page and optional auxiliary page corresponding to the subtitle data according to the private data segment and subtitle descriptor in PMT, and store them in the subtitle index information table. Secondly, start the PES filtering of the subtitle valid data according to the subtitle index information table, and extract the corresponding subtitle data packet. The overall process of subtitle data extraction is shown in Figure 3.

Figure 3 Subtitle data extraction process

Figure 3 Subtitle data extraction process

After obtaining the PID and other information of the subtitles, the subtitle list of all languages ​​carried by the current program is displayed according to the subtitle language for the user to choose. After the user selects an item, the corresponding control information of the item can be used to obtain the subtitle PES packet, register the subtitle PID, synthesis page id and auxiliary page id into the filter channel, and start the filter.

At this time, if the filter receives matching data, a corresponding interrupt will be generated to notify the upper-layer process to read the data; after obtaining a complete PES packet, it will be sent to the subtitle decoder for decoding and display.

3.2 Subtitle Data Decoding Module

The subtitle data decoding module is responsible for decoding the subtitle PES packet.

The subtitle PES packet decoding process is shown in Figure 4.

Figure 4 Subtitle PES packet parsing process

Figure 4 Subtitle PES packet parsing process.

Subtitle decoding mainly analyzes PES packets, including PES header detection, PES header information extraction and subtitle segment analysis.

After filtering a PES packet, first determine whether the packet header is legal, including whether the first four bytes are 0×000001BD and whether the PES packet length is legal.

PES header information extraction includes extracting PTS, PES header length, etc. PTS is the display time of the data to be displayed carried in the packet. According to the header length, the PES load position can be located, and then the PES packet load can be analyzed.

Analyze the payload of the PES packet. First, determine whether the first two bytes (definition byte and subtitle stream id) are 0×20 and 0×00 respectively. If they are both consistent, it can be determined that this packet is the desired PES packet encapsulating subtitle data. Then enter the subtitle segment analysis. There are four situations for the content of the subtitle field. First find the synchronization header byte 0×0f, and then analyze the 8-bit segment type (segment_type). By judging the value of this byte, determine what type of data data_field() carries. When segment_type is 0×10[3], the segment is a page segment; when segment_type is 0×11, the segment is a regional segment; when segment_byte is 0×12, the segment is a CLUT segment; when segment_byte is 0×13, the segment is an object data segment. Finally, call different functions according to different types to perform the next step of analysis on various types of segments.

In the analysis of the page segment, find the page ID, display end time, display status, the number of regions the page consists of, the region ID of each region, and the horizontal and vertical coordinates of each region, and store these data. Then, find the corresponding region segment according to the region ID obtained from the page segment, obtain the width and height of the region, pixel depth, color filled in the region, color table ID (CLUT_id), number of data objects in the region, and each data object number (object_id), and store these data.

Finally, find the color table through CLUT_id and get the Y, Cr, Cb, T values ​​of the color. Find the content of the object data through object_id, including the encoding method and encoding data. Decode these related encoding data using the corresponding decoding method and put them into the buffer. When analyzing the page, if the display end time of the parsed page has passed, there is no need to analyze the page, and clear the data buffer related to the page.

Since a PES packet may contain multiple subtitling segments (subtitling_segment), it is necessary to loop and analyze until the last subtitling segment. After analyzing each subtitling segment, it is necessary to determine whether the next byte is the synchronization header (0×0f) of the next subtitling segment or the subtitling data end mark (0×ff). If it is the synchronization header of the next subtitling segment, continue to analyze. If it is the data end mark, it means that the load analysis carried by the PES packet is completed. Finally, the obtained data is stored in the display buffer, and a timing time is created by analyzing the PTS. When the time is up, the data is read out from the buffer, and the OSD layer driver is called to display the data.

In this decoding, the processing of composition page (composition_page_id) is divided into two types. This is because the same PID may transmit subtitle streams in different languages, that is, multiple information in different languages ​​share the same PID stream, so the composition page can be set as the depth of the filter during processing. When a data stream comes in, the corresponding page ID in the PES packet that matches the PID is judged. The same as the page ID is extracted, and the different is discarded. This is one of the parsing and extraction methods. Another method is to use the PID value shared by multiple languages ​​to set the filter, extract the subtitle stream that matches the PID value, and send it to the PES packet for parsing. After the PES parses the page ID, it is judged whether the page ID is the same as the page ID parsed in the PMT table. If the same, it means that it is the packet you are looking for, otherwise it means that it is an invalid PES packet, and the packet is discarded.

Reference address:Design of subtitle decoding and display system for digital set-top box

Previous article:Design of digital set-top box subtitle decoding and display system
Next article:Design of subtitle decoding and display system for digital set-top box

Latest Analog Electronics Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号