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
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.
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.
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
- Popular Resources
- Popular amplifiers
- Feedback Control of Robot Driving Path
- Development of Analog and Mixed Signal Circuits for Electrocardiogram Modules (I) Research Results Report (Simplified Version)
- Design of Data Acquisition System Based on PC/104
- Research on control algorithm and program design of intelligent tracking car_Technical report of the first \"Freescale\" Cup National College Student Intelligent Car Invitational Competition
- High signal-to-noise ratio MEMS microphone drives artificial intelligence interaction
- Advantages of using a differential-to-single-ended RF amplifier in a transmit signal chain design
- ON Semiconductor CEO Appears at Munich Electronica Show and Launches Treo Platform
- ON Semiconductor Launches Industry-Leading Analog and Mixed-Signal Platform
- Analog Devices ADAQ7767-1 μModule DAQ Solution for Rapid Development of Precision Data Acquisition Systems Now Available at Mouser
- Domestic high-precision, high-speed ADC chips are on the rise
- Microcontrollers that combine Hi-Fi, intelligence and USB multi-channel features – ushering in a new era of digital audio
- Using capacitive PGA, Naxin Micro launches high-precision multi-channel 24/16-bit Δ-Σ ADC
- Fully Differential Amplifier Provides High Voltage, Low Noise Signals for Precision Data Acquisition Signal Chain
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- IAR FOR AVR crashes within seconds when running under WIN10, please help me solve it
- Unboxing
- i.MX6ULL Embedded Linux Development 2-uboot Porting Practice
- A Guide to Hooking Up with Electronic Gangsters
- PCB related knowledge
- Snek: A Python-based language for embedded devices
- Using TI DSP programming clock circuit selection principles and level conversion methods
- On the modeling and configuration of DSP systems
- Basic knowledge of array antenna radiation
- Share the motor drive design circuit information of various original manufacturers (Wildfire, Hard Rock, TI, ST)