3

Our application is related to showing live vidoe data received from other end, we need to display live feeds at an interval of 40 ms ,

The data will receive in YUV Format and it seems android doesn't have any inbuilt support to display the YUV data,

This below is the code to manage and show the data to the Screen,

                        // convert the data to RGB 
                            feedProcess.decode(yuvBuffer,
                                    yuvBuffer.length, imgInfo, imgRaw, ref,
                                    webMIndex);


                            currentTime=new Date().getTime();
                            System.out
                            .println("took "+(currentTime-lastTime) +" ms to decode the buffer " );
                            imgQ.add(imgRaw);


In Another thread i will receiving data and converting it into the Bitmap 

            public void run() {
                // TODO Auto-generated method stub
                while(myThreadRun){
                    if(!imgQ.isEmpty()){
                        try{
                        byte[] arry=imgQ.poll();
                        Bitmap b=createImgae(arry, imgInfo[0], imgInfo[1], 1,width,height);
                        myThreadSurfaceView.setBitmap(b);

                        try {
// draw the image 
                            c = myThreadSurfaceHolder.lockCanvas(null);
                            synchronized (myThreadSurfaceHolder) {
                                                                myThreadSurfaceView.onDraw(c);

                            }
                        } finally {
                            if (c != null) {
                                myThreadSurfaceHolder
                                        .unlockCanvasAndPost(c);
                            }
                        }
                        }catch(NoSuchElementException ex){
                        }
                    }
                }
            }

This Entire logic is taking approx 100 ms to refresh the screen with the new image, are there any other approches that i can try it out ,

Decode function uncompress which takes 10-15 ms + convert YUV to RGB ( 20-30)ms , and this is done in JNI Code,

My understanding is , if YUV data can be shown directly then we can save some time from here,

Please tell your views

Amitg2k12
  • 3,765
  • 10
  • 48
  • 97
  • 1
    See this one @Rohan http://stackoverflow.com/questions/9192982/displaying-yuv-image-in-android – Mehul Jun 06 '12 at 11:19

0 Answers0