Method and apparatus for loading video tracks
By preloading video frame identifiers and storage addresses using a fast table, combined with dynamic adjustments to memory and virtual memory, the problems of memory pressure and disk I/O bottlenecks in high-resolution video processing are solved, improving the loading speed of video track sliding and the user experience.
Patent Information
- Application Number
- CN202411874872.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2044-12-18
AI Technical Summary
In high-resolution video processing, existing technologies suffer from excessive memory pressure, disk I/O bottlenecks, and loading delays, which negatively impact user experience, especially when the video track is scrolling.
The system uses a fast table to preload the frame identifier and frame storage address of video frames, quickly retrieves the target video frame through a secondary memory lookup, and dynamically adjusts the data storage between memory and virtual memory to reduce frequent disk I/O operations.
It effectively reduces memory storage pressure, decreases disk I/O operations, and improves loading speed and user experience during video track scrolling.
Smart Images

Figure CN119729101B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, specifically to a method and apparatus for loading video tracks. Background Technology
[0002] With the continuous increase in video resolution (such as 4K and 8K video), the memory and disk I / O requirements during video editing and playback have increased significantly. Real-time loading of video frame data becomes a major challenge in high-resolution video processing, especially during track scrolling. Existing video frame loading methods typically suffer from the following problems:
[0003] 1. Excessive memory pressure: Due to the large amount of video frame data, directly loading all frames into memory may cause memory overflow, especially when processing high-resolution video and multi-track video.
[0004] 2. Disk I / O bottleneck: Frequent disk I / O operations can cause loading delays, especially during video track scrolling. If a new video frame needs to be loaded from the disk for each scroll, it will seriously affect the user experience.
[0005] 3. Loading delay: Due to the huge amount of data in video frames, the existing loading strategy may cause loading delay, especially when the user slides the track quickly, which takes time to load frame data and will cause playback stuttering. Summary of the Invention
[0006] In view of the above problems, embodiments of this application are proposed to provide a method and apparatus for loading video tracks that overcomes or at least partially solves the above problems.
[0007] According to a first aspect of the embodiments of this application, a method for loading a video track is provided, comprising:
[0008] The frame identifier of the target video frame is determined based on the sliding position of the video track;
[0009] Based on the frame identifier, a secondary memory lookup is performed on the TLB to determine if a frame storage address corresponding to the frame identifier exists in the TLB; the TLB preloads the frame identifiers of video frames and their corresponding frame storage addresses; secondary memory includes physical memory and virtual memory;
[0010] If so, retrieve the corresponding target video frame from memory based on the frame storage address and return it;
[0011] If not, asynchronously load the target video frame from the disk into memory, update the TLB according to the frame storage address in memory, and return the target video frame.
[0012] Optionally, before performing a second-level memory lookup of the TLB based on the frame identifier, the method further includes:
[0013] Based on the sliding information of the video track, predict the video frame to be viewed;
[0014] Load the video frame to be viewed into memory, and determine the frame identifier and corresponding memory frame storage address of the video frame to be viewed;
[0015] Store the frame identifier and the corresponding memory frame storage address in the TLB.
[0016] Optionally, predicting the video frame to be viewed based on the sliding information of the video track further includes:
[0017] The predicted sliding position of the video track is determined based on the sliding direction and speed of the track, and the video frame to be viewed is determined based on the predicted sliding position.
[0018] And / or, determine the video frame to be viewed based on the current sliding position of the track; the video frame to be viewed contains a preset number of video frames.
[0019] Optionally, loading the video frame to be viewed into memory, and determining the frame identifier and corresponding memory frame storage address of the video frame to be viewed further includes:
[0020] Determine if the number of video frames already stored in memory has reached the preset memory storage limit; the preset memory storage limit is dynamically adjusted based on memory usage information.
[0021] If not, load the video frame to be viewed into memory and determine the frame identifier and corresponding memory frame storage address of the video frame to be viewed;
[0022] If so, swap the video frames already stored in memory to virtual memory, load the video frame to be viewed into memory, and determine the frame identifier and corresponding memory frame storage address of the video frame to be viewed.
[0023] Optionally, swapping video frames already stored in memory to virtual memory further includes:
[0024] The video frames already stored in memory are used as swapped video frames. They are sorted by storage time, and the swapped video frames with the longest storage time are swapped and stored in virtual memory in turn until the video frames to be viewed are stored in memory.
[0025] The frame identifiers of the swapped video frames and their corresponding virtual memory frame storage addresses are stored in the TLB (Translation Lookaside Buffer).
[0026] Optionally, the frame storage address includes the memory frame storage address and / or the virtual memory frame storage address;
[0027] Based on the frame identifier, a secondary memory lookup is performed on the TLB to determine whether a frame storage address corresponding to the frame identifier exists in the TLB. This further includes:
[0028] Based on the frame identifier, determine whether there is a memory frame storage address in the TLB that corresponds to the frame identifier;
[0029] If so, obtain the memory frame storage address;
[0030] If not, determine whether a virtual memory frame storage address corresponding to the frame identifier exists in the TLB based on the frame identifier;
[0031] If so, obtain the virtual memory frame storage address;
[0032] Retrieving the corresponding target video frame from memory based on the frame storage address and returning it further includes:
[0033] If the frame storage address is the memory frame storage address, retrieve the corresponding video frame based on the memory frame storage address and return it.
[0034] If the frame storage address is the virtual memory frame storage address, locate the target video frame according to the virtual memory frame storage address, load the target video frame into memory, update the TLB according to the memory frame storage address, and return the target video frame.
[0035] Optionally, the method further includes:
[0036] Monitor whether the memory meets the preset memory swapping conditions; the preset memory swapping conditions are determined based on memory usage information.
[0037] If so, video frames that meet the preset frame swapping conditions will be swapped and stored in virtual memory; the preset frame swapping conditions are determined based on the historical access frequency of the video frames and / or the memory storage time.
[0038] According to a second aspect of the embodiments of this application, an apparatus for loading video tracks is provided, comprising:
[0039] The frame identifier determination module is adapted to determine the frame identifier of the target video frame based on the sliding position of the video track;
[0040] The lookup module is suitable for performing a secondary memory lookup on the TLB based on the frame identifier to determine whether the TLB contains a frame storage address corresponding to the frame identifier; the TLB preloads the frame identifiers of video frames and their corresponding frame storage addresses; the secondary memory includes physical memory and virtual memory;
[0041] The memory return module is suitable for retrieving the corresponding target video frame from memory and returning it if the lookup module determines that a frame storage address corresponding to the frame identifier exists;
[0042] The disk return module is suitable for asynchronously loading the target video frame from the disk into memory if the lookup module determines that there is no frame storage address corresponding to the frame identifier, updating the TLB according to the frame storage address in memory, and returning the target video frame.
[0043] According to a third aspect of the embodiments of this application, a computing device is provided, including: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other through the communication bus;
[0044] The memory is used to store at least one executable instruction that causes the processor to perform the operation corresponding to the above-described method for loading video tracks.
[0045] According to a fourth aspect of the present application, a computer storage medium is provided, the storage medium storing at least one executable instruction that causes a processor to perform operations corresponding to the above-described method for loading video tracks.
[0046] According to a fifth aspect of the present application, a computer program product is provided, including at least one executable instruction that causes a processor to perform operations corresponding to the above-described method for loading video tracks.
[0047] According to the method and apparatus for loading video tracks provided in this application, the TLB preloads and stores frame identifiers and frame storage addresses, allowing for quick location and retrieval of the target video frame for return by looking up the TLB. The TLB can employ two-level memory storage, enabling dynamic adjustment of data storage between memory and disk virtual memory, thus reducing memory storage pressure and frequent disk I / O operations.
[0048] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0049] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0050] Figure 1 A flowchart of a method for loading a video track according to an embodiment of this application is shown;
[0051] Figure 2 A flowchart of a method for loading a video track according to another embodiment of this application is shown;
[0052] Figure 3 A schematic diagram of a device for loading a video track according to an embodiment of this application is shown;
[0053] Figure 4 A schematic diagram of the structure of a computing device according to an embodiment of this application is shown. Detailed Implementation
[0054] Exemplary embodiments of the present application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the scope of the present application to those skilled in the art.
[0055] First, the terms and concepts involved in one or more embodiments of this application will be explained.
[0056] Video Track: A linear data stream composed of video frame data, used to represent the content of a video. During video editing or playback, the video track stores multiple video frames, each typically representing a single image from the video.
[0057] Video frame: A video frame is the basic unit in a video, representing a still image during video playback. A video consists of several consecutive video frames, played at regular time intervals to produce dynamic effects.
[0058] Track Scrubbing: During video playback or editing, track scrubbing refers to a user's ability to quickly browse video content by adjusting the playback progress bar. Track scrubbing typically requires the system to load video frames in real time and display them in the editor or player.
[0059] Lookup Table (LUT): A lookup table is a data structure used to cache video frame indexes or preload information, typically to accelerate data access.
[0060] Virtual memory is a technique used by operating systems to expand the capacity of physical memory by storing some data on the hard drive to avoid memory shortages. Using virtual memory requires a swapping mechanism to move infrequently used data from memory to the hard drive.
[0061] Memory swapping: Memory swapping refers to the operating system exchanging infrequently used data or pages from memory to the hard drive, thereby freeing up memory space. In video playback or editing, memory swapping is used to dynamically load video frame data.
[0062] Frame-by-frame loading: Frame-by-frame loading refers to the process of loading and displaying video frames gradually as needed during video playback or editing, based on the user's scrolling operation and the current playback progress.
[0063] Figure 1 A flowchart of a method for loading a video track according to an embodiment of this application is shown, as follows: Figure 1 As shown, the method includes the following steps:
[0064] Step S101: Determine the frame identifier of the target video frame based on the sliding position of the video track.
[0065] A video is composed of multiple video frames, each with a unique frame identifier, determined by the order of the video frames on the video track. For example, if a video contains 1000 video frames, the frame identifiers can range from 1 to 1000, following the order on the video track.
[0066] When editing a video, the editor needs to load video frames into the editor. This embodiment uses a frame-by-frame loading method, which avoids loading all video frames into memory at once, reducing memory storage pressure. During frame-by-frame loading, the frame identifier of the target video frame is first determined based on the sliding position of the video track, so that the target video frame stored in memory can be obtained according to the frame identifier.
[0067] Step S102: Based on the frame identifier, perform a secondary memory lookup in the TLB to determine whether there is a frame storage address in the TLB that corresponds to the frame identifier.
[0068] The TLB (Time Limit List) is stored in memory and includes frame identifiers and their corresponding frame storage addresses. It can be stored as key-value pairs, such as frame identifier 01 - frame storage address 0x0100, frame identifier 02 - frame storage address 0x0200, etc. The frame storage address can be a memory frame storage address. By looking up the TLB using the frame identifier, the frame storage address of the target video frame can be quickly located, thus allowing the acquisition of the target video frame.
[0069] The TLB stores video frames preloaded into memory. Based on the frame identifier of the video frame loaded into memory and its memory storage address, the video frame can be preloaded into the TLB. The TLB stores the frame identifier and the corresponding memory storage address of the video frame, manages the fast access path of the video frame, and optimizes the loading process of the video frame.
[0070] Based on the frame identifier of the target video frame, a secondary memory lookup is performed on the TLB to determine if a frame storage address corresponding to the frame identifier exists in the TLB, so that the target video frame can be quickly read from memory and returned to the editor. Here, secondary memory includes physical memory and virtual memory. Virtual memory can expand the physical memory capacity, and dynamic video frame storage can be swapped between physical and virtual memory through memory swapping. Accordingly, the frame storage address recorded in the TLB can be either a physical memory frame storage address or a virtual memory frame storage address. By searching for the frame identifier stored in the TLB, the corresponding frame storage address is found. If it exists, step S103 is executed to obtain the corresponding target video frame. If it does not exist, it means that the target video frame is not stored in either physical memory or virtual memory, and it needs to be read from the disk, and step S104 is executed.
[0071] Step S103: Retrieve the corresponding target video frame from memory based on the frame storage address and return it.
[0072] Once the TLB is searched and the frame storage address corresponding to the frame identifier is found, the corresponding target video frame can be obtained based on the frame storage address and returned to the editor for display.
[0073] The frame storage address can be either a memory frame storage address or a virtual memory frame storage address. If it's a memory frame storage address, the corresponding target video frame can be directly retrieved from memory and returned. If it's a virtual memory frame storage address, memory swapping can be used to locate the target video frame stored in virtual memory, load it into memory, and return the target video frame while updating the TLB based on the new memory frame storage address. Since the video track has moved to the target video frame, it indicates that the target video frame is a recently viewed video frame. Loading the target video frame into memory allows for quick retrieval of the target video frame when the video track moves forward or backward in subsequent movements.
[0074] Furthermore, to avoid virtual memory swapping conflicts, such as frequent swapping between virtual memory and main memory which may result in longer loading times and affect the smoothness of video playback, this embodiment only performs memory swapping when the video frames to be loaded are stored in virtual memory, thus avoiding virtual memory swapping conflicts.
[0075] Step S104: Asynchronously load the target video frame from the disk into memory, update the TLB according to the frame storage address in memory, and return the target video frame.
[0076] When a lookup in the TLB (Translation Lookup List) determines that the frame identifier corresponding to the frame's storage address does not exist, since a two-level memory lookup is used, it indicates that the target video frame is not stored in either main memory or virtual memory. Therefore, it needs to be searched for on disk. To speed up the loading of the target video frame, an asynchronous method can be used to load the target video frame from disk into memory and return it to the editor. The TLB is then updated based on the frame identifier and the frame's storage address in memory, facilitating subsequent fast frame lookups based on the TLB.
[0077] When the editor initially displays video frames, a portion of the video frames can be preloaded into memory. The time table (TLB) is then updated based on the memory frame storage addresses, facilitating quick location and retrieval of video frames. Preloading only a portion of the video frames into memory avoids overloading all frames and thus reducing memory pressure. As the video track slides, video frames stored in memory can be swapped to virtual memory. When needed, they can be loaded from virtual memory back into memory via swapping, minimizing frequent disk I / O operations.
[0078] According to the method for loading video tracks provided in this application, the TLB preloads the frame identifier and frame storage address, allowing for quick location and retrieval of the target video frame for return by looking up the TLB. The TLB can employ two-level memory storage, dynamically adjusting data storage between memory and disk virtual memory, thus reducing memory storage pressure and frequent disk I / O operations.
[0079] Figure 2 A flowchart of a method for loading a video track according to an embodiment of this application is shown, as follows: Figure 2 As shown, the method includes the following steps:
[0080] Step S201: Predict the video frame to be viewed based on the sliding information of the video track.
[0081] To reduce video frame access latency during video track sliding, the subsequent video frames to be viewed can be predicted based on the video track sliding information, so that the video frames to be viewed can be pre-loaded into memory for fast access later.
[0082] When predicting the video frame to be viewed, the predicted sliding position of the video track can be determined based on the sliding direction and speed. Based on the predicted sliding position, the video frame to be viewed can be identified. For example, when sliding the video track to the right, the predicted sliding position is determined to be at position xx on the right side of the video track based on the sliding speed and behavioral patterns. The frame identifier corresponding to the video track can then be determined, thus identifying the video frame to be viewed. Alternatively, the frame identifier at the current sliding position of the track can be determined, and the video frame to be viewed following that frame identifier can be identified. The video frames to be viewed include a preset number of video frames, such as the next 50 frames to be viewed.
[0083] Step S202: Load the video frame to be viewed into memory, determine the frame identifier and the corresponding memory frame storage address of the video frame to be viewed, and store the frame identifier and the corresponding memory frame storage address into the TLB.
[0084] After identifying the video frames to be viewed, they can be loaded into memory. To reduce memory storage pressure during loading, a preset memory storage amount can be set to avoid loading all video frames into memory. The preset memory storage amount can also be dynamically adjusted based on memory usage information; when there is ample free memory, the preset memory storage amount can be increased, and when memory storage space is limited, the preset memory storage amount can be decreased.
[0085] During loading, the system first checks if the number of video frames already stored in memory has reached the preset memory storage limit. If not, meaning memory can still store more video frames, the video frames to be viewed are loaded into memory sequentially. After loading, the frame identifier and corresponding memory storage address of each video frame to be viewed are determined. The check can be performed after each video frame is loaded to facilitate sequential storage. Alternatively, the total number of video frames to be loaded and the number of video frames already stored in memory can be compared with the preset memory storage limit. If the total number does not exceed the preset memory storage limit, the video frames to be viewed can be stored directly. If the number of video frames already stored in memory reaches the preset memory storage limit, or if the total number of video frames to be loaded and the number of video frames already stored in memory exceeds the preset memory storage limit, meaning memory cannot store all the video frames to be viewed, the video frames already stored in memory need to be swapped to virtual memory before loading the video frames to be viewed into memory, and the frame identifier and corresponding memory storage address of each video frame to be viewed are determined.
[0086] During swapping, video frames already stored in memory can be used as swap frames. They are sorted by storage time, and the oldest swap frames are sequentially swapped to virtual memory. For example, if the video frames already stored in memory include frame 01, frame 02, frame 03… frame 50, and the video frames to be viewed include frame 51, frame 52, frame 53… frame 60, then, sorted by storage time, frame 01 (the oldest) is swapped to virtual memory, frame 51 is stored in memory, then frame 02 is swapped to virtual memory, frame 52 is stored in memory, and so on, until all the video frames to be viewed are stored in memory. The oldest swap frames have a lower probability of being displayed again, so they are swapped to virtual memory. The video frames stored in virtual memory are mostly those far from the frame identifier corresponding to the current video track position, or those that are rarely used.
[0087] Based on the frame identifier and corresponding memory frame storage address of the video frame to be viewed, it can be recorded in the TLB. At the same time, the frame identifier and corresponding virtual memory frame storage address of the swapped video frame are also stored in the TLB. That is, the frame identifier and memory frame storage address of the swapped video frame originally stored in the TLB need to be updated to the frame identifier and corresponding virtual memory frame storage address of the swapped video frame.
[0088] Step S203: Determine the frame identifier of the target video frame based on the sliding position of the video track.
[0089] Based on the sliding position of the video track, the position of the target video frame in the track can be determined, thereby obtaining the frame identifier corresponding to the target video frame.
[0090] Step S204: Based on the frame identifier, perform a secondary memory lookup in the TLB to determine whether there is a frame storage address in the TLB that corresponds to the frame identifier.
[0091] The frame storage addresses stored in the TLB include memory frame storage addresses and virtual memory frame storage addresses. When viewing the TLB, based on the frame identifier, it is determined whether there is a memory frame storage address in the TLB corresponding to the frame identifier. If so, the memory frame storage address can be obtained directly. If not, it is necessary to further determine whether there is a virtual memory frame storage address in the TLB corresponding to the frame identifier. If so, the virtual memory frame storage address can be obtained.
[0092] If it is determined that a frame storage address corresponding to the frame identifier exists in the TLB, then step S205 is executed; otherwise, step S206 is executed.
[0093] Step S205: Retrieve the corresponding target video frame from memory based on the frame storage address and return it.
[0094] Based on the frame storage address, if the frame storage address is a memory frame storage address, the corresponding video frame can be retrieved and returned to the editor for display. If the frame storage address is a virtual memory frame storage address, the target video frame is located based on the virtual memory frame storage address, loaded into memory, the TLB is updated based on the memory frame storage address, and the target video frame is returned.
[0095] Step S206: Asynchronously load the target video frame from the disk into memory, update the TLB according to the frame storage address in memory, and return the target video frame.
[0096] If the frame storage address of the target video frame does not exist in the TLB, the target video frame needs to be searched for on disk. To facilitate fast loading, an asynchronous loading method is used. The target video frame is retrieved from disk, asynchronously loaded into memory, and returned to the editor. After being loaded into memory, the TLB is updated according to the frame storage address in memory. The TLB records the frame identifier of the target video frame and its corresponding frame storage address, facilitating the management of the target video frame using the TLB and subsequent location and retrieval.
[0097] Step S207: Monitor whether the memory meets the preset memory swapping conditions.
[0098] To alleviate the storage pressure on memory, memory can be monitored. When the memory is found to meet the preset memory swapping conditions, step S208 can be executed to swap and store some video frames in virtual memory.
[0099] The preset memory swapping conditions can be determined based on memory usage information, such as when memory usage reaches 80%. Memory is not only used to store video frames, but is also used when running various applications. To reduce memory storage pressure and improve video frame acquisition speed, when memory usage reaches 80%, the preset memory swapping conditions are met, and step S208 is executed.
[0100] Step S208: Video frames that meet the preset frame swapping conditions are swapped and stored in virtual memory.
[0101] Video frames that meet preset swapping criteria in memory can be swapped to virtual memory, reducing memory usage. These preset swapping criteria can be determined based on factors such as historical access frequency and memory storage time. For example, based on historical access frequency, video frames can be categorized, with a classification threshold set; frames above the threshold are considered high-frequency, and those below are low-frequency. Low-frequency frames, which are accessed less frequently, can be swapped from memory to virtual memory, simultaneously updating the frame storage addresses in the TLB (Transfer Table). Alternatively, based on the storage time in memory, older video frames can be swapped to virtual memory, reducing memory usage.
[0102] The execution order of steps S207-S208 and steps S201-S206 is not limited and is executed according to the actual call.
[0103] The video loading method provided in this application employs a preloading approach to load the video frames to be viewed into memory, reducing loading latency and playback stuttering. The memory frame storage address and frame identifier of each video frame are recorded in a time table (TLB). The TLB manages the video frames, allowing for quick location of the video frame by looking up its identifier in the TLB, facilitating fast and efficient video frame retrieval. Furthermore, by utilizing both memory and virtual memory, and based on factors such as the storage time and access frequency of video frames in memory, the method swaps video frames already stored in memory to virtual memory. When needed, these frames are loaded from virtual memory back into memory, dynamically adjusting data scheduling between memory and disk-based virtual memory to reduce memory storage pressure while improving retrieval efficiency.
[0104] Figure 3 A schematic diagram of a device for loading video tracks according to an embodiment of this application is shown.
[0105] like Figure 3 As shown, the device includes:
[0106] The frame identifier determination module 310 is adapted to determine the frame identifier of the target video frame based on the sliding position of the video track.
[0107] The lookup module 320 is adapted to perform a secondary memory lookup on the TLB based on the frame identifier to determine whether there is a frame storage address in the TLB corresponding to the frame identifier; the TLB preloads the frame identifiers of video frames and their corresponding frame storage addresses; the secondary memory includes physical memory and virtual memory;
[0108] The memory return module 330 is adapted to retrieve the corresponding target video frame from memory and return it if the lookup module determines that there is a frame storage address corresponding to the frame identifier;
[0109] The disk return module 340 is adapted to asynchronously load the target video frame from the disk into memory if the lookup module determines that there is no frame storage address corresponding to the frame identifier, update the TLB according to the frame storage address in memory, and return the target video frame.
[0110] Optionally, the device further includes: a preloading module 350, adapted to predict the video frame to be viewed based on the sliding information of the video track; load the video frame to be viewed into memory, determine the frame identifier of the video frame to be viewed and the corresponding memory frame storage address; and store the frame identifier and the corresponding memory frame storage address into the TLB.
[0111] Optionally, the preload module 350 is further adapted to:
[0112] The predicted sliding position of the video track is determined based on the sliding direction and speed of the track, and the video frame to be viewed is determined based on the predicted sliding position.
[0113] And / or, determine the video frame to be viewed based on the current sliding position of the track; the video frame to be viewed contains a preset number of video frames.
[0114] Optionally, the preloading module 350 is further adapted to: determine whether the number of video frames already stored in memory has reached the preset memory storage limit; and dynamically adjust the preset memory storage limit based on memory usage information.
[0115] If not, load the video frame to be viewed into memory and determine the frame identifier and corresponding memory frame storage address of the video frame to be viewed;
[0116] If so, swap the video frames already stored in memory to virtual memory, load the video frame to be viewed into memory, and determine the frame identifier and corresponding memory frame storage address of the video frame to be viewed.
[0117] Optionally, the preload module 350 is further adapted to:
[0118] The video frames already stored in memory are used as swapped video frames. They are sorted by storage time, and the swapped video frames with the longest storage time are swapped and stored in virtual memory in turn until the video frames to be viewed are stored in memory.
[0119] The frame identifiers of the swapped video frames and their corresponding virtual memory frame storage addresses are stored in the TLB (Translation Lookaside Buffer).
[0120] Optionally, the frame storage address includes the memory frame storage address and / or the virtual memory frame storage address;
[0121] The lookup module 320 is further adapted to:
[0122] Based on the frame identifier, determine whether there is a memory frame storage address in the TLB that corresponds to the frame identifier;
[0123] If so, obtain the memory frame storage address;
[0124] If not, determine whether a virtual memory frame storage address corresponding to the frame identifier exists in the TLB based on the frame identifier;
[0125] If so, obtain the virtual memory frame storage address;
[0126] The memory return module 330 is further adapted to:
[0127] If the frame storage address is the memory frame storage address, retrieve the corresponding video frame based on the memory frame storage address and return it.
[0128] If the frame storage address is the virtual memory frame storage address, locate the target video frame according to the virtual memory frame storage address, load the target video frame into memory, update the TLB according to the memory frame storage address, and return the target video frame.
[0129] Optionally, the device further includes: a switching module 360, adapted to monitor whether the memory meets preset memory switching conditions; the preset memory switching conditions are determined based on memory usage information; if so, video frames that meet the preset switching frame conditions are switched and stored in virtual memory; the preset switching frame conditions are determined based on the historical access frequency of video frames and / or memory storage time.
[0130] The descriptions of the above modules refer to the corresponding descriptions in the method embodiments, and will not be repeated here.
[0131] According to the video track loading device provided in this application, the TLB preloads the frame identifier and frame storage address, allowing for quick location and retrieval of the target video frame for return by looking up the TLB. The TLB can employ two-level memory storage, enabling dynamic adjustment of data storage between memory and disk virtual memory, thereby reducing memory storage pressure and frequent disk I / O operations.
[0132] This application also provides a non-volatile computer storage medium storing at least one executable instruction that can perform the operation corresponding to the method of loading video tracks in any of the above method embodiments.
[0133] This application also provides a computer program product comprising at least one executable instruction or computer program that enables a processor to perform the operation corresponding to the method of loading video tracks in any of the above method embodiments.
[0134] Figure 4 The diagram shows a structural schematic of a computing device according to an embodiment of the present application. The specific embodiments of the present application do not limit the specific implementation of the computing device.
[0135] like Figure 4 As shown, the computing device may include: a processor 402, a communications interface 404, a memory 406, and a communications bus 408.
[0136] in:
[0137] The processor 402, communication interface 404, and memory 406 communicate with each other via communication bus 408.
[0138] Communication interface 404 is used to communicate with other network elements such as clients or other servers.
[0139] The processor 402 is used to execute program 410, specifically to perform the relevant steps in the above-described method embodiment for loading video tracks.
[0140] Specifically, program 410 may include program code that includes computer operation instructions.
[0141] Processor 402 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement this application. The computing device includes one or more processors, which may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0142] Memory 406 is used to store program 410. Memory 406 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.
[0143] Specifically, program 410 can be used to cause processor 402 to execute the method for loading video tracks in any of the above method embodiments. The specific implementation of each step in program 410 can be found in the corresponding descriptions of the steps and units in the above embodiments for loading video tracks, and will not be repeated here. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the devices and modules described above can be referred to the corresponding process descriptions in the foregoing method embodiments, and will not be repeated here.
[0144] The algorithms or displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The required structure for constructing such systems is apparent from the above description. Furthermore, this application is not directed to any particular programming language. It should be understood that the content of this application described herein can be implemented using various programming languages, and the above description of specific languages is for the purpose of disclosing preferred embodiments of this application.
[0145] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of this application may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0146] Similarly, it should be understood that, in order to simplify this application and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of this application, various features of this application are sometimes grouped together into a single embodiment, figure, or description thereof. However, this method of disclosure should not be construed as reflecting an intention that the claimed application requires more features than are expressly recited in each claim. Rather, as reflected in the following claims, inventive aspects lie in fewer than all features of a single foregoing disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into that detailed description, wherein each claim itself is a separate embodiment of this application.
[0147] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.
[0148] Furthermore, those skilled in the art will understand that although some embodiments herein include certain features included in other embodiments but not others, combinations of features from different embodiments are intended to be within the scope of this application and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
[0149] The various component embodiments of this application can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some or all of the components according to this application. This application can also be implemented as a device or apparatus program (e.g., a computer program and computer program product) for performing part or all of the methods described herein. Such an implementation of this application can be stored on a computer-readable medium, or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
[0150] It should be noted that the above embodiments are illustrative of this application and not restrictive, and those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. This application can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be construed as limiting the order of execution.
Claims
1. A method for loading a video track, comprising: The frame identifier of the target video frame is determined based on the sliding position of the video track; Based on the sliding information of the video track, predict the video frame to be viewed; Determine whether the number of video frames already stored in memory has reached a preset memory storage limit; the preset memory storage limit is dynamically adjusted based on memory usage information. If not, load the video frame to be viewed into memory, and determine the frame identifier and corresponding memory frame storage address of the video frame to be viewed; If so, swap the video frames already stored in the memory to the virtual memory, load the video frame to be viewed into the memory, and determine the frame identifier and corresponding memory frame storage address of the video frame to be viewed; Store the frame identifier and the corresponding memory frame storage address into the TLB; Based on the frame identifier, a secondary memory lookup is performed on the TLB to determine whether a frame storage address corresponding to the frame identifier exists in the TLB; the TLB preloads the frame identifiers of video frames and their corresponding frame storage addresses; the secondary memory includes physical memory and virtual memory; If so, retrieve the corresponding target video frame from memory based on the frame storage address and return it; If not, asynchronously load the target video frame from the disk into memory, update the TLB according to the frame storage address in memory, and return the target video frame.
2. The method according to claim 1, wherein, The step of predicting the video frame to be viewed based on the sliding information of the video track further includes: The predicted sliding position of the video track is determined based on the sliding direction and speed of the track, and the video frame to be viewed is determined based on the predicted sliding position. And / or, determine the video frame to be viewed based on the current sliding position of the track; the video frame to be viewed includes a preset number of video frames.
3. The method according to claim 1, wherein, The step of swapping and storing the video frames already stored in the memory to the virtual memory further includes: The video frames already stored in the memory are used as swapped video frames. They are sorted by storage time, and the swapped video frames with the longest storage time are swapped and stored in the virtual memory in turn until the memory has finished storing the video frames to be viewed. The frame identifier of the exchanged video frame and the corresponding virtual memory frame storage address are stored in the TLB.
4. The method according to any one of claims 1-3, wherein, The frame storage address includes the memory frame storage address and / or the virtual memory frame storage address; The step of performing a secondary memory lookup on the TLB based on the frame identifier to determine whether a frame storage address corresponding to the frame identifier exists in the TLB further includes: Based on the frame identifier, determine whether there is a memory frame storage address in the TLB that corresponds to the frame identifier; If so, obtain the memory frame storage address; If not, determine whether there is a virtual memory frame storage address corresponding to the frame identifier in the TLB based on the frame identifier; If so, obtain the storage address of the virtual memory frame; The step of retrieving the corresponding target video frame from memory based on the frame storage address and returning it further includes: If the frame storage address is a memory frame storage address, retrieve the corresponding video frame based on the memory frame storage address and return it; If the frame storage address is a virtual memory frame storage address, the target video frame is located according to the virtual memory frame storage address, the target video frame is loaded into memory, the TLB is updated according to the memory frame storage address, and the target video frame is returned.
5. The method according to any one of claims 1-3, wherein, The method further includes: Monitor whether the memory meets the preset memory swapping conditions; the preset memory swapping conditions are determined based on memory usage information; If so, video frames that meet the preset frame swapping conditions are swapped and stored in virtual memory; the preset frame swapping conditions are determined based on the historical access frequency of the video frames and / or the memory storage time.
6. An apparatus for loading a video track, comprising: The frame identifier determination module is adapted to determine the frame identifier of the target video frame based on the sliding position of the video track; Used to predict the video frame to be viewed based on the sliding information of the video track; The system determines whether the number of video frames already stored in memory has reached a preset memory storage limit; the preset memory storage limit is dynamically adjusted based on memory usage information. If not, the video frame to be viewed is loaded into memory, and the frame identifier and corresponding memory frame storage address of the video frame to be viewed are determined. If yes, the video frames already stored in memory are swapped to virtual memory, the video frame to be viewed is loaded into memory, and the frame identifier and corresponding memory frame storage address of the video frame to be viewed are determined. The frame identifier and corresponding memory frame storage address are then stored in the module of the TLB. The lookup module is adapted to perform a secondary memory lookup on the TLB based on the frame identifier to determine whether a frame storage address corresponding to the frame identifier exists in the TLB; the TLB preloads the frame identifiers of video frames and their corresponding frame storage addresses; the secondary memory includes physical memory and virtual memory; The memory return module is adapted to retrieve the corresponding target video frame from memory and return it if the search module determines that a frame storage address corresponding to the frame identifier exists; The disk return module is adapted to asynchronously load the target video frame from the disk into memory if the lookup module determines that there is no frame storage address corresponding to the frame identifier, update the TLB according to the frame storage address in memory, and return the target video frame.
7. A computing device, comprising: The processor, memory, communication interface, and communication bus are provided, wherein the processor, memory, and communication interface communicate with each other via the communication bus. The memory is used to store at least one executable instruction that causes the processor to perform the operation corresponding to the method of loading a video track as described in any one of claims 1-5.
8. A computer storage medium storing at least one executable instruction that causes a processor to perform an operation corresponding to the method of loading a video track as described in any one of claims 1-5.
9. A computer program product comprising at least one executable instruction that causes a processor to perform an operation corresponding to the method of loading a video track as described in any one of claims 1-5.
Citation Information
Patent Citations
Video frame storage method, video player, terminal and readable storage medium
CN118573950A
Video recording and reproducing apparatus
JP2008193598A