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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:29:29+00:00 2026-06-07T23:29:29+00:00

How can I write a YUV frame data into a CGContext? Please help me,

  • 0

How can I write a YUV frame data into a CGContext?

Please help me,

Thanks a lot.

  • 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-07T23:29:32+00:00Added an answer on June 7, 2026 at 11:29 pm

    The general road map of what you need to do along with some pseudo-code looks like this:

    1. First create a CG bitmap context to draw into. The list of pixel formats for is available here. As you can see on iOS your only real options are some flavor of RGB with 16 bpp or 32 bpp and an alpha channel. There are more options on Mac OS X but you will still want to use some flavor of RGB.

      CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB();
      CGContextRef frameContext = CGBitmapContextCreate(NULL, w, h, 8, bytesPerRow, rgbColorSpace, kCGImageAlphaNoneSkipFirst);
      CGColorSpaceRelease(rgbColorSpace);
      void * data = CGBitmapContextGetData(frameContext);
      
    2. Convert your YUV frame data into RGB and write the RGB data into the data buffer for the CG bitmap context. You can get formulas for how to do this on the Wikipedia page for YUV.

    3. Convert the CG bitmap context into a CG image.

      CGImageRef frameImage = CGBitmapContextCreateImage(frameContext);
      
    4. Draw the CG image to the CG context.

      CGContextDrawImage(myCGContext, myCGRect, frameImage);
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can write something, I'm asking if something is already built into jQuery.
Can anyone please tell me how I can write a bash shell script that
Can someone please explain how you can write a url pattern and view that
I can write and add data on C# ( form application ) then I
Can you please tell me how I can write multidimensional map. For two dimensional
Can you please tell me how I can write multidimensional map. For two dimensional
I can write into a relative file 1 , then when I try to
One can write scripts in Scala. So you can put this into Hello.scala #!/bin/sh
I can write some links: <p>This value is 23456. <a class=edit href=# custom-data=2356>Edit</a></p> <p>This
I can write an app that would copy all input from cin into a

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.