frame.data_copy = new uint8_t[frame_size];
check_error();
frame.size = frame_size;
- frame.userdata = &userdata[frame_idx];
- userdata[frame_idx].pbo = pbo;
- userdata[frame_idx].pixel_format = pixel_format;
+ Userdata *ud = &userdata[frame_idx];
+ frame.userdata = ud;
+ ud->pbo = pbo;
+ ud->pixel_format = pixel_format;
frame.owner = this;
// For 8-bit non-planar Y'CbCr, we ask the driver to split Y' and Cb/Cr
// resolution is progressive.
switch (pixel_format) {
case bmusb::PixelFormat_8BitYCbCr:
- glGenTextures(2, userdata[frame_idx].tex_y);
+ glGenTextures(2, ud->tex_y);
check_error();
- glGenTextures(2, userdata[frame_idx].tex_cbcr);
+ glGenTextures(2, ud->tex_cbcr);
check_error();
break;
case bmusb::PixelFormat_10BitYCbCr:
- glGenTextures(2, userdata[frame_idx].tex_v210);
+ glGenTextures(2, ud->tex_v210);
check_error();
- glGenTextures(2, userdata[frame_idx].tex_444);
+ glGenTextures(2, ud->tex_444);
check_error();
break;
case bmusb::PixelFormat_8BitBGRA:
- glGenTextures(2, userdata[frame_idx].tex_rgba);
+ glGenTextures(2, ud->tex_rgba);
check_error();
break;
case bmusb::PixelFormat_8BitYCbCrPlanar:
- glGenTextures(2, userdata[frame_idx].tex_y);
+ glGenTextures(2, ud->tex_y);
check_error();
- glGenTextures(2, userdata[frame_idx].tex_cb);
+ glGenTextures(2, ud->tex_cb);
check_error();
- glGenTextures(2, userdata[frame_idx].tex_cr);
+ glGenTextures(2, ud->tex_cr);
check_error();
break;
default:
assert(false);
}
- userdata[frame_idx].last_width[0] = width;
- userdata[frame_idx].last_height[0] = height;
- userdata[frame_idx].last_cbcr_width[0] = width / 2;
- userdata[frame_idx].last_cbcr_height[0] = height;
- userdata[frame_idx].last_v210_width[0] = 0;
+ ud->last_width[0] = width;
+ ud->last_height[0] = height;
+ ud->last_cbcr_width[0] = width / 2;
+ ud->last_cbcr_height[0] = height;
+ ud->last_v210_width[0] = 0;
- userdata[frame_idx].last_width[1] = 0;
- userdata[frame_idx].last_height[1] = 0;
- userdata[frame_idx].last_cbcr_width[1] = 0;
- userdata[frame_idx].last_cbcr_height[1] = 0;
- userdata[frame_idx].last_v210_width[1] = 0;
+ ud->last_width[1] = 0;
+ ud->last_height[1] = 0;
+ ud->last_cbcr_width[1] = 0;
+ ud->last_cbcr_height[1] = 0;
+ ud->last_v210_width[1] = 0;
- userdata[frame_idx].last_interlaced = false;
- userdata[frame_idx].last_has_signal = false;
- userdata[frame_idx].last_is_connected = false;
+ ud->last_interlaced = false;
+ ud->last_has_signal = false;
+ ud->last_is_connected = false;
for (unsigned field = 0; field < 2; ++field) {
switch (pixel_format) {
case bmusb::PixelFormat_10BitYCbCr: {
// Seemingly we need to set the minification filter even though
// shader image loads don't use them, or NVIDIA will just give us
// zero back.
- glBindTexture(GL_TEXTURE_2D, userdata[frame_idx].tex_v210[field]);
+ glBindTexture(GL_TEXTURE_2D, ud->tex_v210[field]);
check_error();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
check_error();
if (field == 0) {
- userdata[frame_idx].last_v210_width[0] = v210_width;
+ ud->last_v210_width[0] = v210_width;
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB10_A2, v210_width, height, 0, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, nullptr);
check_error();
}
- glBindTexture(GL_TEXTURE_2D, userdata[frame_idx].tex_444[field]);
+ glBindTexture(GL_TEXTURE_2D, ud->tex_444[field]);
check_error();
set_clamp_to_edge();
if (field == 0) {
break;
}
case bmusb::PixelFormat_8BitYCbCr:
- glBindTexture(GL_TEXTURE_2D, userdata[frame_idx].tex_y[field]);
+ glBindTexture(GL_TEXTURE_2D, ud->tex_y[field]);
check_error();
set_clamp_to_edge();
if (field == 0) {
check_error();
}
- glBindTexture(GL_TEXTURE_2D, userdata[frame_idx].tex_cbcr[field]);
+ glBindTexture(GL_TEXTURE_2D, ud->tex_cbcr[field]);
check_error();
set_clamp_to_edge();
if (field == 0) {
}
break;
case bmusb::PixelFormat_8BitBGRA:
- glBindTexture(GL_TEXTURE_2D, userdata[frame_idx].tex_rgba[field]);
+ glBindTexture(GL_TEXTURE_2D, ud->tex_rgba[field]);
check_error();
set_clamp_to_edge();
if (field == 0) {
}
break;
case bmusb::PixelFormat_8BitYCbCrPlanar:
- glBindTexture(GL_TEXTURE_2D, userdata[frame_idx].tex_y[field]);
+ glBindTexture(GL_TEXTURE_2D, ud->tex_y[field]);
check_error();
set_clamp_to_edge();
if (field == 0) {
check_error();
}
- glBindTexture(GL_TEXTURE_2D, userdata[frame_idx].tex_cb[field]);
+ glBindTexture(GL_TEXTURE_2D, ud->tex_cb[field]);
check_error();
set_clamp_to_edge();
if (field == 0) {
check_error();
}
- glBindTexture(GL_TEXTURE_2D, userdata[frame_idx].tex_cr[field]);
+ glBindTexture(GL_TEXTURE_2D, ud->tex_cr[field]);
check_error();
set_clamp_to_edge();
if (field == 0) {