Forum: GNU Radio strange operation when char at input

Aaa0fc4458ead49e4f9317634a32ae92?d=identicon&s=25 Nemanja Savic (Guest)
on 2013-05-30 00:56
(Received via mailing list)
Hi all guys,

I wouldn't bother again but I have spent a lot of time trying to figure
out
what's going on.

Nameli I want to design block with char type at input and char type at
the
output.
After finished with the design I realized strange block operation. Input
samples were always zero. Then I tried with this:

int
>         out[i] = in1[i]+in2[i];
>     // Tell runtime system how many output items we produced.
>     return noutput_items;
> }
>

After quite some time I designed similar block with float ports and it
worked. Then I changed upper block to have short type at input and
output
and it worked just fine.
And yes, in test everything works just fine, but in grc not, It always
spits 0 at the output.
Is there any possible complications with endianess or I don't know.

Best,
0d057c642b38689bfa090206eec844b8?d=identicon&s=25 Monahan-Mitchell, Tim (Guest)
on 2013-05-30 01:00
(Received via mailing list)
I worked on an "interleaved char to complex" block some time ago. It was
not working right until I changed it to specify 'signed' char instead of
letting the compiler default happen (which could be either way). - Tim

From: discuss-gnuradio-bounces+tmonahan=qti.qualcomm.com@gnu.org
[mailto:discuss-gnuradio-bounces+tmonahan=qti.qualcomm.com@gnu.org] On
Behalf Of Nemanja Savic
Sent: Wednesday, May 29, 2013 4:55 PM
To: discuss-gnuradio@gnu.org
Subject: [Discuss-gnuradio] strange operation when char at input

Hi all guys,
I wouldn't bother again but I have spent a lot of time trying to figure
out what's going on.
Nameli I want to design block with char type at input and char type at
the output.
After finished with the design I realized strange block operation. Input
samples were always zero. Then I tried with this:
int
test_proba_sync_bb::work(int noutput_items,
          gr_vector_const_void_star &input_items,
          gr_vector_void_star &output_items)
{
    const char *in1 = (const char *) input_items[0];
    char *out = (char *) output_items[0];
    const char *in2 = (const char *) input_items[1];

    // Do <+signal processing+>
    for(int i=0;i<noutput_items;i++)
        out[i] = in1[i]+in2[i];
    // Tell runtime system how many output items we produced.
    return noutput_items;
}

After quite some time I designed similar block with float ports and it
worked. Then I changed upper block to have short type at input and
output and it worked just fine.
And yes, in test everything works just fine, but in grc not, It always
spits 0 at the output.
Is there any possible complications with endianess or I don't know.

Best,
Aaa0fc4458ead49e4f9317634a32ae92?d=identicon&s=25 Nemanja Savic (Guest)
on 2013-05-30 01:26
(Received via mailing list)
Hm, could be, I will see later, but I see now that for example
digital_correlate block has unsigned.

Thank you Tim.

Nemanja


On Thu, May 30, 2013 at 12:59 AM, Monahan-Mitchell, Tim <
C539637020fd56193dd6daec746c4a84?d=identicon&s=25 Tom Rondeau (Guest)
on 2013-05-30 04:06
(Received via mailing list)
On Wed, May 29, 2013 at 7:24 PM, Nemanja Savic <vlasinac@gmail.com>
wrote:
> Hm, could be, I will see later, but I see now that for example
> digital_correlate block has unsigned.
>
> Thank you Tim.
>
> Nemanja

Yes. Unlike most data types, there's a strong signed/unsigned property
to chars between Python and C++. A char vector is assumed unsigned.
Looks like you have to force it to be signed.

Tom
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.