Results 1 to 7 of 7

Thread: How to Optimize getPixel() calls for 1bpp vs. 8bpp?

  1. #1
    Join Date
    Sep 2010
    Posts
    78

    How to Optimize getPixel() calls for 1bpp vs. 8bpp?

    Hi, I’m as making the project in visual c++ and I came up with a small issue it’s not related with the c++. I’m having an image of a class file which can be used to store in 1bit or it may be 8 bit per pixel. And those pixel are stored in there buffer with the width and height which are in bits. I’m having the problem in optimizing the getpixel() meted. I want to know how to call that method. Please guide me to how to that. Thanks in advanced.

  2. #2
    Join Date
    May 2009
    Posts
    527

    Re: How to Optimize getPixel() calls for 1bpp vs. 8bpp?

    It maybe because the accessing of 1bpp and the accessing of 8bpp is different and the getpixel() method is called large number of times. So if you put if statement inside the function it may slow down. I want to know how the compiler optimizes the pixel. I only thing it can make is bit per pixel which may have to build the image for 1bpp and 8bpp pixel. You can even try the virtual method but it wills going to be a cost effective program.

  3. #3
    Join Date
    May 2009
    Posts
    539

    Re: How to Optimize getPixel() calls for 1bpp vs. 8bpp?

    Hello, I just want to ask wether you are having a profiling data with you and do you really know if statement slows down the optimizing process a lot. If your having a function and the pointer then you can call it through the use of pointer’s even want to ask whether you are having a bench mark or no. you can even optimize the function with the help of bench mark if it doesn’t work then you should try some other trick to do so.

  4. #4
    Join Date
    Mar 2010
    Posts
    154

    Re: How to Optimize getPixel() calls for 1bpp vs. 8bpp?

    Even I’m as facing with same issue what you had mentioned. I’m not having a benchmark but still my getpixel method had being called large number of times’ think so there might be some hard drive which had being benched. I will going to check the speed of my program once I’m done with the program. It’s even good to use the function pointer in the program. But I think so there might be a chance of defragmenting of a function pointer.

  5. #5
    Join Date
    May 2009
    Posts
    543

    Re: How to Optimize getPixel() calls for 1bpp vs. 8bpp?

    I think so SDK getpixel function is very slow as they usually provide an function like getdate() which make give an direct access to an image. Thought it write fast but it compromise with the encapsulation and for that you must have knowledge of an internal data structure. You can even enumerate the pixel function by using BYTE getFirstPixel(unsigned int q, unsigned int w) const; and then make use of BYTE getNextPixel(); this function will going to keep the class member.

  6. #6
    Join Date
    May 2009
    Posts
    511

    Re: How to Optimize getPixel() calls for 1bpp vs. 8bpp?

    Hi, I want to know how you are able to optimize the function without profiling. There might be something changed which will going to returned the pixel. You can even design your STL function which uses the enumerator where the internal state Is usually kept inside the enumerator object to the client. Even you can make some external processing in your class like if you want a black pixel then you can do so by making the use of getNextBlackPixel.

  7. #7
    Join Date
    Apr 2009
    Posts
    569

    Re: How to Optimize getPixel() calls for 1bpp vs. 8bpp?

    I had done this. I used to call the get pixel method just to count the number of balk pixel or just to detect the two or more adjacent black pixels. But now I’m working more on gray pixel. So I’m writing the row by row algorithm for it. The difficulty with moving the if () statement at the top point is that there are much special functions required for calling getPixelDirect(). I think so if I introduce the border detection routine into the image class then I might do this moving of if statements to top level.

Similar Threads

  1. Replies: 3
    Last Post: 28-12-2011, 10:39 PM
  2. Need to load .NET bitmap from 1bpp png stored as 32bpp
    By Tyee in forum Software Development
    Replies: 6
    Last Post: 26-06-2011, 10:39 PM
  3. How to Optimize Windows 7
    By The#Danger in forum Tips & Tweaks
    Replies: 2
    Last Post: 12-08-2010, 12:43 PM
  4. RAM optimize
    By Talish in forum Motherboard Processor & RAM
    Replies: 5
    Last Post: 03-08-2010, 11:14 PM
  5. How to optimize XP
    By Shantanu12 in forum Tips & Tweaks
    Replies: 3
    Last Post: 22-04-2009, 10:46 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,567,502.11266 seconds with 17 queries