4

I have an image stored in a pointer to char and I want to use on it ipp functions. How do I build an Ipp8u* image in ipp from this pointer to char? is this a heavy calculation (the construction)? Can I do simple casting? Thanks a lot

Luc Touraille
  • 79,925
  • 15
  • 92
  • 137
lital maatuk
  • 5,921
  • 20
  • 57
  • 79

1 Answers1

2

Yes, all you need to do is cast the pointer:

Ipp8u *ipp_data = static_cast<Ipp8u*>(your_data);

or, if you prefer C-style casts for some reason:

Ipp8u *ipp_data = (Ipp8u *)your_data;

As noted in the Intel documentation, Ipp8u is equivalent to C's unsigned char -- at least in the typical implementation where CHAR_BIT == 8. This isn't required but I believe is the case for most (if not all) compilers/platforms supported by Intel-IPP.

PerryC
  • 1,233
  • 2
  • 12
  • 28
Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111
  • Wonder why they say `unsigned char` and not `uint8_t`, which is more explicit. – Mahmoud Al-Qudsi May 11 '12 at 07:57
  • @MahmoudAl-Qudsi: I can only guess it's because `unsigned char` is more common/widely known, but I'd have to agree that uint8_t would really fit the description more accurately. – Jerry Coffin May 12 '12 at 05:34