Tizen 2.0 Release
[framework/multimedia/gst-plugins-bad0.10.git] / gst / videoparsers / h263parse.h
1 /* GStreamer H.263 Parser
2  * Copyright (C) <2010> Arun Raghavan <arun.raghavan@collabora.co.uk>
3  * Copyright (C) <2010> Edward Hervey <edward.hervey@collabora.co.uk>
4  * Copyright (C) <2010> Collabora Multimedia
5  * Copyright (C) <2010> Nokia Corporation
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23 #ifndef __GST_H263_PARAMS_H__
24 #define __GST_H263_PARAMS_H__
25
26 #include <gst/gst.h>
27 #include <gst/base/gstadapter.h>
28
29 G_BEGIN_DECLS
30
31 typedef enum
32 {
33   PARSING = 0,
34   GOT_HEADER,
35   PASSTHROUGH
36 } H263ParseState;
37
38 /* H263 Optional Features */
39 typedef enum
40 {
41   /* Optional Unrestricted Motion Vector (UMV) mode (see Annex D) */
42   H263_OPTION_UMV_MODE = 1 << 0,
43   /* Optional Syntax-based Arithmetic Coding (SAC) mode (see Annex E) */
44   H263_OPTION_SAC_MODE = 1 << 1,
45   /* Optional Advanced Prediction mode (AP) (see Annex F) */
46   H263_OPTION_AP_MODE = 1 << 2,
47   /* Optional PB-frames mode (see Annex G) */
48   H263_OPTION_PB_MODE = 1 << 3,
49   /* Optional Advanced INTRA Coding (AIC) mode (see Annex I) */
50   H263_OPTION_AIC_MODE = 1 << 4,
51   /* Optional Deblocking Filter (DF) mode (see Annex J) */
52   H263_OPTION_DF_MODE = 1 << 5,
53   /* Optional Slice Structured (SS) mode (see Annex K) */
54   H263_OPTION_SS_MODE = 1 << 6,
55   /* Optional Reference Picture Selection (RPS) mode (see Annex N) */
56   H263_OPTION_RPS_MODE = 1 << 7,
57   /* Optional Independent Segment Decoding (ISD) mode (see Annex R) */
58   H263_OPTION_ISD_MODE = 1 << 8,
59   /* Optional Alternative INTER VLC (AIV) mode (see Annex S) */
60   H263_OPTION_AIV_MODE = 1 << 9,
61   /* Optional Modified Quantization (MQ) mode (see Annex T) */
62   H263_OPTION_MQ_MODE = 1 << 10,
63   /* Optional Reference Picture Resampling (RPR) mode (see Annex P) */
64   H263_OPTION_RPR_MODE = 1 << 11,
65   /* Optional Reduced-Resolution Update (RRU) mode (see Annex Q) */
66   H263_OPTION_RRU_MODE = 1 << 12,
67   /* Optional Enhanced Reference Picture Selection (ERPS) mode (see Annex U) */
68   H263_OPTION_ERPS_MODE = 1 << 13,
69   /* Optional Data Partitioned Slices (DPS) mode (see Annex V) */
70   H263_OPTION_DPS_MODE = 1 << 14
71 } H263OptionalFeatures;
72
73 /* H263 Picture Types */
74 typedef enum
75 {
76   PICTURE_I = 0,                /* I-picture (INTRA) Baseline */
77   PICTURE_P,                    /* P-picture (INTER) Baseline */
78   PICTURE_IMPROVED_PB,          /* Improved PB-frame (Annex M) */
79   PICTURE_B,                    /* B-picture (Annex O) */
80   PICTURE_EI,                   /* EI-picture (Annex O) */
81   PICTURE_EP,                   /* EP-picture (Annex O) */
82   PICTURE_RESERVED1,
83   PICTURE_RESERVED2,
84   PICTURE_PB                    /* PB-frame (See Annex G) */
85 } H263PictureType;
86
87 /* H263 Picture Format */
88 typedef enum
89 {
90   PICTURE_FMT_FORBIDDEN_0 = 0,
91   PICTURE_FMT_SUB_QCIF,
92   PICTURE_FMT_QCIF,
93   PICTURE_FMT_CIF,
94   PICTURE_FMT_4CIF,
95   PICTURE_FMT_16CIF,
96   PICTURE_FMT_RESERVED1,
97   PICTURE_FMT_EXTENDEDPTYPE
98 } H263PictureFormat;
99
100 typedef enum
101 {
102   UUI_ABSENT = 0,
103   UUI_IS_1,
104   UUI_IS_01,
105 } H263UUI;
106
107
108 typedef struct _H263Params H263Params;
109
110 struct _H263Params
111 {
112   guint32 temporal_ref;
113
114   H263OptionalFeatures features;
115
116   gboolean splitscreen;
117   gboolean documentcamera;
118   gboolean fullpicturefreezerelease;
119   gboolean custompcfpresent;
120   H263UUI uui;
121   guint8 sss;
122
123   H263PictureFormat format;
124
125   H263PictureType type;
126
127   guint32 width;
128   guint32 height;
129   guint8 parnum, pardenom;
130   gint32 pcfnum, pcfdenom;
131 };
132
133 gboolean      gst_h263_parse_is_delta_unit (const H263Params * params);
134
135 GstFlowReturn gst_h263_parse_get_params    (H263Params       * params_p,
136                                             GstBuffer        * buffer,
137                                             gboolean           fast,
138                                             H263ParseState   * state);
139
140 void          gst_h263_parse_get_framerate (const H263Params * params,
141                                             gint             * num,
142                                             gint             * denom);
143
144 gint          gst_h263_parse_get_profile   (const H263Params * params);
145
146 gint          gst_h263_parse_get_level     (const H263Params * params,
147                                             gint               profile,
148                                             guint              bitrate,
149                                             gint               fps_num,
150                                             gint               fps_denom);
151
152 G_END_DECLS
153 #endif