Sign-extension on ADSP SHARC 21469 ??

  • Follow


Hi,

I have some 24bit audio data (stored in an unsigned int). I have to
sign extend it to 32 bit.
From what I understand, I just look at bit 23 (counting from bit0)
which is the sign-bit. If it
is 1 then I place 1's in bit23 to bit31. If it is zero then I don't
need to do anything.

Now...is there a fast way of doing that on SHARC ADSP 21469 ? A built-
in function or something?

I haven't been able to find anything in the manuals (maybe I am
overlooking something).

Thanks
0
Reply mjames2393 (72) 8/11/2012 4:32:55 PM

"Mauritz Jameson" <mjames2393@gmail.com> wrote in message 
news:2ea9ca25-7c1e-4ce3-92bb-97a49cf6bbae@u7g2000yqj.googlegroups.com...
> Hi,
>
> I have some 24bit audio data (stored in an unsigned int). I have to
> sign extend it to 32 bit.
> From what I understand, I just look at bit 23 (counting from bit0)
> which is the sign-bit. If it
> is 1 then I place 1's in bit23 to bit31. If it is zero then I don't
> need to do anything.
>
> Now...is there a fast way of doing that on SHARC ADSP 21469 ? A built-
> in function or something?
> I haven't been able to find anything in the manuals (maybe I am
> overlooking something).

s32 y = (u32)(s24) x -  (s32)0x800000

Duh.

Vladimir Vassilevsky
DSP and Mixed Signal Consultant
www.abvolt.com



0
Reply nospam (2574) 8/11/2012 5:15:33 PM


"Vladimir Vassilevsky" <nospam@nowhere.com> wrote in message 
news:dpednUa-xrCuDrvNnZ2dnUVZ5r-dnZ2d@giganews.com...
>
> "Mauritz Jameson" <mjames2393@gmail.com> wrote in message 
> news:2ea9ca25-7c1e-4ce3-92bb-97a49cf6bbae@u7g2000yqj.googlegroups.com...
>> Hi,
>>
>> I have some 24bit audio data (stored in an unsigned int). I have to
>> sign extend it to 32 bit.
>> From what I understand, I just look at bit 23 (counting from bit0)
>> which is the sign-bit. If it
>> is 1 then I place 1's in bit23 to bit31. If it is zero then I don't
>> need to do anything.
>>
>> Now...is there a fast way of doing that on SHARC ADSP 21469 ? A built-
>> in function or something?
>> I haven't been able to find anything in the manuals (maybe I am
>> overlooking something).
>
> s32 y = (u32)(s24) x -  (s32)0x800000
>
> Duh.
>
Oops.

s32 y =  (x ^ 0x800000) -  0x800000



Vladimir Vassilevsky
DSP and Mixed Signal Consultant
www.abvolt.com
 


0
Reply nospam (2574) 8/11/2012 5:22:03 PM

Thanks Vlad :-)
0
Reply mjames2393 (72) 8/11/2012 6:35:21 PM

On Sat, 11 Aug 2012 09:32:55 -0700 (PDT), Mauritz Jameson
<mjames2393@gmail.com> wrote:

>Hi,
>
>I have some 24bit audio data (stored in an unsigned int). I have to
>sign extend it to 32 bit.
>From what I understand, I just look at bit 23 (counting from bit0)
>which is the sign-bit. If it
>is 1 then I place 1's in bit23 to bit31. If it is zero then I don't
>need to do anything.
>
>Now...is there a fast way of doing that on SHARC ADSP 21469 ? A built-
>in function or something?
>
>I haven't been able to find anything in the manuals (maybe I am
>overlooking something).
>
>Thanks

See Processor Manual page 11-79
Rn = FEXT Rx BY Ry (SE)

Mark DeArman
0
Reply dearman.mark (137) 8/12/2012 2:18:07 AM

4 Replies
59 Views

(page loaded in 0.915 seconds)


Reply: