CN113422955B - HEIF image encoding method, HEIF image decoding method, HEIF image encoding device, HEIF image decoding device, HEIF image encoding program, HEIF image decoding program, and HEIF image decoding program - Google Patents

HEIF image encoding method, HEIF image decoding method, HEIF image encoding device, HEIF image decoding device, HEIF image encoding program, HEIF image decoding program, and HEIF image decoding program Download PDF

Info

Publication number
CN113422955B
CN113422955B CN202110667390.8A CN202110667390A CN113422955B CN 113422955 B CN113422955 B CN 113422955B CN 202110667390 A CN202110667390 A CN 202110667390A CN 113422955 B CN113422955 B CN 113422955B
Authority
CN
China
Prior art keywords
blocks
block
cost value
final
base
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110667390.8A
Other languages
Chinese (zh)
Other versions
CN113422955A (en
Inventor
程宇杰
钱祥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Samsung Electronics China R&D Center
Samsung Electronics Co Ltd
Original Assignee
Samsung Electronics China R&D Center
Samsung Electronics 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 Samsung Electronics China R&D Center, Samsung Electronics Co Ltd filed Critical Samsung Electronics China R&D Center
Priority to CN202110667390.8A priority Critical patent/CN113422955B/en
Publication of CN113422955A publication Critical patent/CN113422955A/en
Application granted granted Critical
Publication of CN113422955B publication Critical patent/CN113422955B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/119Adaptive subdivision aspects, e.g. subdivision of a picture into rectangular or non-rectangular coding blocks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/70Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by syntax aspects related to video coding, e.g. related to compression standards

Abstract

Provided are a HEIF image encoding method and decoding method, and an encoding apparatus and decoding apparatus, the HEIF image encoding method including: dividing the HEIF image into a plurality of basic blocks with the same size; obtaining a plurality of final blocks by dynamically partitioning the plurality of base blocks; encoding the plurality of final blocks in parallel to obtain encoded data of the HEIF image, wherein the step of obtaining the plurality of final blocks by dynamically partitioning the plurality of base blocks comprises: determining a coding cost value of each base block by pre-coding each base block of the plurality of base blocks; and dynamically partitioning each basic block based on the coding cost value of each basic block to obtain the plurality of final blocks.

Description

HEIF image encoding method, HEIF image decoding method, HEIF image encoding device, HEIF image decoding device, HEIF image encoding program, HEIF image decoding program, and HEIF image decoding program
Technical Field
The present application relates generally to image encoding and decoding techniques, and more particularly, to a HEIF image encoding and decoding method, and an encoding apparatus and a decoding apparatus based on dynamic blocking.
Background
The high efficiency image file format (High Efficiency Image File Format, HEIF) is a new generation of high efficiency image format based on High Efficiency Video Coding (HEVC), and is widely used in image capturing and storage of electronic devices such as mobile phones. The HEIF image can save 50% of memory space relative to an image of a general JPEG format, and using the HEIF format can also reduce the improvement of image quality and the reduction of transmission bandwidth.
In the prior art, a coding and decoding process of the HEIF image adopts a mode of a base block image group with a fixed size, specifically, at a coding end, the HEIF image is coded by dividing the image into matrix-shaped image groups with consistent resolution, and then coding each block image by adopting a coding mode of HEVC. Accordingly, at the decoding end, the HEIF image is decoded by separately decoding each of the block images and then combining the decoded blocks. In order to optimize coding and decoding performance, the existing solution is to process each image in the HEIF file image group by adopting an optimized HEVC method, specifically, divide the HEIF image into a plurality of basic block images, calculate the cost value of each basic block image, and select the mode with the lowest cost value in the HEVC coding and decoding process to process each basic block image of the HEIF image. However, when the existing solution decodes the HEIF image, when the blocks of the multiple HEIF images are decoded in parallel using multiple CPUs, since the data size generated for each block code is not uniform, a large difference between the data sizes will cause load imbalance of each CPU at the decoding end, affecting the decoding efficiency.
Therefore, there is a need for a method and apparatus that can avoid load imbalance of the CPU at the time of decoding and increase the HEIF image decoding speed.
Disclosure of Invention
Technical problem
To solve the above and other drawbacks of the prior art, a HEIF-based image encoding method and decoding method, and an encoding apparatus and decoding apparatus are provided.
Technical proposal
A HEIF image encoding method according to the present disclosure may include: dividing the HEIF image into a plurality of basic blocks with the same size; obtaining a plurality of final blocks by dynamically partitioning the plurality of base blocks; the plurality of final blocks are encoded in parallel to obtain encoded data of the HEIF image. In the HEIF image encoding method according to the present disclosure, the step of obtaining a plurality of final blocks by dynamically blocking the plurality of base blocks may include: determining a coding cost value of each base block by pre-coding each base block of the plurality of base blocks; and dynamically partitioning each basic block based on the coding cost value of each basic block to obtain the plurality of final blocks.
In the HEIF image encoding method according to the present disclosure, the encoded data may include image basic information, block information of the plurality of final blocks, and encoding information of the plurality of final blocks, wherein the block information of the plurality of final blocks includes positions of the plurality of final blocks, sizes of the plurality of final blocks, cost values of the plurality of final blocks, and the number of the plurality of final blocks.
In the HEIF image coding method according to the present disclosure, the step of dynamically blocking each base block based on the coding cost value of the each base block to obtain the plurality of final blocks may include: comparing the coding cost value of each basic block with a first threshold; when the base blocks with the coding cost value larger than the first threshold value exist in the plurality of base blocks, the base blocks with the coding cost value larger than the first threshold value are further segmented into new blocks according to at least one dynamic segmentation method.
In the HEIF image coding method according to the present disclosure, the step of dynamically partitioning the each base block based on the coding cost value of the each base block to obtain the plurality of final blocks may further include: determining the coding cost value of each new block according to each dynamic segmentation method; calculating the variance of the coding cost value of each new block and all the basic blocks which are not further divided; and determining a dynamic segmentation method corresponding to the smallest variance among the at least one dynamic segmentation method as the optimal dynamic segmentation method among the at least one dynamic segmentation method.
In the HEIF image encoding method according to the present disclosure, the step of determining the encoding cost value of each new block may include: the coding cost value of the new segmented block is determined by re-precoding the new segmented block.
In the HEIF image coding method according to the present disclosure, the step of dynamically blocking each base block based on the coding cost value of the each base block to obtain the plurality of final blocks may include: comparing the coding cost value of each basic block with a second threshold; and when adjacent basic blocks with the coding cost value smaller than a second threshold value exist in the plurality of basic blocks, merging the adjacent basic blocks with the coding cost value smaller than the second threshold value into a new block according to at least one merging method.
In the HEIF image coding method according to the present disclosure, the step of dynamically partitioning the each base block based on the coding cost value of the each base block to obtain the plurality of final blocks may further include: determining the coding cost value of each new block for each merging method; calculating the variance of the coding cost value of each new block and all the uncombined base blocks; and determining a merging method corresponding to the smallest variance among the at least one merging method as the best merging method among the at least one merging method.
In the HEIF image encoding method according to the present disclosure, the step of determining the encoding cost value of each new block may include: and adding the coding cost values of the adjacent basic blocks before merging to obtain the coding cost value of the new block of the adjacent basic blocks after merging.
In the HEIF image coding method according to the present disclosure, the step of dynamically partitioning the each base block based on the coding cost value of the each base block to obtain the plurality of final blocks may further include: for the final block generated by merging, block information of a base block used for merging the final block is determined as sub-block information, and the sub-block information of the base block used for merging the final block is recorded together as block information of a corresponding final block.
In the HEIF image encoding method according to the present disclosure, the encoding cost value may be a weighted sum of at least one of the following three: the CPU occupancy of the block at the time of encoding, the compressed data block size generated by encoding the block, and the encoding time spent encoding the block.
In the HEIF image encoding method according to the present disclosure, the step of encoding the plurality of final blocks in a parallel manner may include: when the number of CPU cores is greater than or equal to the number of final blocks, one CPU core is used for encoding one final block; and dynamically allocating a final block to be encoded by each CPU core based on the number of CPU cores and the encoding cost value of each final block when the number of CPU cores is less than the number of final blocks.
In the HEIF image coding method according to the present disclosure, the step of dynamically blocking each base block based on the coding cost value of the each base block to obtain the plurality of final blocks may include: comparing the coding cost value of each basic block with a first threshold and a second threshold, wherein the first threshold is larger than the second threshold; when the basic blocks with the coding cost value larger than the first threshold value exist in the plurality of basic blocks, the basic blocks with the coding cost value larger than the first threshold value are further segmented into new blocks according to at least one dynamic segmentation method; and when adjacent basic blocks with the coding cost value smaller than a second threshold value exist in the plurality of basic blocks, merging the adjacent basic blocks with the coding cost value smaller than the second threshold value into a new block according to at least one merging method.
In the HEIF image coding method according to the present disclosure, the step of dynamically partitioning the each base block based on the coding cost value of the each base block to obtain the plurality of final blocks may further include: determining the coding cost value of each new block according to each combination scheme of the dynamic segmentation method and the combination method; calculating the variance of the coding cost value of each new block and all the base blocks which are not combined or further divided; the combination scheme corresponding to the smallest variance is selected from all combination schemes to determine the best dynamic segmentation method of the at least one dynamic segmentation method and the best merging method of the at least one merging method.
In the HEIF image encoding method according to the present disclosure, the step of determining the encoding cost value of each new block for each combination scheme of the dynamic segmentation method and the merging method may include: for each merging method, the coding cost values of the adjacent basic blocks before merging are added to obtain the coding cost values of the new blocks of the adjacent basic blocks after merging; for each dynamic segmentation method, the coding cost value of the segmented new block is determined by re-precoding the segmented new block.
A HEIF image decoding method according to the present disclosure may include: obtaining encoded data of the HEIF image; parsing image basic information, block information of a plurality of blocks, and encoding information of the plurality of blocks from encoded data; decoding the encoded information of the plurality of blocks in parallel to obtain the plurality of blocks; and merging the decoded blocks based on the image basic information and the block information of the blocks.
In the HEIF image decoding method according to the present disclosure, the block information of the plurality of blocks may include positions of the plurality of blocks, sizes of the plurality of blocks, cost values of the plurality of blocks, the number of the plurality of blocks.
In the HEIF image decoding method according to the present disclosure, the step of decoding the encoded information of the plurality of blocks in parallel to obtain a plurality of blocks may include determining a CPU core to which the encoded information of each of the plurality of blocks is dynamically allocated based on the number of CPU cores, wherein when the number of CPU cores is greater than or equal to the number of the plurality of blocks, one CPU core is allocated to process the encoded information of one block; and dynamically distributing the coding information of the blocks to be processed by each CPU core based on the number of the CPU cores and the coding cost value of each block when the number of the CPU cores is smaller than the number of the plurality of blocks.
In the HEIF image decoding method according to the present disclosure, the step of dynamically allocating the encoding information of the block to be processed by each CPU core based on the number of CPU cores and the encoding cost value of each block may include: dividing the coding information of the blocks into a plurality of groups equal to the number of CPU cores according to at least one grouping mode; calculating the variance of the coding cost value of the group generated by each grouping mode according to the coding cost value of each block; and selecting a grouping mode corresponding to the smallest variance from the at least one grouping mode, and dynamically distributing the coding information of the block to the CPU core according to the grouping mode.
A HEIF image encoding apparatus according to the present disclosure may include: a dividing unit configured to divide the HEIF image into a plurality of base blocks of the same size, and obtain a plurality of final blocks by performing dynamic block processing on the plurality of base blocks; and an encoding unit configured to encode the plurality of final blocks in parallel to obtain encoded data of the HEIF image. In the HEIF image encoding apparatus according to the present disclosure, the dividing unit may be configured to obtain a plurality of final blocks by dynamically dividing the plurality of base blocks by: determining a coding cost value of each base block by pre-coding each base block of the plurality of base blocks; and dynamically partitioning each basic block based on the coding cost value of each basic block to obtain the plurality of final blocks.
In the HEIF image encoding apparatus according to the present disclosure, the encoded data may include image basic information, block information of the plurality of final blocks, and encoding information of the plurality of final blocks, wherein the block information of the plurality of final blocks includes positions of the plurality of final blocks, sizes of the plurality of final blocks, cost values of the plurality of final blocks, and the number of the plurality of final blocks.
In the HEIF image encoding apparatus according to the present disclosure, the dividing unit may be configured to obtain the plurality of final blocks by dynamically dividing the each base block based on the encoding cost value of the each base block by: comparing the coding cost value of each basic block with a first threshold; when the base blocks with the coding cost value larger than the first threshold value exist in the plurality of base blocks, the base blocks with the coding cost value larger than the first threshold value are further segmented into new blocks according to at least one dynamic segmentation method.
In the HEIF image coding apparatus according to the present disclosure, the segmentation unit may be further configured to obtain the plurality of final blocks by dynamically partitioning the each base block based on the coding cost value of the each base block by: determining the coding cost value of each new block according to each dynamic segmentation method; calculating the variance of the coding cost value of each new block and all the basic blocks which are not further divided; and determining a dynamic segmentation method corresponding to the smallest variance among the at least one dynamic segmentation method as the optimal dynamic segmentation method among the at least one dynamic segmentation method.
In the HEIF image encoding apparatus according to the present disclosure, the dividing unit is configured to determine the encoding cost value of each new block by: the coding cost value of the new segmented block is determined by re-precoding the new segmented block.
In the HEIF image encoding apparatus according to the present disclosure, the dividing unit may be configured to obtain the plurality of final blocks by dynamically dividing the each base block based on the encoding cost value of the each base block by: comparing the coding cost value of each basic block with a second threshold; and when adjacent basic blocks with the coding cost value smaller than a second threshold value exist in the plurality of basic blocks, merging the adjacent basic blocks with the coding cost value smaller than the second threshold value into a new block according to at least one merging method. In the HEIF image coding apparatus according to the present disclosure, the segmentation unit may be further configured to obtain the plurality of final blocks by dynamically partitioning the each base block based on the coding cost value of the each base block by: determining the coding cost value of each new block for each merging method; calculating the variance of the coding cost value of each new block and all the uncombined base blocks; and determining a merging method corresponding to the smallest variance among the at least one merging method as the best merging method among the at least one merging method.
In the HEIF image encoding method according to the present disclosure, wherein the segmentation unit is configured to determine the encoding cost value of each new block by: and adding the coding cost values of the adjacent basic blocks before merging to obtain the coding cost value of the new block of the adjacent basic blocks after merging.
In the HEIF image encoding method according to the present disclosure, the dividing unit may be configured to obtain the plurality of final blocks by dynamically dividing the each base block based on the encoding cost value of the each base block by: for the final block generated by merging, block information of a base block used for merging the final block is determined as sub-block information, and the sub-block information of the base block used for merging the final block is recorded together as block information of a corresponding final block.
In the HEIF image encoding method according to the present disclosure, the encoding cost value may be a weighted sum of at least one of the following three: the CPU occupancy of the block at the time of encoding, the compressed data block size generated by encoding the block, and the encoding time spent encoding the block.
In the HEIF image encoding method according to the present disclosure, the encoding unit may be configured to encode the plurality of final blocks in a parallel manner by: when the number of CPU cores is greater than or equal to the number of final blocks, one CPU core is used for encoding one final block; and dynamically allocating a final block to be encoded by each CPU core based on the number of CPU cores and the encoding cost value of each final block when the number of CPU cores is less than the number of final blocks.
In the HEIF image encoding apparatus according to the present disclosure, the dividing unit may be configured to obtain the plurality of final blocks by dynamically dividing the each base block based on the encoding cost value of the each base block by: comparing the coding cost value of each basic block with a first threshold and a second threshold, wherein the first threshold is larger than the second threshold; when the basic blocks with the coding cost value larger than the first threshold value exist in the plurality of basic blocks, the basic blocks with the coding cost value larger than the first threshold value are further segmented into new blocks according to at least one dynamic segmentation method; and when adjacent basic blocks with the coding cost value smaller than a second threshold value exist in the plurality of basic blocks, merging the adjacent basic blocks with the coding cost value smaller than the second threshold value into a new block according to at least one merging method.
In the HEIF image coding apparatus according to the present disclosure, the segmentation unit may be further configured to obtain the plurality of final blocks by dynamically partitioning the each base block based on the coding cost value of the each base block by: determining the coding cost value of each new block according to each combination scheme of the dynamic segmentation method and the combination method; calculating the variance of the coding cost value of each new block and all the base blocks which are not combined or further divided; the combination scheme corresponding to the smallest variance is selected from all combination schemes to determine the best dynamic segmentation method of the at least one dynamic segmentation method and the best merging method of the at least one merging method.
In the HEIF image encoding apparatus according to the present disclosure, the dividing unit may be configured to determine the encoding cost value of each new block by: for each merging method, the coding cost values of the adjacent basic blocks before merging are added to obtain the coding cost values of the new blocks of the adjacent basic blocks after merging; for each dynamic segmentation method, the coding cost value of the segmented new block is determined by re-precoding the segmented new block.
A HEIF image decoding apparatus according to the present disclosure may include: an acquisition unit configured to acquire encoded data of the HEIF image; a parsing unit configured to parse image basic information, block information of a plurality of blocks, and encoding information of the plurality of blocks from encoded data; and a decoding unit configured to decode the encoded information of the plurality of blocks in parallel to obtain the plurality of blocks, and to combine the decoded plurality of blocks based on the image base information and the block information of the plurality of blocks.
In the HEIF image decoding apparatus according to the present disclosure, the block information of the plurality of blocks may include positions of the plurality of blocks, sizes of the plurality of blocks, cost values of the plurality of blocks, the number of the plurality of blocks.
In the HEIF image decoding apparatus according to the present disclosure, the decoding unit may be configured to decode the encoded information of the plurality of blocks in parallel to obtain a plurality of blocks by: determining a CPU core to which the encoding information of each of the plurality of blocks is dynamically allocated based on the number of CPU cores, wherein one CPU core is allocated to process the encoding information of one block when the number of CPU cores is greater than or equal to the number of the plurality of blocks; and dynamically distributing the coding information of the blocks to be processed by each CPU core based on the number of the CPU cores and the coding cost value of each block when the number of the CPU cores is smaller than the number of the plurality of blocks.
In the HEIF image decoding apparatus according to the present disclosure, the decoding unit may be configured to dynamically allocate the encoded information of the block to be processed by each CPU core based on the number of CPU cores and the encoded cost value of said each block by: dividing the coding information of the blocks into a plurality of groups equal to the number of CPU cores according to at least one grouping mode; calculating the variance of the coding cost value of the group generated by each grouping mode according to the coding cost value of each block; and selecting a grouping mode corresponding to the smallest variance from the at least one grouping mode, and dynamically distributing the coding information of the block to the CPU core according to the grouping mode.
An electronic device according to the present disclosure may include: a memory and a processor; the memory stores a computer program; the processor, when running the computer program, performs the HEIF image encoding method described above or the HEIF image decoding method described above.
A computer readable storage medium storing a program according to the present disclosure, which when executed by a processor, can implement the above-described HEIF image encoding method or the above-described HEIF image decoding method.
It is to be understood that the foregoing general description is of exemplary aspects of the following detailed description of the disclosure, and is not intended to limit the scope of the disclosure.
Advantageous effects
The HEIF image encoding method and decoding method based on dynamic blocking, the encoding device and decoding can effectively avoid load imbalance of the CPU during decoding, and the decoding speed of the HEIF image by the electronic equipment is improved.
The method solves the problems of unbalanced load and low decoding speed when decoding HEIF images in the prior art, and also solves the problem of high resource consumption when decoding HEIF images.
Effects obtainable from the present disclosure may not be limited by the above-described effects, and other effects not mentioned may be clearly understood from the following description by those of ordinary skill in the art to which the present disclosure pertains.
Drawings
Fig. 1 is a flowchart illustrating a HEIF image encoding method according to the present disclosure.
Fig. 2 is a diagram illustrating base tiles segmented from a HEIF image according to the present disclosure.
Fig. 3 is a diagram illustrating further segmentation of a base block into new blocks according to the present disclosure.
Fig. 4 is a diagram illustrating a final block resulting from dynamic blocking of a HEIF image according to the present disclosure.
Fig. 5 is a diagram illustrating a process of checking a plurality of blocks for encoding using a plurality of CPUs according to the present disclosure.
Fig. 6 is a flowchart illustrating a HEIF image decoding method according to the present disclosure.
Fig. 7 is a diagram showing one example of a process of checking a plurality of blocks for decoding using a plurality of CPUs according to the present disclosure.
Fig. 8 is a diagram illustrating another example of a process of checking a plurality of blocks for decoding using a plurality of CPUs according to the present disclosure.
Fig. 9 is a block diagram illustrating a HEIF image encoding apparatus according to the present disclosure.
Fig. 10 is a block diagram illustrating a HEIF image decoding apparatus according to the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described in detail with reference to the accompanying drawings.
The terms "comprises" or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, components, and/or groups thereof, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. Each of the phrases such as "a or B", "at least one of a and B", "at least one of a or B", "A, B or C", "at least one of A, B and C", and "at least one of A, B or C" may include all possible combinations of items listed with the corresponding one of the plurality of phrases.
The term "block" used in this specification means a basic unit for performing a specific encoding/decoding process.
Fig. 1 is a flowchart illustrating a HEIF image encoding method according to the present disclosure.
Referring to fig. 1, in step S101, the HEIF image is divided into a plurality of base blocks of the same size. According to an embodiment of the present disclosure, the HEIF image may be image data in a YUV data format, wherein the Y component is a Luminance (luminence or Luma) signal for describing gray scale values, and the U component and the V component are Chrominance (Chroma or Chroma) signals for describing colors and/or saturation, respectively, which are used to specify colors of pixels. The HEIF image may be in other data formats besides YUV data format, the present disclosure is not limited to the data format employed by the HEIF image, and HEIF images in any data format may be encoded and decoded using the techniques mentioned in the present disclosure.
According to an embodiment of the present disclosure, when an image is first divided, the image is divided into a plurality of base blocks of the same size, for example, a plurality of rectangular base blocks of the same size, each base block corresponding to a different position of the image, forming an initial image data area. Here, step S102 will be described in detail with reference to fig. 2.
As shown in fig. 2, assuming that the original HEIF image is composed of 512×512 pixels, if the size of the base block is selected to be 128×128 pixels, the original HEIF image can be divided into a 4×4 matrix area composed of 16 base blocks (i.e., B1, B2, … …, B15, and B16). In the above description, the width and the height of the base block are respectively the same, but the present disclosure is not limited thereto, and the width and the height of the base block may be different from each other.
By dividing the image into a plurality of basic blocks, a plurality of CPU cores can be used for encoding processing for each basic block to realize parallel encoding of the whole image, thereby improving the encoding processing speed.
Referring back to fig. 1, in step S102, a plurality of final blocks may be obtained by performing a dynamic blocking process on the plurality of base blocks. The dynamic blocking process may be various processes performed on the block, and may include, but is not limited to, at least one of a process of dynamically dividing the block, a process of combining the block with other blocks, and a process of keeping the block as it is.
Specifically, the step of dynamically partitioning the plurality of base blocks may include: the coding cost value of each basic block is calculated by pre-coding each basic block in the plurality of basic blocks, and the plurality of final blocks are obtained by dynamically partitioning each basic block based on the coding cost value of each basic block.
In this embodiment, the encoding cost of the block may be determined according to at least one performance index of the CPU occupancy, the compressed data block size, and the encoding time, but the disclosure is not limited thereto, and any other performance index capable of characterizing the encoding cost may be used to represent the cost of encoding the block. The CPU occupancy is used to measure CPU load performance and may be the CPU usage when encoding the block. The compressed data block size may be the calculated size of the compressed data generated after the block is encoded, that is, the size of the memory space occupied by the block after being encoded. The encoding time may be the time it takes to encode a block.
In the present embodiment, the encoding cost value may be calculated from a weighted sum of at least one of the CPU occupancy, the encoding time, and the compressed data block size of each block.
Specifically, for example, the total coding cost value of a plurality of blocks may be expressed as P, the plurality of blocks are respectively defined as blocks B1 to BN (where N is the number of blocks), and the cost values of the blocks B1 to BN are respectively expressed as P 1 、P 2 、……、P N The total coding cost P of a plurality of blocks of the image is all P 1 、P 2 、……、P N And (3) adding the sum. The CPU occupancy rates of blocks B1 through BN may be denoted as H, respectively 1 、H 2 、……、H N The encoding times of the blocks B1 to BN may be denoted as T, respectively 1 、T 2 、……、T N And the compressed data block sizes of the blocks B1 to BN may be denoted as M, respectively 1 、M 2 、……、M N . For example, the encoding cost value Pn of each block Bn may be calculated according to the following equation 1 from the weighted sum of the CPU occupancy, encoding time, and compressed data block size of each block.
P n =αH n +βT n +χM n (equation 1)
In equation 1, N may be a natural number from 1 to N, i.e., the number of the block; alpha, beta and χ may represent the factors of influence of CPU occupancy, encoding time and compressed data block size on the encoding cost value, respectively, and are values between 0 and 1, respectively, determined by empirical values. For example, when n is determined to be 1 in calculating the coding cost value of the first block, the coding cost value P of the first block 1 Is alpha H 1 +βT 1 +χM 1 Is a value of (2).
In the above example, the weighted sum of the CPU occupancy, the encoding time, and the compressed data block size of each block is employed to calculate the encoding cost value of each block, however, the present disclosure is not limited thereto, and one or both of the CPU occupancy, the encoding time, and the compressed data block size may be employed to calculate the encoding cost value of each block, and any other performance index capable of characterizing the encoding cost value may be employed by the present disclosure.
In one example, the step of dynamically partitioning each base block based on the coding cost value of the each base block to obtain the plurality of final blocks may include: and comparing the coding cost value of each basic block with a first threshold value, and when the basic blocks with the coding cost value larger than (or equal to) the first threshold value exist in the plurality of basic blocks, further dividing the basic blocks with the coding cost value larger than the first threshold value into new blocks according to at least one dynamic dividing method. The first threshold is determined based on the encoded cost values of the plurality of base blocks. For example, the first threshold may be j times an average value of coding cost values of the plurality of base blocks, where j is a positive number greater than 1. The splitting method of splitting the block may include, but is not limited to, two splitting, three splitting, four splitting, as shown in (a), (b), and (c) of fig. 3, however, the content shown in fig. 3 is only an example, and the present disclosure is not limited to the splitting method shown in fig. 3.
In addition, the dynamically partitioning the base block may further include: when the coding cost value of the divided new blocks is greater than (or equal to) the first threshold value, the new blocks with the coding cost value greater than the first threshold value can be further divided into new blocks according to at least one dynamic dividing method. The above dynamic partitioning method can be repeatedly performed according to the coding cost value of the new block.
The step of dynamically partitioning each base block based on the coding cost value of each base block to obtain the plurality of final blocks may include determining a final image partitioning scheme based on the coding cost value of a new block of each dynamic partitioning method. In particular, a variety of dynamic partitioning methods may be performed on a plurality of base blocks. For each dynamic segmentation method, the coding cost value of each new block can be determined, the variance of the coding cost value of each new block and all base blocks which are not further segmented is calculated, and the dynamic segmentation method corresponding to the smallest variance in the at least one dynamic segmentation method is determined as the optimal dynamic segmentation method in the at least one dynamic segmentation method.
In this example, the step of determining the coding cost value of the new block may include: for each dynamic partitioning method, the coding cost value of the partitioned new block may be determined by re-precoding the partitioned new block.
In another example, the step of dynamically partitioning the each base block to obtain the plurality of final blocks based on the coding cost value of the each base block may include: and comparing the coding cost value of each basic block with a second threshold value, and merging the adjacent basic blocks with the coding cost value smaller than the second threshold value into a new block according to at least one dynamic merging method when the adjacent basic blocks with the coding cost value smaller than (or equal to) the second threshold value exist in the plurality of basic blocks. For example, when there are two neighboring base blocks of which the coding cost value is less than (or equal to or less than) the second threshold value among the plurality of base blocks, the two neighboring base blocks are merged into a new block. The second threshold is determined based on the encoded cost values of the plurality of base blocks. When there are neighboring three base blocks B1, B2, and B5, each of which has a coding cost value less than (or equal to) the second threshold value, as shown in fig. 2, among the plurality of base blocks, the neighboring two base blocks B1 and B2 may be merged into a new block, or the neighboring two base blocks B1 and B5 may be merged into a new block. In addition, when there are neighboring three base blocks B1, B2, and B3, each of which has a coding cost value less than (or equal to or less than) the second threshold value, as shown in fig. 2, the neighboring two base blocks B1 and B2 may be combined into a new block, the neighboring two base blocks B2 and B3 may be combined into a new block, and the neighboring three base blocks B1, B2, and B3 may also be combined into a new block. For example, the second threshold may be k times an average of the coding cost values of the plurality of base blocks, where k is a positive number less than 1.
In addition, the dynamically partitioning the base block may further include: and when the coding cost value of the combined new blocks is smaller than (or equal to or smaller than) the second threshold value, combining the new blocks with the coding cost value smaller than the second threshold value into the new blocks according to at least one combining method. The above merging method may be repeatedly performed according to the coding cost value of the new block.
The step of dynamically partitioning each base block to obtain the plurality of final blocks based on the coding cost value of each base block may include determining a final image partitioning scheme based on the coding cost value of a new block of each merging method. Specifically, a plurality of merging methods may be performed on a plurality of base blocks. Determining the coding cost value of each new block for each merging method; calculating the variance of the coding cost value of each new block and all the uncombined base blocks; the combining method corresponding to the smallest variance is selected from the at least one combining method to determine the best combining method of the at least one combining method.
In this example, the step of determining the coding cost value of the new block may include: for each merging method, the coding cost values of the new blocks of the adjacent basic blocks after merging are obtained by adding the coding cost values of the adjacent basic blocks before merging.
In another example, the encoded cost value of each base block is compared to a first threshold and a second threshold, wherein the first threshold is greater than the second threshold. When a base block with the coding cost value larger than (or equal to) a first threshold value exists in the plurality of base blocks, the base block with the coding cost value larger than (or equal to) the first threshold value is further divided into new blocks according to at least one dynamic dividing method, and when an adjacent base block with the coding cost value smaller than (or equal to) a second threshold value exists in the plurality of base blocks, the adjacent base blocks with the coding cost value smaller than (or equal to) the second threshold value are combined into the new blocks according to at least one combining method. The first threshold and the second threshold are determined based on the encoded cost values of the plurality of base blocks. For example, the first threshold may be j times the average value of the coding cost values of the plurality of base blocks, where j is a positive number greater than 1, and the second threshold may be k times the average value of the coding cost values of the plurality of base blocks, where k is a positive number less than 1. The partitioning method of partitioning a block may include, but is not limited to, two-split, three-split, four-split, as described above with reference to fig. 3.
In addition, the dynamically partitioning the base block may further include: when the coding cost value of the divided new blocks is larger than (or equal to) the first threshold value, the new blocks with the coding cost value larger than the first threshold value can be further divided into new blocks according to at least one dynamic dividing method, and when the coding cost value of the combined new blocks is smaller than (or equal to) the second threshold value, the new blocks with the coding cost value smaller than the second threshold value can be combined into the new blocks according to at least one dynamic combining method. The above segmentation and merging method may be repeatedly performed according to the coding cost value of the new block.
The step of dynamically partitioning each base block based on the coding cost value of each base block to obtain the plurality of final blocks may include determining a final image blocking manner based on the coding cost value of a new block of a combined scheme of each dynamic partitioning method and combining method. In particular, various combinations of the dynamic partitioning method and the merging method may be performed on a plurality of base blocks. For each combination scheme, determining the coding cost value of each new block, calculating the variance of the coding cost value of each new block and all the base blocks which are not combined or further divided, and selecting the combination scheme corresponding to the smallest variance from all the combination schemes to determine the optimal dynamic division method in the at least one dynamic division method and the optimal combination method in the at least one combination method, thereby obtaining the optimal combination scheme of the dynamic division method and the combination method.
In this example, the step of determining the coding cost value of the new block may include: for each merging method, the coding cost values of the adjacent basic blocks before merging are added to obtain the coding cost values of the new blocks of the adjacent basic blocks after merging; for each dynamic segmentation method, the coding cost value of the segmented new block is determined by re-precoding the segmented new block.
Fig. 4 is a diagram illustrating an example of a tile of a HEIF image resulting after being dynamically blocked in accordance with the present disclosure.
In fig. 4, the illustrated plurality of blocks C1 to C14 may be a plurality of blocks dynamically partitioned under a finally determined combination scheme consisting of a dynamic partitioning method and a merging method. In fig. 4, the blocks C1, C3, C9, C10, C11 and C14 are blocks which are not combined and not further divided, and may correspond to the base block B1, the base block B3, the base block B9, the base block B10, the base block B11 and the base block B14, respectively; block C2, block C4, block 12 and block 13 are new blocks that are merged, wherein block C2 corresponds to basic block B2 and basic block B3, block C4 corresponds to basic block B5 and basic block B9, block C12 corresponds to basic block B8 and basic block B12, and block C13 corresponds to basic block B13, basic block B14 and basic block B15; the block C5, the block C6, the block C7, and the block C8 are new blocks that are further divided, and four blocks C5, C6, C7, and C8 correspond to the base block B6. The HEIF image blocking approach shown in fig. 4 is merely an example.
In addition, when a plurality of final blocks are obtained, for a final block generated by merging, block information of a base block used for merging to generate the final block may be determined as sub-block information, and sub-block information of the base block used for merging to generate the final block may be collectively recorded as block information of the final block without repeatedly calculating the final block (i.e., new block) generated by merging. For example, the block information of the base block B2 and the base block B3 may be recorded together as the block information of the block C2, specifically, the positions of the base block B2 and the base block B3 may be directly recorded as the positions of the block C2 in a packing manner, the sizes of the base block B2 and the base block B3 may be directly recorded as the sizes of the block C2 in a packing manner, and the sum of the coding cost values of the base block B2 and the base block B3 may be recorded as the coding cost value of the block C2.
For the divided final blocks, it is necessary to recalculate and record block information of the final blocks generated by the division. The block information may include, but is not limited to, the location, size, encoding cost value, and number of blocks.
Referring back to fig. 1, in step S103, the plurality of final blocks may be encoded in parallel to obtain encoded data of the HEIF image.
When a plurality of final blocks (for example, a plurality of final blocks as shown in fig. 4) of the HEIF image are obtained, the plurality of final blocks may be checked for parallel encoding using a plurality of CPUs, thereby obtaining encoded data of the HEIF image including image base information of the HEIF image, block information of the plurality of final blocks, and encoding information of the plurality of final blocks. The image basic information may include, for example, resolution of an image, file format of an image, and the like. The block information may include, but is not limited to, a position of the plurality of final blocks, a size of the plurality of final blocks, a coding cost value of the plurality of final blocks, and a number of the plurality of final blocks. If at least one of the final blocks is a final block generated by base block merging, the block information of the final block is composed of block information of the base block used for merging to generate the final block. The encoding information may refer to an encoding result generated by encoding the block.
Here, a process of encoding the plurality of final blocks C1 to CX (where X is a positive integer) in parallel will be described with reference to fig. 5. Fig. 5 is a diagram illustrating a process of encoding a plurality of final blocks illustrated in fig. 4 using a plurality of CPUs according to the present disclosure.
Referring to fig. 5, when the number of the plurality of CPU cores is greater than or equal to the number X of the final blocks C1 to CX (where X is a positive integer), each block is allocated to one CPU core for encoding processing. As shown in fig. 5, final blocks C1 to Cn (X is n in fig. 5) to be processed of the HEIF image are respectively allocated to the CPUs 1 to CPU n, and the plurality of final blocks C1 to Cn are encoded by the plurality of CPUs, resulting in a plurality of encoded information R1 to Rn of the plurality of final blocks.
When the number of the plurality of CPU cores is smaller than the number X of the final blocks C1 to CX (where X is a positive integer), the final block (not shown) to be encoded by each CPU core is dynamically allocated based on the number of CPU cores and the encoding cost value of each block.
In particular, the step of dynamically allocating a final tile to be encoded by each CPU core based on the number of CPU cores and the encoded cost value of each tile may include: dividing the plurality of final blocks into a number of groups equal to the number of CPU cores according to at least one grouping method; calculating the variance of the coding cost value of the group generated by each grouping mode according to the coding cost value of each final block; and selecting a grouping mode corresponding to the smallest variance from the at least one grouping mode, and dynamically distributing the final block to the CPU core according to the grouping mode.
For example, when there are 4 final blocks (D1 to D4) and 3 CPU cores (CPU 1 to CPU 3), the 4 final blocks may be divided into 3 groups according to 6 combination methods, then the variance (e.g., S1 to S6) of the coding cost value of the group generated by each grouping method is calculated according to the coding cost value of each final block, then the grouping method corresponding to the smallest variance among the variances S1 to S6 is selected from the 6 grouping methods, and finally the final blocks are allocated to the 3 CPU cores according to the grouping method.
From the block information and the encoding information obtained as described above, encoded data of the HEIF image including the image base information, the block information, and the encoding information can be obtained.
Fig. 6 is a flowchart illustrating a HEIF image decoding method according to the present disclosure.
Referring to fig. 6, in step S201, encoded data of a HEIF image may be obtained. Specifically, encoded data of the HEIF image may be received and read into memory for processing.
In step S202, the image base information, the block information of the plurality of blocks, and the encoding information of the plurality of blocks may be parsed from the encoded data. The block information of the plurality of blocks comprises positions of the plurality of blocks, sizes of the plurality of blocks, cost values of the plurality of blocks and the number of the plurality of blocks. Specifically, the image basic information, the block information of a plurality of blocks, and the encoding information of the plurality of blocks in the encoded data are analyzed according to the HEIF format. The image basic information may include resolution of an image, file format of an image, and the like.
In step S203, the encoded information of each block may be decoded in parallel to obtain a plurality of blocks. Specifically, a plurality of blocks may be obtained by parallel decoding of encoded data using a plurality of CPU cores. The step of decoding the encoded information of the plurality of blocks in parallel to obtain a plurality of blocks may include: the CPU cores for which the encoding information of each of the plurality of blocks is dynamically allocated are determined based on the number of CPU cores. This will be described in detail with reference to fig. 7 and 8.
Fig. 7 and 8 are diagrams illustrating a process of checking a plurality of blocks for decoding using a plurality of CPUs according to the present disclosure.
Specifically, the step of determining the CPU core to which the encoding information of each of the plurality of blocks is dynamically allocated based on the number of CPU cores may include: when the number n of CPU cores is greater than or equal to the number X of blocks (X is a positive integer), one CPU core is allocated to process encoded information of one block. Referring to fig. 7, when the number n of the plurality of CPU cores is equal to the number n of the plurality of blocks (in fig. 7, X is n), the encoded information of one block is allocated to one CPU core for decoding processing. As shown in fig. 7, the encoding information R1 to Rn to be processed of the HEIF image is respectively allocated to the CPUs 1 to CPU n, and a plurality of blocks are decoded in parallel by the plurality of CPUs, resulting in a plurality of blocks C1 to Cn.
In another example, when the number of CPU cores is smaller than the number X of the plurality of blocks (X is a positive integer), the encoding information of the block to be processed by each CPU core is dynamically allocated based on the number of CPU cores and the encoding cost value of each block. Specifically, when the number of the plurality of CPU cores is smaller than the number X of the plurality of tiles, the step of dynamically allocating the encoded information of the tile to be processed by each CPU core based on the number of the CPU cores and the encoded cost value of each tile may include: the method comprises the steps of dividing the coding information of a plurality of blocks into a plurality of groups equal to the number of CPU cores according to at least one grouping method, calculating the variance of the coding cost value of the group generated by each grouping mode according to the coding cost value of each block, selecting the grouping mode corresponding to the smallest variance from the at least one grouping mode, and dynamically distributing the coding information of the blocks to the CPU cores according to the grouping mode.
Referring to fig. 8, when the number of the plurality of CPU cores is 4 and the number of blocks is greater than 4 (e.g., 7), the encoding information of 7 blocks may be divided into 4 groups in at least one grouping manner, the encoding cost value of each group is calculated by adding the encoding cost values of all the blocks within one group, the variance of the encoding cost value of the group of each grouping manner is calculated, and the grouping manner with the smallest variance is selected from the 7 grouping manners as the grouping manner in which parallel decoding is finally performed, as shown in fig. 8, the final grouping manners are that R1 and R4 are allocated to CPU1, R2 and R5 are allocated to CPU2, R3 and R6 are allocated to CPU3, and R7 is allocated to CPU4.
Referring back to fig. 6, in step S204, the decoded blocks are combined based on the image base information and the block information of the plurality of blocks. Specifically, the plurality of blocks decoded in step S203 are combined into the entire image based on the image basic information and the block information parsed from the encoded data, for example, the block C1, the block C2, the block C3 … …, the block Cn are combined into the entire image as shown in fig. 7, thereby completing the decoding of the HEIF image.
Hereinafter, a HEIF image encoding apparatus and a HEIF image decoding apparatus according to the present disclosure will be described.
Fig. 9 is a block diagram showing the HEIF image encoding apparatus 100 according to the present disclosure.
Referring to fig. 9, the heif image encoding apparatus 100 may include a segmentation unit 101 and an encoding unit 102. Specifically, the HEIF image encoding apparatus 100 may be used to perform image encoding processing on the HEIF image. The segmentation unit 101 may be configured to segment the HEIF image into a plurality of base blocks of the same size, and obtain a plurality of final blocks by dynamically blocking the plurality of base blocks. The encoding unit 102 may be configured to encode the plurality of final blocks in parallel to obtain encoded data of the HEIF image.
Specifically, according to an embodiment of the present disclosure, the encoded data may include image basic information, block information of the plurality of final blocks, and encoding information of the plurality of final blocks, wherein the block information of the plurality of final blocks includes positions of the plurality of final blocks, sizes of the plurality of final blocks, cost values of the plurality of final blocks, and the number of final blocks.
In one embodiment of the present disclosure, the partitioning unit 101 may be configured to obtain a plurality of final blocks by dynamically partitioning the plurality of base blocks by: the coding cost value of each basic block is determined by pre-coding each basic block in the plurality of basic blocks, and the plurality of final blocks are obtained by dynamically partitioning each basic block based on the coding cost value of each basic block.
In this embodiment, the partitioning unit 101 may be configured to obtain the plurality of final blocks by dynamically partitioning the each base block based on the coding cost value of the each base block by: and comparing the coding cost value of each basic block with a first threshold value, and when the basic blocks with the coding cost value larger than the first threshold value exist in the plurality of basic blocks, further dividing the basic blocks with the coding cost value larger than the first threshold value into new blocks according to at least one dynamic dividing method.
In this embodiment, the partitioning unit 101 may be configured to obtain the plurality of final blocks by dynamically partitioning the each base block based on the coding cost value of the each base block by: for each dynamic segmentation method, determining the coding cost value of each new block, calculating the variance of the coding cost value of each new block and all base blocks which are not further segmented, and determining the dynamic segmentation method corresponding to the smallest variance in the at least one dynamic segmentation method as the optimal dynamic segmentation method in the at least one dynamic segmentation method.
In another embodiment, the partitioning unit 101 may be configured to obtain the plurality of final blocks by dynamically partitioning the each base block based on the coding cost value of the each base block by: comparing the coding cost value of each basic block with a second threshold value, and merging the adjacent basic blocks with the coding cost value smaller than the second threshold value into a new block according to at least one merging method when the adjacent basic blocks with the coding cost value smaller than the second threshold value exist in the plurality of basic blocks.
In this embodiment, the partitioning unit 101 may be further configured to obtain the plurality of final blocks by dynamically partitioning the each base block based on the coding cost value of the each base block by: for each merging method, determining the coding cost value of each new block, calculating the variance of the coding cost value of each new block and all the non-merged base blocks, and determining the merging method corresponding to the smallest variance in the at least one merging method as the optimal merging method in the at least one merging method.
In this embodiment, the partitioning unit 101 may be configured to obtain the plurality of final blocks by dynamically partitioning the each base block based on the coding cost value of the each base block by: comparing the coding cost value of each basic block with a first threshold value and a second threshold value, wherein the first threshold value is larger than the second threshold value, when basic blocks with the coding cost value larger than the first threshold value exist in the plurality of basic blocks, further dividing the basic blocks with the coding cost value larger than the first threshold value into new blocks according to at least one dynamic dividing method, and when adjacent basic blocks with the coding cost value smaller than the second threshold value exist in the plurality of basic blocks, merging the adjacent basic blocks with the coding cost value smaller than the second threshold value into the new blocks according to at least one merging method.
In this embodiment, the partitioning unit 101 may be configured to obtain the plurality of final blocks by dynamically partitioning the each base block based on the coding cost value of the each base block by: for each combination scheme of the dynamic segmentation method and the merging method, determining the coding cost value of each new block, calculating the coding cost value of each new block and all the base blocks which are not merged or further segmented, and selecting the combination scheme corresponding to the smallest variance from all the combination schemes to determine the optimal dynamic segmentation method in the at least one dynamic segmentation method and the optimal merging method in the at least one merging method.
In this embodiment, the partitioning unit 101 may be configured to determine the coding cost value of each new block by: for each merging method, the coding cost values of the new blocks after merging of the adjacent basic blocks are obtained by adding the coding cost values of the adjacent basic blocks before merging, and for each dynamic dividing method, the coding cost values of the new blocks after dividing are determined by re-carrying out pre-coding on the new blocks after dividing.
In the various embodiments described above, the encoded cost value may be a weighted sum of three: the CPU occupancy of the block at the time of encoding, the compressed data block size generated by encoding the block, and the encoding time spent encoding the block.
Furthermore, the partitioning unit 101 may be configured to obtain the plurality of final blocks by dynamically partitioning the each base block based on the coding cost value of the each base block by: for the final block generated by merging, block information of a base block used for merging the final block is determined as sub-block information, and the sub-block information of the base block used for merging the final block is recorded together as block information of a corresponding final block.
In this disclosure, the encoding unit 102 may be configured to encode the plurality of final blocks in parallel by: when the number of CPU cores is greater than or equal to the number of final blocks, one CPU core is used for encoding one final block; and dynamically allocating a final block to be encoded by each CPU core based on the number of CPU cores and the encoding cost value of each final block when the number of CPU cores is less than the number of final blocks. Since the encoding method has been described in detail above with reference to fig. 1 to 5, a detailed description thereof will be omitted.
Fig. 10 is a block diagram illustrating a HEIF image decoding apparatus 200 according to the present disclosure.
Referring to fig. 10, the heif image decoding apparatus 200 may include an acquisition unit 201, a parsing unit 202, and a decoding unit 203. Specifically, the HEIF image decoding apparatus 200 may be used to perform image decoding processing on the HEIF image. The acquisition unit 201 may be configured to acquire encoded data of the HEIF image. The parsing unit 202 may be configured to parse image basic information, block information of a plurality of blocks, and encoding information of the plurality of blocks from the encoded data. The decoding unit 203 may be configured to decode the encoded information of the plurality of blocks in parallel to obtain a plurality of blocks, and combine the decoded plurality of blocks based on the image base information and the block information of the plurality of blocks.
Specifically, according to embodiments of the present disclosure, the block information of the plurality of blocks may include positions of the plurality of blocks, sizes of the plurality of blocks, cost values of the plurality of blocks, and the number of the plurality of blocks.
According to an embodiment of the present disclosure, the decoding unit 203 may be configured to obtain a plurality of blocks by decoding the encoded information of the plurality of blocks in parallel by: and determining the CPU cores of which the coding information of each block in the plurality of blocks is dynamically allocated based on the number of the CPU cores.
According to an embodiment of the present disclosure, the decoding unit 203 may be further configured to determine the CPU core to which the encoded information of each of the plurality of blocks is dynamically allocated based on the number of CPU cores by: when the number of CPU cores is greater than or equal to the number of the plurality of blocks, one CPU core is allocated to process the encoded information of one block, and when the number of CPU cores is less than the number of the plurality of blocks, the encoded information of the block to be processed by each CPU core is dynamically allocated based on the number of CPU cores and the encoded cost value of each block.
According to an embodiment of the present disclosure, the decoding unit 203 may be configured to dynamically allocate the encoding information of the blocks to be processed by each CPU core based on the number of CPU cores and the encoding cost value of each block by: dividing the coding information of the blocks into a plurality of groups equal to the number of the CPU cores according to at least one grouping mode, calculating the variance of the coding cost value of the group generated by each grouping mode according to the coding cost value of each block, selecting the grouping mode corresponding to the smallest variance from the at least one grouping mode, and dynamically distributing the coding information of the blocks to the CPU cores according to the grouping mode. Since this has been described in detail above with reference to fig. 6 and 7, a detailed description thereof will be omitted herein.
Another aspect of the present disclosure is to provide an electronic device that may include a memory and a processor; the memory stores a computer program; the processor may perform the HEIF image encoding method or the HEIF image decoding method when running the computer program.
Further, another aspect of the present disclosure is to provide a computer-readable storage medium including a program stored therein, which when executed by a processor, can implement the above-described HEIF image encoding method or HEIF image decoding method.
While the present application has been shown and described with reference to various exemplary embodiments, it is not limited to the particular embodiments or drawings, and it will be understood by those of ordinary skill in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present application as defined by the following claims and their equivalents.

Claims (19)

1. A HEIF image coding method comprising:
dividing the HEIF image into a plurality of basic blocks with the same size;
obtaining a plurality of final blocks by dynamically partitioning the plurality of base blocks;
the plurality of final blocks are encoded in parallel to obtain encoded data of the HEIF image,
Wherein the step of obtaining a plurality of final blocks by dynamically partitioning the plurality of base blocks comprises:
determining a coding cost value of each base block by pre-coding each base block of the plurality of base blocks;
performing dynamic partitioning processing on the plurality of base blocks;
calculating the variance of the coding cost value of the new block which is dynamically partitioned each time and the basic block which is not dynamically partitioned;
a plurality of blocks having the smallest variance is determined as the plurality of final blocks.
2. The HEIF image coding method of claim 1, wherein the coded data includes image base information, block information of the plurality of final blocks, and coding information of the plurality of final blocks, wherein the block information of the plurality of final blocks includes positions of the plurality of final blocks, sizes of the plurality of final blocks, cost values of the plurality of final blocks, number of the plurality of final blocks.
3. The HEIF image coding method of claim 1 wherein the step of dynamically blocking each base block based on the coding cost value of the each base block to obtain the plurality of final blocks includes:
Comparing the coding cost value of each basic block with a first threshold;
when the base blocks with the coding cost value larger than the first threshold value exist in the plurality of base blocks, the base blocks with the coding cost value larger than the first threshold value are further segmented into new blocks according to at least one dynamic segmentation method.
4. The HEIF image coding method of claim 3 wherein the step of dynamically blocking each base block based on its coding cost value to obtain the plurality of final blocks further comprises:
determining the coding cost value of each new block according to each dynamic segmentation method;
calculating the variance of the coding cost value of each new block and all the basic blocks which are not further divided;
and determining a dynamic segmentation method corresponding to the smallest variance among the at least one dynamic segmentation method as the optimal dynamic segmentation method among the at least one dynamic segmentation method.
5. The HEIF image coding method of claim 4 wherein the step of determining the coding cost value of each new block includes:
the coding cost value of the new segmented block is determined by re-precoding the new segmented block.
6. The HEIF image coding method of claim 1 wherein the step of dynamically blocking each base block based on the coding cost value of the each base block to obtain the plurality of final blocks includes:
comparing the coding cost value of each basic block with a second threshold;
and when adjacent basic blocks with the coding cost value smaller than a second threshold value exist in the plurality of basic blocks, merging the adjacent basic blocks with the coding cost value smaller than the second threshold value into a new block according to at least one merging method.
7. The HEIF image coding method of claim 6 wherein the step of dynamically blocking each base block based on its coding cost value to obtain the plurality of final blocks further comprises:
determining the coding cost value of each new block for each merging method;
calculating the variance of the coding cost value of each new block and all the uncombined base blocks;
and determining a merging method corresponding to the smallest variance among the at least one merging method as the best merging method among the at least one merging method.
8. The HEIF image coding method of claim 7 wherein the step of determining the coding cost value of each new block includes:
and adding the coding cost values of the adjacent basic blocks before merging to obtain the coding cost value of the new block of the adjacent basic blocks after merging.
9. The HEIF image coding method of claim 7 wherein the step of dynamically blocking each base block based on its coding cost value to obtain the plurality of final blocks further comprises:
for the final block generated by merging, block information of a base block used for merging the final block is determined as sub-block information, and the sub-block information of the base block used for merging the final block is recorded together as block information of a corresponding final block.
10. The HEIF image coding method of any one of claims 1 to 9, wherein the coding cost value is a weighted sum of at least one of the following three: the CPU occupancy of the block at the time of encoding, the compressed data block size generated by encoding the block, and the encoding time spent encoding the block.
11. The HEIF image coding method of claim 1 wherein the step of coding the plurality of final blocks in parallel includes:
When the number of CPU cores is greater than or equal to the number of final blocks, one CPU core is used for encoding one final block; and
when the number of CPU cores is smaller than the number of final blocks, the final blocks to be encoded by each CPU core are dynamically allocated based on the number of CPU cores and the encoding cost value of each final block.
12. A HEIF image decoding method that decodes encoded data of a HEIF image, wherein the encoded data of the HEIF image is encoded using the HEIF image encoding method of claim 1, the HEIF image decoding method comprising:
obtaining encoded data of the HEIF image;
parsing image basic information, block information of a plurality of blocks, and encoding information of the plurality of blocks from encoded data;
decoding the encoded information of the plurality of blocks in parallel to obtain a plurality of blocks;
and merging the decoded blocks based on the image basic information and the block information of the blocks.
13. The HEIF image decoding method of claim 12 wherein the block information of the plurality of blocks includes a position of the plurality of blocks, a size of the plurality of blocks, a cost value of the plurality of blocks, a number of the plurality of blocks.
14. The HEIF image decoding method according to claim 12, wherein decoding the encoded information of the plurality of blocks in parallel to obtain a plurality of blocks includes determining a CPU core to which the encoded information of each of the plurality of blocks is dynamically allocated based on the number of CPU cores,
when the number of the CPU cores is greater than or equal to the number of the blocks, one CPU core is allocated to process the coding information of one block; and
when the number of CPU cores is smaller than the number of the plurality of blocks, the encoding information of the block to be processed by each CPU core is dynamically allocated based on the number of CPU cores and the encoding cost value of each block.
15. The HEIF image decoding method of claim 14 wherein the step of dynamically allocating the encoded information of the block to be processed by each CPU core based on the number of CPU cores and the encoded cost value of said each block includes:
dividing the coding information of the blocks into a plurality of groups equal to the number of CPU cores according to at least one grouping mode;
calculating the variance of the coding cost value of the group generated by each grouping mode according to the coding cost value of each block;
And selecting a grouping mode corresponding to the smallest variance from the at least one grouping mode, and dynamically distributing the coding information of the block to the CPU core according to the grouping mode.
16. A HEIF image coding apparatus comprising:
a dividing unit configured to divide the HEIF image into a plurality of base blocks of the same size, and obtain a plurality of final blocks by performing dynamic block processing on the plurality of base blocks;
an encoding unit configured to encode the plurality of final blocks in parallel to obtain encoded data of the HEIF image,
wherein the partitioning unit is configured to obtain a plurality of final blocks by dynamically partitioning the plurality of base blocks by:
determining a coding cost value of each base block by pre-coding each base block of the plurality of base blocks;
performing dynamic partitioning processing on the plurality of base blocks;
calculating the variance of the coding cost value of the new block which is dynamically partitioned each time and the basic block which is not dynamically partitioned;
a plurality of blocks having the smallest variance is determined as the plurality of final blocks.
17. A HEIF image decoding apparatus for decoding encoded data of a HEIF image, wherein the encoded data of the HEIF image is encoded using the HEIF image encoding method of claim 1, the HEIF image decoding apparatus comprising:
an acquisition unit configured to obtain encoded data of the HEIF image;
a parsing unit configured to parse image basic information, block information of a plurality of blocks, and encoding information of the plurality of blocks from encoded data;
and a decoding unit configured to decode the encoded information of the plurality of blocks in parallel to obtain the plurality of blocks, and to combine the decoded plurality of blocks based on the image base information and the block information of the plurality of blocks.
18. An electronic device, wherein the electronic device comprises a memory and a processor;
the memory stores a computer program;
the processor, when running the computer program, performs the HEIF image encoding method of any one of claims 1 to 11 or the HEIF image decoding method of any one of claims 12 to 15.
19. A computer readable storage medium storing a program which, when executed by a processor, implements the HEIF image encoding method of any one of claims 1 to 11 or the HEIF image decoding method of any one of claims 12 to 15.
CN202110667390.8A 2021-06-16 2021-06-16 HEIF image encoding method, HEIF image decoding method, HEIF image encoding device, HEIF image decoding device, HEIF image encoding program, HEIF image decoding program, and HEIF image decoding program Active CN113422955B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110667390.8A CN113422955B (en) 2021-06-16 2021-06-16 HEIF image encoding method, HEIF image decoding method, HEIF image encoding device, HEIF image decoding device, HEIF image encoding program, HEIF image decoding program, and HEIF image decoding program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110667390.8A CN113422955B (en) 2021-06-16 2021-06-16 HEIF image encoding method, HEIF image decoding method, HEIF image encoding device, HEIF image decoding device, HEIF image encoding program, HEIF image decoding program, and HEIF image decoding program

Publications (2)

Publication Number Publication Date
CN113422955A CN113422955A (en) 2021-09-21
CN113422955B true CN113422955B (en) 2023-04-21

Family

ID=77788767

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110667390.8A Active CN113422955B (en) 2021-06-16 2021-06-16 HEIF image encoding method, HEIF image decoding method, HEIF image encoding device, HEIF image decoding device, HEIF image encoding program, HEIF image decoding program, and HEIF image decoding program

Country Status (1)

Country Link
CN (1) CN113422955B (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101098473B (en) * 2006-06-30 2012-05-09 联想(北京)有限公司 Picture coding method and apparatus
JP7246855B2 (en) * 2018-02-16 2023-03-28 キヤノン株式会社 Imaging device, recording device and display control device
CN109886861B (en) * 2019-01-08 2023-04-11 北京城市网邻信息技术有限公司 High-efficiency image file format HEIF image loading method and device
JP7442302B2 (en) * 2019-11-22 2024-03-04 キヤノン株式会社 Data processing device, its control method, and program
CN112150567B (en) * 2020-11-06 2023-07-18 北京深维科技有限公司 HEIF image coding method and related equipment

Also Published As

Publication number Publication date
CN113422955A (en) 2021-09-21

Similar Documents

Publication Publication Date Title
US10939112B2 (en) Method and device for video coding and decoding
US10986351B2 (en) Method and device for decoding image by using partition unit including additional region
US10341651B2 (en) Image coding method, decoding method, coding device and decoding device
JP6149076B2 (en) Method and apparatus for palette index signaling for image and video encoding
CN107886560B (en) Animation resource processing method and device
US9143793B2 (en) Video processing system, computer program product and method for managing a transfer of information between a memory unit and a decoder
US20230051471A1 (en) Method and device for decoding image by using partition unit including additional region
US10200716B2 (en) Parallel intra-prediction encoding/decoding process utilizing PIPCM and/or PIDC for selected sections
US7433526B2 (en) Method for compressing images and image sequences through adaptive partitioning
CN112055219B (en) String matching prediction method and device and computer readable storage medium
US20220014777A1 (en) Image coding and decoding methods, image processing device and computer storage medium
US20230262221A1 (en) Method and device for video coding and decoding
EP3651461A1 (en) Iimage encoding device, image decoding device, and data structure
CN114365493A (en) Parallel histogram computation applied to palette table derivation
US20220116613A1 (en) Video encoding method and device, and video decoding method and device
CN108600755B (en) Image frame coding method and device
CN111654696B (en) Intra-frame multi-reference-line prediction method and device, storage medium and terminal
CN113422955B (en) HEIF image encoding method, HEIF image decoding method, HEIF image encoding device, HEIF image decoding device, HEIF image encoding program, HEIF image decoding program, and HEIF image decoding program
CN113365080B (en) Encoding and decoding method, device and storage medium for string coding technology
CN112437307B (en) Video coding method, video coding device, electronic equipment and video coding medium
US20140286583A1 (en) Image encoder and image processing system
CN105828079B (en) Image processing method and device
CN116074500A (en) Image decoding method, encoding method and device
Nystad et al. Flexible texture compression using bounded integer sequence encoding
JP2019149672A (en) Image processing apparatus, image processing method, and image processing program

Legal Events

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