<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>anime on Monsoon's Blog</title><link>https://monsoon-cs.moe/tags/anime/</link><description>Recent content in anime on Monsoon's Blog</description><generator>Hugo</generator><language>en</language><lastBuildDate>Thu, 25 May 2023 00:00:00 +0000</lastBuildDate><atom:link href="https://monsoon-cs.moe/tags/anime/index.xml" rel="self" type="application/rss+xml"/><item><title>VCB-Studio Technical Director Entry Test 2023 and My Answer</title><link>https://monsoon-cs.moe/2023-05-25-vcb/</link><pubDate>Thu, 25 May 2023 00:00:00 +0000</pubDate><guid>https://monsoon-cs.moe/2023-05-25-vcb/</guid><description>&lt;p&gt;See &lt;a href="https://vcb-s.com/archives/15949"&gt;original publication page&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;All my answer files can be browsed in &lt;a href="https://static.monsoon-cs.moe/public/VCB-Studio%20Entry%20Test%202023%20Answers/"&gt;here&lt;/a&gt;, or you can download &lt;a href="https://static.monsoon-cs.moe/public/VCB-Studio%20Entry%20Test%202023%20Answers.zip"&gt;zipped file&lt;/a&gt; (5.9G).&lt;/p&gt;
&lt;h2 id="requirements"&gt;Requirements&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;This is a test for candidates who wish to participate in the training class organized by VCB-Studio. Finish as many problems as you can, and then do the following things:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Pack your answers, result files, and necessary attachments into a &lt;strong&gt;zip/rar/7z&lt;/strong&gt; file. Source files we provided and intermediate file in your encoding should not be packed in.&lt;/li&gt;
&lt;li&gt;Register a Baidu Net Disk account (&lt;a href="https://pan.baidu.com"&gt;https://pan.baidu.com&lt;/a&gt;), upload the zipped file and create a sharing link. Whether you like it or not, Baidu Net Disk has been the most effective way to share files within our team since day one. Other sharing methods will NOT be considered.&lt;/li&gt;
&lt;li&gt;Send the link via email to &lt;a href="mailto:vcbs.training@gmail.com"&gt;vcbs.training@gmail.com&lt;/a&gt; before &lt;strong&gt;Beijing Time (UTC+8) Monday, 23 Jan 2023, 23:59:59&lt;/strong&gt;. Late submissions will NOT be considered.&lt;/li&gt;
&lt;li&gt;Prepare a QQ account. The follow-up training courses will be conducted in the QQ group.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You should independently complete the answers without any public discussion. Any form of plagiarism will NOT be tolerated.&lt;/p&gt;</description><content:encoded><![CDATA[<p>See <a href="https://vcb-s.com/archives/15949">original publication page</a> for more details.</p>
<p>All my answer files can be browsed in <a href="https://static.monsoon-cs.moe/public/VCB-Studio%20Entry%20Test%202023%20Answers/">here</a>, or you can download <a href="https://static.monsoon-cs.moe/public/VCB-Studio%20Entry%20Test%202023%20Answers.zip">zipped file</a> (5.9G).</p>
<h2 id="requirements">Requirements</h2>
<blockquote>
<p>This is a test for candidates who wish to participate in the training class organized by VCB-Studio. Finish as many problems as you can, and then do the following things:</p>
<ol>
<li>Pack your answers, result files, and necessary attachments into a <strong>zip/rar/7z</strong> file. Source files we provided and intermediate file in your encoding should not be packed in.</li>
<li>Register a Baidu Net Disk account (<a href="https://pan.baidu.com">https://pan.baidu.com</a>), upload the zipped file and create a sharing link. Whether you like it or not, Baidu Net Disk has been the most effective way to share files within our team since day one. Other sharing methods will NOT be considered.</li>
<li>Send the link via email to <a href="mailto:vcbs.training@gmail.com">vcbs.training@gmail.com</a> before <strong>Beijing Time (UTC+8) Monday, 23 Jan 2023, 23:59:59</strong>. Late submissions will NOT be considered.</li>
<li>Prepare a QQ account. The follow-up training courses will be conducted in the QQ group.</li>
</ol>
<p>You should independently complete the answers without any public discussion. Any form of plagiarism will NOT be tolerated.</p>
<p>This test has 5 questions. For question 2 and 3, you can choose ONE of them. Choosing both then we will pick one with higher points. The answers should be made in English.</p>
</blockquote>
<h2 id="question1-15pt">Question1 (15pt)</h2>
<blockquote>
<p>Please describe yourself as who you are, where do you study, how do you come to know VCB-Studio and why are you interested in this project, etc. Please do not write more than 500 words, or approximately 1 page. (15pt)</p>
</blockquote>
<p><em>Answers are hidden for privacy reasons.</em></p>
<h2 id="question2-30pt">Question2 (30pt)</h2>
<blockquote>
<p>Scanned pictures (or simply scans) are an important part of BDRips, which are often released as lossless PNG, TIFF format or lossy JPG format. Scans feature high resolution and large size. In the file <strong>Q2.7z</strong>, two sets of pictures have been provided for you. PNGs are the source scans, and WEBPs are transcoded from PNGs according to VCB-Studio Collation specifications. Your tasks are:</p>
<ol>
<li>Summarize the format conversion rules of scans in VCB-Studio Collation specifications. (6pt)</li>
<li>Convert the sources to AVIF and JPEG-XL format, with sizes comparable to the WEBPs. (12pt)</li>
<li>Comment on the quality, encoding speed, and compatibility of AVIF and JPEG- XL, and why/why not you may recommend us switching to the new format as the upgrade for WEBP in 2023. (12pt)</li>
</ol>
<p>You are free to utilize existing tools, but you need to describe clearly where you find the tool and how to use it.</p>
</blockquote>
<h3 id="1-format-conversion-rules-of-scans-in-vcb-studio-collation-specifications">(1) Format conversion rules of scans in VCB-Studio Collation specifications</h3>
<p>Choosing a format with better image quality at the same size when ensuring compatibility.</p>
<h3 id="2-converting-test">(2) Converting test</h3>
<p>See <code>Q2/convert.py</code> for my conversion code. <code>Pillow</code>, <code>pillow_avif_plugin</code> and <code>jxlpy</code> are used libraries. <code>Pillow</code> is the image processing library which I often use, it supports <code>WEBP</code> but not <code>AVIF</code> and <code>JPEG-XL</code>. So I find two <code>Pillow</code> plugins by Google to support <code>AVIF</code> and <code>JPEG-XL</code>.</p>
<p><code>PNG</code> and <code>WEBP Ref</code> are given images, and <code>WEBP Cus</code>, <code>AVIF</code>, <code>JPEG-XL</code> are custom encoded images.</p>
<p><code>WEBP Custom</code> is encoded by <code>Pillow</code>, which is backed by <code>libwebp</code>. Encoding speed is set to slowest(<code>6</code>), and quality is set to <code>90</code> to keep the same size with reference webp images.</p>
<p><code>AVIF</code> is encoded by <code>pillow-avif-plugin</code>, which is backed by <code>libavif</code>. Encoding speed is set to slowest(<code>0</code>), and quality is set to <code>84</code> to get the comparable size with reference webp images.</p>
<p><code>JPEG-XL</code> is encoded by <code>jxlpy</code>, which is backed by <code>libjxl</code>. Encoding speed is set to slowest(<code>9</code>), decoding speed is also slowest(<code>0</code>), and quality is set to <code>92</code> to get the comparable size with reference webp images.</p>
<p>The following table shows the result:</p>
<table>
	<thead>
			<tr>
					<th style="text-align: center">Image</th>
					<th style="text-align: center">PNG (size)</th>
					<th style="text-align: center">WEBP Ref (size)</th>
					<th style="text-align: center">WEBP Cus (size/time)</th>
					<th style="text-align: center">AVIF (size/time)</th>
					<th style="text-align: center">JPEG-XL (size/time)</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td style="text-align: center">01</td>
					<td style="text-align: center">26.97 MB</td>
					<td style="text-align: center">2.95 MB</td>
					<td style="text-align: center">2.95 MB / 3.36 s</td>
					<td style="text-align: center">2.77 MB / 37.77 s</td>
					<td style="text-align: center">2.56 MB / 32.00 s</td>
			</tr>
			<tr>
					<td style="text-align: center">02</td>
					<td style="text-align: center">26.25 MB</td>
					<td style="text-align: center">2.93 MB</td>
					<td style="text-align: center">2.94 MB / 3.27 s</td>
					<td style="text-align: center">2.71 MB / 34.87 s</td>
					<td style="text-align: center">2.48 MB / 33.07 s</td>
			</tr>
			<tr>
					<td style="text-align: center">03</td>
					<td style="text-align: center">3.60 MB</td>
					<td style="text-align: center">0.26 MB</td>
					<td style="text-align: center">0.26 MB / 0.37 s</td>
					<td style="text-align: center">0.28 MB / 11.48 s</td>
					<td style="text-align: center">0.28 MB / 5.12 s</td>
			</tr>
			<tr>
					<td style="text-align: center">04</td>
					<td style="text-align: center">21.78 MB</td>
					<td style="text-align: center">1.03 MB</td>
					<td style="text-align: center">1.03 MB / 2.06 s</td>
					<td style="text-align: center">1.32 MB / 29.56 s</td>
					<td style="text-align: center">1.39 MB / 32.25 s</td>
			</tr>
			<tr>
					<td style="text-align: center">05</td>
					<td style="text-align: center">2.65 MB</td>
					<td style="text-align: center">0.13 MB</td>
					<td style="text-align: center">0.13 MB / 0.24 s</td>
					<td style="text-align: center">0.15 MB / 9.29 s</td>
					<td style="text-align: center">0.18 MB / 4.11 s</td>
			</tr>
			<tr>
					<td style="text-align: center">06</td>
					<td style="text-align: center">2.66 MB</td>
					<td style="text-align: center">0.13 MB</td>
					<td style="text-align: center">0.13 MB / 0.25 s</td>
					<td style="text-align: center">0.15 MB / 9.39 s</td>
					<td style="text-align: center">0.16 MB / 3.81 s</td>
			</tr>
			<tr>
					<td style="text-align: center">07</td>
					<td style="text-align: center">24.38 MB</td>
					<td style="text-align: center">1.71 MB</td>
					<td style="text-align: center">1.71 MB / 2.25 s</td>
					<td style="text-align: center">1.67 MB / 27.78 s</td>
					<td style="text-align: center">1.68 MB / 35.59 s</td>
			</tr>
			<tr>
					<td style="text-align: center">08</td>
					<td style="text-align: center">55.52 MB</td>
					<td style="text-align: center">7.58 MB</td>
					<td style="text-align: center">7.58 MB / 26.48 s</td>
					<td style="text-align: center">7.93 MB / 83.44 s</td>
					<td style="text-align: center">6.36 MB / 72.90 s</td>
			</tr>
			<tr>
					<td style="text-align: center">09</td>
					<td style="text-align: center">44.39 MB</td>
					<td style="text-align: center">2.00 MB</td>
					<td style="text-align: center">2.00 MB / 3.53 s</td>
					<td style="text-align: center">1.99 MB / 59.79 s</td>
					<td style="text-align: center">2.47 MB / 71.73 s</td>
			</tr>
			<tr>
					<td style="text-align: center">10</td>
					<td style="text-align: center">41.59 MB</td>
					<td style="text-align: center">1.21 MB</td>
					<td style="text-align: center">1.21 MB / 3.11 s</td>
					<td style="text-align: center">1.16 MB / 59.99 s</td>
					<td style="text-align: center">1.70 MB / 63.65 s</td>
			</tr>
	</tbody>
</table>
<p><strong>PS</strong>: <code>pillow-avif-plugin</code> uses 8 threads to encode images (on i7-11700), and I didn&rsquo;t find an option to turn it off. Other encoders use only 1 thread. <code>jxlpy</code> example shows that it supports setting multithreading, but it doesn&rsquo;t work.</p>
<h3 id="3-comparison-and-comment">(3) Comparison and comment</h3>
<p>Quality comparison:</p>
<table>
	<thead>
			<tr>
					<th style="text-align: center"><code>PNG</code></th>
					<th style="text-align: center"><code>WEBP Ref</code></th>
					<th style="text-align: center"><code>AVIF</code></th>
					<th style="text-align: center"><code>JPEG-XL</code></th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td style="text-align: center"><img loading="lazy" src="/2023-05-25-vcb/pics/Q2_png.png"></td>
					<td style="text-align: center"><img loading="lazy" src="/2023-05-25-vcb/pics/Q2_webp.png"></td>
					<td style="text-align: center"><img loading="lazy" src="/2023-05-25-vcb/pics/Q2_avif.png"></td>
					<td style="text-align: center"><img loading="lazy" src="/2023-05-25-vcb/pics/Q2_jxl.png"></td>
			</tr>
	</tbody>
</table>
<p>Above is a cropped part from 03 for the given encoding. The <code>WEBP</code> image has severe smearing in dark areas, and obvious color shift occurs in the red dots on the upper left and lower right. The <code>AVIF</code> image is better in smearing, but the color shift is the same as <code>WEBP</code>. The <code>JPEG-XL</code> image is relatively closest to reference <code>PNG</code> image.</p>
<p>Detailed compatibility:</p>
<table>
	<thead>
			<tr>
					<th style="text-align: center">Format</th>
					<th style="text-align: center">Windows</th>
					<th style="text-align: center">macOS</th>
					<th style="text-align: center">Android</th>
					<th style="text-align: center">iOS</th>
					<th style="text-align: center">Chrome</th>
					<th style="text-align: center">Firefox</th>
					<th style="text-align: center">Safari</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td style="text-align: center"><code>WEBP</code></td>
					<td style="text-align: center">≥10</td>
					<td style="text-align: center">≥11</td>
					<td style="text-align: center">≥4</td>
					<td style="text-align: center">≥14</td>
					<td style="text-align: center">✅</td>
					<td style="text-align: center">✅</td>
					<td style="text-align: center">✅</td>
			</tr>
			<tr>
					<td style="text-align: center"><code>AVIF</code></td>
					<td style="text-align: center">≥10-1903</td>
					<td style="text-align: center">≥13</td>
					<td style="text-align: center">≥12</td>
					<td style="text-align: center">≥16</td>
					<td style="text-align: center">✅</td>
					<td style="text-align: center">✅</td>
					<td style="text-align: center">✅</td>
			</tr>
			<tr>
					<td style="text-align: center"><code>JPEG-XL</code></td>
					<td style="text-align: center">❌</td>
					<td style="text-align: center">❌</td>
					<td style="text-align: center">❌</td>
					<td style="text-align: center">❌</td>
					<td style="text-align: center">❌</td>
					<td style="text-align: center">❌</td>
					<td style="text-align: center">❌</td>
			</tr>
	</tbody>
</table>
<p>PS: Results on Windows, macOS, Android and iOS are got by Google. Browser compatibility information can be found at <a href="https://caniuse.com">https://caniuse.com</a>.</p>
<p>Summary:</p>
<table>
	<thead>
			<tr>
					<th style="text-align: center">Format</th>
					<th style="text-align: center">Quality</th>
					<th style="text-align: center">Encoding Speed</th>
					<th style="text-align: center">Compatibility</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td style="text-align: center"><code>WEBP</code></td>
					<td style="text-align: center">worst</td>
					<td style="text-align: center">fast</td>
					<td style="text-align: center">good</td>
			</tr>
			<tr>
					<td style="text-align: center"><code>AVIF</code></td>
					<td style="text-align: center">medium</td>
					<td style="text-align: center">slow</td>
					<td style="text-align: center">medium</td>
			</tr>
			<tr>
					<td style="text-align: center"><code>JPEG-XL</code></td>
					<td style="text-align: center">best</td>
					<td style="text-align: center">slow</td>
					<td style="text-align: center">bad</td>
			</tr>
	</tbody>
</table>
<p>Due to the bad compatibility of <code>JPEG-XL</code>, it should not be considered an appropriate option. <code>AVIF</code> features the better image quality than <code>WEBP</code>, but is only well supported in new platforms, which needs time for adoption, especially for fragmented Android and Windows. Although <code>WBEP</code> takes huge advantage in encoding speed, I don&rsquo;t think encoding speed is a factor that needs to be considered because even for large images, the encoding time is only about 1 minute, and the number of images not large. Compared with video encoding, this is a completely negligible time overhead.</p>
<p>Summarily, I think <strong>now</strong> is not a suitable time to switch to <code>AVIF</code> or <code>JPEG-XL</code>. But two years later, it will be time for <code>AVIF</code> to show its strength.</p>
<h2 id="question3-30pt">Question3 (30pt)</h2>
<blockquote>
<p>Recently 32-bit audio tracks have appeared in some of the latest Hi-Res music. Although now we would not see these annoying 32-bit tracks in the Blu-ray, we have to start working on them in advance. In the file <strong>Q3.7z</strong>, two 32-bit PCM files are provided for you. Your tasks are:</p>
<ol>
<li>Learn about 32-bit tracks and tell the difference between these two files. (6pt)</li>
<li>Try to convert them to FLAC, ALAC, and WavPack losslessly. (15pt)</li>
<li>Consider various aspects such as compression rate, encoding speed, and playback compatibility and select the format you recommend most for 32-bit audio. (9pt)</li>
</ol>
<p>You are free to utilize existing tools, but you need to describe clearly where you find the tool and how to use it.</p>
</blockquote>
<h3 id="1">(1)</h3>
<p>Using <code>ffprobe</code> to get audio encoding info:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Input #0, wav, from &#39;01.wav&#39;:
</span></span><span class="line"><span class="cl">  Duration: 00:03:52.48, bitrate: 6144 kb/s
</span></span><span class="line"><span class="cl">  Stream #0:0: Audio: pcm_s32le ([1][0][0][0] / 0x0001), 96000 Hz, 2 channels, s32, 6144 kb/s
</span></span></code></pre></td></tr></table>
</div>
</div><div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Input #0, wav, from &#39;02.wav&#39;:
</span></span><span class="line"><span class="cl">  Duration: 00:07:03.00, bitrate: 6144 kb/s
</span></span><span class="line"><span class="cl">  Stream #0:0: Audio: pcm_f32le ([3][0][0][0] / 0x0003), 96000 Hz, 2 channels, flt, 6144 kb/s
</span></span></code></pre></td></tr></table>
</div>
</div><p>The difference is: <code>01.wav</code> is encoded by <code>pcm_s32le</code>, and <code>02.wav</code> is encoded by <code>pcm_f32le</code>.</p>
<p><code>pcm_s32le</code> means PCM encoding by 32-bit signed integer with little-endian byte ordering, while <code>pcm_s32le</code> means PCM encoding by 32-bit floating point with little-endian byte ordering.</p>
<h3 id="2">(2)</h3>
<p>I first tried to convert them losslessly using FFmpeg. If FFmpeg failed, I used Google to find a suitable codec.</p>
<p>This is the result of my attempt:</p>
<table>
	<thead>
			<tr>
					<th style="text-align: center">Format</th>
					<th style="text-align: center">32-bit integer</th>
					<th style="text-align: center">32-bit float</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td style="text-align: center"><code>FLAC</code></td>
					<td style="text-align: center">FFmpeg ❌<br><a href="https://github.com/xiph/flac"><code>flac</code></a> (from v1.4.0) ✅</td>
					<td style="text-align: center">FFmpeg ❌</td>
			</tr>
			<tr>
					<td style="text-align: center"><code>ALAC</code></td>
					<td style="text-align: center">FFmpeg (decoding only)<br><a href="https://github.com/nu774/qaac"><code>qaac</code></a> (backed by Apple <code>CoreAudioToolbox</code>) ✅</td>
					<td style="text-align: center">FFmpeg ❌</td>
			</tr>
			<tr>
					<td style="text-align: center"><code>WavPack</code></td>
					<td style="text-align: center">FFmpeg ✅</td>
					<td style="text-align: center">FFmpeg ✅</td>
			</tr>
	</tbody>
</table>
<p>The conversion command:</p>
<table>
	<thead>
			<tr>
					<th style="text-align: center">Format</th>
					<th style="text-align: center">32-bit integer</th>
					<th style="text-align: center">32-bit float</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td style="text-align: center"><code>FLAC</code></td>
					<td style="text-align: center"><code>flac -o 01.flac 01.wav</code></td>
					<td style="text-align: center">❌</td>
			</tr>
			<tr>
					<td style="text-align: center"><code>ALAC</code></td>
					<td style="text-align: center"><code>qaac64 -b 32 --alac -i 01.wav -o 01.m4a</code></td>
					<td style="text-align: center">❌</td>
			</tr>
			<tr>
					<td style="text-align: center"><code>WavPack</code></td>
					<td style="text-align: center"><code>ffmpeg -i 01.wav 01.wv</code></td>
					<td style="text-align: center"><code>ffmpeg -i 02.wav 02.wv</code></td>
			</tr>
	</tbody>
</table>
<p>The resulting files are <code>Q3/01.flac</code>, <code>Q3/01.m4a</code>, <code>Q3/01.wv</code> and <code>Q3/02.wv</code>.</p>
<h3 id="3">(3)</h3>
<p>Encoding speed and compression rate of different encoding methods:</p>
<table>
	<thead>
			<tr>
					<th style="text-align: center">Format</th>
					<th style="text-align: center"><code>WAV</code> file size / encoded file size</th>
					<th style="text-align: center">audio time / encoding time</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td style="text-align: center"><code>FLAC s32</code></td>
					<td style="text-align: center">1.337</td>
					<td style="text-align: center">128.44</td>
			</tr>
			<tr>
					<td style="text-align: center"><code>ALAC s32</code></td>
					<td style="text-align: center">1.304</td>
					<td style="text-align: center">69.81</td>
			</tr>
			<tr>
					<td style="text-align: center"><code>WavPack s32</code></td>
					<td style="text-align: center">1.280</td>
					<td style="text-align: center">121.08</td>
			</tr>
			<tr>
					<td style="text-align: center"><code>WavPack f32</code></td>
					<td style="text-align: center">1.489</td>
					<td style="text-align: center">109.02</td>
			</tr>
	</tbody>
</table>
<p>Summary:</p>
<table>
	<thead>
			<tr>
					<th style="text-align: center"></th>
					<th style="text-align: center"><code>FLAC s32</code></th>
					<th style="text-align: center"><code>FLAC f32</code></th>
					<th style="text-align: center"><code>ALAC s32</code></th>
					<th style="text-align: center"><code>ALAC f32</code></th>
					<th style="text-align: center"><code>WavPack s32</code></th>
					<th style="text-align: center"><code>WavPack f32</code></th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td style="text-align: center">Compression rate</td>
					<td style="text-align: center">best</td>
					<td style="text-align: center">❌</td>
					<td style="text-align: center">medium</td>
					<td style="text-align: center">❌</td>
					<td style="text-align: center">worst</td>
					<td style="text-align: center">-</td>
			</tr>
			<tr>
					<td style="text-align: center">Encoding speed</td>
					<td style="text-align: center">very fast</td>
					<td style="text-align: center">❌</td>
					<td style="text-align: center">fast</td>
					<td style="text-align: center">❌</td>
					<td style="text-align: center">very fast</td>
					<td style="text-align: center">very fast</td>
			</tr>
			<tr>
					<td style="text-align: center">Playback compatibility</td>
					<td style="text-align: center">bad (<code>flac</code> only)</td>
					<td style="text-align: center">❌</td>
					<td style="text-align: center">good (FFmpeg)</td>
					<td style="text-align: center">❌</td>
					<td style="text-align: center">good (FFmpeg)</td>
					<td style="text-align: center">good (FFmpeg)</td>
			</tr>
	</tbody>
</table>
<p>Because FFmpeg is the de facto standard multimedia codec library used by most video players, <code>FLAC</code> is not suitable, which can only be decoded by <code>flac</code>. Also, <code>WavPack</code> shows advantage in encoding speed compared to <code>ALAC</code>, but considering that all of three formats are fast in absolute speed (compared to video encoding), this advantage is not greatly valuable. Last, <code>ALAC</code> shows better compression rate than <code>WavPack</code>, thus file size can be saved.</p>
<p>To sum up, I recommend <code>ALAC</code> for encoding 32-bit audio. But if float point encoding is required (which is rare), <code>WavPack</code> is the only choice.</p>
<h2 id="question4-35pt">Question4 (35pt)</h2>
<blockquote>
<p>MSU publishes video encoder tests every year, with the latest one here:
<a href="https://compression.ru/video/codec_comparison/2021/main_report.html">https://compression.ru/video/codec_comparison/2021/main_report.html</a>.</p>
<p>For the first time last year, H.266 (VVC) encoders participated in the tests and they performed well in terms of encoding quality in the slow encoding (1 fps) test.</p>
<ol>
<li>Choose any of the H.266 (VVC) or AV1 encoders in the figure below, and then encode the source file <em>Q4 [E46686C4].m2ts</em> with no more than 2500 Kbps of video bitrate. You&rsquo;d better use 10bit variants of these encoders, which facilitates the comparison later. In addition, you need to describe clearly where you found the encoder and state the version and parameters you used. If you use H.266 (VVC) encoder, you will get additional 5pt. (10pt+5pt)</li>
<li>We provide an AV1 video file <em>Q4_AV1 [41A7EDDA].mkv</em>, which was encoded via SVT-AV1 10bit encoder without any pre-processing. Comment on the picture quality compared to the source file. When you compare the picture quality, you may want to sample a few frames, attach some screenshots, and comment on the performance of dark scenes and moving scenes. (10pt)</li>
<li>Now compare your own encoding to the given AV1 file in terms of picture quality, encoding speed, and playback compatibility. As a reference, we encoded the above AV1 file at 1.0 fps. (10pt)</li>
</ol>
</blockquote>
<p><img loading="lazy" src="/2023-05-25-vcb/pics/Q4.png"></p>
<h3 id="1-vvc-encoding">(1) VVC encoding</h3>
<p>The testing hardware and software environment is:</p>
<ul>
<li>Encoder: <a href="https://github.com/fraunhoferhhi/vvenc">VVenC</a> v1.7.0.</li>
<li>Compiler: AMD Optimizing C/C++ Compiler 4.0.0.</li>
<li>CPU: 2 x AMD EPYC 7713, 128 cores / 256 threads in total.</li>
<li>RAM: 16 channel DDR4-3200.</li>
<li>OS: Ubuntu 18.04.6.</li>
</ul>
<p>First, use <code>ffmpeg</code> to convert <code>Q4 [E46686C4].m2ts</code> to raw <code>yuv420p10</code> video:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">ffmpeg -i <span class="s2">&#34;Q4 [E46686C4].m2ts&#34;</span> -pix_fmt yuv420p10 Q4_yuv420p10.yuv
</span></span></code></pre></td></tr></table>
</div>
</div><p>Parameter <code>-pix_fmt yuv420p10</code> indicates <code>ffmpeg</code> to output raw video use <code>yuv420p10</code> format:</p>
<p>Then, use <code>vvencapp</code> to encode the raw video:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">vvencapp --input Q4_yuv420p10.yuv --size 1920x1080 --format yuv420_10 --fps 24000/1001 --preset &lt;preset&gt; --bitrate 2500kbps --output Q4_VVC.vvc
</span></span></code></pre></td></tr></table>
</div>
</div><p>Parameters meaning:</p>
<ul>
<li><code>--size 1920x1080</code>: indicating the input raw video frame size is 1920x1080.</li>
<li><code>--format yuv420_10</code>: same as <code>yuv420p10</code> meaning in <code>ffmpeg</code>.</li>
<li><code>--fps 24000/1001</code>: indicating the output video fps is <code>23.976</code> (same as original <code>m2ts</code> file).</li>
<li><code>--preset &lt;preset&gt;</code>: Preset vvc encoding parameter combination. Available options are <code>faster</code>, <code>fast</code>, <code>meadium</code>, <code>slow</code> and <code>slower</code>. Detailed settings are listed in <a href="https://github.com/fraunhoferhhi/vvenc/blob/master/cfg/">https://github.com/fraunhoferhhi/vvenc/blob/master/cfg/randomaccess_*.cfg</a>.</li>
<li><code>--bitrate 2500kbps</code>: controlling the output encoded video bitrate to about <code>2500kbps</code>.</li>
</ul>
<table>
	<thead>
			<tr>
					<th style="text-align: center">File</th>
					<th style="text-align: center">Preset</th>
					<th style="text-align: center">FPS</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td style="text-align: center"><code>Q4_VVC_faster.vvc</code></td>
					<td style="text-align: center"><code>faster</code></td>
					<td style="text-align: center">5.762</td>
			</tr>
			<tr>
					<td style="text-align: center"><code>Q4_VVC_fast.vvc</code></td>
					<td style="text-align: center"><code>fast</code></td>
					<td style="text-align: center">2.156</td>
			</tr>
			<tr>
					<td style="text-align: center"><code>Q4_VVC_medium.vvc</code></td>
					<td style="text-align: center"><code>medium</code></td>
					<td style="text-align: center">0.557</td>
			</tr>
			<tr>
					<td style="text-align: center"><code>Q4_VVC_slow.vvc</code></td>
					<td style="text-align: center"><code>slow</code></td>
					<td style="text-align: center">0.177</td>
			</tr>
			<tr>
					<td style="text-align: center"><code>Q4_VVC_slower.vvc</code></td>
					<td style="text-align: center"><code>slower</code></td>
					<td style="text-align: center">0.058</td>
			</tr>
	</tbody>
</table>
<h3 id="2-comparing-source-video-and-reference-av1-encoded-video">(2) Comparing source video and reference <code>AV1</code> encoded video</h3>
<p>The video player used is <a href="https://github.com/MartinEesmaa/VVCEasy">MPV with libvvdec &amp; xHE-AAC support</a>, configured according to <a href="https://vcb-s.com/archives/7594">https://vcb-s.com/archives/7594</a>.</p>
<p>Dynamic fire with a dark background is a highly challenging scene. Compared to the original video, There are color blocks around hte flame in AV1 video, which is a common problem when the bitrate is insufficient.</p>
<table>
	<thead>
			<tr>
					<th style="text-align: center">Encoding Method</th>
					<th style="text-align: center">Capture</th>
					<th style="text-align: center">File</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td style="text-align: center">Original</td>
					<td style="text-align: center"><img loading="lazy" src="/2023-05-25-vcb/pics/m2ts-flame.png"></td>
					<td style="text-align: center"><code>pics/m2ts-flame.png</code></td>
			</tr>
			<tr>
					<td style="text-align: center">AV1</td>
					<td style="text-align: center"><img loading="lazy" src="/2023-05-25-vcb/pics/av1-flame.png"></td>
					<td style="text-align: center"><code>pics/av1-flame.png</code></td>
			</tr>
	</tbody>
</table>
<h3 id="3-comparing-custom-vvc-encoded-video-and-reference-av1-encoded-video">(3) Comparing custom <code>VVC</code> encoded video and reference <code>AV1</code> encoded video</h3>
<p>Using the same player as (2). In order to be comparable to the video encoded by AV1, I chose the medium preset encoded VVC video, which has an encoding speed of 0.557 fps.</p>
<p>The VVC encoded video is much better than the AV1 video in flame scene. The color blocks are less obvious and closer to the original video.</p>
<table>
	<thead>
			<tr>
					<th style="text-align: center">Encoding Method</th>
					<th style="text-align: center">Capture</th>
					<th style="text-align: center">File</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td style="text-align: center">Original</td>
					<td style="text-align: center"><img loading="lazy" src="/2023-05-25-vcb/pics/m2ts-flame.png"></td>
					<td style="text-align: center"><code>pics/m2ts-flame.png</code></td>
			</tr>
			<tr>
					<td style="text-align: center">AV1</td>
					<td style="text-align: center"><img loading="lazy" src="/2023-05-25-vcb/pics/av1-flame.png"></td>
					<td style="text-align: center"><code>pics/av1-flame.png</code></td>
			</tr>
			<tr>
					<td style="text-align: center">VVC (medium)</td>
					<td style="text-align: center"><img loading="lazy" src="/2023-05-25-vcb/pics/vvc-flame.png"></td>
					<td style="text-align: center"><code>pics/vvc-flame.png</code></td>
			</tr>
	</tbody>
</table>
<h2 id="question5-20pt">Question5 (20pt)</h2>
<blockquote>
<p>When we check an encoded file, we need to locate frames that have been encoded exceptionally awful. We use algorithms like PSNR to evaluate the similarity of each frame in the encoded file to the source file. The result is an array of scores, where the i-th score is tied to the i-th frame. These scores are called raw scores. However, what we are concerned about is the standard score, which is the raw score minus a threshold. A frame with a standard score less than 0 is considered a bad frame. The tasks are:</p>
<ol>
<li>
<p>Find the worst frame, i.e. the one with the lowest standard score among the bad frames, and output its index. If there is more than one worst frame, output the first. If there are no bad frames, output <code>-1</code>. Frames with a standard score of exactly <code>0</code> are not considered as bad frames. (10pt)</p>
<p><strong>Input:</strong>
2 lines. The first line is two integers that represent the number of frames <code>N</code> and the threshold value <code>S</code>. The second row is an array of integers <code>A[N]</code>, representing the raw score of each frame.</p>
<p>For all the data, <code>1&lt;=N&lt;=200000</code>, <code>0&lt;S&lt;100</code>, <code>0&lt;=A[i]&lt;=100</code></p>
<p><strong>Output:</strong>
An integer, the index of the worst frame. The index starts from <code>0</code>. If there is more than one worst frame, output the first. If there are no bad frames, output <code>-1</code>.</p>
<p><strong>Sample:</strong></p>
<pre tabindex="0"><code>Input
10 30
42 31 44 23 21 26 31 41 50 72

Output
10
</code></pre></li>
<li>
<p>Find a continuous sequence of frames that minimizes the sum of their standard scores and output this minimum value. Full scores will only be given if the time complexity of your algorithm is optimal. (10pt)</p>
<p><strong>Input:</strong>
The same as (1).</p>
<p><strong>Output:</strong>
An integer, the minimum sum value.</p>
<p><strong>Sample:</strong></p>
<pre tabindex="0"><code>Input
10 30
42 31 44 23 21 26 31 41 50 72

Output
-20
</code></pre></li>
</ol>
<p>For each sub question, use C/C++/Java/Python/C# to write a console program. Read the input from the standard input and write it to standard output. Do NOT use libraries other than built-in ones (for example, no “import numpy as np”). Submit your source code.</p>
</blockquote>
<h3 id="1-find-the-worst-frame">(1) Find the worst frame</h3>
<p>The following code is consisted with <code>Q5/q5-1.c</code>:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span><span class="lnt">16
</span><span class="lnt">17
</span><span class="lnt">18
</span><span class="lnt">19
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="cl"><span class="cp">#include</span> <span class="cpf">&lt;stdio.h&gt;</span><span class="cp">
</span></span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="kt">int</span> <span class="n">frame_num</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">    <span class="kt">int</span> <span class="n">threshold</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">    <span class="nf">scanf</span><span class="p">(</span><span class="s">&#34;%d%d&#34;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">frame_num</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">threshold</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">    <span class="kt">int</span> <span class="n">worst_idx</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">    <span class="kt">int</span> <span class="n">worst_rate</span> <span class="o">=</span> <span class="mi">101</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">    <span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">frame_num</span><span class="p">;</span> <span class="n">i</span><span class="o">||</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">        <span class="kt">int</span> <span class="n">rate</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">        <span class="nf">scanf</span><span class="p">(</span><span class="s">&#34;%d&#34;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">rate</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">        <span class="k">if</span> <span class="p">(</span><span class="n">rate</span> <span class="o">&lt;</span> <span class="n">threshold</span> <span class="o">&amp;&amp;</span> <span class="n">rate</span> <span class="o">&lt;</span> <span class="n">worst_rate</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">            <span class="n">worst_rate</span> <span class="o">=</span> <span class="n">rate</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">            <span class="n">worst_idx</span> <span class="o">=</span> <span class="n">i</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">        <span class="p">}</span>
</span></span><span class="line"><span class="cl">    <span class="p">}</span>
</span></span><span class="line"><span class="cl">    <span class="nf">printf</span><span class="p">(</span><span class="s">&#34;%d&#34;</span><span class="p">,</span> <span class="n">worst_idx</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">    <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre></td></tr></table>
</div>
</div><h3 id="2-find-minimum-subsequence-sum">(2) Find minimum subsequence sum</h3>
<p><strong>PS:</strong> Due to the ambiguity of the problem, I can‘t determine whether a sequence of 0 length satisfies the requirement. This determines whether the output should be 0 (indicating that a subsequence of length 0 is selected) or the smallest score (indicating that the sequence length is at least 1) when the input standard scores are all positive. The code I submitted is consistent with the second understanding (sequence length is at least 1), if the first understanding (0 length is allowed) is correct, please comment <code>int min_sum = 101;</code> and uncomment <code>int min_sum = 0;</code>.</p>
<p>The following code is consisted with <code>Q5/q5-2.c</code>:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span><span class="lnt">16
</span><span class="lnt">17
</span><span class="lnt">18
</span><span class="lnt">19
</span><span class="lnt">20
</span><span class="lnt">21
</span><span class="lnt">22
</span><span class="lnt">23
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="cl"><span class="cp">#include</span> <span class="cpf">&lt;stdio.h&gt;</span><span class="cp">
</span></span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="kt">int</span> <span class="n">frame_num</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">    <span class="kt">int</span> <span class="n">threshold</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">    <span class="nf">scanf</span><span class="p">(</span><span class="s">&#34;%d%d&#34;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">frame_num</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">threshold</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">    <span class="kt">int</span> <span class="n">min_sum</span> <span class="o">=</span> <span class="mi">101</span><span class="p">;</span> <span class="c1">// when all scores &gt; 0, output the minimum
</span></span></span><span class="line"><span class="cl">    <span class="c1">// int min_sum = 0; // when all scores &gt; 0, output 0
</span></span></span><span class="line"><span class="cl">    <span class="kt">int</span> <span class="n">sum</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">    <span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">frame_num</span><span class="p">;</span> <span class="n">i</span><span class="o">||</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">        <span class="kt">int</span> <span class="n">rate</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">        <span class="nf">scanf</span><span class="p">(</span><span class="s">&#34;%d&#34;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">rate</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">        <span class="n">rate</span> <span class="o">-=</span> <span class="n">threshold</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">        <span class="n">sum</span> <span class="o">|=</span> <span class="n">rate</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">        <span class="k">if</span> <span class="p">(</span><span class="n">sum</span> <span class="o">&lt;</span> <span class="n">min_sum</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">            <span class="n">min_sum</span> <span class="o">=</span> <span class="n">sum</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">        <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">sum</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">            <span class="n">sum</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">        <span class="p">}</span>
</span></span><span class="line"><span class="cl">    <span class="p">}</span>
</span></span><span class="line"><span class="cl">    <span class="nf">printf</span><span class="p">(</span><span class="s">&#34;%d&#34;</span><span class="p">,</span> <span class="n">min_sum</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">    <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre></td></tr></table>
</div>
</div>]]></content:encoded></item></channel></rss>