[MPlayer-cvslog] r32280 - trunk/libvo/mga_template.c
ramiro
subversion at mplayerhq.hu
Fri Sep 17 01:25:04 CEST 2010
Author: ramiro
Date: Fri Sep 17 01:25:04 2010
New Revision: 32280
Log:
mga: use libswscale interface for g200 (untested)
Modified:
trunk/libvo/mga_template.c
Modified: trunk/libvo/mga_template.c
==============================================================================
--- trunk/libvo/mga_template.c Thu Sep 16 21:19:13 2010 (r32279)
+++ trunk/libvo/mga_template.c Fri Sep 17 01:25:04 2010 (r32280)
@@ -19,6 +19,7 @@
#include "fastmemcpy.h"
#include "cpudetect.h"
#include "libswscale/swscale.h"
+#include "libavcore/imgutils.h"
#include "libmpcodecs/vf_scale.h"
#include "mp_msg.h"
#include "help_mp.h"
@@ -41,6 +42,8 @@ static uint32_t drwBorderW
#endif
static uint32_t drwcX,drwcY,dwidth,dheight;
+static struct SwsContext *sws_ctx;
+
static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31;
x0+=mga_vid_config.src_width*(vo_panscan_x>>1)/(vo_dwidth+vo_panscan_x);
@@ -66,25 +69,18 @@ static void draw_osd(void)
}
-#if 0 // Should use libswscale's interface to NV12
static void
draw_slice_g200(uint8_t *image[], int stride[], int width,int height,int x,int y)
{
- uint8_t *dest;
uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31;
+ int dst_stride[4] = { bespitch, bespitch };
+ uint8_t *dst[4];
- dest = vid_data + bespitch*y + x;
- mem2agpcpy_pic(dest, image[0], width, height, bespitch, stride[0]);
-
- width/=2;height/=2;x/=2;y/=2;
-
- dest = vid_data + bespitch*mga_vid_config.src_height + bespitch*y + 2*x;
+ av_image_fill_pointers(dst, PIX_FMT_NV12, mga_vid_config.src_height,
+ vid_data, dst_stride);
- interleaveBytes(image[1],image[2],dest,
- width, height,
- stride[1], stride[2], bespitch);
+ sws_scale(sws_ctx, image, stride, y, height, dst, dst_stride);
}
-#endif
static void
draw_slice_g400(uint8_t *image[], int stride[], int w,int h,int x,int y)
@@ -127,11 +123,9 @@ draw_slice(uint8_t *src[], int stride[],
w,h,x,y);
#endif
-#if 0
if (mga_vid_config.card_type == MGA_G200)
draw_slice_g200(src,stride,w,h,x,y);
else
-#endif
draw_slice_g400(src,stride,w,h,x,y);
return 0;
}
@@ -433,8 +427,16 @@ static int mga_init(int width,int height
}
}
if (mga_vid_config.card_type == MGA_G200) {
- mp_msg(MSGT_VO, MSGL_FATAL, "G200 cards support is currently broken. patches welcome.\n");
- return -1;
+ sws_ctx = sws_getContext(width, height, PIX_FMT_YUV420P,
+ width, height, PIX_FMT_NV12,
+ SWS_BILINEAR, NULL, NULL, NULL);
+ if (!sws_ctx) {
+ mp_msg(MSGT_VO, MSGL_FATAL,
+ "Could not get swscale context to scale for G200.\n");
+ return -1;
+ }
+ mp_msg(MSGT_VO, MSGL_WARN, "G200 cards support is untested. "
+ "Please report whether it works.\n");
}
mp_msg(MSGT_VO,MSGL_V,"[MGA] Using %d buffers.\n",mga_vid_config.num_frames);
@@ -463,6 +465,9 @@ static int mga_uninit(void){
close(f);
f = -1;
}
+ if (sws_ctx) {
+ sws_freeContext(sws_ctx);
+ }
return 0;
}
More information about the MPlayer-cvslog
mailing list