[MPlayer-cvslog] CVS: main/vidix/drivers nvidia_vid.c,1.27,1.28

Reimar Döffinger CVS syncmail at mplayerhq.hu
Sat Sep 3 21:31:12 CEST 2005


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main/vidix/drivers
In directory mail:/var2/tmp/cvs-serv6296/vidix/drivers

Modified Files:
	nvidia_vid.c 
Log Message:
equalizer support


Index: nvidia_vid.c
===================================================================
RCS file: /cvsroot/mplayer/main/vidix/drivers/nvidia_vid.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- nvidia_vid.c	3 Sep 2005 19:20:51 -0000	1.27
+++ nvidia_vid.c	3 Sep 2005 19:31:10 -0000	1.28
@@ -13,6 +13,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <math.h>
 #include <inttypes.h>
 #include <unistd.h>
 
@@ -61,6 +62,14 @@
 #define NV_ARCH_20  0x20
 #define NV_ARCH_30  0x30
 
+// since no useful information whatsoever is passed
+// to the equalizer functions we need this
+static struct {
+  uint32_t lum; // luminance (brightness + contrast)
+  uint32_t chrom; // chrominance (saturation + hue)
+  vidix_video_eq_t vals;
+} eq;
+
 struct nvidia_cards {
   unsigned short chip_id;
   unsigned short arch;
@@ -556,10 +565,10 @@
 		}
 
 		/* NV_PVIDEO_LUMINANCE */
-		VID_WR32 (info->chip.PVIDEO, 0x910 + 0, 0x00001000);
+		VID_WR32 (info->chip.PVIDEO, 0x910 + 0, eq.lum);
 		//VID_WR32 (info->chip.PVIDEO, 0x910 + 4, 0x00001000);
 		/* NV_PVIDEO_CHROMINANCE */
-		VID_WR32 (info->chip.PVIDEO, 0x918 + 0, 0x00001000);
+		VID_WR32 (info->chip.PVIDEO, 0x918 + 0, eq.chrom);
 		//VID_WR32 (info->chip.PVIDEO, 0x918 + 4, 0x00001000);
 
 		/* NV_PVIDEO_OFFSET */
@@ -755,6 +764,11 @@
   info->cur_frame = 0;
   info->use_colorkey = 0;
 
+  eq.lum = 0x00001000;
+  eq.chrom = 0x00001000;
+  memset(&eq.vals, 0, sizeof(vidix_video_eq_t));
+  eq.vals.cap = VEQ_CAP_BRIGHTNESS | VEQ_CAP_CONTRAST |
+                VEQ_CAP_SATURATION | VEQ_CAP_HUE;
   return 0;
 }
 
@@ -869,3 +883,31 @@
 	  info->cur_frame = frame/*(frame+1)%info->num_frames*/;
   return 0;
 }
+
+int vixPlaybackSetEq(const vidix_video_eq_t *eq_parm) {
+  double angle;
+  int16_t chrom_cos, chrom_sin;
+  vidix_video_eq_t new_eq;
+  vixPlaybackGetEq(&new_eq);
+  if (eq_parm->cap & VEQ_CAP_BRIGHTNESS)
+    new_eq.brightness = eq_parm->brightness;
+  if (eq_parm->cap & VEQ_CAP_CONTRAST)
+    new_eq.contrast = eq_parm->contrast;
+  if (eq_parm->cap & VEQ_CAP_SATURATION)
+    new_eq.saturation = eq_parm->saturation;
+  if (eq_parm->cap & VEQ_CAP_HUE)
+    new_eq.hue = eq_parm->hue;
+  eq.lum = (((new_eq.brightness * 512 + 500) / 1000) << 16) |
+           ((((new_eq.contrast + 1000) * 8191 + 1000) / 2000) & 0xffff);
+  angle = (double)new_eq.hue / 1000.0 * 3.1415927;
+  chrom_cos = ((new_eq.saturation + 1000) * 8191 * cos(angle) + 1000) / 2000;
+  chrom_sin = ((new_eq.saturation + 1000) * 8191 * sin(angle) + 1000) / 2000;
+  eq.chrom = chrom_sin << 16 | chrom_cos;
+  return 0;
+}
+
+int vixPlaybackGetEq(vidix_video_eq_t *eq_parm) {
+  memcpy(eq_parm, &eq.vals, sizeof(vidix_video_eq_t));
+  return 0;
+}
+




More information about the MPlayer-cvslog mailing list