Giter Site home page Giter Site logo

bookzhan / yuvrenderscript Goto Github PK

View Code? Open in Web Editor NEW
20.0 4.0 6.0 137 KB

The strongest YUV conversion RenderScript in history, supports conversion to RGBA, BGRA, and supports rotation and flipping simultaneously. The YUV data format supports NV21, YV12, YUV420_888, corresponding to the YUV processing of Android Camera1API and Camera2 API.

Java 74.15% RenderScript 25.85%
yuv2rgb renderscript android camera camera2-api yuv420 nv21 yuv rgba

yuvrenderscript's Introduction

The strongest YUV conversion RenderScript in history, supports conversion to RGBA, BGRA, and supports rotation and flipping simultaneously. The YUV data format supports NV21, YV12, YUV420_888, corresponding to the YUV processing of Android Camera1API and Camera2 API.

​ During this time, I was doing some Android Camera data processing related work, involving YUV to RGBA. Due to the extremely high performance requirements, I have adopted a variety of solutions. At first, I tried the methods in OpenCV and finally found the performance. Not very ideal. Finally, libyuv was used. The performance of this library is better than libyuv. The performance requirements are not particularly high. You can use this library. This library has certain defects. The degree of image restoration after YUV conversion is very bad, and there is obviously a color difference And, on Android phones running for a long time, the performance drops significantly. Finally, there is no way to start using RenderScript. I have to talk about Google. He only provides a ScriptIntrinsicYuvToRGB, and does not support YUV420_888, nor does it support rotation, flipping. Nausea! Only wrote it myself!

The supported methods are as follows:

  1. yuv_yv12_2_Bitmap
  2. yuv_yv12_2_RGBA
  3. yuv_yv12_2_BGRA
  4. yuv_nv21_2_Bitmap
  5. yuv_nv21_2_RGBA
  6. yuv_nv21_2_BGRA
  7. yuv420_2_Bitmap
  8. yuv420_2_RGBA
  9. yuv420_2_BGRA

Give me a star if you like,Thanks!

中文文档地址(Chinese document address):http://www.bzblog.online/wordpress/index.php/2020/01/19/yuvrenderscript/

yuvrenderscript's People

Contributors

bookzhan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

yuvrenderscript's Issues

Cannot resolved bzyuv

I've meet a problem with lib bzyuv from import com.luoye.bzyuv.ScriptC_bz_yuv_util. I don't see lib bzyuv.
Can you show me solution?

YUV转RGB颜色失真

1、在Camera2Activity中onImageAvailable,u和v数据错位了:
if (null == yBuffer) {
yBuffer = new byte[width * height];
}
if (null == uBuffer) {
uBuffer = new byte[planes[1].getBuffer().capacity()];
}
if (null == vBuffer) {
vBuffer = new byte[planes[2].getBuffer().capacity()];
}
planes[0].getBuffer().get(yBuffer);
planes[1].getBuffer().get(vBuffer);
planes[2].getBuffer().get(uBuffer);
2、在YuvConvertUtil的convertYuv420中,U,V数据也错位:
scriptC_yuv.set_mInU(vIn);
scriptC_yuv.set_mInV(uIn);
3、运行,把YUV420_8888的数据转化为RGB,图片失去颜色变成会灰度图

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.