Codec memory reference method, apparatus and device, and computer program product
By referring to the frame memory of the codec in FFmpeg, the CPU resource consumption and codec speed problems caused by frame memory copying during FFmpeg during the codec are solved, and more efficient codec processing is achieved and energy consumption is reduced.
Patent Information
- Application Number
- CN202411640352.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-03-11
AI Technical Summary
During the encoding and decoding process, FFmpeg needs to copy and manage frame memory, which results in a large consumption of CPU computing resources and affects the encoding and decoding speed.
By obtaining frame memory based on the image pixel information of the codec in the codec, and making it compatible with FFmpeg's frame memory data structure, avoiding frame memory copying, and directly referring to frame memory in the codec by FFmpeg.
It reduces CPU resource consumption, improves encoding and decoding processing speed, reduces system energy consumption, and solves the performance loss and power consumption problems caused by frame memory replication.
Smart Images

Figure CN119597462A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a codec memory reference method, a codec memory reference device, an electronic device, and a computer program product. Background Art
[0002] FFmpeg (Fast Forward Moving Picture Experts Group) is a codec tool that supports multiple codec integration, encoding, decoding, transcoding and other functions. FFmpeg is a leading multimedia framework that can decode, encode, transcode, multiplex, demultiplex, stream, filter and play almost all content created by humans and machines, supporting from the most obscure old formats to the most cutting-edge formats, and is highly portable.
[0003] FFmpeg can integrate multiple codecs. However, the frame memory needs to be copied and managed during the encoding and decoding process, which consumes more CPU (Central Processing Unit) computing resources and also has a certain impact on the encoding and decoding speed.
[0004] In view of this, there is an urgent need in the art for a method that can reduce CPU resource consumption and improve encoding and decoding processing speed.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0006] The purpose of the present disclosure is to provide a codec memory reference method, a codec memory reference device, an electronic device and a computer program product, thereby reducing CPU resource consumption and improving the processing speed of codec at least to a certain extent.
[0007] According to a first aspect of the present disclosure, a codec memory reference method is provided, comprising:
[0008] In the codec, a frame memory of the codec frame is obtained according to the image pixel information of the codec frame, wherein the frame memory in the codec has the same data structure as the frame memory in FFmpeg;
[0009] The FFmpeg references the frame memory in the codec to output an output frame corresponding to the codec frame.
[0010] In an exemplary embodiment of the present disclosure, the method further includes:
[0011] The memory management method of the FFmpeg is obtained, and the frame memory application interface of the codec is generated according to the memory management method of the FFmpeg, so that the frame memory application interface of the codec is compatible with the interface of the FFmpeg.
[0012] In an exemplary embodiment of the present disclosure, the memory management method includes a memory application method, a memory reference method and a memory release method.
[0013] In an exemplary embodiment of the present disclosure, in the codec, obtaining the frame memory of the codec frame according to the image pixel information of the codec frame includes:
[0014] In the codec, the frame content of the codec frame in the frame queue is split to obtain image pixel information and attribute information of the codec frame;
[0015] A frame memory of the encoded and decoded frame is obtained according to the image pixel information of the encoded and decoded frame.
[0016] In an exemplary embodiment of the present disclosure, the method further includes:
[0017] After the FFmpeg outputs an output frame corresponding to the codec frame, the FFmpeg is controlled to dereference a frame memory in the codec.
[0018] In an exemplary embodiment of the present disclosure, the method further includes:
[0019] After the FFmpeg outputs the output frame corresponding to the encoded and decoded frame, the frame memory corresponding to the output frame is recycled into the memory pool.
[0020] In an exemplary embodiment of the present disclosure, the method further includes:
[0021] When the reference count of the frame memory corresponding to the output frame reaches a preset value, the frame memory corresponding to the output frame is recycled into a memory pool.
[0022] According to a second aspect of the present disclosure, a codec memory reference device is provided, comprising:
[0023] A frame memory application module is configured to be executed in the codec, and obtain a frame memory of the codec frame according to the image pixel information of the codec frame, wherein the frame memory in the codec has the same data structure as the frame memory in FFmpeg;
[0024] The frame memory reference module is configured to execute the reference of the frame memory in the codec through the FFmpeg, and output the output frame corresponding to the codec frame.
[0025] In an exemplary embodiment of the present disclosure, the codec memory reference device further includes:
[0026] The interface reconstruction module is configured to execute the memory management method of the FFmpeg and generate the frame memory application interface of the codec according to the memory management method of the FFmpeg, so that the frame memory application interface of the codec is compatible with the interface of the FFmpeg.
[0027] In an exemplary embodiment of the present disclosure, the frame memory application module includes:
[0028] A frame content splitting unit is configured to be executed in the codec, split the frame content of the codec frame in the frame queue, and obtain image pixel information and attribute information of the codec frame;
[0029] The frame memory application unit is configured to obtain the frame memory of the coded frame according to the image pixel information of the coded frame.
[0030] In an exemplary embodiment of the present disclosure, the codec memory reference device further includes:
[0031] The frame memory dereferencing module is configured to control the FFmpeg to dereference the frame memory in the codec after the FFmpeg outputs the output frame corresponding to the codec frame.
[0032] In an exemplary embodiment of the present disclosure, the codec memory reference device further includes:
[0033] The frame memory recycling module is configured to recycle the frame memory corresponding to the output frame into the memory pool after the FFmpeg outputs the output frame corresponding to the encoded and decoded frame.
[0034] The frame memory recycling module is further configured to recycle the frame memory corresponding to the output frame into the memory pool when the reference count of the frame memory corresponding to the output frame is a preset value.
[0035] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement any one of the codec memory reference methods described above.
[0036] According to a fourth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the codec memory reference method described in any one of the above is implemented.
[0037] The exemplary embodiments of the present disclosure may have the following beneficial effects:
[0038] In the codec memory reference method of the example implementation mode of the present disclosure, the frame memory of the codec frame is obtained in the codec according to the image pixel information of the codec frame, and the frame memory in the codec is referenced by FFmpeg to output the output frame corresponding to the codec frame, wherein the frame memory in the codec has the same data structure as the frame memory in FFmpeg. The codec memory reference method in the example implementation mode of the present disclosure avoids adding a frame memory copy process by merging the frame memory of the codec and the frame memory application of FFmpeg, so that FFmpeg directly references the frame memory in the codec and outputs the output frame corresponding to the codec frame, and no longer needs to copy the frame memory in the codec, thereby solving the performance loss and power consumption problems caused by frame memory copying between FFmpeg and the codec, saving CPU computing resource overhead, and reducing system energy consumption while improving the codec processing speed.
[0039] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0041] Figure 1 A schematic diagram showing a framework of codec memory replication in a related embodiment of the present disclosure is shown;
[0042] Figure 2 A schematic diagram showing a flow chart of a codec memory reference method according to an exemplary embodiment of the present disclosure;
[0043] Figure 3 A schematic diagram showing a framework of codec memory references in a specific embodiment of the present disclosure is shown;
[0044] Figure 4 A block diagram showing a codec memory reference device according to an example embodiment of the present disclosure is shown;
[0045] Figure 5 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0046] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0047] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein.
[0048] The following example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0049] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0050] In some related embodiments, the codec can be integrated into FFmpeg to encode and decode video images. FFmpeg is responsible for sending the input data source or code stream into the codec, and the codec encodes and decodes it, and then outputs the frame to FFmpeg. The encoding and decoding processes are similar.
[0051] Figure 1A schematic diagram of the framework of codec memory replication in a related embodiment of the present disclosure is shown. Take the decoder as an example for explanation. The decoder and FFmpeg's memory are relatively independent. At this time, the decoder will apply for memory to build a frame queue. There are several frames in the queue, including frame information, image memory, etc. The decoder outputs an output frame 1 to FFmpeg after decoding. After FFmpeg gets the output frame 1, it will apply for a frame memory of the same size, copy the image pixel information of the output frame 1 to the frame memory of FFmpeg, and then output the frame memory as output frame 2 to the outside. For output frame 1, after FFmpeg performs frame pixel replication, it can be recovered by the decoder to the frame queue. For output frame 2, after it is output to the outside, it can be recovered to the frame memory of FFmpeg after the outside has finished using it.
[0052] In the above-mentioned related embodiments, the codec and FFmpeg apply for frame memory respectively. Although this can make decoupling easier, it will cause the intermediate process to require a frame memory copy from output frame 1 to FFmpeg. This part consumes a lot of CPU computing resources, resulting in a loss of codec speed and increased power consumption.
[0053] Based on the above problems, this example implementation first provides a codec memory reference method. Figure 2 As shown, the above codec memory reference method may include the following steps:
[0054] Step S210. In the codec, a frame memory of the codec frame is obtained according to the image pixel information of the codec frame, wherein the data structure of the frame memory in the codec is the same as that of the frame memory in FFmpeg.
[0055] Step S220: Reference the frame memory in the codec through FFmpeg to output the output frame corresponding to the codec frame.
[0056] In the codec memory reference method of the example implementation mode of the present disclosure, the frame memory of the codec frame is obtained in the codec according to the image pixel information of the codec frame, and the frame memory in the codec is referenced by FFmpeg to output the output frame corresponding to the codec frame, wherein the frame memory in the codec has the same data structure as the frame memory in FFmpeg. The codec memory reference method in the example implementation mode of the present disclosure avoids adding a frame memory copy process by merging the frame memory of the codec and the frame memory application of FFmpeg, so that FFmpeg directly references the frame memory in the codec and outputs the output frame corresponding to the codec frame, and no longer needs to copy the frame memory in the codec, thereby solving the performance loss and power consumption problems caused by frame memory copying between FFmpeg and the codec, saving CPU computing resource overhead, and reducing system energy consumption while improving the codec processing speed.
[0057] Next, combine Figure 3 The above steps of this exemplary embodiment are described in more detail.
[0058] In step S210, in the codec, a frame memory of the codec frame is obtained according to the image pixel information of the codec frame, wherein the data structure of the frame memory in the codec is the same as that of the frame memory in FFmpeg.
[0059] In this example implementation, codec refers to an encoder and a decoder, and a codec frame refers to a video frame to be encoded or decoded. The frame content of each codec frame may include two parts, namely, image pixel information of the codec frame and attribute information of the codec frame, and the attribute information of the codec frame includes width, height, some internally defined data structures, etc.
[0060] In this example implementation, the frame content of the codec frame in the frame queue can be split to obtain image pixel information and attribute information of the codec frame, and then the frame memory of the codec frame can be obtained based on the image pixel information of the codec frame, so that the frame memory in the codec is compatible with the frame memory in FFmpeg, that is, the data structure is the same.
[0061] In the original frame queue in the codec, the content of each frame not only contains image pixel information, but also the attribute information of the frame itself. In the codec, the image pixel information of the frame can be separated separately, and the corresponding frame memory can be applied using the frame memory method compatible with FFmpeg.
[0062] In this example implementation, the frame memory application interface of the codec can be reconstructed to make the frame memory application interface of the codec compatible with the interface of FFmpeg. Specifically, the memory management method of FFmpeg can be obtained, and the frame memory application interface of the codec can be generated according to the memory management method of FFmpeg to make the frame memory application interface of the codec compatible with the interface of FFmpeg. Among them, the memory management method includes a memory application method, a memory reference method and a memory release method.
[0063] In order to be compatible with FFmpeg's frame memory reference method, the codec's frame memory application interface can be reconstructed to be compatible with the external FFmpeg interface, and the codec itself is also implemented for compatibility. If the external interface provides a memory management method with the same interface, the external memory management method is used to apply for and reference memory.
[0064] By redesigning the frame image memory application interface of the codec, it can be adapted to the memory reference mechanism of FFmpeg, so that FFmpeg can directly reference the frame memory in the codec.
[0065] In step S220, FFmpeg references the frame memory in the codec to output the output frame corresponding to the codec frame.
[0066] In this example implementation, FFmpeg does not need to copy the frame memory in the codec, but only needs to reference the frame memory in the codec for output to become an output frame.
[0067] After FFmpeg outputs the output frame corresponding to the codec frame, FFmpeg can be controlled to dereference the frame memory in the codec. After FFmpeg outputs the output frame corresponding to the codec frame, or when the reference count of the frame memory corresponding to the output frame reaches a preset value, the frame memory corresponding to the output frame is recycled to the memory pool.
[0068] When the frame memory is referenced once, the reference count is increased by 1, and when it is dereferenced, the reference count is decreased by 1. After FFmpeg outputs the output frame corresponding to the codec frame, or when the reference count of the frame memory corresponding to the output frame is 0, the frame memory corresponding to the output frame can be recycled to the memory pool and become free memory.
[0069] After FFmpeg output is completed, the frame memory can be referenced. After the output frame is output to the outside, if it has been used up, the frame memory corresponding to the output frame can be recycled to the frame memory pool inside the codec for reuse of the frame memory of the next frame of the codec. The management and recycling of frame memory are managed by the codec memory.
[0070] like Figure 3The figure shows a framework diagram of codec memory reference in a specific embodiment of the present disclosure, which is an example of the above steps in this example embodiment. The frame content of the codec frame may include two parts, namely, the image pixel information of the codec frame, and the attribute information of the codec frame. The frame memory of the codec frame is obtained by applying for the image pixel information of the codec frame. By reconstructing the frame memory application interface of the codec to make it compatible with the interface of FFmpeg, FFmpeg does not need to copy the frame memory in the codec, but only needs to reference the frame memory in the codec for output. After FFmpeg outputs the output frame corresponding to the codec frame, FFmpeg can be controlled to dereference the frame memory in the codec, and the frame memory of the output frame is recycled by the codec for multiplexing of the next frame.
[0071] Based on the codec memory reference method in this example implementation, the decoding speed was tested on 100 test sequences online, which increased the decoding speed by about 20% and reduced the decoding power consumption on the mobile terminal by 15%. The codec memory reference method in this example implementation is not only applicable to decoders, but also to encoders.
[0072] It should be noted that although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0073] Furthermore, the present disclosure also provides a codec memory reference device. Figure 4 As shown, the codec memory reference device may include a frame memory application module 410 and a frame memory reference module 420. Among them:
[0074] The frame memory application module 410 is configured to obtain the frame memory of the codec frame according to the image pixel information of the codec frame in the codec, wherein the data structure of the frame memory in the codec is the same as that of the frame memory in FFmpeg;
[0075] The frame memory reference module 420 is configured to reference the frame memory in the codec through FFmpeg and output the output frame corresponding to the codec frame.
[0076] In some exemplary embodiments of the present disclosure, a codec memory reference device provided by the present disclosure may also include an interface reconstruction module, which is configured to obtain the memory management method of FFmpeg and generate a frame memory application interface of the codec according to the memory management method of FFmpeg, so as to make the frame memory application interface of the codec compatible with the interface of FFmpeg.
[0077] In some exemplary embodiments of the present disclosure, the memory management method includes a memory application method, a memory reference method and a memory release method.
[0078] In some exemplary embodiments of the present disclosure, the frame memory application module 410 may include a frame content splitting unit and a frame memory application unit.
[0079] The frame content splitting unit is configured to split the frame content of the coded and decoded frames in the frame queue in the codec to obtain image pixel information and attribute information of the coded and decoded frames;
[0080] The frame memory application unit is configured to obtain the frame memory of the coded frame according to the image pixel information of the coded frame.
[0081] In some exemplary embodiments of the present disclosure, a codec memory reference device provided by the present disclosure may also include a frame memory dereference module, which is configured to control FFmpeg to dereference the frame memory in the codec after FFmpeg outputs an output frame corresponding to the codec frame.
[0082] In some exemplary embodiments of the present disclosure, a codec memory reference device provided by the present disclosure may also include a frame memory recovery module, which is configured to recycle the frame memory corresponding to the output frame into the memory pool after FFmpeg outputs the output frame corresponding to the codec frame.
[0083] In some exemplary embodiments of the present disclosure, the frame memory recycling module is further configured to recycle the frame memory corresponding to the output frame into the memory pool when the reference count of the frame memory corresponding to the output frame is a preset value.
[0084] The specific details of each module / unit in the above-mentioned codec memory reference device have been described in detail in the corresponding method embodiment part, and will not be repeated here.
[0085] Figure 5 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present disclosure is shown.
[0086] It should be noted that Figure 5 The computer system 500 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0087] like Figure 5As shown, computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. Various programs and data required for system operation are also stored in RAM 503. CPU 501, ROM 502 and RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to bus 504.
[0088] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.
[0089] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part 509, and / or installed from a removable medium 511. When the computer program is executed by a central processing unit (CPU) 501, various functions defined in the system of the present disclosure are executed.
[0090] The exemplary embodiment of the present disclosure also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the information prompt method for reward redemption is implemented.
[0091] In one embodiment, the computer program product may be a tangible product containing a computer program, such as a computer-readable storage medium storing a computer program. The readable storage medium may be a storage medium based on electrical, magnetic, optical, electromagnetic, infrared, or other signals, including but not limited to: random access memory (RAM), read-only memory (ROM), magnetic tape, floppy disk, flash memory (Flash), mechanical hard disk (HDD), solid-state drive (SSD), and the like. Exemplarily, the computer program product may be implemented as a non-volatile storage medium storing a computer program, such as a read-only memory, a NAND flash memory, and the like.
[0092] In one embodiment, the computer program product may be an intangible product including a computer program. Exemplarily, the computer program product may be implemented as a virtual digital product, such as a digital file storing an executable file, an installation package, etc. of the computer program.
[0093] The code of the computer program can be written in one or more programming languages. Programming languages such as C language, Java, C++, etc. The program code can be executed entirely on the user computing device, or partially on the user computing device, or as a separate software package, or partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, such as a local area network (LAN), a wide area network (WAN), etc., or can be connected to an external computing device (e.g., an Internet connection provided by an operator).
[0094] The computer program may be carried or transmitted via electrical, magnetic, optical, electromagnetic, infrared, or other signals. The electronic device may convert the signal carrying the computer program into a digital signal, thereby running the computer program. When the computer program is run on the electronic device, its code is used to enable the electronic device to execute (more specifically, the processor of the electronic device may execute) the method steps of various exemplary embodiments of the present disclosure, such as the information prompt method for reward redemption described above.
[0095] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0096] It should be noted that, although several modules of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules described above can be concretized in one module. Conversely, the features and functions of one module described above can be further divided into multiple modules to be concretized.
[0097] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure.
[0098] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A codec memory reference method, characterized in that: include: In the codec, a frame memory of the codec frame is obtained according to the image pixel information of the codec frame, wherein the frame memory in the codec has the same data structure as the frame memory in FFmpeg; The FFmpeg references the frame memory in the codec to output an output frame corresponding to the codec frame.
2. The codec memory reference method according to claim 1, characterized in that: The method further comprises: The memory management method of the FFmpeg is obtained, and the frame memory application interface of the codec is generated according to the memory management method of the FFmpeg, so that the frame memory application interface of the codec is compatible with the interface of the FFmpeg.
3. The codec memory reference method according to claim 2, characterized in that: The memory management method includes a memory application method, a memory reference method and a memory release method.
4. The codec memory reference method according to claim 1, characterized in that: In the codec, obtaining the frame memory of the codec frame according to the image pixel information of the codec frame includes: In the codec, the frame content of the codec frame in the frame queue is split to obtain image pixel information and attribute information of the codec frame; A frame memory of the encoded and decoded frame is obtained according to the image pixel information of the encoded and decoded frame.
5. The codec memory reference method according to claim 1, characterized in that: The method further comprises: After the FFmpeg outputs an output frame corresponding to the codec frame, the FFmpeg is controlled to dereference a frame memory in the codec.
6. The codec memory reference method according to claim 1, characterized in that: The method further comprises: After the FFmpeg outputs the output frame corresponding to the encoded and decoded frame, the frame memory corresponding to the output frame is recycled into the memory pool.
7. The codec memory reference method according to claim 1, characterized in that: The method further comprises: When the reference count of the frame memory corresponding to the output frame reaches a preset value, the frame memory corresponding to the output frame is recycled into a memory pool.
8. A codec memory reference device, characterized in that: include: A frame memory application module is configured to be executed in the codec, and obtain a frame memory of the codec frame according to the image pixel information of the codec frame, wherein the frame memory in the codec has the same data structure as the frame memory in FFmpeg; The frame memory reference module is configured to execute the reference of the frame memory in the codec through the FFmpeg, and output the output frame corresponding to the codec frame.
9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the codec memory reference method as described in any one of claims 1 to 7.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the codec memory referencing method according to any one of claims 1 to 7 is implemented.