Video decoding method based on acceleration module

By adopting a video decoding method based on acceleration modules under the Linux system, the problem of low decoding efficiency of the Atlas 200 AI acceleration module when there are many protocol frames that do not conform or have errors was solved, and efficient video decoding and parameter information extraction were achieved.

CN115474057BActive Publication Date: 2024-10-01TIANJIN JINHANG COMP TECH RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211085002.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-06
Publication Date
2024-10-01
Estimated Expiration
2042-09-06

AI Technical Summary

Technical Problem

On the Linux platform, the Atlas 200 AI acceleration module suffers from low decoding efficiency or is unable to decode when the protocol frames do not fully conform to the decoding protocol or when there are many erroneous frames, especially when it is unable to extract image information with parameter frames.

Method used

The video decoding method based on the acceleration module includes receiving network multicast data and storing it in a circular buffer, filtering error frames, and performing hardware decoding based on the acceleration module. The video decoding is completed through a combination of software and hardware.

Benefits of technology

It improves video decoding efficiency, effectively handles error frames and extracts parameter information, and reduces decoding time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure QLYQS_1
    Figure QLYQS_1
  • Figure QLYQS_11
    Figure QLYQS_11
  • Figure QLYQS_15
    Figure QLYQS_15
Patent Text Reader

Abstract

The present invention relates to a video decoding method based on an acceleration module, and belongs to the technical field of video decoding under a Linux system. The present invention is aimed at the characteristics of the atlas200AI chip, and combined with the characteristics of hardware attributes, to design and implement a video decoding method based on an acceleration module under a Linux system. The method is to first buffer and store the data received by the network under the Linux system, then filter the error frames according to the protocol type, and transmit the decodable data packets to the hard decoding module to complete the decoding function.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of video decoding under Linux system, and specifically relates to a video decoding method based on an acceleration module. Background Art

[0002] The Atlas 200 AI acceleration module integrates the Ascend 310 AI processor, which can realize image recognition, image classification, etc. on the edge. It can realize various data analysis and reasoning calculations such as images and videos, and is widely used in edge AI scenarios such as smart cameras, robots, and drones.

[0003] However, Atlas 200 AI belongs to the category of hard decoding. When the protocol frame does not fully comply with the decoding protocol or there are many error frames, the decoding efficiency is relatively low or decoding is impossible. In addition, for image information with parameter frames, the hard decoding module cannot extract parameter information. Summary of the invention

[0004] 1. Technical issues to be resolved

[0005] The technical problem to be solved by the present invention is to solve the problem of video decoding under the Linux platform.

[0006] (II) Technical solution

[0007] In order to solve the above technical problems, the present invention provides a video decoding method based on an acceleration module, comprising the following steps:

[0008] Step 1: Receive network multicast data and store it in a ring buffer

[0009] First, obtain the IP and port number information in the transmission according to the configuration file; then, block and wait for the image data to be sent by the network; finally, store the received image data into the ring buffer;

[0010] Step 2: Filter error frames

[0011] Analyze the image frames received by the network, dynamically filter the data that does not meet the protocol requirements, and obtain complete data packets;

[0012] Step 3: Complete the hard decoding process based on the acceleration module

[0013] Based on the acceleration module, the complete data packet obtained after filtering is hard decoded.

[0014] The present invention also provides a video decoding system for implementing the method.

[0015] The invention also provides an application of the method in the technical field of video decoding under a Linux system.

[0016] (III) Beneficial effects

[0017] The present invention aims at the characteristics of atlas200AI chip and combines the characteristics of hardware properties to design and implement a video decoding method based on acceleration module under Linux system. The method is to first buffer and store the data received by the network under Linux system, then filter the error frame according to the protocol type, and transmit the decodable data packet to the hard decoding module to complete the decoding function. DETAILED DESCRIPTION

[0018] In order to make the purpose, content, and advantages of the present invention more clear, the specific implementation methods of the present invention are further described in detail below in conjunction with embodiments.

[0019] In order to solve the problem of video decoding under Linux system, the present invention adopts a software and hardware combined decoding method based on an acceleration module. The content of the present invention is further described below. A video decoding method based on an acceleration module under Linux system of the present invention comprises the following steps:

[0020] 1. Receive network multicast data and store it in a ring buffer (buffer array)

[0021] First, obtain the IP and port number information in the transmission according to the configuration file; then, block and wait for the image data to be sent by the network; finally, store the received image data in the ring

[0022] Buffer zone; details are as follows:

[0023] ①First, obtain the receiving IP and port number information in the configuration file;

[0024] ②Then, create a network socket;

[0025] ③Secondly, clear the ring buffer (receive buffer) and block the receiving network

[0026] The image data sent;

[0027] ④ Determine whether the length of the data received this time is greater than zero. If it is greater than zero, execute the next step, otherwise return to step ③;

[0028] ⑤ Determine whether the protocol frame header meets the protocol requirements. If not, discard the frame, otherwise proceed to the next step;

[0029] ⑥Get the protocol field channel number chnnel;

[0030] ⑦ Remove the message header according to the protocol, leaving only the image data;

[0031] ⑧ Determine whether the transmission channel number chnnel is the current channel number of the decoding. If so, execute the next step. Otherwise, delay 20ms and wait for the next network to receive data.

[0032] ⑨ Determine whether the sum of the data length cirLen of the current ring buffer and the data length len received this time is less than the maximum length MAX_CIRCLE_LEN. If so, execute the next step, otherwise jump to step

[0033] ⑩Copy the received data starting from the position where the frame header is removed and store it in the ring buffer. The length of the copied data is len;

[0034] Increase the data length cirLen of the ring buffer by the data length len of the data received this time;

[0035] Move the position of the ring buffer receiving pointer putPtr by len times;

[0036] The received data is copied from the position where the frame header is removed and stored in the circular buffer. The length of the copy is the maximum buffer length MAX_CIRCLE_LEN minus the value of cirlen;

[0037] Get the first pointer of the current ring buffer cirBuf and save it to the receiving pointer putPtr position;

[0038] Calculate the amount of space left in the current circular buffer, that is, subtract the maximum buffer length MAX_CIRCLE_LEN from the current circular buffer data length cirLen and save it to temp;

[0039] Calculate the difference between the data length len and value received this time, that is, the remaining data length value2 after copying once, and save value2 to the data length cireLen of the current ring buffer;

[0040] Receive data from the network again (network receive array), move the ring buffer receive pointer by temp positions, copy the data to the putPtr position of the ring buffer, and the length of the copy is cirLen;

[0041] 2. Filter error frames

[0042] Analyze the image frames received by the network, dynamically filter the data that does not meet the protocol requirements, and adjust and reorganize the image frames during the filtering process to obtain a complete data packet. The specific steps are as follows:

[0043] a. Get the image frame data from the ring buffer, that is, calculate the ring buffer's first address bufPtr and length bufLen:

[0044] ① Get the current ring buffer receiving pointer (write pointer) putPtr position and the total data length cirLen of the ring buffer;

[0045] ② Determine whether the read pointer readPtr is consistent with putPtr. If they are consistent, delay 1ms and return to step ① of this process. Otherwise, execute the next step.

[0046] ③ Determine whether the read data length readLen is less than cirLen. If so, proceed to the next step, otherwise execute step ⑦ of this process;

[0047] ④ Determine whether the difference between cirLen and readLen is greater than or equal to the fixed length of the protocol frame frame_len. If yes, proceed to the next step. If not, execute step ⑥ of this process;

[0048] ⑤Use the current readPtr as the first address bufPtr of the decoded image data, set the length bufLen to frame_len, and move readPtr by frame_len, increase the read length readLen by frame_len;

[0049] ⑥Use the current readPtr as the first address bufPtr of the decoded image data, set the length bufLen to cirLen minus readLen, and move readPtr by (cirLen-readLen), increase the read length readLen by (cirLen-readLen);

[0050] ⑦ Determine whether the sum of readLen and frame_len is less than MAX_LEN. If so, execute the next step. If not, execute step ⑨ of this process.

[0051] ⑧Use the current readPtr as the first address bufPtr of the decoded image data, set the data length bufLen to frame_len, move the read pointer by frame_len, increase the read data length readLen by frame_len;

[0052] ⑨Use the current readPtr as the first address bufPtr of the decoded image data, set the data length bufLen to MAX_LEN-readLen, move the read pointer to the first address of the ring buffer, and set the read data length readLen to 0;

[0053] b. Filter the image frame data as follows:

[0054] ① Determine whether the current decoded frame type is consistent with the current image frame type. If not, execute the next step, otherwise jump to step ⑤ of this process; image frames include vps, pps, sps, sei, I frame, and P frame;

[0055] ②Set the flag insertIDR of the current image frame to be inserted to 1;

[0056] ③ Determine whether the current image frame type is the type specified by the protocol (one of infrared, visible light wide, visible light narrow, and fusion). If so, execute the next step, otherwise return and exit this process;

[0057] ④Change the current decoded frame type to the current image frame type;

[0058] ⑤Get ​​the data length of the current image frame and save it to idrsize;

[0059] ⑥ Traverse from the frame header to the position of idrsize minus 3, and judge the frame data in turn to determine whether the corresponding field is the h265 protocol frame header. If it is, execute the next step, otherwise move the traversal pointer position to continue searching for the frame header until the current image frame is completely traversed and jump to the step of this process

[0060] ⑦ Determine whether the image frame type is one of the three types of frames: vps, pps, sps. If yes, proceed to the next step, otherwise jump to step 9;

[0061] ⑧ Determine whether the sei frame (parameter frame, which is a type of image frame) flag seiFlag is 1. If so, set the insertIDR flag of this decoding to 1 and exit this filtering process. Otherwise, set the insert frame flag idrFlag to 1;

[0062] ⑨ Determine whether the frame type is a sei frame. If so, proceed to the next step. Otherwise, jump to the step of this process.

[0063] ⑩ Determine whether the sei frame flag seiFlag is 1. If so, set the insertIDR flag of this decoding to 1 and exit the filtering process. Otherwise, set seiFlag to 1, record the current position as the frame header position, save the current position to u32start, and update the current frame size to size minus the value of u32start;

[0064] Determine whether the frame type is a P frame. If so, proceed to the next step. Otherwise, jump to the step of this process.

[0065] Determine whether seiFlag is 1. If so, set the insertIDR flag of this decoding to 1 and exit the filtering process. Otherwise, increase the number of inserted frames count flag IsliceNumber by 1 and clear the frame number flag FrameNumber.

[0066] Change the value of the current frame type to 0x02, that is, change it to I frame;

[0067] Determine whether the value of the current frame type is 0x02, that is, whether it is an I frame. If so, execute the next step, otherwise jump to the step of this process

[0068] Determine whether the sei frame flag seiFlag is zero. If so, set the insertIDR flag of this decoding to 1 and exit the filtering process. Otherwise, execute the next step.

[0069] Increase the P frame number indicator PsliceNumber by 1;

[0070] Determine whether the insertIDR flag of this decoding is 1. If it is, execute the next step, otherwise jump to the step of this process

[0071] Change the current frame type to I frame, that is, change the type value to 0x26;

[0072] The flag IsliceNumber recording the number of I frames increases by 1;

[0073] Determine whether the current decoding type is infrared or fusion. If so, proceed to the next step. Otherwise, jump to the step of this process.

[0074] Set the current frame type value to 0x26, that is, change it to I frame;

[0075] Determine whether the P-frame number flag PsliceNumber is 1. If it is, execute the next step, otherwise jump to the step of this process

[0076] Set the data content of the 6th, 7th, and 8th positions of the frame header offset to 0xaf, 0x06, and 0x58, and jump to the steps of this process

[0077] Determine whether the P-frame number flag PsliceNumber is 2. If so, execute the next step, otherwise jump to the step of this process.

[0078] Set the data content of the 6th, 7th, 8th, and 9th positions of the frame header offset to 0x25, 0xaf, 0x06, and 0x58, and jump to the steps of this process

[0079] Determine whether the current decoding type is visible light. If so, proceed to the next step. Otherwise, jump to the step of this process.

[0080] Determine whether the P frame number flag PsliceNumber is 1. If so, set the data content of the 6th, 7th, and 8th positions of the frame header offset to 0xaf, 0x04, and 0x58. Otherwise, continue to determine whether the P frame number flag PsliceNumber is 2. If so, set the data content of the 6th, 7th, 8th, and 9th positions of the frame header offset to 0x23, 0x47, 0x82, and 0x2c. Otherwise, continue to determine whether the P frame number flag PsliceNumber is 3. If so, set the data content of the 6th, 7th, 8th, and 9th positions of the frame header offset to 0x26, 0x87, 0x82, and 0x2c. Otherwise, continue to determine whether the P frame number flag PsliceNumber is 4. If so, set the data content of the 6th, 7th, 8th, and 9th positions of the frame header offset to 0x29, 0xc7, 0x82, and 0x2c. Otherwise, proceed to the next step.

[0081] Set the frame number FrameNumber to zero;

[0082] Determine whether the current frame type is infrared or fusion image. If so, proceed to the next step. Otherwise, jump to the step of this process.

[0083] The number of p frames PsliceNumber is classified and judged: if it is 1, the high and low bit values ​​of the frame number FrameNumber are assigned to the 6th and 7th bits of the current frame; otherwise, the high and low bit values ​​of the frame number FrameNumber are assigned to the 7th and 8th bits of the current frame;

[0084] Determine whether the current frame type is visible light. If so, proceed to the next step. Otherwise, jump to the step of this process.

[0085] The number of p frames PsliceNumber is classified and judged: if it is 1, the high and low bit values ​​of the frame number FrameNumber are assigned to the 6th and 7th bits of the current frame; otherwise, the high and low bit values ​​of the frame number FrameNumber are assigned to the 7th and 8th bits of the current frame;

[0086] Determine whether the number of p frames PsliceNumber is 0 and the number of I frames is 0,

[0087] At the same time, whether the parameter frame flag seiFlag is 0, if it is, exit and return, otherwise go to the next step;

[0088] Use library functions to dynamically apply for image frame storage space based on image size;

[0089] Determine whether the insertion frame flag idrFlag and the parameter frame flag seiFlag are 1, or whether the insertion flag insertIDR of the decoded frame is 1. If one of the first two conditions is met, execute the next step, otherwise jump to the step of this process

[0090] Determine whether the current frame type is infrared or fusion image. If so, proceed to the next step; otherwise, jump to the step of this process.

[0091] Copy the sps data of the infrared or fused image and the current frame image data to the data structure Idr_Buf to be decoded, and increase the frame size by size, and increase the size by the sps data size;

[0092] Determine whether the current frame type is visible light. If so, proceed to the next step; otherwise, jump to the step of this process.

[0093] Copy the sps data of the visible light image and the current frame image data to the data structure Idr_Buf to be decoded, and increase the frame size by size, and increase the size by the sps data size;

[0094] Set the current frame start position u32Start and the insertion flag insertIDR of the frame to be decoded to 0;

[0095] Determine whether the I frame number flag IsliceNumber is 0, if so, increase the frame number FrameNumber by 1;

[0096] Save the current frame data size to be decoded to inBufferSize, use the library function to copy the image data content Idr_Buf to be decoded to the dynamically applied image buffer inBufferDev, and jump to the steps of this process

[0097] Increase the frame number FrameNumber by 1;

[0098] Save the current frame data size to be decoded to inBufferSize, use the library function to copy the image data content Idr_Buf to be decoded to the dynamically applied image buffer inBufferDev, and execute the next step.

[0099] 3. Hard decoding based on acceleration module

[0100] Hard decode the filtered complete data packet. The specific steps are as follows:

[0101] ① Initialize the acceleration module including the hard decoding module. The specific operations are as follows:

[0102] a. Create decoding channel properties. If the creation is successful, proceed to the next step, otherwise exit with an error;

[0103] b. Set the decoding channel ID number. If the setting is successful, proceed to the next step, otherwise an error will be reported and exit;

[0104] c. Set the decoding thread number;

[0105] d. Set the decoding channel callback function. If the setting is successful, proceed to the next step, otherwise exit with an error;

[0106] e. Set the decoding type of the decoding channel. If the setting is successful, proceed to the next step, otherwise an error will be reported and exit;

[0107] f. Set the output image format of the decoding channel. If the setting is successful, proceed to the next step, otherwise exit with an error;

[0108] g. Set the decoding channel output mode. If the setting is successful, proceed to the next step, otherwise exit with an error;

[0109] h. Create a decoding channel according to the decoding channel attributes;

[0110] ②Set the decoding callback function as follows:

[0111] a. Use the library function to obtain the normal frame output of the decoder. If the result is 0, execute the next step, otherwise jump to step f of this process;

[0112] b. Clear the insertion flag insertIDR of the current decoded frame;

[0113] c. Use library functions to obtain image attribute data output;

[0114] d. Use library functions to obtain image size, width and height parameter data from output;

[0115] e. Use the library function to send the image data and parameter data to the host port and end this process function;

[0116] f. The number of recorded errors errCnt increases by 1 and proceeds to the next step;

[0117] g. Check whether the error count errCnt is greater than 2. If so, proceed to the next step; otherwise, exit this process;

[0118] h. Set the insert flag insertIDR to 1 and clear errCnt;

[0119] ③Get the complete data packet;

[0120] ④ Send the complete data packet to the hard decoding module in the acceleration module for decoding, as follows:

[0121] a. Use library functions to dynamically apply for image storage space;

[0122] b. Get parameter information of the image frame;

[0123] c. Integrate the parameter information and the decoded image data into a complete frame;

[0124] d. Create an input image stream attribute object;

[0125] e. Set the input image stream attribute object;

[0126] f. Dynamically apply for image output memory space;

[0127] g. Create an output image stream attribute object;

[0128] h. Set output image properties according to image data, size and format;

[0129] i. Use the decoding channel attributes, input image stream attributes, and output image attributes as parameters and use the library function to send the image frame data to the hard decoding module;

[0130] j. Release the requested image output memory space;

[0131] k. Destroy the input image stream attribute object resources.

[0132] By using the above technical solution and the above operation steps, the present invention can solve the video decoding and transmission problem under the Linux system. The method has been verified by the algorithm and experimentally tested. The results show that the solution can solve the image decoding problem by using a soft decoding method to form a complete data packet containing image frames and parameter frames, and then using the chip's hard decoding module to complete the decoding process, effectively reducing the decoding time.

[0133] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A video decoding method based on an acceleration module, characterized in that: The following steps are involved: Step 1: Receive network multicast data and store it in a ring buffer. First, obtain the IP and port number information in the transmission according to the configuration file; then, block and wait for the image data to be sent by the network; finally, store the received image data into the ring buffer; Step 2: Filter error frames Analyze the image frames received by the network, dynamically filter the data that does not meet the protocol requirements, and obtain complete data packets; Step 3: Complete the hard decoding process based on the acceleration module Based on the acceleration module, the complete data packet obtained after filtering is hard decoded; Step 1 is as follows: ①First, obtain the receiving IP and port number information in the configuration file; ②Then, create a network socket; ③Secondly, clear the ring buffer and block the image data sent by the network; ④ Determine whether the length of the data received this time is greater than zero. If it is greater than zero, execute the next step, otherwise return to step ③; ⑤ Determine whether the protocol frame header meets the protocol requirements. If not, discard the frame. Otherwise, proceed to the next step; ⑥Get the protocol field channel number chnnel; ⑦ Remove the message header according to the protocol, leaving only the image data; ⑧ Determine whether the channel number chnnel is the current channel number of the decoding. If so, execute the next step. Otherwise, delay 20ms and wait for the next network to receive data. ⑨ Determine whether the sum of the data length cirLen of the current ring buffer and the data length len received this time is less than the maximum length MAX_CIRCLE_LEN. If so, execute the next step, otherwise jump to step ⑩Copy the received data starting from the position where the frame header is removed and store it in the ring buffer. The length of the copied data is len; Increase the data length cirLen of the ring buffer by the data length len of the data received this time; Move the position of the ring buffer receiving pointer putPtr by len times; The received data is copied from the position where the frame header is removed and stored in the circular buffer. The length of the copy is the maximum buffer length MAX_CIRCLE_LEN minus the value of cirlen; Get the first pointer of the current ring buffer cirBuf and save it to the receiving pointer putPtr position; Calculate the amount of space left in the current circular buffer, that is, subtract the maximum buffer length MAX_CIRCLE_LEN from the current circular buffer data length cirLen and save it to temp; Calculate the difference between the data length len and value received this time, that is, the remaining data length value2 after copying once, and save value2 to the data length cireLen of the current ring buffer; Receive data from the network again, move the ring buffer receive pointer by temp positions, copy the data to the putPtr position of the ring buffer, and the length of the copy is cirLen.

2. The method according to claim 1, characterized in that Step 2 is as follows: a. Get the image frame data from the ring buffer, that is, calculate the ring buffer's first address bufPtr and length bufLen: ① Get the current position of the ring buffer receiving pointer putPtr and the total length of the ring buffer data cirLen; ② Determine whether the read pointer readPtr is consistent with putPtr. If they are consistent, delay 1ms and return to step ① of this process. Otherwise, execute the next step. ③ Determine whether the read data length readLen is less than cirLen. If so, proceed to the next step, otherwise execute step ⑦ of this process; ④ Determine whether the difference between cirLen and readLen is greater than or equal to the fixed length of the protocol frame frame_len. If yes, proceed to the next step. If not, execute step ⑥ of this process; ⑤Use the current readPtr as the first address bufPtr of the decoded image data, set the length bufLen to frame_len, and move readPtr by frame_len, increase the read length readLen by frame_len; ⑥Use the current readPtr as the first address bufPtr of the decoded image data, set the length bufLen to cirLen minus readLen, and move readPtr by (cirLen-readLen), increase the read length readLen by (cirLen-readLen); ⑦ Determine whether the sum of readLen and frame_len is less than MAX_LEN, If yes, proceed to the next step; if not, proceed to step ⑨ of this process; ⑧Use the current readPtr as the first address bufPtr of the decoded image data, set the data length bufLen to frame_len, move the read pointer by frame_len, increase the read data length readLen by frame_len; ⑨Use the current readPtr as the first address bufPtr of the decoded image data, set the data length bufLen to MAX_LEN-readLen, move the read pointer to the first address of the ring buffer, and set the read data length readLen to 0; b. Filter the image frame data as follows: ① Determine whether the current decoded frame type is consistent with the current image frame type. If not, execute the next step, otherwise jump to step ⑤ of this process; image frames include vps, pps, sps, sei, I frame, and P frame; ②Set the flag insertIDR of the current image frame to be inserted to 1; ③ Determine whether the current image frame type is the type specified by the protocol. If so, proceed to the next step, otherwise return and exit this process; ④Change the current decoded frame type to the current image frame type; ⑤Get ​​the data length of the current image frame and save it to idrsize; ⑥ Traverse from the frame header to the position of idrsize minus 3, and judge the frame data in turn to determine whether the corresponding field is the h265 protocol frame header. If it is, execute the next step, otherwise move the traversal pointer position to continue searching for the frame header until the current image frame is completely traversed, and jump to step ③3 of this process; ⑦ Determine whether the image frame type is one of the three types of frames: vps, pps, sps. If yes, proceed to the next step, otherwise jump to step 9; ⑧ Determine whether the sei frame (parameter frame, which is a type of image frame) flag seiFlag is 1. If so, set the insertIDR flag of this decoding to 1 and exit this filtering process. Otherwise, set the insert frame flag idrFlag to 1; ⑨ Determine whether the frame type is a sei frame. If so, proceed to the next step, otherwise jump to the step of this process ⑩ Determine whether the sei frame flag seiFlag is 1. If so, set the insertIDR flag of this decoding to 1 and exit the filtering process. Otherwise, set seiFlag to 1, record the current position as the frame header position, save the current position to u32start, and update the current frame size to size minus the value of u32start; Determine whether the frame type is a P frame. If so, proceed to the next step. Otherwise, jump to the step of this process. Determine whether seiFlag is 1. If so, set the insertIDR flag of this decoding to 1 and exit the filtering process. Otherwise, increase the number of inserted frames count flag IsliceNumber by 1 and clear the frame number flag FrameNumber. Change the value of the current frame type to 0x02, that is, change it to I frame; Determine whether the value of the current frame type is 0x02, that is, whether it is an I frame. If so, execute the next step, otherwise jump to the step of this process Determine whether the sei frame flag seiFlag is zero. If so, set the insertIDR flag of this decoding to 1 and exit the filtering process. Otherwise, execute the next step. Increase the P frame number indicator PsliceNumber by 1; Determine whether the insertIDR flag of this decoding is 1. If it is, execute the next step, otherwise jump to the step of this process Change the current frame type to I frame, that is, change the type value to 0x26; The flag IsliceNumber recording the number of I frames increases by 1; Determine whether the current decoding type is infrared or fusion. If so, proceed to the next step. Otherwise, jump to the step of this process. Set the current frame type value to 0x26, that is, change it to I frame; Determine whether the P-frame number flag PsliceNumber is 1. If it is, execute the next step, otherwise jump to the step of this process Set the data content of the 6th, 7th and 8th positions of the frame header offset to 0xaf, 0x06 and 0x58, and jump to step ②8 of this process; Determine whether the P-frame number flag PsliceNumber is 2. If so, execute the next step, otherwise jump to the step of this process. Set the data content of the 6th, 7th, 8th, and 9th positions of the frame header offset to 0x25, 0xaf, 0x06, and 0x58, and jump to the steps of this process Determine whether the current decoding type is visible light. If so, proceed to the next step. Otherwise, jump to the step of this process. Determine whether the P frame number flag PsliceNumber is 1. If so, set the data content of the 6th, 7th, and 8th positions of the frame header offset to 0xaf, 0x04, and 0x58. Otherwise, continue to determine whether the P frame number flag PsliceNumber is 2. If so, set the data content of the 6th, 7th, 8th, and 9th positions of the frame header offset to 0x23, 0x47, 0x82, and 0x2c. Otherwise, continue to determine whether the P frame number flag PsliceNumber is 3. If so, set the data content of the 6th, 7th, 8th, and 9th positions of the frame header offset to 0x26, 0x87, 0x82, and 0x2c. Otherwise, continue to determine whether the P frame number flag PsliceNumber is 4. If so, set the data content of the 6th, 7th, 8th, and 9th positions of the frame header offset to 0x29, 0xc7, 0x82, and 0x2c. Otherwise, proceed to the next step. Set the frame number FrameNumber to zero; Determine whether the current frame type is infrared or fusion image. If so, proceed to the next step. Otherwise, jump to the step of this process. The number of p frames PsliceNumber is classified and judged: if it is 1, the high and low bit values ​​of the frame number FrameNumber are assigned to the 6th and 7th bits of the current frame; otherwise, the high and low bit values ​​of the frame number FrameNumber are assigned to the 7th and 8th bits of the current frame; Determine whether the current frame type is visible light. If so, proceed to the next step. Otherwise, jump to the step of this process. The number of p frames PsliceNumber is classified and judged: if it is 1, the high and low bit values ​​of the frame number FrameNumber are assigned to the 6th and 7th bits of the current frame; otherwise, the high and low bit values ​​of the frame number FrameNumber are assigned to the 7th and 8th bits of the current frame; Determine whether the number of p frames PsliceNumber is 0 and the number of I frames is 0, At the same time, whether the parameter frame flag seiFlag is 0, if it is, exit and return, otherwise go to the next step; Use library functions to dynamically apply for image frame storage space based on image size; Determine whether the insertion frame flag idrFlag and the parameter frame flag seiFlag are 1, or whether the insertion flag insertIDR of the decoded frame is 1. If one of the first two conditions is met, execute the next step, otherwise jump to the step of this process Determine whether the current frame type is infrared or fusion image. If so, proceed to the next step; otherwise, jump to the step of this process. Copy the sps data of the infrared or fused image and the current frame image data to the data structure Idr_Buf to be decoded, and increase the frame size by size, and increase the size by the sps data size; Determine whether the current frame type is visible light. If so, proceed to the next step; otherwise, jump to the step of this process. Copy the sps data of the visible light image and the current frame image data to the data structure Idr_Buf to be decoded, and increase the frame size by size, and increase the size by the sps data size; Set the current frame start position u32Start and the insertion flag insertIDR of the frame to be decoded to 0; Determine whether the I frame number flag IsliceNumber is 0, if so, increase the frame number FrameNumber by 1; Save the current frame data size to be decoded to inBufferSize, use the library function to copy the image data content Idr_Buf to be decoded to the dynamically applied image buffer inBufferDev, and jump to the steps of this process Increase the frame number FrameNumber by 1; Save the current frame data size to be decoded to inBufferSize, use the library function to copy the image data content Idr_Buf to be decoded to the dynamically applied image buffer inBufferDev, and execute the next step.

3. The method according to claim 2, characterized in that Step 3 is as follows: 1 Initialize the acceleration module including the hard decoding module. The specific operations are as follows: a. Create decoding channel properties. If the creation is successful, proceed to the next step, otherwise exit with an error; b. Set the decoding channel ID number. If the setting is successful, proceed to the next step, otherwise an error will be reported and exit; c. Set the decoding thread number; d. Set the decoding channel callback function. If the setting is successful, proceed to the next step, otherwise exit with an error; e. Set the decoding type of the decoding channel. If the setting is successful, proceed to the next step, otherwise an error will be reported and exit; f. Set the output image format of the decoding channel. If the setting is successful, proceed to the next step, otherwise exit with an error; g. Set the decoding channel output mode. If the setting is successful, proceed to the next step, otherwise exit with an error; h. Create a decoding channel according to the decoding channel attributes; 2 Set the decoding callback function as follows: a. Use the library function to obtain the normal frame output of the decoder. If the result is 0, execute the next step, otherwise jump to step f of this process; b. Clear the insertion flag insertIDR of the current decoded frame; c. Use library functions to obtain image attribute data output; d. Use library functions to obtain image size, width and height parameter data from output; e. Use the library function to send the image data and parameter data to the host port and end this process function; f. The number of recorded errors errCnt increases by 1 and proceeds to the next step; g. Check whether the error count errCnt is greater than 2. If so, proceed to the next step; otherwise, exit this process; h. Set the insert flag insertIDR to 1 and clear errCnt; 3. Get the complete data packet; 4 Send the complete data packet to the hard decoding module in the acceleration module for decoding, as follows: a. Use library functions to dynamically apply for image storage space; b. Get parameter information of the image frame; c. Integrate the parameter information and the decoded image data into a complete frame; d. Create an input image stream attribute object; e. Set the input image stream attribute object; f. Dynamically apply for image output memory space; g. Create an output image stream attribute object; h. Set output image properties according to image data, size and format; i. Use the decoding channel attributes, input image stream attributes, and output image attributes as parameters and use the library function to send the image frame data to the hard decoding module; j. Release the requested image output memory space; k. Destroy the input image stream attribute object resources.

4. The method according to claim 2, characterized in that The sei frame is a parameter frame.

5. The method according to claim 1, characterized in that The acceleration module is loaded on the atlas200AI chip.

6. The method according to claim 2, characterized in that The ring buffer receiving pointer is a write pointer.

7. The method according to claim 2, characterized in that The types of visible light include a wide visible light type and a narrow visible light type.