[MPlayer-dev-eng] patch for hardware eq with mga_vid
Brian J. Murrell
c431666013141952f09864eb793058b5 at interlinx.bc.ca
Sat Mar 9 12:14:55 CET 2002
OK, I hacked all night, figuring exactly how the existing vidix
hardware EQ worked and did likewise for the mga driver. Find attached
a patch which implements the hardware EQ for mga_vid.o. It includes
both the userspace and kernel module changes to make this work exactly
as it does for vidix.
I would be most appreciative if it could be applied to CVS ASAP.
Thanx,
b.
P.S. I think I got the scale values for both the brightness and
contrast right, but I may be wrong. If a G400 expert could look at
mga_set_video_eq() and mga_set_video_eq() in libvo/mga_common.c and
review whether I got them right, I would appreciate it.
b.
--
Brian J. Murrell
-------------- next part --------------
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.424
diff -u -r1.424 mplayer.c
--- mplayer.c 7 Mar 2002 17:50:24 -0000 1.424
+++ mplayer.c 9 Mar 2002 11:20:15 -0000
@@ -2526,6 +2527,7 @@
osd_visible=sh_video->fps; // 1 sec
vo_osd_progbar_type=OSD_CONTRAST;
vo_osd_progbar_value=((v_cont)<<8)/100;
+ if(v_hw_equ_cap) vo_osd_progbar_value = ((v_cont+100)<<8)/200;
}
#endif
}
@@ -2548,6 +2550,7 @@
osd_visible=sh_video->fps; // 1 sec
vo_osd_progbar_type=OSD_BRIGHTNESS;
vo_osd_progbar_value=((v_bright)<<8)/100;
+ if(v_hw_equ_cap) vo_osd_progbar_value = ((v_bright+100)<<8)/200;
}
#endif
}
@@ -2570,6 +2573,7 @@
osd_visible=sh_video->fps; // 1 sec
vo_osd_progbar_type=OSD_HUE;
vo_osd_progbar_value=((v_hue)<<8)/100;
+ if(v_hw_equ_cap) vo_osd_progbar_value = ((v_hue+100)<<8)/200;
}
#endif
}
@@ -2592,6 +2596,7 @@
osd_visible=sh_video->fps; // 1 sec
vo_osd_progbar_type=OSD_SATURATION;
vo_osd_progbar_value=((v_saturation)<<8)/100;
+ if(v_hw_equ_cap) vo_osd_progbar_value = ((v_saturation+100)<<8)/200;
}
#endif
}
@@ -2635,7 +2640,7 @@
if ( ( use_gui )&&( cmd->id > MP_CMD_GUI_EVENTS ) ) guiGetEvent( guiIEvent,(char *)cmd->id );
else
#endif
- printf("Received unknow cmd %s\n",cmd->name);
+ printf("Received unknown cmd %s\n",cmd->name);
}
}
mp_cmd_free(cmd);
Index: drivers/mga_vid.c
===================================================================
RCS file: /cvsroot/mplayer/main/drivers/mga_vid.c,v
retrieving revision 1.38
diff -u -r1.38 mga_vid.c
--- drivers/mga_vid.c 16 Feb 2002 19:58:39 -0000 1.38
+++ drivers/mga_vid.c 9 Mar 2002 11:20:16 -0000
@@ -1141,6 +1146,8 @@
static int mga_vid_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
int frame;
+ uint32_t tmp;
+
switch(cmd)
{
@@ -1231,6 +1238,22 @@
mga_vid_frame_sel(frame);
break;
+ case MGA_VID_GET_LUMA:
+ tmp = regs.beslumactl - 0x80;
+ if (copy_to_user((uint32_t *) arg, &tmp, sizeof(uint32_t)))
+ {
+ printk(KERN_ERR "mga_vid: failed copy %p to userspace %p\n",
+ &tmp, (uint32_t *) arg);
+ return(-EFAULT);
+ }
+ break;
+
+ case MGA_VID_SET_LUMA:
+ tmp = arg;
+ regs.beslumactl = tmp + 0x80;
+ mga_vid_write_regs(0);
+ break;
+
default:
printk(KERN_ERR "mga_vid: Invalid ioctl\n");
return (-EINVAL);
Index: drivers/mga_vid.h
===================================================================
RCS file: /cvsroot/mplayer/main/drivers/mga_vid.h,v
retrieving revision 1.7
diff -u -r1.7 mga_vid.h
--- drivers/mga_vid.h 23 May 2001 19:51:52 -0000 1.7
+++ drivers/mga_vid.h 9 Mar 2002 11:20:16 -0000
@@ -47,6 +47,8 @@
#define MGA_VID_ON _IO ('J', 2)
#define MGA_VID_OFF _IO ('J', 3)
#define MGA_VID_FSEL _IOR('J', 4, int)
+#define MGA_VID_GET_LUMA _IOR('J', 5, int)
+#define MGA_VID_SET_LUMA _IOR('J', 6, int)
#define MGA_G200 0x1234
#define MGA_G400 0x5678
Index: libvo/mga_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/mga_common.c,v
retrieving revision 1.21
diff -u -r1.21 mga_common.c
--- libvo/mga_common.c 7 Mar 2002 17:50:25 -0000 1.21
+++ libvo/mga_common.c 9 Mar 2002 11:20:17 -0000
@@ -29,6 +29,42 @@
}
}
+static int mga_set_video_eq( const vidix_video_eq_t *info)
+{
+
+ uint32_t luma;
+ float factor = 256.0 / 2000;
+
+ luma = ((int)(info->brightness * factor) << 16) +
+ ((int)(info->contrast * factor) & 0xFFFF);
+ if (ioctl(f,MGA_VID_SET_LUMA,luma)) {
+ perror("Error in mga_vid_config ioctl()");
+ printf("Could not set luma values in the kernel module!\n");
+ return -1;
+ }
+ return 0;
+
+}
+
+static int mga_get_video_eq( vidix_video_eq_t *info)
+{
+
+ uint32_t luma;
+ float factor = 2000.0 / 256;
+
+ if (ioctl(f,MGA_VID_GET_LUMA,&luma)) {
+ perror("Error in mga_vid_config ioctl()");
+ printf("Could not get luma values from the kernel module!\n");
+ return -1;
+ }
+ info->brightness = (luma >> 16) * factor;
+ info->cap |= VEQ_CAP_BRIGHTNESS;
+
+ info->contrast = (luma & 0xFFFF) * factor;
+ info->cap |= VEQ_CAP_CONTRAST;
+
+ return 0;
+}
//static void
//write_slice_g200(uint8_t *y,uint8_t *cr, uint8_t *cb,uint32_t slice_num)
@@ -230,9 +266,18 @@
return 0;
}
+static void query_vaa(vo_vaa_t *vaa)
+{
+ memset(vaa,0,sizeof(vo_vaa_t));
+ vaa->get_video_eq = mga_get_video_eq;
+ vaa->set_video_eq = mga_set_video_eq;
+}
static uint32_t control(uint32_t request, void *data, ...)
{
switch (request) {
+ case VOCTRL_QUERY_VAA:
+ query_vaa((vo_vaa_t*)data);
+ return VO_TRUE;
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
case VOCTRL_GET_IMAGE:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20020309/534399bd/attachment.pgp>
More information about the MPlayer-dev-eng
mailing list