[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[f-cpu] an instruciton



  OK, may be I'm spamming, haven't read the F-CPU doc's yet,
but does F-CPU have an instruction, that just COUNTS THE
BITS IN A CERTAIN REGISTER? For instance, let's say register
X has the following contents: 0110011010 and
the sugested instruction just counts the "1"-bits in that
register. The result in this example is 5.

  What is this instruction good for? Well, in image
recognition and as the sound recognition task is EQUAL TO
image recognition(time as one dimension and frequencies as
the other dimension), then it will also become handy in any
sound related tasks like certain user interfaces.

  So, how can the prementioned instruction be used
in image and sound processing? By masks and in comparison.

Let's say, that I want to compare the image:

00000                          00100
01010  to a database sample  01010
00100                          00100

and I do it with some probabilety. Let's say, that
I consider the image recognized, if it differs
from the sample by n bits(at the moment, n=1).
So I just XOR the sample with the database version
and I get:

00100
00000
00000

And in order to know, if I have a match, I have
to count, how many "1"-bits do I have. Well, generally
it's no problem, it can be done by shifting, but as
in image processing it's one of the most vastly used
operations and there are many samples to compare. The
suggested instruction can speed up the image and sound
recognition software atleast as many times, as many shifts should
be done withought using that instruction(aproxemately the
with of the registers, 64?).

Unfortunately I wasn't able to find
that kind of an instruction in the Intel's instruction set. Please
correct me, if I'm wrong, I haven't done almost any lowlevel
programming for the Intel processors. I must say, that the prementioned
instruction is specially useful with wide registers and, as we all
know, Intel sticks with the 32 bits, provided that we
exclude the "Itanic".


Regards,
    Martin Vahi
*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/