How to reduce the memory usage of the Cobalt - cobalt

We want to use the Cobalt to run YouTube application on our STB with only 256M in memory. Whether YouTube application supports 720P resolution or reduces application specifications, such as reducing image resolution, removing animation effects, etc., to reduce the use of cobalt memory.Could we reduce the use of Cobalt memory in the way of YouTube application?
Thanks!

For information on memory tuning see https://cobalt.googlesource.com/cobalt/+/master/src/cobalt/doc/memory_tuning.md.

Related

How to measure the performance of an Ionic 3 app?

I have developed an app using Ionic 3 framework. I would like to measure the CPU and memory usage of my app. What is the best practice to do so?
You must not use AndroidStudio and XCode to measure the memory usage of the Ionic app.
Why? Here is the comment from Ionic team member
Unfortunately we have not been able to reproduce this issue on our
end. Would you mind checking your app on your device with safari dev
tools instead of the memory tool in xcode? The reason I recommend this
is because the xcode memory tools can be misleading in the fact that
it's not actually measuring memory usage of the javascript heap of the
app, instead, it is reading the memory used by the kernel / OS itself.
So based off the same concept I described here, the OS will not free
up memory used by the JS virtual machine if it 1. thinks the action
that used that memory is going to happen often and 2. thinks that it
has plenty of memory to spare. So, while the JS heap memory will be
shrinking every time the JS engine runs garbage collection, that does
not mean that the memory that iOS has allocated to the browser will
shrink, and, if iOS did start freeing up memory when it has plenty of
memory available you would actually see performance issues. Also, it's
important to remember that high memory usage does not === a memory
leak and in fact operating systems are built to take the most
advantage of the resources (in this case ram) available to it,
especially on mobile devices.
Tools:
Safari dev tools
Chrome dev tools

Use GPU profiler (for example CodeXL) together with PyOpenCL

I have my complex PyOpenCL app with a lot of buffers creations, kernel templating and etc. I want to profile my app on GPU to see what is the bottle neck in my case.
Is it possible to use some gpu profiler with PyOpenCl app? For example CodeXL.
P.S. I know about event profiling but it isn't enough.
Yes, it is possible. Look here: http://devgurus.amd.com/message/1282742

Is direct video card access possible? (No API)

I'm now a bit experienced with using OpenGL, which I started using because it's said that it is the only way to invoke video card functions. (besides DirectX - which I like less than OpenGL)
For programming (e.g. in C/C++) the OS gives many APIs, like functions for printing. But these can also be bypassed, by coding in Assembly-language - and call much lower level APIs (which gain speed) or direct CPU calls.
So I started wondering why this wouldn't be possible on the video card. Why should an API like OpenGL or DirectX be needed? The process going on with those is:
API-call >
OS calls video card (with complex opcodes, I think) >
video card responses (in complex binary format) >
OS decodes this format and responses to user (in expected API format)
I believe this should decrease the speed of the rendering process.
So my question is:
Is there any possibility to bypass any graphical API (under Windows) and make direct calls to the video card?
Thanks,
Dennis
Using assembly or bypassing an api doesnt automatically make something faster, often slower as you dont know what the folks that wrote the library know.
it is absolutely possible yes, those libraries are just processor instructions that poke and peek at registers and ram, and you could just as easily poke and peek at registers and ram. The first problem is can you get that information, sure, you can look at the linux drivers or other open source resources. Second, much of the heavy lifting today is done in the graphics chip by logic or graphics processors, so the host is just a go between and not necessarily the bottleneck if there is a bottleneck. And yes you can program the gpus depending on your video card/chip, etc.
You need to determine where the bottleneck really is, if there really is one, maybe the bus is your problem, maybe the operating system is your problem, or the compiler, or the hard disk or the system memory, the processor and architecture itself, caches, etc. At the same time how will you ever learn how to find these things unless you try.
I recommend getting rid of windows completely, no operating system, go bare metal. Take the linux and other open source resources plus anything you can get from the vendor and get closer to the metal. You will also need a lot of info about the pci/pcie bus and bridges, dma controllers, everything in the path. If you dont want to go that low then use linux or bsd or some other command line environment where it is well known how to take over the video system, and take over the video system while retaining an operating system and a development environment (vi/emacs, gcc).
if that is all way too advanced, then I recommend, dabbling in simple gpu routines to get a feel for how the video card works at least at some level and tackle this learning exercise one step at a time.

mix 2 real webcam into a fake webcam

i need to get the streaming from 2 webcams on the same computer, and mix it as a fake webcam (so then i can use the fake webcam on any software).
I have seen that camcamx is for mac, webcamstudio is for linux, but i need a solution for windows and i can't find it, so i was thinking to write my own small app.
I can program with C#, Java and lazarus, but examples or library or whatever in any language will help anyway.
i will need to make a fake webcam that can be used as a webcam (detected on my computer as a usb webcam), and some code to grasp the stream from two real webcam and mix everything together (there will be like a primary webcam that will be bigger and a secondary webcam that will be smaller, on a corner of the big image)
Anyone can help me on that?
This is not a trivial exercise but it can be done. I know because I've done it before. :)
I implemented this in C++.
What you need to do is to create what's known as a shared memory server. A shared memory server is a region of ram that more than one process can access. Here's how to create one using Named Shared Memory under Windows:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366551(v=vs.85).aspx
In your application that mixes the video from the two cameras, you need to create a DirectShow rendering filter (CBaseRenderer) that writes the mixed video frame into this shared memory.
On the other end, you need to create a separate Visual Studio DLL project that will implement a DirectShow capture filter (CSource and CSourceStream) that will read the video bitmaps your main application writes into this buffer. This VS project needs to be a registerable DLL that can be called to register it as a DirectShow capture device for windows.
Your main application will create and maintain this shared memory buffer when it is operating. If another application (like a video conferencing program) accesses the capture device, all that will come from the device will be a blank buffer until you main application stars feeding real video frames into it.
Tip #1: Since this is a multi-threaded operation, you will need an event handle to signal the capture filter that a frame is ready. You will also need a mutex to control access to the buffer by the "rendering" thread in your application and the "capture" thread in the capture device.
Tip #2: You won't need to call UnmapViewOfFile or CloseHandle on the memory pointers until the rendering or capture filters are disposed.
There is a lot of code you will need to grind out, so any useful examples will be beyond the scope of this discussion. This should get you going in the right direction. Good luck!
I think your question is too far out of scope for what this site is all about. You're talking about thousands and thousands of lines of code and intimate knowledge of drivers, video decoding, mixing, etc., etc. if you're going to write this software on your own.
With that said, there probably is software for this for Windows. I'd start here:
http://alternativeto.net/software/webcamstudio/
Capture video from real webcam: Video Capture on MSDN
Fake webcam: the well known starting point is Vivek's sample/project available at http://tmhare.mvps.org/downloads.htm, see also this post "Fake" DirectShow video capture device
Getting all together is doable, though not trivial.

What are the APIs for hardware accelerated video decoding in phones?

I have seen many smartphones coming with hardware accelerated video decoding supporting mpeg2 and h264, but unlike in desktop and laptop systems, it is not clear to me how to interact with the hardware acceleration.
For desktops/laptops there is DXVA, VDPAU and OpenMax.
Is any of those supported in Mobile phones? I think OpenMax is, but I am not sure of how widely supported it is.
Is anyone familiar with what is usually used to write hardware accelerated media players and decoders for platforms like Snapdragon, Tegra 2 or Omap 4 running Android or Windows Phone?
I know that ffmpeg can be compiled for arm and I wonder what kind of hardware video acceleration it supports on that platform.
For ARMs, these are going to be vendor specific based on the silicon. I've seen some offer speedups by integrating subsets of the video decoding algorithms in hardware and you need to set up special registers to point to the data, flip a bit to go and wait for the output.
I think the majority of these though are going to be APIs to whatever embedded GPU is being used (Nvidia's Tegra, PowerVR SGX). I don't know a whole lot more about these, because they usually require NDAs and all you get is a header file and a ELF binary.
OpenGL ES seems to be supported pretty much everywhere.

Resources