summaryrefslogtreecommitdiff
path: root/quantize.h
diff options
context:
space:
mode:
authorAndreas Regel <andreas.regel@powarman.de>2004-01-28 19:11:00 +0100
committerAndreas Regel <andreas.regel@powarman.de>2004-01-28 19:11:00 +0100
commit64fe6b70d0a5b34a80ff458fbf1664018d5c0182 (patch)
tree4fe036adaf90fef0d0dc910b84dbc11269e40008 /quantize.h
parent310f5b2a62343d0c9b7624c09efe35828785ef26 (diff)
downloadvdr-plugin-osdpip-0.0.3.tar.gz
vdr-plugin-osdpip-0.0.3.tar.bz2
Release version 0.0.3v0.0.3
- new TS->ES remuxer: now using VDR's cRemux for TS->PES and some own code for PES->ES - now using libavcodec from ffmpeg instead of mpeg2dec - frames to decode configurable (I-frames, I-/P-frames, all frames) - frame dropping configurable - added new color depths: - 128 shades greyscale - 128 colors with variable palette using Wu's quantizer (patch needed) - changed osd size setting to 6 configurable values
Diffstat (limited to 'quantize.h')
-rw-r--r--quantize.h96
1 files changed, 96 insertions, 0 deletions
diff --git a/quantize.h b/quantize.h
new file mode 100644
index 0000000..389090b
--- /dev/null
+++ b/quantize.h
@@ -0,0 +1,96 @@
+/*
+ * OSD Picture in Picture plugin for the Video Disk Recorder
+ *
+ * See the README file for copyright information and how to reach the author.
+ */
+
+#ifndef VDR_OSDPIP_QUANTIZE_H
+#define VDR_OSDPIP_QUANTIZE_H
+
+#define MAXCOLOR 256
+
+class cQuantize
+{
+protected:
+ unsigned int paletteOutput[MAXCOLOR];
+ unsigned char imageOutput[1024*1024];
+public:
+ cQuantize();
+ virtual ~cQuantize();
+ virtual int Quantize(unsigned char * input, int size, int colors) = 0;
+ unsigned int * OutputPalette() { return paletteOutput; }
+ unsigned char * OutputImage() { return imageOutput; }
+};
+
+class cQuantizeFixed : public cQuantize
+{
+private:
+ unsigned char * imageInput;
+ int imageSize;
+
+ unsigned char redLevels[32];
+ unsigned char greenLevels[32];
+ unsigned char blueLevels[32];
+ int redLevelCount;
+ int greenLevelCount;
+ int blueLevelCount;
+public:
+ cQuantizeFixed();
+ virtual ~cQuantizeFixed();
+ virtual int Quantize(unsigned char * input, int size, int colors);
+};
+
+#define RED 2
+#define GREEN 1
+#define BLUE 0
+
+//#define NOINVERT // RGB or BGR
+
+struct box
+{
+ int r0;
+ int r1;
+ int g0;
+ int g1;
+ int b0;
+ int b1;
+ int vol;
+};
+
+// Histogram is in elements 1..HISTSIZE along each axis,
+// element 0 is for base or marginal value.
+// NB: these must start out 0!
+#define BOX 33
+
+class cQuantizeWu : public cQuantize
+{
+private:
+ long wt[BOX][BOX][BOX];
+ long mr[BOX][BOX][BOX];
+ long mg[BOX][BOX][BOX];
+ long mb[BOX][BOX][BOX];
+ float m2[BOX][BOX][BOX];
+
+ unsigned short * Qadd;
+
+ unsigned char * imageInput;
+ int imageSize;
+ int palSize;
+
+ void Hist3d(long *vwt, long *vmr, long *vmg, long *vmb, float *m_2);
+ void Momt3d(long *vwt, long *vmr, long *vmg, long *vmb, float *m_2);
+ int Cut(struct box * set1, struct box * set2);
+ long Vol(struct box * cube, long mmt[BOX][BOX][BOX]);
+ float Maximize(struct box * cube, unsigned char dir, int first, int last, int * cut, long whole_r, long whole_g, long whole_b, long whole_w);
+ float Var(struct box * cube);
+ long Top(struct box * cube, unsigned char dir, int pos, long mmt[BOX][BOX][BOX]);
+ long Bottom(struct box * cube, unsigned char dir, long mmt[BOX][BOX][BOX]);
+ void Mark(struct box * cube, int label, unsigned char * tag);
+public:
+ cQuantizeWu();
+ virtual ~cQuantizeWu();
+ virtual int Quantize(unsigned char * input, int size, int colors);
+};
+
+#endif // VDR_OSDPIP_QUANTIZE_H
+