summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-30 01:34:20 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-30 01:34:20 +0000
commitac3b6c65523c941b5058dba1e9fa5c852ef8d085 (patch)
treece4f0ea060d42636960d93c35fb051ad0b3b87ac /libvo
parentc4afe3339f28aba819642c0333705fb3a531c241 (diff)
downloadmpv-ac3b6c65523c941b5058dba1e9fa5c852ef8d085.tar.bz2
mpv-ac3b6c65523c941b5058dba1e9fa5c852ef8d085.tar.xz
- optional slice height for -vo gl (example: -vo gl:32)
based on patch by Dmitry Baryshkov <lumag@qnc.ru> - default height changed from 1 to 4, seems to be more optimal and works fast on both g400max & gf4ti4200 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8655 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_gl.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index 170c8d3c54..965fe9017a 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -58,6 +58,8 @@ static uint32_t image_bytes;
static uint32_t texture_width;
static uint32_t texture_height;
+static int slice_height=1;
+
static void resize(int x,int y){
printf("[gl] Resize: %dx%d\n",x,y);
glViewport( 0, 0, x, y );
@@ -286,13 +288,13 @@ static uint32_t draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y
yuv2rgb(ImageData, src[0], src[1], src[2],
w,h, dstride, stride[0],stride[1]);
- for(i=0;i<h;i++){
+ for(i=0;i<h;i+=slice_height){
glTexSubImage2D( GL_TEXTURE_2D, // target
0, // level
x, // x offset
y+i, // y offset
w, // width
- 1, // height
+ (i+slice_height<=h)?slice_height:h-i, // height
(BYTES_PP==4)?GL_RGBA:GL_RGB, // format
GL_UNSIGNED_BYTE, // type
ImageData+i*dstride ); // *pixels
@@ -310,13 +312,13 @@ int i;
image_width, image_height,
image_width*BYTES_PP, image_width, image_width/2 );
- for(i=0;i<image_height;i++){
+ for(i=0;i<image_height;i+=slice_height){
glTexSubImage2D( GL_TEXTURE_2D, // target
0, // level
0, // x offset
i, // y offset
image_width, // width
- 1, // height
+ (i+slice_height<=image_height)?slice_height:image_height-i, // height
(BYTES_PP==4)?GL_RGBA:GL_RGB, // format
GL_UNSIGNED_BYTE, // type
ImageData+i*BYTES_PP*image_width ); // *pixels
@@ -331,10 +333,11 @@ draw_frame_x11_bgr(uint8_t *src[])
{
int i;
uint8_t *s=src[0];
-uint8_t *de=&ImageData[3*image_width];
- for(i=0;i<image_height;i++){
+ for(i=0;i<image_height;i+=slice_height){
+ int h=(i+slice_height<=image_height)?slice_height:image_height-i;
uint8_t *d=ImageData;
+ uint8_t *de=&ImageData[3*image_width*h];
while(d<de){
d[0]=s[2];
d[1]=s[1];
@@ -347,7 +350,7 @@ uint8_t *de=&ImageData[3*image_width];
// image_height-1-i, // y offset
i, // y offset
image_width, // width
- 1, // height
+ h, // height
(image_bytes==4)?GL_RGBA:GL_RGB, // format
GL_UNSIGNED_BYTE, // type
ImageData); // *pixels
@@ -362,14 +365,14 @@ draw_frame_x11_rgb(uint8_t *src[])
int i;
uint8_t *ImageData=src[0];
- for(i=0;i<image_height;i++){
+ for(i=0;i<image_height;i+=slice_height){
glTexSubImage2D( GL_TEXTURE_2D, // target
0, // level
0, // x offset
// image_height-1-i, // y offset
i, // y offset
image_width, // width
- 1, // height
+ (i+slice_height<=image_height)?slice_height:image_height-i, // height
(image_bytes==4)?GL_RGBA:GL_RGB, // format
GL_UNSIGNED_BYTE, // type
ImageData+i*image_bytes*image_width ); // *pixels
@@ -417,9 +420,15 @@ static uint32_t preinit(const char *arg)
{
if(arg)
{
- printf("[gl] Unknown subdevice: %s\n",arg);
- return ENOSYS;
+ slice_height = atoi(arg);
+ if (slice_height <= 0)
+ slice_height = 65536;
+ }
+ else
+ {
+ slice_height = 4;
}
+ printf("[vo_gl] Using %d as slice_height (0 means image_height).\n", slice_height);
if( !vo_init() ) return -1; // Can't open X11