A H.221 frame data synchronization method suitable for CPU processor implementation
By using efficient bit search frames and frame synchronization word checking methods in the CPU processor, the problem of frequent shifting and comparison operations during the H.221 frame data synchronization process is solved, and the synchronization efficiency is improved.
Patent Information
- Application Number
- CN202411722979.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-04-08
AI Technical Summary
In the CPU processor, a large number of shifting and comparison operations are required during the synchronization of H.221 frame data, resulting in insufficiency of synchronization.
The efficient bit search and frame synchronization word checking method is adopted, and the phase-out test is carried out through different states of the frame search controller (outsynchronization, byte synchronization, frame synchronization) to quickly filter out the frame synchronization words, and reduce data shift and comparison operations in the frame synchronization state.
The CPU processor can achieve H.221 frame synchronization processing efficiency, reduce the number of shifts and comparison operations during the synchronization process, and meet the needs of engineering projects.
Smart Images

Figure CN119788890A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of H.221 frame data synchronization, and in particular to an H.221 frame data synchronization method applicable to a CPU processor, and is particularly applicable to a CPU processor to implement H.221 frame data synchronization. The method adopts a method of efficient bit frame search and frame synchronization word check to reduce the number of shift and comparison operations in the frame search process, and improve the synchronization efficiency of the CPU processor to implement the H.221 frame processing process. Background Art
[0002] The H.221 frame protocol is one of the video conferencing system series protocols developed by ITU-T, which specifies the channel frame structure of audio and video telecommunications services. The 8th bit of the first 8 lines of the H.221 frame together constitutes the "frame synchronization word", and odd frames and even frames use different "frame synchronization words". When using H.221 frames to transmit voice and image data, it is necessary to first locate the position of the H.221 "frame synchronization word" in the data stream in order to determine the corresponding starting position of the current frame data in the data stream, so as to correctly read and write the data of each channel. This process is the H.221 frame data synchronization process. Because the channels are interleaved in a bit manner, the CPU processor needs to perform a large number of shift and comparison operations when searching for the frame synchronization word, which affects the synchronization efficiency.
[0003] In view of this situation, the method of efficient bit search frame and frame synchronization word check can be used for synchronization. First, search for all "suspected synchronization words" in the current data segment and save them in the record table. Then, according to the current "suspected synchronization word" position, calculate the "suspected synchronization word" position of the next frame and check it. Through this step-by-step elimination test, it can be ensured that the "frame synchronization word" can be quickly screened out within three frames of data. After frame synchronization, the "frame synchronization word" check method is used to shift and compare only the data at the "frame synchronization word" position, reducing the data shift and comparison operations, thereby improving the frame synchronization efficiency and meeting the use requirements of engineering projects. Summary of the invention
[0004] In order to reduce the number of data shifts and comparisons in the H.221 frame synchronization process and improve the processing efficiency of the CPU processor to achieve H.221 frame synchronization, the present invention provides an H.221 frame data synchronization method suitable for CPU processor implementation.
[0005] The technical solution adopted by the present invention is:
[0006] An H.221 frame data synchronization method suitable for CPU processor implementation comprises the following steps:
[0007] (1) The frame search controller is initialized to an asynchronous state; wherein the frame search controller includes three states: asynchronous, byte synchronous, and frame synchronous;
[0008] (2) receiving a group of unsynchronized data of the H.221 frame type and checking the current state. If it is an unsynchronized state, proceed to step (3); if it is a byte synchronized state, proceed to step (4);
[0009] (3) In the asynchronous state, the frame search controller uses an efficient bit search frame algorithm to perform byte synchronization check on the unsynchronized data. When searching the data, if the current byte is found to conform to the distribution pattern of the synchronization word of the odd frame or the even frame, the current byte is determined to be a "suspected synchronization word"; the "suspected synchronization word" is searched and the position is recorded. When the "suspected synchronization word" record item is greater than 0, the byte synchronization state is entered and the process returns to step (2). Otherwise, the process returns to step (2) directly.
[0010] (4) In the byte synchronization state, the position of the next "suspected synchronization word" is calculated based on the currently recorded "suspected synchronization word" and a validity check is performed; based on the validity check result, the frame synchronization word is selected from the "suspected synchronization word" and the frame synchronization state is entered, and step (5) is executed, or the asynchronous state is entered and step (2) is returned;
[0011] (5) In the frame synchronization state, check the frame synchronization word. If the frame synchronization word is illegal, enter the asynchronous state and return to step (2); otherwise, maintain the frame synchronization state, and calculate the position of the next frame synchronization word according to the current frame synchronization word as the check parameter for the next frame data, and return to step (2);
[0012] Complete the H221 frame data synchronization method suitable for CPU processor implementation.
[0013] Furthermore, the specific process of using the efficient bit search frame algorithm to perform byte synchronization check on the unsynchronized data in step (3) is as follows:
[0014] The efficient bit search frame algorithm uses the synchronization cache to perform bit-by-bit frame search. When the H221 frame row data length is R bytes, the length of the synchronization cache is (8R+1) bytes. The efficient bit search frame algorithm inputs 1 byte of data each time and stores it in the current position of the synchronization cache in a circular storage manner, and then extracts the first byte of each row to form a synchronization check flag, and searches for odd-numbered or even-numbered frame synchronization words by shifting and comparing the synchronization check flag. If an odd-numbered or even-numbered frame synchronization word is found, the current byte is determined to be a "suspected synchronization word", and the bit offset position and parity frame type of the "suspected synchronization word" are obtained.
[0015] Furthermore, the specific process of step (4) is as follows:
[0016] In the byte synchronization state, the position of the next "suspected synchronization word" is calculated and recorded according to the last "suspected synchronization word" and position in the record table; if the next "suspected synchronization word" is legal, the synchronization count of the "suspected synchronization word" is increased by 1; if the next "suspected synchronization word" is illegal, the corresponding "suspected synchronization word" information is deleted from the record table; calculations are performed in sequence according to the H.221 frame data stream. When the synchronization count of a "suspected synchronization word" exceeds the suspected decision threshold, the frame synchronization state is entered, and the corresponding "suspected synchronization word" is set to the frame synchronization word; when the synchronization count is equal to 0, the asynchronous state is returned.
[0017] Compared with the background technology, the present invention has the following advantages:
[0018] (1) The present invention uses efficient bit search frames to screen "suspected synchronization words", thereby improving synchronization efficiency.
[0019] (2) The present invention uses the "frame synchronization word" check to reduce the number of shift and comparison operations in the synchronization process, thereby improving the processing efficiency of the CPU in maintaining the H221 frame synchronization state. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 The invention discloses a working principle and a flow chart of an H.221 frame data synchronization method applicable to a CPU processor.
[0021] Figure 2 The invention is a schematic diagram of the working principle of a high-efficiency bit frame search module cyclic table lookup algorithm of an H.221 frame data synchronization method implemented by a CPU processor. DETAILED DESCRIPTION
[0022] The present invention will be further explained below in conjunction with the accompanying drawings.
[0023] like Figure 1 As shown, an H.221 frame data synchronization method suitable for CPU processor implementation specifically includes the following steps:
[0024] (1) The frame search controller has three states: "asynchronous", "byte synchronous" and "frame synchronous". The frame search controller is initially set to the "asynchronous" state.
[0025] (2) Receive a group of unsynchronized data of H.221 frame type and check the current state. If it is an unsynchronized state, go to step (3); if it is a byte synchronized state, go to step (4).
[0026] (3) In the "out-of-sync" state, the frame search controller uses an efficient bit search frame algorithm to perform byte synchronization checks on the unsynchronized data. When searching the data, if it is found that the current byte conforms to the distribution pattern of the synchronization word of the odd frame or the even frame, the current byte is determined to be a "suspected synchronization word"; the "suspected synchronization word" is searched and the position is recorded. When the "suspected synchronization word" record item is greater than 0, the "byte synchronization" state is entered and the process returns to step (2). Otherwise, the process directly returns to step (2).
[0027] (4) In the "byte synchronization" state: according to the currently recorded "suspected synchronization word", calculate the position of the next "suspected synchronization word" and perform a legality check. According to the legality check result, filter out the "frame synchronization word" from the "suspected synchronization word" and enter the "frame synchronization state", or enter the "out of synchronization" state and return to step (2).
[0028] (5) In the "frame synchronization" state: check according to the frame synchronization word. If the frame synchronization word is illegal, enter the asynchronous state and return to step (2); otherwise, maintain the frame synchronization state, and calculate the position of the next frame synchronization word based on the current frame synchronization word as the check parameter for the next frame data, and return to step (2).
[0029] The frame search controller is implemented through the cooperation of the state control module, the efficient bit search frame module, the frame synchronization word screening module and the frame synchronization word checking module. Its control parameters include H.221 synchronization cache, current index, frame identification word, bit offset, parameter record table, number of parameter record table entries, synchronization check flag and synchronization flag.
[0030] The H.221 synchronization buffer is used to store the frame data to be searched. The buffer length can include all bits of the frame synchronization word. If the length of the H221 frame row data is R bytes, the length of the synchronization buffer is (8R+1) bytes; the current index represents the write position frame of the current H221 synchronization buffer. The H221 synchronization buffer adopts cyclic writing, and automatically returns to the first byte of the buffer to write the subsequent byte data after writing to the last byte of the buffer. The frame identifier is used to cache the frame identifier data currently being searched; the bit offset is used to record the bit offset position of the synchronized data, that is, how many bits the current data needs to shift to align the H.221 frame header. The parameter record table is used to record the "suspected synchronization word" information. The table entries include the next identifier offset, identifier type, identifier byte cache, identifier byte number, legal check number and bit offset number; the number of parameter record table entries is used to record the number of valid table entries in the valid parameter record table. The synchronization check identifier data structure is the same as the parameter record table entry, and is used to save the information of the frame synchronization word. The synchronization identifier is used to record the current state of the frame search controller, and the legal values include "out of synchronization", "byte synchronization" and "frame synchronization".
[0031] When the program is initialized, the state control module will initialize the parameters of the frame search controller, wherein the current index, frame identifier, bit offset, and number of parameter record entries are set to 0, and the synchronization flag is set to "out of sync".
[0032] Among them, in step (3), the frame search controller uses an efficient bit search frame algorithm to perform byte synchronization check on the unsynchronized data. The specific process is:
[0033] The efficient bit search frame algorithm uses the synchronization cache to perform bit-by-bit frame search. When the H221 frame row data length is R bytes, the length of the synchronization cache is (8R+1) bytes. The efficient bit search frame algorithm inputs 1 byte of data each time and stores it in the current position of the synchronization cache in a circular storage manner, and then extracts the first byte of each row to form a synchronization check flag, and searches for odd-numbered or even-numbered frame synchronization words by shifting and comparing the synchronization check flag. If an odd-numbered or even-numbered frame synchronization word is found, the current byte is determined to be a "suspected synchronization word", and the bit offset position and parity frame type of the "suspected synchronization word" are obtained.
[0034] The search frame controller uses the parameter record table and the number of parameter record table items to record all "suspected synchronization words". In extreme cases, every bit combination in the unsearched frame data can form a synchronization word, so the table length of the parameter record table must be set large enough to ensure that it can accommodate enough "suspected synchronization words", and its specific value is related to the number of bytes of asynchronous data processed at one time.
[0035] The efficient bit search frame module uses the H221 synchronization buffer, the current index and the frame identification word to implement the frame search process. The efficient bit search frame buffer uses a cyclic method to write bytes. Every time a byte is written, it checks whether the corresponding position bits can form a "frame synchronization word". If R is 12 bytes, the H221 frame synchronization buffer should be set to 85 bytes. See Figure 2 As shown, assuming that the current index position is the xth byte, the data at the xth byte, ((x+12) mod 85) byte, ((x+24) mod 85) byte, ((x+36) mod 85) byte, ((x+48) mod 85) byte, ((x+60) mod 85) byte, ((x+72) mod 85) byte, and ((x+84) mod 85) byte need to be used to form a synchronization word bit by bit and compare it with the legal value. In order to improve the efficiency of the check, a table lookup method is used here to check the bit status corresponding to each byte. The content of the check table is the mask corresponding to each bit of the byte, that is: {1,2,4,8,16,32,64,128}. The data byte is bitwise ANDed with the corresponding table entry. If the result is not 0, it means that the bit is 1, otherwise it is 0. When forming the synchronization word, the bit can be set to 1 by performing a bitwise OR operation on the mask table.
[0036] Among them, in step (4), the position of the next "suspected synchronization word" is calculated and recorded based on the currently recorded "suspected synchronization word". If the next "suspected synchronization word" is legal, the synchronization count of the "suspected synchronization word" is increased; if the next "suspected synchronization word" is illegal, the "suspected synchronization word" information is deleted from the record table. According to the H.221 frame data stream, calculations are performed in sequence. When the synchronization count of a "suspected synchronization word" exceeds the suspected decision threshold, the "frame synchronization" state is entered, and the "suspected synchronization word" is set to the "frame synchronization word"; when the synchronization count is equal to 0, the "out of synchronization" state is returned.
[0037] The frame synchronization word filtering module checks the "suspected synchronization word" record item in the parameter record table. If the "suspected synchronization word" is found to be illegal, it will be deleted. At the same time, the number of parameter record table items is reduced by 1. If the number of parameter record table items is 0, the "out of synchronization" state is returned. If the "suspected synchronization word" is found to be legal, the legal check number of the item is increased. If the legal check number of the item exceeds the rebel threshold, the "frame synchronization" state is entered. The suspected synchronization word is set to the frame synchronization word, that is, the parameter is set to the synchronization check flag.
[0038] Among them, step (5) performs a legality check based on the "frame synchronization word". If the "frame synchronization word" is legal, the "frame synchronization" state is maintained; if the "frame synchronization word" is illegal, the "out of synchronization" state is returned. When the "frame synchronization" state is maintained, the next "frame synchronization word" position is calculated based on the current "frame synchronization word" as the check parameter for the next frame of data.
[0039] The frame synchronization word check module performs frame synchronization word check based on the synchronization check mark, and extracts and checks the frame synchronization word according to the next mark offset and the bit offset number. If the frame synchronization word is legal, the "frame synchronization" state is maintained and the data in the frame is read and written. If the frame synchronization word is illegal, the "out of synchronization" state is returned.
Claims
1. A H.221 frame data synchronization method suitable for CPU processor implementation, characterized in that: The following steps are involved: (1) The frame search controller is initialized to an asynchronous state; wherein the frame search controller includes three states: asynchronous, byte synchronous, and frame synchronous; (2) receiving a group of unsynchronized data of the H.221 frame type and checking the current state. If it is an unsynchronized state, proceed to step (3); if it is a byte synchronized state, proceed to step (4); (3) In the asynchronous state, the frame search controller uses an efficient bit search frame algorithm to perform byte synchronization check on the unsynchronized data. When searching the data, if the current byte is found to conform to the distribution pattern of the synchronization word of the odd frame or the even frame, the current byte is determined to be a "suspected synchronization word"; the "suspected synchronization word" is searched and the position is recorded. When the "suspected synchronization word" record item is greater than 0, the byte synchronization state is entered and the process returns to step (2). Otherwise, the process returns to step (2) directly. (4) In the byte synchronization state, the position of the next "suspected synchronization word" is calculated based on the currently recorded "suspected synchronization word" and a legality check is performed; based on the legality check result, the frame synchronization word is selected from the "suspected synchronization word" and the frame synchronization state is entered, and step (5) is executed, or the asynchronous state is entered and step (2) is returned; (5) In the frame synchronization state, check the frame synchronization word. If the frame synchronization word is illegal, enter the asynchronous state and return to step (2); otherwise, maintain the frame synchronization state, and calculate the position of the next frame synchronization word according to the current frame synchronization word as the check parameter for the next frame data, and return to step (2); Complete the H221 frame data synchronization method suitable for CPU processor implementation.
2. The H221 frame data synchronization method suitable for CPU processor implementation according to claim 1, characterized in that: The specific process of using the efficient bit search frame algorithm to perform byte synchronization check on the unsynchronized data in step (3) is as follows: The efficient bit search frame algorithm uses the synchronization cache to perform bit-by-bit frame search. When the H221 frame row data length is R bytes, the length of the synchronization cache is (8R+1) bytes. The efficient bit search frame algorithm inputs 1 byte of data each time and stores it in the current position of the synchronization cache in a circular storage manner, then extracts the first byte of each row to form a synchronization check flag, and searches for odd-numbered or even-numbered frame synchronization words by shifting and comparing the synchronization check flag. If an odd-numbered or even-numbered frame synchronization word is found, the current byte is determined to be a "suspected synchronization word", and the bit offset position and parity frame type of the "suspected synchronization word" are obtained.
3. The H221 frame data synchronization method applicable to a CPU processor according to claim 1, characterized in that: The specific process of step (4) is as follows: In the byte synchronization state, according to the last "suspected synchronization word" and position in the record table, calculate the position of the next "suspected synchronization word" and record it; if the next "suspected synchronization word" is legal, the synchronization count of the "suspected synchronization word" is increased by 1; if the next "suspected synchronization word" is illegal, the corresponding "suspected synchronization word" information is deleted from the record table; according to the H.221 frame data stream, calculations are performed in sequence. When the synchronization count of a "suspected synchronization word" exceeds the suspected judgment threshold, the frame synchronization state is entered, and the corresponding "suspected synchronization word" is set as the frame synchronization word; when the synchronization count is equal to 0, the asynchronous state is returned.