Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Human brain is two separate organs, Stanford Medicine-led research finds(stanford.edu ↗)
    107comments
  2. AI-generated posters don’t have to be horrible(john.hartnup.uk ↗)
    103comments
  3. If math is more than proof, we need to better celebrate the rest of it(terrytao.wordpress.com ↗)
    83comments
  4. GPT-6 Astra Solves a WWI German Radio Cipher(prinzai.com ↗)
    64comments
  5. Android 17 is the first since 3.x to add new APIs without releasing to the AOSP(grapheneos.social ↗)
    435comments
  6. San Francisco Onion Futures Company(onionfutures.com ↗)
    72comments
  7. “The Secret Life of Circuits” is here(coredump.cx ↗)
    17comments
  8. Apple M6 Pro Achieves the Highest Single-Core CPU Score in Geekbench 7(geekbench.com ↗)
    49comments
  9. Cloudflare Quick Tunnels(cloudflare.com ↗)
    285comments
  10. SDCC – Small Device C Compiler(sourceforge.net ↗)
    18comments
  11. How to Write with an LLM(sockpuppet.org ↗)
    338comments
  12. Science Is Open Software(jepedersen.dk ↗)
    39comments
  13. Saving another 100TB of RAM(cloudflare.com ↗)
    81comments
  14. You can run Git on object storage if you re-make packfiles(tigrisdata.com ↗)
    15comments
  15. Why building a Rust LSP is hard(rust-glancer.github.io ↗)
    32comments
  16. How OpenAI Used Its Own LLMs to Design Its Jalapeño Chip(ieee.org ↗)
    92comments
  17. Ctenophores: Wonders of Biology(quantamagazine.org ↗)
    6comments
  18. NASA-IBM Lunar Foundation open-Source Geospatial AI Model(usra.edu ↗)
    2comments
  19. The first new cat species discovered in 100 years(nationalgeographic.com ↗)
    106comments
  20. OpenJev(openjev.com ↗)
    267comments
  21. Goroutine Leak Profiles(go.dev ↗)
    4comments
  22. Communication by means of modulated Johnson noise(pnas.org ↗)
    1comments
  23. Show HN: Cactus Needle 3: 8-29MB automation models can match DeepSeek V4 Flash(cactuscompute.com ↗)
    89comments
  24. Photon-Emission-Guided Laser Fault Injection Enables RP2350 Secure Debug(ledger.com ↗)
    73comments
  25. Dear Customer, Fuck You(fuck-off.ai ↗)
    discuss
  26. Typesafe-computer-use drives a Mac toward a goal for 1/50th of a cent per step(github.com/awlevin ↗)
    54comments
  27. Veronese's Dogs(publicdomainreview.org ↗)
    1comments
  28. Cache-to-Cache: Direct Semantic Communication Between LLMs (2025)(arxiv.org ↗)
    13comments
  29. Warez: The Infrastructure and Aesthetics of Piracy (2021)(archive.org ↗)
    72comments
  30. Inside ZCode: Silently uploading your Git history to the cloud(ferstar.org ↗)
    100comments

Minih264 – Minimalistic, single-header library for encoding H264/SVC

131 pointsby 8y agogithub.com
22 comments
8y agoHN ↗

Very impressive, kudos. I'd like screenshots rather than PSNR and SSIM because those don't translate into human perception of a good encode.

The only grip I have is the 13k lines of C + intrinsics.

8y agoHN ↗

That's most DSP code. Take a look at FFTW or SOKit.

8y agoHN ↗

I've add screenshot of first intra frame and x264.264 to compare in players.

8y agoHN ↗

The only grip I have is the 13k lines of C + intrinsics.

How are you supposed to get acceptable performance without intrinsics?

8y agoHN ↗

Especially if it's meant to be an educational and in any case non-realtime encoder, intrinsics are not really necessary and make the code less portable.

I also wonder how much the compiler can do autovectorisation on code like this --- it's pretty much exactly the type of code that autovectorisation is intended for.

Edit: I noticed in the benchmark that it compressed the 10s foreman.cif (demo video) in half a second, so it's already 20x faster than realtime on that small resolution.

8y agoHN ↗

It's also single core comparison. Multi-threaded encoding is supported too: with 4 threads I get 0,190s for minih264 and 0,135s for x264.

8y agoHN ↗

These types of encoders are very useful, and I hope to see something in this style emerge for AV1 (an encoder which produces reasonable quality in real time on commodity CPUs, using the appropriate subset of bitstream tools for that job).

8y agoHN ↗

Wow. The MP3 decoder that just appeared on HN ( https://news.ycombinator.com/item?id=18046114 ) is impressive enough, this is even more amazing --- especially given the fact that the standard doesn't detail how encoding works, only decoding.

The fact that a single person can write a working H.264 encoder is very inspirational, in the same way as tiny C compilers and the like --- writing software which is commonly thought of as being impossible for a single person to accomplish in a reasonable amount of time really gives a better idea of the actual minimal complexity to those studying such software.

8y agoHN ↗

Encoding can work however you like. The important thing is that the output complies with the standard.

It's nice to have a reference implementation, but it's not like that's the only way it can be done.

8y agoHN ↗

The important thing is that the output complies with the standard.

That's a good point --- you can write an H.264 encoder that doesn't compress at all, and as expected, the amount of code to do so is quite small:

https://cardinalpeak.com/blog/worlds-smallest-h-264-encoder/

However, minih264 may currently be the smallest encoder that does compress.

8y agoHN ↗

Nice job!

Please forgive my poor understanding of C, but is it possible to add the missing features as extra options/files/headers so you can pick and choose which features you want to enable and/or include?

8y agoHN ↗

There already defines to include\exclude features: H264E_MAX_THREADS=n, H264E_SVC_API=1, MINIH264_ONLY_SIMD. Complete documentation still in progress and subject to change. For now only comments in minih264e.h and minih264e_test.c can tell how to use it.

8y agoHN ↗

Cool, thank you for replying, I appreciate that.

8y agoHN ↗

I found this very interesting, particular the comparison to x264 (which I had never heard of).

Looking into it I found x264 looked really easy to use with a nice C api but was encode only - does anyone know of a library very similar to x264 which is both encode/decode?

8y agoHN ↗

It has very limited support for H264 advanced profiles that are usually used, which is a down side. I was honestly surprised about the lack of a good decode library.

8y agoHN ↗

Isn't ffmpeg's libavcodec a good decoding library?

8y agoHN ↗

Unless you cannot use GPL, I suggest to use x264 for encoding. It is simply the best there is. There is nothing similar to it.

8y agoHN ↗

Very impressive. Nice work!

I’ve been learning a lot about h264 and h265 recently, and I’ve read that hevc is somewhat more straightforward to decode. Is that true? I might try writing a decoder for it.

8y agoHN ↗

Apologies for the OT question, but does anybody know why the foreman video clip is used as a standard test sequence for video encoding? Thanks in advance!

8y agoHN ↗

Thanks for taking the time to reply, and I got a good chuckle out of the 4k "remake" :)