minor fixes

This commit is contained in:
Andrey Pavlenko
2015-10-08 12:21:05 +03:00
parent a041105491
commit 23fea91e84
3 changed files with 36 additions and 27 deletions

View File

@@ -237,23 +237,17 @@ void drawFrameProcCPU(int w, int h, int texOut)
int64_t t;
// let's modify pixels in FBO texture in C++ code (on CPU)
const int BUFF_SIZE = 1<<24;//2k*2k*4;
static char tmpBuff[BUFF_SIZE];
if(w*h > BUFF_SIZE)
{
LOGE("Internal temp buffer is too small, can't make CPU frame processing");
return;
}
static cv::Mat m;
m.create(h, w, CV_8UC4);
// read
t = getTimeMs();
// expecting FBO to be bound
glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, tmpBuff);
glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, m.data);
LOGD("glReadPixels() costs %d ms", getTimeInterval(t));
// modify
t = getTimeMs();
cv::Mat m(h, w, CV_8UC4, tmpBuff);
cv::Laplacian(m, m, CV_8U);
m *= 10;
LOGD("Laplacian() costs %d ms", getTimeInterval(t));
@@ -262,7 +256,7 @@ void drawFrameProcCPU(int w, int h, int texOut)
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texOut);
t = getTimeMs();
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, tmpBuff);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, m.data);
LOGD("glTexSubImage2D() costs %d ms", getTimeInterval(t));
}