2

I implement the cobalt spherical feature. It work correctly for 1080p video, but if I play another resolution video such as 480p, the video is reversed.The test video is from https://ytlr-cert.appspot.com/2019/main.html the format is YUVNV12.

I attach source core, could any one help to point out which caused it?

Thanks.

The reversed video:

The image

My Source:


  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;
Kevin
  • 21
  • 4
  • Hi Kevin.Thank you for your question. But please edit your post with the text of the source code. I am sure that you would not appreciate any potential answers in a photographic format. Regards. – Elletlar Feb 22 '19 at 12:13
  • Is it possible that your video decoder is producing differently oriented video frames for 480p? If so you can express this to Cobalt by swapping content_region.top and content_region.bottom. – Andrew Top Feb 24 '19 at 20:59
  • Thanks. It work after I swap top and bottom. – Kevin Feb 25 '19 at 06:29
  • hi Andrew, Now, all resolution videos except 480p work correctly, only 480p video show garbage. There is a different for 480p video. The video frame of 480p include a stride, I'm not sure how to set panel width and out_info width. I have attached all source code, could you help on it? thanks in advance. – Kevin Feb 25 '19 at 06:41

0 Answers0