WO2023246047A1 - 一种jpeg图像压缩的方法、系统、设备和存储介质 - Google Patents

一种jpeg图像压缩的方法、系统、设备和存储介质 Download PDF

Info

Publication number
WO2023246047A1
WO2023246047A1 PCT/CN2022/141668 CN2022141668W WO2023246047A1 WO 2023246047 A1 WO2023246047 A1 WO 2023246047A1 CN 2022141668 W CN2022141668 W CN 2022141668W WO 2023246047 A1 WO2023246047 A1 WO 2023246047A1
Authority
WO
WIPO (PCT)
Prior art keywords
frame
bandwidth
factor
image
frames
Prior art date
Application number
PCT/CN2022/141668
Other languages
English (en)
French (fr)
Inventor
孙旭
周玉龙
刘刚
李拓
Original Assignee
苏州元脑智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 苏州元脑智能科技有限公司 filed Critical 苏州元脑智能科技有限公司
Publication of WO2023246047A1 publication Critical patent/WO2023246047A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/136Incoming video signal characteristics or properties
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/186Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a colour or a chrominance component

Definitions

  • the present application relates to the field of chip design, and more specifically, to a JPEG image compression method, system, device and storage medium.
  • JPEG video image compression is a commonly used international standard for video image compression, used to compress continuous tone static images (including grayscale images and color images).
  • JPEG is the abbreviation of Joint Photographic Experts Group. This standard aims to support various applications based on continuous tone static image compression.
  • the image to be compressed can be in any color space. Users can adjust the compression ratio to make the compression effect reach or be close to the top compression performance in the industry, and have good resolution and restoration quality. Therefore, JPEG image compression is very necessary when a large number of images need to be stored and transmitted.
  • FIG. 1 it is a classic JPEG image compression flow chart, which mainly includes color mode conversion, DCT (discrete cosine transform), quantization, Z-shaped arrangement, run-length coding, Huffman coding, and data packaging.
  • Color mode conversion is to convert the RGB color mode to the YCbCr color mode.
  • DCT processes the entire image into 8X8 small blocks, and performs DCT on the three color channels of each small block separately. In this process, the image data input in rows and columns needs to be divided into several 8x8 small blocks, and then processed sequentially.
  • DCT The DCT process consumes the most resources, has the largest delay, and is the most difficult to implement technically. It largely determines the performance of the entire algorithm.
  • the purpose of the embodiments of this application is to propose a JPEG image compression method, system, computer equipment and computer non-volatile readable storage medium.
  • This application analyzes the encoding characteristics of the image frame by frame when the external bandwidth changes. , calculate the quantization coefficient, and then optimize the quantization coefficient table frame by frame to improve the image quality as much as possible while ensuring that the image does not freeze.
  • one aspect of the embodiment of the present application provides a JPEG image compression method, including the following steps: in response to the current image frame being at the starting frame, encoding the current image using a standard quantization coefficient table; in response to the current image The frame is not at the starting frame, calculate the weighted average image data length of the adjacent first predetermined number of frames, and calculate the coding factor based on the weighted average image data length; predict the bandwidth of the next frame based on changes in bandwidth of the adjacent second predetermined number of frames factor; and determine the quantization parameters of the current image frame through the quantization table according to the relationship between the coding factor and the bandwidth factor, and update the quantization parameters to the quantization table corresponding to the next frame.
  • calculating the weighted average image data length adjacent to the first predetermined number of frames includes: calculating the weighted average of the encoded image lengths of each frame adjacent to the first predetermined number of frames.
  • calculating the encoding factor based on the weighted average image data length includes: determining the standard encoded frame length based on the image resolution and pixel depth, and determining the encoding factor based on the ratio of the weighted average image data length and the standard encoded frame length.
  • predicting the bandwidth factor of the next frame based on changes in the bandwidth of adjacent second predetermined number of frames includes: respectively calculating the average bandwidth of adjacent second predetermined number of frames, and calculating the gradient value based on the average bandwidth; and based on the gradient value and the average bandwidth of the most recent frame to calculate the predicted value of the next frame's bandwidth, and calculate the bandwidth factor of the next frame based on the predicted value.
  • calculating the bandwidth factor of the next frame based on the predicted value includes: determining a standard bandwidth based on the image resolution, pixel depth, and frame rate, and determining the bandwidth factor of the next frame based on the ratio of the predicted value to the standard bandwidth.
  • calculating the average bandwidth of adjacent second predetermined number of frames respectively includes: calculating the time mark point of each frame according to the original frame rate and frame starting position of the image, recording the corresponding bandwidth according to the time mark point, and adding all The average bandwidth is used as the average bandwidth of the current frame.
  • determining the quantization parameter of the current image frame through the quantization table according to the relationship between the encoding factor and the bandwidth factor includes: in response to the encoding factor being less than or equal to the bandwidth factor, determining the brightness and chrominance of the current image frame according to the quantization table. ; and in response to the encoding factor being greater than the bandwidth factor, determining the brightness and chrominance of the current image frame according to the ratio of the encoding factor and the bandwidth factor.
  • a JPEG image compression system including: an encoding module configured to encode the current image using a standard quantization coefficient table in response to the current image frame being at the starting frame; first The calculation module is configured to respond to the current image frame not being in the starting frame, calculate the weighted average image data length of adjacent first predetermined number of frames, and calculate the encoding factor based on the weighted average image data length; the second calculation module is configured to Predict the bandwidth factor of the next frame according to the change in bandwidth of adjacent second predetermined number of frames; and an execution module configured to determine the quantization parameter of the current image frame through the quantization table according to the relationship between the encoding factor and the bandwidth factor, and The quantization parameters are updated to the quantization table corresponding to the next frame.
  • the first calculation module is configured to perform a weighted average calculation on the encoded image lengths of each of adjacent first predetermined number of frames.
  • the first calculation module is configured to: determine the standard encoded frame length according to the image resolution and pixel depth, and determine the encoding factor according to the ratio of the weighted average image data length and the standard encoded frame length.
  • the second calculation module is configured to: respectively calculate the average bandwidth of adjacent second predetermined number of frames, and calculate the gradient value based on the average bandwidth; and calculate the next frame bandwidth based on the gradient value and the average bandwidth of the most recent frame The predicted value, and the bandwidth factor of the next frame is calculated based on the predicted value.
  • the second calculation module is configured to: determine the standard bandwidth according to the image resolution, pixel depth and frame rate, and determine the bandwidth factor of the next frame according to the ratio of the predicted value and the standard bandwidth.
  • the second calculation module is configured to: calculate the time mark point of each frame according to the original frame rate and frame starting position of the image, record the corresponding bandwidth according to the time mark point, and use the average of all bandwidths as The average bandwidth of the current frame.
  • Another aspect of the embodiments of the present application also provides a computer device, including: at least one processor; and a memory.
  • the memory stores computer instructions that can be run on the processor. When the instructions are executed by the processor, the above method is implemented. step.
  • a computer non-volatile readable storage medium stores a computer program that implements the above method steps when executed by a processor.
  • This application has the following beneficial technical effects: when the external bandwidth changes, the encoding characteristics of the image are analyzed frame by frame, the quantization coefficient is calculated, and the quantization coefficient table is optimized frame by frame to improve the image quality as much as possible without ensuring that the image does not freeze.
  • Figure 1 is a flow chart of JPEG image compression in the prior art
  • FIG. 2 is a schematic diagram of an embodiment of the JPEG image compression method provided by this application.
  • FIG. 3 is a flow chart of an embodiment of the JPEG image compression method provided by this application.
  • Figure 4 is a brightness standard quantization coefficient table
  • FIG. 5 is a schematic diagram of an embodiment of the JPEG image compression system provided by this application.
  • Figure 6 is a schematic diagram of the hardware structure of an embodiment of a computer device for JPEG image compression provided by this application;
  • Figure 7 is a schematic diagram of an embodiment of a computer storage medium for JPEG image compression provided by this application.
  • FIG. 2 shows a schematic diagram of an embodiment of the JPEG image compression method provided by this application. As shown in Figure 2, the embodiment of this application includes the following steps:
  • the essence of the quantization process is the process of optimizing the 8 ⁇ 8 coefficient matrix generated after the discrete cosine transform. Since the human eye is insensitive to high-frequency components, the amount of data can be reduced by retaining a small amount or removing the high-frequency part of the 8 ⁇ 8 coefficient matrix.
  • the actual purpose of the quantization process is to reduce the amplitude values of non-zero frequency component coefficients and to increase the number of zero-valued frequency component coefficients.
  • the actual implementation process of the quantization process is to divide each coefficient value of the 8 ⁇ 8 coefficient matrix generated by the discrete cosine transform by the constant corresponding to the coefficient value (these coefficients are combined together to form the quantization parameter table), and round the resulting quotient value. After rounding, the quantized coefficient value is obtained.
  • the quantization process is a lossy process, and the high-frequency components of the quantized coefficient matrix will basically be close to 0.
  • the quantization parameter table can be produced through a standard quantization coefficient table and quantization step size.
  • the choice of quantization step size can change the compression rate and accuracy of the entire encoder. If the quantization step size is larger, the code stream compression ratio obtained will be higher, and the loss of image detail information will be greater; conversely, the code stream compression ratio obtained will be lower, but the detail information of the image can be retained more. Therefore, the output code stream status of the encoder can be controlled by adjusting the value of the quantization step size.
  • two quantization tables are often used in the quantization process: brightness quantization table and color difference quantization table.
  • the principle of Huffman coding is to first count the probability of occurrence of each pixel value in the image, and then correspond each pixel value with each codeword one-to-one according to the probability of each pixel value, and assign shorter codewords to pixel values with a high probability of occurrence, and Pixel values with a low probability of occurrence are assigned longer codewords, thereby further compressing the data.
  • FIG. 3 is a flow chart of an embodiment of the JPEG image compression method provided by this application. The embodiment of this application will be described based on FIG. 3 .
  • the current image is encoded using the standard quantization coefficient table.
  • the starting frame refers to the first 6 frames when the video image just starts to be encoded.
  • the standard quantization coefficient table is used for encoding.
  • Figure 4 is a brightness standard quantization coefficient table.
  • a weighted average image data length of adjacent first predetermined number of frames is calculated, and a coding factor is calculated based on the weighted average image data length.
  • calculating the weighted average image data length adjacent to the first predetermined number of frames includes: calculating the weighted average of the encoded image lengths of each frame adjacent to the first predetermined number of frames.
  • calculating the encoding factor based on the weighted average image data length includes: determining the standard encoded frame length based on the image resolution and pixel depth, and determining the encoding factor based on the ratio of the weighted average image data length and the standard encoded frame length.
  • frame_cnt_reg_1 When the beginning of the image frame is detected, the encoding frame count frame_cnt is set to 0. When valid data is output after huffman encoding, the counter begins to accumulate. When the end of the frame is detected, frame_cnt is registered as frame_cnt_reg. In the first 1-5 frames, the encoded image length is registered, which is frame_cnt_reg_1, frame_cnt_reg_2, frame_cnt_reg_3, frame_cnt_reg_4 and frame_cnt_reg_5.
  • frame_ave (6*frame_cnt_reg_6+4*frame_cnt_reg_5+2*frame_cnt_reg_4+2*frame_cnt_reg_3+frame_cnt_reg_2+frame_cnt_reg_1)/16.
  • Ta frame_ave/frame_std.
  • frame_std is the standard encoded frame length, which is related to the image resolution and pixel depth. When the video image specifications are determined, this value is a fixed value.
  • predicting the bandwidth factor of the next frame based on changes in the bandwidth of adjacent second predetermined number of frames includes: respectively calculating the average bandwidth of adjacent second predetermined number of frames, and calculating the gradient value based on the average bandwidth; and based on the gradient value and the average bandwidth of the most recent frame to calculate the predicted value of the next frame's bandwidth, and calculate the bandwidth factor of the next frame based on the predicted value.
  • calculating the bandwidth factor of the next frame based on the predicted value includes: determining a standard bandwidth based on the image resolution, pixel depth, and frame rate, and determining the bandwidth factor of the next frame based on the ratio of the predicted value to the standard bandwidth.
  • calculating the average bandwidth of adjacent second predetermined number of frames respectively includes: calculating the time mark point of each frame according to the original frame rate and frame starting position of the image, recording the corresponding bandwidth according to the time mark point, and adding all The average bandwidth is used as the average bandwidth of the current frame.
  • the bandwidth factor is essentially a prediction value that predicts the next frame based on the changes in available bandwidth of the previous three frames.
  • changes in bandwidth are time-dependent, so using this method has solid theoretical support. Specific steps are as follows:
  • the bandwidth granted to the image refers to the bandwidth allocated to the jpeg compressed data stream in the entire bus system.
  • the bandwidth allocated to different master and slave devices changes in real time under the influence of many factors such as priority settings and actual data bandwidth.
  • Some bus systems can provide the bandwidth of each channel of data in real time. Band_i , and some need to be calculated by yourself according to relevant agreements.
  • the quantization parameters of the current image frame are determined through the quantization table according to the relationship between the coding factor and the bandwidth factor, and the quantization parameters are updated to the quantization table corresponding to the next frame.
  • determining the quantization parameter of the current image frame through the quantization table according to the relationship between the encoding factor and the bandwidth factor includes: in response to the encoding factor being less than or equal to the bandwidth factor, determining the brightness and chrominance of the current image frame according to the quantization table. ; and in response to the encoding factor being greater than the bandwidth factor, determining the brightness and chrominance of the current image frame according to the ratio of the encoding factor and the bandwidth factor.
  • the JPEG protocol stipulates the standard brightness and chroma quantification parameter table [Q_s] (essentially an 8*8 matrix).
  • the calculation process of the quantization parameter table here, the calculation method of brightness and chroma is the same, and will not be introduced separately. .
  • [Q] [Q_s]
  • the embodiment of this application proposes a design and implementation method of high-performance adaptive JPEG compression, which can optimize the encoding process frame by frame when the system bandwidth changes and image characteristics change, so that the encoded image is always at the highest allowed image. quality.
  • the system 200 includes the following modules: a coding module configured to encode the current image using a standard quantization coefficient table in response to the current image frame being at the starting frame; a first calculation module configured to respond to the current The image frame is not in the starting frame, calculates the weighted average image data length of the adjacent first predetermined number of frames, and calculates the encoding factor based on the weighted average image data length; the second calculation module is configured to calculate the bandwidth of the adjacent second predetermined number of frames based on the weighted average image data length. Predict the bandwidth factor of the next frame based on the change of the in the quantification table.
  • the first calculation module is configured to perform a weighted average calculation on the encoded image lengths of each of adjacent first predetermined number of frames.
  • the first calculation module is configured to: determine the standard encoded frame length according to the image resolution and pixel depth, and determine the encoding factor according to the ratio of the weighted average image data length and the standard encoded frame length.
  • the second calculation module is configured to: respectively calculate the average bandwidth of adjacent second predetermined number of frames, and calculate the gradient value based on the average bandwidth; and calculate the next frame bandwidth based on the gradient value and the average bandwidth of the most recent frame The predicted value, and the bandwidth factor of the next frame is calculated based on the predicted value.
  • the second calculation module is configured to: determine the standard bandwidth according to the image resolution, pixel depth and frame rate, and determine the bandwidth factor of the next frame according to the ratio of the predicted value and the standard bandwidth.
  • the second calculation module is configured to: calculate the time mark point of each frame according to the original frame rate and frame starting position of the image, record the corresponding bandwidth according to the time mark point, and use the average of all bandwidths as The average bandwidth of the current frame.
  • the execution module is configured to: in response to the encoding factor being less than or equal to the bandwidth factor, determine brightness and chrominance of the current image frame according to the quantization table; and in response to the encoding factor being greater than the bandwidth factor, determining according to the encoding factor and the bandwidth factor The ratio of determines the brightness and chroma of the current image frame.
  • the third aspect of the embodiment of the present application proposes a computer device, including: at least one processor; and a memory, the memory stores computer instructions that can be run on the processor, and the instructions are executed by the processor to Implement the following steps: S1. In response to the current image frame being in the starting frame, use the standard quantization coefficient table to encode the current image; S2. In response to the current image frame not being in the starting frame, calculate the weighted average of the first predetermined number of adjacent frames.
  • the quantization parameters of the current image frame are determined through the quantization table, and the quantization parameters are updated to the quantization table corresponding to the next frame.
  • calculating the weighted average image data length adjacent to the first predetermined number of frames includes: calculating the weighted average of the encoded image lengths of each frame adjacent to the first predetermined number of frames.
  • calculating the encoding factor based on the weighted average image data length includes: determining the standard encoded frame length based on the image resolution and pixel depth, and determining the encoding factor based on the ratio of the weighted average image data length and the standard encoded frame length.
  • predicting the bandwidth factor of the next frame based on changes in the bandwidth of adjacent second predetermined number of frames includes: respectively calculating the average bandwidth of adjacent second predetermined number of frames, and calculating the gradient value based on the average bandwidth; and based on the gradient value and the average bandwidth of the most recent frame to calculate the predicted value of the next frame's bandwidth, and calculate the bandwidth factor of the next frame based on the predicted value.
  • calculating the bandwidth factor of the next frame based on the predicted value includes: determining a standard bandwidth based on the image resolution, pixel depth, and frame rate, and determining the bandwidth factor of the next frame based on the ratio of the predicted value to the standard bandwidth.
  • calculating the average bandwidth of adjacent second predetermined number of frames respectively includes: calculating the time mark point of each frame according to the original frame rate and frame starting position of the image, recording the corresponding bandwidth according to the time mark point, and adding all The average bandwidth is used as the average bandwidth of the current frame.
  • determining the quantization parameter of the current image frame through the quantization table according to the relationship between the encoding factor and the bandwidth factor includes: in response to the encoding factor being less than or equal to the bandwidth factor, determining the brightness and chrominance of the current image frame according to the quantization table. ; and in response to the encoding factor being greater than the bandwidth factor, determining the brightness and chrominance of the current image frame according to the ratio of the encoding factor and the bandwidth factor.
  • FIG. 6 it is a schematic diagram of the hardware structure of one embodiment of the computer device for JPEG image compression provided by this application.
  • the device includes a processor 301 and a memory 302.
  • the processor 301 and the memory 302 may be connected through a bus or other means.
  • the connection through a bus is taken as an example.
  • the memory 302 can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as JPEG image compression in the embodiment of the present application.
  • the program instructions/modules corresponding to the methods.
  • the processor 301 executes various functional applications and data processing of the server by running non-volatile software programs, instructions and modules stored in the memory 302, that is, the method of implementing JPEG image compression.
  • the memory 302 may include a storage program area and a storage data area, where the storage program area may store an operating system and an application program required for at least one function; the storage data area may store data created according to the use of a JPEG image compression method, etc.
  • memory 302 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device.
  • memory 302 optionally includes memory located remotely relative to processor 301, and these remote memories may be connected to local modules through a network. Examples of the above-mentioned networks include but are not limited to the Internet, intranets, local area networks, mobile communication networks and combinations thereof.
  • One or more computer instructions 303 corresponding to the JPEG image compression method are stored in the memory 302. When executed by the processor 301, the JPEG image compression method in any of the above method embodiments is executed.
  • Any embodiment of a computer device that performs the above JPEG image compression method can achieve the same or similar effects as the corresponding any of the foregoing method embodiments.
  • This application also provides a computer non-volatile readable storage medium.
  • the computer non-volatile readable storage medium stores a computer program that performs a JPEG image compression method when executed by a processor.
  • FIG. 7 it is a schematic diagram of an embodiment of the computer storage medium for JPEG image compression provided by this application.
  • the computer non-volatile readable storage medium 401 stores a computer program 402 that performs the above method when executed by a processor.
  • the program of the JPEG image compression method can be stored in a computer-readable file.
  • the storage medium of the program can be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
  • the foregoing computer program embodiments can achieve the same or similar effects as any of the corresponding foregoing method embodiments.

Landscapes

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

Abstract

本申请提供一种JPEG图像压缩的方法、系统、设备和存储介质,方法包括:响应于当前图像帧处于起始帧,使用标准量化系数表对所述当前图像进行编码;响应于当前图像帧不处于起始帧,计算邻近第一预定数量帧的加权平均图像数据长度,并根据所述加权平均图像数据长度计算编码因子;根据邻近第二预定数量帧的带宽的变化情况预测下一帧的带宽因子;以及根据所述编码因子和所述带宽因子之间的关系通过量化表确定当前图像帧的量化参数,并将所述量化参数更新到下一帧对应的量化表中。本申请针对系统带宽变化及图像特性发生变化时,逐帧的优化编码过程,使编码后的图像始终处于允许的最高图像质量。

Description

一种JPEG图像压缩的方法、系统、设备和存储介质
相关申请的交叉引用
本申请要求于2022年06月22日提交中国专利局,申请号为202210712053.0,申请名称为“一种JPEG图像压缩的方法、系统、设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及芯片设计领域,更具体地,特别是指一种JPEG图像压缩的方法、系统、设备和存储介质。
背景技术
JPEG视频图像压缩是一种常用的视频图像压缩的国际标准,用于对连续色调静态图像进行压缩(包括灰度图像和彩色图像)。JPEG是联合图像专家组(Joint Photographic Experts Group)的缩写,这个标准目的在于支持各种基于连续色调静态图像压缩的应用。待压缩的图像可以是任何一个色彩空间,用户可以通过调整压缩比能让压缩效果达到或者接近行业领域中顶尖的压缩性能,且具有良好的解析还原质量。因此,当需要存储和传输大量的图像时,JPEG图像压缩是非常有必要的。
如图1所示,为经典的JPEG图像压缩流程图,主要包括色彩模式转换,DCT(离散余弦变换)、量化、Z字编排、行程编码、霍夫曼编码、数据打包。色彩模式转换是将RGB色彩模式转换为YCbCr色彩模式。DCT是将整个图像按照8X8的小块进行处理,每个小块的3个色彩通道分别进行DCT,在这个过程中需要将按照行列输入的图像数据分割为若干个8x8的小块,然后依次进行DCT。DCT过程资源消耗最多、延迟最大、技术实现难度最高,很大程度上决定整个算法的性能。
在实际的技术应用过程中,常遇到这样的情景,视频图像经过JPEG压缩后向后级或其他设备发送,但发送的实际物理通道的带宽是固定的,在这个带宽中还需要发送其他的数据(数据占用的带宽也是随时变化的),且这些数据的优先级可能还会高于视频图像,这就会导致实际分配给视频图像的带宽会变化,因此图像就容易出现卡顿或花屏现象。在现有的技术中,一般使用如下两种方法:1、按照视频图像可能分配到的最小带宽进行压缩处理;2、在带宽发生变化时固定提高每一帧的压缩率,保证帧率稳定。现有技术的缺点:1、此方法较为简单,实现难度小,但会极大的降低图像质量,同时平均带宽利用率也较低;2、此方法虽然可以保证帧率稳定,即视频图像不卡顿,但会严重降低图像质量。
发明内容
有鉴于此,本申请实施例的目的在于提出一种JPEG图像压缩的方法、系统、计算机设备及计算机非易失性可读存储介质,本申请在外部带宽变化时,逐帧分析图像的编码特性,计算量化系数,进而逐帧优化量化系数表,在保证图像不卡顿的情况下尽可能的提高图像质量。
基于上述目的,本申请实施例的一方面提供了一种JPEG图像压缩的方法,包括如下步骤:响应于当前图像帧处于起始帧,使用标准量化系数表对当前图像进行编码;响应于当前图像帧不处于起始帧,计算邻近第一预定数量帧的加权平均图像数据长度,并根据加权平均图像数据长度计算编码因子;根据邻近第二预定数量帧的带宽的变化情况预测下一帧的带宽因子;以及根据编码因子和带宽因子之间的关系通过量化表确定当前图像帧的量化参数,并将量化参数更新到下一帧对应的量化表中。
在一些实施方式中,计算邻近第一预定数量帧的加权平均图像数据长度包括:将邻近第一预定数量帧中的每一帧的编码后图像长度进行加权平均计算。
在一些实施方式中,根据加权平均图像数据长度计算编码因子包括:根据图像分辨率和像素深度确定标准编码后帧长度,并根据加权平均图像数据长度和标准编码后帧长度的比值确定编码因子。
在一些实施方式中,根据邻近第二预定数量帧的带宽的变化情况预测下一帧的带宽因子包括:分别计算邻近第二预定数量帧的平均带宽,并根据平均带宽计算梯度值;以及根据梯度值和最近一帧的平均带宽计算下一帧带宽的预测值,并根据预测值计算下一帧的带宽因子。
在一些实施方式中,根据预测值计算下一帧的带宽因子包括:根据图像分辨率、像素深度和帧率确定标准带宽,并根据预测值和标准带宽的比值确定下一帧的带宽因子。
在一些实施方式中,分别计算邻近第二预定数量帧的平均带宽包括:根据图像的原始帧率和帧起始位置计算每帧的时间标记点,根据时间标记点记录对应的带宽,并将所有带宽的平均值作为当前帧的平均带宽。
在一些实施方式中,根据编码因子和带宽因子之间的关系通过量化表确定当前图像帧的量化参数包括:响应于编码因子小于或等于带宽因子,按照量化表确定当前图像帧的亮度和色度;以及响应于编码因子大于带宽因子,根据编码因子和带宽因子的比值确定当前图像帧的亮度和色度。
本申请实施例的另一方面,提供了一种JPEG图像压缩的系统,包括:编码模块,配置 用于响应于当前图像帧处于起始帧,使用标准量化系数表对当前图像进行编码;第一计算模块,配置用于响应于当前图像帧不处于起始帧,计算邻近第一预定数量帧的加权平均图像数据长度,并根据加权平均图像数据长度计算编码因子;第二计算模块,配置用于根据邻近第二预定数量帧的带宽的变化情况预测下一帧的带宽因子;以及执行模块,配置用于根据编码因子和带宽因子之间的关系通过量化表确定当前图像帧的量化参数,并将量化参数更新到下一帧对应的量化表中。
在一些实施方式中,第一计算模块配置用于:将邻近第一预定数量帧中的每一帧的编码后图像长度进行加权平均计算。
在一些实施方式中,第一计算模块配置用于:根据图像分辨率和像素深度确定标准编码后帧长度,并根据加权平均图像数据长度和标准编码后帧长度的比值确定编码因子。
在一些实施方式中,第二计算模块配置用于:分别计算邻近第二预定数量帧的平均带宽,并根据平均带宽计算梯度值;以及根据梯度值和最近一帧的平均带宽计算下一帧带宽的预测值,并根据预测值计算下一帧的带宽因子。
在一些实施方式中,第二计算模块配置用于:根据图像分辨率、像素深度和帧率确定标准带宽,并根据预测值和标准带宽的比值确定下一帧的带宽因子。
在一些实施方式中,第二计算模块配置用于:根据图像的原始帧率和帧起始位置计算每帧的时间标记点,根据时间标记点记录对应的带宽,并将所有带宽的平均值作为当前帧的平均带宽。
本申请实施例的又一方面,还提供了一种计算机设备,包括:至少一个处理器;以及存储器,存储器存储有可在处理器上运行的计算机指令,指令由处理器执行时实现如上方法的步骤。
本申请实施例的再一方面,还提供了一种计算机非易失性可读存储介质,计算机非易失性可读存储介质存储有被处理器执行时实现如上方法步骤的计算机程序。
本申请具有以下有益技术效果:在外部带宽变化时,逐帧分析图像的编码特性,计算量化系数,进而逐帧优化量化系数表,在保证图像不卡顿的情况下尽可能的提高图像质量。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的实施例。
图1为现有技术中JPEG图像压缩流程图;
图2为本申请提供的JPEG图像压缩的方法的实施例的示意图;
图3为本申请提供的JPEG图像压缩的方法的实施例的流程图;
图4为亮度标准量化系数表;
图5为本申请提供的JPEG图像压缩的系统的实施例的示意图;
图6为本申请提供的JPEG图像压缩的计算机设备的实施例的硬件结构示意图;
图7为本申请提供的JPEG图像压缩的计算机存储介质的实施例的示意图。
具体实施方式
为使本申请的目的、技术方案和优点更加清楚明白,以下结合具体实施例,并参照附图,对本申请实施例进一步详细说明。
需要说明的是,本申请实施例中所有使用“第一”和“第二”的表述均是为了区分两个相同名称非相同的实体或者非相同的参量,可见“第一”“第二”仅为了表述的方便,不应理解为对本申请实施例的限定,后续实施例对此不再一一说明。
本申请实施例的第一个方面,提出了一种JPEG图像压缩的方法的实施例。图2示出的是本申请提供的JPEG图像压缩的方法的实施例的示意图。如图2所示,本申请实施例包括如下步骤:
S1、响应于当前图像帧处于起始帧,使用标准量化系数表对当前图像进行编码;
S2、响应于当前图像帧不处于起始帧,计算邻近第一预定数量帧的加权平均图像数据长度,并根据加权平均图像数据长度计算编码因子;
S3、根据邻近第二预定数量帧的带宽的变化情况预测下一帧的带宽因子;以及
S4、根据编码因子和带宽因子之间的关系通过量化表确定当前图像帧的量化参数,并将量化参数更新到下一帧对应的量化表中。
量化过程的本质是对离散余弦变换后生成8×8系数矩阵进行优化的过程。由于人类的眼睛对高频分量不敏感,因此可以通过保留少量或者去除8×8系数矩阵的高频部分来达到减少数据量的目的。量化过程的实际目的是减小非零频率分量系数的幅度值和增加零值频率分量系数的数量。量化过程的实际实现过程为将离散余弦变换后生成8×8系数矩阵的每个系数值除以对应于该系数值的常数(这些系数组合在一起就是量化参数表),将得到的商值四舍五入取整后得到量化后的系数值。量化过程是一个有损过程,量化后的系数矩阵的高频分量部分都基本会基本接近0。量化参数表可以通过标准量化系数表和量化步长生产,量化步长的选择可以改变整个编码器的压缩率和精度。量化步长取值较大,得到的码流压缩比较高,图 像细节信息的损失较大;反之则得到的码流压缩比会比较低,但是图像的细节信息可以得到更多的保留。因此可以通过调整量化步长的值来控制编码器的输出码流状态。相对于色差,人类的眼睛对亮度的敏感程度更高,因此量化过程中往往使用两个量化表:亮度量化表和色差量化表。
Huffman编码的原理为先统计图像中各个像素值出现的概率,然后根据各个像素值的概率将各个像素值用各个码字一一对应,将出现概率高的像素值分配较短的码字,而将出现概率低的像素值分配较长的码字,从而将数据进一步压缩。
图3为本申请提供的JPEG图像压缩的方法的实施例的流程图,根据图3对本申请实施例进行说明。
响应于当前图像帧处于起始帧,使用标准量化系数表对当前图像进行编码。在本申请的一些实施例中,起始帧是指视频图像刚开始编码时的前6帧图像。在这几帧编码时,不需要考虑外部带宽的影响,使用标准量化系数表进行编码。图4为亮度标准量化系数表。
响应于当前图像帧不处于起始帧,计算邻近第一预定数量帧的加权平均图像数据长度,并根据加权平均图像数据长度计算编码因子。
在一些实施方式中,计算邻近第一预定数量帧的加权平均图像数据长度包括:将邻近第一预定数量帧中的每一帧的编码后图像长度进行加权平均计算。
在一些实施方式中,根据加权平均图像数据长度计算编码因子包括:根据图像分辨率和像素深度确定标准编码后帧长度,并根据加权平均图像数据长度和标准编码后帧长度的比值确定编码因子。
在检测到图像帧首时将编码帧计数frame_cnt置为0,huffman编码后输出有效数据时,计数器开始累加,当检测到帧尾时,将frame_cnt寄存为frame_cnt_reg。在起始的1-5帧时,将编码后的图像长度寄存,即为frame_cnt_reg_1、frame_cnt_reg_2、frame_cnt_reg_3、frame_cnt_reg_4和frame_cnt_reg_5。
在得到第6帧的编码后图像长度frame_cnt_reg_6时,计算时加权平均图像数据长度fram e_ave。frame_ave=(6*frame_cnt_reg_6+4*frame_cnt_reg_5+2*frame_cnt_reg_4+2*frame_cnt_reg_3+frame_cnt_reg_2+frame_cnt_reg_1)/16。在得到第7帧的编码后图像长度时,将其的值赋给frame_cnt_reg_6,之前frame_cnt_reg_5值赋给frame_cnt_reg_4,依次类推,得到最邻近的6帧的图像长度,之后按照同样的公式方法计算frame_ave。
计算编码因子Ta,Ta=frame_ave/frame_std。其中,frame_std为标准编码后帧长度, 与图像分辨率和像素深度有关,在视频图像规格确定时,此值为定值。
根据邻近第二预定数量帧的带宽的变化情况预测下一帧的带宽因子。
在一些实施方式中,根据邻近第二预定数量帧的带宽的变化情况预测下一帧的带宽因子包括:分别计算邻近第二预定数量帧的平均带宽,并根据平均带宽计算梯度值;以及根据梯度值和最近一帧的平均带宽计算下一帧带宽的预测值,并根据预测值计算下一帧的带宽因子。
在一些实施方式中,根据预测值计算下一帧的带宽因子包括:根据图像分辨率、像素深度和帧率确定标准带宽,并根据预测值和标准带宽的比值确定下一帧的带宽因子。
在一些实施方式中,分别计算邻近第二预定数量帧的平均带宽包括:根据图像的原始帧率和帧起始位置计算每帧的时间标记点,根据时间标记点记录对应的带宽,并将所有带宽的平均值作为当前帧的平均带宽。
带宽因子计算时使用基于邻近3帧带宽梯度计算并预测下一帧的可用带宽,并最终计算出下一帧的带宽因子。因此,从本质上说带宽因子是一个预测值,是基于之前3帧的可用带宽的变化情况预测的下一帧。在实际的芯片系统的设计和操作过程中,带宽的变化是具有时间上的相关性的,因此使用此方法具有扎实的理论支撑。具体步骤如下:
计算每帧图像的被授予的平均带宽Band_ave。图像被授予的带宽是指jpeg压缩数据流在整个总线系统中被分配的带宽。在soc系统的总线架构中,不同的主从设备在优先级设置、实际数据带宽等诸多因素影响下,被分配到的带宽是实时变化的,有的总线系统可以实时提供每路数据的带宽Band_i,有的则需要根据相关协议自行计算。
首先,计算3组每帧的时间标记点T1、T2、T3,根据图像的原始帧率和帧起始位置计算,帧起始位置时间即为T1,帧尾位置时间为T3,帧中间位置时间为T2=T1+1/(frame*2),frame为帧率。其次,在时间标记点记录对应的带宽Band_i,并进行寄存,命名为Band_T1、Band_T2和Band_T3。最后,计算Band_ave=(Band_T1+Band_T2+Band_T3)/3。同样方法计算并记录最近连续3帧的平均带宽,并记录为Band_ave_1、Band_ave_2和Band_ave_3。计算梯度值grad=(Band_ave_3-Band_ave_2)+(Band_ave_2-Band_ave_1)。计算下一帧带宽的预测值Band_p=Band_ave_1+grad。计算带宽因子Tb=Band_p/Band_std。其中,Band_std为标准带宽,即为在当前图像规格下占用的最大带宽,与图像分辨率、像素深度、帧率有关,在视频图像规格确定时,此值为定值。
根据编码因子和带宽因子之间的关系通过量化表确定当前图像帧的量化参数,并将量化参数更新到下一帧对应的量化表中。
在一些实施方式中,根据编码因子和带宽因子之间的关系通过量化表确定当前图像帧的量化参数包括:响应于编码因子小于或等于带宽因子,按照量化表确定当前图像帧的亮度和色度;以及响应于编码因子大于带宽因子,根据编码因子和带宽因子的比值确定当前图像帧的亮度和色度。
JPEG协议规定了标准的亮度和色度量化参数表[Q_s](本质上是8*8的矩阵),而此处量化参数表的计算过程,亮度和色度的计算方式相同,不再分开介绍。当T1/(T2)<1或=1时,[Q]=[Q_s];当T1/(T2)>1时,[Q]=[Q_s]*T1/(T2),其中,[Q]表示亮度或色度。
将计算好的量化参数表更新到下一帧图像编码的量化表中,并进行相应的除法运算,完成量化计算。需要特别注意的是,带宽因子、编码因子、量化参数表都是在每一帧的帧尾计算完成的,并将此量化表作为下一帧在量化处理时的量化参数表。
本申请实施例提出了一种高性能自适应JPEG压缩的设计和实现方法,可以针对系统带宽变化及图像特性发生变化时,逐帧的优化编码过程,使编码后的图像始终处于允许的最高图像质量。
需要特别指出的是,上述JPEG图像压缩的方法的各个实施例中的各个步骤均可以相互交叉、替换、增加、删减,因此,这些合理的排列组合变换之于JPEG图像压缩的方法也应当属于本申请的保护范围,并且不应将本申请的保护范围局限在实施例之上。
基于上述目的,本申请实施例的第二个方面,提出了一种JPEG图像压缩的系统。如图5所示,系统200包括如下模块:编码模块,配置用于响应于当前图像帧处于起始帧,使用标准量化系数表对当前图像进行编码;第一计算模块,配置用于响应于当前图像帧不处于起始帧,计算邻近第一预定数量帧的加权平均图像数据长度,并根据加权平均图像数据长度计算编码因子;第二计算模块,配置用于根据邻近第二预定数量帧的带宽的变化情况预测下一帧的带宽因子;以及执行模块,配置用于根据编码因子和带宽因子之间的关系通过量化表确定当前图像帧的量化参数,并将量化参数更新到下一帧对应的量化表中。
在一些实施方式中,第一计算模块配置用于:将邻近第一预定数量帧中的每一帧的编码后图像长度进行加权平均计算。
在一些实施方式中,第一计算模块配置用于:根据图像分辨率和像素深度确定标准编码后帧长度,并根据加权平均图像数据长度和标准编码后帧长度的比值确定编码因子。
在一些实施方式中,第二计算模块配置用于:分别计算邻近第二预定数量帧的平均带宽,并根据平均带宽计算梯度值;以及根据梯度值和最近一帧的平均带宽计算下一帧带宽的预测值,并根据预测值计算下一帧的带宽因子。
在一些实施方式中,第二计算模块配置用于:根据图像分辨率、像素深度和帧率确定标准带宽,并根据预测值和标准带宽的比值确定下一帧的带宽因子。
在一些实施方式中,第二计算模块配置用于:根据图像的原始帧率和帧起始位置计算每帧的时间标记点,根据时间标记点记录对应的带宽,并将所有带宽的平均值作为当前帧的平均带宽。
在一些实施方式中,执行模块配置用于:响应于编码因子小于或等于带宽因子,按照量化表确定当前图像帧的亮度和色度;以及响应于编码因子大于带宽因子,根据编码因子和带宽因子的比值确定当前图像帧的亮度和色度。
基于上述目的,本申请实施例的第三个方面,提出了一种计算机设备,包括:至少一个处理器;以及存储器,存储器存储有可在处理器上运行的计算机指令,指令由处理器执行以实现如下步骤:S1、响应于当前图像帧处于起始帧,使用标准量化系数表对当前图像进行编码;S2、响应于当前图像帧不处于起始帧,计算邻近第一预定数量帧的加权平均图像数据长度,并根据加权平均图像数据长度计算编码因子;S3、根据邻近第二预定数量帧的带宽的变化情况预测下一帧的带宽因子;以及S4、根据编码因子和带宽因子之间的关系通过量化表确定当前图像帧的量化参数,并将量化参数更新到下一帧对应的量化表中。
在一些实施方式中,计算邻近第一预定数量帧的加权平均图像数据长度包括:将邻近第一预定数量帧中的每一帧的编码后图像长度进行加权平均计算。
在一些实施方式中,根据加权平均图像数据长度计算编码因子包括:根据图像分辨率和像素深度确定标准编码后帧长度,并根据加权平均图像数据长度和标准编码后帧长度的比值确定编码因子。
在一些实施方式中,根据邻近第二预定数量帧的带宽的变化情况预测下一帧的带宽因子包括:分别计算邻近第二预定数量帧的平均带宽,并根据平均带宽计算梯度值;以及根据梯度值和最近一帧的平均带宽计算下一帧带宽的预测值,并根据预测值计算下一帧的带宽因子。
在一些实施方式中,根据预测值计算下一帧的带宽因子包括:根据图像分辨率、像素深度和帧率确定标准带宽,并根据预测值和标准带宽的比值确定下一帧的带宽因子。
在一些实施方式中,分别计算邻近第二预定数量帧的平均带宽包括:根据图像的原始帧率和帧起始位置计算每帧的时间标记点,根据时间标记点记录对应的带宽,并将所有带宽的平均值作为当前帧的平均带宽。
在一些实施方式中,根据编码因子和带宽因子之间的关系通过量化表确定当前图像帧的 量化参数包括:响应于编码因子小于或等于带宽因子,按照量化表确定当前图像帧的亮度和色度;以及响应于编码因子大于带宽因子,根据编码因子和带宽因子的比值确定当前图像帧的亮度和色度。
如图6所示,为本申请提供的上述JPEG图像压缩的计算机设备的一个实施例的硬件结构示意图。
以如图6所示的装置为例,在该装置中包括一个处理器301以及一个存储器302。
处理器301和存储器302可以通过总线或者其他方式连接,图6中以通过总线连接为例。
存储器302作为一种非易失性计算机非易失性可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块,如本申请实施例中的JPEG图像压缩的方法对应的程序指令/模块。处理器301通过运行存储在存储器302中的非易失性软件程序、指令以及模块,从而执行服务器的各种功能应用以及数据处理,即实现JPEG图像压缩的方法。
存储器302可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储根据JPEG图像压缩的方法的使用所创建的数据等。此外,存储器302可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实施例中,存储器302可选包括相对于处理器301远程设置的存储器,这些远程存储器可以通过网络连接至本地模块。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
一个或者多个JPEG图像压缩的方法对应的计算机指令303存储在存储器302中,当被处理器301执行时,执行上述任意方法实施例中的JPEG图像压缩的方法。
执行上述JPEG图像压缩的方法的计算机设备的任何一个实施例,可以达到与之对应的前述任意方法实施例相同或者相类似的效果。
本申请还提供了一种计算机非易失性可读存储介质,计算机非易失性可读存储介质存储有被处理器执行时执行JPEG图像压缩的方法的计算机程序。
如图7所示,为本申请提供的上述JPEG图像压缩的计算机存储介质的一个实施例的示意图。以如图7所示的计算机存储介质为例,计算机非易失性可读存储介质401存储有被处理器执行时执行如上方法的计算机程序402。
最后需要说明的是,本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关硬件来完成,JPEG图像压缩的方法的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中, 程序的存储介质可为磁碟、光盘、只读存储记忆体(ROM)或随机存储记忆体(RAM)等。上述计算机程序的实施例,可以达到与之对应的前述任意方法实施例相同或者相类似的效果。
以上是本申请公开的示例性实施例,但是应当注意,在不背离权利要求限定的本申请实施例公开的范围的前提下,可以进行多种改变和修改。根据这里描述的公开实施例的方法权利要求的功能、步骤和/或动作不需以任何特定顺序执行。此外,尽管本申请实施例公开的元素可以以个体形式描述或要求,但除非明确限制为单数,也可以理解为多个。
应当理解的是,在本文中使用的,除非上下文清楚地支持例外情况,单数形式“一个”旨在也包括复数形式。还应当理解的是,在本文中使用的“和/或”是指包括一个或者一个以上相关联地列出的项目的任意和所有可能组合。
上述本申请实施例公开实施例序号仅仅为了描述,不代表实施例的优劣。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,程序可以存储于一种计算机非易失性可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。
所属领域的普通技术人员应当理解:以上任何实施例的讨论仅为示例性的,并非旨在暗示本申请实施例公开的范围(包括权利要求)被限于这些例子;在本申请实施例的思路下,以上实施例或者不同实施例中的技术特征之间也可以进行组合,并存在如上的本申请实施例的不同方面的许多其它变化,为了简明它们没有在细节中提供。因此,凡在本申请实施例的精神和原则之内,所做的任何省略、修改、等同替换、改进等,均应包含在本申请实施例的保护范围之内。

Claims (20)

  1. 一种JPEG图像压缩的方法,其特征在于,包括如下步骤:
    响应于当前图像帧处于起始帧,使用标准量化系数表对所述当前图像帧进行编码;
    响应于当前图像帧不处于起始帧,计算邻近第一预定数量帧的加权平均图像数据长度,并根据所述加权平均图像数据长度计算编码因子;
    根据邻近第二预定数量帧的带宽的变化情况预测下一帧的带宽因子;以及
    根据所述编码因子和所述带宽因子之间的关系通过量化表确定当前图像帧的量化参数,并将所述量化参数更新到下一帧对应的量化表中。
  2. 根据权利要求1所述的方法,其特征在于,所述当前图像帧采用Huffman编码方法进行编码,所述方法还包括:
    统计所述当前图像帧中各个像素值出现的概率;
    根据所述各个像素值的概率为所述各个像素值分配长度不同的码字。
  3. 根据权利要求1所述的方法,其特征在于,所述计算邻近第一预定数量帧的加权平均图像数据长度包括:
    将所述邻近第一预定数量帧中的每一帧的编码后图像长度进行加权平均计算。
  4. 根据权利要求3所述的方法,其特征在于,所述方法还包括:
    依据所述邻近第一预定数量帧的位置,为所述邻近第一预定数量帧中的每一帧的编码后图像长度赋予不同的权重。
  5. 根据权利要求4所述的方法,其特征在于,所述方法还包括:
    当计算邻近第一预定数量帧的加权平均图像数据长度之后,获取所述邻近第一预定数量帧中最后一帧后的第一帧的编码后图像长度,从所述邻近第一预定数量帧中最后一帧后的第一帧开始,依次将后一帧的编码后图像长度赋给前一帧,得到所述邻近第一预定数量帧的图像长度。
  6. 根据权利要求1所述的方法,其特征在于,所述根据所述加权平均图像数据长度计算编码因子包括:
    根据图像分辨率和像素深度确定标准编码后帧长度,并根据所述加权平均图像数据长度和所述标准编码后帧长度的比值确定编码因子。
  7. 根据权利要求6所述的方法,其特征在于,所述方法还包括:
    在视频图像规格一定时,所述标准编码后帧长度为定值。
  8. 根据权利要求1所述的方法,其特征在于,所述根据邻近第二预定数量帧的带宽的变化情况预测下一帧的带宽因子包括:
    分别计算所述邻近第二预定数量帧的平均带宽,并根据所述平均带宽计算梯度值;以及
    根据所述梯度值和最近一帧的平均带宽计算下一帧带宽的预测值,并根据所述预测值计算下一帧的带宽因子。
  9. 根据权利要求8所述的方法,其特征在于,所述根据所述平均带宽计算梯度值的方法包括:
    分别计算所述邻近第二预定数量帧中相邻两帧平均带宽的差值;
    通过将所述差值求和得到所述梯度值。
  10. 根据权利要求8所述的方法,其特征在于,所述根据所述预测值计算下一帧的带宽因子包括:
    根据图像分辨率、像素深度和帧率确定标准带宽,并根据所述预测值和所述标准带宽的比值确定下一帧的带宽因子。
  11. 根据权利要求8所述的方法,其特征在于,所述分别计算所述邻近第二预定数量帧的平均带宽包括:
    根据图像的原始帧率和帧起始位置计算每帧的时间标记点,根据所述时间标记点记录对应的带宽,并将所有带宽的平均值作为当前帧的平均带宽。
  12. 根据权利要求11所述的方法,其特征在于,所述方法还包括:
    针对所述邻近第二预定数量帧中的一帧,确定所述帧中的时间标记点,所述时间标记点包括起始位置时间、帧尾位置时间、帧中间位置时间。
  13. 根据权利要求12所述的方法,其特征在于,所述方法还包括:
    记录所述起始位置时间、所述帧尾位置时间、所述帧中间位置时间对应的带宽;
    通过所述起始位置时间、所述帧尾位置时间、所述帧中间位置时间对应的带宽计算所述平均带宽。
  14. 根据权利要求1所述的方法,其特征在于,所述根据所述编码因子和所述带宽因子之间的关系通过量化表确定当前图像帧的量化参数包括:
    响应于所述编码因子小于或等于所述带宽因子,按照所述量化表确定所述当前图像帧的亮度和色度;以及
    响应于所述编码因子大于所述带宽因子,根据所述编码因子和所述带宽因子的比值确定所述当前图像帧的亮度和色度。
  15. 根据权利要求14所述的方法,其特征在于,所述方法还包括:
    在图像帧尾计算所述带宽因子、所述编码因子、所述量化表。
  16. 根据权利要求15所述的方法,其特征在于,所述方法还包括:
    将所述量化表作为下一帧在量化处理时的量化参数表。
  17. 一种JPEG图像压缩的系统,其特征在于,包括:
    编码模块,配置用于响应于当前图像帧处于起始帧,使用标准量化系数表对所述当前图像进行编码;
    第一计算模块,配置用于响应于当前图像帧不处于起始帧,计算邻近第一预定数量帧的加权平均图像数据长度,并根据所述加权平均图像数据长度计算编码因子;
    第二计算模块,配置用于根据邻近第二预定数量帧的带宽的变化情况预测下一帧的带宽因子;以及
    执行模块,配置用于根据所述编码因子和所述带宽因子之间的关系通过量化表确定当前图像帧的量化参数,并将所述量化参数更新到下一帧对应的量化表中。
  18. 根据权利要求17所述的系统,其特征在于,所述第一计算模块配置用于:
    将所述邻近第一预定数量帧中的每一帧的编码后图像长度进行加权平均计算。
  19. 一种计算机设备,其特征在于,包括:
    至少一个处理器;以及
    存储器,所述存储器存储有可在所述处理器上运行的计算机指令,所述指令由所述处理器执行时实现权利要求1-16任意一项所述方法的步骤。
  20. 一种计算机非易失性可读存储介质,所述计算机非易失性可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1-16任意一项所述方法的步骤。
PCT/CN2022/141668 2022-06-22 2022-12-23 一种jpeg图像压缩的方法、系统、设备和存储介质 WO2023246047A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210712053.0A CN114786011B (zh) 2022-06-22 2022-06-22 一种jpeg图像压缩的方法、系统、设备和存储介质
CN202210712053.0 2022-06-22

Publications (1)

Publication Number Publication Date
WO2023246047A1 true WO2023246047A1 (zh) 2023-12-28

Family

ID=82422426

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/141668 WO2023246047A1 (zh) 2022-06-22 2022-12-23 一种jpeg图像压缩的方法、系统、设备和存储介质

Country Status (2)

Country Link
CN (1) CN114786011B (zh)
WO (1) WO2023246047A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114786011B (zh) * 2022-06-22 2022-11-15 苏州浪潮智能科技有限公司 一种jpeg图像压缩的方法、系统、设备和存储介质
CN115474062B (zh) * 2022-11-10 2023-04-28 苏州浪潮智能科技有限公司 一种提高jpeg压缩质量的方法、系统、芯片以及电子设备
CN116489361B (zh) * 2023-06-25 2023-09-26 之江实验室 一种基于fpga的jpeg编码码流控制方法和装置

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5115309A (en) * 1990-09-10 1992-05-19 At&T Bell Laboratories Method and apparatus for dynamic channel bandwidth allocation among multiple parallel video coders
CN1285691A (zh) * 1999-08-20 2001-02-28 三星电子株式会社 根据网络带宽自适应地控制数据传输速率的装置
US6982762B1 (en) * 1998-05-30 2006-01-03 Stmicroelectronics Asia Pacific Pte Limited Sequence adaptive bit allocation for pictures encoding
CN1857001A (zh) * 2003-05-20 2006-11-01 Amt先进多媒体科技公司 混合视频压缩方法
CN110381315A (zh) * 2019-07-01 2019-10-25 西安万像电子科技有限公司 码率控制方法及装置
CN113766226A (zh) * 2020-06-05 2021-12-07 深圳市中兴微电子技术有限公司 图像编码方法、装置、设备及存储介质
CN114786011A (zh) * 2022-06-22 2022-07-22 苏州浪潮智能科技有限公司 一种jpeg图像压缩的方法、系统、设备和存储介质

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR0139154B1 (ko) * 1994-07-08 1998-06-15 김광호 신경망을 이용한 부호화방법 및 그 장치
CN111726633B (zh) * 2020-05-11 2021-03-26 河南大学 基于深度学习和显著性感知的压缩视频流再编码方法
CN112399176B (zh) * 2020-11-17 2022-09-16 深圳市创智升科技有限公司 一种视频编码方法、装置、计算机设备及存储介质

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5115309A (en) * 1990-09-10 1992-05-19 At&T Bell Laboratories Method and apparatus for dynamic channel bandwidth allocation among multiple parallel video coders
US6982762B1 (en) * 1998-05-30 2006-01-03 Stmicroelectronics Asia Pacific Pte Limited Sequence adaptive bit allocation for pictures encoding
CN1285691A (zh) * 1999-08-20 2001-02-28 三星电子株式会社 根据网络带宽自适应地控制数据传输速率的装置
CN1857001A (zh) * 2003-05-20 2006-11-01 Amt先进多媒体科技公司 混合视频压缩方法
CN110381315A (zh) * 2019-07-01 2019-10-25 西安万像电子科技有限公司 码率控制方法及装置
CN113766226A (zh) * 2020-06-05 2021-12-07 深圳市中兴微电子技术有限公司 图像编码方法、装置、设备及存储介质
CN114786011A (zh) * 2022-06-22 2022-07-22 苏州浪潮智能科技有限公司 一种jpeg图像压缩的方法、系统、设备和存储介质

Also Published As

Publication number Publication date
CN114786011A (zh) 2022-07-22
CN114786011B (zh) 2022-11-15

Similar Documents

Publication Publication Date Title
WO2023246047A1 (zh) 一种jpeg图像压缩的方法、系统、设备和存储介质
US9621900B1 (en) Motion-based adaptive quantization
TWI431948B (zh) 轉換區塊之效率編碼和解碼
JP2008527789A (ja) エントロピー符号化方法
JP2017055267A (ja) 画像符号化装置、画像処理装置、画像符号化方法
JP2016213528A (ja) 画像符号化装置、画像処理装置、画像符号化方法
WO2022048054A1 (zh) 一种红外数据压缩方法、装置及设备
US11343501B2 (en) Video transcoding method and device, and storage medium
JPH11289535A (ja) 知覚的圧縮および強固なビット速度制御システム
US10110896B2 (en) Adaptive motion JPEG encoding method and system
CN113613004A (zh) 图像编码方法、装置、电子设备及存储介质
JP2003032677A (ja) 動画像圧縮符号化装置
TWI705693B (zh) 用於顯示串流壓縮之基於向量之熵寫碼的裝置及方法
US10003802B1 (en) Motion-based adaptive quantization
JP4065522B2 (ja) 画像処理装置及びその制御方法
WO2024022039A1 (zh) 一种视频图像解码方法、编码方法、装置及存储介质
CN115474062B (zh) 一种提高jpeg压缩质量的方法、系统、芯片以及电子设备
TW202406352A (zh) 一種圖像編解碼方法及裝置
JPH1066077A (ja) 画像データの符号量制御方法およびその装置
US10003803B1 (en) Motion-based adaptive quantization
JP2004007526A (ja) データ圧縮装置及び方法
CN116527903B (zh) 图像浅压缩方法及解码方法
TWI829424B (zh) 解碼方法、編碼方法及裝置
WO2023138562A1 (zh) 图像解码方法、图像编码方法及相应的装置
WO2023138391A1 (zh) 系数解码方法、装置、图像解码器及电子设备

Legal Events

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

Ref document number: 22947782

Country of ref document: EP

Kind code of ref document: A1