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

  • Home
  • SEARCH
  • 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 8409209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:50:35+00:00 2026-06-09T23:50:35+00:00

i got an assignment of converting an SIMD SSE instruction to equivalent C code…

  • 0

i got an assignment of converting an SIMD SSE instruction to equivalent C code… The Code is something like this
(I1_block_addr– is a uint8_t and esc_offset_1 is a 32 bit integer.)

      __m128i xmm1 = _mm_load_si128((__m128i*)(I1_block_addr+desc_offset_1));
      __m128i xmm6 = _mm_load_si128((__m128i*)(I2_block_addr+desc_offset_1));

       xmm6 = _mm_sad_epu8(xmm1,xmm6);

what i did is

 char *c1;
 char xmm1[16],xmm6[16];
 short xmm6s[16]

 //for loding 16 byte 
  c1=( char* )( I1_block_addr + desc_offset_1 );
  memcpy( xmm1 , c1 , 16 ); 

  c1=( char* )( I2_block_addr + desc_offset_1 );
  memcpy( xmm6 , c1 , 16 ); 

 xmm6s[0] = (short) ( abs(xmm1[0]-xmm6[0]) + abs(xmm1[1]-xmm6[1]) + abs(xmm1[2]-xmm6[2]) + abs(xmm1[3]-xmm6[3]) + abs(xmm1[4]-xmm6[4]) + abs(xmm1[5]-xmm6[5]) + 
            abs(xmm1[6]-xmm6[6]) + abs(xmm1[7]-xmm6[7]) );

xmm6s[1] = 0;   xmm6s[2] = 0;   xmm6s[3] = 0;   

xmm6s[4] = (short) ( abs(xmm1[8]-xmm6[8]) + abs(xmm1[9]-xmm6[9]) +    abs(xmm1[10]-xmm6[10]) + abs(xmm1[11]-xmm6[11]) + abs(xmm1[12]-xmm6[12]) + 
abs(xmm1[13]-xmm6[13]) + abs(xmm1[14]-xmm6[14]) + abs(xmm1[15]-xmm6[15]) );

xmm6s[5] = 0;   xmm6s[6] = 0;   xmm6s[7] = 0;

i am not getting any error but the quality of image is getting decreased. please tell which part of the code is wrong and how to correct it.

  • 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-09T23:50:36+00:00Added an answer on June 9, 2026 at 11:50 pm

    The code looks more or less OK – I think you just need to change your char/short types to appropriate unsigned types:

    #include <stdint.h>
    
    uint8_t *c1;
    uint8_t xmm1[16], xmm6[16];
    uint16_t xmm6s[8];
    
    c1 = I1_block_addr + desc_offset_1;
    memcpy(xmm1, c1, 16); 
    
    c1 = I2_block_addr + desc_offset_1;
    memcpy(xmm6, c1, 16); 
    
    xmm6s[0] = (uint16_t) ( abs(xmm1[0]-xmm6[0]) + abs(xmm1[1]-xmm6[1]) + abs(xmm1[2]-xmm6[2]) + abs(xmm1[3]-xmm6[3]) + 
                            abs(xmm1[4]-xmm6[4]) + abs(xmm1[5]-xmm6[5]) + abs(xmm1[6]-xmm6[6]) + abs(xmm1[7]-xmm6[7]) );
    
    xmm6s[1] = xmm6s[2] = xmm6s[3] = 0;   
    
    xmm6s[4] = (uint16_t) ( abs(xmm1[8]-xmm6[8]) + abs(xmm1[9]-xmm6[9]) + abs(xmm1[10]-xmm6[10]) + abs(xmm1[11]-xmm6[11]) + 
                            abs(xmm1[12]-xmm6[12]) + abs(xmm1[13]-xmm6[13]) + abs(xmm1[14]-xmm6[14]) + abs(xmm1[15]-xmm6[15]) );
    
    xmm6s[5] = xmm6s[6] = xmm6s[7] = 0;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to complete this assignment, I've got the code set up, however, there's
This is part of a homework assignment. I've got several questions asking find the
I'm battling with this assignment :) I've got two classes: Ocean and Grid. When
I have got this read file code from microsoft @C:\Users\computing\Documents\mikec\assignment2\task_2.txt That works fine when
We got this assignment from school to reproduce this example (created in Flash) into
i'm very new to this cakephp & i got an assignment to fix an
Ive got an assignment to create an image gallery using flickr - this has
I got the following assignment - I have a certain java code for a
Please help! I got very frustrated with this assignment to demonstrate Apache and Java
In the following code, I got the target of assignment expands to non-language object

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.