WO2022077489A1 - 数据处理方法、设备和存储介质 - Google Patents

数据处理方法、设备和存储介质 Download PDF

Info

Publication number
WO2022077489A1
WO2022077489A1 PCT/CN2020/121666 CN2020121666W WO2022077489A1 WO 2022077489 A1 WO2022077489 A1 WO 2022077489A1 CN 2020121666 W CN2020121666 W CN 2020121666W WO 2022077489 A1 WO2022077489 A1 WO 2022077489A1
Authority
WO
WIPO (PCT)
Prior art keywords
image data
layer image
base layer
enhancement layer
data
Prior art date
Application number
PCT/CN2020/121666
Other languages
English (en)
French (fr)
Inventor
李文广
赵文军
周长波
Original Assignee
深圳市大疆创新科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to PCT/CN2020/121666 priority Critical patent/WO2022077489A1/zh
Publication of WO2022077489A1 publication Critical patent/WO2022077489A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • H04N19/436Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation using parallelised computational arrangements

Definitions

  • the present invention relates to the field of data processing, in particular to a data processing, equipment and storage medium.
  • the present invention provides a data processing, device and storage medium, which can be used to make high dynamic range images compatible with images in mainstream image formats.
  • a first aspect of the present invention is to provide a data processing method, comprising: acquiring original image data, performing nonlinear image transformation processing on the original image data to obtain image data to be processed; Extracting a preset amount of base layer image data from the original image data; encoding the base layer image data based on a first preset encoding rule to obtain a base layer image code stream; based on the to-be-processed image data and the base layer image data calculating residuals from layer image data, and determining enhancement layer image data based on the residuals; encoding the enhancement layer image data based on a second preset coding rule to obtain an enhancement layer image code stream; Write a preset field in the base layer image code stream to generate a target image code stream.
  • a second aspect of the present invention is to provide a data processing method, comprising: acquiring a target image code stream; and decoding the target image code stream based on a first preset decoding rule to obtain base layer image data.
  • the third aspect of the present invention is to provide an electronic device, a memory, a processor and an image acquisition device; the memory is used for storing a computer program; the image acquisition device is used to acquire original image data; the processor Invoke the computer program to realize the following steps: obtaining original image data, performing nonlinear image transformation processing on the original image data to obtain the image data to be processed; extracting pre-processing from the image data to be processed or the original image data Set the base layer image data of the data amount; encode the base layer image data based on the first preset coding rule to obtain a base layer image code stream; calculate the residual based on the to-be-processed image data and the base layer image data , determine enhancement layer image data based on the residual; encode the enhancement layer image data based on the second preset coding rule to obtain an enhancement layer image code stream; write the enhancement layer image code stream into the base layer The preset field in the image code stream to generate the target image code stream.
  • the fourth aspect of the present invention is to provide an electronic device, a memory, a processor and a communication component; the memory is used to store a computer program; the communication component is used to obtain a target image stream; the processor calls The computer program implements the following steps: decoding the target image code stream based on a first preset decoding rule to obtain base layer image data.
  • a fifth aspect of the present invention is to provide a computer-readable storage medium, the storage medium is a computer-readable storage medium, and program instructions are stored in the computer-readable storage medium, and the program instructions are used in the first aspect and The method described in the second aspect.
  • the embodiment of the present application provides a data processing method, which obtains original image data, performs nonlinear image transformation processing on the original image data to obtain to-be-processed image data; extracts from the to-be-processed image data or the original image data Base layer image data with a preset data amount; encode the base layer image data based on the first preset encoding rule to obtain a base layer image code stream; calculate residual image data based on the to-be-processed image data and the base layer image data difference, determine the enhancement layer image data based on the residual; encode the enhancement layer image data based on the second preset coding rule to obtain an enhancement layer image code stream; write the enhancement layer image code stream into the basic The preset field in the layer image code stream to generate the target image code stream.
  • the encoding of the image data to be processed is completed, and it is compatible with the image data code stream of the enhancement layer and the image data code of the base layer. flow.
  • the to-be-processed image data since the to-be-processed image data is obtained by performing nonlinear image transformation processing on the original image data, the to-be-processed image data may be HDR image data, and then the HDR image data may be finally encoded.
  • the base layer image data may belong to image data in a mainstream image format, such as image data such as JPEG.
  • the enhancement layer image code stream is written into the preset field in the base layer image code stream to generate the target image code stream, then the image code stream of the mainstream image format can be used as the carrier to encode the HDR image data, so that the HDR image data can be encoded according to different Requirements, that is, it can decode image data in mainstream image formats, and can also decode HDR image data.
  • the decoding end can decode all the information in the target image code stream, an image with a high dynamic range close to the image to be processed can be obtained. Since the image data to be processed is close to the original image information, it has a large post-editing space. Provide users with more creative space and freedom.
  • the to-be-processed image data ie, HDR image data
  • the to-be-processed image corresponding to the to-be-processed image data is visually closer to the base layer image than the original image.
  • Approaching the look and feel of the user when shooting is beneficial to maintaining a uniform and more consistent look and feel in image dissemination, facilitating the user's post-editing operations, and being more user-friendly.
  • the method, the corresponding device and the storage medium provided by the embodiments of the present application based on the above-mentioned data processing method may also have the above-mentioned corresponding technical effects.
  • FIG. 1 is a schematic flowchart of a data processing method according to an embodiment of the present invention.
  • FIG. 2 is a schematic diagram of a data processing method provided by an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of dividing into slices provided by an embodiment of the present invention.
  • FIG. 4 is a schematic diagram of slice division provided by an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of a scanning block provided by an embodiment of the present invention.
  • FIG. 6 is a schematic diagram of a scanning slice provided by an embodiment of the present invention.
  • FIG. 7 is a schematic diagram of an enhancement layer image code stream provided by an embodiment of the present invention.
  • FIG. 8 is a schematic diagram of header information of an enhancement layer image code stream provided by an embodiment of the present invention.
  • FIG. 9 is a schematic diagram of header information of an enhancement layer image code stream provided by an embodiment of the present invention.
  • FIG. 10 is a schematic flowchart of a data processing method provided by an embodiment of the present invention.
  • FIG. 11 is a schematic flowchart of a data processing method according to an embodiment of the present invention.
  • FIG. 12 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention.
  • FIG. 13 is a schematic structural diagram of a data processing device according to an embodiment of the present invention.
  • FIG. 14 is a schematic structural diagram of a data processing device according to an embodiment of the present invention.
  • 15 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
  • 16 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
  • FIG. 17 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
  • JPEG XT image compression standard can compress HDR images on the basis of being compatible with JPEG
  • this compression scheme is aimed at the transmission side, and the decoded image is in a linear space.
  • User-friendly for post-editing And because the images are all compressed using 8bit JPEG. The lack of data precision affects the space for post-editing of images.
  • the solutions proposed in the embodiments of the present application are provided.
  • Obtain the image data to be processed from the original image encode the image data of the base layer based on the first preset encoding rule, and encode the image data of the enhancement layer based on the second preset encoding rule, so as to maximize the accuracy of the image data to be processed. It is possible to retain the data to ensure the dynamic range and post-editing space of the image data to be processed, and then generate the final target image code stream according to the image code stream of the base layer and the image code stream of the enhancement layer, so as to achieve the purpose of compatibility.
  • FIG. 1 is a schematic flowchart of a data processing method provided by an embodiment of the present invention
  • the method 100 provided by an embodiment of the present application may be executed by an electronic device that may have an encoder, and the encoder may be provided in the electronic device, and the electronic device It can be a camera, a drone, a hand-held pan/tilt, a mobile phone, a tablet computer, etc., any electronic device with a camera and/or a camera function.
  • the method 100 includes the following steps:
  • the target image code stream can also be decoded.
  • the decoding process can be an inverse process of encoding the image data to be processed, which can be implemented by an electronic device with a decoder.
  • the decoder and the encoder can be installed in one electronic device at the same time, or can be paired and used independently in different electronic devices.
  • the original image data is high dynamic range image data.
  • the original image data includes linear image data or nonlinear image data.
  • the linear image data may be image data acquired by an image sensor.
  • the nonlinear image data may be high dynamic range image data generated based on multiple images, or may be image data acquired by an image sensor.
  • the original image data may refer to original image data collected from an image acquisition device in an electronic device, the original image data may be linear image data, and the image data may be linear HDR image data.
  • the image acquisition device may be a camera, a camera, etc., for example, the original image data may be acquired through a mobile phone, and the original image data may be 16-bit (bit) linear image data.
  • the image data to be processed may be acquired from the original image data, which may be non-linear image data, and the size may be 12 bits.
  • the acquisition methods can include the following methods:
  • the camera of the mobile phone captures an image of the external environment, and the image is 16-bit linear image data.
  • the encoder in the mobile phone obtains the image data, it can obtain 12-bit nonlinear image data through nonlinear image transformation, which can be used as the intermediate layer image data, and can be directly used as the image data to be processed.
  • the image data to be processed can be non-linear image data. Linear HDR image data.
  • image data to be processed may also be obtained by performing linear image transformation processing on the original image data, and the specific implementation process is similar to that described above, and will not be repeated here. Only for description: for example, linear image transformation processing (eg, linear cropping) of 16-bit original image data to 15-bit image data. This compresses the amount of data for subsequent image processing.
  • linear image transformation processing eg, linear cropping
  • the HDR image will be closer to the display device (ie, the display device) than the original image.
  • a displayable image supported by a display device of an electronic device that may have a decoder usually support images with lower bit depths, such as 8-bit images.
  • the actual data volume will not be reduced too much. In the nonlinear transformation, the details that are more sensitive to the human eye are retained, and the details that are not sensitive to people are more compressed.
  • the nonlinear 12bit HDR image will be closer to the 8bit image, while the linear 16bit original image will be less close to the 8bit image. Since the 12bitHDR image is closer to the 8bit image in terms of visual effect, the 12bitHDR image will be more friendly to the user's viewing, and the 12bitHDR image still retains the information of the high-bit depth image, so it also leaves room for editing. . It is very user-friendly, both in terms of visual effects and editing.
  • not only one nonlinear transformation may be performed to obtain the image data to be processed. It is also possible to continue to perform another nonlinear transformation based on the nonlinear transformation.
  • performing nonlinear image transformation processing on the original image data to obtain the to-be-processed image data includes: performing at least one nonlinear image transformation processing on the original image data to obtain the to-be-processed image data.
  • the encoder in the mobile phone may continue to perform nonlinear changes to obtain 10-bit image data as nonlinear HDR image data.
  • performing linear image transformation processing on the original image data to obtain the image data to be processed includes: performing linear image transformation processing on the original image data at least once to obtain the image data to be processed.
  • At least one nonlinear image transformation process and at least one linear image transformation process are performed on the original image data to obtain the to-be-processed image data. It should be understood that the processing order of the nonlinear image transformation processing and the linear image transformation processing is not limited.
  • the mobile phone continues to perform linear compression on the basis of the 12-bit image data, such as linear clipping, to obtain 10-bit image data as the final nonlinear HDR image data.
  • the encoder in the mobile phone can perform nonlinear image transformation processing on the 16-bit original image data to obtain 14-bit image data, and then perform linear cropping on the 14-bit image data to obtain 12-bit image data.
  • a linear clipping is performed again to obtain 10-bit image data, which is used as the final nonlinear HDR image data.
  • the final data volume of the image data to be processed can also be selected for different display devices, if the display device can support larger display image data, such as 10-bit image data, 12-bit image data, and so on.
  • the above-mentioned transformation times and the target of image transformation can be changed along with it, but the specific implementation steps of transformation are similar, and will not be repeated here.
  • the user can also lead the above-mentioned image transformation process.
  • performing nonlinear image transformation processing on the original image data to obtain the image data to be processed includes: determining the target of the nonlinear image transformation of the original image data based on the loss of image accuracy; The non-linear image transformation process obtains the image data to be processed.
  • the image precision loss refers to the loss of precision of the image during the transformation process, which is determined according to the final transformation target of the image data.
  • the image precision loss has been preset and can be multiple, and each loss can correspond to a final transformation target, that is, the amount of data for the final transformation of the image.
  • the image data is finally transformed into 10-bit image data, 12-bit image data, or 14-bit image data.
  • each transformation target may also correspond to a preset transformation process.
  • the encoder in the mobile phone can display various transformation targets in advance through a display device, such as the screen of the mobile phone where the encoder is located, for the user to select.
  • the encoder in the mobile phone determines the final transformation target in response to the user's selection, and transforms the original image through the above process and transformation target to obtain image data to be processed, which is used as the final nonlinear HDR image data.
  • the number of transformations can also be set, so that the transformation process is determined according to the number of transformation processes. Since similar content has been described above, it will not be repeated here.
  • linear image transformation processing it is also possible to perform linear image transformation processing on the original image data to obtain the image data to be processed, including: determining the target of the linear image transformation of the original image data based on the loss of image accuracy; The target is to perform linear image transformation processing on the original image to obtain the image data to be processed. It will not be repeated here.
  • original image data is acquired, and image transformation processing is performed on the original image data to obtain image data to be processed.
  • the image transformation processing may include linear transformation processing, nonlinear transformation processing, or combination processing of linear transformation processing and nonlinear transformation.
  • the base layer image data refers to the image data of the base data bit depth, that is, the low bit depth image data, and the dynamic range thereof is also the base dynamic range. Such as 8bit image data.
  • the base layer image data is compliant with the displayable image data of conventional display devices.
  • extracting the base layer image data of the preset data amount from the to-be-processed image data or the original image data includes: performing linear image transformation processing on the to-be-processed image data or the original image data to obtain the base layer image data of the preset data amount.
  • the preset data amount may be determined according to the requirements of the electronic device associated with or where the decoder is located, such as 8 bits.
  • the encoder in the mobile phone can perform linear cropping after acquiring the above-mentioned 12-bit image data, and directly obtain the linearly cropped 8-bit base layer image data.
  • the base layer image data of the preset data amount can also be obtained by performing linear image transformation processing from the original image data. It is not repeated here, but it should be understood that the dynamic range of the image data of the base layer is smaller than the dynamic range of the image data to be processed.
  • the first preset encoding rule is an encoding rule determined according to the JPEG encoding rule.
  • it can also be an encoding rule determined according to the encoding rule of the current mainstream image format, such as TIFF (Tag Image File Format, Tag Image File Format), BMP (Bitmap, Bitmap), etc.
  • TIFF Tag Image File Format, Tag Image File Format
  • BMP Bitmap, Bitmap
  • the encoder in the mobile phone can obtain the above-mentioned base layer image data and encode it according to the JPEG coding rule to obtain the base layer image code stream.
  • the residual refers to image data obtained by removing the image data of the base layer from the image data to be processed.
  • the residual can be directly used as enhancement layer image data.
  • the enhancement layer image data refers to the image data between the high bit depth image data and the base layer image data. Its dynamic range is also high dynamic range, which is higher than the dynamic range of the base layer image data.
  • the residual may be calculated based on the image data to be processed extracted in step 101 and the base layer data extracted in step 102 .
  • the specific method may be: calculating the residual based on the image data to be processed and the preprocessed base layer image data, including: subtracting the preprocessed base layer image data from the to-be-processed image data to obtain residual.
  • the encoder can subtract the corresponding 8-bit image data from the 12-bit image data to obtain the enhancement layer image data.
  • the electronic device for decoding the target image code stream after the image data to be processed is encoded and decoded, for the electronic device for decoding the target image code stream, it can only obtain the decoded base layer image data (eg, the decoded target image) from the decoded target image.
  • the undecoded base layer image data cannot be obtained, so in order to better decode the target image in the future, the decoded enhancement layer image data and the decoded base layer image data data (here refers to the base layer image compressed by the first image format, or the encoded base layer image) to obtain the decoded target image, so when encoding the image data to be processed, it can be for the base layer after encoding and decoding. image data to determine the enhancement layer image data.
  • the enhancement layer image data can be obtained from the to-be-processed image data and the encoded and decoded base layer image data.
  • the method 100 further includes: preprocessing the base layer image data to obtain preprocessed base layer image data; calculating the residual based on the to-be-processed image data and the base-layer image data, including: based on the to-be-processed image data Residuals are computed on the image data and the preprocessed base layer image data.
  • the preprocessing of the base layer image data to obtain the preprocessed base layer image data includes: decoding the base layer image code stream based on the first preset decoding rule corresponding to the first preset coding rule, and decoding the obtained base layer image code stream. data as preprocessed base layer image data.
  • the encoder in the mobile phone after acquiring the basic layer image data, that is, the undecoded 8-bit image data, the encoder in the mobile phone performs JPEG encoding on it.
  • the encoded base layer image data is obtained, and then the decoded image data of the base layer can be obtained through image decoding. Then, the corresponding decoded base layer image data is subtracted from the to-be-processed image data to obtain enhancement layer image data.
  • JPEG is a widely used image compression standard because the standard software and hardware algorithms are simple to implement and can ensure the quality of images at a higher compression ratio.
  • other image formats can also be encoded and decoded. Select which image format to encode and decode. When the entire image data to be processed is encoded subsequently, the image in this image format can be compatible with HDR images.
  • the enhancement layer image In addition, because in some relatively flat areas of the enhancement layer image, after the subsequent encoding process of the enhancement layer image data, such as DCT transformation and quantization, only the DC component of the enhancement layer image data will remain, resulting in the final result.
  • the decoded target image such as a 12bit image, presents blockiness.
  • Random noise can be added to the base layer image data (which can be base layer image data or preprocessed base layer image data) obtained above (then it is also equivalent to adding random noise to the enhancement layer image data, Since the enhancement layer image data is obtained from the base layer image data with random noise added), this blocking effect can be improved at the cost of increasing the code stream and part of the noise.
  • the method 100 may further include: adding random noise data to the base layer image data; calculating a residual based on the to-be-processed image data and the base-layer image data, including: based on the to-be-processed image data and adding random noise data
  • the base layer image data computes residuals.
  • random noise may be added to the image data of the base layer or to the preprocessed image data of the base layer.
  • the method 100 may further include: after calculating the residual, adding random noise data to the residual.
  • the method 100 further includes: in the process of calculating the residual, adding random noise data, so that the obtained residual has random noise data.
  • the dynamic range of the image data to be processed can be compared with the base layer image data (the base layer images involved here and below can be the base layer image)
  • the dynamic range of the image data, or the preprocessed base layer image data can also be aligned.
  • the dynamic range represented by the image data to be processed is aligned with the dynamic range represented by the preprocessed base layer image data.
  • the alignment may be: hdr/16, where hdr is image data to be processed, that is, the above-mentioned nonlinear HDR image data.
  • hdr is image data to be processed
  • the base layer image data is 8bit image data
  • hdr/16 can obtain 8bit integer and 4bit decimal, so as to align with the dynamic range of the base layer image data.
  • the preprocessed base layer image data When determining the residual, if it is determined by the preprocessed base layer image data, then the preprocessed base layer image data will inevitably bring loss. In order to compensate for this loss, this loss can be compensated.
  • the aligned image data to be processed is compensated; the preprocessed base layer is subtracted from the compensated image data to be processed. Image data, get residuals.
  • the compensation method may be, for example, compensating the hdr/16 data, hdr/16*drc coef , where *drc coef is the dynamic range of the base layer image data and the dynamic range of the HDR image (ie, hdr) data The inverse of the range scale.
  • the enhancement layer image data can be obtained by subtracting the preprocessed base layer image data.
  • calculating the residual based on the image data to be processed and the preprocessed base layer image data includes: comparing the dynamic range represented by the image data to be processed with the dynamic range represented by the preprocessed base layer image data. Alignment; compensate the aligned image data to be processed by the ratio of the dynamic range of the enhancement layer image data to the dynamic range of the base layer image data; subtract the preprocessed base layer image from the compensated image data to be processed data to get residuals.
  • the data of the enhancement layer image can be selected.
  • the method 100 may further include: determining the enhancement layer image data based on the residual, including: obtaining the data to be retained based on the residual; selecting the retained data from the data to be retained, and using it as the enhancement layer image data.
  • selecting and retaining data refers to performing data retention or data selection on the obtained residuals.
  • the way to choose to keep the data can be, for example, (hdr/16*drc coef -base)*2 n , where n is the number of bits of data you want to keep. According to the previous text, hdr/16 can get 4 decimal places, so the maximum value of n is 4, and the minimum value is 1. Here you can choose n to be 3, then you can keep three decimal places for a long time. (hdr/16*drc coef -base) is the residual. Random noise data can be added to this residual.
  • selecting the reserved data from the data to be reserved and using it as the enhancement layer image data includes: adjusting the reserved data to obtain the enhancement layer image data with positive integer data.
  • res is the image data of the enhancement layer. It can be understood that it is adjusted to a positive integer through 2048.
  • Base can be pre-processed base layer image data.
  • the second preset encoding rule refers to the encoding rule for the enhancement layer image data, and is encoded accordingly.
  • the encoding process may include: as shown in Figure 2, dividing into slices (slice image data), that is, dividing the slice image data in Figure 2, DCT (Discrete Cosine Transform, discrete cosine transform) transform, quantization, Qp map (quantization parameter map , quantization parameter table) calculation, that is, the quantization parameters in Figure 2, coefficient scanning, entropy coding, etc.
  • DCT Discrete Cosine Transform, discrete cosine transform
  • Qp map quantization parameter map , quantization parameter table
  • the Qp map can be determined from the base layer image data.
  • encoding the enhancement layer image data based on the second preset encoding rule includes: encoding the enhancement layer image data based on the base layer image data.
  • encoding the enhancement layer image data based on the base layer image data includes: determining first information reflecting the compression of the enhancement layer image data according to the base layer image data; encoding the enhancement layer image data based on the first information .
  • the first information refers to the information reflecting the compression of the enhancement layer image, such as the Qp map, wherein, the larger the Qp in the Qp map, the more strongly compressed the enhancement layer image at the corresponding position, and the smaller the Qp, the corresponding The more complete the information about the location of the enhancement layer image is preserved.
  • the compression also refers to the removed image data information.
  • the quantity corresponding to the bright part and/or the dark part of the image data of the base layer can be determined first, and then the size of Qp is determined through a quantity threshold. to encode.
  • determining the first information reflecting the compressed state of the enhancement layer image data according to the base layer image data includes: determining the first information reflecting the compressed state of the enhancement layer image data according to the brightness distribution of the base layer image data.
  • the brightness distribution of the base layer image data refers to the distribution of bright parts (also referred to as highlights) and dark parts in the base layer image data. If the number of bright and/or dark areas in a certain image data area is larger, the more complete it is stored, and the smaller its Qp is. Otherwise, Qp is larger.
  • the number of highlighted pixels is determined according to the brightness in each preset image data area in the image; the number of dark pixels is determined according to the brightness in each preset image data area; and/or the number of pixels in the dark place to determine the corresponding brightness distribution.
  • the number of dark pixels and the number of highlighted pixels can be determined by the color information corresponding to the image data.
  • the base layer image is converted from YUV format to RGB format, and the number of highlighted pixels is determined according to the brightness in each preset image data area in the RGB format image; according to each preset image data area in the YUV format According to the brightness situation, the number of pixels in the dark place is determined; according to the number of highlighted pixels and/or the number of pixels in the dark place, the corresponding brightness distribution is determined.
  • the encoder in the mobile phone first converts the input YUV (color coding method, "Y” represents the brightness (Luminance or Luma), that is, the gray value; and “U” and “V” represent It is the chrominance (Chrominance or Chroma), which is used to describe the color and saturation of the image, and is used to specify the color of the pixel.)
  • the basic layer image data is converted into RGB (RGB color mode, red, green, blue three-color color mode) image data in the image format.
  • the base layer image data can be divided into multiple image data areas in advance, and the sum of the number of pixels in the bright and dark areas can be counted for each area.
  • the quantization parameter qIdx in this area is set to 2, otherwise it is set to 8, until the quantization parameter is completed for each area , the Qp map that guides the quantization process corresponding to the enhancement layer image data can be obtained. It should be understood that each region shares the same set of quantization parameters.
  • the division method may be the above-mentioned division into slices (slice image data, every 8 MB is divided into one slice image data, MB (Macroblock, macroblock), MB's The size is 16x16 pixels.), the base layer image data can also be divided into 16*32 quantization blocks (Quantization Block, QB), the same quantization parameter is used in the same QB and/or the same slice is used. The same quantization parameter. It should be understood that the image data may be divided into regions according to requirements, which is not limited here.
  • the determined first information may be:
  • determining the first information reflecting the compression of the enhancement layer image data according to the luminance distribution of the image data of the base layer includes: dividing the image data of the base layer into quantized blocks; for each quantized block, determining the corresponding luminance distribution ; Determine the quantization parameters of each quantization block according to the luminance distribution.
  • the determination of the brightness distribution may specifically include: determining the corresponding brightness distribution for each slice image data, including: determining the corresponding brightness distribution for each slice image data, including: according to each slice image data In the case of medium brightness, determine the number of highlighted pixels; according to the brightness in each slice image data, determine the number of pixels in the dark; determine the corresponding brightness according to the number of highlighted pixels and/or the number of pixels in the dark Distribution.
  • determining the number of highlighted pixels according to the brightness in each sliced image data includes: converting the base layer image data from YUV format to RGB format, and determining the brightness according to the brightness in each sliced image data in RGB format.
  • the number of highlighted pixels determine the number of dark pixels according to the brightness of each sliced image data, including: determine the number of dark pixels according to the brightness of each sliced image data in YUV format;
  • the number of points and/or the number of pixels in the dark place determines the corresponding brightness distribution.
  • determining the quantization parameter of the slice according to the brightness distribution may be: determining the first information reflecting the compression of the enhancement layer image data according to the brightness distribution of the base layer image data, including: dividing the base layer image data into slice images data; for each slice image data, determine the corresponding brightness distribution; according to the brightness distribution, determine the quantization parameter of each slice image data. Since it has been described above, it will not be repeated here.
  • the determination condition of the pixels in the highlighted area is that the value of one channel of the three RGB channels is greater than 220, and it is the pixel in the highlighted area.
  • the determination condition of the pixel in the dark place is that the value of the Y channel in the YUV is less than 64, then it is the pixel in the dark place. Statistics from this.
  • determining the quantization parameter of each slice image data according to the brightness distribution includes: determining the quantization parameter of the corresponding slice image data according to the number of bright pixels and/or the number of dark pixels in the brightness distribution.
  • the above is a process of adaptively setting quantization parameters according to the importance of the content of the image data.
  • the embodiment of the present application will use relatively small quantization parameters in these parts of the image data. , so that the encoding quality of this part of the image data is higher, so as to ensure the post-editing space of the user's image.
  • the first information can also be determined according to the brightness distribution of the HDR image data (for example, the above-mentioned 12-bit image data to be processed).
  • the HDR image data for example, the above-mentioned 12-bit image data to be processed. The implementation process of the determination Similar to the above, it will not be repeated. Only description: It is enough to replace the image data of the base layer with the image data to be processed.
  • the encoding process of the enhancement layer image data shown in FIG. 2 it can be implemented by modularization. For example, it will be divided into slice (slice image data), DCT (Discrete Cosine Transform, discrete cosine transform) transformation, quantization, calculation of Qp map (quantization parameter map, quantization parameter table), coefficient scanning, entropy coding, etc. are divided into a sub-module. to achieve their corresponding functions. Each sub-module can obtain output results through input information.
  • the input can be the base layer image data or the image data to be processed, and the output is the Qp map.
  • quantification can be performed.
  • encoding the enhancement layer image data based on the first information includes: determining second information for dividing the image data frequency of the enhancement layer image data; quantizing the second information based on the first information;
  • the enhancement layer image data is encoded.
  • the second information refers to information for dividing the image data frequency of the enhancement layer image data.
  • DCT transform coefficients which can divide the image data frequency of the enhancement layer image data, to divide high frequency and low frequency.
  • the low frequency is in the upper left corner of the DCT transform coefficient matrix
  • the high frequency is in the lower right corner of the DCT transform coefficient matrix, so as to facilitate subsequent scanning and coding, compress the high frequency information of the image data, and retain the low frequency information of the image data.
  • the second information for determining the frequency of image data for dividing the enhancement layer image data may include:
  • the enhancement layer image data can be firstly divided into slices, and then divided into block sub-blocks of 8 ⁇ 8 pixels based on each slice, and 2D-DCT (two-dimensional DCT) transformation is performed on each block to obtain the DCT transform coefficients of each block.
  • 2D-DCT two-dimensional DCT
  • the enhancement layer image data is divided to obtain multiple groups of macroblocks, and the macroblocks are divided into sub-blocks; for the sub-blocks, second information corresponding to the sub-blocks is determined.
  • the enhancement layer image data is divided to obtain multiple groups of macroblocks, and the macroblocks are divided into sub-blocks; based on the multiple groups of macroblocks, slice image data is generated by combining.
  • the encoder in the mobile phone can firstly divide the input enhancement layer image data into slices for smooth subsequent encoding.
  • the enhancement layer image data is divided into macroblocks MB, the size of which is 16x16 pixels.
  • the MB can then be further divided into 4 blocks, each with a size of 8x8 pixels, and these blocks can be the basic unit of subsequent processing.
  • the MBs of a slice should preferably be in the same MB row.
  • the number of MBs in the slice can be 4.
  • the MBs in the slice The number can be 2. And so on, until there is only 1 MB in the slice.
  • a schematic diagram of the division into slices is given in Figure 3. Among them, there are 8 slices in each row, there are 19 slice rows in total, and there are 152 slices in total. Each slice can be encoded and decoded in parallel. Among them, slice301 has 8 MBs, slice302 has 4 MBs, slice303 has 2 MBs, and slice304 has 1 MB.
  • the input of the sub-module corresponding to the division may be the enhancement layer image data, and the output may be the divided image data.
  • the 2D-DCT transform calculation formula (2) is as follows: the 2D-DCT transform can be determined for each block, and the variation coefficient corresponding to each block can be obtained.
  • S(u, v) is the DCT transform coefficient
  • x and y are pixels, which are 0-7
  • u is the frequency in the horizontal direction
  • v is the frequency in the vertical direction
  • s(x, y) is the coefficient value on the spatial domain.
  • the input of the sub-module corresponding to the DCT transform may be the above-mentioned divided image data, and the output may be the DCT transform coefficient.
  • the 2D-DCT transform calculation can also be obtained by 1D-DCT one-dimensional DCT transform, and on this basis, the 2D-DCT transform coefficients can be obtained.
  • the two-dimensional DCT transform can be decomposed into two one-dimensional DCT transforms, wherein the one-dimensional DCT transform formula (3) is:
  • the formula can also determine the 1D-DCT transform for each block, and obtain the variation coefficient corresponding to each block.
  • X(k) is the one-dimensional DCT transform coefficient of change
  • k is 0, 1, 2...7
  • x(i) is the image data signal corresponding to the block
  • i is the corresponding pixel point.
  • the transformation matrix can be planned as the following form:
  • the quantization of the second information may be: implemented by the following quantization formula:
  • the quantization formula of the DC component is:
  • the quantization formula of the AC component is:
  • TF[i][j] is the DCT transform coefficient after DCT transform
  • bitdepth is the bit width of the DCT transform coefficient
  • QF[i][j] is the quantized DCT transform coefficient
  • qMat[i][j] is the quantization matrix, which is preset.
  • qIdx is a quantization parameter, which is obtained from the corresponding position of the input QP map
  • floor is a round-down function
  • i, j represent the coordinates in the 8*8block.
  • the DC component since its value is larger than the AC component, in order to reduce its excessive footprint, save storage resources and reduce the subsequent calculation amount, it is adjusted by 2 ⁇ (bitdepth+2), or 16384, to reduce the DC component, That is, use TF[i][j]-2 ⁇ (bitdepth+2) to prevent the DC component from being too large.
  • each quantization can be performed in blocks of 8*8 units.
  • the relationship between block, MB, QB, and slice is shown in FIG. 4 .
  • each small block 401 represents an 8*8 block of the basic structure of DCT transform and quantization, and every 4 blocks constitute an MB, and the order of data arrangement of the 4 blocks in 1 MB is shown in FIG. 4 .
  • Every 8 blocks form a QB (16*32), that is, the same qIdx is used for quantization of every 8 blocks (that is, the sub-blocks in the same slice image data share the same quantization parameter), and this value is indexed from the Qp map.
  • the entire figure 4 is 16*16*8 as the size of a slice.
  • a slice still uses the same qIdx, but because the slice is located at the texture boundary of the image data, should the whole slice use a smaller qIdx, such as 2, it will make the code stream more wasteful, or should the entire slice be used?
  • a larger qIdx such as 8
  • Such slices can be further divided into smaller blocks, such as QBs, and then the number of pixels in the bright and/or dark areas in each QB can be counted again according to the above method.
  • a QB is allocated a corresponding qIdx, that is, one QB shares a quantization parameter at this time, and each block is quantized to complete the quantization.
  • the same quantization parameter is shared for one QB.
  • it can be divided into QBs starting from the division of the enhancement layer image data, and each QB contains multiple blocks.
  • DCT transforms transform the blocks in it.
  • quantization is performed for each block, and the quantization parameter used in the quantization is a quantization parameter shared by one QB.
  • the QB can also be further divided into smaller image data area units, and the above-mentioned QP map and DCT transformation can be repeated to achieve the final quantization, which will not be repeated here.
  • the same quantization parameter may also be used for slices. That is, according to the foregoing, the corresponding quantization parameter can be determined for each slice and quantized, and then only one QB is used to share the same quantization parameter for the image data texture boundary, and quantization is performed. It will not be repeated here.
  • the input is the DCT transform coefficient and the QP map
  • the output is the quantized coefficient
  • the quantization result that is, the quantization coefficient
  • the quantization result can be scanned and encoded to generate a code stream.
  • encoding the enhancement layer image data according to the quantization result includes: scanning the quantization result, and encoding the scanned quantization result; obtaining the enhancement layer image code stream includes: generating the enhancement layer image data code based on the encoding result flow.
  • the scanning mode may be: scanning the quantization results, including: scanning the quantization results in each sub-block according to a preset scanning mode to obtain the quantization results after the first scanning; for slice image data, according to the first scanning The quantization results in the slice image data are sequentially scanned for the quantization results in each sub-block, and the quantization results after the second scan are obtained as the final quantization results after the scan.
  • the preset scanning mode may be a progressive scanning mode.
  • the scanning is still based on the sub-blocks in the slice, so the image data of the enhancement layer is divided to obtain multiple groups of macroblocks, and the macroblocks are divided into sub-blocks; based on the multiple groups of macroblocks, a slice image is generated by combining data.
  • the encoder in the mobile phone scans by the progressive scanning method, that is, each block is scanned separately, and the scan result is obtained, that is, the reordered block result.
  • the left picture in Figure 5 is the block before scanning
  • the right picture is the block scanned by the progressive scanning method, in which the direction of the arrow indicates the order of scanning.
  • all 8x8blocks in the slice should be scanned, first scan the frequency component in the same position in each block, and then scan the next frequency component in each block, and the scanning order is from low frequency to high frequency.
  • the direction of the arrow in Figure 6.
  • the scanning is performed in order of frequency.
  • the frequency components may be scanned from low to high.
  • the frequency component at the same position and the small block (pixel) of the lowest frequency component are scanned first, and then the small block (pixel) of the frequency component at the next position is sequentially scanned, that is, the next frequency component is scanned until the end.
  • the input is the quantized coefficient
  • the output is the quantized coefficient reordered after scanning.
  • the quantized coefficients reordered after the scan are encoded.
  • an encoder in a mobile phone entropy encodes the quantized coefficients that are reordered after scanning, as described above.
  • the entropy encoding process in the embodiment of the present application adopts Rice-golomb (Rice-golomb encoding, Rice-Glomb encoding) mixed entropy encoding.
  • the input of the sub-module of the above entropy coding function is the quantized coefficients reordered after scanning, and the output is the binary sequence after entropy coding.
  • the preset field can select the corresponding preset field according to different encoding rules.
  • the encoding rule corresponding to JPEG it may be the position immediately following the APP0 application segment.
  • the encoder in the mobile phone finds the position of the APP0 application segment of the base layer image code stream (code stream marker character FF E0), then reads the length of the application segment, and moves the pointer back by this length, It is the insertion position of the enhancement layer image code stream, and the enhancement layer image code stream is inserted into the base layer image code stream, and the final image code stream is output.
  • the enhancement layer image code stream is inserted at the last or other custom position of the base layer image code stream.
  • the sliceheader (slice header information) stores the qIdx values of different QBs in the slice, and the qIdx of each QB is stored in 1 bit, 1 means qIdx is 8, 0 means qIdx is 2.
  • the enhancement layer image code stream can also be encapsulated.
  • the encoder in the mobile phone encapsulates the enhancement layer image code stream using the APP7 (code stream marker character FF E7) application segment. Since JPEG specifies that the length of the application segment cannot exceed 0XFFFF, it is necessary to cut the enhancement layer image code stream. Then package again.
  • APP7 code stream marker character FF E7
  • JPEG specifies that the length of the application segment cannot exceed 0XFFFF, it is necessary to cut the enhancement layer image code stream. Then package again.
  • the above encapsulation field is only for illustration, and in specific implementation, it may be other APP fields.
  • the method 100 further includes: dividing the enhancement layer image code stream, and encapsulating the divided code stream; writing the enhancement layer image code stream into a preset field in the base layer image code stream, including: The encapsulated code stream is written into the preset field, and the encapsulated code stream has corresponding code stream identification information.
  • the encoder in the mobile phone divides the enhancement layer image code stream, encapsulates the divided code stream, and inserts it into the adding position. Both the enhancement layer image code stream and the divided code stream have corresponding code stream identification information.
  • each segment needs certain header information to be marked.
  • the content of the header information is shown in Figure 8.
  • the header information of this segment is used to describe the total information of the enhancement layer image code stream.
  • the enhancement layer image code stream is recorded only once.
  • Figure 9 shows the header information of each segment of the enhancement layer image code stream after cutting, and each segment of the enhancement layer image code stream has.
  • the enhancement layer image code stream is set in the base layer image code stream, so that a traditional image browser, such as a JPEG image, can be used without post-editing of the image or when browsing on a display with a low bit depth
  • a traditional image browser such as a JPEG image
  • the browser can get the basic layer image of the image, which greatly improves the dissemination of HDR images.
  • the HDR image can be obtained using a proprietary image browser, and the image is visually similar to the base layer image obtained directly in a traditional browser, such as a JPEG image browser, It greatly simplifies the user's editing operation.
  • the enhancement layer image is encoded using the encoding method in the embodiments of the present application, the subsequently decoded HDR image has information close to the original image, so it has a larger post-editing space, thereby providing users with more creative space and freedom Spend.
  • the decoding end can decode all the information in the target image code stream, an image with a high dynamic range close to the image to be processed can be obtained. Since the image data to be processed is close to the original image information, it has a large post-editing space.
  • the following uses a mobile phone as an example to illustrate the application scenario of the embodiment of the present application: the user can take a picture through the mobile phone, and take a picture of a landscape.
  • the landscape photo is a 16-bit linear space image.
  • the mobile phone sends the acquired 16-bit image to the encoder in the mobile phone, so that the encoder can acquire the 16-bit image.
  • the HDR image data in the nonlinear space is obtained from the 16-bit image data independently by the encoder or selected by the user: 12-bit image data, as the image data to be processed.
  • the encoder then obtains 8bit image data from the 12bit image data: basic layer image data. Then, the residual of the 12-bit image data and the 8-bit image data is compensated and adjusted, and the compensated and adjusted positive integer image data is obtained as the enhancement layer image data.
  • the encoder encodes the base layer image data according to the JPEG encoding rules to obtain the JPEG code stream.
  • the enhancement layer image data is encoded according to the encoding rules of the enhancement layer image, and the enhancement layer image code stream is performed.
  • the enhancement layer image code stream is encapsulated into the APP7 application segment in the JPEG code stream to obtain the code stream of the HDR image data.
  • the mobile phone can store the code stream.
  • the user can choose to send the 16-bit image in the first user equipment to the second user equipment for post-editing.
  • the first user equipment sends the finally obtained code stream to the second user equipment.
  • the second user equipment decodes the code stream through a decoder set by the second user equipment.
  • the second user equipment When the second user equipment only supports a common JPEG decoder, it can only decode the base layer data, and the computer only obtains the JPEG code stream, decodes and displays it, and the displayed image at this time is the base layer image data.
  • the enhancement layer image data stream can be taken out from the final code stream, and the code stream of the enhancement layer image data can be extracted according to the corresponding decoding rules.
  • the decoded base layer image data and the decoded enhancement layer image data can finally be obtained, and the two are combined to obtain HDR image data for display for later editing by the user.
  • the above-mentioned user equipment may be a mobile phone, a PTZ camera, a smart wearable device, or a drone user equipment.
  • the above-mentioned first device may be a device with a photographing function, which performs encoding processing based on the method shown in FIG. 1 to obtain a target image code stream after photographing.
  • the target image code stream may be directly transmitted from the first user equipment to the second user equipment through multiple devices based on wired or wireless transmission.
  • the first user equipment may transmit the file corresponding to the target image stream to the Internet server, and the second user equipment downloads the corresponding file from the Internet server.
  • the steps involved in the method 100 are not limited in order, and may not be performed in accordance with the order of labelling and writing, and may be executed concurrently.
  • the method 100 may be performed by a plurality of processing elements in the electronic device working in parallel.
  • FIG. 10 is a schematic flowchart of a data processing method provided by an embodiment of the present invention
  • the method 1000 provided by an embodiment of the present application may be executed by an electronic device that may have an encoder, and the encoder may be set in
  • the electronic device may be a camera, an unmanned aerial vehicle, a hand-held pan/tilt, a mobile phone, a tablet computer, etc., any electronic device having a camera or photographing function.
  • the method 1000 includes the following steps:
  • 1003 Calculate a residual based on the to-be-processed image data and the base layer image data to determine enhancement layer image data.
  • 1006 Write the enhancement layer encoded data into a preset field in the base layer image code stream to generate a target image code stream.
  • steps 1001-1006 Since the specific implementations of steps 1001-1006 have been described in detail above, they will not be repeated here.
  • the image data to be processed may be obtained by performing linear or non-linear transformation based on the original image data.
  • the image data to be processed is high dynamic range image data.
  • the original image data to be processed includes linear image data or nonlinear image data.
  • the linear image data may be image data acquired by an image sensor.
  • the nonlinear image data may be high dynamic range image data generated based on multiple images, or may be image data acquired by an image sensor.
  • the image sensor can collect multiple exposures of the scene based on different shooting parameters in a short period of time to obtain multiple images, and synthesize the obtained multiple images into a high dynamic range image, which is used as the image obtained in step 1001. Image data to be processed.
  • the data amount of the to-be-processed image data is smaller than the original image data.
  • the first preset encoding rule is an encoding rule determined according to the JPEG encoding rule.
  • extracting base layer image data with a preset data amount from the to-be-processed image data may include: performing linear transformation based on the to-be-processed image data to obtain base layer image data with a preset data amount.
  • the steps involved in the method 1000 are not limited in order, and may not be performed in accordance with the order of labelling and writing, and may be executed concurrently. Meanwhile, the method 1000 may be performed by multiple processing elements in the electronic device working in parallel.
  • FIG. 11 is a schematic flowchart of a data processing method provided by an embodiment of the present invention
  • the method 1100 provided by an embodiment of the present application may be executed by an electronic device that may have a decoder, and the decoder may be set in
  • the electronic device may be a camera, an unmanned aerial vehicle, a handheld pan/tilt, a mobile phone, a computer, etc., any electronic device with a camera or photographing function.
  • the method 1100 includes the following steps:
  • the first preset decoding rule corresponds to the first preset encoding rule, that is, the first preset encoding rule set above, such as the encoding rule determined according to the JPEG encoding rule, relatively, the first preset decoding rule It may be a decoding rule determined according to the JPEG decoding rule.
  • the computer receives the target image code stream sent by the user's mobile phone.
  • the decoder in the computer obtains the JPEG code stream in the code stream, and then decodes the JPEG code stream according to the decoding rules determined by the JPEG decoding rules to obtain basic layer image data for display.
  • the target image code stream may be in the form of a JPEG code stream, since it also includes an enhancement layer image data code stream, the target image code stream also includes an enhancement layer image in addition to the JPEG code stream. data stream.
  • the base layer image data is used to generate the base layer image.
  • the decoder in the computer can directly generate the basic layer image in JPEG image format according to the data, which can be displayed on the display screen of the computer.
  • the method 1100 further includes: decoding the target code stream based on the second preset decoding rule to obtain enhancement layer image data; the enhancement layer image data is used to generate a target image in combination with the base layer image data, and the dynamic range of the target image is greater than that of the basic layer image data.
  • the dynamic range of the layer image is not limited to that of the basic layer image data.
  • the second preset decoding rule corresponds to the second preset encoding rule, that is, the second preset encoding rule set above.
  • the second preset decoding rule may be an inverse process of the second preset encoding rule.
  • the decoder in the computer can also obtain the enhancement layer image data code stream from the APP7 application segment in the target image code stream.
  • the divided code stream may be spliced into a complete enhancement layer image data code stream.
  • the decoder may perform decoding according to the inverse process of the aforementioned enhancement layer image data encoding rule (ie, the second preset encoding rule) to obtain the enhancement layer image data.
  • the enhancement layer image data and the base layer image data are combined to obtain the final HDR image data, and an HDR image is generated for display.
  • the steps involved in the method 1100 are not limited in order, and may not be performed in accordance with the order of labelling and writing, and may be executed concurrently. Meanwhile, the method 1100 may be performed by multiple processing elements in the electronic device working in parallel.
  • FIG. 12 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention; the apparatus 1200 can be applied to electronic devices that can have encoders, such as cameras, drones, handheld PTZs, mobile phones, tablet computers, etc. , any electronic device with camera and/or camera functions is acceptable.
  • the apparatus 1200 includes: a transformation module 1201 , an extraction module 1202 , a first encoding module 1203 , a determining module 1204 , a second encoding module 1205 and a generating module 1206 .
  • the functions of each module are described in detail below:
  • the transformation module 1201 is configured to obtain original image data, and perform nonlinear image transformation processing on the original image data to obtain image data to be processed.
  • the extraction module 1202 is configured to extract the base layer image data with a preset amount of data from the image data to be processed or the original image data.
  • the first encoding module 1203 is configured to encode the base layer image data based on the first preset encoding rule to obtain a base layer image code stream.
  • the determining module 1204 is configured to calculate a residual based on the image data to be processed and the base layer image data, and determine the enhancement layer image data based on the residual.
  • the second encoding module 1205 is configured to encode the enhancement layer image data based on the second preset encoding rule to obtain an enhancement layer image code stream.
  • the generating module 1206 is configured to write the enhancement layer image code stream into a preset field in the base layer image code stream to generate a target image code stream.
  • the original image data is high dynamic range image data.
  • the original image data includes linear image data or nonlinear image data.
  • the linear image data may be image data acquired by an image sensor.
  • the nonlinear image data may be high dynamic range image data generated based on multiple images, or may be image data acquired by an image sensor.
  • the transformation module 1201 is further configured to: perform linear image transformation processing on the original image data to obtain image data to be processed.
  • the transformation module 1201 is specifically configured to: perform at least one nonlinear image transformation process on the original image data to obtain the image data to be processed.
  • the transformation module 1201 includes: a determination unit for determining the target of nonlinear image transformation of the original image data based on the loss of image accuracy; a transformation unit for performing nonlinear image transformation on the original image based on the target of the nonlinear image transformation Image transformation processing obtains image data to be processed.
  • the extraction module 1202 is configured to: perform linear image transformation processing on the image data to be processed or the original image data to obtain base layer image data with a preset data amount.
  • the device 1200 a preprocessing module for preprocessing the base layer image data to obtain preprocessed base layer image data; a determining module 1204 for: based on the image data to be processed and the preprocessed base layer image data Calculate residuals.
  • the preprocessing module performs decoding processing on the base layer image code stream based on the first preset decoding rule corresponding to the first preset encoding rule, and uses the decoded data as the preprocessed base layer image data.
  • the determining module 1204 is configured to: subtract the preprocessed base layer image data from the to-be-processed image data to obtain a residual.
  • the determining module 1204 is configured to: obtain the data to be retained based on the residual; select the retained data from the data to be retained, and use it as the enhancement layer image data.
  • the determining module 1204 is configured to: adjust the reserved data to obtain enhancement layer image data with positive integer data.
  • the determining module 1204 includes: an alignment unit for aligning the dynamic range represented by the image data to be processed and the dynamic range represented by the preprocessed base layer image data; a compensation unit for passing the enhancement layer image data The ratio of the dynamic range of the base layer image data to the dynamic range of the base layer image data is used to compensate the aligned image data to be processed; the first determination unit is used to subtract the preprocessed base layer image from the compensated image data to be processed. data to get residuals.
  • the apparatus 1200 further includes: an adding module for adding random noise data to the base layer image data; a determining module 1204 for: calculating a residual based on the image data to be processed and the base layer image data to which random noise data is added.
  • the adding module is also used to add random noise data in the process of calculating the residual, so that the obtained residual has random noise data.
  • adding a module is also used to add random noise data to the residual after the residual is calculated.
  • the first preset encoding rule is an encoding rule determined according to the JPEG encoding rule.
  • the second encoding module 1205 is configured to encode the enhancement layer image data based on the base layer image data.
  • the second encoding module 1205 is configured to determine, according to the base layer image data, first information reflecting the compression of the enhancement layer image data; and encode the enhancement layer image data based on the first information.
  • the second encoding module 1205 is configured to determine the first information reflecting the compression of the enhancement layer image data according to the luminance distribution of the base layer image data.
  • the second encoding module 1205 includes: a second determining unit, configured to determine second information for dividing the image data frequency of the enhancement layer image data; a quantization unit, configured to quantize the second information based on the first information; A coding unit for coding the enhancement layer image data according to the quantization result.
  • the encoding unit is configured to scan the quantization result and encode the scanned quantization result; obtaining the enhancement layer image code stream includes: generating the enhancement layer image data code stream based on the encoding result.
  • the apparatus 1200 further includes: a dividing module, configured to divide the enhancement layer image data to obtain multiple groups of macroblocks, and divide the macroblocks into sub-blocks; and a determining module 1204, further configured to: determine the sub-blocks for the sub-blocks The second information corresponding to the block.
  • the division module is further configured to divide the enhancement layer image data to obtain multiple groups of macroblocks, and divide the macroblocks into sub-blocks;
  • the apparatus 1200 further includes: a combination module, configured to generate a combination based on the multiple groups of macroblocks Slice image data; wherein, the encoding unit is used to: scan the quantization results in each sub-block according to a preset scanning mode to obtain the quantization results after the first scan; for the slice image data, according to the quantization results after the first scan The quantization results in each sub-block in the slice image data are sequentially scanned, and the quantization results after the second scan are obtained as the final quantization results after the scan.
  • the second encoding module 1205 includes: a dividing unit for dividing the base layer image data into sliced image data; a third determining unit for determining the corresponding luminance distribution for each sliced image data; according to the luminance distribution In this case, the quantization parameter of each slice image data is determined.
  • the second encoding module 1205 includes: a dividing unit, which is further configured to divide the base layer image data into quantized blocks; a third determining unit, used for determining the corresponding luminance distribution for each quantized block; according to the luminance distribution , determine the quantization parameters of each quantization block.
  • the third determining unit is configured to: determine the number of highlighted pixels according to the brightness of each sliced image data; determine the number of dark pixels according to the brightness of each sliced image data; The number of pixels and/or the number of pixels in the dark place determines the corresponding brightness distribution.
  • the third determining unit is used for: converting the base layer image data from YUV format to RGB format, and determining the number of highlighted pixels according to the brightness of each sliced image data in RGB format; according to each sliced image data In the case of medium brightness, determine the number of pixels in the dark, including: determining the number of pixels in the dark according to the brightness of each slice image data in YUV format; according to the number of highlighted pixels and/or the number of pixels in the dark , to determine the corresponding brightness distribution.
  • the third determining unit is configured to: determine the quantization parameter of the corresponding slice image data according to the number of bright pixels and/or the number of dark pixels in the luminance distribution.
  • sub-blocks in the same slice image data share the same quantization parameter.
  • the apparatus 1200 further includes: a segmentation module, used for segmenting the enhancement layer image code stream, and encapsulating the segmented code stream; a generating module 1206, used for: writing the encapsulated code stream into a preset field, the encapsulated code stream has the corresponding code stream identification information.
  • FIG. 13 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention
  • the apparatus 1300 can be applied to electronic equipment that can have encoders, such as cameras, drones, handheld PTZs, mobile phones, tablet computers, etc. , any electronic device with camera and/or camera functions is acceptable.
  • the apparatus 1300 includes: an acquisition module 1301 , an extraction module 1302 , a determination module 1303 , a first encoding module 1304 , a second encoding module 1305 and a generating module 1306 .
  • the functions of each module are described in detail below:
  • the acquiring module 1301 is used for acquiring the image data to be processed.
  • the extraction module 1302 is configured to extract the base layer image data of a preset data amount from the to-be-processed image data.
  • a determination module 1303, configured to calculate a residual based on the to-be-processed image data and the base layer image data to determine enhancement layer image data.
  • the first encoding module 1304 is configured to encode the base layer image data based on the first preset encoding rule to obtain a base layer image code stream.
  • the second encoding module 1305 is configured to encode the enhancement layer image data based on a second preset encoding rule to obtain enhancement layer encoded data.
  • the generating module 1306 is configured to write the enhancement layer encoded data into a preset field in the base layer image code stream to generate a target image code stream.
  • the image data to be processed is obtained by performing linear or non-linear transformation based on the original image data.
  • the data amount of the to-be-processed image data is smaller than the original image data.
  • the first preset encoding rule is an encoding rule determined according to the JPEG encoding rule.
  • the extraction module 1302 is configured to: perform linear transformation based on the image data to be processed to obtain the base layer image data with a preset data amount.
  • the apparatus 1400 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention; the apparatus 1400 can be applied to electronic equipment that can have a decoder, such as cameras, drones, handheld PTZs, mobile phones, tablet computers, etc. , any electronic device with camera and/or camera functions is acceptable.
  • the apparatus 1400 includes: an acquisition module 1401 and a first decoding module 1402 . The functions of each module are described in detail below:
  • the obtaining module 1401 is used for obtaining the target image code stream.
  • the first decoding module 1402 is configured to decode the target image code stream based on the first preset decoding rule to obtain base layer image data.
  • the base layer image data is used to generate the base layer image.
  • the device 1400 further includes: a second decoding module, configured to decode the target code stream based on a second preset decoding rule to obtain enhancement layer image data; the enhancement layer image data is used to generate a target in conjunction with the base layer image data image, the dynamic range of the target image is greater than that of the base layer image.
  • a second decoding module configured to decode the target code stream based on a second preset decoding rule to obtain enhancement layer image data
  • the enhancement layer image data is used to generate a target in conjunction with the base layer image data image, the dynamic range of the target image is greater than that of the base layer image.
  • the structure of the data processing apparatus 1200 shown in FIG. 12 can be implemented as an electronic device, and the electronic device can be, for example, a camera, a drone, a handheld PTZ, a mobile phone, a tablet computer, etc. or camera-enabled electronic equipment.
  • the electronic device 1500 may include: one or more processors 1501 , one or more memories 1502 and an image acquisition device 1503 .
  • the memory 1502 is used to store a program that supports the electronic device to execute the data processing method provided in the embodiments shown in FIG. 1 to FIG. 9 .
  • the image acquisition device 1503 is used for acquiring original image data; the processor 1501 is configured to execute the program stored in the memory 1502 .
  • the program includes one or more computer instructions, wherein, when the one or more computer instructions are executed by the processor 1501, the following steps can be implemented:
  • the processor 1501 runs a computer program stored in the memory 1502 to achieve:
  • the original image data is high dynamic range image data.
  • the original image data includes linear image data or nonlinear image data.
  • the linear image data may be image data acquired by an image sensor.
  • the nonlinear image data may be high dynamic range image data generated based on multiple images, or may be image data acquired by an image sensor.
  • the processor 1501 is specifically configured to: perform at least one nonlinear image transformation process on the original image data to obtain the image data to be processed.
  • processor 1501 is further configured to: perform linear image transformation processing on the original image data to obtain image data to be processed.
  • the processor 1501 is specifically configured to: determine the target of nonlinear image transformation of the original image data based on the loss of image accuracy; perform nonlinear image transformation processing on the original image based on the target of the nonlinear image transformation to obtain the image data to be processed .
  • the processor 1501 is specifically configured to: perform linear image transformation processing on the image data to be processed or the original image data to obtain base layer image data with a preset amount of data.
  • the processor 1501 is specifically configured to: preprocess the base layer image data to obtain preprocessed base layer image data; calculate the residual based on the to-be-processed image data and the base-layer image data, including: based on the to-be-processed image data The residual is calculated with the preprocessed base layer image data.
  • the processor 1501 is specifically configured to: perform decoding processing on the base layer image code stream based on the first preset decoding rule corresponding to the first preset encoding rule, and use the decoded data as the preprocessed base layer image data.
  • the processor 1501 is specifically configured to: subtract the preprocessed base layer image data from the to-be-processed image data to obtain the residual.
  • the processor 1501 is specifically configured to: obtain the data to be retained based on the residual; select the retained data from the data to be retained, and use it as the enhancement layer image data.
  • the processor 1501 adjusts the reserved data to obtain enhancement layer image data with positive integer data.
  • the processor 1501 aligns the dynamic range represented by the image data to be processed and the dynamic range represented by the preprocessed base layer image data; A scale is used to compensate the aligned image data to be processed; the preprocessed base layer image data is subtracted from the compensated to-be-processed image data to obtain a residual.
  • the processor 1501 is further configured to: add random noise data to the base layer image data; the processor 1501 is specifically configured to: calculate a residual based on the image data to be processed and the base layer image data to which random noise data is added.
  • the processor 1501 is further configured to: in the process of calculating the residual, add random noise data, so that the obtained residual has random noise data.
  • the processor 1501 is specifically configured to: after calculating the residual, add random noise data to the residual.
  • the first preset encoding rule is an encoding rule determined according to the JPEG encoding rule.
  • the processor 1501 is specifically configured to: encode the enhancement layer image data based on the base layer image data.
  • the processor 1501 is specifically configured to: determine first information reflecting the compression of the enhancement layer image data according to the base layer image data; and encode the enhancement layer image data based on the first information.
  • the processor 1501 is specifically configured to: determine the first information reflecting the compression of the enhancement layer image data according to the brightness distribution of the base layer image data.
  • the processor 1501 is specifically configured to: determine the second information for dividing the image data frequency of the enhancement layer image data; quantize the second information based on the first information; and encode the enhancement layer image data according to the quantization result.
  • the processor 1501 is specifically configured to: scan the quantization result, and encode the scanned quantization result; obtaining the enhancement layer image code stream includes: generating the enhancement layer image data code stream based on the encoding result.
  • the processor 1501 is further configured to: divide the enhancement layer image data to obtain multiple groups of macroblocks, and divide the macroblocks into sub-blocks; for the sub-blocks, determine second information corresponding to the sub-blocks.
  • the processor 1501 is further configured to: divide the enhancement layer image data to obtain multiple groups of macroblocks, and divide the macroblocks into sub-blocks; combine and generate slice image data based on the multiple groups of macroblocks; the processor 1501, specifically Used for: scanning the quantization results in each sub-block according to the preset scanning mode to obtain the quantization results after the first scan; for slice image data, scan each sub-block in the slice image data sequentially according to the quantization results after the first scan , obtain the quantization result after the second scan as the final quantization result after the scan.
  • the processor 1501 is specifically configured to: divide the base layer image data into slice image data; determine the corresponding brightness distribution for each slice image data; determine the quantization parameter of each slice image data according to the brightness distribution.
  • the processor 1501 is specifically configured to: divide the base layer image data into quantized blocks; determine the corresponding luminance distribution for each quantized block; and determine the quantization parameter of each quantized block according to the luminance distribution.
  • the processor 1501 is specifically configured to: determine the number of highlighted pixels according to the brightness of each sliced image data; determine the number of dark pixels according to the brightness of each sliced image data; The number of pixels and/or the number of pixels in the dark place determines the corresponding brightness distribution.
  • the processor 1501 is specifically configured to: convert the base layer image data from YUV format to RGB format, and determine the number of highlighted pixels according to the brightness of each sliced image data in RGB format; according to each sliced image data In the case of medium brightness, determine the number of pixels in the dark, including: determining the number of pixels in the dark according to the brightness of each slice image data in YUV format; according to the number of highlighted pixels and/or the number of pixels in the dark , to determine the corresponding brightness distribution.
  • the processor 1501 is specifically configured to: determine the quantization parameter of the corresponding slice image data according to the number of bright pixels and/or the number of dark pixels in the luminance distribution.
  • sub-blocks in the same slice image data share the same quantization parameter.
  • the processor 1501 is further configured to: divide the enhancement layer image code stream and encapsulate the divided code stream; write the enhancement layer image code stream into a preset field in the base layer image code stream, including: Write the encapsulated code stream into the preset field, and the encapsulated code stream has corresponding code stream identification information.
  • an embodiment of the present invention provides a computer-readable storage medium, where the storage medium is a computer-readable storage medium, and program instructions are stored in the computer-readable storage medium, and the program instructions are used to implement the above-mentioned methods in FIGS. 1 to 9 . .
  • the structure of the data processing apparatus 1300 shown in FIG. 13 can be implemented as an electronic device, and the electronic device can be, for example, a camera, a drone, a handheld PTZ, a mobile phone, a tablet computer, etc. or camera-enabled electronic equipment.
  • the electronic device 1600 may include: one or more processors 1601 and one or more memories 1602 .
  • the memory 1602 is used for storing a program that supports the electronic device to execute the data processing method provided in the embodiment shown in FIG. 10 .
  • the processor 1601 is configured to execute programs stored in the memory 1602 .
  • the program includes one or more computer instructions, wherein the one or more computer instructions can implement the following steps when executed by the processor 1601:
  • the processor 1601 runs the computer program stored in the memory 1602 to achieve: acquiring image data to be processed; extracting a preset amount of base layer image data from the image data to be processed; based on the image data to be processed and the base layer
  • the image data calculates the residual to determine the enhancement layer image data; encodes the base layer image data based on the first preset encoding rule to obtain the base layer image code stream; based on the second preset encoding rule, encodes the enhancement layer image data Encoding is performed to obtain enhancement layer encoded data; and the enhancement layer encoded data is written into a preset field in the base layer image code stream to generate a target image code stream.
  • the image data to be processed is obtained by performing linear or non-linear transformation based on the original image data.
  • the data amount of the to-be-processed image data is smaller than the original image data.
  • the first preset encoding rule is an encoding rule determined according to the JPEG encoding rule.
  • the processor 1601 is configured to: perform linear transformation based on the image data to be processed to obtain base layer image data with a preset amount of data.
  • an embodiment of the present invention provides a computer-readable storage medium, where the storage medium is a computer-readable storage medium, and program instructions are stored in the computer-readable storage medium, and the program instructions are used to implement the above method in FIG. 10 .
  • the structure of the data processing apparatus 1400 shown in FIG. 14 can be implemented as an electronic device, and the electronic device can be, for example, a camera, a drone, a handheld PTZ, a mobile phone, a tablet computer, etc. or camera-enabled electronic equipment.
  • the electronic device 1700 may include: one or more processors 1701, one or more memories 1702, and a communication component 1703.
  • the memory 1702 is used to store a program that supports the electronic device to execute the data processing method provided in the embodiment shown in FIG. 11 .
  • the communication component 1703 is used to obtain the target image code stream;
  • the processor 1701 is configured to execute the program stored in the memory 1702 .
  • the program includes one or more computer instructions, wherein, when the one or more computer instructions are executed by the processor 1701, the following steps can be implemented:
  • Processor 1701 runs computer programs stored in memory 1702 to achieve:
  • the target image code stream is decoded based on the first preset decoding rule to obtain base layer image data.
  • the base layer image data is used to generate the base layer image.
  • the processor 1701 is further configured to: decode the target code stream based on the second preset decoding rule to obtain enhancement layer image data; the enhancement layer image data is used to generate a target image in combination with the base layer image data, and the dynamic range of the target image Greater than the dynamic range of the base layer image.
  • an embodiment of the present invention provides a computer-readable storage medium, where the storage medium is a computer-readable storage medium, and program instructions are stored in the computer-readable storage medium, and the program instructions are used to implement the above method in FIG. 11 .
  • the disclosed related detection apparatus eg, IMU
  • the embodiments of the remote control device described above are only illustrative.
  • the division of the modules or units is only a logical function division.
  • there may be other division methods, such as multiple units or components. May be combined or may be integrated into another system, or some features may be omitted, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, and the indirect coupling or communication connection of the remote control device or unit may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium.
  • the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions for causing a computer processor (processor) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
  • the aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes.

Landscapes

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

Abstract

提供了一种数据处理方法、设备和存储介质,从原始图像中得到待处理图像数据,基于第一预设编码规则对基本层图像数据进行编码,基于第二预设编码规则对增强层图像数据进行编码,从而对待处理图像数据的精度尽可能地进行保留,保证待处理图像数据的动态范围和后期编辑空间,再根据基本层图像码流以及增强层图像码流,生成最终的目标图像码流,达到兼容的目的。

Description

数据处理方法、设备和存储介质 技术领域
本发明涉及数据处理领域,尤其涉及一种数据处理、设备和存储介质。
背景技术
随着图像传感器硬件性能的逐渐增加,相机所能拍摄的实际场景的动态范围也越来越大。而当前互联网使用最为广泛的主流图像压缩格式,如,JPEG(Joint Photographic Experts Group,是由联合图像专家组提出的一种针对静止图像的有损压缩国际标准),由于数据位深的限制只能够保留相机所拍摄场景的部分动态范围。
近些年来,为了适应高动态范围(High Dynamic Range,HDR)图像,一些支持高位深的图像压缩技术也不断被提出来,但是对一些主流图像格式并不兼容。
发明内容
本发明提供了一种数据处理、设备和存储介质,可以用于将高动态范围图像与主流图像格式的图像进行兼容。
本发明的第一方面是为了提供一种数据处理方法,包括:获取原始图像数据,对所述原始图像数据做非线性图像变换处理得到待处理图像数据;从所述待处理图像数据或所述原始图像数据中提取预设数据量的基本层图像数据;基于第一预设编码规则对所述基本层图像数据进行编码,得到基本层图像码流;基于所述待处理图像数据和所述基本层图像数据计算残差,基于所述残差确定增强层图像数据;基于第二预设编码规则对所述增强层图像数据进行编码,得到增强层图像码流;将所述增强层图像码流写入所述基本层图像码流中的预设字段,以生成目标图像码流。
本发明的第二方面是为了提供一种数据处理方法,包括:获取目标图像码流;基于第一预设解码规则对所述目标图像码流进行解码,得到基本层图像数据。
本发明的第三方面是为了提供一种电子设备,存储器、处理器以及图像采集装置;所述存储器,用于存储计算机程序;所述图像采集装置,用于获取原始图像数据;所述处理器调用所述计算机程序,以实现如下步骤:获取原始图像数据,对所述原始图像数据做非线性图像变换处理得到待处理图像数据;从所述待处理图像数据或所述原始图像数据中提取预设数据量的基本层图像数据;基于第一预设编码规则对所述基本层图像数据进行编码,得到基本层图像码流;基于所述待处理图像数据和所述基本层图像数据计算残差,基于所述残差确定增强层图像数据;基于第二预设编码规则对所述增强层图像数据进行编码,得到增强层图像码流;将所述增强层图像码流写入所述基本层图像码流中的预设字段,以生成目标图像码流。
本发明的第四方面是为了提供一种电子设备,存储器、处理器以及通信组件;所述存储器,用于存储计算机程序;所述通信组件,用于获取目标图像码流;所述处理器调用所述计算机程序,以实现如下步骤:基于第一预设解码规则对所述目标图像码流进行解码,得到基本层图像数据。
本发明的第五方面是为了提供一种计算机可读存储介质,所述存储介质为计算机可读存储介质,该计算机可读存储介质中存储有程序指令,所述程序指令用于第一方面以及第二方面所述的方法。
本申请实施例提供了一种数据处理方法,获取原始图像数据,对所述原始图像数据做非线性图像变换处理得到待处理图像数据;从所述待处理图像数据或所述原始图像数据中提取预设数据量的基本层图像数据;基于第一预设编码规则对所述基本层图像数据进行编码,得到基本层图像码流;基于所述待处理图像数据和所述基本层图像数据计算残差,基于所述残差确定增强层图像数据;基于第二预设编码规则对所述增强层图像数据进行编码,得到增强层图像码流;将所述增强层图像码流写入所述基本层图像码流中的预设字段,以生成目标图像码流。
通过将对基本层图像数据进行编码,以及对增强层图像数据进行编码,并生成目标图像码流,从而完成对待处理图像数据的编码,同时可以兼容增强层图像数据码流以及基本层图像数据码流。
此外,由于对原始图像数据做非线性图像变换处理得到待处理图像数据,所以待处理图像数据则可以是HDR图像数据,那么则可以最终对HDR图像数据 进行编码。其中,基本层图像数据则可以属于主流图像格式的图像数据,如,JPEG等图像数据。那么将增强层图像码流写入基本层图像码流中的预设字段,以生成目标图像码流,则可以以主流图像格式的图像码流为载体,编码HDR图像数据,从而可以根据不同的需求,即可以解码主流图像格式的图像数据,也可以解码HDR图像数据。
基于此,可以大大提高了HDR图像的传播性。
此外,若解码端可解码目标图像码流中的全部信息,可以得到一个接近于待处理图像的动态范围较高图像。由于待处理图像数据逼近原图图像信息量,因此具有较大的后期编辑空间。给用户提供更多的创作空间和自由度。
同时,由于待处理图像数据(即HDR图像数据)是从由原始图像进行非线性变换后得到的,从而使得待处理图像数据对应的待处理图像比原始图像在视觉上更为相近基本层图像,接近用户拍摄时的观感,对图像传播中保持统一较为一致的观感有利,便于用户的后期编辑操作,对用户更加友好。
相对的,基于上述数据处理方法的本申请实施例另提供的方法以及对应设备和存储介质,也可以具有上述对应的技术效果。
附图说明
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:
图1为本发明实施例提供的一种数据处理方法的流程示意图;
图2为本发明实施例提供的数据处理方法的示意图;
图3为本发明实施例提供的划分成slice的示意图;
图4为本发明实施例提供的对slice划分的示意图;
图5为本发明实施例提供的扫描block的示意图;
图6为本发明实施例提供的扫描slice的示意图;
图7为本发明实施例提供的增强层图像码流的示意图;
图8为本发明实施例提供的增强层图像码流的头信息的示意图;
图9为本发明实施例提供的增强层图像码流的头信息的示意图;
图10为本发明实施例提供的一种数据处理方法的流程示意图;
图11为本发明实施例提供的一种数据处理方法的流程示意图;
图12为本发明实施例提供的一种数据处理装置的结构示意图;
图13为本发明实施例提供的一种数据处理设备的结构示意图;
图14为本发明实施例提供的一种数据处理设备的结构示意图;
图15为本发明实施例提供的一种电子设备的结构示意图;
图16为本发明实施例提供的一种电子设备的结构示意图;
图17为本发明实施例提供的一种电子设备的结构示意图。
具体实施方式
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
除非另有定义,本文所使用的所有的技术和科学术语与属于本发明的技术领域的技术人员通常理解的含义相同。本文中在本发明的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本发明。
为了便于理解本申请的技术方案和技术效果,下面对现有技术进行简要说明:
基于前文所述可知,由于HDR图像越来越多,当前针对HDR图像的压缩方式往往是直接对高位深的图像进行压缩,这样的话,在高位深的显示设备还不普及并且还不兼容传统图像格式,如JPEG,的情况下,很难受到市场的广泛支持。
此外,虽然JPEG XT图像压缩标准,能够在兼容JPEG的基础上对HDR图像进行压缩,但是该压缩方案却是针对传输端的,其解码出来的图像是在线性空间,对于有想对解码后的图像进行后期编辑的用户很不友好。而且由于图像都是使用8bit的JPEG进行压缩。数据精度的不足影响了图像后期编辑的空间。
因此,为了解决以上问题,本申请实施例提出的方案。从原始图像中得到待处理图像数据,基于第一预设编码规则对基本层图像数据进行编码,基 于第二预设编码规则对所述增强层图像数据进行编码,从而对待处理图像数据的精度尽可能地进行保留,保证待处理图像数据的动态范围和后期编辑空间,再通过根据基本层图像码流以及增强层图像码流,生成最终的目标图像码流,达到兼容的目的。
下面结合附图,对本发明的一些实施方式作详细说明。在各实施例之间不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。
图1为本发明实施例提供的一种数据处理方法的流程示意图;本申请实施例提供的该方法100可以由可具有编码器的电子设备执行,该编码器可以设置在电子设备中,电子设备可以为,相机、无人机、手持云台、手机、平板电脑等,具有摄像和/或照相功能的电子设备均可。该方法100包括以下步骤:
101:获取原始图像数据,对原始图像数据做非线性图像变换处理得到待处理图像数据。
102:从待处理图像数据或原始图像数据中提取预设数据量的基本层图像数据。
103:基于第一预设编码规则对基本层图像数据进行编码,得到基本层图像码流。
104:基于待处理图像数据和基本层图像数据计算残差,基于残差确定增强层图像数据。
105:基于第二预设编码规则对增强层图像数据进行编码,得到增强层图像码流。
106:将增强层图像码流写入基本层图像码流中的预设字段,以生成目标图像码流。
相对的,在对待处理图像数据进行编码之后,还可以对目标图像码流进行解码,该解码过程可以是待处理图像数据进行编码的逆过程,其可以通过具有解码器的电子设备进行实现,该解码器可以与编码器同时设置在通过一个电子设备中,也可以分别独立在不同的电子设备中进行配对使用。
以下针对上述步骤进行详细地阐述:
101:获取原始图像数据,对原始图像数据做非线性图像变换处理得到待处理图像数据。
其中,原始图像数据为高动态范围的图像数据。原始图像数据包括线性图像数据或者非线性图像数据。线性图像数据可以是通过图像传感器采集的 得到的图像数据。非线性图像数据可以是基于多张图像生成的高动态范围图像数据,也可以是通过图像传感器采集的得到的图像数据。
其中,原始图像数据可以是指从电子设备中的图像采集装置采集的原始图像数据,该原始图像数据可以为线性图像数据,该图像数据可以是线性HDR图像数据。其中,图像采集装置可以是相机、摄像头等,如可以通过手机来获取到原始图像数据,该原始图像数据可以为16bit(位)的线性图像数据。
在获取到原始图像数据后,可以从该原始图像数据中获取到待处理图像数据,可以为非线性图像数据,其大小可以为12bit。获取方式可以包括以下几种方式:
例如,根据前文所述,手机的摄像头拍摄外部环境的图像,该图像为16bit的线性图像数据。手机中的编码器在获取到该图像数据后,可以通过非线性图像变换,得到12bit的非线性图像数据,作为中间层图像数据,并可以直接作为待处理图像数据,该待处理图像数据可以是非线性HDR图像数据。
需要说明的是,也可以对原始图像数据做线性图像变换处理得到待处理图像数据,具体的实施过程与前文所述相似,此处就不再赘述。仅说明:例如,将16bit原始图像数据线性图像变换处理(如,线性剪裁)到15bit图像数据。这样可以压缩数据量,便于后续图像处理。
由于是针对该非线性HDR图像数据进行编码,且该HDR图像是通过原始图像进行非线性变换/线性变换得到的,那么该HDR图像相比原始图像而言,会更接近显示设备(即显示设备可以具有解码器的电子设备的显示设备)所支持的可展示图像。如,传统显示设备通常支持较低位深的图像,如8bit图像,对于16bit原始图像非线性变换到12bitHDR图像,实际上数据量不会减少太多。在非线性变换中,保留人眼更敏感的细节信息,对人不敏感的细节信息做更大的压缩。且,在视觉效果上,对于非线性12bitHDR图像会更接近于8bit图像,而线性16bit原始图像,则不太接近8bit图像。由于在视觉效果上12bitHDR图像更接近于8bit图像,那么对于用户的观看而言,12bitHDR图像会更友好,且12bitHDR图像又还保留有高位深图像的信息,所以也给用户留有了编辑的空间。无论是视觉效果上还是编辑上,对于用户都非常友好。
为了能够在视觉效果上更加贴近与显示设备所展示的图像,或者,能够保留更多的高位深图像的信息,可以不单单仅进行一次非线性变换,得到待处理图像数据。还可以继续在该非线性变换基础进行再次的非线性变换。
具体的,对原始图像数据做非线性图像变换处理得到待处理图像数据,包括:对原始图像数据做至少一次非线性图像变换处理得到待处理图像数据。
例如,根据前文所述,手机中的编码器在得到上述12bit图像数据后,还可以继续进行非线性变化来得到10bit图像数据,作为非线性HDR图像数据。
相对的,对原始图像数据做线性图像变换处理得到待处理图像数据,包括:对原始图像数据做至少一次线性图像变换处理得到待处理图像数据。
还可以,对原始图像数据做至少一次非线性图像变换处理和至少一次线性图像变换处理得到待处理图像数据。应理解,对非线性图像变换处理和线性图像变换处理,的处理顺序不限定。
例如,根据前文所述,手机在该12bit图像数据基础上继续进行线性压缩,如线性剪裁,得到10bit图像数据,作为最终的非线性HDR图像数据。或者,根据前文所述,手机中的编码器可以针对16bit原始图像数据进行非线性图像变换处理,得到14bit图像数据,然后对该14bit图像数据进行一次线性剪裁,得到12bit图像数据。在该12bit图像数据基础上,再进行一次线性剪裁,得到10bit图像数据,作为最终的非线性HDR图像数据。
需要说明的是,对于原始图像而言,当可以采集到更大的图像,如20bit原始图像数据等等。那么随着原始图像数据的增大,上述针对该原始图像数据的变换过程也可以增多,不拘泥于一次、二次的压缩过程,应理解的是,第一次对原始图像数据进行变换的过程可以是非线性图像变换处理,然后继续多次的线性图像变换处理等。
相对的,也可以针对不同的显示设备来选择最终的待处理图像数据的数据量,如果显示设备可以支持更大的展示图像数据,如,10bit图像数据、12bit图像数据等。都可以随着其改变上述变换次数以及图像变换的目标,但是变换的具体实施步骤是相似的,就不再赘述。
为了能够满足用户的自主性,也可以用户来主导上述图像变换的过程。
具体的,对原始图像数据做非线性图像变换处理得到待处理图像数据,包括:基于图像精度损失,确定原始图像数据的非线性图像变换的目标;基于非线性图像变换的目标,对原始图像做非线性图像变换处理得到待处理图像数据。
其中,图像精度损失是指图像在变换过程中所损失的精度,其根据图像数据最终变换目标来确定。在本申请实施例中,该图像精度损失是已经预置 好的,可以为多个,每个损失都可以对应一个最终变换目标,即图像最终变换的数据量。如,图像数据最终被变换到10bit图像数据或12bit图像数据或14bit图像数据等。且每个变换目标也可以对应预置好的变换过程。
例如,根据前文所述,手机中的编码器可以通过展示设备,如编码器所在手机的屏幕,来预先显示出各个变换目标,供用户选择。手机中的编码器响应于用户的选择,确定最终的变换目标,通过上述过程,以及变换目标对原始图像进行变换,得到待处理图像数据,并作为最终的非线性HDR图像数据。
需要说明的是,除了上述变换目标外,还可以设置变换次数,从而根据变换过程的次数来确定其变换过程。由于前文阐述过类似的内容,此处就不再赘述。
此外,对于线性图像变换处理来说也可以:对原始图像数据做线性图像变换处理得到待处理图像数据,包括:基于图像精度损失,确定原始图像数据的线性图像变换的目标;基于线性图像变换的目标,对原始图像做线性图像变换处理得到待处理图像数据。此处就不再赘述。
在另一实施方式中,获取原始图像数据,对原始图像数据做图像变换处理得到待处理图像数据。该图像变换处理可以包括线性变换处理、非线性变换处理,或者线性变换处理与非线性变换组合处理。
102:从待处理图像数据或原始图像数据中提取预设数据量的基本层图像数据。
此外,基本层图像数据是指基础数据位深的图像数据,即低位深图像数据,其动态范围也是基础动态范围。如8bit图像数据。该基本层图像数据是符合传统显示设备的可展示图像数据的。
其中,从待处理图像数据或原始图像数据中提取预设数据量的基本层图像数据,包括:对待处理图像数据或原始图像数据做线性图像变换处理得到预设数据量的基本层图像数据。
其中,预设数据量可以根据解码器所关联的或所在的电子设备需求而定,如8bit。
例如,根据前文所述,手机中的编码器可以在获取到上述12bit图像数据后,进行线性剪裁,直接得到线性剪裁后的8bit基本层图像数据。
需要说明的是,也可以从原始图像数据中做线性图像变换处理得到预设数据量的基本层图像数据。此处就不再赘述,但应理解,基本层图像数据的 动态范围是小于待处理图像数据的动态范围的。
103:基于第一预设编码规则对基本层图像数据进行编码,得到基本层图像码流。
其中,第一预设编码规则为根据JPEG编码规则确定的编码规则。此外,还可以是根据当前主流图像格式的编码规则确定的编码规则,如TIFF(标签图像文件格式,Tag Image File Format)、BMP(Bitmap,位图)等。以下可以以JPEG为例进行说明:
例如,根据前文所述,如图2所示,手机中的编码器可以在获取到上述基本层图像数据,根据JPEG编码规则进行编码,得到基本层图像码流。
104:基于待处理图像数据和基本层图像数据计算残差,基于残差确定增强层图像数据。
其中,残差是指从待处理图像数据除去基本层图像数据所得到的图像数据。可以直接将该残差作为增强层图像数据。
其中,增强层图像数据是指高位深图像数据与基本层图像数据之间的图像数据。其动态范围也是高动态范围,是高于基本层图像数据的动态范围的。
在一种实施方式中,可以基于步骤101中提取的待处理图像数据和由步骤102中提取的基本层数据计算残差。
在另一种实施方式中,则具体的可以为:基于待处理图像数据和预处理的基本层图像数据计算残差,包括:从待处理图像数据中减去预处理的基本层图像数据,得到残差。
例如,根据前文所述,编码器在得到待处理图像数据,12bit图像数据后,8bit基本层图像数据后,可以从12bit图像数据中减去对应的8bit图像数据,可以得到增强层图像数据。
此外,在对待处理图像数据进行编码以及解码后,对于用于解码该目标图像码流的电子设备而言,其只能从解码后的目标图像中获取到解码后的基本层图像数据(如,对应通过JPEG编码规则编码的码流),不能拿到未编解码的基本层图像数据,所以为了后续更好地对目标图像进行解码,由解码后的增强层图像数据与解码后的基本层图像数据(这里是指通过第一图像格式进行压缩,或者说进行编码的基本层图像),得到解码后的目标图像,所以在对待处理图像数据进行编码的时候,可以是针对编解码后的基本层图像数据来确定增强层图像数据的。
此外,当基本层图像数据属于编解码后的基本层图像数据时,则可以由待处理图像数据以及编解码后的基本层图像数据,得到增强层图像数据。
具体的,也可以为:该方法100还包括:对基本层图像数据做预处理,得到预处理的基本层图像数据;基于待处理图像数据和基本层图像数据计算残差,包括:基于待处理图像数据和预处理的基本层图像数据计算残差。
其中,基本层图像数据做预处理,得到预处理的基本层图像数据,包括:基于与第一预设编码规则对应的第一预设解码规则对基本层图像码流做解码处理,将解码得到数据作为预处理的基本层图像数据。
例如,根据前文所示,如图2所示,手机中的编码器在获取到基本层图像数据,即未编解码的8bit图像数据后,对其进行JPEG编码的编码。得到编码后的基本层图像数据,然后可以再经过图像解码,得到解码后的基本层图像数据。然后,在从待处理图像数据,减去对应的解码后的基本层图像数据,得到增强层图像数据。
需要说明的是,JPEG由于该标准软硬件算法实现简单,并且能够在较高的压缩倍数下保证图像的质量,使得该标准成为使用较为广泛的图像压缩标准。除了JPEG外,还可以进行其它图像格式编解码,选择哪种图像格式进行编解码,在后续整个待处理图像数据进行编码的时候,就可以针对该图像格式的图像与HDR图像进行兼容。
此外,由于在某些较为平坦的增强层图像的区域,其经过后续的增强层图像数据的编码过程,如DCT变换和量化后,就会只剩下增强层图像数据的直流分量,从而导致最终解码后的目标图像,如12bit图像,呈现块效应。为了改善最后解码后的目标图像的质量。可以在上述得到的基本层图像数据(可以是基本层图像数据,也可以为预处理的基本层图像数据)的基础上加入随机噪声(那么也相当于于在增强层图像数据上加入随机噪声,因为增强层图像数据是根据加入随机噪声的基本层图像数据得到的),就可以以增加码流和部分噪声为代价来改善这种块效应。
具体的,可以是,该方法100还包括:在基本层图像数据中加入随机噪声数据;基于待处理图像数据和基本层图像数据计算残差,包括:基于待处理图像数据和加入随机噪声数据的基本层图像数据计算残差。
其中,可以是针对可以是基本层图像数据,也可以为预处理的基本层图像数据,加入随机噪声。
由于这种情况只会出现在图像数据中特别暗的地方,因此只在基本层图像数据或预处理的基本层图像数据的灰度值小于3的地方增加0,1随机噪声。然后确定出残差。此处就不再赘述。
此外,还可以该方法100还包括:在计算出残差后,在残差中加入随机噪声数据。
另,该方法100还包括:在计算残差的过程中,加入随机噪声数据,以使得到的残差具有随机噪声数据。
为了能够更加方便地确定出增强层图像数据,在计算残差的时候,可以将待处理图像数据的动态范围与基本层图像数据(此处以及以下所涉及的基本层图像均可以是是基本层图像数据,也可以为预处理的基本层图像数据)的动态范围进行对齐。
具体的,将待处理图像数据所表示的动态范围与预处理的基本层图像数据所表示的动态范围进行对齐。
例如,对齐方式可以为:hdr/16,其中,hdr为待处理图像数据,即上述非线性HDR图像数据。当hdr为12bit,且基本层图像数据为8bit图像数据,则hdr/16可以得到8bit整数和4bit小数,从而与基本层图像数据的动态范围对齐。
在确定残差的时候,如果通过预处理的基本层图像数据来确定的,那么势必预处理的基本层图像数据会带来损失,为了补偿这个损失,可以对这个损失进行补偿。
具体的,通过增强层图像数据的动态范围与基本层图像数据的动态范围的比例,对对齐后的待处理图像数据进行补偿;从将补偿后的待处理图像数据中减去预处理的基本层图像数据,得到残差。
其中,补偿的方式可以是,例如,对hdr/16的数据进行补偿,将hdr/16*drc coef,其中,*drc coef是基本层图像数据的动态范围与HDR图像(即hdr)数据的动态范围比例的倒数。补偿完,可以在减去预处理的基本层图像数据即可得到增强层图像数据。
基于前述论述可知,其中,基于待处理图像数据和预处理的基本层图像数据计算残差,包括:将待处理图像数据所表示的动态范围与预处理的基本层图像数据所表示的动态范围进行对齐;通过增强层图像数据的动态范围与基本层图像数据的动态范围的比例,对对齐后的待处理图像数据进行补偿; 从将补偿后的待处理图像数据中减去预处理的基本层图像数据,得到残差。
由于前文已经阐述过了,此处就不再赘述。
为了能够优化计算方式,减少计算量,提高计算效率和时间,可以对增强层图像的数据进行选择。
具体的,该方法100还可以包括:基于残差确定增强层图像数据,包括:基于残差,得到待保留数据;从待保留数据中选择保留数据,并作为增强层图像数据。
其中,选择保留数据是指对得到的残差,进行数据保留或者数据选择。
选择保留数据的方式可以为,例如,将(hdr/16*drc coef-base)*2 n,其中,n为想要保留数据的位数。根据前文可知hdr/16可以得到4位小数,所以n最大为4,最小为1。此处可以选择n为3,那么久可以保留三位小数。(hdr/16*drc coef-base)为残差。可以在该残差内加入随机噪声数据。
由于在后续图像的编码过程中,其计算过程均是对正整数进行计算的,所以还需要将小数转换为正整数。
具体的,从待保留数据中选择保留数据,并作为增强层图像数据,包括:对保留数据进行调整,得到具有正整数数据的增强层图像数据。
例如,根据前文所述,可以通过下式1)来调整:
Figure PCTCN2020121666-appb-000001
其中,res为增强层图像数据,可以理解,通过2048来调整为正整数。Base可以为预处理预的基本层图像的数据。
此外,还可以直接:对残差进行调整,得到具有正整数数据的残差,直接作为增强层图像数据。
105:基于第二预设编码规则对增强层图像数据进行编码,得到增强层图像码流。
其中,第二预设编码规则是指针对增强层图像数据的编码规则,由此进行编码的。该编码过程可以包括:如图2所示,划分成slice(切片图像数据)即图2中的划分切片图像数据,DCT(Discrete Cosine Transform,离散余弦变换)变换,量化,Qp map(quantization parameter map,量化参数表)的计算,即图2中的量化参数,系数扫描,熵编码等。其中,根据由Qp map作为基础,对DCT变换后得到DCT变换系数进行量化的,由此进行图像数据编码。而Qp map则是可以通过基本层图像数据确定的。
基于此,基于第二预设编码规则对增强层图像数据进行编码,包括:基于基本层图像数据对增强层图像数据进行编码。
具体的,基于基本层图像数据对增强层图像数据进行编码,包括:根据基本层图像数据,确定反映增强层图像数据被压缩情况的第一信息;基于第一信息,对增强层图像数据进行编码。
其中,第一信息是指反映增强层图像被压缩情况的信息,如Qp map,其中,Qp map中的Qp越大,则对应位置的增强层图像被压缩得越厉害,Qp越小,则对应位置的增强层图像被保存的信息越完整。应理解,该压缩也是指被去除掉的图像数据信息。
具体的,可以先确定出基本层图像数据的亮处和/或暗处对应的数量,然后通过一个数量阈值来确定Qp的大小。从而进行编码。
其中,根据基本层图像数据,确定反映增强层图像数据被压缩情况的第一信息,包括:根据基本层图像数据的亮度分布情况,确定反映增强层图像数据被压缩情况的第一信息。
基本层图像数据的亮度分布情况是指基本层图像数据中的亮处(也可以称为高亮处)以及暗处的分布情况。如果某个图像数据区域中的亮处和/或暗处所对应的数量越多,其被保存的越完整,其Qp越小。否则,Qp越大。
更具体的,根据图像中各个预置图像数据区域中亮度情况,确定高亮像素点个数;根据各个预置图像数据区域中亮度情况,确定暗处像素点个数;根据高亮像素点个数和/或暗处像素点个数,确定对应的亮度分布情况。
可以通过对应图像数据的颜色信息来确定上述暗处像素点个数和高亮像素点个数。
具体的,将基本层图像由YUV格式转换为RGB格式,根据RGB格式的图像中各个预置图像数据区域中亮度情况,确定高亮像素点个数;根据YUV格式的各个预置图像数据区域中亮度情况,确定暗处像素点个数;根据高亮像素点个数和/或暗处像素点个数,确定对应的亮度分布情况。
例如,根据前文所述,手机中的编码器首先将输入的YUV(颜色编码方法,“Y”表示明亮度(Luminance或Luma),也就是灰度值;而“U”和“V”表示的则是色度(Chrominance或Chroma),作用是描述影像色彩及饱和度,用于指定像素的颜色。)的基本层图像数据转化为RGB(RGB color mode,红、绿、蓝三色色彩模式)的图像格式的图像数据。可以基于预先将基本层图像 数据划分成多个图像数据区域,对每个区域进行统计高亮处和暗处的像素点个数和。根据统计出每个区域中的高亮处和暗处的像素点的个数和进行确定,如果高亮处和暗处的像素点的个数和大于该对应区域内像素点的个数的8%(如,该区域内的像素为16*32,则大于16*32*8%),则该区域内的量化参数qIdx设置为2,否则设置为8,直至对每个区域都完成量化参数的设置,即可得到针对增强层图像数据对应的指导量化过程的Qp map。应理解,每个区域共享同一个设置的量化参数。
其中,对于将基本层图像数据划分成多个区域,其划分方式可以是上述划分成slice(切片图像数据,每8个MB被划分成一个切片图像数据,MB(Macroblock,宏块),MB的大小是16x16像素。),也可以将基本层图像数据划分为16*32的量化块(Quantization Block,QB),同一个QB内使用相同的量化参数和/或同一个slice使用相同的量化参数。应理解,可以根据需求将图像数据进行区域划分,此处不进行限制。
对于量化块而言,其确定第一信息可以为:
具体的,根据基本层图像数据的亮度分布情况,确定反映增强层图像数据被压缩情况的第一信息,包括:将基本层图像数据划分为量化块;针对各个量化块,确定对应的亮度分布情况;根据亮度分布情况,确定各个量化块的量化参数。
由于前文已经阐述过相似的实施方式,此处就不再赘述。
在针对slice的时候,其确定亮度分布情况可以具体为:针对各个切片图像数据,确定对应的亮度分布情况,包括:针对各个切片图像数据,确定对应的亮度分布情况,包括:根据各个切片图像数据中亮度情况,确定高亮像素点个数;根据各个切片图像数据中亮度情况,确定暗处像素点个数;根据高亮像素点个数和/或暗处像素点个数,确定对应的亮度分布情况。
更具体的,根据各个切片图像数据中亮度情况,确定高亮像素点个数,包括:将基本层图像数据由YUV格式转换为RGB格式,并根据RGB格式的各个切片图像数据中亮度情况,确定高亮像素点个数;根据各个切片图像数据中亮度情况,确定暗处像素点个数,包括:根据YUV格式的各个切片图像数据中亮度情况,确定暗处像素点个数;根据高亮像素点个数和/或暗处像素点个数,确定对应的亮度分布情况。
由于前文已经阐述过了,此处就不再赘述。
而对于根据亮度分布情况,确定slice其量化参数可以为:根据基本层图像数据的亮度分布情况,确定反映增强层图像数据被压缩情况的第一信息,包括:将基本层图像数据划分为切片图像数据;针对各个切片图像数据,确定对应的亮度分布情况;根据亮度分布情况,确定各个切片图像数据的量化参数。由于前文已经阐述过了,此处就不再赘述。
统计每个区域内高亮处和/或暗处的像素点个数,高亮处的像素确定条件是RGB三个通道存在一个通道的值大于220,则为高亮处的像素。暗处的像素确定条件是存在YUV中的Y通道的值小于64,则为暗处的像素。由此进行统计。
应理解,对于任一区域中,如果统计出来只有暗处的像素或者高亮处的像素,则可以只按照暗处的像素或者高亮处的像素的个数进行确定,如果该区域既有暗处的像素又有高亮处的像素,则可以根据暗处的像素和高亮处的像素的个数和来判断。此处就不再赘述。
而对于slice确定其量化参数可以为:
具体的,根据亮度分布情况,确定各个切片图像数据的量化参数,包括:根据亮度分布情况中的高亮像素点个数和/或暗处像素点个数,确定对应切片图像数据的量化参数。
由于前文已经阐述过了,此处就不再赘述。
需要说明的是,上述是根据图像数据内容的重要性自适应设定量化参数过程。考虑到用户在后期编辑端会对图像数据的动态范围的两端,即图像数据的亮暗部做出较大的调整,因此本申请实施例在图像数据的这些部分会使用相对较小的量化参数,使得这部分图像数据的编码质量较高,从而保证用户图像的后期编辑空间。
此外,除了根据基本层图像数据的亮度分布情况来确定第一信息外,也可以根据HDR图像数据(如,上述12bit的待处理图像数据)的亮度分布情况来确定第一信息,确定的实施过程与上述相似,就不再赘述。仅说明:将基本层图像数据替换为待处理图像数据即可。
另,针对图2中所示的增强层图像数据的编码过程,可以将其模块化来实现。如将划分成slice(切片图像数据),DCT(Discrete Cosine Transform,离散余弦变换)变换,量化,Qp map(quantization parameter map,量化参数表)的计算,系数扫描,熵编码等分别以一个子模块来实现各自对应的 功能。每个子模块均可以通过输入信息,得到输出结果。对于Qp map子模块而言,其输入可以是基本层图像数据也可以是待处理图像数据,输出是Qp map。
在确定完第一信息后,则可以进行量化。
具体的,基于第一信息,对增强层图像数据进行编码,包括:确定划分增强层图像数据的图像数据频率的第二信息;基于第一信息,对第二信息进行量化;根据量化结果,对增强层图像数据进行编码。
其中,第二信息是指用于划分增强层图像数据的图像数据频率的信息。如,DCT变换系数,其可以划分增强层图像数据的图像数据频率,将高频和低频划分出来。低频在DCT变换系数矩阵的左上角,高频在DCT变换系数矩阵的右下角,以便于后续扫描编码,多压缩图像数据的高频信息,多保留图像数据的低频信息。
其中,确定划分增强层图像数据的图像数据频率的第二信息,可以包括:
可以先对增强层图像数据划分成slice,基于每个slice再划分为8x8像素的block子块,对每个block进行2D-DCT(二维DCT)变换得到每个block的DCT变换系数。
其中,block的具体划分方式可以为:
对增强层图像数据进行划分,得到多组宏块,并将宏块划分为子块;针对子块,确定子块对应的第二信息。
其中,对增强层图像数据进行划分,得到多组宏块,并将宏块划分为子块;基于多组宏块,组合生成切片图像数据。
例如,根据前文所述,手机中的编码器在得到增强层图像数据后,为了后续顺利进行编码,可以先将输入的增强层图像数据进划分为slice。首先,将增强层图像数据被划分为宏块MB,其大小是16x16像素。MB可以接着继续划分为4个blocks,每个block的大小为8x8像素,这些blocks可以是后续处理的基本单位。
当增强层图像数据的分辨率不满足16的倍数的时候,可以先对增强层图像数据进行padding填充直到分辨率满足16的倍数。最后,增强层图像数据的每8个MB被划分成一组,称为slice。
一个slice的MB最好要处于同一MB行,当一行剩余的MB的数目不够8个MB时,slice中MB的数目可以为4,当一行剩余的MB的数目不够4个MB时,slice中MB的数目可以为2。以此类推,直到slice中仅有1个MB。
图3中给出了划分成slice的示意图。其中,每行有8个slice,共有19个slice行,共有152个slices。每个slice可以并行的编解码。其中,slice301有8个MB,slice302有4个MB,slice303有2个MB,slice304有一个MB。该划分所对应的子模块其输入可以是增强层图像数据,输出是划分后的图像数据。此外,2D-DCT变换计算公式(2)如下:可以针对每个block来确定2D-DCT变换,得到每个block对应的变化系数。
Figure PCTCN2020121666-appb-000002
其中,S(u,v)为DCT变换系数,x和y为像素,为0-7,u为水平方向上的频率和v为垂直方向上的频率。s(x,y)为空间域上的系数值。
需要说明的是,DCT变换所对应的子模块,其输入可以是上述划分后的图像数据,输出可以是DCT变换系数。
还值得说明是,该2D-DCT变换计算还可以通过1D-DCT一维DCT变换得到,在此基础上得到2D-DCT变换系数。具体的,可以是二维DCT变换可以分解为两次一维DCT变换,其中一维DCT变换公式(3)为:
Figure PCTCN2020121666-appb-000003
其中,该公式也可以是针对每个block来确定1D-DCT变换,得到每个block对应的变化系数。X(k)为一维DCT变换变化系数,k为0、1、2……7,x(i)为block对应的图像数据信号,i是对应像素点。
其中,变换矩阵可以规划为如下形式:
Figure PCTCN2020121666-appb-000004
其中:
Figure PCTCN2020121666-appb-000005
Figure PCTCN2020121666-appb-000006
其中,基于第一信息,对第二信息进行量化可以为:通过下式量化公式实现:
DC分量的量化公式为:
QF[i][j]=floor((TF[i][j]-2^(bitdepth+2))/(qMat[i][j]*qIdx))  (4)
进一步的,在某些实施例中,可以使用:
QF[i][j]=floor((TF[i][j]-16384)/(qMat[i][j]*qIdx))   (5)
其中,2^(bitdepth+2),bitdepth是12的时候,该值为16384。在具体处理时代码可直接带入该值进行处理。
AC分量的量化公式为:
QF[i][j]=floor(TF[i][j]/(qMat[i][j]*qIdx))   (6)
其中,TF[i][j]是DCT变换后的DCT变换系数,bitdepth为DCT变换系数的位宽,QF[i][j]是经量化后的DCT变换系数,qMat[i][j]是量化矩阵,预置好的。qIdx是量化参数,由输入的QP map对应位置得到,floor为向下取整函数,i,j表示在8*8block中的坐标。
对于DC分量而言,由于其数值大于AC分量,为了降低其占位过多,节省存储资源以及减少后续的计算量,通过2^(bitdepth+2),或16384进行调整,减小DC分量,即使用TF[i][j]-2^(bitdepth+2)防止DC分量过大。
如果资源充足,且能够快速进行后续计算,也可以不进行调整,则可以直接从公式中去除掉对应项即可。
每次量化可以是以8*8为单位的block进行的。在本申请实施例中,block,MB,QB,slice之间的关系如图4所示。在图4中,每个小块401代表DCT变换和量化的基本结构8*8的block,每4个block组成一个MB,1个MB内4个block数据排列的顺序如图4中所示。每8个block组成一个QB(16*32),即每8个block量化时使用相同的qIdx(即同一切片图像数据中的子块共享同一个量化参数),该值从Qp map中索引。整个图4为16*16*8为一个slice的大小。
此外,图像数据纹理边界,需要特殊考虑。
此时,如果一个slice还使用相同的qIdx,但由于这个slice位于图像 数据纹理边界处的话,要不该slice整个使用较小的qIdx,如2,会使得码流比较浪费,要不该slice整个使用较大的qIdx,如,8,会使得部分图像数据编码质量较差。因此,可以对这样的slice继续划分,分为更小的块,如QB,再根据上述方式重新对每个QB中统计高亮处和/或暗处的像素点的个数信息,对每个QB分配对应的qIdx,即,此时一个QB共享一个量化参数,对每个block进行量化,以完成量化。
应理解,如果是针对一个QB共用相同的量化参数。那么根据前文可知,可以从增强层图像数据的划分开始,就可以划分到QB,每个QB中包含多个block。DCT变换的时候,对其中的block进行变换。然后,量化是针对每个block进行的,此时量化中用到的量化参数则是一个QB共用一个量化参数。当然QB也可以继续划分,划分到更小的图像数据区域单元,重复上述QP map和DCT变换,来实现最终的量化,此处就不再赘述。
需要说明的是,还可以如果是针对slice使用相同的量化参数。即根据前文可知,可以针对每个slice来确定其对应的量化参数,并进行量化,然后仅对图像数据纹理边界,使用一个QB共用相同的量化参数,并进行量化。此处就不再赘述。
对于量化功能对应的子模块其输入时DCT变换系数和QP map,输出为量化系数。
在得到量化结果后,可以对量化结果,即量化系数,进行扫描,并进行编码,生成码流。
具体的,根据量化结果,对增强层图像数据进行编码,包括:对量化结果进行扫描,并对扫描后的量化结果进行编码;得到增强层图像码流包括:基于编码结果生成增强层图像数据码流。
其中,扫描方式可以为:对量化结果进行扫描,包括:根据预置扫描方式对各个子块中的量化结果进行扫描,得到第一扫描后的量化结果;针对切片图像数据,按照第一扫描后的量化结果顺序扫描切片图像数据中各个子块中的量化结果,得到第二扫描后的量化结果,作为最终的扫描后的量化结果。
其中,预置扫描方式可以为progressive渐进扫描方式。
在扫描前,还是基于slice中的子块来进行扫描的,所以对增强层图像数据进行划分,得到多组宏块,并将宏块划分为子块;基于多组宏块,组合生成切片图像数据。
例如,根据前文所述,如图5所示,该图5是手机中的编码器通过progressive扫描方式进行扫描的,即对每个block进行单独的扫描,拿到扫描结果,即重新排序后的block结果。其中,图5中左图是扫描前的block,右图是通过progressive扫描方式扫描block,其中箭头方向表示扫描的顺序。然后,对8x8block的扫描完成后,要对slice中的所有8x8block进行扫描,先扫描每个block中相同位置的频率分量再扫描每个block中的下一频率分量,扫描顺序为低频到高频。如图6箭头方向所示。在图6中,如从0位置开始扫描,按照频率顺序进行扫描。在一实施例中,可以是频率分量由低到高进行扫描。先对同一位置的频率分量,最低频率分量的小块(像素)扫描,然后再顺序扫描下一个位置的频率分量的小块(像素),也即,扫描下一频率分量直到结束。
需要说明的是,对于扫描功能对应的子模块,其输入是量化系数,输出是扫描后重新排序的量化系数。
在扫描完成后,则对扫描后重新排序的量化系数进行编码。
例如,根据前文所述,手机中的编码器对扫描后重新排序的量化系数进行熵编码。本申请实施例熵编码过程采用的是Rice-golomb(Rice-golomb编码,莱斯-格伦布编码)混合熵编码。
上述熵编码功能的子模块的输入是扫描后重新排序的量化系数,输出是熵编码后的二进制序列。
106:将增强层图像码流写入基本层图像码流中的预设字段,以生成目标图像码流。
其中,预设字段可以根据不同编码规则选择对应的预设字段。例如,对于JPEG所对应的编码规则而言,可以是紧跟APP0应用段的位置。
例如,根据前文所述,手机中的编码器找到基本层图像码流的APP0应用段的位置(码流标记字符FF E0),然后读取该应用段的长度,将指针往后移动该长度,就是增强层图像码流的插入的位置,并将增强层图像码流插入到基本层图像码流中,输出最终的图像码流。
如果基本层图像码流中不存在APP0应用段,则在基本层图像码流的最后或者其它的自定义位置插入增强层图像码流。
其中,如图7所示,增强层图像码流组织结构。其中sliceheader(slice头信息)中存放着该slice中不同QB的qIdx值,每个QB的qIdx用1bit存储,1 代表qIdx为8,0代表qIdx为2。
此外,在插入增强层图像码流之前,还可以对增强层图像码流进行封装。例如,手机中的编码器将增强层图像码流使用APP7(码流标记字符FF E7)应用段进行封装,由于JPEG规定应用段的长度不能超过0XFFFF,因此需要对增强层图像码流进行切割,然后再封装。上述封装字段仅为举例说明,具体实施时,可以是其他APP字段。
具体的,该方法100还包括:将增强层图像码流进行分割,并将分割后的码流进行封装;将增强层图像码流写入基本层图像码流中的预设字段,包括:将封装后的码流写入到预设字段,封装后的码流具有对应的码流标识信息。
手机中的编码器将增强层图像码流进行分割,并将分割后的码流,进行封装,插入到添加位置,增强层图像码流以及分割后的码流均具有对应的码流标识信息。
将增强层图像码流切割成多段后,每段就需要一定头信息来进行标记,头信息内容如图8所示,该段头信息用来描述增强层图像码流总的信息,未切割前的增强层图像码流,只记录一次。
图9示出了切割后每段增强层图像码流的头信息,每段增强层图像码流都有。
通过本申请实施例将增强层图像码流设置在基本层图像码流中,使得在不对图像进行后期编辑的情况下或者使用低位深的显示器浏览时,使用传统的图片浏览器,如,JPEG图片浏览器,就可以得到图像的基本层图像,大大提高了HDR图像的传播性。
在需要对图像进行编辑时,可以使用专有的图像浏览器可以得到HDR图像,并且该图像和在传统浏览器,如,JPEG图片浏览器,直接得到的基本层图像在视觉上是相似的,大大的简化了用户的编辑操作。
由于增强层图像使用本申请实施例中的编码方式进行编码,使得后续解码后的HDR图像具有逼近与原始图像的信息所以具有较大的后期编辑空间,从而给用户提供更多的创作空间和自由度。
具体的,若解码端可解码目标图像码流中的全部信息,可以得到一个接近于待处理图像的动态范围较高图像。由于待处理图像数据逼近原图图像信息量,因此具有较大的后期编辑空间。
以下为手机为例阐述本申请实施例的应用场景:用户可以通过手机进行 拍照,拍下一张风景照。该风景照是16bit的线性空间的图像。手机将获取到的16bit图像发送至手机中的编码器,使得编码器获取到该16bit图像。由编码器自主或者通过用户选择,从16bit图像数据中得到非线性空间的HDR图像数据:12bit图像数据,作为待处理图像数据。编码器再从12bit图像数据中得到8bit图像数据:基本层图像数据。再将12bit图像数据与8bit图像数据的残差,并对该残差进行补偿以及调整,得到补偿以及调整后的正整数图像数据,作为增强层图像数据。
编码器将基本层图像数据进行JPEG的编码规则进行编码,得到JPEG的码流。同时将增强层图像数据进行增强层图像的编码规则进行编码,增强层图像码流。将增强层图像码流封装到JPEG码流中的APP7应用段中,得到HDR图像数据的码流。手机可以对该码流进行存储。
用户可以选择将第一用户设备中的16bit图像发送至第二用户设备上进行后期编辑。第一用户设备将最终得到的码流发送至第二用户设备。第二用户设备通过其设置的解码器对该码流进行解码。
当第二用户设备仅支持普通的JPEG解码器时,只能对基本层数据进行解码,电脑仅获取出JPEG码流,并进行解码以及显示,此时显示的图像为基本层图像数据。
当第二用户设备不仅具由普通JPEG解码器,还具有对应上述增强层编码规则的解码规则的解码器时,可以从最终码流中取出增强层图像数据码流,并根据对应的解码规则进行解码,最终可以得到解码后的基本层图像数据以及解码后的增强层图像数据,并将两者进行组合得到HDR图像数据进行展示,以供用户进行后期编辑。
其中,上述用户设备可以为手机、云台相机、智能穿戴设备、无人机用户设备。上述第一设备可以是具有拍照功能的设备,其在拍照后即基于图1所示的方法进行编码处理得到目标图像码流。
目标图像码流可以自第一用户设备基于有线、无线,直接传输或者经多设备中继传输至第二用户设备。例如,第一用户设备可以将目标图像码流对应的文件传输至互联网服务器,第二用户设备从该互联网服务器下载对应的文件。
需要说明的是,本方法100中所涉及的各个步骤不限定顺序,可以不按照标号以及撰写的先后顺序进行,可以存在并发执行的可能。同时,该方法100 可以通过电子设备中的多个处理元器件并行工作来执行。
基于上述相似发明构思,图10为本发明实施例提供的一种数据处理方法的流程示意图;本申请实施例提供的该方法1000可以由可具有编码器的电子设备执行,该编码器可以设置在电子设备中,电子设备可以为,相机、无人机、手持云台、手机、平板电脑等,具有摄像或照相功能的电子设备均可。该方法1000包括以下步骤:
1001:获取待处理图像数据。
1002:从所述待处理图像数据提取预设数据量的基本层图像数据。
1003:基于所述待处理图像数据和所述基本层图像数据计算残差,确定增强层图像数据。
1004:基于第一预设编码规则对所述基本层图像数据进行编码,得到基本层图像码流。
1005:基于第二预设编码规则对所述增强层图像数据进行编码,得到增强层编码数据。
1006:将所述增强层编码数据写入所述基本层图像码流中的预设字段,以生成目标图像码流。
由于前文已经详细阐述过步骤1001-1006的具体实施方式,此处就不再赘述。
在一实施例中,所述待处理图像数据可以是是基于原始图像数据进行线性或非线性变换得到的。
在一实施例中,所述待处理图像数据为高动态范围的图像数据。所述原待处理图像数据包括线性图像数据或者非线性图像数据。所述线性图像数据可以是通过图像传感器采集的得到的图像数据。所述非线性图像数据可以是基于多张图像生成的高动态范围图像数据,也可以是通过图像传感器采集的得到的图像数据。
具体的,可以由图像传感器采集在短时间内对场景基于不同拍摄参多次曝光得到多张图像,将得到的多张图像合成为一张高动态范围的图像,作为步骤1001中获取的所述待处理图像数据。
由于前文已经阐述过了,此处就不再赘述。
另,所述待处理图像数据的数据量小于所述原始图像数据。
此外,所述第一预设编码规则为根据JPEG编码规则确定的编码规则。
其中,1002:从待处理图像数据提取预设数据量的基本层图像数据,可以包括:基于待处理图像数据进行线性变换,得到预设数据量的基本层图像数据。
由于前文已经阐述过了,此处就不再赘述。
另,本方法1000未能详细描述的内容,可以参照上述方法100中的各个步骤。
需要说明的是,本方法1000中所涉及的各个步骤不限定顺序,可以不按照标号以及撰写的先后顺序进行,可以存在并发执行的可能。同时,该方法1000可以通过电子设备中的多个处理元器件并行工作来执行。
基于上述相似发明构思,图11为本发明实施例提供的一种数据处理方法的流程示意图;本申请实施例提供的该方法1100可以由可具有解码器的电子设备执行,该解码器可以设置在电子设备中,电子设备可以为,相机、无人机、手持云台、手机、电脑等,具有摄像或照相功能的电子设备均可。该方法1100包括以下步骤:
1101:获取目标图像码流。
1102:基于第一预设解码规则对目标图像码流进行解码,得到基本层图像数据。
其中,第一预设解码规则是与第一预设编码规则对应的,即前文所设的第一预设编码规则,如根据JPEG编码规则确定的编码规则,相对的,第一预设解码规则可以是根据JPEG解码规则确定的解码规则。
例如,根据前文所述,电脑接收到用户手机发送的目标图像码流。电脑中的解码器获取该码流中的JPEG码流,然后根据JPEG解码规则确定的解码规则来对JPEG码流进行解码,得到基本层图像数据,以备进行展示。应理解,虽然该目标图像码流可以是JPEG码流的码流形式,但是由于其中还包含由增强层图像数据码流,所以在目标图像码流中除了包括JPEG码流外还有增强层图像数据码流。
此外,基本层图像数据用于生成基本层图像。
例如,根据前文所述,电脑中的解码器在获取到基本层图像数据后,可以根据该数据直接生成JPEG图像格式的基本层图像,可以通过电脑的显示屏进行展示。
另,该方法1100还包括:基于第二预设解码规则对目标码流进行解码,得到增强层图像数据;增强层图像数据用于配合基本层图像数据生成目标图 像,目标图像的动态范围大于基本层图像的动态范围。
其中,第二预设解码规则与第二预设编码规则对应的,即前文所设的第二预设编码规则。第二预设解码规则可以是第二预设编码规则的逆过程。
例如,根据前文所述,电脑中的解码器还可以从目标图像码流中的APP7应用段中得到增强层图像数据码流。其中,可以是将分割后的码流进行拼接成完整的增强层图像数据码流。在得到增强层图像数据码流后,解码器可以根据前文所述的增强层图像数据编码规则(即第二预设编码规则)的的逆过程进行解码,得到增强层图像数据。最终将增强层图像数据以及基本层图像数据进行结合,得到最终的HDR图像数据,并生成HDR图像进行展示。
另,本方法1100未能详细描述的内容,可以参照上述方法100中的各个步骤。
需要说明的是,本方法1100中所涉及的各个步骤不限定顺序,可以不按照标号以及撰写的先后顺序进行,可以存在并发执行的可能。同时,该方法1100可以通过电子设备中的多个处理元器件并行工作来执行。
图12为本发明实施例提供的一种数据处理装置的结构示意图;该装置1200可以应用于可具有编码器的电子设备中,例如,相机、无人机、手持云台、手机、平板电脑等,具有摄像和/或照相功能的电子设备均可。该装置1200包括:变换模块1201、提取模块1202、第一编码模块1203、确定模块1204、第二编码模块1205以及生成模块1206。以下针对各个模块的功能进行详细的阐述:
变换模块1201,用于获取原始图像数据,对原始图像数据做非线性图像变换处理得到待处理图像数据。
提取模块1202,用于从待处理图像数据或原始图像数据中提取预设数据量的基本层图像数据。
第一编码模块1203,用于基于第一预设编码规则对基本层图像数据进行编码,得到基本层图像码流。
确定模块1204,用于基于待处理图像数据和基本层图像数据计算残差,基于残差确定增强层图像数据。
第二编码模块1205,用于基于第二预设编码规则对增强层图像数据进行编码,得到增强层图像码流。
生成模块1206,用于将增强层图像码流写入基本层图像码流中的预设字 段,以生成目标图像码流。
其中,所述原始图像数据为高动态范围的图像数据。所述原始图像数据包括线性图像数据或者非线性图像数据。所述线性图像数据可以是通过图像传感器采集的得到的图像数据。所述非线性图像数据可以是基于多张图像生成的高动态范围图像数据,也可以是通过图像传感器采集的得到的图像数据。
此外,变换模块1201,还用于:对原始图像数据做线性图像变换处理得到待处理图像数据。
具体的,变换模块1201,具体用于:对原始图像数据做至少一次非线性图像变换处理得到待处理图像数据。
具体的,变换模块1201,包括:确定单元,用于基于图像精度损失,确定原始图像数据的非线性图像变换的目标;变换单元,用于基于非线性图像变换的目标,对原始图像做非线性图像变换处理得到待处理图像数据。
提取模块1202,用于:对待处理图像数据或原始图像数据做线性图像变换处理得到预设数据量的基本层图像数据。
此外,该装置1200:预处理模块,用于对基本层图像数据做预处理,得到预处理的基本层图像数据;确定模块1204,用于:基于待处理图像数据和预处理的基本层图像数据计算残差。
具体的,预处理模块,基于与第一预设编码规则对应的第一预设解码规则对基本层图像码流做解码处理,将解码得到数据作为预处理的所述基本层图像数据。
具体的,确定模块1204,用于:从待处理图像数据中减去预处理的基本层图像数据,得到残差。
具体的,确定模块1204,用于:基于残差,得到待保留数据;从待保留数据中选择保留数据,并作为所述增强层图像数据。
具体的,确定模块1204,用于:对保留数据进行调整,得到具有正整数数据的增强层图像数据。
具体的,确定模块1204,包括:对齐单元,用于将待处理图像数据所表示的动态范围与预处理的基本层图像数据所表示的动态范围进行对齐;补偿单元,用于通过增强层图像数据的动态范围与基本层图像数据的动态范围的比例,对对齐后的待处理图像数据进行补偿;第一确定单元,用于从将补偿后的待处理图像数据中减去预处理的基本层图像数据,得到残差。
此外,该装置1200还包括:加入模块,用于在基本层图像数据中加入随机噪声数据;确定模块1204,用于:基于待处理图像数据和加入随机噪声数据的基本层图像数据计算残差。
此外,加入模块,还用于在计算残差的过程中,加入随机噪声数据,以使得到的残差具有随机噪声数据。
此外,加入模块,还用于在计算出残差后,在残差中加入随机噪声数据。
其中,第一预设编码规则为根据JPEG编码规则确定的编码规则。
具体的,第二编码模块1205,用于基于基本层图像数据对增强层图像数据进行编码。
具体的,第二编码模块1205,用于根据基本层图像数据,确定反映增强层图像数据被压缩情况的第一信息;基于第一信息,对增强层图像数据进行编码。
具体的,第二编码模块1205,用于根据基本层图像数据的亮度分布情况,确定反映增强层图像数据被压缩情况的第一信息。
具体的,第二编码模块1205,包括:第二确定单元,用于确定划分增强层图像数据的图像数据频率的第二信息;量化单元,用于基于第一信息,对第二信息进行量化;编码单元,用于根据量化结果,对增强层图像数据进行编码。
具体的,编码单元,用于对量化结果进行扫描,并对扫描后的量化结果进行编码;得到增强层图像码流包括:基于编码结果生成增强层图像数据码流。
此外,该装置1200还包括:划分模块,用于对增强层图像数据进行划分,得到多组宏块,并将宏块划分为子块;确定模块1204,还用于:针对子块,确定子块对应的第二信息。
此外,划分模块,还用于对增强层图像数据进行划分,得到多组宏块,并将宏块划分为子块;该装置1200还包括:组合模块,用于基于多组宏块,组合生成切片图像数据;其中,编码单元,用于:根据预置扫描方式对各个子块中的量化结果进行扫描,得到第一扫描后的量化结果;针对切片图像数据,按照第一扫描后的量化结果顺序扫描切片图像数据中各个子块中的量化结果,得到第二扫描后的量化结果,作为最终的扫描后的量化结果。
具体的,第二编码模块1205,包括:划分单元,用于将基本层图像数据 划分为切片图像数据;第三确定单元,用于针对各个切片图像数据,确定对应的亮度分布情况;根据亮度分布情况,确定各个切片图像数据的量化参数。
具体的,第二编码模块1205,包括:划分单元,还用于将基本层图像数据划分为量化块;第三确定单元,用于针对各个量化块,确定对应的亮度分布情况;根据亮度分布情况,确定各个量化块的量化参数。
具体的,第三确定单元,用于:根据各个切片图像数据中亮度情况,确定高亮像素点个数;根据各个切片图像数据中亮度情况,确定暗处像素点个数;根据高亮像素点个数和/或暗处像素点个数,确定对应的亮度分布情况。
具体的,第三确定单元,用于:将基本层图像数据由YUV格式转换为RGB格式,并根据RGB格式的各个切片图像数据中亮度情况,确定高亮像素点个数;根据各个切片图像数据中亮度情况,确定暗处像素点个数,包括:根据YUV格式的各个切片图像数据中亮度情况,确定暗处像素点个数;根据高亮像素点个数和/或暗处像素点个数,确定对应的亮度分布情况。
具体的,第三确定单元,用于:根据亮度分布情况中的高亮像素点个数和/或暗处像素点个数,确定对应切片图像数据的量化参数。
其中,同一切片图像数据中的子块共享同一个量化参数。
此外,该装置1200还包括:分割模块,用于将增强层图像码流进行分割,并将分割后的码流进行封装;生成模块1206,用于:将封装后的码流写入到预设字段,封装后的码流具有对应的码流标识信息。
图13为本发明实施例提供的一种数据处理装置的结构示意图;该装置1300可以应用于可具有编码器的电子设备中,例如,相机、无人机、手持云台、手机、平板电脑等,具有摄像和/或照相功能的电子设备均可。该装置1300包括:获取模块1301、提取模块1302、确定模块1303、第一编码模块1304、第二编码模块1305以及生成模块1306。以下针对各个模块的功能进行详细的阐述:
获取模块1301,用于获取待处理图像数据。
提取模块1302,用于从所述待处理图像数据提取预设数据量的基本层图像数据。
确定模块1303,用于基于所述待处理图像数据和所述基本层图像数据计算残差,确定增强层图像数据。
第一编码模块1304,用于基于第一预设编码规则对所述基本层图像数据 进行编码,得到基本层图像码流。
第二编码模块1305,用于基于第二预设编码规则对所述增强层图像数据进行编码,得到增强层编码数据。
生成模块1306,用于将所述增强层编码数据写入所述基本层图像码流中的预设字段,以生成目标图像码流。
所述待处理图像数据是基于原始图像数据进行线性或非线性变换得到的。
另,所述待处理图像数据的数据量小于所述原始图像数据。
此外,所述第一预设编码规则为根据JPEG编码规则确定的编码规则。
其中,提取模块1302,用于:基于待处理图像数据进行线性变换,得到预设数据量的基本层图像数据。
需要注意的是,本实施例未详细描述的部分,可参考上述数据处理装置1200所示实施例的相关说明,在此不再赘述。
图14为本发明实施例提供的一种数据处理装置的结构示意图;该装置1400可以应用于可具有解码器的电子设备中,例如,相机、无人机、手持云台、手机、平板电脑等,具有摄像和/或照相功能的电子设备均可。该装置1400包括:获取模块1401、第一解码模块1402。以下针对各个模块的功能进行详细的阐述:
获取模块1401,用于获取目标图像码流。
第一解码模块1402,用于基于第一预设解码规则对目标图像码流进行解码,得到基本层图像数据。
其中,基本层图像数据用于生成基本层图像。
此外,该装置1400还包括:第二解码模块,用于基于第二预设解码规则对所述目标码流进行解码,得到增强层图像数据;增强层图像数据用于配合基本层图像数据生成目标图像,目标图像的动态范围大于基本层图像的动态范围。
需要注意的是,本实施例未详细描述的部分,可参考上述数据处理装置1200所示实施例的相关说明,在此不再赘述。
在一个可能的设计中,图12所示数据处理装置1200的结构可实现为一电子设备,该电子设备可以是,如相机、无人机、手持云台、手机、平板电脑等各种具有拍照或摄像功能的电子设备。如图15所示,该电子设备1500可以包括:一个或多个处理器1501、一个或多个存储器1502以及图像采集装置1503。 其中,存储器1502用于存储支持电子设备执行上述图1-图9所示实施例中提供的数据处理方法的程序。其中,图像采集装置1503,用于获取原始图像数据;处理器1501被配置为用于执行存储器1502中存储的程序。具体的,程序包括一条或多条计算机指令,其中,一条或多条计算机指令被处理器1501执行时能够实现如下步骤:
处理器1501运行存储器1502中存储的计算机程序以实现:
对原始图像数据做非线性图像变换处理得到待处理图像数据;从待处理图像数据或原始图像数据中提取预设数据量的基本层图像数据;基于第一预设编码规则对基本层图像数据进行编码,得到基本层图像码流;基于待处理图像数据和基本层图像数据计算残差,基于残差确定增强层图像数据;基于第二预设编码规则对增强层图像数据进行编码,得到增强层图像码流;将增强层图像码流写入基本层图像码流中的预设字段,以生成目标图像码流。
其中,所述原始图像数据为高动态范围的图像数据。所述原始图像数据包括线性图像数据或者非线性图像数据。所述线性图像数据可以是通过图像传感器采集的得到的图像数据。所述非线性图像数据可以是基于多张图像生成的高动态范围图像数据,也可以是通过图像传感器采集的得到的图像数据。
具体的,处理器1501,具体用于:对原始图像数据做至少一次非线性图像变换处理得到待处理图像数据。
此外,处理器1501,还用于:对原始图像数据做线性图像变换处理得到待处理图像数据。
具体的,处理器1501,具体用于:基于图像精度损失,确定原始图像数据的非线性图像变换的目标;基于非线性图像变换的目标,对原始图像做非线性图像变换处理得到待处理图像数据。
具体的,处理器1501,具体用于:对待处理图像数据或原始图像数据做线性图像变换处理得到预设数据量的基本层图像数据。
具体的,处理器1501,具体用于:对基本层图像数据做预处理,得到预处理的基本层图像数据;基于待处理图像数据和基本层图像数据计算残差,包括:基于待处理图像数据和预处理的基本层图像数据计算所述残差。
具体的,处理器1501,具体用于:基于与第一预设编码规则对应的第一预设解码规则对基本层图像码流做解码处理,将解码得到数据作为预处理的基本层图像数据。
具体的,处理器1501,具体用于:从待处理图像数据中减去预处理的基本层图像数据,得到所述残差。
具体的,处理器1501,具体用于:基于残差,得到待保留数据;从待保留数据中选择保留数据,并作为增强层图像数据。
具体的,处理器1501,对保留数据进行调整,得到具有正整数数据的增强层图像数据。
具体的,处理器1501,将待处理图像数据所表示的动态范围与预处理的基本层图像数据所表示的动态范围进行对齐;通过增强层图像数据的动态范围与基本层图像数据的动态范围的比例,对对齐后的待处理图像数据进行补偿;从将补偿后的待处理图像数据中减去所述预处理的基本层图像数据,得到残差。
此外,处理器1501,还用于:在基本层图像数据中加入随机噪声数据;处理器1501,具体用于:基于待处理图像数据和加入随机噪声数据的基本层图像数据计算残差。
此外,处理器1501,还用于:在计算残差的过程中,加入随机噪声数据,以使得到的残差具有随机噪声数据。
具体的,处理器1501,具体用于:在计算出残差后,在残差中加入随机噪声数据。
其中,第一预设编码规则为根据JPEG编码规则确定的编码规则。
具体的,处理器1501,具体用于:基于基本层图像数据对增强层图像数据进行编码。
具体的,处理器1501,具体用于:根据基本层图像数据,确定反映增强层图像数据被压缩情况的第一信息;基于第一信息,对增强层图像数据进行编码。
具体的,处理器1501,具体用于:根据基本层图像数据的亮度分布情况,确定反映增强层图像数据被压缩情况的第一信息。
具体的,处理器1501,具体用于:确定划分增强层图像数据的图像数据频率的第二信息;基于第一信息,对第二信息进行量化;根据量化结果,对增强层图像数据进行编码。
具体的,处理器1501,具体用于:对量化结果进行扫描,并对扫描后的量化结果进行编码;得到增强层图像码流包括:基于编码结果生成所述增强 层图像数据码流。
此外,处理器1501,还用于:对增强层图像数据进行划分,得到多组宏块,并将宏块划分为子块;针对子块,确定子块对应的第二信息。
此外,处理器1501,还用于:对增强层图像数据进行划分,得到多组宏块,并将宏块划分为子块;基于多组宏块,组合生成切片图像数据;处理器1501,具体用于:根据预置扫描方式对各个子块中的量化结果进行扫描,得到第一扫描后的量化结果;针对切片图像数据,按照第一扫描后的量化结果顺序扫描切片图像数据中各个子块中的量化结果,得到第二扫描后的量化结果,作为最终的扫描后的量化结果。
具体的,处理器1501,具体用于:将基本层图像数据划分为切片图像数据;针对各个切片图像数据,确定对应的亮度分布情况;根据亮度分布情况,确定各个切片图像数据的量化参数。
具体的,处理器1501,具体用于:将基本层图像数据划分为量化块;针对各个量化块,确定对应的亮度分布情况;根据亮度分布情况,确定各个量化块的量化参数。
具体的,处理器1501,具体用于:根据各个切片图像数据中亮度情况,确定高亮像素点个数;根据各个切片图像数据中亮度情况,确定暗处像素点个数;根据高亮像素点个数和/或暗处像素点个数,确定对应的亮度分布情况。
具体的,处理器1501,具体用于:将基本层图像数据由YUV格式转换为RGB格式,并根据RGB格式的各个切片图像数据中亮度情况,确定高亮像素点个数;根据各个切片图像数据中亮度情况,确定暗处像素点个数,包括:根据YUV格式的各个切片图像数据中亮度情况,确定暗处像素点个数;根据高亮像素点个数和/或暗处像素点个数,确定对应的亮度分布情况。
具体的,处理器1501,具体用于:根据亮度分布情况中的高亮像素点个数和/或暗处像素点个数,确定对应切片图像数据的量化参数。
其中,同一切片图像数据中的子块共享同一个量化参数。
此外,处理器1501,还用于:将增强层图像码流进行分割,并将分割后的码流进行封装;将增强层图像码流写入基本层图像码流中的预设字段,包括:将封装后的码流写入到预设字段,封装后的码流具有对应的码流标识信息。
另外,本发明实施例提供了一种计算机可读存储介质,存储介质为计算 机可读存储介质,该计算机可读存储介质中存储有程序指令,程序指令用于实现上述图1-图9的方法。
在一个可能的设计中,图13所示数据处理装置1300的结构可实现为一电子设备,该电子设备可以是,如相机、无人机、手持云台、手机、平板电脑等各种具有拍照或摄像功能的电子设备。如图16所示,该电子设备1600可以包括:一个或多个处理器1601、一个或多个存储器1602。其中,存储器1602用于存储支持电子设备执行上述图10所示实施例中提供的数据处理方法的程序。其中,处理器1601被配置为用于执行存储器1602中存储的程序。具体的,程序包括一条或多条计算机指令,其中,一条或多条计算机指令被处理器1601执行时能够实现如下步骤:
处理器1601运行存储器1602中存储的计算机程序以实现:获取待处理图像数据;从所述待处理图像数据提取预设数据量的基本层图像数据;基于所述待处理图像数据和所述基本层图像数据计算残差,确定增强层图像数据;基于第一预设编码规则对所述基本层图像数据进行编码,得到基本层图像码流;基于第二预设编码规则对所述增强层图像数据进行编码,得到增强层编码数据;将所述增强层编码数据写入所述基本层图像码流中的预设字段,以生成目标图像码流。
其中,所述待处理图像数据是基于原始图像数据进行线性或非线性变换得到的。
另,所述待处理图像数据的数据量小于所述原始图像数据。
此外,所述第一预设编码规则为根据JPEG编码规则确定的编码规则。
其中,处理器1601,用于:基于待处理图像数据进行线性变换,得到预设数据量的基本层图像数据。
需要注意的是,本实施例未详细描述的部分,可参考上述电子设备1500所示实施例的相关说明,在此不再赘述。
另外,本发明实施例提供了一种计算机可读存储介质,存储介质为计算机可读存储介质,该计算机可读存储介质中存储有程序指令,程序指令用于实现上述图10的方法。
在一个可能的设计中,图14所示数据处理装置1400的结构可实现为一电子设备,该电子设备可以是,如相机、无人机、手持云台、手机、平板电脑等各种具有拍照或摄像功能的电子设备。如图17所示,该电子设备1700可以 包括:一个或多个处理器1701、一个或多个存储器1702以及通信组件1703。其中,存储器1702用于存储支持电子设备执行上述图11所示实施例中提供的数据处理方法的程序。其中,通信组件1703,用于获取目标图像码流;处理器1701被配置为用于执行存储器1702中存储的程序。具体的,程序包括一条或多条计算机指令,其中,一条或多条计算机指令被处理器1701执行时能够实现如下步骤:
处理器1701运行存储器1702中存储的计算机程序以实现:
基于第一预设解码规则对目标图像码流进行解码,得到基本层图像数据。
其中,基本层图像数据用于生成基本层图像。
此外,处理器1701,还用于:基于第二预设解码规则对目标码流进行解码,得到增强层图像数据;增强层图像数据用于配合基本层图像数据生成目标图像,目标图像的动态范围大于基本层图像的动态范围。
需要注意的是,本实施例未详细描述的部分,可参考上述电子设备1500所示实施例的相关说明,在此不再赘述。
另外,本发明实施例提供了一种计算机可读存储介质,存储介质为计算机可读存储介质,该计算机可读存储介质中存储有程序指令,程序指令用于实现上述图11的方法。
以上各个实施例中的技术方案、技术特征在与本相冲突的情况下均可以单独,或者进行组合,只要未超出本领域技术人员的认知范围,均属于本申请保护范围内的等同实施例。
在本发明所提供的几个实施例中,应该理解到,所揭露的相关检测装置(例如:IMU)和方法,可以通过其它的方式实现。例如,以上所描述的遥控装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,遥控装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得计算机处理器(processor)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁盘或者光盘等各种可以存储程序代码的介质。
以上所述仅为本发明的实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。

Claims (67)

  1. 一种数据处理方法,其特征在于,包括:
    获取原始图像数据,对所述原始图像数据做非线性图像变换处理得到待处理图像数据;
    从所述待处理图像数据或所述原始图像数据中提取预设数据量的基本层图像数据;
    基于第一预设编码规则对所述基本层图像数据进行编码,得到基本层图像码流;
    基于所述待处理图像数据和所述基本层图像数据计算残差,基于所述残差确定增强层图像数据;
    基于第二预设编码规则对所述增强层图像数据进行编码,得到增强层图像码流;
    将所述增强层图像码流写入所述基本层图像码流中的预设字段,以生成目标图像码流。
  2. 根据权利要求1所述的方法,其特征在于,所述原始图像数据为高动态范围的图像数据。
  3. 根据权利要求1所述的方法,其特征在于,所述原始图像数据包括线性图像数据或者非线性图像数据。
  4. 根据权利要求1所述的方法,其特征在于,所述对所述原始图像数据做非线性图像变换处理得到待处理图像数据,包括:
    对所述原始图像数据做至少一次非线性图像变换处理得到待处理图像数据。
  5. 根据权利要求1所述的方法,其特征在于,所述对所述原始图像数据做非线性图像变换处理得到待处理图像数据,包括:
    基于图像精度损失,确定所述原始图像数据的非线性图像变换的目标;
    基于所述非线性图像变换的目标,对所述原始图像做非线性图像变换处理得到待处理图像数据。
  6. 根据权利要求1所述的方法,其特征在于,所述从所述待处理图像数据或所述原始图像数据中提取预设数据量的基本层图像数据,包括:
    对所述待处理图像数据或所述原始图像数据做线性图像变换处理得到预设数据量的基本层图像数据。
  7. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    对所述基本层图像数据做预处理,得到预处理的所述基本层图像数据;
    所述基于所述待处理图像数据和所述基本层图像数据计算残差,包括:
    基于所述待处理图像数据和预处理的所述基本层图像数据计算所述残差。
  8. 根据权利要求7所述的方法,其特征在于,所述基本层图像数据做预处理,得到预处理的所述基本层图像数据,包括:
    基于与所述第一预设编码规则对应的第一预设解码规则对所述基本层图像码流做解码处理,将解码得到数据作为所述预处理的所述基本层图像数据。
  9. 根据权利要求7所述的方法,其特征在于,所述基于所述待处理图像数据和预处理的所述基本层图像数据计算所述残差,包括:
    从所述待处理图像数据中减去所述预处理的基本层图像数据,得到所述残差。
  10. 根据权利要求1所述的方法,其特征在于,所述基于所述残差确定增强层图像数据,包括:
    基于所述残差,得到待保留数据;
    从所述待保留数据中选择保留数据,并作为所述增强层图像数据。
  11. 根据权利要求10所述的方法,其特征在于,所述从所述待保留数据中选择保留数据,并作为所述增强层图像数据,包括:
    对所述保留数据进行调整,得到具有正整数数据的增强层图像数据。
  12. 根据权利要求7所述的方法,其特征在于,所述基于所述待处理图像 数据和预处理的所述基本层图像数据计算所述残差,包括:
    将所述待处理图像数据所表示的动态范围与预处理的所述基本层图像数据所表示的动态范围进行对齐;
    通过所述增强层图像数据的动态范围与基本层图像数据的动态范围的比例,对对齐后的待处理图像数据进行补偿;
    从将补偿后的待处理图像数据中减去所述预处理的所述基本层图像数据,得到残差。
  13. 根据权利要求1所述的方法,其特征在于,所述方法还包括:在所述基本层图像数据中加入随机噪声数据;
    所述基于所述待处理图像数据和所述基本层图像数据计算残差,包括:
    基于所述待处理图像数据和加入随机噪声数据的基本层图像数据计算残差。
  14. 根据权利要求1所述的方法,其特征在于,所述方法还包括:在计算所述残差的过程中,加入随机噪声数据,以使得到的所述残差具有随机噪声数据。
  15. 根据权利要求1所述的方法,其特征在于,所述方法还包括:在计算出所述残差后,在所述残差中加入随机噪声数据。
  16. 根据权利要求1所述的方法,其特征在于,所述第一预设编码规则为根据JPEG编码规则确定的编码规则。
  17. 根据权利要求1所述的方法,其特征在于,所述基于第二预设编码规则对所述增强层图像数据进行编码,包括:
    基于所述基本层图像数据对所述增强层图像数据进行编码。
  18. 根据权利要求17所述的方法,其特征在于,所述基于所述基本层图像数据对所述增强层图像数据进行编码,包括:
    根据所述基本层图像数据,确定反映所述增强层图像数据被压缩情况的 第一信息;
    基于所述第一信息,对所述增强层图像数据进行编码。
  19. 根据权利要求17所述的方法,其特征在于,所述根据所述基本层图像数据,确定反映所述增强层图像数据被压缩情况的第一信息,包括:
    根据所述基本层图像数据的亮度分布情况,确定反映所述增强层图像数据被压缩情况的第一信息。
  20. 根据权利要求18所述的方法,其特征在于,所述基于所述第一信息,对所述增强层图像数据进行编码,包括:
    确定划分所述增强层图像数据的图像数据频率的第二信息;
    基于所述第一信息,对所述第二信息进行量化;
    根据量化结果,对所述增强层图像数据进行编码。
  21. 根据权利要求20所述的方法,其特征在于,根据量化结果,对所述增强层图像数据进行编码,包括:
    对量化结果进行扫描,并对扫描后的量化结果进行编码;
    得到增强层图像码流包括:基于编码结果生成所述增强层图像数据码流。
  22. 根据权利要求20所述的方法,其特征在于,所述方法还包括:
    对所述增强层图像数据进行划分,得到多组宏块,并将所述宏块划分为子块;
    针对所述子块,确定所述子块对应的所述第二信息。
  23. 根据权利要求21所述的方法,其特征在于,所述方法还包括:
    对所述增强层图像数据进行划分,得到多组宏块,并将所述宏块划分为子块;
    基于多组宏块,组合生成切片图像数据;
    其中,所述对量化结果进行扫描,包括:
    根据预置扫描方式对各个子块中的量化结果进行扫描,得到第一扫描后的量化结果;
    针对切片图像数据,按照第一扫描后的量化结果顺序扫描切片图像数据中各个子块中的量化结果,得到第二扫描后的量化结果,作为最终的扫描后的量化结果。
  24. 根据权利要求19所述的方法,其特征在于,所述根据所述基本层图像数据的亮度分布情况,确定反映所述增强层图像数据被压缩情况的第一信息,包括:
    将所述基本层图像数据划分为切片图像数据;
    针对各个切片图像数据,确定对应的亮度分布情况;
    根据所述亮度分布情况,确定各个切片图像数据的量化参数。
  25. 根据权利要求19所述的方法,其特征在于,所述根据所述基本层图像数据的亮度分布情况,确定反映所述增强层图像数据被压缩情况的第一信息,包括:
    将所述基本层图像数据划分为量化块;
    针对各个量化块,确定对应的亮度分布情况;
    根据所述亮度分布情况,确定各个量化块的量化参数。
  26. 根据权利要求24所述的方法,其特征在于,所述针对各个切片图像数据,确定对应的亮度分布情况,包括:
    根据各个切片图像数据中亮度情况,确定高亮像素点个数;
    根据各个切片图像数据中亮度情况,确定暗处像素点个数;
    根据高亮像素点个数和/或暗处像素点个数,确定对应的亮度分布情况。
  27. 根据权利要求26所述的方法,其特征在于,所述根据各个切片图像数据中亮度情况,确定高亮像素点个数,包括:
    将基本层图像数据由YUV格式转换为RGB格式,并根据RGB格式的各个切片图像数据中亮度情况,确定高亮像素点个数;
    根据各个切片图像数据中亮度情况,确定暗处像素点个数,包括:
    根据YUV格式的各个切片图像数据中亮度情况,确定暗处像素点个数;
    根据高亮像素点个数和/或暗处像素点个数,确定对应的亮度分布情况。
  28. 根据权利要求24所述的方法,其特征在于,所述根据所述亮度分布情况,确定各个切片图像数据的量化参数,包括:
    根据亮度分布情况中的高亮像素点个数和/或暗处像素点个数,确定对应切片图像数据的量化参数。
  29. 根据权利要求21所述的方法,其特征在于,同一切片图像数据中的子块共享同一个量化参数。
  30. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    将所述增强层图像码流进行分割,并将分割后的码流进行封装;
    将所述增强层图像码流写入所述基本层图像码流中的预设字段,包括:
    将封装后的码流写入到所述预设字段,所述封装后的码流具有对应的码流标识信息。
  31. 一种数据处理方法,其特征在于,包括:
    获取目标图像码流;
    基于第一预设解码规则对所述目标图像码流进行解码,得到基本层图像数据。
  32. 根据权利要求31所述的方法,其特征在于,所述基本层图像数据用于生成基本层图像。
  33. 根据权利要求31所述的方法,其特征在于,所述方法还包括:
    基于第二预设解码规则对所述目标码流进行解码,得到增强层图像数据;
    所述增强层图像数据用于配合所述基本层图像数据生成目标图像,所述目标图像的动态范围大于基本层图像的动态范围。
  34. 一种电子设备,存储器、处理器以及图像采集装置;
    所述存储器,用于存储计算机程序;
    所述图像采集装置,用于获取原始图像数据;
    所述处理器调用所述计算机程序,以实现如下步骤:
    对所述原始图像数据做非线性图像变换处理得到待处理图像数据;
    从所述待处理图像数据或所述原始图像数据中提取预设数据量的基本层图像数据;
    基于第一预设编码规则对所述基本层图像数据进行编码,得到基本层图像码流;
    基于所述待处理图像数据和所述基本层图像数据计算残差,基于所述残差确定增强层图像数据;
    基于第二预设编码规则对所述增强层图像数据进行编码,得到增强层图像码流;
    将所述增强层图像码流写入所述基本层图像码流中的预设字段,以生成目标图像码流。
  35. 根据权利要求34所述的设备,其特征在于,所述原始图像数据为高动态范围的图像数据。
  36. 根据权利要求34所述的设备,其特征在于,所述原始图像数据包括线性图像数据或者非线性图像数据。
  37. 根据权利要求34所述的设备,其特征在于,所述处理器,还用于:对所述原始图像数据做线性图像变换处理得到待处理图像数据。
  38. 根据权利要求34所述的设备,其特征在于,所述处理器,具体用于:
    基于图像精度损失,确定所述原始图像数据的非线性图像变换的目标;
    基于所述非线性图像变换的目标,对所述原始图像做非线性图像变换处理得到待处理图像数据。
  39. 根据权利要求34所述的设备,其特征在于,所述处理器,具体用于:对所述待处理图像数据或所述原始图像数据做线性图像变换处理得到预设数据量的基本层图像数据。
  40. 根据权利要求34所述的设备,其特征在于,所述处理器,具体用于:对所述基本层图像数据做预处理,得到预处理的所述基本层图像数据;
    所述基于所述待处理图像数据和所述基本层图像数据计算残差,包括:
    基于所述待处理图像数据和预处理的所述基本层图像数据计算所述残差。
  41. 根据权利要求40所述的设备,其特征在于,所述处理器,具体用于:基于与所述第一预设编码规则对应的第一预设解码规则对所述基本层图像码流做解码处理,将解码得到数据作为所述预处理的所述基本层图像数据。
  42. 根据权利要求40所述的设备,其特征在于,所述处理器,具体用于:从所述待处理图像数据中减去所述预处理的基本层图像数据,得到所述残差。
  43. 根据权利要求34所述的设备,其特征在于,所述处理器,具体用于:
    基于所述残差,得到待保留数据;
    从所述待保留数据中选择保留数据,并作为所述增强层图像数据。
  44. 根据权利要求43所述的设备,其特征在于,所述处理器,具体用于:对所述保留数据进行调整,得到具有正整数数据的增强层图像数据。
  45. 根据权利要求40所述的设备,其特征在于,所述处理器,具体用于:
    将所述待处理图像数据所表示的动态范围与预处理的所述基本层图像数据所表示的动态范围进行对齐;
    通过所述增强层图像数据的动态范围与基本层图像数据的动态范围的比例,对对齐后的待处理图像数据进行补偿;
    从将补偿后的待处理图像数据中减去所述预处理的所述基本层图像数据,得到残差。
  46. 根据权利要求34所述的设备,其特征在于,所述处理器,还用于:
    在所述基本层图像数据中加入随机噪声数据;
    所述处理器,具体用于:
    基于所述待处理图像数据和加入随机噪声数据的基本层图像数据计算残 差。
  47. 根据权利要求34所述的设备,其特征在于,所述处理器,还用于:
    在计算所述残差的过程中,加入随机噪声数据,以使得到的所述残差具有随机噪声数据。
  48. 根据权利要求34所述的设备,其特征在于,所述处理器,具体用于:
    在计算出所述残差后,在所述残差中加入随机噪声数据。
  49. 根据权利要求34所述的设备,其特征在于,所述第一预设编码规则为根据JPEG编码规则确定的编码规则。
  50. 根据权利要求34所述的设备,其特征在于,所述处理器,具体用于:
    基于所述基本层图像数据对所述增强层图像数据进行编码。
  51. 根据权利要求50所述的设备,其特征在于,所述处理器,具体用于:
    根据所述基本层图像数据,确定反映所述增强层图像数据被压缩情况的第一信息;
    基于所述第一信息,对所述增强层图像数据进行编码。
  52. 根据权利要求50所述的设备,其特征在于,所述处理器,具体用于:
    根据所述基本层图像数据的亮度分布情况,确定反映所述增强层图像数据被压缩情况的第一信息。
  53. 根据权利要求51所述的设备,其特征在于,所述处理器,具体用于:确定划分所述增强层图像数据的图像数据频率的第二信息;
    基于所述第一信息,对所述第二信息进行量化;
    根据量化结果,对所述增强层图像数据进行编码。
  54. 根据权利要求53所述的设备,其特征在于,所述处理器,具体用于:
    对量化结果进行扫描,并对扫描后的量化结果进行编码;
    得到增强层图像码流包括:基于编码结果生成所述增强层图像数据码流。
  55. 根据权利要求53所述的设备,其特征在于,所述处理器,还用于:
    对所述增强层图像数据进行划分,得到多组宏块,并将所述宏块划分为子块;
    针对所述子块,确定所述子块对应的所述第二信息。
  56. 根据权利要求54所述的设备,其特征在于,所述处理器,还用于:对所述增强层图像数据进行划分,得到多组宏块,并将所述宏块划分为子块;
    基于多组宏块,组合生成切片图像数据;
    所述处理器,具体用于:根据预置扫描方式对各个子块中的量化结果进行扫描,得到第一扫描后的量化结果;
    针对切片图像数据,按照第一扫描后的量化结果顺序扫描切片图像数据中各个子块中的量化结果,得到第二扫描后的量化结果,作为最终的扫描后的量化结果。
  57. 根据权利要求52所述的设备,其特征在于,所述处理器,具体用于:
    将所述基本层图像数据划分为切片图像数据;
    针对各个切片图像数据,确定对应的亮度分布情况;
    根据所述亮度分布情况,确定各个切片图像数据的量化参数。
  58. 根据权利要求56所述的设备,其特征在于,所述处理器,具体用于:
    将所述基本层图像数据划分为量化块;
    针对各个量化块,确定对应的亮度分布情况;
    根据所述亮度分布情况,确定各个量化块的量化参数。
  59. 根据权利要求57所述的设备,其特征在于,所述处理器,具体用于:根据各个切片图像数据中亮度情况,确定高亮像素点个数;
    根据各个切片图像数据中亮度情况,确定暗处像素点个数;
    根据高亮像素点个数和/或暗处像素点个数,确定对应的亮度分布情况。
  60. 根据权利要求59所述的设备,其特征在于,所述处理器,具体用于:将基本层图像数据由YUV格式转换为RGB格式,并根据RGB格式的各个切片图像数据中亮度情况,确定高亮像素点个数;
    根据各个切片图像数据中亮度情况,确定暗处像素点个数,包括:
    根据YUV格式的各个切片图像数据中亮度情况,确定暗处像素点个数;
    根据高亮像素点个数和/或暗处像素点个数,确定对应的亮度分布情况。
  61. 根据权利要求57所述的设备,其特征在于,所述处理器,具体用于:根据亮度分布情况中的高亮像素点个数和/或暗处像素点个数,确定对应切片图像数据的量化参数。
  62. 根据权利要求54所述的设备,其特征在于,同一切片图像数据中的子块共享同一个量化参数。
  63. 根据权利要求34所述的设备,其特征在于,所述处理器,还用于:
    将所述增强层图像码流进行分割,并将分割后的码流进行封装;
    将所述增强层图像码流写入所述基本层图像码流中的预设字段,包括:
    将封装后的码流写入到所述预设字段,所述封装后的码流具有对应的码流标识信息。
  64. 一种电子设备,存储器、处理器以及通信组件;
    所述存储器,用于存储计算机程序;
    所述通信组件,用于获取目标图像码流;
    所述处理器调用所述计算机程序,以实现如下步骤:
    基于第一预设解码规则对所述目标图像码流进行解码,得到基本层图像数据。
  65. 根据权利要求64所述的设备,其特征在于,所述基本层图像数据用于生成基本层图像。
  66. 根据权利要求64所述的设备,其特征在于,所述处理器,还用于:
    基于第二预设解码规则对所述目标码流进行解码,得到增强层图像数据;
    所述增强层图像数据用于配合所述基本层图像数据生成目标图像,所述目标图像的动态范围大于基本层图像的动态范围。
  67. 一种计算机可读存储介质,其特征在于,所述存储介质为计算机可读存储介质,该计算机可读存储介质中存储有程序指令,所述程序指令用于实现权利要求1-33中任意一项所述的方法。
PCT/CN2020/121666 2020-10-16 2020-10-16 数据处理方法、设备和存储介质 WO2022077489A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/121666 WO2022077489A1 (zh) 2020-10-16 2020-10-16 数据处理方法、设备和存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/121666 WO2022077489A1 (zh) 2020-10-16 2020-10-16 数据处理方法、设备和存储介质

Publications (1)

Publication Number Publication Date
WO2022077489A1 true WO2022077489A1 (zh) 2022-04-21

Family

ID=81208892

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/121666 WO2022077489A1 (zh) 2020-10-16 2020-10-16 数据处理方法、设备和存储介质

Country Status (1)

Country Link
WO (1) WO2022077489A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090148054A1 (en) * 2007-12-06 2009-06-11 Samsung Electronics Co., Ltd. Method, medium and apparatus encoding/decoding image hierarchically
CN103535038A (zh) * 2011-05-16 2014-01-22 杜比实验室特许公司 用于分层vdr编码的有效架构
CN103918274A (zh) * 2011-11-01 2014-07-09 杜比实验室特许公司 对具有扩展动态范围的图像的分层编码中的自适应伪轮廓预防
CN111491168A (zh) * 2019-01-29 2020-08-04 华为软件技术有限公司 视频编解码方法、解码器、编码器和相关设备

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090148054A1 (en) * 2007-12-06 2009-06-11 Samsung Electronics Co., Ltd. Method, medium and apparatus encoding/decoding image hierarchically
CN103535038A (zh) * 2011-05-16 2014-01-22 杜比实验室特许公司 用于分层vdr编码的有效架构
CN103918274A (zh) * 2011-11-01 2014-07-09 杜比实验室特许公司 对具有扩展动态范围的图像的分层编码中的自适应伪轮廓预防
CN111491168A (zh) * 2019-01-29 2020-08-04 华为软件技术有限公司 视频编解码方法、解码器、编码器和相关设备

Similar Documents

Publication Publication Date Title
US8213498B2 (en) Bitrate reduction techniques for image transcoding
CN110933431B (zh) 针对视频译码处理高动态范围及广色域视频数据
CN112040240B (zh) 数据处理方法、设备和存储介质
US10805606B2 (en) Encoding method and device and decoding method and device
WO2010004726A1 (ja) 画像符号化方法、画像復号方法、画像符号化装置、画像復号装置、プログラム、及び集積回路
US11076172B2 (en) Region-of-interest encoding enhancements for variable-bitrate compression
US8675984B2 (en) Merging multiple exposed images in transform domain
US11076164B2 (en) Video camera with rate control video compression
AU2011213266A1 (en) High dynamic range image generation and rendering
WO2018196864A1 (zh) 图像预测方法和相关产品
GB2421137A (en) Image compression using a quantization parameter determined according to a focus value
Perra et al. Light field compression on sliced lenslet array
US20110116725A1 (en) Data compression method and data compression system
CN114467298B (zh) 一种图像信号转换处理方法、装置及终端设备
WO2022151053A1 (zh) 数据处理方法、装置及系统、计算机存储介质
WO2023093768A1 (zh) 图像处理方法和装置
WO2022077489A1 (zh) 数据处理方法、设备和存储介质
CN108156461A (zh) 一种Bayer图像压缩方法及装置
Gommelet et al. Rate-distortion optimization of a tone mapping with SDR quality constraint for backward-compatible high dynamic range compression
KR20210103562A (ko) 인트라 예측을 위한 교차-성분 선형 모델링의 방법 및 장치
JP2001292449A (ja) 画像処理装置、画像処理方法、及び記録媒体
Hanhart et al. Evaluation of JPEG XT for high dynamic range cameras
CN116886917A (zh) 增益图编码方法、解码方法、装置、设备及介质
TW202139692A (zh) 用於解碼圖片緩衝器管理和動態範圍的動態範圍調整參數的信號傳遞
Dwivedi Design of JPEG Compressor

Legal Events

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

Ref document number: 20957267

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20957267

Country of ref document: EP

Kind code of ref document: A1