[x265] [x265 patch] New AQ mode with Variance and Edge information

chen chenm003 at 163.com
Mon Jul 15 08:23:04 CEST 2019


Thank you.


for constant, I explain a little more
we may declare
const intptr_t row_n2 = (rowNum - 2)*stride;


Now,


src[(rowNum - 2)*stride + (colNum - 2)]
src[(rowNum - 2)*stride + (colNum - 1)] 


==>


src[row_n2 + (colNum - 2)]
src[row_n2 + (colNum - 1)]


a little better to read.


At 2019-07-15 13:58:53, "Akil" <akil at multicorewareinc.com> wrote:

Thanks for your suggestions, Chen. Have added the matrix in comments. That should make the code more readable. Regarding the last point, I think (rowNum+X)*stride cannot be replaced by a constant since it tends to change every time.


On Fri, Jul 12, 2019 at 7:27 AM chen <chenm003 at 163.com> wrote:


On Wed, Jul 10, 2019 at 3:41 PM Akil <akil at multicorewareinc.com> wrote:

# HG changeset patch
# User Akil Ayyappan<akil at multicorewareinc.com>
# Date 1561035091 -19800
#      Thu Jun 20 18:21:31 2019 +0530
# Node ID d25c33cc2b748401c5e908af445a0a110e26c3cf
# Parent  4f6dde51a5db4f9229bddb60db176f16ac98f505
AQ: New AQ mode with Variance and Edge information


+    //Applying Gaussian filter on the picture
+    src = (pixel*)curFrame->m_fencPic->m_picOrg[0];
+    refPic = pic2 + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;
+    pixel pixelValue = 0;
+    for (int rowNum = 0; rowNum < height; rowNum++)
+    {
+        for (int colNum = 0; colNum < width; colNum++)
+        {
+            if ((rowNum >= 2) && (colNum >= 2) && (rowNum != height - 2) && (colNum != width - 2)) //Ignoring the border pixels of the picture
+            {
+                pixelValue = ((2 * src[(rowNum - 2)*stride + (colNum - 2)] + 4 * src[(rowNum - 2)*stride + (colNum - 1)] + 5 * src[(rowNum - 2)*stride + (colNum)] + 4 * src[(rowNum - 2)*stride + (colNum + 1)] + 2 * src[(rowNum - 2)*stride + (colNum + 2)] +
+                    4 * src[(rowNum - 1)*stride + (colNum - 2)] + 9 * src[(rowNum - 1)*stride + (colNum - 1)] + 12 * src[(rowNum - 1)*stride + (colNum)] + 9 * src[(rowNum - 1)*stride + (colNum + 1)] + 4 * src[(rowNum - 1)*stride + (colNum + 2)] +
+                    5 * src[(rowNum)*stride + (colNum - 2)] + 12 * src[(rowNum)*stride + (colNum - 1)] + 15 * src[(rowNum)*stride + (colNum)] + 12 * src[(rowNum)*stride + (colNum + 1)] + 5 * src[(rowNum)*stride + (colNum + 2)] +
+                    4 * src[(rowNum + 1)*stride + (colNum - 2)] + 9 * src[(rowNum + 1)*stride + (colNum - 1)] + 12 * src[(rowNum + 1)*stride + (colNum)] + 9 * src[(rowNum + 1)*stride + (colNum + 1)] + 4 * src[(rowNum + 1)*stride + (colNum + 2)] +
+                    2 * src[(rowNum + 2)*stride + (colNum - 2)] + 4 * src[(rowNum + 2)*stride + (colNum - 1)] + 5 * src[(rowNum + 2)*stride + (colNum)] + 4 * src[(rowNum + 2)*stride + (colNum + 1)] + 2 * src[(rowNum + 2)*stride + (colNum + 2)]) / 159);
+                refPic[(rowNum*stride) + colNum] = pixelValue;
+            }
+        }
+    }



Could you please modify a little?
Ident or give coif matrix as comment, it will be more readable
moreover, (rowNum+X)*stride can be replace by constant, it does not affect compiled code performance but help human read code.


_______________________________________________
x265-devel mailing list
x265-devel at videolan.org
https://mailman.videolan.org/listinfo/x265-devel





--

Regards,
Akil R
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20190715/e63b95ed/attachment.html>


More information about the x265-devel mailing list