summaryrefslogtreecommitdiffstats
path: root/mpeglib/lib/mpegplay/decoderClass.h
blob: 2e969edc0f9f6bce5109ca8b438a05b9af1c8927 (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
  class for decoders
  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 __DECODERCLASS_H
#define __DECODERCLASS_H


 
#include "videoDecoder.h"
#include "mpegVideoStream.h"
#include "decoderTables.h"
#include "slice.h"
#include "proto.h"
#include "../util/mmx/mmx.h"
#include "mmxidct.h"
#include "picture.h"

/* Special values for DCT Coefficients */
#define END_OF_BLOCK 62
#define ESCAPE 61


/* DCT coeff tables. */
#define RUN_MASK 0xfc00
#define LEVEL_MASK 0x03f0
#define NUM_MASK 0x000f
#define RUN_SHIFT 10
#define LEVEL_SHIFT 4
#define RUNTYPE char

class DecoderClass {

  int lmmx;
  int zigzag_direct[256];

  /* Block structure. */

  short int dct_recon[8][8];             /* Reconstructed dct coeff matrix. */
  int dct_dc_y_past;                     /* Past lum. dc dct coefficient.   */
  int dct_dc_cr_past;                    /* Past cr dc dct coefficient.     */
  int dct_dc_cb_past;                    /* Past cb dc dct coefficient.     */
  short int *reconptr;                   /* reconptr = dct_recon[0];        */

  class VideoDecoder* vid_stream;
  class MpegVideoStream* mpegVideoStream;
 public:
  DecoderClass(class VideoDecoder* vid_stream,
	       class MpegVideoStream* mpegVideoStream);
  ~DecoderClass();
  int decodeDCTDCSizeLum();
  int decodeDCTDCSizeChrom();
  int decodeMotionVectors();
  int decodeCBP();

  inline short int* getDCT() { return ((short int*) &(dct_recon[0][0]));}
  void resetDCT();

  void decodeMBTypeB(int& quant,int& motion_fwd,
		     int& motion_bwd,int& pat,int& intra);

  void decodeMBTypeI(int& quant,int& motion_fwd,
		     int& motion_bwd,int& pat,int& intra);
  
  void decodeMBTypeP(int& quant,int& motion_fwd,
		     int& motion_bwd,int& pat,int& intra);

  void ParseReconBlock(int& n,int& mb_intra,unsigned int& quant_scale,
		       int& lflag,
		       unsigned int* iqmatrixptr,
		       unsigned int* niqmatrixptr);
  int decodeMBAddrInc();


  void print();

 private:


  inline void decodeDCTCoeff(unsigned short int* dct_coeff_tbl,
			     unsigned RUNTYPE& run,
			     int& level);

 

};
#endif