<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial">Hello Xuefeng,<br><br>I understand your concept, I just said your algorithm output result close to average of slice base QP, but through complicated compute.<br><br>Regards,<div>Min<br><div></div><div id="divNeteaseMailCard"></div><br>At 2016-09-28 13:59:13,xuefeng <xuefeng@multicorewareinc.com> wrote:<br> <blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><style>body { line-height: 1.5; }blockquote { margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em; }body { font-size: 10.5pt; font-family: 'Segoe UI'; color: rgb(0, 0, 0); line-height: 1.5; }</style>
<div><span></span>hello Min,</div><div>Thanks for your reply.</div><div><br></div><div>a)</div><div>deltaQp = <span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">sliceQp</span><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"> - </span><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">ppsQp</span></div><div>ppsQp is saved in PPS and deltaQp is saved in bitstream.  </div><div><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">In fact, I don't calculate new QP, but </span>calculate <span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">a best delta for pps</span><span style="font-family: ''; font-size: 10.5pt; line-height: 1.5; background-color: window;">QP and deltaQp without changing sliceQp.</span></div><div><span style="font-family: ''; font-size: 10.5pt; line-height: 1.5; background-color: window;">For example,  </span><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">deltaQp = 14(cost 4 bits), </span><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"> </span><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">sliceQp = 40</span><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">, and </span><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">ppsQp = 26</span></div><div><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">If we set deltaQp = 14 - 14 = 0 ( cost 1 bits)  and ppsQp = 26 + 14 = 40,  sliceQp is still 40.  Then we save 3 - 1 = 2 bits in bitstream for each slice.</span></div><div><br></div><div>b)</div><div>I have change <span style="font-family: 'Segoe UI', Tahoma; line-height: normal; font-size: 10.5pt; background-color: window;">QP Range with range extension. Please see this patch.</span></div>
<div><br></div><hr style="width: 210px; height: 1px;" color="#b5c4df" size="1" align="left">
<div><span><div style="MARGIN-LEFT: 10px; MARGIN-TOP: 10px; MARGIN-RIGHT: 10px">
<div><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; COLOR: #000000">Regards,</span></div>
<div><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; COLOR: #000000"></span> </div>
<div><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; COLOR: #000000">             Xuefeng 
Jiang</span></div>
<div><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; COLOR: #000000"></span> </div>
<div><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; COLOR: #000000"><a href="mailto:xuefeng@multicorewareinc.com">xuefeng@multicorewareinc.com</a></span></div></div></span></div>
<blockquote style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;"><div> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">Message: 3</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">Date: Wed, 28 Sep 2016 00:02:33 +0800 (CST)</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">From: chen  <<a href="mailto:chenm003@163.com">chenm003@163.com</a>></div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">To: "Development for x265" <<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a>></div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">Subject: Re: [x265] Optimize slice QP in PPS for x265</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">Message-ID: <<a href="mailto:2e196b48.110e.1576c622432.Coremail.chenm003@163.com">2e196b48.110e.1576c622432.Coremail.chenm003@163.com</a>></div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">Content-Type: text/plain; charset="gbk"</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">Hello Xuefeng,</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">Your idea is good, in low bitrate environment, the MV, header are most important part in bitstream.</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">I take a look your code, it sounds some problems.</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">Your calculate correlation between sliceQp and QP Range (it is [0, 51] without range extension), so you will got a constant correlative array for every QP value.</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">In the final, your algorithm output a QP close to average value of sliceQP.</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">It is right, just spending more time on compute.</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">Regards,</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">Min</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">At 2016-09-27 14:46:14,xuefeng <<a href="mailto:xuefeng@multicorewareinc.com">xuefeng@multicorewareinc.com</a>> wrote:</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">All,</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">hello!</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">x265 set the slice QP in PPS to 26.  Bits can be saved by calculating a closer approximation to the actual slice QP values utilized to encode the bitstream at different quality levels. The delta QP in each slice header is huge especially at low bit rate and quality levels.</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">My test command is as follows.</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">--repeat-headers --hash 1  --input-res 1280x720 --keyint 30 --min-keyint 30 --input "Johnny_1280x720.y4m" --fps 30 --output "test_new.mp4"</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">There is a patch in the attachment for this method based on "Changeset: 11587 (d20b78d6d138)".</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">There is information for x265 coding to see that bitrate goes down.   There is informations for HM decoding to see that MD5 and QP are the same with the method.</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"> </div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">Regards,</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"></div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;">             Xuefeng Jiang</div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"></div><div style="font-family: 'Segoe UI', Tahoma; line-height: normal;"><a href="mailto:xuefeng@multicorewareinc.com">xuefeng@multicorewareinc.com</a></div><div>
</div></blockquote>
</blockquote></div></div>