Multimedia file compression method, device and electronic equipment

By determining and interpolation pixel parameters on the image compression unit of the multimedia file, efficient compression of the multimedia file is achieved, and the problem of large storage space and bandwidth occupancy of multimedia file is solved.

CN116320449BActive Publication Date: 2025-04-22HAINING ESWIN IC DESIGN CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310093437.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-30
Publication Date
2025-04-22
Estimated Expiration
2043-01-30

AI Technical Summary

Technical Problem

Multimedia files take up a lot of storage space and bandwidth, especially high-definition images and videos.

Method used

By acquiring the image compression unit of the multimedia file, the minimum and maximum values ​​of the sum of the pixel values ​​of at least two color channels in the pixel points are determined as the first and second pixel parameters, and numerical values ​​are inserted between them for interpolation, and each pixel point is compressed and encoded based on the relationship between the pixel value and the interpolated value.

Benefits of technology

The compression of multimedia files is realized, reducing the storage space occupied by storing multimedia files and the bandwidth occupied by transmitting multimedia files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116320449B_ABST
    Figure CN116320449B_ABST
Patent Text Reader

Abstract

The present application provides a multimedia file compression, device, electronic device and computer-readable storage medium, and relates to the field of computer technology. The method includes: by determining the first pixel parameter and the second pixel parameter of the image compression unit, inserting at least one first value between the first pixel parameter and the second pixel parameter; based on the numerical relationship between the pixel value and the first value, performing compression encoding processing on each of the pixel points to obtain a target compressed file. Specifically, the data volume of the encoding parameter determined by the numerical relationship is less than the data volume of the pixel value of the pixel point, thereby achieving compression of the multimedia file, reducing the storage space occupied by storing the multimedia file and the bandwidth occupied by transmitting the multimedia file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and more specifically, to a multimedia file compression method, device, electronic device, and computer-readable storage medium. Background Art

[0002] Multimedia technology refers to the technology of using computers to comprehensively process and manage various media information such as text, data, graphics, images, animation, and sound, so that users can interact with computers in real time through multiple senses. It is also called computer multimedia technology.

[0003] With the development of multimedia technology, high-definition images and videos bring better visual effects to users. High-definition images and videos, such as high-definition images, high-definition videos, ultra-high-definition images, and ultra-high-definition videos, usually have resolutions as high as 6K (5760×3240 pixels), 8K (7680×4320 pixels), etc. However, images and videos with higher resolutions have larger data volumes, occupy larger storage spaces, and occupy more bandwidth when transmitting the images and videos. Summary of the invention

[0004] The purpose of the present application is to solve at least one of the above-mentioned technical defects, especially the technical defects that multimedia files occupy a large storage space and a large bandwidth.

[0005] According to one aspect of the present application, a multimedia file compression method is provided, the method comprising:

[0006] Obtaining an image compression unit of a multimedia file;

[0007] Determine a first pixel parameter and a second pixel parameter of the image compression unit, wherein the first pixel parameter is a minimum value of a sum of pixel values ​​of at least two color channels in a pixel point of the image compression unit; and the second pixel parameter is a maximum value of a sum of pixel values ​​of at least two color channels in the pixel point;

[0008] inserting at least one first value between the first pixel parameter and the second pixel parameter;

[0009] For each pixel point in the image compression unit, compression encoding processing is performed on each pixel point based on the numerical relationship between the pixel value of the pixel point and the first numerical value to obtain a target compressed file.

[0010] Optionally, the method further includes:

[0011] In the case where the first pixel parameter is the minimum value of the sum of the pixel values ​​of the first color channel and the second color channel, and the second pixel parameter is the maximum value of the sum of the pixel values ​​of the first color channel and the second color channel,

[0012] Acquiring a third pixel parameter and a fourth pixel parameter of the image compression unit;

[0013] inserting at least one second value between the third pixel parameter and the fourth pixel parameter;

[0014] For each pixel in the image compression unit, based on the numerical relationship between the pixel value of the pixel and the second numerical value, performing compression coding processing on the pixel;

[0015] The third pixel parameter is the minimum value of the pixel value of the third color channel in the pixel point; and the fourth pixel parameter is the maximum value of the pixel value of the third color channel in the pixel point.

[0016] Optionally, inserting at least one first value between the first pixel parameter and the second pixel parameter includes:

[0017] Insert at least two of the first values ​​between the first pixel parameter and the second pixel parameter, and after the interpolation, the first values ​​are arranged in a first preset order to form a first sequence;

[0018] Accordingly, inserting at least one second value between the third pixel parameter and the fourth pixel parameter comprises:

[0019] At least two of the second values ​​are inserted between the third pixel parameter and the fourth pixel parameter, and after interpolation, the second values ​​are arranged in a second preset order to form a second sequence.

[0020] Optionally, the performing compression coding processing on each pixel point based on the numerical relationship between the pixel value of the pixel point and the first numerical value includes: for each pixel point,

[0021] Determine a sum of the pixel value of the first color channel and the pixel value of the second color channel as a pixel sum parameter, and compare the pixel sum parameter with the first value;

[0022] Determine the first value among the first values, which has the smallest difference with the pixel and the parameter, and use the first value as the first target value, and use the arrangement number of the first target value in the first sequence as the first encoding parameter of the pixel.

[0023] Optionally, the performing compression encoding processing on the pixel point based on the numerical relationship between the pixel value of the pixel point and the second numerical value includes:

[0024] For each pixel, comparing the pixel value of the third color channel of the pixel with the second value;

[0025] Determine a second value among the second values ​​whose difference with the pixel value of the third color channel is the smallest, use the second value as the second target value, and use the arrangement sequence number of the second target value in the second sequence as the second encoding parameter of the pixel point.

[0026] Optionally, the target compressed file includes encoding parameters of each pixel; the encoding parameters include a first encoding parameter and a second encoding parameter.

[0027] According to another aspect of the present application, a multimedia file compression device is provided, the device comprising:

[0028] An acquisition module, used for acquiring an image compression unit of a multimedia file;

[0029] A determination module, configured to determine a first pixel parameter and a second pixel parameter of the image compression unit, wherein the first pixel parameter is a minimum value of the sum of pixel values ​​of at least two color channels in a pixel point of the image compression unit; and the second pixel parameter is a maximum value of the sum of pixel values ​​of at least two color channels in the pixel point;

[0030] A first interpolation module, configured to interpolate at least one first value between the first pixel parameter and the second pixel parameter;

[0031] The first compression module is used to perform compression encoding processing on each pixel point in the image compression unit based on the numerical relationship between the pixel value of the pixel point and the first numerical value to obtain a target compressed file.

[0032] Optionally, the device further comprises a second compression module, configured to, when the first pixel parameter is the minimum value of the sum of the pixel values ​​of the first color channel and the second color channel, and the second pixel parameter is the maximum value of the sum of the pixel values ​​of the first color channel and the second color channel,

[0033] Acquiring a third pixel parameter and a fourth pixel parameter of the image compression unit;

[0034] inserting at least one second value between the third pixel parameter and the fourth pixel parameter;

[0035] For each pixel in the image compression unit, based on the numerical relationship between the pixel value of the pixel and the second numerical value, performing compression coding processing on the pixel;

[0036] The third pixel parameter is the minimum value of the pixel value of the third color channel in the pixel point; and the fourth pixel parameter is the maximum value of the pixel value of the third color channel in the pixel point.

[0037] According to another aspect of the present application, an electronic device is provided, the electronic device comprising:

[0038] one or more processors;

[0039] Memory;

[0040] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to: execute the multimedia file compression method according to any one of the first aspects of the present application.

[0041] For example, in a third aspect of the present application, a computing device is provided, including: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;

[0042] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute operations corresponding to the multimedia file compression method shown in the first aspect of the present application.

[0043] According to another aspect of the present application, a computer-readable storage medium is provided, and when the computer program is executed by a processor, the multimedia file compression method described in any one of the first aspects of the present application is implemented.

[0044] For example, the fourth aspect of the embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the multimedia file compression method shown in the first aspect of the present application is implemented.

[0045] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various optional implementations of the first aspect above.

[0046] The beneficial effects of the technical solution provided by this application are:

[0047] In the embodiment of the present application, the first pixel parameter and the second pixel parameter of the image compression unit are determined, wherein the first pixel parameter is the minimum value of the sum of the pixel values ​​of at least two color channels in the pixel point of the image compression unit; the second pixel parameter is the maximum value of the sum of the pixel values ​​of at least two color channels in the pixel point; at least one first numerical value is inserted between the first pixel parameter and the second pixel parameter; based on the numerical relationship between the pixel value and the first numerical value, each of the pixel points is compressed and encoded to obtain a target compressed file. Specifically, the data volume of the encoding parameter determined by the numerical relationship is less than the data volume of the pixel value of the pixel point, thereby achieving compression of the multimedia file and reducing the storage space occupied by storing the multimedia file and the bandwidth occupied by transmitting the multimedia file. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.

[0049] Figure 1 A flowchart of a multimedia file compression method provided in an embodiment of the present application;

[0050] Figure 2 A schematic diagram of an application scenario of a multimedia file compression method provided in an embodiment of the present application;

[0051] Figure 3 A schematic diagram of a code stream format of a multimedia file compression method provided in an embodiment of the present application;

[0052] Figure 4 A schematic diagram of the architecture of a multimedia file compression system provided in an embodiment of the present application;

[0053] Figure 5 A schematic diagram of the structure of a multimedia file compression device provided in an embodiment of the present application;

[0054] Figure 6 A schematic diagram of the structure of an electronic device for multimedia file compression provided in an embodiment of the present application. DETAILED DESCRIPTION

[0055] The embodiments of the present application are described below in conjunction with the drawings in the present application. It should be understood that the implementation methods described below in conjunction with the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions of the embodiments of the present application.

[0056] It will be understood by those skilled in the art that, unless specifically stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the terms "including" and "comprising" used in the embodiments of the present application refer to that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude the implementation as other features, information, data, steps, operations, elements, components and / or combinations thereof supported by the technical field. It should be understood that when we say that an element is "connected" or "coupled" to another element, the one element may be directly connected or coupled to the other element, or it may refer to that the one element and the other element establish a connection relationship through an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein indicates at least one of the items defined by the term, for example, "A and / or B" may be implemented as "A", or as "B", or as "A and B".

[0057] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0058] The embodiment of the present application provides a possible implementation method, which can be executed by any electronic device. Optionally, any electronic device can be a server device or a terminal device, or a device or chip integrated on these devices.

[0059] like Figure 1 As shown, it is one of the flow diagrams of a multimedia file compression method provided in an embodiment of the present application, and the method includes the following steps:

[0060] Step S101: Acquire an image compression unit of a multimedia file.

[0061] Optionally, the embodiments of the present application may be applied to the field of computer technology; for example, they may be specifically applied to application scenarios for compressing multimedia files.

[0062] Specifically, the multimedia file may include a video file or an image file, etc. Optionally, in the embodiment of the present application, the multimedia file may be described as a video file, wherein when compressing the video file, each frame of the video file may be compressed separately.

[0063] In an actual implementation scenario, the image may be divided into a plurality of image compression units, each of which includes at least two pixels.

[0064] As an example, combining Figure 2 As shown, the image can be divided into multiple 16x2 image compression units, that is, each image compression unit includes 2 rows and 16 columns of pixels, that is, each image compression unit includes 32 (16x2) pixels. Wherein, when the image is divided into the above-mentioned image compression units, the last divided image compression unit is less than 16 columns in the column direction, or less than 2 rows in the row direction. For example, when block width is less than 16 (the number of columns is less than 16) or block height is less than 2 (the number of rows is less than 2), a certain column or several columns of pixels of the image can be copied to make up 16 columns, or a certain row of pixels of the image can be copied to make up 2 rows. Optionally, as shown in FIG. 2, the last column of pixels of the image can be copied to make up 16 columns, or the last row of pixels of the image can be copied to make up 2 rows.

[0065] Step S102: Determine a first pixel parameter and a second pixel parameter of the image compression unit, wherein the first pixel parameter is the minimum value of the sum of pixel values ​​of at least two color channels in the pixel points of the image compression unit; and the second pixel parameter is the maximum value of the sum of pixel values ​​of at least two color channels in the pixel points.

[0066] Specifically, the pixel value of the pixel point of the image compression unit may include the pixel values ​​of three color channels, where the three color channels are red (R), green (G), and blue (B) (in the YUV color space model, the three color channels may also be Y, U, and V channels, respectively).

[0067] In an embodiment of the present application, the first pixel parameter is the minimum value of the sum of pixel values ​​of at least two color channels in the pixel points of the image compression unit; the second pixel parameter is the maximum value of the sum of pixel values ​​of at least two color channels in the pixel points.

[0068] For example, the first pixel parameter and the second pixel parameter may be the minimum value and the maximum value of the sum of the pixel values ​​of the two color channels, respectively. For example, the first pixel parameter may be the minimum value of the sum of the pixel values ​​of the R channel and the G channel; the second pixel parameter may be the maximum value of the sum of the pixel values ​​of the R channel and the G channel.

[0069] For another example, the first pixel parameter and the second pixel parameter may be the minimum value and the maximum value of the sum of the pixel values ​​of the three color channels, respectively. That is, the first pixel parameter may be the minimum value of the sum of the pixel values ​​of the R channel, the G channel, and the B channel; and the second pixel parameter may be the maximum value of the sum of the pixel values ​​of the R channel, the G channel, and the B channel.

[0070] Optionally, taking the example that the first pixel parameter and the second pixel parameter are respectively the minimum and maximum values ​​of the sum of the pixel values ​​of two color channels, when determining the first pixel parameter and the second pixel parameter, the sum of the pixel values ​​of the two color channels of each pixel point in the image compression unit can be calculated respectively, for example, the sum of the pixel values ​​of the R channel and the G channel of each pixel point can be calculated respectively; then, the minimum and maximum values ​​of the sum of the pixel values ​​are used as the first pixel parameter and the second pixel parameter.

[0071] Step S103: insert at least one first value between the first pixel parameter and the second pixel parameter.

[0072] Optionally, one or more first values ​​may be inserted between the first pixel parameter and the second pixel parameter.

[0073] In the embodiment of the present application, inserting multiple first values ​​is taken as an example for explanation, and the inserted multiple first values ​​can be arranged in a preset order.

[0074] The inserted multiple first values ​​may be an arithmetic progression, such as the first value Y may be expressed as Y=ep0+index*(ep1-ep0) / (inter_num+1); wherein ep0 represents the first pixel parameter; index represents the order of the inserted first values ​​(such as when inserting the second first value, the order is 2, i.e., index is 2); ep1 represents the second pixel parameter; and inter_num represents the number of inserted first values. As an example, if the first pixel parameter is 0, the second pixel parameter is 100, and the number of inserted first values ​​is 4, then the inserted first values ​​are 20, 40, 60, and 80, respectively.

[0075] In addition, in some embodiments, the inserted multiple first numerical values ​​may also be non-arithmetic progressions. Still combining the above example, the first pixel parameter is 0, the second pixel parameter is 100, the number of inserted first numerical values ​​is 4, and the inserted first numerical values ​​may also be 15, 40, 70, 80, etc.

[0076] Step S104: for each pixel point in the image compression unit, based on the numerical relationship between the pixel value of the pixel point and the first numerical value, compression encoding processing is performed on each pixel point to obtain a target compressed file.

[0077] Specifically, the numerical relationship between the pixel value and the first numerical value may be a numerical magnitude relationship between the pixel value and the first numerical value.

[0078] Optionally, when the pixel point is subjected to compression coding, the pixel value may be compared with each first value to determine the first value with the smallest difference with the pixel value (i.e., the first value closest to the pixel value); then, the arrangement order parameter of the first value is used as the coding parameter of the pixel point. The arrangement order parameter is the arrangement order of the first value in the inserted values, such as, if the arrangement order of the first value in the inserted values ​​is 2, i.e., the first value is the second first value inserted, then the arrangement order parameter is 2.

[0079] In an actual implementation scenario, the pixel values ​​of each color channel of the pixel point can be encoded separately. For example, the pixel values ​​of the R channel, G channel and B channel of the pixel point can be compared with the first value respectively to determine the first value with the smallest difference with the pixel value, and then the arrangement order parameter (arrangement number) of the first value is used as the encoding parameter of the corresponding color channel of the pixel point.

[0080] In addition, encoding processing can also be performed based on the pixel values ​​of at least two color channels. For example, the sum of the pixel values ​​of at least two color channels is compared with the first value to determine the first value with the smallest difference with the sum of the pixel values. Then, the arrangement order parameter (arrangement number) of the first value is used as the encoding parameter of the pixel point.

[0081] In the embodiment of the present application, the first pixel parameter and the second pixel parameter of the image compression unit are determined, wherein the first pixel parameter is the minimum value of the sum of the pixel values ​​of at least two color channels in the pixel point of the image compression unit; the second pixel parameter is the maximum value of the sum of the pixel values ​​of at least two color channels in the pixel point; at least one first numerical value is inserted between the first pixel parameter and the second pixel parameter; based on the numerical relationship between the pixel value and the first numerical value, each of the pixel points is compressed and encoded to obtain a target compressed file. Specifically, the data volume of the encoding parameter determined by the numerical relationship is less than the data volume of the pixel value of the pixel point, thereby achieving compression of the multimedia file and reducing the storage space occupied by storing the multimedia file and the bandwidth occupied by transmitting the multimedia file.

[0082] In one embodiment of the present application, the method further includes:

[0083] In the case where the first pixel parameter is the minimum value of the sum of the pixel values ​​of the first color channel and the second color channel, and the second pixel parameter is the maximum value of the sum of the pixel values ​​of the first color channel and the second color channel,

[0084] Acquiring a third pixel parameter and a fourth pixel parameter of the image compression unit;

[0085] inserting at least one second value between the third pixel parameter and the fourth pixel parameter;

[0086] For each pixel in the image compression unit, based on the numerical relationship between the pixel value of the pixel and the second numerical value, performing compression coding processing on the pixel;

[0087] The third pixel parameter is the minimum value of the pixel value of the third color channel in the pixel point; and the fourth pixel parameter is the maximum value of the pixel value of the third color channel in the pixel point.

[0088] Specifically, the first pixel parameter and the second pixel parameter of the embodiment of the present application may be the minimum value and the maximum value of the pixel values ​​of the two color channels, respectively.

[0089] As an example, taking the case where the first pixel parameter is the minimum value of the sum of the pixel values ​​of the R channel and the B channel, and the second pixel parameter is the maximum value of the sum of the pixel values ​​of the R channel and the B channel, the embodiment of the present application can also obtain the maximum value of the pixel value of the G channel as the third pixel parameter, obtain the minimum value of the pixel value of the G channel as the fourth pixel parameter, and then insert the second value between the third pixel parameter and the fourth pixel parameter.

[0090] In one embodiment of the present application, inserting at least one first value between the first pixel parameter and the second pixel parameter includes:

[0091] Insert at least two of the first values ​​between the first pixel parameter and the second pixel parameter, and after the interpolation, the first values ​​are arranged in a first preset order to form a first sequence;

[0092] Accordingly, inserting at least one second value between the third pixel parameter and the fourth pixel parameter comprises:

[0093] At least two of the second values ​​are inserted between the third pixel parameter and the fourth pixel parameter, and after interpolation, the second values ​​are arranged in a second preset order to form a second sequence. Specifically, one or more first values ​​may be inserted between the first pixel parameter and the second pixel parameter; and one or more second values ​​may be inserted between the third pixel parameter and the fourth pixel parameter.

[0094] Optionally, the methods for inserting the first value and the second value are similar. The following takes inserting the first value as an example to illustrate the method for inserting the value:

[0095] Taking inserting multiple first values ​​as an example, the inserted multiple first values ​​can be arranged in a preset order.

[0096] Among them, the inserted multiple first values ​​can be an arithmetic progression, such as the first value Y can be expressed as Y=ep0+index*(ep1-ep0) / (inter_num+1); wherein ep0 represents the first pixel parameter; index represents the arrangement order of the inserted first values ​​(such as when inserting the second first value, the arrangement order is 2, that is, index is 2); ep1 represents the second pixel parameter; inter_num represents the number of inserted first values. As an example, if the first pixel parameter is 0, the second pixel parameter is 100, and the number of inserted first values ​​is 4, then the inserted first values ​​are 20, 40, 60, and 80 respectively; that is, the above-mentioned first values ​​20, 40, 60, and 80 form a first sequence. In addition, in some embodiments, the first sequence may also include the first pixel parameter 0 and the second pixel parameter 100, that is, the first sequence is 0, 20, 40, 60, 80, and 100.

[0097] In addition, in some embodiments, the inserted multiple first numerical values ​​may also be non-arithmetic progressions. Still combining the above example, the first pixel parameter is 0, the second pixel parameter is 100, the number of inserted first numerical values ​​is 4, and the inserted first numerical values ​​may also be 15, 40, 70, 80, etc.

[0098] The method for inserting the second value can refer to the method for inserting the first value mentioned above, and will not be repeated here.

[0099] In one embodiment of the present application, the step of performing compression encoding processing on each pixel point based on the numerical relationship between the pixel value and the first numerical value includes:

[0100] For each pixel,

[0101] Determine a sum of the pixel value of the first color channel and the pixel value of the second color channel as a pixel sum parameter, and compare the pixel sum parameter with the first value;

[0102] Determine the first value among the first values, which has the smallest difference with the pixel and the parameter, and use the first value as the first target value, and use the arrangement number of the first target value in the first sequence as the first encoding parameter of the pixel.

[0103] The step of performing compression coding processing on the pixel point based on the numerical relationship between the pixel value of the pixel point and the second numerical value includes:

[0104] For each pixel, comparing the pixel value of the third color channel of the pixel with the second value;

[0105] Determine a second value among the second values ​​whose difference with the pixel value of the third color channel is the smallest, use the second value as the second target value, and use the arrangement sequence number of the second target value in the second sequence as the second encoding parameter of the pixel point.

[0106] Specifically, still combining the above as an example, taking the first color channel as the R channel, the second color channel as the B channel, and the third color channel as the G channel as an example, the first pixel parameter is the maximum value of the sum of the pixel values ​​of the R channel and the B channel, the second pixel parameter is the minimum value of the sum of the pixel values ​​of the R channel and the B channel, the third pixel parameter is the maximum value of the pixel value of the G channel, and the fourth pixel parameter is the minimum value of the pixel value of the G channel.

[0107] Exemplarily, assuming that the first pixel parameter is 0 and the second pixel parameter is 100, the inserted first values ​​are 20, 40, 60, and 80 respectively; assuming that the third pixel parameter is 20 and the fourth pixel parameter is 220, the inserted second values ​​are 60, 100, 140, and 180 respectively.

[0108] Then, when compressing and encoding the pixel values ​​of the pixel points, the sum of the pixel values ​​of the R channel and the B channel can be compared with the inserted first values ​​20, 40, 60, and 80 to determine the target value with the smallest difference from the sum of the pixel values, and the arrangement sequence number of the target value can be used as the first encoding parameter of the pixel point.

[0109] For example, the pixel value of the R channel of the pixel point is 40, and the pixel value of the B channel of the pixel point is 21, then the sum of the pixel values ​​is 61. The difference between the sum of the pixel values ​​and the first value 60 is the smallest, then the arrangement order 3 of the first value 60 can be used as the first encoding parameter of the pixel point.

[0110] In addition, the pixel value of the G channel needs to be compared with the inserted second values ​​60, 100, 140, and 180 respectively to determine the target value with the smallest difference with the pixel value, and use the arrangement order parameter of the target value as the second encoding parameter of the pixel point.

[0111] For example, the pixel value of the G channel of the pixel point is 168, and the difference between the pixel value and the second value 180 is the smallest, then the arrangement order 4 of the second value 180 can be used as the second encoding parameter of the pixel point.

[0112] It can be understood that encoding pixels based on the two encoding parameters, the first encoding parameter and the second encoding parameter, occupies fewer data bits than encoding the three color channels of the pixels separately, and thus the pixels can be compressed.

[0113] Optional, combined Figure 3 As shown, it is a schematic diagram of a code stream format, such as Figure 3 As shown, the code stream of each pixel point is marked with a coding mode flag, a first pixel parameter, a second pixel parameter, a third pixel parameter, a fourth pixel parameter, a first coding parameter, and a second coding parameter. Based on the above code stream format, each pixel point in the image is encoded to finally form a target compressed file.

[0114] In one embodiment of the present application, the method further comprises the step of decompressing the target compressed file:

[0115] Receive decompression instruction;

[0116] A target value corresponding to the encoding parameter is determined, and a pixel value of the pixel point is decoded based on the target value.

[0117] Specifically, when decompressing the target compressed file, the target value corresponding to the encoding parameter of the pixel point can be determined. Since the encoding parameter is the arrangement order value of the target value, the decompression process is to reversely determine the target value through the arrangement order value. For example, the encoding parameter is 3, that is, the arrangement order value of the target value is 3, then, according to the corresponding relationship between the arrangement order and the inserted value, the target value can be determined, and the target value is used as the pixel value after decompression of the pixel point. It can be understood that the target value is not the original pixel value of the pixel point, so the compression method of the embodiment of the present application is lossy compression.

[0118] In the embodiment of the present application, the first pixel parameter and the second pixel parameter of the image compression unit are determined, wherein the first pixel parameter is the minimum value of the sum of the pixel values ​​of at least two color channels in the pixel point of the image compression unit; the second pixel parameter is the maximum value of the sum of the pixel values ​​of at least two color channels in the pixel point; at least one first numerical value is inserted between the first pixel parameter and the second pixel parameter; based on the numerical relationship between the pixel value and the first numerical value, each of the pixel points is compressed and encoded to obtain a target compressed file. Specifically, the data volume of the encoding parameter determined by the numerical relationship is less than the data volume of the pixel value of the pixel point, thereby achieving compression of the multimedia file and reducing the storage space occupied by storing the multimedia file and the bandwidth occupied by transmitting the multimedia file.

[0119] Combination Figure 4 , the overall architecture of the embodiment of the present application is described:

[0120] like Figure 4As shown, the instruction generation module is used to generate file compression instructions; the bus interface module is used to transmit file compression instructions; the parameter storage module is used to store compression parameters, such as compression ratio, compressed video format, etc.; the compression module is used to execute the multimedia file compression method of the present application to compress the multimedia file, specifically, in response to the file compression instruction generated by the instruction generation module, compress the multimedia file according to the compression parameters; the compressed target compressed file can be stored in the file storage module; the decompression module is used to decompress the compressed target compressed file.

[0121] The present application embodiment provides a multimedia file compression device, such as Figure 5 As shown, the multimedia file compression device 50 may include: an acquisition module 501, a determination module 502, a first interpolation module 503, and a first compression module 504, wherein:

[0122] An acquisition module 501 is used to acquire an image compression unit of a multimedia file;

[0123] The determination module 502 is used to determine a first pixel parameter and a second pixel parameter of the image compression unit, wherein the first pixel parameter is the minimum value of the sum of pixel values ​​of at least two color channels in the pixel points of the image compression unit; and the second pixel parameter is the maximum value of the sum of pixel values ​​of at least two color channels in the pixel points;

[0124] A first interpolation module 503, configured to interpolate at least one first value between the first pixel parameter and the second pixel parameter;

[0125] The first compression module 504 is used to perform compression encoding processing on each pixel point in the image compression unit based on the numerical relationship between the pixel value of the pixel point and the first numerical value to obtain a target compressed file.

[0126] In one embodiment of the present application, the device further includes a second interpolation module, which is used to, when the first pixel parameter is the minimum value of the sum of the pixel values ​​of the first color channel and the second color channel, and the second pixel parameter is the maximum value of the sum of the pixel values ​​of the first color channel and the second color channel,

[0127] Acquiring a third pixel parameter and a fourth pixel parameter of the image compression unit;

[0128] inserting at least one second value between the third pixel parameter and the fourth pixel parameter;

[0129] For each pixel in the image compression unit, based on the numerical relationship between the pixel value of the pixel and the second numerical value, performing compression coding processing on the pixel;

[0130] The third pixel parameter is the minimum value of the pixel value of the third color channel in the pixel point; and the fourth pixel parameter is the maximum value of the pixel value of the third color channel in the pixel point.

[0131] In one embodiment of the present application, a first interpolation module is used to insert at least two of the first values ​​between the first pixel parameter and the second pixel parameter, and after interpolation, the first values ​​are arranged in a first preset order to form a first sequence;

[0132] Accordingly, inserting at least one second value between the third pixel parameter and the fourth pixel parameter comprises:

[0133] At least two of the second values ​​are inserted between the third pixel parameter and the fourth pixel parameter, and after interpolation, the second values ​​are arranged in a second preset order to form a second sequence.

[0134] In one embodiment of the present application, the first compression module is used for each pixel point:

[0135] Determine a sum of the pixel value of the first color channel and the pixel value of the second color channel as a pixel sum parameter, and compare the pixel sum parameter with the first value;

[0136] Determine the first value among the first values, which has the smallest difference with the pixel and the parameter, and use the first value as the first target value, and use the arrangement number of the first target value in the first sequence as the first encoding parameter of the pixel.

[0137] In one embodiment of the present application, the second compression module is used to compare, for each pixel, a pixel value of a third color channel of the pixel with the second value;

[0138] Determine a second value among the second values ​​whose difference with the pixel value of the third color channel is the smallest, use the second value as the second target value, and use the arrangement sequence number of the second target value in the second sequence as the second encoding parameter of the pixel point.

[0139] In one embodiment of the present application, the target compressed file includes encoding parameters for each pixel; the encoding parameters include a first encoding parameter and a second encoding parameter.

[0140] The device of the embodiments of the present application can execute the method provided by the embodiments of the present application, and the implementation principles are similar. The actions performed by each module in the device of each embodiment of the present application correspond to the steps in the method of each embodiment of the present application. For the detailed functional description of each module of the device, please refer to the description in the corresponding method shown in the previous text, which will not be repeated here.

[0141] In the embodiment of the present application, the first pixel parameter and the second pixel parameter of the image compression unit are determined, wherein the first pixel parameter is the minimum value of the sum of the pixel values ​​of at least two color channels in the pixel point of the image compression unit; the second pixel parameter is the maximum value of the sum of the pixel values ​​of at least two color channels in the pixel point; at least one first numerical value is inserted between the first pixel parameter and the second pixel parameter; based on the numerical relationship between the pixel value and the first numerical value, each of the pixel points is compressed and encoded to obtain a target compressed file. Specifically, the data volume of the encoding parameter determined by the numerical relationship is less than the data volume of the pixel value of the pixel point, thereby achieving compression of the multimedia file and reducing the storage space occupied by storing the multimedia file and the bandwidth occupied by transmitting the multimedia file.

[0142] In an embodiment of the present application, an electronic device is provided, which includes: a memory and a processor; at least one program, which is stored in the memory and is used to be executed by the processor. Compared with the prior art, the following can be achieved: In an embodiment of the present application, by determining the first pixel parameter and the second pixel parameter of the image compression unit, wherein the first pixel parameter is the minimum value of the sum of the pixel values ​​of at least two color channels in the pixel point of the image compression unit; the second pixel parameter is the maximum value of the sum of the pixel values ​​of at least two color channels in the pixel point; inserting at least one first numerical value between the first pixel parameter and the second pixel parameter; based on the numerical relationship between the pixel value and the first numerical value, performing compression encoding processing on each of the pixel points to obtain a target compressed file. Specifically, the amount of data of the encoding parameter determined by the numerical relationship is less than the amount of data of the pixel value of the pixel point, thereby realizing the compression of the multimedia file and reducing the storage space occupied by storing the multimedia file and the bandwidth occupied by transmitting the multimedia file.

[0143] In an alternative embodiment, an electronic device is provided, such as Figure 6 As shown, Figure 6The electronic device 4000 shown includes: a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, such as through a bus 4002. Optionally, the electronic device 4000 may also include a transceiver 4004, which may be used for data interaction between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present application.

[0144] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0145] The bus 4002 may include a path to transmit information between the above components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0146] The memory 4003 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this.

[0147] The memory 4003 is used to store the application code (computer program) for executing the solution of the present application, and the execution is controlled by the processor 4001. The processor 4001 is used to execute the application code stored in the memory 4003 to implement the contents shown in the above method embodiment.

[0148] The electronic devices include but are not limited to mobile phones, laptop computers, multimedia players, desktop computers, etc.

[0149] An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer can execute the corresponding content in the aforementioned method embodiment.

[0150] In the embodiment of the present application, the first pixel parameter and the second pixel parameter of the image compression unit are determined, wherein the first pixel parameter is the minimum value of the sum of the pixel values ​​of at least two color channels in the pixel point of the image compression unit; the second pixel parameter is the maximum value of the sum of the pixel values ​​of at least two color channels in the pixel point; at least one first numerical value is inserted between the first pixel parameter and the second pixel parameter; based on the numerical relationship between the pixel value and the first numerical value, each of the pixel points is compressed and encoded to obtain a target compressed file. Specifically, the data volume of the encoding parameter determined by the numerical relationship is less than the data volume of the pixel value of the pixel point, thereby achieving compression of the multimedia file and reducing the storage space occupied by storing the multimedia file and the bandwidth occupied by transmitting the multimedia file.

[0151] The terms "first", "second", "third", "fourth", "1", "2", etc. (if any) in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than that shown or described in the drawings.

[0152] It should be understood that, although each operation step is indicated by arrows in the flowchart of the embodiment of the present application, the implementation order of these steps is not limited to the order indicated by the arrows. Unless clearly stated herein, in some implementation scenarios of the embodiment of the present application, the implementation steps in each flowchart can be performed in other orders according to demand. In addition, some or all of the steps in each flowchart may include multiple sub-steps or multiple stages based on actual implementation scenarios. Some or all of these sub-steps or stages may be executed at the same time, and each sub-step or stage in these sub-steps or stages may also be executed at different times respectively. In different scenarios of execution time, the execution order of these sub-steps or stages may be flexibly configured according to demand, and the embodiment of the present application does not limit this.

[0153] The above is only an optional implementation method for some implementation scenarios of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the technical concept of the solution of the present application, other similar implementation methods based on the technical ideas of the present application are also within the protection scope of the embodiments of the present application.

Claims

1. A multimedia file compression method, characterized in that: include: Obtaining an image compression unit of a multimedia file; Determine a first pixel parameter and a second pixel parameter of the image compression unit, wherein the first pixel parameter is a minimum value of a sum of pixel values ​​of at least two color channels in a pixel point of the image compression unit; and the second pixel parameter is a maximum value of a sum of pixel values ​​of at least two color channels in the pixel point; inserting at least one first value between the first pixel parameter and the second pixel parameter; For each pixel point in the image compression unit, based on the numerical relationship between the pixel value of the pixel point and the first numerical value, compression encoding processing is performed on each pixel point to obtain a target compressed file; The step of performing compression coding on each pixel point based on the numerical relationship between the pixel value of the pixel point and the first numerical value includes: Compare the pixel value of the pixel point with each of the first values, and determine the first value having the smallest difference with the pixel value; The arrangement order parameter of the first numerical value having the smallest difference with the pixel value is used as the encoding method of the encoding parameter of the pixel point.

2. The multimedia file compression method according to claim 1, characterized in that: The method further comprises: In the case where the first pixel parameter is the minimum value of the sum of the pixel values ​​of the first color channel and the second color channel, and the second pixel parameter is the maximum value of the sum of the pixel values ​​of the first color channel and the second color channel, Acquiring a third pixel parameter and a fourth pixel parameter of the image compression unit; inserting at least one second value between the third pixel parameter and the fourth pixel parameter; For each pixel in the image compression unit, based on the numerical relationship between the pixel value of the pixel and the second numerical value, performing compression coding processing on the pixel; The third pixel parameter is the minimum value of the pixel value of the third color channel in the pixel point; and the fourth pixel parameter is the maximum value of the pixel value of the third color channel in the pixel point.

3. The multimedia file compression method according to claim 2, characterized in that: The inserting at least one first value between the first pixel parameter and the second pixel parameter comprises: Insert at least two of the first values ​​between the first pixel parameter and the second pixel parameter, and after the interpolation, the first values ​​are arranged in a first preset order to form a first sequence; Accordingly, inserting at least one second value between the third pixel parameter and the fourth pixel parameter comprises: At least two of the second values ​​are inserted between the third pixel parameter and the fourth pixel parameter, and after interpolation, the second values ​​are arranged in a second preset order to form a second sequence.

4. The multimedia file compression method according to claim 3, characterized in that: The step of performing compression coding on each pixel point based on the numerical relationship between the pixel value of the pixel point and the first numerical value comprises: for each pixel point, Determine a sum of the pixel value of the first color channel and the pixel value of the second color channel as a pixel sum parameter, and compare the pixel sum parameter with the first value; Determine the first value among the first values, the first value with the smallest difference between the pixel and the parameter, and use the first value with the smallest difference between the pixel and the parameter as the first target value, and use the arrangement sequence number of the first target value in the first sequence as the first encoding parameter of the pixel point.

5. The multimedia file compression method according to claim 4, characterized in that: The step of performing compression coding processing on the pixel point based on the numerical relationship between the pixel value of the pixel point and the second numerical value includes: For each pixel, comparing the pixel value of the third color channel of the pixel with the second value; Determine the second value among the second values, the second value with the smallest difference with the pixel value of the third color channel, and use the second value with the smallest difference with the pixel value of the third color channel as the second target value, and use the arrangement sequence number of the second target value in the second sequence as the second encoding parameter of the pixel point.

6. The multimedia file compression method according to claim 5, characterized in that: The target compressed file includes encoding parameters of each pixel; the encoding parameters include a first encoding parameter and a second encoding parameter.

7. A multimedia file compression device, characterized in that: include: An acquisition module, used for acquiring an image compression unit of a multimedia file; A determination module, configured to determine a first pixel parameter and a second pixel parameter of the image compression unit, wherein the first pixel parameter is a minimum value of a sum of pixel values ​​of at least two color channels in a pixel point of the image compression unit; and the second pixel parameter is a maximum value of a sum of pixel values ​​of at least two color channels in the pixel point; A first interpolation module, configured to interpolate at least one first value between the first pixel parameter and the second pixel parameter; A first compression module, configured to perform compression encoding processing on each pixel point in the image compression unit based on a numerical relationship between a pixel value of the pixel point and the first numerical value, so as to obtain a target compressed file; Wherein, the first compression module is further specifically used for: Compare the pixel value of the pixel point with each of the first values, and determine the first value having the smallest difference with the pixel value; The arrangement order parameter of the first numerical value having the smallest difference with the pixel value is used as the encoding method of the encoding parameter of the pixel point.

8. The multimedia file compression device according to claim 7, characterized in that: The device further includes a second compression module, configured to, when the first pixel parameter is the minimum value of the sum of the pixel values ​​of the first color channel and the second color channel, and the second pixel parameter is the maximum value of the sum of the pixel values ​​of the first color channel and the second color channel, Acquiring a third pixel parameter and a fourth pixel parameter of the image compression unit; inserting at least one second value between the third pixel parameter and the fourth pixel parameter; For each pixel in the image compression unit, based on the numerical relationship between the pixel value of the pixel and the second numerical value, performing compression coding processing on the pixel; The third pixel parameter is the minimum value of the pixel value of the third color channel in the pixel point; and the fourth pixel parameter is the maximum value of the pixel value of the third color channel in the pixel point.

9. An electronic device, characterized in that: The electronic device comprises: one or more processors; Memory; One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to: execute the multimedia file compression method according to any one of claims 1 to 6.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the multimedia file compression method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Data compression and packaging

    CN114584778A

  • Image processing method and apparatus

    US20040196478A1