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 7038991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:44:34+00:00 2026-05-28T01:44:34+00:00

I’m borrowing some code from the VLC to my video player, written in MSVC++

  • 0

I’m borrowing some code from the VLC to my video player, written in MSVC++ 2010, and cannot find equivalent to its inline asms, related to extracting decoded video frame from the GPU memory to the conventional memory.
Particularly, I don’t know how to translate this instruction:

movq   %%xmm1,   8(%[dst1])

which can be seen in the function SplitUV in the file vlc/modules/codec/avcodec/copy.c.

According to MSDN, intrinsics for movq are _mm_move_epi64, _mm_loadl_epi64 and _mm_storel_epi64.
However, they require __m128i arguments, and if I add 1 to the pointer to __m128i, I’ll get the offset of 16 bytes, while I need 8 bytes.

The whole assembler code is the following:

for (x = 0; x < (width & ~31); x += 32) {
  asm volatile (
    "movdqu (%[shuffle]), %%xmm7\n"
    "movdqa  0(%[src]), %%xmm0\n"
    "movdqa 16(%[src]), %%xmm1\n"
    "movdqa 32(%[src]), %%xmm2\n"
    "movdqa 48(%[src]), %%xmm3\n"
    "pshufb  %%xmm7, %%xmm0\n"
    "pshufb  %%xmm7, %%xmm1\n"
    "pshufb  %%xmm7, %%xmm2\n"
    "pshufb  %%xmm7, %%xmm3\n"
    "movq   %%xmm0,   0(%[dst1])\n"
    "movq   %%xmm1,   8(%[dst1])\n"
    "movhpd %%xmm0,   0(%[dst2])\n"
    "movhpd %%xmm1,   8(%[dst2])\n"
    "movq   %%xmm2,  16(%[dst1])\n"
    "movq   %%xmm3,  24(%[dst1])\n"
    "movhpd %%xmm2,  16(%[dst2])\n"
    "movhpd %%xmm3,  24(%[dst2])\n"
    : : [dst1]"r"(&dstu[x]), [dst2]"r"(&dstv[x]), [src]"r"(&src[2*x]), 
        [shuffle]"r"(shuffle) 
    : "memory"
 );
 ...
}

I’ve started translating, line by line, and by now have the following code (incomplete):

__m128i x0, x1, x2, x3, x7;
__m128i *pshuffle128 = (__m128i *)shuffle;
__m128i *pSrc = (__m128i *)src;

for (x = 0; x < (width & ~31); x += 32) {
    __m128i *dst1 = (__m128i *)dstu + x;
    __m128i *dst2 = (__m128i *)dstv + x; 
    x7 = _mm_loadu_si128(pshuffle128);  //    "movdqu (%[shuffle]), %%xmm7\n"
    x0 = _mm_load_si128(pSrc + 0);      //    "movdqa  0(%[src]),   %%xmm0\n"
    x1 = _mm_load_si128(pSrc + 1);      //    "movdqa 16(%[src]),   %%xmm1\n"
    x2 = _mm_load_si128(pSrc + 2);      //    "movdqa 32(%[src]),   %%xmm2\n"
    x3 = _mm_load_si128(pSrc + 3);      //    "movdqa 48(%[src]),   %%xmm3\n"
    x0 = _mm_shuffle_epi8(x0, x7);      //    "pshufb  %%xmm7, %%xmm0\n"
    x1 = _mm_shuffle_epi8(x1, x7);      //    "pshufb  %%xmm7, %%xmm1\n"
    x2 = _mm_shuffle_epi8(x2, x7);      //    "pshufb  %%xmm7, %%xmm2\n"
    x3 = _mm_shuffle_epi8(x3, x7);      //    "pshufb  %%xmm7, %%xmm3\n"
    _mm_storel_epi64(dst1 + 0, x0);     //    "movq   %%xmm0,   0(%[dst1])\n"

The next instruction would be that

movq   %%xmm1,   8(%[dst1])

and I don’t know how to specify offset of 8 bytes.
Also, I have some doubts that I’ve correctly translated PSHUFB.

Would be very grateful for comments and suggestions.

Thanks.

  • 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-05-28T01:44:35+00:00Added an answer on May 28, 2026 at 1:44 am

    Simply use a char* pointer for dst that you can increment by 8 and cast it to __m128i* in the call to _mm_storel_epi64 similar to how it’s done here (search for “_mm_storel_epi64” on that page).

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have this code to decode numeric html entities to the UTF8 equivalent character.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.