| 50 | } |
| 51 | |
| 52 | int Algorithm::processVideoFrame(GLuint textureId, size_t width, |
| 53 | size_t height) { |
| 54 | if (!valid_) { |
| 55 | return -1; |
| 56 | } |
| 57 | |
| 58 | bmf_lite::HardwareDeviceSetInfo set_info; |
| 59 | set_info.device_type = bmf_lite::kHWDeviceTypeEGLCtx; |
| 60 | bmf_lite::EGLContextInfo egl_context_info_create{eglDisplay_, eglContext_, |
| 61 | eglSurface_, eglSurface_}; |
| 62 | set_info.context_info = &egl_context_info_create; |
| 63 | set_info.owned = 0; |
| 64 | |
| 65 | std::shared_ptr<bmf_lite::HWDeviceContext> device_context; |
| 66 | bmf_lite::HWDeviceContextManager::setHwDeviceContext(&set_info, |
| 67 | device_context); |
| 68 | bmf_lite::HardwareDataInfo data_info = { |
| 69 | bmf_lite::MemoryType::kOpenGLTexture2d, bmf_lite::GLES_TEXTURE_RGBA, 0}; |
| 70 | |
| 71 | std::shared_ptr<bmf_lite::VideoBuffer> videoBuffer; |
| 72 | bmf_lite::VideoBufferManager::createTextureVideoBufferFromExistingData( |
| 73 | (void *)textureId, width, height, &data_info, device_context, NULL, |
| 74 | videoBuffer); |
| 75 | bmf_lite::VideoFrame videoFrame(videoBuffer); |
| 76 | |
| 77 | bmf_lite::Param param; |
| 78 | param.setInt("sharp_level", 0); // for super_resolution only |
| 79 | param.setInt("scale_mode", 0); // for super_resolution only |
| 80 | return algorithm_->processVideoFrame(videoFrame, param); |
| 81 | } |
| 82 | |
| 83 | int Algorithm::getVideoFrameOutput(GLuint &textureId, size_t &width, |
| 84 | size_t &height) { |