summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-09-25 13:58:18 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-09-25 13:58:18 +0000
commit2abdf6ac43192f9089466c50ad0639539bc2a18d (patch)
tree8cb264d96d6d0e21e4ba26e77d02863d9cb65d36 /libvo
parent408a146a4e9ab50bbb481754987cbe66230c2c3d (diff)
downloadmpv-2abdf6ac43192f9089466c50ad0639539bc2a18d.tar.bz2
mpv-2abdf6ac43192f9089466c50ad0639539bc2a18d.tar.xz
Fix crashes and green border when using YV12 input format
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16584 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_gl2.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c
index 81212b5d85..770f5711df 100644
--- a/libvo/vo_gl2.c
+++ b/libvo/vo_gl2.c
@@ -274,10 +274,10 @@ static int initTextures()
if (image_format == IMGFMT_YV12) {
ActiveTexture(GL_TEXTURE1);
glCreateClearTex(GL_TEXTURE_2D, gl_internal_format, GL_LINEAR,
- texture_width / 2, texture_height / 2, 0);
+ texture_width / 2, texture_height / 2, 128);
ActiveTexture(GL_TEXTURE2);
glCreateClearTex(GL_TEXTURE_2D, gl_internal_format, GL_LINEAR,
- texture_width / 2, texture_height / 2, 0);
+ texture_width / 2, texture_height / 2, 128);
ActiveTexture(GL_TEXTURE0);
}
@@ -959,6 +959,8 @@ flip_page(void)
//static inline uint32_t draw_slice_x11(uint8_t *src[], uint32_t slice_num)
static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y)
{
+ uint8_t *yptr = src[0], *uptr = src[1], *vptr = src[2];
+ int ystride = stride[0], ustride = stride[1], vstride = stride[2];
int rem_h = h;
struct TexSquare *texline = &texgrid[y / texture_height * texnumx];
int subtex_y = y % texture_width;
@@ -976,29 +978,29 @@ static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y)
ActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, tsq->texobj);
glUploadTex(GL_TEXTURE_2D, gl_bitmap_format, gl_bitmap_type,
- src[0], stride[0], subtex_x, subtex_y,
+ yptr, ystride, subtex_x, subtex_y,
subtex_w, subtex_h, 0);
ActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, tsq->uvtexobjs[0]);
glUploadTex(GL_TEXTURE_2D, gl_bitmap_format, gl_bitmap_type,
- src[1], stride[1], subtex_x, subtex_y,
+ uptr, ustride, subtex_x / 2, subtex_y / 2,
subtex_w / 2, subtex_h / 2, 0);
ActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, tsq->uvtexobjs[1]);
glUploadTex(GL_TEXTURE_2D, gl_bitmap_format, gl_bitmap_type,
- src[2], stride[2], subtex_x, subtex_y,
+ vptr, vstride, subtex_x / 2, subtex_y / 2,
subtex_w / 2, subtex_h / 2, 0);
subtex_x = 0;
- src[0] += subtex_w;
- src[1] += subtex_w / 2;
- src[2] += subtex_w / 2;
+ yptr += subtex_w;
+ uptr += subtex_w / 2;
+ vptr += subtex_w / 2;
tsq++;
rem_w -= subtex_w;
}
subtex_y = 0;
- src[0] += subtex_h * stride[0] - w;
- src[1] += subtex_h / 2 * stride[1] - w / 2;
- src[2] += subtex_h / 2 * stride[2] - w / 2;
+ yptr += subtex_h * ystride - w;
+ uptr += subtex_h / 2 * ustride - w / 2;
+ vptr += subtex_h / 2 * vstride - w / 2;
texline += texnumx;
rem_h -= subtex_h;
}