如何为钴解码设置SbDecodeTargetInfo纹理?

时间:2019-02-22 11:58:54

标签: cobalt

我实现了钴球形特征。它对于1080p视频可以正常工作,但是如果我播放其他分辨率的视频(例如480p),则视频会反转。测试视频来自https://ytlr-cert.appspot.com/2019/main.html 格式为YUVNV12。

我附加了源核心,请问有谁能指出是什么原因造成的?

谢谢。

倒转的视频:

The image

我的来源:


  GL_CALL(glBindTexture(GL_TEXTURE_2D, out_info->planes[0].texture));

  GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
  GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
  GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
  GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));

  GL_CALL(glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA,
                   decode_target->videoframe_info.Stride,
                   decode_target->videoframe_info.imageHeight, 0, GL_ALPHA,
                   GL_UNSIGNED_BYTE, decode_target->buffer_y));

  out_info->planes[0].gl_texture_format = GL_ALPHA;
  out_info->planes[0].width  = decode_target->videoframe_info.Stride;
  out_info->planes[0].height = decode_target->videoframe_info.imageHeight;
  out_info->planes[0].content_region.right  = decode_target->videoframe_info.imageWidth;
  out_info->planes[0].content_region.bottom = decode_target->videoframe_info.imageHeight;


  GL_CALL(glBindTexture(GL_TEXTURE_2D, 0));

  GL_CALL(glBindTexture(GL_TEXTURE_2D, out_info->planes[1].texture));

  GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
  GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
  GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
  GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));

  GL_CALL(glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA,
                   decode_target->videoframe_info.Stride / 2,
                   decode_target->videoframe_info.imageHeight / 2, 0,
                   GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE,
                   decode_target->buffer_uv));

  GL_CALL(glBindTexture(GL_TEXTURE_2D, 0));

  out_info->planes[1].gl_texture_format = GL_LUMINANCE_ALPHA;
  out_info->planes[1].width  = decode_target->videoframe_info.Stride / 2;
  out_info->planes[1].height = decode_target->videoframe_info.imageHeight / 2;
  out_info->planes[1].content_region.right  = decode_target->videoframe_info.imageWidth / 2;
  out_info->planes[1].content_region.bottom = decode_target->videoframe_info.imageHeight / 2;


  out_info->width  = decode_target->videoframe_info.imageWidth;
  out_info->height = decode_target->videoframe_info.imageHeight;

  out_info->format = kSbDecodeTargetFormat2PlaneYUVNV12;

0 个答案:

没有答案