A decoding method for solving timeout memory overflow
Patent Information
- Application Number
- CN202411599695.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2026-09-15
- Estimated Expiration
- 2044-11-11
AI Technical Summary
[0003]但是Atlas 200AI属于硬解码范畴,在协议帧不完全符合解码协议,或者错误帧比较多的情况下,解码效率比较低下或者不能解码,并且对于带有参数帧的图像信息,硬解码模块无法提取参数信息
[0093] The decoding method for resolving timeout memory overflow provided by the above technical solution can address video decoding and transmission issues under Linux systems. This method has undergone algorithm verification and experimental testing. Results show that this solution effectively reduces decoding time by employing a software decoding method to assemble a complete data packet containing image frames and parameter frames, and then using the chip's hardware decoding module to complete the decoding process. Furthermore, real-time monitoring of the hardware decoding status ensures timely release of resources for undecodeable error frames, preventing memory leaks.
Abstract
Description
Technical Field
[0001] This invention belongs to the field of video decoding technology under Linux systems. In Linux-based application scenarios, considering the characteristics of the Atlas200AI chip and combining hardware attributes and software decoding features, a decoding method based on an acceleration module to solve timeout and memory overflow issues under Linux systems is designed and implemented. This invention, for Linux systems, first uses the FFMPEG software decoding library to analyze the data received from the network, effectively obtaining compressed frame parameter information and image information, and transmitting decodeable data packets to the Atlas200AI chip. Simultaneously, it monitors hardware decoding time and resource scheduling, avoiding the problem of hardware decoding failing to complete the decoding process due to memory not being released because of erroneous frames. Background Technology
[0002] The Atlas 200 AI acceleration module integrates the Ascend 310 AI processor, enabling image recognition, image classification, and other functions on the edge. It can perform various data analysis and inference calculations, including images and videos, and is widely used in edge AI scenarios such as smart cameras, robots, and drones.
[0003] However, Atlas 200AI falls under the category of hardware decoding. When the protocol frame does not fully conform to the decoding protocol, or when there are many erroneous frames, the decoding efficiency is low or decoding is impossible. Furthermore, for image information with parameter frames, the hardware decoding module cannot extract the parameter information. This invention uses the ffmpeg decoding library to obtain parameter frame information and data frame information from the original frame, obtains the complete image frame data packet, and transmits the decodeable complete data packet to the hardware decoding module to complete the decoding function. Simultaneously, to solve the problem of providing an interface for upper-layer applications to call, it is provided to the upper layer in the form of a dynamic library. Moreover, to prevent the hardware from failing to release memory resources due to decoding timeouts caused by erroneous frames, monitoring methods are used to release memory in a timely manner to avoid memory leaks. Summary of the Invention
[0004] (I) Purpose of the Invention
[0005] The purpose of this invention is to provide a decoding method that solves the problem of timeout memory overflow, which adopts a hardware and software combined decoding method based on acceleration modules to solve the video decoding problem under the Linux system.
[0006] (II) Technical Solution
[0007] To address the aforementioned technical problems, this invention provides a decoding method for resolving timeout memory overflow, comprising the following steps:
[0008] S1: Porting ffmpeg to the acceleration module platform;
[0009] S2: Set up the interface for initializing resource calls;
[0010] S3: Use the ffmpeg dynamic library to obtain a complete compressed image data packet containing parameter frames;
[0011] S4: Hardware decoding based on the acceleration module;
[0012] S5: Set an error callback function to check the decoding status;
[0013] S6: Return the decoded image to the upper-layer application through the interface function;
[0014] S7: Release the decoding channel resources.
[0015] Step S1 includes the following process:
[0016] S11: Configure ffmpeg compilation properties, and configure parameters according to platform type, CPU type, codec properties, format conversion properties, and cross-compilation properties;
[0017] S12: Modify the acodec.h file to add the parameter frame length sei_len and the array sei_buf, and determine the parameter frame size SEI_BUF_SIZE according to the application layer requirements;
[0018] S13: Add a function to get the parameter frame in the decode_nal_sei_prefix function in the hevc_sei.c file: get the parameter size in the function, assign size to sei_len, check if size is less than or equal to SEI_BUF_SIZE, if the condition is met, copy the data in the context parameter array gb to sei_buf, the length of the copy is size, and the array index i of the copied sei_buf is the index of the gb array divided by 8, that is, sei_buf[i] = gb_buf[index / 8];
[0019] S14: Execute the configure command, which will generate the decoding libraries libavcodec, libavformat, libavutil, and libswscale in the lib subfolder of the configuration folder;
[0020] S15: Copy the dynamic library to the / usr / lib path on the decoding board.
[0021] In step S2, the calling interface is set as an external function, the parameters and return value are set according to the protocol, and the decoding resources are initialized.
[0022] Step S2 includes the following process:
[0023] S21: Initialize the semaphore mutex;
[0024] S22: Create an initialization resource setup thread. The main logic of the thread is set as follows:
[0025] S221: Set the hardware decoding device serial number;
[0026] S222: Use library functions to create a hardware decoding context;
[0027] S223: Use library functions to create a hardware-decoded data stream object;
[0028] S224: Create a decoding thread;
[0029] S225: Initialize ffmpeg resources;
[0030] S226: Create a network data receiving thread and put the received data into a circular buffer array;
[0031] S227: Initialize the accelerated decoding module resources, the process is as follows:
[0032] S2271: Create decoding channel attributes. If creation is successful, proceed to the next step; otherwise, exit with an error.
[0033] S2272: Set the decoding channel ID number. If the setting is successful, proceed to the next step; otherwise, exit with an error.
[0034] S2273: Set the decoding thread number;
[0035] S2274: Set the decoding channel callback function. If the setting is successful, proceed to the next step; otherwise, exit with an error.
[0036] S2275: Set the decoding channel error exception callback function. If the setting is successful, proceed to the next step; otherwise, exit with an error.
[0037] S2276: Set the decoding type of the decoding channel. If the setting is successful, proceed to the next step; otherwise, exit with an error.
[0038] S2277: Set the output image format of the decoding channel. If the setting is successful, proceed to the next step; otherwise, exit with an error.
[0039] S2278: Set the decoding channel output mode. If the setting is successful, proceed to the next step; otherwise, exit with an error.
[0040] S2279: Create a decoding channel based on the decoding channel attributes;
[0041] S228: Periodically check if the network has received the image array, i.e., if the circular buffer array has data. If it does, take the data according to the frame length specified in the protocol and proceed to the next process; otherwise, continue to query and wait for network data.
[0042] Step S3 includes the following process:
[0043] S31: Initialize the decoding library usage environment
[0044] First, set the decoder type to HEVC / h265; then, initialize the decoder context and dynamically allocate image frame storage space.
[0045] S32: Create an ffmpeg thread for acquiring data packets. The creation process is as follows:
[0046] S321: Obtain the pointer to the first address of the image data array read from the network, bufPtr, and its length, bufLen;
[0047] S322: Determine if the current data length bufLen is greater than 0. If it is, continue to the next step; otherwise, wait for the network to send data next time.
[0048] S323: Transmit the pointer to the first address of the data array bufPtr and the length bufLen to the software decoding module. Use the library function av_parser_parse2 to segment the 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; otherwise, exit the current decoding process.
[0049] S324: Save the length ret of the data packet for the image frame segmentation in the current data array, remove the length ret of the image frame data packet for the current segmentation from the total length bufLen of the data array, and move the starting address pointer bufPtr forward by ret times;
[0050] S325: Place the complete image data packet from this segmentation into the queue to be decoded.
[0051] In step S4, the complete data packet filtered by ffmpeg is hardware decoded. The hardware decoding process is as follows:
[0052] S41: Set the decoding callback function, the process is as follows:
[0053] S411: Use library functions to obtain the decoded normal frame output. If the result is 0, proceed to the next step; otherwise, exit with an error.
[0054] S412: Use library functions to obtain image attribute data output;
[0055] S413: Use library functions to retrieve the image size, width, and height parameters from the output;
[0056] S414: Copy the image data and parameter data to the user-returned array g_send_buf;
[0057] S415: Unlock the semaphore mutex, allowing user access to the returned array g_send_buf;
[0058] S42: Obtain the complete image data packet from the decoding queue in step S3;
[0059] S43: The data packet is sent to the hardware decoding module for decoding, as follows:
[0060] S431: Use library functions to dynamically allocate image storage space;
[0061] S432: Obtain parameter information of image frames from ffmpeg;
[0062] S433: Integrates parameter information and decoded image data into a complete frame;
[0063] S434: Create an input image stream property object;
[0064] S435: Set the input image stream property object;
[0065] S436: Dynamically allocate memory space for image output;
[0066] S437: Create an output image attribute object;
[0067] S438: Set the output image attributes based on the image's data, size, and format;
[0068] S439: Use library functions to send image frame data to the hardware decoding module by passing the decoding channel attributes, input image stream attributes, and output image attributes as parameters;
[0069] S4310: Release the allocated image memory space;
[0070] S4311: Destroy the input image stream object resource.
[0071] In step S5, during the decoding process, it is checked in real time whether the image frame can be successfully decoded. If it cannot, resources need to be released. Step S5 includes the following process:
[0072] S51: Set the error callback function to callbackErr, with the parameter being a pointer to an exception type object;
[0073] S52: Use the library function to obtain the decoding task number taskid from the exception information;
[0074] S53: Obtain the image frame number (frameid) of the decoded stream from the abnormal situation information;
[0075] S54: Obtain the device number from the abnormal situation decoding device;
[0076] S55: Check if the device ID and task ID in the previous initialization settings are consistent. If they are, use the image frame number frameid to allocate memory space in S4.
[0077] In step S6, after obtaining the hardware-decoded image, the image data is returned through an interface function, as follows:
[0078] S61: Set up the readbuf function to provide an interface for acquiring image data, as follows:
[0079] S611: Semaphore locking to prevent read / write conflicts on user-returned arrays;
[0080] S612: Copy the image data array g_send_buf decoded in step 4 to the temporary data array g_read_buf;
[0081] S613: Returns the length of the image data;
[0082] S62: Set up a function void* getbufAddress to obtain the address of the image data array, which returns the address of g_read_buf.
[0083] The process of step S7 is as follows:
[0084] S71: Report the decoding thread ID and data stream ID described by calling library functions;
[0085] S72: Set the flag for the decoding thread to false;
[0086] S73: Release the decoding thread;
[0087] S74: Destroy the decode channel object;
[0088] S75: Set the decoding channel description pointer to null;
[0089] S76: Destroy the decoded stream description object;
[0090] S77: Destroy the decoded stream object;
[0091] S78: Sets the array object in the decoded stream to empty.
[0092] (III) Beneficial Effects
[0093] The decoding method for resolving timeout memory overflow provided by the above technical solution can address video decoding and transmission issues under Linux systems. This method has undergone algorithm verification and experimental testing. Results show that this solution effectively reduces decoding time by employing a software decoding method to assemble a complete data packet containing image frames and parameter frames, and then using the chip's hardware decoding module to complete the decoding process. Furthermore, real-time monitoring of the hardware decoding status ensures timely release of resources for undecodeable error frames, preventing memory leaks. Detailed Implementation
[0094] To make the objectives, contents, and advantages of the present invention clearer, the specific embodiments of the present invention will be described in further detail below with reference to examples.
[0095] The decoding method for resolving timeout memory overflow in this embodiment includes the following steps:
[0096] S1: Porting ffmpeg to the acceleration module platform
[0097] S11: Configure ffmpeg compilation properties, including parameters based on platform type, CPU type, codec properties, format conversion properties, and cross-compilation properties.
[0098] S12: Modify the acodec.h file to add the parameter frame length sei_len and the array sei_buf, and determine the parameter frame size SEI_BUF_SIZE according to the application layer requirements;
[0099] S13: Add a function to get the parameter frame in the decode_nal_sei_prefix function in the hevc_sei.c file: get the parameter size in the function, assign size to sei_len, check if size is less than or equal to SEI_BUF_SIZE, if the condition is met, copy the data in the context parameter array gb to sei_buf, the length of the copy is size, and the array index i of the copied sei_buf is the index of the gb array divided by 8, that is, sei_buf[i] = gb_buf[index / 8];
[0100] S14: Execute the configure command, which will generate the decoding libraries libavcodec, libavformat, libavutil, and libswscale in the lib subfolder of the configuration folder.
[0101] S15: Copy the dynamic library to the / usr / lib path of the decoding board;
[0102] S2: Set up the resource call interface for initialization
[0103] Set the API call as an external function, configure the parameters and return value according to the protocol, and initialize the decoding resources. The specific steps are as follows:
[0104] S21: Initialize the semaphore mutex;
[0105] S22: Create an initialization resource setup thread. The main logic of the thread is as follows:
[0106] S221: Set the hardware decoding device serial number;
[0107] S222: Use library functions to create a hardware decoding context;
[0108] S223: Use library functions to create a hardware-decoded data stream object;
[0109] S224: Create a decoding thread;
[0110] S225: Initialize ffmpeg resources;
[0111] S226: Create a network data receiving thread and put the received data into a circular buffer array;
[0112] S227: Initialize the accelerated decoding module resources. The specific steps are as follows:
[0113] S2271: Create decoding channel attributes. If creation is successful, proceed to the next step; otherwise, exit with an error.
[0114] S2272: Set the decoding channel ID number. If the setting is successful, proceed to the next step; otherwise, exit with an error.
[0115] S2273: Set the decoding thread number;
[0116] S2274: Set the decoding channel callback function. If the setting is successful, proceed to the next step; otherwise, exit with an error.
[0117] S2275: Set the decoding channel error exception callback function. If the setting is successful, proceed to the next step; otherwise, exit with an error.
[0118] S2276: Set the decoding type of the decoding channel. If the setting is successful, proceed to the next step; otherwise, exit with an error.
[0119] S2277: Set the output image format of the decoding channel. If the setting is successful, proceed to the next step; otherwise, exit with an error.
[0120] S2278: Set the decoding channel output mode. If the setting is successful, proceed to the next step; otherwise, exit with an error.
[0121] S2279: Create a decoding channel based on the decoding channel attributes;
[0122] S228: Periodically check whether the network has received the image array, i.e., whether the circular buffer array has data. If it does, take the data according to the frame length specified in the protocol and proceed to the next process; otherwise, continue to query and wait for network data.
[0123] S3: Use the ffmpeg dynamic library to obtain a complete compressed image data packet containing parameter frames.
[0124] S31: Initialize the decoding library usage environment
[0125] First, set the decoder type to HEVC (h265). Then, initialize the decoder context and dynamically allocate image frame storage space.
[0126] S32: Create an ffmpeg thread to acquire data packets. The specific thread flow is as follows:
[0127] S321: Obtain the pointer to the first address of the image data array read from the network, bufPtr, and its length, bufLen;
[0128] S322: Determine if the current data length bufLen is greater than 0. If it is, continue to the next step; otherwise, wait for the network to send data next time.
[0129] S323: Transmit the pointer to the first address of the data array bufPtr and the length bufLen to the software decoding module. Use the library function av_parser_parse2 to segment the 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; otherwise, exit the current decoding process.
[0130] S324: Save the length ret of the data packet of the image frame segmentation in the data array this time, remove the length ret of the data packet 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 ret times.
[0131] S325: Place the complete image data packet from this segmentation into the queue to be decoded.
[0132] S4: Hardware decoding based on the acceleration module
[0133] Perform hardware decoding on the complete data packet filtered by ffmpeg. The specific steps are as follows:
[0134] S41: Set the decoding callback function, as follows:
[0135] S411: Use library functions to obtain the decoded normal frame output. If the result is 0, proceed to the next step; otherwise, exit with an error.
[0136] S412: Use library functions to obtain image attribute data output;
[0137] S413: Use library functions to retrieve the image size, width, and height parameters from the output;
[0138] S414: Copy the image data and parameter data to the user-returned array g_send_buf;
[0139] S415: Unlock the semaphore mutex, allowing user access to the returned array g_send_buf;
[0140] S42: Obtain the complete image data packet from the decoding queue in step S3;
[0141] S43: Send the data packet to the hardware decoding module for decoding, as follows:
[0142] S431: Use library functions to dynamically allocate image storage space;
[0143] S432: Obtain parameter information of image frames from ffmpeg;
[0144] S433: Integrates parameter information and decoded image data into a complete frame;
[0145] S434: Create an input image stream property object;
[0146] S435: Set the input image stream property object;
[0147] S436: Dynamically allocate memory space for image output;
[0148] S437: Create an output image attribute object;
[0149] S438: Set the output image attributes based on the image's data, size, and format;
[0150] S439: Use library functions to send image frame data to the hardware decoding module by passing the decoding channel attributes, input image stream attributes, and output image attributes as parameters;
[0151] S4310: Release the allocated image memory space;
[0152] S4311: Destroy the input image stream object resource;
[0153] S5: Set an error callback function to check the decoding status
[0154] During the decoding process, monitor in real time whether the image frames can be decoded successfully. If not, resources need to be released. The specific steps are as follows:
[0155] S51: Set the error callback function to callbackErr, with the parameter being a pointer to an exception type object;
[0156] S52: Use the library function to obtain the decoding task number taskid from the exception information;
[0157] S53: Obtain the image frame number (frameid) of the decoded stream from the abnormal situation information;
[0158] S54: Obtain the device number from the abnormal situation decoding device;
[0159] S55: Check if the device ID and task ID in the previous initialization settings are consistent. If they are, use the image frame number frameid to allocate memory space in process 4.
[0160] S6: Return the decoded image to the upper-layer application via an interface function.
[0161] After obtaining the hardware-decoded image, the image data is returned through an interface function. The specific steps are as follows:
[0162] S61: Set up the readbuf function to provide an interface for obtaining image data. The details are as follows:
[0163] S611: Semaphore locking to prevent read / write conflicts on user-returned arrays;
[0164] S612: Copy the image data array g_send_buf decoded in step 4 to the temporary data array g_read_buf;
[0165] S613: Returns the length of the image data;
[0166] S62: Set up a function `void* getbufAddress` to obtain the address of the image data array, which returns the address of `g_read_buf`.
[0167] S7: Release decoding channel resources
[0168] The specific steps are as follows:
[0169] S71: Report the decoding thread ID and data stream ID described by calling library functions;
[0170] S72: Set the decoding thread flag to false (do not decode);
[0171] S73: Release the decoding thread;
[0172] S74: Destroy the decode channel object;
[0173] S75: Set the decoding channel description pointer to null;
[0174] S76: Destroy the decoded stream description object;
[0175] S77: Destroy the decoded stream object;
[0176] S78: Sets the array object in the decoded stream to empty.
[0177] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A decoding method for resolving timeout memory overflow, characterized in that, Includes the following steps: S1: Porting ffmpeg to the acceleration module platform; S2: Set up the interface for initializing resource calls; S3: Use the ffmpeg dynamic library to obtain a complete compressed image data packet containing parameter frames; S4: Hardware decoding based on the acceleration module; S5: Set an error callback function to check the decoding status; S6: Return the decoded image to the upper-layer application through the interface function; S7: Release decoding channel resources; Step S1 includes the following processes: S11: Configure ffmpeg compilation properties, and configure parameters according to platform type, CPU type, codec properties, format conversion properties, and cross-compilation properties; S12: Modify the acodec.h file to add the parameter frame length sei_len and the array sei_buf, and determine the parameter frame size SEI_BUF_SIZE according to the application layer requirements; S13: Add a function to get the parameter frame in the decode_nal_sei_prefix function in the hevc_sei.c file: get the parameter size in the function, assign size to sei_len, check if size is less than or equal to SEI_BUF_SIZE, if the condition is met, copy the data in the context parameter array gb to sei_buf, the length of the copy is size, and the array index i of the copied sei_buf is the index of the gb array divided by 8, that is, sei_buf[i] = gb_buf[index / 8]; S14: Execute the configure command, which will generate the decoding libraries libavcodec, libavformat, libavutil, and libswscale in the lib subfolder of the configuration folder; S15: Copy the dynamic library to the / usr / lib path of the decoding board; In step S2, the calling interface is set as an external function, the parameters and return value are set according to the protocol, and the decoding resources are initialized; Step S2 includes the following processes: S21: Initialize the semaphore mutex; S22: Create an initialization resource setup thread. The main logic of the thread is set as follows: S221: Set the hardware decoding device serial number; S222: Use library functions to create a hardware decoding context; S223: Use library functions to create a hardware-decoded data stream object; S224: Create a decoding thread; S225: Initialize ffmpeg resources; S226: Create a network data receiving thread and put the received data into a circular buffer array; S227: Initialize the accelerated decoding module resources, the process is as follows: S2271: Create decoding channel attributes. If creation is successful, proceed to the next step; otherwise, exit with an error. S2272: Set the decoding channel ID number. If the setting is successful, proceed to the next step; otherwise, exit with an error. S2273: Set the decoding thread number; S2274: Set the decoding channel callback function. If the setting is successful, proceed to the next step; otherwise, exit with an error. S2275: Set the decoding channel error exception callback function. If the setting is successful, proceed to the next step; otherwise, exit with an error. S2276: Set the decoding type of the decoding channel. If the setting is successful, proceed to the next step; otherwise, exit with an error. S2277: Set the output image format of the decoding channel. If the setting is successful, proceed to the next step; otherwise, exit with an error. S2278: Set the decoding channel output mode. If the setting is successful, proceed to the next step; otherwise, exit with an error. S2279: Create a decoding channel based on the decoding channel attributes; S228: Periodically check whether the network has received the image array, i.e., whether the circular buffer array has data. If it does, take the data according to the frame length specified in the protocol and proceed to the next process; otherwise, continue to query and wait for network data. Step S3 includes the following processes: S31: Initialize the decoding library usage environment First, set the decoder type to HEVC / h265; then, initialize the decoder context and dynamically allocate image frame storage space. S32: Create an ffmpeg thread for acquiring data packets. The creation process is as follows: S321: Obtain the pointer to the first address of the image data array read from the network, bufPtr, and its length, bufLen; S322: Determine if the current data length bufLen is greater than 0. If it is, continue to the next step; otherwise, wait for the network to send data next time. S323: Transmit the pointer to the first address of the data array bufPtr and the length bufLen to the software decoding module. Use the library function av_parser_parse2 to segment the 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; otherwise, exit the current decoding process. S324: Save the length ret of the data packet for the image frame segmentation in the current data array, remove the length ret of the image frame data packet for the current segmentation from the total length bufLen of the data array, and move the starting address pointer bufPtr forward by ret times; S325: Place the complete image data packet from this segmentation into the decoding queue; In step S4, the complete data packet filtered by ffmpeg is hardware decoded. The hardware decoding process is as follows: S41: Set the decoding callback function, the process is as follows: S411: Use library functions to obtain the decoded normal frame output. If the result is 0, proceed to the next step; otherwise, exit with an error. S412: Use library functions to obtain image attribute data output; S413: Use library functions to retrieve the image size, width, and height parameters from the output; S414: Copy the image data and parameter data to the user-returned array g_send_buf; S415: Unlock the semaphore mutex, allowing user access to the returned array g_send_buf; S42: Obtain the complete image data packet from the decoding queue in step S3; S43: The data packet is sent to the hardware decoding module for decoding, as follows: S431: Use library functions to dynamically allocate image storage space; S432: Obtain parameter information of image frames from ffmpeg; S433: Integrates parameter information and decoded image data into a complete frame; S434: Create an input image stream property object; S435: Set the input image stream property object; S436: Dynamically allocate memory space for image output; S437: Create an output image attribute object; S438: Set the output image attributes based on the image's data, size, and format; S439: Use library functions to send image frame data to the hardware decoding module by passing the decoding channel attributes, input image stream attributes, and output image attributes as parameters; S4310: Release the allocated image memory space; S4311: Destroy the input image stream object resource; In step S5, during the decoding process, it is checked in real time whether the image frame can be successfully decoded. If it cannot, resources need to be released. Step S5 includes the following process: S51: Set the error callback function to callbackErr, with the parameter being a pointer to an exception type object; S52: Use the library function to obtain the decoding task number taskid from the exception information; S53: Obtain the image frame number (frameid) from the decoded stream in the exception information; S54: Obtain the device number from the abnormal situation decoding device; S55: Check if the device ID and task ID in the previous initialization settings are consistent. If they are, use the image frame number frameid to allocate memory space in S4.
2. The decoding method for resolving timeout memory overflow as described in claim 1, characterized in that, In step S6, after obtaining the hardware-decoded image, the image data is returned through the interface function, as follows: S61: Set up the readbuf function to provide an interface for acquiring image data, as follows: S611: Semaphore locking to prevent read / write conflicts on user-returned arrays; S612: Copy the image data array g_send_buf decoded in step 4 to the temporary data array g_read_buf; S613: Returns the length of the image data; S62: Sets up a function void* getbufAddress to obtain the address of the image data array, which returns the address of g_read_buf.
3. The decoding method for resolving timeout memory overflow as described in claim 2, characterized in that, The process of step S7 is as follows: S71: Report the decoding thread ID and data stream ID described by calling library functions; S72: Set the decoding thread flag to false; S73: Release the decoding thread; S74: Destroy the decode channel object; S75: Set the decoding channel description pointer to null; S76: Destroy the decoded stream description object; S77: Destroy the decoded stream object; S78: Sets the array object in the decoded stream to empty.
Citation Information
Patent Citations
Multi-channel video decoding method based on dynamic library form
CN117241036A