1 /*
2 * encoder-h261.h --
3 *
4 * H.261 video encoder header file
5 *
6 * Copyright (c) 1994-2002 The Regents of the University of California.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 * A. Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 * B. Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 * C. Neither the names of the copyright holders nor the names of its
18 * contributors may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
22 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 //static const char rcsid[] =
35 // "@(#) $Header: /usr/mash/src/repository/mash/mash-1/codec/encoder-h261.h,v 1.5 2002/02/06 00:55:50 chema Exp $";
36
37 #ifdef INT_64
38 #define NBIT 64
39 #define BB_INT INT_64
40 #else
41 #define NBIT 32
42 #define BB_INT u_int
43 #endif
44
45 class H261Encoder : public EncoderModule {
46 public:
47 void setq(int q);
48 protected:
49 H261Encoder();
50 ~H261Encoder();
51 virtual void encode(const VideoFrame*, const u_int8_t *crvec);
52 int command(int argc, const char*const* argv);
53 void encode_blk(const short* blk, const char* lm);
54 virtual int flush(pktbuf* pb, int nbit, pktbuf* npb);
55 char* make_level_map(int q, u_int fthresh);
56 void setquantizers(int lq, int mq, int hq);
57
58 virtual void size(int w, int h) = 0;
59 virtual void encode_mb(u_int mba, const u_char* frm,
60 u_int loff, u_int coff, int how) = 0;
61
62 /* bit buffer */
63 BB_INT bb_;
64 u_int nbb_;
65
66 u_char* bs_;
67 u_char* bc_;
68 int sbit_;
69
70 u_char lq_; /* low quality quantizer */
71 u_char mq_; /* medium quality quantizer */
72 u_char hq_; /* high quality quantizer */
73 u_char mquant_; /* the last quantizer we sent to other side */
74 int quant_required_; /* 1 if not quant'd in dct */
75 u_int ngob_;
76 u_int mba_;
77
78 u_int cif_; /* 1 for CIF, 0 for QCIF */
79 u_int bstride_;
80 u_int lstride_;
81 u_int cstride_;
82
83 u_int loffsize_; /* amount of 1 luma block */
84 u_int coffsize_; /* amount of 1 chroma block */
85 u_int bloffsize_; /* amount of 1 block advance */
86
87 char* llm_[32]; /* luma dct val -> level maps */
88 char* clm_[32]; /* chroma dct val -> level maps */
89
90 float lqt_[64]; /* low quality quantizer */
91 float mqt_[64]; /* medium quality quantizer */
92 float hqt_[64]; /* high quality quantizer */
93
94 u_int coff_[12]; /* where to find U given gob# */
95 u_int loff_[12]; /* where to find Y given gob# */
96 u_int blkno_[12]; /* for CR */
97 };
98
99
100 class H261DCTEncoder : public H261Encoder {
101 public:
102 H261DCTEncoder();
103 void recv(Buffer*);
104 void size(int w, int h);
105 protected:
106 void encode_mb(u_int mba, const u_char* frm,
107 u_int loff, u_int coff, int how);
108 };
109
110 class H261PixelEncoder : public H261Encoder {
111 public:
112 H261PixelEncoder();
113 void recv(Buffer*);
114 void size(int w, int h);
115 protected:
116 void encode_mb(u_int mba, const u_char* frm,
117 u_int loff, u_int coff, int how);
118 };
119
120 static class H261PixelEncoderClass : public TclClass {
121 public:
122 H261PixelEncoderClass() : TclClass("Module/VideoEncoder/Pixel/H261") {}
123 TclObject* create(int /* argc */, const char*const* /* argv */) {
124 return (new H261PixelEncoder);
125 }
126 } matcher_pixel;
127
128
129 static class H261DCTEncoderClass : public TclClass {
130 public:
131 H261DCTEncoderClass() : TclClass("Module/VideoEncoder/DCT/H261") {}
132 TclObject* create(int /* argc */, const char*const* /* argv */) {
133 return (new H261DCTEncoder);
134 }
135 } matcher_dct;
136
137
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.