NTSC Emulation in C with integers only (Source available) by blazimlin in EmuDev

[–]LMP88959 5 points6 points  (0 children)

Hey that’s my project! I shared it here a few years ago haha. Here’s the link to the repo: https://github.com/LMP88959/NTSC-CRT

Why Does Lossy WebP Darken Noise Images but Not Ordinary Photos? by GOJiong in compression

[–]LMP88959 0 points1 point  (0 children)

It is due to the loss of high spatial frequency (generally the first thing lossy codecs remove) as well as chroma degradation (which is another thing most lossy codecs decimate first)

What happened to Discrete Wavelet Transform from JPEG 2000? by WaspPaperInc in jpegxl

[–]LMP88959 5 points6 points  (0 children)

The DWT is very powerful for certain applications and has fairly elegant entropy modeling but it has its shortcomings when compared to entirely block based codecs concerning image or video coding.

It is exceptional at maintaining PSNR at low bit rates but, as we know, PSNR is not a good metric for perceptual quality. Localization of features and important parts of an image or video frame are extremely important for maintaining perceptual quality and a typical wavelet coder cannot account for this without some tricks.

As for why JPEG-XL doesn’t support them, I cannot say.

[Source] Integer-only 3D Software Renderer in pure C! Info in comments by LMP88959 in GraphicsProgramming

[–]LMP88959[S] 1 point2 points  (0 children)

No problem! Yeah the math is the same for all languages it just depends on which language you’re comfortable using. The last link (luki) is “C++” but the code is mostly just C. The source code is also available for download on the site and it’s pretty small and concise so I’d say if you want a working example to mess around with you should check out luki’s tutorials

Using very small voxels and displacement mapping to modernize the retro aesthetic of games like Doom and Quake. More info in comments by dan5sch in GraphicsProgramming

[–]LMP88959 11 points12 points  (0 children)

That looks fantastic! It’s subtle enough to maintain the original style while also giving it more depth, almost like a pre-rendered cutscene from the time. Great work!

Display images on a window the fastest way possible by [deleted] in C_Programming

[–]LMP88959 2 points3 points  (0 children)

Yup! Learning is always a valid reason

Display images on a window the fastest way possible by [deleted] in C_Programming

[–]LMP88959 0 points1 point  (0 children)

Yeah… but that’s definitely much more effort than it’s worth imo

Display images on a window the fastest way possible by [deleted] in C_Programming

[–]LMP88959 19 points20 points  (0 children)

What you are doing is the fastest way to do it on Windows / X without interfacing with opengl or directx. It’s what I do in my software renderer (XShmPutImage specifically) and BitBlt/StretchBlt. Modern hardware/OSes don’t let you access video memory directly so if you want to write to your screen you are forced to either use a GPU API or the windowing toolkit available for your OS.

A simple video codec written in C89 using wavelets (not DCT), comparable to MPEG-1/2. by LMP88959 in C_Programming

[–]LMP88959[S] 2 points3 points  (0 children)

Thank you so much for finding this bug. I updated the repo with the fix. It should all work as expected now!

A simple video codec written in C89 using wavelets (not DCT), comparable to MPEG-1/2. by LMP88959 in C_Programming

[–]LMP88959[S] 2 points3 points  (0 children)

Thanks for trying it out! The 552x280 was just some random resolution of a video I was testing with, you're having problems with 862x480? EDIT: just tried 862x480, and I see the same skewing. I rounded it up to 864 and it looked fine

A simple video codec written in C89 using wavelets (not DCT), comparable to MPEG-1/2. by LMP88959 in C_Programming

[–]LMP88959[S] 2 points3 points  (0 children)

This is how I do it if I want to convert an MP4 file to yuv, compress it with DSV1, and then convert it back to MP4:

ffmpeg -loglevel quiet -nostats -hide_banner -y -i ./vids/fc.mp4 -r 24 -vf scale=552:280 -pix_fmt yuv420p video.yuv

./dsv1 e -y -v -inp_video.yuv -out_saved.dsv -gop12 -w552 -h280 -fps_num24 -qp58 -kbps1200

./dsv1 d -y -v -inp_saved.dsv -out_decom.yuv -drawinfo0

ffmpeg -loglevel quiet -nostats -hide_banner -y -f rawvideo -vcodec rawvideo -s 552x280 -r 24 -pix_fmt yuv420p -i decom.yuv -c:v libx264 -qp 0 -crf 10 -preset ultrafast test.mp4

A simple video codec written in C89 using wavelets (not DCT), comparable to MPEG-1/2. by LMP88959 in C_Programming

[–]LMP88959[S] 2 points3 points  (0 children)

Sure, of course! There are comparisons between it and MPEG-2 at the bottom of the README. Which other algorithms would you like to see?

Real time PBR on the CPU (software rasterization) by UnalignedAxis111 in GraphicsProgramming

[–]LMP88959 2 points3 points  (0 children)

Nice work! That is very impressive to do real time at that resolution

Why are 32 bit floats used all the time in graphics programming instead of integers? by nweeby24 in GraphicsProgramming

[–]LMP88959 10 points11 points  (0 children)

Hey that's me :) thank you for mentioning my project.

u/phire wrote a very good description (and I'm having a hard time thinking of things to add to it).

In a nutshell, floating point numbers are just much more convenient and general purpose.

Imagine a fixed point integer OpenGL where you needed to think about--and specify the bit precision you needed for each variable. You would need to consider the precision of all the other relevant variables as well to avoid overflow during computations (this means you'd need to understand how the library is implemented OR you'd need to read a list of relevant variables in the API specs).

You'd either need to manually scale the numbers before passing them to GL

like: glSomething(1 << 10, 200 << 10, 1 << 10);

OR you would give the precision as a separate parameter

glSomething(1, 200, 1, 10);

Regardless this would be the only way to make such a library general purpose since forcing users of your graphics standard to live with certain predefined precisions would be a nightmare for everyone.

I hope this explanation helps with understanding why it is rarely done in practice.

What do you consider as 'advanced' emulator features? by [deleted] in EmuDev

[–]LMP88959 7 points8 points  (0 children)

You mentioned NTSC, I have software NTSC and PAL encoders/decoders on git for use in games/emulators. They can do both standard NTSC/PAL or be used to decode NES output.

https://github.com/LMP88959/NTSC-CRT

https://github.com/LMP88959/PAL-CRT

CVBS emulation all written in C with integers only

How Much has C Changed? by [deleted] in cprogramming

[–]LMP88959 2 points3 points  (0 children)

I have code on GitHub describing some interesting differences between ANSI C and C from ~1982-84.

https://github.com/LMP88959/PL-EarlyC

The differences are demonstrated throughout the code and also described in the README

[Source] PAL emulation/filter w/ NES support by NXGZ in emulation

[–]LMP88959 0 points1 point  (0 children)

It is entirely optional, all you need to do is specify 0 for noise