~ubuntu-branches/ubuntu/lucid/gst-plugins-bad0.10/lucid-proposed

« back to all changes in this revision

Viewing changes to ext/cog/cogframe.h

  • Committer: Bazaar Package Importer
  • Author(s): Tony Espy
  • Date: 2009-12-04 13:17:51 UTC
  • mfrom: (18.4.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091204131751-hpo02yltrcsmy1xh
Tags: 0.10.17-1ubuntu1
* Merge from Debian testing (LP: #481645), remaining changes:
  - Removed plugins that are now provided -good
    - libgstdtmf.so
    - libgstvalve.so
    - libgstautoconvert.so
    - libgstrtpmux.so
    - libgstliveadder.so

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#ifndef __COG_FRAME_H__
 
3
#define __COG_FRAME_H__
 
4
 
 
5
#include <cog/cogutils.h>
 
6
 
 
7
COG_BEGIN_DECLS
 
8
 
 
9
typedef struct _CogFrame CogFrame;
 
10
typedef struct _CogFrameData CogFrameData;
 
11
typedef struct _CogUpsampledFrame CogUpsampledFrame;
 
12
 
 
13
typedef void (*CogFrameFreeFunc)(CogFrame *frame, void *priv);
 
14
typedef void (*CogFrameRenderFunc)(CogFrame *frame, void *dest, int component, int i);
 
15
 
 
16
typedef enum _CogColorMatrix {
 
17
  COG_COLOR_MATRIX_UNKNOWN = 0,
 
18
  COG_COLOR_MATRIX_HDTV,
 
19
  COG_COLOR_MATRIX_SDTV
 
20
} CogColorMatrix;
 
21
 
 
22
/* bit pattern:
 
23
 *  0x100 - 0: normal, 1: indirect (packed)
 
24
 *  0x001 - horizontal chroma subsampling: 0: 1, 1: 2
 
25
 *  0x002 - vertical chroma subsampling: 0: 1, 1: 2
 
26
 *  0x00c - depth: 0: u8, 1: s16, 2: s32
 
27
 *  */
 
28
typedef enum _CogFrameFormat {
 
29
  COG_FRAME_FORMAT_U8_444 = 0x00,
 
30
  COG_FRAME_FORMAT_U8_422 = 0x01,
 
31
  COG_FRAME_FORMAT_U8_420 = 0x03,
 
32
 
 
33
  COG_FRAME_FORMAT_S16_444 = 0x04,
 
34
  COG_FRAME_FORMAT_S16_422 = 0x05,
 
35
  COG_FRAME_FORMAT_S16_420 = 0x07,
 
36
 
 
37
  COG_FRAME_FORMAT_S32_444 = 0x08,
 
38
  COG_FRAME_FORMAT_S32_422 = 0x09,
 
39
  COG_FRAME_FORMAT_S32_420 = 0x0b,
 
40
 
 
41
  /* indirectly supported */
 
42
  COG_FRAME_FORMAT_YUYV = 0x100, /* YUYV order */
 
43
  COG_FRAME_FORMAT_UYVY = 0x101, /* UYVY order */
 
44
  COG_FRAME_FORMAT_AYUV = 0x102,
 
45
  COG_FRAME_FORMAT_RGB = 0x104,
 
46
  COG_FRAME_FORMAT_v216 = 0x105,
 
47
  COG_FRAME_FORMAT_v210 = 0x106,
 
48
  COG_FRAME_FORMAT_RGBx = 0x110,
 
49
  COG_FRAME_FORMAT_xRGB = 0x111,
 
50
  COG_FRAME_FORMAT_BGRx = 0x112,
 
51
  COG_FRAME_FORMAT_xBGR = 0x113,
 
52
  COG_FRAME_FORMAT_RGBA = 0x114,
 
53
  COG_FRAME_FORMAT_ARGB = 0x115,
 
54
  COG_FRAME_FORMAT_BGRA = 0x116,
 
55
  COG_FRAME_FORMAT_ABGR = 0x117,
 
56
} CogFrameFormat;
 
57
 
 
58
#define COG_FRAME_FORMAT_DEPTH(format) ((format) & 0xc)
 
59
#define COG_FRAME_FORMAT_DEPTH_U8 0x00
 
60
#define COG_FRAME_FORMAT_DEPTH_S16 0x04
 
61
#define COG_FRAME_FORMAT_DEPTH_S32 0x08
 
62
 
 
63
#define COG_FRAME_FORMAT_H_SHIFT(format) ((format) & 0x1)
 
64
#define COG_FRAME_FORMAT_V_SHIFT(format) (((format)>>1) & 0x1)
 
65
 
 
66
#define COG_FRAME_IS_PACKED(format) (((format)>>8) & 0x1)
 
67
 
 
68
#define COG_FRAME_CACHE_SIZE 8
 
69
 
 
70
struct _CogFrameData {
 
71
  CogFrameFormat format;
 
72
  void *data;
 
73
  int stride;
 
74
  int width;
 
75
  int height;
 
76
  int length;
 
77
  int h_shift;
 
78
  int v_shift;
 
79
};
 
80
 
 
81
struct _CogFrame {
 
82
  int refcount;
 
83
  CogFrameFreeFunc free;
 
84
  CogMemoryDomain *domain;
 
85
  void *regions[3];
 
86
  void *priv;
 
87
 
 
88
  CogFrameFormat format;
 
89
  int width;
 
90
  int height;
 
91
 
 
92
  CogFrameData components[3];
 
93
 
 
94
  int is_virtual;
 
95
  int cache_offset[3];
 
96
  int cached_lines[3][COG_FRAME_CACHE_SIZE];
 
97
  CogFrame *virt_frame1;
 
98
  CogFrame *virt_frame2;
 
99
  void (*render_line) (CogFrame *frame, void *dest, int component, int i);
 
100
  void *virt_priv;
 
101
  void *virt_priv2;
 
102
  int param1;
 
103
  int param2;
 
104
 
 
105
  int extension;
 
106
};
 
107
 
 
108
struct _CogUpsampledFrame {
 
109
  CogFrame *frames[4];
 
110
  void *components[3];
 
111
};
 
112
 
 
113
#define COG_FRAME_DATA_GET_LINE(fd,i) (COG_OFFSET((fd)->data,(fd)->stride*(i)))
 
114
#define COG_FRAME_DATA_GET_PIXEL_U8(fd,i,j) ((uint8_t *)COG_OFFSET((fd)->data,(fd)->stride*(j)+(i)))
 
115
#define COG_FRAME_DATA_GET_PIXEL_S16(fd,i,j) ((int16_t *)COG_OFFSET((fd)->data,(fd)->stride*(j)+(i)*sizeof(int16_t)))
 
116
 
 
117
CogFrame * cog_frame_new (void);
 
118
CogFrame * cog_frame_new_and_alloc (CogMemoryDomain *domain,
 
119
    CogFrameFormat format, int width, int height);
 
120
CogFrame * cog_frame_new_from_data_I420 (void *data, int width, int height);
 
121
CogFrame * cog_frame_new_from_data_YV12 (void *data, int width, int height);
 
122
CogFrame * cog_frame_new_from_data_YUY2 (void *data, int width, int height);
 
123
CogFrame * cog_frame_new_from_data_UYVY (void *data, int width, int height);
 
124
CogFrame * cog_frame_new_from_data_UYVY_full (void *data, int width, int height, int stride);
 
125
CogFrame * cog_frame_new_from_data_AYUV (void *data, int width, int height);
 
126
CogFrame * cog_frame_new_from_data_v216 (void *data, int width, int height);
 
127
CogFrame * cog_frame_new_from_data_v210 (void *data, int width, int height);
 
128
CogFrame * cog_frame_new_from_data_Y42B (void *data, int width, int height);
 
129
CogFrame * cog_frame_new_from_data_Y444 (void *data, int width, int height);
 
130
CogFrame * cog_frame_new_from_data_RGB (void *data, int width, int height);
 
131
CogFrame * cog_frame_new_from_data_RGBx (void *data, int width, int height);
 
132
CogFrame * cog_frame_new_from_data_xRGB (void *data, int width, int height);
 
133
CogFrame * cog_frame_new_from_data_BGRx (void *data, int width, int height);
 
134
CogFrame * cog_frame_new_from_data_xBGR (void *data, int width, int height);
 
135
CogFrame * cog_frame_new_from_data_RGBA (void *data, int width, int height);
 
136
CogFrame * cog_frame_new_from_data_ARGB (void *data, int width, int height);
 
137
CogFrame * cog_frame_new_from_data_BGRA (void *data, int width, int height);
 
138
CogFrame * cog_frame_new_from_data_ABGR (void *data, int width, int height);
 
139
void cog_frame_set_free_callback (CogFrame *frame,
 
140
    CogFrameFreeFunc free_func, void *priv);
 
141
void cog_frame_unref (CogFrame *frame);
 
142
CogFrame *cog_frame_ref (CogFrame *frame);
 
143
CogFrame *cog_frame_dup (CogFrame *frame);
 
144
CogFrame *cog_frame_clone (CogMemoryDomain *domain, CogFrame *frame);
 
145
 
 
146
void cog_frame_convert (CogFrame *dest, CogFrame *src);
 
147
void cog_frame_add (CogFrame *dest, CogFrame *src);
 
148
void cog_frame_subtract (CogFrame *dest, CogFrame *src);
 
149
void cog_frame_shift_left (CogFrame *frame, int shift);
 
150
void cog_frame_shift_right (CogFrame *frame, int shift);
 
151
 
 
152
//void cog_frame_downsample (CogFrame *dest, CogFrame *src);
 
153
void cog_frame_upsample_horiz (CogFrame *dest, CogFrame *src);
 
154
void cog_frame_upsample_vert (CogFrame *dest, CogFrame *src);
 
155
double cog_frame_calculate_average_luma (CogFrame *frame);
 
156
 
 
157
CogFrame * cog_frame_convert_to_444 (CogFrame *frame);
 
158
void cog_frame_md5 (CogFrame *frame, uint32_t *state);
 
159
 
 
160
CogFrame * cog_frame_new_and_alloc_extended (CogMemoryDomain *domain,
 
161
    CogFrameFormat format, int width, int height, int extension);
 
162
CogFrame *cog_frame_dup_extended (CogFrame *frame, int extension);
 
163
void cog_frame_edge_extend (CogFrame *frame, int width, int height);
 
164
void cog_frame_zero_extend (CogFrame *frame, int width, int height);
 
165
void cog_frame_mark (CogFrame *frame, int value);
 
166
void cog_frame_mc_edgeextend (CogFrame *frame);
 
167
 
 
168
void cog_frame_data_get_codeblock (CogFrameData *dest, CogFrameData *src,
 
169
        int x, int y, int horiz_codeblocks, int vert_codeblocks);
 
170
 
 
171
CogUpsampledFrame * cog_upsampled_frame_new (CogFrame *frame);
 
172
void cog_upsampled_frame_free (CogUpsampledFrame *df);
 
173
void cog_upsampled_frame_upsample (CogUpsampledFrame *df);
 
174
#ifdef ENABLE_MOTION_REF
 
175
int cog_upsampled_frame_get_pixel_prec0 (CogUpsampledFrame *upframe, int k,
 
176
    int x, int y);
 
177
int cog_upsampled_frame_get_pixel_prec1 (CogUpsampledFrame *upframe, int k,
 
178
    int x, int y);
 
179
int cog_upsampled_frame_get_pixel_prec3 (CogUpsampledFrame *upframe, int k,
 
180
    int x, int y);
 
181
int cog_upsampled_frame_get_pixel_precN (CogUpsampledFrame *upframe, int k,
 
182
    int x, int y, int mv_precision);
 
183
#endif
 
184
void cog_upsampled_frame_get_block_precN (CogUpsampledFrame *upframe, int k,
 
185
    int x, int y, int prec, CogFrameData *dest);
 
186
void cog_upsampled_frame_get_block_fast_precN (CogUpsampledFrame *upframe, int k,
 
187
    int x, int y, int prec, CogFrameData *dest, CogFrameData *fd);
 
188
void cog_upsampled_frame_get_subdata_prec0 (CogUpsampledFrame *upframe,
 
189
    int k, int x, int y, CogFrameData *fd);
 
190
void cog_upsampled_frame_get_subdata_prec1 (CogUpsampledFrame *upframe,
 
191
    int k, int x, int y, CogFrameData *fd);
 
192
 
 
193
void cog_frame_get_subdata (CogFrame *frame, CogFrameData *fd,
 
194
        int comp, int x, int y);
 
195
 
 
196
void cog_frame_split_fields (CogFrame *dest1, CogFrame *dest2, CogFrame *src);
 
197
 
 
198
 
 
199
COG_END_DECLS
 
200
 
 
201
#endif
 
202