Image processing method, device and equipment
By dividing the image into N-layer blocks and analyzing the rate-distortion cost of filtering units, the problem of resource waste in image processing schemes is solved, and more efficient image coding is achieved.
Patent Information
- Application Number
- CN202011409791.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-04
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2040-12-04
AI Technical Summary
Existing image processing solutions suffer from wasted processing resources, especially when adapting to diverse image content, resulting in excessively high bitrate consumption and impacting final performance.
By dividing the image to be processed into N-level blocks, the rate-distortion cost of each filtering unit and the sum of the costs are obtained. Based on these costs, the final block division result is determined, the size of the filtering unit is reasonably designed to adapt to diverse image content, reduce bit rate consumption, and avoid resource waste.
A more reasonable filter unit design was implemented to adapt to diverse image content, reduce bitrate consumption, avoid waste of processing resources, ensure final performance, and improve coding efficiency.
Smart Images

Figure CN114615494B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image processing method, device and equipment. Background Art
[0002] Sample adaptive offset (SAO) is one of the important technologies in video encoding and decoding. The SAO technology can effectively reduce the ringing effect.
[0003] However, the existing SAO scheme for pixel compensation has the problems of being unable to adapt to diverse image contents, consuming too high a bit rate, wasting processing resources, and affecting the final performance.
[0004] That is, existing image processing solutions have problems such as wasting processing resources. Summary of the invention
[0005] The object of the present invention is to provide an image processing method, apparatus and device to solve the problem of waste of processing resources in the image processing scheme in the prior art.
[0006] In order to solve the above technical problems, an embodiment of the present invention provides an image processing method, including:
[0007] Divide the image to be processed into N layers of blocks to obtain a filter unit corresponding to each layer of block division; wherein the filter unit is a first filter unit or a second filter unit, the first filter unit is a filter unit obtained by dividing the Mth layer of blocks, the second filter unit is a filter unit obtained by dividing the M+1th layer of blocks, and the second filter unit is obtained by dividing the first filter unit into blocks;
[0008] Obtaining a sum of a first rate-distortion cost of each of the first filtering units and a second rate-distortion cost of each of the second filtering units corresponding to the first filtering units;
[0009] Determining a final block division result of the image to be processed according to the first rate-distortion cost and the sum;
[0010] Wherein, N is an integer greater than 0, M takes each value from 0 to N-1 in sequence; and one second filtering unit is greater than or equal to one pixel.
[0011] Optionally, determining a final block result of the image to be processed according to the first rate-distortion cost and the sum includes:
[0012] Obtaining a block result corresponding to each of the first filtering units according to the first rate-distortion costs corresponding to each of the first filtering units and the sum;
[0013] According to each of the block division results, a final block division result of the image to be processed is determined.
[0014] Optionally, obtaining the block results corresponding to each of the first filtering units according to the first rate-distortion costs corresponding to each of the first filtering units and the sum includes:
[0015] When the first rate-distortion cost corresponding to the first filtering unit is greater than or equal to the corresponding sum, retaining the second filtering unit corresponding to the first filtering unit and the first filtering unit;
[0016] Obtaining a block result corresponding to the first filtering unit according to the retained second filtering unit corresponding to the first filtering unit and the first filtering unit; or,
[0017] When the first rate-distortion cost corresponding to the first filtering unit is less than the corresponding sum, deleting the second filtering unit corresponding to the first filtering unit, and retaining the first filtering unit;
[0018] According to the retained first filtering unit, a block result corresponding to the first filtering unit is obtained.
[0019] Optionally, obtaining a first rate-distortion cost of each of the first filtering units and a second rate-distortion cost of a second filtering unit corresponding to each of the first filtering units includes:
[0020] Determining a filter offset of a reference filter unit;
[0021] Obtaining a rate-distortion cost of the reference filtering unit according to the filtering offset;
[0022] The reference filtering unit is the first filtering unit, and the rate-distortion cost is a first rate-distortion cost, or the reference filtering unit is the second filtering unit, and the rate-distortion cost is a second rate-distortion cost.
[0023] Optionally, determining a filtering offset of a reference filtering unit includes:
[0024] Classifying the chrominance pixels of the reference filtering unit according to the size of the luminance pixels at the preset position of the reference filtering unit;
[0025] According to the classification result, a filtering offset of the reference filtering unit is obtained.
[0026] Optionally, classifying the chrominance pixels of the reference filtering unit according to the size of the luminance pixels at the preset position of the reference filtering unit includes:
[0027] Determining the number of classifications of the reference filter unit based on the rate-distortion cost;
[0028] The chrominance pixels of the reference filtering unit are classified according to the classification quantity and the size of the luminance pixels at the preset position of the reference filtering unit.
[0029] Optionally, acquiring the filtering offset of the reference filtering unit according to the classification result includes:
[0030] According to the classification result, the reference offset corresponding to each category of chrominance pixels is obtained;
[0031] A filtering offset of the reference filtering unit is obtained according to the reference offset.
[0032] Optionally, one of the filtering units includes at least one maximum coding unit LCU; and the image processing method further includes:
[0033] According to the first numbering identifier of the LCU in the to-be-processed image and the number of horizontal LCUs and the number of vertical LCUs in the to-be-processed image, a second numbering identifier of the filtering unit to which the LCU belongs is determined.
[0034] Optionally, determining the second numbering identifier of the filtering unit to which the LCU belongs according to the first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs and the number of vertical LCUs in the image to be processed includes:
[0035] Obtaining a first row index and a first column index of the LCU according to a first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs in the image to be processed;
[0036] Obtaining a second row index and a second column index of a filtering unit to which the LCU belongs according to the first row index, the first column index, the number of horizontal LCUs and the number of vertical LCUs of the image to be processed;
[0037] A second numbering identifier of the filtering unit to which the LCU belongs is obtained according to the second row index and the second column index.
[0038] Optionally, determining a filtering offset of a reference filtering unit includes:
[0039] Determining a filter offset of an adjacent filter unit of a reference filter unit;
[0040] The filtering offset of the adjacent filtering unit is used as the filtering offset of the reference filtering unit.
[0041] Optionally, also include:
[0042] Obtaining filtering parameter information of adjacent frame images of the current frame image;
[0043] The filtering parameter information of the adjacent frame image is used as the filtering parameter information of the current frame image.
[0044] The embodiment of the present invention further provides an image processing device, comprising:
[0045] A first processing module is used to divide the image to be processed into N layers of blocks to obtain a filter unit corresponding to each layer of block division; wherein the filter unit is a first filter unit or a second filter unit, the first filter unit is a filter unit obtained by dividing the Mth layer of blocks, the second filter unit is a filter unit obtained by dividing the M+1th layer of blocks, and the second filter unit is obtained by dividing the first filter unit into blocks;
[0046] A first acquisition module, configured to acquire a first rate-distortion cost of each of the first filtering units and a sum of a second rate-distortion cost of each of the first filtering units corresponding to the first filtering units;
[0047] A first determining module, configured to determine a final block result of the image to be processed according to the first rate-distortion cost and the sum;
[0048] Wherein, N is an integer greater than 0, M takes each value from 0 to N-1 in sequence; and one second filtering unit is greater than or equal to one pixel.
[0049] Optionally, the first determining module includes:
[0050] A first processing submodule, configured to obtain a block result corresponding to each of the first filtering units according to the first rate-distortion cost corresponding to each of the first filtering units and the sum;
[0051] According to each of the block division results, a final block division result of the image to be processed is determined.
[0052] Optionally, obtaining the block results corresponding to each of the first filtering units according to the first rate-distortion costs corresponding to each of the first filtering units and the sum includes:
[0053] When the first rate-distortion cost corresponding to the first filtering unit is greater than or equal to the corresponding sum, retaining the second filtering unit corresponding to the first filtering unit and the first filtering unit;
[0054] Obtaining a block result corresponding to the first filtering unit according to the retained second filtering unit corresponding to the first filtering unit and the first filtering unit; or,
[0055] When the first rate-distortion cost corresponding to the first filtering unit is less than the corresponding sum, deleting the second filtering unit corresponding to the first filtering unit, and retaining the first filtering unit;
[0056] According to the retained first filtering unit, a block result corresponding to the first filtering unit is obtained.
[0057] Optionally, the first acquisition module includes:
[0058] A first determination submodule, used to determine a filtering offset of a reference filtering unit;
[0059] A second processing submodule, configured to obtain a rate-distortion cost of the reference filtering unit according to the filtering offset;
[0060] The reference filtering unit is the first filtering unit, and the rate-distortion cost is a first rate-distortion cost, or the reference filtering unit is the second filtering unit, and the rate-distortion cost is a second rate-distortion cost.
[0061] Optionally, determining a filtering offset of a reference filtering unit includes:
[0062] Classifying the chrominance pixels of the reference filtering unit according to the size of the luminance pixels at the preset position of the reference filtering unit;
[0063] According to the classification result, a filtering offset of the reference filtering unit is obtained.
[0064] Optionally, classifying the chrominance pixels of the reference filtering unit according to the size of the luminance pixels at the preset position of the reference filtering unit includes:
[0065] Determining the number of classifications of the reference filter unit based on the rate-distortion cost;
[0066] The chrominance pixels of the reference filtering unit are classified according to the classification quantity and the size of the luminance pixels at the preset position of the reference filtering unit.
[0067] Optionally, acquiring the filtering offset of the reference filtering unit according to the classification result includes:
[0068] According to the classification result, the reference offset corresponding to each category of chrominance pixels is obtained;
[0069] A filtering offset of the reference filtering unit is obtained according to the reference offset.
[0070] Optionally, one of the filtering units includes at least one maximum coding unit LCU; and the image processing device further includes:
[0071] The second determining module is used to determine the second numbering identifier of the filtering unit to which the LCU belongs according to the first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs and the number of vertical LCUs in the image to be processed.
[0072] Optionally, the second determining module includes:
[0073] A third processing submodule, configured to obtain a first row index and a first column index of the LCU according to a first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs in the image to be processed;
[0074] a fourth processing submodule, configured to obtain a second row index and a second column index of a filtering unit to which the LCU belongs according to the first row index, the first column index, the number of horizontal LCUs and the number of vertical LCUs of the image to be processed;
[0075] The fifth processing submodule is used to obtain a second numbering identifier of the filtering unit to which the LCU belongs according to the second row index and the second column index.
[0076] Optionally, determining a filtering offset of a reference filtering unit includes:
[0077] Determining a filter offset of an adjacent filter unit of a reference filter unit;
[0078] The filtering offset of the adjacent filtering unit is used as the filtering offset of the reference filtering unit.
[0079] Optionally, also include:
[0080] A second acquisition module is used to acquire filtering parameter information of adjacent frame images of the current frame image;
[0081] The second processing module is used to use the filtering parameter information of the adjacent frame image as the filtering parameter information of the current frame image.
[0082] An embodiment of the present invention further provides an image processing device, comprising: a processor;
[0083] The processor is used to divide the image to be processed into N layers of blocks to obtain a filter unit corresponding to each layer of block division; wherein the filter unit is a first filter unit or a second filter unit, the first filter unit is a filter unit obtained by dividing the Mth layer of blocks, the second filter unit is a filter unit obtained by dividing the M+1th layer of blocks, and the second filter unit is obtained by dividing the first filter unit into blocks;
[0084] Obtaining a sum of a first rate-distortion cost of each of the first filtering units and a second rate-distortion cost of each of the second filtering units corresponding to the first filtering units;
[0085] Determining a final block division result of the image to be processed according to the first rate-distortion cost and the sum;
[0086] Wherein, N is an integer greater than 0, M takes each value from 0 to N-1 in sequence; and one second filtering unit is greater than or equal to one pixel.
[0087] Optionally, the processor is specifically configured to:
[0088] Obtaining a block result corresponding to each of the first filtering units according to the first rate-distortion costs corresponding to each of the first filtering units and the sum;
[0089] According to each of the block division results, a final block division result of the image to be processed is determined.
[0090] Optionally, the processor is specifically configured to:
[0091] When the first rate-distortion cost corresponding to the first filtering unit is greater than or equal to the corresponding sum, retaining the second filtering unit corresponding to the first filtering unit and the first filtering unit;
[0092] Obtaining a block result corresponding to the first filtering unit according to the retained second filtering unit corresponding to the first filtering unit and the first filtering unit; or,
[0093] When the first rate-distortion cost corresponding to the first filtering unit is less than the corresponding sum, deleting the second filtering unit corresponding to the first filtering unit, and retaining the first filtering unit;
[0094] According to the retained first filtering unit, a block result corresponding to the first filtering unit is obtained.
[0095] Optionally, the processor is specifically configured to:
[0096] Determining a filter offset of a reference filter unit;
[0097] Obtaining a rate-distortion cost of the reference filtering unit according to the filtering offset;
[0098] The reference filtering unit is the first filtering unit, and the rate-distortion cost is a first rate-distortion cost, or the reference filtering unit is the second filtering unit, and the rate-distortion cost is a second rate-distortion cost.
[0099] Optionally, determining a filtering offset of a reference filtering unit includes:
[0100] Classifying the chrominance pixels of the reference filtering unit according to the size of the luminance pixels at the preset position of the reference filtering unit;
[0101] According to the classification result, a filtering offset of the reference filtering unit is obtained.
[0102] Optionally, classifying the chrominance pixels of the reference filtering unit according to the size of the luminance pixels at the preset position of the reference filtering unit includes:
[0103] Determining the number of classifications of the reference filter unit based on the rate-distortion cost;
[0104] The chrominance pixels of the reference filtering unit are classified according to the classification quantity and the size of the luminance pixels at the preset position of the reference filtering unit.
[0105] Optionally, acquiring the filtering offset of the reference filtering unit according to the classification result includes:
[0106] According to the classification result, the reference offset corresponding to each category of chrominance pixels is obtained;
[0107] A filtering offset of the reference filtering unit is obtained according to the reference offset.
[0108] Optionally, one of the filtering units includes at least one maximum coding unit LCU; and the processor is further configured to:
[0109] According to the first numbering identifier of the LCU in the to-be-processed image and the number of horizontal LCUs and the number of vertical LCUs in the to-be-processed image, a second numbering identifier of the filtering unit to which the LCU belongs is determined.
[0110] Optionally, determining the second numbering identifier of the filtering unit to which the LCU belongs according to the first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs and the number of vertical LCUs in the image to be processed includes:
[0111] Obtaining a first row index and a first column index of the LCU according to a first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs in the image to be processed;
[0112] Obtaining a second row index and a second column index of a filtering unit to which the LCU belongs according to the first row index, the first column index, the number of horizontal LCUs and the number of vertical LCUs of the image to be processed;
[0113] A second numbering identifier of the filtering unit to which the LCU belongs is obtained according to the second row index and the second column index.
[0114] Optionally, determining a filtering offset of a reference filtering unit includes:
[0115] Determining a filter offset of an adjacent filter unit of a reference filter unit;
[0116] The filtering offset of the adjacent filtering unit is used as the filtering offset of the reference filtering unit.
[0117] Optionally, the processor is further configured to:
[0118] Obtaining filtering parameter information of adjacent frame images of the current frame image;
[0119] The filtering parameter information of the adjacent frame image is used as the filtering parameter information of the current frame image.
[0120] The embodiment of the present invention further provides an image processing method, comprising:
[0121] Taking the largest coding unit LCU as a unit, dividing the image to be processed into four first sub-blocks;
[0122] Obtaining a third rate-distortion cost of each of the first sub-blocks;
[0123] Taking LCU as a unit, dividing each of the first sub-blocks into four second sub-blocks;
[0124] Obtaining a fourth rate-distortion cost of each of the second sub-blocks;
[0125] A final division result of the image to be processed is determined according to the third rate-distortion cost and the fourth rate-distortion cost.
[0126] Optionally, also include:
[0127] A flag bit ccsao_is_split_flag is set for each first sub-block and each second sub-block, and the flag bit is used to indicate whether the corresponding sub-block in the final division result is divided.
[0128] Optionally, the image to be processed is divided into four first sub-blocks based on a maximum coding unit LCU, including:
[0129] Taking LCU as the unit, the image to be processed is divided into two rows and two columns;
[0130] Wherein, when the number of LCU columns included in the to-be-processed image is an even number, the number of LCU columns included in the two columns is the same;
[0131] When the number of LCU columns included in the to-be-processed image is an odd number, a subsequent column includes one more LCU column than a previous column;
[0132] When the number of LCU rows included in the to-be-processed image is an even number, the number of LCU rows included in the two rows is the same;
[0133] When the number of LCU rows included in the to-be-processed image is an odd number, a subsequent row includes one more LCU row than a previous row.
[0134] Optionally, also include:
[0135] Determine, according to a first numbering identifier of the LCU in the image to be processed and a horizontal number of LCUs and a vertical number of LCUs in the image to be processed, a numbering identifier of a sub-block to which the LCU belongs;
[0136] The sub-block to which the LCU belongs is the first sub-block or the second sub-block.
[0137] Optionally, determining the numbering identifier of the sub-block to which the LCU belongs according to the first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs and the number of vertical LCUs in the image to be processed includes:
[0138] Acquire a first column index lcuX and a first row index lcuY of the LCU according to a first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs of the image to be processed;
[0139] According to the number of horizontal LCUs and the number of vertical LCUs of the image to be processed, obtaining the number of LCUs included in at least one column of sub-blocks and the number of LCUs included in at least one row of sub-blocks;
[0140] Determine, according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks, a serial number identifier of the sub-block to which the LCU belongs;
[0141] The sub-block and the sub-block to which the LCU belongs are both the first sub-block or the second sub-block.
[0142] Optionally, acquiring a first column index lcuX and a first row index lcuY of the LCU according to a first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs of the image to be processed includes:
[0143] Using the first serial number identifier of the LCU in the image to be processed, performing a modulo operation on the number of horizontal LCUs in the image to be processed to obtain a first column index lcuX of the LCU;
[0144] The number of horizontal LCUs in the image to be processed is calculated by using the first numbering identifier of the LCU in the image to be processed and rounded down to obtain the first row index lcuY of the LCU.
[0145] Optionally, when the sub-block to which the LCU belongs is the first sub-block, determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks includes:
[0146] Using the number of horizontal LCUs to raise 2 to the first power and performing a quotient and rounding down operation, a first column number m1 is obtained; and,
[0147] The number of vertical LCUs is used to obtain the quotient of 2 raised to the first power and then rounded down to an integer, thereby obtaining the number of first rows n1.
[0148] Optionally, the determining, according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks, the number identifier of the sub-block to which the LCU belongs further includes:
[0149] Subtracting the first column number m1 from the horizontal LCU number to obtain the second column number m2; and / or,
[0150] The number of the second row n2 is obtained by subtracting the number of the first row n1 from the number of the vertical LCUs.
[0151] Optionally, determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks includes:
[0152] Obtaining a first sub-block column index regionX to which the LCU belongs according to the first column index lcuX and the first column number m1;
[0153] Obtaining a first sub-block row index regionY to which the LCU belongs according to the first row index lcuY and the first row number n1;
[0154] The serial number identifier of the first sub-block to which the LCU belongs is obtained by multiplying the first sub-block row index regionY by 2 raised to the first power and then adding the first sub-block column index regionX.
[0155] Optionally, obtaining the first sub-block column index regionX to which the LCU belongs according to the first column index lcuX and the first column number m1 includes:
[0156] When the first column index lcuX is greater than or equal to the first column number m1, the first sub-block column index regionX to which the LCU belongs is 1;
[0157] Otherwise, the first sub-block column index regionX to which the LCU belongs is 0.
[0158] Optionally, obtaining the first sub-block row index regionY to which the LCU belongs according to the first row index lcuY and the first row number n1 includes:
[0159] When the first row index lcuY is greater than or equal to the first row number n1, the first sub-block row index regionY to which the LCU belongs is 1;
[0160] Otherwise, the first sub-block row index regionY to which the LCU belongs is 0.
[0161] Optionally, when the sub-block to which the LCU belongs is the second sub-block, determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks includes:
[0162] Using the number of horizontal LCUs to raise 2 to the power of 2, perform a quotient operation and round it down to obtain the number of the first column x1; and
[0163] The number of third columns x3 is obtained by subtracting the number of horizontal LCUs from the number of horizontal LCUs and taking the quotient of 2 raised to the first power and rounding down the quotient of 2 raised to the first power to an integer; and
[0164] Subtract the number of horizontal LCUs from the number of horizontal LCUs raised to the power of 2 to obtain a value obtained by taking the quotient of the value down to an integer, and then subtract the number of the third column x3 from the value to obtain the number of the fourth column x4; and
[0165] Using the number of vertical LCUs to raise 2 to the power of 2, perform a quotient operation and round it down to obtain the number of first rows y1; and
[0166] The number of third rows y3 is obtained by subtracting the number of vertical LCUs from the number of vertical LCUs and taking the quotient of 2 raised to the first power and rounding down the quotient of 2 raised to the first power to an integer; and
[0167] The fourth column number y4 is obtained by subtracting the vertical LCU number from the vertical LCU number raised to the first power of 2 and taking the quotient of the quotient as an integer, and then subtracting the third row number y3 from the value.
[0168] Optionally, the determining, according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks, the number identifier of the sub-block to which the LCU belongs further includes:
[0169] Using the number of horizontal LCUs to raise 2 to the first power, performing a quotient operation and rounding down, and then subtracting the number of the first column x1, to obtain the number of the second column x2; and / or,
[0170] The quotient of the vertical LCU number is rounded down to the first power of 2, and then the first row number y1 is subtracted to obtain the second column number y2.
[0171] Optionally, determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks includes:
[0172] Obtaining a second sub-block column index regionX to which the LCU belongs according to the first column index lcuX, the first column number x1, and the fourth column number x4;
[0173] Obtaining a second sub-block row index regionY to which the LCU belongs according to the first row index lcuY, the first row number y1, and the fourth column number y4;
[0174] The number identifier of the second sub-block to which the LCU belongs is obtained by multiplying the second sub-block row index regionY by 2 raised to the power of 2 and adding the second sub-block column index regionX.
[0175] Optionally, obtaining the second sub-block column index regionX to which the LCU belongs according to the first column index lcuX, the first column number x1, and the fourth column number x4 includes:
[0176] When the first column index lcuX is greater than or equal to a difference obtained by subtracting the number of fourth columns x4 from the number of horizontal LCUs, the second sub-block column index regionX to which the LCU belongs is 3;
[0177] When the first column index lcuX is less than the difference between the number of horizontal LCUs and the number of fourth columns x4, and the first column index lcuX is greater than or equal to a value obtained by raising the quotient of the number of horizontal LCUs to the first power of 2 and dividing it by an integer, the second sub-block column index regionX to which the LCU belongs is 2;
[0178] When the first column index lcuX is less than the difference between the number of horizontal LCUs and the number of fourth columns x4, and the first column index lcuX is less than the value obtained by taking the quotient of the number of horizontal LCUs raised to the first power of 2 and dividing it by an integer, and the first column index lcuX is greater than or equal to the first column number x1, the second sub-block column index regionX to which the LCU belongs is 1; otherwise, the second sub-block column index regionX to which the LCU belongs is 0.
[0179] Optionally, obtaining the second sub-block row index regionY to which the LCU belongs according to the first row index lcuY, the first row number y1, and the fourth column number y4 includes:
[0180] When the first row index lcuY is greater than or equal to a difference value obtained by subtracting the fourth column number y4 from the number of vertical LCUs, the second sub-block row index regionY to which the LCU belongs is 3;
[0181] When the first row index lcuY is less than the difference value obtained by subtracting the fourth column number x4 from the number of vertical LCUs, and the first row index lcuY is greater than or equal to a value obtained by raising the quotient of the number of vertical LCUs to the first power of 2 and dividing it by an integer, the second sub-block row index regionY to which the LCU belongs is 2;
[0182] When the first row index lcuY is less than the difference between the number of vertical LCUs and the number of fourth columns x4, and the first row index lcuY is less than the value obtained by taking the quotient of the number of vertical LCUs raised to the first power of 2 and dividing it by an integer, and the first row index lcuY is greater than or equal to the first row number y1, the second sub-block row index regionY to which the LCU belongs is 1; otherwise, the second sub-block row index regionY to which the LCU belongs is 0.
[0183] The embodiment of the present invention further provides an image processing device, comprising:
[0184] A first division module, used for dividing the image to be processed into four first sub-blocks based on a maximum coding unit LCU;
[0185] A third acquisition module, configured to acquire a third rate-distortion cost of each of the first sub-blocks;
[0186] A second division module, configured to divide each of the first sub-blocks into four second sub-blocks in units of LCU;
[0187] A fourth acquisition module, configured to acquire a fourth rate-distortion cost of each of the second sub-blocks;
[0188] The third determining module is used to determine the final division result of the image to be processed according to the third rate-distortion cost and the fourth rate-distortion cost.
[0189] Optionally, also include:
[0190] The first setting module is used to set a flag bit ccsao_is_split_flag for each first sub-block and each second sub-block, wherein the flag bit is used to indicate whether the corresponding sub-block in the final division result is divided.
[0191] Optionally, the image to be processed is divided into four first sub-blocks based on a maximum coding unit LCU, including:
[0192] Taking LCU as the unit, the image to be processed is divided into two rows and two columns;
[0193] Wherein, when the number of LCU columns included in the to-be-processed image is an even number, the number of LCU columns included in the two columns is the same;
[0194] When the number of LCU columns included in the to-be-processed image is an odd number, a subsequent column includes one more LCU column than a previous column;
[0195] When the number of LCU rows included in the to-be-processed image is an even number, the number of LCU rows included in the two rows is the same;
[0196] When the number of LCU rows included in the to-be-processed image is an odd number, a subsequent row includes one more LCU row than a previous row.
[0197] Optionally, also include:
[0198] A fourth determining module, configured to determine a numbering identifier of a sub-block to which the LCU belongs according to a first numbering identifier of the LCU in the image to be processed and a horizontal number of LCUs and a vertical number of LCUs in the image to be processed;
[0199] The sub-block to which the LCU belongs is the first sub-block or the second sub-block.
[0200] Optionally, determining the numbering identifier of the sub-block to which the LCU belongs according to the first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs and the number of vertical LCUs in the image to be processed includes:
[0201] Acquire a first column index lcuX and a first row index lcuY of the LCU according to a first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs of the image to be processed;
[0202] According to the number of horizontal LCUs and the number of vertical LCUs of the image to be processed, obtaining the number of LCUs included in at least one column of sub-blocks and the number of LCUs included in at least one row of sub-blocks;
[0203] Determine, according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks, a serial number identifier of the sub-block to which the LCU belongs;
[0204] The sub-block and the sub-block to which the LCU belongs are both the first sub-block or the second sub-block.
[0205] Optionally, acquiring a first column index lcuX and a first row index lcuY of the LCU according to a first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs of the image to be processed includes:
[0206] Using the first serial number identifier of the LCU in the image to be processed, performing a modulo operation on the number of horizontal LCUs in the image to be processed to obtain a first column index lcuX of the LCU;
[0207] The number of horizontal LCUs in the image to be processed is calculated by using the first numbering identifier of the LCU in the image to be processed and rounded down to obtain the first row index lcuY of the LCU.
[0208] Optionally, when the sub-block to which the LCU belongs is the first sub-block, determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks includes:
[0209] Using the number of horizontal LCUs to raise 2 to the first power and performing a quotient and rounding down operation, a first column number m1 is obtained; and,
[0210] The number of vertical LCUs is used to obtain the quotient of 2 raised to the first power and then rounded down to an integer, thereby obtaining the number of first rows n1.
[0211] Optionally, the determining, according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks, the number identifier of the sub-block to which the LCU belongs further includes:
[0212] Subtracting the first column number m1 from the horizontal LCU number to obtain the second column number m2; and / or,
[0213] The number of the second row n2 is obtained by subtracting the number of the first row n1 from the number of the vertical LCUs.
[0214] Optionally, determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks includes:
[0215] Obtaining a first sub-block column index regionX to which the LCU belongs according to the first column index lcuX and the first column number m1;
[0216] Obtaining a first sub-block row index regionY to which the LCU belongs according to the first row index lcuY and the first row number n1;
[0217] The serial number identifier of the first sub-block to which the LCU belongs is obtained by multiplying the first sub-block row index regionY by 2 raised to the first power and then adding the first sub-block column index regionX.
[0218] Optionally, obtaining the first sub-block column index regionX to which the LCU belongs according to the first column index lcuX and the first column number m1 includes:
[0219] When the first column index lcuX is greater than or equal to the first column number m1, the first sub-block column index regionX to which the LCU belongs is 1;
[0220] Otherwise, the first sub-block column index regionX to which the LCU belongs is 0.
[0221] Optionally, obtaining the first sub-block row index regionY to which the LCU belongs according to the first row index lcuY and the first row number n1 includes:
[0222] When the first row index lcuY is greater than or equal to the first row number n1, the first sub-block row index regionY to which the LCU belongs is 1;
[0223] Otherwise, the first sub-block row index regionY to which the LCU belongs is 0.
[0224] Optionally, when the sub-block to which the LCU belongs is the second sub-block, determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks includes:
[0225] Using the number of horizontal LCUs to raise 2 to the power of 2, perform a quotient operation and round it down to obtain the number of the first column x1; and
[0226] The number of third columns x3 is obtained by subtracting the number of horizontal LCUs from the number of horizontal LCUs and taking the quotient of 2 raised to the first power and rounding down the quotient of 2 raised to the first power to an integer; and
[0227] Subtract the number of horizontal LCUs from the number of horizontal LCUs raised to the power of 2 to obtain a value obtained by taking the quotient of the value down to an integer, and then subtract the number of the third column x3 from the value to obtain the number of the fourth column x4; and
[0228] Using the number of vertical LCUs to raise 2 to the power of 2, perform a quotient operation and round it down to obtain the number of first rows y1; and
[0229] The number of third rows y3 is obtained by subtracting the number of vertical LCUs from the number of vertical LCUs and taking the quotient of 2 raised to the first power and rounding down the quotient of 2 raised to the first power to an integer; and
[0230] The fourth column number y4 is obtained by subtracting the vertical LCU number from the vertical LCU number raised to the first power of 2 and taking the quotient of the quotient as an integer, and then subtracting the third row number y3 from the value.
[0231] Optionally, the determining, according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks, the number identifier of the sub-block to which the LCU belongs further includes:
[0232] Using the number of horizontal LCUs to raise 2 to the first power, performing a quotient operation and rounding down, and then subtracting the number of the first column x1, to obtain the number of the second column x2; and / or,
[0233] The quotient of the vertical LCU number is rounded down to the first power of 2, and then the first row number y1 is subtracted to obtain the second column number y2.
[0234] Optionally, determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks includes:
[0235] Obtaining a second sub-block column index regionX to which the LCU belongs according to the first column index lcuX, the first column number x1, and the fourth column number x4;
[0236] Obtaining a second sub-block row index regionY to which the LCU belongs according to the first row index lcuY, the first row number y1, and the fourth column number y4;
[0237] The number identifier of the second sub-block to which the LCU belongs is obtained by multiplying the second sub-block row index regionY by 2 raised to the power of 2 and adding the second sub-block column index regionX.
[0238] Optionally, obtaining the second sub-block column index regionX to which the LCU belongs according to the first column index lcuX, the first column number x1, and the fourth column number x4 includes:
[0239] When the first column index lcuX is greater than or equal to a difference obtained by subtracting the number of fourth columns x4 from the number of horizontal LCUs, the second sub-block column index regionX to which the LCU belongs is 3;
[0240] When the first column index lcuX is less than the difference between the number of horizontal LCUs and the number of fourth columns x4, and the first column index lcuX is greater than or equal to a value obtained by raising the quotient of the number of horizontal LCUs to the first power of 2 and dividing it by an integer, the second sub-block column index regionX to which the LCU belongs is 2;
[0241] When the first column index lcuX is less than the difference between the number of horizontal LCUs and the number of fourth columns x4, and the first column index lcuX is less than the value obtained by taking the quotient of the number of horizontal LCUs raised to the first power of 2 and dividing it by an integer, and the first column index lcuX is greater than or equal to the first column number x1, the second sub-block column index regionX to which the LCU belongs is 1; otherwise, the second sub-block column index regionX to which the LCU belongs is 0.
[0242] Optionally, obtaining the second sub-block row index regionY to which the LCU belongs according to the first row index lcuY, the first row number y1, and the fourth column number y4 includes:
[0243] When the first row index lcuY is greater than or equal to a difference value obtained by subtracting the fourth column number y4 from the number of vertical LCUs, the second sub-block row index regionY to which the LCU belongs is 3;
[0244] When the first row index lcuY is less than the difference value obtained by subtracting the fourth column number x4 from the number of vertical LCUs, and the first row index lcuY is greater than or equal to a value obtained by raising the quotient of the number of vertical LCUs to the first power of 2 and dividing it by an integer, the second sub-block row index regionY to which the LCU belongs is 2;
[0245] When the first row index lcuY is less than the difference between the number of vertical LCUs and the number of fourth columns x4, and the first row index lcuY is less than the value obtained by taking the quotient of the number of vertical LCUs raised to the first power of 2 and dividing it by an integer, and the first row index lcuY is greater than or equal to the first row number y1, the second sub-block row index regionY to which the LCU belongs is 1; otherwise, the second sub-block row index regionY to which the LCU belongs is 0.
[0246] An embodiment of the present invention further provides an image processing device, comprising: a processor;
[0247] The processor is used to divide the image to be processed into four first sub-blocks based on the largest coding unit LCU;
[0248] Obtaining a third rate-distortion cost of each of the first sub-blocks;
[0249] Taking LCU as a unit, dividing each of the first sub-blocks into four second sub-blocks;
[0250] Obtaining a fourth rate-distortion cost of each of the second sub-blocks;
[0251] A final division result of the image to be processed is determined according to the third rate-distortion cost and the fourth rate-distortion cost.
[0252] Optionally, the processor is further configured to:
[0253] A flag bit ccsao_is_split_flag is set for each first sub-block and each second sub-block, and the flag bit is used to indicate whether the corresponding sub-block in the final division result is divided.
[0254] Optionally, the image to be processed is divided into four first sub-blocks based on a maximum coding unit LCU, including:
[0255] Taking LCU as the unit, the image to be processed is divided into two rows and two columns;
[0256] Wherein, when the number of LCU columns included in the to-be-processed image is an even number, the number of LCU columns included in the two columns is the same;
[0257] When the number of LCU columns included in the to-be-processed image is an odd number, a subsequent column includes one more LCU column than a previous column;
[0258] When the number of LCU rows included in the to-be-processed image is an even number, the number of LCU rows included in the two rows is the same;
[0259] When the number of LCU rows included in the to-be-processed image is an odd number, a subsequent row includes one more LCU row than a previous row.
[0260] Optionally, the processor is further configured to:
[0261] Determine, according to a first numbering identifier of the LCU in the image to be processed and a horizontal number of LCUs and a vertical number of LCUs in the image to be processed, a numbering identifier of a sub-block to which the LCU belongs;
[0262] The sub-block to which the LCU belongs is the first sub-block or the second sub-block.
[0263] Optionally, determining the numbering identifier of the sub-block to which the LCU belongs according to the first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs and the number of vertical LCUs in the image to be processed includes:
[0264] Acquire a first column index lcuX and a first row index lcuY of the LCU according to a first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs of the image to be processed;
[0265] According to the number of horizontal LCUs and the number of vertical LCUs of the image to be processed, obtaining the number of LCUs included in at least one column of sub-blocks and the number of LCUs included in at least one row of sub-blocks;
[0266] Determine, according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks, a serial number identifier of the sub-block to which the LCU belongs;
[0267] The sub-block and the sub-block to which the LCU belongs are both the first sub-block or the second sub-block.
[0268] Optionally, acquiring a first column index lcuX and a first row index lcuY of the LCU according to a first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs of the image to be processed includes:
[0269] Using the first serial number identifier of the LCU in the image to be processed, performing a modulo operation on the number of horizontal LCUs in the image to be processed to obtain a first column index lcuX of the LCU;
[0270] The number of horizontal LCUs in the image to be processed is calculated by using the first numbering identifier of the LCU in the image to be processed and rounded down to obtain the first row index lcuY of the LCU.
[0271] Optionally, when the sub-block to which the LCU belongs is the first sub-block, determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks includes:
[0272] Using the number of horizontal LCUs to raise 2 to the first power and performing a quotient and rounding down operation, a first column number m1 is obtained; and,
[0273] The number of vertical LCUs is used to obtain the quotient of 2 raised to the first power and then rounded down to an integer, thereby obtaining the number of first rows n1.
[0274] Optionally, the determining, according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks, the number identifier of the sub-block to which the LCU belongs further includes:
[0275] Subtracting the first column number m1 from the horizontal LCU number to obtain the second column number m2; and / or,
[0276] The number of the second row n2 is obtained by subtracting the number of the first row n1 from the number of the vertical LCUs.
[0277] Optionally, determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks includes:
[0278] Obtaining a first sub-block column index regionX to which the LCU belongs according to the first column index lcuX and the first column number m1;
[0279] Obtaining a first sub-block row index regionY to which the LCU belongs according to the first row index lcuY and the first row number n1;
[0280] The serial number identifier of the first sub-block to which the LCU belongs is obtained by multiplying the first sub-block row index regionY by 2 raised to the first power and then adding the first sub-block column index regionX.
[0281] Optionally, obtaining the first sub-block column index regionX to which the LCU belongs according to the first column index lcuX and the first column number m1 includes:
[0282] When the first column index lcuX is greater than or equal to the first column number m1, the first sub-block column index regionX to which the LCU belongs is 1;
[0283] Otherwise, the first sub-block column index regionX to which the LCU belongs is 0.
[0284] Optionally, obtaining the first sub-block row index regionY to which the LCU belongs according to the first row index lcuY and the first row number n1 includes:
[0285] When the first row index lcuY is greater than or equal to the first row number n1, the first sub-block row index regionY to which the LCU belongs is 1;
[0286] Otherwise, the first sub-block row index regionY to which the LCU belongs is 0.
[0287] Optionally, when the sub-block to which the LCU belongs is the second sub-block, determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks includes:
[0288] Using the number of horizontal LCUs to raise 2 to the power of 2, perform a quotient operation and round it down to obtain the number of the first column x1; and
[0289] The number of third columns x3 is obtained by subtracting the number of horizontal LCUs from the number of horizontal LCUs and taking the quotient of 2 raised to the first power and rounding down the quotient of 2 raised to the first power to an integer; and
[0290] Subtract the number of horizontal LCUs from the number of horizontal LCUs raised to the power of 2 to obtain a value obtained by taking the quotient of the value down to an integer, and then subtract the number of the third column x3 from the value to obtain the number of the fourth column x4; and
[0291] Using the number of vertical LCUs to raise 2 to the power of 2, perform a quotient operation and round it down to obtain the number of first rows y1; and
[0292] The number of third rows y3 is obtained by subtracting the number of vertical LCUs from the number of vertical LCUs and taking the quotient of 2 raised to the first power and rounding down the quotient of 2 raised to the first power to an integer; and
[0293] The fourth column number y4 is obtained by subtracting the vertical LCU number from the vertical LCU number raised to the first power of 2 and taking the quotient of the quotient as an integer, and then subtracting the third row number y3 from the value.
[0294] Optionally, the determining, according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks, the number identifier of the sub-block to which the LCU belongs further includes:
[0295] Using the number of horizontal LCUs to raise 2 to the first power, performing a quotient operation and rounding down, and then subtracting the number of the first column x1, to obtain the number of the second column x2; and / or,
[0296] The quotient of the vertical LCU number is rounded down to the first power of 2, and then the first row number y1 is subtracted to obtain the second column number y2.
[0297] Optionally, determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks includes:
[0298] Obtaining a second sub-block column index regionX to which the LCU belongs according to the first column index lcuX, the first column number x1, and the fourth column number x4;
[0299] Obtaining a second sub-block row index regionY to which the LCU belongs according to the first row index lcuY, the first row number y1, and the fourth column number y4;
[0300] The number identifier of the second sub-block to which the LCU belongs is obtained by multiplying the second sub-block row index regionY by 2 raised to the power of 2 and adding the second sub-block column index regionX.
[0301] Optionally, obtaining the second sub-block column index regionX to which the LCU belongs according to the first column index lcuX, the first column number x1, and the fourth column number x4 includes:
[0302] When the first column index lcuX is greater than or equal to a difference obtained by subtracting the number of fourth columns x4 from the number of horizontal LCUs, the second sub-block column index regionX to which the LCU belongs is 3;
[0303] When the first column index lcuX is less than the difference between the number of horizontal LCUs and the number of fourth columns x4, and the first column index lcuX is greater than or equal to a value obtained by raising the quotient of the number of horizontal LCUs to the first power of 2 and dividing it by an integer, the second sub-block column index regionX to which the LCU belongs is 2;
[0304] When the first column index lcuX is less than the difference between the number of horizontal LCUs and the number of fourth columns x4, and the first column index lcuX is less than the value obtained by taking the quotient of the number of horizontal LCUs raised to the first power of 2 and dividing it by an integer, and the first column index lcuX is greater than or equal to the first column number x1, the second sub-block column index regionX to which the LCU belongs is 1; otherwise, the second sub-block column index regionX to which the LCU belongs is 0.
[0305] Optionally, obtaining the second sub-block row index regionY to which the LCU belongs according to the first row index lcuY, the first row number y1, and the fourth column number y4 includes:
[0306] When the first row index lcuY is greater than or equal to a difference value obtained by subtracting the fourth column number y4 from the number of vertical LCUs, the second sub-block row index regionY to which the LCU belongs is 3;
[0307] When the first row index lcuY is less than the difference value obtained by subtracting the fourth column number x4 from the number of vertical LCUs, and the first row index lcuY is greater than or equal to a value obtained by raising the quotient of the number of vertical LCUs to the first power of 2 and dividing it by an integer, the second sub-block row index regionY to which the LCU belongs is 2;
[0308] When the first row index lcuY is less than the difference between the number of vertical LCUs and the number of fourth columns x4, and the first row index lcuY is less than the value obtained by taking the quotient of the number of vertical LCUs raised to the first power of 2 and dividing it by an integer, and the first row index lcuY is greater than or equal to the first row number y1, the second sub-block row index regionY to which the LCU belongs is 1; otherwise, the second sub-block row index regionY to which the LCU belongs is 0.
[0309] An embodiment of the present invention further provides an image processing device, comprising a memory, a processor, and a program stored in the memory and executable on the processor; when the processor executes the program, the above-mentioned image processing method is implemented.
[0310] An embodiment of the present invention further provides a readable storage medium on which a program is stored. When the program is executed by a processor, the steps in the above-mentioned image processing method are implemented.
[0311] The beneficial effects of the above technical solution of the present invention are as follows:
[0312] In the above scheme, the image processing method divides the image to be processed into N layers of blocks to obtain the filter unit corresponding to each layer of block division; wherein the filter unit is a first filter unit or a second filter unit, the first filter unit is a filter unit obtained by the Mth layer of block division, the second filter unit is a filter unit obtained by the M+1th layer of block division, and the second filter unit is obtained by dividing the first filter unit into blocks; the sum of the first rate-distortion cost of each first filter unit and the second rate-distortion cost of the second filter unit corresponding to each first filter unit is obtained; according to the first rate-distortion cost and the sum, the final block division result of the image to be processed is determined; wherein N is an integer greater than 0, and M takes each value from 0 to N-1 in turn; one second filter unit is greater than or equal to one pixel; it can realize a more reasonable design of the size of the filter unit, adapt to various image contents, reduce bit rate consumption, avoid wasting processing resources, and ensure final performance, and the scheme has low complexity, can significantly improve the coding efficiency, and well solve the problem of wasting processing resources in the image processing scheme in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0313] Figure 1 The image processing method according to the embodiment of the present invention is shown in FIG. Figure 1 ;
[0314] Figure 2 A schematic diagram of block division according to an embodiment of the present invention;
[0315] Figure 3 This is a schematic diagram of the final block result of an embodiment of the present invention;
[0316] Figure 4 This is a schematic diagram of the division of layer 1 according to an embodiment of the present invention;
[0317] Figure 5 This is a schematic diagram of the division of layer 2 according to an embodiment of the present invention;
[0318] Figure 6 A schematic diagram of coding frame filtering according to an embodiment of the present invention;
[0319] Figure 7 The structure of the image processing device according to the embodiment of the present invention is shown in FIG. Figure 1 ;
[0320] Figure 8 The structure of the image processing device according to the embodiment of the present invention is shown in FIG. Figure 1 ;
[0321] Fig. 9 The image processing method according to the embodiment of the present invention is shown in FIG. Figure 2 ;
[0322] Fig.10The structure of the image processing device according to the embodiment of the present invention is shown in FIG. Figure 2 ;
[0323] Fig.11 The structure of the image processing device according to the embodiment of the present invention is shown in FIG. Figure 2 . DETAILED DESCRIPTION
[0324] In order to make the technical problems, technical solutions and advantages to be solved by the present invention more clear, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.
[0325] The present invention aims at the problem that the image processing scheme in the prior art wastes processing resources, and provides an image processing method, including the following two embodiments:
[0326] Embodiment 1
[0327] The image processing method provided by the embodiment of the present invention is as follows: Figure 1 As shown, including:
[0328] Step 11: Divide the image to be processed into N layers of blocks to obtain a filter unit corresponding to each layer of block division; wherein the filter unit is a first filter unit or a second filter unit, the first filter unit is a filter unit obtained by dividing the Mth layer of blocks, the second filter unit is a filter unit obtained by dividing the M+1th layer of blocks, and the second filter unit is obtained by dividing the first filter unit into blocks;
[0329] Step 12: Obtain a sum of the first rate-distortion cost of each of the first filtering units and the second rate-distortion cost of each of the second filtering units corresponding to the first filtering units;
[0330] Step 13: Determine the final block result of the image to be processed based on the first rate-distortion cost and the sum; wherein N is an integer greater than 0, and M takes each value from 0 to N-1 in turn; and one of the second filtering units is greater than or equal to one pixel.
[0331] Among them, the "block division" can be any division method, different layers can use the same or different methods, and each unit of the same layer can also use the same or different division methods, which is not limited here. Regarding the "block division of the M+1th layer", it can be assumed that the division is performed first, and then the corresponding rate-distortion cost is obtained, and whether the division is actually performed is determined according to the rate-distortion cost.
[0332] The image processing method provided by the embodiment of the present invention divides the image to be processed into N layers of blocks to obtain the filter unit corresponding to each layer of block division; wherein the filter unit is a first filter unit or a second filter unit, the first filter unit is a filter unit obtained by the Mth layer of block division, the second filter unit is a filter unit obtained by the M+1th layer of block division, and the second filter unit is obtained by dividing the first filter unit into blocks; the sum of the first rate-distortion cost of each first filter unit and the second rate-distortion cost of the second filter unit corresponding to each first filter unit is obtained; according to the first rate-distortion cost and the sum, the final block division result of the image to be processed is determined; wherein N is an integer greater than 0, and M takes each value from 0 to N-1 in turn; one second filter unit is greater than or equal to one pixel; it can realize a more reasonable design of the size of the filter unit, adapt to various image contents, reduce bit rate consumption, avoid wasting processing resources, and ensure final performance, and the scheme has low complexity, can significantly improve the coding efficiency, and well solve the problem of wasting processing resources in the image processing scheme in the prior art.
[0333] Among them, determining the final block result of the image to be processed based on the first rate-distortion cost and the sum includes: obtaining the block result corresponding to each of the first filtering units based on the first rate-distortion cost corresponding to each of the first filtering units and the sum; and determining the final block result of the image to be processed based on each of the block results.
[0334] Specifically, the block results corresponding to each of the first filtering units are obtained according to the first rate-distortion costs corresponding to each of the first filtering units and the sum, including: when the first rate-distortion cost corresponding to the first filtering unit is greater than or equal to the corresponding sum, retaining the second filtering unit and the first filtering unit corresponding to the first filtering unit; obtaining the block results corresponding to the first filtering unit according to the second filtering unit and the first filtering unit corresponding to the retained first filtering unit; or, when the first rate-distortion cost corresponding to the first filtering unit is less than the corresponding sum, deleting the second filtering unit corresponding to the first filtering unit and retaining the first filtering unit; and obtaining the block results corresponding to the first filtering unit according to the retained first filtering unit.
[0335] In this way, the filter unit with the best rate-distortion cost can be obtained, and the best final block result can be obtained.
[0336] In an embodiment of the present invention, obtaining the first rate-distortion cost of each of the first filtering units and the second rate-distortion cost of the second filtering unit corresponding to each of the first filtering units includes: determining a filtering offset of a reference filtering unit; obtaining the rate-distortion cost of the reference filtering unit according to the filtering offset; wherein the reference filtering unit is the first filtering unit and the rate-distortion cost is the first rate-distortion cost, or the reference filtering unit is the second filtering unit and the rate-distortion cost is the second rate-distortion cost.
[0337] The determining of the filtering offset of the reference filtering unit includes: classifying the chrominance pixels of the reference filtering unit according to the size of the luminance pixels at a preset position of the reference filtering unit; and obtaining the filtering offset of the reference filtering unit according to the classification result.
[0338] This can take into account the relationship between adjacent component pixels and improve performance.
[0339] Specifically, the chrominance pixels of the reference filtering unit are classified according to the size of the luminance pixels at the preset position of the reference filtering unit, including: determining the number of classifications of the reference filtering unit based on the rate-distortion cost; and classifying the chrominance pixels of the reference filtering unit according to the number of classifications and the size of the luminance pixels at the preset position of the reference filtering unit.
[0340] This can further optimize performance.
[0341] The obtaining of the filter offset of the reference filter unit according to the classification result includes: obtaining a reference offset corresponding to each category of chroma pixels according to the classification result; and obtaining the filter offset of the reference filter unit according to the reference offset.
[0342] Specifically, several candidate values (the reference value is shifted to the left or right) are obtained according to the reference offset, and then a value corresponding to the optimal RDO is selected from the reference offset and the candidate values as the filtering offset.
[0343] This also optimizes performance.
[0344] In an embodiment of the present invention, one of the filtering units includes at least one maximum coding unit LCU; the image processing method also includes: determining the second numbering identifier of the filtering unit to which the LCU belongs based on the first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs and the number of vertical LCUs in the image to be processed.
[0345] This allows for indexing of the filter units.
[0346] Among them, determining the second numbering identifier of the filtering unit to which the LCU belongs according to the first numbering identifier of the LCU in the image to be processed and the horizontal number of LCUs and the vertical number of LCUs in the image to be processed includes: obtaining the first row index and the first column index of the LCU according to the first numbering identifier of the LCU in the image to be processed and the horizontal number of LCUs in the image to be processed; obtaining the second row index and the second column index of the filtering unit to which the LCU belongs according to the first row index, the first column index, the horizontal number of LCUs and the vertical number of LCUs in the image to be processed; and obtaining the second numbering identifier of the filtering unit to which the LCU belongs according to the second row index and the second column index.
[0347] In this way, the index of the filter unit can be obtained quickly and accurately.
[0348] In an embodiment of the present invention, determining the filtering offset of the reference filtering unit may also include: determining the filtering offset of an adjacent filtering unit of the reference filtering unit; and using the filtering offset of the adjacent filtering unit as the filtering offset of the reference filtering unit.
[0349] This can further reduce bit rate consumption.
[0350] Furthermore, the image processing method further includes: obtaining filtering parameter information of adjacent frame images of the current frame image; and using the filtering parameter information of the adjacent frame images as filtering parameter information of the current frame image.
[0351] This can also further reduce bit rate consumption.
[0352] The image processing method provided by the embodiment of the present invention is further described below.
[0353] In view of the above technical problems, an embodiment of the present invention provides an image processing method, which can be specifically implemented as a block-based image or video cross-component sample adaptive compensation method. This solution involves the following parts:
[0354] Part 1, classification method;
[0355] For the sub-blocks obtained after block division (i.e., the above-mentioned filter units), firstly, the chroma pixels are classified using the luma pixels. The specific classification can be performed using the following formula (1):
[0356] Class Idx =(Y luma ×bandnum)>>bit_depth (1);
[0357] Formula (1) represents Y luma×bandnum is shifted right by bit_depth bits, that is, Y luma Multiply by bandnum, divide by 2 to the power of bit_depth;
[0358] C chroma Indicates chroma pixel, Y luma Represents C chroma The corresponding brightness pixel, bandnum represents the total number of categories (i.e. the number of categories mentioned above). bit_depth is the bit depth of the image or video corresponding to the current sub-block; assuming Class Idx The corresponding C chroma A category is separated, which must satisfy: Class Idx ∈[0,bandnum-1]. Formula (1) is based on pixel size for classification. For example, assuming bit_depth = 10; there are 5 chrominance pixels {C1, C2, C3, C4, C5}, and their corresponding luminance pixel values are {100, 300, 600, 700, 900}, where bandnum = 4; this means that all chrominance pixels will be divided into 4 categories. Using formula (1) to classify the 5 chrominance pixels, the Class values corresponding to the 5 chrominance pixels are Idx They are {0,1,2,2,3} respectively.
[0359] Assume that the image or video YUV format corresponding to the current sub-block is 4:2:0, and that the width and height of luma are width and height, respectively. luma ,height luma ; Chroma width and height are width and height respectively chroma ,height chroma ; Then there is a corresponding relationship:
[0360] width luma =2×width chroma (2);
[0361] height luma =2×height chroma (3);
[0362] Assumption Y luma The location is (P x ,P y ), C chroma The location is (Pc x ,Pc y ), then according to formulas (2) and (3), C in formula (1) chroma The corresponding Y luma It can be obtained according to the following formula:
[0363] P x =Pc x ×2+X (4);
[0364] P y =Pc y ×2+Y (5);
[0365] Where X and Y are both integers, and X∈[-1,1],Y∈[-1,1]. Therefore, Y luma There are nine candidates. The rate-distortion cost corresponding to each candidate can be calculated, and the best value among the candidates can be obtained and applied to formula (1).
[0366] Part II, classification adaptation;
[0367] Part 1 uses Y luma The pixel uses formula (1) to calculate C chroma Pixel classification, the entire pixel is divided into bandnum categories, and the bandnum value can be selected through the rate-distortion optimization method. In order to find the optimal value, the maximum value maxBandValue is first set. Then bandnum is cyclically calculated from 1 to maxBandValue to calculate the rate-distortion cost (Rate-Distortion Optimization, RDO), and the optimal bandnum result is found according to the rate-distortion cost (that is, the bandnum value corresponding to the minimum rate-distortion cost, applied to formula (1)).
[0368] The setting of maxBandValue may be based on experience or may be randomly set, which is not limited here.
[0369] Part III, Filter Parameters Calculation;
[0370] Assuming that there are bandnum categories, we need to calculate bandnum filter parameters. t The filtering parameters of class t ∈[0,bandnum-1], the offset calculation process is as follows:
[0371] First, count the number of pixels in class_t, numCount, and the difference diffCount between the pixels in class_t and the original pixels at the corresponding positions (i.e., the pixels before compression, the pixels in the sub-block are obtained by compression based on the original pixels) (i.e., the sum of the differences between each pixel in class_t and the original pixels at the corresponding positions);
[0372] Then calculate the initial offset of class_t: initialOffset = diffCount / numCount; initialOffset is the initial offset;
[0373] Then, the best offset (bestOffset) is calculated according to RDO as the offset of this category (corresponding to the above-mentioned reference offset). Specifically, the bestOffset (i.e., the Offset corresponding to the minimum rate-distortion cost) can be selected from the initialOffset and multiple offset values adjacent to the initialOffset according to RDO;
[0374] The calculation process of all categories of offsets is the same. In this way, a total of bandnum offsets (corresponding to the filter offset of the above reference filter unit) can be obtained. Then, through RDO, it is decided whether the current sub-block needs to perform the above classification filtering operation. Specifically, it can be assumed that the sub-block is filtered according to the offset of each category, and then the RDO after filtering is obtained. When RDO is greater than 0, it is determined that the current sub-block will not be filtered this time (corresponding to RDO=0).
[0375] Part IV, adaptive block partitioning;
[0376] Considering that the texture contained in a frame of image is relatively complex, the whole frame of image is divided into different regions by block division, and each region is trained with independent filter parameters. The following is an example of quadtree division:
[0377] like Figure 2As shown, Layer 0 indicates that the entire frame image is regarded as a filter unit, and a set of filter parameters is trained. Layer 1 indicates that the entire frame image is divided into four filter units, and each unit independently trains its own set of filter parameters. Layer 2 indicates that the entire frame image is divided into 16 filter units, and each unit independently trains its own set of filter parameters, and a maximum of 16 sets of filter parameters may be divided. Layer 2 can also be represented as continuing to be divided on the basis of Layer 1 (corresponding to the above-mentioned second filter unit being obtained by block division of the first filter unit): for example, filter unit 0 of Layer 1 is further divided into four filter units 0 to 3 of Layer 2; filter unit 1 of Layer 1 is further divided into filter units 4 to 7 of Layer 2, and so on. Each filter unit independently trains filter parameters and independently decides whether the current filter unit selects filtering. It is explained here that the division methods of different layers (such as Layer 1 and Layer 2) can be the same or different, and the division methods of different sub-blocks of the same layer (such as filter unit 0 of Layer 1 and filter unit 1 of Layer 1) can be the same or different, which is not limited here.
[0378] Assume that the final partition result (i.e. the above final block result) is as follows Figure 3 As shown, in this case, the sum of the rate-distortion costs of dividing a whole frame into four filter sub-units is smaller than the rate-distortion cost of not dividing. At the same time, the rate-distortion cost obtained by continuing to divide the upper left and lower right filter sub-units into quadtrees is smaller than the rate-distortion cost of not dividing. Wherein, the limit of block division can be one pixel per block, or a maximum number of division layers can be set; if the rate-distortion cost after division is greater than the rate-distortion cost before division during the division process, it is determined not to perform this division; the division result with a small rate-distortion cost is retained (when the first rate-distortion cost corresponding to the first filter unit is greater than or equal to the corresponding sum, the second filter unit and the first filter unit corresponding to the first filter unit are retained; according to the second filter unit and the first filter unit corresponding to the retained first filter unit, the block result corresponding to the first filter unit is obtained; or, when the first rate-distortion cost corresponding to the first filter unit is less than the corresponding sum, the second filter unit corresponding to the first filter unit is deleted, and the first filter unit is retained; according to the retained first filter unit, the block result corresponding to the first filter unit is obtained; according to each of the block results, the final block result of the image to be processed is determined).
[0379] Part 5, block indexing method (can also be understood as determining the block index corresponding to the LCU);
[0380] Assume that the image is divided into multiple irregular blocks by a two-layer quadtree, such as Figure 4 The Layer1 division diagram shown in the figure is as follows: Figure 5 The Layer2 partition diagram shown in the figure assumes that the partition is based on the Largest Coding Unit (LCU), that is, the block boundaries must be aligned with the LCU boundaries. Therefore, it involves how to index the LCU to the sub-blocks of Layer1 and Layer2. Figure 2 The number of horizontal and vertical LCUs of the image is num_lcu_width (i.e. the number of horizontal LCUs) and num_lcu_height (i.e. the number of vertical LCUs). This solution adopts the following derivation method:
[0381] (1) Method for deriving LCU in Layer 1 sub-block
[0382] The sub-block to which the lcu_idx-th LCU (i.e., the first numbering identifier) belongs (e.g. Figure 4 The export method of ) is as follows:
[0383] 1) First derive the lcu column index and row index as follows:
[0384] lcuX (i.e., the first column index) = lcu_idx% num_lcu_width; the % in the formula means remainder;
[0385] lcuY (i.e., the first row index) = lcu_idx / num_lcu_width; the / in the formula means finding the quotient (rounding down);
[0386] 2) Secondly, calculate the number of LCUs contained in each column of sub-blocks and the number of LCUs contained in each row:
[0387] The number of LCUs contained in the 0th column sub-block is m1=num_lcu_width>>1; this formula indicates that m1 is equal to num_lcu_width divided by 2 to the power of 1 (rounded to an integer);
[0388] The number of LCUs contained in the first column of sub-blocks is m2 = num_lcu_width - m1;
[0389] The number of LCUs contained in the 0th row sub-block is n1=num_lcu_height>>1; this formula indicates that n1 is equal to num_lcu_height divided by 2 to the power of 1 (take an integer);
[0390] The number of LCUs contained in the first row of sub-blocks n2 = num_lcu_height - n1;
[0391] m2 and n2 may not be calculated and are not limited here.
[0392] 3) Then derive the row index and column index of the corresponding sub-block in the following manner:
[0393] regionX (ie, the second column index) = (lcuX≥m1)?1:0; this formula indicates that when lcuX is greater than or equal to m1, regionX is equal to 1; otherwise, regionX is equal to 0.
[0394] regionY (ie, the second row index) = (lcuY≥n1)?1:0; this formula indicates that when lcuY is greater than or equal to n1, regionY is equal to 1; otherwise, regionY is equal to 0.
[0395] 4) Finally, the number region of the sub-block to which the LCU belongs (i.e., the second numbering identifier mentioned above) is derived:
[0396] region=regionY<<1+regionX. This formula means that region is equal to regionY multiplied by 2 to the power of 1, and then added to regionX.
[0397] Take the LCU block filled with 4 diagonal lines as an example, lcu_idx = 16 (numbering starts from 0 from top to bottom and from left to right), num_lcu_width = 9, num_lcu_height = 7. First, derive the row index lcuY and column index lcuX: lcuX = 7, lcuY = 1. Then derive the row index regionY and column index regionX of the sub-block: regionX = 1, regionY = 0. Finally, derive the sub-block number region to which the LCU belongs: region = 0 << 1 + 1 = 1.
[0398] (2) Method for deriving LCU in Layer 2 sub-blocks
[0399] The sub-block to which the lcu_idx-th LCU belongs (such as Figure 5 The export method of ) is as follows:
[0400] 1) First, derive the lcu column index and row index as follows;
[0401] lcuX (i.e., the first column index) = lcu_idx% num_lcu_width; the % in the formula means remainder;
[0402] lcuY (i.e., the first row index) = lcu_idx / num_lcu_width; the / in the formula means finding the quotient (rounding down);
[0403] 2) Calculate the number of LCUs contained in each column of sub-blocks and the number of LCUs contained in each row of sub-blocks:
[0404] The number of LCUs contained in the 0th column sub-block is x1=num_lcu_width>>2; this formula indicates that x1 is equal to num_lcu_width divided by 2 to the power of 2 (take an integer);
[0405] The number of LCUs contained in the first column of sub-blocks is x2=num_lcu_width>>1–x1; this formula indicates that x2 is equal to num_lcu_width divided by 2 raised to the first power (rounded to an integer) and then x1 is subtracted;
[0406] The number of LCUs contained in the second column sub-block x3 = (num_lcu_width-num_lcu_width>>1)>>1; this formula indicates that x3 is equal to num_lcu_width minus num_lcu_width divided by the first power of 2 (rounded to an integer), and then divided by the first power of 2 (rounded to an integer);
[0407] The number of LCUs included in the third column sub-block is x4=(num_lcu_width-num_lcu_width>>1)-x3; this formula indicates that x4 is equal to num_lcu_width minus num_lcu_width divided by the first power of 2 (take an integer), and then minus x3;
[0408] The number of LCUs contained in the 0th row sub-block y1=(num_lcu_height)>>2; this formula indicates that y1 is equal to num_lcu_height divided by 2 to the power of 2 (take an integer);
[0409] The number of LCUs contained in the first row of sub-blocks is y2=num_lcu_height>>1-y1; this formula indicates that y2 is equal to num_lcu_height divided by 2 to the power of 1 (rounded to an integer), and then y1 is subtracted;
[0410] The number of LCUs included in the second row of sub-blocks y3 = (num_lcu_height-num_lcu_height>>1)>>1; this formula indicates that y3 is equal to num_lcu_height minus num_lcu_height divided by the first power of 2 (take an integer), and then divided by the first power of 2 (take an integer);
[0411] The number of LCUs included in the third row of sub-blocks is y4 = (num_lcu_height - num_lcu_height>>1) - y3; this formula indicates that y4 is equal to num_lcu_height minus num_lcu_height divided by 2 to the power of 1 (rounded to an integer), and then minus y3;
[0412] x4 and y4 may not be calculated and are not limited here.
[0413] 3) Then calculate the row index and column index of the sub-block to which the LCU belongs:
[0414] regionX=(lcuX≥x1+x2+x3)?3:((lcuX≥x1+x2)?2:(lcuX≥x1)?1:0); This formula indicates that when lcuX is greater than or equal to x1+x2+x3, regionX is equal to 3; otherwise, when lcuX is greater than or equal to x1+x2 (i.e., lcuX is less than x1+x2+x3, and lcuX is greater than or equal to x1+x2), regionX is equal to 2; otherwise, when lcuX is greater than or equal to x1 (i.e., lcuX is less than x1+x2+, and lcuX is greater than or equal to x1), regionX is equal to 1; otherwise (i.e., lcuX is less than x1), regionX is equal to 0.
[0415] regionY=(lcuY≥y1+y2+y3)?3:((lcuY≥y1+y2)?2:(lcuY≥y1)?1:0); This formula indicates that when lcuY is greater than or equal to y1+y2+y3, regionY is equal to 3; otherwise, when lcuY is greater than or equal to y1+y2 (i.e., lcuY is less than y1+y2+y3, and lcuY is greater than or equal to y1+y2), regionY is equal to 2; otherwise, when lcuY is greater than or equal to y1 (i.e., lcuY is less than y1+y2, and lcuY is greater than or equal to y1), regionY is equal to 1; otherwise (i.e., lcuY is less than y1), regionY is equal to 0.
[0416] 4) Finally, define the number of the layer 2 sub-block to belong to the number set map_idx
[16] , map_idx
[16] = {0, 1, 4, 5, 2, 3, 6, 7, 8, 9, 12, 13, 10, 11, 14, 15}, and derive the number region of the sub-block to which the LCU belongs:
[0417] region=map_idx[regionY<<2+regionX]; this formula means that region is equal to the number in map_idx, which is equal to regionY multiplied by 2 raised to the power of 2 plus regionX.
[0418] Among them, Map_idx actually saves the image divided into layer2 (see Figure 2 ) and then numbers are stored sequentially from left to right and from top to bottom.
[0419] The method of deriving LCU in Layer 2 sub-blocks can also be understood as:
[0420] 1) First, according to the “method for deriving LCU sub-blocks in Layer 1”, the region1 sub-block to which the lcu_idx-th LCU belongs in Layer 1 is derived, where region1∈[0,3].
[0421] 2) Secondly, in the region1 block, the “LCU derivation method in Layer 1 sub-block” is recursively adopted to derive the region2 sub-block to which it belongs. The region2 sub-block is one of the four sub-blocks obtained by quadtree partitioning the region1 block, region2∈[0,3].
[0422] 3) Finally, the region number of the sub-block to which the LCU belongs is derived:
[0423] region=region1<<2+region2; this formula means that region is equal to region1 multiplied by 2 raised to the power of 2, and then added to region2.
[0424] by Figure 5 Take the LCU block filled with diagonal lines as an example, regionX=3,regionY=1:region=map_idx[1<<2+3]=7. It can also be understood as: first, according to the "deriving method of LCU in Layer1 sub-block", the sub-block number region1=1 of the LCU block in Layer1 is derived; secondly, in the region1 block, the "deriving method of LCU in Layer1 sub-block" is recursively adopted to derive the sub-block to which it belongs as region2=3. Finally, the sub-block number of the LCU in Layer2 is derived as: region=1<<2+3=7.
[0425] It is explained here that the block-based cross-component pixel compensation method provided by the embodiment of the present invention can be implemented in the AVS (Source Coding Standard) 3 reference software HPM9.1. Experimental results show that under the three configurations of Random Access (RA), ALL Intra (AI, all I frames) and Low Delay (LD), the method can achieve a relatively obvious performance gain, see the following Table 1:
[0426] Table 1 Performance gain of block-based cross-component pixel compensation method under RA / AI / LD configurations
[0427]
[0428] In Table 1, Sequence represents sequence, Overall represents column mean, and all columns under Sequence (except Overall) involve general test sequences of AVS 3, which will not be described in detail here; Y represents the brightness of the pixel, and U and V represent the chromaticity of the pixel.
[0429] It is explained here that in the embodiment of the present invention, the current coded frame (corresponding to the above-mentioned current frame image) can be filtered using the compensation value of the time domain coded frame (corresponding to the above-mentioned adjacent frame image) (corresponding to the above-mentioned use of the filtering parameter information of the adjacent frame image as the filtering parameter information of the current frame image), see Figure 6 (In the figure, a represents the time domain encoded frame, and b represents the current encoded frame).
[0430] From the above, it can be seen that the solution provided by the embodiment of the present invention takes into account the influence between different components in the process of compensating the samples, and at the same time designs the size of the filtering unit more reasonably; and can be applied to the chroma pixel filtering process; this method has low computational complexity, is hardware-friendly, and can significantly improve coding efficiency.
[0431] The embodiment of the present invention also provides an image processing device, such as Figure 7 As shown, including:
[0432] The first processing module 71 is used to divide the image to be processed into N layers of blocks to obtain a filter unit corresponding to each layer of block division; wherein the filter unit is a first filter unit or a second filter unit, the first filter unit is a filter unit obtained by dividing the Mth layer of blocks, the second filter unit is a filter unit obtained by dividing the M+1th layer of blocks, and the second filter unit is obtained by dividing the first filter unit into blocks;
[0433] A first acquisition module 72, configured to acquire a first rate-distortion cost of each of the first filtering units and a sum of a second rate-distortion cost of each of the first filtering units corresponding to the first filtering units;
[0434] A first determining module 73, configured to determine a final block division result of the image to be processed according to the first rate-distortion cost and the sum;
[0435] Wherein, N is an integer greater than 0, M takes each value from 0 to N-1 in sequence; and one second filtering unit is greater than or equal to one pixel.
[0436] The image processing device provided by the embodiment of the present invention divides the image to be processed into N layers of blocks to obtain the filtering unit corresponding to each layer of block division; wherein the filtering unit is a first filtering unit or a second filtering unit, the first filtering unit is a filtering unit obtained by the Mth layer of block division, the second filtering unit is a filtering unit obtained by the M+1th layer of block division, and the second filtering unit is obtained by dividing the first filtering unit into blocks; the sum of the first rate-distortion cost of each first filtering unit and the second rate-distortion cost of the second filtering unit corresponding to each first filtering unit is obtained; according to the first rate-distortion cost and the sum, the final block division result of the image to be processed is determined; wherein N is an integer greater than 0, and M takes each value from 0 to N-1 in turn; one second filtering unit is greater than or equal to one pixel; it can realize a more reasonable design of the size of the filtering unit, adapt to various image contents, reduce bit rate consumption, avoid wasting processing resources, and ensure final performance, and the scheme has low complexity, can significantly improve the coding efficiency, and well solve the problem of wasting processing resources in the image processing scheme in the prior art.
[0437] Among them, the first determination module includes: a first processing submodule, used to obtain the blocking results corresponding to each of the first filtering units according to the first rate-distortion costs corresponding to each of the first filtering units and the sum; and determine the final blocking result of the image to be processed according to each of the blocking results.
[0438] Specifically, the block results corresponding to each of the first filtering units are obtained according to the first rate-distortion costs corresponding to each of the first filtering units and the sum, including: when the first rate-distortion cost corresponding to the first filtering unit is greater than or equal to the corresponding sum, retaining the second filtering unit and the first filtering unit corresponding to the first filtering unit; obtaining the block results corresponding to the first filtering unit according to the second filtering unit and the first filtering unit corresponding to the retained first filtering unit; or, when the first rate-distortion cost corresponding to the first filtering unit is less than the corresponding sum, deleting the second filtering unit corresponding to the first filtering unit and retaining the first filtering unit; and obtaining the block results corresponding to the first filtering unit according to the retained first filtering unit.
[0439] In an embodiment of the present invention, the first acquisition module includes: a first determination submodule, used to determine the filtering offset of the reference filtering unit; a second processing submodule, used to obtain the rate-distortion cost of the reference filtering unit according to the filtering offset; wherein, the reference filtering unit is the first filtering unit and the rate-distortion cost is the first rate-distortion cost, or the reference filtering unit is the second filtering unit and the rate-distortion cost is the second rate-distortion cost.
[0440] The determining of the filtering offset of the reference filtering unit includes: classifying the chrominance pixels of the reference filtering unit according to the size of the luminance pixels at a preset position of the reference filtering unit; and obtaining the filtering offset of the reference filtering unit according to the classification result.
[0441] In an embodiment of the present invention, the chrominance pixels of the reference filtering unit are classified according to the size of the luminance pixels at the preset position of the reference filtering unit, including: determining the number of classifications of the reference filtering unit based on the rate-distortion cost; and classifying the chrominance pixels of the reference filtering unit according to the number of classifications and the size of the luminance pixels at the preset position of the reference filtering unit.
[0442] The obtaining of the filter offset of the reference filter unit according to the classification result includes: obtaining a reference offset corresponding to each category of chroma pixels according to the classification result; and obtaining the filter offset of the reference filter unit according to the reference offset.
[0443] In an embodiment of the present invention, one of the filtering units includes at least one maximum coding unit LCU; the image processing device also includes: a second determination module, used to determine the second numbering identifier of the filtering unit to which the LCU belongs based on the first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs and the number of vertical LCUs in the image to be processed.
[0444] Among them, the second determination module includes: a third processing submodule, used to obtain the first row index and the first column index of the LCU according to the first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs in the image to be processed; a fourth processing submodule, used to obtain the second row index and the second column index of the filtering unit to which the LCU belongs according to the first row index, the first column index, the number of horizontal LCUs and the number of vertical LCUs in the image to be processed; and a fifth processing submodule, used to obtain the second numbering identifier of the filtering unit to which the LCU belongs according to the second row index and the second column index.
[0445] In an embodiment of the present invention, determining the filtering offset of the reference filtering unit may also include: determining the filtering offset of an adjacent filtering unit of the reference filtering unit; and using the filtering offset of the adjacent filtering unit as the filtering offset of the reference filtering unit.
[0446] Furthermore, the image processing device also includes: a second acquisition module, used to obtain filtering parameter information of adjacent frame images of the current frame image; and a second processing module, used to use the filtering parameter information of the adjacent frame images as filtering parameter information of the current frame image.
[0447] Among them, the implementation embodiments of the image processing method of the above-mentioned embodiment 1 are all applicable to the embodiments of the image processing device and can also achieve the same technical effects.
[0448] The embodiment of the present invention also provides an image processing device, such as Figure 8 As shown, it includes: a processor 81;
[0449] The processor 81 is used to divide the image to be processed into N layers of blocks to obtain a filter unit corresponding to each layer of block division; wherein the filter unit is a first filter unit or a second filter unit, the first filter unit is a filter unit obtained by dividing the Mth layer of blocks, the second filter unit is a filter unit obtained by dividing the M+1th layer of blocks, and the second filter unit is obtained by dividing the first filter unit into blocks;
[0450] Obtaining a sum of a first rate-distortion cost of each of the first filtering units and a second rate-distortion cost of each of the second filtering units corresponding to the first filtering units;
[0451] Determining a final block division result of the image to be processed according to the first rate-distortion cost and the sum;
[0452] Wherein, N is an integer greater than 0, M takes each value from 0 to N-1 in sequence; and one second filtering unit is greater than or equal to one pixel.
[0453] In the embodiment of the present invention, the image processing device may also include a transceiver for communicating with the processor, which is not limited here.
[0454] The image processing device provided by the embodiment of the present invention divides the image to be processed into N layers of blocks to obtain the filtering unit corresponding to each layer of block division; wherein the filtering unit is a first filtering unit or a second filtering unit, the first filtering unit is a filtering unit obtained by the Mth layer of block division, the second filtering unit is a filtering unit obtained by the M+1th layer of block division, and the second filtering unit is obtained by dividing the first filtering unit into blocks; the sum of the first rate-distortion cost of each first filtering unit and the second rate-distortion cost of the second filtering unit corresponding to each first filtering unit is obtained; according to the first rate-distortion cost and the sum, the final block division result of the image to be processed is determined; wherein N is an integer greater than 0, and M takes each value from 0 to N-1 in turn; one second filtering unit is greater than or equal to one pixel; it can realize a more reasonable design of the size of the filtering unit, adapt to various image contents, reduce bit rate consumption, avoid wasting processing resources, and ensure final performance, and the scheme has low complexity, can significantly improve the coding efficiency, and well solve the problem of wasting processing resources in the image processing scheme in the prior art.
[0455] The processor is specifically used to: obtain the block results corresponding to each of the first filtering units according to the first rate-distortion costs corresponding to each of the first filtering units and the sum; and determine the final block results of the image to be processed according to each of the block results.
[0456] Specifically, the processor is specifically used to: when the first rate-distortion cost corresponding to the first filtering unit is greater than or equal to the corresponding sum, retain the second filtering unit and the first filtering unit corresponding to the first filtering unit; obtain the blocking result corresponding to the first filtering unit based on the retained second filtering unit and the first filtering unit corresponding to the first filtering unit; or, when the first rate-distortion cost corresponding to the first filtering unit is less than the corresponding sum, delete the second filtering unit corresponding to the first filtering unit and retain the first filtering unit; and obtain the blocking result corresponding to the first filtering unit based on the retained first filtering unit.
[0457] In an embodiment of the present invention, the processor is specifically used to: determine a filtering offset of a reference filtering unit; and obtain a rate-distortion cost of the reference filtering unit based on the filtering offset; wherein the reference filtering unit is the first filtering unit and the rate-distortion cost is a first rate-distortion cost, or the reference filtering unit is the second filtering unit and the rate-distortion cost is a second rate-distortion cost.
[0458] The determining of the filtering offset of the reference filtering unit includes: classifying the chrominance pixels of the reference filtering unit according to the size of the luminance pixels at a preset position of the reference filtering unit; and obtaining the filtering offset of the reference filtering unit according to the classification result.
[0459] In an embodiment of the present invention, the chrominance pixels of the reference filtering unit are classified according to the size of the luminance pixels at the preset position of the reference filtering unit, including: determining the number of classifications of the reference filtering unit based on the rate-distortion cost; and classifying the chrominance pixels of the reference filtering unit according to the number of classifications and the size of the luminance pixels at the preset position of the reference filtering unit.
[0460] The obtaining of the filter offset of the reference filter unit according to the classification result includes: obtaining a reference offset corresponding to each category of chroma pixels according to the classification result; and obtaining the filter offset of the reference filter unit according to the reference offset.
[0461] In an embodiment of the present invention, one of the filtering units includes at least one maximum coding unit LCU; the processor is also used to: determine the second numbering identifier of the filtering unit to which the LCU belongs based on the first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs and the number of vertical LCUs in the image to be processed.
[0462] Among them, determining the second numbering identifier of the filtering unit to which the LCU belongs according to the first numbering identifier of the LCU in the image to be processed and the horizontal number of LCUs and the vertical number of LCUs in the image to be processed includes: obtaining the first row index and the first column index of the LCU according to the first numbering identifier of the LCU in the image to be processed and the horizontal number of LCUs in the image to be processed; obtaining the second row index and the second column index of the filtering unit to which the LCU belongs according to the first row index, the first column index, the horizontal number of LCUs and the vertical number of LCUs in the image to be processed; and obtaining the second numbering identifier of the filtering unit to which the LCU belongs according to the second row index and the second column index.
[0463] In an embodiment of the present invention, determining the filtering offset of the reference filtering unit may also include: determining the filtering offset of an adjacent filtering unit of the reference filtering unit; and using the filtering offset of the adjacent filtering unit as the filtering offset of the reference filtering unit.
[0464] Furthermore, the processor is also used to: obtain filtering parameter information of adjacent frame images of the current frame image; and use the filtering parameter information of the adjacent frame images as filtering parameter information of the current frame image.
[0465] Among them, the implementation embodiments of the image processing method of the above-mentioned embodiment 1 are all applicable to the embodiments of the image processing device and can also achieve the same technical effects.
[0466] Embodiment 2
[0467] The image processing method provided by the embodiment of the present invention is as follows: Fig. 9 As shown, including:
[0468] Step 91: Divide the image to be processed into four first sub-blocks based on the largest coding unit LCU;
[0469] Step 92: Obtain a third rate-distortion cost of each of the first sub-blocks;
[0470] Step 93: Taking LCU as a unit, divide each of the first sub-blocks into four second sub-blocks;
[0471] Step 94: Obtain a fourth rate-distortion cost of each of the second sub-blocks;
[0472] Step 95: Determine a final division result of the image to be processed according to the third rate-distortion cost and the fourth rate-distortion cost.
[0473] Specifically, a set of filtering parameters can be trained based on the original CCSAO as the chrominance component of a frame. The solution provided by the embodiment of the present invention divides a frame into two layers of quadtree recursively according to LCU (such as Figure 2 and Figure 3 As shown, Figure 2 It can also be understood as a two-layer CCSAO division diagram).
[0474] This solution can be specifically understood as follows: After CCSAO attempts frame-level filtering and calculates the rate-distortion cost, it then attempts to divide the entire frame into four sub-blocks in units of LCU. Each sub-block uses the CCSAO filtering method to calculate its own rate-distortion cost independently. After that, each sub-block continues to try to be divided into four sub-blocks, and each sub-block calculates its own rate-distortion cost in the same way. After that, the final division result is obtained by comparing the rate-distortion relationship.
[0475] The image processing method provided by the embodiment of the present invention divides the image to be processed into four first sub-blocks by taking the maximum coding unit LCU as the unit; obtains the third rate distortion cost of each of the first sub-blocks; divides each of the first sub-blocks into four second sub-blocks by taking the LCU as the unit; obtains the fourth rate distortion cost of each of the second sub-blocks; determines the final division result of the image to be processed according to the third rate distortion cost and the fourth rate distortion cost; can achieve a more reasonable design of the size of the filter unit, adapt to various image contents, reduce bit rate consumption, avoid wasting processing resources, ensure final performance, and the scheme has low complexity, can significantly improve the coding efficiency, and well solves the problem of wasting processing resources in the image processing scheme in the prior art.
[0476] Furthermore, the image processing method further includes: setting a flag ccsao_is_split_flag for each first sub-block and each second sub-block, wherein the flag is used to indicate whether the corresponding sub-block in the final division result is divided.
[0477] Specifically, it can be understood that the entire improvement of CCSAO is to introduce a split flag bit in the syntax element: ccsao_is_split_flag. Figure 3 As a result of this division, the ccsao_is_split_flag of Layer 0 is equal to true. At the same time, the ccsao_is_split_flag of R(block)0 and R3 of Layer 1 is also equal to true. The ccsao_is_split_flag of R1 and R2 is equal to false.
[0478] In the embodiment of the present invention, the image to be processed is divided into four first sub-blocks based on the maximum coding unit LCU, including: dividing the image to be processed into two rows and two columns based on the LCU; wherein, when the number of columns of LCU contained in the image to be processed is an even number, the two columns contain the same number of LCU columns; when the number of columns of LCU contained in the image to be processed is an odd number, the latter column contains one more column of LCU than the former column; when the number of rows of LCU contained in the image to be processed is an even number, the two rows contain the same number of LCU rows; when the number of rows of LCU contained in the image to be processed is an odd number, the latter row contains one more row of LCU than the former row.
[0479] For details on the division of Layer 1 and Layer 2, see Figure 4 and Figure 5 :
[0480] For Layer 1, blocks are divided into LCU units, and the image is evenly divided into 2 rows and 2 columns. If num_lcu_width is an odd number, the blocks in the first column will contain one more LCU in the horizontal direction than the blocks in the 0th column. Similarly, if num_lcu_height is an odd number, the blocks in the first row will contain one more LCU in the vertical direction than the blocks in the 0th row; Figure 4 shown.
[0481] For Layer 2, first, the image is evenly divided into 4 sub-blocks according to the block division method of Layer 1; secondly, each sub-block is divided into four blocks using the same classification method as the block division of Layer 1; Figure 5 shown.
[0482] Furthermore, the image processing method also includes: determining the numbering identifier of the sub-block to which the LCU belongs based on the first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs and the number of vertical LCUs in the image to be processed; wherein the sub-block to which the LCU belongs is the first sub-block or the second sub-block.
[0483] It can also be understood that this solution also includes a method for deriving the sub-blocks to which the LCU belongs; regarding the number of horizontal LCUs and the number of vertical LCUs, it can be assumed that the number of horizontal and vertical LCUs in the current frame is num_lcu_width and num_lcu_height respectively; the LCUs are marked in the order of 0, 1, 2, etc. according to the raster scanning method. The divided sub-blocks are divided according to Figure 2 Mark as shown.
[0484] In an embodiment of the present invention, determining the numbering identifier of the sub-block to which the LCU belongs according to the first numbering identifier of the LCU in the image to be processed and the horizontal number of LCUs and the vertical number of LCUs in the image to be processed includes: obtaining the first column index lcuX and the first row index lcuY of the LCU according to the first numbering identifier of the LCU in the image to be processed and the horizontal number of LCUs in the image to be processed; obtaining the number of LCUs included in at least one column of sub-blocks and the number of LCUs included in at least one row of sub-blocks according to the horizontal number of LCUs and the vertical number of LCUs in the image to be processed; determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks; wherein the sub-block and the sub-block to which the LCU belongs are both the first sub-block or the second sub-block.
[0485] Among them, the obtaining of the first column index lcuX and the first row index lcuY of the LCU according to the first numbering identifier of the LCU in the image to be processed and the horizontal number of LCUs in the image to be processed includes: using the first numbering identifier of the LCU in the image to be processed to perform a modulo operation on the horizontal number of LCUs in the image to be processed to obtain the first column index lcuX of the LCU; using the first numbering identifier of the LCU in the image to be processed to perform a quotient and round down operation on the horizontal number of LCUs in the image to be processed to obtain the first row index lcuY of the LCU.
[0486] Specifically, in the case that the sub-block to which the LCU belongs is the first sub-block (i.e., corresponding to layer 1), the numbering identifier of the sub-block to which the LCU belongs is determined according to the first column index lcuX, the first row index lcuY, the number of LCUs contained in at least one column of sub-blocks, and the number of LCUs contained in at least one row of sub-blocks, including: taking the quotient of the horizontal LCU number to the first power of 2 and rounding it down to obtain the first column number m1 (corresponding to the formula m1=num_lcu_width>>1); and taking the quotient of the vertical LCU number to the first power of 2 and rounding it down to obtain the first row number n1 (corresponding to the formula n1=num_lcu_height>>1).
[0487] In an embodiment of the present invention, the method of determining the numbering identifier of the sub-block to which the LCU belongs based on the first column index lcuX, the first row index lcuY, the number of LCUs contained in at least one column of sub-blocks, and the number of LCUs contained in at least one row of sub-blocks also includes: subtracting the first column number m1 from the horizontal LCU number to obtain the second column number m2 (corresponding to the formula m2=num_lcu_width-m1); and / or subtracting the first row number n1 from the vertical LCU number to obtain the second row number n2 (corresponding to n2=num_lcu_height-n1).
[0488] The method of determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs contained in at least one column of sub-blocks, and the number of LCUs contained in at least one row of sub-blocks includes: obtaining the first sub-block column index regionX to which the LCU belongs according to the first column index lcuX and the first column number m1; obtaining the first sub-block row index regionY to which the LCU belongs according to the first row index lcuY and the first row number n1; and obtaining the numbering identifier of the first sub-block to which the LCU belongs by multiplying the first sub-block row index regionY by 2 raised to the power of 1 and then adding the first sub-block column index regionX (corresponding to the formula region=regionY<<1+regionX).
[0489] In the embodiment of the present invention, the first sub-block column index regionX to which the LCU belongs is obtained according to the first column index lcuX and the first column number m1, including: when the first column index lcuX is greater than or equal to the first column number m1, the first sub-block column index regionX to which the LCU belongs is 1; otherwise, the first sub-block column index regionX to which the LCU belongs is 0 (corresponding to the formula regionX=(lcuX≥m1)?1:0).
[0490] Among them, the first sub-block row index regionY to which the LCU belongs is obtained according to the first row index lcuY and the first row number n1, including: when the first row index lcuY is greater than or equal to the first row number n1, the first sub-block row index regionY to which the LCU belongs is 1; otherwise, the first sub-block row index regionY to which the LCU belongs is 0 (corresponding to the formula regionY=(lcuY≥n1)?1:0).
[0491] The complete (LCU derivation method in Layer 1 sub-block) can also be understood as follows: the derivation method of the sub-block to which the lcu_idx-th LCU belongs is as follows:
[0492] 1. First, export the lcu row index and column index as follows:
[0493] Column lcuX=lcu_idx%num_lcu_width;
[0494] Row lcuY=lcu_idx / num_lcu_width;
[0495] 2. Next, calculate the number of LCUs contained in each column of sub-blocks and the number of LCUs contained in each row:
[0496] m1 = num_lcu_width >> 1;
[0497] m2=num_lcu_width-m1;
[0498] n1=num_lcu_height>>1;
[0499] n2=num_lcu_height-n1;
[0500] 3. Then derive the row index and column index of the corresponding sub-block as follows:
[0501] regionX=(lcuX≥m1)? 1:0;
[0502] regionY=(lcuY≥n1)? 1:0;
[0503] 4. Finally, export the sub-block of the region to which the LCU belongs:
[0504] region=regionY<<1+regionX.
[0505] In the embodiment of the present invention, when the sub-block to which the LCU belongs is the second sub-block (corresponding to layer 2), determining the number identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks includes: performing a floor operation on the quotient of 2 raised to the power of 2 using the number of horizontal LCUs to obtain the first column number x1 (corresponding to the formula x1=num_lcu_width>>2); and, performing a floor operation on the quotient of 2 raised to the power of 2 minus the value obtained by taking the quotient of 2 raised to the power of 1 from the number of horizontal LCUs, and then performing a floor operation on the quotient of 2 raised to the power of 1 to obtain the third column number x3 (corresponding to the formula x3=(num_lcu_width-num_lcu_width>>1)>>1); and, performing a floor operation on the quotient of 2 raised to the power of 1 from the number of horizontal LCUs to obtain the value obtained by taking the quotient of 2 raised to the power of 1 using the number of horizontal LCUs, and then subtracting the third column number x3 to obtain The fourth column number x4 (corresponding to the formula x4 = (num_lcu_width-num_lcu_width>>1)-x3); and, using the vertical LCU number to the power of 2 to take the quotient and round down to the integer, the first row number y1 (corresponding to the formula y1 = (num_lcu_height)>>2); and, using the vertical LCU number minus the vertical LCU number to the power of 2 to take the quotient and round down to the integer value, and then rounding the quotient of 2 to the power of 1 to the integer value. The quotient is rounded down to obtain the number of the third row y3 (corresponding to the formula y3 = (num_lcu_height-num_lcu_height>>1)>>1); and the value obtained by taking the quotient of the vertical LCU number minus the first power of 2 from the vertical LCU number is rounded down to an integer, and then subtracting the third row number y3 to obtain the number of the fourth column y4 (corresponding to the formula y4 = (num_lcu_height-num_lcu_height>>1)-y3).
[0506] Among them, the method of determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs contained in at least one column of sub-blocks, and the number of LCUs contained in at least one row of sub-blocks also includes: using the number of horizontal LCUs to the first power of 2 to perform a floor operation on the quotient, and then subtracting the first column number x1 to obtain the second column number x2 (corresponding to the formula x2=num_lcu_width>>1–x1); and / or, using the first power of 2 to perform a floor operation on the quotient, and then subtracting the first row number y1 to obtain the second column number y2 (corresponding to the formula y2=num_lcu_height>>1-y1).
[0507] In the embodiment of the present invention, the method of determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks includes: obtaining the second sub-block column index regionX to which the LCU belongs according to the first column index lcuX, the first column number x1, and the fourth column number x4; obtaining the second sub-block row index regionY to which the LCU belongs according to the first row index lcuY, the first row number y1, and the fourth column number y4; and obtaining the numbering identifier of the second sub-block to which the LCU belongs by multiplying the second sub-block row index regionY by 2 raised to the power of 2 and then adding the second sub-block column index regionX (corresponding to the formula region=map_idx[regionY<<2+regionX]).
[0508] In the embodiment of the present invention, the obtaining of the second sub-block column index regionX to which the LCU belongs according to the first column index lcuX, the first column number x1, and the fourth column number x4 includes: when the first column index lcuX is greater than or equal to the difference obtained by subtracting the fourth column number x4 from the horizontal LCU number, the second sub-block column index regionX to which the LCU belongs is 3; when the first column index lcuX is less than the difference obtained by subtracting the fourth column number x4 from the horizontal LCU number, and the first column index lcuX is greater than or equal to the value obtained by taking the quotient of the horizontal LCU number to the first power of 2 and rounding it down to an integer, the second sub-block column index regionX to which the LCU belongs is is 2; when the first column index lcuX is less than the difference between the number of horizontal LCUs and the number of fourth columns x4, and the first column index lcuX is less than the value obtained by taking the quotient of the number of horizontal LCUs raised to the first power of 2 and dividing it by an integer, and the first column index lcuX is greater than or equal to the first column number x1, the second sub-block column index regionX to which the LCU belongs is 1; otherwise, the second sub-block column index regionX to which the LCU belongs is 0 (corresponding to the formula regionX=(lcuX≥num_lcu_width-x4)?3:((lcuX≥num_lcu_width>>1)?2:(lcuX≥x1)?1:0)).
[0509] The second sub-block row index regionY to which the LCU belongs is obtained according to the first row index lcuY, the first row number y1 and the fourth column number y4, including: when the first row index lcuY is greater than or equal to the difference obtained by subtracting the fourth column number y4 from the vertical LCU number, the second sub-block row index regionY to which the LCU belongs is 3; when the first row index lcuY is less than the difference obtained by subtracting the fourth column number x4 from the vertical LCU number, and the first row index lcuY is greater than or equal to the value obtained by taking the quotient of the vertical LCU number to the first power of 2 and raising it to an integer, the second sub-block row index regionY to which the LCU belongs is 2; When the first row index lcuY is less than the difference between the number of vertical LCUs and the number of fourth columns x4, and the first row index lcuY is less than the value obtained by taking the quotient of the number of vertical LCUs raised to the first power of 2 and dividing it by an integer, and the first row index lcuY is greater than or equal to the first row number y1, the second sub-block row index regionY to which the LCU belongs is 1; otherwise, the second sub-block row index regionY to which the LCU belongs is 0 (corresponding to the formula regionY=(lcuY≥num_lcu_height-y4)?3:((lcuY≥num_lcu_height>>1)?2:(lcuY≥y1)?1:0)).
[0510] The complete (LCU derivation method in Layer 2 sub-block) can also be understood as follows: the derivation method of the sub-block to which the lcu_idx-th LCU belongs is as follows:
[0511] 1. First, export the lcu row index and column index as follows:
[0512] lcuX=lcu_idx%num_lcu_width;
[0513] lcuY=lcu_idx / num_lcu_width;
[0514] 2. Calculate the number of LCUs contained in each column of sub-blocks and the number of LCUs contained in each row of sub-blocks:
[0515] x1=num_lcu_width>>2;
[0516] x2=num_lcu_width>>1–x1;
[0517] x3=(num_lcu_width-num_lcu_width>>1)>>1;
[0518] x4=(num_lcu_width-num_lcu_width>>1)-x3;
[0519] y1=(num_lcu_height)>>2;
[0520] y2=num_lcu_height>>1-y1;
[0521] y3=(num_lcu_height-num_lcu_height>>1)>>1;
[0522] y4=(num_lcu_height-num_lcu_height>>1)-y3;
[0523] 3. Then calculate the row index and column index of the sub-block to which the LCU belongs:
[0524] regionX=(lcuX≥num_lcu_width-x4)? 3:((lcuX≥num_lcu_width>>1)? 2:(lcuX≥x1)?1:0);
[0525] regionY=(lcuY≥num_lcu_height-y4)? 3:((lcuY≥num_lcu_height>>1)?2:(lcuY≥y1)?1:0);
[0526] 4. Finally, define map_idx
[16] = {0, 1, 4, 5, 2, 3, 6, 7, 8, 9, 12, 13, 10, 11, 14, 15}, and derive the region-th sub-block to which the LCU belongs:
[0527] region=map_idx[regionY<<2+regionX].
[0528] From the above, we can see that this scheme adds a two-layer quadtree partitioning method on the basis of the original CCSAO scheme. Compared with the original CCSAO technology, the performance is further improved. Specifically:
[0529] Based on the original CCSAO technology, this scheme proposes a two-layer quadtree partitioning method with LCU blocks as the partitioning unit. Experimental results show that this method can achieve certain performance benefits.
[0530] About CCSAO Technology:
[0531] CCSAO technology uses luma pixels to classify chroma pixels. The parameter training and filtering process after classification are similar to the existing ESAO and SAO methods. rec According to the corresponding brightness pixel Divide into bandNum categories. Then train a filter parameter for each category. Each chrominance pixel is filtered using the filter parameter trained by its corresponding category.
[0532] It is to be noted that the similarities between the solutions in Example 1 and Example 2 of this solution can be used as reference for each other and will not be described in detail here.
[0533] The embodiment of the present invention also provides an image processing device, such as Fig.10 As shown, including:
[0534] A first division module 101 is used to divide the image to be processed into four first sub-blocks based on a maximum coding unit LCU;
[0535] A third acquisition module 102, configured to acquire a third rate-distortion cost of each of the first sub-blocks;
[0536] A second division module 103 is used to divide each of the first sub-blocks into four second sub-blocks in units of LCU;
[0537] A fourth acquisition module 104, configured to acquire a fourth rate-distortion cost of each of the second sub-blocks;
[0538] The third determining module 105 is used to determine a final division result of the image to be processed according to the third rate-distortion cost and the fourth rate-distortion cost.
[0539] The image processing device provided by the embodiment of the present invention divides the image to be processed into four first sub-blocks by taking the maximum coding unit LCU as the unit; obtains the third rate-distortion cost of each of the first sub-blocks; divides each of the first sub-blocks into four second sub-blocks by taking the LCU as the unit; obtains the fourth rate-distortion cost of each of the second sub-blocks; determines the final division result of the image to be processed according to the third rate-distortion cost and the fourth rate-distortion cost; can achieve a more reasonable design of the size of the filter unit, adapt to various image contents, reduce bit rate consumption, avoid wasting processing resources, ensure final performance, and the scheme has low complexity, can significantly improve the coding efficiency, and well solves the problem of wasting processing resources in the image processing scheme in the prior art.
[0540] Furthermore, the image processing apparatus further includes: a first setting module, configured to set a flag ccsao_is_split_flag for each first sub-block and each second sub-block, wherein the flag is configured to indicate whether the corresponding sub-block in the final division result is divided.
[0541] Wherein, the method of dividing the image to be processed into four first sub-blocks based on the maximum coding unit LCU includes: dividing the image to be processed into two rows and two columns based on the LCU; wherein, when the number of columns of LCU contained in the image to be processed is an even number, the two columns contain the same number of LCU columns; when the number of columns of LCU contained in the image to be processed is an odd number, the latter column contains one more column of LCU than the former column; when the number of rows of LCU contained in the image to be processed is an even number, the two rows contain the same number of LCU rows; when the number of rows of LCU contained in the image to be processed is an odd number, the latter row contains one more row of LCU than the former row.
[0542] Furthermore, the image processing device also includes: a fourth determination module, used to determine the numbering identifier of the sub-block to which the LCU belongs based on the first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs and the number of vertical LCUs in the image to be processed; wherein the sub-block to which the LCU belongs is the first sub-block or the second sub-block.
[0543] Among them, the determining the numbering identifier of the sub-block to which the LCU belongs according to the first numbering identifier of the LCU in the image to be processed and the horizontal number of LCUs and the vertical number of LCUs of the image to be processed includes: obtaining the first column index lcuX and the first row index lcuY of the LCU according to the first numbering identifier of the LCU in the image to be processed and the horizontal number of LCUs of the image to be processed; obtaining the number of LCUs included in at least one column of sub-blocks and the number of LCUs included in at least one row of sub-blocks according to the horizontal number of LCUs and the vertical number of LCUs of the image to be processed; determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks; wherein the sub-block and the sub-block to which the LCU belongs are both the first sub-block or the second sub-block.
[0544] In an embodiment of the present invention, obtaining the first column index lcuX and the first row index lcuY of the LCU according to the first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs in the image to be processed includes: performing a modulo operation on the number of horizontal LCUs in the image to be processed using the first numbering identifier of the LCU in the image to be processed to obtain the first column index lcuX of the LCU; performing a quotient and rounding down operation on the number of horizontal LCUs in the image to be processed using the first numbering identifier of the LCU in the image to be processed to obtain the first row index lcuY of the LCU.
[0545] Among them, in the case that the sub-block to which the LCU belongs is the first sub-block, the numbering identifier of the sub-block to which the LCU belongs is determined according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks, including: taking the quotient and rounding down the number of horizontal LCUs to the first power of 2 to obtain the first column number m1; and taking the quotient and rounding down the number of vertical LCUs to the first power of 2 to obtain the first row number n1.
[0546] Furthermore, the method of determining the numbering identifier of the sub-block to which the LCU belongs based on the first column index lcuX, the first row index lcuY, the number of LCUs contained in at least one column of sub-blocks, and the number of LCUs contained in at least one row of sub-blocks also includes: subtracting the first column number m1 from the horizontal LCU number to obtain the second column number m2; and / or subtracting the first row number n1 from the vertical LCU number to obtain the second row number n2.
[0547] Among them, the method of determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs contained in at least one column of sub-blocks, and the number of LCUs contained in at least one row of sub-blocks includes: obtaining the first sub-block column index regionX to which the LCU belongs according to the first column index lcuX and the first column number m1; obtaining the first sub-block row index regionY to which the LCU belongs according to the first row index lcuY and the first row number n1; and obtaining the numbering identifier of the first sub-block to which the LCU belongs by multiplying the first sub-block row index regionY by 2 raised to the power of 1 and then adding the first sub-block column index regionX.
[0548] In an embodiment of the present invention, the first sub-block column index regionX to which the LCU belongs is obtained according to the first column index lcuX and the first column number m1, including: when the first column index lcuX is greater than or equal to the first column number m1, the first sub-block column index regionX to which the LCU belongs is 1; otherwise, the first sub-block column index regionX to which the LCU belongs is 0.
[0549] Among them, the first sub-block row index regionY to which the LCU belongs is obtained according to the first row index lcuY and the first row number n1, including: when the first row index lcuY is greater than or equal to the first row number n1, the first sub-block row index regionY to which the LCU belongs is 1; otherwise, the first sub-block row index regionY to which the LCU belongs is 0.
[0550] In an embodiment of the present invention, in the case that the sub-block to which the LCU belongs is the second sub-block, the numbering identifier of the sub-block to which the LCU belongs is determined according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks, including: performing a floor operation on the quotient of 2 raised to the power of 2 using the number of horizontal LCUs to obtain the first column number x1; and performing a floor operation on the quotient of 2 raised to the power of 2 minus the value obtained by performing a floor operation on the quotient of 2 raised to the power of 1 using the number of horizontal LCUs to obtain the third column number x3; and performing a floor operation on the quotient of 2 raised to the power of 1 using the number of horizontal LCUs to obtain the third column number x4. Subtract the value obtained by taking the quotient of 2 raised to the first power from the number of horizontal LCUs, and then subtract the number of the third column x3 to obtain the number of the fourth column x4; and, take the quotient of 2 raised to the second power from the number of vertical LCUs and round it down to obtain the number of the first row y1; and, take the value obtained by taking the quotient of 2 raised to the first power from the number of vertical LCUs and then round it down to the first power of 2 to obtain the number of the third row y3; and, take the value obtained by taking the quotient of 2 raised to the first power from the number of vertical LCUs and then subtract the number of the third row y3 to obtain the number of the fourth column y4.
[0551] Furthermore, the method of determining the numbering identifier of the sub-block to which the LCU belongs based on the first column index lcuX, the first row index lcuY, the number of LCUs contained in at least one column of sub-blocks, and the number of LCUs contained in at least one row of sub-blocks also includes: performing a floor operation on the quotient of 2 raised to the first power of the horizontal LCU number, and then subtracting the first column number x1 to obtain the second column number x2; and / or performing a floor operation on the quotient of 2 raised to the first power of the vertical LCU number, and then subtracting the first row number y1 to obtain the second column number y2.
[0552] The method of determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs contained in at least one column of sub-blocks, and the number of LCUs contained in at least one row of sub-blocks includes: obtaining the second sub-block column index regionX to which the LCU belongs according to the first column index lcuX, the first column number x1, and the fourth column number x4; obtaining the second sub-block row index regionY to which the LCU belongs according to the first row index lcuY, the first row number y1, and the fourth column number y4; and obtaining the numbering identifier of the second sub-block to which the LCU belongs by multiplying the second sub-block row index regionY by 2 raised to the power of 2 and then adding the second sub-block column index regionX.
[0553] In the embodiment of the present invention, the second sub-block column index regionX to which the LCU belongs is obtained according to the first column index lcuX, the first column number x1, and the fourth column number x4, including: when the first column index lcuX is greater than or equal to the difference obtained by subtracting the fourth column number x4 from the horizontal LCU number, the second sub-block column index regionX to which the LCU belongs is 3; when the first column index lcuX is less than the difference obtained by subtracting the fourth column number x4 from the horizontal LCU number, and the first column index lcuX is greater than or equal to 1 of the horizontal LCU number to 2. When the value obtained by raising the quotient of 2 to the power of 1 is reduced to an integer, the second sub-block column index regionX to which the LCU belongs is 2; when the first column index lcuX is less than the difference obtained by subtracting the fourth column number x4 from the number of horizontal LCUs, and the first column index lcuX is less than the value obtained by raising the quotient of the horizontal LCU number to the power of 2 to the power of 1, and the first column index lcuX is greater than or equal to the first column number x1, the second sub-block column index regionX to which the LCU belongs is 1; otherwise, the second sub-block column index regionX to which the LCU belongs is 0.
[0554] In the embodiment of the present invention, the second sub-block row index regionY to which the LCU belongs is obtained according to the first row index lcuY, the first row number y1 and the fourth column number y4, including: when the first row index lcuY is greater than or equal to the difference obtained by subtracting the fourth column number y4 from the vertical LCU number, the second sub-block row index regionY to which the LCU belongs is 3; when the first row index lcuY is less than the difference obtained by subtracting the fourth column number x4 from the vertical LCU number, and the first row index lcuY is greater than or equal to 1 of the vertical LCU number to 2. When the first row index lcuY is less than the difference between the number of vertical LCUs and the number of fourth columns x4, and the first row index lcuY is less than the value obtained by raising the quotient of the number of vertical LCUs to the power of 2 raised to the first power and lowering it to an integer, and the first row index lcuY is greater than or equal to the first row number y1, the second sub-block row index regionY to which the LCU belongs is 1; otherwise, the second sub-block row index regionY to which the LCU belongs is 0.
[0555] Among them, the implementation embodiments of the image processing method of the above-mentioned embodiment 2 are all applicable to the embodiments of the image processing device and can also achieve the same technical effects.
[0556] The embodiment of the present invention also provides an image processing device, such as Fig.11 As shown, it includes: a processor 111;
[0557] The processor 111 is used to divide the image to be processed into four first sub-blocks based on the largest coding unit LCU;
[0558] Obtaining a third rate-distortion cost of each of the first sub-blocks;
[0559] Taking LCU as a unit, dividing each of the first sub-blocks into four second sub-blocks;
[0560] Obtaining a fourth rate-distortion cost of each of the second sub-blocks;
[0561] A final division result of the image to be processed is determined according to the third rate-distortion cost and the fourth rate-distortion cost.
[0562] The image processing device provided by the embodiment of the present invention divides the image to be processed into four first sub-blocks by taking the maximum coding unit LCU as the unit; obtains the third rate-distortion cost of each of the first sub-blocks; divides each of the first sub-blocks into four second sub-blocks by taking the LCU as the unit; obtains the fourth rate-distortion cost of each of the second sub-blocks; determines the final division result of the image to be processed according to the third rate-distortion cost and the fourth rate-distortion cost; can achieve a more reasonable design of the size of the filter unit, adapt to various image contents, reduce bit rate consumption, avoid wasting processing resources, ensure final performance, and the scheme has low complexity, can significantly improve the coding efficiency, and well solves the problem of wasting processing resources in the image processing scheme in the prior art.
[0563] Furthermore, the processor is further configured to: set a flag ccsao_is_split_flag for each first sub-block and each second sub-block, wherein the flag is used to indicate whether the corresponding sub-block in the final division result is divided.
[0564] Wherein, the method of dividing the image to be processed into four first sub-blocks based on the maximum coding unit LCU includes: dividing the image to be processed into two rows and two columns based on the LCU; wherein, when the number of columns of LCU contained in the image to be processed is an even number, the two columns contain the same number of LCU columns; when the number of columns of LCU contained in the image to be processed is an odd number, the latter column contains one more column of LCU than the former column; when the number of rows of LCU contained in the image to be processed is an even number, the two rows contain the same number of LCU rows; when the number of rows of LCU contained in the image to be processed is an odd number, the latter row contains one more row of LCU than the former row.
[0565] Furthermore, the processor is also used to: determine the numbering identifier of the sub-block to which the LCU belongs based on the first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs and the number of vertical LCUs in the image to be processed; wherein the sub-block to which the LCU belongs is the first sub-block or the second sub-block.
[0566] In an embodiment of the present invention, determining the numbering identifier of the sub-block to which the LCU belongs according to the first numbering identifier of the LCU in the image to be processed and the horizontal number of LCUs and the vertical number of LCUs in the image to be processed includes: obtaining the first column index lcuX and the first row index lcuY of the LCU according to the first numbering identifier of the LCU in the image to be processed and the horizontal number of LCUs in the image to be processed; obtaining the number of LCUs included in at least one column of sub-blocks and the number of LCUs included in at least one row of sub-blocks according to the horizontal number of LCUs and the vertical number of LCUs in the image to be processed; determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks; wherein the sub-block and the sub-block to which the LCU belongs are both the first sub-block or the second sub-block.
[0567] Among them, the obtaining of the first column index lcuX and the first row index lcuY of the LCU according to the first numbering identifier of the LCU in the image to be processed and the horizontal number of LCUs in the image to be processed includes: using the first numbering identifier of the LCU in the image to be processed to perform a modulo operation on the horizontal number of LCUs in the image to be processed to obtain the first column index lcuX of the LCU; using the first numbering identifier of the LCU in the image to be processed to perform a quotient and round down operation on the horizontal number of LCUs in the image to be processed to obtain the first row index lcuY of the LCU.
[0568] In an embodiment of the present invention, when the sub-block to which the LCU belongs is the first sub-block, determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks includes: performing a floor operation on the quotient of 2 raised to the first power to obtain the first column number m1; and performing a floor operation on the quotient of 2 raised to the first power to obtain the first row number n1.
[0569] Furthermore, the method of determining the numbering identifier of the sub-block to which the LCU belongs based on the first column index lcuX, the first row index lcuY, the number of LCUs contained in at least one column of sub-blocks, and the number of LCUs contained in at least one row of sub-blocks also includes: subtracting the first column number m1 from the horizontal LCU number to obtain the second column number m2; and / or subtracting the first row number n1 from the vertical LCU number to obtain the second row number n2.
[0570] Among them, the method of determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs contained in at least one column of sub-blocks, and the number of LCUs contained in at least one row of sub-blocks includes: obtaining the first sub-block column index regionX to which the LCU belongs according to the first column index lcuX and the first column number m1; obtaining the first sub-block row index regionY to which the LCU belongs according to the first row index lcuY and the first row number n1; and obtaining the numbering identifier of the first sub-block to which the LCU belongs by multiplying the first sub-block row index regionY by 2 raised to the power of 1 and then adding the first sub-block column index regionX.
[0571] In an embodiment of the present invention, the first sub-block column index regionX to which the LCU belongs is obtained according to the first column index lcuX and the first column number m1, including: when the first column index lcuX is greater than or equal to the first column number m1, the first sub-block column index regionX to which the LCU belongs is 1; otherwise, the first sub-block column index regionX to which the LCU belongs is 0.
[0572] Among them, the first sub-block row index regionY to which the LCU belongs is obtained according to the first row index lcuY and the first row number n1, including: when the first row index lcuY is greater than or equal to the first row number n1, the first sub-block row index regionY to which the LCU belongs is 1; otherwise, the first sub-block row index regionY to which the LCU belongs is 0.
[0573] In an embodiment of the present invention, in the case that the sub-block to which the LCU belongs is the second sub-block, the numbering identifier of the sub-block to which the LCU belongs is determined according to the first column index lcuX, the first row index lcuY, the number of LCUs included in at least one column of sub-blocks, and the number of LCUs included in at least one row of sub-blocks, including: performing a floor operation on the quotient of 2 raised to the power of 2 using the number of horizontal LCUs to obtain the first column number x1; and performing a floor operation on the quotient of 2 raised to the power of 2 minus the value obtained by performing a floor operation on the quotient of 2 raised to the power of 1 using the number of horizontal LCUs to obtain the third column number x3; and performing a floor operation on the quotient of 2 raised to the power of 1 using the number of horizontal LCUs to obtain the third column number x4. Subtract the value obtained by taking the quotient of 2 raised to the first power from the number of horizontal LCUs, and then subtract the number of the third column x3 to obtain the number of the fourth column x4; and, take the quotient of 2 raised to the second power from the number of vertical LCUs and round it down to obtain the number of the first row y1; and, take the value obtained by taking the quotient of 2 raised to the first power from the number of vertical LCUs and then round it down to the first power of 2 to obtain the number of the third row y3; and, take the value obtained by taking the quotient of 2 raised to the first power from the number of vertical LCUs and then subtract the number of the third row y3 to obtain the number of the fourth column y4.
[0574] Furthermore, the method of determining the numbering identifier of the sub-block to which the LCU belongs based on the first column index lcuX, the first row index lcuY, the number of LCUs contained in at least one column of sub-blocks, and the number of LCUs contained in at least one row of sub-blocks also includes: performing a floor operation on the quotient of 2 raised to the first power of the horizontal LCU number, and then subtracting the first column number x1 to obtain the second column number x2; and / or performing a floor operation on the quotient of 2 raised to the first power of the vertical LCU number, and then subtracting the first row number y1 to obtain the second column number y2.
[0575] The method of determining the numbering identifier of the sub-block to which the LCU belongs according to the first column index lcuX, the first row index lcuY, the number of LCUs contained in at least one column of sub-blocks, and the number of LCUs contained in at least one row of sub-blocks includes: obtaining the second sub-block column index regionX to which the LCU belongs according to the first column index lcuX, the first column number x1, and the fourth column number x4; obtaining the second sub-block row index regionY to which the LCU belongs according to the first row index lcuY, the first row number y1, and the fourth column number y4; and obtaining the numbering identifier of the second sub-block to which the LCU belongs by multiplying the second sub-block row index regionY by 2 raised to the power of 2 and then adding the second sub-block column index regionX.
[0576] In the embodiment of the present invention, the second sub-block column index regionX to which the LCU belongs is obtained according to the first column index lcuX, the first column number x1, and the fourth column number x4, including: when the first column index lcuX is greater than or equal to the difference obtained by subtracting the fourth column number x4 from the horizontal LCU number, the second sub-block column index regionX to which the LCU belongs is 3; when the first column index lcuX is less than the difference obtained by subtracting the fourth column number x4 from the horizontal LCU number, and the first column index lcuX is greater than or equal to 1 of the horizontal LCU number to 2. When the value obtained by raising the quotient of 2 to the power of 1 is reduced to an integer, the second sub-block column index regionX to which the LCU belongs is 2; when the first column index lcuX is less than the difference obtained by subtracting the fourth column number x4 from the number of horizontal LCUs, and the first column index lcuX is less than the value obtained by raising the quotient of the horizontal LCU number to the power of 2 to the power of 1, and the first column index lcuX is greater than or equal to the first column number x1, the second sub-block column index regionX to which the LCU belongs is 1; otherwise, the second sub-block column index regionX to which the LCU belongs is 0.
[0577] The second sub-block row index regionY to which the LCU belongs is obtained according to the first row index lcuY, the first row number y1 and the fourth column number y4, including: when the first row index lcuY is greater than or equal to the difference obtained by subtracting the fourth column number y4 from the vertical LCU number, the second sub-block row index regionY to which the LCU belongs is 3; when the first row index lcuY is less than the difference obtained by subtracting the fourth column number x4 from the vertical LCU number, and the first row index lcuY is greater than or equal to the vertical LCU number multiplied by 2 to the first power, the second sub-block row index regionY to which the LCU belongs is 3; when the first row index lcuY is less than the difference obtained by subtracting the fourth column number x4 from the vertical LCU number, and the first row index lcuY is greater than or equal to the vertical LCU number multiplied by 2 to the first power, the second sub-block row index regionY to which the LCU belongs is 3; When the first row index lcuY is less than the difference between the number of vertical LCUs and the number of fourth columns x4, and the first row index lcuY is less than the value obtained by taking the quotient of the number of vertical LCUs raised to the first power of 2 and dividing it by an integer, and the first row index lcuY is greater than or equal to the first row number y1, the second sub-block row index regionY to which the LCU belongs is 1; otherwise, the second sub-block row index regionY to which the LCU belongs is 0.
[0578] Among them, the implementation embodiments of the image processing method of the above-mentioned embodiment 2 are all applicable to the embodiments of the image processing device and can achieve the same technical effects.
[0579] An embodiment of the present invention further provides an image processing device, comprising a memory, a processor, and a program stored in the memory and executable on the processor; when the processor executes the program, the image processing method of the above-mentioned embodiment 1 or embodiment 2 is implemented.
[0580] Among them, the implementation embodiments of the image processing method of the above-mentioned embodiment 1 or embodiment 2 are all applicable to the embodiments of the image processing device and can achieve the same technical effects.
[0581] An embodiment of the present invention further provides a readable storage medium on which a program is stored. When the program is executed by a processor, the steps of the image processing method in the above-mentioned embodiment 1 or embodiment 2 are implemented.
[0582] Among them, the implementation embodiments of the image processing method of the above-mentioned embodiment 1 or embodiment 2 are all applicable to the embodiments of the readable storage medium and can achieve the same technical effects.
[0583] It should be noted that many functional components described in this specification are referred to as modules / sub-modules in order to more particularly emphasize the independence of their implementation methods.
[0584] In the embodiment of the present invention, module / submodule can be implemented with software so that it can be performed by various types of processors. For example, an executable code module of an identification can include one or more physical or logical blocks of computer instructions, for example, it can be constructed as an object, process or function. Nevertheless, the executable code of the identified module does not need to be physically located together, but can include different instructions stored in different positions, and when these instructions are logically combined together, it constitutes a module and realizes the specified purpose of this module.
[0585] In fact, executable code module can be a single instruction or many instructions, and can even be distributed on a plurality of different code segments, distributed among different programs, and distributed across a plurality of memory devices. Similarly, operating data can be identified in the module, and can be implemented and organized in the data structure of any appropriate type according to any appropriate form. The operating data can be collected as a single data set, or can be distributed in different locations (including on different storage devices), and can only be present on a system or network as an electronic signal at least in part.
[0586] When a module can be implemented by software, considering the level of existing hardware technology, a person skilled in the art can build a corresponding hardware circuit to implement the corresponding function of the module that can be implemented by software without considering the cost. The hardware circuit includes a conventional very large scale integration (VLSI) circuit or gate array and existing semiconductors such as logic chips, transistors, or other discrete components. The module can also be implemented by a programmable hardware device, such as a field programmable gate array, a programmable array logic, a programmable logic device, etc.
[0587] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary personnel in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. An image processing method, characterized in that: include: Divide the image to be processed into N layers of blocks to obtain a filter unit corresponding to each layer of block division; wherein the filter unit is a first filter unit or a second filter unit, the first filter unit is a filter unit obtained by dividing the Mth layer of blocks, the second filter unit is a filter unit obtained by dividing the M+1th layer of blocks, and the second filter unit is obtained by dividing the first filter unit into blocks; Obtaining a sum of a first rate-distortion cost of each of the first filtering units and a second rate-distortion cost of each of the second filtering units corresponding to the first filtering units; Determining a final block division result of the image to be processed according to the first rate-distortion cost and the sum; Wherein, N is an integer greater than 0, and M takes each value from 0 to N-1 in turn; one second filtering unit is greater than or equal to one pixel; The step of obtaining the first rate-distortion cost of each of the first filtering units and the second rate-distortion cost of the second filtering unit corresponding to each of the first filtering units includes: Determining a filter offset of a reference filter unit; Obtaining a rate-distortion cost of the reference filtering unit according to the filtering offset; The reference filtering unit is the first filtering unit, and the rate-distortion cost is the first rate-distortion cost, or the reference filtering unit is the second filtering unit, and the rate-distortion cost is the second rate-distortion cost; Wherein, determining the filtering offset of the reference filtering unit includes: Classifying the chrominance pixels of the reference filtering unit according to the size of the luminance pixels at the preset position of the reference filtering unit; According to the classification result, a filtering offset of the reference filtering unit is obtained.
2. The image processing method according to claim 1, characterized in that: Determining a final block result of the image to be processed according to the first rate-distortion cost and the sum includes: Obtaining a block result corresponding to each of the first filtering units according to the first rate-distortion costs corresponding to each of the first filtering units and the sum; According to each of the block division results, a final block division result of the image to be processed is determined.
3. The image processing method according to claim 2, characterized in that: The obtaining, according to the first rate-distortion costs corresponding to the first filtering units and the sum, the block results corresponding to the first filtering units, comprises: When the first rate-distortion cost corresponding to the first filtering unit is greater than or equal to the corresponding sum, retaining the second filtering unit corresponding to the first filtering unit and the first filtering unit; Obtaining a block result corresponding to the first filtering unit according to the retained second filtering unit corresponding to the first filtering unit and the first filtering unit; or, When the first rate-distortion cost corresponding to the first filtering unit is less than the corresponding sum, deleting the second filtering unit corresponding to the first filtering unit, and retaining the first filtering unit; According to the retained first filtering unit, a block result corresponding to the first filtering unit is obtained.
4. The image processing method according to claim 1, characterized in that: The classifying the chrominance pixels of the reference filtering unit according to the size of the luminance pixels at the preset position of the reference filtering unit comprises: Determining the number of classifications of the reference filter unit based on the rate-distortion cost; The chrominance pixels of the reference filtering unit are classified according to the classification quantity and the size of the luminance pixels at the preset position of the reference filtering unit.
5. The image processing method according to claim 1, characterized in that: The step of obtaining the filter offset of the reference filter unit according to the classification result includes: According to the classification result, the reference offset corresponding to each category of chrominance pixels is obtained; A filtering offset of the reference filtering unit is obtained according to the reference offset.
6. The image processing method according to claim 1, characterized in that: One of the filtering units includes at least one largest coding unit LCU; The image processing method further comprises: According to the first numbering identifier of the LCU in the to-be-processed image and the number of horizontal LCUs and the number of vertical LCUs in the to-be-processed image, a second numbering identifier of the filtering unit to which the LCU belongs is determined.
7. The image processing method according to claim 6, characterized in that: The determining, according to the first numbering identifier of the LCU in the to-be-processed image and the number of horizontal LCUs and the number of vertical LCUs in the to-be-processed image, the second numbering identifier of the filtering unit to which the LCU belongs includes: Obtaining a first row index and a first column index of the LCU according to a first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs in the image to be processed; Obtaining a second row index and a second column index of a filtering unit to which the LCU belongs according to the first row index, the first column index, the number of horizontal LCUs and the number of vertical LCUs of the image to be processed; A second numbering identifier of the filtering unit to which the LCU belongs is obtained according to the second row index and the second column index.
8. The image processing method according to claim 1, characterized in that: The determining of the filtering offset of the reference filtering unit comprises: Determining a filter offset of an adjacent filter unit of a reference filter unit; The filtering offset of the adjacent filtering unit is used as the filtering offset of the reference filtering unit.
9. The image processing method according to claim 1, characterized in that: Also includes: Obtaining filtering parameter information of adjacent frame images of the current frame image; The filtering parameter information of the adjacent frame image is used as the filtering parameter information of the current frame image.
10. An image processing device, characterized in that: include: A first processing module is used to divide the image to be processed into N layers of blocks to obtain a filter unit corresponding to each layer of block division; wherein the filter unit is a first filter unit or a second filter unit, the first filter unit is a filter unit obtained by dividing the Mth layer of blocks, the second filter unit is a filter unit obtained by dividing the M+1th layer of blocks, and the second filter unit is obtained by dividing the first filter unit into blocks; A first acquisition module, configured to acquire a first rate-distortion cost of each of the first filtering units and a sum of a second rate-distortion cost of each of the first filtering units corresponding to the first filtering units; A first determining module, configured to determine a final block result of the image to be processed according to the first rate-distortion cost and the sum; Wherein, N is an integer greater than 0, and M takes each value from 0 to N-1 in turn; one second filtering unit is greater than or equal to one pixel; Wherein, the first acquisition module includes: A first determination submodule, used to determine a filtering offset of a reference filtering unit; A second processing submodule, configured to obtain a rate-distortion cost of the reference filtering unit according to the filtering offset; The reference filtering unit is the first filtering unit, and the rate-distortion cost is the first rate-distortion cost, or the reference filtering unit is the second filtering unit, and the rate-distortion cost is the second rate-distortion cost; Wherein, determining the filtering offset of the reference filtering unit includes: Classifying the chrominance pixels of the reference filtering unit according to the size of the luminance pixels at the preset position of the reference filtering unit; According to the classification result, a filtering offset of the reference filtering unit is obtained.
11. The image processing device according to claim 10, characterized in that: The first determining module includes: A first processing submodule, configured to obtain a block result corresponding to each of the first filtering units according to the first rate-distortion cost corresponding to each of the first filtering units and the sum; According to each of the block division results, a final block division result of the image to be processed is determined.
12. The image processing device according to claim 11, characterized in that: The obtaining, according to the first rate-distortion costs corresponding to the first filtering units and the sum, the block results corresponding to the first filtering units, comprises: When the first rate-distortion cost corresponding to the first filtering unit is greater than or equal to the corresponding sum, retaining the second filtering unit corresponding to the first filtering unit and the first filtering unit; Obtaining a block result corresponding to the first filtering unit according to the retained second filtering unit corresponding to the first filtering unit and the first filtering unit; or, When the first rate-distortion cost corresponding to the first filtering unit is less than the corresponding sum, deleting the second filtering unit corresponding to the first filtering unit, and retaining the first filtering unit; According to the retained first filtering unit, a block result corresponding to the first filtering unit is obtained.
13. The image processing device according to claim 10, characterized in that: The classifying the chrominance pixels of the reference filtering unit according to the size of the luminance pixels at the preset position of the reference filtering unit comprises: Determining the number of classifications of the reference filter unit based on the rate-distortion cost; The chrominance pixels of the reference filtering unit are classified according to the classification quantity and the size of the luminance pixels at the preset position of the reference filtering unit.
14. The image processing device according to claim 10, characterized in that: The step of obtaining the filter offset of the reference filter unit according to the classification result includes: According to the classification result, the reference offset corresponding to each category of chrominance pixels is obtained; A filtering offset of the reference filtering unit is obtained according to the reference offset.
15. The image processing device according to claim 10, characterized in that: One of the filtering units includes at least one maximum coding unit LCU; the image processing device also includes: The second determining module is used to determine the second numbering identifier of the filtering unit to which the LCU belongs according to the first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs and the number of vertical LCUs in the image to be processed.
16. The image processing device according to claim 15, characterized in that: The second determining module includes: A third processing submodule, configured to obtain a first row index and a first column index of the LCU according to a first numbering identifier of the LCU in the image to be processed and the number of horizontal LCUs in the image to be processed; a fourth processing submodule, configured to obtain a second row index and a second column index of a filtering unit to which the LCU belongs according to the first row index, the first column index, the number of horizontal LCUs and the number of vertical LCUs of the image to be processed; The fifth processing submodule is used to obtain a second numbering identifier of the filtering unit to which the LCU belongs according to the second row index and the second column index.
17. The image processing device according to claim 10, characterized in that: The determining of the filtering offset of the reference filtering unit comprises: Determining a filter offset of an adjacent filter unit of a reference filter unit; The filtering offset of the adjacent filtering unit is used as the filtering offset of the reference filtering unit.
18. The image processing device according to claim 10, characterized in that: Also includes: A second acquisition module is used to acquire filtering parameter information of adjacent frame images of the current frame image; The second processing module is used to use the filtering parameter information of the adjacent frame image as the filtering parameter information of the current frame image.
19. An image processing device, characterized in that: include: processor; The processor is used to divide the image to be processed into N layers of blocks to obtain a filter unit corresponding to each layer of block division; wherein the filter unit is a first filter unit or a second filter unit, the first filter unit is a filter unit obtained by dividing the Mth layer of blocks, the second filter unit is a filter unit obtained by dividing the M+1th layer of blocks, and the second filter unit is obtained by dividing the first filter unit into blocks; Obtaining a sum of a first rate-distortion cost of each of the first filtering units and a second rate-distortion cost of each of the second filtering units corresponding to the first filtering units; Determining a final block division result of the image to be processed according to the first rate-distortion cost and the sum; Wherein, N is an integer greater than 0, and M takes each value from 0 to N-1 in turn; one second filtering unit is greater than or equal to one pixel; The processor is specifically used for: Determining a filter offset of a reference filter unit; Obtaining a rate-distortion cost of the reference filtering unit according to the filtering offset; The reference filtering unit is the first filtering unit, and the rate-distortion cost is the first rate-distortion cost, or the reference filtering unit is the second filtering unit, and the rate-distortion cost is the second rate-distortion cost; Wherein, determining the filtering offset of the reference filtering unit includes: Classifying the chrominance pixels of the reference filtering unit according to the size of the luminance pixels at the preset position of the reference filtering unit; According to the classification result, a filtering offset of the reference filtering unit is obtained.
20. An image processing device, comprising a memory, a processor, and a program stored in the memory and executable on the processor; characterized in that: When the processor executes the program, the image processing method according to any one of claims 1 to 9 is implemented.
21. A readable storage medium having a program stored thereon, characterized in that: When the program is executed by a processor, the steps in the image processing method according to any one of claims 1 to 9 are implemented.
