[Mplayer-cvslog] CVS: main/libvo vo_gl.c,1.33,1.34
Arpi of Ize
arpi at mplayerhq.hu
Mon Dec 30 02:34:34 CET 2002
Update of /cvsroot/mplayer/main/libvo
In directory mail:/var/tmp.root/cvs-serv19581
Modified Files:
vo_gl.c
Log Message:
- optional slice height for -vo gl (example: -vo gl:32)
based on patch by Dmitry Baryshkov <lumag at qnc.ru>
- default height changed from 1 to 4, seems to be more optimal and works
fast on both g400max & gf4ti4200
Index: vo_gl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- vo_gl.c 11 Nov 2002 15:20:26 -0000 1.33
+++ vo_gl.c 30 Dec 2002 01:34:20 -0000 1.34
@@ -58,6 +58,8 @@
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 @@
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 @@
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 @@
{
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 @@
// 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 @@
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 @@
{
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
More information about the MPlayer-cvslog
mailing list