WO2022188753A1 - Video frame caching method, and device - Google Patents

Video frame caching method, and device Download PDF

Info

Publication number
WO2022188753A1
WO2022188753A1 PCT/CN2022/079575 CN2022079575W WO2022188753A1 WO 2022188753 A1 WO2022188753 A1 WO 2022188753A1 CN 2022079575 W CN2022079575 W CN 2022079575W WO 2022188753 A1 WO2022188753 A1 WO 2022188753A1
Authority
WO
WIPO (PCT)
Prior art keywords
frame
displayed
buffer
reconstructed
identifier
Prior art date
Application number
PCT/CN2022/079575
Other languages
French (fr)
Chinese (zh)
Inventor
罗小伟
郭春磊
李�荣
Original Assignee
展讯通信(上海)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 展讯通信(上海)有限公司 filed Critical 展讯通信(上海)有限公司
Publication of WO2022188753A1 publication Critical patent/WO2022188753A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/44004Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving video buffer management, e.g. video decoder buffer or video display buffer
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/431Generation of visual interfaces for content selection or interaction; Content or additional data rendering

Definitions

  • the present application relates to the technical field of video display, and in particular, to a video frame buffering method and device.
  • the processing of the audio and video streams involves the decoding of the video streams and the display of image frames in addition to the demultiplexing of the audio and video streams. That is, the video stream is first reconstructed into image frame data through video decoding, and then the image frame is rendered to the screen through the image display process.
  • the image frame data is usually stored in the frame buffer of the system memory.
  • the embodiments of the present invention provide a video frame buffering method and device, which can not only avoid the copy operation of the reconstructed frame, but also reduce the delay caused by the need to use the reconstructed frame as a reference frame. Therefore, the solutions of the embodiments of the present invention can reduce the video output delay while occupying a small amount of system memory.
  • an embodiment of the present invention provides a video frame buffering method, including: determining a shared buffer, where the shared buffer includes a plurality of frame buffers, and each frame buffer is provided with a status identifier; The frame is written into a frame buffer provided with a writable identifier, and if the reconstructed frame has a reference frame feature, a reference frame identifier is set for the corresponding frame buffer; the frame to be displayed is determined from the reconstructed frame that has been buffered, and the The frame buffer where the frame to be displayed is located is set with a to-be-displayed flag; the to-be-displayed frame in the frame buffer where the to-be-displayed flag is set is displayed, and if the to-be-displayed frame no longer has the reference frame feature after being displayed, the corresponding Framebuffer settings writable flag.
  • the number of frame buffers included in the shared buffer is determined according to the number of reference frames and the number of buffered frames of the video stream to be played.
  • each of the frame buffers is provided with a status identifier, including: each of the frame buffers is provided with a counter, and the value of the counter is used as a status identifier of the corresponding frame buffer.
  • the corresponding counter value changes.
  • the method further includes: creating a frame buffer queue, where the frame buffer queue is used to store the status identification information of each frame buffer in the shared buffer; writing the reconstructed frame output from the decoding is set with a writable mark.
  • the frame buffer including: according to the state identification information of the respective frame buffers stored in the frame buffer queue, determine the frame buffer that is provided with the writable mark, wherein, the frame buffer that is provided with the writable mark is used for Write the reconstructed frame of the decoded output.
  • determining the frame to be displayed from the cached reconstructed frame includes: if the reconstructed frame output by the current decoding only has the display feature, then determining the reconstructed frame output by the current decoding as the frame to be displayed, and writing it in the writable frame.
  • the corresponding frame buffer is set with the identification to be displayed; if the reconstructed frame outputted by the current decoding has both the reference frame feature and the display feature, the reconstructed frame outputted by the current decoding is determined as the frame to be displayed, and the reference frame identification
  • the to-be-displayed flag is set.
  • the reconstructed frame output by the current decoding may be determined as the frame to be displayed when a preset display condition is satisfied.
  • determining the frame to be displayed from the reconstructed frame that has been buffered further comprising: in addition to the reconstructed frame output by the current decoding, if the reconstructed frame in at least one frame buffer that has been set with a reference frame identifier no longer has The reference frame features, and has the display feature and has not yet been displayed, then the corresponding reconstructed frame is determined as the frame to be displayed, and the reference frame identifier of the corresponding frame buffer is set as the to-be-displayed identifier; in addition to the reconstructed frame output by the current decoding, if If the reconstructed frame in the at least one frame buffer already set with the reference frame identifier no longer has the reference frame identifier, and has been displayed or has no display feature, the reference frame identifier of the corresponding frame buffer is set as a writable identifier.
  • the method further includes: creating a to-be-displayed queue, where the to-be-displayed queue is used to store to-be-displayed identification information of the to-be-displayed frame.
  • the to-be-displayed queue is used to store to-be-displayed identification information of the to-be-displayed frame.
  • the to-be-displayed queue is also used to store timestamp information and number information of the to-be-displayed frame; displaying the to-be-displayed frame includes: according to the to-be-displayed frame timestamp information and number information. , determine the display order of the to-be-displayed frames, and display the to-be-displayed frames according to the display order of the to-be-displayed frames.
  • setting a writable flag to the corresponding frame buffer including: if the to-be-displayed frame only has the display feature, then after the to-be-displayed frame is displayed , set the to-be-displayed identification as a writable identification; if the to-be-displayed frame has both display features and reference features, after the to-be-displayed frame is displayed, the to-be-displayed identification is set as the reference frame identification, and then the reference frame identification Set to the ID to be written.
  • an embodiment of the present invention provides a terminal device, including: a determination module configured to determine a shared buffer, where the shared buffer includes a plurality of frame buffers, and each frame buffer is provided with a status identifier; a decoding module , for writing the decoded output reconstructed frame into a frame buffer provided with a writable identifier, and if the reconstructed frame has a reference frame feature, then a reference frame identifier is set for the corresponding frame buffer; The frame to be displayed is determined in the reconstructed frame, and the frame buffer where the frame to be displayed is located is set with a to-be-displayed mark; After the frame is displayed, it no longer has the reference frame feature, then the writable flag is set for the corresponding frame buffer.
  • an embodiment of the present invention provides a terminal device, including: at least one processor; and at least one memory communicatively connected to the processor, wherein: the memory stores a program that can be executed by the processor Program instructions to be invoked by the processor to execute to perform the method of the first aspect or any possible embodiment of the first aspect. .
  • an embodiment of the present invention provides a computer-readable storage medium, where the computer-readable storage medium includes a stored program, wherein when the program runs, a device on which the computer-readable storage medium is located is controlled to execute the first The method of an aspect or any possible embodiment of the first aspect. .
  • the video decoding scheduling and the image display scheduling share the frame buffer, and the video decoding scheduling and the image display scheduling do not need to copy and reconstruct the frame data frequently during the decoding and display process, which saves the system cache space and improves the system performance.
  • the solution of the embodiment of the present invention sets a status flag for the reconstructed frame output by decoding, and the reference frame output by decoding can be displayed in real time, and can continue to be used as the reference frame for subsequent video frame decoding after display, thereby reducing the phenomenon of video frame delay and stalling.
  • FIG. 1 is a flowchart of a video frame buffering method provided by the related art
  • FIG. 3 is a flowchart of a video frame buffering method provided by an embodiment of the present invention.
  • FIG. 4 is a flowchart of another video frame buffering method provided by an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a terminal device provided by an embodiment of the present invention.
  • FIG. 6 is a schematic structural diagram of another terminal device provided by an embodiment of the present invention.
  • FIG. 1 is a flowchart of a video frame buffering method provided in the related art.
  • the system schedules create video decoding schedules and image display schedules.
  • Video decoding schedules and image display schedules maintain their internal frame buffers.
  • the frame buffers maintained by video decoding schedules are used to store frames. (0), Frame(1)...Frame(N) reconstructed frames, and the frame buffer maintained by the image display schedule is used for Frame(0), Frame(1)...Frame(M) frames to be displayed.
  • the video decoding engine decodes the video code stream and outputs the reconstructed frame of the video frame image.
  • the video decoding engine writes the output reconstructed frames into the frame buffer it maintains.
  • the image display engine copies the reconstructed frames to be displayed and buffers them into the frame buffer maintained by the image display engine.
  • the image display engine displays the copied reconstructed frames according to the display order. In the method shown in FIG. 1 , each video frame to be displayed needs to be copied, and the process of copying data is relatively time-consuming, which greatly reduces the performance of the entire system and increases the system bandwidth.
  • FIG. 2 is a flowchart of another video frame buffering method provided by the related art.
  • the system scheduling creates video decoding scheduling and image display scheduling, and the frame buffer maintained by the video decoding scheduling is used to store Frame(0), Frame(1)...Frame(N) reconstructed frames. is released after the reconstructed frame is displayed. Since the reconstructed frame will be released after being displayed, and since most of the reconstructed frames need to be used as reference frames for the subsequent decoding process, there will be reconstructed frames that are decoded first and displayed later in the frame buffer. For example, the P1 frame in the video stream I 0 P 1 B 2 P 3 , the P 1 frame is decoded before the B 2 frame, but the P 1 frame is after the B 2 frame when displayed .
  • the method shown in Figure 2 does not need to copy the reconstructed frame data during the image display scheduling process, but the decoded reconstructed frame may be retained for a long time, which may cause a large delay or The stuttering phenomenon affects the video playback effect.
  • the embodiments of the present invention provide a video frame buffering solution.
  • the video decoding scheduling and the image display scheduling share the frame buffer, and by setting the status flags for each frame buffer included in the shared buffer, the real-time display of the reconstructed frame can be realized while maintaining the reference frame function of the reconstructed frame. Thereby, the display delay can be reduced.
  • FIG. 3 is a flowchart of a video frame buffering method provided by an embodiment of the present invention.
  • the system schedules to create video decoding schedules and image display schedules, and allocates 0, 1, 2...N frame buffers as shared buffers, which can be used by video decoding scheduling and image display.
  • Display scheduling is co-scheduling, and the shared buffer is used to store Frame(0), Frame(1)...Frame(N) reconstructed frames.
  • each frame buffer is provided with a state identifier, and the state of the reconstructed frame in the corresponding frame buffer can be determined through the state identifier.
  • the method according to the embodiment of the present invention may further include: creating a frame buffer queue, where the frame buffer queue is used to store address information and state identification information of each frame buffer. According to the address information and status identification information of each frame buffer in the frame buffer queue, the reconstructed frame to be processed can be called. For example, upon initialization, each framebuffer in the shared buffer is set with a writable flag. The video decoding scheduling can randomly select a frame buffer with a writable flag set as the storage location of the reconstructed frame through the frame buffer queue.
  • the corresponding frame buffers set the to-be-displayed flags. After the frame to be displayed is displayed, a displayed flag can be set for the corresponding frame buffer. Wherein, if the video frame that has been displayed is no longer used as the reference frame of other subsequent video frames, a writable flag may be set for it. If a video frame that has been displayed still needs to be used as a reference frame for other subsequent video frames, a reference frame identifier can be reserved for it. Specifically, based on the shared buffer shown in FIG. 3 , the video decoding engine decodes the video stream, and outputs the reconstructed frame of the video frame image.
  • the video decoding engine writes the decoded output reconstructed frame into the frame buffer set with the writable flag.
  • the reference frame identifier is set for the corresponding frame buffer.
  • the image display engine determines the frame to be displayed from the reconstructed frames that have been buffered, and sets the to-be-displayed flag in the frame buffer where the frame to be displayed is located.
  • the image display engine reads and displays the reconstructed frame from the frame buffer with the to-be-displayed flag set.
  • the reconstructed frames can be divided into: reconstructed frames only used for display, reconstructed frames used as both reference frames and display, reconstructed frames only used as reference frames, and neither The reference frame is in turn not used for the reconstructed frame for display.
  • the image display scheduling process renders and displays two types of reconstructed frames that are only used for display, and are both used as reference frames and used for display.
  • the processing flow of the video frame buffering method according to the embodiment of the present invention includes:
  • each frame buffer is set with a writable flag.
  • the initial value of each counter may take 0. When the value of the counter is 0, it indicates that the corresponding frame buffer is in a writable state.
  • a frame buffer queue may also be created based on the shared buffer, where the frame buffer queue is used to store address information and state identification information of each frame buffer included in the shared buffer.
  • the video decoding schedule may determine the address of the frame buffer with the writable flag according to the frame buffer queue.
  • the number of frame buffers included in the shared buffer may be determined according to the number of reference frames and the number of buffered frames of the video stream to be played. In some embodiments, the number of reference frames is determined as ref_num according to the characteristics of the video stream to be played. Determine the number of buffered frames M according to the number of image frame buffers supported by the image display scheduling. The number of frame buffers included in the frame buffer queue may be: ref_num+M.
  • the video decoding scheduler may determine the address information of the frame buffer set with the writable identifier according to the status identifier information of each frame buffer stored in the frame buffer queue.
  • the video decoding scheduler can write the reconstructed frame output by the current decoding into the frame buffer set with the writable flag. Wherein, if the reconstructed frame output by the current decoding has the reference frame feature, the writable identifier of the corresponding frame buffer is set as the reference frame identifier.
  • the initial value of each counter may take 0. When the value of the counter is 0, it indicates that the corresponding frame buffer is in a writable state.
  • the video decoding scheduling can write the reconstructed frame output by the current decoding into the frame buffer whose counter value is 0. If the reconstructed frame currently decoded and output has the reference frame feature, the counter for the frame buffer used to store the current reconstructed frame is +1, and the status identification information of the corresponding frame buffer in the frame buffer queue also corresponds to +1.
  • the fact that the current frame has the reference frame feature means that the current frame is a reference frame for decoding subsequent video frames.
  • the video decoding schedule determines that the Px video frame is a reference frame of the subsequent Py video frame, and the video decoding schedule adds 1 to the frame buffered counter corresponding to the Px video frame.
  • P x represents the video frame currently being decoded
  • P y represents any video frame whose decoding time is after P x .
  • P x and P y can be two adjacent video frames in decoding order.
  • Px and Py may also be spaced apart by multiple other video frames in decoding order.
  • P x and P y may be video frames of the same type, or may be video frames of different types, which will not be described one by one here.
  • the video decoding scheduler may also maintain a reference frame queue.
  • the video decoding scheduler may store the address information and state identification information of the corresponding reconstructed frame in the reference frame queue.
  • relevant information such as the address of the reconstructed frame that no longer has the reference frame queue may be deleted from the reference frame queue.
  • the frames to be displayed include reconstructed frames having only display features and both display features and reference features.
  • the video decoding scheduling can determine the reconstructed frame output by the current decoding as the frame to be displayed, and increase the counter of the corresponding reconstructed frame by 1. . If the reconstructed frame output by the current decoding has both the reference frame feature and the display feature, the reconstructed frame output by the current decoding is determined as the frame to be displayed, and the corresponding frame buffer is set on the basis of the reference frame identifier. The counter value is 1 based on +1. Optionally, if the reconstructed frame currently decoded and output has both the reference frame feature and the display feature, it may be determined as the frame to be displayed when a preset condition is met.
  • the difference between its time stamp and the time stamp or number of the last displayed reconstructed frame is smaller than a certain threshold, it is determined as a frame to be displayed.
  • a certain threshold For example, when the difference between its time stamp and the time stamp or number of the last displayed reconstructed frame is smaller than a certain threshold, it is determined as a frame to be displayed.
  • the reconstructed frame output by the current decoding when it is determined that it has both the reference frame feature and the display feature, it is determined as the frame to be displayed.
  • a queue to be displayed may also be created, and the queue to be displayed is used to store address information and identification information of a frame to be displayed.
  • the image display scheduling can schedule and display each frame to be displayed according to the queue to be displayed.
  • the corresponding reconstructed frame can be The frame to be displayed is determined, and the reference frame identifier of the corresponding frame buffer is set as the identifier to be displayed.
  • setting the reference frame identifier of the corresponding frame buffer as the to-be-displayed identifier may be: when the reconstructed frame in the at least one frame buffer is determined as the to-be-displayed frame, the counter of the at least one frame buffer is set in the original reference frame.
  • the frame ID is +1 based on 1, then its value is 2.
  • the corresponding counter takes a value of -1, and the counter takes a value of 1 at this time.
  • the special reference frame can be considered as: the original reference frame, at this time, it no longer has the reference frame feature, and has the display feature and is not displayed.
  • a special reference frame identifier may also be set for the special reference frame. The special reference frame identifier may not be reflected by the value of the counter, for example, the corresponding reconstructed frame may be marked with the special reference frame identifier in the queue to be displayed.
  • the corresponding frame buffer may take a value of -1, and the value of the counter after -1 may take a value of 0, that is, a writable state.
  • the video frame currently being decoded is a Px video frame
  • the Pz video frame is a reference frame of the Px video frame.
  • the P z video frame is no longer a reference frame of other video frames, and the P z video frame no longer has the reference frame feature.
  • the counter of the frame buffer where the P z video frame is located can be set to -1. Wherein, if the counter value of the frame buffer where the P z video frame is located is 1, the value after -1 is 0, indicating that the frame buffer where the P z video frame is located can write a new reconstructed frame.
  • setting the to-be-displayed flag in the frame buffer where the frame to be displayed is located may be the counter of the frame buffer corresponding to the to-be-displayed frame +1.
  • the to-be-displayed flag is set for the frame buffer where the to-be-displayed frame is located on the basis of the writable flag.
  • the to-be-displayed identifier is set for the frame buffer where the to-be-displayed frame is located on the basis of the reference frame identifier.
  • the counter is +1 based on the reference frame identification, that is, the value is 2; when it is added to the queue to be displayed, the counter is -1, that is, the value is 1 .
  • the image display scheduler stores the frame buffer address and counter value of the frame to be displayed in the queue to be displayed.
  • timestamp information and serial number information of frames to be displayed may also be stored in the queue to be displayed.
  • the image display scheduling may determine the display order of the to-be-displayed frames according to the timestamp information and the serial number information of the to-be-displayed frames, and render and display the to-be-displayed frames according to the display order of the to-be-displayed frames.
  • the image display schedule may be displayed according to the current time stamp distance from far to near, and displayed in the sequence of the numbers of the frames to be displayed.
  • its counter is set to -1.
  • the value of its counter-1 becomes 0, and the corresponding frame buffer is in a writable state. If the frame to be displayed has both the display feature and the reference frame feature, after the frame to be displayed is displayed, the value of its counter-1 becomes 1. For a special reference frame, the value of counter-1 becomes 0 after it is displayed, and the corresponding frame buffer is in a writable state. After each frame to be displayed in the to-be-displayed queue is displayed by the image display schedule, the display queue can be cleared.
  • the system schedule creates a video decoding schedule and an image display schedule, and allocates a shared buffer, the shared buffer includes 10 frame buffers, each frame buffer is set with a counter, and the initial value of the counter is 0.
  • the video decoding scheduling creates a frame buffer queue, and the frame buffer queue stores the addresses and counter values of the 10 frame buffers.
  • the video decoding scheduling determines the frame buffer whose counter value is 0 according to the frame buffer queue, and writes the reconstructed frame currently decoded and output into the frame buffer whose counter value is 0 according to its corresponding address. Wherein, if the reconstructed frame output by the current decoding is the reference frame of the subsequent decoded video frame, the frame buffer counter where the current reconstructed frame is located is +1.
  • the shared buffer has already stored reconstructed frames, and one or several of the reconstructed frames that have been stored are no longer reference frames, but they still have display features and are not displayed, they will be marked as special Refer to the frame ID, add it to the queue to be displayed, and increase its counter by 1. If the shared buffer has already stored reconstructed frames, and one or several of the reconstructed frames already stored are no longer reference frames, and they have no display feature and have been displayed, set their corresponding counters to -1, that is, their corresponding counters are set to -1. The counter returns to 0, indicating that a new reconstructed frame can be written.
  • the image display scheduler can add it to the to-be-displayed queue and add the frame where it is located.
  • the cached counter is +1, and its counter value is 2 at this time. If the reconstructed frame output by the current decoding does not have the reference frame feature, but has the display feature and is determined to be the frame to be displayed, the image display scheduler can add it to the to-be-displayed queue and add 1 to the counter of the frame buffer where it is located. When the counter value is 1.
  • the image display scheduler can also determine the frame to be displayed from other reconstructed frames that have been buffered, add the determined frame to be displayed to the queue to be displayed, and buffer the frame where it is located.
  • the counter + 1 such as the above-mentioned reconstructed frame marked with a special reference frame identifier. After that, if the frame to be displayed has a special reference frame identification, its counter is -1. That is, the counter of each to-be-displayed frame in the to-be-displayed queue takes a value of 1 or 2.
  • the image display schedules each reconstructed frame in the queue to be displayed to be displayed in sequence. For example, each reconstructed frame in the queue of to-be-displayed frames is displayed in sequence in order of distance from the current time from far to near and the numbers are consecutive. And after the reconstructed frame in the frame queue to be displayed is displayed, the counter of its frame buffer is -1. Optionally, for the frame buffer whose counter -1 returns to 0, the stored reconstructed frame can be deleted to support writing a new reconstructed frame. For a frame buffer whose counter is 1 after -1, the stored reconstructed frame can be used as a reference frame for subsequent video frame decoding.
  • the video decoding scheduling and the image display scheduling share the frame buffer, and the video decoding scheduling and the image display scheduling do not need to copy data frequently between the decoding buffer and the display buffer, which saves the system buffer space and improves the system performance.
  • the solution of the embodiment of the present invention sets a status flag for the reconstructed frame output by decoding, and the reference frame output by decoding can be displayed in real time, and can continue to be used as the reference frame for subsequent video frame decoding after display, thereby reducing the phenomenon of video frame delay and stalling.
  • the shared buffer mechanism provided by the embodiments of the present invention can reduce the display delay of video frames with as few frame buffer requirements as possible, and this solution can avoid system bandwidth increase, decoding time-consuming and system functions caused by copying data in memory.
  • the disadvantages such as increased power consumption ensure the system performance and improve the video playback experience.
  • an embodiment of the present invention further provides a terminal device.
  • these terminal devices can be configured by using commercially available hardware components through the steps taught in this solution.
  • FIG. 5 is a schematic structural diagram of a terminal device according to an embodiment of the present invention.
  • the terminal device includes: a determination module 201, configured to determine a shared buffer, where the shared buffer includes a plurality of frame buffers, and each of the frame buffers is provided with a status identifier.
  • the decoding module 202 is configured to write the decoded output reconstructed frame into a frame buffer provided with a writable flag, and if the reconstructed frame has a reference frame feature, set a reference frame flag to the corresponding frame buffer.
  • the display module 203 is configured to determine the frame to be displayed from the reconstructed frame that has been buffered, and to set the to-be-displayed flag in the frame buffer where the to-be-displayed frame is located; The frame is displayed, and if the frame to be displayed no longer has the reference frame feature after being displayed, a writable flag is set for the corresponding frame buffer.
  • the terminal device in this embodiment of the present invention may execute the methods in the embodiments shown in FIG. 3 and FIG. 4 .
  • the terminal device in this embodiment of the present invention may execute the methods in the embodiments shown in FIG. 3 and FIG. 4 .
  • each module of the terminal device shown in FIG. 5 is only a division of logical functions, and may be fully or partially integrated into a physical entity in actual implementation, or may be physically separated.
  • these modules can all be implemented in the form of software calling through processing elements; they can also all be implemented in hardware; some modules can also be implemented in the form of software calling through processing elements, and some modules can be implemented in hardware.
  • the determination module 201 may be a separately established processing element, or may be integrated in a certain chip of the electronic device.
  • the implementation of other modules is similar.
  • all or part of these modules can be integrated together, and can also be implemented independently.
  • each step of the above-mentioned method or each of the above-mentioned modules can be completed by an integrated logic circuit of hardware in the processor element or an instruction in the form of software.
  • the above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more specific integrated circuits (Application Specific Integrated Circuit; hereinafter referred to as: ASIC), or, one or more microprocessors Digital Singnal Processor (hereinafter referred to as: DSP), or, one or more Field Programmable Gate Array (Field Programmable Gate Array; hereinafter referred to as: FPGA), etc.
  • ASIC Application Specific Integrated Circuit
  • DSP Digital Singnal Processor
  • FPGA Field Programmable Gate Array
  • these modules can be integrated together and implemented in the form of a system-on-a-chip (System-On-a-Chip; hereinafter referred to as: SOC).
  • FIG. 6 is a schematic structural diagram of another terminal device provided by an embodiment of the present invention. As shown in FIG. 6, the terminal device is represented in the form of a general-purpose computing device. Components of the terminal device may include, but are not limited to, one or more processors 310 , a communication interface 320 , a memory 330 , a communication bus 340 connecting different system components (including the memory 330 , the communication interface 320 and the processing unit 310 ).
  • Communication bus 340 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of a variety of bus structures.
  • these architectures include, but are not limited to, Industry Standard Architecture (hereinafter referred to as: ISA) bus, Micro Channel Architecture (hereinafter referred to as: MAC) bus, enhanced ISA bus, video electronics Standards Association (Video Electronics Standards Association; hereinafter referred to as: VESA) local bus and Peripheral Component Interconnection (Peripheral Component Interconnection; hereinafter referred to as: PCI) bus.
  • ISA Industry Standard Architecture
  • MAC Micro Channel Architecture
  • VESA Video Electronics Standards Association
  • PCI Peripheral Component Interconnection
  • Electronic devices typically include various computer system readable media. These media can be any available media that can be accessed by the electronic device, including both volatile and nonvolatile media, removable and non-removable media.
  • the memory 330 may include a computer system-readable medium in the form of volatile memory, such as random access memory (Random Access Memory; hereinafter referred to as: RAM) and/or cache memory.
  • RAM random access memory
  • the electronic device may further include other removable/non-removable, volatile/non-volatile computer system storage media.
  • the memory 330 may include at least one program product having a set (eg, at least one) of program modules configured to perform the functions of the embodiments shown in FIGS. 3 and 4 of the present specification.
  • Program modules typically perform the functions and/or methods of the embodiments described in this specification.
  • the processor 310 executes various functional applications and data processing by running the programs stored in the memory 330 , for example, implementing the video frame buffering method provided by the embodiments shown in FIGS. 3 to 4 of this specification.
  • the present application further provides a computer storage medium, wherein the computer storage medium can store a program, and when the program is executed, it can include some or all of the steps in the various embodiments provided in the present application.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (English: read-only memory, abbreviated as: ROM) or a random access memory (English: random access memory, abbreviated as: RAM) and the like.
  • an embodiment of the present invention further provides a computer program product, where the computer program product includes executable instructions, and when the executable instructions are executed on a computer, causes the computer to execute part or some of the above method embodiments. all steps.
  • “at least one” refers to one or more, and “multiple” refers to two or more.
  • “And/or”, which describes the association relationship of the associated objects means that there can be three kinds of relationships, for example, A and/or B, which can indicate the existence of A alone, the existence of A and B at the same time, and the existence of B alone. where A and B can be singular or plural.
  • the character “/” generally indicates that the associated objects are an “or” relationship.
  • “At least one of the following” and similar expressions refer to any combination of these items, including any combination of single or plural items.
  • At least one of a, b, and c may represent: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, c may be single or multiple.
  • any function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
  • the technical solution of the present invention can be embodied in the form of a software product in essence, or the part that contributes to the prior art or the part of the technical solution.
  • the computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
  • the aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM for short), random access memory (RAM for short), magnetic disk or CD, etc. that can store program codes medium.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The present application relates to the technical field of video display, and in particular to a video frame caching method, and a device. The method comprises: determining a shared cache, wherein the shared cache comprises a plurality of frame caches, and a state identifier is set for each frame cache; writing reconstructed frames, which are decoded and output, into frame caches for which a writing-available identifier is set, and if the reconstructed frames have reference frame features, setting a reference frame identifier for corresponding frame caches; determining, from among cached reconstructed frames, a frame to be displayed, and setting a to-be-displayed identifier for the frame cache where the frame to be displayed is located; and displaying the frame to be displayed that is in the frame cache for which the to-be-displayed identifier is set, and if there no longer is a reference frame feature after the frame to be displayed is displayed, setting a writing-available identifier for the corresponding frame cache. By means of the solution in the embodiments of the present invention, a video output delay can be decreased while relatively little system memory is occupied.

Description

视频帧缓存方法和设备Video frame buffer method and device
本申请要求于2021年03月08日提交中国专利局、申请号为202110249758.9、申请名称为“视频帧缓存方法和设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202110249758.9 and the application title "Video Frame Buffering Method and Apparatus" filed with the China Patent Office on March 08, 2021, the entire contents of which are incorporated into this application by reference.
技术领域technical field
本申请涉及视频显示技术领域,尤其涉及一种视频帧缓存方法和设备。The present application relates to the technical field of video display, and in particular, to a video frame buffering method and device.
背景技术Background technique
在音视频播放场景中,音视频流的处理除了音视频流的解复用之外,还涉及视频流的解码和图像帧显示。即视频流首先经过视频解码重建为图像帧数据,然后经由图像显示过程将图像帧渲染到屏幕。其中,为了支持视频流解码和图像帧显示过程的正常调度,通常将图像帧数据存储在系统内存的帧缓存中。但在当前的图像帧数据的缓存方法中,可能会存在解码后的重建帧需要拷贝,占用较多内存;或者解码后的重建帧由于需要做后续视频帧的参考帧而需要延迟输出,导致视频卡顿等问题。In the audio and video playback scenario, the processing of the audio and video streams involves the decoding of the video streams and the display of image frames in addition to the demultiplexing of the audio and video streams. That is, the video stream is first reconstructed into image frame data through video decoding, and then the image frame is rendered to the screen through the image display process. Among them, in order to support the normal scheduling of the video stream decoding and image frame display process, the image frame data is usually stored in the frame buffer of the system memory. However, in the current image frame data caching method, there may be decoded reconstructed frames that need to be copied and occupy more memory; or the decoded reconstructed frames need to be delayed output because they need to be used as reference frames for subsequent video frames, resulting in video Caton, etc.
发明内容SUMMARY OF THE INVENTION
有鉴于此,本发明实施例提供了一种视频帧缓存方法和设备,不仅可以避免重建帧的拷贝操作,而且可以降低重建帧由于需要做参考帧而带来的延迟。因此,本发明实施例方案能够在占用较小系统内存的情况下,降低视频输出延迟。In view of this, the embodiments of the present invention provide a video frame buffering method and device, which can not only avoid the copy operation of the reconstructed frame, but also reduce the delay caused by the need to use the reconstructed frame as a reference frame. Therefore, the solutions of the embodiments of the present invention can reduce the video output delay while occupying a small amount of system memory.
第一方面,本发明实施例提供了一种视频帧缓存方法,包括:确定共享缓存,所述共享缓存包括多个帧缓存,每个所述帧缓存均设置有状态标识;将解码输出的重建帧写入设置有可写入标识的帧缓存,并且如果所述重建帧具有参考帧特征, 则对相应帧缓存设置参考帧标识;从已经缓存的所述重建帧中确定待显示帧,并对所述待显示帧所在的帧缓存设置待显示标识;对设置有待显示标识的帧缓存中的所述待显示帧进行显示,如果所述待显示帧显示之后不再具有参考帧特征,则对相应帧缓存设置可写入标识。In a first aspect, an embodiment of the present invention provides a video frame buffering method, including: determining a shared buffer, where the shared buffer includes a plurality of frame buffers, and each frame buffer is provided with a status identifier; The frame is written into a frame buffer provided with a writable identifier, and if the reconstructed frame has a reference frame feature, a reference frame identifier is set for the corresponding frame buffer; the frame to be displayed is determined from the reconstructed frame that has been buffered, and the The frame buffer where the frame to be displayed is located is set with a to-be-displayed flag; the to-be-displayed frame in the frame buffer where the to-be-displayed flag is set is displayed, and if the to-be-displayed frame no longer has the reference frame feature after being displayed, the corresponding Framebuffer settings writable flag.
可选的,所述共享缓存包括的帧缓存个数是根据待播放视频流的参考帧个数和缓冲帧个数确定的。Optionally, the number of frame buffers included in the shared buffer is determined according to the number of reference frames and the number of buffered frames of the video stream to be played.
可选的,每个所述帧缓存均设置有状态标识,包括:每个所述帧缓存均设置有计数器,所述计数器的取值用于作为对应帧缓存的状态标识。当帧缓存中缓存的重建帧状态发生改变时,对应的计数器取值发生改变。Optionally, each of the frame buffers is provided with a status identifier, including: each of the frame buffers is provided with a counter, and the value of the counter is used as a status identifier of the corresponding frame buffer. When the state of the reconstructed frame buffered in the frame buffer changes, the corresponding counter value changes.
可选的,所述方法还包括:创建帧缓存队列,所述帧缓存队列用于存储所述共享缓存中各个帧缓存的状态标识信息;将解码输出的重建帧写入设置有可写入标识的帧缓存,包括:根据所述帧缓存队列存储的所述各个帧缓存的状态标识信息,确定设置有可写入标识的帧缓存,其中,所述设置有可写入标识的帧缓存用于写入解码输出的重建帧。Optionally, the method further includes: creating a frame buffer queue, where the frame buffer queue is used to store the status identification information of each frame buffer in the shared buffer; writing the reconstructed frame output from the decoding is set with a writable mark. The frame buffer, including: according to the state identification information of the respective frame buffers stored in the frame buffer queue, determine the frame buffer that is provided with the writable mark, wherein, the frame buffer that is provided with the writable mark is used for Write the reconstructed frame of the decoded output.
可选的,从已经缓存的所述重建帧中确定待显示帧,包括:如果当前解码输出的重建帧仅具有显示特征,则将当前解码输出的重建帧确定为待显示帧,并在可写入标识的基础上对相应帧缓存设置待显示标识;如果当前解码输出的重建帧既具有参考帧特征又具有显示特征,则将当前解码输出的重建帧确定为待显示帧,并在参考帧标识的基础上对相应帧缓存设置待显示标识。其中,如果当前解码输出的重建帧既具有参考帧特征又具有显示特征,可以在满足预设的显示条件时,将当前解码输出的重建帧确定为待显示帧。Optionally, determining the frame to be displayed from the cached reconstructed frame includes: if the reconstructed frame output by the current decoding only has the display feature, then determining the reconstructed frame output by the current decoding as the frame to be displayed, and writing it in the writable frame. On the basis of the input identification, the corresponding frame buffer is set with the identification to be displayed; if the reconstructed frame outputted by the current decoding has both the reference frame feature and the display feature, the reconstructed frame outputted by the current decoding is determined as the frame to be displayed, and the reference frame identification On the basis of the corresponding frame buffer, the to-be-displayed flag is set. Wherein, if the reconstructed frame output by the current decoding has both the reference frame feature and the display feature, the reconstructed frame output by the current decoding may be determined as the frame to be displayed when a preset display condition is satisfied.
可选的,从已经缓存的所述重建帧中确定待显示帧,还包括:除当前解码输出的重建帧之外,如果已经设置有参考帧标识的至少一个帧缓存中的重建帧不再具有参考帧特征,并且具有显示特征且还未显示,则将相应重建帧确定为待显示帧,并将相应帧缓存的参考帧标识设置为待显示标识;除当前解码输出的重建帧 之外,如果已经设置有参考帧标识的至少一个帧缓存中的重建帧不再具有参考帧标识,并且已经显示或者不具有显示特征,则将相应帧缓存的参考帧标识设置为可写入标识。Optionally, determining the frame to be displayed from the reconstructed frame that has been buffered, further comprising: in addition to the reconstructed frame output by the current decoding, if the reconstructed frame in at least one frame buffer that has been set with a reference frame identifier no longer has The reference frame features, and has the display feature and has not yet been displayed, then the corresponding reconstructed frame is determined as the frame to be displayed, and the reference frame identifier of the corresponding frame buffer is set as the to-be-displayed identifier; in addition to the reconstructed frame output by the current decoding, if If the reconstructed frame in the at least one frame buffer already set with the reference frame identifier no longer has the reference frame identifier, and has been displayed or has no display feature, the reference frame identifier of the corresponding frame buffer is set as a writable identifier.
可选的,所述方法还包括:创建待显示队列,所述待显示队列用于存储所述待显示帧的待显示标识信息。其中,仅具有显示特征和既具有显示特征又具有参考特征的待显示帧的待显示标识不同。Optionally, the method further includes: creating a to-be-displayed queue, where the to-be-displayed queue is used to store to-be-displayed identification information of the to-be-displayed frame. Wherein, only the to-be-displayed identifications of the to-be-displayed frames having the display feature and the to-be-displayed frame having both the display feature and the reference feature are different.
可选的,所述待显示队列还用于存储所述待显示帧的时间戳信息和编号信息;对所述待显示帧进行显示,包括:根据所述待显示帧的时间戳信息和编号信息,确定所述待显示帧的显示顺序,并根据所述待显示帧的显示顺序,对所述待显示帧进行显示。Optionally, the to-be-displayed queue is also used to store timestamp information and number information of the to-be-displayed frame; displaying the to-be-displayed frame includes: according to the to-be-displayed frame timestamp information and number information. , determine the display order of the to-be-displayed frames, and display the to-be-displayed frames according to the display order of the to-be-displayed frames.
可选的,如果所述待显示帧显示之后不再具有参考帧特征,则对相应帧缓存设置可写入标识,包括:如果所述待显示帧仅具有显示特征,则在待显示帧显示之后,将待显示标识设置为可写入标识;如果所述待显示帧既具有显示特征又具有参考特征,则在待显示帧显示之后,将待显示标识设置为参考帧标识,之后将参考帧标识设置为待写入标识。Optionally, if the to-be-displayed frame no longer has the reference frame feature after being displayed, setting a writable flag to the corresponding frame buffer, including: if the to-be-displayed frame only has the display feature, then after the to-be-displayed frame is displayed , set the to-be-displayed identification as a writable identification; if the to-be-displayed frame has both display features and reference features, after the to-be-displayed frame is displayed, the to-be-displayed identification is set as the reference frame identification, and then the reference frame identification Set to the ID to be written.
第二方面,本发明实施例提供了一种终端设备,包括:确定模块,用于确定共享缓存,所述共享缓存包括多个帧缓存,每个所述帧缓存均设置有状态标识;解码模块,用于将解码输出的重建帧写入设置有可写入标识的帧缓存,并且如果所述重建帧具有参考帧特征,则对相应帧缓存设置参考帧标识;显示模块,用于从已经缓存的所述重建帧中确定待显示帧,并对所述待显示帧所在的帧缓存设置待显示标识;对设置有待显示标识的帧缓存中的所述待显示帧进行显示,如果所述待显示帧显示之后不再具有参考帧特征,则对相应帧缓存设置可写入标识。In a second aspect, an embodiment of the present invention provides a terminal device, including: a determination module configured to determine a shared buffer, where the shared buffer includes a plurality of frame buffers, and each frame buffer is provided with a status identifier; a decoding module , for writing the decoded output reconstructed frame into a frame buffer provided with a writable identifier, and if the reconstructed frame has a reference frame feature, then a reference frame identifier is set for the corresponding frame buffer; The frame to be displayed is determined in the reconstructed frame, and the frame buffer where the frame to be displayed is located is set with a to-be-displayed mark; After the frame is displayed, it no longer has the reference frame feature, then the writable flag is set for the corresponding frame buffer.
第三方面,本发明实施例提供了一种终端设备,包括:至少一个处理器;以及与所述处理器通信连接的至少一个存储器,其中:所述存储器存储有可被所述处理器执行的程序指令,所述处理器调用所述程序指令以执行以执行第一方面或 者第一方面任一项可能实施例的方法。。In a third aspect, an embodiment of the present invention provides a terminal device, including: at least one processor; and at least one memory communicatively connected to the processor, wherein: the memory stores a program that can be executed by the processor Program instructions to be invoked by the processor to execute to perform the method of the first aspect or any possible embodiment of the first aspect. .
第四方面,本发明实施例提供了一种计算机可读存储介质,所述计算机可读存储介质包括存储的程序,其中,在所述程序运行时控制所述计算机可读存储介质所在设备执行第一方面或者第一方面任一项可能实施例的方法。。In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where the computer-readable storage medium includes a stored program, wherein when the program runs, a device on which the computer-readable storage medium is located is controlled to execute the first The method of an aspect or any possible embodiment of the first aspect. .
本发明实施例方案中,视频解码调度和图像显示调度共享帧缓存,视频解码调度和图像显示调度无需在解码和显示过程中频繁拷贝重建帧数据,节约系统缓存空间,提升系统性能。而且,本发明实施例方案对解码输出的重建帧设置状态标识,解码输出的参考帧可以实时显示,并且在显示之后可以继续作为后续视频帧解码的参考帧,降低视频帧延迟卡顿的现象。In the solution of the embodiment of the present invention, the video decoding scheduling and the image display scheduling share the frame buffer, and the video decoding scheduling and the image display scheduling do not need to copy and reconstruct the frame data frequently during the decoding and display process, which saves the system cache space and improves the system performance. Moreover, the solution of the embodiment of the present invention sets a status flag for the reconstructed frame output by decoding, and the reference frame output by decoding can be displayed in real time, and can continue to be used as the reference frame for subsequent video frame decoding after display, thereby reducing the phenomenon of video frame delay and stalling.
附图说明Description of drawings
为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to illustrate the technical solutions of the embodiments of the present application more clearly, the following briefly introduces the accompanying drawings used in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained from these drawings without any creative effort.
图1是相关技术提供的一种视频帧缓存方法的流程图;1 is a flowchart of a video frame buffering method provided by the related art;
图2是相关技术提供的另一种视频帧缓存方法的流程图;2 is a flowchart of another video frame buffering method provided by the related art;
图3是本发明实施例提供的一种视频帧缓存方法的流程图;3 is a flowchart of a video frame buffering method provided by an embodiment of the present invention;
图4是本发明实施例提供的另一种视频帧缓存方法的流程图;4 is a flowchart of another video frame buffering method provided by an embodiment of the present invention;
图5是本发明实施例提供的一种终端设备的结构示意图;5 is a schematic structural diagram of a terminal device provided by an embodiment of the present invention;
图6是本发明实施例提供的另一种终端设备的结构示意图。FIG. 6 is a schematic structural diagram of another terminal device provided by an embodiment of the present invention.
具体实施方式Detailed ways
为了更好的理解本申请的技术方案,下面结合附图对本申请实施例进行详细描述。应当明确,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提 下所获得的所有其它实施例,都属于本申请保护的范围。In order to better understand the technical solutions of the present application, the embodiments of the present application are described in detail below with reference to the accompanying drawings. It should be clear that the described embodiments are only a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the protection scope of this application.
图1是相关技术提供的一种视频帧缓存方法的流程图。如图1所示,在视频播放场景中,系统调度创建视频解码调度和图像显示调度,视频解码调度和图像显示调度各自维护其内部的帧缓存,如视频解码调度维护的帧缓存用于存储Frame(0)、Frame(1)……Frame(N)个重建帧,图像显示调度维护的帧缓存用于莻Frame(0)、Frame(1)……Frame(M)个待显示帧。如图1所示,在视频解码调度过程中,视频解码引擎对视频码流进行解码,输出视频帧图像的重建帧。视频解码引擎将输出的重建帧写入其维护的帧缓存中。在图像显示调度过程中,图像显示引擎对需要显示的重建帧进行拷贝并缓存至其维护的帧缓存中。图像显示引擎依据显示顺序对拷贝的各个重建帧进行显示。在图1所示方法中,待显示的每一帧视频帧都需要拷贝,而拷贝数据的过程耗时又相对比较高,因此会极大降低整个系统的性能,增加系统带宽。FIG. 1 is a flowchart of a video frame buffering method provided in the related art. As shown in Figure 1, in the video playback scenario, the system schedules create video decoding schedules and image display schedules. Video decoding schedules and image display schedules maintain their internal frame buffers. For example, the frame buffers maintained by video decoding schedules are used to store frames. (0), Frame(1)...Frame(N) reconstructed frames, and the frame buffer maintained by the image display schedule is used for Frame(0), Frame(1)...Frame(M) frames to be displayed. As shown in FIG. 1 , in the video decoding scheduling process, the video decoding engine decodes the video code stream and outputs the reconstructed frame of the video frame image. The video decoding engine writes the output reconstructed frames into the frame buffer it maintains. During the image display scheduling process, the image display engine copies the reconstructed frames to be displayed and buffers them into the frame buffer maintained by the image display engine. The image display engine displays the copied reconstructed frames according to the display order. In the method shown in FIG. 1 , each video frame to be displayed needs to be copied, and the process of copying data is relatively time-consuming, which greatly reduces the performance of the entire system and increases the system bandwidth.
图2是相关技术提供的另一种视频帧缓存方法的流程图。如图2所示,系统调度创建视频解码调度和图像显示调度,视频解码调度维护的帧缓存用于存储Frame(0)、Frame(1)……Frame(N)个重建帧,该帧缓存中的重建帧显示之后即被释放。由于重建帧显示之后会被释放,而且由于大部分重建帧需要作为后续解码过程的参考帧,因此在帧缓存中会存在解码在前,显示在后的重建帧。例如视频流I 0P 1B 2P 3中的P 1帧,P 1帧解码在B 2帧之前,但在显示时P 1帧在B 2帧之后。可见,对于解码后不能马上输出显示的重建帧,其需要在帧缓存中暂存,直至该重建帧不再做后续解码过程的参考帧。与图1所示方法相比,图2所示方法在图像显示调度过程中无需拷贝重建帧数据,但解码后的重建帧可能会保留相当长的时间,由此可能会造成很大的延迟或者卡顿现象,影响视频播放效果。 FIG. 2 is a flowchart of another video frame buffering method provided by the related art. As shown in Figure 2, the system scheduling creates video decoding scheduling and image display scheduling, and the frame buffer maintained by the video decoding scheduling is used to store Frame(0), Frame(1)...Frame(N) reconstructed frames. is released after the reconstructed frame is displayed. Since the reconstructed frame will be released after being displayed, and since most of the reconstructed frames need to be used as reference frames for the subsequent decoding process, there will be reconstructed frames that are decoded first and displayed later in the frame buffer. For example, the P1 frame in the video stream I 0 P 1 B 2 P 3 , the P 1 frame is decoded before the B 2 frame, but the P 1 frame is after the B 2 frame when displayed . It can be seen that, for the reconstructed frame that cannot be output and displayed immediately after decoding, it needs to be temporarily stored in the frame buffer until the reconstructed frame is no longer used as a reference frame for the subsequent decoding process. Compared with the method shown in Figure 1, the method shown in Figure 2 does not need to copy the reconstructed frame data during the image display scheduling process, but the decoded reconstructed frame may be retained for a long time, which may cause a large delay or The stuttering phenomenon affects the video playback effect.
为了解决相关技术中,由于数据拷贝带来的占用系统内存,以及参考帧长时间暂存带来的延迟卡顿现象,本发明实施例提供了一种视频帧缓存方案。在该方案中,视频解码调度和图像显示调度共享帧缓存,并且通过对共享缓存包括的各 个帧缓存设置状态标识,可以在保持重建帧的参考帧功能的同时,实现对重建帧的实时显示,由此可以降低显示延迟。In order to solve the related art, due to the occupation of system memory caused by data copying and the delayed and stuck phenomenon caused by temporary storage of reference frames for a long time, the embodiments of the present invention provide a video frame buffering solution. In this solution, the video decoding scheduling and the image display scheduling share the frame buffer, and by setting the status flags for each frame buffer included in the shared buffer, the real-time display of the reconstructed frame can be realized while maintaining the reference frame function of the reconstructed frame. Thereby, the display delay can be reduced.
图3是本发明实施例提供的一种视频帧缓存方法的流程图。如图3所示,在视频播放场景中,系统调度创建视频解码调度和图像显示调度,以及分配0、1、2……N个帧缓存作为共享缓存,该共享缓存可以由视频解码调度和图像显示调度共同调度,共享缓存用于存储Frame(0)、Frame(1)……Frame(N)个重建帧。与图1和图2不同,图3所示的共享缓存中,每个帧缓存均设置有状态标识,通过状态标识可以确定相应帧缓存缓存的重建帧的状态。可选的,当帧缓存中存储的重建帧的状态发生改变时,帧缓存对应的状态标识也进行变更。可选的,本发明实施例方法还可以包括:创建帧缓存队列,帧缓存队列用于存储各个帧缓存的地址信息和状态标识信息。根据帧缓存队列中各个帧缓存的地址信息和状态标识信息,可以调用需要处理的重建帧。例如,初始化时,共享缓存中的每个帧缓存均设置有可写入标识。视频解码调度可以通过帧缓存队列随机选择一个设置有可写入标识的帧缓存作为重建帧的存放位置。当一个或者多个帧缓存中的重建帧被确定为待显示帧时,对应的帧缓存设置待显示标识。当待显示帧显示之后,可以对相应帧缓存设置已显示标识。其中,如果已经显示的视频帧不再作为后续其它视频帧的参考帧,则可以为其设置可写入标识。如果已经显示的视频帧仍然需要作为后续其它视频帧的参考帧,则可以为其保留参考帧标识。具体的,基于图3所示共享缓存,视频解码引擎对视频码流进行解码,输出视频帧图像的重建帧。视频解码引擎将解码输出的重建帧写入设置有可写入标识的帧缓存。可选的,如果写入的重建帧具有参考帧特征,则对相应帧缓存设置参考帧标识。在图像显示调度过程中,图像显示引擎从已经缓存的各个重建帧中确定待显示帧,并对待显示帧所在的帧缓存设置待显示标识。图像显示引擎从设置有待显示标识的帧缓存中读取重建帧进行显示。其中,根据重建帧的显示特征和参考帧特征,重建帧可以分为:仅用于显示的重建帧、既作为参考帧又用于显示的重建帧、仅作为参考帧 的重建帧、既不作为参考帧又不用于显示的重建帧。可选的,图像显示调度过程对仅用于显示、以及既作为参考帧又用于显示两种类型的重建帧进行渲染显示。FIG. 3 is a flowchart of a video frame buffering method provided by an embodiment of the present invention. As shown in Figure 3, in the video playback scenario, the system schedules to create video decoding schedules and image display schedules, and allocates 0, 1, 2...N frame buffers as shared buffers, which can be used by video decoding scheduling and image display. Display scheduling is co-scheduling, and the shared buffer is used to store Frame(0), Frame(1)...Frame(N) reconstructed frames. Different from FIG. 1 and FIG. 2 , in the shared buffer shown in FIG. 3 , each frame buffer is provided with a state identifier, and the state of the reconstructed frame in the corresponding frame buffer can be determined through the state identifier. Optionally, when the state of the reconstructed frame stored in the frame buffer changes, the state identifier corresponding to the frame buffer is also changed. Optionally, the method according to the embodiment of the present invention may further include: creating a frame buffer queue, where the frame buffer queue is used to store address information and state identification information of each frame buffer. According to the address information and status identification information of each frame buffer in the frame buffer queue, the reconstructed frame to be processed can be called. For example, upon initialization, each framebuffer in the shared buffer is set with a writable flag. The video decoding scheduling can randomly select a frame buffer with a writable flag set as the storage location of the reconstructed frame through the frame buffer queue. When the reconstructed frames in one or more frame buffers are determined to be frames to be displayed, the corresponding frame buffers set the to-be-displayed flags. After the frame to be displayed is displayed, a displayed flag can be set for the corresponding frame buffer. Wherein, if the video frame that has been displayed is no longer used as the reference frame of other subsequent video frames, a writable flag may be set for it. If a video frame that has been displayed still needs to be used as a reference frame for other subsequent video frames, a reference frame identifier can be reserved for it. Specifically, based on the shared buffer shown in FIG. 3 , the video decoding engine decodes the video stream, and outputs the reconstructed frame of the video frame image. The video decoding engine writes the decoded output reconstructed frame into the frame buffer set with the writable flag. Optionally, if the written reconstructed frame has the reference frame feature, the reference frame identifier is set for the corresponding frame buffer. During the image display scheduling process, the image display engine determines the frame to be displayed from the reconstructed frames that have been buffered, and sets the to-be-displayed flag in the frame buffer where the frame to be displayed is located. The image display engine reads and displays the reconstructed frame from the frame buffer with the to-be-displayed flag set. Among them, according to the display characteristics and reference frame characteristics of the reconstructed frames, the reconstructed frames can be divided into: reconstructed frames only used for display, reconstructed frames used as both reference frames and display, reconstructed frames only used as reference frames, and neither The reference frame is in turn not used for the reconstructed frame for display. Optionally, the image display scheduling process renders and displays two types of reconstructed frames that are only used for display, and are both used as reference frames and used for display.
基于图3的说明,本发明实施例的视频帧缓存方法的处理流程,如图4所示包括:Based on the description of FIG. 3 , the processing flow of the video frame buffering method according to the embodiment of the present invention, as shown in FIG. 4 , includes:
101,确定共享缓存,所述共享缓存包括多个帧缓存,每个所述帧缓存均设置有状态标识。可选的,可以为每个帧缓存设置一个计数器,计数器的取值用于作为对应帧缓存的状态标识。当帧缓存中缓存的重建帧状态发生改变时,对应的计数器的取值也对应发生改变。可选的,在初始状态时,各个帧缓存均设置有可写入标识。例如,各个计数器的初始值可以取0。当计数器的取值为0时,表示对应帧缓存为可写入状态。101. Determine a shared buffer, where the shared buffer includes a plurality of frame buffers, and each frame buffer is provided with a status identifier. Optionally, a counter may be set for each frame buffer, and the value of the counter is used as a state identifier of the corresponding frame buffer. When the state of the reconstructed frame buffered in the frame buffer changes, the value of the corresponding counter also changes correspondingly. Optionally, in the initial state, each frame buffer is set with a writable flag. For example, the initial value of each counter may take 0. When the value of the counter is 0, it indicates that the corresponding frame buffer is in a writable state.
在一些实施例中,在确定共享缓存之后,还可以基于共享缓存创建帧缓存队列,帧缓存队列用于存储共享缓存包括的各个帧缓存的地址信息和状态标识信息。视频解码调度可以根据帧缓存队列确定设置有可写入标识的帧缓存的地址。In some embodiments, after the shared buffer is determined, a frame buffer queue may also be created based on the shared buffer, where the frame buffer queue is used to store address information and state identification information of each frame buffer included in the shared buffer. The video decoding schedule may determine the address of the frame buffer with the writable flag according to the frame buffer queue.
在一些实施例中,共享缓存包括的帧缓存个数可以根据待播放视频流的参考帧个数和缓冲帧个数确定。在一些实施例中,根据待播放视频流的特性,确定参考帧个数为ref_num。根据图像显示调度支持的图像帧缓冲个数,确定缓冲帧个数M。帧缓存队列包括的帧缓存个数可以为:ref_num+M。In some embodiments, the number of frame buffers included in the shared buffer may be determined according to the number of reference frames and the number of buffered frames of the video stream to be played. In some embodiments, the number of reference frames is determined as ref_num according to the characteristics of the video stream to be played. Determine the number of buffered frames M according to the number of image frame buffers supported by the image display scheduling. The number of frame buffers included in the frame buffer queue may be: ref_num+M.
102,将解码输出的重建帧写入设置有可写入标识的帧缓存,并且如果当前写入的重建帧具有参考帧特征,则对相应帧缓存设置参考帧标识。102. Write the decoded output reconstructed frame into a frame buffer set with a writable flag, and if the currently written reconstructed frame has a reference frame feature, set a reference frame flag for the corresponding frame buffer.
在一些实施例中,视频解码调度可以根据帧缓存队列存储的各个帧缓存的状态标识信息,确定设置有可写入标识的帧缓存的地址信息。视频解码调度可以将当前解码输出的重建帧写入设置有可写入标识的帧缓存。其中,如果当前解码输出的重建帧具有参考帧特征,则将相应帧缓存的可写入标识设置为参考帧标识。In some embodiments, the video decoding scheduler may determine the address information of the frame buffer set with the writable identifier according to the status identifier information of each frame buffer stored in the frame buffer queue. The video decoding scheduler can write the reconstructed frame output by the current decoding into the frame buffer set with the writable flag. Wherein, if the reconstructed frame output by the current decoding has the reference frame feature, the writable identifier of the corresponding frame buffer is set as the reference frame identifier.
在一些示例中,各个计数器的初始值可以取0。当计数器的取值为0时,表示对应帧缓存为可写入状态。视频解码调度可以将当前解码输出的重建帧写入计 数器取值为0的帧缓存。如果当前解码输出的重建帧具有参考帧特征,则对用于存储当前重建帧的帧缓存的计数器+1,帧缓存队列中相应帧缓存的状态标识信息也对应+1。In some examples, the initial value of each counter may take 0. When the value of the counter is 0, it indicates that the corresponding frame buffer is in a writable state. The video decoding scheduling can write the reconstructed frame output by the current decoding into the frame buffer whose counter value is 0. If the reconstructed frame currently decoded and output has the reference frame feature, the counter for the frame buffer used to store the current reconstructed frame is +1, and the status identification information of the corresponding frame buffer in the frame buffer queue also corresponds to +1.
其中,当前帧具有参考帧特征是指当前帧是后续视频帧解码的参考帧。例如,视频解码调度在对P x视频帧解码时,确定P x视频帧是后续P y视频帧的参考帧,则视频解码调度将P x视频帧所对应帧缓存的计数器+1。其中,P x表示当前正在解码的视频帧,P y表示解码时间在P x之后的任意一个视频帧,可选的,P x和P y可以是解码顺序相邻的两个视频帧,当然在解码顺序上P x和P y也可以间隔多个其它视频帧。另外,P x和P y可以是相同类型的视频帧,也可以是不同类型的视频帧,此处不再一一列举说明。 The fact that the current frame has the reference frame feature means that the current frame is a reference frame for decoding subsequent video frames. For example, when decoding a Px video frame, the video decoding schedule determines that the Px video frame is a reference frame of the subsequent Py video frame, and the video decoding schedule adds 1 to the frame buffered counter corresponding to the Px video frame. Among them, P x represents the video frame currently being decoded, and P y represents any video frame whose decoding time is after P x . Optionally, P x and P y can be two adjacent video frames in decoding order. Px and Py may also be spaced apart by multiple other video frames in decoding order. In addition, P x and P y may be video frames of the same type, or may be video frames of different types, which will not be described one by one here.
可选的,视频解码调度还可以维护参考帧队列,当一个重建帧具有参考帧特征时,视频解码调度可以将相应重建帧的地址信息和状态标识信息存入参考帧队列。可选的,当任一参考帧不再具有参考帧特征时,可以将不再具有参考帧队列的重建帧的地址等相关信息从参考帧队列中删除。Optionally, the video decoding scheduler may also maintain a reference frame queue. When a reconstructed frame has the reference frame feature, the video decoding scheduler may store the address information and state identification information of the corresponding reconstructed frame in the reference frame queue. Optionally, when any reference frame no longer has the reference frame feature, relevant information such as the address of the reconstructed frame that no longer has the reference frame queue may be deleted from the reference frame queue.
103,从已经缓存的重建帧中确定待显示帧,并对待显示帧所在的帧缓存设置待显示标识。可选的,待显示帧包括仅具有显示特征和既具有显示特征又具有参考特征的重建帧。103. Determine the frame to be displayed from the reconstructed frames that have been buffered, and set a to-be-displayed flag in the frame buffer where the frame to be displayed is located. Optionally, the frames to be displayed include reconstructed frames having only display features and both display features and reference features.
视频解码调度在对当前帧进行解码时,如果当前解码输出的重建帧仅具有显示特征,则视频解码调度可以将当前解码输出的重建帧确定为待显示帧,并将相应重建帧的计数器+1。如果当前解码输出的重建帧既具有参考帧特征又具有显示特征,则将当前解码输出的重建帧确定为待显示帧,并在参考帧标识的基础上对相应帧缓存设置待显示标识,即在计数器取值为1的基础上再+1。可选的,如果当前解码输出的重建帧既具有参考帧特征又具有显示特征,则可以在满足预设条件时,将其确定为待显示帧。例如,当其时间戳与上一个显示的重建帧的时间戳或者编号的差值小于一定阈值,则将其确定为待显示帧。当然对于当前解码输出 的重建帧,在确定其既具有参考帧特征又具有显示特征时,即确定为待显示帧。When the video decoding scheduling decodes the current frame, if the reconstructed frame output by the current decoding only has the display feature, the video decoding scheduling can determine the reconstructed frame output by the current decoding as the frame to be displayed, and increase the counter of the corresponding reconstructed frame by 1. . If the reconstructed frame output by the current decoding has both the reference frame feature and the display feature, the reconstructed frame output by the current decoding is determined as the frame to be displayed, and the corresponding frame buffer is set on the basis of the reference frame identifier. The counter value is 1 based on +1. Optionally, if the reconstructed frame currently decoded and output has both the reference frame feature and the display feature, it may be determined as the frame to be displayed when a preset condition is met. For example, when the difference between its time stamp and the time stamp or number of the last displayed reconstructed frame is smaller than a certain threshold, it is determined as a frame to be displayed. Of course, for the reconstructed frame output by the current decoding, when it is determined that it has both the reference frame feature and the display feature, it is determined as the frame to be displayed.
可选的,本发明实施例中还可以创建待显示队列,待显示队列用于存储待显示帧的地址信息和待显示标识信息。图像显示调度可以根据待显示队列对各个待显示帧进行调度并显示。Optionally, in this embodiment of the present invention, a queue to be displayed may also be created, and the queue to be displayed is used to store address information and identification information of a frame to be displayed. The image display scheduling can schedule and display each frame to be displayed according to the queue to be displayed.
进一步,除当前解码输出的重建帧之外,如果已经设置有参考帧标识的至少一个帧缓存中的重建帧不再具有参考帧特征,并且具有显示特征且还未显示,则可以将相应重建帧确定为待显示帧,并将相应帧缓存的参考帧标识设置为待显示标识。可选的,此处将相应帧缓存的参考帧标识设置为待显示标识可以是:当将该至少一个帧缓存中的重建帧确定为待显示帧时,将该至少一个帧缓存的计数器在原参考帧标识为1的基础上+1,则其取值为2。当将该至少一个帧缓存中的重建帧加入待显示队列,并确定其为特殊参考帧时,再将相应计数器取值-1,此时计数器取值为1。其中,特殊参考帧可以认为是:原来为参考帧,此时不再具有参考帧特征,具有显示特征且未显示。可选的,对于特殊参考帧还可以设置特殊参考帧标识。其中,特殊参考帧标识可以不通过计数器的取值体现,例如可以在待显示队列中对相应重建帧标注特殊参考帧标识。Further, in addition to the reconstructed frame output by the current decoding, if the reconstructed frame in the at least one frame buffer that has been set with the reference frame identifier no longer has the reference frame feature, and has the display feature and has not yet been displayed, the corresponding reconstructed frame can be The frame to be displayed is determined, and the reference frame identifier of the corresponding frame buffer is set as the identifier to be displayed. Optionally, setting the reference frame identifier of the corresponding frame buffer as the to-be-displayed identifier may be: when the reconstructed frame in the at least one frame buffer is determined as the to-be-displayed frame, the counter of the at least one frame buffer is set in the original reference frame. The frame ID is +1 based on 1, then its value is 2. When the reconstructed frame in the at least one frame buffer is added to the queue to be displayed, and it is determined that it is a special reference frame, the corresponding counter takes a value of -1, and the counter takes a value of 1 at this time. Among them, the special reference frame can be considered as: the original reference frame, at this time, it no longer has the reference frame feature, and has the display feature and is not displayed. Optionally, a special reference frame identifier may also be set for the special reference frame. The special reference frame identifier may not be reflected by the value of the counter, for example, the corresponding reconstructed frame may be marked with the special reference frame identifier in the queue to be displayed.
进一步,除当前解码输出的重建帧之外,如果已经设置有参考帧标识的至少一个帧缓存中的重建帧不再具有参考帧特征,并且已经显示或者不具有显示特征,则将相应帧缓存的参考帧标识设置为可写入标识。例如,可以将该至少一个帧缓存的计数器取值-1,其计数器-1后取值为0,即为可写入状态。在一个具体示例中,当前正在解码的视频帧为P x视频帧,P z视频帧为P x视频帧的参考帧。P x视频帧解码后,P z视频帧不再为其它视频帧的参考帧,则P z视频帧不再具有参考帧特征。并且P z视频帧已经显示或者P z视频帧是不用进行显示的帧,则可以将P z视频帧所在的帧缓存的计数器-1。其中,如果P z视频帧所在的帧缓存的计数器取值为1,则-1后取值为0,表示P z视频帧所在的帧缓存可以写入新的重建帧。 Further, in addition to the reconstructed frame output by the current decoding, if the reconstructed frame in at least one frame buffer that has been set with the reference frame identifier no longer has the reference frame feature, and has been displayed or does not have the display feature, the corresponding frame buffer The reference frame flag is set to writable flag. For example, the counter of the at least one frame buffer may take a value of -1, and the value of the counter after -1 may take a value of 0, that is, a writable state. In a specific example, the video frame currently being decoded is a Px video frame, and the Pz video frame is a reference frame of the Px video frame. After the P x video frame is decoded, the P z video frame is no longer a reference frame of other video frames, and the P z video frame no longer has the reference frame feature. And if the P z video frame has been displayed or the P z video frame is a frame not to be displayed, the counter of the frame buffer where the P z video frame is located can be set to -1. Wherein, if the counter value of the frame buffer where the P z video frame is located is 1, the value after -1 is 0, indicating that the frame buffer where the P z video frame is located can write a new reconstructed frame.
可选的,对待显示帧所在的帧缓存设置待显示标识可以是将待显示帧对应的 帧缓存的计数器+1。其中,如果确定出的待显示帧仅具有显示特征,则在可写入标识的基础上对所述待显示帧所在的帧缓存设置待显示标识。如果所述待显示帧既具有显示特征又具有参考特征,则在参考帧标识的基础上对所述待显示帧所在的帧缓存设置待显示标识。其中,特殊参考帧被确定为待显示帧时,计数器在参考帧标识的基础上+1,即取值为2;当其加入到待显示队列之后再对其计数器-1,即取值为1。Optionally, setting the to-be-displayed flag in the frame buffer where the frame to be displayed is located may be the counter of the frame buffer corresponding to the to-be-displayed frame +1. Wherein, if the determined frame to be displayed only has the display feature, the to-be-displayed flag is set for the frame buffer where the to-be-displayed frame is located on the basis of the writable flag. If the to-be-displayed frame has both the display feature and the reference feature, the to-be-displayed identifier is set for the frame buffer where the to-be-displayed frame is located on the basis of the reference frame identifier. Among them, when the special reference frame is determined to be the frame to be displayed, the counter is +1 based on the reference frame identification, that is, the value is 2; when it is added to the queue to be displayed, the counter is -1, that is, the value is 1 .
104,对设置有待显示标识的帧缓存中的所述待显示帧进行显示,如果待显示帧显示之后不再具有参考帧特征,则对相应帧缓存设置可写入标识。104. Display the to-be-displayed frame in the frame buffer set with the to-be-displayed flag. If the to-be-displayed frame no longer has the reference frame feature after being displayed, set a writable flag to the corresponding frame buffer.
图像显示调度将待显示帧的帧缓存地址和计数器取值存储于待显示队列中。可选的,待显示队列中还可以存储待显示帧的时间戳信息和编号信息。图像显示调度可以根据待显示帧的时间戳信息和编号信息,确定待显示帧的显示顺序,并根据待显示帧的显示顺序,对待显示帧进行渲染显示。可选的,图像显示调度可以按照时间戳距离当前由远及近,并且按照各个待显示帧的编号顺序进行显示。可选的,图像显示调度对待显示帧进行显示之后,则将其计数器-1。其中,如果待显示帧仅具有显示特征,则在待显示帧显示之后,其计数器-1取值变为0,其对应的帧缓存即为可写入状态。如果待显示帧既具有显示特征又具有参考帧特征,则在待显示帧显示之后,其计数器-1取值变为1。对于特殊参考帧,其显示之后计数器-1取值变为0,其对应的帧缓存即为可写入状态。图像显示调度对待显示队列中的各个待显示帧进行显示之后,可以对显示队列进行清除。The image display scheduler stores the frame buffer address and counter value of the frame to be displayed in the queue to be displayed. Optionally, timestamp information and serial number information of frames to be displayed may also be stored in the queue to be displayed. The image display scheduling may determine the display order of the to-be-displayed frames according to the timestamp information and the serial number information of the to-be-displayed frames, and render and display the to-be-displayed frames according to the display order of the to-be-displayed frames. Optionally, the image display schedule may be displayed according to the current time stamp distance from far to near, and displayed in the sequence of the numbers of the frames to be displayed. Optionally, after the to-be-displayed frame is displayed by the image display schedule, its counter is set to -1. Wherein, if the to-be-displayed frame only has display features, after the to-be-displayed frame is displayed, the value of its counter-1 becomes 0, and the corresponding frame buffer is in a writable state. If the frame to be displayed has both the display feature and the reference frame feature, after the frame to be displayed is displayed, the value of its counter-1 becomes 1. For a special reference frame, the value of counter-1 becomes 0 after it is displayed, and the corresponding frame buffer is in a writable state. After each frame to be displayed in the to-be-displayed queue is displayed by the image display schedule, the display queue can be cleared.
在一个具体示例中,系统调度创建视频解码调度和图像显示调度,并且分配共享缓存,共享缓存包括10个帧缓存,每个帧缓存设置一个计数器,计数器初始化取值为0。视频解码调度创建帧缓存队列,帧缓存队列中存储该10个帧缓存的地址和计数器取值。视频解码调度根据帧缓存队列确定计数器取值为0的帧缓存,并根据其对应的地址将当前解码输出的重建帧写入计数器为0的帧缓存。其中,如果当前解码输出的重建帧是后续解码视频帧的参考帧,则将当前重建帧所 在的帧缓存计数器+1。如果在对当前帧解码时,共享缓存已经存储有重建帧,并且已经存储的重建帧中的一个或几个不再是参考帧,但其还具有显示特征且并未显示,则对其标注特殊参考帧标识,并将其加入到待显示队列,将其计数器+1。如果共享缓存已经存储有重建帧,并且已经存储的重建帧中的一个或几个不再是参考帧,并且其不具有显示特征且或者已经显示,则将其对应的计数器-1,即其对应的计数器归0,表示可写入新的重建帧。In a specific example, the system schedule creates a video decoding schedule and an image display schedule, and allocates a shared buffer, the shared buffer includes 10 frame buffers, each frame buffer is set with a counter, and the initial value of the counter is 0. The video decoding scheduling creates a frame buffer queue, and the frame buffer queue stores the addresses and counter values of the 10 frame buffers. The video decoding scheduling determines the frame buffer whose counter value is 0 according to the frame buffer queue, and writes the reconstructed frame currently decoded and output into the frame buffer whose counter value is 0 according to its corresponding address. Wherein, if the reconstructed frame output by the current decoding is the reference frame of the subsequent decoded video frame, the frame buffer counter where the current reconstructed frame is located is +1. If, when decoding the current frame, the shared buffer has already stored reconstructed frames, and one or several of the reconstructed frames that have been stored are no longer reference frames, but they still have display features and are not displayed, they will be marked as special Refer to the frame ID, add it to the queue to be displayed, and increase its counter by 1. If the shared buffer has already stored reconstructed frames, and one or several of the reconstructed frames already stored are no longer reference frames, and they have no display feature and have been displayed, set their corresponding counters to -1, that is, their corresponding counters are set to -1. The counter returns to 0, indicating that a new reconstructed frame can be written.
如果当前解码输出的重建帧不仅是后续解码视频帧的参考帧(即具有参考帧特征)而且还被确定为待显示帧,则图像显示调度可以将其加入到待显示队列,并将其所在帧缓存的计数器+1,此时其计数器取值为2。如果当前解码输出的重建帧不具有参考帧特征,但具有显示特征并被确定为待显示帧,则图像显示调度可以将其加入到待显示队列,并将其所在帧缓存的计数器+1,此时其计数器取值为1。If the reconstructed frame output by the current decoding is not only the reference frame of the subsequent decoded video frame (that is, has the reference frame feature) but also is determined to be the frame to be displayed, the image display scheduler can add it to the to-be-displayed queue and add the frame where it is located. The cached counter is +1, and its counter value is 2 at this time. If the reconstructed frame output by the current decoding does not have the reference frame feature, but has the display feature and is determined to be the frame to be displayed, the image display scheduler can add it to the to-be-displayed queue and add 1 to the counter of the frame buffer where it is located. When the counter value is 1.
可选的,除了当前解码输出的重建帧之外,图像显示调度还可以已经缓存的其它重建帧中确定待显示帧,并将确定出的待显示帧加入待显示队列,并对其所在帧缓存的计数器+1,例如上述标注有特殊参考帧标识的重建帧。之后,如果待显示帧具有特殊参考帧标识则将其计数器-1。即,待显示队列中各待显示帧的计数器取值为1或者2。Optionally, in addition to the reconstructed frame currently output by decoding, the image display scheduler can also determine the frame to be displayed from other reconstructed frames that have been buffered, add the determined frame to be displayed to the queue to be displayed, and buffer the frame where it is located. The counter + 1, such as the above-mentioned reconstructed frame marked with a special reference frame identifier. After that, if the frame to be displayed has a special reference frame identification, its counter is -1. That is, the counter of each to-be-displayed frame in the to-be-displayed queue takes a value of 1 or 2.
图像显示调度待显示队列中的各重建帧依次进行显示,例如按照距离当前时间由远及近且编号连续的顺序,依次对待显示帧队列中的各个重建帧进行显示。并且对待显示帧队列中的重建帧显示完成之后,将其帧缓存的计数器-1。可选的,对于计数器-1归0的帧缓存,可以将其存储的重建帧删除,以支持写入新的重建帧。对于计数器-1之后为1的帧缓存,其存储的重建帧可以作为后续视频帧解码的参考帧。The image display schedules each reconstructed frame in the queue to be displayed to be displayed in sequence. For example, each reconstructed frame in the queue of to-be-displayed frames is displayed in sequence in order of distance from the current time from far to near and the numbers are consecutive. And after the reconstructed frame in the frame queue to be displayed is displayed, the counter of its frame buffer is -1. Optionally, for the frame buffer whose counter -1 returns to 0, the stored reconstructed frame can be deleted to support writing a new reconstructed frame. For a frame buffer whose counter is 1 after -1, the stored reconstructed frame can be used as a reference frame for subsequent video frame decoding.
可见,本发明实施例方案中,视频解码调度和图像显示调度共享帧缓存,视频解码调度和图像显示调度无需在解码缓存和显示缓存之间频繁拷贝数据,节约 系统缓存空间,提升系统性能。而且,本发明实施例方案对解码输出的重建帧设置状态标识,解码输出的参考帧可以实时显示,并且在显示之后可以继续作为后续视频帧解码的参考帧,降低视频帧延迟卡顿的现象。It can be seen that in the solution of the embodiment of the present invention, the video decoding scheduling and the image display scheduling share the frame buffer, and the video decoding scheduling and the image display scheduling do not need to copy data frequently between the decoding buffer and the display buffer, which saves the system buffer space and improves the system performance. Moreover, the solution of the embodiment of the present invention sets a status flag for the reconstructed frame output by decoding, and the reference frame output by decoding can be displayed in real time, and can continue to be used as the reference frame for subsequent video frame decoding after display, thereby reducing the phenomenon of video frame delay and stalling.
本发明实施例提供的共享缓存机制,能够在尽可能少的帧缓存需求下,降低视频帧的显示延迟,而且该方案能够避免内存拷贝数据带来的诸如系统带宽增加、解码耗时以及系统功耗增加等弊端,确保了系统性能,提升视频播放体验。The shared buffer mechanism provided by the embodiments of the present invention can reduce the display delay of video frames with as few frame buffer requirements as possible, and this solution can avoid system bandwidth increase, decoding time-consuming and system functions caused by copying data in memory. The disadvantages such as increased power consumption ensure the system performance and improve the video playback experience.
对应上述视频帧缓存方法,本发明实施例还提供了一种终端设备。本领域技术人员可以理解,这些终端设备均可使用市售的硬件组件通过本方案所教导的步骤进行配置来构成。Corresponding to the above video frame buffering method, an embodiment of the present invention further provides a terminal device. Those skilled in the art can understand that these terminal devices can be configured by using commercially available hardware components through the steps taught in this solution.
图5是本发明实施例提供的一种终端设备的结构示意图。如图5所示,该终端设备包括:确定模块201,用于确定共享缓存,所述共享缓存包括多个帧缓存,每个所述帧缓存均设置有状态标识。解码模块202,用于将解码输出的重建帧写入设置有可写入标识的帧缓存,并且如果所述重建帧具有参考帧特征,则对相应帧缓存设置参考帧标识。显示模块203,用于从已经缓存的所述重建帧中确定待显示帧,并对所述待显示帧所在的帧缓存设置待显示标识;对设置有待显示标识的帧缓存中的所述待显示帧进行显示,如果所述待显示帧显示之后不再具有参考帧特征,则对相应帧缓存设置可写入标识。FIG. 5 is a schematic structural diagram of a terminal device according to an embodiment of the present invention. As shown in FIG. 5 , the terminal device includes: a determination module 201, configured to determine a shared buffer, where the shared buffer includes a plurality of frame buffers, and each of the frame buffers is provided with a status identifier. The decoding module 202 is configured to write the decoded output reconstructed frame into a frame buffer provided with a writable flag, and if the reconstructed frame has a reference frame feature, set a reference frame flag to the corresponding frame buffer. The display module 203 is configured to determine the frame to be displayed from the reconstructed frame that has been buffered, and to set the to-be-displayed flag in the frame buffer where the to-be-displayed frame is located; The frame is displayed, and if the frame to be displayed no longer has the reference frame feature after being displayed, a writable flag is set for the corresponding frame buffer.
本发明实施例的终端设备可以执行图3和图4所示实施例的方法。本实施例未详细描述的部分,可以参考对图3和图4所示实施例的相关说明。该技术方案的执行过程和技术效果参见图3和图4所示实施例中的描述,在此不再赘述。The terminal device in this embodiment of the present invention may execute the methods in the embodiments shown in FIG. 3 and FIG. 4 . For parts that are not described in detail in this embodiment, reference may be made to the related descriptions of the embodiments shown in FIG. 3 and FIG. 4 . For the execution process and technical effects of the technical solution, refer to the descriptions in the embodiments shown in FIG. 3 and FIG. 4 , which will not be repeated here.
应理解,图5所示终端设备的各个模块的划分仅仅是一种逻辑功能的划分,实际实现时可以全部或部分集成到一个物理实体上,也可以物理上分开。且这些模块可以全部以软件通过处理元件调用的形式实现;也可以全部以硬件的形式实现;还可以部分模块以软件通过处理元件调用的形式实现,部分模块通过硬件的形式实现。例如,确定模块201可以为单独设立的处理元件,也可以集成在电子 设备的某一个芯片中实现。其它模块的实现与之类似。此外这些模块全部或部分可以集成在一起,也可以独立实现。在实现过程中,上述方法的各步骤或以上各个模块可以通过处理器元件中的硬件的集成逻辑电路或者软件形式的指令完成。It should be understood that the division of each module of the terminal device shown in FIG. 5 is only a division of logical functions, and may be fully or partially integrated into a physical entity in actual implementation, or may be physically separated. And these modules can all be implemented in the form of software calling through processing elements; they can also all be implemented in hardware; some modules can also be implemented in the form of software calling through processing elements, and some modules can be implemented in hardware. For example, the determination module 201 may be a separately established processing element, or may be integrated in a certain chip of the electronic device. The implementation of other modules is similar. In addition, all or part of these modules can be integrated together, and can also be implemented independently. In the implementation process, each step of the above-mentioned method or each of the above-mentioned modules can be completed by an integrated logic circuit of hardware in the processor element or an instruction in the form of software.
例如,以上这些模块可以是被配置成实施以上方法的一个或多个集成电路,例如:一个或多个特定集成电路(Application Specific Integrated Circuit;以下简称:ASIC),或,一个或多个微处理器(Digital Singnal Processor;以下简称:DSP),或,一个或者多个现场可编程门阵列(Field Programmable Gate Array;以下简称:FPGA)等。再如,这些模块可以集成在一起,以片上系统(System-On-a-Chip;以下简称:SOC)的形式实现。For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more specific integrated circuits (Application Specific Integrated Circuit; hereinafter referred to as: ASIC), or, one or more microprocessors Digital Singnal Processor (hereinafter referred to as: DSP), or, one or more Field Programmable Gate Array (Field Programmable Gate Array; hereinafter referred to as: FPGA), etc. For another example, these modules can be integrated together and implemented in the form of a system-on-a-chip (System-On-a-Chip; hereinafter referred to as: SOC).
图6是本发明实施例提供的另一种终端设备的结构示意图。如图6所示,终端设备以通用计算设备的形式表现。终端设备的组件可以包括但不限于:一个或者多个处理器310,通信接口320,存储器330,连接不同系统组件(包括存储器330、通信接口320和处理单元310)的通信总线340。FIG. 6 is a schematic structural diagram of another terminal device provided by an embodiment of the present invention. As shown in FIG. 6, the terminal device is represented in the form of a general-purpose computing device. Components of the terminal device may include, but are not limited to, one or more processors 310 , a communication interface 320 , a memory 330 , a communication bus 340 connecting different system components (including the memory 330 , the communication interface 320 and the processing unit 310 ).
通信总线340表示几类总线结构中的一种或多种,包括存储器总线或者存储器控制器,外围总线,图形加速端口,处理器或者使用多种总线结构中的任意总线结构的局域总线。举例来说,这些体系结构包括但不限于工业标准体系结构(Industry Standard Architecture;以下简称:ISA)总线,微通道体系结构(Micro Channel Architecture;以下简称:MAC)总线,增强型ISA总线、视频电子标准协会(Video Electronics Standards Association;以下简称:VESA)局域总线以及外围组件互连(Peripheral Component Interconnection;以下简称:PCI)总线。 Communication bus 340 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of a variety of bus structures. For example, these architectures include, but are not limited to, Industry Standard Architecture (hereinafter referred to as: ISA) bus, Micro Channel Architecture (hereinafter referred to as: MAC) bus, enhanced ISA bus, video electronics Standards Association (Video Electronics Standards Association; hereinafter referred to as: VESA) local bus and Peripheral Component Interconnection (Peripheral Component Interconnection; hereinafter referred to as: PCI) bus.
电子设备典型地包括多种计算机系统可读介质。这些介质可以是任何能够被电子设备访问的可用介质,包括易失性和非易失性介质,可移动的和不可移动的介质。Electronic devices typically include various computer system readable media. These media can be any available media that can be accessed by the electronic device, including both volatile and nonvolatile media, removable and non-removable media.
存储器330可以包括易失性存储器形式的计算机系统可读介质,例如随机存取存储器(Random Access Memory;以下简称:RAM)和/或高速缓存存储器。 电子设备可以进一步包括其它可移动/不可移动的、易失性/非易失性计算机系统存储介质。存储器330可以包括至少一个程序产品,该程序产品具有一组(例如至少一个)程序模块,这些程序模块被配置以执行本说明书图3和图4所示实施例的功能。The memory 330 may include a computer system-readable medium in the form of volatile memory, such as random access memory (Random Access Memory; hereinafter referred to as: RAM) and/or cache memory. The electronic device may further include other removable/non-removable, volatile/non-volatile computer system storage media. The memory 330 may include at least one program product having a set (eg, at least one) of program modules configured to perform the functions of the embodiments shown in FIGS. 3 and 4 of the present specification.
具有一组(至少一个)程序模块的程序/实用工具,可以存储在存储器330中,这样的程序模块包括——但不限于——操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。程序模块通常执行本说明书所描述的实施例中的功能和/或方法。A program/utility having a set (at least one) of program modules that may be stored in memory 330, such program modules including, but not limited to, an operating system, one or more application programs, other program modules, and program data , each or some combination of these examples may include an implementation of a network environment. Program modules typically perform the functions and/or methods of the embodiments described in this specification.
处理器310通过运行存储在存储器330中的程序,从而执行各种功能应用以及数据处理,例如实现本说明书图3~图4所示实施例提供的视频帧缓存方法。The processor 310 executes various functional applications and data processing by running the programs stored in the memory 330 , for example, implementing the video frame buffering method provided by the embodiments shown in FIGS. 3 to 4 of this specification.
具体实现中,本申请还提供一种计算机存储介质,其中,该计算机存储介质可存储有程序,该程序执行时可包括本申请提供的各实施例中的部分或全部步骤。所述的存储介质可为磁碟、光盘、只读存储记忆体(英文:read-only memory,简称:ROM)或随机存储记忆体(英文:random access memory,简称:RAM)等。In a specific implementation, the present application further provides a computer storage medium, wherein the computer storage medium can store a program, and when the program is executed, it can include some or all of the steps in the various embodiments provided in the present application. The storage medium may be a magnetic disk, an optical disk, a read-only memory (English: read-only memory, abbreviated as: ROM) or a random access memory (English: random access memory, abbreviated as: RAM) and the like.
具体实现中,本发明实施例还提供了一种计算机程序产品,所述计算机程序产品包含可执行指令,当所述可执行指令在计算机上执行时,使得计算机执行上述方法实施例中的部分或全部步骤。In a specific implementation, an embodiment of the present invention further provides a computer program product, where the computer program product includes executable instructions, and when the executable instructions are executed on a computer, causes the computer to execute part or some of the above method embodiments. all steps.
本发明实施例中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示单独存在A、同时存在A和B、单独存在B的情况。其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项”及其类似表达,是指的这些项中的任意组合,包括单项或复数项的任意组合。例如,a,b和c中的至少一项可以表示:a,b,c,a-b,a-c,b-c,或a-b-c,其中a,b,c可以是单个,也可以是多个。In the embodiments of the present invention, "at least one" refers to one or more, and "multiple" refers to two or more. "And/or", which describes the association relationship of the associated objects, means that there can be three kinds of relationships, for example, A and/or B, which can indicate the existence of A alone, the existence of A and B at the same time, and the existence of B alone. where A and B can be singular or plural. The character "/" generally indicates that the associated objects are an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, and c may represent: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, c may be single or multiple.
本领域普通技术人员可以意识到,本文中公开的实施例中描述的各单元及算 法步骤,能够以电子硬件、计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those of ordinary skill in the art can realize that the units and algorithm steps described in the embodiments disclosed herein can be implemented by a combination of electronic hardware, computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of the present invention.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described systems, devices and units may refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.
在本发明所提供的几个实施例中,任一功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,简称ROM)、随机存取存储器(random access memory,简称RAM)、磁碟或者光盘等各种可以存储程序代码的介质。In the several embodiments provided by the present invention, if any function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention can be embodied in the form of a software product in essence, or the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM for short), random access memory (RAM for short), magnetic disk or CD, etc. that can store program codes medium.
以上所述,仅为本发明的具体实施方式,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。本发明的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present invention. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included within the protection scope of the present invention. The protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (12)

  1. 一种视频帧缓存方法,其特征在于,包括:A video frame buffering method, comprising:
    确定共享缓存,所述共享缓存包括多个帧缓存,每个所述帧缓存均设置有状态标识;determining a shared buffer, the shared buffer includes a plurality of frame buffers, and each of the frame buffers is provided with a status identifier;
    将解码输出的重建帧写入设置有可写入标识的帧缓存,并且如果所述重建帧具有参考帧特征,则对相应帧缓存设置参考帧标识;Write the decoded output reconstructed frame into a frame buffer that is provided with a writable identifier, and if the reconstructed frame has a reference frame feature, then set a reference frame identifier to the corresponding frame buffer;
    从已经缓存的所述重建帧中确定待显示帧,并对所述待显示帧所在的帧缓存设置待显示标识;Determine the frame to be displayed from the reconstructed frame that has been buffered, and set a to-be-displayed flag for the frame buffer where the frame to be displayed is located;
    对设置有待显示标识的帧缓存中的所述待显示帧进行显示,如果所述待显示帧显示之后不再具有参考帧特征,则对相应帧缓存设置可写入标识。The to-be-displayed frame in the frame buffer set with the to-be-displayed flag is displayed, and if the to-be-displayed frame no longer has the reference frame feature after being displayed, a writable flag is set to the corresponding frame buffer.
  2. 根据权利要求1所述的方法,其特征在于,所述共享缓存包括的帧缓存个数是根据待播放视频流的参考帧个数和缓冲帧个数确定的。The method according to claim 1, wherein the number of frame buffers included in the shared buffer is determined according to the number of reference frames and the number of buffered frames of the video stream to be played.
  3. 根据权利要求1或2所述的方法,其特征在于,每个所述帧缓存均设置有状态标识,包括:The method according to claim 1 or 2, wherein each of the frame buffers is provided with a status identifier, comprising:
    每个所述帧缓存均设置有计数器,所述计数器的取值用于作为对应帧缓存的状态标识。Each of the frame buffers is provided with a counter, and the value of the counter is used as a state identifier of the corresponding frame buffer.
  4. 根据权利要求1所述的方法,其特征在于,所述方法还包括:创建帧缓存队列,所述帧缓存队列用于存储所述共享缓存中各个帧缓存的状态标识信息;The method according to claim 1, wherein the method further comprises: creating a frame buffer queue, and the frame buffer queue is used to store the status identification information of each frame buffer in the shared buffer;
    将解码输出的重建帧写入设置有可写入标识的帧缓存,包括:Write the decoded output reconstructed frame to the framebuffer with writable flag, including:
    根据所述帧缓存队列存储的所述各个帧缓存的状态标识信息,确定设置有可写入标识的帧缓存,其中,所述设置有可写入标识的帧缓存用于写入解码输出的重建帧。According to the state identification information of the respective frame buffers stored in the frame buffer queue, determine the frame buffers provided with the writable flags, wherein the frame buffers provided with the writeable flags are used for the reconstruction of the write decoding output frame.
  5. 根据权利要求1所述的方法,其特征在于,从已经缓存的所述重建帧中确定待显示帧,包括:The method according to claim 1, wherein determining the frame to be displayed from the reconstructed frames that have been buffered comprises:
    如果当前解码输出的重建帧仅具有显示特征,则将当前解码输出的重建帧确定为待显示帧,并在可写入标识的基础上对相应帧缓存设置待显示标识;If the reconstructed frame output by the current decoding only has the display feature, then the reconstructed frame output by the current decoding is determined as the frame to be displayed, and the corresponding frame buffer is set on the basis of the writable mark. The mark to be displayed is set;
    如果当前解码输出的重建帧既具有参考帧特征又具有显示特征,则将当前解码输出的重建帧确定为待显示帧,并在参考帧标识的基础上对相应帧缓存设置待显示标识。If the reconstructed frame output by the current decoding has both the reference frame feature and the display feature, the reconstructed frame output by the current decoding is determined as the frame to be displayed, and the to-be-displayed flag is set for the corresponding frame buffer based on the reference frame flag.
  6. 根据权利要求5所述的方法,其特征在于,从已经缓存的所述重建帧中确定待显示帧,还包括:The method according to claim 5, wherein determining the frame to be displayed from the reconstructed frames that have been buffered, further comprising:
    除当前解码输出的重建帧之外,如果已经设置有参考帧标识的至少一个帧缓存中的重建帧不再具有参考帧特征,并且具有显示特征且还未显示,则将相应重建帧确定为待显示帧,并将相应帧缓存的参考帧标识设置为待显示标识;In addition to the reconstructed frame currently decoded and output, if the reconstructed frame in at least one frame buffer that has been set with the reference frame identifier no longer has the reference frame feature, and has the display feature and has not yet been displayed, the corresponding reconstructed frame is determined to be pending Display the frame, and set the reference frame ID of the corresponding frame buffer as the ID to be displayed;
    除当前解码输出的重建帧之外,如果已经设置有参考帧标识的至少一个帧缓存中的重建帧不再具有参考帧标识,并且已经显示或者不具有显示特征,则将相应帧缓存的参考帧标识设置为可写入标识。In addition to the reconstructed frame output by the current decoding, if the reconstructed frame in at least one frame buffer that has been set with a reference frame identifier no longer has a reference frame identifier, and has been displayed or has no display feature, the reference frame of the corresponding frame buffer The ID is set to writable ID.
  7. 根据权利要求1、5或6所述的方法,其特征在于,所述方法还包括:The method according to claim 1, 5 or 6, wherein the method further comprises:
    创建待显示队列,所述待显示队列用于存储所述待显示帧的待显示标识信息。A queue to be displayed is created, and the queue to be displayed is used to store the to-be-displayed identification information of the to-be-displayed frame.
  8. 根据权利要求7所述的方法,其特征在于,所述待显示队列还用于存储所述待显示帧的时间戳信息和编号信息;对所述待显示帧进行显示,包括:The method according to claim 7, wherein the queue to be displayed is further used to store timestamp information and number information of the to-be-displayed frame; displaying the to-be-displayed frame includes:
    根据所述待显示帧的时间戳信息和编号信息,确定所述待显示帧的显示顺序,并根据所述待显示帧的显示顺序,对所述待显示帧进行显示。The display order of the to-be-displayed frames is determined according to the timestamp information and the serial number information of the to-be-displayed frames, and the to-be-displayed frames are displayed according to the display order of the to-be-displayed frames.
  9. 根据权利要求8所述的方法,其特征在于,如果所述待显示帧显示之后不再具有参考帧特征,则对相应帧缓存设置可写入标识,包括:The method according to claim 8, wherein if the to-be-displayed frame no longer has the reference frame feature after being displayed, setting a writable flag to the corresponding frame buffer, comprising:
    如果所述待显示帧仅具有显示特征,则在待显示帧显示之后,将待显示标识设置为可写入标识;If the to-be-displayed frame only has display features, then after the to-be-displayed frame is displayed, the to-be-displayed identification is set as a writable identification;
    如果所述待显示帧既具有显示特征又具有参考特征,则在待显示帧显示 之后,将待显示标识设置为参考帧标识,之后将参考帧标识设置为待写入标识。If the frame to be displayed has both the display feature and the reference feature, then after the frame to be displayed is displayed, the marker to be displayed is set as the reference frame marker, and then the reference frame marker is set as the marker to be written.
  10. 一种终端设备,其特征在于,包括:A terminal device, characterized in that it includes:
    确定模块,用于确定共享缓存,所述共享缓存包括多个帧缓存,每个所述帧缓存均设置有状态标识;a determining module, configured to determine a shared buffer, the shared buffer includes a plurality of frame buffers, and each of the frame buffers is provided with a state identifier;
    解码模块,用于将解码输出的重建帧写入设置有可写入标识的帧缓存,并且如果所述重建帧具有参考帧特征,则对相应帧缓存设置参考帧标识;A decoding module for writing the decoded output reconstructed frame into a frame buffer that is provided with a writable identifier, and if the reconstructed frame has a reference frame feature, then a reference frame identifier is set to the corresponding frame buffer;
    显示模块,用于从已经缓存的所述重建帧中确定待显示帧,并对所述待显示帧所在的帧缓存设置待显示标识;对设置有待显示标识的帧缓存中的所述待显示帧进行显示,如果所述待显示帧显示之后不再具有参考帧特征,则对相应帧缓存设置可写入标识。A display module, configured to determine a frame to be displayed from the reconstructed frame that has been cached, and set a to-be-displayed mark in the frame buffer where the to-be-displayed frame is located; set the to-be-displayed frame in the frame buffer where the to-be-displayed mark is set The display is performed, and if the frame to be displayed no longer has the reference frame feature after being displayed, a writable flag is set for the corresponding frame buffer.
  11. 一种终端设备,其特征在于,包括:A terminal device, characterized in that it includes:
    至少一个处理器;以及at least one processor; and
    与所述处理器通信连接的至少一个存储器,其中:at least one memory communicatively coupled to the processor, wherein:
    所述存储器存储有可被所述处理器执行的程序指令,所述处理器调用所述程序指令以执行如权利要求1至9任一项所述的方法。The memory stores program instructions executable by the processor, which are invoked by the processor to perform a method as claimed in any one of claims 1 to 9.
  12. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质包括存储的程序,其中,在所述程序运行时控制所述计算机可读存储介质所在设备执行权利要求1至9任一所述的方法。A computer-readable storage medium, characterized in that the computer-readable storage medium comprises a stored program, wherein when the program is run, a device where the computer-readable storage medium is located is controlled to execute any one of claims 1 to 9 the method described.
PCT/CN2022/079575 2021-03-08 2022-03-07 Video frame caching method, and device WO2022188753A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110249758.9A CN113015003B (en) 2021-03-08 2021-03-08 Video frame caching method and device
CN202110249758.9 2021-03-08

Publications (1)

Publication Number Publication Date
WO2022188753A1 true WO2022188753A1 (en) 2022-09-15

Family

ID=76408000

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/079575 WO2022188753A1 (en) 2021-03-08 2022-03-07 Video frame caching method, and device

Country Status (2)

Country Link
CN (1) CN113015003B (en)
WO (1) WO2022188753A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113015003B (en) * 2021-03-08 2022-11-25 展讯通信(上海)有限公司 Video frame caching method and device
CN115733987A (en) * 2021-08-30 2023-03-03 华为技术有限公司 Encoding and decoding method, encoder, decoder and electronic equipment
CN115802095B (en) * 2023-01-06 2023-04-18 北京象帝先计算技术有限公司 Video streaming device, system, equipment and video streaming method

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1652605A (en) * 2003-12-30 2005-08-10 三星电子株式会社 Video codecs, data processing systems and methods for the same
CN101729893A (en) * 2008-08-15 2010-06-09 北京北大众志微系统科技有限责任公司 MPEG multi-format compatible decoding method based on software and hardware coprocessing and device thereof
US20110096833A1 (en) * 2009-10-22 2011-04-28 Sony Computer Entertainment Inc. Software video decoder display buffer underflow prediction and recovery
US20140003525A1 (en) * 2012-06-29 2014-01-02 Cisco Technology, Inc. Video encoder/decoder, method and computer program product that process tiles of video data
CN106921862A (en) * 2014-04-22 2017-07-04 联发科技股份有限公司 Multi-core decoder system and video encoding/decoding method
US20190147854A1 (en) * 2017-11-16 2019-05-16 Microsoft Technology Licensing, Llc Speech Recognition Source to Target Domain Adaptation
CN113015003A (en) * 2021-03-08 2021-06-22 展讯通信(上海)有限公司 Video frame caching method and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105657540B (en) * 2016-01-05 2019-02-22 珠海全志科技股份有限公司 A kind of video encoding/decoding method and its device being adapted to Android system
CN107222779B (en) * 2017-06-08 2019-11-19 浙江大华技术股份有限公司 A kind of method and device of video play-reverse
CN111787330B (en) * 2020-06-16 2022-03-08 眸芯科技(上海)有限公司 Coding method supporting decoding compression frame buffer self-adaptive distribution and application
CN111953992A (en) * 2020-07-07 2020-11-17 西安万像电子科技有限公司 Decoding method and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1652605A (en) * 2003-12-30 2005-08-10 三星电子株式会社 Video codecs, data processing systems and methods for the same
CN101729893A (en) * 2008-08-15 2010-06-09 北京北大众志微系统科技有限责任公司 MPEG multi-format compatible decoding method based on software and hardware coprocessing and device thereof
US20110096833A1 (en) * 2009-10-22 2011-04-28 Sony Computer Entertainment Inc. Software video decoder display buffer underflow prediction and recovery
US20140003525A1 (en) * 2012-06-29 2014-01-02 Cisco Technology, Inc. Video encoder/decoder, method and computer program product that process tiles of video data
CN106921862A (en) * 2014-04-22 2017-07-04 联发科技股份有限公司 Multi-core decoder system and video encoding/decoding method
US20190147854A1 (en) * 2017-11-16 2019-05-16 Microsoft Technology Licensing, Llc Speech Recognition Source to Target Domain Adaptation
CN113015003A (en) * 2021-03-08 2021-06-22 展讯通信(上海)有限公司 Video frame caching method and device

Also Published As

Publication number Publication date
CN113015003A (en) 2021-06-22
CN113015003B (en) 2022-11-25

Similar Documents

Publication Publication Date Title
WO2022188753A1 (en) Video frame caching method, and device
US10223122B2 (en) Managing event count reports in a tile-based architecture
US9342857B2 (en) Techniques for locally modifying draw calls
US20140168242A1 (en) Techniques for setting up and executing draw calls
US10147222B2 (en) Multi-pass rendering in a screen space pipeline
US9293109B2 (en) Technique for storing shared vertices
US8949554B2 (en) Idle power control in multi-display systems
US20130117631A1 (en) Error detection and correction for external dram
US9418616B2 (en) Technique for storing shared vertices
US20120221795A1 (en) Shared memory system and control method therefor
US20150206596A1 (en) Managing a ring buffer shared by multiple processing engines
US10430989B2 (en) Multi-pass rendering in a screen space pipeline
CN110708609A (en) Video playing method and device
US10453243B2 (en) Primitive level preemption using discrete non-real-time and real time pipelines
US8190974B2 (en) Error detection and correction for external DRAM
JP2021501938A (en) Index compression and decompression in the graphics pipeline
CN111080761B (en) Scheduling method and device for rendering tasks and computer storage medium
CN113473226B (en) Method and device for improving video rendering efficiency, computer equipment and storage medium
US11614889B2 (en) Aggregating commands in a stream based on cache line addresses
CN111831404A (en) High performance inline ECC architecture for DRAM controllers
US20190325639A1 (en) Compact visibility state for gpus compatible with hardware instancing
US20220391264A1 (en) Techniques for efficiently synchronizing multiple program threads
CN115209216A (en) Video playing method and device and electronic equipment
US20150089284A1 (en) Approach to reducing voltage noise in a stalled data pipeline
US8694697B1 (en) Rescindable instruction dispatcher

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22766276

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22766276

Country of ref document: EP

Kind code of ref document: A1