CN115767085A - Data processing method and device - Google Patents

Data processing method and device Download PDF

Info

Publication number
CN115767085A
CN115767085A CN202211363217.XA CN202211363217A CN115767085A CN 115767085 A CN115767085 A CN 115767085A CN 202211363217 A CN202211363217 A CN 202211363217A CN 115767085 A CN115767085 A CN 115767085A
Authority
CN
China
Prior art keywords
compressed
compression
subblock
target
preset
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.)
Pending
Application number
CN202211363217.XA
Other languages
Chinese (zh)
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.)
Vivo Mobile Communication Co Ltd
Original Assignee
Vivo Mobile Communication 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 Vivo Mobile Communication Co Ltd filed Critical Vivo Mobile Communication Co Ltd
Priority to CN202211363217.XA priority Critical patent/CN115767085A/en
Publication of CN115767085A publication Critical patent/CN115767085A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The application discloses a data processing method and a device thereof, belonging to the technical field of communication. The data processing method comprises the steps of obtaining a to-be-compressed subblock of a first object; respectively carrying out compression coding processing on the subblocks to be compressed through N preset compression modes to obtain a compression coding data set, wherein the compression coding data set comprises coding data corresponding to each preset compression mode in the N preset compression modes; screening a target compression mode from N preset compression modes according to the comparison result of the subblock to be compressed and the reconstructed subblock, wherein the reconstructed subblock is obtained by decoding and reconstructing encoded data; and processing the sub-blocks to be compressed according to the target compression mode.

Description

Data processing method and device
Technical Field
The present application belongs to the field of communications technologies, and in particular, to a data processing method and apparatus.
Background
With the continuous development of network communication technology and the continuous improvement of the requirements of people on the definition of screen display, the resolution of electronic devices such as mobile phones, televisions, computers and the like gradually develops towards 4k and 8k, so that the requirements on transmission and storage of image and video data are also continuously improved.
In the related art, image and video data can be processed in an embedded compression mode, but the mode usually cannot realize the performance of visual lossless on the premise of meeting the limited transmission bandwidth and storage requirements, and the imaging quality of the image and video data is influenced.
Disclosure of Invention
The embodiment of the application aims to provide a data processing method, a data processing device, an electronic device and a readable storage medium, and can solve the problem that the prior image and video compression mode cannot realize visual lossless while reducing data transmission bandwidth and storage.
In a first aspect, an embodiment of the present application provides a data processing method, which may include:
acquiring a to-be-compressed sub-block of a first object;
respectively carrying out compression coding treatment on sub-blocks to be compressed through N preset compression modes to obtain a compression coding data set, wherein the compression coding data set comprises coding data corresponding to each preset compression mode in the N preset compression modes, and N is an integer larger than 1;
screening a target compression mode from N preset compression modes according to a comparison result of the subblocks to be compressed and the reconstructed subblocks, wherein the reconstructed subblocks are obtained by decoding and reconstructing encoded data;
and processing the sub-blocks to be compressed according to the target compression mode.
In a second aspect, an embodiment of the present application provides a data processing apparatus, which may include:
the acquisition module is used for acquiring a subblock to be compressed of a first object;
the processing module is used for respectively carrying out compression coding processing on the subblocks to be compressed through N preset compression modes to obtain a compression coding data set, wherein the compression coding data set comprises coding data corresponding to each preset compression mode in the N preset compression modes, and N is an integer greater than 1;
the screening module is used for screening a target compression mode from N preset compression modes according to the comparison result of the subblock to be compressed and the reconstructed subblock, and the reconstructed subblock is obtained by decoding and reconstructing encoded data;
and the generating module is used for processing the sub-blocks to be compressed according to the target compression mode.
In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, and when executed by the processor, the program or instructions implement the steps of the data processing method shown in the first aspect.
In a fourth aspect, the present application provides a readable storage medium, on which a program or instructions are stored, and when executed by a processor, the program or instructions implement the steps of the data processing method as shown in the first aspect.
In a fifth aspect, an embodiment of the present application provides a chip, where the chip includes a processor and a data processing interface, the data processing interface is coupled to the processor, and the processor is configured to execute a program or instructions to implement the steps of the data processing method shown in the first aspect.
In a sixth aspect, embodiments of the present application provide a computer program product, stored in a storage medium, which is executed by at least one processor to implement a method as in the first aspect.
In the embodiment of the application, the to-be-compressed subblocks of the first object are respectively subjected to compression coding processing through N preset compression modes to obtain coded data corresponding to each preset compression mode in the N preset compression modes, then the coded data corresponding to each preset compression mode are decoded and reconstructed to obtain reconstructed subblocks, so that the uncompressed coded to-be-compressed subblocks and the compressed coded, decoded and reconstructed subblocks can be compared, and a target compression mode capable of compressing the to-be-compressed subblocks is selected from the N preset compression modes based on the comparison result of the uncompressed coded to-be-compressed subblocks and the compressed and decoded and reconstructed subblocks, so that the best target compression mode which gives consideration to objective compression errors and subjective visual effects can be selected for each to-be-compressed subblock in the N preset compression modes, and each to-be-compressed subblock is processed through the target compression mode corresponding to each to-be-compressed subblock to obtain a compression result which corresponds to each to-be-compressed subblock and can meet the transmission bandwidth requirement and can also realize visual lossless performance, thereby further improving the imaging quality of the decompressed first object.
Drawings
Fig. 1 is a flowchart of a data processing method provided in an embodiment of the present application;
fig. 2 is a schematic diagram of a corresponding relationship in a data processing method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure;
fig. 5 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below clearly with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments that can be derived by one of ordinary skill in the art from the embodiments given herein are intended to be within the scope of the present disclosure.
The terms first, second and the like in the description and in the claims of the present application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the terms so used are interchangeable under appropriate circumstances such that the embodiments of the application are capable of operation in other sequences than those illustrated or otherwise described herein, and that the terms "first," "second," and the like are generally used herein in a generic sense to distinguish one object from another, and not necessarily to limit the number of objects, e.g., the first object may be one or more. In addition, "and/or" in the specification and claims means at least one of connected objects, a character "/" generally means that a preceding and succeeding related objects are in an "or" relationship.
With the continuous development of network communication technology and the continuous improvement of the requirements of people on the definition of screen display, the resolution of electronic devices such as mobile phones, televisions, computers and the like gradually develops towards 2k, 4k and 8 k. However, the continuous increase of image and video data to be transmitted and stored brings great challenges to the memory bandwidth and the computing power of electronic devices, and thus, the image and video compression technology is very important to reduce the data transmission bandwidth and the memory consumption.
In the related art, compression may be performed by an embedded compression manner or by using a single compression mode. However, the former generally cannot achieve visually lossless performance on the premise of meeting limited transmission bandwidth and storage requirements; the latter neglects that the sensitivity of subjective human vision to different picture errors and the minimum objective data compression error are not completely uniform, and often cannot realize the vision lossless performance on the premise of meeting the limited transmission bandwidth and storage requirements, or meet the transmission bandwidth and storage requirements on the premise of realizing the vision lossless performance.
Therefore, an embodiment of the present application provides a data processing method for image and video compression and decompression based on multiple compression modes, which may respectively perform compression coding on to-be-compressed sub-blocks of a first object through N preset compression modes to obtain coded data corresponding to each of the N preset compression modes, and then decode and reconstruct the coded data corresponding to each preset compression mode to obtain reconstructed sub-blocks, so that uncompressed coded to-be-compressed sub-blocks and reconstructed sub-blocks which have been compressed, coded and decoded and reconstructed may be compared, and based on a comparison result of the uncompressed coded to-be-compressed sub-blocks and the reconstructed sub-blocks, a target compression mode capable of compressing the to-be-compressed sub-blocks may be selected from the N preset compression modes, so that, in the N preset compression modes, for each to-be-compressed sub-block in the first object, an optimal target compression mode of a compression error and a subjective visual effect may be selected, and each to-be-compressed sub-block may be processed through the target compression mode corresponding to-compress each to-be-compressed sub-block, so as to obtain a target compression mode which may satisfy a transmission bandwidth requirement and may also achieve a compression result of a visual lossless performance, thereby further improving imaging quality of the first object after compression.
Based on this, the embodiment of the present application provides a data processing method, and the following describes in detail the data processing method provided by the embodiment of the present application with reference to fig. 1 to 3.
Fig. 1 is a flowchart of a data processing method according to an embodiment of the present application.
As shown in fig. 1, the data processing method may specifically include the following steps:
step 110, obtaining a to-be-compressed subblock of a first object; step 120, performing compression coding processing on the subblocks to be compressed respectively through N preset compression modes to obtain a compression coding data set, wherein the compression coding data set comprises coding data corresponding to each preset compression mode in the N preset compression modes, and N is an integer greater than 1; step 130, according to the comparison result of the subblock to be compressed and the reconstructed subblock, screening a target compression mode from N preset compression modes, wherein the reconstructed subblock is obtained by decoding and reconstructing encoded data; and 140, processing the sub-blocks to be compressed according to the target compression mode.
Therefore, uncompressed coding sub blocks to be compressed and compressed coding and decoding reconstructed sub blocks after reconstruction can be compared, a target compression mode capable of compressing the sub blocks to be compressed is selected in the N preset compression modes based on the comparison result of the uncompressed coding sub blocks and the compressed coding and decoding reconstructed sub blocks, therefore, the best target compression mode which gives consideration to objective compression errors and subjective visual effects is selected for each sub block to be compressed in the first object in the N preset compression modes, and each sub block to be compressed is processed through the target compression mode corresponding to each sub block to be compressed, so that the compression result which corresponds to each sub block to be compressed, not only can meet the requirement of transmission bandwidth, but also can achieve visual lossless performance, and the imaging quality of the decompressed first object is further improved.
The above steps are described in detail below, specifically as follows.
Referring first to step 110, in one or more possible embodiments, step 110 may specifically include:
dividing the first object according to a dividing condition to obtain M subblocks to be compressed, wherein M is a positive integer, and the dividing condition comprises at least one of the following components: the number of divisions and the division size.
For example, taking the first object as an image, the image may be divided according to a partition size to obtain M sub-blocks to be compressed (Range Block), where the sub-blocks to be compressed may be basic units for compressing the image. Specifically, the division size of the subblock to be compressed may be a pixel region of i × j, the value ranges of i and j are [1, image height ] and [1, image width ], for example, the image size is 1920 × 1080, the value range of n is [1,1080], and the value range of M is [1,1920].
In addition, the image can be divided according to the division number, wherein M is the preset division number. In a similar way, the image can be divided according to the preset division number and the preset division size, so that subblocks to be compressed corresponding to the preset division number can be obtained, and the size of each subblock to be compressed is the preset division size.
It should be noted that, if the size of the sub-block to be compressed in the embodiment of the present application is smaller than or equal to the preset size, the first object of the sub-block to be compressed may be taken as a whole as the sub-block to be compressed.
And, in another or more possible embodiments, before step 110, the data processing method may further include:
acquiring a first object, the first object may include at least one of: images, videos. The video may be a video stream of multiple frames of images. In particular, the first object may be an object having RGB, YUV format. The RGB format may include three channels of Red (Red), green (Green) and Blue (Blue) color space data. The YUV format can be used to describe the color saturation of an image, where Y represents brightness and U/V represents chroma.
It should be noted that the first object referred to above may also be a Raw (Raw) image or a gray-scale image. The Raw image is the most original data from the sensor, and is usually 4 channels, and there are different bayer types, such as GBRG, GRBG, RBBG, GBBR, etc.; the grayscale map refers to an image having only a single channel, such as a G channel, a B channel, or an R channel.
Referring next to step 120, the preset compression mode in the embodiment of the present application may include at least two algorithms: prediction, transformation, and quantization, so that each subblock to be compressed in the M subblocks to be compressed in the step 110 may be subjected to a near lossless or lossy compression encoding process by one or a combination of the aforementioned algorithms.
Specifically, the prediction algorithm referred to above may include an algorithm for predicting the current pixel using the current pixel and neighboring pixels, such as horizontal direction prediction, vertical direction prediction, median-Edge prediction (MED prediction), and the like. The above-mentioned Transform algorithm may include a Transform algorithm for mutually converting an image signal of a first object such as an image between a time domain and a space domain, such as Discrete Cosine Transform (DCT Transform), discrete Fourier Transform (DFT Transform), discrete Wavelet Transform (DWT Transform), discrete Walsh-Hadamard Transform (DWHT Transform), and the like. The quantization algorithms referred to above may include scalar quantization and vector quantization algorithms, such as uniform quantization, non-uniform quantization, and the like. Based on this, a mode of a combination of prediction and quantization algorithms, such as the Differential Pulse Code Modulation (DPCM) algorithm, may be employed.
Based on this, the encoded data in the embodiment of the present application may include compressed data obtained by performing compression encoding processing on the sub-block to be compressed by using the preset compression mode.
For example, as shown in fig. 2, N is 3, that is, the preset compression mode 1, the preset compression mode 2, and the preset compression mode 3, so that the sub-block a to be compressed can be compressed and encoded through the preset compression mode 1, the preset compression mode 2, and the preset compression mode 3, to obtain encoded data 1 corresponding to the preset compression mode 1, encoded data 2 corresponding to the preset compression mode 2, and encoded data 3 corresponding to the preset compression mode 3, where the encoded data 1, the encoded data 2, and the encoded data 3 may form a compressed encoded data set of the sub-block a to be compressed.
Similarly, based on the above example in step 110, if the number of the sub-blocks to be compressed is N, then based on the same compression and encoding process, the compression and encoding data set of each of the N sub-blocks to be compressed is obtained.
Here, it should be noted that, since the first objects before and after lossless compression coding, such as images, are completely equal, and the size of the coded data after compression is different for different images, the storage requirement and the transmission bandwidth size required by the first objects cannot be controlled, the preset compression mode in the embodiment of the present application may include near-lossless or lossy compression coding algorithms such as prediction, transformation, quantization, and the like, and the lossless compression coding algorithm may not be included in the preset compression mode in the embodiment of the present application.
Further, referring to step 130, in one or more possible embodiments, the predetermined compression mode corresponds to a predetermined decompression mode, and based on this, before step 130, the data processing method may further include:
and decoding and reconstructing the encoded data according to a preset decompression mode corresponding to the preset compression mode to obtain a reconstructed subblock.
Specifically, the decoding and reconstructing process in the embodiment of the present application may be a process of decoding encoded data through a preset decompression mode corresponding to each of the N preset compression modes, and reconstructing decoded data to obtain a compressed and decompressed sub-block (range), that is, a reconstructed sub-block. For example, the size of the sub-block to be compressed is 8 × 8, and after the sub-block is compressed and decompressed, the reconstructed sub-block with the size of 8 × 8 is obtained.
Although the subblocks have the same size, the characteristics such as the pixel value and the pixel distribution in the subblock are different from each other, and the difference between the two subblocks will be described below.
In order to calculate the comparison result of the subblocks to be compressed and the reconstructed subblocks, in one or more possible embodiments, the comparison result may include global error data and local error data, wherein the global error data is used to represent the overall error size and error distribution between the subblocks to be compressed and the reconstructed subblocks; the local error data is used for representing the size of an error extreme value and the error distribution range between each pixel point in the subblock to be compressed and each pixel point in the reconstructed subblock.
Based on this, the step 130 may specifically include:
step 1301, screening a target comparison result from the comparison results of the subblock to be compressed and each reconstruction subblock of the N reconstruction subblocks, wherein the target comparison result meets at least one of the following conditions: the global error data is less than or equal to a first preset threshold, and the local error data is less than or equal to a second preset threshold;
in step 1302, a preset compression mode corresponding to the target comparison result is determined as a target compression mode.
Further, the steps of obtaining the global error data and the local error data may be described in detail in the following, where it should be noted that the order of obtaining the global error data and the local error data is not limited again.
In one example, global error data is calculated, based on which, before step 1301, the data processing method may further include:
step 1303, calculating global error data through a preset algorithm according to the size of the subblock to be compressed and the pixel value of the reconstructed subblock;
wherein the preset algorithm comprises at least one of the following: sum of absolute errors, sum of squared errors, mean absolute error, mean square error, root mean square error.
In particular, the global Error data may include a sub-Block Error (Block Error), which refers to a sub-Block Error between a reconstructed sub-Block and a sub-Block to be compressed.
The preset algorithm includes, but is not limited to, at least one of the following: sum of Absolute Error algorithm (Sum of Absolute Difference/Sum of Absolute Error, SAD/SAE), sum of Squared Error algorithm (Sum of Squared Difference/Sum of Squared Error, SSD/SSE), mean Absolute Error algorithm (Mean Absolute Difference/Mean Absolute Error, MAD/MAE), mean Squared Error (Mean Squared Difference/Mean Squared Error, MSD/MSE), root Mean Squared Error (Root Mean Squared Difference/Root Mean Squared Error, RMSD/RMSE)
Illustratively, the calculation formula of each preset algorithm is as follows:
sum of absolute error algorithm, i.e., equation (1):
Figure BDA0003923466450000091
the sum of squares error algorithm, equation (2):
Figure BDA0003923466450000092
mean absolute error algorithm, equation (3):
Figure BDA0003923466450000093
mean square error algorithm, equation (4):
Figure BDA0003923466450000094
root mean square error algorithm, equation (5):
Figure BDA0003923466450000095
wherein n and m in the above equations (1) to (5) represent the height and width of the subblock to be compressed, respectively, y i,j Representing pixel values, X, of the reconstructed sub-block i,j Representing the pixel values of the subblock to be compressed.
In another example, the local error data is calculated, and based on this, before step 1301, the data processing method may further include:
in step 1304, local error data is calculated according to the pixel value of a first pixel point in the subblock to be compressed and the pixel value of a second pixel point in the reconstructed subblock, wherein the pixel coordinates of the first pixel point and the second pixel point are the same.
Further, the local error data includes a maximum error value, a median error value, and a minimum error value; based on this, the step 1304 may specifically include:
calculating the difference value between the pixel value of a first pixel point in the subblock to be compressed and a second pixel point in the reconstructed subblock;
determining a value with a minimum absolute value in the difference values as a minimum error value, determining a value with a maximum absolute value in the difference values as a maximum error value, and determining a median value of the absolute values in the difference values as a median error value.
Specifically, the minimum Error value (Min _ Error) is the minimum value in the absolute Error subblock obtained by subtracting each pixel in the reconstructed subblock and the subblock to be compressed; the Middle Error value (Middle _ Error) is the Middle value in the absolute Error sub-block obtained by subtracting each pixel in the reconstructed sub-block and the sub-block to be compressed; the maximum Error value (Max _ Error) is the maximum value in the absolute Error sub-block obtained by subtracting each pixel in the reconstructed sub-block and the sub-block to be compressed. The absolute error sub-block refers to an absolute value of a difference value between the reconstructed sub-block and the sub-block to be compressed.
Exemplarily, the subblocks to be compressed are 8 × 8 pixel matrixes, the reconstructed subblocks are also 8 × 8 pixel matrixes, matrix subtraction is performed on the subblocks and the reconstructed subblocks, and an absolute value is taken from each element in the matrix obtained by the matrix subtraction, so that the obtained matrix is an absolute error matrix; in the 8 × 8 absolute error matrix, the element with the largest value is taken as the largest error, the element with the smallest value is taken as the smallest error, and the element with the middle value is taken as the median error.
Based on the above, the comparison result in step 1301 can be specifically realized by the following formula (6):
multi-mode_select_deviation=Block_Error*Weight_0+Max_Error*Weight_1+Min_Error*Weight_2+Middle_Error*Weight_3 (6)
the multi-mode _ selection _ provision is the subblock to be compressed and each reconstructed subblock of the N reconstructed subblocks, block _ Error is a subblock Error, max _ Error is a maximum Error value, min _ Error is a minimum Error value, middle _ Error is a Middle Error value, weight _0, weight _1, weight _2 and Weight _3 are Weight coefficients corresponding to the subblock Error, the maximum Error value, the minimum Error value and the Middle Error value respectively.
Further, the value ranges of the Weight coefficients are all [0,1], and Weight _0+ Weight_1 + Weight_2 + Weight_3 =1.
Since the human eye subjective vision often observes the area with larger local error or uneven error distribution more easily, the balance is performed between the global error data and the local error data through the weight coefficient, the comparison results of different preset compression modes are calculated, and the preset compression mode with the minimum deviation in the obtained comparison results is the best compression mode which is obtained after the global and local balance and gives consideration to the objective compression error and the subjective visual effect, namely the target compression mode.
Then, referring to step 140, in one or more embodiments, the target compression mode corresponds to a target mode sequence identifier, and the compression result includes code stream data, based on which step 140 may specifically include:
and according to a preset bit-width ratio, packaging the target mode sequence identification and the coded data to obtain code stream data after the subblocks to be compressed are compressed.
Specifically, the mode sequence identifier refers to sequence numbers that are pre-assigned and different from each other for each pre-compressed mode, for example, N is 5, the mode sequence identifiers corresponding to the 5 compressed modes may be 0,1,2,3,4, respectively, and the sequence numbers of different pre-compressed modes are different from each other. Based on this, the sequence numbers of the target mode sequences are pre-designated for the target compression mode and are different from each other.
And the above mentioned related packaging means that the target mode sequence identifier and the encoded data corresponding to the target compression mode corresponding to the subblock to be compressed are packaged according to a preset bit width ratio, and are packaged into a data packet as the code stream data corresponding to the subblock to be compressed. The preset bit-width ratio refers to a bit-width ratio between the mode sequence identifier and the encoded data, and for decoding convenience, the preset bit-width ratios of multiple preset compression modes are fixed or follow a preset rule, for example, the preset bit-width ratio is 4: and 64, the mode sequence mark is stored by using 4 bits, and the coded data is stored by using 64 bits.
Therefore, the optimal compression result of each subblock to be compressed can be stored, the storage pressure is reduced, the memory consumption is reduced, and the N compression results of the first object compressed by the N preset compression modes as a whole are prevented from being stored.
Then, in one or more possible embodiments, after step 140, the data processing method may further include:
and storing the compression results corresponding to the subblocks to be compressed into a storage unit according to a preset sequence.
Specifically, the preset order may be a raster scanning order, that is, an order in which the corresponding pixel regions are scanned by the raster-scan display (for example, scanning from left to right and from top to bottom). And a storage unit may refer to a storage space for writing compression results, such as codestream data.
Therefore, the data processing method provided by the embodiment of the application can select the optimal target compression mode which gives consideration to both objective compression errors and subjective visual effects for each to-be-compressed sub-block in the first object among the plurality of preset compression modes, and process the to-be-compressed sub-blocks through the target compression mode, so that the optimal target compression mode which gives consideration to both objective compression errors and subjective visual effects can be selected for each to-be-compressed sub-block, the optimal compression results of each to-be-compressed sub-block are stored respectively, the storage pressure is reduced, the memory consumption is reduced, and N compression results of the first object compressed by the N preset compression modes as a whole are avoided being stored, and the internal cost is reduced.
In addition, the embodiment of the present application further provides a data decoding process, and based on this, after the step 140, the data processing method may further include:
step 150, analyzing the compression result of the subblock to be compressed according to a preset bit-width ratio to obtain a target mode sequence identifier;
step 160, acquiring a target preset decompression mode corresponding to the target mode sequence identifier according to the mode sequence identifier and the associated information of the preset decompression mode;
step 170, decompressing and reconstructing the compression result of the compression sub-block through a target preset decompression mode to obtain a reconstructed sub-block corresponding to the compression result;
and step 180, splicing the plurality of reconstructed sub-blocks to obtain the decompressed second object under the condition that the reconstructed sub-blocks are a plurality of reconstructed sub-blocks.
Specifically, the compression results of the subblocks to be compressed, such as code stream data, are read from the storage unit in a preset order. And then decoding the coded data in the code stream data by using a target preset decompression mode of a target compression mode corresponding to the target mode sequence identifier to obtain a reconstructed subblock corresponding to the code stream data.
For example, as shown in fig. 3, if N is 5, the mode sequence identifiers are 0,1,2,3,4, respectively, if the target compression mode is mode 3, the corresponding target mode sequence identifier is 3, and the preset bit-to-width ratio is 4:64, firstly, the code stream data of the first 4 bits is taken out for analysis, a target mode sequence identifier is 3, and the target compression mode is known to be a mode 3; and then, decoding the residual 64-bit encoded data by using a preset decoding mode corresponding to the mode 3 to obtain a reconstructed subblock. And then, outputting the plurality of reconstructed sub-blocks, and arranging the plurality of reconstructed sub-blocks according to the preset sequence to obtain a decompressed second object, so that the second object is displayed when a user triggers to display the second object.
According to the embodiment of the application, the optimal target compression mode which gives consideration to both objective compression errors and subjective visual effects can be selected for each subblock to be compressed through the mode, and the optimal compression result of each subblock to be compressed can be decompressed respectively, so that the decompressed image or video can achieve the visual lossless performance, and the visual effects of the decompressed image and video can be improved.
In addition, it should be noted that, in a scene of transmitting a compressed image, the above-mentioned related optimal compression result obtained by processing the sub-blocks to be compressed by the target compression mode may be sent in batches, so as to reduce the data transmission bandwidth each time, thereby implementing transmission of the visually lossless first object on the premise of satisfying the limited transmission bandwidth.
In the data processing method provided by the embodiment of the application, the execution main body can be a data processing device. In the embodiment of the present application, a data processing apparatus executes a data processing method as an example, and the data processing apparatus provided in the embodiment of the present application is described.
Based on the same inventive concept, the application also provides a data processing device. The detailed description is made with reference to fig. 3.
Fig. 3 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present application.
As shown in fig. 3, the data processing apparatus 30 may specifically include:
an obtaining module 301, configured to obtain a sub-block to be compressed of a first object;
a processing module 302, configured to perform compression and encoding processing on the sub-blocks to be compressed respectively through N preset compression modes to obtain a compressed and encoded data set, where the compressed and encoded data set includes encoded data corresponding to each preset compression mode in the N preset compression modes, and N is an integer greater than 1;
the screening module 303 is configured to screen a target compression mode from the N preset compression modes according to a comparison result between the subblock to be compressed and the reconstructed subblock, where the reconstructed subblock is obtained by decoding and reconstructing encoded data;
the processing module 302 is further configured to process the sub-block to be compressed based on the target compression mode.
The data processing device 30 will be described in detail below, specifically as follows:
in one or more possible embodiments, the data processing apparatus 30 in the embodiment of the present application may further include a first determining module; wherein the content of the first and second substances,
the screening module 303 may be further configured to, in a case that the comparison result includes the global error data and the local error data, screen a target comparison result from the comparison results of the subblock to be compressed and each reconstructed subblock of the N reconstructed subblocks, where the target comparison result satisfies at least one of the following: the global error data is less than or equal to a first preset threshold, and the local error data is less than or equal to a second preset threshold;
the first determining module is used for determining a preset compression mode corresponding to the target comparison result as a target compression mode;
the global error data is used for representing the overall error size and error distribution between the subblocks to be compressed and the reconstructed subblocks; the local error data is used for representing the size of an error extreme value and an error distribution range between each pixel point in the subblock to be compressed and each pixel point in the reconstructed subblock.
In another or more possible embodiments, the data processing apparatus 30 in the embodiment of the present application may further include a calculating module and a second determining module; wherein, the first and the second end of the pipe are connected with each other,
the calculation module is used for calculating the difference value between the pixel value of a first pixel point in the subblock to be compressed and a second pixel point in the reconstructed subblock under the condition that the local error data comprises a maximum error value, a middle error value and a minimum error value, and the pixel coordinates of the first pixel point and the second pixel point are the same;
and the second determining module is used for determining the value with the minimum absolute value in the difference values as the minimum error value, determining the value with the maximum absolute value in the difference values as the maximum error value and determining the median of the absolute values in the difference values as the intermediate error value.
In yet another or more possible embodiments, the processing module 302 in this embodiment is specifically configured to, when the target compression mode corresponds to the target mode sequence identifier and the compression result includes code stream data, encapsulate the target mode sequence identifier and the encoded data according to a preset bit-to-width ratio to obtain code stream data after compressing the sub-block to be compressed.
In yet another or more possible embodiments, the data processing apparatus 30 in the embodiment of the present application may further include a parsing module, a decompression module, and a splicing module; wherein the content of the first and second substances,
the analysis module is used for analyzing the compression result of the subblock to be compressed according to the preset bit-width ratio to obtain a target mode sequence identifier;
the obtaining module 301 may be further configured to obtain a target preset decompression mode corresponding to the target mode sequence identifier according to the mode sequence identifier and the association information of the preset decompression mode;
the decompression module is used for decompressing and reconstructing the compression result of the compression subblock through a target preset decompression mode to obtain a reconstructed subblock corresponding to the compression result;
and the splicing module is used for splicing the plurality of reconstructed subblocks under the condition that the reconstructed subblocks are the plurality of reconstructed subblocks to obtain the decompressed second object.
The data processing apparatus in the embodiments of the present application may be an electronic device, and may also be a component in the electronic device, such as an integrated circuit or a chip. The electronic device may be a terminal, or may be a device other than a terminal. The electronic Device may be, for example, a Mobile phone, a tablet computer, a notebook computer, a palm top computer, a vehicle-mounted electronic Device, a Mobile Internet Device (MID), an Augmented Reality (AR)/Virtual Reality (VR) Device, a robot, a wearable Device, an ultra-Mobile personal computer (UMPC), a netbook or a Personal Digital Assistant (PDA), and the like, and may also be a server, a Network Attached Storage (Network Attached Storage, NAS), a personal computer (NAS), a Television (TV), a teller machine, a self-service machine, and the like, and the embodiments of the present application are not limited in particular.
The data processing apparatus in the embodiment of the present application may be an apparatus having an operating system. The operating system may be an Android operating system, an IOS operating system, or other possible operating systems, which is not specifically limited in the embodiment of the present application.
The data processing apparatus provided in the embodiment of the present application can implement each process implemented in the method embodiments of fig. 1 to fig. 3, achieve the same technical effect, and is not described here again to avoid repetition.
In the embodiment of the application, the sub-blocks to be compressed of the first object are respectively subjected to compression coding processing through N preset compression modes to obtain coded data corresponding to each preset compression mode in the N preset compression modes, then the coded data corresponding to each preset compression mode are decoded and reconstructed to obtain reconstructed sub-blocks, so that the uncompressed coded sub-blocks to be compressed and the reconstructed sub-blocks which are compressed, coded and decoded and reconstructed can be compared, and based on the comparison result of the uncompressed coded sub-blocks and the reconstructed sub-blocks, a target compression mode capable of compressing the sub-blocks to be compressed is selected in the N preset compression modes.
Optionally, as shown in fig. 4, an electronic device 40 is further provided in this embodiment of the present application, and includes a processor 401 and a memory 402, where the memory 402 stores a program or an instruction that can be executed on the processor 401, and when the program or the instruction is executed by the processor 401, the steps of the data processing method embodiment are implemented, and the same technical effects can be achieved, and are not described again to avoid repetition.
It should be noted that the electronic devices such as the first electronic device and the second electronic device in the embodiments of the present application include the mobile electronic device and the non-mobile electronic device described above.
Fig. 5 is a schematic hardware structure diagram of an electronic device according to an embodiment of the present application.
The electronic device 500 includes, but is not limited to: radio frequency unit 501, network module 502, audio output unit 503, input unit 504, sensor 505, display unit 606, user input unit 507, interface unit 508, memory 509, processor 510, and the like.
Those skilled in the art will appreciate that the electronic device 500 may further include a power supply (e.g., a battery) for supplying power to various components, and the power supply may be logically connected to the processor 510 via a power management system, so as to implement functions of managing charging, discharging, and power consumption via the power management system. The electronic device structure shown in fig. 5 does not constitute a limitation of the electronic device, and the electronic device may include more or less components than those shown, or combine some components, or arrange different components, and thus, the description is omitted here.
In this embodiment, the processor 510 is configured to obtain a sub-block to be compressed of a first object. The processor 510 may be further configured to perform compression and encoding processing on the sub-blocks to be compressed respectively through N preset compression modes to obtain a compression and encoding data set, where the compression and encoding data set includes encoding data corresponding to each preset compression mode in the N preset compression modes, and N is an integer greater than 1. The processor 510 may be further configured to, according to a comparison result between the sub-block to be compressed and the reconstructed sub-block, screen a target compression mode from the N preset compression modes, where the reconstructed sub-block is obtained by decoding and reconstructing encoded data. The processor 510 may be further configured to process the sub-blocks to be compressed based on the target compression mode.
In one or more possible embodiments, the processor 510 in this embodiment may be specifically configured to, in a case that the comparison result includes global error data and local error data, filter a target comparison result from the comparison result of the subblock to be compressed and each reconstructed subblock of the N reconstructed subblocks, where the target comparison result satisfies at least one of the following: the global error data is less than or equal to a first preset threshold, and the local error data is less than or equal to a second preset threshold;
determining a preset compression mode corresponding to the target comparison result as a target compression mode;
the global error data is used for representing the overall error size and error distribution between the subblocks to be compressed and the reconstructed subblocks; the local error data is used for representing the size of an error extreme value and the error distribution range between each pixel point in the subblock to be compressed and each pixel point in the reconstructed subblock.
In another or more possible embodiments, the processor 510 in this embodiment may be further configured to, when the local error data includes a maximum error value, a middle error value, and a minimum error value, calculate a difference between a pixel value of a first pixel point in the to-be-compressed subblock and a second pixel point in the reconstructed subblock, where pixel coordinates of the first pixel point and the second pixel point are the same; determining a value with a minimum absolute value in the difference values as a minimum error value, determining a value with a maximum absolute value in the difference values as a maximum error value, and determining a median value of the absolute values in the difference values as a median error value.
In yet another or more possible embodiments, the processor 510 in this embodiment is specifically configured to, when the target compression mode corresponds to the target mode sequence identifier and the compression result includes code stream data, encapsulate the target mode sequence identifier and the encoded data according to a preset bit-to-width ratio to obtain code stream data after compressing the sub-block to be compressed.
In one or more possible embodiments, the processor 510 in this embodiment may be further configured to, according to a preset bit-to-width ratio, analyze a compression result of a sub-block to be compressed to obtain a target pattern sequence identifier;
acquiring a target preset decompression mode corresponding to the target mode sequence identifier according to the mode sequence identifier and the associated information of the preset decompression mode;
decompressing and reconstructing the compression result of the compressed subblock through a target preset decompression mode to obtain a reconstructed subblock corresponding to the compression result;
and under the condition that the reconstructed sub-blocks are multiple reconstructed sub-blocks, splicing the multiple reconstructed sub-blocks to obtain the decompressed second object.
It is to be understood that the input Unit 504 may include a Graphics Processing Unit (GPU) 5041 and a microphone 5042, the Graphics processor 5041 Processing image data of still images or video obtained by an image capture device (e.g., a camera) in a video capture mode or an image capture mode. The display unit 606 may include a display panel, which may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 507 includes at least one of a touch panel 5071 and other input devices 5072. The touch panel 5071 is also called a touch screen. The touch panel 5071 may include two parts of a touch detection device and a touch display. Other input devices 5072 may include, but are not limited to, a physical keyboard, function keys (e.g., volume display keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in further detail herein.
The memory 509 may be used to store a software program and various data, and the memory 509 may mainly include a first memory area storing a program or an instruction and a second memory area storing data, wherein the first memory area may store an operating system, an application program or an instruction (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like. Further, the memory 509 may include volatile memory or non-volatile memory, or the memory 509 may include both volatile and non-volatile memory. The non-volatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash Memory. The volatile Memory may be a Random Access Memory (RAM), a Static Random Access Memory (Static RAM, SRAM), a Dynamic Random Access Memory (Dynamic RAM, DRAM), a Synchronous Dynamic Random Access Memory (Synchronous DRAM, SDRAM), a Double Data Rate Synchronous Dynamic Random Access Memory (Double Data Rate SDRAM, ddr SDRAM), an Enhanced Synchronous SDRAM (ESDRAM), a Synchronous Link DRAM (SLDRAM), and a Direct Memory bus RAM (DRRAM). The memory 509 in the embodiments of the subject application includes, but is not limited to, these and any other suitable types of memory.
Processor 510 may include one or more processing units; optionally, the processor 510 integrates an application processor, which mainly handles operations related to the operating system, user interface, application programs, etc., and a modem processor, which mainly handles wireless data processing signals, such as a baseband processor. It will be appreciated that the modem processor described above may not be integrated into processor 510.
The embodiment of the present application further provides a readable storage medium, where a program or an instruction is stored on the readable storage medium, and when the program or the instruction is executed by a processor, the program or the instruction implements each process of the data processing method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read only memory ROM, a random access memory RAM, a magnetic disk or an optical disk, and the like.
In addition, an embodiment of the present application further provides a chip, where the chip includes a processor and a data processing interface, the data processing interface is coupled to the processor, and the processor is configured to execute a program or an instruction to implement each process of the data processing method embodiment, and the same technical effect can be achieved, and details are not repeated here to avoid repetition.
It should be understood that the chips mentioned in the embodiments of the present application may also be referred to as a system-on-chip, or a system-on-chip.
Embodiments of the present application provide a computer program product, where the program product is stored in a storage medium, and the program product is executed by at least one processor to implement the processes of the foregoing data processing method embodiments, and can achieve the same technical effects, and in order to avoid repetition, details are not described here again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one of 8230, and" comprising 8230does not exclude the presence of additional like elements in a process, method, article, or apparatus comprising the element.
Further, it should be noted that the scope of the methods and apparatus of the embodiments of the present application is not limited to performing the functions in the order illustrated or discussed, but may include performing the functions in a substantially simultaneous manner or in a reverse order based on the functions involved, e.g., the methods described may be performed in an order different than that described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, or a network device) to execute the method of the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the present embodiments are not limited to those precise embodiments, which are intended to be illustrative rather than restrictive, and that various changes and modifications may be effected therein by one skilled in the art without departing from the scope of the appended claims.

Claims (10)

1. A method of data processing, comprising:
acquiring a to-be-compressed subblock of a first object;
respectively carrying out compression coding processing on the subblocks to be compressed through N preset compression modes to obtain a compression coding data set, wherein the compression coding data set comprises coding data corresponding to each preset compression mode in the N preset compression modes, and N is an integer greater than 1;
screening a target compression mode from the N preset compression modes according to a comparison result of the sub-block to be compressed and the reconstructed sub-block, wherein the reconstructed sub-block is obtained by decoding and reconstructing the encoded data;
and processing the subblocks to be compressed according to the target compression mode.
2. The method of claim 1, wherein the comparison result comprises global error data and local error data; the step of screening a target compression mode from the N preset compression modes according to the comparison result of the subblock to be compressed and the reconstructed subblock comprises the following steps:
screening a target comparison result from the comparison result of the subblock to be compressed and each reconstructed subblock of the N reconstructed subblocks, wherein the target comparison result meets at least one of the following conditions: the global error data is less than or equal to a first preset threshold, and the local error data is less than or equal to a second preset threshold;
determining a preset compression mode corresponding to the target comparison result as a target compression mode;
wherein the global error data is used for representing the overall error size and error distribution between the subblock to be compressed and the reconstructed subblock; and the local error data is used for representing the size of an error extreme value and the error distribution range between each pixel point in the subblock to be compressed and each pixel point in the reconstructed subblock.
3. The method of claim 2, wherein the local error data comprises a maximum error value, a median error value, and a minimum error value; before screening a target comparison result from the comparison results of the subblock to be compressed and each reconstructed subblock of the N reconstructed subblocks, the method further comprises:
calculating the difference value between the pixel value of a first pixel point in the subblock to be compressed and a second pixel point in the reconstructed subblock, wherein the pixel coordinates of the first pixel point and the second pixel point are the same;
determining a value of the difference value having a smallest absolute value as the minimum error value, determining a value of the difference value having a largest absolute value as the maximum error value, and determining a median of the absolute values of the difference values as the intermediate error value.
4. The method of claim 1, wherein the target compression mode corresponds to a target mode sequence id, and the compression result comprises code stream data;
the processing the sub-blocks to be compressed according to the target compression mode comprises:
and according to a preset bit-width ratio, packaging the target mode sequence identifier and the coded data to obtain code stream data after the subblocks to be compressed are compressed.
5. The method of claim 1, wherein after the processing the sub-blocks to be compressed according to the target compression mode, the method further comprises:
analyzing the compression result of the subblock to be compressed according to a preset bit-width ratio to obtain a target mode sequence identifier;
acquiring a target preset decompression mode corresponding to the target mode sequence identifier according to the mode sequence identifier and the associated information of the preset decompression mode;
decompressing and reconstructing the compression result of the compression subblock through the target preset decompression mode to obtain a reconstructed subblock corresponding to the compression result;
and under the condition that the reconstructed sub-blocks are multiple reconstructed sub-blocks, splicing the multiple reconstructed sub-blocks to obtain a decompressed second object.
6. A data processing apparatus, comprising:
the acquisition module is used for acquiring a subblock to be compressed of a first object;
the processing module is used for respectively carrying out compression coding processing on the subblocks to be compressed through N preset compression modes to obtain a compression coding data set, wherein the compression coding data set comprises coding data corresponding to each preset compression mode in the N preset compression modes, and N is an integer greater than 1;
the screening module is used for screening a target compression mode from the N preset compression modes according to the comparison result of the sub-block to be compressed and the reconstructed sub-block, and the reconstructed sub-block is obtained by decoding and reconstructing the encoded data;
and the processing module is further used for processing the subblocks to be compressed according to the target compression mode.
7. The apparatus of claim 6, wherein the data processing apparatus further comprises a first determining module; wherein the content of the first and second substances,
the screening module is further configured to screen a target comparison result from the comparison results of the subblock to be compressed and each of the N reconstructed subblocks if the comparison result includes global error data and local error data, where the target comparison result satisfies at least one of the following: the global error data is less than or equal to a first preset threshold, and the local error data is less than or equal to a second preset threshold;
the first determining module is configured to determine a preset compression mode corresponding to the target comparison result as a target compression mode;
wherein the global error data is used for representing the overall error size and error distribution between the subblock to be compressed and the reconstructed subblock; and the local error data is used for representing the size of an error extreme value and the error distribution range between each pixel point in the subblock to be compressed and each pixel point in the reconstructed subblock.
8. The apparatus of claim 7, wherein the data processing apparatus further comprises a calculation module and a second determination module; wherein, the first and the second end of the pipe are connected with each other,
the calculation module is configured to calculate a difference between a pixel value of a first pixel in the subblock to be compressed and a pixel coordinate of a second pixel in the reconstructed subblock when the local error data includes a maximum error value, a middle error value and a minimum error value;
the second determining module is configured to determine a value with a smallest absolute value among the difference values as the minimum error value, determine a value with a largest absolute value among the difference values as the maximum error value, and determine a median value of the absolute values among the difference values as the intermediate error value.
9. The apparatus according to claim 6, wherein the processing module is specifically configured to, in a case that the target compression mode corresponds to a target mode sequence identifier and the compression result includes code stream data, encapsulate the target mode sequence identifier and the encoded data according to a preset bit-to-width ratio to obtain the code stream data after the subblock to be compressed is compressed.
10. The apparatus of claim 6, wherein the data processing apparatus further comprises a parsing module, a decompression module, and a concatenation module; wherein the content of the first and second substances,
the analysis module is used for analyzing the compression result of the subblock to be compressed according to a preset bit-width ratio to obtain a target mode sequence identifier;
the acquisition module is further used for acquiring a target preset decompression mode corresponding to the target mode sequence identifier according to the mode sequence identifier and the associated information of the preset decompression mode;
the decompression module is used for decompressing and reconstructing the compression result of the compressed subblock through the target preset decompression mode to obtain a reconstructed subblock corresponding to the compression result;
and the splicing module is used for splicing the plurality of reconstructed subblocks under the condition that the reconstructed subblocks are a plurality of reconstructed subblocks to obtain a decompressed second object.
CN202211363217.XA 2022-11-02 2022-11-02 Data processing method and device Pending CN115767085A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211363217.XA CN115767085A (en) 2022-11-02 2022-11-02 Data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211363217.XA CN115767085A (en) 2022-11-02 2022-11-02 Data processing method and device

Publications (1)

Publication Number Publication Date
CN115767085A true CN115767085A (en) 2023-03-07

Family

ID=85355504

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211363217.XA Pending CN115767085A (en) 2022-11-02 2022-11-02 Data processing method and device

Country Status (1)

Country Link
CN (1) CN115767085A (en)

Similar Documents

Publication Publication Date Title
KR100974177B1 (en) Method and apparatus for using random field models to improve picture and video compression and frame rate up conversion
Kim et al. Hierarchical prediction and context adaptive coding for lossless color image compression
US9538239B2 (en) Decoder and method for decoding encoded input data containing a plurality of blocks or packets
EP3829173A1 (en) Transmission of images and videos using artificial intelligence models
US10848787B2 (en) Lossy image compression using palettization of locally mixed colors
EP4020370A1 (en) Image processing method and device
KR101346942B1 (en) Vector embedded graphics coding
CN111738951B (en) Image processing method and device
CN112218092A (en) Encoding method, apparatus and storage medium for string encoding technique
EP3035687A1 (en) A device and a method for encoding an image and corresponding decoding method and decoding device
US11006119B1 (en) Compression encoding of images
CN102271251B (en) Lossless image compression method
WO2022266955A1 (en) Image decoding method and apparatus, image processing method and apparatus, and device
CN111246208B (en) Video processing method and device and electronic equipment
CN116847087A (en) Video processing method and device, storage medium and electronic equipment
CN115767085A (en) Data processing method and device
CN115294429A (en) Feature domain network training method and device
EP3026912A1 (en) Method and device for encoding and decoding a HDR picture and a LDR picture using illumination information
CN101310534A (en) Method and apparatus for using random field models to improve picture and video compression and frame rate up conversion
WO2024078403A1 (en) Image processing method and apparatus, and device
CN115150370B (en) Image processing method
Siddique et al. Exhaustive crisp parameter modification in quantization table for effective image compression
EP3035685A1 (en) A device and a method for encoding an image and corresponding decoding method and decoding device
EP3065127A1 (en) Method and device for processing image data
CN115412727A (en) Encoding method, decoding method and device thereof

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