diff options
author | woro <woro@e10066b5-e1e2-0310-b819-94efdf66514b> | 2008-04-11 20:11:00 +0000 |
---|---|---|
committer | woro <woro@e10066b5-e1e2-0310-b819-94efdf66514b> | 2008-04-11 20:11:00 +0000 |
commit | 57d7ee812c8be1bd118471512682cb3393ce595f (patch) | |
tree | 2e0d792fc74eda1661b439853c004e2ed5c06820 /quantize.h | |
parent | b2550195d6b61f9be3470679082b8d6b5159aa83 (diff) | |
download | vdr-plugin-muggle-57d7ee812c8be1bd118471512682cb3393ce595f.tar.gz vdr-plugin-muggle-57d7ee812c8be1bd118471512682cb3393ce595f.tar.bz2 |
merge mp3ng branch into trunk
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@1173 e10066b5-e1e2-0310-b819-94efdf66514b
Diffstat (limited to 'quantize.h')
-rw-r--r-- | quantize.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/quantize.h b/quantize.h new file mode 100644 index 0000000..737d234 --- /dev/null +++ b/quantize.h @@ -0,0 +1,70 @@ +#ifndef VDR_GRAPHTFT_QUANTIZE_H +#define VDR_GRAPHTFT_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; } +}; + +#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_GRAPHTFT_QUANTIZE_H |