[x265] [PATCH 5 of 5] integrated ssim computation for each CTURow

Steve Borho steve at borho.org
Tue Oct 1 05:23:19 CEST 2013


On Mon, Sep 30, 2013 at 8:27 PM, Aarthi Priya Thirumalai <
aarthi at multicorewareinc.com> wrote:

>
> On Oct 1, 2013 1:44 AM, "Steve Borho" <steve at borho.org> wrote:
> >
> >
> >
> >
> > On Fri, Sep 27, 2013 at 11:52 PM, Aarthi Thirumalai <
> aarthi at multicorewareinc.com> wrote:
> >>
> >> # HG changeset patch
> >> # User Aarthi Thirumalai
> >> # Date 1380343885 -19800
> >> #      Sat Sep 28 10:21:25 2013 +0530
> >> # Node ID b1539ccab7bab1708433a9b8b18f5f8c090b1810
> >> # Parent  a8b00de495520f00a4648dac5d111e40b5570ca3
> >> integrated ssim computation for each CTURow
> >>
> >> diff -r a8b00de49552 -r b1539ccab7ba source/encoder/frameencoder.cpp
> >> --- a/source/encoder/frameencoder.cpp   Sat Sep 28 10:18:23 2013 +0530
> >> +++ b/source/encoder/frameencoder.cpp   Sat Sep 28 10:21:25 2013 +0530
> >> @@ -91,6 +91,9 @@
> >>          delete[] m_rows;
> >>      }
> >>
> >> +    if (tempBuf)
> >
> >
> > X265_FREE does the NULL check for you
> >
> >>
> >> +        X265_FREE(tempBuf);
> >> +
> >>      m_frameFilter.destroy();
> >>
> >>      // wait for worker thread to exit
> >> @@ -106,6 +109,8 @@
> >>                          2 : (m_cfg->param.bEnableSAO ||
> m_cfg->param.bEnableLoopFilter ? 1 : 0);
> >>
> >>      m_rows = new CTURow[m_numRows];
> >> +    if(m_cfg->param.bEnableSsim)
> >
> >
> > white-space
> >
> >>
> >> +        CHECKED_MALLOC(tempBuf, int, m_cfg->param.bEnableSsim * 8 *
> (m_cfg->param.sourceWidth/4 + 3));
> >>      for (int i = 0; i < m_numRows; ++i)
> >>      {
> >>          m_rows[i].create(top);
> >> @@ -168,6 +173,8 @@
> >>          assert(0);
> >>      }
> >>      start();
> >> +fail:
> >> +    return;
> >>  }
> >>
> >>  int FrameEncoder::getStreamHeaders(NALUnitEBSP **nalunits)
> >> @@ -540,6 +547,31 @@
> >>          slice->setSaoEnabledFlag((saoParam->bSaoFlag[0] == 1) ? true :
> false);
> >>      }
> >>
> >> +    /*Compute SSIM if enabled*/
> >> +       if(m_cfg->param.bEnableSsim)
> >
> > white-space
> >>
> >> +       {
> >> +            pixel *rec = (pixel*)m_pic->getPicYuvRec()->getLumaAddr();
> >> +            pixel *org = (pixel*)m_pic->getPicYuvOrg()->getLumaAddr();
> >> +            int stride = m_pic->getPicYuvOrg()->getStride();
> >> +           for(int row = 0; row < m_numRows; row++)
> >> +           {
> >> +               int bEnd = ((row + 1) == (this->m_numRows - 1));
> >> +               int bStart = (row == 0);
> >> +               int minPixY = row * 64 - 4 * !bStart;
> >> +               int maxPixY = (row + 1)* 64 - 4 * !bEnd;
> >> +               int ssim_cnt;
> >> +               x265_emms();
> >> +               /* offset by 2 pixels to avoid alignment of ssim blocks
> with dct blocks,
> >> +               * and overlap by 4 */
> >
> >
> > do you understand what this comment implies?  I don't and we probably
> should
> >
> The function to calculate ssim for each row in this manner. Starting point
> : offset block by 2 in x axis. Do ssim for 2 4x4 blocks till row end.
> Offset by 4 in y axis from starting point n repeat above step for entire
> height(maxpicy - minpic) this offset is done so block positions don't match
> with dct sizes.


Thanks.  Why is it important to not match dct sizes?  Are those less
accurate for measuring SSIM because of blocking artifacts?  It seems like
"cheating" almost, to avoid pixels you know will measure badly.

--
Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20130930/d9122665/attachment-0001.html>


More information about the x265-devel mailing list