Video single frame rollback method and related equipment

By using a circular buffer and texture compression technology, the problems of large decoding volume and high storage pressure in single-frame rollback in video surveillance are solved, achieving millisecond-level accurate frame positioning and efficient analysis.

CN121486633APending Publication Date: 2026-02-06E SURFING VISION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511708320.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-19
Publication Date
2026-02-06

AI Technical Summary

Technical Problem

Existing video surveillance technologies suffer from large decoding volumes, high storage pressure, and inaccurate frame positioning when rewinding to a single frame, failing to meet the precise analysis requirements of surveillance scenarios.

Method used

A circular buffer is used to store decoded frames, and the storage is optimized by texture compression and the read-write relationship is reversed to achieve backoff, thereby reducing the amount of decoding and storage usage, while improving the accuracy of frame positioning.

Benefits of technology

It reduces the data storage footprint of frames, avoids frame dropping, improves system response speed and frame positioning accuracy, and meets the needs of frame-by-frame analysis in monitoring scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121486633A_ABST
    Figure CN121486633A_ABST
Patent Text Reader

Abstract

The invention discloses a video single frame rollback method and related equipment. A decoded video frame is stored through an annular cache region, the frame is stored back to the annular cache region through texture compression after reading and rendering, a logic read-write relation of the annular cache region is reversed when a rollback instruction is received, and corresponding texture data is read to complete rollback. The frame data volume is greatly reduced through the texture compression technology, more frames can be stored in the same memory, the problem that backoff frames are discarded due to storage limitation is thoroughly avoided, and the continuity between the frames is guaranteed. The decoding frames are continuously reserved in the annular cache region, the compressed texture data can be directly rendered, the previous frame can be positioned only by reversing the read-write relation during rollback, the reference frame does not need to be pulled again for decoding, the extra decoding amount is eliminated from the source, and the response speed of the system is remarkably improved. Meanwhile, due to the cycle characteristic of the annular cache region and accurate control over read-write inversion, a target frame can be directly positioned and rendered immediately, interframe dependence interference is avoided, accurate frame positioning is achieved, and the requirement for frame-by-frame analysis of a monitoring scene is met.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of video processing, more particularly, to a video single frame rollback method and related equipment. BACKGROUND

[0002] In the field of video monitoring, staff often need to check abnormal pictures frame by frame through single frame rollback. The time accuracy and frame positioning accuracy of this technology directly affect the monitoring analysis efficiency and is one of the core requirements to ensure the practical value of the monitoring system.

[0003] Current monitoring videos mostly use inter-frame dependent compression technology. Video frames do not exist independently, but are associated with complex references. If the last frame is to be displayed through single frame rollback, a series of associated frames referenced by the frame need to be pulled and decoded frame by frame to the target position. Each rollback operation will cause the decoding amount to double instantly, seriously affecting the system response speed. At the same time, the memory occupation of the decoded single frame video is high, and the storage of a large amount of frame data puts a huge pressure on the device. In actual application, part of the rollback frames are often discarded due to storage limitations, resulting in insufficient frame positioning accuracy and failing to meet the accurate analysis requirements in the monitoring scenario. There are two main existing solutions: one is to convert non-key frames to key frames or simplify the encoding type through transcoding preprocessing, which can reduce the lag but takes a long time and has low playback efficiency; the other is to organize the original video data in reverse order to avoid transcoding, but repeated decoding is required, which is computationally intensive and still has the problem of frame loss. Both solutions focus on the encoding and decoding stage and cannot solve the core problems of large decoding amount, high storage pressure, and inaccurate frame positioning.

[0004] Therefore, there is an urgent need for an efficient single frame rollback method to simplify the single frame rollback of video monitoring devices, reduce the decoding amount and storage volume occupation, and improve the frame positioning accuracy. SUMMARY

[0005] The present application provides a video single frame rollback method and related equipment. The core design of the method includes storing decoded frames in a ring buffer area, optimizing storage through texture compression, and reversing the read-write relationship to achieve rollback. This design can greatly reduce frame data storage occupation to avoid frame loss, save repeated decoding during rollback to improve response speed, reduce decoding amount and storage volume occupation, and improve frame positioning accuracy.

[0006] A video single frame rollback method, comprising:

[0007] In the video playback process, the decoded video frame sequence is stored in a ring buffer area;

[0008] The video frame is read from the ring buffer area and sent to a graphics rendering pipeline for rendering and display;

[0009] compress the texture data of the video frame after rendering and display, and store the compressed texture data back to the ring buffer;

[0010] when receiving the single frame rollback instruction, reverse the logical read-write relationship of the ring buffer;

[0011] based on the reversed logical read-write relationship, read the texture data corresponding to the next video frame from the ring buffer and perform rendering and display, realizing video single frame rollback.

[0012] Optionally, the process of sending the video frame to the graphics rendering pipeline for rendering and display includes:

[0013] create an input texture for the video frame through a graphics rendering interface;

[0014] transfer the input texture to the rendering pipeline, and sequentially perform spatial transformation, primitive assembly and rasterization processing through a vertex shader;

[0015] in the pixel shader stage, convert the pixel data of the input texture into standard pixel data in RGB format using a color conversion formula;

[0016] fill the converted standard pixel data into a newly created RGB texture for display using the rendering to texture technology.

[0017] Optionally, the process of compressing the texture data of the video frame after rendering and display includes:

[0018] extract the texture data corresponding to the video frame after rendering and display as the texture data to be compressed;

[0019] divide the texture data to be compressed into a plurality of image blocks with fixed sizes;

[0020] perform texture compression processing based on the block compression algorithm on each image block to generate corresponding compressed data blocks;

[0021] organize the compressed data blocks in the original image spatial order to generate complete compressed texture data.

[0022] Optionally, after realizing video single frame rollback, it further includes:

[0023] according to the current reversed logical read-write relationship, re-store the texture data corresponding to the video frame currently displayed in rollback into the ring buffer.

[0024] Optionally, before reading the texture data corresponding to the next video frame from the ring buffer and performing rendering and display, it further includes:

[0025] If the compressed texture data of the next video frame exists in the circular buffer, the compressed texture data of the next video frame is directly read and rendered; otherwise, the next video frame is obtained by decoding the video source data.

[0026] Optionally, the circular buffer adopts a first-in-first-out overwrite strategy. When the circular buffer is full, the earliest stored compressed texture data is overwritten by the newly stored data.

[0027] A video single-frame rewind device, comprising:

[0028] The circular buffer module is used to store the decoded video frame sequence into the circular buffer during video playback.

[0029] The rendering and display module is used to read video frames from the circular buffer and send them to the graphics rendering pipeline for rendering and display.

[0030] The texture compression module is used to compress the textures of the rendered video frames and store the compressed texture data back to the circular buffer.

[0031] The rollback / reverse module is used to reverse the logical read-write relationship of the circular buffer when a single-frame rollback command is received, and read the texture data corresponding to the next video frame from the circular buffer based on the reversed logical read-write relationship and render and display it, thereby realizing single-frame rollback of the video.

[0032] A video single-frame rollback device, comprising a memory and a processor;

[0033] The memory is used to store programs;

[0034] The processor is configured to execute the program to implement the steps of the video single-frame rollback method as described in any of the preceding claims.

[0035] A readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the video single-frame rollback method as described in any of the preceding claims.

[0036] A computer program product includes a computer program that, when executed by a processor, performs the steps of the video single-frame rollback method as described in any of the preceding claims.

[0037] As can be seen from the above technical solutions, the video single-frame rollback method and related device provided in this application first store the decoded frame in a circular buffer and read and render it during video playback. Then, the rendered video frame is texture compressed and stored back in the buffer. When a rollback command is received, the logical read-write relationship of the buffer is reversed, and the corresponding texture data is read based on the reversed relationship to complete the rollback. This application performs texture compression on the rendered video frame before storing it back. Texture compression technology can significantly reduce the frame data size, allowing more frame data to be stored in the same memory space. This completely avoids the situation of discarding rollback frames due to storage limitations, ensuring the continuity between frames and effectively alleviating the storage pressure on the device. The circular buffer continuously stores the decoded frame data, and the compressed texture data can be directly used for rendering. When a rollback command is received, the previous frame can be located simply by reversing the logical read-write relationship, without having to fetch the reference frame again and decode it repeatedly. This fundamentally eliminates the extra decoding workload and significantly improves the system response speed. The circular storage characteristics of the ring buffer, combined with the precise control of logical read-write reversal, enable the system to directly locate the texture data corresponding to the target frame and render it in real time. This eliminates the interference of inter-frame dependencies on positioning, achieving millisecond-level accurate frame positioning. It fully meets the core requirements of frame-by-frame analysis in video surveillance scenarios, improving the practical value and analysis efficiency of the monitoring system. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0039] Figure 1 This is a flowchart of a video single-frame rollback method disclosed in an embodiment of this application;

[0040] Figure 2 This is a schematic diagram of a circular buffer area disclosed in an embodiment of this application;

[0041] Figure 3 This is a schematic diagram of a video single-frame rollback device disclosed in an embodiment of this application;

[0042] Figure 4 This is a hardware structure block diagram of a video single-frame rollback device disclosed in an embodiment of this application. Detailed Implementation

[0043] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0044] This application can be used in a wide variety of general-purpose or special-purpose computing device environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor devices, distributed computing environments including any of the above devices, etc.

[0045] The following section introduces the solution proposed in this application. The technical solution is as follows, and details are provided below.

[0046] Figure 1 This is a flowchart of a video single-frame rollback method disclosed in an embodiment of this application.

[0047] like Figure 1 As shown, the method may include:

[0048] Step S1: During video playback, the decoded video frame sequence is stored in a circular buffer.

[0049] Specifically, when the video playback system starts, the decoding module continuously decodes the input video stream, converting the originally compressed and encoded video data into a sequence of raw video frames that can be directly used for rendering. Then, the system writes these decoded consecutive video frame sequences into a preset circular buffer according to the natural playback sequence of the video frames.

[0050] Specifically, the circular buffer used in this application features circular storage, with its core management strategy being a first-in, first-out (FIFO) dynamic overwriting mechanism. This mechanism enables efficient data recycling with limited buffer resources. When the system continuously writes decoded video frames to the circular buffer until the buffer's storage capacity reaches a preset limit, the buffer management module automatically triggers the overwriting logic, directly replacing the earliest stored historical data in the circular buffer—that is, the previously rendered and converted compressed texture data—with the newly written decoded video frame data. This FIFO overwriting strategy has dual technical advantages: firstly, it effectively avoids video playback interruptions or data overflows caused by a full buffer, ensuring the continuity of video playback; secondly, by promptly overwriting the earliest historical data, it ensures that the circular buffer always retains the latest video frame data most relevant to the current playback progress. This provides a crucial data foundation for quickly locating and retrieving the target frame data when a single-frame rollback command is received, improving the response efficiency of the entire rollback process from the source.

[0051] Step S2: Read video frames from the circular buffer and send them to the graphics rendering pipeline for rendering and display.

[0052] Specifically, step S2 connects video frame storage and visual output. Its execution sequence forms a collaborative parallel relationship with the video frame writing operation in step S1. While step S1 continuously stores decoded video frames into the circular buffer, step S2 completes the reading and rendering scheduling of frame data according to the natural playback sequence of the video.

[0053] The system pre-maintains a pair of read and write pointers. The read pointer always points to the address of the next frame of data to be rendered in the circular buffer. The read index of the corresponding circular storage device increases sequentially. This address maintains a safe distance from the address of the write pointer in step S1 to avoid read / write operation conflicts. When a signal indicating that the previous frame has been rendered is detected, the system accurately reads the corresponding original video frame data from the circular buffer according to the read pointer address. Simultaneously, the compressed video frame processed in step S3 is transferred from the current buffer portion of the circular storage device to the historical buffer portion. This transfer operation is repeated until the historical buffer portion is full. If the historical buffer capacity is exceeded, the last frame position in the historical record is marked as writable to allow subsequent video frames to be written to the circular storage device. After reading, the system converts the video frame data according to the interface requirements of the graphics rendering pipeline, supplementing rendering parameters such as pixel format and resolution. Then, the formatted frame data is sent to the input port of the graphics rendering pipeline. The graphics rendering pipeline sequentially processes vertex assembly, rasterization, fragment shading, etc., converting the digital frame data into a displayable analog signal. Finally, it is transmitted to the display device through the display driver module to achieve real-time output of the video image. When using the single-frame rollback function, the system switches to reverse consumption mode (i.e., the direction of decreasing timestamps), swapping the historical cache and the current cache. The historical cache, which originally stored texture-compressed video frames, becomes the current cache storing the video frame data to be rendered and displayed. Data is read from this current cache (the historical cache portion in forward consumption mode) for rendering and display. After rendering, it is stored in a new historical cache portion (the current cache portion in forward consumption mode). Because the timestamp of this video frame is smaller than that of the previously rendered frame, single-frame rollback is achieved. This mechanism avoids repeated decoding that consumes CPU during single-frame rollback, while improving frame positioning accuracy. The latency during the entire normal playback process is minimal, ensuring smooth playback.

[0054] Step S3: Compress the rendered video frames for textures and save the compressed texture data back to the circular buffer.

[0055] Specifically, after the video frames are processed by the graphics rendering pipeline and output through the display device, the efficiency of frame data storage is optimized through texture compression, while reserving data resources that can be directly called for subsequent single-frame rollback operations.

[0056] The execution logic of step S3 is divided into two stages: compression processing and memory recall scheduling. In the compression processing stage, the displayed video frame output from step S2 is first captured. This frame data has already undergone pixel arrangement optimization and color space calibration, and can be directly used as compression input without secondary preprocessing. Subsequently, the system adaptively selects the compression standard based on the hardware performance of the running terminal. For example, in embedded monitoring devices with limited computing power, the more efficient ETC2 format is used, while in high-performance monitoring hosts, the ASTC format, which supports variable block sizes, is selected. The compression operation is processed in parallel by the hardware acceleration unit, compressing the frame data volume to 1 / 4 to 1 / 8 of the original size, while quantization parameters control ensure that the peak signal-to-noise ratio (PSNR) of the compressed frame is not less than 38dB, guaranteeing the recognizability of key details such as faces and license plates in the monitoring image. The rendered video frame is a piece of texture data. After texture compression, the texture volume will decrease; compressed texture data is essentially still a texture data format video frame. In the memory recall scheduling stage, the system allocates storage addresses according to the current working mode of the circular buffer. The current buffer is stored during playback, and automatically moved to the history buffer when subsequent frames are updated; if a rollback command has been triggered, the data is directly stored in the swapped history buffer. The entire process is accessed via pointer movement, which avoids affecting the smoothness of normal playback, while providing efficient data support for single-frame rollback without re-decoding.

[0057] Step S4: When a single frame rollback instruction is received, the logical read-write relationship of the circular buffer is reversed.

[0058] Specifically, step S4 is the core logic switching step of the single-frame rollback function. Its triggering depends on external command input, and the execution process does not change the physical storage structure of the circular buffer, only adjusting the data access rules. The triggering sources of the single-frame rollback command include frame-by-frame rollback operations initiated by the user through the monitoring terminal's buttons, touch screen, or remote control interface, as well as rollback commands automatically generated by the system according to preset analysis logic. After the command is verified by the system, it is confirmed that the current video is in a playback or paused state, and the read and write logic adjustment process of the circular buffer is immediately triggered. In forward playback mode, the read and write logic of the circular buffer follows the rule of incrementing the write pointer to store new data and incrementing the read pointer to read the data to be rendered, ensuring that the frame data flows in the playback sequence. When performing the logic reversal operation, the system only adjusts the movement direction of the read and write pointers to achieve rule switching. The read pointer changes from the original incrementing mode to the decrementing mode, pointing to the data address of the previous frame of the current frame, while the write pointer temporarily remains stationary or switches to a state of only receiving data after rendering and storing it, to avoid new data overwriting the historical frames to be rolled back. At the same time, after the logic is reversed, the system will synchronously update the partition mapping relationship of the cache area, so that the historical cache area in the forward mode becomes the data reading area during rollback, providing a clear logical direction for the frame data reading in step S5, and ensuring the immediate response of the rollback operation.

[0059] Step S5: Based on the reversed logical read-write relationship, read the texture data corresponding to the next video frame from the circular buffer and render and display it to realize single-frame video rollback.

[0060] Specifically, based directly on the inverted logical read-write relationship in step S4, the system achieves precise scheduling and rendering of the target frame. After logical inversion, the read pointer is positioned at the data address of the previous frame of the current frame. The data corresponding to this address is the texture data compressed in step S3, which does not require further decoding. The system first reads the corresponding texture data from the designated area of ​​the circular buffer (i.e., the historical buffer in forward mode and the current data area in fallback mode) according to the inverted read pointer address. The reading process is completed quickly through address mapping, avoiding the delay caused by data copying. The read texture data directly meets the input requirements of the graphics rendering pipeline. The system can send it to the rendering pipeline for pixel filling, color calibration, and other fast processing without additional format conversion. After processing, it is immediately output to the display device through the display driver module. The timestamp of the video frame presented at this time is smaller than that of the previously rendered and displayed video frame, thus achieving precise single-frame fallback. After the fallback frame is rendered, the system will store the frame data back to the corresponding partition of the circular buffer (the current buffer in forward mode and the historical buffer in fallback mode) according to the inverted rules, completing a closed loop of the fallback process. The entire process avoids the waste of CPU resources caused by repeated decoding, and achieves zero-error frame positioning by relying on pre-stored texture data, which fully meets the precise analysis needs of monitoring scenarios.

[0061] by Figure 2 To further illustrate this application, let's take an example:

[0062] An 8-unit circular buffer (corresponding to storage units 0-7 in the attached diagram) is used to store video frames and perform single-frame rollback through windex (write index) and rindex (read index), meeting the requirements for frame-by-frame rollback.

[0063] 1. Frame data storage in a circular buffer

[0064] like Figure 2 (a) When the system plays the video normally, the decoded video frames are stored in the circular buffer in the forward consumption direction (presenting the direction of increasing timestamps): windex points to unit 2, rindex points to unit 7, and frames 0, 1, 2 can be read, and historical frames 3, 4, 5, 6, 7 (old frames that have been rendered and compressed) can be read. This realizes the writing of new frames and the cyclic overwriting of old frames, and reserves historical data for rollback.

[0065] 2. Rendering and displaying video frames

[0066] The system reads video frames in the incrementing direction of rindex. Figure 2 (b) In this case, rindex points to cell 0 and is sent to the graphics rendering pipeline to complete the rendering and display. At this time, frames 1 and 2 can be read, frame 3 can be written, and frames 4, 5, 6, 7 and 0 can be recorded in history to ensure smooth real-time output of video images.

[0067] 3. Texture compression and saving of rendering frames

[0068] After rendering and displaying, video frames (such as frame 0) are compressed and stored back to the history section of the circular buffer. Figure 2 (b) Units 4, 5, 6, 7, and 0 complete the rendering, compression, and storage loop, storing compressed data for subsequent rollback operations.

[0069] 4. Logical read / write reversal for single-frame rollback

[0070] like Figure 2 (c) When it is necessary to backtrack to the previous frame, a single frame backtracking instruction is triggered, and the system switches to reverse consumption (presenting a decreasing timestamp direction) mode: windex points to unit 3 (the original historical record area), rindex points to unit 0, and historical frames 0, 7, 6, 5, and 4 (i.e., the historical buffer area in forward mode) can be read, realizing the logical swap between the historical buffer and the current buffer.

[0071] 5. Reading and rendering of backflip frames

[0072] Based on the reversed logic, the system reads the compressed texture data of the previous frame from the direction of decreasing rindex, such as...Figure 2 (d) reads frame number 7 and directly sends it to the rendering pipeline for display, achieving single-frame rollback. After rollback, the frame data is re-stored into the circular buffer according to the reverse logic, such as... Figure 2 (e) can read unit frames 7, 6, 5, 4 and 3 to ensure the continuity of subsequent rewind or forward playback.

[0073] exist Figure 2 In (f), the system returns to forward consumption (presenting an increasing timestamp direction) mode: windex points to unit 3, rindex points to unit 0, the readable portions are units 2, 1, and 0, and the historical records are units 7, 6, 5, 4, and 3. This indicates that after the single-frame rollback operation is completed, the system resumes normal playback logic, continues to read new frames in the increasing timestamp direction, and at the same time, the historical record area continuously stores the processed old frames to ensure the loop availability of subsequent playback and rollback.

[0074] Before performing the core operation of reading the texture data corresponding to the next video frame from the circular buffer and rendering it based on the reversed logical read-write relationship in step S5, a frame data existence judgment step is explicitly added.

[0075] Before reading the texture data corresponding to the next video frame from the circular buffer and rendering and displaying it, the process also includes:

[0076] If the compressed texture data of the next video frame exists in the circular buffer, the compressed texture data of the next video frame is directly read and rendered; otherwise, the next video frame is obtained by decoding the video source data.

[0077] Specifically, the system first locates the next video frame to be rolled back and extracts its unique identifier (such as a timestamp or frame number). It then queries the frame index record in the circular buffer using this identifier. If the query result shows that the compressed texture data of the next video frame already exists in the circular buffer, the compressed texture data is quickly read directly through address mapping and can be sent into the rendering process without additional processing. If the query confirms that the compressed texture data of the frame is not stored in the circular buffer, an emergency acquisition mechanism is immediately activated. The system pulls the original encoded source data corresponding to the frame through the video data interface and calls the decoding module to perform targeted decoding of the source data, thereby obtaining the complete data of the next video frame.

[0078] In addition, after completing the single-frame rollback rendering and display of the video, in order to enhance the circular reuse capability of the buffer data, the texture data corresponding to the currently rolled-back video frame needs to be re-stored into the circular buffer according to the logical read-write relationship after the reversal in step S4.

[0079] After implementing single-frame rewind in video, it also includes:

[0080] The texture data corresponding to the currently displayed video frame is re-stored into the circular buffer according to the current reversed logical read / write relationship.

[0081] Specifically, the re-storage operation is automatically triggered by the cache scheduling logic. The system first confirms the write pointer position in the current reverse mode, which is either a free area in the circular buffer that allows writing or an old data area to be overwritten. Then, it extracts the texture data and updated timestamp information of the current rollback frame and writes them to the corresponding area according to the reverse time-first storage principle. If the target area is full, the earliest stored non-critical frame data is overwritten according to the first-in-first-out strategy. After re-storage, the system synchronously updates the storage records in the frame index table to ensure that the frame data can be quickly retrieved by subsequent rollback or forward playback operations. This process avoids wasting rollback frame data, further enriches the available data in the buffer, reduces the probability of cache misses in subsequent operations, and makes the single-frame rollback mechanism more stable and efficient.

[0082] As can be seen from the above technical solutions, the video single-frame rollback method and related device provided in this application first store the decoded frame in a circular buffer and read and render it during video playback. Then, the rendered video frame is texture compressed and stored back in the buffer. When a rollback command is received, the logical read-write relationship of the buffer is reversed, and the corresponding texture data is read based on the reversed relationship to complete the rollback. This application performs texture compression on the rendered video frame before storing it back. Texture compression technology can significantly reduce the frame data size, allowing more frame data to be stored in the same memory space. This completely avoids the situation of discarding rollback frames due to storage limitations, ensuring the continuity between frames and effectively alleviating the storage pressure on the device. The circular buffer continuously stores the decoded frame data, and the compressed texture data can be directly used for rendering. When a rollback command is received, the previous frame can be located simply by reversing the logical read-write relationship, without having to fetch the reference frame again and decode it repeatedly. This fundamentally eliminates the extra decoding workload and significantly improves the system response speed. The circular storage characteristics of the ring buffer, combined with the precise control of logical read-write reversal, enable the system to directly locate the texture data corresponding to the target frame and render it in real time. This eliminates the interference of inter-frame dependencies on positioning, achieving millisecond-level accurate frame positioning. It fully meets the core requirements of frame-by-frame analysis in video surveillance scenarios, improving the practical value and analysis efficiency of the monitoring system.

[0083] In some embodiments of this application, the process of sending the data to the graphics rendering pipeline for rendering and display in step S2 is described, which may specifically include:

[0084] Step S21: Create an input texture for the video frame through the graphics rendering interface;

[0085] Step S22: The input texture is transmitted to the rendering pipeline and sequentially undergoes spatial transformation, primitive assembly, and rasterization processing through the vertex shader.

[0086] Step S23: In the pixel shader stage, the pixel data of the input texture is converted into standard pixel data in RGB format using a color conversion formula;

[0087] Step S24: Using rendering-to-texture technology, the converted standard pixel data is filled into a newly created RGB texture for display.

[0088] Specifically, the input carrier for video frames is constructed using a standardized graphics rendering interface. OpenGL or Vulkan graphics rendering interfaces, which offer strong cross-platform compatibility, are preferred. The system first parses the video frame data read from the circular buffer, extracting key parameters such as resolution and original pixel format. Then, it calls the corresponding texture creation function to allocate independent video memory space for the video frame and create an input texture. The internal format of this input texture strictly matches the pixel format of the video frame, and the texture's width and height dimensions are consistent with the video frame resolution. Simultaneously, the texture filtering mode is set to linear filtering to ensure smooth image rendering during texture scaling, providing a standardized data carrier for subsequent rendering pipeline processing.

[0089] The created input texture is bound to the rendering pipeline to ensure that the pipeline can directly access the texture data. After the input texture is passed in, it first enters the vertex shader. The vertex shader receives the preset vertex coordinates and texture coordinate data, performs the model-view projection matrix transformation, and maps the texture coordinates from the local coordinate system to the screen coordinate system to complete the spatial position calibration of the texture. Then it enters the primitive assembly stage. In this stage, according to the vertex connection method, the vertices after spatial transformation are assembled into continuous graphic primitives, and the display area boundary of the input texture is defined. Finally, rasterization is performed to discretize the vector primitives into a pixel array on the screen, providing position indexes for subsequent pixel-level processing. The entire process is completed with GPU hardware acceleration to ensure the smoothness of video playback.

[0090] Executed during the pixel shader stage, corresponding color conversion logic is applied for different original pixel formats of the input texture. If the input texture is in YUV420 format, the color conversion formulas are: R=Y+1.13983×(V-128), G=Y-0.39465×(U-128)-0.58060×(V-128), B=Y+2.03211×(U-128), where Y is the luminance component and U and V are the chrominance components. If the input texture is in RGBA format, the alpha channel is directly stripped while the RGB components are retained, completing the format purification. The converted pixel data is in 8-bit RGB standard format, with each channel value ranging from 0 to 255. Color deviation is controlled within a threshold imperceptible to the human eye, meeting the format requirements of display devices for input signals.

[0091] An RGB texture with the same resolution as the target display device is created, and a corresponding framebuffer object is created. The newly created RGB texture is then bound to the color attachment of the framebuffer, establishing a transmission link of "rendering data - framebuffer - RGB texture". Subsequently, the standard RGB pixel data output by the pixel shader is transmitted to the framebuffer through the write logic of the rendering pipeline, and then filled into the bound RGB texture. After the data filling is completed, the system unbinds the framebuffer from the RGB texture and submits the RGB texture to the display driver module. The display driver controls the texture data output according to the refresh rate of the display device, ultimately achieving clear and real-time display of video frames.

[0092] In some embodiments of this application, the process of texture compression of the rendered video frames in step S3 is described, which may specifically include:

[0093] Step S31: Extract the texture data corresponding to the rendered video frame as the texture data to be compressed.

[0094] Specifically, step S31 is the pre-processing data preparation stage for texture compression. The core task is to accurately acquire raw texture data that can be directly used for compression. The data source for this step is the texture data corresponding to the rendered video frames, i.e., the RGB textures that have been adapted for display. This texture contains complete pixel color and spatial distribution information of the video frames. The system extracts the above RGB texture data completely through the texture data reading function of the graphics rendering interface, using it as the texture data to be compressed. During the extraction process, the system simultaneously records the basic attributes of the texture data, such as the overall size of the image and the color depth of the pixels. It also performs integrity verification on the extracted data to ensure that no data is lost or erroneous during transmission from video memory to system memory, providing high-quality, undamaged raw material for subsequent compression processing.

[0095] Step S32: Divide the texture data to be compressed into multiple image blocks of fixed size.

[0096] Specifically, based on the characteristics of the block compression algorithm used, the system divides the texture data to be compressed into multiple standard image blocks of fixed size, following the natural image order from left to right and top to bottom. This fixed-size division allows the compression algorithm to perform parallel operations more efficiently, improving the overall processing speed. For residual pixels in the texture edge areas that are less than the size of a standard block, the system uses a smooth edge pixel extension method to complete them into standard image blocks, avoiding obvious image breaks or distortion after compression due to incomplete edge data, and ensuring the consistency of the entire texture image compression effect.

[0097] Step S33: Perform texture compression processing based on block compression algorithm on each image block to generate corresponding compressed data blocks.

[0098] Specifically, step S33 uses a block compression algorithm to reduce data volume while preserving visual information. The system first analyzes the pixel distribution characteristics of each image block, such as determining whether the block is a region with gentle color gradations or a region with rich color details, and then calls the corresponding processing logic of the block compression algorithm accordingly. For image blocks with gentle color changes, a predictive coding method based on the correlation between adjacent pixels is used to reduce data redundancy by calculating the differences between pixels; for image blocks with rich color details, vector quantization technology is used to map complex pixel combinations to a preset standard color mode, replacing the original pixel data with simpler index information. Regardless of the processing method used, the principle is to maximize the compression ratio within an acceptable range of image quality loss, ensuring that the compressed image blocks can still clearly present the key details of the video frame, meeting the visual recognition needs in monitoring scenarios, and finally generating a corresponding compressed data block for each image block.

[0099] Step S34: Organize each of the compressed data blocks according to the original image space order to generate complete compressed texture data.

[0100] Specifically, step S34 is the data integration stage, which reassembles the scattered compressed data blocks into complete, directly usable data. Following the spatial order of each compressed data block within the original texture image, all compressed data blocks are sequentially concatenated to form a continuous compressed data stream. To facilitate subsequent reading and parsing, the system adds metadata at the beginning of this data stream, containing key information such as the original texture size, the type of compression algorithm used, and the image block division rules, ensuring rapid data decoding and restoration during subsequent calls. Through this organization method, complete compressed texture data is ultimately generated. This data significantly reduces memory usage and can be directly stored in a circular buffer for single-frame rollback. Furthermore, the entire processing is highly efficient and fast, without causing any delay to real-time video playback.

[0101] The following describes a video single-frame rollback device provided in the embodiments of this application. The video single-frame rollback device described below and the video single-frame rollback method described above can be referred to and correspond to each other.

[0102] See Figure 3 , Figure 3 This is a schematic diagram of a video single-frame rollback device disclosed in an embodiment of this application.

[0103] like Figure 3 As shown, the video single-frame rollback device may include:

[0104] The circular buffer module 110 is used to store the decoded video frame sequence into the circular buffer during video playback.

[0105] The rendering and display module 120 is used to read video frames from the circular buffer and send them to the graphics rendering pipeline for rendering and display.

[0106] The texture compression module 130 is used to compress the texture of the rendered video frames and store the compressed texture data back to the circular buffer.

[0107] The rollback and reversal module 140 is used to reverse the logical read-write relationship of the circular buffer when a single-frame rollback instruction is received, and read the texture data corresponding to the next video frame from the circular buffer based on the reversed logical read-write relationship and render and display it, thereby realizing single-frame rollback of the video.

[0108] As can be seen from the above technical solutions, the video single-frame rollback method and related device provided in this application first store the decoded frame in a circular buffer and read and render it during video playback. Then, the rendered video frame is texture compressed and stored back in the buffer. When a rollback command is received, the logical read-write relationship of the buffer is reversed, and the corresponding texture data is read based on the reversed relationship to complete the rollback. This application performs texture compression on the rendered video frame before storing it back. Texture compression technology can significantly reduce the frame data size, allowing more frame data to be stored in the same memory space. This completely avoids the situation of discarding rollback frames due to storage limitations, ensuring the continuity between frames and effectively alleviating the storage pressure on the device. The circular buffer continuously stores the decoded frame data, and the compressed texture data can be directly used for rendering. When a rollback command is received, the previous frame can be located simply by reversing the logical read-write relationship, without having to fetch the reference frame again and decode it repeatedly. This fundamentally eliminates the extra decoding workload and significantly improves the system response speed. The circular storage characteristics of the ring buffer, combined with the precise control of logical read-write reversal, enable the system to directly locate the texture data corresponding to the target frame and render it in real time. This eliminates the interference of inter-frame dependencies on positioning, achieving millisecond-level accurate frame positioning. It fully meets the core requirements of frame-by-frame analysis in video surveillance scenarios, improving the practical value and analysis efficiency of the monitoring system.

[0109] Optionally, the process of sending the data to the graphics rendering pipeline for rendering and display includes:

[0110] The input texture is created for the video frame through the graphics rendering interface;

[0111] The input texture is transmitted to the rendering pipeline and sequentially undergoes spatial transformation, primitive assembly, and rasterization processing through the vertex shader.

[0112] During the pixel shader stage, the pixel data of the input texture is converted into standard pixel data in RGB format using a color conversion formula;

[0113] Using render-to-texture technology, the converted standard pixel data is filled into a new RGB texture for display.

[0114] Optionally, the process of performing texture compression on the rendered video frames includes:

[0115] Extract the texture data corresponding to the rendered video frames as the texture data to be compressed;

[0116] The texture data to be compressed is divided into multiple image blocks of fixed size;

[0117] For each image block, perform texture compression processing based on a block compression algorithm to generate a corresponding compressed data block;

[0118] The compressed data blocks are organized in the original image space order to generate complete compressed texture data.

[0119] Optionally, after implementing single-frame rewind, the following may also be included:

[0120] The texture data corresponding to the currently displayed video frame is re-stored into the circular buffer according to the current reversed logical read / write relationship.

[0121] Optionally, before reading the texture data corresponding to the next video frame from the circular buffer and rendering and displaying it, the method further includes:

[0122] If the compressed texture data of the next video frame exists in the circular buffer, the compressed texture data of the next video frame is directly read and rendered; otherwise, the next video frame is obtained by decoding the video source data.

[0123] Optionally, the circular buffer adopts a first-in-first-out overwrite strategy. When the circular buffer is full, the earliest stored compressed texture data is overwritten by the newly stored data.

[0124] The video single-frame rollback device provided in this application embodiment can be applied to video single-frame rollback equipment. Figure 4 The hardware structure block diagram of the video single-frame rewind device is shown below. Figure 4 The hardware structure of a video single-frame rollback device may include: at least one processor 1, at least one communication interface 2, at least one memory 3, and at least one communication bus 4;

[0125] In this embodiment of the application, the number of processor 1, communication interface 2, memory 3, and communication bus 4 is at least one, and processor 1, communication interface 2, and memory 3 communicate with each other through communication bus 4;

[0126] Processor 1 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention.

[0127] Memory 3 may include high-speed RAM, and may also include non-volatile memory, such as at least one disk storage device;

[0128] The memory stores a program, which the processor can call. The program is used for:

[0129] During video playback, the decoded video frame sequence is stored in a circular buffer.

[0130] Video frames are read from the circular buffer and sent to the graphics rendering pipeline for rendering and display.

[0131] The rendered video frames are texture compressed, and the compressed texture data is stored back to the circular buffer.

[0132] When a single-frame rollback instruction is received, the logical read-write relationship of the circular buffer is reversed;

[0133] Based on the reversed logical read-write relationship, the texture data corresponding to the next video frame is read from the circular buffer and rendered for display, thus realizing single-frame video rollback.

[0134] Optionally, the refined and extended functions of the program can be referred to the above description.

[0135] This application embodiment also provides a readable storage medium that can store a program suitable for execution by a processor, the program being used for:

[0136] During video playback, the decoded video frame sequence is stored in a circular buffer.

[0137] Video frames are read from the circular buffer and sent to the graphics rendering pipeline for rendering and display.

[0138] The rendered video frames are texture compressed, and the compressed texture data is stored back to the circular buffer.

[0139] When a single-frame rollback instruction is received, the logical read-write relationship of the circular buffer is reversed;

[0140] Based on the reversed logical read-write relationship, the texture data corresponding to the next video frame is read from the circular buffer and rendered for display, thus realizing single-frame video rollback.

[0141] Optionally, the refined and extended functions of the program can be referred to the above description.

[0142] This application also provides a computer program product, including a computer program, wherein the computer program is executed by a processor using the following method:

[0143] During video playback, the decoded video frame sequence is stored in a circular buffer.

[0144] Video frames are read from the circular buffer and sent to the graphics rendering pipeline for rendering and display.

[0145] The rendered video frames are texture compressed, and the compressed texture data is stored back to the circular buffer.

[0146] When a single-frame rollback instruction is received, the logical read-write relationship of the circular buffer is reversed;

[0147] Based on the reversed logical read-write relationship, the texture data corresponding to the next video frame is read from the circular buffer and rendered for display, thus realizing single-frame video rollback.

[0148] Optionally, the refined and extended functions of the program can be referred to the above description.

[0149] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0150] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0151] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for single-frame video rewind, characterized in that, include: During video playback, the decoded video frame sequence is stored in a circular buffer. Video frames are read from the circular buffer and sent to the graphics rendering pipeline for rendering and display. The rendered video frames are texture compressed, and the compressed texture data is stored back to the circular buffer. When a single-frame rollback instruction is received, the logical read-write relationship of the circular buffer is reversed; Based on the reversed logical read-write relationship, the texture data corresponding to the next video frame is read from the circular buffer and rendered for display, thus realizing single-frame video rollback.

2. The method according to claim 1, characterized in that, The process of sending the data into the graphics rendering pipeline for rendering and display includes: The input texture is created for the video frame through the graphics rendering interface; The input texture is transmitted to the rendering pipeline and sequentially undergoes spatial transformation, primitive assembly, and rasterization processing through the vertex shader. During the pixel shader stage, the pixel data of the input texture is converted into standard pixel data in RGB format using a color conversion formula; Using render-to-texture technology, the converted standard pixel data is filled into a new RGB texture for display.

3. The method according to claim 1, characterized in that, The process of performing texture compression on the rendered video frames includes: Extract the texture data corresponding to the rendered video frames as the texture data to be compressed; The texture data to be compressed is divided into multiple image blocks of fixed size; For each image block, perform texture compression processing based on a block compression algorithm to generate a corresponding compressed data block; The compressed data blocks are organized in the original image space order to generate complete compressed texture data.

4. The method according to claim 1, characterized in that, After implementing single-frame rewind in video, it also includes: The texture data corresponding to the currently displayed video frame is re-stored into the circular buffer according to the current reversed logical read / write relationship.

5. The method according to claim 1, characterized in that, Before reading the texture data corresponding to the next video frame from the circular buffer and rendering and displaying it, the process also includes: If the compressed texture data of the next video frame exists in the circular buffer, the compressed texture data of the next video frame is directly read and rendered; otherwise, the next video frame is obtained by decoding the video source data.

6. The method according to claim 1, characterized in that, The circular buffer adopts a first-in-first-out (FIFO) overwrite strategy. When the circular buffer is full, the earliest stored compressed texture data is overwritten by the newly stored data.

7. A video single-frame rollback device, characterized in that, include: The circular buffer module is used to store the decoded video frame sequence into the circular buffer during video playback. The rendering and display module is used to read video frames from the circular buffer and send them to the graphics rendering pipeline for rendering and display. The texture compression module is used to compress the textures of the rendered video frames and store the compressed texture data back to the circular buffer. The rollback / reverse module is used to reverse the logical read-write relationship of the circular buffer when a single-frame rollback command is received, and read the texture data corresponding to the next video frame from the circular buffer based on the reversed logical read-write relationship and render and display it, thereby realizing single-frame rollback of the video.

8. A video single-frame rollback device, characterized in that, Including memory and processor; The memory is used to store programs; The processor is configured to execute the program to implement each step of the video single-frame rollback method as described in any one of claims 1-6.

9. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements each step of the video single-frame rollback method as described in any one of claims 1-6.

10. A computer program product, comprising a computer program, characterized in that, The computer program is executed by the processor to perform the steps of the video single-frame rollback method as described in any one of claims 1-6.