What is the fastest way to convert JPEG byte data to raw greyscale byte information?

醉酒当歌 提交于 2021-01-28 09:22:09

问题


Since the Raw callback from takePhoto is not reliable I have to use the JPEG callback... What I'm basicly getting is a byte array which holds all the information in JPEG data-form. I now need to somehow get this to be only grayscale information with each pixel having a value of 0-255...

At the moment I'm converting the jpeg data array to Bitmap using BitmapFactory.decodeByteArray and then converting the bitmap to grayscale by using getPixel(), which is pretty bad performance wise...

Does anyone have any experience with this?


回答1:


Theoretically, the fastest way would be to just decode the Y component and ignore Cb and Cr in the stream.



来源:https://stackoverflow.com/questions/47139477/what-is-the-fastest-way-to-convert-jpeg-byte-data-to-raw-greyscale-byte-informat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!