<div dir="ltr"><div># HG changeset patch</div><div># User Deepthi Nandakumar <<a href="mailto:deepthi@multicorewareinc.com">deepthi@multicorewareinc.com</a>></div><div># Date 1464935525 -19800</div><div># Fri Jun 03 12:02:05 2016 +0530</div><div># Node ID 91de20bfe2affa6e225681be129208e654c2ba48</div><div># Parent e00b80fe105e30e2ac8927e441db45111eb734ad</div><div>uhd-bd: Clarifications to level and tier determination</div><div><br></div><div>diff -r e00b80fe105e -r 91de20bfe2af source/encoder/encoder.cpp</div><div>--- a/source/encoder/encoder.cpp<span class="" style="white-space:pre"> </span>Fri Jun 03 06:20:37 2016 +0200</div><div>+++ b/source/encoder/encoder.cpp<span class="" style="white-space:pre"> </span>Fri Jun 03 12:02:05 2016 +0530</div><div>@@ -1884,6 +1884,19 @@</div><div> p->vui.aspectRatioIdc = 1;</div><div> p->bEmitHRDSEI = 1;</div><div> int disableUhdBd = 0;</div><div>+</div><div>+ if (p->levelIdc && p->levelIdc != 51)</div><div>+ {</div><div>+ x265_log(p, X265_LOG_WARNING, "uhd-bd: Wrong level specified, UHD Bluray mandates Level 5.1\n");</div><div>+ }</div><div>+ p->levelIdc = 51;</div><div>+</div><div>+ if (!p->bHighTier)</div><div>+ {</div><div>+ x265_log(p, X265_LOG_WARNING, "uhd-bd: Turning on high tier\n");</div><div>+ p->bHighTier = 1;</div><div>+ }</div><div>+</div><div> if (!p->bRepeatHeaders)</div><div> {</div><div> x265_log(p, X265_LOG_WARNING, "uhd-bd: Turning on repeat-headers\n");</div><div>diff -r e00b80fe105e -r 91de20bfe2af source/encoder/level.cpp</div><div>--- a/source/encoder/level.cpp<span class="" style="white-space:pre"> </span>Fri Jun 03 06:20:37 2016 +0200</div><div>+++ b/source/encoder/level.cpp<span class="" style="white-space:pre"> </span>Fri Jun 03 12:02:05 2016 +0530</div><div>@@ -131,33 +131,33 @@</div><div> vps.ptl.levelIdc = Level::LEVEL8_5;</div><div> vps.ptl.tierFlag = Level::MAIN;</div><div> }</div><div>+ else if (param.uhdBluray)</div><div>+ {</div><div>+ i = 8;</div><div>+ vps.ptl.levelIdc = levels[i].levelEnum;</div><div>+ vps.ptl.tierFlag = Level::HIGH;</div><div>+ vps.ptl.minCrForLevel = levels[i].minCompressionRatio;</div><div>+ vps.ptl.maxLumaSrForLevel = levels[i].maxLumaSamplesPerSecond;</div><div>+ }</div><div> else for (i = 0; i < NumLevels; i++)</div><div> {</div><div>- if (param.uhdBluray && levels[i].levelIdc != 51)</div><div>- {</div><div>+ if (lumaSamples > levels[i].maxLumaSamples)</div><div> continue;</div><div>- }</div><div>- else if (!param.uhdBluray)</div><div>- {</div><div>- if (lumaSamples > levels[i].maxLumaSamples)</div><div>- continue;</div><div>- else if (samplesPerSec > levels[i].maxLumaSamplesPerSecond)</div><div>- continue;</div><div>- else if (bitrate > levels[i].maxBitrateMain && levels[i].maxBitrateHigh == MAX_UINT)</div><div>- continue;</div><div>- else if (bitrate > levels[i].maxBitrateHigh)</div><div>- continue;</div><div>- else if (param.sourceWidth > sqrt(levels[i].maxLumaSamples * 8.0f))</div><div>- continue;</div><div>- else if (param.sourceHeight > sqrt(levels[i].maxLumaSamples * 8.0f))</div><div>- continue;</div><div>- else if (param.levelIdc && param.levelIdc != levels[i].levelIdc)</div><div>- continue;</div><div>- }</div><div>+ else if (samplesPerSec > levels[i].maxLumaSamplesPerSecond)</div><div>+ continue;</div><div>+ else if (bitrate > levels[i].maxBitrateMain && levels[i].maxBitrateHigh == MAX_UINT)</div><div>+ continue;</div><div>+ else if (bitrate > levels[i].maxBitrateHigh)</div><div>+ continue;</div><div>+ else if (param.sourceWidth > sqrt(levels[i].maxLumaSamples * 8.0f))</div><div>+ continue;</div><div>+ else if (param.sourceHeight > sqrt(levels[i].maxLumaSamples * 8.0f))</div><div>+ continue;</div><div>+ else if (param.levelIdc && param.levelIdc != levels[i].levelIdc)</div><div>+ continue;</div><div> uint32_t maxDpbSize = MaxDpbPicBuf;</div><div>- if (param.uhdBluray)</div><div>- maxDpbSize = 6;</div><div>- else if (lumaSamples <= (levels[i].maxLumaSamples >> 2))</div><div>+</div><div>+ if (lumaSamples <= (levels[i].maxLumaSamples >> 2))</div><div> maxDpbSize = X265_MIN(4 * MaxDpbPicBuf, 16);</div><div> else if (lumaSamples <= (levels[i].maxLumaSamples >> 1))</div><div> maxDpbSize = X265_MIN(2 * MaxDpbPicBuf, 16);</div><div>@@ -209,8 +209,6 @@</div><div> else</div><div> vps.ptl.tierFlag = Level::MAIN;</div><div> #undef CHECK_RANGE</div><div>- if (param.uhdBluray)</div><div>- vps.ptl.tierFlag = Level::HIGH;</div><div> </div><div> vps.ptl.levelIdc = levels[i].levelEnum;</div><div> vps.ptl.minCrForLevel = levels[i].minCompressionRatio;</div><div>@@ -381,12 +379,15 @@</div><div> /* The value of sps_max_dec_pic_buffering_minus1[ HighestTid ] + 1 shall be less than or equal to MaxDpbSize */</div><div> const uint32_t MaxDpbPicBuf = 6;</div><div> uint32_t maxDpbSize = MaxDpbPicBuf;</div><div>- if (lumaSamples <= (l.maxLumaSamples >> 2))</div><div>- maxDpbSize = X265_MIN(4 * MaxDpbPicBuf, 16);</div><div>- else if (lumaSamples <= (l.maxLumaSamples >> 1))</div><div>- maxDpbSize = X265_MIN(2 * MaxDpbPicBuf, 16);</div><div>- else if (lumaSamples <= ((3 * l.maxLumaSamples) >> 2))</div><div>- maxDpbSize = X265_MIN((4 * MaxDpbPicBuf) / 3, 16);</div><div>+ if (!param.uhdBluray) /* Do not change MaxDpbPicBuf for UHD-Bluray */</div><div>+ {</div><div>+ if (lumaSamples <= (l.maxLumaSamples >> 2))</div><div>+ maxDpbSize = X265_MIN(4 * MaxDpbPicBuf, 16);</div><div>+ else if (lumaSamples <= (l.maxLumaSamples >> 1))</div><div>+ maxDpbSize = X265_MIN(2 * MaxDpbPicBuf, 16);</div><div>+ else if (lumaSamples <= ((3 * l.maxLumaSamples) >> 2))</div><div>+ maxDpbSize = X265_MIN((4 * MaxDpbPicBuf) / 3, 16);</div><div>+ }</div><div> </div><div> int savedRefCount = param.maxNumReferences;</div><div> while (vps.maxDecPicBuffering > maxDpbSize && param.maxNumReferences > 1)</div><div><br></div><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div>Deepthi Nandakumar<br></div>Engineering Manager, x265<br></div>Multicoreware, Inc<br></div></div>
</div>