Mercurial > mplayer.hg
comparison vidix/drivers/nvidia_vid.c @ 16380:73afe41bb7c3
equalizer support
author | reimar |
---|---|
date | Sat, 03 Sep 2005 19:31:10 +0000 |
parents | 430ca60471ba |
children | fa804efbfaf6 |
comparison
equal
deleted
inserted
replaced
16379:cdd8c0dfc19b | 16380:73afe41bb7c3 |
---|---|
11 | 11 |
12 #include <errno.h> | 12 #include <errno.h> |
13 #include <stdio.h> | 13 #include <stdio.h> |
14 #include <stdlib.h> | 14 #include <stdlib.h> |
15 #include <string.h> | 15 #include <string.h> |
16 #include <math.h> | |
16 #include <inttypes.h> | 17 #include <inttypes.h> |
17 #include <unistd.h> | 18 #include <unistd.h> |
18 | 19 |
19 | 20 |
20 #include "../vidix.h" | 21 #include "../vidix.h" |
58 #define NV_ARCH_03 0x03 | 59 #define NV_ARCH_03 0x03 |
59 #define NV_ARCH_04 0x04 | 60 #define NV_ARCH_04 0x04 |
60 #define NV_ARCH_10 0x10 | 61 #define NV_ARCH_10 0x10 |
61 #define NV_ARCH_20 0x20 | 62 #define NV_ARCH_20 0x20 |
62 #define NV_ARCH_30 0x30 | 63 #define NV_ARCH_30 0x30 |
64 | |
65 // since no useful information whatsoever is passed | |
66 // to the equalizer functions we need this | |
67 static struct { | |
68 uint32_t lum; // luminance (brightness + contrast) | |
69 uint32_t chrom; // chrominance (saturation + hue) | |
70 vidix_video_eq_t vals; | |
71 } eq; | |
63 | 72 |
64 struct nvidia_cards { | 73 struct nvidia_cards { |
65 unsigned short chip_id; | 74 unsigned short chip_id; |
66 unsigned short arch; | 75 unsigned short arch; |
67 }; | 76 }; |
554 VID_WR32 (info->chip.PVIDEO, 0x808 + 0, base + offset + size - 1); | 563 VID_WR32 (info->chip.PVIDEO, 0x808 + 0, base + offset + size - 1); |
555 //VID_WR32 (info->chip.PVIDEO, 0x808 + 4, base + size - 1); | 564 //VID_WR32 (info->chip.PVIDEO, 0x808 + 4, base + size - 1); |
556 } | 565 } |
557 | 566 |
558 /* NV_PVIDEO_LUMINANCE */ | 567 /* NV_PVIDEO_LUMINANCE */ |
559 VID_WR32 (info->chip.PVIDEO, 0x910 + 0, 0x00001000); | 568 VID_WR32 (info->chip.PVIDEO, 0x910 + 0, eq.lum); |
560 //VID_WR32 (info->chip.PVIDEO, 0x910 + 4, 0x00001000); | 569 //VID_WR32 (info->chip.PVIDEO, 0x910 + 4, 0x00001000); |
561 /* NV_PVIDEO_CHROMINANCE */ | 570 /* NV_PVIDEO_CHROMINANCE */ |
562 VID_WR32 (info->chip.PVIDEO, 0x918 + 0, 0x00001000); | 571 VID_WR32 (info->chip.PVIDEO, 0x918 + 0, eq.chrom); |
563 //VID_WR32 (info->chip.PVIDEO, 0x918 + 4, 0x00001000); | 572 //VID_WR32 (info->chip.PVIDEO, 0x918 + 4, 0x00001000); |
564 | 573 |
565 /* NV_PVIDEO_OFFSET */ | 574 /* NV_PVIDEO_OFFSET */ |
566 VID_WR32 (info->chip.PVIDEO, 0x920 + 0, 0x0); | 575 VID_WR32 (info->chip.PVIDEO, 0x920 + 0, 0x0); |
567 //VID_WR32 (info->chip.PVIDEO, 0x920 + 4, offset + pitch); | 576 //VID_WR32 (info->chip.PVIDEO, 0x920 + 4, offset + pitch); |
753 | 762 |
754 rivatv_enable_PMEDIA(info); | 763 rivatv_enable_PMEDIA(info); |
755 info->cur_frame = 0; | 764 info->cur_frame = 0; |
756 info->use_colorkey = 0; | 765 info->use_colorkey = 0; |
757 | 766 |
767 eq.lum = 0x00001000; | |
768 eq.chrom = 0x00001000; | |
769 memset(&eq.vals, 0, sizeof(vidix_video_eq_t)); | |
770 eq.vals.cap = VEQ_CAP_BRIGHTNESS | VEQ_CAP_CONTRAST | | |
771 VEQ_CAP_SATURATION | VEQ_CAP_HUE; | |
758 return 0; | 772 return 0; |
759 } | 773 } |
760 | 774 |
761 void vixDestroy(void){ | 775 void vixDestroy(void){ |
762 unmap_phys_mem(info->control_base ,0x00C00000 + 0x00008000); | 776 unmap_phys_mem(info->control_base ,0x00C00000 + 0x00008000); |
867 rivatv_overlay_start(info, frame); | 881 rivatv_overlay_start(info, frame); |
868 if (info->num_frames >= 1) | 882 if (info->num_frames >= 1) |
869 info->cur_frame = frame/*(frame+1)%info->num_frames*/; | 883 info->cur_frame = frame/*(frame+1)%info->num_frames*/; |
870 return 0; | 884 return 0; |
871 } | 885 } |
886 | |
887 int vixPlaybackSetEq(const vidix_video_eq_t *eq_parm) { | |
888 double angle; | |
889 int16_t chrom_cos, chrom_sin; | |
890 vidix_video_eq_t new_eq; | |
891 vixPlaybackGetEq(&new_eq); | |
892 if (eq_parm->cap & VEQ_CAP_BRIGHTNESS) | |
893 new_eq.brightness = eq_parm->brightness; | |
894 if (eq_parm->cap & VEQ_CAP_CONTRAST) | |
895 new_eq.contrast = eq_parm->contrast; | |
896 if (eq_parm->cap & VEQ_CAP_SATURATION) | |
897 new_eq.saturation = eq_parm->saturation; | |
898 if (eq_parm->cap & VEQ_CAP_HUE) | |
899 new_eq.hue = eq_parm->hue; | |
900 eq.lum = (((new_eq.brightness * 512 + 500) / 1000) << 16) | | |
901 ((((new_eq.contrast + 1000) * 8191 + 1000) / 2000) & 0xffff); | |
902 angle = (double)new_eq.hue / 1000.0 * 3.1415927; | |
903 chrom_cos = ((new_eq.saturation + 1000) * 8191 * cos(angle) + 1000) / 2000; | |
904 chrom_sin = ((new_eq.saturation + 1000) * 8191 * sin(angle) + 1000) / 2000; | |
905 eq.chrom = chrom_sin << 16 | chrom_cos; | |
906 return 0; | |
907 } | |
908 | |
909 int vixPlaybackGetEq(vidix_video_eq_t *eq_parm) { | |
910 memcpy(eq_parm, &eq.vals, sizeof(vidix_video_eq_t)); | |
911 return 0; | |
912 } | |
913 |