提交 3e67c711 编写于 作者: Z Zhang Rui

ijksdl: align buffer of overlay

上级 be294d51
......@@ -112,13 +112,13 @@ static int android_render_rgb_on_rgb(ANativeWindow_Buffer *out_buffer, const SDL
if (dst_line_size == src_line_size) {
int plane_size = src_line_size * min_height;
// ALOGE("android_render_rgb_on_rgb %p %p %d", dst_pixels, src_pixels, plane_size);
// ALOGE("android_render_rgb_on_rgb (pix-match) %p %p %d", dst_pixels, src_pixels, plane_size);
memcpy(dst_pixels, src_pixels, plane_size);
} else {
// TODO: padding
int bytewidth = IJKMIN(dst_line_size, src_line_size);
// ALOGE("android_render_rgb_on_rgb %p %d %p %d %d %d", dst_pixels, dst_line_size, src_pixels, src_line_size, bytewidth, min_height);
// ALOGE("android_render_rgb_on_rgb (pix-mismatch) %p %d %p %d %d %d", dst_pixels, dst_line_size, src_pixels, src_line_size, bytewidth, min_height);
av_image_copy_plane(dst_pixels, dst_line_size, src_pixels, src_line_size, bytewidth, min_height);
}
......
......@@ -120,8 +120,6 @@ SDL_VoutOverlay *SDL_VoutFFmpeg_CreateOverlay(int width, int height, Uint32 form
return NULL;
}
width = IJKALIGN(width, 32);
SDL_VoutOverlay_Opaque *opaque = overlay->opaque;
overlay->format = format;
overlay->pitches = opaque->pitches;
......@@ -131,21 +129,24 @@ SDL_VoutOverlay *SDL_VoutFFmpeg_CreateOverlay(int width, int height, Uint32 form
enum AVPixelFormat ff_format = AV_PIX_FMT_NONE;
int planes = 0;
int buf_width = width;
int buf_width = width; // must be aligned to 16 bytes pitch for arm-neon image-convert
int buf_height = height;
switch (format) {
case SDL_FCC_YV12: {
ff_format = AV_PIX_FMT_YUV420P;
buf_width = IJKALIGN(width, 16); // 1 bytes per pixel for Y-plane
planes = 3;
break;
}
case SDL_FCC_RV16: {
ff_format = AV_PIX_FMT_RGB565;
buf_width = IJKALIGN(width, 8); // 2 bytes per pixel
planes = 1;
break;
}
case SDL_FCC_RV32: {
ff_format = AV_PIX_FMT_0BGR32;
buf_width = IJKALIGN(width, 4); // 4 bytes per pixel
planes = 1;
break;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册