aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--drivers/mga_vid.c19
-rw-r--r--drivers/mga_vid.h2
-rw-r--r--libvo/mga_common.c4
-rw-r--r--libvo/vo_mga.c6
-rw-r--r--libvo/vo_xmga.c8
-rw-r--r--mplayer.c43
6 files changed, 76 insertions, 6 deletions
diff --git a/drivers/mga_vid.c b/drivers/mga_vid.c
index d8f1c36343..33b396da1c 100644
--- a/drivers/mga_vid.c
+++ b/drivers/mga_vid.c
@@ -395,6 +395,8 @@ static int mga_vid_set_config(mga_vid_config_t *config)
switch(config->format){
case MGA_VID_FORMAT_YV12:
+ case MGA_VID_FORMAT_I420:
+ case MGA_VID_FORMAT_IYUV:
regs.besctl = 1 // BES enabled
+ (0<<6) // even start polarity
+ (1<<10) // x filtering enabled
@@ -484,13 +486,17 @@ switch(config->format){
regs.besb1org = (uint32_t) mga_src_base + baseadrofs + 2*frame_size;
regs.besb2org = (uint32_t) mga_src_base + baseadrofs + 3*frame_size;
-if(config->format==MGA_VID_FORMAT_YV12){
+if(config->format==MGA_VID_FORMAT_YV12
+ ||config->format==MGA_VID_FORMAT_IYUV
+ ||config->format==MGA_VID_FORMAT_I420
+ ){
// planar YUV frames:
if (is_g400)
baseadrofs = (((ofstop*regs.besviscal)/4)>>16)*regs.bespitch;
else
baseadrofs = (((ofstop*regs.besviscal)/2)>>16)*regs.bespitch;
+ if(config->format==MGA_VID_FORMAT_YV12){
regs.besa1corg = (uint32_t) mga_src_base + baseadrofs + regs.bespitch * sh ;
regs.besa2corg = (uint32_t) mga_src_base + baseadrofs + 1*frame_size + regs.bespitch * sh;
regs.besb1corg = (uint32_t) mga_src_base + baseadrofs + 2*frame_size + regs.bespitch * sh;
@@ -499,6 +505,17 @@ if(config->format==MGA_VID_FORMAT_YV12){
regs.besa2c3org = regs.besa2corg + ((regs.bespitch * sh) / 4);
regs.besb1c3org = regs.besb1corg + ((regs.bespitch * sh) / 4);
regs.besb2c3org = regs.besb2corg + ((regs.bespitch * sh) / 4);
+ } else {
+ regs.besa1c3org = (uint32_t) mga_src_base + baseadrofs + regs.bespitch * sh ;
+ regs.besa2c3org = (uint32_t) mga_src_base + baseadrofs + 1*frame_size + regs.bespitch * sh;
+ regs.besb1c3org = (uint32_t) mga_src_base + baseadrofs + 2*frame_size + regs.bespitch * sh;
+ regs.besb2c3org = (uint32_t) mga_src_base + baseadrofs + 3*frame_size + regs.bespitch * sh;
+ regs.besa1corg = regs.besa1c3org + ((regs.bespitch * sh) / 4);
+ regs.besa2corg = regs.besa2c3org + ((regs.bespitch * sh) / 4);
+ regs.besb1corg = regs.besb1c3org + ((regs.bespitch * sh) / 4);
+ regs.besb2corg = regs.besb2c3org + ((regs.bespitch * sh) / 4);
+ }
+
}
weight = ofstop * (regs.besviscal >> 2);
diff --git a/drivers/mga_vid.h b/drivers/mga_vid.h
index 69eccefee7..55b807e7a1 100644
--- a/drivers/mga_vid.h
+++ b/drivers/mga_vid.h
@@ -38,6 +38,8 @@ uint32_t num_frames;
} mga_vid_config_t;
#define MGA_VID_FORMAT_YV12 0x32315659
+#define MGA_VID_FORMAT_IYUV (('I'<<24)|('Y'<<16)|('U'<<8)|'V')
+#define MGA_VID_FORMAT_I420 (('I'<<24)|('4'<<16)|('2'<<8)|'0')
#define MGA_VID_FORMAT_YUY2 (('Y'<<24)|('U'<<16)|('Y'<<8)|'2')
#define MGA_VID_FORMAT_UYVY (('U'<<24)|('Y'<<16)|('V'<<8)|'Y')
diff --git a/libvo/mga_common.c b/libvo/mga_common.c
index f9c281c19b..ca37ce0a63 100644
--- a/libvo/mga_common.c
+++ b/libvo/mga_common.c
@@ -14,6 +14,8 @@ static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned
uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31;
switch(mga_vid_config.format){
case MGA_VID_FORMAT_YV12:
+ case MGA_VID_FORMAT_IYUV:
+ case MGA_VID_FORMAT_I420:
vo_draw_alpha_yv12(w,h,src,srca,stride,vid_data+bespitch*y0+x0,bespitch);
break;
case MGA_VID_FORMAT_YUY2:
@@ -171,6 +173,8 @@ query_format(uint32_t format)
{
switch(format){
case IMGFMT_YV12:
+ case IMGFMT_I420:
+ case IMGFMT_IYUV:
case IMGFMT_YUY2:
case IMGFMT_UYVY:
// case IMGFMT_RGB|24:
diff --git a/libvo/vo_mga.c b/libvo/vo_mga.c
index 00e5b6afed..241d48de1a 100644
--- a/libvo/vo_mga.c
+++ b/libvo/vo_mga.c
@@ -67,6 +67,12 @@ init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint3
case IMGFMT_YV12:
mga_vid_config.frame_size = ((width + 31) & ~31) * height + (((width + 31) & ~31) * height) / 2;
mga_vid_config.format=MGA_VID_FORMAT_YV12; break;
+ case IMGFMT_I420:
+ mga_vid_config.frame_size = ((width + 31) & ~31) * height + (((width + 31) & ~31) * height) / 2;
+ mga_vid_config.format=MGA_VID_FORMAT_I420; break;
+ case IMGFMT_IYUV:
+ mga_vid_config.frame_size = ((width + 31) & ~31) * height + (((width + 31) & ~31) * height) / 2;
+ mga_vid_config.format=MGA_VID_FORMAT_IYUV; break;
case IMGFMT_YUY2:
mga_vid_config.frame_size = ((width + 31) & ~31) * height * 2;
mga_vid_config.format=MGA_VID_FORMAT_YUY2; break;
diff --git a/libvo/vo_xmga.c b/libvo/vo_xmga.c
index 35c4850d82..77401c501f 100644
--- a/libvo/vo_xmga.c
+++ b/libvo/vo_xmga.c
@@ -185,6 +185,14 @@ static uint32_t init( uint32_t width, uint32_t height, uint32_t d_width, uint32_
mga_vid_config.format=MGA_VID_FORMAT_YV12;
mga_vid_config.frame_size=( ( width + 31 ) & ~31 ) * height + ( ( ( width + 31 ) & ~31 ) * height ) / 2;
break;
+ case IMGFMT_I420:
+ mga_vid_config.format=MGA_VID_FORMAT_I420;
+ mga_vid_config.frame_size=( ( width + 31 ) & ~31 ) * height + ( ( ( width + 31 ) & ~31 ) * height ) / 2;
+ break;
+ case IMGFMT_IYUV:
+ mga_vid_config.format=MGA_VID_FORMAT_IYUV;
+ mga_vid_config.frame_size=( ( width + 31 ) & ~31 ) * height + ( ( ( width + 31 ) & ~31 ) * height ) / 2;
+ break;
case IMGFMT_YUY2:
mga_vid_config.format=MGA_VID_FORMAT_YUY2;
mga_vid_config.frame_size=( ( width + 31 ) & ~31 ) * height * 2;
diff --git a/mplayer.c b/mplayer.c
index 9b524ddad1..4bc9464e6a 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -909,11 +909,17 @@ switch(sh_video->codec->driver){
exit(1);
}
- if(out_fmt==IMGFMT_YUY2)
- DS_VideoDecoder_SetDestFmt(16,mmioFOURCC('Y', 'U', 'Y', '2'));
-// DS_VideoDecoder_SetDestFmt(16,mmioFOURCC('Y', 'V', '1', '2'));
- else
- DS_VideoDecoder_SetDestFmt(out_fmt&255,0);
+ switch(out_fmt){
+ case IMGFMT_YUY2:
+ case IMGFMT_UYVY:
+ DS_VideoDecoder_SetDestFmt(16,out_fmt);break; // packed YUV
+ case IMGFMT_YV12:
+ case IMGFMT_I420:
+ case IMGFMT_IYUV:
+ DS_VideoDecoder_SetDestFmt(12,out_fmt);break; // planar YUV
+ default:
+ DS_VideoDecoder_SetDestFmt(out_fmt&255,0); // RGB/BGR
+ }
DS_VideoDecoder_Start();
@@ -1023,6 +1029,9 @@ make_pipe(&keyb_fifo_get,&keyb_fifo_put);
if((out_fmt&IMGFMT_BGR_MASK)==IMGFMT_RGB)
printf("RGB%d\n",out_fmt&255); else
if(out_fmt==IMGFMT_YUY2) printf("YUY2\n"); else
+ if(out_fmt==IMGFMT_UYVY) printf("UYVY\n"); else
+ if(out_fmt==IMGFMT_I420) printf("I420\n"); else
+ if(out_fmt==IMGFMT_IYUV) printf("IYUV\n"); else
if(out_fmt==IMGFMT_YV12) printf("YV12\n");
}
@@ -1336,7 +1345,19 @@ switch(sh_video->codec->driver){
if(in_size>max_framesize) max_framesize=in_size;
DS_VideoDecoder_DecodeFrame(start, in_size, 0, 1);
+ current_module="draw_frame";
+
t2=GetTimer();t=t2-t;video_time_usage+=t*0.000001f;
+ if(out_fmt==IMGFMT_YV12||out_fmt==IMGFMT_IYUV||out_fmt==IMGFMT_I420){
+ uint8_t* dst[3];
+ int stride[3];
+ stride[0]=sh_video->disp_w;
+ stride[1]=stride[2]=sh_video->disp_w/2;
+ dst[0]=sh_video->our_out_buffer;
+ dst[2]=dst[0]+sh_video->disp_w*sh_video->disp_h;
+ dst[1]=dst[2]+sh_video->disp_w*sh_video->disp_h/4;
+ video_out->draw_slice(dst,stride,sh_video->disp_w,sh_video->disp_h,0,0);
+ } else
video_out->draw_frame((uint8_t **)&sh_video->our_out_buffer);
t2=GetTimer()-t2;vout_time_usage+=t2*0.000001f;
break;
@@ -1359,7 +1380,19 @@ switch(sh_video->codec->driver){
&sh_video->o_bih, sh_video->our_out_buffer);
if(ret){ printf("Error decompressing frame, err=%d\n",ret);break; }
}
+ current_module="draw_frame";
t2=GetTimer();t=t2-t;video_time_usage+=t*0.000001f;
+// if(out_fmt==IMGFMT_YV12){
+ if(out_fmt==IMGFMT_YV12||out_fmt==IMGFMT_IYUV||out_fmt==IMGFMT_I420){
+ uint8_t* dst[3];
+ int stride[3];
+ stride[0]=sh_video->disp_w;
+ stride[1]=stride[2]=sh_video->disp_w/2;
+ dst[0]=sh_video->our_out_buffer;
+ dst[2]=dst[0]+sh_video->disp_w*sh_video->disp_h;
+ dst[1]=dst[2]+sh_video->disp_w*sh_video->disp_h/4;
+ video_out->draw_slice(dst,stride,sh_video->disp_w,sh_video->disp_h,0,0);
+ } else
video_out->draw_frame((uint8_t **)&sh_video->our_out_buffer);
t2=GetTimer()-t2;vout_time_usage+=t2*0.000001f;