[x265] [PATCH] Displaying the number of weighted P frames used in console log

Shazeb Khan shazeb at multicorewareinc.com
Thu Oct 24 05:54:16 CEST 2013


On Thu, Oct 24, 2013 at 12:19 AM, Steve Borho <steve at borho.org> wrote:

>
>
>
> On Wed, Oct 23, 2013 at 4:20 AM, <shazeb at multicorewareinc.com> wrote:
>
>> # HG changeset patch
>> # User Shazeb Nawaz Khan <shazeb at multicorewareinc.com>
>> # Date 1382520034 -19800
>> #      Wed Oct 23 14:50:34 2013 +0530
>> # Node ID 98e84472bb7ae8aa60bdcffb5972b4d20017ab79
>> # Parent  6d96d64c4e9a2c526b57274760a7147241328cb3
>> Displaying the number of weighted P frames used in console log
>>
>> diff -r 6d96d64c4e9a -r 98e84472bb7a source/Lib/TLibCommon/TComSlice.cpp
>> --- a/source/Lib/TLibCommon/TComSlice.cpp       Tue Oct 22 23:36:36 2013
>> +0530
>> +++ b/source/Lib/TLibCommon/TComSlice.cpp       Wed Oct 23 14:50:34 2013
>> +0530
>> @@ -125,6 +125,7 @@
>>      m_enableTMVPFlag = true;
>>      m_ssim = 0;
>>      m_ssimCnt = 0;
>> +    m_numWPRefs = 0;
>>  }
>>
>>  bool TComSlice::getRapPicFlag()
>> diff -r 6d96d64c4e9a -r 98e84472bb7a source/Lib/TLibCommon/TComSlice.h
>> --- a/source/Lib/TLibCommon/TComSlice.h Tue Oct 22 23:36:36 2013 +0530
>> +++ b/source/Lib/TLibCommon/TComSlice.h Wed Oct 23 14:50:34 2013 +0530
>> @@ -1375,8 +1375,9 @@
>>
>>  public:
>>
>> -    MotionReference * m_mref[2][MAX_NUM_REF + 1];
>> -    wpScalingParam  m_weightPredTable[2][MAX_NUM_REF][3]; //
>> [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V]
>> +    MotionReference  *m_mref[2][MAX_NUM_REF + 1];
>> +    wpScalingParam    m_weightPredTable[2][MAX_NUM_REF][3]; //
>> [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V]
>> +    int               m_numWPRefs;                          // number of
>> references for which unidirectional weighted prediction is used
>>
>>      /* SSIM values per frame */
>>      double          m_ssim;
>> diff -r 6d96d64c4e9a -r 98e84472bb7a source/encoder/encoder.cpp
>> --- a/source/encoder/encoder.cpp        Tue Oct 22 23:36:36 2013 +0530
>> +++ b/source/encoder/encoder.cpp        Wed Oct 23 14:50:34 2013 +0530
>> @@ -94,6 +94,7 @@
>>      m_lookahead = new Lookahead(this, m_threadPool);
>>      m_dpb = new DPB(this);
>>      m_rateControl = new RateControl(this);
>> +    m_numWPFrames = 0;
>>  }
>>
>>  void Encoder::destroy()
>> @@ -249,6 +250,8 @@
>>              pic_out->stride[2] = recpic->getCStride();
>>          }
>>
>> +        if (out->getSlice()->m_numWPRefs > 0)
>> +            m_numWPFrames++;
>>
>
..........(1)


>          uint64_t bits = calculateHashAndPSNR(out, nalunits);
>>          // Allow this frame to be recycled if no frame encoders are
>> using it for reference
>>          ATOMIC_DEC(&out->m_countRefEncoders);
>> @@ -293,6 +296,12 @@
>>          m_analyzeB.printOut('b', fps);
>>          m_analyzeAll.printOut('a', fps);
>>      }
>> +
>> +    if (param.bEnableWeightedPred)
>> +    {
>> +        fprintf(stderr, "x265 [info]: %d weighted P frames used\n",
>> m_numWPFrames);
>>
>
> this should use x265_log().  Perhaps it should be something like:  "%d of
> %d (%d%%) P frames weighted"
>

ok, What do we want to print with the third %d? total number of frames
encoded?


>
>
>> +    }
>> +
>>
>>  #if _SUMMARY_OUT_
>>      m_analyzeAll.printSummaryOut(fps);
>> @@ -326,6 +335,7 @@
>>          stats->globalSsim = 0;
>>          stats->globalPsnr = 0;
>>      }
>> +    stats->totalWPFrames = m_numWPFrames;
>>  }
>>
>>  #define VERBOSE_RATE 0
>> diff -r 6d96d64c4e9a -r 98e84472bb7a source/encoder/encoder.h
>> --- a/source/encoder/encoder.h  Tue Oct 22 23:36:36 2013 +0530
>> +++ b/source/encoder/encoder.h  Wed Oct 23 14:50:34 2013 +0530
>> @@ -69,6 +69,9 @@
>>      // quality control
>>      TComScalingList    m_scalingList;      ///< quantization matrix
>> information
>>
>> +    // weighted prediction
>> +    int                m_numWPFrames;      // number of Unidirectional
>> weighted frames used
>> +
>>  public:
>>
>>      x265_nal_t *m_nals;
>> diff -r 6d96d64c4e9a -r 98e84472bb7a source/encoder/frameencoder.cpp
>> --- a/source/encoder/frameencoder.cpp   Tue Oct 22 23:36:36 2013 +0530
>> +++ b/source/encoder/frameencoder.cpp   Wed Oct 23 14:50:34 2013 +0530
>> @@ -426,7 +426,10 @@
>>          {
>>              TComPicYuv *recon = slice->getRefPic(list,
>> ref)->getPicYuvRec();
>>              if ((slice->isInterP() && slice->getPPS()->getUseWP()))
>> +            {
>>                  w = slice->m_weightPredTable[list][ref];
>> +                slice->m_numWPRefs++;
>>
>
> this is counting number of weighted references, which isn't quite the same
> thing.  The increment needs to be outside this loop
>

this is just collecting more information for future convenience; please
check (1) above, encoder gets the sought number


>
>
>> +            }
>>              slice->m_mref[list][ref] = recon->generateMotionReference(w);
>>          }
>>      }
>> diff -r 6d96d64c4e9a -r 98e84472bb7a source/x265.h
>> --- a/source/x265.h     Tue Oct 22 23:36:36 2013 +0530
>> +++ b/source/x265.h     Wed Oct 23 14:50:34 2013 +0530
>> @@ -241,6 +241,7 @@
>>      double    globalSsim;
>>      double    accBits;
>>      uint32_t  totalNumPics;
>> +    uint32_t  totalWPFrames;    /* Total number of Uni-directional
>> weighted frames used */
>>  }
>>  x265_stats_t;
>>
>> _______________________________________________
>> x265-devel mailing list
>> x265-devel at videolan.org
>> https://mailman.videolan.org/listinfo/x265-devel
>>
>
>
>
> --
> Steve Borho
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20131024/93506bfb/attachment.html>


More information about the x265-devel mailing list