提交 f5e9709e 编写于 作者: B bbcallen

ios: gles: correct alignment of gles texture

上级 78c40fc0
......@@ -144,13 +144,22 @@ SDL_VoutOverlay *SDL_VoutFFmpeg_CreateOverlay(int width, int height, Uint32 form
overlay->h = height;
enum AVPixelFormat ff_format = AV_PIX_FMT_NONE;
int buf_width = width; // must be aligned to 16 bytes pitch for arm-neon image-convert
int buf_width = width;
int buf_height = height;
switch (format) {
case SDL_FCC_I420:
case SDL_FCC_YV12: {
ff_format = AV_PIX_FMT_YUV420P;
// FIXME: need runtime config
#if defined(__ANDROID__)
// 16 bytes align pitch for arm-neon image-convert
buf_width = IJKALIGN(width, 16); // 1 bytes per pixel for Y-plane
#elif defined(__APPLE__)
// 2^n align for width
buf_width = 1 << (sizeof(int) * 8 - __builtin_clz(width));
#else
buf_width = IJKALIGN(width, 16); // unknown platform
#endif
opaque->planes = 3;
break;
}
......
......@@ -86,8 +86,8 @@ static NSString *const g_yuvFragmentShaderString = IJK_SHADER_STRING
if (0 == _textures[0])
glGenTextures(3, _textures);
const UInt8 *pixels[3] = {overlay->pixels[0], overlay->pixels[1], overlay->pixels[2]};
const NSUInteger widths[3] = { frameWidth, frameWidth / 2, frameWidth / 2 };
const UInt8 *pixels[3] = { overlay->pixels[0], overlay->pixels[1], overlay->pixels[2] };
const NSUInteger widths[3] = { overlay->pitches[0], overlay->pitches[1], overlay->pitches[2] };
const NSUInteger heights[3] = { frameHeight, frameHeight / 2, frameHeight / 2 };
for (int i = 0; i < 3; ++i) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册