Home Help Center

Ice-E 1.3.0 (Android) to ICE 3.5.0 (Windows) - mapping problem?

belvederbelveder Member Clemens ArthOrganization: TU GrazProject: Computer Vision stuff
Hi,
since I want to integrate ICE functionality into a mostly native c++ application on Android, I compiled and linked ICE-E to it. I want to transmit some image data (as sequence of bytes) and some plain double values.

Interestingly, transmitting image data is not an issue - the byte sequence is transmitted correctly. However, the double values are completely messed up during transmission. Any ideas how to track down the errors? I'm pretty sure, once I store the double values as bytes it works again.

Cheers...

Comments

  • belvederbelveder Member Clemens ArthOrganization: TU GrazProject: Computer Vision stuff
    strange byte order changes?

    Ok, here's what happens, but it is not really clear why:

    As HEX, this is the double value in its correct format: 00 00 00 C0 9D 6F 92 40
    As HEX, this is what is delivered by ICE after transmission: 9D 6F 92 40 00 00 00 C0

    obviously the first 4 and the last 4 byte are swapped... any ideas why that might happen?
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,

    Seems that IceE is picking the wrong endianness, for android ARM it should be little endian.

    You should look in "IceE-1.3.0/cppe/include/IceE/Config.h" here you will need to update the defines for ICE_LITTLE_ENDIAN/ICE_BIG_ENDIAN to account for the android architectures you build. You will need to rebuild IceE after that.
  • belvederbelveder Member Clemens ArthOrganization: TU GrazProject: Computer Vision stuff
    xdm wrote: »
    Hi,

    Seems that IceE is picking the wrong endianness, for android ARM it should be little endian.

    You should look in "IceE-1.3.0/cppe/include/IceE/Config.h" here you will need to update the defines for ICE_LITTLE_ENDIAN/ICE_BIG_ENDIAN to account for the android architectures you build. You will need to rebuild IceE after that.

    but that doesn't really make sense, does it? I checked and it should already use little-endian. If it would choose the wrong endianness, then integers would be messed up too, but they are not. In fact it does not reorder the bytes, but it seems to reorder chunks of memory. Could that somehow be a ICE-E / ICE incompatibility? On the server I use ICE...
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,

    After a closer look it seems it could be that the implementation of BasicStream::write(Double v) isn't correct for ARM.
    #  if defined(__arm__) && defined(__linux)
        dest[4] = *src++;
        dest[5] = *src++;
        dest[6] = *src++;
        dest[7] = *src++;
        dest[0] = *src++;
        dest[1] = *src++;
        dest[2] = *src++;
        dest[3] = *src;
    #  else
        *dest++ = *src++;
        *dest++ = *src++;
        *dest++ = *src++;
        *dest++ = *src++;
        *dest++ = *src++;
        *dest++ = *src++;
        *dest++ = *src++;
        *dest = *src;
    #  endif
    

    Seems like the else branch should be used, instead of reordering the bytes, try to update cppe/src/IceE/BasicStream.cpp and rebuild it.
  • belvederbelveder Member Clemens ArthOrganization: TU GrazProject: Computer Vision stuff
    xdm wrote: »
    Hi,

    After a closer look it seems it could be that the implementation of BasicStream::write(Double v) isn't correct for ARM.
    #  if defined(__arm__) && defined(__linux)
        dest[4] = *src++;
        dest[5] = *src++;
        dest[6] = *src++;
        dest[7] = *src++;
        dest[0] = *src++;
        dest[1] = *src++;
        dest[2] = *src++;
        dest[3] = *src;
    #  else
        *dest++ = *src++;
        *dest++ = *src++;
        *dest++ = *src++;
        *dest++ = *src++;
        *dest++ = *src++;
        *dest++ = *src++;
        *dest++ = *src++;
        *dest = *src;
    #  endif
    

    Seems like the else branch should be used, instead of reordering the bytes, try to update cppe/src/IceE/BasicStream.cpp and rebuild it.

    Thanks, that finally solved the problem. However, I had to replace ALL occurences of
    #  if defined(__arm__) && defined(__linux)
    
    correctly, including all read/write functions for double and also the functions concerning the manipulation of double arrays (in total it might have been 5 or 6 times...) - now it works as it is supposed to.

    Thanks again
  • wimvalckewimvalcke Member Wim ValckeOrganization: PersonalProject: Nokia N900 port
    Did somebody got a running IceE server on Android (using NDK)? It works for me as a client, but an Ice server crashes as soon an object is added to an object adapter.

    Best regards

    Wim.
Sign In or Register to comment.