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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:15:31+00:00 2026-06-11T21:15:31+00:00

I am almost sure that this is much simpler than I think it is,

  • 0

I am almost sure that this is much simpler than I think it is, but I have been scouring the internet for a much longer time than I care to admit to try and figure out how the frig to convert the two formats. I am able to extract the Y0, Cb, Y1, Cr data from a stream of unsigned bytes (unsigned char), but I have no idea how these bytes are arranged in YV12 – is this document implying that the various values are actually contained in different rows?

I’ve literally been searching all day for things like “c++ convert YUY2 to YV12,” and have turned up absolutely no tutorials or code samples. I would think that this would have some form of documentation that I could use, but the information seems to be scarce on this particular subject.

  • 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-11T21:15:32+00:00Added an answer on June 11, 2026 at 9:15 pm

    Looks like the linked entry on YUY2 together with the Wikipedia article on YV12 makes this pretty clear:

    • YUY2 stores every two adjacent, horizontal pixels as four bytes, [Y1, U, Y2, V].

    • YV12 stores an entire M × N frame in a contiguous array of M*N + 2 * (M/2 * N/2) bytes. Let’s call the array byte frame[M * N * 3 / 2]. We have:

      • frame[i] for i in [0, M * N) are the Y-values of the pixels.
      • frame[j] for j in [M * N, M * N * 5/4) are the V-values of each 2 × 2-pixel tile.
      • frame[j] for k in [M * N * 5/4, M * N * 6/4) are the U-values of each 2 × 2-pixel tile.

    So as you convert from YUY2 to YV12, you have to halve the amount of U– and V-data, possibly by taking the average of two adjacent rows.

    Example:

    byte YUY2Source[M * N * 2] = /* source frame */;
    byte YV12Dest[M * N * 3/2];
    
    for (unsigned int i = 0; i != M * N; ++i)
    {
        YV12Dest[i] = YUY2Source[2 * i];
    }
    
    for (unsigned int j = 0; j != M * N / 4; ++j)
    {
        YV12Dest[M * N + j]       = ( YUY2Source[N*(j / N/2    ) + 4 * j + 3]
                                    + YUY2Source[N*(j / N/2 + 1) + 4 * j + 3] ) / 2;
    
        YV12Dest[M * N * 5/4 + j] = ( YUY2Source[N*(j / N/2    ) + 4 * j + 1]
                                    + YUY2Source[N*(j / N/2 + 1) + 4 * j + 1] ) / 2;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am almost sure that this is not possible, but I'm wondering if someone
HI, I have almost solved this but have now got stuck! What I need
So the question is in title. I almost sure that the answer is NO,
This seems like such a trivial question to ask, but it's been vexing me
Almost every game use keyboard as input. I have been searching for 2 days
I'm almost positive the answer is no but just to be sure... there's no
I'm almost sure there is tool in eclipse that will allow me to browse
I have a website that is starting to grow but with that comes users
I have been searching for the solution to this problem for a while and
When you search in Google (i'm almost sure that Altavista did the same thing)

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.