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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:02:07+00:00 2026-06-06T01:02:07+00:00

in public void onPreviewFrame(byte[] data, Camera camera) we get the data in YUV format.

  • 0

in

public void onPreviewFrame(byte[] data, Camera camera) 

we get the data in YUV format. Now for converting to RGB I have used a converter in NDK. But it is still not fast enough.

So I found this:
http://www.roman10.net/effective-color-conversion-yuv-rgb-in-android-in-assembly/

which has this NDK method:
https://github.com/roman10/roman10-android-tutorial/blob/master/colorConversion/jni/test.c

but I do not know how to change it so it would accept the YUV byte array ‘data’ and return me an RGB int array?

  • 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-06T01:02:10+00:00Added an answer on June 6, 2026 at 1:02 am

    You must write a JNI function similar to naGetConvertedFrame(). The new function will have the following declaration:

    JNIEXPORT void JNICALL Java_<name>_convert(JNIEnv * pEnv, jobject pObj, jobject pBitmap, jbyteArray jData, jint jWidth, jint jHeight)
    

    The name of the function should reflect the name of the Java class that will declare this function as native method (see RenderView.java as example). In Roman’s example the shared library is loaded from another class, in Main.java – but this loadLibrary() could be easily trasnferred into RenderView.java file.

    private static native void convert(Bitmap _bitmap, byte[] data, int _width, int _height);
    

    Your function will be similar to the original example, only it will not read a file, but rather use GetByteArrayElements() to acquire y, u, and v pointers for the convertor.

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

Sidebar

Related Questions

In following method, public void onPreviewFrame4(byte[] data, Camera camera) data is come in Yuv
public void GrabData() throws IOException { try { BufferedReader br = new BufferedReader(new FileReader(data/500.txt));
public void test(Object obj){ //Here i have to set the values of the obj
When trying to convert the byte[] of Camera.onPreviewFrame to Bitamp using BitmapFactory.decodeByteArray gives me
public void Insert(int value) { if (value < Data) { if (LeftNode == null)
public void PlayforMe() { for (int i=game.size()-1;i>=1;i--) { Card a = game.get(i); Card b
public void get(View view){ try { asPt = new ProgressTask().execute(null,null,null); Log.d(Watcher,Get finished); } catch
public void printList( ){ Node<E> p ; System.out.printf( [ ) ; for ( p=head.next
public void openOptions() { Intent intent=new Intent(this,Game.class); //intent.putExtra(razmer, level); startActivity(intent); // Intent intent=new Intent(this,Options.class);
public void swap(Point var1, Point var2) { var1.x = 100; var1.y = 100; Point

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.