Giter Site home page Giter Site logo

Comments (2)

cyang1 avatar cyang1 commented on May 19, 2024

Thanks!

Do you have a specific image that can be used to repro this issue? I'm not certain how new_pos could become negative, as the neighbors bitmasks are created in PixelGrid::initialize() in such a way that bounds checks should be unnecessary.

from depixelize.

bsl avatar bsl commented on May 19, 2024

Right after the int new_pos = ... on line 366, I added

if (new_pos < 0) {
  printf("r=%d c=%d pos=%d cur_pos=%d i=%d bitmask=%#02x D[i=%d][0]=%d D[i=%d][1]=%d new_pos=%d\n",
          r, c, pos, cur_pos, i, bitmask, i, DIRECTIONS[i][0], i, DIRECTIONS[i][1], new_pos);
  continue;
}

I ran depixelize on smw_mushroom_input.png. The output looks like

r=0 c=0 pos=0 cur_pos=0  i=7 bitmask=0x85 D[i=7][0]=-1 D[i=7][1]=1 new_pos=-17
r=0 c=0 pos=0 cur_pos=1  i=7 bitmask=0x85 D[i=7][0]=-1 D[i=7][1]=1 new_pos=-16
r=0 c=0 pos=0 cur_pos=2  i=7 bitmask=0x85 D[i=7][0]=-1 D[i=7][1]=1 new_pos=-15
r=0 c=0 pos=0 cur_pos=3  i=7 bitmask=0x85 D[i=7][0]=-1 D[i=7][1]=1 new_pos=-14
r=0 c=0 pos=0 cur_pos=4  i=7 bitmask=0x85 D[i=7][0]=-1 D[i=7][1]=1 new_pos=-13
r=0 c=0 pos=0 cur_pos=5  i=7 bitmask=0x85 D[i=7][0]=-1 D[i=7][1]=1 new_pos=-12
r=0 c=0 pos=0 cur_pos=6  i=7 bitmask=0x89 D[i=7][0]=-1 D[i=7][1]=1 new_pos=-11
r=0 c=0 pos=0 cur_pos=7  i=7 bitmask=0x81 D[i=7][0]=-1 D[i=7][1]=1 new_pos=-10
r=0 c=0 pos=0 cur_pos=8  i=7 bitmask=0x81 D[i=7][0]=-1 D[i=7][1]=1 new_pos=-9
r=0 c=0 pos=0 cur_pos=9  i=7 bitmask=0x81 D[i=7][0]=-1 D[i=7][1]=1 new_pos=-8
r=0 c=0 pos=0 cur_pos=10 i=7 bitmask=0x81 D[i=7][0]=-1 D[i=7][1]=1 new_pos=-7
r=0 c=0 pos=0 cur_pos=11 i=7 bitmask=0x83 D[i=7][0]=-1 D[i=7][1]=1 new_pos=-6
r=0 c=0 pos=0 cur_pos=12 i=7 bitmask=0x85 D[i=7][0]=-1 D[i=7][1]=1 new_pos=-5
r=0 c=0 pos=0 cur_pos=13 i=7 bitmask=0x85 D[i=7][0]=-1 D[i=7][1]=1 new_pos=-4
r=0 c=0 pos=0 cur_pos=14 i=7 bitmask=0x85 D[i=7][0]=-1 D[i=7][1]=1 new_pos=-3
r=0 c=0 pos=0 cur_pos=15 i=7 bitmask=0x85 D[i=7][0]=-1 D[i=7][1]=1 new_pos=-2
r=0 c=0 pos=0 cur_pos=16 i=7 bitmask=0x85 D[i=7][0]=-1 D[i=7][1]=1 new_pos=-1

from depixelize.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.