summaryrefslogtreecommitdiffstats
path: root/mpeglib/lib/util/render/dither/ditherWrapper.h
blob: b01abff80d162564d1405bbc09293283151bfc90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
  wrapper for X11 Window
  Copyright (C) 1999  Martin Vogt

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU Library General Public License as published by
  the Free Software Foundation.

  For more information look at the file COPYRIGHT in this package

 */


#ifndef __DITHERWRAPPER_H
#define __DITHERWRAPPER_H

 
#include "../../mmx/mmx.h"

#include "../yuvPicture.h"
#include "../imageBase.h"
#include <stdlib.h>
#include "ditherMMX.h"
#include "dither8Bit.h"
#include "dither16Bit.h"
#include "dither32Bit.h"
#include "ditherRGB_flipped.h"
#include "ditherRGB.h"


/**
   Wraps all calls to software ditherer and the different 
   resolutions,mmx enhancements, and doublesize ditherers.
*/


class DitherWrapper {

  int lmmx;

  int bpp;
  // colorMask
  unsigned int redMask;
  unsigned int greenMask;
  unsigned int blueMask;

  Dither8Bit* dither8Bit;
  Dither16Bit* dither16Bit;
  Dither32Bit* dither32Bit;
  DitherRGB_flipped* ditherRGB_flipped;
  DitherRGB* ditherRGB;
  
 public:
  DitherWrapper(int bpp,unsigned int redMask,
		unsigned int greenMask,unsigned int blueMask,
		unsigned char pixel[256]);
  ~DitherWrapper();
  
/*    int getDitherSize(); */
/*    void setDitherSize(int ditherMode); */

  void doDither(YUVPicture* pic,int depth,int imageMode,
		unsigned char* dest,int offset);
  

 private:
  void doDitherYUV(YUVPicture* pic,int depth,int imageMode,
		   unsigned char* dest,int offset);
  void doDitherRGB(YUVPicture* pic,int depth,int imageMode,
		   unsigned char* dest,int offset);
  void doDitherRGB_NORMAL(YUVPicture* pic,int depth,int imageMode,
			  unsigned char* dest,int offset);
  void doDitherRGB_FLIPPED(YUVPicture* pic,int depth,int imageMode,
			   unsigned char* dest,int offset);
     
  void doDither_std(YUVPicture* pic,int depth,unsigned char* dest,int offset);
  void doDither_x2(YUVPicture* pic,int depth,unsigned char* dest,int offset);
};

#endif