LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 05-05-2008, 02:14 AM   #1
montylee
Member
 
Registered: May 2003
Location: India
Distribution: Ubuntu 7.04, Fedora Core 9
Posts: 168

Rep: Reputation: 30
Wink How to compare 2 frame buffers?


I have an embedded application. I want to compare the frame/screen being shown on the display for validation purposes i.e. i want to check whether the frame currently being shown on the display is same as the frame shown earlier.
For this i am saving the checksum of frame buffer contents and comparing for validation.

Now, the problem is that when the checksum is computed, it takes into account the mouse pointer position. So, the next time when i compute the checksum if the mouse pointer is at a different position then the checksum will be different and the validation will fail.

Now, how can i compare two frames of a frame buffer? Currently i am using checksum for comparison but it takes mouse pointer position into account.
 
Old 05-05-2008, 02:31 AM   #2
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
Re-write the function to not take mouse position into account?
 
Old 05-05-2008, 03:35 AM   #3
montylee
Member
 
Registered: May 2003
Location: India
Distribution: Ubuntu 7.04, Fedora Core 9
Posts: 168

Original Poster
Rep: Reputation: 30
lol, i am simply using a checksum command for computing the checksum and it takes the mouse position into account automatically. So, i am not deliberately doing it.
 
Old 05-05-2008, 04:41 AM   #4
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
So, there is no way to not include the mouse position? Not even if you create a new input that does not use the mouse? Cant reset the mouse data just for the checksum-computing phase?

OK then, ummm, perhaps you should write your own checksum command? Or use a already existing checksum system (MD5) and make it compute based on your framebuffer data? Or.... is the mouse data somehow, for some impossible to know reason, part of the framebuffer data?
 
Old 05-05-2008, 08:03 AM   #5
montylee
Member
 
Registered: May 2003
Location: India
Distribution: Ubuntu 7.04, Fedora Core 9
Posts: 168

Original Poster
Rep: Reputation: 30
Hey thanks for replying!
i think the mouse data is infact part of the framebuffer data as it includes the mouse cursor. I don't have the exact code of the checksum computation algo as my friend is doing it but i think it's only based on the existing linux checksum command (maybe md5sum).

I'll know the details only when i get the code from my friend. The code is for an embedded device and in addition to mouse, it accepts keyboard and touchscreen events.

According to ur reply, i guess i have to disable any inputs (mouse, touchscreen) while taking the checksum. I have to investigate on this a bit. I think the problem might be due to the mouse cursor being displayed as it is part of the frame buffer data while the checksum is being computed. As soon as the cursor position is changed, the checksum changes.

Basically, this is what i want to achieve:
My embedded application has several screens. When u press a button it opens another screen. I want to validate the screens after opening i.e. whether the correct screen is getting opened or not. So, i take a checksum of the frame buffer as soon as a screen opens and save it somewhere. Next time the same window is opened, i validate the screen by taking its checksum and comparing the checksums. Is there any other way to compare the screens in an embedded application?

Last edited by montylee; 05-05-2008 at 08:07 AM.
 
Old 05-06-2008, 07:13 AM   #6
montylee
Member
 
Registered: May 2003
Location: India
Distribution: Ubuntu 7.04, Fedora Core 9
Posts: 168

Original Poster
Rep: Reputation: 30
bump!
Is there any other method to compare the frame (i.e. frame being displayed on the screen)?
 
Old 05-06-2008, 07:42 AM   #7
fantas
Member
 
Registered: Jun 2007
Location: Bavaria
Distribution: slackware, xubuntu
Posts: 143

Rep: Reputation: 22
Disclaimer: My experience with embedded programming is close to null, so ignore me if I'm stating the obvious or making wrong assumptions

A common practice to compare large objects is not doing the very expensive job of comparing each byte (or even doing checksums) but rather add additional state informations to this object (if diskspace/memory allows), and keeping these up to date.
Like said - I wouldn't know if this is feasible at all - but my approach would be to add such a state flag to the framebuffer and let the instance which usually does the checksums rather set/reset this flag according to the different ways how the framebuffer could have been changed (content, size, mouse, etc.) and then it would be an extremely cheap operation to just check this flag once in a while.
 
Old 05-07-2008, 03:30 AM   #8
montylee
Member
 
Registered: May 2003
Location: India
Distribution: Ubuntu 7.04, Fedora Core 9
Posts: 168

Original Poster
Rep: Reputation: 30
hey thanks for the reply.
I think adding a state flag to the framebuffer is a good idea. I'll hav to investigate more upon the same.
 
  


Reply

Tags
buffer, frame


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
discription on frame sorting used in buffers sandy_31619 Programming 1 08-23-2007 03:03 PM
can't get Sun frame buffers to work with svga monitor frankie_DJ Solaris / OpenSolaris 2 07-28-2005 08:57 AM
calling a frame from another frame : JAVA randomx Programming 0 10-07-2004 02:49 PM
Drawing using frame buffers villie Programming 1 06-16-2004 06:05 AM
NVidia Twinview dual head, 2 frame buffers peter72 Linux - Hardware 0 04-07-2004 02:22 PM


All times are GMT -5. The time now is 03:22 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration