Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9191505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:42:00+00:00 2026-06-17T20:42:00+00:00

now i have a code want to improve. the datatype of src data is

  • 0

now i have a code want to improve. the datatype of src data is byte. i want to calculate with float and store the result to byte. but i dont know how to convert datatype of data bwtween BYTE and float. I develop on Android NDK. the C++ code i want to improve followed:

void DoEffect(BYTE *pSrc, float rat){
//image data:BGRA
float red, green, blue;
red = pSrc[RED_CHANNEL] * rat;
green = pSrc[GREEN_CHANNEL] * rat;
blue = pSrc[BLUE_CHANNEL] * rat;

//  some step to calculate the result;
//  red = ...
//  ...
//

pSrc[RED_CHANNEL] = (BYTE)red;
pSrc[GREEN_CHANNEL] = (BYTE)green;
pSrc[BLUE_CHANNEL] = (BYTE)blue;

}

and my neon asm code:

void DoEffect_neon_asm(BYTE *pSrc, float rat){
__asm__ __volatile__(
        "vld4.8     {d0-d3},[%[src]]    \n"
        "vdupq.32   {d4, d5}, [%[rat]]  \n"
        "# convert src data to float?       \n"
        "code: convert byte to float        \n"
        "# calculate result         \n"
        "..                 \n"
        "# convert result to byte       \n"
        "code: convert float to byte        \n"
        :[src]"r"(pSrc), [rat]"r"(rat)
);

}

my problem is how to code “code: convert byte to float” and “code: convert float to byte” listed in “neon asm code”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:42:01+00:00Added an answer on June 17, 2026 at 8:42 pm

    Converting bytes to floats is fairly straightforward. The code below will do this for one register of bytes:

    "vmovl.u8       q3, d2                      \n\t"   //Expand to 16-bit
    "vmovl.u16      q10, d6                     \n\t"   //Expand to 32-bit
    "vmovl.u16      q11, d7                     \n\t"
    "vcvt.f32.u32   q10, q10                    \n\t"   //Convert to float
    "vcvt.f32.u32   q11, q11                    \n\t"
    

    Converting back to bytes is almost exactly the reverse process. Use vcvt.u32.f32 and vmovn instead.

    Also, if you’re new to NEON, I would recommend reading the documentation thoroughly. It’s a good way to get a handle on the instructions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a working solution for my problem but now I want to improve
I use the smarty tpl. Now i have a php code and i want
I have download entire Eclipse Helios/Indigo version Source Code. Now I want to work
The javascript code I now have can toggle a single row of data. Whether
Edit: original question below, but I revise it now that I have some code
I have the following dummy code: dt<-data.frame(country=letters[1:20],val=rnorm(20),siz=rnorm(20)) qplot(x=country,y=val,data=dt,geom=point,size=siz) Now I want to increase the
I have the code below. It looks long and complicated and now I have
I have code that dynamically load 10 different textfields in viewdidload method now if
Right now I have the following code working: @UiHandler(usernameTextBox) void onUsernameTextBoxKeyPress(KeyPressEvent event) { keyPress(event);
I already have code which lazy loads scripts on request. My issue now is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.