<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:宋体;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@宋体";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        font-size:10.5pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.5pt;
        font-family:"Calibri",sans-serif;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:"Calibri",sans-serif;}
span.EmailStyle19
        {mso-style-type:personal-compose;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}
/* Page Definitions */
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="ZH-CN" link="#0563C1" vlink="#954F72" style="text-justify-trim:punctuation">
<div class="WordSection1">
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><a name="_MailEndCompose"><span lang="EN-US"><o:p> </o:p></span></a></p>
<p class="MsoPlainText"><a name="_____replyseparator"></a><span lang="EN-US">-----Original Message-----<br>
From: Mark Thompson [mailto:sw@jkqxz.net] <br>
Sent: Thursday, January 19, 2017 8:25 AM<br>
To: libva@lists.freedesktop.org; Qu, Pengfei <pengfei.qu@intel.com><br>
Subject: Re: [Libva] [PATCH v1 0/9]Encoder Architecture Changes (Primarily AVC)<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">On 13/01/17 09:24, Pengfei Qu wrote:<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> Encoder architecture restructuring for H.264 (with some impact to HEVC now) on HSW+<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> * Improvements to the shaders<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> * Improvements to the B frame efficiency<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> * Improvements to the low bit rate mode<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> * Improved features in two stage VME/PAK pipeline<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> <o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> v1:<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> Reduce the patch number and re org for VME and MFX related patches.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> Patch re org for VME pipeline<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> Patch re org for MFX pipeline<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> keep assert for internal logic and replace assert for input validation function.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> Remove unnecessary comments and enum value.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> Use the 64bit version OUT_BCS_RELOC64.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> Move kernel binary into header file.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">> use misc parameter from encoder_context structure.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">I've had a go with this on Skylake.  In general, I see significant gains in quality with similar performance (yay), however I found some issues as well.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US" style="color:black">[Pengfei] It is great to know you try it.
</span><span lang="EN-US" style="font-family:Wingdings;color:black">J</span><span lang="EN-US" style="color:black"> Yes. Quality improvement is as our expectation.
<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">CQP mode seems to have regressed significantly in speed - it is maybe 25% slower than CBR/VBR now (though indeed higher quality, particularly on B-frames).  Is this expected?  I would have thought it should be the
 "easiest" (and therefore fastest) mode.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">[Pengfei]yes, CQP is the easiest way. it is
</span><span lang="EN-US" style="font-family:"Courier New"">“</span><span lang="EN-US">quality level</span><span lang="EN-US" style="font-family:"Courier New"">”</span><span lang="EN-US"> related. i think you are using
</span><span lang="EN-US" style="font-family:"Courier New"">“</span><span lang="EN-US">avcenc</span><span lang="EN-US" style="font-family:"Courier New"">”</span><span lang="EN-US"> to do test. One new parameter
</span><span lang="EN-US" style="font-family:"Courier New"">“</span><span lang="EN-US">quality level</span><span lang="EN-US" style="font-family:"Courier New"">”</span><span lang="EN-US"> will be set in the driver by now, and
</span><span lang="EN-US" style="font-family:"Courier New"">“</span><span lang="EN-US">avcenc</span><span lang="EN-US" style="font-family:"Courier New"">”</span><span lang="EN-US"> does not set this parameter by now. So in default mode, CQP use the
</span><span lang="EN-US" style="font-family:"Courier New"">“</span><span lang="EN-US">best quality level</span><span lang="EN-US" style="font-family:"Courier New"">”</span><span lang="EN-US"> and CBR/VBR use the
</span><span lang="EN-US" style="font-family:"Courier New"">“</span><span lang="EN-US">normal quality level</span><span lang="EN-US" style="font-family:"Courier New"">”</span><span lang="EN-US">, that is the reason why the CQP performance slower. I will add
 support in the </span><span lang="EN-US" style="font-family:"Courier New"">“</span><span lang="EN-US">avcenc</span><span lang="EN-US" style="font-family:"Courier New"">”</span><span lang="EN-US"> and also fix the same default
</span><span lang="EN-US" style="font-family:"Courier New"">“</span><span lang="EN-US">quality level</span><span lang="EN-US" style="font-family:"Courier New"">”</span><span lang="EN-US"> in the driver.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">Also, there seems to be something funny going on in the VBR rate controller.  Sometimes (nondeterministically, with the same parameters) the beginning of the stream gets stuck at a very high QP / low bitrate for a
 long period, making the output video terrible quality.  After some time (maybe a few thousand frames) it recovers and thereafter acts normally.  It seems to happen entirely randomly with low probability (less than 10%, maybe?), with no obvious connection to
 the encoding parameters.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">I found some things which might be related (but equally could just be perturbing something else, for example by changing the timing):<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">* It never seems to happen if the encoder input comes directly from a decoder - I have only seen it when there is a VPP instance in between them (though it need not do anything to the video - it can just copy to a
 new surface of the same size).<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">* I tested on two different machines and it only seems to happen on one of them: it happens on a 6260U (GT3), but not on a 6300 (GT2).<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">Can you offer any thoughts on what might be relevant which I could test for?  (Currently my reproduction method is just "transcode videos between sizes repeatedly until it happens", which I realise is not very helpful. 
 I am happy to try to narrow that down a bit if I could have any idea what I can look for.)<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">[Pengfei]How about CBR? VPP seems increase the probability, right? I think it is RC related or GT3 related. If CBR has the same issue, I think it is GT3 related.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">Thanks,<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">- Mark<o:p></o:p></span></p>
</div>
</body>
</html>