A method, system, terminal and medium for multi-process encoding and decoding of homologous files

Multi-process programming and decoding is performed through the shared memory cache area, which solves the problem of read and write restrictions of storage devices during multi-process programming and decoding, and achieves more efficient memory utilization and encoding and decoding efficiency.

CN116320468BActive Publication Date: 2025-07-08INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310300047.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-26
Publication Date
2025-07-08
Estimated Expiration
2043-03-26

AI Technical Summary

Technical Problem

During the multi-process encoding and decoding process, the prior art has led to limited read and write of storage devices such as hard disks, waiting problems arise and memory space is wasted.

Method used

The multi-process codec homologous file method is adopted to extract and code data through the shared memory cache area, reducing waiting problems, improving encoding and decoding efficiency, and saving memory space.

Benefits of technology

It effectively reduces the waiting time during multi-process encoding and decoding, and improves memory utilization and encoding and decoding efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116320468B_ABST
    Figure CN116320468B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of video encoding and decoding, and specifically discloses a method, system, terminal and medium for encoding and decoding homologous files in multiple processes. It determines whether the source file has been opened. If it has not been opened, the source file is opened to obtain the global context of the source file, and a memory buffer is applied. The frame data of the source file is filled in the memory buffer, and the frame data is extracted from the memory buffer for encoding and decoding. If it has been opened, the frame data is directly extracted from the memory buffer for encoding and decoding. In the present invention, multiple encoding and decoding processes preferentially use the same memory buffer, extract data from one memory buffer for encoding and decoding, reduce waiting problems, improve the encoding and decoding efficiency, save memory space, and improve the memory utilization rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of video encoding and decoding, and particularly to a method, system, terminal and medium for multi-process encoding and decoding of homologous files. Background Art

[0002] Data shows that in recent years, the scale of the online video market has been increasing year by year. The online video industry has maintained a relatively high growth rate in recent years, reflecting the strong vitality and optimistic industrial prospects of the industry. The influence of online videos is also increasing day by day. Video encoding and decoding technology is the initial condition for the development of Internet TV. Efficient video encoding ensures the provision of video services in the real Internet environment.

[0003] Video compression encoding technology can be divided into two categories: lossless compression and lossy compression. Lossless compression is also called reversible encoding, which means that when the compressed data is used for reconstruction (i.e., decompression), the reconstructed data is exactly the same as the original data. Lossy compression is also called irreversible encoding, which means that when the compressed data is used for reconstruction (i.e., decompression), there are differences between the reconstructed data and the original data, but it does not affect people's misunderstanding of the information expressed by the original material.

[0004] Currently, video companies provide different resolutions for each video source for users to choose by themselves, such as 1080P, 520P, etc. This process requires encoding and decoding of video files with different resolutions. When multiple encoding and decoding processes are used to encode and decode the same source file to obtain multiple videos with different resolutions, each encoding and decoding process will apply for its own memory space, store the content of the read source file in its own memory space, and then perform data processing. However, due to the reading and writing limitations of storage devices such as hard disks, the current method of multiple encoding processes reading the source file simultaneously will have waiting problems and cause waste of memory space. Summary of the Invention

[0005] To solve the above problems, the present invention provides a method, system, terminal and medium for multi-process encoding and decoding of homologous files. Multiple encoding and decoding processes preferentially use the same memory buffer, extract data from one memory buffer for encoding and decoding, reduce waiting problems, improve encoding and decoding efficiency, save memory space, and improve memory utilization.

[0006] In a first aspect, the technical solution of the present invention provides a method for multi-process encoding and decoding of homologous files, including the following steps:

[0007] Judge whether the source file has been opened;

[0008] If not, open the source file to obtain the global context of the source file, apply for a memory buffer, fill the source file frame data in the memory buffer, and extract frame data from the memory buffer for encoding and decoding;

[0009] If it has been opened, directly extract the frame data from the memory buffer for encoding and decoding.

[0010] In an alternative embodiment, before determining whether the target source file has been opened, the following steps are further included:

[0011] Register the encoding and decoding process;

[0012] Add marker points to the encoding and decoding process during registration.

[0013] In an alternative embodiment, the method further includes the following steps:

[0014] In response to determining that the target source file has not been opened, set the marker point of the current encoding and decoding process to the first marker;

[0015] In response to determining that the target source file has been opened, set the marker point of the current encoding and decoding process to the second marker.

[0016] In an alternative embodiment, after determining that the target source file has been opened, the following steps are further included:

[0017] Determine whether the memory buffer has been expanded;

[0018] If it has not been expanded, notify the encoding and decoding process with the first marker to expand the applied memory buffer;

[0019] The encoding and decoding process with the first marker extracts frame data from the source file to fill the expanded memory buffer.

[0020] In an alternative embodiment, extracting frame data from the memory buffer for encoding and decoding specifically includes:

[0021] Detect the marker point identifier of the current encoding and decoding process;

[0022] In response to the marker point identifier of the current encoding and decoding process being the first marker, extract the first frame data packet from the memory buffer;

[0023] Perform encoding and decoding on the first frame data packet, and after the encoding and decoding is completed, continue to perform the operation of extracting the second frame data packet from the memory buffer;

[0024] Perform encoding and decoding on the second frame data packet, and after the encoding and decoding is completed, continue to perform the operation of extracting the third frame data packet from the memory buffer;

[0025] And so on, until the extraction of data from the memory buffer fails, indicating that the current encoding and decoding process has completed the encoding and decoding of all the data in the memory buffer, and extract the next segment of frame data from the source file to fill and overwrite the memory buffer.

[0026] In an optional implementation, frame data is extracted from the memory buffer for encoding and decoding, which specifically further includes:

[0027] Detect the marker point identifier of the current encoding and decoding process;

[0028] In response to the marker point identifier of the current encoding and decoding process being the second marker, extract the first frame data packet from the memory buffer;

[0029] Perform encoding and decoding on the first frame data packet, and after the encoding and decoding is completed, continue to execute the operation of extracting the second frame data packet from the memory buffer;

[0030] Detect whether the second frame data packet is successfully extracted;

[0031] If the second frame data packet is not successfully extracted, determine whether the extraction count has reached the threshold;

[0032] If not, continue to execute the operation of extracting the second frame data packet from the memory buffer;

[0033] If it reaches, the current encoding and decoding process modifies the identifier of its own marker point to the first identifier, and re-applies for an exclusive memory buffer, and extracts the frame data of the next segment of the encoded and decoded frame data from the source file and fills it into the re-applied exclusive memory buffer;

[0034] Extract frame data packets from the re-applied exclusive memory buffer for encoding and decoding;

[0035] If the second frame data packet is successfully extracted, perform encoding and decoding on the second frame data packet, and after the encoding and decoding is completed, continue to execute the operation of extracting the third frame data packet from the memory buffer, and so on.

[0036] In an optional implementation, before extracting frame data from the memory buffer for encoding and decoding, the following steps are further included:

[0037] Probe the stream information to obtain the encoding format;

[0038] Find the corresponding codec according to the encoding format;

[0039] Open the found codec;

[0040] Apply for a scaling data format conversion structure;

[0041] After extracting frame data from the memory buffer for encoding and decoding, the following steps are further included:

[0042] Release the conversion structure;

[0043] Close the codec;

[0044] Close the source file.

[0045] In a second aspect, the technical solution of the present invention provides a system for multi-process encoding and decoding of homologous files, including:

[0046] A file status judgment module: to judge whether the source file has been opened;

[0047] A first encoding and decoding module: if it is judged that the source file is not opened, then open the source file to obtain the global context of the source file, apply for a memory buffer, fill the source file frame data in the memory buffer, and extract the frame data from the memory buffer for encoding and decoding;

[0048] A second encoding and decoding module: if it is judged that the source file has been opened, then directly extract the frame data from the memory buffer for encoding and decoding.

[0049] In a third aspect, the technical solution of the present invention provides a terminal, including:

[0050] A memory for storing a program for multi-process encoding and decoding of homologous files;

[0051] A processor for implementing the steps of the method for multi-process encoding and decoding of homologous files as described in any one of the above when executing the program for multi-process encoding and decoding of homologous files.

[0052] In a fourth aspect, the technical solution of the present invention provides a computer-readable storage medium, on which a program for multi-process encoding and decoding of homologous files is stored, and when the program for multi-process encoding and decoding of homologous files is executed by a processor, the steps of the method for multi-process encoding and decoding of homologous files as described in any one of the above are implemented.

[0053] A method, system, terminal and medium for multi-process encoding and decoding of homologous files provided by the present invention, compared with the prior art, has the following beneficial effects: The encoding and decoding process first detects whether the source file has been opened. If it has not been opened, it means that the current encoding and decoding process is the first encoding and decoding process, and it is necessary to open the source file and apply for a memory buffer, store the frame data in the source file into the memory buffer, and then extract data from the memory buffer for encoding and decoding; if the source file has been opened, it means that the current encoding and decoding process is the encoding and decoding process after the first one, and the current encoding process directly extracts data from the memory buffer applied by the first encoding and decoding process for encoding and decoding, without having to apply for a memory buffer by itself. Multiple encoding and decoding processes of the present invention preferentially use the same memory buffer, extract data from one memory buffer for encoding and decoding, reduce waiting problems, improve encoding and decoding efficiency, save memory space, and improve memory utilization rate. Description of the Drawings

[0054] To more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0055] Figure 1 It is a schematic diagram of the data processing principle of the current multi-encoding and decoding process.

[0056] Figure 2 It is a schematic diagram of the data processing principle of a method for multi-process encoding and decoding of homologous files provided by an embodiment of the present invention.

[0057] Figure 3 It is a schematic diagram of the method flow for multi-process encoding and decoding of homologous files provided by an embodiment of the present invention.

[0058] Figure 4 It is a schematic diagram of the method flow for multi-process encoding and decoding of homologous files provided by an embodiment of the present invention.

[0059] Figure 5 It is a schematic block diagram of the system structure for multi-process encoding and decoding of homologous files provided by an embodiment of the present invention.

[0060] Figure 6 It is a schematic diagram of the structure of a terminal provided by an embodiment of the present invention. Detailed implementation manners

[0061] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present invention belongs. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

[0062] The following explains the key terms that appear in the present invention.

[0063] FFmpeg is an open-source computer program that can be used to record, convert digital audio and video, and convert them into streams. It includes the following audio / video encoding libraries such as libavcodec.

[0064] libavformat: Used for the generation and parsing of various audio / video encapsulation formats, including functions such as obtaining the information required for decoding to generate a decoding context structure and reading audio / video frames.

[0065] libavcodec: Used for encoding and decoding various types of sound / images.

[0066] libavutil: Contains some common utility functions.

[0067] libswscale: Used for video scene scaling and color mapping conversion.

[0068] libpostproc: Used for post - processing effects.

[0069] ffmpeg: A tool provided by this project, which can be used for format conversion, decoding, or real - time encoding of TV cards, etc.

[0070] ffsever: An HTTP multimedia real - time broadcast streaming server.

[0071] ffplay: A simple player that uses the ffmpeg library for parsing and decoding and displays through SDL.

[0072] To enable those skilled in the art to better understand the solution of this application, the following further details this application in conjunction with the accompanying drawings and specific embodiments. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all of them. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of this application.

[0073] The current video company provides different resolutions for each video source for users to choose by themselves, and this process requires encoding and decoding the video files with their respective different resolutions. Figure 1 It is a schematic diagram of the data processing principle for the current multi - encoding and decoding process. As Figure 1 shown, when using multiple encoding and decoding processes to encode and decode the same source file to obtain multiple videos with different resolutions, each encoding and decoding process will apply for its own memory space, store the content of the read source file in its own memory space, and then perform data processing. However, due to the read - write limitations of storage devices such as hard disks, the current method of multiple encoding processes reading the source file simultaneously will have waiting problems and cause waste of memory space.

[0074] Based on this, the present invention provides a method for multi - process encoding of the same source file. Figure 2 The following is a schematic diagram of the data processing principle of this method. The first encoding and decoding process applies for a memory buffer in the storage device, and this memory buffer is a shared memory buffer. Then the first encoding and decoding process retrieves frame data from the source file to fill this memory buffer, and the first encoding and decoding process extracts data from the memory buffer for encoding and decoding. Subsequent encoding and decoding processes preferentially directly read data from this shared memory buffer for encoding and decoding, reducing waiting problems, improving encoding and decoding efficiency, saving memory space, and improving memory utilization.

[0075] Figure 3It is a schematic flowchart of a method for multi - process encoding and decoding of homologous files provided by an embodiment of the present invention. Figure 3 The execution subject can be a system for multi - process encoding and decoding of homologous files. According to different requirements, the order of steps in this flowchart can be changed, and some steps can be omitted.

[0076] As Figure 3 shown, the method includes the following steps.

[0077] S1, Determine whether the source file has been opened.

[0078] S2, If not opened, open the source file to obtain the global context of the source file, apply for a memory buffer, fill the source file frame data in the memory buffer, and extract frame data from the memory buffer for encoding and decoding.

[0079] S3, If already opened, directly extract frame data from the memory buffer for encoding and decoding.

[0080] Each encoding and decoding process first detects whether the source file to be processed has been opened by other encoding and decoding processes. If not opened, it means that the current encoding and decoding process is the first one. This first encoding and decoding process will open the source file to obtain the global context of the source file, apply for a memory buffer from the storage device, then extract frame data from the source file to fill the memory buffer, and then extract frame data from the memory buffer for encoding and decoding.

[0081] If the source file has already been opened, it means that the current encoding and decoding process is not the first one. There is already a memory buffer storing the frame data of the source file, and the current encoding and decoding can directly extract frame data from the memory buffer for encoding and decoding.

[0082] The method for multi - process encoding and decoding of homologous files provided by this embodiment enables multiple encoding and decoding processes to preferentially use the same memory buffer, extract data from one memory buffer for encoding and decoding, reduces waiting problems, improves encoding and decoding efficiency, saves memory space, and improves memory utilization.

[0083] Figure 4 It is a schematic flowchart of a method for multi - process encoding and decoding of homologous files provided by an embodiment of the present invention. Figure 4 The execution subject can be a system for multi - process encoding and decoding of homologous files. According to different requirements, the order of steps in this flowchart can be changed, and some steps can be omitted.

[0084] As Figure 4 shown, the method includes the following steps.

[0085] S1, Register the encoding and decoding process, and add marker points to the encoding and decoding process during the registration process.

[0086] Before using the codec library in the encoding / decoding process, registration is required. Only after registration can the codec in the codec library be used for data encoding / decoding.

[0087] In this embodiment, a marker point is added to the encoding / decoding process during the encoding / decoding registration process. Subsequently, a marker is added at this marker point. The marker is used to identify whether the encoding / decoding process needs to apply for a memory buffer. Of course, generally, the first encoding / decoding process applies for a memory buffer. In some alternative embodiments, after the data in the current memory buffer is overwritten, subsequent encoding / decoding processes will also apply for their own memory buffers. See the following for details.

[0088] S2. Determine whether the source file has been opened. If not, execute step S3; if it has been opened, execute step S7.

[0089] S3. Set the marker point of the current encoding / decoding process to the first marker.

[0090] S4. The encoding / decoding process with the first marker opens the source file to obtain the global context of the source file and applies for a memory buffer.

[0091] S5. Extract frame data from the source file and fill it into the memory buffer.

[0092] S6. Extract frame data from the memory buffer for encoding / decoding.

[0093] S7. Set the marker point of the current encoding / decoding process to the second marker.

[0094] S8. Determine whether the memory buffer has been expanded. If it has been expanded, execute S11; if not, execute step S9.

[0095] S9. Notify the encoding / decoding process with the first marker to expand the applied memory buffer.

[0096] S10. The encoding / decoding process with the first marker expands the applied memory buffer and extracts frame data from the source file to fill the expanded memory buffer.

[0097] S11. The encoding / decoding process with the second marker extracts frame data from the expanded memory buffer for encoding / decoding.

[0098] It should be noted that after the memory buffer is expanded, the encoding / decoding process with the first marker actually extracts frame data from the expanded memory buffer for encoding / decoding.

[0099] The first encoding and decoding process applies for a memory buffer and extracts frame data from the memory buffer for encoding and decoding. After the first encoding and decoding process finishes encoding and decoding all the frame data in the memory buffer, the first encoding and decoding process extracts the next segment of frame data from the source file and fills it into the memory buffer (when there is no other encoding and decoding process, the filled memory buffer is the originally applied one; when there are other encoding and decoding processes, the filled memory buffer is the expanded one). In this way, the previous data in the memory buffer will be overwritten. Since the memory buffer is shared, other encoding and decoding processes also extract frame data from the memory buffer for encoding and decoding. If the processing speed of subsequent encoding and decoding processes is slower than that of the first encoding and decoding process, to ensure correct encoding and decoding, either the first encoding and decoding process waits for all other encoding and decoding processes to finish encoding and decoding the data in the current memory buffer before filling new data, which will reduce the processing efficiency, or other encoding and decoding programs reapply for a memory buffer by themselves. Therefore, in this embodiment, the original memory buffer is expanded to minimize the number of times of reapplying for the memory buffer.

[0100] When expanding the memory buffer, the storage space of the memory buffer can be doubled. Of course, according to different requirements, users can also choose other multiples for expansion processing.

[0101] In an alternative embodiment, when extracting frame data from the memory buffer for encoding and decoding, the first encoding and decoding process performs encoding and decoding according to the normal data extraction process. Subsequent encoding and decoding processes preferably extract data from the current memory buffer, and during the encoding and decoding process, it is judged whether to reapply for a memory buffer by itself according to the data extraction result.

[0102] The first encoding and decoding process extracting frame data from the memory buffer for encoding and decoding includes the following steps.

[0103] S110, detecting the marker point identifier of the current encoding and decoding process.

[0104] S120, in response to the marker point identifier of the current encoding and decoding process being the first marker, extracting the first frame data packet from the memory buffer.

[0105] S130, performing encoding and decoding on the first frame data packet, and after the encoding and decoding is completed, continuing to execute the operation of extracting the second frame data packet from the memory buffer.

[0106] S140, performing encoding and decoding on the second frame data packet, and after the encoding and decoding is completed, continuing to execute the operation of extracting the third frame data packet from the memory buffer.

[0107] S150, and so on, until the data extraction from the memory buffer fails, indicating that the current encoding and decoding process has completed encoding and decoding all the data in the memory buffer, and then extracting the next segment of frame data from the source file and filling and overwriting it into the memory buffer.

[0108] The first encoding / decoding process sequentially extracts the first frame data packet, the second frame data, and so on from the memory buffer according to the frame data order until no more frame data can be extracted, indicating that all the data in the memory buffer has been encoded / decoded. Then, it extracts the next segment of frame data from the source file and fills it into the memory buffer, and the new frame data will overwrite the previous frame data. The first encoding / decoding process continues to encode / decode other new frame data from the memory buffer.

[0109] The subsequent encoding / decoding processes extract frame data from the memory buffer for encoding / decoding, including the following steps.

[0110] S210, Detect the marker identification of the current encoding / decoding process.

[0111] S220, In response to the marker identification of the current encoding / decoding process being the second marker, extract the first frame data packet from the memory buffer.

[0112] S230, Encode / Decode the first frame data packet. After the encoding / decoding is completed, continue to perform the operation of extracting the second frame data packet from the memory buffer.

[0113] S240, Detect whether the extraction of the second frame data packet is successful.

[0114] S250, If the extraction of the second frame data packet is not successful, determine whether the number of extractions has reached the threshold.

[0115] S260, If not, continue to perform the operation of extracting the second frame data packet from the memory buffer.

[0116] S270, If it has reached, the current encoding / decoding process modifies the identification of its own marker to the first identification, and re-applies for an exclusive memory buffer, and extracts the next segment of frame data of the already encoded / decoded frame data from the source file and fills it into the re-applied exclusive memory buffer.

[0117] S280, Extract frame data packets from the re-applied exclusive memory buffer for encoding / decoding.

[0118] S290, If the extraction of the second frame data packet is successful, encode / Decode the second frame data packet. After the encoding / decoding is completed, continue to perform the operation of extracting the third frame data packet from the memory buffer, and so on.

[0119] After each frame data packet is encoded or decoded, the subsequent encoding and decoding process first detects whether the next frame data packet can be normally extracted when extracting it. If it can be normally extracted, the encoding and decoding continue. If it cannot be normally extracted, it means that the data in the current memory buffer has been overwritten by new data or all the data in the memory buffer has been encoded and decoded. At this time, the encoding and decoding process itself applies for an exclusive memory buffer to ensure the encoding and decoding efficiency and accuracy.

[0120] To further understand the present invention, a specific embodiment is provided below to further elaborate on the present invention in detail. In this specific embodiment, the FFmpeg process is used to implement the encoding and decoding of data.

[0121] (I) Preparation stage

[0122] Step 1: Register the FFmpeg library.

[0123] When using the corresponding library of FFmpeg, registration is required. Either sub-items can be registered or all can be registered.

[0124] A marker point is added to the process during the registration process, named TYZM. 0 indicates that there is no transcoding of homologous files; 1 indicates that there is homologous transcoding.

[0125] Step 2: Open the file.

[0126] First, determine whether the file is opened by FFmpeg.

[0127] If not, mark the process as TYZM0, open the file, and obtain the corresponding file global context according to the file name information.

[0128] If so, mark the process as TYZM1 and do not open the file.

[0129] Step 3: Detect the stream information and obtain the encoding format.

[0130] Detect the stream information and obtain the encoding format. If the stream information is not detected, the encoding type obtained by its stream encoder may be empty, and the original format cannot be known during subsequent data conversion, resulting in errors.

[0131] Step 4: Find the corresponding codec according to the encoding format.

[0132] Step 5: Open the found codec.

[0133] Step 6: Apply for a scaling data format conversion structure.

[0134] Most data is in the yuv series format, but the displayed data is in the rgb and other related color space data, and a structure conversion is required.

[0135] Step Seven, apply for a memory buffer.

[0136] Check the process marker point TYZM.

[0137] If it is 0, apply for a memory buffer to fill the source file frame data.

[0138] If it is 1, multiply the memory buffer applied by the first FFmpeg process that reads the file by 2 as the same memory buffer for all FFmpeg processes to fill the source file frame data.

[0139] (2) Enter the loop encoding and decoding stage

[0140] Step Eight, obtain a frame of data packet.

[0141] Take a packaged data packet, judge the type of the data packet and decode it to obtain the stored encoded data

[0142] Step Nine: Data conversion.

[0143] Use the conversion function combined with the conversion structure to convert the encoded data to obtain the raw data with the required target width, height and specified storage format.

[0144] Step Ten: Process by oneself.

[0145] Process the obtained raw data by oneself.

[0146] Check the process marker point TYZM.

[0147] If it is 0, keep looping until a data packet is successfully obtained. If a frame of data cannot be obtained, it means that the file encoding and decoding has been completed.

[0148] If it is 1, judge whether a frame of data is obtained after each encoding, try 3 times. If it fails, the process will change the TYZM marker point to 0, abandon the previous memory buffer, re-apply for an exclusive memory buffer and then perform loop encoding.

[0149] Step Eleven, release the frame data packet.

[0150] After execution, return to execute "Step Eight: Obtain a frame of data packet", and one loop ends.

[0151] (3) Jump out of the loop

[0152] Step Twelve: Release the conversion structure.

[0153] After all decoding is completed, release the corresponding resources in the application order.

[0154] Step Thirteen: Close the decoder / encoder.

[0155] Close the decoder / encoder that was opened previously.

[0156] Step Fourteen: Close the context.

[0157] After closing the file context, the variables applied previously shall be released in sequence according to the application order.

[0158] In the above text, embodiments of a method for multi-process encoding and decoding of homologous files have been described in detail. Based on the method for multi-process encoding and decoding of homologous files described in the above embodiments, an embodiment of the present invention also provides a system for multi-process encoding and decoding of homologous files corresponding to this method.

[0159] Figure 5 FIG. is a schematic block diagram of the system structure for multi-process encoding and decoding of homologous files provided by an embodiment of the present invention. In this embodiment, the system 500 for multi-process encoding and decoding of homologous files can be divided into multiple functional modules according to the functions it performs, such as Figure 5 shown, the functional modules may include: a registration module 510, a file status judgment module 520, a first encoding and decoding module 530, and a second encoding and decoding module 540. The module referred to in the present invention means a series of computer program segments that can be executed by at least one processor and can complete fixed functions, and are stored in the memory.

[0160] File status judgment module 520: Judge whether the source file has been opened.

[0161] First encoding and decoding module 530: If it is judged that the source file is not opened, open the source file to obtain the global context of the source file, apply for a memory buffer, fill the source file frame data in the memory buffer, and extract the frame data from the memory buffer for encoding and decoding.

[0162] Second encoding and decoding module 540: If it is judged that the source file has been opened, directly extract the frame data from the memory buffer for encoding and decoding.

[0163] In an optional embodiment, the system 500 further includes a registration module 510: register the encoding and decoding process, and add marker points to the encoding and decoding process during the registration process.

[0164] Correspondingly, the first encoding and decoding module 530 sets the marker point of the current encoding and decoding process to the first marker in response to judging that the target source file is not opened. The second encoding and decoding module 540 sets the marker point of the current encoding and decoding process to the second marker in response to judging that the target source file has been opened.

[0165] In an alternative embodiment, the second codec module 540 further determines whether the memory buffer has been expanded; if not, it notifies the codec process with the first tag to expand the applied memory buffer. Correspondingly, the first codec module 530 causes the codec process with the first tag to extract frame data from the source file to fill the expanded memory buffer.

[0166] In an alternative embodiment, the first codec module 530 extracts frame data from the memory buffer for encoding and decoding, specifically including: detecting the marker point identifier of the current codec process; in response to the marker point identifier of the current codec process being the first tag, extracting the first frame data packet from the memory buffer; performing encoding and decoding on the first frame data packet, and after the encoding and decoding is completed, continuing to perform the operation of extracting the second frame data packet from the memory buffer; performing encoding and decoding on the second frame data packet, and after the encoding and decoding is completed, continuing to perform the operation of extracting the third frame data packet from the memory buffer; and so on, until the data extraction from the memory buffer fails, indicating that the current codec process has completed the encoding and decoding of all the data in the memory buffer, and extracting the next segment of frame data from the source file to fill and overwrite the memory buffer.

[0167] In an alternative embodiment, the second codec module 540 extracts frame data from the memory buffer for encoding and decoding, specifically further including: detecting the marker point identifier of the current codec process; in response to the marker point identifier of the current codec process being the second tag, extracting the first frame data packet from the memory buffer; performing encoding and decoding on the first frame data packet, and after the encoding and decoding is completed, continuing to perform the operation of extracting the second frame data packet from the memory buffer; detecting whether the second frame data packet is successfully extracted; if the second frame data packet is not successfully extracted, determining whether the extraction count has reached the threshold; if not, continuing to perform the operation of extracting the second frame data packet from the memory buffer; if so, the current codec process modifies the identifier of its own marker point to the first identifier, and re-applies for an exclusive memory buffer, and extracts the next segment of frame data of the frame data that has been encoded and decoded from the source file to fill the re-applied exclusive memory buffer; extracting frame data packets from the re-applied exclusive memory buffer for encoding and decoding; if the second frame data packet is successfully extracted, performing encoding and decoding on the second frame data packet, and after the encoding and decoding is completed, continuing to perform the operation of extracting the third frame data packet from the memory buffer, and so on.

[0168] In an optional embodiment, before the first codec module 530 and the second codec module 540 extract frame data from the memory buffer for encoding and decoding, they are further configured to detect stream information, obtain the encoding format; find the corresponding codec according to the encoding format; open the found codec; and apply for a scaling data format conversion structure. After the first codec module 530 and the second codec module 540 extract frame data from the memory buffer for encoding and decoding, they are further configured to release the conversion structure; close the codec; and close the source file.

[0169] Figure 6 FIG. 4 is a schematic structural diagram of a terminal 600 provided by an embodiment of the present invention, including: a processor 610, a memory 620, and a communication unit 630. When the processor 610 implements the program for multi-process encoding and decoding of the same source file saved in the memory 620, the following steps are implemented:

[0170] Determine whether the source file has been opened;

[0171] If not opened, open the source file to obtain the global context of the source file, apply for a memory buffer, fill the source file frame data in the memory buffer, and extract the frame data from the memory buffer for encoding and decoding;

[0172] If it has been opened, directly extract the frame data from the memory buffer for encoding and decoding.

[0173] Multiple encoding and decoding processes of the present invention preferentially use the same memory buffer, extract data from one memory buffer for encoding and decoding, reduce waiting problems, improve encoding and decoding efficiency, save memory space, and improve memory utilization.

[0174] The terminal 600 includes a processor 610, a memory 620, and a communication unit 630. These components communicate through one or more buses. Those skilled in the art can understand that the structure of the server shown in the figure does not constitute a limitation to the present invention. It can be a bus structure, a star structure, and can also include more or fewer components than shown in the figure, or combine certain components, or arrange different components.

[0175] Among them, the memory 620 can be used to store the execution instructions of the processor 610. The memory 620 can be implemented by any type of volatile or non-volatile storage terminal or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disc. When the execution instructions in the memory 620 are executed by the processor 610, the terminal 600 can execute some or all of the steps in the above method embodiments.

[0176] The processor 610 is the control center of the storage terminal, connecting various parts of the entire electronic terminal through various interfaces and lines. By running or executing software programs and / or modules stored in the memory 620, and calling the data stored in the memory, it performs various functions of the electronic terminal and / or processes data. The processor can be composed of an integrated circuit (IC), for example, it can be composed of a single packaged IC, or it can be composed of multiple packaged ICs with the same or different functions connected. For example, the processor 610 may only include a central processing unit (CPU). In the embodiment of the present invention, the CPU can be a single arithmetic core or include multiple arithmetic cores.

[0177] The communication unit 630 is used to establish a communication channel so that the storage terminal can communicate with other terminals. It receives user data sent by other terminals or sends user data to other terminals.

[0178] The present invention also provides a computer storage medium, which can be a magnetic disk, an optical disc, a read-only memory (ROM), a random access memory (RAM), etc.

[0179] The computer storage medium stores a program for multi-process encoding and decoding of homologous files. When the program for multi-process encoding and decoding of homologous files is executed by the processor, the following steps are implemented:

[0180] Judge whether the source file has been opened;

[0181] If it has not been opened, open the source file to obtain the global context of the source file, apply for a memory buffer, fill the source file frame data in the memory buffer, and extract the frame data from the memory buffer for encoding and decoding;

[0182] If it has been opened, directly extract the frame data from the memory buffer for encoding and decoding.

[0183] Multiple encoding and decoding processes of the present invention preferentially use the same memory buffer, extract data from a memory buffer for encoding and decoding, reduce waiting problems, improve encoding and decoding efficiency, save memory space, and improve memory utilization.

[0184] Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solutions in the embodiments of the present invention, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk, or an optical disc, etc., various media that can store program codes, including several instructions for causing a computer terminal (which can be a personal computer, a server, or a second terminal, a network terminal, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.

[0185] In several embodiments provided by the present invention, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the couplings, direct couplings, or communication connections shown or discussed with each other can be through some interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical, or other forms.

[0186] The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0187] In addition, in each embodiment of the present invention, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit.

[0188] The above-disclosed are only the preferred embodiments of the present invention, but the present invention is not limited thereto. Any non-creative changes that can be thought of by those skilled in the art, as well as several improvements and refinements made without departing from the principle of the present invention, should fall within the protection scope of the present invention.

Claims

1. A method for multi-process encoding and decoding of homologous files, characterized in that, It includes the following steps: Judge whether the source file has been opened; If not, open the source file to obtain the global context of the source file, apply for a memory buffer, fill the source file frame data in the memory buffer, and extract the frame data from the memory buffer for encoding and decoding; If it has been opened, directly extract the frame data from the memory buffer for encoding and decoding; Meanwhile, in response to judging that the target source file has not been opened, set the marker point of the current encoding and decoding process to the first marker; in response to judging that the target source file has been opened, set the marker point of the current encoding and decoding process to the second marker; Among them, extracting the frame data from the memory buffer for encoding and decoding specifically includes: Detect the marker point identifier of the current encoding and decoding process; In response to the marker point identifier of the current encoding and decoding process being the first marker, extract the first frame data packet from the memory buffer; Perform encoding and decoding on the first frame data packet, and after the encoding and decoding are completed, continue to perform the operation of extracting the second frame data packet from the memory buffer; Perform encoding and decoding on the second frame data packet, and after the encoding and decoding are completed, continue to perform the operation of extracting the third frame data packet from the memory buffer; And so on, until the extraction of data from the memory buffer fails, indicating that the current encoding and decoding process has completed all the encoding and decoding of the data in the memory buffer, and extract the next segment of frame data from the source file to fill and overwrite the memory buffer; Extracting the frame data from the memory buffer for encoding and decoding specifically further includes: Detect the marker point identifier of the current encoding and decoding process; In response to the marker point identifier of the current encoding and decoding process being the second marker, extract the first frame data packet from the memory buffer; Perform encoding and decoding on the first frame data packet, and after the encoding and decoding are completed, continue to perform the operation of extracting the second frame data packet from the memory buffer; Detect whether the second frame data packet is successfully extracted; If the second frame data packet is not successfully extracted, judge whether the extraction times have reached the threshold; If not, continue to perform the operation of extracting the second frame data packet from the memory buffer; If it reaches, the current encoding and decoding process modifies the identifier of its own marker point to the first identifier, and re-applies for an exclusive memory buffer, and extracts the next segment of frame data of the frame data that has been encoded and decoded from the source file to fill the re-applied exclusive memory buffer; Extract the frame data packet from the re-applied exclusive memory buffer for encoding and decoding; If the second frame data packet is successfully extracted, perform encoding and decoding on the second frame data packet, and after the encoding and decoding are completed, continue to perform the operation of extracting the third frame data packet from the memory buffer, and so on.

2. The method for multi-process encoding and decoding of homologous files according to claim 1, characterized in that, Before judging whether the target source file has been opened, it further includes the following steps: Register the encoding and decoding process; Add marker points to the encoding and decoding process during the registration process.

3. The method for multi-process encoding and decoding of homologous files according to claim 2, wherein After judging that the target source file has been opened, it further includes the following steps: Judge whether the memory buffer has been expanded; If not, notify the encoding and decoding process with the first marker to expand the applied memory buffer; The encoding and decoding process with the first marker extracts the frame data from the source file to fill the expanded memory buffer.

4. The method for multi-process encoding and decoding of homologous files according to claim 1, wherein, Before extracting the frame data from the memory buffer for encoding and decoding, it further includes the following steps: Detect the stream information and obtain the encoding format; Find the corresponding codec according to the encoding format; Open the found codec; Apply for a scaling data format conversion structure; After extracting frame data from the memory buffer for encoding and decoding, the following steps are further included: Release the conversion structure; Close the codec; Close the source file.

5. A system for multi-process encoding and decoding of homologous files, characterized in that, Including, File status judgment module: Judge whether the source file has been opened; First encoding and decoding module: If it is judged that the source file is not opened, open the source file to obtain the global context of the source file, apply for a memory buffer, fill the source file frame data in the memory buffer, extract frame data from the memory buffer for encoding and decoding, and at the same time set the marker point of the current encoding and decoding process to the first marker; Second encoding and decoding module: If it is judged that the source file has been opened, directly extract frame data from the memory buffer for encoding and decoding, and at the same time set the marker point of the current encoding and decoding process to the second marker; The first encoding and decoding module extracts frame data from the memory buffer for encoding and decoding, specifically including: Detect the marker point identifier of the current encoding and decoding process; In response to the marker point identifier of the current encoding and decoding process being the first marker, extract the first frame data packet from the memory buffer; Perform encoding and decoding on the first frame data packet, and after the encoding and decoding are completed, continue to perform the operation of extracting the second frame data packet from the memory buffer; Perform encoding and decoding on the second frame data packet, and after the encoding and decoding are completed, continue to perform the operation of extracting the third frame data packet from the memory buffer; And so on, until the extraction of data from the memory buffer fails, indicating that the current encoding and decoding process has completed the encoding and decoding of all data in the memory buffer, and extract the next segment of frame data from the source file to fill and overwrite the memory buffer; The second encoding and decoding module extracts frame data from the memory buffer for encoding and decoding, specifically including: Detect the marker point identifier of the current encoding and decoding process; In response to the marker point identifier of the current encoding and decoding process being the second marker, extract the first frame data packet from the memory buffer; Perform encoding and decoding on the first frame data packet, and after the encoding and decoding are completed, continue to perform the operation of extracting the second frame data packet from the memory buffer; Detect whether the second frame data packet is successfully extracted; If the second frame data packet is not successfully extracted, judge whether the extraction times have reached the threshold; If not, continue to perform the operation of extracting the second frame data packet from the memory buffer; If so, the current encoding and decoding process modifies the identifier of its own marker point to the first identifier, and re-applies for an exclusive memory buffer, and extracts the next segment of frame data of the frame data that has been encoded and decoded from the source file to fill the re-applied exclusive memory buffer; Extract frame data packets from the re-applied exclusive memory buffer for encoding and decoding; If the second frame data packet is successfully extracted, perform encoding and decoding on the second frame data packet, and after the encoding and decoding are completed, continue to perform the operation of extracting the third frame data packet from the memory buffer, and so on.

6. A terminal, characterized in that, Including: A memory for storing a program for multi-process encoding and decoding of the same source file; A processor for implementing the steps of the method for multi-process encoding and decoding of the same source file as described in any one of claims 1-4 when executing the program for multi-process encoding and decoding of the same source file.

7. A computer-readable storage medium, characterized in that, The readable storage medium stores a program for multi-process encoding and decoding of homologous files. When the program for multi-process encoding and decoding of homologous files is executed by a processor, the steps of the method for multi-process encoding and decoding of homologous files according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Script execution and updating method and device, equipment and storage medium

    CN110231935A

  • Video coding real-time evaluation and playing tool

    CN111510766A