Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Efficient and Faster way to do 2x2 binning of a matrix

Efficient and Faster way to do 2x2 binning of a matrix

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kiran Satish
    wrote on last edited by
    #1

    Hello, I am trying to implement a faster way to do 2x2 binning of a 1024x1024 matrix of byte (char) databyte in MFC. The end result will be in a 512x512 matrix. I can do this using two for loops, but I am looking for a faster and efficient way to implement this. Any suggestions? thanks

    PKNT

    J 1 Reply Last reply
    0
    • K Kiran Satish

      Hello, I am trying to implement a faster way to do 2x2 binning of a 1024x1024 matrix of byte (char) databyte in MFC. The end result will be in a 512x512 matrix. I can do this using two for loops, but I am looking for a faster and efficient way to implement this. Any suggestions? thanks

      PKNT

      J Offline
      J Offline
      jschell
      wrote on last edited by
      #2

      Presumably you are using a byte lookup rather than a mask operation. You can try indexing from end to end and then using two indexes one for the first row (say position X) and then one one for the second (X+1024). However that would then require an if test each time to skip the second row once you reached 1024.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups