CN116843775B - Decoding method and device based on inverse discrete cosine transform - Google Patents

Decoding method and device based on inverse discrete cosine transform Download PDF

Info

Publication number
CN116843775B
CN116843775B CN202311123729.3A CN202311123729A CN116843775B CN 116843775 B CN116843775 B CN 116843775B CN 202311123729 A CN202311123729 A CN 202311123729A CN 116843775 B CN116843775 B CN 116843775B
Authority
CN
China
Prior art keywords
matrix
discrete cosine
inverse discrete
coefficient
inverse
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202311123729.3A
Other languages
Chinese (zh)
Other versions
CN116843775A (en
Inventor
鲍金龙
赵军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202311123729.3A priority Critical patent/CN116843775B/en
Publication of CN116843775A publication Critical patent/CN116843775A/en
Application granted granted Critical
Publication of CN116843775B publication Critical patent/CN116843775B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • G06T9/007Transform coding, e.g. discrete cosine transform
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/14Fourier, Walsh or analogous domain transformations, e.g. Laplace, Hilbert, Karhunen-Loeve, transforms
    • G06F17/147Discrete orthonormal transforms, e.g. discrete cosine transform, discrete sine transform, and variations therefrom, e.g. modified discrete cosine transform, integer transforms approximating the discrete cosine transform
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/16Matrix or vector computation, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Computational Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Algebra (AREA)
  • Discrete Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • Multimedia (AREA)
  • Computing Systems (AREA)
  • Complex Calculations (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The application provides a decoding method and device based on inverse discrete cosine transform, relates to the technical field of data processing, and is particularly applicable to cloud technology, artificial intelligence, intelligent traffic, auxiliary driving and other scenes. The method comprises the following steps: generating a target matrix according to the inverse quantized coefficient matrix, wherein the target matrix is a matrix of 4x4, and the target matrix comprises 16 submatrices; generating a mask matrix of the target matrix according to whether the coefficient of the submatrix is 0, wherein the mask matrix is a matrix of 4x4, and the coefficient of the mask matrix comprises 1 and 0; according to the mask matrix, invoking an inverse discrete cosine transform function corresponding to the mask matrix to perform inverse discrete cosine transform on the coefficient matrix to obtain data after the inverse discrete cosine transform, wherein the inverse discrete cosine transform function only calculates the inverse discrete cosine transform of the non-0 coefficient of the coefficient matrix, and does not calculate the inverse discrete cosine transform of the 0 coefficient of the coefficient matrix. The method simply and effectively improves the rate of the inverse discrete cosine transform and further improves the decoding rate.

Description

Decoding method and device based on inverse discrete cosine transform
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a decoding method and apparatus based on inverse discrete cosine transform.
Background
Discrete cosine transform (Discrete Cosine Transform, DCT) is a process of converting a set of data from a time domain (time domain) to a frequency domain (frequency domain) for analyzing frequency characteristics of signals or performing signal compression, and is widely used in image and video coding standards. This process of DCT computation increases the complexity of decoding. This is because, when the coefficient matrix of the input image is subjected to DCT transform and quantization, a large number of 0 coefficients are generated, and when the input values are all 0, the output values are also 0 in the inverse DCT transform in the decoding process. Thus a transformation of the inverse DCT for multiple 0 inputs is unnecessary.
Disclosure of Invention
The embodiment of the application provides a decoding method and a decoding device for inverse discrete cosine transform, which realize simple and effective acceleration of the calculation rate of inverse discrete cosine transform and further can improve the decoding rate of video or images.
In a first aspect, an embodiment of the present application provides a decoding method based on inverse discrete cosine transform, including:
generating a target matrix according to the inverse quantized coefficient matrix, wherein the target matrix is a 4x4 matrix, the target matrix comprises 16 submatrices, and the coefficient matrix is obtained by performing entropy decoding and inverse quantization on an encoding code stream of an image;
Generating a mask matrix of the target matrix according to whether the coefficient of the sub-matrix is 0, wherein the mask matrix is a 4x4 matrix, and the coefficient of the mask matrix comprises 1 and 0, wherein when the sub-matrix comprises non-0 coefficients, the coefficient of the mask matrix corresponding to the sub-matrix is 1, and when the coefficient of the sub-matrix comprises all 0, the coefficient of the mask matrix corresponding to the sub-matrix is 0;
according to the mask matrix, invoking an inverse discrete cosine transform function corresponding to the mask matrix to perform inverse discrete cosine transform on the inverse quantized coefficient matrix to obtain inverse discrete cosine transformed data, wherein the inverse discrete cosine transform function only calculates the inverse discrete cosine transform of non-0 coefficient of the inverse quantized coefficient matrix and does not calculate the inverse discrete cosine transform of 0 coefficient of the inverse quantized coefficient matrix;
and determining the image according to the data after the inverse discrete cosine transform.
In a second aspect, an embodiment of the present application provides a decoding apparatus, including:
the processing unit is used for generating a target matrix according to the inverse quantized coefficient matrix, wherein the target matrix is a 4x4 matrix, the target matrix comprises 16 submatrices, and the coefficient matrix is obtained by performing entropy decoding and inverse quantization on an encoded code stream of an image;
The processing unit is further configured to generate a mask matrix of the target matrix according to whether coefficients of the sub-matrix are 0, where the mask matrix is a 4x4 matrix, and coefficients of the mask matrix include 1 and 0, where when the sub-matrix includes non-0 coefficients, coefficients of the mask matrix corresponding to the sub-matrix are 1, and when the coefficients of the sub-matrix include all 0, coefficients of the mask matrix corresponding to the sub-matrix are 0;
the processing unit is further configured to invoke an inverse discrete cosine transform function corresponding to the mask matrix to perform inverse discrete cosine transform on the inverse quantized coefficient matrix according to the mask matrix, so as to obtain inverse discrete cosine transformed data, where the inverse discrete cosine transform function only calculates an inverse discrete cosine transform of a non-0 coefficient of the inverse quantized coefficient matrix, and does not calculate an inverse discrete cosine transform of a 0 coefficient of the inverse quantized coefficient matrix;
the processing unit is further configured to determine the image according to the inverse discrete cosine transformed data.
In a third aspect, embodiments of the present application provide an electronic device, including:
a processor adapted to implement computer instructions; the method comprises the steps of,
A memory storing computer instructions adapted to be loaded by a processor and to perform the method of the first aspect described above.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium storing computer instructions that, when read and executed by a processor of a computer device, cause the computer device to perform the method of the first aspect described above.
In a fifth aspect, embodiments of the present application provide a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device performs the method of the first aspect described above.
According to the technical scheme, the terminal equipment generates a 4x4 target matrix according to the dequantized coefficient matrix, generates a mask matrix according to whether the coefficient of the target matrix is 0, wherein the coefficient of the mask matrix comprises 1 and 0, 1 represents that the corresponding subarray has a non-0 coefficient, and 0 represents that the corresponding subarray coefficient is 0. And invoking an inverse discrete cosine transform function corresponding to the mask matrix according to the mask matrix to perform inverse discrete cosine transform on the inverse quantized coefficient matrix, wherein the inverse discrete cosine transform function only calculates the inverse discrete cosine transform of non-0 coefficient of the inverse quantized coefficient matrix, and does not calculate the inverse discrete cosine transform of 0 coefficient of the inverse quantized coefficient matrix, namely the inverse discrete cosine transform function removes the 0 coefficient to perform the inverse discrete cosine transform, so that the calculation rate of the inverse discrete cosine transform is simply and effectively accelerated, and the decoding rate of videos or images can be further improved.
Drawings
FIG. 1 is an alternative schematic diagram of a system architecture 100 according to an embodiment of the present application;
FIG. 2 is a schematic flow chart of image encoding based on discrete cosine transform according to an embodiment of the present application;
FIG. 3 is a DCT computation matrix based on a common butterfly transform according to an embodiment of the present application;
fig. 4 is a flowchart of an IDCT signal based on a common butterfly transform according to an embodiment of the present application;
FIG. 5 is a schematic flow chart of a decoding method 200 based on inverse discrete cosine transform according to an embodiment of the present application;
fig. 6 is a flowchart of an IDCT signal based on a common butterfly transform according to an embodiment of the present application;
fig. 7 is a flowchart of an IDCT signal based on a common butterfly transform according to an embodiment of the present application;
fig. 8 is a flowchart of an IDCT signal based on a common butterfly transform according to an embodiment of the present application;
fig. 9 is a flowchart of an IDCT signal based on a common butterfly transform according to an embodiment of the present application;
fig. 10 is a flowchart of an IDCT signal based on a common butterfly transform according to an embodiment of the present application;
fig. 11 is a flowchart of an IDCT signal based on a common butterfly transform according to an embodiment of the present application;
Fig. 12 is a flowchart of an IDCT signal based on a common butterfly transform according to an embodiment of the present application;
fig. 13 is a flowchart of an IDCT signal based on a common butterfly transform according to an embodiment of the present application;
fig. 14 is a flowchart of an IDCT signal based on a common butterfly transform according to an embodiment of the present application;
fig. 15 is a flowchart of an IDCT signal based on a common butterfly transform according to an embodiment of the present application;
fig. 16 is a flowchart of an IDCT signal based on a common butterfly transform according to an embodiment of the present application;
fig. 17 is a flowchart of an IDCT signal based on a common butterfly transform according to an embodiment of the present application;
fig. 18 is a flowchart of an IDCT signal based on a common butterfly transform according to an embodiment of the present application;
fig. 19 is a flowchart of an IDCT signal based on a common butterfly transform according to an embodiment of the present application;
FIG. 20 is a schematic block diagram of an apparatus 300 of an embodiment of the present application;
fig. 21 is a schematic block diagram of an electronic device 400 provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
Fig. 1 is an alternative schematic diagram of a system architecture 100 according to an embodiment of the present application. As shown in fig. 1, the system architecture 100 includes a server 110 and a terminal device 120. Wherein the server 110 generates a video code stream by encoding the video image, and transmits the video code stream to the terminal device 120. The terminal device 120 receives the video code stream, decodes the video code stream, and displays a video image according to the decoded data.
It should be understood that the server 110 may be a stand-alone physical server, a server cluster or a distributed system formed by a plurality of physical servers, or may be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
The terminal device 120 may be, but is not limited to, a mobile phone, a computer, an intelligent voice interaction device, an intelligent home appliance, a vehicle-mounted terminal, etc.
The terminal device 120 and the server 110 may be directly or indirectly connected through wired or wireless communication, which is not limited herein.
It should be understood that the method provided by the embodiment of the application is not only applied to the encoding and decoding process of video, but also applied to the encoding and decoding process of images.
In order to more clearly understand the embodiments of the present application, the basic procedure of image codec will be briefly described below.
Fig. 2 is a schematic flow chart of image encoding based on discrete cosine transform (Discrete Cosine Transform, DCT) according to an embodiment of the present application. As shown in fig. 2, in the image encoding process, an input image is divided into data blocks of 8x8 size, then DCT transform is performed on the data blocks of 8x8 to obtain DCT coefficients, then the DCT coefficients are quantized, and the quantized coefficients are entropy-encoded to obtain encoded data of the image. The decoding process of an image is the inverse of the encoding process and generally includes entropy decoding, inverse quantization, inverse discrete cosine transform (Inverse Discrete Cosine Transform, IDCT), reconstructing the image.
It should be understood that fig. 2 is only a schematic flowchart illustrating the basic DCT image coding, and includes a plurality of steps of inter-frame prediction, intra-frame prediction, scanning, etc. in a specific implementation process of image coding, and may be specifically understood with reference to the prior art, which is not repeated herein.
DCT is widely used in image and video coding standards such as Joint photographic experts group 2 (Moving Picture Experts Group, MPEG-2) and Joint photographic experts group 4 (Moving Picture Experts Group, MPEG-4), video coding standards, high efficiency video coding (High Efficiency Video Coding, HEVC), and more recently multifunctional video coding (Versatile Video Codec, VVC), AV1 video coding (which is an open source, free video coding first version developed by the open media alliance (Alliance for Open Media), audio video coding standards third edition (Audio Video coding Standard, AVS 3), and the like, still employ DCT as an important coding compression process.
The DCT transform is to convert a set of data from a time domain (time domain) to a frequency domain (frequency domain) for analyzing frequency characteristics of a signal or performing signal compression.
The DCT represents the signal as a weighted combination of a set of cosine functions.
In one-dimensional DCT, given N input data points,/>,/>,……/>Transformed DCT coefficients->Calculated from the following formula (1):
for k=0,…N-1(1)
the two-dimensional DCT transform can be obtained by performing a one-dimensional DCT transform on each line of the image, and then performing a one-dimensional DCT transform on each column of the result.
DCT coefficients after two-dimensional DCT transformationCalculated from the following formula (2):
(2)
the DCT transformation process is in fact a matrix multiplication, and in order to reduce the complexity of DCT (IDCT), a number of fast algorithms have been proposed, of which the two-pass line-and-column algorithm based on butterfly decomposition is still the most common.
Fig. 3 is a DCT computation process based on a common butterfly transform provided in an embodiment of the present application. The left matrix is a butterfly transformation parameter matrix, the parameter matrix is generally a fixed matrix in a butterfly algorithm, and the right matrix is an input coefficient matrix, such as a pixel matrix of an image or an inverse quantized coefficient matrix.
Fig. 4 is a flowchart of an IDCT signal based on a common butterfly transform according to an embodiment of the present application. Although the butterfly transform can reduce the operation amount and improve the algorithm performance. However, when IDCT computation based on a general butterfly transform is performed, the butterfly transform still performs computation on all coefficients of the input coefficient matrix.
The complete IDCT transformation process is described below by a section of the procedure.
One-dimensional column transformation process:
void ButterflyInverseCol8(const int16_t* src, int16_t* dst)
{
int32_t k;
int32_t E[4], O[4];
int32_t EE[2], EO[2];
const int32_t shift = 7;
const int32_t add = 1<<(shift - 1);
for (k = 0; k<4; k++) {
O[k] = g_t8[1][k] * src[8]+ g_t8[3][k]* src[3 * 8] +
g_t8[5][k]* src[5 * 8] + g_t8[7][k] * src[7 * 8];
}
EO[0] = g_t8[2][0] * src[2 * 8]+ g_t8[6][0]* src[6 * 8];
EO[1] = g_t8[2][1] * src[2 * 8]+ g_t8[6][1]* src[6 * 8];
EE[0] = g_t8[0][0] * src[0]+ g_t8[4][0]* src[4 * 8];
EE[1] = g_t8[0][1] * src[0]+ g_t8[4][1]* src[4 * 8];
E[0] = EE[0]+ EO[0];
E[3] = EE[0]- EO[0];
E[1] = EE[1]+ EO[1];
E[2] = EE[1]- EO[1];
for (k = 0; k<4; k++) {
dst[k] = (E[k]+ O[k] + add)>>shift;
dst[k + 4] = (E[3 - k]- O[3 - k] + add)>>shift;
}
}
two-dimensional column transformation process:
void ButterflyInverseCol8x8(const int16_t* src, int16_t* dst)
{
int j;
for(j = 0; j<8; j ++ ) {
ButterflyInverseCol8(src + j * 8, dst + j * 8);
}
}
complete IDCT transformation:
void idct8x8_c(const int16_t* src, int16_t* dst)
{
int16_tcoef[8 * 8];
ButterflyInverseCol8x8(src,coef);
ButterflyInverseRow8x8(coef,dst);
}
this process of DCT computation increases the complexity of decoding. This is because, when the coefficient matrix of the input image is subjected to DCT transform and quantization, a large number of 0 coefficients are generated, and when the input values are all 0 in the inverse DCT transform in the decoding process, the output values are also 0. Thus a transformation of the inverse DCT for multiple 0 inputs is unnecessary.
Recently, in the prior art, an IDCT method for removing 0 coefficients is proposed, which needs to determine each coefficient included in the coefficient matrix after inverse quantization, determine a coefficient other than 0, and perform IDCT transform on the coefficient other than 0. The scheme only gives an acceleration method of 8x8 IDCT transformation, and in the implementation process, the method needs to generate 256 row transformation functions of IDCT and 256 column transformation functions of IDCT, so that the implementation is complex, and the best performance is not achieved. The IDCT transform for 16x16 and the IDCT transform for 32x32 is more complex.
Therefore, the application provides a decoding method based on the inverse discrete cosine transform, which can simply and effectively improve the rate of the inverse discrete cosine transform and further improve the decoding rate.
The following describes a scheme provided in the embodiments of the present application with reference to the accompanying drawings.
Fig. 5 is a schematic flowchart of a decoding method 200 based on inverse discrete cosine transform according to an embodiment of the present application. The method 200 may be performed by any electronic device having data processing capabilities. For example, the electronic device may be implemented as a server or a computer. The following description will take an example in which the electronic device is a terminal device. As shown in fig. 5, method 200 may include steps 210 through 240.
S210, the terminal equipment generates a target matrix according to the coefficient matrix after the inverse quantization, wherein the target matrix is a matrix of 4x4, and the target matrix comprises 16 submatrices; the coefficient matrix is obtained by performing entropy decoding and dequantization on the coded code stream of the image.
S220, the terminal equipment generates a mask matrix of the target matrix according to whether the coefficient of the sub-matrix is 0, wherein the mask matrix is a 4x4 matrix, the coefficient of the mask matrix comprises 1 and 0, wherein when the sub-matrix comprises non-0 coefficient, the coefficient of the mask matrix corresponding to the sub-matrix is 1, and when the coefficient of the sub-matrix comprises 0, the coefficient of the mask matrix corresponding to the sub-matrix is 0.
S230, the terminal equipment calls the function of the inverse discrete cosine transform corresponding to the mask matrix to perform the inverse discrete cosine transform on the inverse quantized coefficient matrix according to the mask matrix to obtain the data after the inverse discrete cosine transform, wherein the function of the inverse discrete cosine transform only calculates the inverse discrete cosine transform of the non-0 coefficient of the inverse quantized coefficient matrix and does not calculate the inverse discrete cosine transform of the 0 coefficient of the inverse quantized coefficient matrix.
S240, the terminal equipment determines the image according to the data after the inverse discrete cosine transform.
The terminal equipment generates a 4x4 target matrix according to the coefficient matrix after the inverse quantization, generates a mask matrix according to whether the coefficient of the target matrix is 0, wherein the coefficient of the mask matrix comprises 1 and 0, 1 represents that the corresponding subarray has non-0 coefficient, and 0 represents that the corresponding subarray coefficient is 0. And invoking an inverse discrete cosine transform function corresponding to the mask matrix according to the mask matrix to perform inverse discrete cosine transform on the inverse quantized coefficient matrix, wherein the inverse discrete cosine transform function only calculates the inverse discrete cosine transform of non-0 coefficient of the inverse quantized coefficient matrix, and does not calculate the inverse discrete cosine transform of 0 coefficient of the inverse quantized coefficient matrix, namely the inverse discrete cosine transform function removes the 0 coefficient to perform the inverse discrete cosine transform, so that the calculation rate of the inverse discrete cosine transform is simply and effectively accelerated, and the decoding rate of videos or images can be further improved.
For a clearer understanding of the present embodiments, the method 200 is described in the following substeps.
In step S210, the terminal device generates a target matrix according to the dequantized coefficient matrix, where the target matrix is a matrix of 4×4, and the target matrix includes 16 sub-matrices.
Specifically, the terminal device obtains a coefficient matrix after performing inverse quantization, and converts the coefficient matrix into a target matrix including 16 submatrices, where the target matrix is a matrix of 4 rows and 4 columns. As shown in formula (3):
(3)
optionally, when the inverse quantized coefficient matrix is an 8x8 matrix, each sub-matrix included in the target matrix is a 2x2 matrix; or,
when the inverse quantized coefficient matrix is a matrix of 16x16, each sub-matrix included in the target matrix is a matrix of 4x4; or,
when the inverse quantized coefficient matrix is a matrix of 32×32, the target matrix includes a matrix of 8×8 each.
Specifically, the inverse quantized coefficient matrix may be an 8×8 matrix, a 16×16 matrix, or a 32×32 matrix, and the specific size of the coefficient matrix is determined by the multimedia compression standard used. For an 8x8 transform, each sub-array size is 2x2; for a 16x16 transform, each sub-array size is 4x4; for a 32x32 transform, each sub-array size is 8x8.
In step S220, the terminal device generates a mask matrix according to whether the coefficient of the sub-matrix is 0, the mask matrix being a matrix of 4x4, the coefficient of the mask matrix including 1 and 0.
Optionally, the generating a mask matrix according to whether the coefficient of the submatrix is 0 includes:
when the submatrix comprises non-0 coefficients, the coefficient of the mask matrix corresponding to the submatrix is 1;
when the sub-matrix includes all the coefficients of 0, the coefficient of the mask matrix corresponding to the sub-matrix is 0.
Specifically, in the above formula (3), the C00 submatrix has a non-zero coefficient, and the remaining submatrices are all 0. The non-zero submatrix may be represented by bit 1 and bit 0 represents the all-0 submatrix, and then the mask matrix corresponding to equation 1 is shown in equation (4) below:
(4)
it should be understood that when the terminal device generates the mask matrix according to whether the coefficient of the submatrix is 0, if a certain submatrix is composed of 0 coefficients, the submatrix may be expressed as a Z submatrix first, as shown in the following formula (5):
(5)
only the position C00 subarray in the above formula (3) has a non-zero coefficient, and the rest subarrays are all 0. Bit 1 is then used to represent the non-zero subarrays, bit 0 is used to represent the all 0Z subarrays, and equation (5) can be expressed as equation (4) above.
Optionally, the decoding method further includes:
according to the dividing method of the mask matrix, the inverse discrete cosine transform function is generated, wherein the inverse discrete cosine transform function comprises 16 inverse discrete cosine transform row transform functions and 16 inverse discrete cosine transform column transform functions, the 16 inverse discrete cosine transform row transform functions comprise inverse discrete cosine transforms of non-0 coefficients of the inverse quantized coefficient matrix, and the 16 inverse discrete cosine transform column transform functions comprise inverse discrete cosine transforms of non-0 coefficients of the inverse quantized coefficient matrix.
Specifically, according to the above all-0 subarray division method, each row and each column has 16 column transform functions of inverse discrete cosine transform and row transform functions of inverse discrete cosine transform, only the inverse discrete cosine transform of non-0 coefficient of the inverse quantized coefficient matrix is calculated in the column transform functions of inverse discrete cosine transform and the row transform functions of inverse discrete cosine transform, the inverse discrete cosine transform of 0 coefficient of the inverse quantized coefficient matrix is not calculated, the calculated amount of inverse discrete cosine transform is reduced, and the calculation speed of inverse discrete cosine transform is improved.
For a clearer understanding of the present embodiment, the following shows the first column 16 possible degenerated column transforms of the 4x4 mask matrix, respectively:
binary 0001, decimal sequence number 0001;
binary 0010, decimal number 0002;
binary 0100, decimal number 0004;
binary 1000, decimal number 0008;
binary 0011, decimal number 0003;
binary 0101, decimal sequence number 0005;
binary 1001, decimal number 0009;
binary 0110, decimal number 0006;
binary 1010, decimal sequence number 0010;
binary 1100, decimal sequence number 0012;
binary 0111, decimal number 0007;
binary 1011, decimalSerial number 0011;
binary 1101, decimal number 0013;
binary 1110, decimal sequence number 0014;
binary 1111, decimal sequence number 0015;
binary 0000, decimal sequence number 0000, this path directly outputs all zeros.
The following describes a signal flow diagram of 16 column transforms based on the inverse discrete cosine transform of a normal butterfly transform, respectively.
Fig. 6 is a flowchart of an IDCT signal based on a butterfly transformation according to an embodiment of the present application, where the first column of the mask matrix is At this time, only the first two elements of the first column representing the inverse quantized coefficient matrix are not 0, and only the first two elements of the first column need to be calculated during IDCT calculation.
Fig. 7 is a flowchart of an IDCT signal based on a butterfly transformation according to an embodiment of the present application, where the first column of the mask matrix isAt this time, only the third and fourth elements of the first column representing the inverse quantized coefficient matrix are not 0, and only the third and fourth elements of the first column need to be calculated during IDCT calculation.
Fig. 8 is a flowchart of an IDCT signal based on a butterfly transformation according to an embodiment of the present application, where the first column of the mask matrix isAt this time, only the fifth and sixth elements of the first column representing the inverse quantized coefficient matrix are not 0, and only the fifth and sixth elements of the first column need to be calculated during IDCT calculation.
Fig. 9 is a flowchart of an IDCT signal based on a butterfly transformation according to an embodiment of the present application, where the first column of the mask matrix isAt this time, only the seventh and eighth elements of the first column representing the inverse quantized coefficient matrix are not 0, and only the seventh and eighth elements of the first column need to be calculated in the IDCT calculation.
Fig. 10 is a flowchart of an IDCT signal based on a butterfly transformation according to an embodiment of the present application, where the first column of the mask matrix isAt this time, the first four elements of the first column representing the inverse quantized coefficient matrix are not 0, and only the first four elements of the first column need to be calculated during IDCT calculation.
Fig. 11 is a flowchart of an IDCT signal based on a butterfly transformation according to an embodiment of the present application, where the first column of the mask matrix isAt this time, the first, second, fifth and sixth elements representing the first column of the inverse quantized coefficient matrix are not 0, and only the first, second, fifth and sixth elements of the first column need to be calculated in the IDCT calculation.
Fig. 12 is a flowchart of an IDCT signal based on a butterfly transformation according to an embodiment of the present application, where the first column of the mask matrix isAt this time, the first, second, seventh and eighth of the first column of the inverse quantized coefficient matrix are representedThe element is not 0, and only the first, second, seventh and eighth elements of the first column need to be calculated in IDCT calculation.
Fig. 13 is a flowchart of an IDCT signal based on a butterfly transformation according to an embodiment of the present application, where the first column of the mask matrix is At this time, the third, fourth, fifth and sixth elements of the first column representing the inverse quantized coefficient matrix are not 0, and only the third, fourth, fifth and sixth elements of the first column need to be calculated in the IDCT calculation.
Fig. 14 is a flowchart of an IDCT signal based on a butterfly transformation according to an embodiment of the present application, where the first column of the mask matrix isThe third, fourth, seventh and eighth elements of the first column representing the inverse quantized coefficient matrix are not 0 at this time, and only the third, fourth, seventh and eighth elements of the first column need to be calculated in the IDCT calculation.
Fig. 15 is a flowchart of an IDCT signal based on a butterfly transformation according to an embodiment of the present application, where the first column of the mask matrix isAt this time, the fifth, sixth, seventh and eighth elements representing the first column of the inverse quantized coefficient matrix are not 0, and only the fifth, sixth, seventh and eighth elements of the first column need to be calculated in the IDCT calculation.
Fig. 16 is a flowchart of an IDCT signal based on a butterfly transformation according to an embodiment of the present application, where the first column of the mask matrix is At this time, the first six elements of the first column representing the inverse quantized coefficient matrix are not 0, and only the first six elements of the first column need to be calculated in the IDCT calculation.
Fig. 17 is a flowchart of an IDCT signal based on a butterfly transformation according to an embodiment of the present application, where the first column of the mask matrix isThe first, second, third, fourth, seventh and eighth elements of the first column representing the inverse quantized coefficient matrix are not 0 at this time, and only the first, second, third, fourth, seventh and eighth elements of the first column need to be calculated in the IDCT calculation.
Fig. 18 is a flowchart of an IDCT signal based on a butterfly transformation according to an embodiment of the present application, where the first column of the mask matrix isAt this time, the first, second, fifth, sixth, seventh and eighth elements representing the first column of the inverse quantized coefficient matrix are not 0, and only the first, second, fifth, sixth, seventh and eighth elements of the first column need to be calculated in IDCT calculation.
Fig. 19 is a flowchart of an IDCT signal based on a butterfly transformation according to an embodiment of the present application, where the first column of the mask matrix is At this time, the third, fourth, fifth, sixth, seventh and eighth elements of the first column representing the inverse quantized coefficient matrix are not 0, and only the third, fourth, fifth, sixth, seventh and eighth elements of the first column need to be calculated in the IDCT calculation.
When the first column of the mask matrix isIn this case, the flow chart of the IDCT signal based on the normal butterfly transformation in the first column is shown in fig. 4, where all the elements in the first column representing the inverse quantized coefficient matrix are not 0, and in the IDCT calculation, all the elements in the first column need to be calculated.
When the first column of the mask matrix isWhen this path outputs all zeros directly.
As can be seen from the signal flow chart, the method for sub-array division provided by the embodiment of the present application does not need to perform IDCT calculation on all elements in each column each time, so that the operand during IDCT conversion is obviously reduced, and the algorithm performance is improved.
It will be appreciated that the above describes a mask matrix diagram of 16 inverse discrete cosine transformed column transforms and that the mask matrix of the inverse discrete cosine transformed column transforms is the same as the mask matrix of the inverse discrete cosine transformed column transforms.
It should be understood that, since only the inverse discrete cosine transform of the non-0 coefficient of the inverse quantized coefficient matrix is calculated among the column transform functions and the row transform functions of the inverse discrete cosine transforms, and the inverse discrete cosine transform of the 0 coefficient of the inverse quantized coefficient matrix is not calculated, the column transform functions and the row transform functions of the inverse discrete cosine transforms of the 16 inverse discrete cosine transforms may also be referred to as the column transform functions and the row transform functions of the inverse discrete cosine transforms of the degenerated inverse discrete cosine transforms.
In order to more clearly understand this step, a specific example will be described below.
When the function ButterflyInver 8 calculates, if the accessed input matrix coefficient src [ x ] belongs to a certain all 0 subarray, the code accessing the input matrix coefficient can be replaced by 0, namely the corresponding code is directly deleted.
For example, the first column in formula (4)When the IDCT transform is performed, the input matrix coefficients may be directly deleted without processing the third to seventh rows.
The procedure in the IDCT conversion performed in the first column in the above formula (4) is exemplarily described as follows:
void ButterflyInverse8_p0_0001 (const int16_t* src, int16_t* dst)
{
int32_t val;
int32_t E[4], O[4];
int32_t EE[2], EO[2];
const int32_t shift = 7;
const int32_t add = 1<<(shift - 1);
O[0] = g_t8[1][0] * src[1*8];
O[1] = g_t8[1][1] * src[1*8];
O[2] = g_t8[1][2] * src[1*8];
O[3] = g_t8[1][3] * src[1*8];
EE[0] = g_t8[0][0] * src[0 * 8];
EE[1] = g_t8[0][1] * src[0 * 8];
E[0] = EE[0];
E[3] = EE[0];
E[1] = EE[1];
E[2] = EE[1];
dst[0] = (E[0]+ O[0] + add)>>shift;
dst[4] = (E[3]- O[3] + add)>>shift;
dst[1] = (E[1]+ O[1] + add)>>shift;
dst[5] = (E[2]- O[2] + add)>>shift;
dst[2] = (E[2]+ O[2] + add)>>shift;
dst[6] = (E[1]- O[1] + add)>>shift;
dst[3] = (E[3]+ O[3] + add)>>shift;
dst[7] = (E[0]- O[0] + add)>>shift;
}
from the above, the program code is greatly reduced, the operation amount during IDCT conversion is obviously reduced, and the speed of IDCT conversion can be improved.
In step S230, the terminal device invokes an inverse discrete cosine transform function corresponding to the mask matrix according to the mask matrix to perform inverse discrete cosine transform on the inverse quantized coefficient matrix, so as to obtain inverse discrete cosine transformed data.
Optionally, according to the mask matrix, invoking an inverse discrete cosine transform function corresponding to the mask matrix to perform inverse discrete cosine transform on the inverse quantized coefficient matrix to obtain inverse discrete cosine transformed data, where the method includes:
According to the target line coefficient of the mask matrix, invoking an inverse discrete cosine line transformation function corresponding to the target line coefficient to perform inverse discrete cosine line transformation on the inverse quantized coefficient matrix to obtain inverse discrete cosine line transformed data;
and according to the target column coefficient of the mask matrix, invoking an inverse discrete cosine column transformation function corresponding to the target column coefficient to perform inverse discrete cosine column transformation on the data after inverse discrete cosine line transformation, so as to obtain the data after inverse discrete cosine transformation.
Optionally, the invoking the inverse discrete cosine transform function corresponding to the mask matrix according to the mask matrix performs inverse discrete cosine transform on the inverse quantized coefficient matrix to obtain inverse discrete cosine transformed data, including:
according to the target column coefficient of the mask matrix, invoking an inverse discrete cosine column transformation function corresponding to the target column coefficient to perform inverse discrete cosine column transformation on the inverse quantized coefficient matrix to obtain inverse discrete cosine column transformed data;
and according to the target line coefficient of the mask matrix, invoking an inverse discrete cosine line transformation function corresponding to the target line coefficient to perform inverse discrete cosine line transformation on the data after inverse discrete cosine column transformation, so as to obtain the data after inverse discrete cosine transformation.
The two implementation methods describe that when inverse discrete cosine transform calculation is performed on the coefficient matrix after inverse quantization, inverse discrete cosine transform can be performed on the coefficient matrix after inverse quantization to obtain data after inverse discrete cosine transform, and then inverse discrete cosine column transform is performed on the data after inverse discrete cosine transform to obtain data after inverse discrete cosine transform; or performing inverse discrete cosine column transformation on the coefficient matrix after inverse quantization to obtain data after inverse discrete cosine column transformation, and performing inverse discrete cosine row transformation on the data after inverse discrete cosine column transformation to obtain data after inverse discrete cosine transformation.
For example, after the scan obtains the mask matrix, a fast rank transform corresponding to the mask is invoked.
typedef void (*idct_1d_ptr)(const int16_t*, int16_t*);
idct_1d_ptr idct8x8_pass0[16]={
ButterflyInverse8_p0_0000,
ButterflyInverse8_p0_0001,
……
};
idct_1d_ptr idct8x8_pass1[16]={
ButterflyInverse8_p1_0000,
ButterflyInverse8_p1_0001,
……
};
void idct8x8_sparse_c(const int16_t* src, int16_t* dst)
{
int16_tcoef[8 * 8]);
uint32_t col_mask = *(uint32_t*)(dst);
uint32_t row_mask = *(uint32_t*)(dst + 2);
int i;
for (i = 0; i<8; i+=2) {
ButterflyInverse8_pass0[col_mask&0xf](src + i, coef + i * 8);
ButterflyInverse8_pass0[col_mask&0xf](src + i + 1, coef + i * 8 + 8);
col_mask>>= 4;
}
for (i = 0; i<8; i++) {
ButterflyInverse8_pass1[row_mask](coef + i * 8, dst + i * 8);
}
}
Alternatively, the decoding method 200 may be applied to the encoding process of an image or video.
Specifically, at the encoding end, it is often required to detect whether the encoded code stream meets the quality requirement, generally, the encoding end decodes the encoded code stream to obtain a decoded original image, compares the decoded original image with the encoded original image, and determines whether to adjust the encoding parameters, such as the encoding mode, and the like.
It should be appreciated that the above examples are described for an 8x8 inverse quantized coefficient matrix, and that the same division and degenerate rank transform function may be written for the 16x16 and 32x32 inverse quantized coefficient matrices.
In order to verify the performance of the decoding method based on the inverse discrete cosine transform provided in the embodiment of the present application, standard butterfly transform and the inverse discrete cosine transform test based on the present application are performed on the IDCT 8x8, the IDCT 16x16 and the IDCT 32x32, respectively, so as to obtain data as shown in table 1.
TABLE 1 execution time of different IDCT transforms
Through testing, it can be known that the decoding method based on the inverse discrete cosine transform provided by the embodiment of the application can rapidly realize IDCT, and the calculation time required by the method is about half of that of a common butterfly algorithm. Wherein the speed of IDCT 8x8 is doubled, the speed of IDCT 16x16 is doubled, and the speed of IDCT 32x32 is increased by a larger degree.
The specific embodiments of the present application have been described in detail above with reference to the accompanying drawings, but the present application is not limited to the specific details of the above embodiments, and various simple modifications may be made to the technical solutions of the present application within the scope of the technical concept of the present application, and all the simple modifications belong to the protection scope of the present application. For example, the specific features described in the above embodiments may be combined in any suitable manner, and in order to avoid unnecessary repetition, various possible combinations are not described in detail. As another example, any combination of the various embodiments of the present application may be made without departing from the spirit of the present application, which should also be considered as disclosed herein.
It should be further understood that, in the various method embodiments of the present application, the sequence numbers of the foregoing processes do not mean the order of execution, and the order of execution of the processes should be determined by the functions and internal logic of the processes, and should not constitute any limitation on the implementation process of the embodiments of the present application. It is to be understood that the numbers may be interchanged where appropriate such that the described embodiments of the application may be implemented in other sequences than those illustrated or described.
The decoding method embodiments based on the inverse discrete cosine transform of the present application are described in detail above with reference to fig. 1 to 19, and the device embodiments of the present application are described in detail below with reference to fig. 20 and 21.
Fig. 20 is a schematic block diagram of an apparatus 300 according to an embodiment of the present application, where the apparatus 300 may implement the functions of a terminal device in the decoding method based on inverse discrete cosine transform. As shown in fig. 20, the apparatus 300 may include a processing unit 310.
The processing unit 310 is configured to generate a target matrix according to the dequantized coefficient matrix, where the target matrix is a 4x4 matrix, the target matrix includes 16 submatrices, and the coefficient matrix is obtained by performing entropy decoding and dequantization on a coded code stream of an image;
The processing unit 310 is further configured to generate a mask matrix of the target matrix according to whether coefficients of the sub-matrix are 0, where the mask matrix is a 4x4 matrix, and coefficients of the mask matrix include 1 and 0, where when the sub-matrix includes non-0 coefficients, coefficients of the mask matrix corresponding to the sub-matrix are 1, and when the coefficients of the sub-matrix include all 0, coefficients of the mask matrix corresponding to the sub-matrix are 0;
the processing unit 310 is further configured to invoke an inverse discrete cosine transform function corresponding to the mask matrix to perform an inverse discrete cosine transform on the inverse quantized coefficient matrix according to the mask matrix, so as to obtain inverse discrete cosine transformed data, where the inverse discrete cosine transform function only calculates an inverse discrete cosine transform of a non-0 coefficient of the inverse quantized coefficient matrix, and does not calculate an inverse discrete cosine transform of a 0 coefficient of the inverse quantized coefficient matrix;
the processing unit 310 is further configured to determine the image according to the inverse discrete cosine transformed data.
In some embodiments, the processing unit 310 is further configured to generate the inverse discrete cosine transform function according to the division method of the mask matrix, where the inverse discrete cosine transform function includes 16 inverse discrete cosine transform row transform functions and 16 inverse discrete cosine transform column transform functions, the 16 inverse discrete cosine transform row transform functions include inverse discrete cosine transforms of non-0 coefficients of the inverse quantized coefficient matrix, and the 16 inverse discrete cosine transform column transform functions include inverse discrete cosine transforms of non-0 coefficients of the inverse quantized coefficient matrix.
In some embodiments, the processing unit 310 is specifically configured to: according to the target line coefficient of the mask matrix, invoking an inverse discrete cosine line transformation function corresponding to the target line coefficient to perform inverse discrete cosine line transformation on the inverse quantized coefficient matrix to obtain inverse discrete cosine line transformed data;
and according to the target column coefficient of the mask matrix, invoking an inverse discrete cosine column transformation function corresponding to the target column coefficient to perform inverse discrete cosine column transformation on the data after inverse discrete cosine line transformation, so as to obtain the data after inverse discrete cosine transformation.
In some embodiments, the processing unit 310 is specifically configured to: according to the target column coefficient of the mask matrix, invoking an inverse discrete cosine column transformation function corresponding to the target column coefficient to perform inverse discrete cosine column transformation on the inverse quantized coefficient matrix to obtain inverse discrete cosine column transformed data;
and according to the target line coefficient of the mask matrix, invoking an inverse discrete cosine line transformation function corresponding to the target line coefficient to perform inverse discrete cosine line transformation on the data after inverse discrete cosine line transformation, so as to obtain the data after inverse discrete cosine transformation.
In some embodiments, when the inverse quantized coefficient matrix is an 8x8 matrix, the target matrix includes a matrix with each sub-matrix being 2x 2; or,
when the inverse quantized coefficient matrix is a matrix of 16x16, each sub-matrix included in the target matrix is a matrix of 4x 4; or,
when the inverse quantized coefficient matrix is a matrix of 32×32, each submatrix included in the target matrix is an 8×8 matrix.
In some embodiments, the inverse quantized coefficient matrix is sized according to the multimedia compression standard employed.
In some embodiments, the device is an encoding device and/or a decoding device of an image or video.
In some embodiments, the apparatus further comprises a display unit 320, the processing unit 310 is configured to reconstruct an image from the inverse discrete cosine transformed data, and the display unit 320 is configured to display the image.
It should be understood that apparatus embodiments and method embodiments may correspond with each other and that similar descriptions may refer to the method embodiments. To avoid repetition, no further description is provided here. Specifically, when the apparatus 300 for data processing in this embodiment may correspond to an execution body for executing the method 200 in this embodiment of the present application, the foregoing and other operations and/or functions of each module in the apparatus 300 are respectively for implementing the corresponding flow of each method in fig. 3, and are not described herein for brevity.
The apparatus and system of embodiments of the present application are described above in terms of functional modules in connection with the accompanying drawings. It should be understood that the functional module may be implemented in hardware, or may be implemented by instructions in software, or may be implemented by a combination of hardware and software modules. Specifically, each step of the method embodiments in the embodiments of the present application may be implemented by an integrated logic circuit of hardware in a processor and/or an instruction in software form, and the steps of the method disclosed in connection with the embodiments of the present application may be directly implemented as a hardware decoding processor or implemented by a combination of hardware and software modules in the decoding processor. Alternatively, the software modules may be located in a well-established storage medium in the art such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, and the like. The storage medium is located in a memory, and the processor reads information in the memory, and in combination with hardware, performs the steps in the above method embodiments.
Fig. 21 is a schematic block diagram of an electronic device 400 provided in an embodiment of the present application.
As shown in fig. 21, the electronic device 400 may include:
A memory 410 and a processor 420, the memory 410 being adapted to store a computer program and to transfer the program code to the processor 420. In other words, the processor 420 may call and run a computer program from the memory 410 to implement the methods in embodiments of the present application.
For example, the processor 420 can be configured to execute the steps of the various execution bodies of the method 200 described above according to instructions in the computer program.
In some embodiments of the present application, the processor 420 may include, but is not limited to:
a general purpose processor, digital signal processor (Digital Signal Processor, DSP), application specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like.
In some embodiments of the present application, the memory 410 includes, but is not limited to:
volatile memory and/or nonvolatile memory. The nonvolatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable EPROM (EEPROM), or a flash Memory. The volatile memory may be random access memory (Random Access Memory, RAM) which acts as an external cache. By way of example, and not limitation, many forms of RAM are available, such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (Double Data Rate SDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), and Direct memory bus RAM (DR RAM).
In some embodiments of the present application, the computer program may be partitioned into one or more modules that are stored in the memory 410 and executed by the processor 420 to perform the methods provided herein. The one or more modules may be a series of computer program instruction segments capable of performing the specified functions, which are used to describe the execution of the computer program in the electronic device 400.
Optionally, the electronic device 400 may further include:
a communication interface 430, the communication interface 430 being connectable to the processor 420 or the memory 410.
The processor 420 may control the communication interface 430 to communicate with other devices, and in particular, may send information or data to other devices or receive information or data sent by other devices. By way of example, communication interface 430 may include a transmitter and a receiver. The communication interface 430 may further include antennas, the number of which may be one or more.
It should be appreciated that the various components in the electronic device 400 are connected by a bus system that includes a power bus, a control bus, and a status signal bus in addition to a data bus.
According to an aspect of the present application, there is provided a communication device comprising a processor and a memory for storing a computer program, the processor being adapted to invoke and run the computer program stored in the memory, such that the encoder performs the method of the above method embodiments.
According to an aspect of the present application, there is provided a computer storage medium having stored thereon a computer program which, when executed by a computer, enables the computer to perform the method of the above-described method embodiments. Alternatively, embodiments of the present application also provide a computer program product comprising instructions which, when executed by a computer, cause the computer to perform the method of the method embodiments described above.
According to another aspect of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium and executes the computer instructions to cause the computer device to perform the method of the above-described method embodiments.
In other words, when implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces, in whole or in part, a flow or function consistent with embodiments of the present application. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a digital video disc (digital video disc, DVD)), or a semiconductor medium (e.g., a Solid State Disk (SSD)), or the like.
It should be understood that in the embodiments of the present application, "B corresponding to a" means that B is associated with a. In one implementation, B may be determined from a. It should also be understood that determining B from a does not mean determining B from a alone, but may also determine B from a and/or other information.
In the description of the present application, unless otherwise indicated, "at least one" means one or more, and "a plurality" means two or more. In addition, "and/or" describes an association relationship of the association object, and indicates that there may be three relationships, for example, a and/or B may indicate: a alone, a and B together, and B alone, wherein a, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (one) of a, b, or c may represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c may be single or plural.
It should be further understood that the description of the first, second, etc. in the embodiments of the present application is for purposes of illustration and distinction only, and does not represent a specific limitation on the number of devices in the embodiments of the present application, and should not constitute any limitation on the embodiments of the present application.
It should also be appreciated that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or server that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It will be appreciated that in the specific embodiments of the present application, data related to user information and the like may be involved. When the above embodiments of the present application are applied to specific products or technologies, user approval or consent is required, and the collection, use and processing of relevant data is required to comply with relevant laws and regulations and standards of the relevant countries and regions.
Those of ordinary skill in the art will appreciate that the various illustrative modules and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus, device, and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or modules, which may be in electrical, mechanical, or other forms.
The modules illustrated as separate components may or may not be physically separate, and components shown as modules may or may not be physical modules, i.e., may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. For example, functional modules in the embodiments of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module.
The foregoing is merely a specific embodiment of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes or substitutions are covered in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A decoding method based on inverse discrete cosine transform, comprising:
generating a target matrix according to the inverse quantized coefficient matrix, wherein the target matrix is a 4x4 matrix, the target matrix comprises 16 submatrices, and the coefficient matrix is obtained by performing entropy decoding and inverse quantization on an encoding code stream of an image;
generating a mask matrix of the target matrix according to whether the coefficient of the sub-matrix is 0, wherein the mask matrix is a 4x4 matrix, and the coefficient of the mask matrix comprises 1 and 0, wherein when the sub-matrix comprises non-0 coefficients, the coefficient of the mask matrix corresponding to the sub-matrix is 1, and when the coefficient of the sub-matrix comprises all 0, the coefficient of the mask matrix corresponding to the sub-matrix is 0;
according to the mask matrix, invoking an inverse discrete cosine transform function corresponding to the mask matrix to perform inverse discrete cosine transform on the inverse quantized coefficient matrix to obtain inverse discrete cosine transformed data, wherein the inverse discrete cosine transformed function only calculates the inverse discrete cosine transform of non-0 coefficient of the inverse quantized coefficient matrix and does not calculate the inverse discrete cosine transform of 0 coefficient of the inverse quantized coefficient matrix;
And determining the image according to the data after the inverse discrete cosine transform.
2. The decoding method of claim 1, wherein the decoding method further comprises:
according to the dividing method of the mask matrix, the inverse discrete cosine transform function is generated, wherein the inverse discrete cosine transform function comprises 16 inverse discrete cosine transform row transform functions and 16 inverse discrete cosine transform column transform functions, the 16 inverse discrete cosine transform row transform functions comprise inverse discrete cosine transforms of non-0 coefficients of the inverse quantized coefficient matrix, and the 16 inverse discrete cosine transform column transform functions comprise inverse discrete cosine transforms of non-0 coefficients of the inverse quantized coefficient matrix.
3. The decoding method according to claim 1, wherein the step of calling an inverse discrete cosine transform function corresponding to the mask matrix according to the mask matrix to perform inverse discrete cosine transform on the inversely quantized coefficient matrix to obtain inverse discrete cosine transformed data includes:
according to the target line coefficient of the mask matrix, invoking an inverse discrete cosine line transformation function corresponding to the target line coefficient to perform inverse discrete cosine line transformation on the inverse quantized coefficient matrix to obtain inverse discrete cosine line transformed data;
And according to the target column coefficient of the mask matrix, invoking an inverse discrete cosine column transformation function corresponding to the target column coefficient to perform inverse discrete cosine column transformation on the data after inverse discrete cosine line transformation, so as to obtain the data after inverse discrete cosine transformation.
4. The decoding method according to claim 1, wherein the step of calling an inverse discrete cosine transform function corresponding to the mask matrix according to the mask matrix to perform inverse discrete cosine transform on the inverse quantized coefficient matrix to obtain inverse discrete cosine transformed data includes:
according to the target column coefficient of the mask matrix, invoking an inverse discrete cosine column transformation function corresponding to the target column coefficient to perform inverse discrete cosine column transformation on the inverse quantized coefficient matrix to obtain inverse discrete cosine column transformed data;
and according to the target line coefficient of the mask matrix, invoking an inverse discrete cosine line transformation function corresponding to the target line coefficient to perform inverse discrete cosine line transformation on the data after inverse discrete cosine column transformation, so as to obtain the data after inverse discrete cosine transformation.
5. The decoding method of claim 1, wherein,
When the coefficient matrix after the inverse quantization is an 8x8 matrix, each submatrix included in the target matrix is a 2x2 matrix; or,
when the inverse quantized coefficient matrix is a matrix of 16x16, each sub-matrix included in the target matrix is a matrix of 4x 4; or,
when the inverse quantized coefficient matrix is a matrix of 32×32, each submatrix included in the target matrix is an 8×8 matrix.
6. The decoding method of claim 1, wherein the size of the inverse quantized coefficient matrix is set according to a multimedia compression standard employed.
7. The decoding method according to claim 1, wherein the decoding method is applied in the encoding process of an image or video.
8. A decoding apparatus, comprising:
the processing unit is used for generating a target matrix according to the inverse quantized coefficient matrix, wherein the target matrix is a 4x4 matrix, the target matrix comprises 16 submatrices, and the coefficient matrix is obtained by performing entropy decoding and inverse quantization on an encoded code stream of an image;
the processing unit is further configured to generate a mask matrix of the target matrix according to whether coefficients of the sub-matrix are 0, where the mask matrix is a 4x4 matrix, and coefficients of the mask matrix include 1 and 0, where when the sub-matrix includes non-0 coefficients, coefficients of the mask matrix corresponding to the sub-matrix are 1, and when the coefficients of the sub-matrix include all 0, coefficients of the mask matrix corresponding to the sub-matrix are 0;
The processing unit is further configured to call an inverse discrete cosine transform function corresponding to the mask matrix according to the mask matrix, and perform inverse discrete cosine transform on the inverse quantized coefficient matrix to obtain inverse discrete cosine transformed data;
the processing unit is further configured to determine the image according to the inverse discrete cosine transformed data.
9. An electronic device comprising a processor and a memory, the memory having instructions stored therein, which when executed by the processor cause the processor to perform the decoding method of any of claims 1-7.
10. A computer storage medium comprising instructions which, when run on a computer, cause the computer to perform the decoding method of any of claims 1-7.
CN202311123729.3A 2023-09-01 2023-09-01 Decoding method and device based on inverse discrete cosine transform Active CN116843775B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311123729.3A CN116843775B (en) 2023-09-01 2023-09-01 Decoding method and device based on inverse discrete cosine transform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311123729.3A CN116843775B (en) 2023-09-01 2023-09-01 Decoding method and device based on inverse discrete cosine transform

Publications (2)

Publication Number Publication Date
CN116843775A CN116843775A (en) 2023-10-03
CN116843775B true CN116843775B (en) 2023-12-22

Family

ID=88171085

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311123729.3A Active CN116843775B (en) 2023-09-01 2023-09-01 Decoding method and device based on inverse discrete cosine transform

Country Status (1)

Country Link
CN (1) CN116843775B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5563718A (en) * 1993-11-30 1996-10-08 Polaroid Corporation Image coding by use of discrete cosine transforms
CN103002276A (en) * 2011-03-31 2013-03-27 Vixs系统公司 Multi-format video decoder and methods for use therewith
CN103814573A (en) * 2011-07-19 2014-05-21 超威半导体公司 Apparatus and method for decoding using coefficient compression
CN105704498A (en) * 2016-03-17 2016-06-22 北京大学深圳研究生院 Method and device for inverse discrete cosine transform, video coding/decoding method and frame
CN113223038A (en) * 2021-05-24 2021-08-06 之江实验室 Discrete cosine transform-based mask representation instance segmentation method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7233703B2 (en) * 2003-03-25 2007-06-19 Sharp Laboratories Of America, Inc. Computation-reduced IDCT method for video coding
CN104104958B (en) * 2013-04-08 2017-08-25 联发科技(新加坡)私人有限公司 Picture decoding method and its picture decoding apparatus
US11138290B2 (en) * 2019-03-30 2021-10-05 Intel Corporation Discrete cosine transform/inverse discrete cosine transform (DCT/IDCT) systems and methods

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5563718A (en) * 1993-11-30 1996-10-08 Polaroid Corporation Image coding by use of discrete cosine transforms
CN103002276A (en) * 2011-03-31 2013-03-27 Vixs系统公司 Multi-format video decoder and methods for use therewith
CN103814573A (en) * 2011-07-19 2014-05-21 超威半导体公司 Apparatus and method for decoding using coefficient compression
CN105704498A (en) * 2016-03-17 2016-06-22 北京大学深圳研究生院 Method and device for inverse discrete cosine transform, video coding/decoding method and frame
CN113223038A (en) * 2021-05-24 2021-08-06 之江实验室 Discrete cosine transform-based mask representation instance segmentation method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于ARM的嵌入式静态图像显示系统的研究与实现;王战盟;《中国优秀硕士学位论文全文数据库信息科技辑》(第5期);I137-88 *

Also Published As

Publication number Publication date
CN116843775A (en) 2023-10-03

Similar Documents

Publication Publication Date Title
CN108605141B (en) Efficient parameter storage for compact multi-pass transforms
US11647214B2 (en) Multiple transforms adjustment stages for video coding
JP5529257B2 (en) Compute even-size discrete cosine transform
JP2019508969A (en) Efficient transform coding using optimized compact multi-pass transform
CN110710217B (en) Method and apparatus for coding last significant coefficient flag
US10250907B2 (en) Intra-frame pixel prediction method, encoding method and decoding method, and device thereof
US20120307893A1 (en) Fast computing of discrete cosine and sine transforms of types vi and vii
US20100172409A1 (en) Low-complexity transforms for data compression and decompression
KR20130054354A (en) Variable localized bit depth increase for fixed-point transforms in video coding
US20120082230A1 (en) Variable length coding of video block coefficients
CN110636313B (en) Transformation and quadratic transformation matrix training method, encoder and related device
WO2011005105A1 (en) Computer implemented early skip
US11323714B2 (en) Method and device for context-adaptive binary arithmetic coding a sequence of binary symbols representing a syntax element related to video data
RU2624464C1 (en) Scan orders for non-conversion encoding
WO2022116085A1 (en) Encoding method, decoding method, encoder, decoder, and electronic device
CN116843775B (en) Decoding method and device based on inverse discrete cosine transform
US10419772B2 (en) Parallel arithmetic coding techniques
WO2023082107A1 (en) Decoding method, encoding method, decoder, encoder, and encoding and decoding system
US20220046253A1 (en) Video encoding and decoding methods and apparatuses, device, and storage medium
KR20030057425A (en) An adaptive inverse transformation device
WO2021263251A1 (en) State transition for dependent quantization in video coding
CN113411588B (en) Method for determining prediction direction, decoder and computer storage medium
CN116805971A (en) Image coding and decoding method, device and equipment
CN108206950B (en) Code stream length calculation method and device
Lubobya et al. Optimization of 4x4 Integer DCT in H. 264/AVC Encoder

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant