|
|
How was it in the JSOP's thread the other day about the "I told you so"?
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
|
I've been building a tiny graphics library for IoT devices to supplant Adafruit's offering which is huge, especially if you want jpeg loading support, and I think might be tied to the Arduino framework.
I've been working on JPEG decompression all morning with the idea that I would take a std::istream and a std::ostream in jpeg::convert() . (There is no load() function because there's no memory for that on these devices)
Come to find out, JPEG decompression returns a series of rectangles - i'm not sure of the dispersal/locality of them yet - but I can't produce for example, a 16-bit color depth bitmap stream (which expects pixels left to right, top to bottom) with something that takes rectangles without allocating enough memory (depending on the locality) to hold much, if not all of the buffer.
*headdesk*
*headdesk*
*headdesk*
I've already got 80% of it implemented and I'm asking myself how I got that far without realizing this fairly obvious problem.
Real programmers use butterflies
|
|
|
|
|
Read the title and I thought you actually shot your foot off.
Glad you are alright.
|
|
|
|
|
FWIW, that's a side-effect of how the image is processed. It isn't scanned left-to-right, top-to-bottom. It is scanned in a diagonal traversal pattern and that results in the rectangular sections that you saw. That scanning pattern results in better compression of the data than plain, old, horizontal or vertical scanning.
"They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"
|
|
|
|
|
Yeah, and since I was adapting the decompression algorithm from some other code, I should have put two and two together well before I did, hence my frustration.
Real programmers use butterflies
|
|
|
|
|
But not your deputy
modified 5-Apr-21 21:01pm.
|
|
|
|
|
|
If it's any consolation, a couple of years ago I spent days designing a C# system that was so elegant and beautiful it would have been a doddle to implement and update.
Only to remember that for very good reasons you can't override static functions and the whole damn thing was a pile of cr*p.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Quote: you can't override static functions Damn! Didn't occur to me. Must remember that!
Get me coffee and no one gets hurt!
|
|
|
|
|
Wouldn't the design work if you simply made the functions non-static so that you could override them?
|
|
|
|
|
static functions are great for async/thread-safe work, but I have not really used them for anything else.
|
|
|
|
|
No, part of the whole plan was that the static methods returned a collection of the derived class only - and if you need an instance it gets messy. And you can't cast a List<X> to List<DerivedFromX> without creating a new colection ... which gets inefficient, and that means you can't alter it (such as adding a new one).
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I wish you'd told me that a month ago - I've wasted a couple of weeks trying to do exactly the same thing
|
|
|
|
|
Know your tools!
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Look at it the good way : you've spared 20% of the effort !
|
|
|
|
|
|
So what's plan B: Give up on modern compression and fall all the way back to bitmaps or .pcx (run length encoding)? Flail the CPU to death repeating large chunks of the decode while throwing away all data not needed for the current scan line only to repeat?
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
I've reverted to using callbacks which report a rectangle of bitmap data at arbitrary locations throughout the logical size of the jpeg's bitmap plane.
I also solved the stream problem by seeking but there's another problem where the bitmap data isn't being written.
This is temporary. I found the problem. The problem is std::ostream is not calling std::strstreambuf.xsputn which is frustrating me to no end.
And then I saw the template bloat introduced by iostreams even as little as I was using them and I decided to write my own stream class. I'm building io::file_stream and then i'll build io::memory_stream, and then I'm good - hopefully it all works after that.
Real programmers use butterflies
|
|
|
|
|
Would eyeliner that tasted good be Chicken Tikka Mascara?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You'll rouge the day you thought of that shadowy comment!
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Instead of sticking to your ribs, it would stick to your lips.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Possibly resulting in "a schmeer" without a bagel.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
That wasn’t a great line.
That wasn’t a terrible line.
It was a Maybe-line!
If you can't laugh at yourself - ask me and I will do it for you.
|
|
|
|