TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Discrete Cosine Transform in Video Compression – Explain Like I'm Five

121 点作者 ponderingfish将近 5 年前

18 条评论

JackFr将近 5 年前
Maybe I'm dense, but I didn't find this useful at all. The author spends the bulk of the article explaining what transform means (not typically the sticking point) and then uses terms like "pixel-domain", "frequency-domain", "decorrelating", "energy compacting" without explanation or definition. The author could spend a little less time on the former and more on the latter IMHO.
评论 #24282448 未加载
评论 #24282664 未加载
cdavid将近 5 年前
I am not convinced it is eli5. I am too lazy to write a blog post w&#x2F; illustration, but for audio signals, which I am more familiar with, the intuition behind DCT (and MDCT, used e.g. for mp3) is straightforward.<p>Assuming you understand that a Fourier transform is an operation to go from from time domain to the frequency domain, the problem solved by DCT, DST, etc. is related to the fact that <i>digital</i> signal processing are finite, and without any care, you introduce &#x27;irregularities&#x27; if you use a &#x27;normal&#x27; Fourier transform.<p>So the main idea of DCT&#x2F;DST&#x2F;etc. is to implicitly &#x27;copy&#x27; and&#x2F;or mirror the signal, to reduce the artefacts&#x2F;irregularities introduced by Fourier Transform. Reducing irregularities intuitively leads to more regular signals, and the more regular your signal, the quicker the high frequencies decrease, which is the compression effect of DCT.<p>More mathematically, but still very informally: DCT&#x2F;DST is about boundary conditions. Using DFT (the &#x27;normal&#x27; Fourier transform for digital signals) will imply discontinuities at the boundaries. For continuous time signals, an intuitive way to define regularities is to measure the decay of successive derivative of a function f(t), by looking at convergence convergence of t^n f(t) as t -&gt; inf for n. That implies that regular functions have bounded Fourier transforms, and the more regular, the faster the Fourier transform decays.<p>The DST&#x2F;DCT, by mirroring&#x2F;copying the signal, reduce irregularities, and hence their coefficients decrease faster.
评论 #24283104 未加载
评论 #24283462 未加载
评论 #24283127 未加载
评论 #24283079 未加载
Diti将近 5 年前
This is DEFINITELY NOT explained like I’m five. More like late high school level (mathematical planes, frequencies) and above (matrixes). I appreciate the author’s attempt at vulgarization but the title is wrong.
评论 #24282078 未加载
评论 #24282070 未加载
评论 #24282131 未加载
walagran将近 5 年前
Pretty cool! I would add Computerphile&#x27;s Youtube Video as a watch after this: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=Q2aEzeMDHMA" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=Q2aEzeMDHMA</a>. This is a part of their 4-video series on JPEG:<a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;playlist?list=PLQfOC23r609kmgOr_V8sfUnr0r3pOI9gT" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;playlist?list=PLQfOC23r609kmgOr_V8sf...</a>
评论 #24290944 未加载
EForEndeavour将近 5 年前
The main reason why this article wasn&#x27;t intuitive to me is that the toy example is trivial, and the next example (a real image) is very nontrivial.<p>The first example shows through three lines of runnable Matlab code (sadly, I don&#x27;t have Matlab and it&#x27;s not free, but whatever) that if you start with an 8-by-8 matrix of 255 and run the discrete cosine transform, you end up with a sparse matrix with just one nonzero value in the first entry, because &quot;the DCT has compacted the energy of the matrix into the first element referred to as the DC coefficient. The rest of the coefficients are called the AC coefficients.&quot;<p>Cool? This doesn&#x27;t help any more than just telling me that sentence directly. Also, the article doesn&#x27;t even expand on this fingerhold of familiarity: DC and AC? Like direct current and alternating current, so that first element is in some sense the zero-frequency (&quot;direct current&quot;) term, and if the starting example had any variation at all beyond a perfectly uniform field of 255&#x27;s, you&#x27;d start to see &quot;energy&quot; showing up in the &quot;alternating-current&quot; entries? <i>That</i> would start to give some intuition.<p>I guess what I&#x27;m saying is this article works, but it works by frustrating the reader just enough that they modify and play with the code (porting it from Matlab if they have to), thereby gaining the intuitive understanding that the article promises.
评论 #24283503 未加载
ssawyer06将近 5 年前
Being familiar with the DCT but having no idea how to explain to a five year-old, I clicked. This does not ELI5 the DCT.
评论 #24282909 未加载
评论 #24282796 未加载
djmips将近 5 年前
If this stuff intrigues you please try out Steve Brunton&#x27;s extensive set of videos on Data Science that include superb lectures on Fourier Series, the Fourier Transform and the Fast Fourier Transform with examples in Matlab and Python. Can&#x27;t recommend this guy enough. <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;channel&#x2F;UCm5mt-A4w61lknZ9lCsZtBw" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;channel&#x2F;UCm5mt-A4w61lknZ9lCsZtBw</a>
justjonathan将近 5 年前
This is an explanation (from the amazing three blue one brown) of the DFT not the DCT, but this was the first thing that ever really made sense to me. It is explained by someone who really knows math incredibly well and is an amazing teacher, with amazing visuals: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=spUNpyF58BY" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=spUNpyF58BY</a>
cevans01将近 5 年前
For those that have already worked with the FFT a bit, there are ways to use the FFT to calculate a DCT:<p><a href="https:&#x2F;&#x2F;dsp.stackexchange.com&#x2F;questions&#x2F;2807&#x2F;fast-cosine-transform-via-fft" rel="nofollow">https:&#x2F;&#x2F;dsp.stackexchange.com&#x2F;questions&#x2F;2807&#x2F;fast-cosine-tra...</a>
miccah将近 5 年前
Not DCT, but this website [1] has been on my TODO list for awhile. It explains DFT using interactive visualizations.<p>[1] <a href="https:&#x2F;&#x2F;jackschaedler.github.io&#x2F;circles-sines-signals&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;jackschaedler.github.io&#x2F;circles-sines-signals&#x2F;index....</a>
评论 #24282393 未加载
golergka将近 5 年前
&gt; In simple terms, the Discrete Cosine Transform takes a set of N correlated (similar) data-points and returns N de-correlated (dis-similar) data-points (coefficients) in such a way that the energy is compacted in only a few of the coefficients M where M &lt;&lt; N.<p>That&#x27;s not simple terms.
hinkley将近 5 年前
3Blue1Brown ELI15 the Fast Fourier Transform, which sets up the problem domain:<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=spUNpyF58BY" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=spUNpyF58BY</a>
anovikov将近 5 年前
Good description of how you use it for image compression, but nothing about video compression - that is, how similarity between consecutive frames is used.
rrao84将近 5 年前
Fantastic explanation of transforms and the example of 20 questions and DCT totally did it for me. The rest of the explanation is hard to grok if aren&#x27;t a programmer or not interested in image &amp; video compression. YMMV
master_yoda_1将近 5 年前
Looks like everyone at hackernews have intelligence of a five year old :) Sad to see for so many human being their brain never evolve.
andi999将近 5 年前
Actually even if you are not 5 this totally misses the point about the DCT. Especially the AC components are not explained.
zackmorris将近 5 年前
Here&#x27;s the page that got me interested in the DCT 15 years ago:<p><a href="https:&#x2F;&#x2F;www.mathworks.com&#x2F;help&#x2F;images&#x2F;discrete-cosine-transform.html" rel="nofollow">https:&#x2F;&#x2F;www.mathworks.com&#x2F;help&#x2F;images&#x2F;discrete-cosine-transf...</a><p>Although I must admit that I haven&#x27;t fully internalized it (it&#x27;s easy to forget how it works). It might help to learn some of the more mainstream ones like the Fourier transform first:<p><a href="https:&#x2F;&#x2F;www.mathworks.com&#x2F;help&#x2F;images&#x2F;fourier-transform.html" rel="nofollow">https:&#x2F;&#x2F;www.mathworks.com&#x2F;help&#x2F;images&#x2F;fourier-transform.html</a><p><a href="https:&#x2F;&#x2F;www.mathworks.com&#x2F;help&#x2F;images&#x2F;image-transforms.html" rel="nofollow">https:&#x2F;&#x2F;www.mathworks.com&#x2F;help&#x2F;images&#x2F;image-transforms.html</a><p>MATLAB (or GNU Octave which is free) is the only language I&#x27;ve used that maps abstractions to code in close to a 1:1 fashion. I think of code bloat as roughly these orders of magnitude:<p>Math&#x2F;Matrix languages (MATLAB) 1:1<p>Scripting languages (JavaScript, PHP, Python, etc) 10:1<p>Bare metal languages (Rust, C++, Assembly) 100:1<p>Unfortunately I have yet to find a functional programming language that is 1:1 in the same way that MATLAB is. One would think that Lisp&#x2F;Haskell&#x2F;Scala&#x2F;Julia&#x2F;Clojure&#x2F;Erlang would be concise. But in practice, I&#x27;ve found them to generally be write-only languages that are quite difficult to grok. The only thing that comes close is spreadsheets, but due to their 2D nature, they can&#x27;t really scale beyond a certain level of complexity. Honestly, I think that the lack of adoption of functional programming languages (due to their own obstinance) is one of the great problems of our time.<p>Anyway, for the past 5-10 years or so, I solve most problems in my head in a data-driven way that looks like a hybrid between MATLAB and spreadsheets, piping data between classes written in an Actor model style (I learned this from a very good teacher during a contract at HP). I use rules of thumb like no mutable data (stored state), mostly higher-order functions, and framing concepts in terms of transformations rather than class inheritance. Then I translate that to whatever language I have to use for the client, which is probably PHP, JavaScript or C# (Unity).<p>I highly recommend this sort of approach for keeping abstractions separate from implementations. Unfortunately since nobody else seems to follow this method, it makes for some friction in the workplace. People talk past me all of the time because they don&#x27;t realize that I&#x27;m coming from this place of experience. They don&#x27;t see the need for this clean separation when they are &quot;trying to get things done&quot;. They may get things done faster, but if you want bug-free implementations, this is the way to go IMHO.<p>Edit: I&#x27;m on the fence about TensorFlow. It&#x27;s arguably more advanced than MATLAB, but vastly more opaque. So I&#x27;m not sold on any advantage it provides, other than perhaps better performance or usefulness in certain domains like machine learning. Oh and any perceived lack of performance with MATLAB is an implementation detail. I can&#x27;t understand why it&#x27;s not fully parallelized and running on the GPU by now.
rsync将近 5 年前
&quot;Explain Like I&#x27;m Five&quot;<p>Oh my god - are you all right ? Where are your parents ?