ProcessDataTask类中:数组转换一般400ms左右
if (mIsPortrait) {
long time1 = System.currentTimeMillis();
data = new byte[mData.length];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
data[x height + height - y - 1] = mData[x + y width];
//这一步的转换意义是?横竖屏转换?旋转90度?
}
}
int tmp = width;
width = height;
height = tmp;
经过打log测试发现,关键的时间损耗不在zbar的识别过程中,而是在onPreviewFrame所得的 byte[] 输入到zbar前的转换过程中,双层循环, preview size: width:1280,height:720时,也需要耗时400ms左右. 请问这个过程应该如何优化?
具体如下: zabarView.processData(data, width, height, false); 10ms(框内识别)/51ms(全屏识别)
ProcessDataTask类中:数组转换一般400ms左右 if (mIsPortrait) { long time1 = System.currentTimeMillis(); data = new byte[mData.length]; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { data[x height + height - y - 1] = mData[x + y width]; //这一步的转换意义是?横竖屏转换?旋转90度? } } int tmp = width; width = height; height = tmp;