- October 31, 2006
- 1,972
- 539
- Home Country
- Germany
Hi,
while working on the Atmolight plugin (see here https://forum.team-mediaportal.com/...in-update-13-01-2010-v1-1-a-75840/#post557386) i noticed that the current method in the framebuffer always copies the whole image from the GPU which is a big CPU eater.
Even more when you think about 1080i/p video content.
In most cases it is enough to get only a small portion of the screen (e.g. for black bar detection) or get a smaller, resized image like e.g. in my case.
I tried many different ways to capture the current screen content but the framegrabber was the only solution since it gets feeded directly by PlaneSurface.PresentImage(...).
To give Plugin developers the freedom of choice how they would like the current image i made the attached small patch.
It just exposes an OnNewFrameEvent from the framegrabber, where the current image is handed over before it's processed by the framegrabber itself.
It's just a very small patch and until this event is not hooked to any code it won't be used anyway but maybe of great help to take CPU load from the framegrabber.
Ok, I know, we have a feature freeze but this is not really a feature - it helps to reduce CPU load in MP if used by a plugin and if not it doesn't have any effect or side effect at all.
This is a bit like begging - but please vote for "yes" because otherwise my (and probably that of many other) Atmolight Hardware will never run smooth with MP
So, what do you think?
Please vote
The patch is here
while working on the Atmolight plugin (see here https://forum.team-mediaportal.com/...in-update-13-01-2010-v1-1-a-75840/#post557386) i noticed that the current method in the framebuffer always copies the whole image from the GPU which is a big CPU eater.
Even more when you think about 1080i/p video content.
In most cases it is enough to get only a small portion of the screen (e.g. for black bar detection) or get a smaller, resized image like e.g. in my case.
I tried many different ways to capture the current screen content but the framegrabber was the only solution since it gets feeded directly by PlaneSurface.PresentImage(...).
To give Plugin developers the freedom of choice how they would like the current image i made the attached small patch.
It just exposes an OnNewFrameEvent from the framegrabber, where the current image is handed over before it's processed by the framegrabber itself.
It's just a very small patch and until this event is not hooked to any code it won't be used anyway but maybe of great help to take CPU load from the framegrabber.
Ok, I know, we have a feature freeze but this is not really a feature - it helps to reduce CPU load in MP if used by a plugin and if not it doesn't have any effect or side effect at all.
This is a bit like begging - but please vote for "yes" because otherwise my (and probably that of many other) Atmolight Hardware will never run smooth with MP
So, what do you think?
Please vote
The patch is here
Code:
Index: Core/Player/FrameGrabber.cs
===================================================================
--- Core/Player/FrameGrabber.cs (revision 24717)
+++ Core/Player/FrameGrabber.cs (working copy)
@@ -45,6 +45,9 @@
private FrameGrabber() {}
+ public delegate void NewFrameHandler(Int16 width, Int16 height, Int16 arWidth, Int16 arHeight, uint pSurface);
+ public event NewFrameHandler OnNewFrame;
+
public static FrameGrabber GetInstance()
{
if (instance == null)
@@ -120,6 +123,16 @@
/// <param name="pSurface"></param>
public void OnFrame(Int16 width, Int16 height, Int16 arWidth, Int16 arHeight, uint pSurface)
{
+ if (OnNewFrame != null)
+ {
+ try
+ {
+ OnNewFrame(width, height, arWidth, arHeight, pSurface);
+ }
+ catch(Exception)
+ {
+ }
+ }
// Is GetCurrentImage() requesting a frame grab?
if (!grabSample)
{