Image code stream control method suitable for low-speed synchronous interface
By adjusting the quantization Q value according to the average frame length of the recent frames and filling data uniformly at the end of each frame, the problem of encoded data rate fluctuation when the low-speed synchronous channel is transmitted is solved, and the effect of reducing transmission delay and improving image display fluctuation is achieved.
Patent Information
- Application Number
- CN202411723432.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2044-11-28
AI Technical Summary
When the low-speed synchronization channel transmits a low-speed image code stream, there is fluctuation in the encoded image data rate, resulting in an increase in transmission delay and a decrease in image quality.
By adjusting the quantization Q value based on the average frame length of the last few frames, the number of caches of the synchronous transmission interface is reduced, the encoding transmission delay is reduced, and the data is evenly filled at the end of each frame image frame to reduce frame rate jitter.
Reduces the number of caches of the synchronous transmission interface, reduces the encoding transmission delay, and improves the smoothness and quality of image reception and display.
Smart Images

Figure CN119815019A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to an image code stream control method applicable to a low-speed synchronous interface in the field of image transmission, and is particularly applicable to low-speed image code stream control using a synchronous interface for transmission. The present invention adjusts the encoder quantization Q value according to the average frame length of the last few frames of coded data to adapt it to the transmission requirements of a low-speed synchronous channel, reduce transmission delay, and improve image display effects. Background Art
[0002] The low-speed image data is collected in standard definition format with a frame rate of 25 frames per second. During the compression process, it is encoded into intra-frame coded I frames and inter-frame coded P frames. Usually, the amount of I frame data is much larger than the amount of P frame data. This leads to a certain degree of fluctuation in the received image encoding bit rate. The low-speed synchronous channel transmits data at a fixed rate. In order to meet the transmission requirements of the synchronous channel, the encoded image data needs to be cached, and the image quantization Q value needs to be adjusted according to the amount of cached data, so that the fluctuating encoded image data can be transmitted at a constant rate, while minimizing the Q value as much as possible, reducing image distortion and improving image quality.
[0003] Using the cached data volume to adjust the image quantization Q value requires the encoder to cache a certain amount of data, which in turn adds additional time delay. When the image data is a static image, even if the minimum Q value is used, the P frame data volume cannot meet the transmission capacity. Summary of the invention
[0004] In order to avoid the problems in the background technology, the present invention proposes an image code stream control method suitable for a low-speed synchronous interface, which can use the average frame length of the latest few frames as the basis for adjusting the Q value, reduce the number of synchronous transmission interface buffers, and reduce the coding transmission delay. By evenly filling data at the end of each frame, the image frame rate jitter is reduced and the receiving display fluency is improved.
[0005] The technical solution adopted by the present invention is:
[0006] An image code stream control method applicable to a low-speed synchronous interface comprises the steps of:
[0007] (1) The image encoding module encodes the original image frame output by the image acquisition module based on the quantization Q value, generates an encoded image frame and outputs it to the frame length statistics module; wherein, during the first encoding process, the quantization Q value is an initial quantization value;
[0008] (2) The frame length statistics module calculates the actual average frame length of the encoded image frames with the most recent set frame number according to the current frame length and the frame length of the historical record, and then outputs the actual average frame length to the Q value adjustment module, and at the same time outputs the encoded image frames to the inter-thread cache module;
[0009] (3) The Q value adjustment module adjusts the quantization Q value of the subsequent encoding process according to the actual average frame length, returns to step (1), and executes step (4) at the same time;
[0010] (4) The inter-thread cache module caches the coded image frames, and the frame sending module takes out the coded image frames from the inter-thread cache module, composes the synchronous data frames, and outputs them through the synchronous data sending module under the control of the synchronous timing interrupt;
[0011] Complete image stream control suitable for low-speed synchronous interface.
[0012] Furthermore, the process of adjusting the quantized Q value in step (3) is as follows:
[0013] Compare the actual average frame length of the encoded image frame with the theoretical average frame length of the low-speed synchronization interface; when the actual average frame length is greater than the theoretical average frame length, increase the quantization Q value; when the actual average frame length is between the theoretical average frame length and the adjustment threshold, keep the quantization Q value unchanged; when the actual average frame length is less than the adjustment threshold, reduce the quantization Q value and increase the subsequent encoded data volume.
[0014] Furthermore, when calculating the actual average frame length of the most recently set frame number coded image frames in step (2), a frame length calculation structure is used, and the frame length calculation structure includes five parameters including a frame length array, a record number, a record position, a total frame length, and an average frame length;
[0015] The frame length array contains multiple units, assuming the number of units is n, each unit is used to store a frame length value in bytes; the number of records is used to indicate the number of valid frame length values in the frame length array; the record position is used to indicate the storage position of the next frame length value; the total frame length is used to indicate the sum of valid frame length values in the frame length array; the average frame length is used to indicate the average value of valid frame length values in the frame length array;
[0016] The average frame length calculation process includes:
[0017] During initialization, the frame length array, number of records, record position, total frame length, and average frame length are cleared to 0;
[0018] After receiving the encoded image frame input by the image encoding module, the frame length statistics module extracts the frame length m bytes of the encoded image frame and records it in the corresponding position of the frame length array, and the total frame length increases by m; the frame length value of the current unit in the frame length array is reduced; the record position increases by 1, and then if it is determined that the record position is greater than or equal to n, the record position is set to 0, if the number of records is less than n, the number of records increases by 1; the total frame length is divided by the number of records to obtain the average frame length of the most recently set number of frames; where m is the set value.
[0019] Furthermore, the sending frame assembly module in step (4) has a data filling mechanism. When the coded image frame is insufficient, the idle data area after the coded image frame in the current synchronization data frame is filled. When there is no coded image frame in the inter-thread cache, the synchronization data frame is completely composed of filling data.
[0020] Compared with the background technology, the present invention has the following advantages:
[0021] (1) The present invention uses the average frame length of the most recent frames as the basis for adjusting the Q value, thereby reducing the amount of synchronous transmission interface buffers and reducing the coding transmission time delay.
[0022] (2) The filling data of the present invention is evenly distributed at the end of each frame of image data, which reduces frame rate jitter and improves the smoothness of image reception and display. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 The present invention is a block diagram of the working principle of an image code stream control method suitable for a low-speed synchronous interface. DETAILED DESCRIPTION
[0024] The present invention will be further explained below in conjunction with the accompanying drawings.
[0025] like Figure 1 As shown, a method for controlling image code stream applicable to a low-speed synchronous interface comprises the following steps:
[0026] (1) The image encoding module encodes the original image frame output by the image acquisition module based on the quantization Q value, generates an encoded image frame and outputs it to the frame length statistics module; wherein, during the first encoding process, the quantization Q value is the initial quantization value.
[0027] (2) The frame length statistics module calculates the actual average frame length of the image frames encoded with the most recent set frame number based on the current frame length and the frame length of the historical records, and then outputs the actual average frame length to the Q value adjustment module for Q value adjustment, and at the same time outputs the encoded image frames to the inter-thread cache module.
[0028] Wherein, when calculating the actual average frame length of the most recently set frame number coded image frames in step (2), a frame length calculation structure is used. The frame length calculation structure includes five parameters: frame length array, record number, record position, total frame length and average frame length, and is used to record and calculate the average frame length of the most recent frames.
[0029] The frame length array of the frame length statistics module contains n units, each of which can store a frame length value in bytes. The number of records is used to indicate the number of valid frame length values in the frame length array, and the legal value range is 0 to n. The record position is used to indicate the storage position of the next frame length value, and the legal value range is 0 to n-1. The total frame length is used to indicate the sum of the valid frame length values in the frame length array. The average frame length is used to indicate the average value of the valid frame length values in the frame length array.
[0030] The average frame length calculation steps include:
[0031] During initialization, the frame length array, number of records, record position, total frame length, and average frame length are cleared to 0.
[0032] After receiving the encoded image frame input by the image encoding module, the frame length statistics module extracts the frame length m bytes of the encoded image frame and records it in the corresponding position of the frame length array, and the total frame length increases by m. Reduce the frame length value of the current unit in the frame length array. The record position increases by 1, and then if the record position is greater than or equal to n, it is set to 0. If the number of records is less than n, the number of records increases by 1. Divide the total frame length by the number of records to get the average frame length of the most recent frames.
[0033] (3) The Q value adjustment module adjusts the quantization Q value of the subsequent encoded image according to the average frame length to ensure that the subsequently encoded data can meet the synchronous channel transmission requirements; then returns to step (1) and executes step (4) at the same time.
[0034] The process of adjusting the quantization Q value in step (3) is as follows:
[0035] Compare the actual average frame length of the encoded image frame with the theoretical average frame length of the low-speed synchronization interface; when the actual average frame length is greater than the theoretical average frame length, increase the quantization Q value to reduce the amount of subsequent encoded data; when the actual average frame length is between the theoretical average frame length and the adjustment threshold, keep the quantization Q value unchanged; when the actual average frame length is less than the adjustment threshold, reduce the quantization Q value to improve the subsequent image quality and increase the amount of subsequent encoded data.
[0036] The legal quantization Q value range of the image encoder is 2 to 31. For a synchronous channel with a transmission rate of 384,000 bits per second, 25 frames of images need to be collected and encoded per second, and the theoretical average frame length is 1920 bytes. The adjustment threshold is set to 70% of the theoretical average frame length, that is, 1344 bytes. When the actual average frame length is greater than 1920 bytes, the quantization Q value increases by 1, and the maximum is not higher than 31; when the actual average frame length is less than or equal to 1920 bytes and greater than 1344 bytes, the quantization Q value remains unchanged; when the actual average frame length is less than or equal to 1344 bytes, the quantization Q value decreases by 1, and the minimum is not less than 2. The adjustment frequency is once per frame.
[0037] (4) The inter-thread cache module caches the coded image frames. The sending frame assembly module takes out the coded image frames from the inter-thread cache module, composes the synchronous data frames, and outputs them through the synchronous data sending module under the control of the synchronous timing interrupt.
[0038] The coded image frame in step (4) is sent to the synchronous sending thread through the inter-thread buffer module. The sending frame assembly module of the synchronous sending thread converts the coded image frame into a synchronous data frame and outputs it to the synchronous data sending module. The synchronous data sending module outputs the synchronous data frame according to the timing interrupt.
[0039] Among them, the sending frame module has a data filling mechanism to ensure that when the coded image data is insufficient, there is enough filling data to occupy the synchronization channel. The filling data is only used when the inter-thread cache module is insufficient to encode the image frame. The idle data area after the coded image data in the current synchronization data frame is filled with data. When there is no coded image frame in the inter-thread cache module, the synchronization data frame is completely composed of filling data.
Claims
1. An image code stream control method suitable for a low-speed synchronous interface, characterized in that: Includes steps: (1) The image encoding module encodes the original image frame output by the image acquisition module based on the quantization Q value, generates an encoded image frame and outputs it to the frame length statistics module; wherein, during the first encoding process, the quantization Q value is an initial quantization value; (2) The frame length statistics module calculates the actual average frame length of the encoded image frames with the most recent set frame number according to the current frame length and the frame length of the historical record, and then outputs the actual average frame length to the Q value adjustment module, and at the same time outputs the encoded image frames to the inter-thread cache module; (3) The Q value adjustment module adjusts the quantization Q value of the subsequent encoding process according to the actual average frame length, returns to step (1), and executes step (4) at the same time; (4) The inter-thread cache module caches the coded image frames, and the frame sending module takes out the coded image frames from the inter-thread cache module, composes the synchronous data frames, and outputs them through the synchronous data sending module under the control of the synchronous timing interrupt; Complete image stream control suitable for low-speed synchronous interface.
2. The code stream control method suitable for low-speed image transmission according to claim 1, characterized in that: The process of adjusting the quantized Q value in step (3) is as follows: Compare the actual average frame length of the encoded image frame with the theoretical average frame length of the low-speed synchronization interface; when the actual average frame length is greater than the theoretical average frame length, increase the quantization Q value; When the actual average frame length is between the theoretical average frame length and the adjustment threshold, the quantization Q value is kept unchanged; When the actual average frame length is less than the adjustment threshold, the quantization Q value is reduced and the amount of subsequent encoded data is increased.
3. The image code stream control method applicable to a low-speed synchronous interface according to claim 2, characterized in that: When calculating the actual average frame length of the image frames encoded by the most recently set frame number in step (2), a frame length calculation structure is used, and the frame length calculation structure includes five parameters: frame length array, record number, record position, total frame length and average frame length; The frame length array contains multiple units, assuming the number of units is n, each unit is used to store a frame length value in bytes; the number of records is used to indicate the number of valid frame length values in the frame length array; The record position is used to indicate the storage position of the next frame length value; The total frame length is used to represent the sum of the valid frame length values in the frame length array; The average frame length is used to represent the average value of the valid frame length values in the frame length array; The average frame length calculation process includes: During initialization, the frame length array, number of records, record position, total frame length, and average frame length are cleared to 0; After receiving the encoded image frame input by the image encoding module, the frame length statistics module extracts the frame length m bytes of the encoded image frame and records it in the corresponding position of the frame length array, and the total frame length increases by m; the frame length value of the current unit in the frame length array is reduced; the record position increases by 1, and then if it is determined that the record position is greater than or equal to n, the record position is set to 0, if the number of records is less than n, the number of records increases by 1; the total frame length is divided by the number of records to obtain the average frame length of the most recently set number of frames; where m is the set value.
4. The image code stream control method applicable to a low-speed synchronous interface according to claim 3, characterized in that: The sending frame assembly module in step (4) has a data filling mechanism. When the coded image frame is insufficient, the idle data area after the coded image frame in the current synchronization data frame is filled. When there is no coded image frame in the inter-thread cache, the synchronization data frame is completely composed of filling data.
Citation Information
Patent Citations
Self-adapting code rate control method
CN101252689A
Fixed-point wavelet transform method for joint photographic experts group 2000 (JPEG2000) image compression
CN102685501A
Code rate control method based on variable frame rate in low delay video coding
CN103702119A
Optimization method and system for code rate control of video monitor in 3G network
CN103841418A
Visible light communication system and synchronous detection method thereof
CN106850061A