WO2018196502A1 - 图片转码方法和装置 - Google Patents

图片转码方法和装置 Download PDF

Info

Publication number
WO2018196502A1
WO2018196502A1 PCT/CN2018/079443 CN2018079443W WO2018196502A1 WO 2018196502 A1 WO2018196502 A1 WO 2018196502A1 CN 2018079443 W CN2018079443 W CN 2018079443W WO 2018196502 A1 WO2018196502 A1 WO 2018196502A1
Authority
WO
WIPO (PCT)
Prior art keywords
picture
source
quality parameter
target
quality
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2018/079443
Other languages
English (en)
French (fr)
Inventor
黄晓政
王诗涛
罗斌姬
刘海军
丁飘
陈新星
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Publication of WO2018196502A1 publication Critical patent/WO2018196502A1/zh
Priority to US16/504,764 priority Critical patent/US10904542B2/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

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/40Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using video transcoding, i.e. partial or full decoding of a coded input stream followed by re-encoding of the decoded output stream
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • H04N19/126Details of normalisation or weighting functions, e.g. normalisation matrices or variable uniform quantisers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/132Sampling, masking or truncation of coding units, e.g. adaptive resampling, frame skipping, frame interpolation or high-frequency transform coefficient masking
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/154Measured or subjectively estimated visual quality after decoding, e.g. measurement of distortion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/172Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a picture, frame or field
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock

Definitions

  • the present application relates to the field of image processing, and in particular, to a picture transcoding method and apparatus.
  • JPEG Joint Photographic Experts Group
  • the usual practice is to transcode the original image format into a more efficient image format for transmission and storage.
  • the transcoding refers to converting the original picture that has been compressed into another picture format.
  • the embodiment of the present invention provides a method and a device for transcoding a picture, which can avoid the problem of waste of storage resources or network transmission resources caused by a large amount of data of a picture file after transcoding.
  • An embodiment of the present application provides a picture transcoding method, where the method includes:
  • the embodiment of the present application further provides a picture transcoding device, where the device includes:
  • the memory readable instruction module is stored in the memory;
  • the machine readable instruction module includes:
  • a source image quality obtaining module configured to obtain a source image quality parameter of the source image, where the source image is a picture to be transcoded, and the source image quality parameter is used to represent an image quality of the source image;
  • the target quality obtaining module And acquiring, by the target quality obtaining module, a target picture quality parameter of the target picture format corresponding to the source picture quality parameter of the source picture according to the source picture quality parameter and the preset mapping relationship;
  • the picture transcoding module transcodes the source picture according to the target picture quality parameter to obtain a target picture in a target picture format.
  • the embodiment of the present application also provides a non-transitory computer readable storage medium, wherein the storage medium stores machine readable instructions, which are executable by a processor to perform the above method.
  • the embodiment of the present application dynamically performs image transcoding according to the quality parameter of the source picture by using the corresponding quality configuration, thereby avoiding waste of storage resources or network transmission resources caused by the high quality configuration resulting in a large amount of image files after transcoding.
  • FIG. 1 is a schematic flowchart of an implementation process of a picture transcoding method in an embodiment of the present application
  • FIG. 2 is a schematic diagram of picture transcoding in the embodiment of the present application.
  • FIG. 3 is a schematic diagram of a picture transcoding process in the embodiment of the present application.
  • FIG. 4 is a schematic flowchart of an implementation process of a picture transcoding method in another embodiment of the present application.
  • FIG. 5 is a schematic flowchart of an implementation process of a source image quality parameter obtaining method in an embodiment of the present application
  • FIG. 6 is a schematic flowchart of an implementation process of a picture transcoding method in another embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of a picture transcoding device in an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of a source image quality obtaining module in a picture transcoding device according to an embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of a target quality acquiring module in a picture transcoding device according to an embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of a picture transcoding module in a picture transcoding device according to an embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of a hardware component of a picture transcoding device according to an embodiment of the present application.
  • FIG. 12 is a schematic structural diagram of a picture transcoding device in another embodiment of the present application.
  • FIG. 13 is a schematic structural diagram of a mapping relationship obtaining module of a picture transcoding device according to an embodiment of the present application.
  • FIG. 14 is a schematic structural diagram of still another hardware component of a picture transcoding device according to an embodiment of the present application.
  • 15 is a schematic structural diagram of a source image quality obtaining apparatus in an embodiment of the present application.
  • FIG. 16 is a schematic structural diagram of a hardware component of a source image quality obtaining apparatus in the embodiment of the present application.
  • the picture transcoding method in the embodiment of the present application can be implemented in various types of personal terminals or network back-end servers to perform image transcoding processing on existing pictures, and the following describes the picture transcoding device as an execution subject, the personal terminal.
  • the web background server may be a web server, a cloud storage server, a picture management server or an instant messaging server, a social application server, or the like.
  • the picture transcoding method proposed by the present application can be used as long as it involves scenes in which a picture needs to be stored or transmitted.
  • FIG. 1 is a schematic flowchart of an implementation process of a picture transcoding method in the embodiment of the present application.
  • the process of the picture transcoding method in this embodiment may include:
  • the source picture refers to a picture that needs to be transcoded.
  • the source map quality parameter represents the image quality of the source image, and the image quality may refer to the quality of the image, or the degree of distortion of the image, which generally reflects the evaluation of the visual perception of a picture, which may include subjective evaluation and objective evaluation.
  • Subjective evaluation is subjective scoring directly by the evaluator's image quality of the image to be evaluated.
  • the objective evaluation is to calculate the image quality score of the image through computer algorithm, and the image quality evaluation can also be divided into reference image quality.
  • reference image quality generally refers to the degree of error of the measured image (ie, the target image) relative to the standard image (ie, the original image), and the non-reference image quality is only the evaluation method for the image itself.
  • Commonly used image quality evaluation algorithms may include: structural similarity SSIM (structural similarity) algorithm, mean square error (MSE) algorithm, information fidelity criterion (IFC) algorithm and visual information fidelity ( VIF, visual information fidelity) algorithm.
  • the picture transcoding device may obtain the source picture quality parameter of the source picture in the above manner, or may receive the result of the source picture quality parameter from other devices or channels, such as manually inputting or receiving the source picture quality of the source picture from the third device or the network server. parameter.
  • the picture transcoding device may obtain a source picture quality parameter of the source picture by acquiring a quantization matrix of the source picture, and then comparing the quantization matrix of the source picture with a preset standard quantization matrix.
  • the picture transcoding device may obtain, according to a ratio between each coefficient in the quantization matrix of the source picture and a coefficient of a corresponding position in the preset standard quantization matrix, between the quantization matrix of the source picture and the standard quantization matrix.
  • the difference coefficient value, and then normalizing the difference coefficient value according to a preset normalization algorithm to obtain the source image quality parameter for example, the source image quality parameter obtained by the normalization process is a value of 0 to 100
  • This method can be applied to obtain the source picture quality parameter of the source picture in a picture format such as JPEG. The implementation process of this mode will be specifically described below by referring to FIG.
  • the picture transcoding device may acquire a quantization parameter (QP) of each pixel macroblock Macroblock in the source picture, and acquire a source picture quality parameter of the source picture.
  • the method may further include: obtaining a picture quantization parameter of the source picture according to the quantization parameter of each pixel macroblock in the source picture, and determining the source picture quality parameter according to the picture quantization parameter of the source picture (again, for example, normalization processing)
  • the obtained source image quality parameter is a value of 0 to 100).
  • This method can be applied to obtain the source image quality parameter of the source image of the image of the image format such as WebP (a picture format developed by Google google to speed up the image loading speed). The implementation process of this mode will be specifically described below by referring to FIG. 6.
  • the quality parameter configuration used by the picture transcoding device to transcode the source picture should match the quality parameter of the source picture.
  • the matching mentioned here may be the same, that is, the target picture quality parameter of the target picture format and the source of the source picture.
  • the graph quality parameters are the same, and may also be different mapping relationships, for example, a mapping formula for calculating quality parameters of the target image format according to the quality parameters of the source image.
  • the target picture quality parameter of the target picture can also be used to represent the image quality of the target picture, for example, the quantization parameter QP of the target picture, and the smaller the QP, the higher the image quality of the target picture.
  • the picture transcoding device transcodes the source picture according to the source picture quality parameter to obtain a target picture in a target picture format, a target picture quality parameter of the target picture and the source picture quality parameter.
  • Matching can include:
  • the picture transcoding device acquires a target picture quality parameter of the target picture format corresponding to the source picture quality parameter of the source picture according to a mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format.
  • the mapping relationship between the quality parameter of the source image format and the quality parameter of the target image format may include at least one quality parameter sample value of the source image format and a target corresponding to each quality parameter sample value of the source image format. The correspondence between the quality parameters of the picture format.
  • the picture transcoding device may traverse each quality parameter sample value of the at least one quality parameter sample value of the source picture format as a target quality sample value, and adopt different code transcoding qualities for the source picture of the target quality parameter sample value respectively.
  • the parameter is transcoded to obtain transcoded pictures of multiple target picture formats respectively corresponding to the plurality of different transcoding quality parameters.
  • the picture transcoding device compares the respective transcoded pictures with the source picture of the target quality parameter sample value, and selects, in the plurality of transcoded pictures, the transcoding that the image quality meets the preset quality requirement and the image data amount is the smallest.
  • the picture transcoding device may obtain a target picture format corresponding to each quality parameter sample value. Quality parameters.
  • the source picture quality parameter of the source picture may be found in the mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format. And the quality parameter of the target picture format corresponding to the quality parameter sample value is used as the target picture quality parameter of the target picture format corresponding to the source picture quality parameter of the source picture.
  • the mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format includes a mapping formula for calculating a quality parameter of the target picture format according to a quality parameter of the source picture format.
  • the picture transcoding device may train the mapping formula by using the quality parameter of the transcoded picture of the multiple target picture formats and the source picture quality parameter of the corresponding source picture as training parameters, so that the trained The mapping formula approximates a correspondence between a quality parameter of the plurality of transcoded pictures and a source picture quality parameter of the corresponding source picture.
  • the picture transcoding device transcodes the source picture according to the target picture quality parameter to obtain a target picture in a target picture format.
  • the picture transcoding device transcodes the source picture according to the target picture quality parameter to obtain a target picture of the target picture format, which may further include as shown in FIG. 3:
  • the target picture format is BPG
  • the picture file can be compressed less under the same quality conditions.
  • the quality of the picture after transcoding is not higher than the picture quality of the source picture format.
  • the source image is also a lossy compressed image format
  • the quality configuration setting of the target image format does not match the source image, such as the source image quality configuration is low, and the target image quality configuration is higher, according to (3) the quality of the target image is not higher than the source image; and according to (2),
  • the target image retains more unnecessary distortion information, and the target image file data is redundant, resulting in waste of data storage resources or network transmission resources. In this case, even if the target image format is more efficient, it is not necessarily Can not achieve the effect of (1).
  • the quality configuration performs image transcoding, thereby maximizing the retention of more pixel content and avoiding waste of storage resources or network transmission resources caused by data redundancy.
  • the picture is transcoded according to the quality parameter of the source picture, so that when the source picture quality configuration is low, the high quality configuration of the target picture is caused, and the data of the picture file after the transcoding is redundant. Waste of storage resources or network transmission resources.
  • FIG. 4 is a schematic flowchart of an implementation process of a picture transcoding method in another embodiment of the present application. As shown in the figure, the process of the picture transcoding method in this embodiment includes:
  • the mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format may include at least one quality parameter sample value of the source picture format and corresponding to each quality parameter sample value of the source picture format. The correspondence between the quality parameters of the target image format.
  • the picture transcoding device may traverse each quality parameter sample value of the at least one quality parameter sample value of the source picture format as a target quality sample value, and adopt different code transcodings for the source picture of the target quality parameter sample value respectively.
  • the quality parameter is transcoded to obtain transcoded pictures of multiple target picture formats respectively corresponding to the plurality of different transcoding quality parameters.
  • the sample value of the at least one quality parameter of the source picture format may be (5, 10, 15, 20, 25, 30...85, 90, 95) In other embodiments, more or some of the quality parameter sample values may be selected as needed.
  • the value interval of the transcoding quality parameter in the range of 0-100 is taken as an example.
  • the picture transcoding device adopts (5, 10, 15, 20, 25, 30...85, respectively.
  • the transcoding quality parameters of 90, 95) are transcoded to obtain transcoded pictures corresponding to 19 transcoding quality parameters, respectively.
  • the picture transcoding device compares the respective transcoded pictures with the source picture of the target quality parameter sample value, and confirms the transcoding in the plurality of transcoded pictures that the image quality meets the preset quality requirement and the image data amount is the smallest.
  • a picture, and the transcoding quality parameter corresponding to the transcoded picture whose image quality meets the preset quality requirement and the minimum amount of picture data is used as the quality parameter of the target picture format corresponding to the target quality parameter sample value.
  • the picture transcoding device compares each transcoded picture with the source picture of the target quality parameter sample value to obtain a difference in picture content between each transcoded picture and the source picture. The larger the difference, the more the image quality of the transcoded picture is. Low, then the above example obtains the transcoding pictures corresponding to the 19 transcoding quality parameters. If the preset quality requirement is that the difference between the picture content between the transcoded picture and the source picture does not exceed 10%, then the picture transcoding device is The transcoded picture corresponding to the 19 transcoding quality parameters is used to find a transcoded picture that meets the preset quality requirement, for example, the transcoded picture corresponding to the QP of 5, 10, and 15 satisfies the difference between the picture content and the source picture.
  • the picture transcoding device sets the QP to 15 as the quality parameter of the target picture format corresponding to the sampled value of the target quality parameter.
  • the picture transcoding device may obtain a target picture format corresponding to each quality parameter sample value. Quality parameters.
  • the mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format includes a mapping formula for calculating a quality parameter of the target picture format according to a quality parameter of the source picture format, and the picture transcoding device
  • the mapping formula may be trained by using the quality parameters of the transcoded pictures of the plurality of target picture formats and the source picture quality parameters of the corresponding source pictures as training parameters, so that the trained mapping formula approximates the plurality of The correspondence between the quality parameters of the transcoded pictures and the source picture quality parameters of the corresponding source pictures.
  • the quality parameters of the transcoded picture of the target picture format and the source picture quality parameter of the corresponding source picture which are determined by the plurality of sets of known transcoding efficiencies, between the quality parameter of the source picture and the quality parameter of the target picture format.
  • the mapping relationship is trained, as shown in Figure 2, the image is transcoded, the source image format is JPEG, the target image format is BPG (Better Portable Graphics, better portable graphics), and the source image quality parameters of the source image are normalized.
  • the value is 0 to 100. The larger the value is, the higher the image quality of the source picture is.
  • the quantization parameter QP is used as the target picture quality parameter to represent the image quality of the picture after transcoding.
  • the source picture quality parameter of the A picture is 80, and the quality parameter of the corresponding A picture after transcoding is 24;
  • the source picture quality parameter of the picture is 70, and the quality parameter of the corresponding B picture after transcoding is 27;
  • the source picture quality parameter of the C picture is 60, and the quality parameter of the corresponding B picture after transcoding is 24, that
  • the three groups transcoded image quality parameters corresponding source image quality parameter can be a source of FIG prediction formula calculation map format image quality parameter according to the target quality parameter for the source image:
  • the DQP is the quality parameter of the BPG picture after transcoding
  • the SQP is the source picture quality parameter of the JPEG format normalized to the value 0 ⁇ 100.
  • mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format and the mapping relationship between the quality parameter of the source picture and the quality parameter of the target picture format are only For example, those skilled in the art may obtain more training modes and more mapping relationships between quality parameters of the source picture and quality parameters of the target picture format according to the content disclosed in the embodiments of the present application, for example, a simpler mapping. relationship:
  • N is a set constant value, or a trained constant value.
  • the mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format includes at least one quality parameter sample value of the source picture format and a target corresponding to each quality parameter sample value of the source picture format.
  • the quality parameter of the picture format, the picture transcoding device may search for the source picture in a mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format when the source picture needs to be transcoded.
  • the source parameter quality parameter is the closest quality parameter sample value, and the quality parameter of the target picture format corresponding to the quality parameter sample value is used as the target picture quality parameter of the target picture format corresponding to the source picture quality parameter of the source picture.
  • the picture transcoding device is in a mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format.
  • the quality parameter of the target picture format corresponding to the quality parameter sampling value is 55, and the quality parameter of the target picture format corresponding to the quality parameter sampling value of 55 is determined as the target picture quality parameter of the target picture format of the current transcoding.
  • the mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format includes calculating a mapping formula of the quality parameter of the target picture format according to the quality parameter of the source picture format
  • the picture transcoding device When the source picture needs to be transcoded, the source picture quality parameter of the source picture may be substituted into the mapping formula to calculate the target picture quality parameter of the target picture format of the current transcoding.
  • transcoding the source image may include:
  • the source picture is decoded into original pixel data, for example, RGB original pixel data is decoded, and if the source picture is in JPEG format, the JPEG picture data is decoded to obtain RGB original pixel data.
  • the original pixel data is re-encoded according to the target picture quality parameter to obtain a target picture in a target picture format.
  • the target picture format is BPG
  • the BPG picture is encoded according to the decoded original pixel data
  • the coding quality configuration of the BPG picture is determined according to the target picture quality parameter.
  • the picture is transcoded according to the quality parameter of the source picture, so that when the source picture quality configuration is low, the high quality configuration of the target picture is caused, and the data of the picture file after the transcoding is redundant. Waste of storage resources or network transmission resources.
  • FIG. 5 is a schematic flowchart of an implementation process of a source image quality parameter obtaining method in the embodiment of the present application, where the source method quality parameter obtaining method in the embodiment includes:
  • the quantization matrix may be an 8 ⁇ 8 matrix of quantized coefficients, and in other embodiments may be a matrix of 16 ⁇ 16 or other sizes, as shown below:
  • the picture transcoding device may obtain an 8x8 quantization matrix of JPEG by parsing a DQT (Define Quantization Table) in the JPEG file data, usually a data segment starting with DQT in the JPEG file data.
  • DQT Deform Quantization Table
  • the JPEG picture may include more than one quantization matrix, for example, including a luminance quantization matrix and a color quantization matrix.
  • a luminance quantization matrix for example, including a luminance quantization matrix and a color quantization matrix.
  • the present embodiment only uses a luminance quantization matrix as an example for description.
  • S402. Acquire a source picture quality parameter of the source picture by comparing a quantization matrix of the source picture with a preset standard quantization matrix.
  • the picture transcoding device may obtain, according to a ratio between each coefficient in the quantization matrix of the source picture and a coefficient of a corresponding position in the preset standard quantization matrix, between the quantization matrix of the source picture and the standard quantization matrix.
  • the difference coefficient value may be obtained, according to a ratio between each coefficient in the quantization matrix of the source picture and a coefficient of a corresponding position in the preset standard quantization matrix, between the quantization matrix of the source picture and the standard quantization matrix. The difference coefficient value.
  • the preset standard quantization matrix may be a quantization matrix that is pre-determined according to a mental vision valve and has an image coding quality effect on brightness or chrominance of a JPEG picture to a specified standard.
  • the luminance standard quantization matrix can be:
  • the chrominance standard quantization matrix can be:
  • the picture transcoding device can calculate the ratio between the luminance quantization matrix of the source picture and the coefficient of the corresponding position in the luminance standard quantization matrix, and obtain the difference between the quantization matrix of the source picture and the standard quantization matrix. Coefficient value.
  • a specific algorithm for obtaining a difference coefficient value between the quantization matrix of the source picture and the standard quantization matrix may be as follows:
  • the picture transcoding device can normalize the difference coefficient value SUM according to a preset normalization algorithm to obtain a source picture quality parameter.
  • the picture transcoding device may normalize the difference coefficient value according to a preset normalization algorithm to obtain a source picture quality parameter in a range of 0 to 100 values.
  • the normalization algorithm can for example:
  • JPEG quality parameter Q (200.0-SUM) / 2.0;
  • the picture transcoding device can obtain the source picture quality parameter of the source picture by comparing the difference between the luminance quantization matrix of the source picture and the preset brightness standard quantization matrix.
  • the picture transcoding device can also compare the source.
  • the difference between the chrominance quantization matrix of the image and the preset chrominance standard quantization matrix results in the source image quality parameter of the source image, or the difference between the luminance quantization matrix of the source image and the preset luminance standard quantization matrix, and the source
  • the difference between the chrominance quantization matrix of the image and the preset chrominance standard quantization matrix, and the source image quality parameter of the source image is calculated comprehensively, which is not detailed in the embodiment of the present application.
  • the image transcoding device may transcode the source image according to the source image quality parameter to obtain a target image in a target image format.
  • the target picture quality parameter of the target picture matches the source picture quality parameter.
  • the target image that is transcoded to obtain the target image format according to the source image quality parameter may further include:
  • the embodiment of the present application provides a method for obtaining a source picture quality parameter of a source picture, so as to quickly and accurately obtain a source picture quality configuration of the source picture when the picture needs to be transcoded, thereby dynamically according to the source picture.
  • the source map quality configuration transcodes the image.
  • FIG. 5 is a schematic flowchart of an implementation process of a picture transcoding method in another embodiment of the present application. As shown in the figure, the process of the picture transcoding method in this embodiment may include:
  • the source picture may be divided into a plurality of pixel macroblocks, each of which has its own quantization parameter, for example, averaging the quantization parameters of each pixel macroblock in the source picture to obtain a source.
  • the picture quantization parameter of the picture in some embodiments, the picture quantization parameter of the source picture may be directly used as the source picture quality parameter, or the picture quantization parameter of the source picture may be normalized by a specific normalization algorithm. To obtain the source map quality parameters of the normalized source image.
  • the quality parameter configuration used by the picture transcoding device to transcode the source picture should match the quality parameter of the source picture.
  • the matching mentioned here may be the same, that is, the target picture quality parameter of the target picture format and the source of the source picture.
  • the graph quality parameters are the same, and may also be different mapping relationships, for example, a mapping formula for calculating quality parameters of the target image format according to the quality parameters of the source image.
  • the picture quantization parameter of the source picture is directly used as the source picture quality parameter, and the quantization parameter QP is used as the target picture quality parameter to represent the image quality of the transcoded picture, then the mapping between the quality parameter of the source picture and the quality parameter of the target picture format is performed.
  • the relationship can be:
  • N is a set constant value, or a trained constant value.
  • transcoding the source image may include:
  • the source picture is decoded into original pixel data, for example, RGB original pixel data is decoded, and if the source picture is in JPEG format, the JPEG picture data is decoded to obtain RGB original pixel data.
  • the original pixel data is re-encoded according to the target picture quality parameter to obtain a target picture in a target picture format.
  • the target picture format is BPG
  • the BPG picture is encoded according to the decoded original pixel data
  • the coding quality configuration of the BPG picture is determined according to the target picture quality parameter.
  • the source picture quality parameter of the source picture is obtained according to the quantization parameter of each pixel macroblock in the source picture, and then the picture is transcoded according to the quality parameter of the source picture, so that the source picture quality configuration can be avoided.
  • the higher quality configuration of the target image leads to waste of storage resources or network transmission resources caused by redundancy of the image file data after transcoding.
  • FIG. 7 is a schematic structural diagram of a picture transcoding apparatus in the embodiment of the present application.
  • the picture transcoding apparatus in this embodiment may at least include: a source picture quality obtaining module 510, a target quality acquiring module 520, and a picture.
  • Transcoding module 530 may be included in the picture transcoding apparatus in this embodiment.
  • the source map quality obtaining module 510 is configured to obtain a source map quality parameter of the source image.
  • the source map quality parameter represents the image quality of the source image, and the image quality generally reflects the evaluation of the visual perception of a picture, which may include subjective evaluation and objective evaluation, and the subjective evaluation is the image quality directly evaluated by the evaluator. Subjective scoring is carried out.
  • the objective evaluation is to calculate the image quality score of the image through the machine algorithm, and the image quality evaluation can also be divided into the reference image quality and the non-reference image quality.
  • the reference image quality usually refers to the measured image quality.
  • the degree of error of the image (ie, the target image) relative to the standard image (ie, the original image) while the no-reference image quality is an evaluation method that is only for the image itself.
  • Commonly used image quality evaluation algorithms may include: structural similarity SSIM (structural similarity) algorithm, mean square error (MSE) algorithm, information fidelity criterion (IFC) algorithm and visual information fidelity ( VIF, visual information fidelity) algorithm.
  • the picture transcoding device may obtain the source picture quality parameter of the source picture in the above manner, or may receive the result of the source picture quality parameter from other devices or channels, such as manually inputting or receiving the source picture quality of the source picture from the third device or the network server. parameter.
  • the source map quality obtaining module 510 can be specifically configured to:
  • the method may include: obtaining a picture quantization parameter of the source picture according to the quantization parameter of each pixel macro block in the source picture, and determining the source picture quality parameter according to the picture quantization parameter of the source picture (eg, normalized processing)
  • the source map quality parameter is a value from 0 to 100). This method can be applied to obtain the source picture quality parameter of the source picture in the image format such as WebP.
  • the implementation process of the mode is specifically described above in conjunction with FIG. 4, and details are not described in this embodiment.
  • the source map quality acquisition module 510 can be used as shown in FIG. 8:
  • the quantization matrix obtaining unit 5110 is configured to obtain a quantization matrix of the source picture.
  • the source image quality obtaining unit 5120 is configured to obtain a source image quality parameter of the source image by comparing a quantization matrix of the source image with a preset standard quantization matrix.
  • the source map quality obtaining unit 5120 may further include:
  • the matrix comparison sub-unit 5121 is configured to obtain, according to a ratio between each coefficient in the quantization matrix of the source picture and a coefficient of a corresponding position in the preset standard quantization matrix, between the quantization matrix of the source picture and the standard quantization matrix. Difference coefficient value;
  • the normalization sub-unit 5122 is configured to normalize the difference coefficient value according to a preset normalization algorithm to obtain the source image quality parameter (for example, the source image quality parameter obtained by the normalization process is 0 to 100 Value). This method can be applied to obtain the source picture quality parameter of the source picture in a picture format such as JPEG. The implementation process of this mode will be specifically described below by referring to FIG.
  • the picture transcoding module 530 transcodes the source picture according to the source picture quality parameter to obtain a target picture in a target picture format, where the target picture quality parameter of the target picture matches the source picture quality parameter.
  • the quality parameter configuration adopted by the picture transcoding module 530 for transcoding the source picture should match the quality parameter of the source picture.
  • the matching mentioned here may be the same, that is, the target picture quality parameter of the target picture format and the source picture.
  • the source map quality parameters are the same, or may be different mapping relationships, for example, a mapping formula for calculating a quality parameter of a target picture format according to a quality parameter of the source picture.
  • the target picture quality parameter of the target picture can also be used to represent the image quality of the target picture, for example, the quantization parameter QP of the target picture, and the smaller the QP, the higher the image quality of the target picture.
  • the picture transcoding module 530 may further include:
  • a source map decoding unit 5301 configured to decode the source picture into original pixel data
  • the encoding unit 5302 is configured to re-encode the original pixel data according to the target picture quality parameter to obtain a target picture in a target picture format.
  • the target quality obtaining module 520 is configured to obtain a target picture quality parameter of the target picture format corresponding to the source picture quality parameter of the source picture according to a mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format.
  • the picture transcoding module 530 is configured to transcode the source picture according to the target picture quality parameter to obtain a target picture in a target picture format.
  • the mapping relationship between the quality parameter of the source image format and the quality parameter of the target image format may include at least one quality parameter sample value of the source image format and a target corresponding to each quality parameter sample value of the source image format.
  • the target quality obtaining module 520 may further include as shown in FIG. 9:
  • the sample transcoding unit 521 is configured to perform transcoding on the source picture of the target quality parameter sample value by using a plurality of different transcoding quality parameters, to obtain multiple target picture formats respectively corresponding to the plurality of different transcoding quality parameters. Transcoded picture;
  • the quality selecting unit 522 is configured to: in each of the plurality of transcoded pictures, confirm that the image quality meets the preset quality requirement and the amount of the image data is the smallest, by comparing each of the transcoded pictures with the source picture of the target quality parameter sample value. And transcoding the picture, and the transcoding quality parameter corresponding to the transcoded picture whose image quality meets the preset quality requirement and the minimum amount of picture data is used as the quality parameter of the target picture format corresponding to the target quality parameter sample value.
  • the target quality obtaining module 520 may traverse each of the at least one quality parameter sample value of the source picture format as the target quality sample value, and the sample transcoding unit 521 adopts the source picture of the target quality parameter sample value respectively.
  • a plurality of different transcoding quality parameters are transcoded to obtain transcoded pictures of multiple target picture formats respectively corresponding to the plurality of different transcoding quality parameters.
  • the quality selection unit 522 selects a transcoding code that matches the source picture of the target quality parameter sample value, and selects a transcoding in which the image quality satisfies the preset quality requirement and the image data amount is the smallest among the plurality of transcoded pictures.
  • the target quality obtaining module 520 can obtain the target image format corresponding to each quality parameter sample value by performing the above-mentioned sampling transcoding and quality selection process for each of the at least one quality parameter sampling value of the source picture format. Quality parameters.
  • the target quality obtaining module 520 may further include:
  • the quality mapping unit 523 is configured to search for a quality parameter sample value that is closest to the source image quality parameter of the source image in a mapping relationship between the quality parameter of the source image format and the quality parameter of the target image format.
  • the quality parameter of the target picture format corresponding to the quality parameter sample value is used as the target picture quality parameter of the target picture format corresponding to the source picture quality parameter of the source picture.
  • the mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format includes a mapping formula for calculating a quality parameter of the target picture format according to a quality parameter of the source picture format.
  • the target quality obtaining module 520 may further include:
  • the mapping formula training unit 524 is configured to use the quality parameter of the transcoded picture of the multiple target picture formats and the source picture quality parameter of the corresponding source picture as training parameters, and train the mapping formula to enable the trained The mapping formula approximates a correspondence between a quality parameter of the plurality of transcoded pictures and a source picture quality parameter of the corresponding source picture.
  • the picture transcoding device may train the mapping formula by using the quality parameter of the transcoded picture of the multiple target picture formats and the source picture quality parameter of the corresponding source picture as training parameters, so that the trained The mapping formula approximates a correspondence between a quality parameter of the plurality of transcoded pictures and a source picture quality parameter of the corresponding source picture.
  • the target quality obtaining module 520 may include any one of the functional units as shown in FIG. 9, and may also include all of the functional units, the sample transcoding unit 521, the quality selecting unit 522, and the mapping formula training unit.
  • the 524 may also obtain a mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format by cooperating with each other, for example, at least one quality parameter sample value of the source picture format is obtained by the sample transcoding unit 521 and the quality selecting unit 522. And a quality parameter of the target picture format corresponding to each quality parameter sample value of the source picture format, and then the mapping formula training unit 524 trains according to the correspondence between the quality parameter sample value of the source picture format and the quality parameter of the target picture format. A mapping formula for calculating a quality parameter of the target picture format according to the quality parameter of the source picture is obtained.
  • the picture transcoding device in the embodiment of the present application can perform image transcoding by using the corresponding quality configuration according to the quality parameter of the source picture, thereby avoiding the use of a higher quality configuration of the target picture when the source picture quality configuration is lower.
  • the above picture transcoding device may be an electronic device such as a PC, and may also be a portable electronic device such as a PAD, a tablet computer or a laptop computer, and is not limited to the description herein; or may be constituted by a cluster server.
  • the electronic search word pushing device includes at least a database for storing data and a processor for data processing, and may include a built-in storage medium, for merging the electronic devices of one entity or each unit function split for realizing each unit function. Or a separately set storage medium.
  • a microprocessor for the processor for data processing, a microprocessor, a central processing unit (CPU), a digital signal processor (DSP, Digital Singnal Processor), or a programmable logic array may be used when performing processing.
  • CPU central processing unit
  • DSP digital signal processor
  • a programmable logic array may be used when performing processing.
  • FPGA Field-Programmable Gate Array
  • the operation instruction may be computer executable code, by which the implementation of the present application, such as the picture shown in FIG. The various steps in the code method flow.
  • the apparatus includes a processor 901, a storage medium 902, and at least one external communication interface 903; the processor 901, the storage medium 902, and the communication interface 903 are all connected by a bus 904.
  • the processor 901 in the picture transcoding device can invoke the operation instructions in the storage medium 902 to perform the following process:
  • FIG. 12 is a schematic structural diagram of a picture transcoding apparatus in another embodiment of the present application. As shown in the figure, the picture transcoding apparatus in this embodiment may include at least:
  • the mapping relationship obtaining module 1220 is configured to obtain a mapping relationship between a quality parameter of the source image and a quality parameter of the target image format.
  • the mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format may include at least one quality parameter sample value of the source picture format and corresponding to each quality parameter sample value of the source picture format.
  • the quality parameters of the target image format may further include:
  • the sample transcoding unit 1221 is configured to perform transcoding on the source picture of the target quality parameter sample value by using a plurality of different transcoding quality parameters, to obtain multiple target picture formats respectively corresponding to the plurality of different transcoding quality parameters. Transcoded picture;
  • the quality selection unit 1222 is configured to select, by comparing the respective transcoded pictures with the source picture of the target quality parameter sample values, the image quality in the plurality of transcoded pictures to meet the preset quality requirement and the minimum amount of picture data. And transcoding the picture, and the transcoding quality parameter corresponding to the transcoded picture whose image quality meets the preset quality requirement and the minimum amount of picture data is used as the quality parameter of the target picture format corresponding to the target quality parameter sample value.
  • the sample transcoding unit 1221 adopts a plurality of different source pictures for the target quality parameter sample values respectively.
  • Transcoding quality parameters are transcoded to obtain transcoded pictures of multiple target picture formats respectively corresponding to the plurality of different transcoding quality parameters.
  • the sample value of the at least one quality parameter of the source picture format may be (5, 10, 15, 20, 25, 30...85, 90, 95) In other embodiments, more or some of the quality parameter sample values may be selected as needed.
  • the value interval of the transcoding quality parameter in the range of 0-100 is taken as an example.
  • the picture transcoding device adopts (5, 10, 15, 20, 25, 30...85, respectively.
  • the transcoding quality parameters of 90, 95) are transcoded to obtain transcoded pictures corresponding to 19 transcoding quality parameters, respectively.
  • the quality selecting unit 1222 compares the respective transcoded pictures with the source picture of the target quality parameter sample value, and selects, in the plurality of transcoded pictures, the transcoding that the image quality satisfies the preset quality requirement and the image data amount is the smallest. And a picture, and the transcoding quality parameter corresponding to the transcoded picture whose image quality meets the preset quality requirement and the minimum amount of picture data is used as the quality parameter of the target picture format corresponding to the target quality parameter sample value.
  • the quality selecting unit 1222 compares each transcoded picture with the source picture of the target quality parameter sample value to obtain a difference in picture content between each transcoded picture and the source picture. The larger the difference, the more the image quality of the transcoded picture is. Low, then the transcoding picture corresponding to the 19 transcoding quality parameters is obtained in the above example. If the preset quality requirement is that the difference of the picture content between the transcoded picture and the source picture does not exceed 10%, the quality selecting unit 1222 is The transcoded picture corresponding to the 19 transcoding quality parameters is used to find a transcoded picture that meets the preset quality requirement, for example, the transcoded picture corresponding to the QP of 5, 10, and 15 satisfies the difference between the picture content and the source picture.
  • the quality selection unit 1222 sets the QP to 15 as the quality parameter of the target picture format corresponding to the target quality parameter sample value.
  • the mapping relationship obtaining module 1220 may obtain the target image format corresponding to each quality parameter sample value by performing the above-mentioned sampling transcoding and quality selection process for each of the at least one quality parameter sampling value of the source picture format. Quality parameters.
  • the mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format includes a mapping formula for calculating a quality parameter of the target picture format according to a quality parameter of the source picture format
  • the mapping relationship obtaining module 1220 can include:
  • the mapping training unit 1223 is configured to use the quality parameter of the transcoded picture of the multiple target picture formats and the source picture quality parameter of the corresponding source picture as training parameters, and train the mapping formula to make the trained mapping The formula approximates the correspondence between the quality parameters of the plurality of transcoded pictures and the source picture quality parameters of the corresponding source pictures.
  • the mapping training unit 1223 is composed of a plurality of sets of known transcoding efficiencies satisfying the required quality parameters of the transcoded picture of the target picture format and the source picture quality parameters of the corresponding source picture to the quality parameters of the source picture and the quality of the target picture format.
  • the mapping relationship between the parameters is trained, as shown in Figure 2, the image is transcoded, the source image format is JPEG, the target image format is BPG (Better Portable Graphics, better portable graphics), and the source image quality parameters of the source image are Normalized to a value of 0 to 100, the larger the value, the higher the image quality of the source picture, and the quantization parameter QP is used as the target picture quality parameter to represent the image quality of the picture after transcoding.
  • the source picture quality parameter of the A picture is 80, and the quality parameter of the corresponding A picture after transcoding is 24;
  • the source picture quality parameter of the B picture is 70, and the quality parameter of the corresponding B picture after transcoding is 27;
  • the source picture quality parameter of the C picture is 60, and the quality of the corresponding B picture after transcoding
  • the parameter is 24, then according to the quality parameters of the three sets of transcoded pictures and the source picture quality parameters of the corresponding source picture, the mapping formula of the quality parameter of the target picture format according to the quality parameter of the source picture can be predicted as:
  • the DQP is the quality parameter of the BPG picture after transcoding
  • the SQP is the source picture quality parameter of the JPEG format normalized to the value 0 ⁇ 100.
  • mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format and the mapping relationship between the quality parameter of the source picture and the quality parameter of the target picture format are only For example, those skilled in the art may obtain more training modes and more mapping relationships between quality parameters of the source picture and quality parameters of the target picture format according to the content disclosed in the embodiments of the present application, for example, a simpler mapping. relationship:
  • N is a set constant value, or a trained constant value.
  • the target quality obtaining module 1230 is configured to obtain a target picture quality parameter of the target picture format corresponding to the source picture quality parameter of the source picture according to the mapping relationship between the quality parameter of the source picture and the quality parameter of the target picture format.
  • the mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format includes at least one quality parameter sample value of the source picture format and a target corresponding to each quality parameter sample value of the source picture format.
  • the quality parameter of the picture format when the picture transcoding device needs to transcode the source picture, the target quality obtaining module 1230 may be in the mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format. Finding a quality parameter sample value that is closest to the source image quality parameter of the source image, and using the quality parameter of the target image format corresponding to the quality parameter sample value as a target image format corresponding to the source image quality parameter of the source image Picture quality parameters.
  • the picture transcoding device is in a mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format.
  • the quality parameter of the target picture format corresponding to the quality parameter sampling value is 55, and the quality parameter of the target picture format corresponding to the quality parameter sampling value of 55 is determined as the target picture quality parameter of the target picture format of the current transcoding.
  • the mapping relationship between the quality parameter of the source picture format and the quality parameter of the target picture format includes calculating a mapping formula of the quality parameter of the target picture format according to the quality parameter of the source picture format
  • the picture transcoding device When the source picture needs to be transcoded, the target quality obtaining module 1230 may substitute the source picture quality parameter of the source picture into the mapping formula to calculate a target picture quality parameter of the target picture format of the current transcoding.
  • the picture transcoding module 1240 is configured to transcode the source picture according to the target picture quality parameter to obtain a target picture in a target picture format.
  • the picture transcoding module 1240 may further include the following:
  • a source map decoding unit configured to decode the source picture into original pixel data
  • a coding unit configured to re-encode the original pixel data according to the target picture quality parameter to obtain a target picture in a target picture format.
  • the source image quality obtaining module 1210 is configured to obtain a source image quality parameter of the source image.
  • the source map quality parameter characterizes the image quality of the source picture.
  • Common image quality evaluation algorithms may include: SSIM algorithm, MSE algorithm, IFC algorithm and VIF algorithm.
  • the source image quality obtaining module 1210 may obtain the source image quality parameter of the source image in the foregoing manner, and may also receive the result of the source image quality parameter from other devices or channels, such as manually inputting or receiving the source image source from the third device or the network server. Figure quality parameters.
  • the picture transcoding device in the embodiment of the present application can perform image transcoding by using the corresponding quality configuration according to the quality parameter of the source picture, thereby avoiding the use of a higher quality configuration of the target picture when the source picture quality configuration is lower.
  • the above picture transcoding device may be an electronic device such as a PC, and may also be a portable electronic device such as a PAD, a tablet computer or a laptop computer, and is not limited to the description herein; or may be constituted by a cluster server.
  • the electronic search word pushing device includes at least a database for storing data and a processor for data processing, and may include a built-in storage medium, for merging the electronic devices of one entity or each unit function split for realizing each unit function. Or a separately set storage medium.
  • a microprocessor for the processor for data processing, a microprocessor, a central processing unit (CPU), a digital signal processor (DSP, Digital Singnal Processor), or a programmable logic array may be used when performing processing.
  • CPU central processing unit
  • DSP digital signal processor
  • a programmable logic array may be used when performing processing.
  • FPGA Field-Programmable Gate Array
  • the operation instruction may be computer executable code, by which the implementation of the present application, such as the picture transfer shown in FIG. 4, is implemented The various steps in the code method flow.
  • the apparatus includes a processor 1401, a storage medium 1402, and at least one external communication interface 1403; the processor 1401, the storage medium 1402, and the communication interface 1403 are all connected by a bus 1404.
  • the processor 1401 in the picture transcoding device can invoke the operation instructions in the storage medium 1402 to perform the following process:
  • FIG. 15 is a source diagram quality parameter obtaining apparatus in the embodiment of the present application.
  • the source map quality parameter obtaining apparatus in the embodiment of the present application includes:
  • the quantization matrix obtaining unit 1510 is configured to obtain a quantization matrix of the source picture.
  • the quantization matrix may be an 8 ⁇ 8 matrix of quantized coefficients, and in other embodiments may be a matrix of 16 ⁇ 16 or other sizes.
  • the picture transcoding device may obtain an 8x8 quantization matrix of JPEG by parsing a DQT (Define Quantization Table) in the JPEG file data, usually a data segment starting with DQT in the JPEG file data.
  • DQT Deform Quantization Table
  • the JPEG picture may include more than one quantization matrix, for example, including a luminance quantization matrix and a color quantization matrix.
  • a luminance quantization matrix for example, including a luminance quantization matrix and a color quantization matrix.
  • the present embodiment only uses a luminance quantization matrix as an example for description.
  • the source image quality obtaining unit 1520 is configured to obtain a source image quality parameter of the source image by comparing a quantization matrix of the source image with a preset standard quantization matrix.
  • the source map quality obtaining unit 5120 may further include:
  • the matrix comparison sub-unit 5121 is configured to obtain, according to a ratio between each coefficient in the quantization matrix of the source picture and a coefficient of a corresponding position in the preset standard quantization matrix, between the quantization matrix of the source picture and the standard quantization matrix. Difference coefficient value.
  • the preset standard quantization matrix may be a quantization matrix that is pre-determined according to a mental vision valve and has an image coding quality effect on brightness or chrominance of the source picture to a specified standard.
  • the picture transcoding device can calculate the ratio between the luminance quantization matrix of the source picture and the coefficient of the corresponding position in the luminance standard quantization matrix, and obtain the difference between the quantization matrix of the source picture and the standard quantization matrix. Coefficient value.
  • the normalization sub-unit 1522 is configured to normalize the difference coefficient value according to a preset normalization algorithm to obtain the source map quality parameter.
  • the source picture quality parameter obtaining apparatus in this embodiment may be adapted to obtain a source picture quality parameter of a source picture in a picture format such as JPEG.
  • a source picture quality parameter of a source picture in a picture format such as JPEG.
  • the source image quality parameter obtaining device may pass the other source device or itself according to the source image quality parameter, and transcode the source image to obtain a target image in a target image format, where the target image is obtained.
  • the target picture quality parameter matches the source picture quality parameter.
  • the transcoding the source image according to the source image quality parameter to obtain the target image in the target image format may be:
  • the source picture quality parameter obtaining device may be an electronic device such as a PC, and may also be a portable electronic device such as a PAD, a tablet computer or a laptop computer, and is not limited to the description herein;
  • the source device quality parameter obtaining device includes at least a database for storing data and a processor for data processing, which may include a built-in electronic device that is configured as a physical entity or a separate function for each unit function. Storage medium or storage medium that is set independently.
  • a microprocessor for the processor for data processing, a microprocessor, a central processing unit (CPU), a digital signal processor (DSP, Digital Singnal Processor), or a programmable logic array may be used when performing processing.
  • CPU central processing unit
  • DSP digital signal processor
  • a programmable logic array may be used when performing processing.
  • FPGA Field-Programmable Gate Array
  • the operation instruction may be computer executable code, by which the implementation of the present application, such as the source diagram shown in FIG. 5, is implemented.
  • the quality parameters capture the various steps in the method flow.
  • the apparatus includes a processor 1601, a storage medium 1602, and at least one external communication interface 1603; the processor 1601, the storage medium 1602, and the communication interface 1603 are all connected by a bus 1604.
  • the processor 1601 in the picture transcoding device can invoke the operation instructions in the storage medium 1602 to perform the following process:
  • the source picture quality parameter of the source picture is obtained by comparing the quantization matrix of the source picture with a preset standard quantization matrix.
  • the disclosed apparatus and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner such as: multiple units or components may be combined, or Can be integrated into another system, or some features can be ignored or not executed.
  • the coupling, or direct coupling, or communication connection of the components shown or discussed may be indirect coupling or communication connection through some interfaces, devices or units, and may be electrical, mechanical or other forms. of.
  • the units described above as separate components may or may not be physically separated, and the components displayed as the units may or may not be physical units, that is, may be located in one place or distributed on multiple network units; Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may be separately used as one unit, or two or more units may be integrated into one unit; the above integration
  • the unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
  • the foregoing program may be stored in a computer readable storage medium, and the program is executed when executed.
  • the foregoing storage device includes the following steps: the foregoing storage medium includes: a mobile storage device, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
  • ROM read-only memory
  • RAM random access memory
  • magnetic disk or an optical disk.
  • optical disk A medium that can store program code.
  • the above-described integrated unit of the present application may be stored in a computer readable storage medium if it is implemented in the form of a software function module and sold or used as a stand-alone product.
  • the technical solution of the embodiments of the present application may be embodied in the form of a software product in essence or in the form of a software product stored in a storage medium, including a plurality of instructions.
  • a computer device (which may be a personal computer, server, or network device, etc.) is caused to perform all or part of the methods described in various embodiments of the present application.
  • the foregoing storage medium includes various media that can store program codes, such as a mobile storage device, a ROM, a RAM, a magnetic disk, or an optical disk.

Landscapes

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

Abstract

本申请实施例公开了图片转码方法和装置,其中的一种图片转码方法包括:获取源图片的源图质量参数,其中所述源图片为待转码的图片,所述源图质量参数用于表征所述源图片的图像质量;根据所述源图质量参数以及预设的映射关系,获取与所述源图片的源图质量参数对应的目标图片格式的目标图片质量参数;根据所述目标图片质量参数,对所述源图片进行转码得到目标图片格式的目标图片。

Description

图片转码方法和装置
本申请要求于2017年4月27日提交中国专利局、申请号为201710299885.3,发明名称为“图片转码方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及一种图像处理领域,尤其涉及一种图片转码方法和装置。
发明背景
目前普遍使用的例如JPEG(Joint Photographic Experts Group,联合图像专家小组)等图片格式,技术产生的年代较早,压缩效率普遍比较低。大量已存在的图片已经在用JPEG这样的图片格式保存。在互联网时代,将海量图片文件存储和传输会耗费大量存储和带宽成本。通常的做法是将原图片格式转码成一种压缩效率更高的图片格式,用来传输和存储。所述转码是指将已经压缩的原图片转换成另一种图片格式。
发明内容
本申请实施例提供了一种图片转码方法和装置,可避免采用较高质量配置导致转码后图片文件数据量很大造成的存储资源或网络传输资源的浪费的问题。
本申请实施例提供了一种图片转码方法,所述方法包括:
获取源图片的源图质量参数,其中所述源图片为待转码的图片,所述源图质量参数用于表征所述源图片的图像质量;
根据所述源图质量参数以及预设的映射关系,获取与所述源图片的源图质量参数对应的目标图片格式的目标图片质量参数;
根据所述目标图片质量参数,对所述源图片进行转码得到目标图片 格式的目标图片。
相应的,本申请实施例还提供了一种图片转码装置,所述装置包括:
处理器;
与所述处理器相连接的存储器;所述存储器中存储有机器可读指令模块;所述机器可读指令模块包括:
源图质量获取模块,用于获取源图片的源图质量参数,其中所述源图片为待转码的图片,所述源图质量参数用于表征所述源图片的图像质量;
目标质量获取模块,根据所述源图质量参数以及预设的映射关系,获取与所述源图片的源图质量参数对应的目标图片格式的目标图片质量参数;
图片转码模块,根据所述目标图片质量参数,对所述源图片进行转码得到目标图片格式的目标图片。
本申请实施例还提供了一种非易失性计算机可读存储介质,其中所述存储介质中存储有机器可读指令,所述机器可读指令可以由处理器执行以完成上述方法。
本申请实施例根据源图片的质量参数动态的采用对应的质量配置进行图片转码,从而避免采用较高质量配置导致转码后图片文件数据量很大造成的存储资源或网络传输资源的浪费。
附图简要说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本申请实施例中的一种图片转码方法的实施流程示意图;
图2是本申请实施例中的图片转码示意图;
图3是本申请实施例中的图片转码过程示意图;
图4是本申请另一实施例中的图片转码方法的实施流程示意图;
图5是本申请实施例中的一种源图质量参数获取方法的实施流程示意图;
图6是本申请另一实施例中的图片转码方法的实施流程示意图;
图7是本申请实施例中的一种图片转码装置的结构示意图;
图8是本申请实施例的图片转码装置中的源图质量获取模块的结构示意图;
图9是本申请实施例的图片转码装置中的目标质量获取模块的结构示意图;
图10是本申请实施例的图片转码装置中的图片转码模块的结构示意图;
图11是本申请实施例的图片转码装置的一个硬件组成结构示意图;
图12是本申请另一实施例中的图片转码装置的结构示意图;
图13是本申请实施例的图片转码装置的映射关系获取模块的结构示意图;
图14是本申请实施例的图片转码装置的又一个硬件组成结构示意图;
图15是本申请实施例中的源图质量获取装置的结构示意图;
图16是本申请施例中的源图质量获取装置的一个硬件组成结构示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案 进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请实施例中的图片转码方法可以实现于各类个人终端或网络后台服务器中对已有图片进行图片转码处理,在下文均以图片转码装置作为执行主体进行介绍,所述个人终端可以例如个人电脑、笔记本电脑、平板电脑、电子阅读器、智能手机、智能穿戴设备等,所述网络后台服务器可以为网站服务器、云存储服务器、图片管理服务器或即时通讯服务器、社交应用服务器等,只要涉及需要对图片进行存储或传输的场景均可以使用本申请提出的图片转码方法。
图1是本申请实施例中的一种图片转码方法的实施流程示意图,如图所示本实施例中的图片转码方法流程可以包括:
S101,获取源图片的源图质量参数。
在一些实施例中,所述源图片是指需要被转码的图片。所述源图质量参数表征源图片的图像质量,而图像质量可以是指图像的优劣,或者图像的失真程度,通常可以反映人们对一幅图片视觉感受的评价,可以包括主观评价和客观评价,主观评价即直接由评价者对待评图片的图像质量进行主观评分,客观评价即通过将图片数据化,通过机器算法计算得到图片的图像质量评分,同时图像质量评价也可以分为有参考图像质量和无参考图像质量,有参考图像质量通常指被测图像(即目标图像)相对于标准图像(即原图像)的误差的程度,而无参考图像质量是只仅针对图像本身的评价方式。常用的图像质量评价算法可以包括:结构相似性SSIM(structural similarity)算法,均方误差MSE(mean square error)算法、信息保真度准则(IFC,information fidelity criterion)算法和视觉信 息保真度(VIF,visual information fidelity)算法等。图片转码装置可以通过上述方式获取源图片的源图质量参数,也可以从其他设备或渠道接收源图质量参数的结果,例如人工输入或从第三设备或网络服务器接收源图片的源图质量参数。
在一些实施例中,图片转码装置可以通过获取源图片的量化矩阵,进而比较源图片的量化矩阵与预设的标准量化矩阵,获取所述源图片的源图质量参数。具体实现中,图片转码装置可以根据源图片的量化矩阵中的各系数与预设的标准量化矩阵中相应位置的系数之间的比值,获取所述源图片的量化矩阵与标准量化矩阵之间的差异系数值,进而根据预设的归一化算法对所述差异系数值归一化处理得到所述源图质量参数(例如归一化处理得到的源图质量参数为0~100的数值)。该方式可以适用于获取JPEG等图片格式的源图片的源图质量参数。下文通过结合图5具体描述该方式的实现过程。
在另一实施方式中,图片转码装置可以获取源图片中每个像素宏块Macroblock的量化参数(Quantization Parameter,QP),获取所述源图片的源图质量参数。具体可以包括,根据源图片中每个像素宏块的量化参数,获取源图片的图片量化参数,进而根据所述源图片的图片量化参数确定所述源图质量参数(同样可以例如归一化处理得到的源图质量参数为0~100的数值)。该方式可以适用于获取WebP(谷歌google开发的一种旨在加快图片加载速度的图片格式)等图片格式的源图片的源图质量参数。下文通过结合图6具体描述该方式的实现过程。
S102,根据所述源图质量参数,对所述源图片进行转码得到目标图片格式的目标图片,所述目标图片的目标图片质量参数与所述源图质量参数匹配。
即图片转码装置对源图片进行转码处理采用的质量参数配置应该 与源图片的质量参数相匹配,这里提及的匹配可以是相同,即目标图片格式的目标图片质量参数与源图片的源图质量参数相同,也可以是不相同的映射关系,例如为根据源图片的质量参数计算目标图片格式的质量参数的映射公式。所述目标图片的目标图片质量参数同样可以用于表示目标图片的图像质量,例如可以目标图片的量化参数QP,QP越小则目标图片的图像质量越高。
在一些实施例中,图片转码装置根据所述源图质量参数,对所述源图片进行转码得到目标图片格式的目标图片,所述目标图片的目标图片质量参数与所述源图质量参数匹配可以包括:
1)图片转码装置根据源图片格式的质量参数与目标图片格式的质量参数之间的映射关系,获取与所述源图片的源图质量参数对应的目标图片格式的目标图片质量参数。
具体实现中,所述源图片格式的质量参数与目标图片格式的质量参数之间的映射关系可以包括源图片格式的至少一个质量参数采样值以及与源图片格式的各个质量参数采样值对应的目标图片格式的质量参数之间的对应关系。
图片转码装置可以遍历所述源图片格式的至少一个质量参数采样值中的每个质量参数采样值作为目标质量采样值,针对目标质量参数采样值的源图片分别采用多个不同的转码质量参数进行转码,得到分别与所述多个不同转码质量参数对应的多个目标图片格式的转码图片。接着图片转码装置通过将各个转码图片与所述目标质量参数采样值的源图片进行比较,在所述多个转码图片中选择图像质量满足预设质量要求并且图片数据量最小的转码图片,进而将所述图像质量满足预设质量要求并且图片数据量最小的转码图片对应的转码质量参数作为与所述目标质量参数采样值对应的目标图片格式的质量参数。通过针对所述源图片 格式的至少一个质量参数采样值中的每个质量参数采样值进行上述的采样转码和质量选择过程,图片转码装置可以得到各个质量参数采样值对应的目标图片格式的质量参数。
接着图片转码装置在需要对源图片进行转码时,可以在所述源图片格式的质量参数与目标图片格式的质量参数之间的映射关系中查找与所述源图片的源图质量参数最接近的质量参数采样值,将所述质量参数采样值对应的目标图片格式的质量参数作为与源图片的源图质量参数对应的目标图片格式的目标图片质量参数。
在另一些实施例中,所述源图片格式的质量参数与目标图片格式的质量参数之间的映射关系包括用于根据源图片格式的质量参数计算目标图片格式的质量参数的映射公式。具体实现中,图片转码装置可以通过将多个目标图片格式的转码图片的质量参数及其对应的源图片的源图质量参数作为训练参数,对所述映射公式进行训练,使得经过训练的所述映射公式逼近所述多个转码图片的质量参数与其对应的源图片的源图质量参数之间的对应关系。
2)图片转码装置根据所述目标图片质量参数,对所述源图片进行转码得到目标图片格式的目标图片。
其中2)图片转码装置根据所述目标图片质量参数,对所述源图片进行转码得到目标图片格式的目标图片进一步可以如图3所示包括:
1)将源图片解码成原始像素数据,例如解码得到RGB原始像素数据,若源图片为JPEG格式,则是将JPEG图片数据解码得到RGB原始像素数据。
2)按照所述目标图片质量参数将所述原始像素数据重新编码得到目标图片格式的目标图片。
例如目标图片格式为BPG,则根据解码得到的原始像素数据进行 BPG图片编码,并根据所述目标图片质量参数确定BPG图片的编码质量配置,例如确定得到目标图片质量参数为DQP=40,则可以为按照量化参数QP=40对原始像素数据进行BPG图片编码。
经大量试验总结,图片转码过程中有下列三个规律:
(1)当图片转码成目标图片格式的时候,如果目标图片格式的压缩效率更高,可以在同等质量条件下把图片文件压缩的更小。
(2)图片压缩配置质量的时候,质量配置的越高,源图片的信息保留越多,文件大小也会越大。
(3)根据图片有损压缩的特性,转码后的图片质量不会高于源图片格式的图片质量。
如果源图片也是有损压缩图片格式,这就表明源图片保留的相机采集的原始像素信息已经被有损压缩损失掉了,已经存在了一定量的失真。当目标图片格式的质量配置设置和源图片不匹配,如源图片质量配置很低,目标图片质量配置较高,根据(3)目标图片的质量不会高于源图片;并且根据(2),目标图片保留了较多没必要的失真的信息,目标图片文件数据产生冗余,造成数据存储资源或网络传输资源的浪费,在这样的情况下即使目标图片格式的压缩效率更高,也不一定能够达不到(1)的效果。反之,如源图片质量配置很高,目标图片质量配置较低,则经过转码会丢失更多的像素内容造成更多的失真,因此,最好的方式是采用与源图片的质量参数匹配的质量配置进行图片转码,从而能够最大限度的保留更多的像素内容,并且避免数据冗余导致的,存储资源或网络传输资源的浪费。
本申请实施例通过根据源图片的质量参数采用对应的质量配置进行图片转码,从而能够避免在源图片质量配置较低时,对目标图片采用较高质量配置导致转码后图片文件数据量冗余造成的存储资源或网络 传输资源的浪费。
图4是本申请另一实施例中的图片转码方法的实施流程示意图,如图所示本实施例中的图片转码方法流程包括:
S201,获取源图片格式的质量参数与目标图片格式的质量参数之间的映射关系。
在一些实施例中,所述源图片格式的质量参数与目标图片格式的质量参数之间的映射关系可以包括源图片格式的至少一个质量参数采样值以及与源图片格式的各个质量参数采样值对应的目标图片格式的质量参数之间的对应关系。
图片转码装置可以通过遍历所述源图片格式的至少一个质量参数采样值中的每个质量参数采样值作为目标质量采样值,针对目标质量参数采样值的源图片分别采用多个不同的转码质量参数进行转码,得到分别与所述多个不同转码质量参数对应的多个目标图片格式的转码图片。以源图片格式的质量参数在0-100的数值区间为例,所述源图片格式的至少一个质量参数采样值可以为(5,10,15,20,25,30…85,90,95),在其他实施例中可以根据需要选取更多或其中部分的质量参数采样值。相应的,同样以转码质量参数在0-100的数值区间为例,针对目标质量参数采样值的源图片,图片转码装置分别采用(5,10,15,20,25,30…85,90,95)的转码质量参数进行转码,从而得到分别与19个转码质量参数对应的转码图片。接着图片转码装置通过将各个转码图片与所述目标质量参数采样值的源图片进行比较,在所述多个转码图片中确认图像质量满足预设质量要求并且图片数据量最小的转码图片,进而将所述图像质量满足预设质量要求并且图片数据量最小的转码图片对应的转码质量参数作为与所述目标质量参数采样值对应的目标图片格式的质量参数。图片转码装置将各个转码图片与所述目标质量参数采 样值的源图片进行比较可以得到各个转码图片与源图片之间的画面内容差异,差异越大则表示转码图片的图像质量越低,接着上文示例中得到了19个转码质量参数对应的转码图片,假设预设质量要求为转码图片与源图片之间的画面内容差异不超过10%,则图片转码装置在所述19个转码质量参数对应的转码图片中查找满足该预设质量要求的转码图片,例如QP为5,10,15对应的转码图片满足与源图片之间的画面内容差异不超过10%的质量要求,但是QP为15对应的转码图片的图片数据量最小,那么图片转码装置将QP为15作为与所述目标质量参数采样值对应的目标图片格式的质量参数。
通过针对所述源图片格式的至少一个质量参数采样值中的每个质量参数采样值进行上述的采样转码和质量选择过程,图片转码装置可以得到各个质量参数采样值对应的目标图片格式的质量参数。
在另一些实施例中,所述源图片格式的质量参数与目标图片格式的质量参数之间的映射关系包括根据源图片格式的质量参数计算目标图片格式的质量参数的映射公式,图片转码装置可以通过将多个目标图片格式的转码图片的质量参数及其对应的源图片的源图质量参数作为训练参数,对所述映射公式进行训练,使得经过训练的所述映射公式逼近所述多个转码图片的质量参数与其对应的源图片的源图质量参数之间的对应关系。即由多组已知转码效率满足要求的目标图片格式的转码图片的质量参数及其对应的源图片的源图质量参数对所述源图片的质量参数与目标图片格式的质量参数之间的映射关系进行训练,如图2所示的图片转码,源图片格式为JPEG,目标图片格式为BPG(Better Portable Graphics,更好的便携式图形),将源图片的源图质量参数归一化处理至数值0~100,数值越大表示源图片的图像质量越高,而使用量化参数QP作为目标图片质量参数代表转码后图片的图像质量,QP越小则转码后 的目标图片质量越高,示例性的,已知分别针对A图片、B图片以及C图片的转码效率满足要求,A图片的源图质量参数为80,其转码后对应的A图片的质量参数为24;B图片的源图质量参数为70,其转码后对应的B图片的质量参数为27;C图片的源图质量参数为60,其转码后对应的B图片的质量参数为24,那么根据这三组转码图片的质量参数与其对应的源图片的源图质量参数可以预测根据源图片的质量参数计算目标图片格式的质量参数的映射公式为:
DQP=-0.6*SQP+72;
其中DQP为转码后BPG图片的质量参数,SQP为归一化处理至数值0~100后的JPEG格式的源图质量参数。
需要指出的是,以上源图片格式的质量参数与目标图片格式的质量参数之间的映射关系的训练方式以及训练得到的源图片的质量参数与目标图片格式的质量参数之间的映射关系均仅为示例,本领域技术人员根据本申请实施例公开的内容可以得到更多的训练方式以及更多的源图片的质量参数与目标图片格式的质量参数之间的映射关系,例如更为简单的映射关系:
DQP=SQP;DQP=100-SQP;
或DQP=SQP+N,N为一设定常数值,或为经过训练得到的常数值。
S202,根据源图片格式的质量参数与目标图片格式的质量参数之间的映射关系,获取与源图片的源图质量参数对应的目标图片格式的目标图片质量参数。
在一些实施例中,若源图片格式的质量参数与目标图片格式的质量参数之间的映射关系包括源图片格式的至少一个质量参数采样值以及与源图片格式的各个质量参数采样值对应的目标图片格式的质量参数,那么图片转码装置在需要对源图片进行转码时,可以在所述源图片格式 的质量参数与目标图片格式的质量参数之间的映射关系中查找与所述源图片的源图质量参数最接近的质量参数采样值,将所述质量参数采样值对应的目标图片格式的质量参数作为与源图片的源图质量参数对应的目标图片格式的目标图片质量参数。例如所述源图片的源图质量参数为54,那么最接近的质量参数采样值为55,图片转码装置在所述源图片格式的质量参数与目标图片格式的质量参数之间的映射关系中查找质量参数采样值为55对应的目标图片格式的质量参数,将质量参数采样值为55对应的目标图片格式的质量参数确定为本次转码的目标图片格式的目标图片质量参数。
在另一实施例中,若源图片格式的质量参数与目标图片格式的质量参数之间的映射关系包括根据源图片格式的质量参数计算目标图片格式的质量参数的映射公式,则图片转码装置在需要对源图片进行转码时,既可以将所述源图片的源图质量参数代入所述映射公式中计算得到本次转码的目标图片格式的目标图片质量参数。
S203,根据所述目标图片质量参数,对所述源图片进行转码得到目标图片格式的目标图片。
具体的,对所述源图片进行转码可以包括:
将源图片解码成原始像素数据,例如解码得到RGB原始像素数据,若源图片为JPEG格式,则是将JPEG图片数据解码得到RGB原始像素数据。按照所述目标图片质量参数将所述原始像素数据重新编码得到目标图片格式的目标图片。例如目标图片格式为BPG,则根据解码得到的原始像素数据进行BPG图片编码,并根据所述目标图片质量参数确定BPG图片的编码质量配置,例如确定得到目标图片质量参数为QP=40,则为按照QP=40对原始像素数据进行BPG图片编码。
本申请实施例通过根据源图片的质量参数采用对应的质量配置进 行图片转码,从而能够避免在源图片质量配置较低时,对目标图片采用较高质量配置导致转码后图片文件数据量冗余造成的存储资源或网络传输资源的浪费。
图5是本申请实施例中的一种源图质量参数获取方法的实施流程示意图,如图所示本实施例中的源图质量参数获取方法流程包括:
S401,获取源图片的量化矩阵。
示例性的,以源图片为JPEG格式为例,所述量化矩阵可以为一个8x8的量化系数矩阵,在其他实施例中也可以是16x16或其他大小的矩阵,例如下所示:
Figure PCTCN2018079443-appb-000001
在一些实施例中,图片转码装置可以通过解析JPEG文件数据中的DQT(Define Quantization Table,定义量化表),通常在JPEG文件数据中以DQT为开头的数据段,获得JPEG的8x8量化矩阵。
在一些实施例中,JPEG图片可以包含不止一个量化矩阵,例如包括一个亮度量化矩阵和一个色度量化矩阵,为方便说明,本实施例只以亮度量化矩阵为例进行说明。
S402,通过比较源图片的量化矩阵与预设的标准量化矩阵,获取所述源图片的源图质量参数。
具体实现中,图片转码装置可以根据源图片的量化矩阵中的各系数与预设的标准量化矩阵中相应位置的系数之间的比值,获取所述源图片的量化矩阵与标准量化矩阵之间的差异系数值。
所述预设的标准量化矩阵可以为预先依据心理视觉阀制定的,对JPEG图片的亮度或色度的图像编码质量效果达到指定标准的量化矩阵。示例性的,亮度标准量化矩阵可以为:
Figure PCTCN2018079443-appb-000002
色度标准量化矩阵可以为:
Figure PCTCN2018079443-appb-000003
以亮度量化矩阵为例,图片转码装置可以计算源图片的亮度量化矩阵与亮度标准量化矩阵中相应位置的系数之间的比值,获取所述源图片的量化矩阵与标准量化矩阵之间的差异系数值。
进一步示例性的,通过计算源图片的亮度量化矩阵与亮度标准量化矩阵中相应位置的系数之间的比值,获取所述源图片的量化矩阵与标准量化矩阵之间的差异系数值的具体算法可以如下:
定义源图片的量化矩阵与标准量化矩阵之间的差异系数值SUM:
SUM=(∑ i,jR i,j)/64,其中
Figure PCTCN2018079443-appb-000004
而针对特殊情况:如若K i,j=0,则R i,j=999.99。
接着,图片转码装置可以根据预设的归一化算法对所述差异系数值 SUM归一化处理得到源图质量参数。
示例性的,图片转码装置可以根据预设的归一化算法对所述差异系数值归一化处理得到0~100数值范围内的源图质量参数。所述归一化算法可以例如:
若SUM≤100.0,JPEG质量参数Q=(200.0-SUM)/2.0;
若SUM>100.0,则JPEG质量参数Q=5000.0/SUM。
以及特殊情况:若K 8x8的所有系数K i,j都是1的时候,表明该JPEG图片没有经过量化,质量最优,JPEG质量参数Q就等于100。
以上根据源图片的量化矩阵中的各系数与预设的标准量化矩阵中相应位置的系数之间的比值计算差异系数值的方式,以及根据所述差异系数值归一化处理得到源图质量参数的算法均仅作为示例,本领域技术人员根据本申请提供的方式可以经合理变换得到不同的计算方式和算法,均应属于本申请的权利要求的保护范畴。
从而图片转码装置可以通过比较源图片的亮度量化矩阵与预设的亮度标准量化矩阵之间的差异得到源图片的源图质量参数,在其他实施例中,图片转码装置还可以通过比较源图片的色度量化矩阵与预设的色度标准量化矩阵之间的差异得到源图片的源图质量参数,或者结合源图片的亮度量化矩阵与预设的亮度标准量化矩阵之间的差异以及源图片的色度量化矩阵与预设的色度标准量化矩阵之间的差异,综合计算得到源图片的源图质量参数,本申请实施例中不再展开详述。
进而在一些实施例中,在获取到源图片的源图质量参数后,图片转码装置可以根据所述源图质量参数,对所述源图片进行转码得到目标图片格式的目标图片,所述目标图片的目标图片质量参数与所述源图质量参数匹配。
其中,所述根据所述源图质量参数,对所述源图片进行转码得到目标图片格式的目标图片进一步可以包括:
根据源图片格式的质量参数与目标图片格式的质量参数之间的映射关系,获取与所述源图片的源图质量参数对应的目标图片格式的目标图片质量参数;根据所述目标图片质量参数,对所述源图片进行转码得到目标图片格式的目标图片。
本申请实施例提供了一种获取源图片的源图片质量参数的方法,以便于在需要对图片进行转码时能够快速准确的获取到源图片的源图质量配置,从而动态的根据源图片的源图质量配置对该图片进行转码。
图5是本申请另一实施例中的图片转码方法的实施流程示意图,如图所示本实施例中的图片转码方法流程可以包括:
S501,根据源图片中每个像素宏块的量化参数,获取源图片的源图质量参数。
在本实施例中,源图片可以被划分为多个像素宏块,每个像素宏块拥有自身的量化参数,例如将源图片中每个像素宏块的量化参数取平均值,即可得到源图片的图片量化参数,在一些实施例中,可以直接将源图片的图片量化参数作为源图质量参数,也可以通过特定的归一化算法对所述源图片的图片量化参数进行归一化处理,从而得到归一化的源图片的源图质量参数。
S502,根据源图片格式的质量参数与目标图片格式的质量参数之间的映射关系,获取与所述源图片的源图质量参数对应的目标图片格式的目标图片质量参数。
即图片转码装置对源图片进行转码处理采用的质量参数配置应该与源图片的质量参数相匹配,这里提及的匹配可以是相同,即目标图片格式的目标图片质量参数与源图片的源图质量参数相同,也可以是不相 同的映射关系,例如为根据源图片的质量参数计算目标图片格式的质量参数的映射公式。
例如直接将源图片的图片量化参数作为源图质量参数为,同时使用量化参数QP作为目标图片质量参数代表转码后图片的图像质量,那么源图片的质量参数与目标图片格式的质量参数的映射关系可以为:
DQP=SQP;
或DQP=SQP+N,N为一设定常数值,或为经过训练得到的常数值。
S503,根据所述目标图片质量参数,对所述源图片进行转码得到目标图片格式的目标图片。
具体的,对所述源图片进行转码可以包括:
将源图片解码成原始像素数据,例如解码得到RGB原始像素数据,若源图片为JPEG格式,则是将JPEG图片数据解码得到RGB原始像素数据。按照所述目标图片质量参数将所述原始像素数据重新编码得到目标图片格式的目标图片。例如目标图片格式为BPG,则根据解码得到的原始像素数据进行BPG图片编码,并根据所述目标图片质量参数确定BPG图片的编码质量配置,例如确定得到目标图片质量参数为QP=40,则为按照QP=40对原始像素数据进行BPG图片编码。
本申请实施例根据源图片中每个像素宏块的量化参数获取源图片的源图质量参数,进而根据源图片的质量参数采用对应的质量配置进行图片转码,从而能够避免在源图片质量配置较低时,对目标图片采用较高质量配置导致转码后图片文件数据量冗余造成的存储资源或网络传输资源的浪费。
图7是本申请实施例中的一种图片转码装置的结构示意图,如图所示本实施例中的图片转码装置至少可以包括:源图质量获取模块510、目标质量获取模块520和图片转码模块530。
其中,源图质量获取模块510,用于获取源图片的源图质量参数。
所述源图质量参数表征源图片的图像质量,而图像质量通常可以反映人们对一幅图片视觉感受的评价,可以包括主观评价和客观评价,主观评价即直接由评价者对待评图片的图像质量进行主观评分,客观评价即通过将图片数据化,通过机器算法计算得到图片的图像质量评分,同时图像质量评价也可以分为有参考图像质量和无参考图像质量,有参考图像质量通常指被测图像(即目标图像)相对于标准图像(即原图像)的误差的程度,而无参考图像质量是只仅针对图像本身的评价方式。常用的图像质量评价算法可以包括:结构相似性SSIM(structural similarity)算法,均方误差MSE(mean square error)算法、信息保真度准则(IFC,information fidelity criterion)算法和视觉信息保真度(VIF,visual information fidelity)算法等。图片转码装置可以通过上述方式获取源图片的源图质量参数,也可以从其他设备或渠道接收源图质量参数的结果,例如人工输入或从第三设备或网络服务器接收源图片的源图质量参数。
在一些实施例中,源图质量获取模块510具体可以用于:
获取源图片中每个像素宏块的量化参数,获取所述源图片的源图质量参数。具体可以包括,根据源图片中每个像素宏块的量化参数,获取源图片的图片量化参数,进而根据所述源图片的图片量化参数确定所述源图质量参数(例如归一化处理得到的源图质量参数为0~100的数值)。该方式可以适用于获取WebP等图片格式的源图片的源图质量参数。上文通过结合图4具体描述该方式的实现过程,本实施例中不再赘述。
在另一些实施例中,源图质量获取模块510可以如图8所示用于:
量化矩阵获取单元5110,用于获取源图片的量化矩阵。
源图质量获取单元5120,用于通过比较源图片的量化矩阵与预设的标准量化矩阵,获取所述源图片的源图质量参数。
在一些实施例中,所述源图质量获取单元5120进一步还可以包括:
矩阵比较子单元5121,用于根据源图片的量化矩阵中的各系数与预设的标准量化矩阵中相应位置的系数之间的比值,获取所述源图片的量化矩阵与标准量化矩阵之间的差异系数值;
归一化子单元5122,用于根据预设的归一化算法对所述差异系数值归一化处理得到所述源图质量参数(例如归一化处理得到的源图质量参数为0~100的数值)。该方式可以适用于获取JPEG等图片格式的源图片的源图质量参数。下文通过结合图5具体描述该方式的实现过程。
图片转码模块530,根据所述源图质量参数,对所述源图片进行转码得到目标图片格式的目标图片,所述目标图片的目标图片质量参数与所述源图质量参数匹配。
即图片转码模块530对源图片进行转码处理采用的质量参数配置应该与源图片的质量参数相匹配,这里提及的匹配可以是相同,即目标图片格式的目标图片质量参数与源图片的源图质量参数相同,也可以是不相同的映射关系,例如为根据源图片的质量参数计算目标图片格式的质量参数的映射公式。所述目标图片的目标图片质量参数同样可以用于表示目标图片的图像质量,例如可以目标图片的量化参数QP,QP越小则目标图片的图像质量越高。
在一些实施例中,所述图片转码模块530如图10所示进一步可以包括:
源图解码单元5301,用于将源图片解码成原始像素数据;
编码单元5302,用于按照所述目标图片质量参数将所述原始像素数据重新编码得到目标图片格式的目标图片。
目标质量获取模块520,用于根据源图片格式的质量参数与目标图片格式的质量参数之间的映射关系,获取与所述源图片的源图质量参数 对应的目标图片格式的目标图片质量参数。
而所述图片转码模块530,用于根据所述目标图片质量参数,对所述源图片进行转码得到目标图片格式的目标图片。
具体实现中,所述源图片格式的质量参数与目标图片格式的质量参数之间的映射关系可以包括源图片格式的至少一个质量参数采样值以及与源图片格式的各个质量参数采样值对应的目标图片格式的质量参数。在该实施方式下,目标质量获取模块520可以如图9所示进一步包括:
采样转码单元521,用于针对目标质量参数采样值的源图片分别采用多个不同的转码质量参数进行转码,得到分别与所述多个不同转码质量参数对应的多个目标图片格式的转码图片;
质量选择单元522,用于通过将各个转码图片与所述目标质量参数采样值的源图片进行比较,在所述多个转码图片中确认图像质量满足预设质量要求并且图片数据量最小的转码图片,并将所述图像质量满足预设质量要求并且图片数据量最小的转码图片对应的转码质量参数作为与所述目标质量参数采样值对应的目标图片格式的质量参数。
即目标质量获取模块520可以遍历所述源图片格式的至少一个质量参数采样值中的每个质量参数采样值作为目标质量采样值,采样转码单元521针对目标质量参数采样值的源图片分别采用多个不同的转码质量参数进行转码,得到分别与所述多个不同转码质量参数对应的多个目标图片格式的转码图片。接着质量选择单元522通过将各个转码图片与所述目标质量参数采样值的源图片进行比较,在所述多个转码图片中选择图像质量满足预设质量要求并且图片数据量最小的转码图片,进而将所述图像质量满足预设质量要求并且图片数据量最小的转码图片对应的转码质量参数作为与所述目标质量参数采样值对应的目标图片格式的 质量参数。通过针对所述源图片格式的至少一个质量参数采样值中的每个质量参数采样值进行上述的采样转码和质量选择过程,目标质量获取模块520可以得到各个质量参数采样值对应的目标图片格式的质量参数。
进一步的,所述目标质量获取模块520还可以包括:
质量映射单元523,用于在所述源图片格式的质量参数与目标图片格式的质量参数之间的映射关系中查找与所述源图片的源图质量参数最接近的质量参数采样值,将所述质量参数采样值对应的目标图片格式的质量参数作为与源图片的源图质量参数对应的目标图片格式的目标图片质量参数。
在另一些实施例中,所述源图片格式的质量参数与目标图片格式的质量参数之间的映射关系包括根据源图片格式的质量参数计算目标图片格式的质量参数的映射公式。所述目标质量获取模块520还可以包括:
映射公式训练单元524,用于将多个目标图片格式的转码图片的质量参数及其对应的源图片的源图质量参数作为训练参数,对所述映射公式进行训练,使得经过训练的所述映射公式逼近所述多个转码图片的质量参数与其对应的源图片的源图质量参数之间的对应关系。
具体实现中,图片转码装置可以通过将多个目标图片格式的转码图片的质量参数及其对应的源图片的源图质量参数作为训练参数,对所述映射公式进行训练,使得经过训练的所述映射公式逼近所述多个转码图片的质量参数与其对应的源图片的源图质量参数之间的对应关系。
需要指出的是,目标质量获取模块520可以包括如图9所示的功能单元的中的任一个,也可以包括其中的所有功能单元,采样转码单元521、质量选择单元522以及映射公式训练单元524还可以通过相互配合共同得到源图片格式的质量参数与目标图片格式的质量参数之间的映射关系,例如由采样转码单元521和质量选择单元522得到源图片格式的至 少一个质量参数采样值以及与源图片格式的各个质量参数采样值对应的目标图片格式的质量参数,进而由映射公式训练单元524根据上述源图片格式的质量参数采样值与目标图片格式的质量参数之间的对应关系训练得到根据源图片的质量参数计算目标图片格式的质量参数的映射公式。
本申请实施例中的图片转码装置可以通过根据源图片的质量参数采用对应的质量配置进行图片转码,从而能够避免在源图片质量配置较低时,对目标图片采用较高质量配置导致转码后图片文件数据量冗余造成的存储资源或网络传输资源的浪费。
这里需要指出的是,上述图片转码装置可以为PC这种电子设备,还可以为如PAD,平板电脑,手提电脑这种便携电子设备,不限于这里的描述;也可以是通过集群服务器构成的,为实现各单元功能而合并为一实体或各单元功能分体设置的电子设备,媒体搜索词推送装置至少包括用于存储数据的数据库和用于数据处理的处理器,可以包括内置的存储介质或独立设置的存储介质。
其中,对于用于数据处理的处理器而言,在执行处理时,可以采用微处理器、中央处理器(CPU,Central Processing Unit)、数字信号处理器(DSP,Digital SingnalProcessor)或可编程逻辑阵列(FPGA,Field-Programmable Gate Array)实现;对于存储介质来说,包含操作指令,该操作指令可以为计算机可执行代码,通过所述操作指令来实现上述本申请实施例如图1所示的图片转码方法流程中的各个步骤。
图片转码装置作为硬件实体的一个示例如图11所示。所述装置包括处理器901、存储介质902以及至少一个外部通信接口903;所述处理器901、存储介质902以及通信接口903均通过总线904连接。
图片转码装置中的处理器901可以调用存储介质902中的操作指令 执行以下流程:
获取源图片的源图质量参数;
根据所述源图质量参数,对所述源图片进行转码得到目标图片格式的目标图片,所述目标图片的目标图片质量参数与所述源图质量参数匹配。
这里需要指出的是:以上涉及图片转码装置的描述,与前文图片转码方法的描述是类似的,不做赘述。对于本申请图片转码装置实施例中未披露的技术细节,请参照本申请方法实施例的描述。
图12是本申请另一实施例中的图片转码装置的结构示意图,如图所示本实施例中的图片转码装置至少可以包括:
映射关系获取模块1220,用于获取源图片的质量参数与目标图片格式的质量参数之间的映射关系。
在一些实施例中,所述源图片格式的质量参数与目标图片格式的质量参数之间的映射关系可以包括源图片格式的至少一个质量参数采样值以及与源图片格式的各个质量参数采样值对应的目标图片格式的质量参数。在该实施方式下,所述映射关系获取模块1220可以如图13所示进一步包括:
采样转码单元1221,用于针对目标质量参数采样值的源图片分别采用多个不同的转码质量参数进行转码,得到分别与所述多个不同转码质量参数对应的多个目标图片格式的转码图片;
质量选择单元1222,用于通过将各个转码图片与所述目标质量参数采样值的源图片进行比较,在所述多个转码图片中选择图像质量满足预设质量要求并且图片数据量最小的转码图片,并将所述图像质量满足预设质量要求并且图片数据量最小的转码图片对应的转码质量参数作为与所述目标质量参数采样值对应的目标图片格式的质量参数。
即可以通过遍历所述源图片格式的至少一个质量参数采样值中的每个质量参数采样值作为目标质量采样值,采样转码单元1221针对目标质量参数采样值的源图片分别采用多个不同的转码质量参数进行转码,得到分别与所述多个不同转码质量参数对应的多个目标图片格式的转码图片。以源图片格式的质量参数在0-100的数值区间为例,所述源图片格式的至少一个质量参数采样值可以为(5,10,15,20,25,30…85,90,95),在其他实施例中可以根据需要选取更多或其中部分的质量参数采样值。相应的,同样以转码质量参数在0-100的数值区间为例,针对目标质量参数采样值的源图片,图片转码装置分别采用(5,10,15,20,25,30…85,90,95)的转码质量参数进行转码,从而得到分别与19个转码质量参数对应的转码图片。接着质量选择单元1222通过将各个转码图片与所述目标质量参数采样值的源图片进行比较,在所述多个转码图片中选择图像质量满足预设质量要求并且图片数据量最小的转码图片,进而将所述图像质量满足预设质量要求并且图片数据量最小的转码图片对应的转码质量参数作为与所述目标质量参数采样值对应的目标图片格式的质量参数。质量选择单元1222将各个转码图片与所述目标质量参数采样值的源图片进行比较可以得到各个转码图片与源图片之间的画面内容差异,差异越大则表示转码图片的图像质量越低,接着上文示例中得到了19个转码质量参数对应的转码图片,假设预设质量要求为转码图片与源图片之间的画面内容差异不超过10%,则质量选择单元1222在所述19个转码质量参数对应的转码图片中查找满足该预设质量要求的转码图片,例如QP为5,10,15对应的转码图片满足与源图片之间的画面内容差异不超过10%的质量要求,但是QP为15对应的转码图片的图片数据量最小,那么质量选择单元1222将QP为15作为与所述目标质量参数采样值对应的目标图片格式的质量参数。
通过针对所述源图片格式的至少一个质量参数采样值中的每个质量参数采样值进行上述的采样转码和质量选择过程,映射关系获取模块1220可以得到各个质量参数采样值对应的目标图片格式的质量参数。
在另一些实施例中,所述源图片格式的质量参数与目标图片格式的质量参数之间的映射关系包括根据源图片格式的质量参数计算目标图片格式的质量参数的映射公式,映射关系获取模块1220可以包括:
映射训练单元1223,用于将多个目标图片格式的转码图片的质量参数及其对应的源图片的源图质量参数作为训练参数,对所述映射公式进行训练,使得经过训练的所述映射公式逼近所述多个转码图片的质量参数与其对应的源图片的源图质量参数之间的对应关系。
映射训练单元1223由多组已知转码效率满足要求的目标图片格式的转码图片的质量参数及其对应的源图片的源图质量参数对所述源图片的质量参数与目标图片格式的质量参数之间的映射关系进行训练,如图2所示的图片转码,源图片格式为JPEG,目标图片格式为BPG(Better Portable Graphics,更好的便携式图形),将源图片的源图质量参数归一化处理至数值0~100,数值越大表示源图片的图像质量越高,而使用量化参数QP作为目标图片质量参数代表转码后图片的图像质量,QP越小则转码后的目标图片质量越高,示例性的,已知分别针对A图片、B图片以及C图片的转码效率满足要求,A图片的源图质量参数为80,其转码后对应的A图片的质量参数为24;B图片的源图质量参数为70,其转码后对应的B图片的质量参数为27;C图片的源图质量参数为60,其转码后对应的B图片的质量参数为24,那么根据这三组转码图片的质量参数与其对应的源图片的源图质量参数可以预测根据源图片的质量参数计算目标图片格式的质量参数的映射公式为:
DQP=-0.6*SQP+72;
其中DQP为转码后BPG图片的质量参数,SQP为归一化处理至数值0~100后的JPEG格式的源图质量参数。
需要指出的是,以上源图片格式的质量参数与目标图片格式的质量参数之间的映射关系的训练方式以及训练得到的源图片的质量参数与目标图片格式的质量参数之间的映射关系均仅为示例,本领域技术人员根据本申请实施例公开的内容可以得到更多的训练方式以及更多的源图片的质量参数与目标图片格式的质量参数之间的映射关系,例如更为简单的映射关系:
DQP=SQP;DQP=100-SQP;
或DQP=SQP+N,N为一设定常数值,或为经过训练得到的常数值。
目标质量获取模块1230,用于根据源图片的质量参数与目标图片格式的质量参数之间的映射关系,获取与源图片的源图质量参数对应的目标图片格式的目标图片质量参数。
在一些实施例中,若源图片格式的质量参数与目标图片格式的质量参数之间的映射关系包括源图片格式的至少一个质量参数采样值以及与源图片格式的各个质量参数采样值对应的目标图片格式的质量参数,那么图片转码装置在需要对源图片进行转码时,可以由目标质量获取模块1230在所述源图片格式的质量参数与目标图片格式的质量参数之间的映射关系中查找与所述源图片的源图质量参数最接近的质量参数采样值,将所述质量参数采样值对应的目标图片格式的质量参数作为与源图片的源图质量参数对应的目标图片格式的目标图片质量参数。例如所述源图片的源图质量参数为54,那么最接近的质量参数采样值为55,图片转码装置在所述源图片格式的质量参数与目标图片格式的质量参数之间的映射关系中查找质量参数采样值为55对应的目标图片格式的质量参数,将质量参数采样值为55对应的目标图片格式的质量参数确 定为本次转码的目标图片格式的目标图片质量参数。
在另一实施例中,若源图片格式的质量参数与目标图片格式的质量参数之间的映射关系包括根据源图片格式的质量参数计算目标图片格式的质量参数的映射公式,则图片转码装置在需要对源图片进行转码时,可以由目标质量获取模块1230将所述源图片的源图质量参数代入所述映射公式中计算得到本次转码的目标图片格式的目标图片质量参数。
图片转码模块1240,用于根据所述目标图片质量参数,对所述源图片进行转码得到目标图片格式的目标图片。
在一些实施例中,所述图片转码模块1240同如图10所示进一步可以包括:
源图解码单元,用于将源图片解码成原始像素数据;
编码单元,用于按照所述目标图片质量参数将所述原始像素数据重新编码得到目标图片格式的目标图片。
在一些实施例中的图片转码装置进一步还可以包括:
源图质量获取模块1210,用于获取源图片的源图质量参数。
所述源图质量参数表征源图片的图像质量。常用的图像质量评价算法可以包括:SSIM算法,MSE算法、IFC算法和VIF算法等。源图质量获取模块1210可以通过上述方式获取源图片的源图质量参数,也可以从其他设备或渠道接收源图质量参数的结果,例如人工输入或从第三设备或网络服务器接收源图片的源图质量参数。
本申请实施例中的图片转码装置可以通过根据源图片的质量参数采用对应的质量配置进行图片转码,从而能够避免在源图片质量配置较低时,对目标图片采用较高质量配置导致转码后图片文件数据量冗余造成的存储资源或网络传输资源的浪费。
这里需要指出的是,上述图片转码装置可以为PC这种电子设备, 还可以为如PAD,平板电脑,手提电脑这种便携电子设备,不限于这里的描述;也可以是通过集群服务器构成的,为实现各单元功能而合并为一实体或各单元功能分体设置的电子设备,媒体搜索词推送装置至少包括用于存储数据的数据库和用于数据处理的处理器,可以包括内置的存储介质或独立设置的存储介质。
其中,对于用于数据处理的处理器而言,在执行处理时,可以采用微处理器、中央处理器(CPU,Central Processing Unit)、数字信号处理器(DSP,Digital SingnalProcessor)或可编程逻辑阵列(FPGA,Field-Programmable Gate Array)实现;对于存储介质来说,包含操作指令,该操作指令可以为计算机可执行代码,通过所述操作指令来实现上述本申请实施例如图4所示的图片转码方法流程中的各个步骤。
图片转码装置作为硬件实体的一个示例如图14所示。所述装置包括处理器1401、存储介质1402以及至少一个外部通信接口1403;所述处理器1401、存储介质1402以及通信接口1403均通过总线1404连接。
图片转码装置中的处理器1401可以调用存储介质1402中的操作指令执行以下流程:
获取源图片格式的质量参数与目标图片格式的质量参数之间的映射关系;
根据源图片格式的质量参数与目标图片格式的质量参数之间的映射关系,获取与源图片的源图质量参数对应的目标图片格式的目标图片质量参数;
根据所述目标图片质量参数,对所述源图片进行转码得到目标图片格式的目标图片。
这里需要指出的是:以上涉及图片转码装置的描述,与前文图片转码方法的描述是类似的,同方法的有益效果描述,不做赘述。对于本申 请图片转码装置实施例中未披露的技术细节,请参照本申请方法实施例的描述。
图15是本申请实施例中的一种源图质量参数获取装置,如图所示本申请实施例中的源图质量参数获取装置包括:
量化矩阵获取单元1510,用于获取源图片的量化矩阵。
示例性的,以源图片为JPEG格式为例,所述量化矩阵可以为一个8x8的量化系数矩阵,在其他实施例中也可以是16x16或其他大小的矩阵。
在一些实施例中,图片转码装置可以通过解析JPEG文件数据中的DQT(Define Quantization Table,定义量化表),通常在JPEG文件数据中以DQT为开头的数据段,获得JPEG的8x8量化矩阵。
在一些实施例中,JPEG图片可以包含不止一个量化矩阵,例如包括一个亮度量化矩阵和一个色度量化矩阵,为方便说明,本实施例只以亮度量化矩阵为例进行说明。
源图质量获取单元1520,用于通过比较源图片的量化矩阵与预设的标准量化矩阵,获取所述源图片的源图质量参数。
在一些实施例中,所述源图质量获取单元5120进一步还可以包括:
矩阵比较子单元5121,用于根据源图片的量化矩阵中的各系数与预设的标准量化矩阵中相应位置的系数之间的比值,获取所述源图片的量化矩阵与标准量化矩阵之间的差异系数值。
所述预设的标准量化矩阵可以为预先依据心理视觉阀制定的,对源图片的亮度或色度的图像编码质量效果达到指定标准的量化矩阵。
以亮度量化矩阵为例,图片转码装置可以计算源图片的亮度量化矩阵与亮度标准量化矩阵中相应位置的系数之间的比值,获取所述源图片的量化矩阵与标准量化矩阵之间的差异系数值。
归一化子单元1522,用于根据预设的归一化算法对所述差异系数值归一化处理得到所述源图质量参数。
本实施例中的源图质量参数获取装置可以适用于获取JPEG等图片格式的源图片的源图质量参数。具体实现过程和原理可以参考上文通过结合图5描述的实现过程,本实施例中不再赘述。
源图质量参数获取装置在分析得到源图质量参数后,可以交由其他装置或自身根据所述源图质量参数,对所述源图片进行转码得到目标图片格式的目标图片,所述目标图片的目标图片质量参数与所述源图质量参数匹配。
所述根据所述源图质量参数,对所述源图片进行转码得到目标图片格式的目标图片具体可以为:
根据源图片格式的质量参数与目标图片格式的质量参数之间的映射关系,获取与所述源图片的源图质量参数对应的目标图片格式的目标图片质量参数;
根据所述目标图片质量参数,对所述源图片进行转码得到目标图片格式的目标图片
这里需要指出的是,上述源图质量参数获取装置可以为PC这种电子设备,还可以为如PAD,平板电脑,手提电脑这种便携电子设备,不限于这里的描述;也可以是通过集群服务器构成的,为实现各单元功能而合并为一实体或各单元功能分体设置的电子设备,源图质量参数获取装置至少包括用于存储数据的数据库和用于数据处理的处理器,可以包括内置的存储介质或独立设置的存储介质。
其中,对于用于数据处理的处理器而言,在执行处理时,可以采用微处理器、中央处理器(CPU,Central Processing Unit)、数字信号处理器(DSP,Digital SingnalProcessor)或可编程逻辑阵列(FPGA,Field- Programmable Gate Array)实现;对于存储介质来说,包含操作指令,该操作指令可以为计算机可执行代码,通过所述操作指令来实现上述本申请实施例如图5所示的源图质量参数获取方法流程中的各个步骤。
源图质量参数获取装置作为硬件实体的一个示例如图16所示。所述装置包括处理器1601、存储介质1602以及至少一个外部通信接口1603;所述处理器1601、存储介质1602以及通信接口1603均通过总线1604连接。
图片转码装置中的处理器1601可以调用存储介质1602中的操作指令执行以下流程:
获取源图片的量化矩阵;
通过比较源图片的量化矩阵与预设的标准量化矩阵,获取所述源图片的源图质量参数。
这里需要指出的是:以上涉及源图质量参数获取装置的描述,与前文源图质量参数获取方法的描述是类似的,同方法的有益效果描述,不做赘述。对于本申请源图质量参数获取装置实施例中未披露的技术细节,请参照本申请方法实施例的描述。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。以上所描述的设备实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个单元或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的耦合、或直接耦合、或通信连接可以是通过一些接口,设备或单元的间接耦合或通信连接,可以是电性的、机械的或其它形式的。
上述作为分离部件说明的单元可以是、或也可以不是物理上分开的, 作为单元显示的部件可以是、或也可以不是物理单元,即可以位于一个地方,也可以分布到多个网络单元上;可以根据实际的需要选择其中的部分或全部单元来实现本实施例方案的目的。
另外,在本申请各实施例中的各功能单元可以全部集成在一个处理单元中,也可以是各单元分别单独作为一个单元,也可以两个或两个以上单元集成在一个单元中;上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
或者,本申请上述集成的单元如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本申请各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (18)

  1. 一种图片转码方法,应用于计算机设备,所述方法包括:
    获取源图片的源图质量参数,其中所述源图片为待转码的图片,所述源图质量参数用于表征所述源图片的图像质量;
    根据所述源图质量参数以及预设的映射关系,获取与所述源图片的源图质量参数对应的目标图片格式的目标图片质量参数;
    根据所述目标图片质量参数,对所述源图片进行转码得到目标图片格式的目标图片。
  2. 如权利要求1所述的图片转码方法,所述获取源图片的源图质量参数包括:
    获取源图片的量化矩阵;
    通过比较源图片的量化矩阵与预设的标准量化矩阵,获取所述源图片的源图质量参数。
  3. 如权利要求2所述的图片转码方法,所述通过比较源图片的量化矩阵与预设的标准量化矩阵,获取所述源图片的源图质量参数包括:
    根据源图片的量化矩阵中的各系数与预设的标准量化矩阵中相应位置的系数之间的比值,获取所述源图片的量化矩阵与标准量化矩阵之间的差异系数值;
    根据预设的归一化算法对所述差异系数值归一化处理得到所述源图质量参数。
  4. 如权利要求1所述的图片转码方法,所述预设的映射关系包括源图片格式的至少一个质量参数采样值以及与源图片格式的各个质量参数采样值对应的目标图片格式的质量参数之间的映射关系;
    所述根据源图质量参数和预设的映射关系,获取与源图片的源图质量参数对应的目标图片格式的目标图片质量参数包括:
    在所述源图片格式的至少一个质量参数采样值与目标图片格式的质量参数之间的映射关系中,查找与所述源图片的源图质量参数最接近的质量参数采样值,将所述质量参数采样值对应的目标图片格式的质量参数作为与源图片的源图质量参数对应的目标图片格式的目标图片质量参数。
  5. 根据权利要求4所述的方法,进一步包括:获取所述源图片格式的至少一个质量参数采样值与对应的目标图片格式的质量参数之间的映射关系;
    所述获取源图片格式的至少一个质量参数采样值与对应的目标图片格式的质量参数之间的映射关系包括:
    将每个质量参数采样值作为目标质量参数采样值,针对目标质量参数采样值的源图片分别采用多个不同的转码质量参数进行转码,得到分别与所述多个不同转码质量参数对应的多个目标图片格式的转码图片;
    通过将各个转码图片与所述目标质量参数采样值的源图片进行比较,在所述多个转码图片中选择图像质量满足预设质量要求并且图片数据量最小的转码图片;
    将所述图像质量满足预设质量要求并且图片数据量最小的转码图片对应的转码质量参数作为与所述目标质量参数采样值对应的目标图片格式的质量参数。
  6. 如权利要求1所述的图片转码方法,所述获取源图片的源图质量参数包括:
    根据源图片中每个像素宏块的量化参数,获取所述源图片的源图质量参数。
  7. 如权利要求1所述的图片转码方法,所述预设的映射关系为用于根据源图片的源图质量参数计算目标图片格式的目标图片质量参数 的映射公式;
    所述根据源图质量参数和预设的映射关系,获取与源图片的源图质量参数对应的目标图片格式的目标图片质量参数包括:
    将所述源图质量参数代入所述映射公式中,计算得到所述与源图片的源图质量参数对应的目标图片格式的目标图片质量参数。
  8. 根据权利要求7所述的图片转码方法,其中,在获取源图片的源图质量参数之前,所述方法还包括:
    将多个目标图片格式的转码图片的质量参数及其对应的源图片的源图质量参数作为训练参数,对所述映射公式进行训练,使得经过训练的所述映射公式逼近所述多个转码图片的质量参数与其对应的源图片的源图质量参数之间的对应关系。
  9. 如权利要求1所述的图片转码方法,所述根据所述目标图片质量参数,对所述源图片进行转码得到目标图片格式的目标图片包括:
    将源图片解码成原始像素数据;
    按照所述目标图片质量参数将所述原始像素数据重新编码得到目标图片格式的目标图片。
  10. 一种图片转码装置,所述装置包括:
    处理器;
    与所述处理器相连接的存储器;所述存储器中存储有机器可读指令模块;所述机器可读指令模块包括:
    源图质量获取模块,用于获取源图片的源图质量参数,其中所述源图片为待转码的图片,所述源图质量参数用于表征所述源图片的图像质量;
    目标质量获取模块,用于根据所述源图质量参数以及预设的映射关系,获取与所述源图片的源图质量参数对应的目标图片格式的目标图片 质量参数;
    图片转码模块,用于根据所述目标图片质量参数,对所述源图片进行转码得到目标图片格式的目标图片。
  11. 如权利要求10所述的图片转码装置,所述源图质量获取模块包括:
    量化矩阵获取单元,用于获取源图片的量化矩阵;
    源图质量获取单元,用于通过比较源图片的量化矩阵与预设的标准量化矩阵,获取所述源图片的源图质量参数。
  12. 如权利要求11所述的图片转码装置,所述源图质量获取单元包括:
    矩阵比较子单元,用于根据源图片的量化矩阵中的各系数与预设的标准量化矩阵中相应位置的系数之间的比值,获取所述源图片的量化矩阵与标准量化矩阵之间的差异系数值;
    归一化子单元,用于根据预设的归一化算法对所述差异系数值归一化处理得到所述源图质量参数。
  13. 如权利要求10所述的图片转码装置,所述预设的映射关系包括源图片格式的至少一个质量参数采样值以及与源图片格式的各个质量参数采样值对应的目标图片格式的质量参数之间的映射关系;
    所述目标质量获取模块包括:
    质量映射单元,用于在所述源图片格式的至少一个质量参数采样值与目标图片格式的质量参数之间的映射关系中,查找与所述源图片的源图质量参数最接近的质量参数采样值,将所述质量参数采样值对应的目标图片格式的质量参数作为与源图片的源图质量参数对应的目标图片格式的目标图片质量参数。
  14. 如权利要求13所述的图片转码装置,其中,所述目标质量获 取模块还包括:
    采样转码单元,用于将每个质量参数采样值作为目标质量参数采样值,针对目标质量参数采样值的源图片分别采用多个不同的转码质量参数进行转码,得到分别与所述多个不同转码质量参数对应的多个目标图片格式的转码图片;
    质量选择单元,用于通过将各个转码图片与所述目标质量参数采样值的源图片进行比较,在所述多个转码图片中选择图像质量满足预设质量要求并且图片数据量最小的转码图片,并将所述图像质量满足预设质量要求并且图片数据量最小的转码图片对应的转码质量参数作为与所述目标质量参数采样值对应的目标图片格式的质量参数。
  15. 如权利要求10所述的图片转码装置,所述源图质量获取模块用于:
    根据源图片中每个像素宏块的量化参数,获取所述源图片的源图质量参数。
  16. 如权利要求10所述的图片转码装置,所述预设的映射关系为用于根据源图片的源图质量参数计算目标图片格式的目标图片质量参数的映射公式;
    所述目标质量获取模块包括:
    质量映射单元,用于将所述源图质量参数代入所述映射公式中,计算得到所述目标图片格式的目标图片质量参数。
  17. 如权利要求16所述的图片转码装置,其中,所述装置还包括:
    映射公式训练模块,用于将多个目标图片格式的转码图片的质量参数及其对应的源图片的源图质量参数作为训练参数,对所述映射公式进行训练,使得经过训练的所述映射公式逼近所述多个转码图片的质量参数与其对应的源图片的源图质量参数之间的对应关系。
  18. 一种非易失性计算机可读存储介质,其中所述存储介质中存储有机器可读指令,所述机器可读指令可以由处理器执行以完成权利要求1-9中任一项所述的方法。
PCT/CN2018/079443 2017-04-27 2018-03-19 图片转码方法和装置 Ceased WO2018196502A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US16/504,764 US10904542B2 (en) 2017-04-27 2019-07-08 Image transcoding method and apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710299885.3 2017-04-27
CN201710299885.3A CN108805943B (zh) 2017-04-27 2017-04-27 图片转码方法和装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/504,764 Continuation US10904542B2 (en) 2017-04-27 2019-07-08 Image transcoding method and apparatus

Publications (1)

Publication Number Publication Date
WO2018196502A1 true WO2018196502A1 (zh) 2018-11-01

Family

ID=63919411

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/079443 Ceased WO2018196502A1 (zh) 2017-04-27 2018-03-19 图片转码方法和装置

Country Status (4)

Country Link
US (1) US10904542B2 (zh)
CN (1) CN108805943B (zh)
TW (1) TWI680437B (zh)
WO (1) WO2018196502A1 (zh)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113486939B (zh) * 2021-06-30 2024-07-09 平安证券股份有限公司 一种处理图片的方法、装置、终端及存储介质
US12062144B2 (en) * 2022-05-27 2024-08-13 Snap Inc. Automated augmented reality experience creation based on sample source and target images
CN115396683B (zh) * 2022-08-22 2024-04-09 广州博冠信息科技有限公司 视频优化处理方法、装置、电子设备及计算机可读介质
CN118660164B (zh) * 2024-08-21 2024-11-22 深圳市杉岩数据技术有限公司 一种基于对象属性的图像转码压缩、解压缩的方法及装置

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010010707A1 (en) * 2000-01-31 2001-08-02 Mitsubishi Denki Kabushiki Kaisha Image signal transcoder capable of bit stream transformation suppressing deterioration of picture quality
CN1695382A (zh) * 2002-11-01 2005-11-09 诺基亚有限公司 用于图像编码转换的方法和设备
CN102917157A (zh) * 2012-10-19 2013-02-06 北京快联科技有限公司 一种基于人体视觉系统的图片压缩系统及方法
US20130156310A1 (en) * 2011-12-15 2013-06-20 Microsoft Corporation Dynamic Image Quality Checker for use in Image Transcoding
CN105187835A (zh) * 2014-05-30 2015-12-23 阿里巴巴集团控股有限公司 基于内容的自适应视频转码方法及装置
CN105791849A (zh) * 2014-12-25 2016-07-20 中兴通讯股份有限公司 图片压缩方法及装置
CN106611432A (zh) * 2015-10-21 2017-05-03 深圳市腾讯计算机系统有限公司 一种图片格式转换方法、装置和系统

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7356079B2 (en) * 2001-11-21 2008-04-08 Vixs Systems Inc. Method and system for rate control during video transcoding
JP4167226B2 (ja) 2002-10-30 2008-10-15 テレフオンアクチーボラゲット エル エム エリクソン(パブル) アドホック・モードwlanシステムで使用するための方法
US8204323B2 (en) * 2003-06-05 2012-06-19 Aware, Inc. Image quality control techniques
US7672524B2 (en) * 2006-03-02 2010-03-02 Mitsubishi Electric Research Laboratories, Inc. Quality control for image transcoding
JP4944966B2 (ja) * 2006-12-14 2012-06-06 トレデス 2010, ソシエダッド リミターダ デジタル画像をデジタル透かしにより印付ける方法
TWI347786B (en) * 2007-08-13 2011-08-21 Jeilin Technology Corp Ltd Method of image compression and device thereof
CN101842812B (zh) * 2007-11-02 2012-05-30 高等技术学校 用于数字图像转码中的参数质量感知选择的系统和方法
JP5176175B2 (ja) * 2007-11-02 2013-04-03 エコール・ドゥ・テクノロジー・スュペリュール 品質制御パラメータの変更及びスケーリングによって変換される画像のファイルサイズを予想するシステム、方法及びプログラム
US8885050B2 (en) * 2011-02-11 2014-11-11 Dialogic (Us) Inc. Video quality monitoring
KR20130049523A (ko) * 2011-11-04 2013-05-14 오수미 인트라 예측 블록 생성 장치
US8897586B2 (en) * 2012-06-15 2014-11-25 Comcast Cable Communications, Llc Dynamic generation of a quantization matrix for compression of a digital object

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010010707A1 (en) * 2000-01-31 2001-08-02 Mitsubishi Denki Kabushiki Kaisha Image signal transcoder capable of bit stream transformation suppressing deterioration of picture quality
CN1695382A (zh) * 2002-11-01 2005-11-09 诺基亚有限公司 用于图像编码转换的方法和设备
US20130156310A1 (en) * 2011-12-15 2013-06-20 Microsoft Corporation Dynamic Image Quality Checker for use in Image Transcoding
CN102917157A (zh) * 2012-10-19 2013-02-06 北京快联科技有限公司 一种基于人体视觉系统的图片压缩系统及方法
CN105187835A (zh) * 2014-05-30 2015-12-23 阿里巴巴集团控股有限公司 基于内容的自适应视频转码方法及装置
CN105791849A (zh) * 2014-12-25 2016-07-20 中兴通讯股份有限公司 图片压缩方法及装置
CN106611432A (zh) * 2015-10-21 2017-05-03 深圳市腾讯计算机系统有限公司 一种图片格式转换方法、装置和系统

Also Published As

Publication number Publication date
US20190335186A1 (en) 2019-10-31
TW201907365A (zh) 2019-02-16
CN108805943A (zh) 2018-11-13
CN108805943B (zh) 2022-12-09
US10904542B2 (en) 2021-01-26
TWI680437B (zh) 2019-12-21

Similar Documents

Publication Publication Date Title
US8892764B1 (en) Dynamic selection of parameter sets for transcoding media data
US10887365B2 (en) System and methods for bit rate control
KR101832418B1 (ko) 이미지 압축 품질을 최적화 하기 위한 방법 및 시스템
EP4075800A1 (en) Encoding method and encoder
US10904542B2 (en) Image transcoding method and apparatus
US10205763B2 (en) Method and apparatus for the single input multiple output (SIMO) media adaptation
WO2022133753A1 (zh) 点云编解码方法与系统、及点云编码器与点云解码器
WO2020244328A1 (zh) 图像处理方法及装置
WO2019114294A1 (zh) 图像编解码方法、装置、系统及存储介质
EP4075803A1 (en) Coding method and coder
WO2022140937A1 (zh) 点云编解码方法与系统、及点云编码器与点云解码器
EP3720128A1 (en) Methods, systems, and apparatuses for processing video by adaptive rate distortion optimization
EP4412214A1 (en) Video encoding and decoding method, device and system, and storage medium
EP3709660B1 (en) Method and apparatus for content-adaptive frame duration extension
WO2023169303A1 (zh) 编解码方法、装置、设备、存储介质及计算机程序产品
CN111476866A (zh) 视频优化与播放方法、系统、电子设备及存储介质
US20260122275A1 (en) Systems, methods, and apparatuses for video processing
CN108347451B (zh) 图片处理系统、方法和装置
CN111970508B (zh) 视频编码方法、装置、计算机设备及存储介质
KR20230082554A (ko) 포인트 클라우드의 플렌옵틱 색상 정보 부호화/복호화 방법, 장치 및 기록
RU2854759C2 (ru) Способ кодирования и декодирования характеристических данных и устройство
US12621444B2 (en) Loop filtering, video encoding, and video decoding methods and apparatus, storage medium, and electronic device
WO2024213012A1 (en) Visual volumetric video-based coding method, encoder and decoder
US20240283952A1 (en) Adaptive coding tool selection with content classification
US8411971B1 (en) Method and apparatus for normalizing perceptual quality in media compression

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: 18791306

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: 18791306

Country of ref document: EP

Kind code of ref document: A1