Skip to content

fixed bug #4215#3757

Merged
opencv-pushbot merged 1 commit intoopencv:masterfrom
ilya-lavrenov:popcnp
Mar 2, 2015
Merged

fixed bug #4215#3757
opencv-pushbot merged 1 commit intoopencv:masterfrom
ilya-lavrenov:popcnp

Conversation

@ilya-lavrenov
Copy link
Copy Markdown
Contributor

No description provided.

@alalek
Copy link
Copy Markdown
Member

alalek commented Feb 26, 2015

👍

BTW, Optimization of "init once" functions for 256 values looks very strange.

#if 1
// (value & mask) == 0 ? 1 : 0
static uchar inverted_popcnt8[256] = {
8,7,7,6,7,6,6,5,7,6,6,5,6,5,5,4,
7,6,6,5,6,5,5,4,6,5,5,4,5,4,4,3,
7,6,6,5,6,5,5,4,6,5,5,4,5,4,4,3,
6,5,5,4,5,4,4,3,5,4,4,3,4,3,3,2,
7,6,6,5,6,5,5,4,6,5,5,4,5,4,4,3,
6,5,5,4,5,4,4,3,5,4,4,3,4,3,3,2,
6,5,5,4,5,4,4,3,5,4,4,3,4,3,3,2,
5,4,4,3,4,3,3,2,4,3,3,2,3,2,2,1,
7,6,6,5,6,5,5,4,6,5,5,4,5,4,4,3,
6,5,5,4,5,4,4,3,5,4,4,3,4,3,3,2,
6,5,5,4,5,4,4,3,5,4,4,3,4,3,3,2,
5,4,4,3,4,3,3,2,4,3,3,2,3,2,2,1,
6,5,5,4,5,4,4,3,5,4,4,3,4,3,3,2,
5,4,4,3,4,3,3,2,4,3,3,2,3,2,2,1,
5,4,4,3,4,3,3,2,4,3,3,2,3,2,2,1,
4,3,3,2,3,2,2,1,3,2,2,1,2,1,1,0
};
#else
...
         for (int j = 0; j < 256u; j++)
         {
             int val = 0;
             for (int mask = 1; mask < 256; mask += mask)
                 val += ((j & mask) == 0) ? 1 : 0;
             inverted_popcnt8[j] = (uchar)val;
         }
...
#endif

@opencv-pushbot opencv-pushbot merged commit b963d84 into opencv:master Mar 2, 2015
vpisarev added a commit that referenced this pull request Mar 2, 2015
@ilya-lavrenov ilya-lavrenov deleted the popcnp branch March 2, 2015 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants