Fractal based Image compression algorithm (and source code) - math

I am looking for a decent fractal based compression algorithm for images. So far I only find dead links to the FIF image format and dead links pointing to Iterated Systems Inc which then became MediaBin which then became nothing from what I can see.

The source files in ANSI C (enc.c and dec.c) for PIFS (i.e. partition iterated function system) are available on the website of Fractal Image Compression: Theory and Application to Digital Images book.

I think you should take a look at the Fiasco library. You can find an old article about it on Linux Journal.

The "nanocrunch.cpp" source code, implementing, yet another variant on fractal image compression, was developed by "Boojum", and is the top answer to another Stack Overflow question: Twitter image encoding challenge .

Related

QR Code Recognition in AGV (Auto Guided Vehicle)

I have some questions.
The first question is which equipment should be used to recognize QR Code.
I'm thinking of two things.
The first is the QR code Scanner used in the industrial field.
The second is the camera module. (opencv will be used)
However, the situation to consider is that it should be recognized at the speed of 50cm/s.
What do you think about?
And if I use a camera, is there a library that you can recommend to recognize QR Code? (C/C++ only)
Always start with the simplest solution and then go more complex if needed. If you're using ROS/OpenCV, OpenCV has a QR Code scanner, ex. Other options include ZBar, quirc, and more, found by searching github or the internet.
As for a camera, if you don't need the intrinsic matrix, then you only need to decide on the resolution: more resolution takes (non-linearly) longer to compute, but less resolution prohibits seeing the objects well.
Your comment about "recognize at 50cm/s" doesn't make much sense. I assume you mean that you want to be able to decode a QR code that's up-to 50 cm away, and do it in less than a second (to have time to stop). First you'll have to check if the algorithm, running on your hardware, can detect the QR code at different desired distances, and how that changes with scaling the image up/down in OpenCV. Then you'll have to time how long it takes to detect/decode it at those distances/resolutions/scales. If it fails to be good enough, you can try another algorithm, try different compilation settings, perhaps give it it's own thread, change the scaling on the image, accept the limitations, or change the hardware.

TLB structure in intel

I started from Patterson & Hennessy book with basic definitions and then followed the intel programming reference documents for more information about TLB.
From the intel documents i got to know the high level design of TLB.
such as line size, associativity and levels of caching. But in need a detailed explanation of how TLB caching works with respect to cache misses and its replacement mechanisms in modern CPU. What pages moves
to L2 TLB from L1 TLB ? how many pages can a single entry in TLB address? How many entries are present in TLB ? (In particular DTLB)
Any Information or references will be of great help to me.
(If this is not the proper forum for this question, please suggest the right one)
Thank you.
TLB can be called a translation cache and thus, its functioning is almost as that of on-chip caches, e.g., the tradeoffs of exclusive/inclusive hierarchy, multi/single-level, private/shared are same as that in cache. Same for associativity, page size, etc.
One TLB entry only maps one virtual page to physical page, but the page size can be varied, e.g., instead of 4kB, a processor can use 2MB or 2GB, which is called a superpage or hugepage. Or a processor can use multiple page sizes.
Since you are asking for reference, see my survey paper on TLB which answers all these questions and reviews 85+ papers. Specifically, section 2 of the paper references papers that discuss TLB designs in commercial processors.

What is the status of Microsoft Media Foundation?

Microsoft Media Foundation (MF) was introduced as the successor of DirectShow in Windows Vista. I have mostly ignored it, but it has some features (such as decoding of WMV AC-1 files) which are hard to implement in DirectShow. Media Foundation is also a more modern API so it would seem logical to make the switch.
However, the online teaching resources and official documentation seem greatly lacking. There is only 1 book covering the topic (published by Microsoft) and it is no longer available for normal prices. (People charge $500,- or more for second hand versions.)
As far as I could find there are no other books. While other techniques from Microsoft are usually covered in multiple books by multiple publishers.
The official Media Foundation blog has not been updated in since 2011. In the two years that it was active only 10 technical articles were written, 5 of which covering error logging/tracing instead of actual functionality.
The StackOverflow tag ms-media-foundation is only used with 328 questions, of which 142 are unanswered. In contrast there are 1641 DirectShow questions of which only 496 are unanswered.
So what happened to Microsoft Media Foundation? Will the new API ever take off and replace DirectShow or has even Microsoft forsaken MF in favour of going back to the old and rusty (trusty?) DirectShow. Or is there maybe another, non Microsoft framework, that has taken over?
Firstly I don't know the answer and am someone who has spent way too long trying to get even basic Media Foundation scenarios working; at times it feels more like a quest in search of some long lost secret scripture than programming.
My suspicion is that Microsoft does want to make MF the standard media API for the Windows platform and perhaps the best indication is the Windows Universal App Samples where there are 7 instances of "mfapi.h" but zero instances of "dshow.h". Also the relatively new WPF MediaCapture and MediaElement controls do hook into the Media Foundation APIs so it seems safe to say that for all new work Microsoft are using MF instead of DirectShow.
Wow I see what you mean about Polinger's MF book! I have the book (which I'll now shortly be selling at that price) and can assure you it's definitely not worth it. I've never really found it much help despite re-reading it numerous times. It's pretty much the same as the online docs in that it sticks to a small number of specific scenarios (in fact a number of chapters in the book just re-print the SDK samples) and as soon as you need to do something outside those you are on your own.
In regards to the official MF blog there was a thread on the MSDN forums griping about thing and to which one of the Microsoft guys responded saying they have switched blogging platforms (it obviously would be nice if they could put a note indicating that). Apparently a number of the Microsoft MF devs are still blogging. This seems to be the most "active" one.
Update: If anyone happens to get drawn here due to the Polinger book reference note that the companion code can be downloaded from here (the original link quoted in the book is http://go.microsoft.com/FWLink/?Linkid=229072 which at the time of writing redirects to the aforementioned page).
For me, Media Foundation is really a very nice API to do multimedia programming.
What I can blame, is that Media Foundation's releases don't apply to Windows 7, currently the most popular OS in the world.
Media Foundation has a lot of competitors (DirectShow, Ffmpeg, Gstreamer, etc...). So, more choice, less developers, less tutorials and so on...
I try to promote this API as i can, so here is my work on Media Foundation : MFNode
I cover a lot of scenarios, and you have to check source code to learn.
You will find :
audio/video player (win32)
custom media session
sequencer source
audio/video capture
screen capture
kinect V1 capture
wave audio mixer
http streaming (winsock)
jpeg encoding (Gdiplus)
dxva2 technology
cuda decoding
directX9 renderer and shader
COM technology
different kind of mediafoundation Source, Sink and Transform (mpeg2, flv, a52, vp6...)
mp3 to wave transcoder
EDIT
More MediaFoundation code here : github mofo7777
I suspect one reason for MediaFoundation not being used as much is that it limits you to encoding in WMV format only, and limits your ability to decode too (you can decode more than just WMV, but even the old VFW from Win 3.1 days allowed you to select a compressor of your choice)
The even rustier and older VFW (video for windows) is simpler than all of them latest and greatest, and allows multiple compressors - so I am wondering if MediaFoundation will ever be updated to allow more compressors and decompressors (or encoders and decoders) than the very limited selection they offer.
MediaFoundation API's, although interfaces, seem pretty low level still, and requires lots of boiler plate code just to get basic things working - powerful for WMV production, as they give you plenty of tools - but, a little bit hard to use for doing basic tasks (best is to download wrappers around the API, which to my surprise, not many exist.. these API's are not so popular as you would think).

is there any tool to figure out the memory occupies by the swf?

Well i am not asking about the tool to compress or measure the size of swf file , i need a tool that can show me how many bytes or mbs, my swf is using ??
You mean a profiler, and yes there are a few options.
First I would recommend using FlashDevelop to er... develop your Flash software. It has a great profiler that can show you memory usage over time and also give you a live rundown one how much memory each object is using and how many of an object type exists (great for finding memory leaks).
There is also De Monster Debugger. For a great video tutorial that covers the basics see Lee Brimelow's - Debugging with MonsterDebugger.

Actionscript PNGEncoder performance and UI blocking

I'm trying to use PNGEncoder to encode a bitmapData object into a png ByteArray so I can send the data to the server. Everything would be peachy except the bitmapData is 4000x4000px and when I run the PNGEncoder.encode function on it the whole app stops (UI is blocked) for 5-8 seconds while it runs. Does anybody have any suggestions on how to not make it block so bad, I read about chunking up the process (since you can't multithread in AS3) but can't find any sample code on chunking up the process.
Thanks,
Sam
In addition to Arthur's comment, you could also write it in C/C++ for Alchemy, since alchemy supports green threads. Like PixelBender, Alchemy also requires Flash 10.
There are mainly two ways to do this.
a) Use pixel bender:
You can off load the work to pixel bender (a shade like language in as3). This has the advantage of using the gpu on some cases, but it also is assynchronous and non blocking (runs on another thread). But it does require player 10+. I haven't seen a pixel bender png encoder, and to be honest, it may not be possible (I am not familiar enough with png encoding to tell), but it might be an option. This is, performance wise, the best you can get. More info here
b) Use chuncking. Basically, you rewrite the encoder to encode blocks (lines, columns or a smaller area), and hook that to an enter frame event, each frame you'd call next on your encoder, until there is no more encoding to do. Zeh has a neat LWZ chunked encoder with source code that might give you insights into the details.
Cheers
Arthur
Another shameless plug!
You can use my recently completed PNGEncoder2 library (also requires Flash 10+), which handily supports gigantic images. It does proper asynchronous encoding, with no single compression step at the end. Additionally, it's really fast ;-)
Grab it from GitHub (README), and check out the benchmark comparing it with other encoders on my blog post.
It's highly tuned for speed, and uses the Alchemy opcodes and domain memory to speed it up (thanks to Haxe), so it should be comparable to anything you compile using Alchemy.
You could encode multiple PNG files separately and send them to the server. Once on the server you can reconstruct the larger image.
It's for JPEG encoding, but should be useful - look a this post http://segfaultlabs.com/blog/post/asynchronous-jpeg-encoding/
As Arthur Debert said, you can use chunking. I'd suggest that instead of encoding once/frame, you try a setTimeout( chunkingFunction, 0 ); approach. A timeout with a 0 ms delay will happen as soon as possible, allowing the chunking to process quickly but without crushing the UI.

Resources