A video decoding method combining software and hardware with efficient transmission
Through the video decoding method that combines software and hardware, using the ffmpeg dynamic library and PCIE channel, the problems of low decoding efficiency and large transmission delay of Hi3559AV100 are solved, and efficient video decoding and data transmission are achieved.
Patent Information
- Application Number
- CN202110699060.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-23
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2041-06-23
AI Technical Summary
Hi3559AV100 has low decoding efficiency when the protocol frames do not fully comply with the decoding protocol or there are many error frames, and the hard decoding module cannot return decoded image frames with parameter frames, and network transmission delays when the image data is large is too large and cannot meet performance requirements.
Using a video decoding method that combines software and hardware, by configuring the ffmpeg dynamic library and using the PCIE channel, the decoding process of the hard decoding module and the transmission of image data are completed, reducing decoding time and data transmission delay. Specific steps include configuring the PCIE device, creating a data reading thread and a data packet acquisition thread, using the hard decoding module to decode the image data, and returning the decoded image data through the PCIE channel.
It effectively reduces decoding time and data transmission delay, improves video decoding efficiency, and meets performance requirements.
Smart Images

Figure CN113596469B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the video decoding technology under Linux system, in particular to a video decoding method combining software and hardware and having high efficiency transmission. Background Art
[0002] Hi3559AV100 is a professional 8K Ultra HD Mobile Camera SOC. It provides 8K30 / 4K120 broadcast-level image quality digital video recording, supports multi-channel sensor input, supports H.265 encoding output or film-level RAW data output, and integrates high-performance ISP processing. It also adopts advanced low-power process and low-power architecture design, providing users with excellent image processing capabilities.
[0003] Hi3559AV100 supports the industry-leading multi-channel 4K Sensor input, multi-channel ISP image processing, HDR10 high dynamic range technology standard, and multi-channel panoramic hardware stitching. While supporting 8K30 / 4K120 video recording, Hi3559AV100 provides hardened 6-Dof digital image stabilization, reducing dependence on mechanical gimbals.
[0004] PCI-Express (Peripheral Component Interconnect Express) is a high-speed serial computer expansion bus standard. Its original name was "3GIO". It was proposed by Intel in 2001 to replace the old PCI, PCI-X and AGP bus standards. PCIe is a high-speed serial point-to-point dual-channel high-bandwidth transmission. The connected devices are allocated exclusive channel bandwidth and do not share bus bandwidth. It mainly supports active power management, error reporting, end-to-end reliable transmission, hot plugging and quality of service (QOS) and other functions. PCIe was renamed "PCI-Express" or "PCI-e" after it was certified and released by PCI-SIG (PCI Special Interest Group). Its main advantage is its high data transmission rate and considerable development potential.
[0005] However, Hi3559AV100 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 low or it cannot be decoded. In addition, the hard decoding module cannot return the decoded image frame with the parameter frame. At the same time, when the image data is large, the network transmission delay is large and cannot meet the performance requirements. Summary of the invention
[0006] The technical problem solved by the present invention is: to overcome the shortcomings of the prior art, to provide a video decoding method that combines software and hardware and has efficient transmission, to use the hard decoding module of the chip to complete the decoding process, to effectively reduce the decoding time, and to use the PCIE channel to transmit the images before and after decoding, thereby greatly reducing the data transmission delay.
[0007] The technical solution of the present invention is:
[0008] In a first aspect, a video decoding method combining software and hardware and efficient transmission includes the following steps:
[0009] 1) Configure the compilation properties and parameters of ffmpeg and transplant the ffmpeg dynamic library to the HiSilicon platform;
[0010] 2) Configure PCIE devices;
[0011] Configure the PCIE of the HiSilicon platform as a slave device and the PCIE device of the host as a master device; at the same time, formulate the transmission rules between the master device and the slave device;
[0012] 3) Create a PCIE data reading thread and start the PCIE reading task to obtain the original image data transmitted by the host;
[0013] 4) Create a ffmpeg data packet acquisition thread and use the ffmpeg dynamic library to obtain the complete data packet of the compressed image
[0014] 5) Use the hard decoding module of the HiSilicon platform to decode the compressed image data packet to obtain the decoded image data;
[0015] 6) Use the PCIE channel to transmit the decoded image data back to the host.
[0016] Optionally, the master device and slave device transmission rules in step 2) are as follows:
[0017] After the master device is powered on, the specified content of the handshake is written. After the slave device is powered on, the corresponding content is detected and the handshake is successful.
[0018] The master device and the slave device allocate a read and write PCIE address for each channel, and different read and write addresses do not conflict with each other;
[0019] After the master device successfully handshakes, the address content of each channel receiving data is written into the specified PCIE address segment;
[0020] The master device uses the query of the content length of the fixed address segment to determine whether there is data or not, and clears the content length to zero after completing the data reading.
[0021] Before transmitting data, the slave device first uses the fixed address segment length to determine whether the master device has read the previous data. If so, it writes the decoded image data and the length. If not, it abandons the data writing task and waits to receive the next decoded image data before transmitting.
[0022] Optionally, the step 3) of creating a PCIE data reading thread is as follows:
[0023] 31) Apply for the read-write mutex lock of the PCIE channel to protect the read-write operations of each PCIE channel, and do not allow multiple PCIE channels to perform read-write operations at the same time;
[0024] 32) Check whether the host device has new image data available for reading, that is, whether the read data length within the fixed address is not zero, and the host's read address is not zero;
[0025] 33) Read data in the specified read address segment according to the protocol rules. The specific operations are: setting the destination address of the PCIE read task to the PCIE read address of the slave device; setting the source address to the PCIE write address of the master device;
[0026] 34) Send a read data task command to the slave device through the ioctl function; determine whether the return value of the read data task is successful. If the read data task is successful, the read length is cleared to zero for the master device to transmit data next time;
[0027] 35) Unlock the read-write mutex of the PCIE channel to release resources.
[0028] Optionally, the method of using the PCIE channel to transmit the decoded image data back to the host in step 6) is specifically as follows:
[0029] 61) Get the read-write mutex lock of the PCIE channel;
[0030] 62) Copy the decoded image parameter data to the DMA virtual address space;
[0031] 63) Determine whether the write length in the HiSilicon platform chip is cleared by the host. If it is not 0, report an error and exit, terminate the image sending task, and return to step 61) after receiving the new decoded image parameter data; otherwise, enter step 64);
[0032] 64) Obtain the destination physical address of the data to be sent to the host device. If the destination physical address is zero, report an error and exit, terminate the image sending task, and return to step 61) after receiving the new decoded image parameter data; otherwise, enter step 65); configure the PCIE of HiSilicon as a slave device, and the PCIE device of the host as a master device;
[0033] 65) Get the physical first address of the DMA transfer and the offset address specified by the protocol, use the sum of the two as the source address of the DMA transfer task, and use the physical address vxworks_phy_addr of the host PCIE as the destination address of the task;
[0034] 66) Set the transmission length of this task to the length of the parameter frame data sei_len;
[0035] 67) Determine whether the current PCIE operation handle is greater than zero. If so, use the system function ioctl to issue the PCIE write task and proceed to the next step. If not, report an error and exit this process, terminate the image sending task, and return to step 61 after receiving the new decoded image parameter data;
[0036] 68) Determine whether the task status of the current PCIE write task is completed, if so, proceed to the next step, if not, report an error and exit this process; after receiving the new decoded image parameter data, return to step 61);
[0037] 69) Set the source address of the second DMA transfer task to the image frame array data, use the host physical address vxworks_phy_addr offset parameter frame byte number sei_len as the destination address of the task, and set the image frame length frame_len to the transfer length of the second task;
[0038] 610) Repeat steps 67) and 68) and proceed to the next step;
[0039] 611) Write the sent image frame length frame_len to the memory address specified by the protocol, prompting the host to read the data;
[0040] 612) Using the host to read the image frame data and parameter frame data, and complete the return work;
[0041] 613) Unlock the mutex lock of the PCIE channel, release the PCIE channel resources, and return to step 61) after receiving new decoded image parameter data.
[0042] Optionally, in step 1), the ffmpeg dynamic library is transplanted to the HiSilicon platform, specifically:
[0043] 11) First, configure ffmpeg compilation properties, and configure parameters according to platform type, CPU type, codec properties, format conversion properties, and cross-compilation properties;
[0044] 12) Modify the acodec.h file, add the parameter frame length sei_len and array sei_buf, and determine its parameter frame size SEI_BUF_SIZE according to the application layer requirements;
[0045] 13) Add the function of getting parameter frame in the decode_nal_sei_prefix function in the hevc_sei.c file;
[0046] 14) Execute the configure command to generate the decoding libraries libavcodec, libavformat, libavutil, and libswscale in the subfolder lib of the configuration folder;
[0047] 15) Finally, copy the dynamic library to the / usr / lib path of the decoding board.
[0048] Optionally, step 4) creates an ffmpeg data packet acquisition thread, specifically:
[0049] 421) Get the image data array first address pointer bufPtr and length bufLen read from the PCIE channel;
[0050] 422) Determine whether the current data length bufLen is greater than 0, if so, proceed to the next step, if not, exit the decoding process of this data and wait for the image data to be transmitted by the next PCIE channel;
[0051] 423) Transmit the data array first address pointer bufPtr and length bufLen to the soft decoding module, use the library function av_parser_parse2 to split the image data by frame, if a complete image frame data packet can be successfully obtained from the array, record and continue to the next step, if not, exit this decoding process; wait for the image data array transmitted by the PCIE channel;
[0052] 424) Save the data packet length ret of the image frame segmentation in the data array this time, remove the image frame data packet length ret of this segmentation from the total length bufLen of the data array, and move the first address pointer bufPtr forward by the number of times ret;
[0053] 425) Put the complete data packet of the image segmented this time into a queue to be decoded.
[0054] Optionally, the method for decoding the compressed image data packet in step 5) is specifically as follows:
[0055] 51) Initialize the hard decoding module according to the image parameters and decoding type, configure the video data buffer size in the hard decoding module, and start the decoding module;
[0056] 52) Dynamically apply for the buffer size buf of the video image frame data packet;
[0057] 53) Loop to determine whether the decoding is completed, if so, exit the processing flow and proceed to step 57), otherwise proceed to the next step;
[0058] 54) Set the parameters of the current frame to be decoded: stream end marker, frame header marker, frame tail marker;
[0059] 55) Put the image frame data into buf;
[0060] 56) Call the dynamic library function to send buf data to the hard decoding module;
[0061] 57) Monitor the decoding status of the hard decoding module in real time. If the decoding is wrong, soft restart the hard decoding module and reset the parameters. If the decoding is normal, call the library function to obtain the decoded image.
[0062] 58) Call the library function to stop sending the video stream to the hard decoding module, close the decoding channel, unbind the binding relationship between modules, and clear resources.
[0063] In a second aspect, a processing device includes:
[0064] Memory for storing computer programs;
[0065] A processor is used to call and run the computer program from the memory to execute the method of the first aspect.
[0066] A computer-readable storage medium stores a computer program or instruction. When the computer program or instruction is executed, the method described in the first aspect is implemented.
[0067] A computer program product comprises instructions, and when the computer program product is run on a computer, the computer is caused to execute the method according to the first aspect.
[0068] The advantages of the present invention compared with the prior art are:
[0069] The present invention uses the ffmpeg decoding library to obtain the parameter frame information and data frame information in the original frame, combines a complete data packet to the hard decoding module, reduces the decoding delay, and completes the decoding function. At the same time, the PCIE channel is used to transmit image big data, which greatly reduces the transmission delay.
[0070] The present invention uses the HiSilicon Hi3559AV100 chip as a hard decoding module under the Linux system, uses the FFMPEG decoding library to obtain complete data packets, effectively obtains compressed frame parameter information and image frame information, reduces decoding time, and simultaneously starts the PCIE channel to efficiently transmit image data, greatly reducing data transmission delay. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] Figure 1 The present invention is a flowchart of a video decoding solution for efficient transmission combining software and hardware. DETAILED DESCRIPTION
[0072] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0073] Combination Figure 1 In order to solve the video decoding problem under the Linux system, we use a combination of ffmpeg soft decoding and HiSilicon chip module hard decoding, and use the PCIE channel to transmit image data. Below we further describe the content of the present invention.
[0074] PCIE (Peripheral Components Interconnect Express) is a high-speed serial computer expansion bus standard. PCIE is a high-speed serial point-to-point dual-channel high-bandwidth transmission. The connected devices are allocated exclusive channel bandwidth and do not share bus bandwidth. PCIE devices communicate through logical connections called interconnects or links. A link is a point-to-point communication channel between two PCI Express ports, allowing them to send and receive normal PCI requests and interrupts. PCIE uses a shared parallel bus architecture in which the PCI host and all devices share a common set of address, data, and control lines.
[0075] 1. Port ffmpeg to HiSilicon platform
[0076] 11) First, configure the ffmpeg compilation properties and configure parameters according to the platform type, CPU type, codec properties, format conversion properties, and cross-compilation properties.
[0077] 12) Modify the acodec.h file, add the parameter frame length sei_len and array sei_buf, and determine its parameter frame size SEI_BUF_SIZE according to the application layer requirements;
[0078] 13) Add the function of obtaining the parameter frame in the decode_nal_sei_prefix function in the hevc_sei.c file: obtain the parameter size in the function, assign size to sei_len, determine whether size is less than or equal to SEI_BUF_SIZE, and if so, copy the data in the context parameter array gb to sei_buf. The length of the copy is size, and the array subscript i of the copied sei_buf is the index index of the gb array divided by 8, that is, sei_buf[i]=gb_buf[index / 8];
[0079] 14) Then, execute the configure command to generate the decoding libraries libavcodec, libavformat, libavutil, and libswscale in the subfolder lib of the configuration folder.
[0080] 15) Finally, copy the dynamic library to the / usr / lib path of the decoding board;
[0081] 2. Configure PCIE devices
[0082] First, according to the transmission requirements, configure HiSilicon's PCIE as a slave device and the host's PCIE device as a master device.
[0083] Then, configure the PCIE driver file. Automatically load the 3559 driver files in the system path / etc / profile of the HiSilicon board: hi35xx_dev_slv.ko, irq_map_slv.ko, mcc_drv_slv.ko, mcc_usrdev_slv.ko, pcit_dma_slv.ko.
[0084] Finally, formulate the master and slave transmission rules, the rules are as follows:
[0085] After the master device is powered on, the specified content of the handshake is written. After the slave device is powered on, the corresponding content is detected and the handshake is successful.
[0086] The master device and the slave device allocate a read and write PCIE address for each channel, and different read and write addresses do not conflict with each other;
[0087] After the master device successfully handshakes, the address content of each channel receiving data is written into the specified PCIE address segment;
[0088] The master device uses the query of the content length of the fixed address segment to determine whether there is data or not, and clears the content length to zero after completing the data reading.
[0089] Before transmitting data, the slave device first uses the fixed address segment length to determine whether the master device has read the previous data (i.e., the fixed address segment length is 0). If yes, it writes the decoded image data and writes the length. If not, it abandons the data writing task and waits for the next decoded image data to be received before transmitting.
[0090] 3. Get the data transmitted by the host through PCIE
[0091] Create a PCIE data reading thread. The specific operations of the thread are:
[0092] 31) Apply for the read-write mutex lock of the PCIE channel to protect the read-write operations of each PCIE channel, and do not allow multiple PCIE channels to perform read-write operations at the same time;
[0093] 32) Check whether the host device has new image data available for reading, that is, whether the read data length within the fixed address is not zero, and the host's read address is not zero;
[0094] 33) Read data in the specified read address segment according to the protocol rules. The specific operations are: setting the destination address of the PCIE read task to the PCIE read address of the slave device; setting the source address to the PCIE write address of the master device;
[0095] 34) Send a read data task command to the slave device through the ioctl function; determine whether the return value of the read data task is successful. If the read data task is successful, the read length is cleared to zero for the master device to transmit data next time.
[0096] 35) Unlock the read-write mutex of the PCIE channel to release resources.
[0097] 4. Use ffmpeg dynamic library to obtain the complete data packet of compressed image
[0098] Create a usage environment for ffmpeg and specify the soft decoder required for startup, which can perform protocol analysis on the original data. At the same time, loop to obtain the original data from the data area received from the network, call the library function to obtain the length of the data packet that can be combined into a complete image frame, remove the length from the data area received from the network and loop repeatedly until there is no data in the data area. The details are as follows:
[0099] 41) Initialize the decoding library usage environment
[0100] First, set the decoder type and use the HEVC (h265) decoder. Then, initialize the decoder context and dynamically apply for image frame storage space based on the size of each frame of image data. Finally, open the decoder based on the parameters.
[0101] 42) Create ffmpeg to obtain data packets thread, the specific process of the thread is as follows:
[0102] 421) Get the image data array first address pointer bufPtr and length bufLen read from the PCIE channel;
[0103] 422) Determine whether the current data length bufLen is greater than 0. If so, proceed to the next step. If not, exit the decoding process of this data and wait for the image data to be transmitted by the next PCIE channel.
[0104] 423) The data array first address pointer bufPtr and length bufLen are transmitted to the soft decoding module, and the image data is segmented by frame using the library function av_parser_parse2. If a complete image frame data packet can be successfully obtained from the array, it is recorded and continued to the next step. If not, the decoding process is exited; wait for the image data array transmitted by the PCIE channel.
[0105] 424) Save the data packet length ret of the image frame segmentation in this data array, remove the data packet length ret of the image frame segmentation this time from the total length bufLen of the data array, and move the first address pointer bufPtr forward by the number of moves ret.
[0106] 425) Put the complete data packet of the image segmented this time into a queue to be decoded.
[0107] 5. Send the complete data packet to be decoded to the hard decoding module.
[0108] Start the chip's hard decoding module, dynamically apply for the size of the image buffer according to the size of the image to be decoded, copy the original image data into the cache, and perform hard decoding based on its configuration information. At the same time, start the real-time monitoring thread for situations where the decoding module cannot work due to error frames, analyze its decoding status, and implement soft reset measures so that the decoding module can continue to decode.
[0109] 51) Initialize the hard decoding module according to the image parameters and decoding type, configure its video data buffer size, and start the decoding module;
[0110] 52) Dynamically apply for the buffer size buf of the video image frame data packet;
[0111] 53) Loop to determine whether the decoding is completed, if so, exit the processing flow and proceed to step 57), otherwise proceed to the next step;
[0112] 54) Set the parameters of the current frame to be decoded: stream end marker, frame header marker, frame tail marker;
[0113] 55) Put the image frame data into buf;
[0114] 56) Call the dynamic library function to send buf data to the hard decoding module;
[0115] 57) Monitor the decoding status of the hard decoding module in real time. If the decoding is wrong, soft restart the hard decoding module and reset the parameters. If the decoding is normal, call the library function to obtain the decoded image;
[0116] 58) Call the library function to stop sending the video stream to the hard decoding module, close the decoding channel, unbind the binding relationship between each module, and clear the resources.
[0117] 6. Send the decoded image to the host via PCIE
[0118] After obtaining the target image after hard decoding, copy the image data to the memory space of DMA transfer, start the DMA transfer task to send the image data to the PCIE channel on the host side, and write the sending length into the address segment specified by the protocol to notify the host to read the data. The specific steps are as follows:
[0119] 61) Get the read-write mutex lock of the PCIE channel;
[0120] 62) Copy the decoded image parameter data to the DMA virtual address space;
[0121] 63) Determine whether the write length in the HiSilicon platform chip is cleared by the host (i.e., the previous frame of image data has been taken away by the host device). If it is not 0, report an error and exit, terminate the image sending task, and return to step 61) after receiving the new decoded image parameter data; otherwise, enter step 64);
[0122] 64) Obtain the destination physical address of the data to be sent to the master device. If the destination physical address is zero, report an error and exit, terminate the image sending task, and return to step 61) after receiving the new decoded image parameter data; otherwise, enter step 65); configure the PCIE of the HiSilicon platform as a slave device, and the PCIE device of the host as a master device;
[0123] 65) Get the physical first address of the DMA transfer and the offset address specified by the protocol, use the sum of the two as the source address of the DMA transfer task, and use the physical address vxworks_phy_addr of the host PCIE as the destination address of the task;
[0124] 66) Set the transmission length of this task to the length of the parameter frame data sei_len;
[0125] 67) Determine whether the current PCIE operation handle is greater than zero. If so, use the system function ioctl to issue the PCIE write task and proceed to the next step. If not, report an error and exit this process, terminate the image sending task, and return to step 61 after receiving the new decoded image parameter data;
[0126] 68) Determine whether the task status of the current PCIE write task is completed, if so, proceed to the next step, if not, report an error and exit this process; after receiving the new decoded image parameter data, return to step 61);
[0127] 69) Set the source address of the second DMA transfer task to the image frame array data, use the host physical address vxworks_phy_addr offset parameter frame byte number sei_len as the destination address of the task, and set the image frame length frame_len to the transfer length of the second task;
[0128] 610) Repeat steps 67) and 68) and proceed to the next step;
[0129] 611) Write the sent image frame length frame_len to the memory address specified by the protocol, prompting the host to read the data;
[0130] 612) Using the host to read the image frame data and parameter frame data, and complete the return work;
[0131] 613) Unlock the mutex lock of the PCIE channel, release the PCIE channel resources, and return to step 61) after receiving new decoded image parameter data.
[0132] Steps 2), 3) and 6) of the present invention enable the PCIE channel to transmit data, effectively reducing the transmission delay.
[0133] The present invention belongs to the video decoding technology under the Linux system. In the application scenario where the system is Linux, according to the characteristics of the HiSilicon Hi3559AV100 chip and combined with the PCIE device properties, a video decoding scheme design method based on the combination of soft decoding and hard decoding under the Linux system is designed and implemented.
[0134] By using the above technical solution and the above operation steps, the present invention can solve the video decoding and transmission problems 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, dynamically filtering the error frame, and obtaining the complete data packet. The hard decoding module of the chip is used to complete the decoding process, effectively reducing the decoding time, and using the PCIE channel to transmit the images before and after decoding, which greatly reduces the data transmission delay.
[0135] The contents not described in detail in the specification of the present invention belong to the common knowledge of those skilled in the art.
Claims
1. A video decoding method combining software and hardware and efficient transmission, characterized in that: The steps include: 1) Configure the compilation properties and parameters of ffmpeg and port the ffmpeg dynamic library to the HiSilicon platform; 2) Configure PCIE devices; Configure the PCIE of the HiSilicon platform as a slave device and the PCIE device of the host as a master device; at the same time, formulate the transmission rules between the master device and the slave device; 3) Create a PCIE data reading thread and start the PCIE reading task to obtain the original image data transmitted by the host; 4) Create a ffmpeg data packet acquisition thread and use the ffmpeg dynamic library to obtain the complete data packet of the compressed image; 5) Use the hard decoding module of the HiSilicon platform to decode the compressed image data packet to obtain the decoded image data; 6) Use the PCIE channel to transmit the decoded image data back to the host; Step 3) creates a PCIE data reading thread, as follows: 31) Apply for the read-write mutex lock of the PCIE channel to protect the read-write operations of each PCIE channel. Multiple PCIE channels are not allowed to perform read-write operations at the same time. 32) Check whether the host device has new image data to read, that is, whether the read data length within the fixed address is not zero, and the host's read address is not zero; 33) Read data in the specified read address segment according to the protocol rules. Specific operations: Set the destination address of the PCIE read task to the PCIE read address of the slave device; Set the source address to the PCIE write address of the master device; 34) Send a read data task command to the slave device through the ioctl function; determine whether the return value of the read data task is successful. If the read data task is successful, the read length is cleared to zero for the master device to transmit data next time; 35) Unlock the read-write mutex of the PCIE channel to release resources; Step 6) The method of using the PCIE channel to transmit the decoded image data back to the host is specifically as follows: 61) Get the read-write mutex lock of the PCIE channel; 62) Copy the decoded image parameter data to the DMA virtual address space; 63) Determine whether the write length in the HiSilicon platform chip is cleared by the host. If it is not 0, report an error and exit, terminate the image sending task, and return to step 61 after receiving the new decoded image parameter data); otherwise, enter step 64); 64) Get the destination physical address of the data to be sent to the host device. If the destination physical address is zero, report an error and exit, terminate the image sending task, and return to step 61 after receiving the new decoded image parameter data); otherwise, go to step 65); configure the PCIE of HiSilicon as a slave device and the PCIE device of the host as a master device; 65) Get the physical first address of DMA transfer and the offset address specified by the protocol, use the sum of the two as the source address of the DMA transfer task, and use the physical address vxworks_phy_addr of the host PCIE as the destination address of the task; 66) Set the transmission length of this task to the length of the parameter frame data sei_len; 67) Determine whether the current PCIE operation handle is greater than zero. If so, use the system function ioctl to issue the PCIE write task and proceed to the next step. If not, report an error and exit this process, terminate the image sending task, and return to step 61 after receiving the new decoded image parameter data); 68) Determine whether the task status of the current PCIE write task is completed, if yes, proceed to the next step, if not, report an error and exit this process; after receiving the new decoded image parameter data, return to step 61); 69) Set the source address of the second DMA transfer task to the image frame array data, use the host physical address vxworks_phy_addr offset parameter frame byte number sei_len as the destination address of the task, and set the image frame length frame_len to the transfer length of the second task; 610) Repeat steps 67) and 68) and proceed to the next step; 611) Write the sent image frame length frame_len to the memory address specified by the protocol, prompting the host to read the data; 612) Use the host to read the image frame data and parameter frame data and complete the return work; 613) Unlock the mutex lock of the PCIE channel, release the PCIE channel resources, and return to step 61 after receiving the new decoded image parameter data); Step 1) Porting the ffmpeg dynamic library to the HiSilicon platform is as follows: 11) First, configure the ffmpeg compilation properties, and configure the parameters according to the platform type, CPU type, codec properties, format conversion properties, and cross-compilation properties; 12) Modify the acodec.h file, add the parameter frame length sei_len and array sei_buf, and determine its parameter frame size SEI_BUF_SIZE according to the application layer requirements; 13) Add the function of getting parameter frame in the decode_nal_sei_prefix function in the hevc_sei.c file; 14) Execute the configure command to generate the decoding libraries libavcodec, libavformat, libavutil, and libswscale in the subfolder lib of the configuration folder; 15) Finally, copy the decoding libraries libavcodec, libavformat, libavutil, and libswscale to the / usr / lib path of the decoding board; Step 4) Create ffmpeg to obtain data packets thread, specifically: 421) Get the first address pointer bufPtr and length bufLen of the image data array read from the PCIE channel; 422) Determine whether the current data length bufLen is greater than 0. If so, proceed to the next step. If not, exit the decoding process of this data and wait for the image data to be transmitted by the next PCIE channel. 423) Send the data array first address pointer bufPtr and length bufLen to the soft decoding module, use the library function av_parser_parse2 to split the image data into frames, if a complete image frame data packet can be successfully obtained from the array, record it and continue to the next step, if not, exit this decoding process; Waiting for the image data array to be transmitted by the PCIE channel; 424) Save the data packet length ret of the image frame segmentation in the data array this time, remove the data packet length ret of the image frame segmentation this time from the total length bufLen of the data array, and move the first address pointer bufPtr forward by the number of times ret; 425) putting the complete data packet of the image segmented this time into a queue to be decoded; Step 5) The method for decoding the compressed image data packet is specifically as follows: 51) Initialize the hard decoding module according to the image parameters and decoding type, configure the video data buffer size in the hard decoding module, and start the decoding module; 52) Dynamically apply for the buffer size buf of the video image frame data packet; 53) Loop to determine whether the decoding is completed, if yes, exit the processing flow and proceed to step 57), otherwise proceed to the next step; 54) Set the parameters of the current frame to be decoded: stream end marker, frame header marker, frame tail marker; 55) Put the image frame data into buf; 56) Call the dynamic library function to send buf data to the hard decoding module; 57) Monitor the decoding status of the hard decoding module in real time. If the decoding is wrong, soft restart the hard decoding module and reset the parameters. If the decoding is normal, call the library function to obtain the decoded image. 58) Call the library function to stop sending the video stream to the hard decoding module, close the decoding channel, unbind the binding relationship between modules, and clear resources.
2. The video decoding method of claim 1 that combines software and hardware and has high efficiency transmission, characterized in that: Step 2) The master device and slave device transmission rules are as follows: After the master device is powered on, the specified content of the handshake is written. After the slave device is powered on, the corresponding content is detected and the handshake is successful. The master device and the slave device allocate a read and write PCIE address for each channel, and different read and write addresses do not conflict with each other; After the master device successfully handshakes, the address content of each channel receiving data is written into the specified PCIE address segment; The master device uses the query of the content length of the fixed address segment to determine whether there is data or not, and clears the content length to zero after completing the data reading. Before transmitting data, the slave device first uses the fixed address segment length to determine whether the master device has read the previous data. If so, it writes the decoded image data and the length. If not, it abandons the data writing task and waits to receive the next decoded image data before transmitting.
3. A processing device, characterized in that: include: Memory for storing computer programs; A processor, configured to call and run the computer program from the memory to execute the method according to claim 2.
4. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program or instruction, and when the computer program or instruction is executed, the method of claim 2 is implemented.
5. A computer program product, characterized in that The computer program product comprises instructions, which, when the computer program product is run on a computer, cause the computer to perform the method of claim 2 .
